From: Tony v. d. H. <to...@us...> - 2004-05-03 15:04:19
|
Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/BindHelp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13995/!OsLib/Tools/BindHelp Modified Files: .cvsignore BindHelp.c Added Files: AMUmakefile GNUmakefile Make,fd7 Removed Files: !Clean,fd7 !Make,fd7 Makefile,fe1 Log Message: merged Unix-Build back into trunk (20040503-1) Index: .cvsignore =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/BindHelp/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** .cvsignore 27 Nov 2002 22:11:00 -0000 1.2 --- .cvsignore 3 May 2004 15:03:31 -0000 1.3 *************** *** 1 **** --- 1,2 ---- o + BindHelp --- NEW FILE: AMUmakefile --- # # Makefile for BindHelp under RISC OS. # #------------------------------------------------------------------------ #target-specific macros TARGET = BindHelp ALL = ${TARGET} VPATH = INCLUDES = OSLibSupport: OSLib: C: DEFINES = LIBS = OSLibSupport:o.${SUPPORT} OSLib:o.${OSLib} C:o.Stubs MODULES = ${TARGET} # all the general rules are in ^.AMUmakefile/source include ${MAKEFILEDIR}.^.AMUmakefile/source --- !Make,fd7 DELETED --- --- NEW FILE: Make,fd7 --- Echo <Sys$Time> !OSLib.Tools.BindHelp.Make %0 WIMPSlot -min 1024K -max 1024K if "<C$MODE>" = "32" then Do AMU -D -f <Obey$Dir>.AMUmakefile -desktop %0 APCS=32 if "<C$MODE>"<> "32" then Do AMU -D -f <Obey$Dir>.AMUmakefile -desktop %0 APCS=26 Echo <Sys$Time> Done. --- !Clean,fd7 DELETED --- Index: BindHelp.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/BindHelp/BindHelp.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BindHelp.c 29 Dec 2003 11:40:20 -0000 1.6 --- BindHelp.c 3 May 2004 15:03:31 -0000 1.7 *************** *** 74,81 **** */ - #ifndef TRACE - #define TRACE 0 - #endif - #define USE_STRONGHELP 0 /* set true to generate dest using StrongHelp filer calls */ --- 74,77 ---- *************** *** 96,100 **** /* From OSLibSupport */ ! #include "X.h" #include "trace.h" --- 92,96 ---- /* From OSLibSupport */ ! #include "x.h" #include "trace.h" *************** *** 114,117 **** --- 110,122 ---- ( x ) = 0 + #define RO_DIR_SEP "." + #define UNIX_DIR_SEP "/" + + #ifdef EXECUTE_ON_UNIX + #define DIR_SEP UNIX_DIR_SEP + #else + #define DIR_SEP RO_DIR_SEP + #endif + /* data structures */ typedef struct *************** *** 172,176 **** /* globals */ static int index_entries; ! static char *index[ INDEX_SIZ ]; static char *src_path; static char *dst_path; --- 177,181 ---- /* globals */ static int index_entries; ! static char *man_index[ INDEX_SIZ ]; static char *src_path; static char *dst_path; *************** *** 211,215 **** int s; s = sizeof( dir_entry_header) + str_block_size( entry -> name ); ! // tracef( "dir_entry_size: %04x; %s\n" _ s _ entry->name ); return s; } --- 216,220 ---- int s; s = sizeof( dir_entry_header) + str_block_size( entry -> name ); ! tracef( "dir_entry_size: %04x; %s\n" _ s _ entry->name ); return s; } *************** *** 229,233 **** size += dir_entry_size( entry ); } ! // tracef( "dir_size: %04x\n" _ size ); return size; } --- 234,238 ---- size += dir_entry_size( entry ); } ! tracef( "dir_size: %04x\n" _ size ); return size; } *************** *** 281,285 **** cmp = stricmp( s0, s1 ); ! // tracef( "cmp (\"%s\" \"%s\") = %i\n" _ s0 _ s1 _ SGN(cmp) ); return cmp; } --- 286,290 ---- cmp = stricmp( s0, s1 ); ! tracef( "cmp (\"%s\" \"%s\") = %i\n" _ s0 _ s1 _ SGN(cmp) ); return cmp; } *************** *** 298,305 **** size = (size + 3 ) & ~3; if( ptr < 0 ) ptr = osargs_read_extw( handle ); - unwritten = osgbpb_write_atw( handle, buf, size, ptr ); if( unwritten != 0 ) --- 303,311 ---- size = (size + 3 ) & ~3; + tracef( "write_block size: %d; to %d\n" _ size _ ptr ); + if( ptr < 0 ) ptr = osargs_read_extw( handle ); unwritten = osgbpb_write_atw( handle, buf, size, ptr ); if( unwritten != 0 ) *************** *** 324,328 **** dir_list_entry *entry; ! //tracef( "add_obj %s\n" _ name ); entry = x_ALLOC( sizeof( dir_list_entry ) ); --- 330,334 ---- dir_list_entry *entry; ! tracef( "add_obj %s\n" _ name ); entry = x_ALLOC( sizeof( dir_list_entry ) ); *************** *** 429,433 **** header.length = entry -> size + sizeof( data_header ); ! //tracef( "write_dir_entry: offset: %08x; length: %08x; %s\n" \ _ offset \ _ header.length \ --- 435,439 ---- header.length = entry -> size + sizeof( data_header ); ! tracef( "write_dir_entry: offset: %08x; length: %08x; %s\n" \ _ offset \ _ header.length \ *************** *** 473,476 **** --- 479,483 ---- static byte *buf; char temp[ TEMP_MAX ]; + os_error err; #if !USE_STRONGHELP *************** *** 478,482 **** int offset = entry -> offset; ! //tracef( "write_data: offset %08x; %s\n" _ offset _ entry->filename ); /* write the data header */ --- 485,489 ---- int offset = entry -> offset; ! tracef( "write_data: offset %08x; %s\n" _ offset _ entry->filename ); /* write the data header */ *************** *** 493,497 **** fprintf( stdout, " page %s\n", entry -> filename ); ! sprintf( temp, "%s.%s", src_path, entry -> filename ); /* copy the data */ --- 500,504 ---- fprintf( stdout, " page %s\n", entry -> filename ); ! sprintf( temp, "%s"DIR_SEP"%s", src_path, entry -> filename ); /* copy the data */ *************** *** 507,516 **** memset( buf, data_block_size( entry ), 0 ); ! osfile_load_stamped_no_path( temp, buf, NULL, NULL, &size, NULL ); if( entry->size != size ) { x_LOCAL_ERROR( err_filesize, 1, "Filesize mismatch" ); ! fprintf( stderr, "\nwrite_data: file size passed: %d; read %d", entry->size, size ); x_THROW( err_filesize ); } --- 514,530 ---- memset( buf, data_block_size( entry ), 0 ); ! if ( osfile_load_stamped_no_path( temp, buf, NULL, NULL, &size, NULL ) ! != osfile_IS_FILE ! ) ! { ! err.errnum = 0; ! sprintf( err.errmess,"File not found: \"%s\"", temp ); ! x_THROW( &err ); ! } if( entry->size != size ) { x_LOCAL_ERROR( err_filesize, 1, "Filesize mismatch" ); ! tracef( "write_data: file size passed: %d; read %d\n" _ entry->size _ size ); x_THROW( err_filesize ); } *************** *** 521,525 **** #else handle = handle; ! sprintf( temp, "%s.%s", dst_path, entry -> filename ); osfile_save( temp, entry -> stamp_h, entry -> stamp_l, buf, buf + size ); #endif --- 535,539 ---- #else handle = handle; ! sprintf( temp, "%s"DIRSEP"%s", dst_path, entry -> filename ); osfile_save( temp, entry -> stamp_h, entry -> stamp_l, buf, buf + size ); #endif *************** *** 529,535 **** x_CATCH( &x0 ) { ! FREE( buf ); ! x_RETHROW( &x0 ); } return written; } --- 543,554 ---- x_CATCH( &x0 ) { ! tracef( "write_data: Exception caught: errno %d -- \"%s\"\n" \ ! _ x0.error -> errnum \ ! _ x0.error -> errmess ! ); ! FREE( buf ); ! x_RETHROW( &x0 ); } + tracef( "write_data: returning\n" ); return written; } *************** *** 566,570 **** #if !USE_STRONGHELP ! //tracef( "write_dir_list: writing dir at %08x; size %08x\n" _ offset+size _ dirsize ); size += write_block( handle, (byte*)&header, --- 585,589 ---- #if !USE_STRONGHELP ! tracef( "write_dir_list: writing dir at %08x; size %08x\n" _ offset+size _ dirsize ); size += write_block( handle, (byte*)&header, *************** *** 601,605 **** { /* recurse into any lower level dir */ ! //tracef( "write_dir_list: recurses\n" ); if( verbose ) fprintf( stdout, "Directory %s\n", entry -> name ); --- 620,624 ---- { /* recurse into any lower level dir */ ! tracef( "write_dir_list: recurses\n" ); if( verbose ) fprintf( stdout, "Directory %s\n", entry -> name ); *************** *** 631,635 **** #endif ! //tracef( "write_dir_list: returns %08x\n" _ size ); return size; } --- 650,654 ---- #endif ! tracef( "write_dir_list: returns %08x\n" _ size ); return size; } *************** *** 642,647 **** dir_list_entry *entry; ! while( *root != NULL ) { entry = *root; *root = entry -> next; --- 661,668 ---- dir_list_entry *entry; ! while( root && *root ) { + //tracef( "delete_dir_entry 0x%x\n" _ *root ); + entry = *root; *root = entry -> next; *************** *** 668,673 **** #if !USE_STRONGHELP dir_entry_header dir; char* name = "$"; ! offset = osargs_read_extw( handle ); --- 689,697 ---- #if !USE_STRONGHELP dir_entry_header dir; + #if 0 char* name = "$"; ! #else ! char name[4] = {'$',0,0,0}; ! #endif offset = osargs_read_extw( handle ); *************** *** 692,696 **** size = write_dir_list( handle, root, offset, pass ); ! //tracef( "write_file: wrote %08x bytes\n" _ size ); } --- 716,720 ---- size = write_dir_list( handle, root, offset, pass ); ! tracef( "write_file: wrote %08x bytes\n" _ size ); } *************** *** 711,715 **** #else file_header header; ! //tracef( "create_file - %s \n" _ name ); handle = osfind_openoutw( osfind_NO_PATH, --- 735,739 ---- #else file_header header; ! tracef( "create_file - %s \n" _ name ); handle = osfind_openoutw( osfind_NO_PATH, *************** *** 736,740 **** { for( ;index_entries > 0; index_entries-- ) ! free( index[ index_entries - 1 ] ); } --- 760,764 ---- { for( ;index_entries > 0; index_entries-- ) ! free( man_index[ index_entries - 1 ] ); } *************** *** 751,754 **** --- 775,779 ---- x_exception x0; time_t xtime; + char year[8]; if( verbose ) *************** *** 756,767 **** /* sort the index */ ! qsort( index, index_entries, sizeof( index[0] ), Cmp ); /* create an index file in the source dir */ ! sprintf( temp_name, "%s.%s", src_path, "!Root" ); if ( ( index_file = fopen( temp_name, "wb" ) ) == NULL ) x_THROW_LAST_ERROR(); ! //tracef( "file_index writing %s\n" _ temp_name ); x_TRY( &x0 ) { --- 781,792 ---- /* sort the index */ ! qsort( man_index, index_entries, sizeof( man_index[0] ), Cmp ); /* create an index file in the source dir */ ! sprintf( temp_name, "%s"DIR_SEP"%s", src_path, "!Root" ); if ( ( index_file = fopen( temp_name, "wb" ) ) == NULL ) x_THROW_LAST_ERROR(); ! tracef( "file_index writing %s\n" _ temp_name ); x_TRY( &x0 ) { *************** *** 786,790 **** { if ( ( size += fprintf( index_file, ! "<%s=>%s_>\n", index[i], index[i] ) ) < 0 --- 811,815 ---- { if ( ( size += fprintf( index_file, ! "<%s=>%s_>\n", man_index[i], man_index[i] ) ) < 0 *************** *** 795,798 **** --- 820,824 ---- time( &xtime ); strftime( temp, TEMP_MAX, "%d %b %Y", localtime( &xtime ) ); + strftime( year, 8, "%Y", localtime( &xtime ) ); if ( ( size += fprintf( index_file, "#EndTable\n" *************** *** 801,808 **** "#Align Centre\n" "OSLib by {*}Jonathan Coxhead{*}\n" ! "Copyright © Jonathan Coxhead and OSLib Maintainers 1995 - 2002\n" "StrongHelp Manual created %s by BindHelp\n" ! "<http://www.mk-net.demon.co.uk/oslib=>#url>\n" "<mailto:osl...@co...=>#url>\n", temp ) --- 827,836 ---- "#Align Centre\n" "OSLib by {*}Jonathan Coxhead{*}\n" ! "Copyright © Jonathan Coxhead and OSLib Maintainers " ! "1995 - %s\n" "StrongHelp Manual created %s by BindHelp\n" ! "<http://ro-oslib.sourceforge.net=>#url>\n" "<mailto:osl...@co...=>#url>\n", + year, temp ) *************** *** 858,868 **** "%s%s%s%s%s", src_path ? src_path : "", ! src_path ? "." : "", dir ? dir : "", ! dir ? "." : "", file ); ! //tracef( "add_index: reading %s\n" _ temp ); ! source = fopen( temp, "r" ); if ( !source ) x_THROW_LAST_ERROR(); --- 886,897 ---- "%s%s%s%s%s", src_path ? src_path : "", ! src_path ? DIR_SEP : "", dir ? dir : "", ! dir ? DIR_SEP : "", file ); ! ! tracef( "add_index: reading %s\n" _ temp ); ! source = fopen( temp, "r" ); if ( !source ) x_THROW_LAST_ERROR(); *************** *** 875,880 **** /* add to index */ *(temp+strlen(temp)-1) = '\0'; ! //tracef( "add_index: %s\n" _ temp ); ! index[ index_entries++ ] = qstrdup( temp ); /* tidy up */ --- 904,909 ---- /* add to index */ *(temp+strlen(temp)-1) = '\0'; ! tracef( "add_index: %s\n" _ temp ); ! man_index[ index_entries++ ] = qstrdup( temp ); /* tidy up */ *************** *** 884,888 **** { fclose( source ); ! //tracef( "exception in add_index\n" ); x_RETHROW( &x0 ); } --- 913,917 ---- { fclose( source ); ! tracef( "exception in add_index\n" ); x_RETHROW( &x0 ); } *************** *** 906,910 **** "%s%s%s", src_path, ! (dir && dir[0] != '\0') ? "." : "", dir ? dir : "" ); --- 935,939 ---- "%s%s%s", src_path, ! (dir && dir[0] != '\0') ? DIR_SEP : "", dir ? dir : "" ); *************** *** 915,919 **** int read_count; ! //tracef( "scan_dir: %s\n" _ source_dir ); context = osgbpb_dir_entries_info( source_dir, (osgbpb_info_list*)infolist, --- 944,948 ---- int read_count; ! tracef( "scan_dir: %s\n" _ source_dir ); context = osgbpb_dir_entries_info( source_dir, (osgbpb_info_list*)infolist, *************** *** 924,928 **** &read_count ); ! // //tracef( "scan_dir: context %d; read_count %d\n" _ context _ read_count ); if( read_count != 0 ) --- 953,957 ---- &read_count ); ! tracef( "scan_dir: context %d; read_count %d\n" _ context _ read_count ); if( read_count != 0 ) *************** *** 934,938 **** "%s%s%s", dir ? dir : "", ! (dir && dir[0] != '\0') ? "." : "", INFO -> name ); --- 963,967 ---- "%s%s%s", dir ? dir : "", ! (dir && dir[0] != '\0') ? DIR_SEP : "", INFO -> name ); *************** *** 942,946 **** /* sub-directory found - add to linked list, then recurse into it */ ! //tracef( "scan_dir - recursing into %s\n" _ INFO->name ); *root = dir_entry = add_dir( INFO->name, --- 971,975 ---- /* sub-directory found - add to linked list, then recurse into it */ ! tracef( "scan_dir - recursing into %s\n" _ INFO->name ); *root = dir_entry = add_dir( INFO->name, *************** *** 958,962 **** { /* page found */ ! // tracef( "scan_dir - found file: %s.%s \n" _ dir _ INFO->name ); *root = dir_entry = add_file( INFO->name, --- 987,991 ---- { /* page found */ ! tracef( "scan_dir - found file: %s"DIR_SEP"%s \n" _ dir _ INFO->name ); *root = dir_entry = add_file( INFO->name, *************** *** 980,984 **** while( context != osgbpb_NO_MORE ); ! //tracef( "scan_dir - returns\n" ); #undef INFO } --- 1009,1013 ---- while( context != osgbpb_NO_MORE ); ! tracef( "scan_dir - returns\n" ); #undef INFO } *************** *** 1007,1015 **** x_TRY( &x0 ) { - fprintf( stdout, "BindHelp " VERSION " "__DATE__ " © Tony van der Hoff\n" ); - #if USE_STRONGHELP - fprintf( stdout, "Using StrongHelp calls\n" ); - #endif - if( argc < 3 ) x_THROW( Error_syntax ); --- 1036,1039 ---- *************** *** 1031,1037 **** --- 1055,1071 ---- } + if( verbose ) + { + fprintf( stdout, "BindHelp " VERSION " "__DATE__ " © Tony van der Hoff\n" ); + #if USE_STRONGHELP + fprintf( stdout, "Using StrongHelp calls\n" ); + #endif + } + /* create destination manual and copy the source into it */ + tracef( "main: Creating file\n" ); handle = create_file( dst_path ); + tracef( "main: creating manual\n" ); x_TRY( &x1 ) { *************** *** 1039,1044 **** ** so it doesn't appear in the dir list */ ! sprintf( temp, "%s.!Root", src_path ); ! osfile_delete( temp, NULL, NULL, NULL, NULL ); /* scan the source dir to create the master index and directory list */ --- 1073,1079 ---- ** so it doesn't appear in the dir list */ ! sprintf( temp, "%s"DIR_SEP"!Root", src_path ); ! tracef( "deleting \"%s\"\n" _ temp ); ! xosfile_delete( temp, NULL, NULL, NULL, NULL, NULL ); /* scan the source dir to create the master index and directory list */ *************** *** 1064,1070 **** x_CATCH( &x1 ) { ! osfind_closew( handle ); osfile_delete( argv[2], NULL, NULL, NULL, NULL ); delete_dir_list( &dir_list_root ); x_RETHROW( &x1 ); } --- 1099,1110 ---- x_CATCH( &x1 ) { ! tracef( "Main: exception caught: 0x%x - %s\n" _ \ ! x1.error ? x1.error -> errnum : 0 _ \ ! x1.error ? x1.error -> errmess : "NULL" ); ! ! osfind_closew( handle ); osfile_delete( argv[2], NULL, NULL, NULL, NULL ); delete_dir_list( &dir_list_root ); + x_RETHROW( &x1 ); } --- Makefile,fe1 DELETED --- --- NEW FILE: GNUmakefile --- # # Makefile for BindHelp for UNIX. # #------------------------------------------------------------------------ #target-specific macros TARGET = BindHelp MODULES = ${TARGET} os osgbpb osfile osargs osfind x kernel unix INCLUDES = -I.. -I../support DEFINES = -DUNIX -DEXECUTE_ON_UNIX -D__swi VPATH = ../support ../oslib/unix # additional modules required if tracing TRACEMODULES = trace m # all the general rules are in ../GNUmakefile.source include ../GNUmakefile.source |