void CMsgBox::StartThread() { InitMsg(); if(idThread == 0) pthread_create(&idThread, NULL, &MsgFileThread, (void*)this); }
void CMsgBox::StopThread() { condThread = 0; if(idThread != 0) { pthread_join(idThread, NULL); idThread = 0; } InitMsg(); }
// send a message to listening GUI client... int SendMesg( char *msg ) { static long sendcount=0; int len,err; struct msgdata ipcdata; if ( sendcount == 0 ) InitMsg(); len = strlen( msg ); strcpy( ipcdata.mtext, msg ); err = msgsnd( MSG_ID, (void*)&ipcdata, len, 0); sendcount++; return err; }
int InitSubSystems( void ) { if( !setjmp( Env ) ) { InitMem(); InitLibIo(); InitInputLibs(); InitMsg( ); // InitCmdLine(); // JBS 99/07/09 moved below InitFileTab(); InitObj(); return( EXIT_SUCCESS ); } else { return( EXIT_FAILURE ); } }
void InitSubSystems( void ) /********************************/ { #ifdef _INT_DEBUG memset( _edata, 0xA5, _end - _edata ); // don't rely on BSS == 0 #endif LnkMemInit(); LnkFilesInit(); InitMsg(); InitNodes(); InitTokBuff(); InitSpillFile(); InitSym(); InitObjORL(); InitCmdFile(); }
static msg_list *AddWords( char *msg ) { //============================================== int index; char *word_str; msg_list *curr_msg; msg_word *curr_word; int word_size; curr_msg = InitMsg(); curr_word = NULL; for(;;) { while( *msg == ' ' ) { ++msg; } if( *msg == NULLCHAR ) break; index = 0; for(;;) { if( msg[ index ] == NULLCHAR ) break; ++index; if( msg[ index ] == ' ' ) break; } word_size = index + 1; if( msg[ index ] == ' ' ) { msg[ index++ ] = NULLCHAR; } word_str = malloc( word_size ); strcpy( word_str, msg ); if( curr_word == NULL ) { curr_word = malloc( sizeof( msg_word ) ); curr_msg->msg = curr_word; } else { curr_word->link = malloc( sizeof( msg_word ) ); curr_word = curr_word->link; } curr_word->link = NULL; curr_word->word = ProcessWord( word_str ); curr_msg->count++; msg += index; } return( curr_msg ); }
static void BuildLists( void ) //================================ { int index; group_list *curr_group; int group; msg_list *prev_msg; msg_list *msg_ptr; msg_list *last_non_null_msg; msg_list **p_null_msg; msg_word *word; int caret; char rec[BUFF_LEN+1]; char msg_used_at; char msg_compiler; char msg_target; char delim; fprintf( ErrCod, "#define NO_CARROT 0\n" ); fprintf( ErrCod, "#define OPR_CARROT 1\n" ); fprintf( ErrCod, "#define OPN_CARROT 2\n" ); fprintf( RCFile, "#include \"errcod.h\"\n\n" ); fprintf( RCFile, "STRINGTABLE\nBEGIN\n\n" ); group = 0; curr_group = NULL; ReadInFile( rec ); prev_msg = NULL; last_non_null_msg = NULL; for( ;; ) { if( HeadGroup == NULL ) { HeadGroup = malloc( sizeof( group_list ) ); curr_group = HeadGroup; } else { curr_group->link = malloc( sizeof( group_list ) ); curr_group = curr_group->link; } curr_group->link = NULL; curr_group->start_msg_num = group * 256; curr_group->end_msg_num = curr_group->start_msg_num; curr_group->name[0] = rec[0]; curr_group->name[1] = rec[1]; curr_group->name[2] = NULLCHAR; for( ;; ) { if( ReadInFile( rec ) != 0 ) { fprintf( RCFile, "\nEND\n" ); return; } ++RecNum; if( ( strlen( rec ) > 2 ) && ( rec[2] == ' ' ) ) // Group record break; index = 3; while( rec[index] != ' ' ) { ++index; } // End of message ID rec[index] = '\0'; ++index; ++index; // skip [ if( rec[index] != sw_language ) continue; ++index; msg_compiler = rec[index]; ++index; msg_target = rec[index]; ++index; msg_used_at = rec[index]; ++index; caret = rec[index] - '0'; ++index; ++index; // skip ] msg_ptr = InitMsg(); if( UseMessage( msg_compiler, msg_target, msg_used_at ) ) { // proccess message text AddWords( msg_ptr, &rec[index] ); } msg_ptr->caret = caret; if( msg_ptr->msg != NULL ) { fprintf( ErrCod, "#define %s %d\n", rec, curr_group->end_msg_num ); fprintf( RCFile, " %s+MSG_LANG_BASE \"", rec ); delim = ' '; for( word = msg_ptr->msg; word != NULL; word = word->link ) { if( word->link == NULL ) { delim = '"'; } fprintf( RCFile, "%s%c", word->word->word, delim ); } fprintf( RCFile, "\n" ); last_non_null_msg = msg_ptr; } curr_group->end_msg_num++; if( HeadMsg == NULL ) { HeadMsg = msg_ptr; } else { prev_msg->link = msg_ptr; } prev_msg = msg_ptr; } prev_msg = last_non_null_msg; if( last_non_null_msg == NULL ) { p_null_msg = &HeadMsg; } else { p_null_msg = &last_non_null_msg->link; } while( *p_null_msg != NULL ) { msg_ptr = (*p_null_msg)->link; free( *p_null_msg ); curr_group->end_msg_num--; *p_null_msg = msg_ptr; } ++group; } }