Skip to content

Commit

Permalink
RT R3 A103 Hostkit for Win32
Browse files Browse the repository at this point in the history
  • Loading branch information
REBOL Technologies authored and earl committed Aug 20, 2010
1 parent 1a270f6 commit 7f30242
Show file tree
Hide file tree
Showing 18 changed files with 312 additions and 82 deletions.
4 changes: 2 additions & 2 deletions info.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
REBOL 3 Host-Kit Source Distribution
From REBOL Technologies in Ukiah, California

Version: 2.100.102.0.0 (alpha)
Updated: 29-Jul-2010/15:04:56-7:00
Version: 2.100.103.0.0 (alpha)
Updated: 19-Aug-2010/20:35:57-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.
Expand Down
Binary file modified lib/r3lib.dll
Binary file not shown.
Binary file modified lib/r3lib.exp
Binary file not shown.
Binary file modified lib/r3lib.lib
Binary file not shown.
8 changes: 6 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#--- REBOL 3.0 Host Makefile - Build A102
#--- Note: this makefile was generated by make-build.r (29-Jul-2010/22:04:56)
#--- REBOL 3.0 Host Makefile - Build A103
#--- Note: this makefile was generated by make-build.r (20-Aug-2010/3:35:57)
#--- 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

Expand Down Expand Up @@ -32,6 +32,7 @@ OBJS= \
$O/host-args.o\
$O/host-device.o\
$O/host-stdio.o\
$O/host-ext-test.o\
$O/dev-net.o\
$O/dev-dns.o\
$O/host-lib.o\
Expand Down Expand Up @@ -135,6 +136,9 @@ $O/host-device.o: $S/os/host-device.c $(INCS) $I/reb-host.h $I/host-lib.h $I/r
$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
$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
$C $(CFLAGS) -fpack-struct -o $O/dev-net.o $S/os/dev-net.c

Expand Down
2 changes: 1 addition & 1 deletion src/boot/version.r
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.100.102.3.1
2.100.103.3.1
4 changes: 2 additions & 2 deletions src/include/ext-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
************************************************************************
**
** Title: Extension Types (Isolators)
** Build: A102
** Date: 29-Jul-2010/15:04:12-7:00
** Build: A103
** Date: 19-Aug-2010/20:35:22-7:00
** File: ext-types.h
**
** AUTO-GENERATED FILE - Do not modify. (From: make-boot.r)
Expand Down
6 changes: 3 additions & 3 deletions src/include/host-lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
************************************************************************
**
** Title: Host Access Library
** Build: A102
** Date: 29-Jul-2010/15:04:11-7:00
** Build: A103
** Date: 19-Aug-2010/20:35:21-7:00
** File: host-lib.h
**
** AUTO-GENERATED FILE - Do not modify. (From: make-os-ext.r)
**
***********************************************************************/


#define HOST_LIB_VER 102
#define HOST_LIB_VER 103
#define HOST_LIB_SUM 5782
#define HOST_LIB_SIZE 30

Expand Down
1 change: 1 addition & 0 deletions src/include/reb-c.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ typedef char i8;
typedef unsigned char u8;
typedef short i16;
typedef unsigned short u16;
typedef unsigned int uint;
typedef long i32;
typedef unsigned long u32;

Expand Down
19 changes: 13 additions & 6 deletions src/include/reb-event.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ typedef struct rebol_event {
u8 type; // event id (mouse-move, mouse-button, etc)
u8 flags; // special flags
u8 win; // window id
u8 info; // other info
u8 model; // port, object, gui, callback
u32 data; // an x/y position or keycode (raw/decoded)
union {
REBREQ *req; // request (for device events)
Expand All @@ -29,14 +29,21 @@ typedef struct rebol_event {
// Special event flags:

enum {
EVF_NO_REQ, // request field not used (e.g. GUI)
EVF_COPIED, // event data has been copied
EVF_HAS_XY, // map-event will work on it
EVF_DOUBLE, // double click detected
EVF_CONTROL,
EVF_SHIFT,
EVF_IS_PORT,
EVF_IS_OBJ,
EVF_COPIED, // event data has been copied
EVF_HAS_XY, // map-event will work on it
};


// Event port data model

enum {
EVM_PORT,
EVM_OBJECT,
EVM_GUI,
EVM_CALLBACK,
};

// Special messages
Expand Down
5 changes: 3 additions & 2 deletions src/include/reb-evtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
************************************************************************
**
** Title: Event Types
** Build: A102
** Date: 29-Jul-2010/15:04:12-7:00
** Build: A103
** Date: 19-Aug-2010/20:35:22-7:00
** File: reb-evtypes.h
**
** AUTO-GENERATED FILE - Do not modify. (From: make-boot.r)
Expand All @@ -20,6 +20,7 @@ enum event_types {
EVT_IGNORE,
EVT_INTERRUPT,
EVT_DEVICE,
EVT_CALLBACK,
EVT_CUSTOM,
EVT_ERROR,
EVT_INIT,
Expand Down
51 changes: 41 additions & 10 deletions src/include/reb-ext-lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
************************************************************************
**
** Title: REBOL Extension API
** Build: A102
** Date: 29-Jul-2010/15:04:11-7:00
** Build: A103
** Date: 19-Aug-2010/20:35:21-7:00
** File: reb-ext-lib.r
**
** AUTO-GENERATED FILE - Do not modify. (From: make-ext-lib.r)
Expand Down Expand Up @@ -36,6 +36,7 @@ typedef struct rebol_ext_api {
u32 *(*words_of_object)(REBSER *obj);
int (*get_field)(REBSER *obj, u32 word, RXIARG *val);
int (*set_field)(REBSER *obj, u32 word, RXIARG val, int type);
int (*callback)(RXICBI *cbi);
} RXILIB;

//** Included by extension ********************************************
Expand Down Expand Up @@ -156,7 +157,7 @@ RXILIB *RXI; // Passed to the Init() function
/*
** u32 RXI_map_word(REBYTE *string)
**
** Given a word as a string, return its word identifier.
** Given a word as a string, return its global word identifier.
**
** Returns:
** The word identifier that matches the string.
Expand All @@ -175,7 +176,7 @@ RXILIB *RXI; // Passed to the Init() function
** Given a block of word values, return an array of word ids.
**
** Returns:
** An array of word identifiers (integers). The [0] value is the size.
** An array of global word identifiers (integers). The [0] value is the size.
** Arguments:
** series - block of words as values (from REBOL blocks, not strings.)
** Note:
Expand All @@ -189,12 +190,12 @@ RXILIB *RXI; // Passed to the Init() function
/*
** REBYTE *RXI_word_string(u32 word)
**
** Return a string related to a given word identifier.
** Return a string related to a given global word identifier.
**
** Returns:
** A copy of the word string, null terminated.
** Arguments:
** word - a word identifier
** word - a global word identifier
** Note:
** The result is a null terminated copy of the name for your own use.
** The string is always UTF-8 encoded (chars > 127 are encoded.)
Expand Down Expand Up @@ -274,7 +275,7 @@ RXILIB *RXI; // Passed to the Init() function
** Datatype of value or zero if index is past tail.
** Arguments:
** series - block series pointer
** index - word identifier (integer)
** index - global word identifier (integer)
** val - gets set to the value of the field
*/

Expand All @@ -288,7 +289,7 @@ RXILIB *RXI; // Passed to the Init() function
** TRUE if index past end and value was appended to tail of block.
** Arguments:
** series - block series pointer
** index - word identifier (integer)
** index - global word identifier (integer)
** val - new value for field
** type - datatype of value
*/
Expand Down Expand Up @@ -318,7 +319,7 @@ RXILIB *RXI; // Passed to the Init() function
** Datatype of value or zero if word is not found in the object.
** Arguments:
** obj - object pointer (e.g. from RXA_OBJECT)
** word - word identifier (integer)
** word - global word identifier (integer)
** val - gets set to the value of the field
*/

Expand All @@ -332,11 +333,39 @@ RXILIB *RXI; // Passed to the Init() function
** The type arg, or zero if word not found in object or if field is protected.
** Arguments:
** obj - object pointer (e.g. from RXA_OBJECT)
** word - word identifier (integer)
** word - global word identifier (integer)
** val - new value for field
** type - datatype of value
*/

#define RXI_CALLBACK(a) RXI->callback(a)
/*
** int RXI_callback(RXICBI *cbi)
**
** Evaluate a REBOL callback function, either synchronous or asynchronous.
**
** Returns:
** Sync callback: type of the result; async callback: true if queued
** Arguments:
** cbi - callback information:
** - special option flags
** - object pointer (where function is located)
** - function name as global word identifier (within above object)
** - argument list passed to callback (see notes below)
** - result value
** Description:
** The flag value will determine the type of callback. It can be either
** synchronous, where the code will re-enter the interpreter environment
** and call the specified function, or asynchronous where an EVT_CALLBACK
** event is queued, and the callback will be evaluated later when events
** are processed within the interpreter's environment.
**
** For asynchronous callbacks, the cbi and the args array must be managed
** because the data isn't processed until the callback event is
** handled. Therefore, these cannot be allocated locally on
** the C stack; they should be dynamic (or global if so desired.)
*/


#else

Expand All @@ -359,6 +388,7 @@ 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,
Expand All @@ -379,6 +409,7 @@ RXILIB Ext_Lib = {
RXI_words_of_object,
RXI_get_field,
RXI_set_field,
RXI_callback,
};

#endif
37 changes: 33 additions & 4 deletions src/include/reb-ext.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,21 @@ typedef union rxi_arg_val {
};
} RXIARG;

// For direct access to arg array:
#define RXI_COUNT(a) (a[0].bytes[0])
#define RXI_TYPE(a,n) (a[0].bytes[n])

// Command function call frame:
typedef struct rxi_cmd_frame {
RXIARG args[8]; // arg values (64 bits each)
} RXIFRM;

typedef int (*RXICAL)(int cmd, RXIFRM *args, void *data);

// Access macros:
// Access macros (indirect access via RXIFRM pointer):
#define RXA_ARG(f,n) ((f)->args[n])
#define RXA_COUNT(f) (RXA_ARG(f,0).bytes[0])
#define RXA_TYPE(f,n) (RXA_ARG(f,0).bytes[n])
#define RXA_COUNT(f) (RXA_ARG(f,0).bytes[0]) // number of args
#define RXA_TYPE(f,n) (RXA_ARG(f,0).bytes[n]) // types (of first 7 args)
#define RXA_REF(f,n) (RXA_ARG(f,n).int32a)

#define RXA_INT64(f,n) (RXA_ARG(f,n).int64)
Expand All @@ -74,7 +78,6 @@ typedef int (*RXICAL)(int cmd, RXIFRM *args, void *data);
#define RXA_IMAGE_WIDTH(f,n) (RXA_ARG(f,n).width)
#define RXA_IMAGE_HEIGHT(f,n) (RXA_ARG(f,n).height)


// Command function return values:
enum rxi_return {
RXR_UNSET,
Expand All @@ -98,5 +101,31 @@ enum {
RXI_SER_LEFT, // units free in series (past tail)
};

// Error Codes (returned in result value from some API functions):
enum {
RXE_NO_ERROR,
RXE_NO_WORD, // the word cannot be found (e.g. in an object)
RXE_NOT_FUNC, // the value is not a function (for callback)
RXE_BAD_ARGS, // function arguments to not match
};

#define SET_EXT_ERROR(v,n) ((v)->int32a = (n))
#define GET_EXT_ERROR(v) ((v)->int32a)

typedef struct rxi_callback_info {
u32 flags;
REBSER *obj; // object that holds the function
u32 word; // word id for function (name)
RXIARG *args; // argument list for function
RXIARG result; // result from function
} RXICBI;

enum {
RXC_NONE,
RXC_ASYNC, // async callback
RXC_QUEUED, // pending in event queue
RXC_DONE, // call completed, structs can be freed
};

// Include the library interface:
#include "reb-ext-lib.h"
4 changes: 2 additions & 2 deletions src/include/rebol-lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
************************************************************************
**
** Title: REBOL Interface Library
** Build: A101
** Date: 21-Jul-2010/12:15:34-7:00
** 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)
Expand Down
1 change: 1 addition & 0 deletions src/os/host-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ static int Poll_Default(REBDEV *dev)
CLEARS(&evt);

evt.type = (REBYTE)type;
evt.model = EVM_PORT;
evt.req = req;
if (type == EVT_ERROR) evt.data = req->error;

Expand Down
Loading

0 comments on commit 7f30242

Please sign in to comment.