diff --git a/go.r b/go.r deleted file mode 100644 index f3dede3..0000000 --- a/go.r +++ /dev/null @@ -1,81 +0,0 @@ -REBOL [ - Title: "Host-Kit Graphics: Basic GOB Compositing Test" - Version: 1.0.1 - Author: "Carl Sassenrath" - Notes: { - A101: PAIRs are now floating point, and commands like CIRCLE - can pass a pair for second argument. - } -] - -win: view/no-wait main: make gob! [color: black offset: 0x0 size: 500x500] - -to-draw: func [block] [bind reduce block import 'draw] - -units: 32 -pause: .01 - -points: [] -loop 100 [ - clear main - clear points - repeat n units [append points random main/size] - append main make gob! reduce/no-set [ - offset: 0x0 - size: main/size - draw: to-draw ['pen random 255.255.255 'lines points] - ] - show main - wait pause -] - -loop 100 [ - clear main - repeat n units [ - sz: random 100x100 - append main make gob! reduce/no-set [ - draw: to-draw [ - 'pen random 255.255.255 - 'fill-pen random 255.255.255.255 - 'circle sz sz * 98% - ] - offset: random 300x300 - size: sz * 2 - ] - ] - show main - wait pause -] - -loop 100 [ - clear main - repeat n units [ - sz: random 100x100 - append main make gob! reduce/no-set [ - draw: to-draw [ - 'pen random 255.255.255 - 'fill-pen random 255.255.255.255 - 'box 2x2 sz - ] - offset: random 400x400 - size: sz + 4x4 - ] - ] - show main - wait pause -] - -loop 100 [ - clear main - repeat n units * 10 [ - append main make gob! reduce/no-set [ - color: random 255.255.255.255 - offset: random 500x500 - size: random 80x80 - ] - ] - show main - wait pause -] - -unview win diff --git a/info.txt b/info.txt index aac90c4..944e38f 100644 --- a/info.txt +++ b/info.txt @@ -1,8 +1,8 @@ REBOL 3 Host-Kit Source Distribution From REBOL Technologies in Ukiah, California - Version: 2.100.103.0.0 (alpha) - Updated: 19-Aug-2010/20:35:57-7:00 + Version: 2.100.104.0.0 (alpha) + Updated: 26-Aug-2010/20:41:49-7:00 The purpose of the R3 Host-Kit is to provide developers with a method of building custom versions of REBOL, including built-in extension modules. diff --git a/lib/r3lib.dll b/lib/r3lib.dll index ab6961d..3e4d112 100644 Binary files a/lib/r3lib.dll and b/lib/r3lib.dll differ diff --git a/lib/r3lib.exp b/lib/r3lib.exp index c0412f5..db5dcd1 100644 Binary files a/lib/r3lib.exp and b/lib/r3lib.exp differ diff --git a/lib/r3lib.lib b/lib/r3lib.lib index 2ac05e9..a4f75b4 100644 Binary files a/lib/r3lib.lib and b/lib/r3lib.lib differ diff --git a/makefile b/makefile index 0038e37..8613d8f 100644 --- a/makefile +++ b/makefile @@ -1,5 +1,5 @@ -#--- REBOL 3.0 Host Makefile - Build A103 -#--- Note: this makefile was generated by make-build.r (20-Aug-2010/3:35:57) +#--- REBOL 3.0 Host Makefile - Build A104 +#--- Note: this makefile was generated by make-build.r (27-Aug-2010/3:41:49) #--- This file intentionally kept simple - to work on all platforms. #--- You will need REBOL 2.6 or 2.7 in your work directory or environment path @@ -25,7 +25,8 @@ INCS= \ $I/reb-evtypes.h\ $I/reb-net.h\ $I/reb-filereq.h\ - $I/reb-gob.h + $I/reb-gob.h\ + $I/reb-lib.h OBJS= \ $O/host-main.o\ @@ -130,13 +131,13 @@ $O/host-main.o: $S/os/host-main.c $(INCS) $I/reb-host.h $I/host-lib.h $I/reb $O/host-args.o: $S/os/host-args.c $(INCS) $I/reb-config.h $I/reb-c.h $I/reb-args.h $C $(CFLAGS) -fpack-struct -o $O/host-args.o $S/os/host-args.c -$O/host-device.o: $S/os/host-device.c $(INCS) $I/reb-host.h $I/host-lib.h $I/rebol-lib.h +$O/host-device.o: $S/os/host-device.c $(INCS) $I/reb-host.h $I/host-lib.h $C $(CFLAGS) -fpack-struct -o $O/host-device.o $S/os/host-device.c $O/host-stdio.o: $S/os/host-stdio.c $(INCS) $I/reb-host.h $I/host-lib.h $C $(CFLAGS) -fpack-struct -o $O/host-stdio.o $S/os/host-stdio.c -$O/host-ext-test.o: $S/os/host-ext-test.c $(INCS) $I/reb-host.h $I/host-lib.h $I/rebol-lib.h +$O/host-ext-test.o: $S/os/host-ext-test.c $(INCS) $I/reb-host.h $I/host-lib.h $C $(CFLAGS) -fpack-struct -o $O/host-ext-test.o $S/os/host-ext-test.c $O/dev-net.o: $S/os/dev-net.c $(INCS) $I/reb-host.h $I/host-lib.h $I/sys-net.h @@ -163,13 +164,13 @@ $O/dev-event.o: $S/os/win32/dev-event.c $(INCS) $I/reb-host.h $I/host-lib.h $O/dev-clipboard.o: $S/os/win32/dev-clipboard.c $(INCS) $I/reb-host.h $I/host-lib.h $I/sys-net.h $C $(CFLAGS) -fpack-struct -o $O/dev-clipboard.o $S/os/win32/dev-clipboard.c -$O/host-graphics.o: $S/os/win32/host-graphics.c $(INCS) $I/reb-host.h $I/host-lib.h $I/rebol-lib.h $I/agg-draw.h +$O/host-graphics.o: $S/os/win32/host-graphics.c $(INCS) $I/reb-host.h $I/host-lib.h $I/agg-draw.h $C $(CFLAGS) -fpack-struct -o $O/host-graphics.o $S/os/win32/host-graphics.c -$O/host-event.o: $S/os/win32/host-event.c $(INCS) $I/reb-host.h $I/host-lib.h $I/rebol-lib.h +$O/host-event.o: $S/os/win32/host-event.c $(INCS) $I/reb-host.h $I/host-lib.h $C $(CFLAGS) -fpack-struct -o $O/host-event.o $S/os/win32/host-event.c -$O/host-window.o: $S/os/win32/host-window.c $(INCS) $I/reb-host.h $I/host-lib.h $I/rebol-lib.h $I/agg-compositor.h +$O/host-window.o: $S/os/win32/host-window.c $(INCS) $I/reb-host.h $I/host-lib.h $I/agg-compositor.h $C $(CFLAGS) -fpack-struct -o $O/host-window.o $S/os/win32/host-window.c diff --git a/src/agg/agg_compo.cpp b/src/agg/agg_compo.cpp index 561f82b..3c748bd 100644 --- a/src/agg/agg_compo.cpp +++ b/src/agg/agg_compo.cpp @@ -6,7 +6,7 @@ extern "C" void Blit_Rect(REBGOB *gob, REBPAR d, REBPAR dsize, REBYTE *src, REBPAR s, REBPAR ssize); //extern "C" void* Rich_Text; //extern "C" void* Effects; -extern "C" void *Reb_Get_Series(REBSER *ser, REBINT what); +extern "C" void *RL_Get_Series(REBSER *ser, REBINT what); namespace agg { diff --git a/src/boot/version.r b/src/boot/version.r index 688dc7d..8433b51 100644 --- a/src/boot/version.r +++ b/src/boot/version.r @@ -1 +1 @@ -2.100.103.3.1 \ No newline at end of file +2.100.104.3.1 \ No newline at end of file diff --git a/src/include/ext-types.h b/src/include/ext-types.h index d0bb2b9..4426fa4 100644 --- a/src/include/ext-types.h +++ b/src/include/ext-types.h @@ -7,8 +7,8 @@ ************************************************************************ ** ** Title: Extension Types (Isolators) -** Build: A103 -** Date: 19-Aug-2010/20:35:22-7:00 +** Build: A104 +** Date: 26-Aug-2010/20:40:59-7:00 ** File: ext-types.h ** ** AUTO-GENERATED FILE - Do not modify. (From: make-boot.r) diff --git a/src/include/host-lib.h b/src/include/host-lib.h index 5833e89..0e8ad44 100644 --- a/src/include/host-lib.h +++ b/src/include/host-lib.h @@ -7,8 +7,8 @@ ************************************************************************ ** ** Title: Host Access Library -** Build: A103 -** Date: 19-Aug-2010/20:35:21-7:00 +** Build: A104 +** Date: 26-Aug-2010/20:40:59-7:00 ** File: host-lib.h ** ** AUTO-GENERATED FILE - Do not modify. (From: make-os-ext.r) @@ -16,7 +16,7 @@ ***********************************************************************/ -#define HOST_LIB_VER 103 +#define HOST_LIB_VER 104 #define HOST_LIB_SUM 5782 #define HOST_LIB_SIZE 30 diff --git a/src/include/reb-config.h b/src/include/reb-config.h index b67e126..15da0ca 100644 --- a/src/include/reb-config.h +++ b/src/include/reb-config.h @@ -132,12 +132,16 @@ #define OS_CRLF FALSE #endif +#ifdef REBOL_HOST +#define REB_LIB +#endif + #ifdef REBOL_ONLY -#define REBOL_API // REBOL stand-alone test version +#define RL_API #else #ifdef REBOL_EXPORTS -#define REBOL_API API_EXPORT // for REBOL library build +#define RL_API API_EXPORT // for REBOL library build #else -#define REBOL_API API_IMPORT // for host files when DLL used +#define RL_API API_IMPORT // for host files when DLL used #endif #endif // REBOL_ONLY diff --git a/src/include/reb-event.h b/src/include/reb-event.h index d6bcd4a..6d977ba 100644 --- a/src/include/reb-event.h +++ b/src/include/reb-event.h @@ -40,10 +40,11 @@ enum { // Event port data model enum { - EVM_PORT, - EVM_OBJECT, - EVM_GUI, - EVM_CALLBACK, + EVM_DEVICE, // I/O request holds the port pointer + EVM_PORT, // event holds port pointer + EVM_OBJECT, // event holds object frame pointer + EVM_GUI, // GUI event uses system/view/event/port + EVM_CALLBACK, // Callback event uses system/ports/callback port }; // Special messages diff --git a/src/include/reb-evtypes.h b/src/include/reb-evtypes.h index a6a9cc5..a942338 100644 --- a/src/include/reb-evtypes.h +++ b/src/include/reb-evtypes.h @@ -7,8 +7,8 @@ ************************************************************************ ** ** Title: Event Types -** Build: A103 -** Date: 19-Aug-2010/20:35:22-7:00 +** Build: A104 +** Date: 26-Aug-2010/20:41-7:00 ** File: reb-evtypes.h ** ** AUTO-GENERATED FILE - Do not modify. (From: make-boot.r) diff --git a/src/include/reb-ext.h b/src/include/reb-ext.h index d2c634b..81bf620 100644 --- a/src/include/reb-ext.h +++ b/src/include/reb-ext.h @@ -126,6 +126,3 @@ enum { RXC_QUEUED, // pending in event queue RXC_DONE, // call completed, structs can be freed }; - -// Include the library interface: -#include "reb-ext-lib.h" diff --git a/src/include/reb-gob.h b/src/include/reb-gob.h index 7a7af0a..cff934a 100644 --- a/src/include/reb-gob.h +++ b/src/include/reb-gob.h @@ -150,9 +150,9 @@ struct rebol_gob { // size: 64 bytes! #define GOB_TAIL(g) SERIES_TAIL((g)->pane) #define GOB_HEAD(g) ((REBGOB **)(SERIES_DATA(GOB_PANE(g)))) #else -#define GOB_STRING(g) ((REBYTE *)Reb_Get_Series(GOB_CONTENT(g), 0)) -#define GOB_TAIL(g) ((REBCNT)Reb_Get_Series(GOB_PANE(g), 1)) -#define GOB_HEAD(g) ((REBGOB **)Reb_Get_Series(GOB_PANE(g), 0)) +#define GOB_STRING(g) ((REBYTE *)RL_Get_Series(GOB_CONTENT(g), 0)) +#define GOB_TAIL(g) ((REBCNT)RL_Get_Series(GOB_PANE(g), 1)) +#define GOB_HEAD(g) ((REBGOB **)RL_Get_Series(GOB_PANE(g), 0)) #endif #define GOB_BITMAP(g) GOB_STRING(g) #define GOB_SKIP(g,n) (GOB_HEAD(g)+n) diff --git a/src/include/reb-host.h b/src/include/reb-host.h index 031d6d2..321cf85 100644 --- a/src/include/reb-host.h +++ b/src/include/reb-host.h @@ -25,3 +25,4 @@ #include "reb-filereq.h" #include "reb-gob.h" +#include "reb-lib.h" diff --git a/src/include/reb-ext-lib.h b/src/include/reb-lib.h similarity index 54% rename from src/include/reb-ext-lib.h rename to src/include/reb-lib.h index fb73526..b992b58 100644 --- a/src/include/reb-ext-lib.h +++ b/src/include/reb-lib.h @@ -6,19 +6,32 @@ ** ************************************************************************ ** -** Title: REBOL Extension API -** Build: A103 -** Date: 19-Aug-2010/20:35:21-7:00 +** Title: REBOL Host and Extension API +** Build: A104 +** Date: 26-Aug-2010/20:40:59-7:00 ** File: reb-ext-lib.r ** ** AUTO-GENERATED FILE - Do not modify. (From: make-ext-lib.r) ** ***********************************************************************/ -#define RXI_VERSION 1 +#define RXI_VERS 2 typedef struct rebol_ext_api { - int version; + //int version; + void (*version)(REBYTE vers[]); + int (*init)(REBARGS *rargs, void *lib); + int (*start)(int reserved); + void (*reset)(); + void *(*extend)(REBYTE *source, RXICAL call); + void (*escape)(REBINT reserved); + int (*do_string)(REBYTE *text); + int (*do_binary)(REBYTE *bin, REBINT length, REBCNT flags, REBCNT key); + void (*print)(REBYTE *fmt, ...); + void (*print_tos)(REBCNT flags, REBYTE *marker); + int (*event)(REBEVT *evt); + void *(*get_series)(REBSER *ser, REBINT what); + void (*do_commands)(REBSER *blk, void *data); void *(*make_block)(u32 size); void *(*make_string)(u32 size, int unicode); void *(*make_image)(u32 width, u32 height); @@ -39,10 +52,6 @@ typedef struct rebol_ext_api { int (*callback)(RXICBI *cbi); } RXILIB; -//** Included by extension ******************************************** - -#ifndef RXI_API - #ifdef TO_WIN32 #define RXIEXT __declspec(dllexport) #else @@ -57,9 +66,119 @@ RXILIB *RXI; // Passed to the Init() function // Use these macros to access the API library functions: -#define RXI_MAKE_BLOCK(a) RXI->make_block(a) +#define RL_VERSION(a) RXI->version(a) +/* +** void RL_Version(REBYTE vers[]) +** +***********************************************************************/ + +#define RL_INIT(a,b) RXI->init(a,b) +/* +** int RL_Init(REBARGS *rargs, void *lib) +** +** REBOL_HOST_LIB *lib +** +***********************************************************************/ + +#define RL_START(a) RXI->start(a) +/* +** int RL_Start(int reserved) +** +***********************************************************************/ + +#define RL_RESET() RXI->reset() +/* +** void RL_Reset() +** +** Reset REBOL. Currently only resets the stack. +** +***********************************************************************/ + +#define RL_EXTEND(a,b) RXI->extend(a,b) /* -** void *RXI_make_block(u32 size) +** void *RL_Extend(REBYTE *source, RXICAL call) +** +** Adds a boot extension to the system/catalog/boot-exts list. +** Later in the boot, these are used with LOAD-EXTENSION to +** query and potentially init each extension (depending on flag.) +** +***********************************************************************/ + +#define RL_ESCAPE(a) RXI->escape(a) +/* +** void RL_Escape(REBINT reserved) +** +** Signal that escape is needed. Can be CTRL-C or ESCAPE. +** +***********************************************************************/ + +#define RL_DO_STRING(a) RXI->do_string(a) +/* +** int RL_Do_String(REBYTE *text) +** +** Text must be valid UTF-8. +** Returns TRUE if ran ok. +** +***********************************************************************/ + +#define RL_DO_BINARY(a,b,c,d) RXI->do_binary(a,b,c,d) +/* +** int RL_Do_Binary(REBYTE *bin, REBINT length, REBCNT flags, REBCNT key) +** +** Run a binary encoded script form such as compressed text. +** +** Also include: rebin, cloaked, signed, and encrypted formats. +** Returns TRUE if ran ok. +** +***********************************************************************/ + +#define RL_PRINT(a,b) RXI->print(a,b) +/* +** void RL_Print(REBYTE *fmt, ...) +** +***********************************************************************/ + +#define RL_PRINT_TOS(a,b) RXI->print_tos(a,b) +/* +** void RL_Print_TOS(REBCNT flags, REBYTE *marker) +** +** Print top of stack value. (Actually it is TOS+1). +** Marker is usually "==" to show output. +** +***********************************************************************/ + +#define RL_EVENT(a) RXI->event(a) +/* +** int RL_Event(REBEVT *evt) +** +** Appends an application event (e.g. GUI) to the event port. +** Sets signal to get REBOL attention for WAIT and awake. +** Returns 0 if queue is full. +** +** To avoid environment problems, this function only appends +** to the event queue (no auto-expand). So if the queue is full +** an error will be returned. If the event is a CLOSE or other +** high-importance signal, the signal will be raised here. +** +***********************************************************************/ + +#define RL_GET_SERIES(a,b) RXI->get_series(a,b) +/* +** void *RL_Get_Series(REBSER *ser, REBINT what) +** +** Returns information about a series: data, length +** +***********************************************************************/ + +#define RL_DO_COMMANDS(a,b) RXI->do_commands(a,b) +/* +** void RL_Do_Commands(REBSER *blk, void *data) +** +***********************************************************************/ + +#define RL_MAKE_BLOCK(a) RXI->make_block(a) +/* +** void *RL_Make_Block(u32 size) ** ** Allocate a new block. ** @@ -76,9 +195,9 @@ RXILIB *RXI; // Passed to the Init() function ** However, you can lock blocks to prevent deallocation. (?? default) */ -#define RXI_MAKE_STRING(a,b) RXI->make_string(a,b) +#define RL_MAKE_STRING(a,b) RXI->make_string(a,b) /* -** void *RXI_make_string(u32 size, int unicode) +** void *RL_Make_String(u32 size, int unicode) ** ** Allocate a new string. ** @@ -97,9 +216,9 @@ RXILIB *RXI; // Passed to the Init() function ** However, you can lock strings to prevent deallocation. (?? default) */ -#define RXI_MAKE_IMAGE(a,b) RXI->make_image(a,b) +#define RL_MAKE_IMAGE(a,b) RXI->make_image(a,b) /* -** void *RXI_make_image(u32 width, u32 height) +** void *RL_Make_Image(u32 width, u32 height) ** ** Allocate a new image of the given size. ** @@ -114,9 +233,9 @@ RXILIB *RXI; // Passed to the Init() function ** no references to them from REBOL code (C code does nothing.) */ -#define RXI_GC_PROTECT(a,b) RXI->gc_protect(a,b) +#define RL_GC_PROTECT(a,b) RXI->gc_protect(a,b) /* -** void RXI_gc_protect(REBSER *series, BOOL protect) +** void RL_GC_Protect(REBSER *series, BOOL protect) ** ** Protect memory from garbage collection. ** @@ -135,9 +254,9 @@ RXILIB *RXI; // Passed to the Init() function ** find them, such as in an existing block or object (variable). */ -#define RXI_GET_STRING(a,b,c) RXI->get_string(a,b,c) +#define RL_GET_STRING(a,b,c) RXI->get_string(a,b,c) /* -** int RXI_get_string(REBSER *series, u32 index, void **str) +** int RL_Get_String(REBSER *series, u32 index, void **str) ** ** Obtain a pointer into a string (bytes or unicode). ** @@ -153,9 +272,9 @@ RXILIB *RXI; // Passed to the Init() function ** to make a copy of the string if needed. */ -#define RXI_MAP_WORD(a) RXI->map_word(a) +#define RL_MAP_WORD(a) RXI->map_word(a) /* -** u32 RXI_map_word(REBYTE *string) +** u32 RL_Map_Word(REBYTE *string) ** ** Given a word as a string, return its global word identifier. ** @@ -169,9 +288,9 @@ RXILIB *RXI; // Passed to the Init() function ** it will be added and the new word identifier is returned. */ -#define RXI_MAP_WORDS(a) RXI->map_words(a) +#define RL_MAP_WORDS(a) RXI->map_words(a) /* -** u32 *RXI_map_words(REBSER *series) +** u32 *RL_Map_Words(REBSER *series) ** ** Given a block of word values, return an array of word ids. ** @@ -186,9 +305,9 @@ RXILIB *RXI; // Passed to the Init() function ** The array is allocated with OS_MAKE and you can OS_FREE it any time. */ -#define RXI_WORD_STRING(a) RXI->word_string(a) +#define RL_WORD_STRING(a) RXI->word_string(a) /* -** REBYTE *RXI_word_string(u32 word) +** REBYTE *RL_Word_String(u32 word) ** ** Return a string related to a given global word identifier. ** @@ -204,9 +323,9 @@ RXILIB *RXI; // Passed to the Init() function ** The string is allocated with OS_MAKE and you can OS_FREE it any time. */ -#define RXI_FIND_WORD(a,b) RXI->find_word(a,b) +#define RL_FIND_WORD(a,b) RXI->find_word(a,b) /* -** u32 RXI_find_word(u32 *words, u32 word) +** u32 RL_Find_Word(u32 *words, u32 word) ** ** Given an array of word ids, return the index of the given word. ** @@ -219,9 +338,9 @@ RXILIB *RXI; // Passed to the Init() function ** The first element of the word array is the length of the array. */ -#define RXI_SERIES_INFO(a,b) RXI->series_info(a,b) +#define RL_SERIES_INFO(a,b) RXI->series_info(a,b) /* -** int RXI_series_info(REBSER *series, REBCNT what) +** int RL_Series_Info(REBSER *series, REBCNT what) ** ** Get series information. ** @@ -232,9 +351,9 @@ RXILIB *RXI; // Passed to the Init() function ** what - indicates what information to return (see enum) */ -#define RXI_GET_CHAR(a,b) RXI->get_char(a,b) +#define RL_GET_CHAR(a,b) RXI->get_char(a,b) /* -** int RXI_get_char(REBSER *series, u32 index) +** int RL_Get_Char(REBSER *series, u32 index) ** ** Get a character from byte or unicode string. ** @@ -250,9 +369,9 @@ RXILIB *RXI; // Passed to the Init() function ** R3 build options. The default is 16 bits. */ -#define RXI_SET_CHAR(a,b,c) RXI->set_char(a,b,c) +#define RL_SET_CHAR(a,b,c) RXI->set_char(a,b,c) /* -** u32 RXI_set_char(REBSER *series, u32 index, u32 chr) +** u32 RL_Set_Char(REBSER *series, u32 index, u32 chr) ** ** Set a character into a byte or unicode string. ** @@ -265,9 +384,9 @@ RXILIB *RXI; // Passed to the Init() function ** will be appended. */ -#define RXI_GET_VALUE(a,b,c) RXI->get_value(a,b,c) +#define RL_GET_VALUE(a,b,c) RXI->get_value(a,b,c) /* -** int RXI_get_value(REBSER *series, u32 index, RXIARG *val) +** int RL_Get_Value(REBSER *series, u32 index, RXIARG *val) ** ** Get a value from a block. ** @@ -279,9 +398,9 @@ RXILIB *RXI; // Passed to the Init() function ** val - gets set to the value of the field */ -#define RXI_SET_VALUE(a,b,c,d) RXI->set_value(a,b,c,d) +#define RL_SET_VALUE(a,b,c,d) RXI->set_value(a,b,c,d) /* -** int RXI_set_value(REBSER *series, u32 index, RXIARG val, int type) +** int RL_Set_Value(REBSER *series, u32 index, RXIARG val, int type) ** ** Set a value in a block. ** @@ -294,9 +413,9 @@ RXILIB *RXI; // Passed to the Init() function ** type - datatype of value */ -#define RXI_WORDS_OF_OBJECT(a) RXI->words_of_object(a) +#define RL_WORDS_OF_OBJECT(a) RXI->words_of_object(a) /* -** u32 *RXI_words_of_object(REBSER *obj) +** u32 *RL_Words_Of_Object(REBSER *obj) ** ** Returns information about the object. ** @@ -309,9 +428,9 @@ RXILIB *RXI; // Passed to the Init() function ** The array is allocated with OS_MAKE and you can OS_FREE it any time. */ -#define RXI_GET_FIELD(a,b,c) RXI->get_field(a,b,c) +#define RL_GET_FIELD(a,b,c) RXI->get_field(a,b,c) /* -** int RXI_get_field(REBSER *obj, u32 word, RXIARG *val) +** int RL_Get_Field(REBSER *obj, u32 word, RXIARG *val) ** ** Get a field value (context variable) of an object. ** @@ -323,9 +442,9 @@ RXILIB *RXI; // Passed to the Init() function ** val - gets set to the value of the field */ -#define RXI_SET_FIELD(a,b,c,d) RXI->set_field(a,b,c,d) +#define RL_SET_FIELD(a,b,c,d) RXI->set_field(a,b,c,d) /* -** int RXI_set_field(REBSER *obj, u32 word, RXIARG val, int type) +** int RL_Set_Field(REBSER *obj, u32 word, RXIARG val, int type) ** ** Set a field (context variable) of an object. ** @@ -338,9 +457,9 @@ RXILIB *RXI; // Passed to the Init() function ** type - datatype of value */ -#define RXI_CALLBACK(a) RXI->callback(a) +#define RL_CALLBACK(a) RXI->callback(a) /* -** int RXI_callback(RXICBI *cbi) +** int RL_Callback(RXICBI *cbi) ** ** Evaluate a REBOL callback function, either synchronous or asynchronous. ** @@ -367,49 +486,38 @@ RXILIB *RXI; // Passed to the Init() function */ -#else - -//** Included by REBOL ************************************************ - -extern void *RXI_make_block(u32 size); -extern void *RXI_make_string(u32 size, int unicode); -extern void *RXI_make_image(u32 width, u32 height); -extern void RXI_gc_protect(REBSER *series, BOOL protect); -extern int RXI_get_string(REBSER *series, u32 index, void **str); -extern u32 RXI_map_word(REBYTE *string); -extern u32 *RXI_map_words(REBSER *series); -extern REBYTE *RXI_word_string(u32 word); -extern u32 RXI_find_word(u32 *words, u32 word); -extern int RXI_series_info(REBSER *series, REBCNT what); -extern int RXI_get_char(REBSER *series, u32 index); -extern u32 RXI_set_char(REBSER *series, u32 index, u32 chr); -extern int RXI_get_value(REBSER *series, u32 index, RXIARG *val); -extern int RXI_set_value(REBSER *series, u32 index, RXIARG val, int type); -extern u32 *RXI_words_of_object(REBSER *obj); -extern int RXI_get_field(REBSER *obj, u32 word, RXIARG *val); -extern int RXI_set_field(REBSER *obj, u32 word, RXIARG val, int type); -extern int RXI_callback(RXICBI *cbi); - -RXILIB Ext_Lib = { - RXI_VERSION, - RXI_make_block, - RXI_make_string, - RXI_make_image, - RXI_gc_protect, - RXI_get_string, - RXI_map_word, - RXI_map_words, - RXI_word_string, - RXI_find_word, - RXI_series_info, - RXI_get_char, - RXI_set_char, - RXI_get_value, - RXI_set_value, - RXI_words_of_object, - RXI_get_field, - RXI_set_field, - RXI_callback, -}; +#ifdef REB_LIB // direct calls to REBOL library functions + +RL_API void RL_Version(REBYTE vers[]); +RL_API int RL_Init(REBARGS *rargs, void *lib); +RL_API int RL_Start(int reserved); +RL_API void RL_Reset(); +RL_API void *RL_Extend(REBYTE *source, RXICAL call); +RL_API void RL_Escape(REBINT reserved); +RL_API int RL_Do_String(REBYTE *text); +RL_API int RL_Do_Binary(REBYTE *bin, REBINT length, REBCNT flags, REBCNT key); +RL_API void RL_Print(REBYTE *fmt, ...); +RL_API void RL_Print_TOS(REBCNT flags, REBYTE *marker); +RL_API int RL_Event(REBEVT *evt); +RL_API void *RL_Get_Series(REBSER *ser, REBINT what); +RL_API void RL_Do_Commands(REBSER *blk, void *data); +RL_API void *RL_Make_Block(u32 size); +RL_API void *RL_Make_String(u32 size, int unicode); +RL_API void *RL_Make_Image(u32 width, u32 height); +RL_API void RL_GC_Protect(REBSER *series, BOOL protect); +RL_API int RL_Get_String(REBSER *series, u32 index, void **str); +RL_API u32 RL_Map_Word(REBYTE *string); +RL_API u32 *RL_Map_Words(REBSER *series); +RL_API REBYTE *RL_Word_String(u32 word); +RL_API u32 RL_Find_Word(u32 *words, u32 word); +RL_API int RL_Series_Info(REBSER *series, REBCNT what); +RL_API int RL_Get_Char(REBSER *series, u32 index); +RL_API u32 RL_Set_Char(REBSER *series, u32 index, u32 chr); +RL_API int RL_Get_Value(REBSER *series, u32 index, RXIARG *val); +RL_API int RL_Set_Value(REBSER *series, u32 index, RXIARG val, int type); +RL_API u32 *RL_Words_Of_Object(REBSER *obj); +RL_API int RL_Get_Field(REBSER *obj, u32 word, RXIARG *val); +RL_API int RL_Set_Field(REBSER *obj, u32 word, RXIARG val, int type); +RL_API int RL_Callback(RXICBI *cbi); #endif diff --git a/src/include/rebol-lib.h b/src/include/rebol-lib.h deleted file mode 100644 index da48784..0000000 --- a/src/include/rebol-lib.h +++ /dev/null @@ -1,35 +0,0 @@ -/*********************************************************************** -** -** REBOL 3.0 "Invasion" -** Copyright 2010 REBOL Technologies -** All rights reserved. -** -************************************************************************ -** -** Title: REBOL Interface Library -** Build: A102 -** Date: 13-Aug-2010/15:36:26-7:00 -** File: rebol-lib.h -** -** AUTO-GENERATED FILE - Do not modify. (From: make-headers.r) -** -***********************************************************************/ - - -extern REBOL_API void Reb_Version(REBYTE vers[]); // a-lib.c -extern REBOL_API REBINT Reb_Init(REBARGS *rargs, REBOL_HOST_LIB *lib); // a-lib.c -extern REBOL_API REBINT Reb_Start(REBINT reserved); // a-lib.c -extern REBOL_API void Reb_Reset(); // a-lib.c -extern REBOL_API void *Reb_Extend(REBYTE *source, RXICAL call); // a-lib.c -extern REBOL_API void Reb_Escape(REBINT reserved); // a-lib.c -extern REBOL_API REBFLG Reb_Do_String(REBYTE *text); // a-lib.c -extern REBOL_API REBINT Reb_Do_Binary(REBYTE *bin, REBINT length, REBCNT flags, REBCNT key); // a-lib.c -extern REBOL_API void Reb_Print(REBYTE *fmt, ...); // a-lib.c -extern REBOL_API void Reb_Print_TOS(REBCNT flags, REBYTE *marker); // a-lib.c -extern REBOL_API REBINT Reb_Event(REBEVT *evt); // a-lib.c -extern REBOL_API void *Reb_Get_Series(REBSER *ser, REBINT what); // a-lib.c -extern REBOL_API void Reb_Do_Commands(REBSER *blk, void *data); // a-lib.c -extern REBOL_API REBINT Reb_Dialect(REBINT dialect, REBSER *block, REBCNT *index, REBSER **arglist); // a-lib2.c -extern REBOL_API void Reb_Set_Var(void *var, void *value); // a-lib2.c -extern REBOL_API REBINT Reb_Map_Words(REBYTE **names, REBCNT *symbols); // a-lib2.c -extern REBOL_API REBINT Reb_Find_Word(REBCNT sym, REBCNT *symbols, REBINT limit); // a-lib2.c diff --git a/src/os/host-device.c b/src/os/host-device.c index 5afeabe..e541e2c 100644 --- a/src/os/host-device.c +++ b/src/os/host-device.c @@ -43,9 +43,7 @@ #include #include "reb-host.h" - #include "host-lib.h" -#include "rebol-lib.h" /*********************************************************************** @@ -224,11 +222,11 @@ static int Poll_Default(REBDEV *dev) CLEARS(&evt); evt.type = (REBYTE)type; - evt.model = EVM_PORT; + evt.model = EVM_DEVICE; evt.req = req; if (type == EVT_ERROR) evt.data = req->error; - Reb_Event(&evt); // (returns 0 if queue is full, ignored) + RL_Event(&evt); // (returns 0 if queue is full, ignored) } diff --git a/src/os/host-ext-test.c b/src/os/host-ext-test.c index b0e8570..07e8bfb 100644 --- a/src/os/host-ext-test.c +++ b/src/os/host-ext-test.c @@ -34,8 +34,6 @@ #include "reb-host.h" #include "host-lib.h" -#include "rebol-lib.h" - char *RX_Spec = "REBOL [\n" @@ -102,7 +100,7 @@ REBCNT Test_Sync_Callback(REBSER *obj, REBCNT word, RXIARG *result) args[1].int64 = 123; - n = RXI_CALLBACK(&cbi); + n = RL_CALLBACK(&cbi); *result = cbi.result; return n; @@ -132,7 +130,7 @@ REBCNT Test_Async_Callback(REBSER *obj, REBCNT word) args[1].int64 = 123; - n = RXI_CALLBACK(cbi); // result is in cbi struct, if wanted + n = RL_CALLBACK(cbi); // result is in cbi struct, if wanted return n; } @@ -157,18 +155,18 @@ RXIEXT int RX_Call(int cmd, RXIFRM *frm, void *data) { break; case 3: - RXA_WORD(frm, 1) = RXI_MAP_WORD("system"); //?? is frame always long enough?? + RXA_WORD(frm, 1) = RL_MAP_WORD("system"); //?? is frame always long enough?? RXA_TYPE(frm, 1) = RXT_WORD; break; case 4: - RXI_GET_STRING(RXA_SERIES(frm, 1), 0, (void*)(&str)); // latin-1 only for test - RXA_WORD(frm, 1) = RXI_MAP_WORD(str); + RL_GET_STRING(RXA_SERIES(frm, 1), 0, (void*)(&str)); // latin-1 only for test + RXA_WORD(frm, 1) = RL_MAP_WORD(str); RXA_TYPE(frm, 1) = RXT_WORD; break; case 5: - RXA_TYPE(frm, 1) = RXI_GET_FIELD(RXA_OBJECT(frm, 1), RXA_WORD(frm, 2), &RXA_ARG(frm, 1)); + RXA_TYPE(frm, 1) = RL_GET_FIELD(RXA_OBJECT(frm, 1), RXA_WORD(frm, 2), &RXA_ARG(frm, 1)); break; case 6: @@ -189,5 +187,5 @@ RXIEXT int RX_Call(int cmd, RXIFRM *frm, void *data) { void Init_Ext_Test(void) { - RXI = Reb_Extend(&RX_Spec[0], &RX_Call); + RXI = RL_Extend(&RX_Spec[0], &RX_Call); } diff --git a/src/os/host-main.c b/src/os/host-main.c index b3335e5..b787886 100644 --- a/src/os/host-main.c +++ b/src/os/host-main.c @@ -42,7 +42,8 @@ #include "reb-host.h" // standard host include files #include "host-lib.h" // OS host library (dispatch table) -#include "rebol-lib.h" // REBOL library (function prototypes) + +//#include "rebol-lib.h" // REBOL library (function prototypes) #include "host-init.c" @@ -121,13 +122,13 @@ int main(int argc, char **argv) Parse_Args(argc, argv, &Main_Args); vers[0] = 5; // len - Reb_Version(&vers[0]); + RL_Version(&vers[0]); Open_StdIO(); // also sets up interrupt handler // Initialize the REBOL library: if (!Host_Lib) Host_Crash("Missing host lib"); - n = Reb_Init(&Main_Args, Host_Lib); + n = RL_Init(&Main_Args, Host_Lib); if (n == 1) Host_Crash("REBOL DLL wrong size"); if (n == 2) Host_Crash("REBOL DLL wrong version/checksum"); @@ -141,10 +142,10 @@ int main(int argc, char **argv) #endif // Initialize host bundled source code: - Reb_Do_Binary((REBYTE *)(&Reb_Init_Code[0]), REB_INIT_SIZE, 0, 0); + RL_Do_Binary((REBYTE *)(&Reb_Init_Code[0]), REB_INIT_SIZE, 0, 0); // Run REBOL's mezzanine bootstrap: - n = (Main_Args.options & RO_NO_BOOT) ? TRUE : Reb_Start(0); // TRUE on halt + n = (Main_Args.options & RO_NO_BOOT) ? TRUE : RL_Start(0); // TRUE on halt // Console line input loop (just an example, can be improved): if ( @@ -155,8 +156,8 @@ int main(int argc, char **argv) while (TRUE) { Put_Str(PROMPT_STR); if ((line = Get_Str())) { - Reb_Do_String(line); - Reb_Print_TOS(0, RESULT_STR); + RL_Do_String(line); + RL_Print_TOS(0, RESULT_STR); OS_Free(line); } else break; // EOS diff --git a/src/os/posix/dev-stdio.c b/src/os/posix/dev-stdio.c index f4cf4e6..5fa7ed2 100644 --- a/src/os/posix/dev-stdio.c +++ b/src/os/posix/dev-stdio.c @@ -69,7 +69,7 @@ void *Term_IO; void Handle_Signal(int sig) { Put_Str("[escape]"); - Reb_Escape(0); + RL_Escape(0); } void Init_Signals(void) diff --git a/src/os/win32/dev-stdio.c b/src/os/win32/dev-stdio.c index f5df001..f97e07e 100644 --- a/src/os/win32/dev-stdio.c +++ b/src/os/win32/dev-stdio.c @@ -33,7 +33,7 @@ #include #include - + #include "reb-host.h" #include "host-lib.h" @@ -54,7 +54,7 @@ static BOOL Redir_Inp = 0; // Special access: extern REBDEV *Devices[]; -extern REBOL_API void Reb_Escape(int level); + //********************************************************************** @@ -62,7 +62,7 @@ BOOL WINAPI Handle_Break(DWORD dwCtrlType) { // Handle the MS CMD console CTRL-C, BREAK, and other events: if (dwCtrlType >= CTRL_CLOSE_EVENT) OS_Exit(100); // close button, shutdown, etc. - Reb_Escape(0); + RL_Escape(0); return TRUE; // We handled it } diff --git a/src/os/win32/host-event.c b/src/os/win32/host-event.c index b0e79ac..5049e96 100644 --- a/src/os/win32/host-event.c +++ b/src/os/win32/host-event.c @@ -45,7 +45,6 @@ #include "reb-host.h" #include "host-lib.h" -#include "rebol-lib.h" //***** Constants ***** @@ -101,7 +100,7 @@ static void Add_Event_XY(REBGOB *gob, REBINT id, REBINT xy, REBINT flags) evt.data = xy; evt.ser = (void*)gob; - Reb_Event(&evt); // returns 0 if queue is full + RL_Event(&evt); // returns 0 if queue is full } static void Add_Event_Key(REBGOB *gob, REBINT id, REBINT key, REBINT flags) @@ -114,7 +113,7 @@ static void Add_Event_Key(REBGOB *gob, REBINT id, REBINT key, REBINT flags) evt.data = key; evt.ser = (void*)gob; - Reb_Event(&evt); // returns 0 if queue is full + RL_Event(&evt); // returns 0 if queue is full } static void Add_File_Events(REBGOB *gob, REBINT flags, HDROP drop) @@ -145,7 +144,7 @@ static void Add_File_Events(REBGOB *gob, REBINT flags, HDROP drop) buf[len] = 0; // ?! convert to REBOL format? E.g.: evt.ser = OS_To_REBOL_File(buf, &len); OS_Free(buf); - if (!Reb_Event(&evt)) break; // queue is full + if (!RL_Event(&evt)) break; // queue is full } } diff --git a/src/os/win32/host-graphics.c b/src/os/win32/host-graphics.c index fe3cb3f..8be4cb0 100644 --- a/src/os/win32/host-graphics.c +++ b/src/os/win32/host-graphics.c @@ -29,7 +29,7 @@ #include "reb-host.h" #include "host-lib.h" -#include "rebol-lib.h" + #include "agg-draw.h" #include "host-ext-graphics.h" #include "host-ext-draw.h" @@ -51,7 +51,7 @@ extern REBINT Show_Gob(REBGOB *gob); ** ***********************************************************************/ { - Reb_Do_Commands(block, graphics); + RL_Do_Commands(block, graphics); return 0; } @@ -108,7 +108,7 @@ extern REBINT Show_Gob(REBGOB *gob); REBCNT n; REBSER blk = RXA_SERIES(frm, 1); - for (n = 0; type = RXI_GET_VALUE(blk, n, &val); n++) { + for (n = 0; type = RL_GET_VALUE(blk, n, &val); n++) { if (type == RXT_PAIR) { if (n > 0) agg_add_vertex(data, val.pair); @@ -143,8 +143,8 @@ extern REBINT Show_Gob(REBGOB *gob); ** ***********************************************************************/ { - RXI = Reb_Extend((REBYTE *)(&RX_graphics[0]), &RXD_Graphics); - Reb_Extend((REBYTE *)(&RX_draw[0]), &RXD_Draw); + RXI = RL_Extend((REBYTE *)(&RX_graphics[0]), &RXD_Graphics); + RL_Extend((REBYTE *)(&RX_draw[0]), &RXD_Draw); } diff --git a/src/os/win32/host-window.c b/src/os/win32/host-window.c index 978bafc..cd5e9a3 100644 --- a/src/os/win32/host-window.c +++ b/src/os/win32/host-window.c @@ -34,7 +34,6 @@ #include "reb-host.h" #include "host-lib.h" -#include "rebol-lib.h" #ifndef NO_COMPOSITOR #include "agg-compositor.h"