diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c4b7925 --- /dev/null +++ b/Makefile @@ -0,0 +1,63 @@ +### update this to fit your system +SCSH_SRC = /afs/wsi/home/dfreese/scsh-0.6 +SCSH_LIB = /afs/wsi/home/dfreese/i386_fbsd40/lib/scsh +X11_PATH = /usr/X11R6 + +### the following does not have to be changed (hopefully) +SCHEME_INCLUDE = $(SCSH_SRC)/c +X11_INCLUDE = $(X11_PATH)/include +X11_LIB = $(X11_PATH)/lib + +CC = gcc + +SCX_VERSION = "0.1" +SCX_VM = "scxvm" +SCX_IMAGE = "scx.image" + +### The first=default target +enough: $(SCX_VM) #$(SCX_IMAGE) #doesn't work yet + +### Making the VM ### +### The VM is scsh plus all new primitives from the c files ### + +OBJECTS = c/main.o \ + c/xlib/display.o c/xlib/window.o c/xlib/type.o c/xlib/color.o \ + c/xlib/colormap.o c/xlib/pixel.o c/xlib/gcontext.o c/xlib/event.o \ + c/xlib/pixmap.o c/xlib/graphics.o c/xlib/font.o \ + c/xlib/cursor.o c/xlib/text.o c/xlib/property.o c/xlib/wm.o \ + c/xlib/client.o c/xlib/key.o c/xlib/error.o \ + c/xlib/extension.o c/xlib/init.o c/xlib/util.o c/xlib/grab.o \ + c/xlib/visual.o c/xlib/region.o + +$(SCX_VM): c/main.o $(OBJECTS) + $(CC) -g -o $(SCX_VM) -L $(SCSH_LIB) -L $(X11_LIB) \ + $(OBJECTS) -lscsh -lm -lX11 -lcrypt && + +$(OBJECTS): c/xlib/xlib.h +.c.o: + $(CC) -g -c -I $(X11_INCLUDE) -I $(SCHEME_INCLUDE) -o $@ $< + + +### Making the Image ### +### The Image is a dump of the VM with all new packages loaded, and +### xlib opened. + +STARTUP_MSG = "with SCX $(SCX_VERSION), the X11 support."; + +$(SCX_IMAGE): + ( \ + echo ",batch on"; \ + echo ",config ,load scheme/xlib/xlib-type-interfaces.scm"; \ + echo ",config ,load scheme/xlib/xlib-type-package.scm"; \ + echo ",config ,load scheme/xlib/xlib-interfaces.scm"; \ + echo ",config ,load scheme/xlib/xlib-packages.scm"; \ + echo ",open xlib"; \ + echo ",dump $(SCX_IMAGE) \"$(STARTUP_MSG)\"" \ + ) | $(SCX_VM) + + +#SCSH_IMAGE = "/afs/wsi/home/dfreese/i386_fbsd43/lib/scheme48/scsh.image" +#main.c: + +clean: + rm -f $(SCX_VM) c/*.o c/xlib/*.o diff --git a/c/main.c b/c/main.c new file mode 100644 index 0000000..a331ac2 --- /dev/null +++ b/c/main.c @@ -0,0 +1,87 @@ +#include "scheme48.h" + +extern void scx_init_window(); +extern void scx_init_display(); +extern void scx_init_type(); +extern void scx_init_color(); +extern void scx_init_colormap(); +extern void scx_init_pixel(); +extern void scx_init_gcontext(); +extern void scx_init_event(); +extern void scx_init_pixmap(); +extern void scx_init_graphics(); +extern void scx_init_font(); +extern void scx_init_cursor(); +extern void scx_init_text(); +extern void scx_init_property(); +extern void scx_init_wm(); +extern void scx_init_client(); +extern void scx_init_key(); +extern void scx_init_error(); +extern void scx_init_extension(); +extern void scx_init_init(); +extern void scx_init_util(); +extern void scx_init_grab(); +extern void scx_init_visual(); +extern void scx_init_region(); + +int main(int argc, char **argv) { + // char** my_argv = argv; + + s48_add_external_init(scx_init_window); + s48_add_external_init(scx_init_display); + s48_add_external_init(scx_init_type); + s48_add_external_init(scx_init_color); + s48_add_external_init(scx_init_color); + s48_add_external_init(scx_init_colormap); + s48_add_external_init(scx_init_pixel); + s48_add_external_init(scx_init_gcontext); + s48_add_external_init(scx_init_event); + s48_add_external_init(scx_init_pixmap); + s48_add_external_init(scx_init_graphics); + s48_add_external_init(scx_init_font); + s48_add_external_init(scx_init_text); + s48_add_external_init(scx_init_property); + s48_add_external_init(scx_init_cursor); + s48_add_external_init(scx_init_wm); + s48_add_external_init(scx_init_client); + s48_add_external_init(scx_init_key); + s48_add_external_init(scx_init_error); + s48_add_external_init(scx_init_extension); + s48_add_external_init(scx_init_init); + s48_add_external_init(scx_init_util); + s48_add_external_init(scx_init_grab); + s48_add_external_init(scx_init_visual); + s48_add_external_init(scx_init_region); + + /* char **argp; //JMG + char *image_name = DEFAULT_IMAGE_NAME; + long heap_size = DEFAULT_HEAP_SIZE; // in numbers of cells + long stack_size = DEFAULT_STACK_SIZE; // in numbers of cells + char *object_file = NULL; // specified via a command line argument + char *prog_name; + +#if defined(STATIC_AREAS) + extern long static_entry; + extern long static_symbol_table; + extern long static_imported_binding_table, static_exported_binding_table; + extern long p_count, *p_areas[], p_sizes[]; + extern long i_count, *i_areas[], i_sizes[]; +#endif + + long vm_argc = 0; + char *me = *argv; // Save program name. + prog_name = *argv++; + + argv=process_args(argv, + &heap_size, &stack_size, + &object_file, &image_name); + for(argc=0, argp=argv; *argp; argc++, argp++); // Recompute argc. + return internal_s48_main(heap_size, stack_size, prog_name, object_file, image_name, argc, argv); + */ + + s48_main(8000000, 64000, + "/afs/wsi/home/dfreese/i386_fbsd40/lib/scsh/scsh.image", + 0, (char**) 0); +} +