[comp.lang.scheme] MIT C Scheme design info

jameson@calgary.UUCP (Kevin Jameson) (03/29/88)

The following is a list of most C files used in the MIT C Scheme 
interpreter, along with a brief statement of function.  Most of the
information is gleaned from the short comment at the beginning of each
file.  This list gives a flavor of how the interpreter is organized,
and should help new readers of the code to find their way around.

Note that much (half?) of C Scheme is written in Scheme, and is not
listed here.  The microcode interpreter files below actually 
interpret many runtime functions which are written in Scheme (such
as the main read-eval-print loop).  The Scheme runtime files + the
host interpreter below offer a complete system to the user.

Of course some of the information below may be wrong, though to
the best of my knowledge it is correct.  Any mistakes are my own.

- Kevin Jameson, 28 March 88 
  ..!{ihnp4,ubc-vision}!alberta!calgary!jameson


FILE           Brief Function
=============  ==================================================
scheme.h       defs for the interpreter in interpre.c
config.h       configuration file describes stk size,heap size, etc
const.h        global named constants
fixobj.h       format (offsets) of fixed object vector
extern.h       extern machine and many other interface dcls
scode.h        describes byte code format
sdata.h        describes user data object formats
types.h        list of object type codes TC_xxx
returns.h      list of return codes used by interpreter RC_xxxx
errors.h       list of error codes
prims.h        list of ids and names (PC_xxx) for all system primitives
object.h       defs & access macros for scheme objects
primitive.h    macros for defining and handling primitives
boot.c         main boot program for scheme interpreter
interpre.h     macros for interpreter
zones.h        time zones for performance metering
hooks.c        hooks into the interp - apply,catch,throw, etc
storage.c      prim, arg count tbls, global storage allocs
interpre.c     byte code interp coded in continuation passing style
utils.c        utils used by interpreter (backout_of_primitive,etc)
lookup.c       symbol lookup and manipulation
usrdef.c       table of external primitives produced by findprim
extern.c       external primitives defined by user
findprim.c     builds table of external prims from users files
nihil.c        defines unimplemented primitives reqd by scheme
default.h      unimplemented default hooks not def'd by user in config.h
cross.doc      some doc on the cross syntaxer (byte code compiler)
readme.unx     tells where things are in unix version

MATH CODE

generic.c      mostly generic math funs for various numeric types
missing.c      math utils which wouldn't fit anywhere else
mul.c          portable fixnum multiplication
flonum.c       floating pt funs, mostly superceded by generic.c
flonum.h       defs for flonum.c
fixnum.c       fixnum (24 bit) funs, mostly superceded by generic.c
bignum.c       bignum arithmetic functions
bignum.h       bignum arithmetic declarations
bitops.c       extended bitops for infinite precision arithmetic
bitstr.c       bitstring functions

DEBUGGING CODE

step.c         support for the debugger stepper
xdebug.c       useful prims for scheme memory prim debugging
bkpt.c         debugger breakpoint functions
bkpt.h         debugger breakpoint definitions, macros
debug.c        printing and listing functions used by debugger

GARBAGE COLLECTOR

purify.c       much like gc, only purifies (whatever that is) instead
daemon.c       two gc daemons (obj hash tbl & file closer)
gc.h           macros for all gc code (and maybe others)
gccode.h       macros for code which does gc-like loops
gcloop.c       low level gc stuff
gctype.c       maps type codes into gc object type codes

PRIMITIVE FUNCTIONS

fetchpar.c     makes implementation parms available to scheme
file.c         file i/o primitive scheme functions
hunk.c         funs to handle triplet hunk3's for file blocks
io.c           scheme io primitives, channel grabbing, etc
list.c         list manipulation functions (memq, cons, car, etc)
prim.c         primitives which won't fit elsewhere
string.c       string primitives, cv strings to/from lists
vector.c       vector handling and conversion (to lists) code

FASTLOADER (FASL) FUNCTIONS

translate.h    macros for psbtobin, bintopsb (psb=portable scheme binary)
schloader.c    standalone prog to load a dumped scheme core?
load.c         common code for reading fasl files
bintopsb.c     converts fasl files to portable ascii
breakup.c      used for fasl conversion?
ppband.c       pretty prints fasl files in human format
psbtobin.c     converts portable ascii files to fasl format
dump.c         common code for dumping fasl files
dumpworld.c    core save routine, calls gnu unexec
fasdump.c      holds fasdump, fasload, and bandload functions
fasl.h         defs for fasl file format
fasload.c      reads fasl files, relocates and interns symbols

SCHEME CODE (not related to the Scheme runtime stuff)

chapter1.code  from Structure and Interpretation of Computer Programs
chapter2.code  from SICP (Abelson & Sussman)
chapter3.code  from SICP
chapter4.code  from SICP
chapter5.code  from SICP

MISCELLANEOUS

ChangeLog      only two entries
install        main installation notes
Install.unx    unix installation notes
Install.vms    vms  installation notes
Makefile       main makefile
Makefile.200   for the 200 series of some machine
Makefile.500   for the 500 series of some machine
Makefile.ind   for some other operating system
Makefile.unk   for an unknown operating system
Makefile.vax   for vax
Readme.vms     tells where things are in vms version
TO_DO          a wish list
UPGRADE        diffs between CScheme release 3 and 4
Wsize.c        tests out compiler/machine for bit & math ops
athena.c       athena graphics primitives for special terminals
bobcat.c       bobcat graphics interface for starbase package
config.dst     same as config.h
locks.h        for locking heap, etc
os.c           selects appropriate operating system file for build
process.c      utils to fork inferior processes in unix
regblock.c     defines registers used by compiler
unexec.c       from gnu-emacs. dumps core on unix systems
unix.c         unix specific prims (completed version of unknown.c)
unknown.c      os specific blank prim stubs for unknown op system
valret.c       emulates ITS valret on a unix system
vms.c          vms specific prims (completed version of unknown.c)
vmsall.com     vms batch file for compilation
               <several other vms batch files have been omitted>

SPECIAL CODE (to handle Scheme language features)

future.c       support code for futures
futures.h      macros for futures code
history.h      defines history data structures
intercom.c     single process simulation of futures stuff

jameson@calgary.UUCP (Kevin Jameson) (04/02/88)

The following is a list (part 2 of 2) of most Scheme files used in the 
MIT C Scheme interpreter circa verson 4.1, along with a brief statement 
of their function.  Most of the information has been gleaned
gleaned from the short comment at the beginning of each
file.  This list gives a flavor of how the interpreter is organized,
and should help new readers of the code to find their way around.

Note that much (half?) of C Scheme is written in C, and is not
listed here.  The list of C files (part 1 of 2) for the microcode 
interpreter was posted earlier.

I know now that the earlier posting of C files contained minor errors,
and at the very least is somewhat out of date (my version is 4.1, 
vs. the current version of 6.2.0).  (No doubt the same two facts will
hold for this file too, but it's a start...)   Any mistakes are my own.

- Kevin Jameson, 31 March 88 
  ..!{ihnp4,ubc-vision}!alberta!calgary!jameson


FILE           Brief Function
=============  ==================================================

SCHEME SYSTEM TYPES

xbuild.scm      build a cross syntaxer system
abuild.scm      build a system for athena
ubuild.scm      build a unix interface scheme system
sbuildmd.scm    build a student (MIT 6.001 course) scheme system
studentmd.scm   env,syntax,& read tbl mods for 6.001 students
featmd.scm      std features scheme system 


INTERPRETER

error.scm       rep (read-eval-print) interface,error defs,definers,handlers
parse.scm       scheme parser for The REP Reader (ch class tbls,macros,atoms)
print.scm       The REP (read-eval-print) Printer
read.scm        The REP Reader (tyi/eof/input streams,with-input-from-file)
rep.scm         the read-eval-print loop,history,and history access funs
repuse.scm      REP user interface (prompts, drivers, proceeds)


CROSS SYNTAXER  (the byte code (scode) compiler)

syntax.scm      the Cross Syntaxer (byte code (scode) generator/compiler)
scan.scm        definition scanner reduces n of "real auxilary" vars in env
xconv.scm       convert declarations into integrations
xpatch.scm      special lambda interface
xsubst.scm      integration of primitives (merger, dispatcher)
unsyn.scm       unsyntaxer converts scode back to sexprs


MISC DEFINITIONS and Data Type Stuff

adapt.scm       compatability defs (true/#!true,nil/'(),list*/cons*)
crock.scm       defs of special obj types (state & syntax tables, type obj)
stypes.scm      scode type setup (TC's: symbols,conditions,proctypes,etc)
scode.scm       scode grab bag (consts,many predicates for data types)
sdata.scm       abstract data field funs(ctl pts,set!s,refs,pairs,vects,etc)
types.scm       abstract typing funs (supremum/infimums?,lattice theory stuff)
ustruc.scm      microstruc? (follows scode abstraction in boot sequence)
utabmd.scm      ucode type tables (fixed,types,returns,prims,externs,errors)
utabs.scm       ucode tbl intrfc (fixed obj vec,type detection,TC,RC,TERMC..)


PRIMITIVES

bitvec.scm      1 bit vector ops (cons,set,size,ref,1b? predicates)
char.scm        character defs, bit tables, charscan table generator funs
equals.scm      many equality funs (eqv?,equal?,etc)
explode.scm     maclisp style printname utils (explode,implode,readch,ascii)
format.scm      output string formatters, format dispatch table
gensym.scm      uninterned symbol generator
gprims.scm      global primitives list (defs funs in global env for compiler)
hash.scm        object hashing, unhashing, population functions
io.scm          primitive io utils (channel stuff, files vector/locks,hunk3s)
list.scm        lisp ops (cons,pair?,length,cxr,mappers,assocs,members,etc)
load.scm        program loading
lambda.scm      lambda abstraction (lambda,lexpr,extended-lambda)
narith.scm      scheme math funs (+,-,trigs,floats,polys,min/max,etc)
oldio.scm       old io procedure names (channel io stuff)
pathnm.scm      pathname utils (make,drive,directroy,type,conversion funs)
primlist.scm    primitive list ops (cons,memq,assoc,cxr,etc)
scomb.scm       scode combinator abstractions
stream.scm      stream utilities (append,filter,accumulate,merge,etc)
string.scm      character string ops
strmac.scm      stream macros
uio.scm         useful file io funs (read,copy,rn,dl,exists?)
unpars.scm      unparsers for converting objects to string representations
vector.scm      vector ops (make,copy,vector references..)
xlist.scm       extended list ops (mapcan,mapcan*,or,and)


PACKAGES

advice.scm      tools to advise funs (trace,break,other advice wrappers)
pp.scm          scheme pretty printer
rrrs.scm        revised report on Scheme compatability defs,macro definers
wind.scm        state space world model (state pts,dynamic wind,protectors..)


DEBUGGER

comand.scm      debugger command loop support
debug.scm       scm level debugger w/ display,history,motion,continuation cmds
stackp.scm      scheme control stack parser for debugger
where.scm       the environment inspector(show,show-frame,print bindings...)
xdebug.scm      debugging primitives


SYSTEM 

boot.scm        bootload utils, run after coldmd. defs of global primitve funs
datime.scm      date time utils
events.scm      event distribution system
file.scm        file package (catalog,floppy,volumn,directory,misc funs)
gc.scm          scheme garbage collector, gc-daemon list, suspension funs
gcstat.scm      garbage collector meters, history modes, etc
history.scm     history manipulation (backbone & ribs, push/pop history, etc)
intrpt.scm      interrupt system (timers,keyboard ints,default handlers)
link.scm        links compiled byte code ?
photo.scm       ? takes an internal photo or something (whatever that is)
sysclk.scm      system clock utils (set,read,interval calculations)
system.scm      system funs (world dumpers,disk savers)
world.scm       world ops (save, disk restore, quit, exit..)


MACHINE DEPENDENT (md)

implmd.scm      defs for implementation dependencies (mostly whtspc ch codes)
spmd.scm        control stack/control point funs
xusermd.scm     cross syntaxer user interface (pathname and string funs)
coldmd.scm      first scm code runs early, builds obarray, fixed obj vector
runmd.scm       loads compiled code for runtime system


MISCELLANEOUS

bgraph.scm      bobcat (starbase) graphics interface
emacs.scm       emacs interface to scheme system
future.scm      part of butterfly basic band load (atom macros)
graphics.scm    graphics system interface (draw-line,line styles, etc)
process.scm     interface to unix primitives (signal,spawn,wait,pause,etc)
qsort.scm       a scheme quicksort
sample.scm      shows how microcode C funs are linked into scheme
unix.scm        unix scheme interface (cwd,mkdir,kill-eol,getenv,etc)


6.001 Course

login.scm       student login/logout utils
logout.scm      student logout utils (resets 6.001 student environment)
namelist.scm    machine names for 6.001 lab


EXAMPLES

chapter1.cod        Scheme code from text by Abelson & Sussman,
chapter2.cod        Structure and Interpretation of Computer Programs
chapter3.cod        
chapter5.cod
chapter4.cod


PROBLEM SETS    (mostly related to SICP)

adventure.scm   a game
compiler.scm    simple scheme compiler (see Struc & Interp of Comp Progms)
eceval.scm      explicit control evaluator (see SICP)
ecevsyn.scm     expr & env defs used by explicit ctl eval (see SICP)
regsim.scm      register machine simulator (see SICP)
ps4.scm         huffman encoding funs
ps5.scm         basic generic math funs (ints,polys,rationals, see SICP)
ps6.scm         imaginary world defs (deans,trolls,etc)
ps7.scm         stream utils
ps8eval.scm     evaluator funs for explicit ctl evaluator (see SICP)
ps8mods.scm     environment, binding utils (see SICP)
ps8putget.scm   put/get procs (see SICP)
ps9data.scm     database for query language interpreter (see SICP)
ps9query.scm    query language interpreter (see SICP)
ps10load.scm    program loader