/*! \brief Transmits the channel delta values to QTouch Studio. */ void Transmit_Delta(void) { int16_t delta; UNUSED(delta); /* Dummy. To avoid warning. */ #if ((DEF_TOUCH_QDEBUG_ENABLE_QM == 1) ||\ (DEF_TOUCH_QDEBUG_ENABLE_QTA == 1) ||\ (DEF_TOUCH_QDEBUG_ENABLE_QTB == 1)) uint8_t c; PutChar(QT_DELTAS); for (c = 0; c < QDEBUG_NUM_SENSORS; c++) { QDEBUG_GET_DELTA_FUNC(c, &delta); PutChar((uint8_t)((delta >> 8) & 0xFFu)); PutChar((uint8_t)(delta & 0xFFu)); } #endif #if DEF_TOUCH_QDEBUG_ENABLE_AT == 1 uint16_t reference = *(QDEBUG_REFERENCES_PTR); uint16_t signal = *(QDEBUG_SIGNALS_PTR); uint16_t unsigned_delta = (uint16_t)(reference - signal); delta = (int16_t)unsigned_delta; PutChar(QT_DELTAS); PutChar((uint8_t)((delta >> 8) & 0xFFu)); PutChar((uint8_t)(delta & 0xFFu)); #endif Send_Message(); }
/* \brief Send 32bit unsigned integer as SUMP meta data */ static void SUMP_sendmeta_uint32(char type, unsigned int i) { PutChar(type); PutChar((i >> 24) & 0xff); PutChar((i >> 16) & 0xff); PutChar((i >> 8) & 0xff); PutChar(i & 0xff); }
int main() { char c1 = 'a'; char c2 = 'b'; char c3 = 'c'; char c4 = 'd'; int j; int tid1; int tid2; int tid3; int tid4; tid1 = UserThreadCreate(SimpleThread, (void*) &c1); tid2 = UserThreadCreate(SimpleThread, (void*) &c2); tid3 = UserThreadCreate(SimpleThread, (void*) &c3); tid4 = UserThreadCreate(SimpleThread, (void*) &c4); for (j = 0; j < 10; j++) { PutChar('m'); PutInt(j); PutChar('\n'); } UserThreadJoin(tid1); UserThreadJoin(tid2); UserThreadJoin(tid3); UserThreadJoin(tid4); /* not reached */ return 0; }
void ListAliases( void ) /**********************/ { int i; char far *alias; char prompt[ 80 ]; SaveLine(); SavePrompt( prompt ); PutNL(); i = 0; alias = AliasList; while( *alias != '\0' ) { if( *alias == '\n' ) { if( ++i == 23 ) { PutChar( '\n' ); if( !PutMore() ) break; ++alias; i = 0; continue; } } PutChar( *alias ); ++alias; } RestorePrompt( prompt ); RestoreLine(); Draw = TRUE; }
void UDA_Driver::PutFloat(float val, uint8_t nbDecimal) { char tab[4]; unsigned char i; for ( i = 0 ; i < nbDecimal ; i++ ) { val = val * 10.0; } unsigned short val10 = (unsigned short)(val); memset(tab,0,sizeof(tab)); sprintf(tab,"%02d",val10); unsigned char offset = 0; for ( i = 0 ; i < 3 ; i++ ) { if ( i >= ( 3 - strlen(tab))) { if ( (i == (2-nbDecimal)) && (nbDecimal != 0) ) PutChar(i,tab[offset] | 0x80 ); else PutChar(i,tab[offset] ); offset++; } else { PutChar(i,' '); } } }
void main(int argc, char *argv[]) // shared memory ID passed from server { int shmid; info_t *my_info; sem_t *sem_video; char *p, str[30]; shmid = atoi( argv[0] ); // get shared memory ID server requested/opened if( ( p = shmat( shmid, 0, 0 ) ) == (char *) -1 ) // attach to p { perror( "alphabet shmat: " ); return; } my_info = (info_t *)p; // got to go around via p (char *) sprintf( str, "%d", getppid() ); // use server PID as key str sem_video = sem_open( str, O_CREAT, S_IRWXU, 1 ); if( sem_video == SEM_FAILED ) { perror("alphabet sem_open: "); return; } srand( getpid() * (unsigned int)time(NULL) ); // seed rand() for( my_info->col=1; my_info->col<=MAX_COL; my_info->col++ ) // race loop { PutChar( my_info->row, my_info->col, my_info->symbol, sem_video ); // show my symbol usleep( USEC * ( 1+ rand()%4 ) ); // random sleep 1 ~ 4 portions of USEC if( my_info->col == MAX_COL ) break; // if reached finish, no need to erase last PutChar( my_info->row, my_info->col, ' ', sem_video ); // erase my symbol } }
/** * Изменение атрибутов. */ void CConsole::SetTextAttributes( EnAttributes Attributes ) { WriteString( ESC ); PutChar( ( Attributes & 0x0F ) + '0' ); PutChar( 'm' ); }
bool AddModRecord(event ev) { if (IsRecordDisabled(ev)) return true; uint i = OpenRecord(MOD_RECORD, cdwModRecord); reCurr.ti = *GetCurrTimeDate(); reCurr.cdwRecord = cdwModRecord++; SaveCache(&chModRecord); reCurr.ev = ev; PutChar(0, ibDig); switch (ev) { case EVE_MODEM_PROFILEOPEN: case EVE_MODEM_SPECIALOPEN: Put(1, (uchar *) &mpdiDigital[ibDig], sizeof(digital)); break; case EVE_MODEM_PROFILE: PutInt(1, mpcwStopCan[ibDig]); break; case EVE_MODEM_PROFILEOK: PutInt(1, cwHouRead); PutInt(3, mpcwStopCan[ibDig]); break; case EVE_MODEM_PROFILEERROR2:PutInt(1, GetCurr()); PutChar(3, mpSerial[ibPort]); break; } CloseRecord(MOD_RECORD, i); return CloseOut(); }
/** * @brief Transmits the channel config struct to QTouch Studio * @ingroup QDebug-Remote */ void Transmit_Sensor_Config(void) { uint8_t c; PutChar(QT_SENSOR_CONFIG); #ifdef _ROTOR_SLIDER_ PutChar(1); // 1 = KRS /* Value of c is used according the maximum channel number to be measured to avoid the over the air data transmission. */ for(c = 0; c <= CHANNEL_19; c++) { PutChar(sensors[c].threshold); PutChar(sensors[c].type_aks_pos_hyst); PutChar(sensors[c].from_channel); PutChar(sensors[c].to_channel); } #else PutChar(0); // 0 = K for(c=0; c<QT_NUM_CHANNELS; c++) { PutChar(sensors[c].threshold); PutChar(sensors[c].type_aks_pos_hyst); PutChar(sensors[c].from_channel); } #endif Send_Message(); }
bool AddImpRecord(event ev) { if (IsRecordDisabled(ev)) return true; uint i = OpenRecord(IMP_RECORD, cdwImpRecord); reCurr.ti = *GetCurrTimeDate(); reCurr.cdwRecord = cdwImpRecord++; SaveCache(&chImpRecord); reCurr.ev = ev; PutChar(0, ibDig); switch (ev) { case EVE_EVENTS_BADLINK: PutChar(1, mpSerial[ibPort]); PutChar(2, bEventCode); break; case EVE_EVENTS_OMISSION: PutChar(1, bEventCode); break; case EVE_EVENTS_A: case EVE_EVENTS_B: Put(1, (uchar *) &tiRecordTime, sizeof(time)); PutChar(7, bEventCode); break; } CloseRecord(IMP_RECORD, i); return CloseOut(); }
/*============================================================================ Name : Transmit_Delta ------------------------------------------------------------------------------ Purpose : Transmits the channel delta values to QTouch Studio Input : n/a Output : n/a Notes : The value is equal to signal-reference ============================================================================*/ void Transmit_Delta(void) { int16_t delta; /* avoid Cppcheck Warning */ UNUSED(delta); #if ((DEF_TOUCH_QMATRIX == 1) || \ (DEF_TOUCH_QTOUCH_GRP_A == 1) || \ (DEF_TOUCH_QTOUCH_GRP_B == 1)) uint8_t c; PutChar(QT_DELTAS); for (c=0; c < QDEBUG_NUM_SENSORS; c++) { QDEBUG_GET_DELTA_FUNC( c, &delta); PutChar((uint8_t)((delta >>8) & 0xFFu)); PutChar((uint8_t)(delta & 0xFFu)); } #endif #if DEF_TOUCH_AUTONOMOUS_QTOUCH == 1 uint16_t reference = *(QDEBUG_REFERENCES_PTR); uint16_t signal = *(QDEBUG_SIGNALS_PTR); uint16_t unsigned_delta = (uint16_t)( reference - signal ); delta = (int16_t) unsigned_delta; PutChar(QT_DELTAS); PutChar((uint8_t)((delta >>8) & 0xFFu)); PutChar((uint8_t)(delta & 0xFFu)); #endif Send_Message(); }
void print(char c, int n) { int i; for (i = 0; i < n; i++) { PutChar(c + i); } PutChar('\n'); }
int main(){ int c = GetChar(); PutChar(c); PutChar('\n'); }
int main() { char s = SynchGetChar(); PutChar(s); PutChar('\n'); return 0; }
int main() { PutInt(ForkExec("step4_ForkExec_helloworld")); PutChar('\n'); PutInt(ForkExec("step4_ForkExec_helloworld")); PutChar('\n'); return 0; }
void PutASMCode(int code, Symbol opds[]) { char *fmt = ASMTemplate[code]; char *prefix = NULL; int i; PutChar('\t'); while (*fmt) { switch (*fmt) { case ';': PutString("\n\t"); break; case '%': fmt++; if (*fmt == 'b') { prefix = "BYTE PTR "; fmt++; } else if (*fmt == 'w') { prefix = "WORD PTR "; fmt++; } else if (*fmt == 'd') { prefix = "DWORD PTR "; fmt++; } else prefix = NULL; i = *fmt - '0'; if (opds[i]->reg != NULL) { PutString(opds[i]->reg->name); } else { if (prefix && opds[i]->kind != SK_Constant && opds[i]->kind != SK_Function) { PutString(prefix); } PutString(GetAccessName(opds[i])); } break; default: PutChar(*fmt); break; } fmt++; } PutChar('\n'); }
void VT102Attribute (INT8U fgcolor, INT8U bgcolor) { PutChar(0x1b); PutChar('['); PutDec(30 + fgcolor); PutChar(';'); PutDec(40 + bgcolor); PutChar('m'); }
void WriteOneEntry(CalEntry *c) { int ch, i; char const *s = c->entry; printf(" ["); /* Chew up leading spaces */ while(isspace((unsigned char) *s)) s++; /* Skip three decimal numbers for COLOR special */ if (c->special == SPECIAL_COLOR) { for (i=0; i<3; i++) { while(*s && !isspace(*s)) s++; while(*s && isspace(*s)) s++; } } PutChar('('); while(*s) { /* Use the "unsigned char" cast to fix problem on Solaris 2.5 */ /* which treated some latin1 characters as white space. */ ch = (unsigned char) *s++; if (ch == '\\' || ch == '(' || ch == ')') PutChar('\\'); if (!isspace(ch)) PutChar(ch); else { PutChar(')'); while(isspace((unsigned char)*s)) s++; if (!*s) { goto finish; } PutChar('('); } } printf(")\n"); finish: if (c->special == SPECIAL_COLOR) { int r, g, b; if (sscanf(c->entry, "%d %d %d", &r, &g, &b) == 3) { if (r < 0) r = 0; else if (r > 255) r = 255; if (g < 0) g = 0; else if (g > 255) g = 255; if (b < 0) b = 0; else if (b > 255) b = 255; printf("(gsave %f %f %f setrgbcolor)(grestore)", r / 255.0, g / 255.0, b / 255.0); } else { /* Punt... unrecognized color is black */ printf("()()"); } } else { printf("()()"); } printf("]\n"); }
bool AddSysRecord(event ev) { if (IsRecordDisabled(ev)) return true; uint i = OpenRecord(SYS_RECORD, cdwSysRecord); reCurr.ti = *GetCurrTimeDate(); reCurr.cdwRecord = cdwSysRecord++; SaveCache(&chSysRecord); reCurr.ev = ev; switch (ev) { // case EVE_CONTACTS3_START: // case EVE_CONTACTS3_COUNTER: memcpy(&reCurr.mpbBuff+0, &cbContact, sizeof(uchar)); // memcpy(&reCurr.mpbBuff+1, &cbContactMax, sizeof(uchar)); break; // // case EVE_VALUE3_DOWN: memcpy(&reCurr.mpbBuff+0, &reContactDown, sizeof(float)); break; // case EVE_VALUE3_UP: memcpy(&reCurr.mpbBuff+0, &reContactUp, sizeof(float)); break; // case EVE_VALUE3_COUNTER: memcpy(&reCurr.mpbBuff+0, &cbContactMax, sizeof(uchar)); break; // // case EVE_CONTACTS3_0_ON: memcpy(&reCurr.mpbBuff+0, &reContactRec, sizeof(float)); // memcpy(&reCurr.mpbBuff+4, &reContactUp, sizeof(float)); break; // // case EVE_CONTACTS3_0_OFF: memcpy(&reCurr.mpbBuff+0, &reContactRec, sizeof(float)); // memcpy(&reCurr.mpbBuff+4, &reContactDown, sizeof(float)); break; // // case EVE_CONTACTSMODE: // case EVE_CONTACTS1: // case EVE_CONTACTS2: memcpy(&reCurr.mpbBuff+0, &bContactRec, sizeof(uchar)); break; case EVE_PREVNEXTTIME2: Put(0, (uchar *) &tiCurr, sizeof(time)); break; case EVE_EDIT_DIGITAL1: case EVE_EDIT_DIGITAL2: PutChar(0, ibRecordCan); Put(1, (uchar *) &mpdiDigital[ibRecordCan], sizeof(digital)); break; case EVE_EDIT_KEY10: case EVE_EDIT_KEY20: PutChar(0, ibRecordCan); Put(1, (uchar *) &mpphKeys[ibRecordCan].szLine+0, 7); break; case EVE_EDIT_KEY11: case EVE_EDIT_KEY21: Put(0, (uchar *) &mpphKeys[ibRecordCan].szLine+7, 6); break; case EVE_EDIT_ADDRESS10: case EVE_EDIT_ADDRESS11: PutChar(0, ibRecordCan); Put(1, (uchar *) &mpdwAddress1[ibRecordCan], sizeof(ulong)); break; case EVE_EDIT_ADDRESS20: case EVE_EDIT_ADDRESS21: PutChar(0, ibRecordCan); Put(1, (uchar *) &mpdwAddress2[ibRecordCan], sizeof(ulong)); break; } CloseRecord(SYS_RECORD, i); return CloseOut(); }
/** * Очистить n знаков от позиции курсора. */ void CConsole::ClearForward( uint8_t Count ) { if ( Count == 0 ) return; WriteString( ESC ); PutChar( ( Count / 10 ) + '0' ); PutChar( ( Count % 10 ) + '0' ); PutChar( 'X' ); }
void f(void* arg) { PutChar('5'); Arg *param = (Arg*) arg; PutChar(param->a); PutChar('6'); param->wait = 0; PutChar('7'); UserThreadExit(0); }
void SimpleThread(void* which) { char* ch = (char*) which; int i; for (i = 0; i < 10; i++) { PutChar(*ch); PutInt(i); PutChar('\n'); } UserThreadExit(); }
void print(void* arg) { #if 1 PutChar((char)arg); PutChar('z'); ThreadExit(); #endif }
static void ShowSign(char *string) { char *base = string; int ch, first, last; if (moveit != 0) { tputs(tgoto(moveit, 0, height - 1), 1, outc); tputs(wipeit, 1, outc); } while (*string != 0) { ch = *string; if (ch != ' ') { if (moveit != 0) { for (first = length - 2; first >= (string - base); first--) { if (first < length - 1) { tputs(tgoto(moveit, first + 1, height - 1), 1, outc); PutChar(' '); } tputs(tgoto(moveit, first, height - 1), 1, outc); PutChar(ch); } } else { last = ch; if (isalpha(ch)) { first = isupper(ch) ? 'A' : 'a'; } else if (isdigit(ch)) { first = '0'; } else { first = ch; } if (first < last) { Underline(1); while (first < last) { PutChar(first); Backup(); first++; } Underline(0); } } if (moveit != 0) Backup(); } StandOut(1); PutChar(ch); StandOut(0); fflush(stdout); string++; } if (moveit != 0) tputs(wipeit, 1, outc); putchar('\n'); }
/*============================================================================ Name : Transmit_State ------------------------------------------------------------------------------ Purpose : Transmits the state values to QTouch Studio Input : n/a Output : n/a Notes : On/Off condition for each sensor ============================================================================*/ void Transmit_State(void) { #if ((DEF_TOUCH_QMATRIX == 1) || \ (DEF_TOUCH_QTOUCH_GRP_A == 1) || \ (DEF_TOUCH_QTOUCH_GRP_B == 1)) uint8_t c; uint8_t *p_sensor_states = QDEBUG_SENSOR_STATES_PTR; uint8_t *p_rotor_slider_values = QDEBUG_SENSOR_RS_VALUES; PutChar(QT_STATES); PutChar(QDEBUG_NUM_CHANNELS); PutChar(QDEBUG_NUM_ROTORS_SLIDERS); for (c=0; c < QDEBUG_NUM_SENSOR_STATE_BYTES; c++) { PutChar(p_sensor_states[c]); } for (c=0; c < QDEBUG_NUM_ROTORS_SLIDERS; c++) { PutChar(p_rotor_slider_values[c] ); } #endif #if DEF_TOUCH_AUTONOMOUS_QTOUCH == 1 PutChar(QT_STATES); PutChar(QDEBUG_NUM_CHANNELS); PutChar(0u); /* Dummy. QDEBUG_NUM_ROTORS_SLIDERS. */ PutChar(autonomous_qtouch_in_touch); #endif Send_Message(); }
/** * @brief Transmits the measurement values for each channel to QTouch Studio * @ingroup QDebug-Remote */ void Transmit_Signals(void) { uint8_t c; PutChar(QT_SIGNALS); for(c=0; c<QT_NUM_CHANNELS; c++) { PutChar(qt_measure_data.channel_signals[c] >> 8); PutChar(qt_measure_data.channel_signals[c] & 0xFF); } Send_Message(); }
void Thread2(void* arg) { int tid = *(int*) arg; int i; for (i = 0; i < 500; i++) { PutChar('d'); } PutChar('Q'); UserThreadJoin(tid); PutChar('Z'); UserThreadExit(); }
/** * @brief Transmits the channel reference values to QTouch Studio */ void Transmit_Ref(void) { uint8_t c; PutChar(QT_REFERENCES); for(c=0; c<QT_NUM_CHANNELS; c++) { PutChar(qt_measure_data.channel_references[c] >> 8); PutChar(qt_measure_data.channel_references[c] & 0xFF); } Send_Message(); }
void Thread(void* arg) { int* i = (int*) arg; PutChar('T'); PutInt(*i); PutChar('\n'); (*i)--; if (*i > 0) { int tid = UserThreadCreate(Thread, arg); UserThreadJoin(tid); } UserThreadExit(); }
int main(){ //MAX_STRING_SIZE est defini a 5 PutString("toto"); PutChar('\n'); PutString("Je pense que\n ca va"); PutChar('\n'); PutString("abcdefghijklmnopqrstuvwxyz"); PutChar('\n'); return 0; }