void __declspec(dllexport) SelAutoCopy(PLUGINDATA *pd) { pd->dwSupport|=PDS_SUPPORTALL; if (pd->dwSupport & PDS_GETSUPPORT) return; if (!bInitCommon) InitCommon(pd); if (bInitSelAutoCopy) { UninitMain(); UninitSelAutoCopy(); //If any function still loaded, stay in memory and show as non-active if (nInitMain) pd->nUnload=UD_NONUNLOAD_NONACTIVE; } else { InitMain(); InitSelAutoCopy(); if (!pd->bOnStart) { if (SendMessage(pd->hWndEdit, EM_SELECTIONTYPE, 0, 0) != SEL_EMPTY) { CopySelection(pd->hWndEdit); } } //Stay in memory, and show as active pd->nUnload=UD_NONUNLOAD_ACTIVE; } }
void __declspec(dllexport) PasteSerial(PLUGINDATA *pd) { pd->dwSupport|=PDS_SUPPORTALL; if (pd->dwSupport & PDS_GETSUPPORT) return; if (!bInitCommon) InitCommon(pd); else if (!bInitPasteSerial) ReadOptions(OF_PASTESERIAL); if (bInitPasteSerial) { UninitMain(); UninitPasteSerial(); //If any function still loaded, stay in memory and show as non-active if (nInitMain) pd->nUnload=UD_NONUNLOAD_NONACTIVE; } else { InitMain(); InitPasteSerial(); //Stay in memory, and show as active pd->nUnload=UD_NONUNLOAD_ACTIVE; } }
//Plugin extern function void __declspec(dllexport) Capture(PLUGINDATA *pd) { pd->dwSupport|=PDS_SUPPORTALL; if (pd->dwSupport & PDS_GETSUPPORT) return; if (!bInitCommon) InitCommon(pd); else if (!bInitCapture) ReadOptions(OF_CAPTURE); if (bInitCapture) { DestroyDock(hWndCaptureDlg, DKT_KEEPAUTOLOAD); //Stay in memory and show as non-active pd->nUnload=UD_NONUNLOAD_NONACTIVE; } else { InitMain(); InitCapture(); pfCapture=pd->lpPluginFunction; bCaptureDockWaitResize=pd->bOnStart; CreateDock(&hWndCaptureDlg, &dkCaptureDlg, !bCaptureDockWaitResize); //Stay in memory, and show as active pd->nUnload=UD_NONUNLOAD_ACTIVE; } }
void main() { InitMain(); current_duty = 200; // initial value for current_duty current_duty1 = 200; // initial value for current_duty1 TRISA = 0xFF; // PORTA is input TRISB = 0xFF; // Set PORTB as input //PORTB = 0x00; PWM1_Start(); // start PWM1 PWM2_Start(); // start PWM2 PWM1_Set_Duty(0); // Set current duty for PWM1 PWM2_Set_Duty(0); // Set current duty for PWM2 adcon1 = 0b1000010; while (1) { // endless loop temp_res = ADC_Read(0); temp_res=temp_res*255.0/1024.0; newduty=temp_res; if(RB0_bit==1 && RB1_bit==0){ PWM1_Set_Duty(newduty); PWM2_Set_Duty(0); }else if(RB0_bit==0 && RB1_bit==1){ PWM1_Set_Duty(0); PWM2_Set_Duty(newduty); } else{ PWM1_Set_Duty(0); PWM2_Set_Duty(0); } Delay_ms(5); // slow down change pace a little } }
int main(void) { // Init PIC24 InitMain(); // Init modules AudioInInit(); Uart2Init(UART_BAUD_250000, 0); LedsInit(); // Main loop while(1) { if(AudioInIsGetReady()) { Fixed audioSample = AudioInGet(); // Update LEDs LedsUpdate(audioSample); // Print audio sample Uart2RxTasks(); if(Uart2IsPutReady() >= 6) { static const char asciiDigits[10] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; int i = FIXED_TO_INT(audioSample); div_t n; int print = 0; if(i < 0) { Uart2PutChar('-'); i = -i; } if(i >= 10000) { n = div(i, 10000); Uart2PutChar(asciiDigits[n.quot]); i = n.rem; print = 1; } if(i >= 1000 || print) { n = div(i, 1000); Uart2PutChar(asciiDigits[n.quot]); i = n.rem; print = 1; } if(i >= 100 || print) { n = div(i, 100); Uart2PutChar(asciiDigits[n.quot]); i = n.rem; print = 1; } if(i >= 10 || print) { n = div(i, 10); Uart2PutChar(asciiDigits[n.quot]); i = n.rem; } Uart2PutChar(asciiDigits[i]); Uart2PutChar('\r'); } } } }
/* Initialise the engine */ static PyObject * engine_init(PyObject *self, PyObject *args) { int rc; if (!PyArg_ParseTuple(args, "sh", &binbookfile, &verbose)) return NULL; rc = InitMain(); Py_RETURN_NONE; }
void arch_init_start() { #ifndef NDEBUG #ifdef _MSC_VER if (FindArg("-memdbg")) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | /* _CRTDBG_CHECK_CRT_DF | */ _CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF); #endif #endif InitMain (); }
void __declspec(dllexport) Now(PLUGINDATA *pd) { pd->dwSupport|=PDS_SUPPORTALL; if (pd->dwSupport & PDS_GETSUPPORT) return; if (pd->bOnStart) bMinimizeToTrayNowOnStart=TRUE; if (!bInitCommon) InitCommon(pd); if (!bInitMain) InitMain(); Hide(); //Stay in memory, but show as non-active pd->nUnload=UD_NONUNLOAD_NONACTIVE; }
/***************************************************************** 関数名 : GameMain 機能 : メインの処理 引数 : なし 出力 : ゲームの状態 *****************************************************************/ int GameMain() { InitAdventure(); InitMain(); /* タイマー */ Uint32 interval = SDL_GetTicks() + 100; /* ゲーム内時刻:約0.1秒で1カウント */ int time = 0; Uint32 now; while(gState == GAME_MAIN) { InputKey(); now = SDL_GetTicks(); if(now >= interval) { TimerEvent(++time); /* 0.04秒(25fps)ごとにタイマー処理するよう設定 */ interval = now + (1000 / 25); //fps } } return gState; }
extern void __declspec(dllexport) Main(PLUGINDATA *pd) { pd->dwSupport |= PDS_NOANSI; if(pd->dwSupport & PDS_GETSUPPORT) return; if(pd->bOldWindows) { pd->nUnload = UD_UNLOAD; return; } if(!g_bLoaded) { LoadPlugin(pd); if(!g_bLoaded) { pd->nUnload = UD_UNLOAD; return; } } if(g_bMainReady) { FreeMain(); } else { InitMain(); if(!pd->bOnStart) { g_bInternalNew = FALSE; } } pd->nUnload = (g_bMainReady)? (UD_NONUNLOAD_ACTIVE): (g_nLock?UD_NONUNLOAD_NONACTIVE:UD_UNLOAD); if(!g_nLock) UnloadPlugin(pd); }
//Plugin extern function void __declspec(dllexport) Always(PLUGINDATA *pd) { pd->dwSupport|=PDS_SUPPORTALL; if (pd->dwSupport & PDS_GETSUPPORT) return; if (!bInitCommon) InitCommon(pd); if (!bInitMain) InitMain(); if (bMinimizeToTrayAlways) { bMinimizeToTrayAlways=FALSE; //Stay in memory, but show as non-active pd->nUnload=UD_NONUNLOAD_NONACTIVE; } else { bMinimizeToTrayAlways=TRUE; //Stay in memory, and show as active pd->nUnload=UD_NONUNLOAD_ACTIVE; } }
int main (int argc, char **argv) { /* * Process command-line arguments. */ /* Get rid of the program name. */ argc--; argv++; /* CHECKME: get rid of the '+' syntax? */ while ((argc > 0) && ((argv[0][0] == '-') || (argv[0][0] == '+'))) { switch (argv[0][1]) { case 'a': /* Need the "+" syntax here... */ ahead = ((argv[0][0] == '-') ? false : true); break; case 'b': argc--; argv++; if (argc > 0) { bookfile = argv[0]; #ifdef BINBOOK binbookfile = NULL; #endif } break; #ifdef BINBOOK case 'B': argc--; argv++; if (argc > 0) binbookfile = argv[0]; break; #endif case 'C': /* Curses interface. */ display_type = DISPLAY_CURSES; break; case 'h': /* Need the "+" syntax here... */ hash = ((argv[0][0] == '-') ? false : true); break; case 'l': argc--; argv++; if (argc > 0) Lang = argv[0]; break; case 'L': argc--; argv++; if (argc > 0) strcpy(listfile, argv[0]); break; case 's': argc--; argv++; if (argc > 0) strcpy(savefile, argv[0]); break; case 'P': argc--; argv++; if (argc > 0) bookmaxply = atoi(argv[0]); break; case 'R': /* Raw text interface. */ display_type = DISPLAY_RAW; break; case 'S': argc--; argv++; if (argc > 0) booksize = atoi(argv[0]); break; #if ttblsz case 'r': argc--; argv++; if (argc > 0) rehash = atoi(argv[0]); if (rehash > MAXrehash) rehash = MAXrehash; break; case 'T': argc--; argv++; if (argc > 0) ttblsize = atoi(argv[0]); if ((ttblsize <= MINTTABLE)) ttblsize = (MINTTABLE) + 1; break; #ifdef HASHFILE case 'c': /* Create or test persistent transposition table. */ argc--; argv++; if (argc > 0) filesz = atoi(argv[0]); else filesz = vfilesz; if ((filesz > 0) && (filesz < 24)) filesz = (1 << filesz) - 1 + MAXrehash; else filesz = filesz + MAXrehash; if ((hashfile = fopen(HASHFILE, RWA_ACC)) == NULL) hashfile = fopen(HASHFILE, WA_ACC); if (hashfile != NULL) { long j; struct fileentry n; printf(CP[66]); n.f = n.t = 0; n.flags = 0; n.depth = 0; n.sh = n.sl = 0; for (j = 0; j < filesz + 1; j++) fwrite(&n, sizeof(struct fileentry), 1, hashfile); fclose(hashfile); } else { printf(CP[50], HASHFILE); } return 0; case 't': /* Create or test persistent transposition table. */ hashfile = fopen(HASHFILE, RWA_ACC); if (hashfile) { fseek(hashfile, 0L, SEEK_END); filesz = (ftell(hashfile) / (sizeof(struct fileentry))) - 1; } if (hashfile != NULL) { long i, j; int nr[MAXDEPTH]; struct fileentry n; printf(CP[49]); for (i = 0; i < MAXDEPTH; i++) nr[i] = 0; fseek(hashfile, 0L, SEEK_END); i = ftell(hashfile) / (sizeof(struct fileentry)); fseek(hashfile, 0L, SEEK_SET); for (j = 0; j < i + 1; j++) { fread(&n, sizeof(struct fileentry), 1, hashfile); if (n.depth > MAXDEPTH) { printf("ERROR\n"); exit(1); } if (n.depth) { nr[n.depth]++; nr[0]++; } } printf(CP[109], nr[0], i); for (j = 1; j < MAXDEPTH; j++) printf("%d ", nr[j]); printf("\n"); } return 0; #endif /* HASHFILE */ #endif /* ttblsz */ case 'v': fprintf(stderr, CP[102], version, patchlevel); exit(1); case 'X': /* X interface. */ display_type = DISPLAY_X; break; case 'x': argc--; argv++; if (argc > 0) xwin = argv[0]; break; default: fprintf(stderr, CP[113]); exit(1); } argc--; argv++; } if (argc == 2) { char *p; MaxResponseTime = 100L * strtol(argv[1], &p, 10); if (*p == ':') { MaxResponseTime = 60L * MaxResponseTime + 100L * strtol(++p, (char **) NULL, 10); } TCflag = false; TCmoves = 0; TCminutes = 0; TCseconds = 0; } if (argc >= 3) { char *p; if (argc > 9) { printf("%s\n", CP[220]); exit(1); } TCmoves = atoi(argv[1]); TCminutes = (short)strtol(argv[2], &p, 10); if (*p == ':') TCseconds = (short)strtol(p + 1, (char **) NULL, 10); else TCseconds = 0; TCflag = true; argc -= 3; argv += 3; while (argc > 1) { XCmoves[XC] = atoi(argv[0]); XCminutes[XC] = (short)strtol(argv[1], &p, 10); if (*p == ':') XCseconds[XC] = (short)strtol(p + 1, (char **) NULL, 10); else XCseconds[XC] = 0; if (XCmoves[XC] && (XCminutes[XC] || XCseconds[XC])) XC++; else { printf("%s\n", CP[220]); exit(1); } argc -= 2; argv += 2; } if (argc) { /* * If we got here, there are unknown arguments, so issue * an error message and quit. */ printf("%s\n", CP[233]); print_arglist(argc, argv); exit(1); } } if (InitMain() != 0) exit(1); while (!flag.quit) { oppptr = (oppptr + 1) % MINGAMEIN; if (flag.bothsides && !flag.mate) SelectMove(opponent, FOREGROUND_MODE); else InputCommand(NULL); if (opponent == white) { if (flag.gamein || TCadd) { TimeCalc(); } else if (TimeControl.moves[opponent] == 0) { if (XC) { if (XCmore < XC) { TCmoves = XCmoves[XCmore]; TCminutes = XCminutes[XCmore]; TCseconds = XCseconds[XCmore]; XCmore++; } } SetTimeControl(); } } compptr = (compptr + 1) % MINGAMEIN; if (!(flag.quit || flag.mate || flag.force)) { #ifdef INTERRUPT_TEST printf("starting search...\n"); #endif SelectMove(computer, FOREGROUND_MODE); if (computer == white) { if (flag.gamein) { TimeCalc(); } else if (TimeControl.moves[computer] == 0) { if (XC) { if (XCmore < XC) { TCmoves = XCmoves[XCmore]; TCminutes = XCminutes[XCmore]; TCseconds = XCseconds[XCmore]; XCmore++; } } SetTimeControl(); } } } } ExitMain(); return 0; }