[comp.sys.handhelds] Patches for STAR 1.04.1

darrylo@hpnmdla.hp.com (Darryl Okahata) (03/12/91)

     Here are some patches for STAR 1.04.1.  These patches are in
context diff form, and so you need the patch(1) program to apply them.
Items fixed:

* Some functions were called with the wrong number of arguments.

* Uninitialized pointers were being freed.

* Some functions were supposed to return a value, but weren't.

* Some functions do not return a value, yet their "return value" were
  being used in expressions.

* Due to the fact that "long" on most machines is only 32 bits, the
  move.p9 through move.p16 instructions will now only work if you
  compile with gcc.  Properly fixing this "bug" will require major
  modifications to STAR.  (The current error message is very cryptic,
  unfortunately.)

* The sources will now compile under Turbo C/C++, as well as MSC, Unix,
  gcc, etc..

STAR should really be run through lint(1).

     -- Darryl Okahata
	UUCP: {hplabs!, hpcea!, hpfcla!} hpnmd!darrylo
	Internet: darrylo%hpnmd@relay.hp.com

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion or policy of Hewlett-Packard or of the
little green men that have been following him all day.

===============================================================================
*** /tmp/48sx/star.orig/args.c	Tue Jan 29 16:11:24 1991
--- args.c	Mon Mar 11 10:56:51 1991
***************
*** 337,343
  /* Satisfy next character; output error if not what expected.
   * This test is always true.
   */
! mustbe(cpp,c)
    register char **cpp;
    int c;
  {

--- 337,343 -----
  /* Satisfy next character; output error if not what expected.
   * This test is always true.
   */
! void mustbe(cpp,c)
    register char **cpp;
    int c;
  {
***************
*** 359,365
  
  
  /* Write addressing syntax error message */
! static stxerr()
  {
    sgnerr("Bad operand syntax");
  }

--- 359,365 -----
  
  
  /* Write addressing syntax error message */
! static void stxerr()
  {
    sgnerr("Bad operand syntax");
  }
***************
*** 492,498
  /* Decode general arguments
   * Number of arguments may range 1 - (MAXARG-1)
   */
! dcdarg(cp0, args)
    char *cp0;
    int args;
  {

--- 492,498 -----
  /* Decode general arguments
   * Number of arguments may range 1 - (MAXARG-1)
   */
! void dcdarg(cp0, args)
    char *cp0;
    int args;
  {
*** /tmp/48sx/star.orig/code.c	Tue Jan 29 16:11:25 1991
--- code.c	Mon Mar 11 10:56:44 1991
***************
*** 541,547
    char *cp;
  {
    int f, sd;
-   char *tmp = cp;
  
  
    dcdfield(&cp, &f, FT_FIX|FT_DEFLT|F_DEFLT);

--- 541,546 -----
    char *cp;
  {
    int f, sd;
  
  
    dcdfield(&cp, &f, FT_FIX|FT_DEFLT|F_DEFLT);
***************
*** 1502,1508
    /* [AC],@D[01] or @D[01],[AC]? */
    if((sd = types_table(sacd01_table, 2, 8)) >= 0)
      {
!       struct astruct *apdn, *apac;
  
        if(f == F_DEFLT)
  	{

--- 1501,1507 -----
    /* [AC],@D[01] or @D[01],[AC]? */
    if((sd = types_table(sacd01_table, 2, 8)) >= 0)
      {
!       struct astruct *apdn;
  
        if(f == F_DEFLT)
  	{
***************
*** 1517,1523
  	}
  
        apdn = (type(GEN1, AP_ID01) ? GEN1 : GEN2);
-       apac = (apdn == GEN1 ? GEN2 : GEN1);
  
        if(apdn->reg == R_D1)
  	sd++;

--- 1516,1521 -----
  	}
  
        apdn = (type(GEN1, AP_ID01) ? GEN1 : GEN2);
  
        if(apdn->reg == R_D1)
  	sd++;
***************
*** 1649,1656
  
        n = ((f - 1) & 0xf) + 1;
        code1(n-1);
!       
!       chkimm(GEN1, - ((INT) 1 << (n * 4 - 1)), ((INT) 1 << (n * 4)) - 1);
        coden(n, arg[0].disp1);
        return;
      }

--- 1647,1669 -----
  
        n = ((f - 1) & 0xf) + 1;
        code1(n-1);
! 
! #ifdef __GNUC__
!       if (n < 16)
!       {
! 	chkimm(GEN1, - ((INT) 1 << (n * 4 - 1)), ((INT) 1 << (n * 4)) - 1);
!       }
! #else
!       if (n < 8)
!       {
! 	chkimm(GEN1, - ((INT) 1 << (n * 4 - 1)), ((INT) 1 << (n * 4)) - 1);
!       }
!       else if (n > 8)
!       {
! 	sgnerr("Value of n (%d) > 8", n);
! 	abort();
!       }
! #endif
        coden(n, arg[0].disp1);
        return;
      }
*** /tmp/48sx/star.orig/code.h	Tue Jan 29 16:11:26 1991
--- code.h	Mon Mar 11 10:52:42 1991
***************
*** 2,7
   * code.h -- STAR Code Generation/Checking Header 
   */
  extern
!   gendisp(), revbits(), isimm(), type(), types2(), types_table();
  
  #define	MAXARG	6

--- 2,9 -----
   * code.h -- STAR Code Generation/Checking Header 
   */
  extern
!   revbits(), isimm(), types2(), types_table();
! 
! extern void gendisp(long, int, int, int);
  
  #define	MAXARG	6
*** /tmp/48sx/star.orig/ctt.c	Tue Jan 29 16:11:26 1991
--- ctt.c	Mon Mar 11 10:52:46 1991
***************
*** 42,48
  {
    CTT_ROOT *ctt_tmp;
    extern char *malloc();
-   extern void fatal();
  
    
    if(!(ctt_tmp = (CTT_ROOT *) malloc(sizeof(CTT_ROOT))))

--- 42,47 -----
  {
    CTT_ROOT *ctt_tmp;
    extern char *malloc();
  
  
    if(!(ctt_tmp = (CTT_ROOT *) malloc(sizeof(CTT_ROOT))))
***************
*** 59,65
  {
    CTT_NODE *ctt_tmp;
    extern char *malloc();
-   extern void fatal();
  
    
    if(!(ctt_tmp = (CTT_NODE *) malloc(sizeof(CTT_NODE))))

--- 58,63 -----
  {
    CTT_NODE *ctt_tmp;
    extern char *malloc();
  
    if(!(ctt_tmp = (CTT_NODE *) malloc(sizeof(CTT_NODE))))
      fatal("Cannot allocate CTT node, %d bytes", sizeof(CTT_NODE));
*** /tmp/48sx/star.orig/dirs.c	Tue Jan 29 16:11:27 1991
--- dirs.c	Mon Mar 11 10:56:33 1991
***************
*** 46,52
    loc;
  
  extern
!   mustbe(), cifnest, ciftrue, cifsave;
  
  extern char
    nextch();

--- 46,52 -----
    loc;
  
  extern
!   cifnest, ciftrue, cifsave;
  
  extern char
    nextch();
***************
*** 702,708
  
  
  /* Make sure there is nothing more */
! nomore(cpp)
    char **cpp;
  {
    if(!eol(cpp))

--- 702,708 -----
  
  
  /* Make sure there is nothing more */
! void nomore(cpp)
    char **cpp;
  {
    if(!eol(cpp))
***************
*** 997,1002
    
    for(acc = ch - '0'; !eol(cpp) && **cpp <= '7' && **cpp >= '0';
        acc = (acc << 3) + str_nextch(cpp) - '0');
  }
  
  

--- 997,1003 -----
    
    for(acc = ch - '0'; !eol(cpp) && **cpp <= '7' && **cpp >= '0';
        acc = (acc << 3) + str_nextch(cpp) - '0');
+   return (acc);
  }
  
  
***************
*** 1043,1049
      case '4':
      case '5':
      case '6':
!     case '7':	return(tmpc, octch(cpp));
      case 'g':	return('\007');
      case 'b':	return('\010');
      default:	return(tmpc);

--- 1044,1050 -----
      case '4':
      case '5':
      case '6':
!     case '7':	return(octch(tmpc, cpp));
      case 'g':	return('\007');
      case 'b':	return('\010');
      default:	return(tmpc);
***************
*** 1308,1314
  
  
  /* DEBUG: print value on stderr */
! debug_print_val(v)
    struct val v;
  {
    switch(v.type)

--- 1309,1315 -----
  
  
  /* DEBUG: print value on stderr */
! void debug_print_val(v)
    struct val v;
  {
    switch(v.type)
***************
*** 1348,1354
        dump_sym_chain(*sp);
  }
  
! debug_print_sym()
  {
    fputs("*** Symbol table ***\n", stderr);
    dump_sym_aux(symtbl);

--- 1349,1355 -----
        dump_sym_chain(*sp);
  }
  
! void debug_print_sym()
  {
    fputs("*** Symbol table ***\n", stderr);
    dump_sym_aux(symtbl);
***************
*** 1394,1400
    int nlines;
    long startpos;
    char lbuf[256], *cp, **block, **l;
!   extern pass, lincnt, inhibit_list, scmp(), fgetss();
    extern FILE *sourcefile, *listfile;
    extern long ftell();
    extern char *malloc(), *strdup(), bufcpy[];

--- 1395,1401 -----
    int nlines;
    long startpos;
    char lbuf[256], *cp, **block, **l;
!   extern pass, lincnt, inhibit_list, scmp();
    extern FILE *sourcefile, *listfile;
    extern long ftell();
    extern char *malloc(), *strdup(), bufcpy[];
***************
*** 1876,1882
  {
    char
      *s, *name, *endname, c, **l,
!     **argbody, mcall[256], *passlabel;
    int
      arglines, listsave;
    struct sstruct *symp;

--- 1877,1883 -----
  {
    char
      *s, *name, *endname, c, **l,
!     **argbody, mcall[256];
    int
      arglines, listsave;
    struct sstruct *symp;
***************
*** 1893,1900
  
  
    dcdfield(&cp, &dummy, FT_NONE);
- 
-   passlabel = (pass == 3 ? label_pass3 : label);
  
    s = scansym(&cp, &c);
    name = strdup(s);

--- 1894,1899 -----
  
  
    dcdfield(&cp, &dummy, FT_NONE);
  
    s = scansym(&cp, &c);
    name = strdup(s);
*** /tmp/48sx/star.orig/eval.c	Tue Jan 29 16:11:28 1991
--- eval.c	Mon Mar 11 10:52:57 1991
***************
*** 662,669
    char **cpp;
  {
    INT tmp;
!   char *save = *cpp;
!   
    tmp = (INT) 0;
    noseq = TRUE;
  

--- 661,667 -----
    char **cpp;
  {
    INT tmp;
! 
    tmp = (INT) 0;
    noseq = TRUE;
  
***************
*** 1324,1329
        oldcodebuf = malloc(codeptr-codebuf);
        bcopy(codebuf, oldcodebuf, codeptr-codebuf);
      }
  
    oldcodeptr = codeptr;
    codeptr = codebuf;

--- 1322,1331 -----
        oldcodebuf = malloc(codeptr-codebuf);
        bcopy(codebuf, oldcodebuf, codeptr-codebuf);
      }
+   else
+     {
+       oldcodebuf = NULL;
+     }
  
    oldcodeptr = codeptr;
    codeptr = codebuf;
***************
*** 1405,1411
    loc0 = save_loc0;
    loc  = save_loc;
  
!   bcopy(oldcodebuf, codebuf, oldcodeptr-codebuf);
    codeptr = oldcodeptr;
    free(oldcodebuf);
    return(term);

--- 1407,1417 -----
    loc0 = save_loc0;
    loc  = save_loc;
  
!   if (oldcodebuf)
!     {
!       bcopy(oldcodebuf, codebuf, oldcodeptr-codebuf);
!       free(oldcodebuf);
!     }
    codeptr = oldcodeptr;
    return(term);
  }
***************
*** 1407,1413
  
    bcopy(oldcodebuf, codebuf, oldcodeptr-codebuf);
    codeptr = oldcodeptr;
-   free(oldcodebuf);
    return(term);
  }
  

--- 1413,1418 -----
        free(oldcodebuf);
      }
    codeptr = oldcodeptr;
    return(term);
  }
  
*** /tmp/48sx/star.orig/forms.c	Tue Jan 29 16:11:29 1991
--- forms.c	Mon Mar 11 10:57:10 1991
***************
*** 132,138
  
  
  /* Generate jump offset */
! gendisp(disp, dispdiff, op3, op4)
    long disp;
    int dispdiff, op3, op4;
  {

--- 132,138 -----
  
  
  /* Generate jump offset */
! void gendisp(disp, dispdiff, op3, op4)
    long disp;
    int dispdiff, op3, op4;
  {
*** /tmp/48sx/star.orig/sects.c	Tue Jan 29 16:11:31 1991
--- sects.c	Mon Mar 11 10:53:39 1991
***************
*** 65,71
  {
    SECT *stmp;
    extern char *malloc();
-   extern void fatal();
  
  
    if(!(stmp = (SECT *) malloc(sizeof(SECT))))

--- 65,70 -----
  {
    SECT *stmp;
    extern char *malloc();
  
    if(!(stmp = (SECT *) malloc(sizeof(SECT))))
      fatal("Cannot allocate memory for section");
***************
*** 107,113
  static SECT_CSEG *sc_cseg_alloc()
  {
    SECT_CSEG *new_cseg;
-   extern void fatal();
    extern char *malloc();
  
  

--- 105,110 -----
  static SECT_CSEG *sc_cseg_alloc()
  {
    SECT_CSEG *new_cseg;
    extern char *malloc();
  
  
*** /tmp/48sx/star.orig/star.c	Tue Jan 29 16:11:33 1991
--- star.c	Mon Mar 11 10:57:05 1991
***************
*** 31,36
  USA, or send e-mail to bson@ai.mit.edu. */
  
  
  #include <stdio.h>
  #include <varargs.h>
  #include "sects.h"

--- 31,41 -----
  USA, or send e-mail to bson@ai.mit.edu. */
  
  
+ #ifdef __TURBOC__
+ extern unsigned _stklen = 20000U;	/* Set the runtime stack size */
+ #endif
+ 
+ 
  #include <stdio.h>
  #include "star.h"
  #ifdef USE_STDARGS
***************
*** 32,39
  
  
  #include <stdio.h>
- #include <varargs.h>
- #include "sects.h"
  #include "star.h"
  #include "literals.h"
  #include "symbols.h"

--- 37,42 -----
  
  
  #include <stdio.h>
  #include "star.h"
  #ifdef USE_STDARGS
  # include <stdarg.h>
***************
*** 35,40
  #include <varargs.h>
  #include "sects.h"
  #include "star.h"
  #include "literals.h"
  #include "symbols.h"
  

--- 38,49 -----
  
  #include <stdio.h>
  #include "star.h"
+ #ifdef USE_STDARGS
+ # include <stdarg.h>
+ #else
+ # include <varargs.h>
+ #endif
+ #include "sects.h"
  #include "literals.h"
  #include "symbols.h"
  
***************
*** 154,160
  
  
  /* Same as fgets(), but strips trailing LF */
! fgetss(buf, bufsz, fp)
    register FILE *fp;
    register char *buf;
    register bufsz;

--- 163,169 -----
  
  
  /* Same as fgets(), but strips trailing LF */
! void fgetss(buf, bufsz, fp)
    register FILE *fp;
    register char *buf;
    register bufsz;
***************
*** 391,397
  
  
  /* Write line number */
! wrline(fp)
    FILE *fp;
  {
    extern void newpage();

--- 400,406 -----
  
  
  /* Write line number */
! void wrline(fp)
    FILE *fp;
  {
    extern void newpage();
***************
*** 406,412
  /* Make sure there is a specified number of bytes left in code
   * buffer. If not, write listing (if pass 3) and clear code buffer.
   */
! codchk(length) 
    int length;
  {
    extern void writelist();

--- 415,421 -----
  /* Make sure there is a specified number of bytes left in code
   * buffer. If not, write listing (if pass 3) and clear code buffer.
   */
! void codchk(length)
    int length;
  {
    extern void writelist();
***************
*** 423,429
  
  
  /* Stuff up code buffer with nibble */
! code1(nibval)
    unsigned nibval;
  {
    if(!ciftrue)

--- 432,438 -----
  
  
  /* Stuff up code buffer with nibble */
! void code1(nibval)
    unsigned nibval;
  {
    if(!ciftrue)
***************
*** 444,450
  
  
  /* Stuff up code buffer with two nibbles */
! code2(bytval)
    unsigned bytval;
  {
    if(!ciftrue)

--- 453,459 -----
  
  
  /* Stuff up code buffer with two nibbles */
! void code2(bytval)
    unsigned bytval;
  {
    if(!ciftrue)
***************
*** 466,472
  
  
  /* Stuff up code buffer with 3 nibbles */
! code3(l)
    unsigned l;
  {
    if(!ciftrue)

--- 475,481 -----
  
  
  /* Stuff up code buffer with 3 nibbles */
! void code3(l)
    unsigned l;
  {
    if(!ciftrue)
***************
*** 491,497
  
  
  /* Stuff up code buffer with 16-bit integer */
! code4(l)
    unsigned l;
  {
    if(!ciftrue)

--- 500,506 -----
  
  
  /* Stuff up code buffer with 16-bit integer */
! void code4(l)
    unsigned l;
  {
    if(!ciftrue)
***************
*** 516,522
  
  
  /* Put 20-bit integer in buffer */
! code5(l)
    unsigned long l;
  {
    if(!ciftrue)

--- 525,531 -----
  
  
  /* Put 20-bit integer in buffer */
! void code5(l)
    unsigned long l;
  {
    if(!ciftrue)
***************
*** 545,551
   * We can't just call sc_add_code() directly, since we
   * have to update the listings and stats.
   */
! coden(l, i)
    int l;
    INT i;
  {

--- 554,560 -----
   * We can't just call sc_add_code() directly, since we
   * have to update the listings and stats.
   */
! void coden(l, i)
    int l;
    INT i;
  {
***************
*** 550,556
    INT i;
  {
    if(!l || !ciftrue)
!     return(0);
  
    if(l <= NIBWID)
      codchk(l);

--- 559,565 -----
    INT i;
  {
    if(!l || !ciftrue)
!     return;
  
    if(l <= NIBWID)
      codchk(l);
***************
*** 558,564
    if(l >= 5)
      {
        code5(i);
!       return(coden(l-5, i >> 20));
      }
  
    if(l == 4)

--- 567,574 -----
    if(l >= 5)
      {
        code5(i);
!       coden(l-5, i >> 20);
!       return;
      }
  
    if(l == 4)
***************
*** 562,568
      }
  
    if(l == 4)
!     return(code4(i & 0xffff));
  
    if(l == 3)
      return(code3(i & 0xfff));

--- 572,581 -----
      }
  
    if(l == 4)
!     {
!       code4(i & 0xffff);
!       return;
!     }
  
    if(l == 3)
      {
***************
*** 565,572
      return(code4(i & 0xffff));
  
    if(l == 3)
!     return(code3(i & 0xfff));
!       
    if(l == 2)
      return(code2(i & 0xff));
  

--- 578,588 -----
      }
  
    if(l == 3)
!     {
!       code3(i & 0xfff);
!       return;
!     }
! 
    if(l == 2)
      {
        code2(i & 0xff);
***************
*** 568,574
      return(code3(i & 0xfff));
        
    if(l == 2)
!     return(code2(i & 0xff));
  
    return(code1(i & 0xf));
  }

--- 584,593 -----
      }
  
    if(l == 2)
!     {
!       code2(i & 0xff);
!       return;
!     }
  
    code1(i & 0xf);
    return;
***************
*** 570,576
    if(l == 2)
      return(code2(i & 0xff));
  
!   return(code1(i & 0xf));
  }
  
  

--- 589,596 -----
        return;
      }
  
!   code1(i & 0xf);
!   return;
  }
  
  
***************
*** 575,581
  
  
  /* Signal error if in third pass and increment error counter */
! #if defined(UNIX) || defined(MSDOS) || defined(VMS)
  void sgnerr(va_alist)
    va_dcl
  {

--- 595,645 -----
  
  
  /* Signal error if in third pass and increment error counter */
! #ifdef USE_STDARGS
! /*
!  * For Turbo C, et.al.
!  */
! void sgnerr(char *descr, ...)
! {
!   va_list args;
!   extern void writelist();
! 
!   /* Make sure it's the third pass */
!   if(pass != 3 || !ciftrue || !errors_enabled)
!     return;
! 
!   if(!multierrflag)
!     errors_enabled = FALSE;
! 
!   va_start(args, descr);
! 
!   if(listflag)
!     {
!       wrline(listfile);
!       fprintf(listfile, "ERROR: ");
!       vfprintf(listfile, descr, args);
!       fprintf(listfile, "\n");
!     }
!   if(!quiet)
!     {
! #ifdef UNIX_ERRORS
!       fprintf(stderr, "\"%s\", line %u: ", curfil, lincnt);
!       vfprintf(stderr, descr, args);
!       fputc('\n', stderr);
! #else
!       wrline(stderr);
!       fprintf(stderr, "ERROR: ");
!       vfprintf(stderr, descr, args);
!       fprintf(stderr, "\n");
!       writelist(stderr);
! #endif
!     }
!   va_end(args);
!   errcnt++;
! }
! 
! #else
! # if defined(UNIX) || defined(MSDOS) || defined(VMS)
  void sgnerr(va_alist)
    va_dcl
  {
***************
*** 617,623
    errcnt++;
  }
  
! #else
  
  void sgnerr(descr, arg1, arg2, arg3, arg4)
    long descr, arg1, arg2, arg3, arg4;

--- 681,687 -----
    errcnt++;
  }
  
! # else
  
  void sgnerr(descr, arg1, arg2, arg3, arg4)
    long descr, arg1, arg2, arg3, arg4;
***************
*** 654,659
      }
    errcnt++;
  }
  #endif
  
  

--- 718,724 -----
      }
    errcnt++;
  }
+ # endif
  #endif
  
  
***************
*** 658,664
  
  
  /* Write warning if in third pass and increment error counter */
! #if defined(UNIX) || defined(MSDOS) || defined(VMS)
  void sgnwrn(va_alist)
    va_dcl
  {

--- 723,774 -----
  
  
  /* Write warning if in third pass and increment error counter */
! #ifdef USE_STDARGS
! /*
!  * For Turbo C, et.al.
!  */
! void sgnwrn(char *descr, ...)
! {
!   va_list args;
!   extern void writelist();
! 
!   /* Make sure its the third pass */
!   if(pass != 3 || !ciftrue || !errors_enabled)
!     return;
! 
!   if(!multierrflag)
!     errors_enabled = FALSE;
! 
!   va_start(args, descr);
! 
!   if(listflag)
!     {
!       wrline(listfile);
!       fprintf(listfile, "WARNING: ");
!       vfprintf(listfile, descr, args);
!       fprintf(listfile, "\n");
!     }
! 
!   if(!quiet)
!     {
! #ifdef UNIX_ERRORS
!       fprintf(stderr, "\"%s\", line %u: Warning - ", curfil, lincnt);
!       vfprintf(stderr, descr, args);
!       fputc('\n', stderr);
! #else
!       wrline(stderr);
!       fprintf(stderr, "WARNING: ");
!       vfprintf(stderr, descr, args);
!       fprintf(stderr, "\n");
!       writelist(stderr);
! #endif
!     }
!   va_end(args);
!   errcnt++;
! }
! 
! #else
! # if defined(UNIX) || defined(MSDOS) || defined(VMS)
  void sgnwrn(va_alist)
    va_dcl
  {
***************
*** 701,707
    errcnt++;
  }
  
! #else
  
  sgnwrn(descr, arg1, arg2, arg3, arg4)
    long descr, arg1, arg2, arg3, arg4;

--- 811,817 -----
    errcnt++;
  }
  
! # else
  
  sgnwrn(descr, arg1, arg2, arg3, arg4)
    long descr, arg1, arg2, arg3, arg4;
***************
*** 740,745
    errcnt++;
  }
  
  #endif
  
  

--- 850,856 -----
    errcnt++;
  }
  
+ # endif
  #endif
  
  
***************
*** 744,750
  
  
  /* Fatal error display */
! #if defined(UNIX) || defined(MSDOS) || defined(VMS)
  
  void fatal(va_alist)
    va_dcl

--- 855,885 -----
  
  
  /* Fatal error display */
! #ifdef USE_STDARGS
! /*
!  * For Turbo C, et.al.
!  */
! void fatal(char *descr, ...)
! {
!   va_list args;
!   extern void writelist();
! 
!   va_start(args, descr);
! 
!   fprintf(stderr, "\n\nAssembler Internal Error:\n  ");
!   vfprintf(stderr, descr, args);
!   fprintf(stderr, "\n  At or near line %d in source file %s\n",
! 	  lincnt, curfil);
! 
! #ifdef FATAL_DUMP
!   abort();
! #else
!   exit(3);
! #endif
! }
! 
! #else
! # if defined(UNIX) || defined(MSDOS) || defined(VMS)
  
  void fatal(va_alist)
    va_dcl
***************
*** 768,774
  #endif
  }
  
! #else
  
  void fatal(descr, arg1, arg2, arg3, arg4)
    long descr, arg1, arg2, arg3, arg4;

--- 903,909 -----
  #endif
  }
  
! # else
  
  void fatal(descr, arg1, arg2, arg3, arg4)
    long descr, arg1, arg2, arg3, arg4;
***************
*** 781,786
    exit(3);
  }
  
  #endif
  
  

--- 916,922 -----
    exit(3);
  }
  
+ # endif
  #endif
  
  
***************
*** 855,861
    label_pass3[0] = '\0';
  
    /* Is the first character a space? */
!   if(*inp == ' ')
      {
        inp = byspace(inp);
        return;

--- 991,997 -----
    label_pass3[0] = '\0';
  
    /* Is the first character a space? */
!   if(*inp == ' ' || *inp == '\t')
      {
        inp = byspace(inp);
        return;
***************
*** 862,868
      }
    
    /* Zero terminate symbol */
!   for(tmp=inp; *inp > ' '  &&  *inp != ':'; *inp++ = toupper(*inp));
  
    if(*inp != ':')		/* Not a label */
      {

--- 998,1007 -----
      }
  
    /* Zero terminate symbol */
!   for(tmp=inp; *inp > ' '  &&  *inp != ':'; inp++)
!     {
!       *inp = toupper(*inp);
!     }
  
    if(*inp != ':')               /* Not a label */
      {
***************
*** 1021,1027
  
  
  /* Set default filetype */
! static deftype(filarr, filx, ftyp)
    char *filarr[], *ftyp;
    int filx;
  {

--- 1160,1166 -----
  
  
  /* Set default filetype */
! static void deftype(filarr, filx, ftyp)
    char *filarr[], *ftyp;
    int filx;
  {
***************
*** 1465,1471
  
  
  /* Open source file and assemble contents, then close file */
! static assemble(filename, filex)
    char *filename;
  {
    extern macro_invocation;

--- 1604,1610 -----
  
  
  /* Open source file and assemble contents, then close file */
! static void assemble(filename, filex)
    char *filename;
  {
    extern macro_invocation;
***************
*** 1530,1536
  
  
  /* Initialize instruction table hash list */
! initins()
  {
    register ix;
    register char ltr;

--- 1669,1675 -----
  
  
  /* Initialize instruction table hash list */
! void initins()
  {
    register ix;
    register char ltr;
***************
*** 1617,1623
      **end_of_table;
    int
      nsyms,			/* # of symbols to be printed */
-     npages,			/* # of pages */
      nrows,			/* # of rows per col */
      lpp;			/* Lines per page */
  

--- 1756,1761 -----
      **end_of_table;
    int
      nsyms,			/* # of symbols to be printed */
      nrows,			/* # of rows per col */
      lpp;			/* Lines per page */
  
***************
*** 1627,1633
    /* Partition pages. Each page is 3 columns. */
    newpage();
    lpp = pagesz-linecnt;
-   npages = nsyms/lpp;
  
    if(nsyms % 3)
      nrows = (nsyms+3)/3;

--- 1765,1770 -----
    /* Partition pages. Each page is 3 columns. */
    newpage();
    lpp = pagesz-linecnt;
  
    if(nsyms % 3)
      nrows = (nsyms+3)/3;
***************
*** 1872,1876
    /* Close files and exit */
    fclose(listfile);
    fclose(codefile);
  }
   

--- 2009,2014 -----
    /* Close files and exit */
    fclose(listfile);
    fclose(codefile);
+   return (0);
  }
  
*** /tmp/48sx/star.orig/star.h	Tue Jan 29 16:11:34 1991
--- star.h	Mon Mar 11 10:53:59 1991
***************
*** 17,24
   */
  /* #define MSDOS */		/* MS-DOS, MSC 5.0+ */
  /* #define MSDOS_FILENAMES */	/* Define this if you want
!                                    the new file types */
! 
  
  #if defined(MSDOS_FILENAMES) || defined(VMS_FILENAMES)
  

--- 17,37 -----
   */
  /* #define MSDOS */		/* MS-DOS, MSC 5.0+ */
  /* #define MSDOS_FILENAMES */	/* Define this if you want
! 				   the new file types */
! #ifdef __TURBOC__
! # ifndef MSDOS
! #  define MSDOS
! # endif
! # define MSDOS_FILENAMES
! # define USE_STDARGS
! #endif
! 
! #ifndef USE_STDARGS
! /* #define USE_STDARGS		/* Define if you use stdargs.h instead of
! 				 * varargs.h.  This only works if you have
! 				 * an ANSI C compiler.
! 				 */
! #endif
  
  #if defined(MSDOS_FILENAMES) || defined(VMS_FILENAMES)
  
***************
*** 210,215
  };
  
  
  /* Just so we don't have to load sect.h in all code */
  #ifndef _SECT_DEF_
  #define STRUCT_SECT void

--- 223,231 -----
  };
  
  
+ #if 1
+ # define STRUCT_SECT	struct sect
+ #else
  /* Just so we don't have to load sect.h in all code */
  #ifndef _SECT_DEF_
  #define STRUCT_SECT void
***************
*** 216,221
  #else
  #define STRUCT_SECT struct sect
  #endif
  
  /* Value holder */
  

--- 232,238 -----
  #else
  #define STRUCT_SECT struct sect
  #endif
+ #endif
  
  /* Value holder */
  
***************
*** 373,382
    solidify(struct val), localize(struct val), val_zero, val_one,
    val_nullstr;
  
! extern
!   coden(int, INT), code1(unsigned), code2(unsigned), code3(unsigned),
!   code4(unsigned), code5(unsigned long),
!   pass;
  
  extern long
    loc, loc0;

--- 390,396 -----
    solidify(struct val), localize(struct val), val_zero, val_one,
    val_nullstr;
  
! extern pass;
  
  extern long
    loc, loc0;
***************
*** 382,388
    loc, loc0;
  
  extern void
!   chkimm(struct astruct *, INT, INT), fatal(), sgnerr(), sgnwrn(),
    expr_gc();
  
  extern char

--- 396,405 -----
    loc, loc0;
  
  extern void
!   chkimm(struct astruct *, INT, INT),
!   fatal(char *, ...),
!   sgnerr(char *, ...),
!   sgnwrn(char *, ...),
    expr_gc();
  
  extern char
***************
*** 387,389
  
  extern char
    *expand_symbols(char *);

--- 404,418 -----
  
  extern char
    *expand_symbols(char *);
+ 
+ extern void mustbe(char **, int);		/* args.c */
+ extern void dcdarg(char *, int);		/* args.c */
+ extern int  type(struct astruct *, int);	/* args.c */
+ extern void fgetss(char *, int, FILE *);	/* star.c */
+ extern void wrline(FILE *);			/* star.c */
+ extern void code1(unsigned int);		/* star.c */
+ extern void code2(unsigned int);		/* star.c */
+ extern void code3(unsigned int);		/* star.c */
+ extern void code4(unsigned int);		/* star.c */
+ extern void code5(unsigned long);		/* star.c */
+ extern void coden(int, INT);			/* star.c */
*** /tmp/48sx/star.orig/symbols.c	Tue Jan 29 16:11:35 1991
--- symbols.c	Mon Mar 11 10:57:28 1991
***************
*** 47,53
  #include "star.h"
  #include "symbols.h"
  
- extern void fatal();
  
  /* Create symbol table */
  SYM_ROOT *sm_open(creator, destructor)

--- 47,52 -----
  #include "star.h"
  #include "symbols.h"
  
  
  /* Create symbol table */
  SYM_ROOT *sm_open(creator, destructor)

darrylo@hpnmdla.hp.com (Darryl Okahata) (03/12/91)

In comp.sys.handhelds, I write:

>      Here are some patches for STAR 1.04.1.  These patches are in
> context diff form, and so you need the patch(1) program to apply them.
> Items fixed:

     It's just been pointed out to me that 1.04.1 is an old version, and
that the latest versions have these bugs fixed.

     -- Darryl Okahata
	UUCP: {hplabs!, hpcea!, hpfcla!} hpnmd!darrylo
	Internet: darrylo%hpnmd@relay.hp.com

DISCLAIMER: this message is the author's personal opinion and does not
constitute the support, opinion or policy of Hewlett-Packard or of the
little green men that have been following him all day.

bson@rice-chex.ai.mit.edu (Jan Brittenson) (03/12/91)

   I would like to request *anyone* that downloads a program, any
program, that they contact the author before setting out on a huge bug
fix effort.  Or you may end up like the unfortunate author of the
previous post - fixing code that was fixed quite some time ago. Since
any help on STAR is both needed and wanted, I sort of lose too if
people secretly fix bugs that have already been fixed, since people
could instead help finding and fixing existing bugs in current
releases.

   So, I directed the author to the not yet announced 1.04.4 - I hope
he will get Turbo C to compile that version as well. Not much is new,
it's basically the same as 1.04.3 except two bugs were fixed - one
that is serious and was discovered shortly after 1.04.3 was announced.
It causes local symbols in large programs divided into several files
to fail miserably. Bill Gribble has also provided a binary for
AmigaDOS, as well as some installation notes.

   Oh, one more thing. Sometimes people forward announcements to
comp.archive. I frequently get mail from people asking me "great, but
what does it do?" This makes me feel silly. If you feel compelled to
forward my announcements to non-handhelds forums, then please consider
adding a few lines to clarify what the program does.

						-- Jan Brittenson
						   bson@ai.mit.edu

					   Read my lisp: no new classes!