[comp.sys.amiga] Compiling VT100 2.4 under Lattice

dillon@CORY.BERKELEY.EDU (Matt Dillon) (12/25/86)

>Has anyone had any success in compiling VT100 2.4 (not 2.3) under
>Lattice?  I keep getting software errors while COMPILING init.c and
>window.c, and the system crashes while COMPILING vt100.c (note:  I
>haven't even built an executable, so these are NOT run time errors).
>
>The problem always occurs while in LC1, but LC1 is moot about any
>problems, it just dies.  I'm using LC to call LC1, but nothing else.

	(Assuming a 512K Amiga)

*	Make sure you have at least an 8K stack... (my stack was 8K when
	I compiled the VT100 under Lattice). 

*	Make sure you REMOVE the '#define MANX' in VT100.H, and *keep* the
	'#define LATTICE' (e.g. pick one or the other).

*	And, for the larger modules, you cannot use the RAM: drive to
hold the temporary (.Q) file...you run out of memory either causing the
compiler to crash or to give up.  Hopefully you have two drives and can 
specify your compiler disk as the temporary drive (it must have at least
100K free).  If you specify the same disk as your source is on as the
temporary drive, the compile will work... but take forever.

>-Michael
>
>P.S.  Thanks.  Any hints would help
>
>P.P.S.  Has anyone been able to download Egad! (the binaries)?  Amiga
>Kermit loses 4 bytes (72324 instead of 72328), and thus the executable
>jwon't work.  Yes, I'm using kermit -ix on the UNIX side, and set file
>type binary on the Amiga side.  I've tried three times, and it still
>doesn't work.

	Try using the XMODEM protocol and/or a different terminal program.

				-Matt

stever@videovax.Tek.COM (Steven E. Rice, P.E.) (01/03/87)

In article <23418@rochester.ARPA> Michael McInerny (mcinerny@rochester.ARPA)
asked:

>>> Has anyone had any success in compiling VT100 2.4 (not 2.3) under
>>> Lattice?  I keep getting software errors while COMPILING init.c and
>>> window.c, and the system crashes while COMPILING vt100.c (note:  I
>>> haven't even built an executable, so these are NOT run time errors).
>>>
>>> The problem always occurs while in LC1, but LC1 is moot about any
>>> problems, it just dies.  I'm using LC to call LC1, but nothing else.

Matt Dillon (dillon@CORY.BERKELEY.EDU) responded to Michael's query in
article <8612250211.AA02559@cory.Berkeley.EDU>:

>> (Assuming a 512K Amiga)
>>
>> * Make sure you have at least an 8K stack... (my stack was 8K when
>>   I compiled the VT100 under Lattice).
>>
>> * Make sure you REMOVE the '#define MANX' in VT100.H, and *keep* the
>>   '#define LATTICE' (e.g. pick one or the other).
>>
>> * And, for the larger modules, you cannot use the RAM: drive to hold
>>   the temporary (.Q) file...you run out of memory either causing the
>>   compiler to crash or to give up.  Hopefully you have two drives and
>>   can specify your compiler disk as the temporary drive (it must have
>>   at least 100K free).  If you specify the same disk as your source
>>   is on as the temporary drive, the compile will work... but take
>>   forever.

Steven D. Litvintchouk (sdl@linus.UUCP), in article <249@linus.UUCP>,
suggested double the stack that Matt proposed:

> Did you remember to set your stack size higher before compiling?  
> (This is necessary with such large files as init.c.)  I first typed
> 	STACK 16000
> at the CLI, before compiling anything.  

I don't know what compiler version each person is using, but the C-CLI
disk of my compiler (Amiga C v1.1 = Lattice C v3.03) comes up with a
15000 byte stack.  This was sufficient to compile vt100 version 2.4 on
my system, with room to spare.

Rather than removing the MANX definition, change the values assigned in
the definition statements to:

        #define    LATTICE     1
        #define    MANX        0

Apparently Matt has something else running at the same time as his
compiler (perhaps his shell, plus a make program and cc?), as I have had
no problem compiling with the source file in RAM:, as well as directing
the *.q files to RAM: (one at a time, mind you!!).

In fact, on one compilation, I (erroneously) directed the *.o files to
RAM: as well.  All modules compiled successfully, even though at the end
of all compilations there was 60K+ of *.o files in RAM: (this may be order
dependent)!

My system is 512K, two drives, v1.1 Kickstart and Workbench, with nothing
else running while I compile.  I tried to get the _make_ and _cc_ from
the early Fish Disks running, but couldn't (my lack of understanding, I'm
sure!), so I wrote a script to compile and link vt100.  I have included
this, along with some diffs for three files.  The files contained in the
shar are:

  1. expand.c.diff

     Someone (aaauuugh!! I've lost my reference file!) posted an article
     a while back about vt100 failing with Lattice v3.1 because the
     libraries contain functions _dopen_ and _dclose_, which have the
     same names as some of Dave's directory manipulation functions.
     The writer suggested changing the names of the functions "dopen",
     "dnext", and "dclose" in _expand.c_ to "diropen", "dirnext", and
     "dirclose", respectively.  These diffs accomplish the change.

  2. kermit.c.diff

     A compiled-in option is available to convert filenames to lower-case
     when transferring files to the Amiga.  Since I am generally in
     contact with a 4.2 BSD system, this is not only unnecessary, but
     undesirable!  Do not install this patch if you spend most of your
     time talking to MS-DOS systems and their ilk. . .

  3. vt100.h.diff

     These diffs define the Lattice compiler and specify image mode
     transfer for kermit.  If you are using Lattice, it is easy to
     switch the 1 and 0 with a text editor, but it is included because
     the original question was about use of the Lattice compiler.

     Since I am in contact primarily with a 4.2 BSD system, image mode
     is in my best interest.  Be sure you know the characteristics of
     your favorite host before changing the transfer mode!

  4. vt100makescript

     This is a very simple script file that will compile vt100 using
     the Lattice compiler.  It is intended for a two-disk system,
     although it could be used on a one-disk system (with LOTS of
     disk swaps!).  Each source file is copied to RAM: before
     compilation, and the quad (*.q) files are assigned to RAM:.

     The source is assumed to be in a directory named "source" (catchy,
     eh?) on the C-DEVEL disk.  _vt100makescript_ is assumed to be in
     this directory also, and is executed from within it.  The object
     (*.o) files are written into the same directory.  When all files
     have been successfully compiled, the linker is invoked, leaving
     the executable file "vt100" in the "source" directory, as well.

     LC1 and LC2 are called directly (LC is not used).  Alink is called
     to link the resulting object files.  Compilation and linking require
     about 35 minutes.  The disks get some exercise, but nothing like it
     was the first time, when everything was specified to be on the
     floppies!

     Here is a list of the results from a recent compilation:

        expand.c                    8447 rwed 17-Dec-86 23:35:31
        expand.o                    3852 rwed Today     20:07:13
        init.c                     21517 rwed 17-Dec-86 23:36:01
        init.o                     12960 rwed Today     20:12:48
        kermit.c                   24107 rwed 17-Dec-86 23:35:40
        kermit.o                   13796 rwed Today     20:19:08
        remote.c                   10022 rwed 17-Dec-86 23:35:19
        remote.o                    6860 rwed Today     20:23:06
        script.c                   11781 rwed 17-Dec-86 23:34:59
        script.o                    6564 rwed Today     20:26:41
        vt100                      76532 rwed Today     20:41:14
        vt100.c                    10134 rwed 17-Dec-86 23:35:14
        vt100.h                    10479 rwed 17-Dec-86 23:35:25
        vt100.o                     8596 rwed Today     20:30:16
        vt100makescript             3370 rwed Today     20:02:23
        window.c                    9466 rwed 17-Dec-86 23:35:08
        window.o                    5816 rwed Today     20:33:51
        xmodem.c                    9344 rwed 17-Dec-86 23:36:07
        xmodem.o                    4868 rwed Today     20:37:23
        19 files - 560 blocks used


I hope this information will help Michael, and any others that have been
having problems.

					Steve Rice

----------------------------------------------------------------------------
{decvax | hplabs | ihnp4 | uw-beaver}!tektronix!videovax!stever


# ---------------- Remove this line and everything above it -----------------
#!/bin/sh
# This is a shell archive, meaning:
# 1.  Remove everything above the #!/bin/sh line.
# 2.  Save the resulting text in a file
# 3.  Execute the file with /bin/sh (not csh) to create the following files:
#
#                expand.c.diff
#                kermit.c.diff
#                vt100.h.diff
#                vt100makescript
#
# Archive creation date: Fri Jan  2 23:00:39 PST 1987
# Archive created by: Steven E. Rice, P.E. (Tektronix Television Systems)
#
echo " "
echo Files to extract:
echo " "
echo '  expand.c.diff'
echo '  kermit.c.diff'
echo '  vt100.h.diff'
echo '  vt100makescript'
echo " "
#
if test -f expand.c.diff
then
  echo " "
  echo shar: will not over-write existing file expand.c.diff
  echo " "
else
  echo extracting expand.c.diff '(3985 characters)'
  sed 's/^X//' > expand.c.diff << 'SHAR_EOF'
X*** expand.c.orig	Fri Jan  2 09:52:10 1987
X--- expand.c	Fri Jan  2 08:15:31 1987
X***************
X*** 27,33
X   * Disk directory routines
X   *
X   *
X!  * dopen() returns a struct DPTR, or NULL if the given file does not
X   * exist.  stat will be set to 1 if the file is a directory.  If the
X   * name is "", then the current directory is openned.
X   *
X
X--- 27,33 -----
X   * Disk directory routines
X   *
X   *
X!  * diropen() returns a struct DPTR, or NULL if the given file does not
X   * exist.  stat will be set to 1 if the file is a directory.  If the
X   * name is "", then the current directory is openned.
X   *
X***************
X*** 31,37
X   * exist.  stat will be set to 1 if the file is a directory.  If the
X   * name is "", then the current directory is openned.
X   *
X!  * dnext() returns 1 until there are no more entries.  The **name and
X   * *stat are set.  *stat = 1 if the file is a directory.
X   *
X   * dclose() closes a directory channel.
X
X--- 31,37 -----
X   * exist.  stat will be set to 1 if the file is a directory.  If the
X   * name is "", then the current directory is openned.
X   *
X!  * dirnext() returns 1 until there are no more entries.  The **name and
X   * *stat are set.  *stat = 1 if the file is a directory.
X   *
X   * dirclose() closes a directory channel.
X***************
X*** 34,40
X   * dnext() returns 1 until there are no more entries.  The **name and
X   * *stat are set.  *stat = 1 if the file is a directory.
X   *
X!  * dclose() closes a directory channel.
X   *
X   */
X  
X
X--- 34,40 -----
X   * dirnext() returns 1 until there are no more entries.  The **name and
X   * *stat are set.  *stat = 1 if the file is a directory.
X   *
X!  * dirclose() closes a directory channel.
X   *
X   */
X  
X***************
X*** 39,45
X   */
X  
X  struct DPTR *
X! dopen(name, stat)
X  char *name;
X  int *stat;
X  {
X
X--- 39,45 -----
X   */
X  
X  struct DPTR *
X! diropen(name, stat)
X  char *name;
X  int *stat;
X  {
X***************
X*** 69,75
X     dp->fib = (struct FileInfoBlock *)
X           AllocMem((long)sizeof(struct FileInfoBlock), MEMF_PUBLIC);
X     if (!Examine (dp->lock, dp->fib)) {
X!       dclose (dp);
X        return (NULL);
X     }
X     if (dp->fib->fib_DirEntryType >= 0)
X
X--- 69,75 -----
X     dp->fib = (struct FileInfoBlock *)
X           AllocMem((long)sizeof(struct FileInfoBlock), MEMF_PUBLIC);
X     if (!Examine (dp->lock, dp->fib)) {
X!       dirclose (dp);
X        return (NULL);
X     }
X     if (dp->fib->fib_DirEntryType >= 0)
X***************
X*** 77,83
X     return (dp);
X  }
X  
X! dnext(dp, pname, stat)
X  struct DPTR *dp;
X  char **pname;
X  int *stat;
X
X--- 77,83 -----
X     return (dp);
X  }
X  
X! dirnext(dp, pname, stat)
X  struct DPTR *dp;
X  char **pname;
X  int *stat;
X***************
X*** 93,99
X  }
X  
X  
X! dclose(dp)
X  struct DPTR *dp;
X  {
X     if (dp == NULL)
X
X--- 93,99 -----
X  }
X  
X  
X! dirclose(dp)
X  struct DPTR *dp;
X  {
X     if (dp == NULL)
X***************
X*** 159,165
X     *ptr = '\0';
X     tail = (scr) ? ptr + 1 : NULL;
X  
X!    if ((dp = dopen (bname, &stat)) == NULL  ||  stat == 0) {
X        free (bname);
X        free (base);
X        free (eav);
X
X--- 159,165 -----
X     *ptr = '\0';
X     tail = (scr) ? ptr + 1 : NULL;
X  
X!    if ((dp = diropen (bname, &stat)) == NULL  ||  stat == 0) {
X        free (bname);
X        free (base);
X        free (eav);
X***************
X*** 166,172
X        emits ("Could not open directory");
X        return (NULL);
X     }
X!    while (dnext (dp, &name, &stat)) {
X        if (compare_ok(ename, name)) {
X           if (tail) {
X              int alt_ac;
X
X--- 166,172 -----
X        emits ("Could not open directory");
X        return (NULL);
X     }
X!    while (dirnext (dp, &name, &stat)) {
X        if (compare_ok(ename, name)) {
X           if (tail) {
X              int alt_ac;
X***************
X*** 217,223
X           }
X        }
X     }
X!    dclose (dp);
X     *pac = eac;
X     eav[eac] = NULL;
X     free (bname);
X
X--- 217,223 -----
X           }
X        }
X     }
X!    dirclose (dp);
X     *pac = eac;
X     eav[eac] = NULL;
X     free (bname);
SHAR_EOF
  if test 3985 -ne `wc -c < expand.c.diff`
  then
    echo " "
    echo shar: error transmitting expand.c.diff
    echo '      ('`wc -c < expand.c.diff | tr -d '\040'`' characters received)'
    echo " "
  fi
fi
#
if test -f kermit.c.diff
then
  echo " "
  echo shar: will not over-write existing file kermit.c.diff
  echo " "
else
  echo extracting kermit.c.diff '(701 characters)'
  sed 's/^X//' > kermit.c.diff << 'SHAR_EOF'
X*** kermit.c.orig	Fri Jan  2 09:52:11 1987
X--- kermit.c	Fri Jan  2 08:20:17 1987
X***************
X*** 18,24
X  #define MODULE_KERMIT 1
X  #include "vt100.h"
X  
X! #define CONVERTNAME TRUE    /* file name to lower case for receive */
X  #define MAXPACKSIZ 94       /* Maximum msgpkt size */
X  #define CR         13       /* ASCII Carriage Return */
X  #define LF         10       /* ASCII line feed */
X
X--- 18,24 -----
X  #define MODULE_KERMIT 1
X  #include "vt100.h"
X  
X! #define CONVERTNAME FALSE    /* file name to lower case for receive */
X  #define MAXPACKSIZ 94       /* Maximum msgpkt size */
X  #define CR         13       /* ASCII Carriage Return */
X  #define LF         10       /* ASCII line feed */
SHAR_EOF
  if test 701 -ne `wc -c < kermit.c.diff`
  then
    echo " "
    echo shar: error transmitting kermit.c.diff
    echo '      ('`wc -c < kermit.c.diff | tr -d '\040'`' characters received)'
    echo " "
  fi
fi
#
if test -f vt100.h.diff
then
  echo " "
  echo shar: will not over-write existing file vt100.h.diff
  echo " "
else
  echo extracting vt100.h.diff '(1658 characters)'
  sed 's/^X//' > vt100.h.diff << 'SHAR_EOF'
X*** vt100.h.orig	Fri Jan  2 09:52:12 1987
X--- vt100.h	Fri Jan  2 10:08:42 1987
X***************
X*** 17,24
X   ********************************************************************/
X  
X  /* ########  define the compiler type here ######## */
X! #define	LATTICE	0
X! #define MANX	1
X  
X  /*  compiler diretives to fetch the necessary header files */
X  #include <exec/types.h>
X
X--- 17,24 -----
X   ********************************************************************/
X  
X  /* ########  define the compiler type here ######## */
X! #define   LATTICE   1
X! #define   MANX      0
X  
X  /*  compiler diretives to fetch the necessary header files */
X  #include <exec/types.h>
X***************
X*** 193,199
X  int	p_bold	     = 0x900;	    /* default BOLD       RGB color */
X  int	p_cursor     = 0x009;	    /* default Cursor	  RGB color */
X  int	p_lines	     = 48;	    /* number of lines on the screen */
X! int	p_mode	     = 1;	    /* 0 = image, 1 = CRLF (for kermit) */
X  int	p_buffer     = 512;	    /* read buffer size (>= 512 bytes) */
X  int     p_parity     = 0;	    /* 0=none,1=mark,2=space,3=even,4=odd */
X  long	p_break	     = 750000;	    /* break time (in micro seconds) */
X
X--- 193,199 -----
X  int	p_bold	     = 0x900;	    /* default BOLD       RGB color */
X  int	p_cursor     = 0x009;	    /* default Cursor	  RGB color */
X  int	p_lines	     = 48;	    /* number of lines on the screen */
X! int   p_mode        = 0;       /* 0 = image, 1 = CRLF (for kermit) */
X  int	p_buffer     = 512;	    /* read buffer size (>= 512 bytes) */
X  int     p_parity     = 0;	    /* 0=none,1=mark,2=space,3=even,4=odd */
X  long	p_break	     = 750000;	    /* break time (in micro seconds) */
SHAR_EOF
  if test 1658 -ne `wc -c < vt100.h.diff`
  then
    echo " "
    echo shar: error transmitting vt100.h.diff
    echo '      ('`wc -c < vt100.h.diff | tr -d '\040'`' characters received)'
    echo " "
  fi
fi
#
if test -f vt100makescript
then
  echo " "
  echo shar: will not over-write existing file vt100makescript
  echo " "
else
  echo extracting vt100makescript '(3334 characters)'
  sed 's/^X//' > vt100makescript << 'SHAR_EOF'
X; Script to make Dave Wecker's vt100
X;
Xstack 15000
X;
Xif not exists expand.c
X  echo "File expand.c does not exist.  Make terminated."
X  quit 20
X  endif
Xecho " "
Xecho "Compiling expand.c"
Xecho " "
Xcopy expand.c RAM:expand.c
X:C/lc1 -oRAM: -i:include/ -i:include/lattice/ RAM:expand
Xdelete RAM:expand.c
Xif not exists RAM:expand.q
X  echo "Compilation of expand.c failed.  Make terminated."
X  quit 20
X  endif
X:C/lc2 -oC-DEVEL:source/ RAM:expand
X;
Xif not exists init.c
X  echo "File init.c does not exist.  Make terminated."
X  quit 20
X  endif
Xecho " "
Xecho "Compiling init.c"
Xecho " "
Xcopy init.c RAM:init.c
X:C/lc1 -oRAM: -i:include/ -i:include/lattice/ RAM:init
Xdelete RAM:init.c
Xif not exists RAM:init.q
X  echo "Compilation of init.c failed.  Make terminated."
X  quit 20
X  endif
X:C/lc2 -oC-DEVEL:source/ RAM:init
X;
Xif not exists kermit.c
X  echo "File kermit.c does not exist.  Make terminated."
X  quit 20
X  endif
Xecho " "
Xecho "Compiling kermit.c"
Xecho " "
Xcopy kermit.c RAM:kermit.c
X:C/lc1 -oRAM: -i:include/ -i:include/lattice/ RAM:kermit
Xdelete RAM:kermit.c
Xif not exists RAM:kermit.q
X  echo "Compilation of kermit.c failed.  Make terminated."
X  quit 20
X  endif
X:C/lc2 -oC-DEVEL:source/ RAM:kermit
X;
Xif not exists remote.c
X  echo "File remote.c does not exist.  Make terminated."
X  quit 20
X  endif
Xecho " "
Xecho "Compiling remote.c"
Xecho " "
Xcopy remote.c RAM:remote.c
X:C/lc1 -oRAM: -i:include/ -i:include/lattice/ RAM:remote
Xdelete RAM:remote.c
Xif not exists RAM:remote.q
X  echo "Compilation of remote.c failed.  Make terminated."
X  quit 20
X  endif
X:C/lc2 -oC-DEVEL:source/ RAM:remote
X;
Xif not exists script.c
X  echo "File script.c does not exist.  Make terminated."
X  quit 20
X  endif
Xecho " "
Xecho "Compiling script.c"
Xecho " "
Xcopy script.c RAM:script.c
X:C/lc1 -oRAM: -i:include/ -i:include/lattice/ RAM:script
Xdelete RAM:script.c
Xif not exists RAM:script.q
X  echo "Compilation of script.c failed.  Make terminated."
X  quit 20
X  endif
X:C/lc2 -oC-DEVEL:source/ RAM:script
X;
Xif not exists vt100.c
X  echo "File vt100.c does not exist.  Make terminated."
X  quit 20
X  endif
Xecho " "
Xecho "Compiling vt100.c"
Xecho " "
Xcopy vt100.c RAM:vt100.c
X:C/lc1 -oRAM: -i:include/ -i:include/lattice/ RAM:vt100
Xdelete RAM:vt100.c
Xif not exists RAM:vt100.q
X  echo "Compilation of vt100.c failed.  Make terminated."
X  quit 20
X  endif
X:C/lc2 -oC-DEVEL:source/ RAM:vt100
X;
Xif not exists window.c
X  echo "File window.c does not exist.  Make terminated."
X  quit 20
X  endif
Xecho " "
Xecho "Compiling window.c"
Xecho " "
Xcopy window.c RAM:window.c
X:C/lc1 -oRAM: -i:include/ -i:include/lattice/ RAM:window
Xdelete RAM:window.c
Xif not exists RAM:window.q
X  echo "Compilation of window.c failed.  Make terminated."
X  quit 20
X  endif
X:C/lc2 -oC-DEVEL:source/ RAM:window
X;
Xif not exists xmodem.c
X  echo "File xmodem.c does not exist.  Make terminated."
X  quit 20
X  endif
Xecho " "
Xecho "Compiling xmodem.c"
Xecho " "
Xcopy xmodem.c RAM:xmodem.c
X:C/lc1 -oRAM: -i:include/ -i:include/lattice/ RAM:xmodem
Xdelete RAM:xmodem.c
Xif not exists RAM:xmodem.q
X  echo "Compilation of xmodem.c failed.  Make terminated."
X  quit 20
X  endif
X:C/lc2 -oC-DEVEL:source/ RAM:xmodem
X;
X;
Xassign LIB: C-DEVEL:LIB
X;
Xecho " "
Xecho "Linking vt100"
Xecho " "
Xalink FROM LIB:LStartUp.obj+expand.o+init.o+kermit.o+remote.o+script.o+vt100.o+window.o+xmodem.o TO vt100 LIBRARY LIB:lc.lib+LIB:amiga.lib
X
SHAR_EOF
  if test 3334 -ne `wc -c < vt100makescript`
  then
    echo " "
    echo shar: error transmitting vt100makescript
    echo '      ('`wc -c < vt100makescript | tr -d '\040'`' characters received)'
    echo " "
  fi
fi
# end of shell archive
echo " "
echo 'end of shell archive'
echo " "
exit 0