示例#1
0
void CMsgBox::StartThread()
{
    InitMsg();

	if(idThread == 0)
		pthread_create(&idThread, NULL, &MsgFileThread, (void*)this);
}
示例#2
0
void CMsgBox::StopThread()
{
	condThread = 0;

	if(idThread != 0)
	{
		pthread_join(idThread, NULL);
		idThread = 0;
	}

    InitMsg();
}
示例#3
0
文件: testmsg.c 项目: rauls/iReporter
// 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;
}
示例#4
0
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 );
    }
}
示例#5
0
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();
}
示例#6
0
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 );
}
示例#7
0
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;
    }
}