本文整理汇总了C++中Initial函数的典型用法代码示例。如果您正苦于以下问题:C++ Initial函数的具体用法?C++ Initial怎么用?C++ Initial使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Initial函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Open
int CSMDevice::Open()
{
if(Initial() != 0)
return 1;
hMapFile = CreateFileMapping(
INVALID_HANDLE_VALUE, // use paging file
NULL, // default security
PAGE_READWRITE, // read/write access
0, // maximum object size (high-order DWORD)
this->gComm_SMsize, // maximum object size (low-order DWORD)
this->gComm_SMName); // name of mapping object
if (hMapFile == NULL)
{
MessageBox(NULL, TEXT("CreateFileMapping Fail"), TEXT("CSMDevice::Open"), MB_OK);
return 2;
}
pBuf = (unsigned short*) MapViewOfFile(hMapFile, // handle to map object
FILE_MAP_ALL_ACCESS, // read/write permission
0,
0,
this->gComm_SMsize);
if (pBuf == NULL)
{
MessageBox(NULL, TEXT("MapViewOfFile Fail"), TEXT("CSMDevice::Open"), MB_OK);
CloseHandle(hMapFile);
return 3;
}
return 0;
}
示例2: main
void main()
{
Initial(); //Initialize all settings required for general QwikFlash and LCD operation
DisplayC(Clear1); //Clear the LCD one time at the beginning of your program
DisplayC(Clear2);
//Your personal PORT/TRIS/ADCON/etc settings or configurations can go here
//Or make your own function and call it
TRISBbits.RB0 = 1; // set PortB0 as input port
TRISBbits.RB1 = 1; // set PortB1 as input port
TRISBbits.RB2 = 1; // set PortB2 as input port
TRISBbits.RB3 = 1; // set PortB3 as input port
T0CON = 0b00000101; // timer 0 configuration register bit settings
INTCON = 0b00110000; // interrupt configuration register bit settings
INTCON2 = 0b11110000; // interrupt configuration register 2 bit settings
INTCON3 = 0b00001000; // interrupt configuration register 3 bit settings
RCON = 0b10000000;
TMR0H = 0x67; // Load preload value in timer 0 in high byte
TMR0L = 0x69; // Load preload value in timer 0 in low byte
INTCONbits.PEIE = 1; // Set PEIE enable bit
INTCONbits.GIE = 1; // GIE enable bit
T0CONbits.TMR0ON = 1; // turn timer 0 on
while (1)
{
// switch1 is a flag that is set from the low
// priority interrupt
if (switch1)
{
DisplayC(pause1); // display the pause symbol
Str_2[1] = 0x03;
}
else
{
DisplayC(play1); // display the play symbol
Str_2[1] = 0x04;
}
// if switch 1, switch 2, and pushbutton 1 are set
// then increment timer
if (switch1 == 1 && PORTBbits.RB2 == 1 && PORTBbits.RB3 == 1)
{
Str_2[7] = '+'; // display ++ for increment
Str_2[8] = '+';
timeInDay();
}
else
{
Str_2[7] = ' '; // clear ++ for increment
Str_2[8] = ' ';
}
DisplayC(Str_2);
}
}
示例3: main
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
if ((panelHandle = LoadPanel (0, "Remotely.uir", PANEL)) < 0)
return -1;
if ((configHandle = LoadPanel (0, "Remotely.uir", CONFIG)) < 0)
return -1;
if ((itemHandle = LoadPanel (0, "Remotely.uir", FILE_ITEM)) < 0)
return -1;
menubarHandle = GetPanelMenuBar (panelHandle);
GetPanelHandleFromTabPage (panelHandle, PANEL_TAB, 0, &bbucommonHandle);
GetPanelHandleFromTabPage (panelHandle, PANEL_TAB, 1, &rrucommonHandle);
GetPanelHandleFromTabPage (panelHandle, PANEL_TAB, 2, &customizingHandle);
SetActiveTabPage (panelHandle, PANEL_TAB, 0);
if(Initial(0, 0)<0 || Initial(1, 0)<0 || Initial(2, 0)<0 || Initial(3, 0)<0)
{
SetLed("Read file type information from config.ini to UI error,please try again!",0);
}
WriteLog();
DisplayPanel (panelHandle);
RunUserInterface ();
return 0;
}
示例4: DancePartner
void DancePartner(Person dancer[],int num)
{ //结构数组dancer中存放跳舞的男女,num是跳舞的人数。
int i;
Person p;
CirQueue Mdancers,Fdancers;
Initial(&Mdancers);//男士队列初始化
Initial(&Fdancers);//女士队列初始化
for(i=0; i<num; i++) { //依次将跳舞者依其性别入队
p=dancer[i];
if(p.sex=='F')
EnQueue(&Fdancers,p); //排入女队
else
EnQueue(&Mdancers,p); //排入男队
}
printf("舞队是:\n");
while(!IsEmpty(&Fdancers)&&!IsEmpty(&Mdancers)) {
//依次输入男女舞伴名
p=DeQueue(&Fdancers); //女士出队
printf("%s ",p.name);//打印出队女士名
p=DeQueue(&Mdancers); //男士出队
printf("%s\n",p.name); //打印出队男士名
}
if(!IsEmpty(&Fdancers)) { //输出女士剩余人数及队头女士的名字
printf("还有 %d 个女士等下一轮.\n",Fdancers.count);
p=Front(&Fdancers); //取队头
printf("%s will be the first to get a partner. \n",p.name);
}
else if(!IsEmpty(&Mdancers)) { //输出男队剩余人数及队头者名字
printf("还有%d 个男士等下一轮.\n",Mdancers.count);
p=Front(&Mdancers);
printf("%s will be the first to get a partner.\n",p.name);
}
}
示例5: ConfigItem
void CVICALLBACK ConfigItem (int menuBar, int menuItem, void *callbackData,
int panel)
{
if((Initial(1, 0)>=0) && (Initial(2, 0)>=0) && (Initial(3, 0)>=0))
{
InstallPopup(itemHandle);
}
else
{
SetLed("Read file type or filter information from config.ini to UI error,please try again!",0);
}
}
示例6: main
int main(){
int k, n, N, p, q, r;
double *y_r, *y_i, *x_r, *x_i, w_r, w_i;
printf("Please input p q r=");
scanf("%d %d %d", &p, &q, &r);
N = Generate_N(p, q, r);
printf("N=2^%d 3^%d 5^%d = %d\n",p,q,r,N);
x_r = (double *) malloc(N*sizeof(double));
x_i = (double *) malloc(N*sizeof(double));
y_r = (double *) malloc(N*sizeof(double));
y_i = (double *) malloc(N*sizeof(double));
Initial(x_r, x_i, N);
FFTv3(x_r, x_i, y_r, y_i, N);
/*
for(int i=0;i<N;++i){
printf("%f\n",y_r[i]);
}
*/
Print_Complex_Vector(y_r, y_i, N);
return 0;
}
示例7: CriticalPath
Status CriticalPath(GRAPHIC_TYPE graphic, GRAPHIC_TYPE* result) {
int i = 0;
int vertex_count = graphic -> vertex_count;
int *topological_sort_result_index = (int*)malloc(sizeof(int) * vertex_count),
*vertex_earliest_start_time = (int*)malloc(sizeof(int) * vertex_count),
*vertex_latest_start_time = (int*)malloc(sizeof(int) * vertex_count);
//initial
for (i = 0; i < vertex_count; i++) {
vertex_earliest_start_time[i] = -1;
vertex_latest_start_time[i] = -1;
}
calculate_topological_sort_result_index(graphic, topological_sort_result_index);
calculate_vertex_earliest_start_time(graphic, topological_sort_result_index, vertex_earliest_start_time);
vertex_latest_start_time[vertex_count - 1] = vertex_earliest_start_time[vertex_count - 1];
calculate_vertex_latest_start_time(graphic, topological_sort_result_index, vertex_latest_start_time);
Initial(result);
calculate_critical_path_result(graphic, topological_sort_result_index, vertex_earliest_start_time, vertex_latest_start_time, result);
free(topological_sort_result_index);
free(vertex_earliest_start_time);
free(vertex_latest_start_time);
return OK;
}
示例8: Reset
void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType)
{
m_sAPType = sAPType;
Reset();
Initial();
}
示例9: memset
__fastcall PCIM114GL::PCIM114GL()
{
m_byteDIPort=NULL;
m_byteDOPort=NULL;
m_bAutoMode=false;
m_bInitOK=Initial(0);
if(!m_bInitOK)
{
m_byteDIPort=new byte[12];
m_byteDOPort=new byte[12];
}
m_dMMtoPLS[Axis_Const::LDY]=10000.0/10.0;
m_dMMtoPLS[Axis_Const::LDZ]=10000.0/10.0;
m_dMMtoPLS[Axis_Const::SPZ]=10000.0/5.0;
m_dMMtoPLS[Axis_Const::MGZ]=10000.0/5.0;
m_dMMtoPLS[Axis_Const::LLC]=10000.0/16.0;
m_dMMtoPLS[Axis_Const::SPX]=10000.0/16.0;
m_dMMtoPLS[Axis_Const::SPY]=10000.0/16.0;
m_dMMtoPLS[Axis_Const::CDX]=10000.0/16.0;
m_dMMtoPLS[Axis_Const::RLC]=10000.0/16.0;
for(int nIndex=0;nIndex<AXIS_SIZE;nIndex++) m_dLastTargetPos[nIndex]=0.0;
memset(m_byteDOPort,0,sizeof(byte)*m_vectDIOMap.size() * 2);
}
示例10: Initial
void CJS_EventHandler::OnMenu_Exec(
CPDFSDK_FormFillEnvironment* pTargetFormFillEnv,
const CFX_WideString& strTargetName) {
Initial(JET_MENU_EXEC);
m_pTargetFormFillEnv.Reset(pTargetFormFillEnv);
m_strTargetName = strTargetName;
}
示例11: main
// <<< main function >>>
//*****************************************************************************
void main(void)
{
unsigned char i;
Initial(); //initial .....
#if (SFNsimple ==0)
//char *mySTR = "Complete mode!";
static char *mySTR[3] = {
"S-Font test...",
"Complete mode!",
"Www.Elasa.ir!"
};
N11_TypeStr(1, 1, mySTR[1], N11_GetStrLenC(mySTR[1]), BLACK, 150);
_delay_ms(2000);
N11_TypeStr(1, 1, mySTR[1], N11_GetStrLenC(mySTR[1]), WHITE, 50);
_delay_ms(1000);
N11_TypeStr(0, 1, mySTR[0], N11_GetStrLenC(mySTR[0]), BLACK, 100);
N11_TypeStr(2, 1, mySTR[1], N11_GetStrLenC(mySTR[1]), BLACK, 100);
N11_TypeStr(4, 1, mySTR[2], N11_GetStrLenC(mySTR[2]), BLACK, 100);
N11_TypeStr(6, 1, mySTR[3], N11_GetStrLenC(mySTR[3]), BLACK, 100);
_delay_ms(3000);
N11_ChrCls(100);
_delay_ms(500);
StringAt(1, 1, "YES!!! :)", BLACK);
#endif
//----- main loop!!!
while(1);
} //main
示例12: main
int main(int argc, char* argv[])
{
int * x = NULL;
int row = 2;
int col = 2;
int i, j;
int layer = 3;
if(argc >= 2)
layer = atoi(argv[1]);
x = (int*)malloc(row * col * sizeof(int));
memset(x, 0, sizeof(int) * row * col);
Initial(x, 2, 2);
Hilbert(&x, row, col, layer);
printf("Hilbert list:\n");
for(i = 0;i < row * pow(2, layer - 1);i ++)
{
for(j = 0;j < col * pow(2, layer - 1);j ++)
printf("%d \t", x[i * col * (int)pow(2, layer - 1) + j]);
printf("\n");
}
printf("\nEnd Hilbert layer = %d.\n", layer);
free(x);
x = NULL;
getchar();
return 0;
}
示例13: Initial
void CJS_EventHandler::OnDoc_Open(CPDFSDK_Document* pDoc,
const CFX_WideString& strTargetName) {
Initial(JET_DOC_OPEN);
m_pTargetDoc = pDoc;
m_strTargetName = strTargetName;
}
示例14: Initial
CDataBlockAllocator::CDataBlockAllocator(int nDBNum, int nDBSize, int bIniShareDB )
:m_nMaxDBNum(nDBNum)
,m_nDBSize(nDBSize)
{
Initial(bIniShareDB);
m_MapTest.clear();
}
示例15: main
int main(int argc,char **argv)
{
PetscErrorCode ierr;
PetscInt time_steps = 100,steps;
PetscMPIInt size;
Vec global;
PetscReal dt,ftime;
TS ts;
MatStructure A_structure;
Mat A = 0;
ierr = PetscInitialize(&argc,&argv,(char*)0,help);CHKERRQ(ierr);
ierr = MPI_Comm_size(PETSC_COMM_WORLD,&size);CHKERRQ(ierr);
ierr = PetscOptionsGetInt(NULL,"-time",&time_steps,NULL);CHKERRQ(ierr);
/* set initial conditions */
ierr = VecCreate(PETSC_COMM_WORLD,&global);CHKERRQ(ierr);
ierr = VecSetSizes(global,PETSC_DECIDE,3);CHKERRQ(ierr);
ierr = VecSetFromOptions(global);CHKERRQ(ierr);
ierr = Initial(global,NULL);CHKERRQ(ierr);
/* make timestep context */
ierr = TSCreate(PETSC_COMM_WORLD,&ts);CHKERRQ(ierr);
ierr = TSSetProblemType(ts,TS_NONLINEAR);CHKERRQ(ierr);
ierr = TSMonitorSet(ts,Monitor,NULL,NULL);CHKERRQ(ierr);
dt = 0.1;
/*
The user provides the RHS and Jacobian
*/
ierr = TSSetRHSFunction(ts,NULL,RHSFunction,NULL);CHKERRQ(ierr);
ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);
ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,3,3);CHKERRQ(ierr);
ierr = MatSetFromOptions(A);CHKERRQ(ierr);
ierr = MatSetUp(A);CHKERRQ(ierr);
ierr = RHSJacobian(ts,0.0,global,&A,&A,&A_structure,NULL);CHKERRQ(ierr);
ierr = TSSetRHSJacobian(ts,A,A,RHSJacobian,NULL);CHKERRQ(ierr);
ierr = TSSetFromOptions(ts);CHKERRQ(ierr);
ierr = TSSetInitialTimeStep(ts,0.0,dt);CHKERRQ(ierr);
ierr = TSSetDuration(ts,time_steps,1);CHKERRQ(ierr);
ierr = TSSetSolution(ts,global);CHKERRQ(ierr);
ierr = TSSolve(ts,global);CHKERRQ(ierr);
ierr = TSGetSolveTime(ts,&ftime);CHKERRQ(ierr);
ierr = TSGetTimeStepNumber(ts,&steps);CHKERRQ(ierr);
/* free the memories */
ierr = TSDestroy(&ts);CHKERRQ(ierr);
ierr = VecDestroy(&global);CHKERRQ(ierr);
ierr = MatDestroy(&A);CHKERRQ(ierr);
ierr = PetscFinalize();
return 0;
}