Update of /cvsroot/ro-oslib/OSLib/!OsLib/Tools/support In directory sc8-pr-cvs1:/tmp/cvs-serv10228/OSLib/!OsLib/Tools/support Modified Files: Tag: unix-build lookup.c m.c riscos.c riscos.h trace.c unix.c Added Files: Tag: unix-build kernel.c Log Message: Unix Build --- NEW FILE: kernel.c --- (This appears to be a binary file; contents omitted.) Index: lookup.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/support/Attic/lookup.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** lookup.c 14 Jan 2004 13:33:17 -0000 1.1.2.1 --- lookup.c 20 Jan 2004 17:08:48 -0000 1.1.2.2 *************** *** 87,91 **** lookup_t t; ! // tracef ("lookup_new\n"); if ((t = m_ALLOC (sizeof *t)) == NULL) { --- 87,91 ---- lookup_t t; ! tracef ("lookup_new\n"); if ((t = m_ALLOC (sizeof *t)) == NULL) { *************** *** 101,105 **** t->count = start_count; ! // tracef ("clearing out entries 0, ..., %d\n" _ t->count - 1); for (i = 0; i < t->count; i++) t->entries [i].token = NULL; --- 101,105 ---- t->count = start_count; ! tracef ("clearing out entries 0, ..., %d\n" _ t->count - 1); for (i = 0; i < t->count; i++) t->entries [i].token = NULL; *************** *** 110,114 **** if (error != NULL) { ! // tracef ("ERROR: %s (error 0x%X)\n" _ error->errmess _ error->errnum); if (t != NULL) { --- 110,114 ---- if (error != NULL) { ! tracef ("ERROR: %s (error 0x%X)\n" _ error->errmess _ error->errnum); if (t != NULL) { *************** *** 127,131 **** ) { ! // tracef ("lookup_delete\n"); if (t != NULL) --- 127,131 ---- ) { ! tracef ("lookup_delete\n"); if (t != NULL) *************** *** 166,170 **** Entry *e = NULL; ! // tracef ("Lookup\n"); for (i = 0; i < t->count; i++) --- 166,170 ---- Entry *e = NULL; ! //tracef ("Lookup\n"); for (i = 0; i < t->count; i++) *************** *** 173,177 **** { e = &t->entries [i]; ! // tracef ("found an empty slot (%d)\n" _ i); break; } --- 173,177 ---- { e = &t->entries [i]; ! tracef ("Lookup found an empty slot (%d)\n" _ i); break; } *************** *** 182,189 **** xterritory_collate() in |error|.*/ #ifndef EXECUTE_ON_UNIX - #if 0 - if (xterritory_collate (territory_CURRENT, s, t->entries [i].token, - territory_IGNORE_CASE, &collate) != NULL) - #else // Make Lookup case-sensitive, to allow otherwise identical C identifiers // also to make behaviour the same as strcmp() --- 182,185 ---- *************** *** 191,212 **** 0, &collate) != NULL) #endif ! #endif ! collate = strcmp (s, t->entries [i].token); if (collate == 0) { e = &t->entries [i]; ! // tracef ("found a match (%d)\n" _ i); break; } } - // if (e == NULL) tracef ("no slot found\n"); - if (e_out != NULL) *e_out = e; /*finish:*/ ! // if (error != NULL) ! // tracef ("ERROR: %s (error 0x%X)\n" _ error->errmess _ error->errnum); return error; } --- 187,213 ---- 0, &collate) != NULL) #endif ! ! collate = strcmp (s, t->entries [i].token); if (collate == 0) { e = &t->entries [i]; ! tracef ("Lookup found a match (%d)\n" _ i); break; } } if (e_out != NULL) *e_out = e; + #if 0 + if (e == NULL) + {tracef ("Lookup: no slot found\n");} + else + {tracef( "Lookup: returning slot 0x%x\n" _ e );} + #endif + /*finish:*/ ! if (error != NULL) ! {tracef ("Lookup ERROR: %s (error 0x%X)\n" _ error->errmess _ error->errnum);} return error; } *************** *** 223,227 **** Entry *e; ! // tracef ("lookup (0x%X, \"%s\",)\n" _ t _ s); if ((error = Lookup (t, s, &e)) != NULL) --- 224,228 ---- Entry *e; ! //tracef ("lookup (0x%X, \"%s\",)\n" _ t _ s); if ((error = Lookup (t, s, &e)) != NULL) *************** *** 230,233 **** --- 231,235 ---- if (e == NULL || e->token == NULL) { + tracef( "lookup failed: e=0x%x token=0x%x\n" _ e _ e ? e -> token : 0 ); error = riscos_error_lookup (os_GLOBAL_NO_ANY, "NoAny", s); goto finish; *************** *** 237,242 **** finish: ! // if (error != NULL) ! // tracef ("ERROR: %s (error 0x%X)\n" _ error->errmess _ error->errnum); return error; } --- 239,247 ---- finish: ! if (error != NULL) ! {tracef ("lookup ERROR: %s (error 0x%X)\n" _ error->errmess _ error->errnum);} ! ! //tracef( "lookup returning slot: 0x%x\n" _ e->ptr ); ! return error; } *************** *** 248,255 **** Entry *e; ! // tracef ("lookup_insert (0x%X, \"%s\", 0x%X)\n" _ t _ s _ ptr); if ((error = Lookup (t, s, &e)) != NULL) goto finish; if (e == NULL) --- 253,263 ---- Entry *e; ! tracef ("lookup_insert (0x%X, \"%s\", 0x%X)\n" _ t _ s _ ptr); if ((error = Lookup (t, s, &e)) != NULL) + { + tracef( "lookup_insert error: %s\n" _ error -> errmess ); goto finish; + } if (e == NULL) *************** *** 257,262 **** Entry *tmp; ! // tracef ("extending the table to count %d (now at 0x%X)\n" _ ! // 2*t->count _ t->entries); if ((tmp = m_REALLOC (t->entries, t->count*sizeof (Entry), 2*t->count*sizeof (Entry))) == NULL) --- 265,270 ---- Entry *tmp; ! tracef ("extending the table to count %d (now at 0x%X)\n" _ ! 2*t->count _ t->entries); if ((tmp = m_REALLOC (t->entries, t->count*sizeof (Entry), 2*t->count*sizeof (Entry))) == NULL) *************** *** 266,273 **** } t->entries = tmp; ! // tracef ("table extended (now at 0x%X)\n" _ t->entries); ! // tracef ("clearing out entries %d, ..., %d\n" _ ! // t->count _ 2*t->count - 1); memset (t->entries + t->count, '\0', t->count*sizeof (Entry)); --- 274,281 ---- } t->entries = tmp; ! tracef ("table extended (now at 0x%X)\n" _ t->entries); ! tracef ("clearing out entries %d, ..., %d\n" _ ! t->count _ 2*t->count - 1); memset (t->entries + t->count, '\0', t->count*sizeof (Entry)); *************** *** 275,294 **** t->count *= 2; ! // tracef ("new count %d\n" _ t->count); } ! if (e->token == NULL && (e->token = m_ALLOC (riscos_strlen (s) + 1)) == ! NULL) { error = riscos_error_lookup (os_GLOBAL_NO_MEM, "NoMem"); goto finish; } riscos_strcpy (e->token, s); /*case may have changed*/ e->ptr = ptr; finish: ! // if (error != NULL) ! // tracef ("ERROR: %s (error 0x%X)\n" _ error->errmess _ error->errnum); return error; } --- 283,306 ---- t->count *= 2; ! tracef ("new count %d\n" _ t->count); } ! tracef( "lookup_insert into slot 0x%x\n" _ e ); ! if (e->token == NULL && (e->token = m_ALLOC (riscos_strlen (s) + 1)) == NULL) { + tracef( "lookup_insert out of memory\n" ); error = riscos_error_lookup (os_GLOBAL_NO_MEM, "NoMem"); goto finish; } + tracef( "lookup_insert into token 0x%x\n" _ e -> token); riscos_strcpy (e->token, s); /*case may have changed*/ e->ptr = ptr; finish: ! if (error != NULL) ! {tracef ("ERROR: %s (error 0x%X)\n" _ error->errmess _ error->errnum);} ! ! //tracef( "lookup_insert done\n" ); return error; } *************** *** 303,307 **** ) { ! // tracef ("lookup_enumerate\n"); if ((int) *context < t->count && --- 315,319 ---- ) { ! tracef ("lookup_enumerate\n"); if ((int) *context < t->count && Index: m.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/support/Attic/m.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** m.c 14 Jan 2004 13:33:17 -0000 1.1.2.1 --- m.c 20 Jan 2004 17:08:48 -0000 1.1.2.2 *************** *** 21,29 **** */ ! #undef TRACE ! #define TRACE 1 #if TRACE ! /*#define XTRACE*/ #endif --- 21,31 ---- */ ! #ifdef TRACE ! #undef TRACE ! #define TRACE 1 ! #endif #if TRACE ! #define XTRACE #endif *************** *** 35,46 **** /*From OSLib*/ ! #include "macros.h" ! #include "os.h" ! #include "wimp.h" /*From Support*/ #include "m.h" #include "riscos.h" ! #include "svc.h" #include "trace.h" --- 37,52 ---- /*From OSLib*/ ! #include "oslib/macros.h" ! #include "oslib/os.h" ! #ifndef EXECUTE_ON_UNIX ! #include "oslib/wimp.h" ! #endif /*From Support*/ #include "m.h" #include "riscos.h" ! #ifndef EXECUTE_ON_UNIX ! #include "svc.h" ! #endif #include "trace.h" *************** *** 95,99 **** --- 101,107 ---- os_error error; + #ifdef XTRACE trace_f (file, line, "m_assert %s\n", msg); + #endif error.errnum = 1; *************** *** 101,108 **** --- 109,120 ---- file, line, msg); + #ifndef EXECUTE_ON_UNIX if (svc_get_mode () == svc_USR) os_generate_error (&error); else xwimp_report_error (&error, NONE, "<<Memory checker>>", NULL); + #else + fprintf( stderr, "<<Memory checker>>\n%s\n", error.errmess ); + #endif } /*------------------------------------------------------------------------*/ Index: riscos.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/support/Attic/riscos.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** riscos.c 14 Jan 2004 13:33:17 -0000 1.1.2.1 --- riscos.c 20 Jan 2004 17:08:48 -0000 1.1.2.2 *************** *** 134,138 **** int riscos_strlen ( ! char *s ) { --- 134,138 ---- int riscos_strlen ( ! char const *s ) { *************** *** 151,159 **** ( char *s1, ! char *s ) { int i = 0; while ((s1 [i] = s [i]) >= ' ') i++; --- 151,161 ---- ( char *s1, ! char const *s ) { int i = 0; + //tracef ("riscos_strcpy (\"%.*s\")\n" _ riscos_strlen (s) _ s ); + while ((s1 [i] = s [i]) >= ' ') i++; *************** *** 168,173 **** int riscos_strcmp ( ! char *s0, ! char *s1 ) { --- 170,175 ---- int riscos_strcmp ( ! char const *s0, ! char const *s1 ) { *************** *** 199,203 **** ( char *s1, ! char *s, int n ) --- 201,205 ---- ( char *s1, ! char const *s, int n ) Index: riscos.h =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/support/Attic/riscos.h,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** riscos.h 14 Jan 2004 13:33:17 -0000 1.1.2.1 --- riscos.h 20 Jan 2004 17:08:48 -0000 1.1.2.2 *************** *** 61,71 **** */ ! extern int riscos_strlen (char *s); ! extern char *riscos_strcpy (char *s1, char *s); ! extern int riscos_strcmp (char *s0, char *s1); ! extern char *riscos_strncpy (char *s1, char *s, int n); /* Useful string processing functions, designed to allow safe in-line use --- 61,71 ---- */ ! extern int riscos_strlen (char const *s); ! extern char *riscos_strcpy (char *s1, char const *s); ! extern int riscos_strcmp (char const *s0, char const *s1); ! extern char *riscos_strncpy (char *s1, char const *s, int n); /* Useful string processing functions, designed to allow safe in-line use Index: trace.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/support/Attic/trace.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** trace.c 14 Jan 2004 13:33:17 -0000 1.1.2.1 --- trace.c 20 Jan 2004 17:08:48 -0000 1.1.2.2 *************** *** 28,31 **** --- 28,33 ---- * append a \r if there was a final \n. */ + #undef DEBUG + #define DEBUG 0 #undef TRACE *************** *** 102,109 **** --- 104,116 ---- if ((val = getenv (var)) == NULL) + { strcpy (to, "v"); + } else strcpy (to, val); + #if DEBUG + fprintf( stderr, "trace to %s\n", to ); + #endif switch (to [0]) { *************** *** 205,208 **** --- 212,217 ---- break; #endif + default: + break; } *************** *** 226,229 **** --- 235,242 ---- // int len; + #if DEBUG + fprintf( stderr, "%s %d trace_f\n", __FILE__, __LINE__ ); + #endif + /*Do not do anything once Error is set.*/ if (Error == NULL) *************** *** 273,279 **** --- 286,298 ---- case VDU: + #if DEBUG + fprintf( stderr, "%s %d trace_f: VDU\n", __FILE__, __LINE__ ); + #endif if ((error = xos_write0 (s)) != NULL) goto finish; break; + + default: + break; } } *************** *** 363,366 **** --- 382,388 ---- case VDU: + #if DEBUG + fprintf( stderr, "%s %d trace_f: VDU\n", __FILE__, __LINE__ ); + #endif for (cc = s; *cc != '\0'; cc++) { *************** *** 397,400 **** --- 419,425 ---- } break; + + default: + break; } } *************** *** 451,454 **** --- 476,482 ---- goto finish; break; + + default: + break; } *************** *** 493,496 **** --- 521,526 ---- break; #endif + default: + break; } Index: unix.c =================================================================== RCS file: /cvsroot/ro-oslib/OSLib/!OsLib/Tools/support/Attic/unix.c,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** unix.c 14 Jan 2004 13:33:17 -0000 1.1.2.1 --- unix.c 20 Jan 2004 17:08:48 -0000 1.1.2.2 *************** *** 1,3 **** --- 1,6 ---- /*unix.c - emulation of some useful SWIs and functions*/ + /* this is the same functionality as support/riscos.c + but ported to unix + */ /*OSLib---efficient, type-safe, transparent, extensible,\n" *************** *** 56,59 **** --- 59,64 ---- riscos_strcpy (e->errmess, token); + //tracef ( "Error_Lookup %d: %s\n" _ e ->errnum _ e -> errmess ); + return e; } *************** *** 83,86 **** --- 88,97 ---- va_end (list); + + if ( error == 0 ) + tracef( "riscos_error_lookup: not found\n" ); + else + tracef( "riscos_error_lookup: %d: %s\n" _ error -> errnum _ error -> errmess ); + return error; } *************** *** 106,111 **** --- 117,126 ---- riscos_strncpy (&error.errmess [len], msg, os_ERROR_LIMIT - len - 1); + #ifdef EXECUTE_ON_UNIX + fprintf( stderr, "Assertion failure:\n %s", error.errmess ); + #else (void) xwimp_report_error (&error, wimp_ERROR_BOX_SHORT_TITLE, "Assertion failure", NULL); + #endif } #endif *************** *** 116,120 **** int riscos_strlen ( ! char *s ) { --- 131,135 ---- int riscos_strlen ( ! char const *s ) { *************** *** 133,137 **** ( char *s1, ! char *s ) { --- 148,152 ---- ( char *s1, ! char const *s ) { *************** *** 150,155 **** int riscos_strcmp ( ! char *s0, ! char *s1 ) { --- 165,170 ---- int riscos_strcmp ( ! char const *s0, ! char const *s1 ) { *************** *** 191,195 **** ( char *s1, ! char *s, int n ) --- 206,210 ---- ( char *s1, ! char const *s, int n ) |