static lib_handle FindSrcFile( char *fname ) { //============================================= // Find a source file. lib_handle lp; MakeName( fname, SDSrcExtn( fname ), fname ); lp = SDOpen( fname, READ_FILE ); if( lp != NULL ) { SrcInclude( fname ); } return( lp ); }
void Include( char *inc_name ) { //================================= file_handle fp; char bld_name[MAX_FILE+1]; char err_msg[ERR_BUFF_SIZE+1]; SDInitAttr(); CopyMaxStr( inc_name, bld_name, MAX_FILE ); MakeName( bld_name, SDSrcExtn( bld_name ), bld_name ); if( AlreadyOpen( inc_name ) ) return; if( AlreadyOpen( bld_name ) ) return; // try file called <include_name>.FOR. fp = SDOpen( bld_name, READ_FILE ); if( fp != NULL ) { SrcInclude( bld_name ); CurrFile->fileptr = fp; } else { // get error message before next i/o SDError( NULL, err_msg ); // try library fp = IncSearch( inc_name ); if( fp != NULL ) { // SrcInclude( inc_name ) now done in LIBSUPP CurrFile->fileptr = fp; CurrFile->flags |= INC_LIB_MEMBER; } else { // could not open include file InfoError( SM_OPENING_FILE, bld_name, err_msg ); } } // clear RetCode so that we don't get "file not found" returned // because we could not open include file RetCode = _SUCCESSFUL; AddDependencyInfo( CurrFile ); }
void OpenSrc( void ) { //======================= file_handle fp; char err_msg[ERR_BUFF_SIZE+1]; char bld_name[MAX_FILE+1]; bool erase_err; erase_err = ErrFile == NULL; SDInitAttr(); MakeName( SrcName, SrcExtn, bld_name ); fp = SDOpen( bld_name, READ_FILE ); if( fp != NULL ) { SrcInclude( bld_name ); CurrFile->fileptr = fp; } else { SDError( NULL, err_msg ); InfoError( SM_OPENING_FILE, bld_name, err_msg ); } if( erase_err ) { CloseErr(); Erase( ErrExtn ); } }