Beispiel #1
0
void PrintfUsage( void )
{
    char        msg_buff[MAX_MESSAGE_SIZE];
    unsigned    count;
    char        page_text[MAX_MESSAGE_SIZE];
    int         first_ln;

    count = PrintBanner();
#ifdef __OSI__
    if( _Copyright != NULL ) {
        puts( _Copyright );
        count += 1;
    }
#endif
    first_ln = MSG_USAGE_BASE;
    MsgGet( first_ln++, page_text );
    for( ; ; first_ln++ ) {
        if( ++count >= 23 ) {
            if( Wait_for_return( page_text ) ) {
                break;
            }
            count = 0;
        }
        MsgGet( first_ln, msg_buff );
        if( ( msg_buff[ 0 ] == '.' ) && ( msg_buff[ 1 ] == 0 ) )
            break;
        puts( msg_buff );
    }
}
Beispiel #2
0
int MsgInit( void )
{
#if !defined( USE_TEXT_MSGS )
    int         initerror;
    char        name[_MAX_PATH];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) == NULL ) {
        initerror = 1;
    } else {
        hInstance.filename = name;
        OpenResFile( &hInstance );
        if( hInstance.handle == NIL_HANDLE ) {
            initerror = 1;
        } else {
            initerror = FindResources( &hInstance );
            if( !initerror ) {
                initerror = InitResources( &hInstance );
            }
        }
    }
    MsgShift = WResLanguage() * MSG_LANG_SPACING;
    if( !initerror && !MsgGet( MSG_USE_BASE, name ) ) {
        initerror = 1;
    }
    if( initerror ) {
        write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
        MsgFini();
        return( 0 );
    }
#endif
    return( 1 );
}
Beispiel #3
0
STATIC void usage( void ) {

    char        msgbuff[MAX_RESOURCE_SIZE];
    int         previous_null = 0;
    int         i;

    header();
    for( i = MSG_USE_BASE;; i++ ) {
        MsgGet( i, msgbuff );
        if( ( msgbuff[ 0 ] == '.' ) && ( msgbuff[ 1 ] == 0 ) ) break;
        if( previous_null ) {
            if( msgbuff[0] != '\0' ) {
                waitForKey();
                PrtFmt( msgbuff );
                PrtFmt( "\n" );
                previous_null = 0;
            } else break;
        } else if( msgbuff[0] == '\0' ) {
            previous_null = 1;
        } else {
            PrtFmt( msgbuff );
            PrtFmt( "\n" );
        }
    }
    exit( EXIT_FAILURE );
}
Beispiel #4
0
void PrintfUsage( int first_ln )
{
    char        msg_buff[128];
    unsigned    count;

    count = trademark();
#ifdef __OSI__
    if( _Copyright != NULL ) {
        puts( _Copyright );
        count += 1;
    }
#endif
    for( ;; first_ln++ ) {
#ifndef __UNIX__
        if( ++count >= 23 ) {
            Wait_for_return();
            count = 0;
        }
#endif
        MsgGet( first_ln, msg_buff );
        if( ( msg_buff[ 0 ] == '.' ) && ( msg_buff[ 1 ] == 0 ) )
            break;
        puts( msg_buff );
    }
}
Beispiel #5
0
void MsgPrintf( int resourceid )
{
    char        msgbuf[MAX_MESSAGE_SIZE];

    PrintBanner();
    MsgGet( resourceid, msgbuf );
    printf( "%s", msgbuf );
}
Beispiel #6
0
void MsgPrintf1( int resourceid, const char *token )
{
    char        msgbuf[MAX_MESSAGE_SIZE];

    PrintBanner();
    MsgGet( resourceid, msgbuf );
    printf( msgbuf, token );
}
Beispiel #7
0
STATIC void unrecognized( char opt ) {
    char        msgbuff[MAX_RESOURCE_SIZE];

    header();
    MsgGet( MSG_SYNTAX_ERR_IN_OPT, msgbuff );
    PrtFmt( msgbuff, opt );
    PrtFmt( "\n" );
    usage();
}
Beispiel #8
0
void MsgPrintf1( int resourceid, char *token )
{
    char        msgbuf[128];

    if( !Options.banner_printed ) {
        Options.banner_printed = TRUE;
        trademark();
    }
    MsgGet( resourceid, msgbuf );
    printf( msgbuf, token );
}
Beispiel #9
0
void MsgGetTail( int resourceid, char *buffer )
/*********************************************/
{
    char        msg[MAX_RESOURCE_SIZE];
    char const  *p;

    MsgGet( resourceid, msg );
    for( p = msg; (p = strchr( p, '%' )) != NULL && *(++p) != 'L'; ++p ) {
    }
    if( p != NULL ) {
        strcpy( buffer, (++p) );
    }
}
Beispiel #10
0
void MsgSubStr( int resourceid, char *buff, char *p )
/***************************************************/
{
    char        msgbuff[MAX_RESOURCE_SIZE];
    char        *src;
    char        *dest;
    char        ch;

    MsgGet( resourceid, msgbuff );
    src = msgbuff;
    dest = buff;
    for(;;) {
        ch = *src++;
        if( ch == '\0' ) break;
        if( ch != '%' ) {
            *dest++ = ch;
        } else {
            ch = *src++;
            switch( ch ) {
            case 's' :
                dest = strApp( dest, p );
                break;
            case 'Z' :
                {
                    char    tmpbuff[MAX_RESOURCE_SIZE];

                    MsgGet( MSG_SYS_ERR_0+errno, tmpbuff );
                    dest = strApp( dest, tmpbuff );
                }
                break;
            default :
                *dest++ = ch;
                break;
            }
        }
    }
    *dest = '\0';
}
Beispiel #11
0
void FatalError( int str, ... )
{
    va_list             arglist;
    char                buff[ MAX_ERROR_SIZE ];
    char                msg[ 512 ];
    IDEMsgInfo          msg_info;

    va_start( arglist, str );
    MsgGet( str, buff );
    _vbprintf( msg, 512, buff, arglist );
    if( ideCb ) {
        IdeMsgInit( &msg_info, IDEMSGSEV_ERROR, msg );
        ideCb->PrintWithInfo( ideHdl, &msg_info );
    }
    va_end( arglist );
    longjmp( Env, 1 );
}
Beispiel #12
0
static void parse_cmdline( char **cmdline )
/*****************************************/
{
    char msgbuf[80];
    int  level = 0;

    if( cmdline == NULL || *cmdline == NULL || **cmdline == 0 ) {
        usage_msg();
    }
    for( ;*cmdline != NULL; ++cmdline ) {
        ProcOptions( *cmdline, &level );
    }
    if( AsmFiles.fname[ASM] == NULL ) {
        MsgGet( NO_FILENAME_SPECIFIED, msgbuf );
        Fatal( MSG_CANNOT_OPEN_FILE, msgbuf );
    }
}
Beispiel #13
0
void Warning( int str, ... )
{
    va_list             arglist;
    char                buff[ MAX_ERROR_SIZE ];
    char                msg[ 512 ];
    IDEMsgInfo          msg_info;

    if( Options.quiet )
        return;
    MsgGet( str, buff );
    va_start( arglist, str );
    _vbprintf( msg, 512, buff, arglist );
    if( ideCb ) {
        IdeMsgInit( &msg_info, IDEMSGSEV_WARNING, msg );
        ideCb->PrintWithInfo( ideHdl, &msg_info );
    }
    va_end( arglist );
}
Beispiel #14
0
bool MsgInit( void )
{
#if !defined( USE_TEXT_MSGS )
    char        name[_MAX_PATH];

    hInstance.status = 0;
    if( _cmdname( name ) != NULL && OpenResFile( &hInstance, name ) ) {
        MsgShift = _WResLanguage() * MSG_LANG_SPACING;
        if( MsgGet( MSG_USAGE_BASE, name ) ) {
            return( true );
        }
    }
    CloseResFile( &hInstance );
    posix_write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    return( false );
#else
    return( true );
#endif
}
Beispiel #15
0
int MsgInit( void )
/******************/
{
    char        name[_MAX_PATH];
    char        dummy[MAX_RESOURCE_SIZE];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( MsgGet( MSG_USAGE_BASE, dummy ) ) {
                return( true );
            }
        }
    }
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    MsgFini();
    return( false );
}
Beispiel #16
0
void Usage( void )
{
    char                buff[ MAX_ERROR_SIZE ];
    int                 str;
    int                 str_first;
    int                 str_last;
    IDEMsgInfo          msg_info;
    int                 count;
    if( ideCb ) {
        msg_info.severity = IDEMSGSEV_BANNER;
        count = 3;
        msg_info.flags = 0;
        msg_info.helpfile = NULL;
        msg_info.helpid = 0;
        msg_info.msg = buff;
        if( Options.ar ) {
            str_first = USAGE_AR_FIRST;
            str_last = USAGE_AR_LAST;
        } else {
            str_first = USAGE_WLIB_FIRST;
            str_last = USAGE_WLIB_LAST;
        }
        for( str = str_first; str <= str_last; ++str ) {
            MsgGet( str, buff );
#ifndef __UNIX__
            if( ideInfo && ideInfo->ver > 2 && ideInfo->console_output &&
                ( count > 20 && buff[ 0 ] == '\0' || count == 24 ) ) {
                msg_info.msg = "    (Press Return to continue)" ;
                ideCb->PrintWithInfo( ideHdl, &msg_info );
                getch();
                count = 0;
                msg_info.msg = buff;
            }
#endif
            ++count;
            if( buff[ 0 ] == '\0' ) {
                continue;
            }
            ideCb->PrintWithInfo( ideHdl, &msg_info );
        }
    }
    longjmp( Env, 1 );
}
Beispiel #17
0
bool MsgInit( void )
{
    char            name[_MAX_PATH];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        res_failure = false;
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( MsgGet( WDIS_LITERAL_BASE, name ) ) {
                return( true );
            }
        }
        MsgFini();
    }
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    res_failure = true;
    return( false );
}
Beispiel #18
0
bool MsgInit( void )
/******************/
{
#ifndef BOOTSTRAP
    static char     name[_MAX_PATH]; // static because address passed outside.

    hInstance.status = 0;
    if( _cmdname( name ) != NULL && OpenResFile( &hInstance, name ) ) {
        MsgShift = _WResLanguage() * MSG_LANG_SPACING;
        if( MsgGet( MSG_USAGE_BASE, name ) ) {
            return( true );
        }
    }
    CloseResFile( &hInstance );
    posix_write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    return( false );
#else
    return( true );
#endif
}
Beispiel #19
0
void PutMsg( FILE *fp, int severity, int msgnum, va_list args )
/********************************************************************/
{
    int             i,j;
    char           *type;
    char            msgbuf[MAXMSGSIZE];
    char            buffer[MAX_LINE_LEN];

    if( fp != NULL ) {

        MsgGet( msgnum, msgbuf );
        switch (severity ) {
        case 1:  type = MsgGetEx( MSG_FATAL_PREFIX );   break;
        case 2:  type = MsgGetEx( MSG_ERROR_PREFIX );   break;
        case 4:  type = MsgGetEx( MSG_WARNING_PREFIX ); break;
        default:  type = NULL; i = 0; break;
        }
        if ( type )
            i = sprintf( buffer, "%s A%4u: ", type, severity * 1000 + msgnum );
        i += vsprintf( buffer+i, msgbuf, args );
        //buffer[i] = NULLC;

        if ( severity && (j = GetCurrSrcPos( msgbuf ))) {
            fwrite( msgbuf, 1, j, fp );
        } else
            j = 0;
        fwrite( buffer, 1, i, fp );
        fwrite( "\n", 1, 1, fp );

        /* if in Pass 1, add the error msg to the listing */
        if ( FileInfo.file[LST] &&
             severity &&
             Parse_Pass == PASS_1 &&
             fp == FileInfo.file[ERR] ) {
            LstWrite( LSTTYPE_DIRECTIVE, GetCurrOffset(), 0 );
            LstPrintf( "                           %s", buffer );
            LstNL();
        }
    }
}
Beispiel #20
0
int MsgInit( void )
/*****************/
{
#ifndef BOOTSTRAP
    static char     name[_MAX_PATH]; // static because address passed outside.

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( MsgGet( MSG_USAGE_BASE, name ) ) {
                return( 1 );
            }
        }
    }
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    MsgFini();
    return( 0 );
#else    
    return( 1 );
#endif
}
Beispiel #21
0
bool MsgReOrder( int resourceid, char *buff, char **paratype )
/************************************************************/
{
    bool    rvalue = false;

    MsgGet( resourceid, buff );
    *paratype = msgInTable( resourceid );
    if( *paratype != NULL ) {
        buff = strchr( buff, '%' );
        while( buff != NULL ) {
            if( *(buff + 1) == '%' ) {
                buff++;
            } else if( *(buff + 1) == **paratype ) {
                break;
            } else if( *(buff + 1) == *(*paratype + 1) ) {
                rvalue = true;
                break;
            }
            buff = strchr( (buff + 1), '%' );
        }
    }
    return( rvalue );
}
void CMsgQueueHandler::ServiceL(const RMessage2& aMessage)
	{
	CMessageQueue* tempMq;
	switch (aMessage.Function())
		{
		case EMsgGet:
			MsgGet(aMessage);
			break;

		case EMsgCtl:
			MsgCtl(aMessage);
			break;
		
		case EMsgRcv:

			TInt index;
			tempMq = FindById (aMessage.Int0 (), index);
			if ( tempMq)
				{
				if ( tempMq->CheckPerm( EUserRead | EOthersRead, aMessage) )
					{
					//message wil; be completed by SendRcv itself if required
					tempMq->iExternal = ETrue;
					tempMq->RcvMsg (aMessage);
					}
				else
					{
					aMessage.Complete (KErrPermissionDenied);
					}
				}
			else
				{
				aMessage.Complete (KErrArgument);
				}

			break;

		case EMsgSnd:
		
			TInt index2;
			tempMq	= FindById (aMessage.Int0 (), index2);
			if ( tempMq)
				{
				if ( tempMq->CheckPerm( EUserWrite | EOthersWrite, aMessage))
					{
					//message wil; be completed by SendMsg itself if required
					tempMq->iExternal = ETrue;
					tempMq->SndMsg (aMessage);
					}
				else
					{
					aMessage.Complete (KErrPermissionDenied);
					}
				}
			else
				{
				aMessage.Complete (KErrArgument);
				}

			break;
			
		default:
			User::Leave(KErrNotSupported);
			break;
		}
	}
Beispiel #23
0
void main( int argc, char *argv[] ) {
#pragma on (unreferenced);

    uint        i;
    uint        num_files;
    cmdline_t   *cmd;
    int         multi_module;
    pobj_lib_info pli;

    atexit( cleanupHandler );
    MemInit();
    MsgInit( argv[0] );
    cmd = CmdLineParse();
    init();
    while( cmd->action != NULL ) {
        ActionInit( cmd );
        num_files = cmd->action->num_files;
        i = 0;
        do {
            ActionInfile( cmd, inputFile, i );
            fileIn = ObjReadOpen( inputFile );
            if( fileIn == NULL ) {
                Fatal( MSG_UNABLE_TO_OPEN_FILE, inputFile );
            }
            if( cmd->need_output ) {
                ActionOutfile( cmd, outputFile, i );
                fileOut = ObjWriteOpen( outputFile );
                if( fileOut == NULL ) {
                    Fatal( MSG_UNABLE_TO_OPEN_FILE, outputFile );
                }
            } else {
                fileOut = NULL;
            }
            if( cmd->quiet == 0 ) {
                char    msgbuff[MAX_RESOURCE_SIZE];

                MsgGet( MSG_CONVERTING, msgbuff );
                PrtFmt( msgbuff, inputFile );
                PrtFmt( "\n" );
            }
            pli.is_lib = 0;
            do {
                multi_module = PObj( fileIn, fileOut, &pli );
                prune();
            } while( multi_module );
            ObjReadClose( fileIn );
            if( fileOut != NULL ) {
                ObjWriteClose( fileOut );
                ActionRename( cmd, inputFile, outputFile, i, pli.is_lib,
                    pli.page_len );
            }
            ++i;
        } while( i < num_files );
        ActionFini( cmd );
    }
    fini();
    MsgFini();
    MemFini();
    outputFile[0] = '\0';
    exit( EXIT_SUCCESS );
}
Beispiel #24
0
static void get_fname( char *token, int type )
/********************************************/
/*
 * figure out the source file name & store it in AsmFiles
 * fill in default object file name if it is null
 */
{
    char        name [ _MAX_PATH  ];
    char        msgbuf[80];
    PGROUP      pg;
    PGROUP      def;

    /* get filename for source file */

    if( type == ASM ) {
        if( token == NULL ) {
            MsgGet( SOURCE_FILE, msgbuf );
            Fatal( MSG_CANNOT_OPEN_FILE, msgbuf );
        }
        if( AsmFiles.fname[ASM] != NULL ) {
            Fatal( MSG_TOO_MANY_FILES );
        }

        _splitpath2( token, pg.buffer, &pg.drive, &pg.dir, &pg.fname, &pg.ext );
        if( *pg.ext == '\0' ) {
            pg.ext = ASM_EXT;
        }
        _makepath( name, pg.drive, pg.dir, pg.fname, pg.ext );
        AsmFiles.fname[ASM] = AsmAlloc( strlen( name ) + 1 );
        strcpy( AsmFiles.fname[ASM], name );

        _makepath( name, pg.drive, pg.dir, NULL, NULL );
        /* add the source path to the include path */
        AddStringToIncludePath( name );

        if( AsmFiles.fname[OBJ] == NULL ) {
            /* set up default object and error filename */
            pg.ext = OBJ_EXT;
            _makepath( name, NULL, NULL, pg.fname, pg.ext );
        } else {
            _splitpath2( AsmFiles.fname[OBJ], def.buffer, &def.drive,
                         &def.dir, &def.fname, &def.ext );
            if( *def.fname == NULLC )
                def.fname = pg.fname;
            if( *def.ext == NULLC )
                def.ext = OBJ_EXT;

            _makepath( name, def.drive, def.dir, def.fname, def.ext );
            AsmFree( AsmFiles.fname[OBJ] );
        }
        AsmFiles.fname[OBJ] = AsmAlloc( strlen( name ) + 1 );
        strcpy( AsmFiles.fname[OBJ], name );

        if( AsmFiles.fname[ERR] == NULL ) {
            pg.ext = ERR_EXT;
            _makepath( name, NULL, NULL, pg.fname, pg.ext );
        } else {
            _splitpath2( AsmFiles.fname[ERR], def.buffer, &def.drive,
                         &def.dir, &def.fname, &def.ext );
            if( *def.fname == NULLC )
                def.fname = pg.fname;
            if( *def.ext == NULLC )
                def.ext = ERR_EXT;
            _makepath( name, def.drive, def.dir, def.fname, def.ext );
            AsmFree( AsmFiles.fname[ERR] );
        }
        AsmFiles.fname[ERR] = AsmAlloc( strlen( name ) + 1 );
        strcpy( AsmFiles.fname[ERR], name );

        if( AsmFiles.fname[LST] == NULL ) {
            pg.ext = LST_EXT;
            _makepath( name, NULL, NULL, pg.fname, pg.ext );
        } else {
            _splitpath2( AsmFiles.fname[LST], def.buffer, &def.drive,
                         &def.dir, &def.fname, &def.ext );
            if( *def.fname == NULLC )
                def.fname = pg.fname;
            if( *def.ext == NULLC )
                def.ext = LST_EXT;
            _makepath( name, def.drive, def.dir, def.fname, def.ext );
            AsmFree( AsmFiles.fname[LST] );
        }
        AsmFiles.fname[LST] = AsmAlloc( strlen( name ) + 1 );
        strcpy( AsmFiles.fname[LST], name );

    } else {
        /* get filename for object, error, or listing file */
        _splitpath2( token, pg.buffer, &pg.drive, &pg.dir, &pg.fname, &pg.ext );
        if( AsmFiles.fname[ASM] != NULL ) {
            _splitpath2( AsmFiles.fname[ASM], def.buffer, &def.drive,
                         &def.dir, &def.fname, &def.ext );
            if( *pg.fname == NULLC ) {
                pg.fname = def.fname;
            }
        }
        if( *pg.ext == NULLC ) {
            switch( type ) {
            case ERR:   pg.ext = ERR_EXT;  break;
            case LST:   pg.ext = LST_EXT;  break;
            case OBJ:   pg.ext = OBJ_EXT;  break;
            }
        }
        _makepath( name, pg.drive, pg.dir, pg.fname, pg.ext );
        if( AsmFiles.fname[type] != NULL ) {
            AsmFree( AsmFiles.fname[type] );
        }
        AsmFiles.fname[type] = AsmAlloc( strlen( name ) + 1 );
        strcpy( AsmFiles.fname[type], name );
    }
}