cmdnov.c
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C语言 代码 · 共 709 行 · 第 1/2 页
C
709 行
unsigned_32 value;
if( !GetLong( &value ) ) return FALSE;
FmtData.u.nov.exeflags |= value;
return( TRUE );
}
extern bool ProcCustom( void )
/****************************/
{
if( !GetToken( SEP_EQUALS, TOK_INCLUDE_DOT | TOK_IS_FILENAME ) ) {
return( FALSE );
}
FmtData.u.nov.customdata = tostring(); // no default extension.
return( TRUE );
}
extern bool ProcMessages( void )
/******************************/
{
if( !GetToken( SEP_EQUALS, TOK_INCLUDE_DOT | TOK_IS_FILENAME ) ) {
return( FALSE );
}
FmtData.u.nov.messages = tostring(); // no default extension.
return( TRUE );
}
extern bool ProcHelp( void )
/**************************/
{
if( !GetToken( SEP_EQUALS, TOK_INCLUDE_DOT | TOK_IS_FILENAME ) ) {
return( FALSE );
}
FmtData.u.nov.help = tostring(); // no default extension.
return( TRUE );
}
extern bool ProcXDCData( void )
/*****************************/
{
if( !GetToken( SEP_EQUALS, TOK_INCLUDE_DOT | TOK_IS_FILENAME ) ) {
return( FALSE );
}
FmtData.u.nov.rpcdata = tostring(); // no default extension.
return( TRUE );
}
extern bool ProcSharelib( void )
/******************************/
{
if( !GetToken( SEP_EQUALS, TOK_INCLUDE_DOT | TOK_IS_FILENAME ) ) {
return( FALSE );
}
FmtData.u.nov.sharednlm = FileName( Token.this, Token.len, E_NLM, FALSE );
return( TRUE );
}
extern bool ProcExit( void )
/**************************/
{
if( !GetToken( SEP_EQUALS, TOK_INCLUDE_DOT ) ) {
return( FALSE );
}
FmtData.u.nov.exitfn = tostring();
return( TRUE );
}
extern bool ProcThreadName( void )
/*******************************/
{
if( !GetToken( SEP_NO, TOK_INCLUDE_DOT ) ) {
return( FALSE );
} else if( Token.len > MAX_THREAD_NAME_LENGTH ) {
LnkMsg( LOC+LINE+WRN+MSG_VALUE_TOO_LARGE, "s", "threadname" );
} else {
FmtData.u.nov.threadname = tostring();
}
return( TRUE );
}
#define COPYRIGHT_START "Copyright 1991"
#define DEFAULT_COPYRIGHT COPYRIGHT_START " Novell, Inc. All rights reserved"
#define DEFAULT_COPYRIGHT_LENGTH (sizeof( DEFAULT_COPYRIGHT ) - 1)
#define YEAR_OFFSET (sizeof( COPYRIGHT_START ) - 1)
extern bool ProcCopyright( void )
/*******************************/
{
struct tm * currtime;
time_t thetime;
unsigned year;
char * copy_year;
if( !GetToken( SEP_EQUALS, TOK_INCLUDE_DOT )
&& !GetToken( SEP_NO, TOK_INCLUDE_DOT) ) {
if( FmtData.u.nov.copyright != NULL ) {
_LnkFree( FmtData.u.nov.copyright ); // assume second is correct.
}
_ChkAlloc( FmtData.u.nov.copyright, DEFAULT_COPYRIGHT_LENGTH + 1 );
memcpy(FmtData.u.nov.copyright,DEFAULT_COPYRIGHT,DEFAULT_COPYRIGHT_LENGTH+1);
copy_year = FmtData.u.nov.copyright + YEAR_OFFSET;
thetime = time( NULL );
currtime = localtime( &thetime );
year = currtime->tm_year + 1900;
while( year > 0 ) {
*copy_year = '0' + (year % 10);
year /= 10;
copy_year--;
}
} else {
if( Token.len > MAX_COPYRIGHT_LENGTH ) {
LnkMsg( LOC+LINE+WRN+MSG_VALUE_TOO_LARGE, "s", "copyright" );
} else {
if( FmtData.u.nov.copyright != NULL ) {
_LnkFree( FmtData.u.nov.copyright ); // assume second is correct.
}
FmtData.u.nov.copyright = tostring();
}
}
return( TRUE );
}
extern bool ProcNovell( void )
/****************************/
{
if( !ProcOne( NovModels, SEP_NO, FALSE ) ) { // get file type
int nType = 0;
if((nType = atoi(Token.this)) > 0)
{
GetToken( SEP_NO, TOK_INCLUDE_DOT);
ProcModuleTypeN(nType);
}
else
ProcNLM();
}
if( !GetToken( SEP_QUOTE, TOK_INCLUDE_DOT ) ) { // get description
FmtData.u.nov.description = NULL;
return( TRUE );
}
if( Token.len > MAX_DESCRIPTION_LENGTH ) {
LnkMsg( LOC+LINE+ERR+MSG_VALUE_TOO_LARGE, "s", "description" );
} else {
FmtData.u.nov.description = tostring();
}
return( TRUE );
}
extern void SetNovFmt( void )
/***************************/
{
Extension = E_NLM;
if( !(LinkState & FMT_SPECIFIED) && Name != NULL ) {
FmtData.u.nov.description = FileName( Name, strlen( Name ), E_NLM,
CmdFlags & CF_UNNAMED );
}
}
extern void FreeNovFmt( void )
/****************************/
{
_LnkFree( FmtData.u.nov.screenname );
_LnkFree( FmtData.u.nov.description );
_LnkFree( FmtData.u.nov.checkfn );
_LnkFree( FmtData.u.nov.exitfn );
_LnkFree( FmtData.u.nov.customdata );
_LnkFree( FmtData.u.nov.threadname );
_LnkFree( FmtData.u.nov.copyright );
_LnkFree( FmtData.u.nov.messages );
_LnkFree( FmtData.u.nov.help );
_LnkFree( FmtData.u.nov.rpcdata );
_LnkFree( FmtData.u.nov.sharednlm );
/* FreeList( FmtData.u.nov.exp.export );
FreeList( FmtData.u.nov.exp.module ); Permalloc'd now */
}
extern bool ProcNLM( void )
/*************************/
{
Extension = E_NLM;
FmtData.u.nov.moduletype = 0;
return( TRUE );
}
extern bool ProcLAN( void )
/*************************/
{
Extension = E_LAN;
FmtData.u.nov.moduletype = 1;
return( TRUE );
}
extern bool ProcDSK( void )
/*************************/
{
Extension = E_DSK;
FmtData.u.nov.moduletype = 2;
return( TRUE );
}
extern bool ProcNAM( void )
/*************************/
{
Extension = E_NAM;
FmtData.u.nov.moduletype = 3;
return( TRUE );
}
extern bool ProcModuleType4( void )
/*************************/
{
Extension = E_NLM;
FmtData.u.nov.moduletype = 4;
return( TRUE );
}
extern bool ProcModuleType5( void )
/*************************/
{
Extension = E_NOV_MSL;
FmtData.u.nov.moduletype = 5;
return( TRUE );
}
extern bool ProcModuleType6( void )
/*************************/
{
Extension = E_NLM;
FmtData.u.nov.moduletype = 6;
return( TRUE );
}
extern bool ProcModuleType7( void )
/*************************/
{
Extension = E_NLM;
FmtData.u.nov.moduletype = 7;
return( TRUE );
}
extern bool ProcModuleType8( void )
/*************************/
{
Extension = E_NOV_HAM;
FmtData.u.nov.moduletype = 8;
return( TRUE );
}
extern bool ProcModuleType9( void )
/*************************/
{
Extension = E_NOV_CDM;
FmtData.u.nov.moduletype = 9;
return( TRUE );
}
#if 0
/*
// as I have got tired ot writing, module types 10 through 12 are reserved */
extern bool ProcModuleType10( void )
/*************************/
{
Extension = ;
FmtData.u.nov.moduletype = 10;
return( TRUE );
}
extern bool ProcModuleType11( void )
/*************************/
{
Extension = ;
FmtData.u.nov.moduletype = 11;
return( TRUE );
}
extern bool ProcModuleType12( void )
/*************************/
{
Extension = ;
FmtData.u.nov.moduletype = 12;
return( TRUE );
}
#endif
static bool ProcModuleTypeN( int n )
/*************************/
{
Extension = E_NLM;
FmtData.u.nov.moduletype = n;
return( TRUE );
}
static bool GetNovModule( void )
/******************************/
{
AddNameTable( Token.this, Token.len, FALSE, &FmtData.u.nov.exp.module );
return( TRUE );
}
extern bool ProcModule( void )
/****************************/
{
return( ProcArgList( GetNovModule, TOK_INCLUDE_DOT ) );
}
extern bool ProcOSDomain( void )
/******************************/
{
FmtData.u.nov.exeflags |= NOV_OS_DOMAIN;
return( TRUE );
}
extern bool ProcNovDBIExports( void )
/***********************************/
{
FmtData.u.nov.flags |= DO_NOV_EXPORTS;
return( TRUE );
}
extern bool ProcNovDBIReferenced( void )
/**************************************/
{
FmtData.u.nov.flags |= DO_NOV_REF_ONLY;
return( TRUE );
}
extern bool ProcNovDBI( void )
/****************************/
{
LinkFlags |= NOVELL_DBI_FLAG;
if( ProcOne( NovDBIOptions, SEP_NO, FALSE ) ) {
while( ProcOne( NovDBIOptions, SEP_COMMA, FALSE ) ); /*null loop*/
}
return( TRUE );
}
extern bool ProcExportsDBI( void )
/********************************/
{
DBIFlag |= DBI_ONLY_EXPORTS;
FmtData.u.nov.flags |= DO_WATCOM_EXPORTS;
return( TRUE );
}
extern void CmdNovFini( void )
/****************************/
{
if( FmtData.u.nov.description == NULL && Name != NULL ) {
FmtData.u.nov.description = FileName( Name, strlen( Name ), Extension,
CmdFlags & CF_UNNAMED );
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?