mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-18 17:50:29 +02:00
* init.c (scm_boot_guile_1): Added scm_init_objects ().
Added #include "objects.h" * Makefile.am (libguile_la_SOURCES): Added objects.c. (modinclude_HEADERS): Added objects.h.
This commit is contained in:
parent
0c32d76caf
commit
1d9ee7c788
4 changed files with 179 additions and 21 deletions
|
@ -21,9 +21,9 @@ libguile_la_SOURCES = \
|
||||||
feature.c filesys.c fports.c gc.c gdbint.c genio.c gh_data.c gh_eval.c \
|
feature.c filesys.c fports.c gc.c gdbint.c genio.c gh_data.c gh_eval.c \
|
||||||
gh_funcs.c gh_init.c gh_io.c gh_list.c gh_predicates.c gsubr.c hash.c \
|
gh_funcs.c gh_init.c gh_io.c gh_list.c gh_predicates.c gsubr.c hash.c \
|
||||||
hashtab.c init.c ioext.c kw.c list.c load.c mallocs.c markers.c \
|
hashtab.c init.c ioext.c kw.c list.c load.c mallocs.c markers.c \
|
||||||
mbstrings.c net_db.c numbers.c objprop.c options.c pairs.c ports.c \
|
mbstrings.c net_db.c numbers.c objects.c objprop.c options.c pairs.c \
|
||||||
posix.c print.c procprop.c procs.c ramap.c read.c root.c scmsigs.c \
|
ports.c posix.c print.c procprop.c procs.c ramap.c read.c root.c \
|
||||||
script.c simpos.c smob.c socket.c stackchk.c stime.c \
|
scmsigs.c script.c simpos.c smob.c socket.c stackchk.c stime.c \
|
||||||
strings.c strop.c strorder.c strports.c struct.c symbols.c tag.c \
|
strings.c strop.c strorder.c strports.c struct.c symbols.c tag.c \
|
||||||
throw.c unif.c variable.c vectors.c version.c vports.c weaks.c \
|
throw.c unif.c variable.c vectors.c version.c vports.c weaks.c \
|
||||||
fluids.c
|
fluids.c
|
||||||
|
@ -56,9 +56,9 @@ modinclude_HEADERS = __scm.h alist.h arbiters.h async.h \
|
||||||
eq.h error.h eval.h extchrs.h feature.h filesys.h fports.h gc.h \
|
eq.h error.h eval.h extchrs.h feature.h filesys.h fports.h gc.h \
|
||||||
gdb_interface.h gdbint.h genio.h gsubr.h hash.h hashtab.h init.h \
|
gdb_interface.h gdbint.h genio.h gsubr.h hash.h hashtab.h init.h \
|
||||||
ioext.h kw.h list.h load.h mallocs.h markers.h mbstrings.h net_db.h \
|
ioext.h kw.h list.h load.h mallocs.h markers.h mbstrings.h net_db.h \
|
||||||
numbers.h objprop.h options.h pairs.h ports.h posix.h regex-posix.h print.h \
|
numbers.h objects.h objprop.h options.h pairs.h ports.h posix.h \
|
||||||
procprop.h procs.h ramap.h read.h root.h scmsigs.h script.h \
|
regex-posix.h print.h procprop.h procs.h ramap.h read.h root.h scmsigs.h \
|
||||||
simpos.h smob.h socket.h srcprop.h stackchk.h stacks.h \
|
script.h simpos.h smob.h socket.h srcprop.h stackchk.h stacks.h \
|
||||||
stime.h strings.h strop.h strorder.h strports.h struct.h symbols.h \
|
stime.h strings.h strop.h strorder.h strports.h struct.h symbols.h \
|
||||||
tag.h tags.h throw.h unif.h variable.h vectors.h version.h vports.h \
|
tag.h tags.h throw.h unif.h variable.h vectors.h version.h vports.h \
|
||||||
weaks.h snarf.h threads.h coop-defs.h fluids.h
|
weaks.h snarf.h threads.h coop-defs.h fluids.h
|
||||||
|
|
|
@ -65,10 +65,8 @@ GUILE_VERSION = @GUILE_VERSION@
|
||||||
LD = @LD@
|
LD = @LD@
|
||||||
LIBLOBJS = @LIBLOBJS@
|
LIBLOBJS = @LIBLOBJS@
|
||||||
LIBTOOL = @LIBTOOL@
|
LIBTOOL = @LIBTOOL@
|
||||||
LN_S = @LN_S@
|
|
||||||
MAINT = @MAINT@
|
MAINT = @MAINT@
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
NM = @NM@
|
|
||||||
PACKAGE = @PACKAGE@
|
PACKAGE = @PACKAGE@
|
||||||
RANLIB = @RANLIB@
|
RANLIB = @RANLIB@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
|
@ -98,9 +96,9 @@ libguile_la_SOURCES = \
|
||||||
feature.c filesys.c fports.c gc.c gdbint.c genio.c gh_data.c gh_eval.c \
|
feature.c filesys.c fports.c gc.c gdbint.c genio.c gh_data.c gh_eval.c \
|
||||||
gh_funcs.c gh_init.c gh_io.c gh_list.c gh_predicates.c gsubr.c hash.c \
|
gh_funcs.c gh_init.c gh_io.c gh_list.c gh_predicates.c gsubr.c hash.c \
|
||||||
hashtab.c init.c ioext.c kw.c list.c load.c mallocs.c markers.c \
|
hashtab.c init.c ioext.c kw.c list.c load.c mallocs.c markers.c \
|
||||||
mbstrings.c net_db.c numbers.c objprop.c options.c pairs.c ports.c \
|
mbstrings.c net_db.c numbers.c objects.c objprop.c options.c pairs.c \
|
||||||
posix.c print.c procprop.c procs.c ramap.c read.c root.c scmsigs.c \
|
ports.c posix.c print.c procprop.c procs.c ramap.c read.c root.c \
|
||||||
script.c simpos.c smob.c socket.c stackchk.c stime.c \
|
scmsigs.c script.c simpos.c smob.c socket.c stackchk.c stime.c \
|
||||||
strings.c strop.c strorder.c strports.c struct.c symbols.c tag.c \
|
strings.c strop.c strorder.c strports.c struct.c symbols.c tag.c \
|
||||||
throw.c unif.c variable.c vectors.c version.c vports.c weaks.c \
|
throw.c unif.c variable.c vectors.c version.c vports.c weaks.c \
|
||||||
fluids.c
|
fluids.c
|
||||||
|
@ -129,9 +127,9 @@ modinclude_HEADERS = __scm.h alist.h arbiters.h async.h \
|
||||||
eq.h error.h eval.h extchrs.h feature.h filesys.h fports.h gc.h \
|
eq.h error.h eval.h extchrs.h feature.h filesys.h fports.h gc.h \
|
||||||
gdb_interface.h gdbint.h genio.h gsubr.h hash.h hashtab.h init.h \
|
gdb_interface.h gdbint.h genio.h gsubr.h hash.h hashtab.h init.h \
|
||||||
ioext.h kw.h list.h load.h mallocs.h markers.h mbstrings.h net_db.h \
|
ioext.h kw.h list.h load.h mallocs.h markers.h mbstrings.h net_db.h \
|
||||||
numbers.h objprop.h options.h pairs.h ports.h posix.h regex-posix.h print.h \
|
numbers.h objects.h objprop.h options.h pairs.h ports.h posix.h \
|
||||||
procprop.h procs.h ramap.h read.h root.h scmsigs.h script.h \
|
regex-posix.h print.h procprop.h procs.h ramap.h read.h root.h scmsigs.h \
|
||||||
simpos.h smob.h socket.h srcprop.h stackchk.h stacks.h \
|
script.h simpos.h smob.h socket.h srcprop.h stackchk.h stacks.h \
|
||||||
stime.h strings.h strop.h strorder.h strports.h struct.h symbols.h \
|
stime.h strings.h strop.h strorder.h strports.h struct.h symbols.h \
|
||||||
tag.h tags.h throw.h unif.h variable.h vectors.h version.h vports.h \
|
tag.h tags.h throw.h unif.h variable.h vectors.h version.h vports.h \
|
||||||
weaks.h snarf.h threads.h coop-defs.h fluids.h
|
weaks.h snarf.h threads.h coop-defs.h fluids.h
|
||||||
|
@ -180,11 +178,12 @@ eval.lo extchrs.lo feature.lo filesys.lo fports.lo gc.lo gdbint.lo \
|
||||||
genio.lo gh_data.lo gh_eval.lo gh_funcs.lo gh_init.lo gh_io.lo \
|
genio.lo gh_data.lo gh_eval.lo gh_funcs.lo gh_init.lo gh_io.lo \
|
||||||
gh_list.lo gh_predicates.lo gsubr.lo hash.lo hashtab.lo init.lo \
|
gh_list.lo gh_predicates.lo gsubr.lo hash.lo hashtab.lo init.lo \
|
||||||
ioext.lo kw.lo list.lo load.lo mallocs.lo markers.lo mbstrings.lo \
|
ioext.lo kw.lo list.lo load.lo mallocs.lo markers.lo mbstrings.lo \
|
||||||
net_db.lo numbers.lo objprop.lo options.lo pairs.lo ports.lo posix.lo \
|
net_db.lo numbers.lo objects.lo objprop.lo options.lo pairs.lo ports.lo \
|
||||||
print.lo procprop.lo procs.lo ramap.lo read.lo root.lo scmsigs.lo \
|
posix.lo print.lo procprop.lo procs.lo ramap.lo read.lo root.lo \
|
||||||
script.lo simpos.lo smob.lo socket.lo stackchk.lo stime.lo strings.lo \
|
scmsigs.lo script.lo simpos.lo smob.lo socket.lo stackchk.lo stime.lo \
|
||||||
strop.lo strorder.lo strports.lo struct.lo symbols.lo tag.lo throw.lo \
|
strings.lo strop.lo strorder.lo strports.lo struct.lo symbols.lo tag.lo \
|
||||||
unif.lo variable.lo vectors.lo version.lo vports.lo weaks.lo fluids.lo
|
throw.lo unif.lo variable.lo vectors.lo version.lo vports.lo weaks.lo \
|
||||||
|
fluids.lo
|
||||||
PROGRAMS = $(bin_PROGRAMS)
|
PROGRAMS = $(bin_PROGRAMS)
|
||||||
|
|
||||||
guile_OBJECTS = guile.o
|
guile_OBJECTS = guile.o
|
||||||
|
@ -226,8 +225,8 @@ DEP_FILES = .deps/alist.P .deps/alloca.P .deps/appinit.P \
|
||||||
.deps/gsubr.P .deps/guile.P .deps/hash.P .deps/hashtab.P \
|
.deps/gsubr.P .deps/guile.P .deps/hash.P .deps/hashtab.P \
|
||||||
.deps/inet_aton.P .deps/init.P .deps/ioext.P .deps/kw.P .deps/list.P \
|
.deps/inet_aton.P .deps/init.P .deps/ioext.P .deps/kw.P .deps/list.P \
|
||||||
.deps/load.P .deps/mallocs.P .deps/markers.P .deps/mbstrings.P \
|
.deps/load.P .deps/mallocs.P .deps/markers.P .deps/mbstrings.P \
|
||||||
.deps/net_db.P .deps/numbers.P .deps/objprop.P .deps/options.P \
|
.deps/net_db.P .deps/numbers.P .deps/objects.P .deps/objprop.P \
|
||||||
.deps/pairs.P .deps/ports.P .deps/posix.P .deps/print.P \
|
.deps/options.P .deps/pairs.P .deps/ports.P .deps/posix.P .deps/print.P \
|
||||||
.deps/procprop.P .deps/procs.P .deps/putenv.P .deps/ramap.P \
|
.deps/procprop.P .deps/procs.P .deps/putenv.P .deps/ramap.P \
|
||||||
.deps/read.P .deps/regex-posix.P .deps/root.P .deps/scmsigs.P \
|
.deps/read.P .deps/regex-posix.P .deps/root.P .deps/scmsigs.P \
|
||||||
.deps/script.P .deps/simpos.P .deps/smob.P .deps/socket.P \
|
.deps/script.P .deps/simpos.P .deps/smob.P .deps/socket.P \
|
||||||
|
|
75
libguile/objects.c
Normal file
75
libguile/objects.c
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
/* Copyright (C) 1995,1996 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||||
|
* Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* As a special exception, the Free Software Foundation gives permission
|
||||||
|
* for additional uses of the text contained in its release of GUILE.
|
||||||
|
*
|
||||||
|
* The exception is that, if you link the GUILE library with other files
|
||||||
|
* to produce an executable, this does not by itself cause the
|
||||||
|
* resulting executable to be covered by the GNU General Public License.
|
||||||
|
* Your use of that executable is in no way restricted on account of
|
||||||
|
* linking the GUILE library code into it.
|
||||||
|
*
|
||||||
|
* This exception does not however invalidate any other reasons why
|
||||||
|
* the executable file might be covered by the GNU General Public License.
|
||||||
|
*
|
||||||
|
* This exception applies only to the code released by the
|
||||||
|
* Free Software Foundation under the name GUILE. If you copy
|
||||||
|
* code from other Free Software Foundation releases into a copy of
|
||||||
|
* GUILE, as the General Public License permits, the exception does
|
||||||
|
* not apply to the code that you add in this way. To avoid misleading
|
||||||
|
* anyone as to the status of such modified files, you must delete
|
||||||
|
* this exception notice from them.
|
||||||
|
*
|
||||||
|
* If you write modifications of your own for GUILE, it is your choice
|
||||||
|
* whether to permit this exception to apply to your modifications.
|
||||||
|
* If you do not wish that, delete this exception notice. */
|
||||||
|
|
||||||
|
|
||||||
|
/* This file contains those minimal pieces of the Guile Object
|
||||||
|
* Oriented Programming System which needs to be included in
|
||||||
|
* libguile.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "_scm.h"
|
||||||
|
|
||||||
|
#include "struct.h"
|
||||||
|
|
||||||
|
#include "objects.h"
|
||||||
|
|
||||||
|
|
||||||
|
SCM scm_metaclass_standard;
|
||||||
|
SCM *scm_entity_vtable;
|
||||||
|
|
||||||
|
void
|
||||||
|
scm_init_objects ()
|
||||||
|
{
|
||||||
|
SCM ms = scm_makfrom0str (SCM_METACLASS_STANDARD_LAYOUT);
|
||||||
|
SCM ml = scm_make_struct_layout (ms);
|
||||||
|
SCM mt = scm_make_vtable_vtable (ml, SCM_INUM0,
|
||||||
|
SCM_LIST3 (SCM_BOOL_F, SCM_EOL, SCM_EOL));
|
||||||
|
|
||||||
|
SCM es = scm_makfrom0str (SCM_ENTITY_LAYOUT);
|
||||||
|
SCM el = scm_make_struct_layout (es);
|
||||||
|
SCM et = scm_make_struct (mt, SCM_INUM0,
|
||||||
|
SCM_LIST4 (el, SCM_BOOL_F, SCM_EOL, SCM_EOL));
|
||||||
|
|
||||||
|
scm_sysintern ("<standard-metaclass>", mt);
|
||||||
|
scm_metaclass_standard = mt;
|
||||||
|
scm_sysintern ("<entity-class>", et);
|
||||||
|
scm_entity_vtable = SCM_STRUCT_DATA (et);
|
||||||
|
}
|
84
libguile/objects.h
Normal file
84
libguile/objects.h
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
/* classes: h_files */
|
||||||
|
|
||||||
|
#ifndef OBJECTSH
|
||||||
|
#define OBJECTSH
|
||||||
|
|
||||||
|
/* Copyright (C) 1996 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
* any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this software; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
||||||
|
* Boston, MA 02111-1307 USA
|
||||||
|
*
|
||||||
|
* As a special exception, the Free Software Foundation gives permission
|
||||||
|
* for additional uses of the text contained in its release of GUILE.
|
||||||
|
*
|
||||||
|
* The exception is that, if you link the GUILE library with other files
|
||||||
|
* to produce an executable, this does not by itself cause the
|
||||||
|
* resulting executable to be covered by the GNU General Public License.
|
||||||
|
* Your use of that executable is in no way restricted on account of
|
||||||
|
* linking the GUILE library code into it.
|
||||||
|
*
|
||||||
|
* This exception does not however invalidate any other reasons why
|
||||||
|
* the executable file might be covered by the GNU General Public License.
|
||||||
|
*
|
||||||
|
* This exception applies only to the code released by the
|
||||||
|
* Free Software Foundation under the name GUILE. If you copy
|
||||||
|
* code from other Free Software Foundation releases into a copy of
|
||||||
|
* GUILE, as the General Public License permits, the exception does
|
||||||
|
* not apply to the code that you add in this way. To avoid misleading
|
||||||
|
* anyone as to the status of such modified files, you must delete
|
||||||
|
* this exception notice from them.
|
||||||
|
*
|
||||||
|
* If you write modifications of your own for GUILE, it is your choice
|
||||||
|
* whether to permit this exception to apply to your modifications.
|
||||||
|
* If you do not wish that, delete this exception notice. */
|
||||||
|
|
||||||
|
|
||||||
|
#include "libguile/__scm.h"
|
||||||
|
#include "libguile/struct.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define SCM_I_ENTITYP(OBJ)\
|
||||||
|
(SCM_STRUCT_VTABLE_DATA (OBJ) == scm_entity_vtable)
|
||||||
|
#define SCM_ENTITY(OBJ) ((scm_entity*) SCM_STRUCT_DATA (OBJ))
|
||||||
|
#define SCM_ENTITY_PROC_0(OBJ) (SCM_ENTITY (OBJ)->proc0)
|
||||||
|
#define SCM_ENTITY_PROC_1(OBJ) (SCM_ENTITY (OBJ)->proc1)
|
||||||
|
#define SCM_ENTITY_PROC_2(OBJ) (SCM_ENTITY (OBJ)->proc2)
|
||||||
|
#define SCM_ENTITY_PROC_3(OBJ) (SCM_ENTITY (OBJ)->proc3)
|
||||||
|
|
||||||
|
#define SCM_METACLASS_STANDARD_LAYOUT "pwpwpw"
|
||||||
|
struct scm_metaclass_standard {
|
||||||
|
SCM layout;
|
||||||
|
SCM vcell;
|
||||||
|
SCM vtable;
|
||||||
|
SCM print;
|
||||||
|
SCM direct_supers;
|
||||||
|
SCM direct_slots;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SCM_ENTITY_LAYOUT "pwpwpwpw"
|
||||||
|
typedef struct scm_entity {
|
||||||
|
SCM proc0;
|
||||||
|
SCM proc1;
|
||||||
|
SCM proc2;
|
||||||
|
SCM proc3;
|
||||||
|
} scm_entity;
|
||||||
|
|
||||||
|
extern SCM scm_metaclass_standard;
|
||||||
|
extern SCM *scm_entity_vtable;
|
||||||
|
|
||||||
|
extern void scm_init_objects SCM_P ((void));
|
||||||
|
|
||||||
|
#endif /* OBJECTSH */
|
Loading…
Add table
Add a link
Reference in a new issue