|
From: Martin R. <ru...@us...> - 2004-08-13 21:34:52
|
Update of /cvsroot/foo/foo/elkfoo/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17518 Modified Files: bpf.m context.m defaults.m foofun.m fooinit.m module.m modules.m pointer.m signals.m snd.m soundfile.m task.m tell.m types.m Log Message: new include policy. the return of write-context, read-context, copy-context Index: foofun.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/foofun.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** foofun.m 6 Aug 2004 02:52:59 -0000 1.2 --- foofun.m 13 Aug 2004 21:34:39 -0000 1.3 *************** *** 31,45 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif ! ! #define Object SchemeObject /* avoid Obj-C type clash */ ! #ifdef HAVE_FOOELK_SCHEME_H ! #include <fooelk/scheme.h> ! #else ! #include <elk/scheme.h> ! #endif ! #undef Object #include <math.h> --- 31,35 ---- */ ! #include "elkfoo.h" #include <math.h> Index: tell.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/tell.m,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** tell.m 9 Aug 2004 17:30:47 -0000 1.14 --- tell.m 13 Aug 2004 21:34:39 -0000 1.15 *************** *** 31,37 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #import <Foundation/NSObjCRuntime.h> --- 31,35 ---- */ ! #include "elkfoo.h" #import <Foundation/NSObjCRuntime.h> *************** *** 42,55 **** #include <strings.h> - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - - #include "elkfoo.h" - static SchemeObject --- 40,43 ---- Index: signals.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/signals.m,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** signals.m 6 Aug 2004 02:52:59 -0000 1.4 --- signals.m 13 Aug 2004 21:34:39 -0000 1.5 *************** *** 31,52 **** */ - #ifdef HAVE_CONFIG_H - #include "config.h" - #endif - - // #include <objc/objc-class.h> /* objc_class */ - // #include <objc/objc-api.h> /* objc_class */ - // #include <objc/Object.h> - - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - #include "elkfoo.h" int T_Signal; --- 31,37 ---- */ #include "elkfoo.h" + int T_Signal; Index: module.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/module.m,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** module.m 6 Aug 2004 02:52:59 -0000 1.5 --- module.m 13 Aug 2004 21:34:39 -0000 1.6 *************** *** 31,37 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #ifdef NeXT_RUNTIME --- 31,35 ---- */ ! #include "elkfoo.h" #ifdef NeXT_RUNTIME *************** *** 44,62 **** #import <Foundation/NSString.h> - // #include <objc/Object.h> - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - - #include "elkfoo.h" int T_Module; - SchemeObject Get_Context (); /* defined in context.m */ --- 42,49 ---- Index: modules.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/modules.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** modules.m 6 Aug 2004 02:52:59 -0000 1.3 --- modules.m 13 Aug 2004 21:34:39 -0000 1.4 *************** *** 31,37 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #include <FOO/FOOContext.h> --- 31,35 ---- */ ! #include "elkfoo.h" #include <FOO/FOOContext.h> *************** *** 71,90 **** #include "FOOMVariableTwoPole.h" - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - #include <sys/types.h> #include <sys/timeb.h> - #include "elkfoo.h" #define IdOf(module) (MODULE_T(module)->pointer) - static int Get_Taps (SchemeObject taps) --- 69,78 ---- Index: soundfile.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/soundfile.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** soundfile.m 5 Aug 2004 22:30:31 -0000 1.3 --- soundfile.m 13 Aug 2004 21:34:39 -0000 1.4 *************** *** 31,44 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #include <FOO/FOOSoundFile.h> - #include <signal.h> - #include <sndfile.h> #include <limits.h> /* for PATH_MAX */ #include <sys/types.h> --- 31,41 ---- */ ! #include "elkfoo.h" #include <FOO/FOOSoundFile.h> #include <sndfile.h> + #include <signal.h> #include <limits.h> /* for PATH_MAX */ #include <sys/types.h> *************** *** 46,58 **** #include <sys/stat.h> - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - - #include "elkfoo.h" SchemeObject General_File_Operation (SchemeObject s, int op); --- 43,46 ---- Index: bpf.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/bpf.m,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** bpf.m 6 Aug 2004 05:59:07 -0000 1.6 --- bpf.m 13 Aug 2004 21:34:38 -0000 1.7 *************** *** 31,47 **** */ - #ifdef HAVE_CONFIG_H - #include "config.h" - #endif - - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - #include "elkfoo.h" #include <FOO/FOOBreakpointFunction.h> --- 31,36 ---- */ #include "elkfoo.h" + #include <FOO/FOOBreakpointFunction.h> Index: snd.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/snd.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** snd.m 5 Aug 2004 18:58:52 -0000 1.2 --- snd.m 13 Aug 2004 21:34:39 -0000 1.3 *************** *** 31,37 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #include <FOO/FOOSoundFile.h> --- 31,35 ---- */ ! #include "elkfoo.h" #include <FOO/FOOSoundFile.h> *************** *** 45,57 **** #include <sys/stat.h> - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - - #include "elkfoo.h" int T_Snd; --- 43,46 ---- *************** *** 180,184 **** s = A_Make_Snd([FOOSoundFile class]); ! filename = AUTORELEASE([NSString stringWithCString: cn]); if ([IdOf(s) initWithFile: filename] == nil) --- 169,173 ---- s = A_Make_Snd([FOOSoundFile class]); ! filename = [NSString stringWithCString: cn]; if ([IdOf(s) initWithFile: filename] == nil) Index: context.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/context.m,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** context.m 6 Aug 2004 02:52:59 -0000 1.5 --- context.m 13 Aug 2004 21:34:39 -0000 1.6 *************** *** 31,56 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #include <FOO/FOOContext.h> #include <FOO/FOOModule.h> - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - - #include "elkfoo.h" int T_Context; - SchemeObject V_Context; - static void Check_Context (SchemeObject o) --- 31,48 ---- */ ! #include "elkfoo.h" ! ! #import <Foundation/NSKeyedArchiver.h> ! #import <Foundation/NSException.h> ! #import <Foundation/NSData.h> + #include <FOO/FOOGlobalsManager.h> #include <FOO/FOOContext.h> #include <FOO/FOOModule.h> int T_Context; SchemeObject V_Context; static void Check_Context (SchemeObject o) *************** *** 82,89 **** ! id getCurrentContext () /* used in ../kernel/Context.h */ { ! id context; const char *oldErrorTag; --- 74,81 ---- ! FOOContext * getCurrentContext () /* used in ../kernel/Context.h */ { ! FOOContext *context; const char *oldErrorTag; *************** *** 174,178 **** SchemeObject ! A_Make_Context (id c) { SchemeObject context = Null, zero = Make_Integer(0); --- 166,170 ---- SchemeObject ! A_Make_Context (FOOContext *c) { SchemeObject context = Null, zero = Make_Integer(0); *************** *** 275,360 **** int ! Write_Context (FILE *fp, ! id context) { ! Primitive_Error("sorry. not yet ported"); ! ! // // NXStream *s; ! // TypedStream *ts; ! ! // // if ((s = NXOpenFile(fileno(fp), OBJC_WRITEONLY)) == NULL) ! // // return -1; ! ! // // if ((ts = objc_open_typed_stream(s, OBJC_WRITEONLY)) == NULL) { ! // if ((ts = objc_open_typed_stream(fp, OBJC_WRITEONLY)) == NULL) { ! // // NXClose(s); ! // return -2; ! // } ! // objc_write_root_object(ts, context); ! // objc_close_typed_stream(ts); ! // // NXClose(s); ! return 1; } ! static SchemeObject P_Context_Write(argc, argv) ! int argc; ! SchemeObject *argv; { ! Primitive_Error("sorry. not yet ported"); ! // // NXStream *s; ! // // TypedStream *ts; ! // SchemeObject context = argv[0], port; ! ! // if (argc < 2) ! // port = Curr_Output_Port; ! // else ! // port = argv[1]; ! // Check_Context(context); ! // Check_Type(port, T_Port); ! // if (!IS_OUTPUT(port)) ! // Primitive_Error("not an output port: ~a", port); ! // if (PORT(port)->flags & P_STRING) ! // Primitive_Error("not a file port: ~a", port); ! // switch (Write_Context(PORT(port)->file, CONTEXT_T(context)->pointer)) { ! // case -1: ! // Primitive_Error("cannot open stream for: ~a", port); ! // case -2: ! // // NXClose(s); ! // Primitive_Error("cannot open typed stream for: ~a", port); ! // } ! return True; } int ! Read_Context (FILE *fp, ! id *context) { ! Primitive_Error("sorry. not yet ported"); ! // // NXStream *s; ! // TypedStream *ts; ! // // id c; ! ! // // if ((s = NXOpenFile(fileno(fp), NX_READONLY)) == NULL) ! // // return -1; ! // // if ((ts = NXOpenTypedStream(s, NX_READONLY)) == NULL) { ! // if ((ts = objc_open_typed_stream(fp, OBJC_READONLY)) == NULL) { ! // // NXClose(s); ! // return -2; ! // } ! // if (objc_read_object(ts, context) == -1) { ! // objc_close_typed_stream(ts); ! // // NXClose(s); ! // return -3; ! // } ! // objc_close_typed_stream(ts); ! // // NXClose(s); ! // // *context = c; ! return 1; } --- 267,352 ---- int ! Write_Context (NSString *path, ! FOOContext *context) { ! NS_DURING ! [FOOGlobalsManager archiveContext: context toFile: path]; ! NS_HANDLER ! // yet to implement ! NS_ENDHANDLER ! return 0; } ! static SchemeObject ! P_Context_Write (int argc, ! SchemeObject *argv) { ! SchemeObject context = argv[0], port = Null; ! const char *path; ! ! Check_Context(context); ! if (argc < 2) ! { ! port = Curr_Output_Port; ! } ! else if (TYPE(argv[1]) == T_Port) ! { ! port = argv[1]; ! } ! else if (TYPE(argv[1]) == T_String) ! { ! path = Get_String(argv[1]); ! } ! else ! { ! Wrong_Type_Combination(argv[1], "string or port"); ! } ! ! if (! Nullp(port)) ! { ! if (! IS_OUTPUT(port)) ! { ! Primitive_Error("not an output port: ~a", port); ! } ! if (PORT(port)->flags & P_STRING) ! { ! Primitive_Error("not a file port: ~a", port); ! } ! path = Get_String(PORT(port)->name); ! } ! ! switch (Write_Context([NSString stringWithCString: path], ! CONTEXT_T(context)->pointer)) ! { ! case -1: ! Primitive_Error("cannot open file ~a", path); ! ! case -2: ! Primitive_Error("error while archiving context to ~a", path); ! } ! ! return True; } int ! Read_Context (NSString *path, ! FOOContext **context) { ! NS_DURING ! *context = [FOOGlobalsManager unArchiveContextWithFile: path]; ! NS_HANDLER ! // yet to implement ! NS_ENDHANDLER ! if (*context == nil) ! { ! return -3; ! } ! return 0; } *************** *** 364,448 **** SchemeObject *argv) { ! Primitive_Error("sorry. not yet ported"); ! return True; ! // SchemeObject port; ! // // NXStream *s; ! // // TypedStream *ts; ! // id c; ! ! // if (argc < 1) ! // port = Curr_Input_Port; ! // else ! // port = argv[0]; ! // Check_Type(port, T_Port); ! // if (!IS_INPUT(port)) ! // Primitive_Error("not an input port: ~a", port); ! // if (PORT(port)->flags & P_STRING) ! // Primitive_Error("not a file port: ~a", port); ! // switch (Read_Context(PORT(port)->file, &c)) { ! // case -1: ! // Primitive_Error("cannot open stream for: ~a", port); ! // case -2: ! // Primitive_Error("cannot open typed stream for: ~a", port); ! // case -3: ! // Primitive_Error("cannot read from typed stream for: ~a", port); ! // } ! // return A_Make_Context(c); ! } ! ! ! static SchemeObject ! P_Context_Copy (SchemeObject context) ! { ! Primitive_Error("sorry. not yet ported"); ! return True; ! // id c; ! // // NXStream *ws, *rs; ! // FILE *stream; ! // TypedStream *ts; ! // // char *buffer; ! // // int len, maxlen; ! ! // /* use tempfile instead of memory stream (workaround = ugly) */ ! // Check_Context(context); ! // // if ((ws = NXOpenMemory(NULL, 0, NX_WRITEONLY)) == NULL) ! // // Primitive_Error("cannot open memory write stream"); ! // // create tempfile ! // if (! (stream = tmpfile())) ! // { ! // Primitive_Error("cannot create temporary file"); ! // } - // // create typed stream - // if ((ts = objc_open_typed_stream(stream, OBJC_WRITEONLY)) == NULL) { - // // NXCloseMemory(ws, NX_FREEBUFFER); - // Primitive_Error("cannot open typed write stream"); - // } - // objc_write_root_object(ts, CONTEXT_T(context)->pointer); - // objc_close_typed_stream(ts); ! // // NXGetMemoryBuffer(ws, &buffer, &len, &maxlen); ! // // if ((rs = NXOpenMemory(buffer, len, NX_READONLY)) == NULL) ! // // Primitive_Error("cannot open memory read stream"); ! // rewind(stream); ! // if ((ts = objc_open_typed_stream(stream, OBJC_READONLY)) == NULL) { ! // // NXCloseMemory(ws, NX_FREEBUFFER); ! // Primitive_Error("cannot open typed read stream"); ! // } ! // if (objc_read_object(ts, &c) == -1) ! // Primitive_Error("bad context read"); ! // objc_close_typed_stream(ts); ! // // NXCloseMemory(ws, NX_FREEBUFFER); ! // // NXCloseMemory(rs, NX_FREEBUFFER); ! // fclose(stream); ! // return A_Make_Context(c); } --- 356,434 ---- SchemeObject *argv) { ! SchemeObject port = Null; ! FOOContext *context; ! const char *path; ! if (argc < 1) ! { ! port = Curr_Input_Port; ! } ! else if (TYPE(argv[0]) == T_Port) ! { ! port = argv[0]; ! } ! else if (TYPE(argv[0]) == T_String) ! { ! path = Get_String(argv[0]); ! } ! else ! { ! Wrong_Type_Combination(argv[0], "string or port"); ! } ! if (! Nullp(port)) ! { ! if (! IS_INPUT(port)) ! { ! Primitive_Error("not an input port: ~a", port); ! } ! if (PORT(port)->flags & P_STRING) ! { ! Primitive_Error("not a file port: ~a", port); ! } ! path = Get_String(PORT(port)->name); ! } ! switch (Read_Context([NSString stringWithCString: path], &context)) ! { ! case -1: ! Primitive_Error("cannot open stream for: ~a", port); ! case -2: ! Primitive_Error("cannot open typed stream for: ~a", port); ! case -3: ! Primitive_Error("cannot read from typed stream for: ~a", port); ! } ! return A_Make_Context(context); ! } ! static SchemeObject ! P_Context_Copy (SchemeObject context) ! { ! /* in the future, we want to conform to the <NSCopying> protocol in ! * all related classes instead of using the archiving mechanism for ! * copying ! */ ! FOOContext *c; ! NSMutableData *data; ! NSKeyedArchiver *archiver; ! NSKeyedUnarchiver *unarchiver; ! Check_Context(context); ! data = [NSMutableData data]; ! archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData: data]; ! [archiver encodeObject: CONTEXT_T(context)->pointer forKey: @"FOOContext"]; ! [archiver finishEncoding]; ! RELEASE(archiver); ! // RELEASE(data); // ??? autoreleased or not? ! unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData: data]; ! c = [unarchiver decodeObjectForKey: @"FOOContext"]; ! [unarchiver finishDecoding]; ! [unarchiver release]; ! return A_Make_Context(c); } Index: types.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/types.m,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** types.m 9 Aug 2004 01:47:34 -0000 1.1 --- types.m 13 Aug 2004 21:34:39 -0000 1.2 *************** *** 32,38 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #ifdef NeXT_RUNTIME --- 32,36 ---- */ ! #include "elkfoo.h" #ifdef NeXT_RUNTIME *************** *** 44,57 **** #endif - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - - #include "elkfoo.h" - #define SKIP_BODY(p, c) \ --- 42,45 ---- Index: fooinit.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/fooinit.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** fooinit.m 5 Aug 2004 18:58:52 -0000 1.3 --- fooinit.m 13 Aug 2004 21:34:39 -0000 1.4 *************** *** 33,39 **** /* $Id */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #include <stdio.h> --- 33,37 ---- /* $Id */ ! #include "elkfoo.h" #include <stdio.h> *************** *** 43,56 **** #include <strings.h> ! #define Object SchemeObject /* avoid Obj-C type clash */ ! #ifdef HAVE_FOOELK_SCHEME_H ! #include <fooelk/scheme.h> ! #else ! #include <elk/scheme.h> ! #endif ! #undef Object #import <Foundation/NSAutoreleasePool.h> - #include <FOO/FOOGlobalsManager.h> --- 41,47 ---- #include <strings.h> ! #include <FOO/FOOGlobalsManager.h> #import <Foundation/NSAutoreleasePool.h> Index: pointer.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/pointer.m,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pointer.m 9 Aug 2004 17:30:47 -0000 1.8 --- pointer.m 13 Aug 2004 21:34:39 -0000 1.9 *************** *** 31,37 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #include <strings.h> --- 31,35 ---- */ ! #include "elkfoo.h" #include <strings.h> *************** *** 45,57 **** #endif - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - - #include "elkfoo.h" int T_Pointer; --- 43,46 ---- Index: task.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/task.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** task.m 6 Aug 2004 02:52:59 -0000 1.3 --- task.m 13 Aug 2004 21:34:39 -0000 1.4 *************** *** 31,37 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #include <FOO/FOOContext.h> --- 31,35 ---- */ ! #include "elkfoo.h" #include <FOO/FOOContext.h> *************** *** 44,56 **** #include <strings.h> - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - - #include "elkfoo.h" SchemeObject General_File_Operation (SchemeObject s, int op); /* in io.c */ --- 42,45 ---- Index: defaults.m =================================================================== RCS file: /cvsroot/foo/foo/elkfoo/src/defaults.m,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** defaults.m 6 Aug 2004 02:52:59 -0000 1.2 --- defaults.m 13 Aug 2004 21:34:39 -0000 1.3 *************** *** 31,48 **** */ ! #ifdef HAVE_CONFIG_H ! #include "config.h" ! #endif #include <FOO/FOOGlobalsManager.h> - #define Object SchemeObject /* avoid Obj-C type clash */ - #ifdef HAVE_FOOELK_SCHEME_H - #include <fooelk/scheme.h> - #else - #include <elk/scheme.h> - #endif - #undef Object - static SchemeObject --- 31,38 ---- */ ! #include "elkfoo.h" #include <FOO/FOOGlobalsManager.h> static SchemeObject |