more porting results: sc (spreadsheet calculator)

Charles Hedrick hedrick at athos.rutgers.edu
Mon Feb 29 15:26:09 AEST 1988



This is yet another in my series of reports on porting software to the
Microport System V/AT.  This is a report on sc, a public-domain
spreadsheet system for Unix.  I have just ported version 5.1 of sc.  It
is available from the comp.sources.unix archives, as v13i016-v13i018. 
The changes are because of a known bug in the uport C compiler.  In the
version 2.3 release notes there is a comment that the compiler will
reject an array if the number of elements in the array times the size
per element is greater than 64K, even if the array is actually an array
of pointers.  This is a bug, since an array of pointer should use the
number of elements time the size of a pointer (in this case, 4 bytes). 
Of course one could simply reduce the size of the array, but in this
case I have chosen to adopt a kludge.  I declare the array in one module
as an array of longs (same size as a pointer, so the right amount of
space gets allocated).  Everywhere else, I refer to it without
specifying the size, so the compiler doesn't get upset. 

By the way, I tried this with my special version of malloc.  For some
reason it causes certain control characters not to be read correctly. 
It appears that curses somehow will not work with my malloc.  I've
tried an obvious workaround and failed, so for the moment I'm using
the normal system malloc.

*** Makefile.ORIG	Sun Feb 28 20:44:16 1988
--- Makefile	Sun Feb 28 23:59:44 1988
***************
*** 22,30
  #SIMPLE=-DSIMPLE
  
  # Use this for system V.2
! #CFLAGS= -O -DSYSV2
! #LDFLAGS=
! #LIB=-lm -lcurses
  
  # Use this for system V.3
  #CFLAGS= -O -DSYSV3

--- 22,30 -----
  #SIMPLE=-DSIMPLE
  
  # Use this for system V.2
! CFLAGS= -O -DSYSV2 -Ml
! LDFLAGS=
! LIB=-lm -lcurses
  
  # Use this for system V.3
  #CFLAGS= -O -DSYSV3
***************
*** 37,45
  #LIB=-lm -lcurses -ltermcap
  
  # Use this for BSD 4.3
! CFLAGS= -O -DBSD43
! LDFLAGS=
! LIB=-lm -lcurses -ltermcap
  
  # Use this for system III (XENIX)
  #CFLAGS= -O -DSYSIII

--- 37,45 -----
  #LIB=-lm -lcurses -ltermcap
  
  # Use this for BSD 4.3
! #CFLAGS= -O -DBSD43
! #LDFLAGS=
! #LIB=-lm -lcurses -ltermcap
  
  # Use this for system III (XENIX)
  #CFLAGS= -O -DSYSIII
***************
*** 52,58
  #LIB=-lm -lcurses -ltermcap
  
  # The objects
! OBJS=sc.o lex.o gram.o interp.o cmds.o crypt.o xmalloc.o range.o
  
  $(name):	$(OBJS)
  	cc ${CFLAGS} ${LDFLAGS} ${OBJS} ${LIB} -o $(name)

--- 52,58 -----
  #LIB=-lm -lcurses -ltermcap
  
  # The objects
! OBJS=sc.o lex.o gram.o interp.o cmds.o crypt.o xmalloc.o range.o table.o
  
  $(name):	$(OBJS)
  	cc ${CFLAGS} ${LDFLAGS} ${OBJS} ${LIB} -o $(name)
*** sc.c.ORIG	Sun Feb 28 20:43:35 1988
--- sc.c	Sun Feb 28 23:17:51 1988
***************
*** 39,45
  
  /* Globals defined in sc.h */
  
- struct ent *tbl[MAXROWS][MAXCOLS];
  int strow, stcol;
  int currow, curcol;
  int savedrow, savedcol;

--- 39,44 -----
  
  /* Globals defined in sc.h */
  
  int strow, stcol;
  int currow, curcol;
  int savedrow, savedcol;
*** sc.h.ORIG	Sun Feb 28 20:43:29 1988
--- sc.h	Sun Feb 28 20:49:06 1988
***************
*** 122,128
  
  #define ctl(c) ('c'&037)
  
! extern struct ent *tbl[MAXROWS][MAXCOLS];
  
  extern int strow, stcol;
  extern int currow, curcol;

--- 122,129 -----
  
  #define ctl(c) ('c'&037)
  
! /* hack for microport buggy compiler */
! extern struct ent *tbl[1][MAXCOLS];
  
  extern int strow, stcol;
  extern int currow, curcol;



More information about the Comp.unix.microport mailing list