wBool_t wPrintInit( void ) { if (!printInit()) { return FALSE; } return TRUE; }
void cgen(FILE *f) { FILE *w; int t = 1; int c; w = fopen("a.c", "w"); if (!w) { perror("F*****g no space for write file"); exit(1); } printInit(w); while ((c = fgetc(f)) != EOF) { switch(c) { case '>': identline(t, w); fprintf(w, "++ptr;\n"); break; case '<': identline(t, w); fprintf(w, "--ptr;\n"); break; case '+': identline(t, w); fprintf(w, "++*ptr;\n"); break; case '-': identline(t, w); fprintf(w, "--*ptr;\n"); break; case '.': identline(t, w); fprintf(w, "putchar(*ptr);\n"); break; case ',': identline(t, w); fprintf(w, "*ptr = getchar();\n"); break; case '[': identline(t, w); fprintf(w, "while(*ptr) {\n"); t++; break; case ']': t--; identline(t, w); fprintf(w, "}\n"); break; } } printEnd(w); fclose(w); }
void init(bt_config_t *config) { int i; fillChunkList(&masterChunk, MASTER, config->chunk_file); fillChunkList(&hasChunk, HAS, config->has_chunk_file); fillPeerList(config); if((log_file = fopen("lab2-errors.txt", "w")) == NULL) { fprintf(stderr, "Failed to open logging file.\n"); }; maxConn = config->max_conn; nonCongestQueue = newqueue(); for(i = 0; i < peerInfo.numPeer; i++) { int peerID = peerInfo.peerList[i].peerID; uploadPool[peerID].dataQueue = newqueue(); uploadPool[peerID].ackWaitQueue = newqueue(); uploadPool[peerID].connID = 0; downloadPool[peerID].getQueue = newqueue(); downloadPool[peerID].timeoutQueue = newqueue(); downloadPool[peerID].ackSendQueue = newqueue(); downloadPool[peerID].connected = 0; downloadPool[peerID].cache = NULL; initWindows(&(downloadPool[peerID].rw), &(uploadPool[peerID].sw)); } printInit(); }
HDC mswGetPrinterDC( void ) { if (!printInit()) { return (HDC)0; } /*memset( &printDlg, 0, sizeof printDlg );*/ printDlg.lStructSize = sizeof printDlg; printDlg.hwndOwner = NULL; printDlg.Flags = PD_RETURNDC|PD_NOPAGENUMS|PD_NOSELECTION; if (PrintDlg(&printDlg) != 0) return printDlg.hDC; else return (HDC)0; }
void wPrintSetup( wPrintSetupCallBack_p callback ) { if (!printInit()) { return; } /*memset( &printDlg, 0, sizeof printDlg );*/ printDlg.lStructSize = sizeof printDlg; printDlg.hwndOwner = NULL; printDlg.Flags = PD_RETURNDC|PD_PRINTSETUP; if (PrintDlg(&printDlg) != 0 && printDlg.hDC) { getPageDim( printDlg.hDC ); } if ( callback ) { callback( TRUE ); } }
void wPrintGetPhysSize( double *w, double *h ) { printInit(); *w = physSizeW; *h = physSizeH; }
void wPrintGetPageSize( double *w, double *h ) { printInit(); *w = pageSizeW; *h = pageSizeH; }
//---------------------------------------------------------- // System initialization //---------------------------------------------------------- static inline void initSystem(void) { bool success; (void)success; // disable interrupts: disabled on msp430 by default, but other systems might need this DISABLE_INTS(); // stop the watchdog: GCC disables it by default, but other compilers might not be so helpful watchdogStop(); // TODO: init dynamic memory // platformMemInit(); // basic, platform-specific initialization: timers, platform-specific drivers (?) initPlatform(); // start energy accounting (as soon as timers are initialized) energyConsumerOn(ENERGY_CONSUMER_MCU); #ifdef USE_PRINT // init printing to serial (makes sense only after clock has been calibrated) if (printInit != NULL) printInit(); #endif INIT_PRINTF("starting MansOS...\n"); #ifdef USE_LEDS INIT_PRINTF("init LED(s)...\n"); ledsInit(); #endif #ifdef USE_BEEPER beeperInit(); #endif #ifdef RAMTEXT_START if ((MemoryAddress_t)&_end > RAMTEXT_START) { // Panic right aways on RAM overflow. // In case this happens, you might want to increase the address // specified by CONST_RAMTEXT_START in config file assertionFailed("Overflow between .data and .ramtext sections", __FILE__, __LINE__); } #endif #ifdef USE_ADC if (adcInit != NULL) { INIT_PRINTF("init ADC...\n"); adcInit(); } #endif #ifdef USE_RANDOM INIT_PRINTF("init RNG...\n"); randomInit(); #endif #if USE_ALARMS INIT_PRINTF("init alarms...\n"); initAlarms(); #endif #ifdef USE_RADIO INIT_PRINTF("init radio...\n"); radioInit(); #endif #ifdef USE_ADDRESSING INIT_PRINTF("init communication stack...\n"); networkingInit(); #endif #ifdef USE_EXT_FLASH INIT_PRINTF("init external flash...\n"); extFlashInit(); #endif #ifdef USE_SDCARD INIT_PRINTF("init SD card...\n"); sdcardInit(); #endif #ifdef USE_EEPROM INIT_PRINTF("init EEPROM...\n"); eepromInit(); #endif #ifdef USE_ISL29003 INIT_PRINTF("init ISL light sensor...\n"); success = islInit(); if (!success) { INIT_PRINTF("ISL init failed!\n"); } #endif #ifdef USE_ADS1115 INIT_PRINTF("init ADS111x ADC converter chip...\n"); adsInit(); #endif #if USE_ADS8638 INIT_PRINTF("init ADS8638 ADC converter chip...\n"); ads8638Init(); #endif #if USE_ADS8328 INIT_PRINTF("init ADS8328 ADC converter chip...\n"); ads8328Init(); #endif #if USE_AD5258 INIT_PRINTF("init AD5258 digital potentiometer...\n"); ad5258Init(); #endif #if USE_DAC7718 INIT_PRINTF("init DAC7718 DAC converter chip...\n"); dac7718Init(); #endif #if USE_ISL1219 INIT_PRINTF("init ISL1219 real-time clock chip...\n"); isl1219Init(); #endif #ifdef USE_HUMIDITY INIT_PRINTF("init humidity sensor...\n"); humidityInit(); #endif #ifdef USE_ACCEL INIT_PRINTF("init accelerometer...\n"); accelInit(); #endif #ifdef USE_TIMESYNC INIT_PRINTF("init base station time sync...\n"); timesyncInit(); #endif #ifdef USE_SMP INIT_PRINTF("init SSMP...\n"); smpInit(); #endif #ifdef USE_REPROGRAMMING INIT_PRINTF("init reprogramming...\n"); bootParamsInit(); #endif #ifdef USE_DCO_RECALIBRATION extern void dcoRecalibrationInit(void); INIT_PRINTF("init DCO recalibration...\n"); dcoRecalibrationInit(); #endif #ifdef USE_FS INIT_PRINTF("init file system...\n"); fsInit(); #endif #ifdef USE_FATFS INIT_PRINTF("init FAT file system...\n"); fatFsInit(); INIT_PRINTF("init POSIX-like file routines...\n"); posixStdioInit(); #endif #ifdef USE_WMP INIT_PRINTF("init WMP...\n"); wmpInit(); #endif #ifdef USE_SEAL_NET INIT_PRINTF("init SEAL networking...\n"); sealNetInit(); #endif INIT_PRINTF("starting the application...\n"); }