From tapiopa@aol.com Tue Feb 14 20:16:22 1995
Path: princeton!gw1.att.com!fnnews.fnal.gov!mp.cs.niu.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!usc!bloom-beacon.mit.edu!uhog.mit.edu!news.mathworks.com!uunet!newstf01.news.aol.com!newsbf02.news.aol.com!not-for-mail
From: tapiopa@aol.com (Tapiopa)
Newsgroups: comp.lang.scheme
Subject: Re: VSCM crashes during .scheme-boot dump on PowerMac
Date: 12 Feb 1995 17:49:19 -0500
Organization: America Online, Inc. (1-800-827-6364)
Lines: 240
Sender: root@newsbf02.news.aol.com
Message-ID: <3hm39f$lfh@newsbf02.news.aol.com>
Reply-To: tapiopa@aol.com (Tapiopa)
NNTP-Posting-Host: newsbf02.mail.aol.com

Instructions for compiling vscmV1r1 under CW5 (by Bake Timmons, 2/12/95).

(Disclaimer: Only tested on a PowerMac 6100, sys 7.5, generating PPC
code.)
(Some of these instructions are stolen from Ken Dickey's THINKC.inst file
in the vscmV1r1 distribution.  Thanks, Ken. :))

[1] Create a new file, "align.h" with the following text:
------------------------------------vv
/* align.h  */

# ifndef ALIGN_H_
# define ALIGN_H_

typedef long MEM_align_t;

#endif

/*  --- EOF "align.h" ---   */
------------------------------------^^


[2] Edit file "main.c" to add CW5's fake argc/argv processing so that
"stdio" can be used.

>[2.a] Add to the beginning the define:
----------vv
# define _CW5 
----------^^

>[2.b] Just before Main() and the line
----------vv
extern int main (int argc, char **argv);
----------^^
add the lines:
----------vv
#ifdef _CW5    /*@@ added for console i/o -- CW5 emulation @@*/
#include <sioux.h>
#include <console.h>
#endif
----------^^

>[2.c] In function Main(), just after the declarations (char **volatile
vargv;), add:
----------vv
#ifdef _CW5
  argc = ccommand( &argv ) ; /*@@ CW5 fake argc/v processing @@*/
#endif
----------^^


[3] The next bit of editing is a bit tedious (probably due to my
inexperience), but it works.  There are files (all those that begin with a
capital letter) that CW5 stumbles on because of some redeclaration
"errors".  These errors are all similiar, and for each such file you'll
need to preprocess it, find the line(s) containing the error, rename the
declaration so that it behaves, paste that pre-processed line back into
the
source file where the error occurred, comment out the code that
pre-processed "incorrectly", and then save the source file (whew!). 
Here's
a complete (_long_) example:

*******Begin***********
>Error   : identifier 'MEM_Boolean_vector' redeclared
>Boolean.c line 73 ...<part of a huge, single line>

Now preprocess Boolean.c and in the preprocessed file #Boolean.c notice
the
following outrageously long line (there's only one such line in each of
these "problem" files).

static MEM_description *MEM_Boolean_vector ...

If you now click at the start of this line and do a find on
"MEM_Boolean_vector", you'll get six occurences on this line, the last
being the redeclaration.  So what you want to do is rename the first five
to "MEM_Boolean_vector0".  Note that the CW editor has a scrolling limit,
so you'll have to use (option) right-arrow or highlighting to see more of
the line.  After you've made the five replacements, just copy that line,
and comment out the following lines in Boolean.c:

MEM_VECTOR (Boolean,
     0, MEM_NULL_measure,
     MEM_NULL_iterator, dumper, excavator, MEM_NULL_revisor,
     MEM_NULL_task, MEM_NULL_task, MEM_NULL_task,
     EXT (SCM_NO_NUMBER,
   cannot_cvt_real, display, display, NULL_eq, NULL_eq));

Now paste in the copied line and save the new Boolean.c.  Rinse and repeat
;)

*******End***********

[4] Fortunately, the hard work is over.  Next, make sure that you've got
the
vbis.sort file that is made.  If, like me, you don't have access to Unix,
here it is, for vscmV1r1:

------------------------------------vv
 INSTR (I_ALLOCV, 2, "allocate-vector")
 INSTR (I_APPEND, 1, "append")
 INSTR (I_ASSIGN, 1, "assign")
 INSTR (I_CALL, 2, "call")
 INSTR (I_CALLE, 2, "call-exit")
 INSTR (I_CAR, 1, "car")
 INSTR (I_CDR, 1, "cdr")
 INSTR (I_CHECK, 1, "check")
 INSTR (I_CONS, 1, "cons")
 INSTR (I_DELAY, 2, "delay")
 INSTR (I_DEREF, 1, "deref")
 INSTR (I_EJMP_P, 3, "eqv?jump+pop")
 INSTR (I_EXIT, 1, "exit")
 INSTR (I_FETCH, 3, "fetch")
 INSTR (I_FETCHM, 2, "fetch-module")
 INSTR (I_FJMP, 2, "false?jump")
 INSTR (I_FJMP_P, 2, "false?jump+pop")
 INSTR (I_FJMP_EP, 2, "false?jump:pop")
 INSTR (I_GET_G, 2, "get-glob")
 INSTR (I_GET_I, 2, "get-integrable")
 INSTR (I_GET_L, 2, "get-loc")
 INSTR (I_GET_LC, 2, "get-loc-cell")
 INSTR (I_GET_LV, 2, "get-loc-void")
 INSTR (I_GET_V, 3, "get-vec")
 INSTR (I_GET_VC, 3, "get-vec-cell")
 INSTR (I_GET_VV, 3, "get-vec-void")
 INSTR (I_JMP_BW, 2, "jump-backward")
 INSTR (I_JMP_FW, 2, "jump-forward")
 INSTR (I_LAMBDA, 2, "lambda")
 INSTR (I_LTV, 1, "list->vector")
 INSTR (I_MC, 2, "make-cell")
 INSTR (I_MCL, 3, "make-closure")
 INSTR (I_MV, 2, "make-vector")
 INSTR (I_MJMP_P, 3, "memv?jump+pop")
 INSTR (I_MODULE, 2, "module")
 INSTR (I_MPOP, 2, "multi-pop")
 INSTR (I_NEJMP_EP, 3, "neqv?jump:pop")
 INSTR (I_NMJMP_EP, 3, "nmemv?jump:pop")
 INSTR (I_NOT, 1, "not")
 OINSTR (I_O_DELAY, 2, "o-delay")
 OINSTR (I_O_FILL_FRAME, 3, "o-fill-frame")
 OINSTR (I_O_FRAME, 3, "o-frame")
 OINSTR (I_O_GET_E, 3, "o-get-env")
 OINSTR (I_O_GET_L, 2, "o-get-loc")
 OINSTR (I_O_LAMBDA, 2, "o-lambda")
 OINSTR (I_O_NMJMP_EP, 3, "o-nmemv?jump:pop")
 OINSTR (I_O_POP_FRAME, 1, "o-pop-frame")
 OINSTR (I_O_PUT_E, 3, "o-put-env")
 OINSTR (I_O_PUT_E_P, 3, "o-put-env-pop")
 OINSTR (I_O_PUT_L, 2, "o-put-loc")
 OINSTR (I_O_PUT_L_P, 2, "o-put-loc-pop")
 INSTR (I_POP, 1, "pop")
 INSTR (I_P_FJMP, 2, "pop-false?jump")
 INSTR (I_P_TJMP, 2, "pop-true?jump")
 INSTR (I_PUT_G, 2, "put-glob")
 INSTR (I_PUT_G_P, 2, "put-glob-pop")
 INSTR (I_PUT_L, 2, "put-loc")
 INSTR (I_PUT_LC, 2, "put-loc-cell")
 INSTR (I_PUT_LC_P, 2, "put-loc-cell-pop")
 INSTR (I_PUT_L_P, 2, "put-loc-pop")
 INSTR (I_PUT_V, 3, "put-vec")
 INSTR (I_PUT_VC, 3, "put-vec-cell")
 INSTR (I_PUT_VC_P, 3, "put-vec-cell-pop")
 INSTR (I_PUT_V_P, 3, "put-vec-pop")
 INSTR (I_REF, 1, "ref")
 INSTR (I_REGM, 2, "register-module")
 INSTR (I_TAKE, 2, "take")
 INSTR (I_TK_F, 1, "take-false")
 INSTR (I_TK_N, 1, "take-nil")
 INSTR (I_TK_T, 1, "take-true")
 INSTR (I_TJMP, 2, "true?jump")
 INSTR (I_TJMP_P, 2, "true?jump+pop")
 INSTR (I_TJMP_EP, 2, "true?jump:pop")
 INSTR (I_UCALL, 2, "unchecked-call")
 INSTR (I_UCALLE, 2, "unchecked-call-exit")
 XINSTR (I_UGET_G, 2, "unchecked-get-glob")
 INSTR (I_VALIDATE, 1, "validate")
 INSTR (I_VECTOR, 2, "vector")
 INSTR (I_VOID, 2, "void")
 INSTR (I_VREF, 2, "vec-ref")
 INSTR (I_VSET, 2, "vec-set")
------------------------------------^^

[5] Start a new vscm.u project.  Add all the sources.  Remove mkalign.c &
strerr.c. Add also the library files: ANSI C.PPC.Lib, InterfaceLib,
MathLib, MWCRuntimeLib, and SIOUX.PPC.Lib.  (Of course, choose the
analogous things for the 68K build.)  The segmentation doesn't matter
much.

[6] Set the following preferences in your project, using the
Edit->Preferences dialog box: (1) In the "Language" section, make sure all
the option boxes are unchecked and that you've got MacHeadersPPC as the
prefix file.  (2) In the "Project" section, type in a creator of VSCM, a
preferred 5000K, a minimum 1500K, and a stack size of 192K (these items
are
merely suggestions).

[7] Make the project.

[8] Compile "vscmc.scm" to "vscmc.asm"; Create a file, ".scheme-boot.asm"
by concatenating "vscmc.asm" "version.asm" and "repl-ml.asm".

[9] Launch VSCM with flags "-b - -a ".scheme-boot.asm" and when the image
comes up, type
        (dump ".scheme-boot")
        
The snag I've run into: while I'm able to load the .scheme-boot.asm
alright,
trying to dump the .scheme-boot image ends up in a crash (the file never
gets written either). The only way to debug this with CW debugger is to
"step-over" lines to get to the running vscm app, then give the following
command-line options to vscm:

-b - -a ".scheme-boot.asm" -d ".scheme-boot"

Now, keep stepping over until you get to the following line in main.c:

MEM_dump_storage (fp, dump_prefix);

>From now on, you'll need to "step-into" the functions in order to figure
out
as much as you can before you crash.  Eventually, you'll bump into the
following line storage.c:

for (pos = 0; location_table [i][pos].location != obj; pos++);

This is really strange stuff at this point, with pos assuming a wierd
value.
 If you try to move beyond this point, you crash (but if you've faithfully
stepped-into, you can escape to shell using MacsBug).  TIA to all who
tackle this.  Maybe someone will figure it out.

[10] enjoy yourself!

Please direct any comments, questions, flames, etc. to

timmbake@mcl.mcl.ucsb.edu. 
Thanks,
Bake


