home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume35 / ss / part07 < prev    next >
Encoding:
Text File  |  1993-03-02  |  60.8 KB  |  2,010 lines

  1. Newsgroups: comp.sources.misc
  2. From: art@cs.ualberta.ca (Art Mulder)
  3. Subject: v35i093:  ss - Simple Spreadsheet program, v1.2b, Part07/11
  4. Message-ID: <1993Feb22.153009.21758@sparky.imd.sterling.com>
  5. X-Md4-Signature: 23af6a4947d819d990232be57e0cb5fa
  6. Date: Mon, 22 Feb 1993 15:30:09 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: art@cs.ualberta.ca (Art Mulder)
  10. Posting-number: Volume 35, Issue 93
  11. Archive-name: ss/part07
  12. Environment: curses, sunos, sysv, ultrix, sgi, dec, mips, sun
  13.  
  14. #! /bin/sh
  15. # This is a shell archive.  Remove anything before this line, then feed it
  16. # into a shell via "sh file" or similar.  To overwrite existing files,
  17. # type "sh file -c".
  18. # Contents:  ss_12b/Makefile.ultrix ss_12b/menu.c ss_12b/ss.h
  19. #   ss_12b/sunfkeys/README ss_12b/version.c
  20. # Wrapped by kent@sparky on Sat Feb 20 16:01:03 1993
  21. PATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:/usr/lbin ; export PATH
  22. echo If this archive is complete, you will see the following message:
  23. echo '          "shar: End of archive 7 (of 11)."'
  24. if test -f 'ss_12b/Makefile.ultrix' -a "${1}" != "-c" ; then 
  25.   echo shar: Will not clobber existing file \"'ss_12b/Makefile.ultrix'\"
  26. else
  27.   echo shar: Extracting \"'ss_12b/Makefile.ultrix'\" \(16515 characters\)
  28.   sed "s/^X//" >'ss_12b/Makefile.ultrix' <<'END_OF_FILE'
  29. X#############################################################################
  30. X# Makefile $Revision: 6.21 $
  31. X#
  32. X# How to build the 'ss' package:
  33. X# 1) Read this Makefile, keeping an eye out for anything that appears to
  34. X#    have a bearing on your situation.
  35. X#
  36. X# 2) Customize these variables, to match the situation at your site:
  37. X#    EXDIR (path), MANDIR, MANEXT, LIBDIR, SIGVOID, RE_COMP/REGCMP, 
  38. X#    DFLT_PAGER, and FMOD. 
  39. X#
  40. X#    There are lost of other variables, but most shouldn't need to be
  41. X#    changed.  (If you followed #1, you probably already know that, and
  42. X#    have probably already changed any you think should be changed.)
  43. X#
  44. X# 3) Underneath the heading "SYSTEM DEFINES", below, there are sections
  45. X#    of code for many different machine/compiler/OS setups.  Select
  46. X#    the section that corresponds to your site, and:
  47. X#      (a) Uncomment it.
  48. X#      (b) Customize it, if needed.
  49. X#      (c) Ensure that all other System Defines are commented out.
  50. X#
  51. X# 4) "make"
  52. X#    This will build everything, but will not install it.  If you want
  53. X#    you can install the pieces yourself, or issue the "make install"
  54. X#    command.
  55. X#
  56. X# 4) If you have the command 'file' that uses /etc/magic you can
  57. X#    add the line:
  58. X#    38    string        Spreadsheet    sc/ss file
  59. X#############################################################################
  60. X
  61. X#
  62. X#       Commonly Changed Variables.  Modify as necessary for your site
  63. X#---------------------------------------------------------------------------
  64. X
  65. X# This is where the install step puts the executables.
  66. X# EXDIR        = /site/bin
  67. X  EXDIR        = /usr/local/bin
  68. X
  69. X# This is where the man page goes.
  70. X# MANDIR    = /usr/local/src/man/man1    # reno
  71. X# MANEXT    = 1                # reno
  72. X  MANDIR    = /usr/man/manl
  73. X  MANEXT    = l
  74. X  MANMODE    = 644
  75. X
  76. X# This is where the library file (tutorial) goes.
  77. X# LIBDIR    =/usr/local/share/$(name) # reno
  78. X  LIBDIR    = /usr/local/lib/$(name)
  79. X
  80. X# Set SIGVOID if signal routines are type void.
  81. X# use: SIGVOID=-DSIGVOID for:
  82. X#    System 5.3, SunOS 4.X, VMS, BSD4.4 (reno), and ANSI C Compliant systems
  83. X# use: SIGVOID=         for:
  84. X#  BSD systems (excluding reno, BSD4.4), and the UNIXPC 'cc'
  85. X  SIGVOID    =-DSIGVOID
  86. X# SIGVOID    =
  87. X
  88. X# Set RE_COMP if you have the re_comp/re_exec regular expression routines
  89. X# (most BSD based systems do).
  90. X  RE_COMP    =-DRE_COMP
  91. X##RE_COMP    =
  92. X
  93. X# Set REGCMP if you have the regcmp/regex regular expression routines
  94. X# (most System V based systems do)
  95. X##REGCMP    =-DREGCMP
  96. X  REGCMP    =
  97. X
  98. X# This is the name of a pager like "more".
  99. X# "pg" may be appropriate for SYSV.
  100. X  DFLT_PAGER    =-DDFLT_PAGER=\"less\"
  101. X# DFLT_PAGER    =-DDFLT_PAGER=\"more\"    # generic && reno
  102. X
  103. X# If you get errors about fmod being undefined when you try to
  104. X# compile, then define NO_FMOD (most likely BSD4.3 and Mt Xinu).
  105. X# FMOD        =-DNO_FMOD
  106. X  FMOD        =
  107. X
  108. X#
  109. X#       Variables which are NOT commonly changed.  
  110. X#---------------------------------------------------------------------------
  111. X
  112. X# Specify the name of the program.
  113. X# All documentation and installation keys on this value.
  114. X  name        = ss
  115. X  NAME        = SS
  116. X
  117. X# Set NOUNGETCH for lex.c if you don't have ungetch() in your
  118. X# curses library.
  119. X  NOUNGETCH = -DNOUNGETCH
  120. X# NOUNGETCH = 
  121. X
  122. X# Set SIMPLE for lex.c if you don't want arrow keys or lex.c blows up
  123. X  SIMPLE    =
  124. X# SIMPLE    =-DSIMPLE
  125. X
  126. X# Set BROKENCURSES if your curses has the nl/nonl bug
  127. X# if it does and you don't set BROKENCURSES, the display will
  128. X# be staggered across the screen. Also try IDLOKBAD below.
  129. X  BROKENCURSES    =
  130. X# BROKENCURSES    =-DBROKENCURSES
  131. X
  132. X# Set DOBACKUPS if you would like a backup copy of a source file on a save
  133. X# DOBACKUPS    =
  134. X  DOBACKUPS    =-DDOBACKUPS
  135. X
  136. X# Set INTERNATIONAL if you need 8 bit characters.  You should
  137. X# not set this if you are running 5.3.0.  I think it is OK in 5.3.1.
  138. X# INTERNATIONAL    =-DINTERNATIONAL
  139. X  INTERNATIONAL    =
  140. X
  141. X# Set IEEE_MATH if you need setsticky() calls in your signal handlers
  142. X# IEEE_MATH    =-DIEEE_MATH
  143. X  IEEE_MATH    =
  144. X
  145. X# Set RINT=-DRINT if you do not have rint() in math.h
  146. X# Set RINT=    on/with (they have rint):
  147. X#    SunOS 4.0.3c, 4.1.1 compiler
  148. X#    BSD4.4 (reno)
  149. X  RINT    =
  150. X# RINT    =-DRINT
  151. X
  152. X# this is the name to save back ups in
  153. X  SAVE        =-DSAVENAME=\"$(NAME).SAVE\"
  154. X
  155. X# Path to crypt, do NOT define if you don't have crypt.
  156. X# most systems:
  157. X##CRYPT        =-DCRYPT_PATH=\"/bin/crypt\"
  158. X# BSD:
  159. X# CRYPT        =-DCRYPT_PATH=\"/usr/bin/crypt\"
  160. X# other people?:
  161. X# CRYPT        =-DCRYPT_PATH=\"/usr/local/bin/crypt\"
  162. X
  163. X# If your system doesn't have notimeout() in curses define NONOTIMEOUT
  164. X# NONOTIMEOUT    =
  165. X  NONOTIMEOUT    =-DNONOTIMEOUT
  166. X
  167. X# flags for lint
  168. X  LINTFLAGS    =-abchxv
  169. X
  170. X## # Format of quick reference guide generated by $(name)qref
  171. X## # Leave undefined for normal text output.
  172. X## # QREF_FMT=
  173. X##   QREF_FMT=-DTROFF
  174. X
  175. X
  176. X# *** SPECIAL NOTES ***
  177. X# HP-UX 7.0: Do NOT use -O
  178. X#    (known broken, try sc's boolean operators if you wish)
  179. X#
  180. X# **** SYSV curses bugs... ****
  181. X# Try setting IDLOKBAD to fix (with an empty spreadsheet):
  182. X#    a) Redrawing the bottom half of the screen when you
  183. X#         move between row 9 <-> 10
  184. X#    b) the highlighted row labels being trash when you
  185. X#        move between row 9 <-> 10
  186. X#    c) On an xterm on Esix Rev. D+ from eating lines
  187. X#         -goto (or move) a few lines (or more) past the bottom
  188. X#         of the screen, goto (or move) to the top line on the
  189. X#         screen, move upward and the current line is deleted, the
  190. X#         others move up even when they should not, check by
  191. X#         noticing the rows become 2, 3, 40, 41, 42... (etc).
  192. X#    Known systems/terminfos w/ curses problems:
  193. X#    {Esix Rev. D+, AT&T SysV3.2.1}:at386-m,xterm, HP-UX7.0:(not sure)
  194. X  IDLOKISBAD    =-DIDLOKBAD
  195. X# IDLOKISBAD    =
  196. X
  197. X# If you don't have idlok() in your curses define NOIDLOK
  198. X  NO_IDLOK=
  199. X# NO_IDLOK=-DNOIDLOK
  200. X
  201. X# If moving right off the screen causes the screen to not redraw
  202. X# properly, define RIGHT_CBUG to get around a curses problem on some
  203. X# boxes, this forces screen redraws when going right off the screen
  204. X  RIGHTBUG    =
  205. X# RIGHTBUG    =-DRIGHT_CBUG
  206. X
  207. X# IF you have problems w/ your yacc try bison, Berkeley yacc, or
  208. X# some other yacc. Some systems don't allow you to
  209. X# increase the number of terminals (mostly AT&T), SCO's does though.
  210. X# NOTE: Do not use with bison 1.16! Get a new version...
  211. X# YACC        =yacc
  212. X  YACC        =bison -y
  213. X
  214. X# MS-DOS needs y_tab instead of the normal y.tab
  215. X# YTAB            =y_tab
  216. X  YTAB            =y.tab
  217. X
  218. X# Command to use to make temporary copies of some source files.
  219. X  LN        =ln
  220. X# LN        =ln -s
  221. X# LN        =cp
  222. X
  223. X#    SYSTEM DEFINES
  224. X#---------------------------------------------------------------------------
  225. X# Locate your System in the following ALPHABETICAL list of systems, and
  226. X# uncomment the defintions relating to it.  See the comments accompanying
  227. X# each system for further information.  
  228. X#
  229. X# **> Make sure that all other systems are commented out! <**
  230. X
  231. X# system AIX V3.1
  232. X#- - - - - - - - - - - - - - - - - - - -
  233. X#CFLAGS        = -O -DSYSV2 -DCHTYPE=int -DNLS
  234. X#LDFLAGS    =
  235. X#LIB        =-lm -lPW -lcurses
  236. X
  237. X# BSD 4.2
  238. X#- - - - - - - - - - - - - - - - - - - -
  239. X#CFLAGS        = -O -DBSD42
  240. X#LDFLAGS    =
  241. X#LIB        =-lm -lcurses -ltermcap
  242. X# with gcc also use:
  243. X#CC        =gcc
  244. X
  245. X# BSD 4.3
  246. X#- - - - - - - - - - - - - - - - - - - -
  247. X#CFLAGS        = -O -DBSD43
  248. X#LDFLAGS    =
  249. X#LIB        =-lm -lcurses -ltermcap
  250. X
  251. X# Microport
  252. X#- - - - - - - - - - - - - - - - - - - -
  253. X#CFLAGS        = -DSYSV2 -O -DUPORT -Ml
  254. X#LDFLAGS    =-Ml
  255. X#LIB        =-lm -lcurses -lPW
  256. X
  257. X# Mips (preliminary, based on System V.3 entry)
  258. X#- - - - - - - - - - - - - - - - - - - -
  259. X# On Mips use: "/usr/bsd43/bin/make"
  260. X# CC            = gcc
  261. X# CFLAGS        = -DSYSV3 -O -I/usr/include -I/usr/include/posix
  262. X# LDFLAGS       = -s
  263. X# YACC          = bison -y
  264. X# LIB           = -lm -lcurses -lPW
  265. X
  266. X# MS-DOS, Microsoft C 5.1 and NDMAKE
  267. X#- - - - - - - - - - - - - - - - - - - -
  268. X#CC        =cl
  269. X#CFLAGS        = -AL -O -Fo$*.o
  270. X#LDFLAGS    =/noi /st:0x4000
  271. X#LIB        =lcurses
  272. X#YACC        =bison -y
  273. X#
  274. X#.SUFFIXES : .o .c
  275. X#.c.o:
  276. X#    $(CC) $(CFLAGS) -c $*.c
  277. X
  278. X# SCO Unix V rel. 3.2.0
  279. X#- - - - - - - - - - - - - - - - - - - -
  280. X#       -compile using rcc, cc does not cope with gram.c
  281. X#       -edit /usr/include/curses.h, rcc does not understand #error
  282. X#       -link: make CC=cc, rcc's loader gets unresolved __cclass, __range
  283. X#               (rather strange,?)
  284. X#CC        =rcc
  285. X#CC        =cc
  286. X#CC        =gcc -fstrength-reduce
  287. X#SIGVOID    =-DSIGVOID
  288. X#CFLAGS        = -O -DSYSV3
  289. X#LDFLAGS    =
  290. X#LIB        =-lm -lcurses -ltinfo -lPW
  291. X#YACC        =yacc -Sm10000
  292. X
  293. X# SCO Unix 3.2.2 and ODT 1.1
  294. X#- - - - - - - - - - - - - - - - - - - -
  295. X#CC        =cc
  296. X#CFLAGS        = -O -DSYSV3
  297. X#LDFLAGS    =
  298. X#LIB        =-lm -lcurses -lPW -lmalloc -lc_s
  299. X#YACC        =yacc -Sm10000
  300. X
  301. X# Sequent boxes
  302. X#- - - - - - - - - - - - - - - - - - - -
  303. X#CC        =atscc
  304. X#CFLAGS        =-O -DBSD42
  305. X#LDFLAGS    = 
  306. X#LIB        =-lm -lcurses  -ltermcap
  307. X#PSCLIB        =-lseq
  308. X# with gcc also use:
  309. X#CC        =gcc
  310. X#CFLAGS        = -O -DBSD42 -pipe
  311. X
  312. X# Sun Systems
  313. X#- - - - - - - - - - - - - - - - - - - -
  314. X# Use this for SunOS 4.X if you have the System V package installed.
  315. X# This will link with the System V curses which is preferable to the
  316. X# BSD curses (especially helps scrolling on slow (9600bps or less)
  317. X# serial lines).
  318. X#
  319. X# Be sure to define SIGVOID and RE_COMP above.
  320. X# 
  321. X# CC        = /usr/5bin/cc
  322. X# CFLAGS    = -O -DSYSV3 
  323. X# LDFLAGS    =
  324. X# LIB        = -lm -lcurses 
  325. X
  326. X### Try gcc 2.0
  327. X# CC        =/usr/gnu/bin/gcc
  328. X# CFLAGS    = -O -DSYSV3  -I/usr/5include
  329. X# LDFLAGS    = -L/usr/5lib
  330. X
  331. X# Ultrix Systems (preliminary - Ultrix V4.2a, Rev. 47)
  332. X#- - - - - - - - - - - - - - - - - - - -
  333. X# The following comments came with `sc'.
  334. X#       # For ULTRIX: define the BSD4.2 section and SIGVOID above
  335. X#       #   tdw@cl.cam.ac.uk tested on Ultrix 3.1C-0
  336. X# I'm not _quite_ listening to them.  Specifically: I use gcc and am
  337. X# using the System V curses -- cursesX -- in Ultrix.  Art Mulder
  338. X  CC        = /usr/gnu/bin/gcc
  339. X  CFLAGS    = -O -DULTRIX
  340. X  LIB        = -lm -lcursesX
  341. X  LDFLAGS    =
  342. X
  343. X# system V.2 (includes: HP-UX 7.05, UNIXPC)
  344. X#- - - - - - - - - - - - - - - - - - - -
  345. X#CFLAGS        = -O -DSYSV2 
  346. X#LDFLAGS    =
  347. X#LIB        =-lm -lPW -lcurses
  348. X# with gcc on a Sequent also use:
  349. X#CC        =att gcc
  350. X#CFLAGS        =  -DSYSV2 -g -pipe -traditional
  351. X
  352. X# system V.3
  353. X#- - - - - - - - - - - - - - - - - - - -
  354. X##CFLAGS    =  -DSYSV3 -O
  355. X##LDFLAGS    = -s
  356. X##CFLAGS    =  -DSYSV3 -g
  357. X##LDFLAGS    = -g
  358. X##LIB        =-lm -lcurses -lPW
  359. X
  360. X# with gcc also use:
  361. X#CC        =gcc
  362. X#CFLAGS        = -DSYSV3 -O -pipe -traditional
  363. X#YACC        =bison -y
  364. X# debugging bison (bison 1.16 is broken)
  365. X#CFLAGS=  -DSYSV3 -g -pipe -traditional
  366. X#YACC=bison -y -v -t -l
  367. X
  368. X
  369. X# system V.4
  370. X#- - - - - - - - - - - - - - - - - - - -
  371. X#CFLAGS        =  -DSYSV4 -DSYSV3 -O
  372. X#LDFLAGS    = -s
  373. X#LIB        =-lm -lcurses -lgen
  374. X# with gcc also use:
  375. X#CC        =gcc
  376. X#CFLAGS        =  -DSYSV3 -O -pipe
  377. X
  378. X# VENIX
  379. X#- - - - - - - - - - - - - - - - - - - -
  380. X#CFLAGS        = -DVENIX -DBSD42 -DV7
  381. X#LDFLAGS    = -z -i 
  382. X#LIB        =-lm -lcurses -ltermcap
  383. X
  384. X# XENIX Version 2.3
  385. X#- - - - - - - - - - - - - - - - - - - -
  386. X#CFLAGS        = -O -DSYSIII -DXENIX2_3
  387. X#LDFLAGS    = -i
  388. X#LIB        =-lm -lcurses -ltermcap
  389. X
  390. X# XENIX system III 
  391. X#- - - - - - - - - - - - - - - - - - - -
  392. X#CFLAGS        = -O -DSYSIII
  393. X#LDFLAGS    = -i
  394. X#LIB        =-lm -lcurses -ltermcap
  395. X
  396. X#
  397. X#       Some Definitions used in compiling/installing
  398. X#---------------------------------------------------------------------------
  399. X
  400. X# All of the source files
  401. XSRC=Makefile cmds.c crypt.c eres.sed format.c gram.y interp.c \
  402. X    lex.c pss.c range.c ss.c ss.h screen.c sres.sed version.c \
  403. X    vmtbl.c xmalloc.c ctrl.c disprange.c getinput.c \
  404. X        menu.c menu_file.c menu_edit.c menu_cell.c menu_rowcol.c \
  405. X        menu_name.c menu_misc.c menu_macro.c help.c
  406. X
  407. X# The objects
  408. XOBJS=cmds.o crypt.o format.o gram.o interp.o lex.o range.o ss.o \
  409. X    screen.o version.o vmtbl.o xmalloc.o ctrl.o \
  410. X        disprange.o getinput.o \
  411. X    menu.o menu_file.o menu_edit.o menu_cell.o menu_rowcol.o \
  412. X    menu_name.o menu_misc.o menu_macro.o help.o
  413. X
  414. X# The documents in the Archive
  415. XDOCS=README ss.man pss.doc VMS_NOTES torev build.com
  416. X
  417. X
  418. X#       MAIN MAKE TARGETS
  419. X#---------------------------------------------------------------------------
  420. X
  421. X# Default Make Target:  Make ``ss'' and ``pss''.
  422. X# Nothing is installed.
  423. X#- - - - - - - - - - - - - - - - - - - -
  424. X
  425. Xall:    $(name) p$(name) 
  426. X
  427. X
  428. X# Make ``ss''
  429. X#- - - - - - - - - - - - - - - - - - - -
  430. X
  431. X$(name):$(PAR)     $(OBJS)
  432. X    $(CC) ${LDFLAGS} ${OBJS} ${LIB} -o $(name)
  433. X
  434. X# Alternative link for MS-DOS
  435. X# $(name):     $(OBJS)
  436. X#    link ${LDFLAGS} ${OBJS},$(name),,${LIB};
  437. X
  438. X
  439. X# Make ``pss''
  440. X#- - - - - - - - - - - - - - - - - - - -
  441. X
  442. Xp$(name):    pss.c pvmtbl.o pxmalloc.o
  443. X    $(CC) $(CFLAGS) ${LDFLAGS} -o p$(name) pss.c pvmtbl.o pxmalloc.o ${PSCLIB}
  444. X
  445. X# Alternative link for MS-DOS (NB: MSC 5.1 has no getopt.c)
  446. X# p$(name):    pss.o pvmtbl.o pxmalloc.o getopt.o
  447. X#     link ${LDFLAGS} pss.o pvmtbl.o pxmalloc.o getopt.o,p$(name);
  448. X
  449. X# Documentation
  450. X#- - - - - - - - - - - - - - - - - - - -
  451. X
  452. X# 1) convert ``ss.man'' to ``ss.l''
  453. X#    - replace all occurances of ``pname'' with ``ss'' (or whatever
  454. X#      the NAME is above)
  455. X#    - insert the proper revision number
  456. X
  457. Xman:    ss.man
  458. X    name=$(name) NAME=$(NAME) LIBDIR=$(LIBDIR) sh torev ss.man > $(name).$(MANEXT)
  459. X
  460. X# - Do the same for ``pss.doc''
  461. Xpman:    pss.doc
  462. X    name=$(name) NAME=$(NAME) LIBDIR=$(LIBDIR) sh torev pss.doc > p$(name).$(MANEXT)
  463. X#      Make Install
  464. X#---------------------------------------------------------------------------
  465. X
  466. Xinstall: $(EXDIR)/$(name) $(EXDIR)/p$(name) \
  467. X     $(MANDIR)/$(name).$(MANEXT) $(MANDIR)/p$(name).$(MANEXT)
  468. X
  469. X$(EXDIR)/$(name): $(name)
  470. X    cp $(name) $(EXDIR)
  471. X    strip $(EXDIR)/$(name)
  472. X
  473. X$(EXDIR)/p$(name): p$(name)
  474. X    cp p$(name) $(EXDIR)
  475. X    strip $(EXDIR)/p$(name)
  476. X
  477. X$(MANDIR)/$(name).$(MANEXT): man
  478. X    cp $(name).$(MANEXT) $(MANDIR)/$(name).$(MANEXT)
  479. X    chmod $(MANMODE) $(MANDIR)/$(name).$(MANEXT)
  480. X
  481. X$(MANDIR)/p$(name).$(MANEXT): pman
  482. X    cp p$(name).$(MANEXT) $(MANDIR)/p$(name).$(MANEXT)
  483. X    chmod $(MANMODE) $(MANDIR)/p$(name).$(MANEXT)
  484. X
  485. X
  486. X#     SUPPLEMENTARY MAKE TARGETS
  487. X#---------------------------------------------------------------------------
  488. X# (These are usually not made directly themselves)
  489. X
  490. X
  491. X# ``ss'' supplementary objects
  492. X#- - - - - - - - - - - - - - - - - - - -
  493. X
  494. Xgram.c:    gram.y
  495. X    $(YACC) -d gram.y
  496. X    mv $(YTAB).c gram.c
  497. X
  498. X$(YTAB).h:    gram.y
  499. X
  500. Xcmds.o: cmds.c ss.h
  501. X    $(CC) ${CFLAGS} ${DOBACKUPS} ${CRYPT} -c cmds.c
  502. X
  503. Xcrypt.o: crypt.c ss.h
  504. X    $(CC) ${CFLAGS} ${CRYPT} ${DOBACKUPS} -c crypt.c
  505. X
  506. Xformat.o: format.c
  507. X
  508. Xinterp.o:    interp.c ss.h
  509. X    $(CC) ${CFLAGS} ${IEEE_MATH} ${SIGVOID} ${RINT} ${RE_COMP} ${REGCMP} ${FMOD} -c interp.c
  510. X
  511. Xgram.o:    ss.h $(YTAB).h gram.c
  512. X    $(CC) ${CFLAGS} -c gram.c
  513. X    sed < gram.y > experres.h -f eres.sed
  514. X    sed < gram.y > statres.h -f sres.sed
  515. X
  516. Xlex.o:    ss.h $(YTAB).h gram.o lex.c
  517. X    $(CC) ${CFLAGS} ${NOUNGETCH} ${SIMPLE} ${IEEE_MATH} ${SIGVOID} ${NONOTIMEOUT} -c lex.c
  518. X
  519. Xrange.o: range.c ss.h
  520. X
  521. Xss.o:    ss.h ss.c menu.h disprange.h ctrl.h
  522. X    $(CC) ${CFLAGS} ${DFLT_PAGER} $(RIGHTBUG) ${SIGVOID} ${SAVE} -c ss.c
  523. X
  524. Xdisprange.o:    ss.h disprange.c ctrl.h
  525. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c disprange.c
  526. X
  527. Xmenu.o:    ss.h menu.c ctrl.h menu_file.h menu_edit.h menu_cell.h\
  528. X    menu_rowcol.h menu_name.h menu_misc.h menu_macro.h
  529. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c menu.c
  530. X
  531. Xmenu_file.o:    ss.h menu_file.c getinput.h disprange.h
  532. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c menu_file.c
  533. X
  534. Xmenu_edit.o:    ss.h menu_edit.c getinput.h disprange.h
  535. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c menu_edit.c
  536. X
  537. Xmenu_cell.o:    ss.h menu_cell.c getinput.h 
  538. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c menu_cell.c
  539. X
  540. Xmenu_rowcol.o:    ss.h menu_rowcol.c getinput.h 
  541. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c menu_rowcol.c
  542. X
  543. Xmenu_misc.o:    ss.h menu_misc.c getinput.h 
  544. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c menu_misc.c
  545. X
  546. Xmenu_macro.o:    ss.h menu_macro.c getinput.h 
  547. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c menu_macro.c
  548. X
  549. Xmenu_name.o:    ss.h menu_name.c getinput.h 
  550. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c menu_name.c
  551. X
  552. Xgetinput.o:    ss.h getinput.h
  553. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c getinput.c
  554. X
  555. Xctrl.o:    ss.h ctrl.c ctrl.h menu.h disprange.h menu_cell.h menu_misc.h
  556. X    $(CC) ${CFLAGS} ${DFLT_PAGER} ${SIGVOID} ${SAVE} -c ctrl.c
  557. X
  558. Xscreen.o:    ss.h screen.c
  559. X    $(CC) ${CFLAGS} ${BROKENCURSES} ${IDLOKISBAD} ${INTERNATIONAL} ${RIGHTBUG} ${SIGVOID} -c screen.c
  560. X
  561. Xhelp.o: ss.h help.c
  562. X    $(CC) ${CFLAGS} -c help.c
  563. X
  564. X# ``pss'' supplementary objects
  565. X#- - - - - - - - - - - - - - - - - - - -
  566. X
  567. Xpvmtbl.c: vmtbl.c
  568. X    -rm -f pvmtbl.c
  569. X    ${LN} vmtbl.c pvmtbl.c
  570. X
  571. Xpvmtbl.o: ss.h pvmtbl.c
  572. X    $(CC) ${CFLAGS} -c -DPSC pvmtbl.c
  573. X
  574. Xpxmalloc.c: xmalloc.c
  575. X    -rm -f pxmalloc.c
  576. X    ${LN} xmalloc.c pxmalloc.c
  577. X
  578. Xpxmalloc.o: ss.h pxmalloc.c
  579. X    $(CC) ${CFLAGS} -c -DPSC pxmalloc.c
  580. X
  581. X
  582. X#     OTHER MAKE TARGETS
  583. X#---------------------------------------------------------------------------
  584. X
  585. Xclean:
  586. X    rm -f *.o *res.h $(YTAB).h debug core gram.c $(name).$(MANEXT) \
  587. X    $(name).$(MANEXT) p$(name).man p$(name).$(MANEXT) y.output \
  588. X    pxmalloc.c pvmtbl.c qhelp.c y_tab.h
  589. X
  590. Xspotless: clean
  591. X    rm -f $(name) p$(name) 
  592. X
  593. X#---------------------------------------------------------------------------
  594. X#       end
  595. END_OF_FILE
  596.   if test 16515 -ne `wc -c <'ss_12b/Makefile.ultrix'`; then
  597.     echo shar: \"'ss_12b/Makefile.ultrix'\" unpacked with wrong size!
  598.   fi
  599.   # end of 'ss_12b/Makefile.ultrix'
  600. fi
  601. if test -f 'ss_12b/menu.c' -a "${1}" != "-c" ; then 
  602.   echo shar: Will not clobber existing file \"'ss_12b/menu.c'\"
  603. else
  604.   echo shar: Extracting \"'ss_12b/menu.c'\" \(15391 characters\)
  605.   sed "s/^X//" >'ss_12b/menu.c' <<'END_OF_FILE'
  606. X/**********************************************************************
  607. X* %M%
  608. X* ss     :    A SpreadSheet Program
  609. X*
  610. X* Art's Spreadsheet program.          Art Mulder ( art@cs.ualberta.ca )
  611. X* University of Alberta, Department of Computing Science.
  612. X***********************************************************************
  613. X* Menu Driver
  614. X***********************************************************************
  615. X* Functions for displaying the command menus and processing the 
  616. X* related input.
  617. X* NOTE: this is not the ONLY interface to the user.
  618. X* These functions are used exclusively by ss.c
  619. X**********************************************************************/
  620. X#ifndef lint
  621. X  static char Sccsid[] = "%W% %G%";
  622. X#endif
  623. X
  624. X/*
  625. X * Include files
  626. X */
  627. X#include <stdio.h>
  628. X#include <sys/types.h>
  629. X#include <signal.h>
  630. X#include "curses_stuff.h"
  631. X#include <ctype.h>
  632. X
  633. X/*
  634. X** #ifdef BSD42
  635. X** # include <strings.h>
  636. X** #else
  637. X** # ifndef SYSIII
  638. X** #   include <string.h>
  639. X** # endif
  640. X** #endif
  641. X*/
  642. X
  643. X#include "ss.h"
  644. X#include "keys.h"
  645. X#include "menu.h"
  646. X#include "menu_file.h"
  647. X#include "menu_edit.h"
  648. X#include "menu_cell.h"
  649. X#include "menu_rowcol.h"
  650. X#include "menu_misc.h"
  651. X#include "menu_macro.h"
  652. X
  653. X#include "menu_name.h"
  654. X
  655. X
  656. X/*    Function Prototypes (lib func's)
  657. X *----------------------------------------------------------------------
  658. X */
  659. X    extern    char    *getenv();
  660. X
  661. X/*    External Global variables
  662. X *----------------------------------------------------------------------
  663. X */
  664. X    extern int showneed;    /* From main.c */
  665. X    extern int  showrange;    /* ditto */
  666. X    extern int running;        /* ditto */
  667. X    extern int anychanged;     /* ditto */
  668. X    extern int showexpr;    /* ditto */
  669. X    extern int ClearScreen;    /* ditto */
  670. X
  671. X    extern int lastmx, lastmy;    /* From screen.c */
  672. X    extern int lastcol, lcols;    /* ditto */
  673. X
  674. X/*    Internal Function Prototypes
  675. X ***********************************************************************
  676. X */
  677. X
  678. Xstatic int Menu();
  679. Xstatic void FileMenu();
  680. Xstatic void EditMenu();     
  681. Xstatic void CellMenu();
  682. Xstatic void RowColumnMenu();
  683. Xstatic void NameMenu();
  684. Xstatic void MiscMenu();
  685. Xstatic void MacroMenu();
  686. X
  687. X/*    Externally Accessible Functions
  688. X ***********************************************************************
  689. X */
  690. X
  691. Xvoid MainMenu()
  692. X/*----------------------------------------------------------------------
  693. X** Top command level/menu.  Invoked by the "/" command
  694. X*/
  695. X{
  696. X#   define MainSize 8
  697. X    static char MainKeys[] =  {'F',   'E',    'C',   'R', 'O', 'M', 'A', 'Q'};
  698. X    static char *MainDesc[] = {"File","Edit", "Cell","Row", "Column","Misc",
  699. X        "Macro", "Quit"};
  700. X
  701. X    switch (Menu(MainSize, MainKeys, MainDesc, MAINHELP)) {
  702. X
  703. X    case 'F':    FileMenu();        break;
  704. X    case 'E':    EditMenu();        break;
  705. X    case 'C':    CellMenu();        break;
  706. X      
  707. X    case 'R':    RowColumnMenu(TRUE);    break; /* TRUE = Row */
  708. X    case 'O':    RowColumnMenu(FALSE);    break;
  709. X      
  710. X    case 'M':    MiscMenu();        break;
  711. X    case 'A':    MacroMenu();        break;
  712. X    case 'Q':    FileQuit();        break;
  713. X    }
  714. X} /* MainMenu() */
  715. X
  716. X
  717. X/*    Internal Functions
  718. X ***********************************************************************
  719. X */
  720. X
  721. X/**
  722. X ** ADD message to Menu() so we can say
  723. X ** "Insert Row or Column", optionally        ???????????
  724. X **/
  725. X
  726. Xstatic int Menu(size, keys, keydesc, helpcontext)
  727. X/*----------------------------------------------------------------------
  728. X** The Main Menu display function.  Displays a menu and does rough
  729. X** preprocessign of the input.  Ensures that only valid input is received,
  730. X** also deals with aborts and help requests.
  731. X**
  732. X** NOTE: The Keys should all be in uppercase.  (if they are letters).
  733. X*/
  734. X    int     size;        /* # of elements in keys & keydesc arrays */
  735. X    char    keys[];        /* Menu keys */
  736. X    char    *keydesc[];    /* Corresponding descriptions of keys */
  737. X    int        helpcontext;    /* A flag to pass along to help() */
  738. X/*
  739. X * Size must be a correct number.  Anything else has an undefined effect.
  740. X * No checking is made to ensure that all the keys & descriptions fit
  741. X * across the screen.
  742. X */
  743. X{
  744. X    int x;
  745. X    int  ValidInput;        /* Loop Control */
  746. X    int c;            /* input */
  747. X
  748. X    FullUpdate++;        /* to clear the message line */
  749. X
  750. X/*
  751. X * The Command line is the top line of the display.    starts at(0,0)
  752. X * The message/error line is the second line.        starts at(1,0)
  753. X */
  754. X
  755. X/*
  756. X * 1) Display the Menu on the Command/error line 
  757. X *
  758. X * Given a size of 3, and a set of keys and descriptions like this:
  759. X *     key[0] = 'f',        key[1] = 'e',        key[2] = 'o',
  760. X *     keydesc[0] = "File", keydesc[1] = "Edit", keydesc[2] = "Options".
  761. X * A menu looking like this would be displayed:
  762. X *    f:File e:Edit o:Options
  763. X * Except the keys would be highlighted.
  764. X */
  765. X    (void)move(0,0);         /* Get into position */
  766. X    (void)clrtoeol();         /* Clear line */
  767. X    for (x=0; x < size; x++) {
  768. X    addch(keys[x] | A_STANDOUT);    /* Display key, highlighted */
  769. X    addch(':');            /* Separator */
  770. X    addstr(keydesc[x]);        /* Key Description */
  771. X    addch(' ');
  772. X    }
  773. X
  774. X/* 2) Display a Prompt on the Message Line */
  775. X    Message("Enter Command, or <Space> to Abort: ");
  776. X
  777. X/*
  778. X * 3) Get and Process input
  779. X *
  780. X * Valid Input:
  781. X * a)    A '?' will invoke help.  Pass along 'helpcontext' so that help()
  782. X *    knows from where it was invoked, so context-sensitive help can
  783. X *    be provided.
  784. X * b)    <Space> or kABORT will Abort the menu.
  785. X * c)    Any of the keys (Case is unimportant) will be accepted as valid
  786. X *    and be returned to the calling routine for processing there.
  787. X * d)    Anything else will result in an error (beep!)
  788. X */
  789. X    for (;;) {            /* Forever... */
  790. X    c = nmgetch();
  791. X    switch (c) {
  792. X
  793. X    case '?':        /* Help */
  794. X        /** Context sensitive help **/        /** WRITE THIS **/
  795. X        /* refresh needed? */
  796. X        break;
  797. X    case kABORT:        /* Abort current command */
  798. X    case ' ':
  799. X        ClearMessage;
  800. X/**        (void) refresh(); **/
  801. X        return(' ');
  802. X        break;
  803. X    default:
  804. X        c = (char) toupper(c);
  805. X        for (x=0; x < size; x++) {    /* Check if input is valid key */
  806. X        if ( c == keys[x]) {
  807. X            ClearMessage;
  808. X            return(c);
  809. X        }
  810. X        }
  811. X        beep();        /* error bell */
  812. X        break;
  813. X    }
  814. X    } 
  815. X    /* NOTREACHED */
  816. X} /* Menu() */
  817. X
  818. Xstatic void FileMenu()
  819. X/*----------------------------------------------------------------------
  820. X** File command level/menu.  Invoked from the Main menu
  821. X*/
  822. X{
  823. X#   define FileSize     8
  824. X    static char FileKeys[]  = {'N',  'L',   'M',    'S',   'A', 'W','T','Q'};
  825. X    char tbl_mode[MAXSTR];
  826. X/* 
  827. X * Set up menu to show the current mode of ``Tbl Save''
  828. X *    - end up with something like ``Tbl Save(TeX)''
  829. X */
  830. X    strcpy(tbl_mode, "Tbl Save(");
  831. X    switch (tbl_style) {
  832. X    case TBL:        strcat(tbl_mode, "tbl)");    break;
  833. X    case TEX:        strcat(tbl_mode, "TeX)");    break;
  834. X    case LATEX:        strcat(tbl_mode, "LaTeX)");    break;
  835. X    case SLATEX:     strcat(tbl_mode, "SLaTeX)");    break;
  836. X    case FRAME:        strcat(tbl_mode, "FrameMaker)"); break;
  837. X    default:        strcat(tbl_mode, "?)");        break;
  838. X    }
  839. X
  840. X    {
  841. X#ifdef __STDC__                               /* Ansi C can handle this: */
  842. X    char *FileDesc[] = {"New", "Load", "Merge", "Save", "Save As",
  843. X    "Write txt", tbl_mode, "Quit"};
  844. X#else                                         /* Non-Ansi Can't. */
  845. X    static char *FileDesc[] = {"New", "Load", "Merge", "Save", "Save As",
  846. X        "Write txt", "", "Quit"};
  847. X    FileDesc[6] = tbl_mode;
  848. X#endif
  849. X
  850. X    switch (Menu(FileSize, FileKeys, FileDesc, FILEHELP)) {
  851. X
  852. X    case 'N':            /* New */
  853. X        Message("** New -> Unimplemented");
  854. X        break;
  855. X    case 'L':     FileLoad();         break;
  856. X    case 'M':    FileMerge();         break;
  857. X    case 'S':    FileSave();         break;
  858. X    case 'A':    FileSaveAs();         break;
  859. X    case 'W':    FileWriteTxt();     break;
  860. X    case 'T':    FileTblSave(tbl_mode);     break;
  861. X    case 'Q':    FileQuit();        break;
  862. X
  863. X    } /* switch */
  864. X    } /* filemenu declaration */
  865. X
  866. X} /* FileMenu() */
  867. X
  868. Xstatic void EditMenu()
  869. X/*----------------------------------------------------------------------
  870. X** Edit command level/menu.  Invoked from the Main menu
  871. X** - commands that operate either on the entire worksheet,
  872. X**   or on a range of cells.  (see the range commands of sc)
  873. X*/
  874. X{
  875. X#   define WorkSize     8
  876. X    static char WorkKeys[]  ={'C','E','N','L','U','F','I','V'};
  877. X    static char *WorkDesc[] ={"Copy", "Erase", "Name", "Lock", "Unlck",
  878. X                  "Format", "Fill", "Valueize"};
  879. X
  880. X    switch (Menu(WorkSize, WorkKeys, WorkDesc, WORKHELP)) {
  881. X
  882. X    case 'C':    EditCopy();    break;
  883. X    case 'E':     EditErase();    break;
  884. X    case 'N':    NameMenu();    break;
  885. X    case 'L':    EditLock();    break;
  886. X    case 'U':     EditUnLock();    break;
  887. X    case 'F':    EditFormat();    break;
  888. X    case 'I':    EditFill();    break;
  889. X    case 'V':    EditValueize();    break;
  890. X    }
  891. X
  892. X} /* EditMenu() */
  893. X
  894. X
  895. Xstatic void CellMenu()
  896. X/*----------------------------------------------------------------------
  897. X** Cell command level/menu.  Invoked from the Main menu
  898. X*/
  899. X{
  900. X#   define CellSize     5
  901. X    static char CellKeys[]  ={'G',    'M',    'C', 'L', 'V'};
  902. X    static char *CellDesc[] ={"Goto", "Mark", "Copy marked cell",
  903. X                  "edit Label", "edit Value"};
  904. X
  905. X    switch (Menu(CellSize, CellKeys, CellDesc, CELLHELP)) {
  906. X/**   case 'E':    CellErase();        break; **/
  907. X      case 'G':    CellGoto();        break;    
  908. X      case 'M':    CellMark();        break;
  909. X      case 'C':    CellCopy();        break;
  910. X      case 'L':    CellEditLabel();    break;
  911. X      case 'V':    CellEditValue();    break;
  912. X    }
  913. X} /* CellMenu() */
  914. X
  915. X
  916. Xstatic void RowColumnMenu(IsRow)
  917. X/*----------------------------------------------------------------------
  918. X** Row & Column command level/menu.  Invoked from the Main menu
  919. X*/
  920. X    int IsRow;
  921. X{
  922. X    /*
  923. X     * The Row & the Column Menu are *ALMOST* identical.
  924. X     * "Format: is a Column option only.
  925. X     */
  926. X#   define RowSize     8
  927. X    static char RowKeys[]  ={'I','D','Y','M','C','H','S','V'};
  928. X    static char *RowDesc[] ={"Insert", "Delete", "Yank", "Merge", "Copy",
  929. X                 "Hide", "Show", "Valueize"};
  930. X#   define ColSize     9
  931. X    static char ColKeys[]  ={'I','D','Y','M','C','H','S','V','F'};
  932. X    static char *ColDesc[] ={"Insert", "Delete", "Yank", "Merge", "Copy",
  933. X                 "Hide", "Show", "Valueize","Fmt"};
  934. X
  935. X    int menuchoice;
  936. X
  937. X    if (IsRow == TRUE)        /* Processing a Row */
  938. X    menuchoice = Menu(RowSize, RowKeys, RowDesc, ROWHELP);
  939. X    else            /* Processing a Column */
  940. X    menuchoice = Menu(ColSize, ColKeys, ColDesc, ROWHELP);
  941. X    
  942. X    switch (menuchoice) {
  943. X
  944. X      case 'I':    RCInsert(IsRow);    break; /* Insert */
  945. X      case 'D': RCDelete(IsRow);    break; /* Delete */
  946. X      case 'Y': RCYank(IsRow);        break; /* Yank */
  947. X      case 'M': RCMerge();        break; /* Merge */
  948. X      case 'C': RCCopy(IsRow);        break; /* Copy */
  949. X      case 'H': RCHide(IsRow);        break; /* Hide */
  950. X      case 'S': RCShow(IsRow);        break; /* Show */
  951. X      case 'V': RCValueize(IsRow);    break; /* Valueize */
  952. X      case 'F': ColFormat();        break; /* Format Column */
  953. X    }
  954. X
  955. X} /* RowColumnMenu() */
  956. X
  957. X
  958. Xstatic void NameMenu()
  959. X/*----------------------------------------------------------------------
  960. X** Name command level/sub-menu.  Invoked from the Top-Level Edit menu.
  961. X*/
  962. X{
  963. X#   define NSize     3
  964. X    static char NKeys[]  ={'D','E','S'};
  965. X    static char *NDesc[] ={"Define Name", "Erase Name", "Show Names"};
  966. X
  967. X    switch (Menu(NSize, NKeys, NDesc, WNHELP)) {
  968. X
  969. X      case 'D':    NameDefine();    break; /* Define a name */
  970. X      case 'E':    NameErase();    break; /* Erase a name */
  971. X      case 'S':    NameShow();    break; /* Show all names */
  972. X    }
  973. X
  974. X} /* NameMenu() */
  975. X
  976. Xstatic void MiscMenu()
  977. X/*----------------------------------------------------------------------
  978. X** Misc commands menu.  Invoked from the Main menu
  979. X*/
  980. X{
  981. X#   define MiscSize     6
  982. X    static char MiscKeys[]  ={'!','O','S','V','E','R'};
  983. X    static char *MiscDesc[] ={ "Shell Cmd", "Options", "Settings",
  984. X                   "show Values", "show Expr.", "Recalc"};
  985. X
  986. X    switch (Menu(MiscSize, MiscKeys, MiscDesc, MISCHELP)) {
  987. X
  988. X      case '!': MiscShell(); break;     /* Execute a Shell command */
  989. X      case 'O': OptionsMenu();    break;     /* WorkSheet - Toggle Options */
  990. X      case 'S': MiscSettings(); break;     /* WorkSheet - Settings */
  991. X      case 'V': MiscRedraw(TRUE); break; /* Hilite Cells containing Values */
  992. X      case 'E': MiscRedraw_Expr(); break; /* Hilite Cells containing Exp'ns */
  993. X      case 'R': MiscRecalc(); break;    /* Recalc Spreadsheet */
  994. X    }
  995. X
  996. X} /* MiscMenu() */
  997. X
  998. X
  999. Xstatic void MacroMenu()
  1000. X/*----------------------------------------------------------------------
  1001. X** Macro command level/menu.  Invoked from the Main menu
  1002. X*/
  1003. X{
  1004. X#   define MacroSize     2
  1005. X    static char MacroKeys[]  = {'R',  'D',    };
  1006. X    static char *MacroDesc[] = {"Run","Define"};
  1007. X
  1008. X    switch (Menu(MacroSize, MacroKeys, MacroDesc, MACROHELP)) {
  1009. X      case 'R':    MacroRun();    break; /* Run macros */
  1010. X      case 'D':    MacroDefine();    break; /* Define path */
  1011. X    }
  1012. X
  1013. X} /* MacroMenu() */
  1014. X
  1015. X/*** SO FAR UPDATED ***/
  1016. X
  1017. Xvoid OptionsMenu()
  1018. X/*----------------------------------------------------------------------
  1019. X** Options command level/menu.  Invoked from the WorkSheet menu
  1020. X** - Toggle options governing the spreadsheet
  1021. X*/
  1022. X{
  1023. X/* Options Menu */
  1024. X#if !defined(VMS) && !defined(MSDOS) && defined(CRYPT_PATH)
  1025. X#   define OptSize     9
  1026. X    static char OptKeys[]  ={'X','A','C','E','L','R','T','Z','$'};
  1027. X    static char *OptDesc[] ={"Encrypt", "Auto", "Cell", "Ext fn's", "Label",
  1028. X                 "Return", "Top", "Limits", "Pre-Scale"};
  1029. X#else    /* No Encryption */
  1030. X#   define OptSize     8
  1031. X    static char OptKeys[]  ={'A','C','E','L','R','T','Z','$'};
  1032. X    static char *OptDesc[] ={"Auto", "Cell", "Ext fn's", "Label", 
  1033. X                 "Return", "Top", "Limits", "Pre-Scale"};
  1034. X#endif
  1035. X
  1036. X    switch (Menu(OptSize, OptKeys, OptDesc, OPTHELP)) {
  1037. X    case 'A':     /* WorkSheet - Options - Auto Recalc */
  1038. X    autocalc ^= 1;
  1039. X    Message("** Automatic recalculation %sabled.", autocalc ? "en":"dis");
  1040. X    break;
  1041. X    case 'C':    /* WorkSheet - Options - Cell Highlight */
  1042. X    showcell = (! showcell);
  1043. X    repaint(lastmx, lastmy, fwidth[lastcol]);
  1044. X    Message ("** Cell highlighting %sabled.", showcell ? "en" : "dis");
  1045. X    break;
  1046. X    case 'E':    /* WorkSheet - Options - Ext Funcs */
  1047. X    extfunc = (! extfunc);
  1048. X    Message ("** External functions %sabled.", extfunc? "en" : "dis");
  1049. X    break;
  1050. X    case 'T':    /* WorkSheet - Options - Top Line Display */
  1051. X    showtop = (! showtop);
  1052. X    Message ("** Top line display of cell contents %sabled.",
  1053. X        showtop ? "en" : "dis");
  1054. X    break;
  1055. X    case 'L':    /* WorkSheet - Options - Auto Labeling */
  1056. X    autolabel = (! autolabel);
  1057. X    Message ("** Autolabel %sabled.", autolabel? "en" : "dis");
  1058. X    break;
  1059. X    case 'R':    /* WorkSheet - Options - Return Action */
  1060. X    ++craction;
  1061. X    if(craction >= 3)
  1062. X        craction = 0;
  1063. X    switch(craction) {
  1064. X    default:
  1065. X        craction = 0;             /* fall through */
  1066. X    case 0:
  1067. X        Message("** After a <CR> the Cell Cursor stays put.");
  1068. X        break;
  1069. X    case CRROWS:
  1070. X        Message("** After a <CR> the Cell Cursor moves down one row.");
  1071. X        break;
  1072. X    case CRCOLS:
  1073. X        Message("** After a <CR> the Cell Cursor moves right one column.");
  1074. X        break;
  1075. X    }
  1076. X    break;
  1077. X#if !defined(VMS) && !defined(MSDOS) && defined(CRYPT_PATH)
  1078. X    case 'X':     /* WorkSheet - Options - Encrypt */
  1079. X    Crypt = (! Crypt);
  1080. X    Message ("** Encryption %sabled.", Crypt? "en" : "dis");
  1081. X    break;
  1082. X#endif
  1083. X    case 'Z':     /* WorkSheet - Options - Row/Col Limits */
  1084. X    rowlimit = currow;
  1085. X    collimit = curcol;
  1086. X    Message("** Row and column limits set");
  1087. X    break;
  1088. X    case '$':          /* WorkSheet - Options - Prescale $ */
  1089. X    if (prescale == 1.0) {
  1090. X        Message ("** Prescale enabled.  (Numbers are multiplied by .01)");
  1091. X        prescale = 0.01;
  1092. X    } else {
  1093. X        prescale = 1.0;
  1094. X        Message ("** Prescale disabled.");
  1095. X    }
  1096. X    break;
  1097. X    }
  1098. X
  1099. X    modflg++;        /* So options get saved in Spreadsheet file */
  1100. X} /* OptionsMenu() */
  1101. X
  1102. X
  1103. X/**********************************************************************
  1104. X*       End
  1105. X**********************************************************************/
  1106. END_OF_FILE
  1107.   if test 15391 -ne `wc -c <'ss_12b/menu.c'`; then
  1108.     echo shar: \"'ss_12b/menu.c'\" unpacked with wrong size!
  1109.   fi
  1110.   # end of 'ss_12b/menu.c'
  1111. fi
  1112. if test -f 'ss_12b/ss.h' -a "${1}" != "-c" ; then 
  1113.   echo shar: Will not clobber existing file \"'ss_12b/ss.h'\"
  1114. else
  1115.   echo shar: Extracting \"'ss_12b/ss.h'\" \(16550 characters\)
  1116.   sed "s/^X//" >'ss_12b/ss.h' <<'END_OF_FILE'
  1117. X/**********************************************************************
  1118. X* %W% %G%
  1119. X*
  1120. X* ss    :       A SpreadSheet Program
  1121. X*
  1122. X* Art's Spreadsheet program.          Art Mulder ( art@cs.ualberta.ca )
  1123. X* University of Alberta, Department of Computing Science.
  1124. X***********************************************************************
  1125. X* Main Header file
  1126. X***********************************************************************
  1127. X* May/92 - Art Mulder.  Hacked a bit to bring it up to Rev 6.21 of `sc' 
  1128. X*          Additions and changes for conversion to `ss'.
  1129. X*          Cosmetic rearrangements.
  1130. X* 
  1131. X* Mar/88 - More mods by Alan Silverstein, 3-4/88, see list of changes.
  1132. X* Dec/86 - R. Bond 
  1133. X* ??     - Modified by Mark Weiser and Bruce Israel, University of Maryland
  1134. X* Sep/82 - Original by James Gosling, September 1982
  1135. X**********************************************************************/
  1136. X
  1137. X#ifndef ss_h
  1138. X#  define ss_h
  1139. X
  1140. X#if defined(MSDOS)
  1141. X#  include <stdio.h>
  1142. X#endif
  1143. X
  1144. X/*
  1145. X * False & True
  1146. X */
  1147. X#ifndef FALSE
  1148. X# define    FALSE    0
  1149. X# define    TRUE    1
  1150. X#endif 
  1151. X
  1152. X#define    ATBL(tbl, row, col)    (*(tbl + row) + (col))
  1153. X  /* Macro to ease accessing the contents of the spreadsheet table */
  1154. X
  1155. X/*    Defaults and Initial Settings of variables
  1156. X *----------------------------------------------------------------------
  1157. X */
  1158. X#define MINROWS 100     /* minimum size of the spreadsheet at startup */
  1159. X#define MINCOLS 30 
  1160. X#define    ABSMAXCOLS 702    /* absolute cols: ZZ (base 26) */
  1161. X    /** I *think* this is the largest permitted column (Art M) **/
  1162. X
  1163. X#define CRROWS 1
  1164. X#define CRCOLS 2
  1165. X    /* See "craction" variable.  When the user enters a value
  1166. X     * into a cell and types return, the action taken (the <CR> action,
  1167. X     * or the craction) can be: 0 - Stay put, 1 (CRROWS) - move down
  1168. X     * one row, or 2 (CRCOLS) - move right one column.
  1169. X     */
  1170. X
  1171. X#define RESCOL 4
  1172. X#define RESROW 3 
  1173. X    /* The number of reserved Columns at the left of the screen -
  1174. X     * Reserved for the row numbers.  Also, the number of reserved
  1175. X     * rows at the top of the screen -- reserved for the prompt line,
  1176. X     * error line, and the line containing the column numbers.
  1177. X     */
  1178. X
  1179. X
  1180. X#define REFMTFIX    0    /* Formats, used in engformat() */
  1181. X#define REFMTFLT    1    /* (in format.c)        */
  1182. X#define REFMTENG    2
  1183. X#define REFMTDATE    3
  1184. X
  1185. X#define DEFWIDTH     10    /* Default column width     */
  1186. X#define DEFPREC       2    /* Default column precision     */
  1187. X#define DEFREFMT      REFMTFIX  
  1188. X    /* Make default format fixed point  THA 10/14/90 */
  1189. X
  1190. X#define    FBUFLEN        1024    /* buffer size for a single field */
  1191. X#define    PATHLEN        1024    /* maximum path length */
  1192. X
  1193. X#define MAXSTR      128    /* Max. string length (for messages, errors) */
  1194. X
  1195. X#define BYCOLS         1     /* calculation order */
  1196. X#define BYROWS         2
  1197. X
  1198. X/* 
  1199. X * tblprint style output for:
  1200. X */
  1201. X#define    TBL        1    /* `tbl' */
  1202. X#define    LATEX        2    /* `LaTeX' */
  1203. X#define    TEX        3    /* `TeX' */
  1204. X#define    SLATEX        4    /* `SLaTeX' (Scandinavian LaTeX) */
  1205. X#define FRAME       5    /* `FrameMaker' */
  1206. X
  1207. X/*
  1208. X * Cell error (1st generation (ERROR) or 2nd+ (INVALID)) 
  1209. X */
  1210. X#define    CELLOK        0
  1211. X#define    CELLERROR    1
  1212. X#define    CELLINVALID    2
  1213. X
  1214. X/*
  1215. X * Types for etype() 
  1216. X */
  1217. X#define NUM    1
  1218. X#define STR    2
  1219. X
  1220. X#define    GROWAMT        30    /* default minimum amount to grow */
  1221. X
  1222. X#define    GROWNEW        1    /* first time table */
  1223. X#define    GROWROW        2    /* add rows */
  1224. X#define    GROWCOL        3    /* add columns */
  1225. X#define    GROWBOTH    4    /* grow both */
  1226. X
  1227. X/*     ??
  1228. X *----------------------------------------------------------------------
  1229. X */
  1230. X
  1231. X#if (defined(BSD42) || defined(BSD43)) && !defined(strrchr)
  1232. X#  define strrchr rindex
  1233. X#endif
  1234. X
  1235. X#if (defined(BSD42) || defined(BSD43)) && !defined(strchr)
  1236. X#  define strchr index
  1237. X#endif
  1238. X
  1239. X#ifdef SYSV4
  1240. X   size_t    strlen();
  1241. X#endif
  1242. X
  1243. X
  1244. X/*     Global Structure Definitions
  1245. X *----------------------------------------------------------------------
  1246. X */
  1247. X
  1248. X/*
  1249. X * ent_ptr holds the row/col # and address type of a cell
  1250. X *
  1251. X * vf is the type of cell address, 0 non-fixed, or bitwise OR of FIX_ROW or
  1252. X *    FIX_COL
  1253. X * vp : we just use vp->row or vp->col, vp may be a new cell just for holding
  1254. X *    row/col (say in gram.y) or a pointer to an existing cell
  1255. X */
  1256. Xstruct ent_ptr {
  1257. X    int vf;
  1258. X    struct ent *vp;
  1259. X};
  1260. X
  1261. X#define FIX_ROW 1
  1262. X#define FIX_COL 2
  1263. X
  1264. X
  1265. X/*
  1266. X * holds the beginning/ending cells of a range
  1267. X */
  1268. Xstruct range_s {
  1269. X    struct ent_ptr left, right;
  1270. X};
  1271. X
  1272. X
  1273. X/*
  1274. X * Flag Values:
  1275. X *   Some not too obvious things about the flags:
  1276. X *   is_valid means there is a valid number in v.
  1277. X *   is_locked means that the cell cannot be edited.
  1278. X *   label set means it points to a valid constant string.
  1279. X *   is_strexpr set means expr yields a string expression.
  1280. X *    If is_strexpr is not set, and expr points to an expression
  1281. X *      tree, the expression yields a numeric expression.
  1282. X *    So, either v or label can be set to a constant. 
  1283. X *
  1284. X *    Either (but not both at the same time) can be set from
  1285. X *      an expression.
  1286. X */
  1287. X#define is_valid         0001
  1288. X#define is_changed       0002
  1289. X#define is_strexpr       0004
  1290. X#define is_leftflush     0010
  1291. X#define is_deleted       0020
  1292. X#define is_locked        0040
  1293. X#define is_label         0100
  1294. X
  1295. X#define VALID_CELL(p, r, c) ((p = *ATBL(tbl, r, c)) && \
  1296. X                 ((p->flags & is_valid) || p->label))
  1297. X
  1298. X/*
  1299. X * info for each cell, only alloc'd when something is stored in a cell
  1300. X */
  1301. Xstruct ent {
  1302. X    double v;        /* v && label are set in EvalAll() */
  1303. X    char *label;
  1304. X    struct enode *expr;    /* cell's contents */
  1305. X    short flags;    
  1306. X    short row, col;
  1307. X    struct ent *next;    /* next deleted ent (pulled, deleted cells) */
  1308. X    char *format;    /* printf format for this cell */
  1309. X    char cellerror;    /* error in a cell? */
  1310. X};
  1311. X
  1312. X/*
  1313. X * stores a range (left, right)
  1314. X */
  1315. Xstruct range {
  1316. X    struct ent_ptr r_left, r_right;
  1317. X    char *r_name;            /* possible name for this range */
  1318. X    struct range *r_next, *r_prev;    /* chained ranges */
  1319. X    int r_is_range;
  1320. X};
  1321. X
  1322. X/*
  1323. X * stores type of operation this cell will perform
  1324. X */
  1325. Xstruct enode {
  1326. X    int op;
  1327. X    union {
  1328. X    int gram_match;         /* some compilers (hp9000ipc) need this */
  1329. X    double k;        /* constant # */
  1330. X    struct ent_ptr v;    /* ref. another cell */
  1331. X    struct range_s r;    /* op is on a range */
  1332. X    char *s;        /* string part of a cell */
  1333. X    struct {        /* other cells use to eval()/seval() */
  1334. X        struct enode *left, *right;
  1335. X    } o;
  1336. X    } e;
  1337. X};
  1338. X
  1339. X/* op values */
  1340. X#define O_VAR 'v'
  1341. X#define O_CONST 'k'
  1342. X#define O_ECONST 'E'    /* constant cell w/ an error */
  1343. X#define O_SCONST '$'
  1344. X#define REDUCE 0200    /* Or'ed into OP if operand is a range */
  1345. X
  1346. X#define OP_BASE 256
  1347. X#define ACOS     (OP_BASE + 0)
  1348. X#define ASIN     (OP_BASE + 1)
  1349. X#define ATAN     (OP_BASE + 2)
  1350. X#define CEIL     (OP_BASE + 3)
  1351. X#define COS     (OP_BASE + 4)
  1352. X#define EXP     (OP_BASE + 5)
  1353. X#define FABS     (OP_BASE + 6)
  1354. X#define FLOOR     (OP_BASE + 7)
  1355. X#define HYPOT     (OP_BASE + 8)
  1356. X#define LOG     (OP_BASE + 9)
  1357. X#define LOG10     (OP_BASE + 10)
  1358. X#define POW     (OP_BASE + 11)
  1359. X#define SIN     (OP_BASE + 12)
  1360. X#define SQRT     (OP_BASE + 13)
  1361. X#define TAN     (OP_BASE + 14)
  1362. X#define DTR     (OP_BASE + 15)
  1363. X#define RTD     (OP_BASE + 16)
  1364. X#define MIN     (OP_BASE + 17)
  1365. X#define MAX     (OP_BASE + 18)
  1366. X#define RND     (OP_BASE + 19)
  1367. X#define HOUR     (OP_BASE + 20)
  1368. X#define MINUTE     (OP_BASE + 21)
  1369. X#define SECOND     (OP_BASE + 22)
  1370. X#define MONTH     (OP_BASE + 23)
  1371. X#define DAY     (OP_BASE + 24)
  1372. X#define YEAR     (OP_BASE + 25)
  1373. X#define NOW     (OP_BASE + 26)
  1374. X#define DATE     (OP_BASE + 27)
  1375. X#define FMT     (OP_BASE + 28)
  1376. X#define SUBSTR     (OP_BASE + 29)
  1377. X#define STON     (OP_BASE + 30)
  1378. X#define EQS     (OP_BASE + 31)
  1379. X#define EXT     (OP_BASE + 32)
  1380. X#define ELIST     (OP_BASE + 33)    /* List of expressions */
  1381. X#define LMAX      (OP_BASE + 34)
  1382. X#define LMIN      (OP_BASE + 35)
  1383. X#define NVAL     (OP_BASE + 36)
  1384. X#define SVAL     (OP_BASE + 37)
  1385. X#define PV     (OP_BASE + 38)
  1386. X#define FV     (OP_BASE + 39)
  1387. X#define PMT     (OP_BASE + 40)
  1388. X#define STINDEX (OP_BASE + 41)
  1389. X#define LOOKUP     (OP_BASE + 42)
  1390. X#define ATAN2     (OP_BASE + 43)
  1391. X#define INDEX     (OP_BASE + 44)
  1392. X#define DTS     (OP_BASE + 45)
  1393. X#define TTS     (OP_BASE + 46)
  1394. X#define ABS     (OP_BASE + 47)
  1395. X#define HLOOKUP (OP_BASE + 48)
  1396. X#define VLOOKUP (OP_BASE + 49)
  1397. X#define ROUND     (OP_BASE + 50)
  1398. X#define IF     (OP_BASE + 51)
  1399. X#define MYROW     (OP_BASE + 52)
  1400. X#define MYCOL     (OP_BASE + 53)
  1401. X#define COLTOA     (OP_BASE + 54)
  1402. X#define UPPER     (OP_BASE + 55)
  1403. X#define LOWER     (OP_BASE + 56)
  1404. X#define CAPITAL (OP_BASE + 57)
  1405. X#define NUMITER (OP_BASE + 58)
  1406. X
  1407. X
  1408. X/*     Global Variables
  1409. X *----------------------------------------------------------------------
  1410. X * See ``ss.c'' for documentation on each.
  1411. X */
  1412. Xextern char message[MAXSTR];    
  1413. Xextern char *buff;
  1414. Xextern char *range;    
  1415. X
  1416. Xextern    struct ent ***tbl;    
  1417. Xextern    char curfile[];
  1418. Xextern    int strow, stcol;
  1419. Xextern    int currow, curcol;
  1420. Xextern    int savedrow, savedcol;
  1421. Xextern    int FullUpdate;
  1422. Xextern    int maxrow, maxcol;
  1423. Xextern    int maxrows, maxcols;    /* # cells currently allocated */
  1424. Xextern    int *fwidth;
  1425. Xextern    int *precision;
  1426. Xextern  int *realfmt;
  1427. Xextern    char *col_hidden;
  1428. Xextern    char *row_hidden;
  1429. Xextern    char line[FBUFLEN];
  1430. Xextern    int linelim;
  1431. Xextern    int changed;
  1432. Xextern    struct ent *to_fix;
  1433. Xextern    int showsc, showsr;
  1434. X
  1435. X/*     Function Prototypes
  1436. X *----------------------------------------------------------------------
  1437. X */
  1438. Xextern    FILE *openout();
  1439. Xextern    FILE *fdopen(), *fopen();
  1440. Xextern    char *coltoa();
  1441. Xextern    char *findhome();
  1442. Xextern    char *r_name();
  1443. Xextern    char *strrchr();
  1444. Xextern    char *v_name();
  1445. Xextern    int any_locked_cells();
  1446. Xextern    int are_ranges();
  1447. Xextern    int atocol();
  1448. Xextern    int cwritefile();
  1449. Xextern    int engformat();
  1450. Xextern    int etype();
  1451. Xextern    int fork();
  1452. Xextern    int format();
  1453. Xextern    int get_rcqual();
  1454. Xextern    int growtbl();
  1455. Xextern    int locked_cell();
  1456. Xextern    int modcheck();
  1457. Xextern    int nmgetch();
  1458. Xextern    int nmungetch();
  1459. Xextern    int writefile();
  1460. Xextern    int yn_ask();
  1461. Xextern    struct enode *copye();
  1462. Xextern    struct enode *new();
  1463. Xextern    struct enode *new_const();
  1464. Xextern    struct enode *new_range();
  1465. Xextern    struct enode *new_str();
  1466. Xextern    struct enode *new_var();
  1467. Xextern    struct ent *lookat();
  1468. Xextern    struct range *find_range();
  1469. Xextern    void EvalAll();
  1470. Xextern    void add_range();
  1471. Xextern    void backcol();
  1472. Xextern    void backrow();
  1473. Xextern    void checkbounds();
  1474. Xextern    void clearent();
  1475. Xextern    void clean_range();
  1476. Xextern    void closecol();
  1477. Xextern    void closeout();
  1478. Xextern    void closerow();
  1479. Xextern    void colshow_op();
  1480. Xextern    void copy();
  1481. Xextern    void copyent();
  1482. Xextern    void creadfile();
  1483. Xextern    void deleterow();
  1484. Xextern    void del_range();
  1485. Xextern    void deraw();
  1486. Xextern    void diesave();
  1487. Xextern    void doend();
  1488. Xextern    void doformat();
  1489. Xextern    void dupcol();
  1490. Xextern    void duprow();
  1491. Xextern    void editexp();
  1492. Xextern    void editfmt();
  1493. Xextern    void edit_mode();
  1494. Xextern    void edits();
  1495. Xextern    void editv();
  1496. Xextern    void efree();
  1497. Xextern    void erase_area();
  1498. Xextern    void erasedb();
  1499. Xextern    void eraser();
  1500. Xextern    void fill();
  1501. Xextern    void flush_saved();
  1502. Xextern    void format_cell();
  1503. Xextern    void forwcol();
  1504. Xextern    void forwrow();
  1505. Xextern    void free_ent();
  1506. Xextern    void go_last();
  1507. Xextern    void goraw();
  1508. Xextern    void help();
  1509. Xextern    void hide_col();
  1510. Xextern    void hide_row();
  1511. Xextern    void hidecol();
  1512. Xextern    void hiderow();
  1513. Xextern    void initkbd();
  1514. Xextern    void ins_string();
  1515. Xextern    void insert_mode();
  1516. Xextern    void insertrow();
  1517. Xextern    void kbd_again();
  1518. Xextern    void label();
  1519. Xextern    void let();
  1520. Xextern    void list_range();
  1521. Xextern    void lock_cells();
  1522. Xextern    void moveto();
  1523. Xextern    void num_search();
  1524. Xextern    void opencol();
  1525. Xextern    void printfile();
  1526. Xextern    void pullcells();
  1527. Xextern    void readfile();
  1528. Xextern    void resetkbd();
  1529. Xextern    void rowshow_op();
  1530. Xextern    void setauto();
  1531. Xextern    void setiterations();
  1532. Xextern    void setorder();
  1533. Xextern    void showcol();
  1534. X
  1535. Xextern    void showrow();
  1536. Xextern    void showstring();
  1537. Xextern    void signals();
  1538. Xextern    void slet();
  1539. X
  1540. Xextern    void str_search();
  1541. Xextern    void sync_ranges();
  1542. Xextern    void sync_refs();
  1543. Xextern    void tblprintfile();
  1544. Xextern    void unlock_cells();
  1545. Xextern    void valueize_area();
  1546. Xextern    void write_fd();
  1547. Xextern    void write_range();
  1548. X
  1549. Xextern    void yyerror();
  1550. X#ifdef DOBACKUPS
  1551. Xextern    int backup_file();
  1552. X#endif
  1553. X
  1554. Xextern    int modflg;
  1555. X#if !defined(VMS) && !defined(MSDOS) && defined(CRYPT_PATH)
  1556. X    extern    int Crypt;
  1557. X#endif
  1558. Xextern    char *mdir;
  1559. Xextern    double prescale;
  1560. Xextern    int extfunc;
  1561. Xextern    int propagation;
  1562. Xextern    int calc_order;
  1563. Xextern    int autocalc;
  1564. Xextern    int autolabel;
  1565. Xextern    int numeric;
  1566. Xextern    int showcell;
  1567. Xextern    int showtop;
  1568. Xextern    int loading;
  1569. Xextern    int getrcqual;
  1570. Xextern    int tbl_style;
  1571. Xextern    int rndinfinity;
  1572. Xextern    char *progname;
  1573. Xextern    int craction;
  1574. Xextern    int rowlimit;
  1575. Xextern    int collimit;
  1576. X
  1577. X#if BSD42 || SYSIII
  1578. X#  ifndef cbreak
  1579. X#    define cbreak    crmode
  1580. X#    define nocbreak    nocrmode
  1581. X#  endif
  1582. X#endif
  1583. X
  1584. X#if defined(BSD42) || defined(BSD43) && !defined(ultrix)
  1585. X#  define memcpy(dest, source, len)    bcopy(source, dest, (unsigned int)len);
  1586. X#  define memset(dest, zero, len)    bzero((dest), (unsigned int)(len));
  1587. X#else
  1588. X#  ifndef SYSV3
  1589. X    /* May 13/92 - Art Mulder - on my Sun Sparc (SunOS 4.1.1) using
  1590. X     * gcc 2.0 and the System V stuff, this gives errors/warnings.
  1591. X     * So skip it.  Never had problems skipping it under `sc 6.19'
  1592. X     */
  1593. X#    include <memory.h>
  1594. X#  endif
  1595. X#endif
  1596. X
  1597. X/*    xmalloc.c stuff
  1598. X *----------------------------------------------------------------------
  1599. X */
  1600. X  extern    char *scxmalloc();
  1601. X  extern    char *scxrealloc();
  1602. X  extern     void scxfree();
  1603. X
  1604. X#define     Malloc     scxmalloc
  1605. X#define        Realloc    scxrealloc
  1606. X#define        Free    scxfree
  1607. X    /* This is primarily to make the programs cosmetically nicer,
  1608. X     * since ``malloc'' is more familiar than ``scxmalloc'' etc.
  1609. X     */
  1610. X
  1611. X/*    Prompt/Message macros
  1612. X *----------------------------------------------------------------------
  1613. X * Top Row: Cell Display, Menu Display, Data Entry     (Prompt Row)
  1614. X * 2nd Row: Informative or Error Messages        (Message Row)
  1615. X *    "error" macro is retained for backward compatibility for now.
  1616. X */
  1617. X
  1618. X#ifdef PSC    /* for "psc.c" */
  1619. X#   define error(msg)    fprintf(stderr, msg);
  1620. X#   define Message(msg)    fprintf(stderr, msg);
  1621. X#else
  1622. X#   define error     (void)move(1,0), (void)clrtoeol(), (void)printw
  1623. X#   define Message     (void)move(1,0), (void)clrtoeol(), (void)printw
  1624. X#endif
  1625. X
  1626. X#   define ClearMessage    (void)move(1,0), (void)clrtoeol()
  1627. X
  1628. X#   define Prompt     (void)move(0,0), (void)clrtoeol(), (void)printw
  1629. X#   define ClearPrompt    (void)move(0,0), (void)clrtoeol()
  1630. X
  1631. X/*     Help Contexts 
  1632. X *----------------------------------------------------------------------
  1633. X * NOTE: These are unfinished "hooks" to context sensitive help,
  1634. X * see "menu.c"
  1635. X */
  1636. X#   define HELP        1
  1637. X#   define MAINHELP    2
  1638. X#   define FILEHELP    3
  1639. X#   define CELLHELP    4
  1640. X#   define ROWHELP    5
  1641. X#   define WORKHELP    6
  1642. X#   define WNHELP    7
  1643. X#   define MISCHELP    8
  1644. X#   define OPTHELP    9
  1645. X#   define CNHELP    10
  1646. X#   define MACROHELP    11
  1647. X
  1648. X
  1649. X/*     Useful Macros
  1650. X *----------------------------------------------------------------------
  1651. X */
  1652. X
  1653. X/*
  1654. X * Void or Int (for function declarations) depending on SIGVOID
  1655. X */
  1656. X#ifdef SIGVOID 
  1657. X#  define VOID_OR_INT    void
  1658. X#else
  1659. X#  define VOID_OR_INT    int
  1660. X#endif
  1661. X
  1662. X
  1663. X/*
  1664. X * Run the command in 'line' through the parser.  Also perform
  1665. X * any necessary housekeeping.  
  1666. X */
  1667. X#define PROCESS_line {         \
  1668. X    ClearMessage;        \
  1669. X        linelim = 0;        \
  1670. X        (void) yyparse ();    \
  1671. X        linelim = -1; }
  1672. X
  1673. X/*
  1674. X * If ``buff'' is NULL, issue an ``Aborted'' message, and return
  1675. X * from the current function.  Buff is the standard name for
  1676. X * pointers to the input buffers returned by the ``getinput.c''
  1677. X * functions.
  1678. X */
  1679. X#define ABORT_AND_RETURN_IF_BUFF_NULL {        \
  1680. X    if (buff == NULL) {            \
  1681. X        Message("** Operation Aborted");    \
  1682. X        return;                \
  1683. X        } }                        
  1684. X
  1685. X/*
  1686. X * Similar to ABORT_AND_RETURN...
  1687. X */
  1688. X#define ABORT_AND_BREAK_IF_BUFF_NULL {        \
  1689. X    if (buff == NULL) {            \
  1690. X        Message("** Operation Aborted");    \
  1691. X        break;                \
  1692. X        } }                        
  1693. X
  1694. X/*     Misc
  1695. X *----------------------------------------------------------------------
  1696. X */
  1697. X
  1698. X/*
  1699. X * define some macro's so we don't have to have have (void)'s scattered
  1700. X * all over the place in the code.  
  1701. X * (These have not been universally implemented throughout the package)
  1702. X */
  1703. X#define Sprintf        (void) sprintf /* stdio.h voids... */
  1704. X#define Fprintf        (void) fprintf
  1705. X#define Printf        (void) printf
  1706. X#define Fflush        (void) fflush
  1707. X#define Close        (void) close
  1708. X#define Fclose         (void) fclose
  1709. X#define Fputs        (void) fputs
  1710. X    
  1711. X#define Execl        (void) execl /* System Calls(?) voids... */
  1712. X#define Dup        (void) dup
  1713. X    
  1714. X#define Strcat        (void) strcat /* string.h voids... */
  1715. X#define Strcpy        (void) strcpy
  1716. X#define Strtof        (void) strtof
  1717. X    
  1718. X#define Refresh        (void) refresh /* curses.h voids... */
  1719. X#define Move        (void) move
  1720. X#define Addstr        (void) addstr
  1721. X#define Clrtoeol    (void) clrtoeol
  1722. X    
  1723. X#define Signal        (void) signal /* signal.h voids... */
  1724. X#define Kill        (void) kill
  1725. X
  1726. X#define Yyparse        (void) yyparse
  1727. X
  1728. X
  1729. Xint numeric;
  1730. X    /*
  1731. X     * This variable is NOT USED in `ss'.  It is currently retained for
  1732. X     * compatibility with `sc' data files.  If you modify ``gram.y''
  1733. X     * to do nothing with the `K_NUMERIC' token, then this variable
  1734. X     * can probably be safely deleted.
  1735. X     */
  1736. X
  1737. X#endif /* ifndef ss_h */
  1738. X
  1739. X/*----------------------------------------------------------------------
  1740. X *    End
  1741. X */
  1742. END_OF_FILE
  1743.   if test 16550 -ne `wc -c <'ss_12b/ss.h'`; then
  1744.     echo shar: \"'ss_12b/ss.h'\" unpacked with wrong size!
  1745.   fi
  1746.   # end of 'ss_12b/ss.h'
  1747. fi
  1748. if test -f 'ss_12b/sunfkeys/README' -a "${1}" != "-c" ; then 
  1749.   echo shar: Will not clobber existing file \"'ss_12b/sunfkeys/README'\"
  1750. else
  1751.   echo shar: Extracting \"'ss_12b/sunfkeys/README'\" \(8111 characters\)
  1752.   sed "s/^X//" >'ss_12b/sunfkeys/README' <<'END_OF_FILE'
  1753. X---------- ---------- ---------- ---------- ---------- ---------- ----------
  1754. X              XTERM-SUN
  1755. X---------- ---------- ---------- ---------- ---------- ---------- ----------
  1756. X
  1757. XSUMMARY:
  1758. X========
  1759. X  Xterm-sun is an enhanced terminfo (and termcap) database entry for
  1760. X  the xterm terminal program running under X11 on a Sun Workstation.
  1761. X
  1762. X  The termcap and terminfo database entries for xterm (used in many
  1763. X  programs, especially curses-based programs) are missing many function
  1764. X  key entries.  This package seeks to rectify that situation.
  1765. X
  1766. X  Included are definitions for the function keys <Home>, <End>, <PgUp>,
  1767. X  <PgDn>, and <F1> through <F12>.
  1768. X
  1769. X  Using xterm-sun lets you use those function keys in curses-based programs
  1770. X  from within an xterm window.
  1771. X
  1772. XDESCRIPTION
  1773. X===========
  1774. X  Xterm is one of the most widely used pieces of X-windows software.
  1775. X  But it is certainly not one of the best.  The README file that
  1776. X  accompanies it describes it as ``the most ugly program in the
  1777. X  distribution''.  One flaw with xterm (IMHO) lies in its sparse
  1778. X  termcap/terminfo entry, and in it's handling of function keys on the
  1779. X  Sun keyboard.
  1780. X
  1781. X  ASIDE:    I have never used Xterm on anything other than a Sun, so I
  1782. X        have no idea how it functions on those platforms.
  1783. X
  1784. X  The termcap (and terminfo) entry for xterm is lacking definitions for
  1785. X  the Home,End, PageUp, and PageDown function keys.  Furthermore, while
  1786. X  it does contain definitions for functions keys F1 through F10, those
  1787. X  definitions (at least on my system) are WRONG.  That is, they do not
  1788. X  match the codes that are produced by xterm when those keys are
  1789. X  pressed.
  1790. X
  1791. X  This caused me some annoyance while developing a curses-based
  1792. X  program.  I wanted to make use of the Home, End, PageUp, and PageDn
  1793. X  in my program but was unable to.  Since I am not qualified to fix
  1794. X  xterm (Somebody, please fix it!), I have instead put together an
  1795. X  enhanced termcap and terminfo database entry for a Sun Sparc with a
  1796. X  Type-4 keyboard.
  1797. X
  1798. X  ASIDE:    These also work on a Sun3 with the type-2 keyboard.
  1799. X        However, I have not tested them extensively on such.  There
  1800. X        may be some problems lurking in the darkness, ready to
  1801. X        pounce on unsuspecting programmers.
  1802. X
  1803. XRESTRICTION
  1804. X===========
  1805. X  These enhanced termcap / terminfo entries require that you run xterm
  1806. X  with the ``-sf'' command line option, to force xterm to generate Sun
  1807. X  function key escape codes.
  1808. X
  1809. X  This is necessary, because with the default option (+sf, standard
  1810. X  function key escape codes) I found that xterm produces NO output
  1811. X  whatsoever when the Home, End, PageUp, or PageDown keys were
  1812. X  pressed.
  1813. X
  1814. XTHE TERMCAP / TERMINFO FILES
  1815. X============================
  1816. X
  1817. X  There are two files included in this package: xterm-sun.ti and
  1818. X  xterm-sun.tc.  xterm-sun.ti contains the terminfo database entry for
  1819. X  a Sun, entitled xterm-sun.  The corresponding termcap entry is stored
  1820. X  in xterm-sun.tc.  The xterm-sun.tc file was produced from
  1821. X  xterm-sun.ti using ``/usr/5bin/infocmp -C''.
  1822. X
  1823. X  Please refer to the comments in those files, for additional
  1824. X  information.
  1825. X
  1826. X  The ``vanilla'' xterm termcap / terminfo database entry contains
  1827. X  definitions for only the keypad arrow keys.  (Yes, I know I already
  1828. X  mentioned that it contained WRONG definitions for the function keys
  1829. X  F1 through F10.  I'm trying to forget about that :-).  I have added
  1830. X  the following function key definitions:
  1831. X
  1832. X    <Home>, <End>, <Page Down>, <Page Up>, <Insert>, <F1> through
  1833. X    <F12>, <Shift><End>, <Shift><Home>, <Shift><Left Arrow>,
  1834. X    <Shift><Right Arrow>.
  1835. X
  1836. X  NOTE:     Under ``xterm -sf'', xterm produces the same key codes for
  1837. X        function keys <F11> and <F12> as it does for the function
  1838. X        keys <Stop> and <Again>.  This may cause you some grief, be
  1839. X        careful.
  1840. X
  1841. X  BEEF:     Why doesn't terminfo / termcap allow a shifted Up/Down
  1842. X        Arrow when it does have a shifted Left/Right Arrow?  What
  1843. X        about shifted PageUp/PageDown, after all, there are shifted
  1844. X        Home/End Keys.  Seems rather arbitrary.  Mutter mutter,
  1845. X        grumble grumble.
  1846. X
  1847. X  Note that on a Sun3 with the type-2 keyboard, there are no function
  1848. X  keys F10 through F12.  Also, the Home, End, PageUp, PageDown are not
  1849. X  labelled as such.  They are:
  1850. X
  1851. X        Home :   R7
  1852. X         End :   R13
  1853. X        PgUp :   R9
  1854. X        PgDn :   R15
  1855. X
  1856. XINSTALLATION
  1857. X============
  1858. X  There are a number of ways that you can install these database
  1859. X  entries.
  1860. X
  1861. X  1) Rename them from ``xterm-sun'' to ``xterm'' and replaces the
  1862. X     standard entries in the termcap and terminfo databases with these
  1863. X     enhanced entries.  This will require some fiddling on your part,
  1864. X     since as distributed, these refer to the original xterm entries.
  1865. X
  1866. X  This would cause the least amount of disruption for xterm users, but
  1867. X  remember that these termcap / terminfo function key descriptions only
  1868. X  work with ``xterm -sf''.
  1869. X
  1870. X  2) Install the ``xterm-sun'' entries into your system termcap and
  1871. X     terminfo databases.
  1872. X
  1873. X  This is also a nice option, but like option 1, it requires System
  1874. X  Administrator privileges.
  1875. X
  1876. X  3) If you are a ``lowly user'' you can install them in your own
  1877. X     home account.
  1878. X
  1879. X  Pick a subdirectory under your user id (I use /lib/terminfo)
  1880. X  and put the files there.
  1881. X
  1882. X  Nothing special is required with xterm-sun.tc, but xterm-sun.ti must
  1883. X  be compiled before it can be used.  See the man page for tic(8v) for
  1884. X  instructions on that.  (Note:  tic is probably in /usr/5bin on your
  1885. X  Sun system).
  1886. X
  1887. X  When it is compiled, xterm-sun.ti will also produce a compiled
  1888. X  ``xterm'' and ``vs100'' entry.  See the comments in xterm-sun.ti.
  1889. X  Those can safely be deleted.
  1890. X
  1891. XUSAGE
  1892. X=====
  1893. X  For option 1 above, all you need to do to make this enhanced termcap
  1894. X  / terminfo database entry available to all your curses programs is to
  1895. X  remember to start xterm with the ``- sf'' option.
  1896. X
  1897. X  If you choose option 2 above, you must also give the command like
  1898. X  option ``-tn xterm-sun'' when you run xterm.
  1899. X
  1900. X  Those of us forced to use option 3 above, have the most grief.
  1901. X
  1902. X    Set your TERM environment variable to ``xterm-sun''.
  1903. X
  1904. X    Set your TERMINFO environment variable to the parent directory
  1905. X    of the directory where the compiled `xterm- sun' entry is.
  1906. X
  1907. X    Set your TERMCAP environment variable to be the directory of
  1908. X    where you stored `xterm-sun.tc'.  This MUST begin with a slash
  1909. X    (`/') due to the way the function tgetent() works.  (See the
  1910. X    source code of xterm, and the man page of tgetent() to learn
  1911. X    more of this.)
  1912. X
  1913. X        An example, based on option 3, above.
  1914. X       % setenv TERM xterm-sun
  1915. X       % setenv TERMINFO /usr/users/joeblow/termlib
  1916. X        (the xterm-sun compiled terminfo entry is stored
  1917. X        in the x subdirectory under termlib)
  1918. X       % setenv TERMCAP /usr/users/joeblow/termlib/xterm-sun.tc
  1919. X       % xterm -sf -tn xterm-sun &
  1920. X
  1921. XTESTING
  1922. X=======
  1923. X  Included with this package is a simple curses program ``f1.c''.
  1924. X  To compile this program, edit the Makefile to match your sight
  1925. X  and then give the command ``make f1''
  1926. X
  1927. X  If you then run f1, you can check and see that you can indeed
  1928. X  detect the various function keys from within a curses program.
  1929. X
  1930. X  REMEMBER to first set your TERMINFO and TERM environment variables.
  1931. X  Oh yah, ``f1.c'' uses System V curses and terminfo, NOT termcap.
  1932. X
  1933. XDISCLAIMER
  1934. X==========
  1935. X  I hope you find this package to be useful to you.  But I make no
  1936. X  warranty as to accuracy/correctness of these files.  Caveat Emptor.
  1937. X
  1938. X  This material is dated April 4, 1992.  Hopefully, someone will soon
  1939. X  fix xterm, and this package will no longer be of any use to anyone.
  1940. X
  1941. XFILES:
  1942. X======
  1943. X  README    - this file
  1944. X  xterm-sun.ti    - terminfo database entry (see comments)
  1945. X  xterm-sun.tc    - termcap database entry (see comments)
  1946. X
  1947. X  Makefile    - makefile for f1.c
  1948. X  f1.c        - simple curses program to test the terminfo entry
  1949. X
  1950. XSEE ALSO
  1951. X========
  1952. X  xterm(1), curses(3v), termcap(5), terminfo(5v), infocmp(8v), tic(8v),
  1953. X  tgetent(3x).
  1954. X
  1955. XBUGS
  1956. X====
  1957. X  Hopefully none, but this *is* a beta release.
  1958. X
  1959. XAUTHOR:
  1960. X=======
  1961. X  ...art mulder                       Department of Computing Science
  1962. X  art@cs.ualberta.ca          University of Alberta, Edmonton, Canada
  1963. X---------- ---------- ---------- ---------- ---------- ---------- ----------
  1964. END_OF_FILE
  1965.   if test 8111 -ne `wc -c <'ss_12b/sunfkeys/README'`; then
  1966.     echo shar: \"'ss_12b/sunfkeys/README'\" unpacked with wrong size!
  1967.   fi
  1968.   # end of 'ss_12b/sunfkeys/README'
  1969. fi
  1970. if test -f 'ss_12b/version.c' -a "${1}" != "-c" ; then 
  1971.   echo shar: Will not clobber existing file \"'ss_12b/version.c'\"
  1972. else
  1973.   echo shar: Extracting \"'ss_12b/version.c'\" \(242 characters\)
  1974.   sed "s/^X//" >'ss_12b/version.c' <<'END_OF_FILE'
  1975. X/*
  1976. X * CODE REVISION NUMBER:
  1977. X *
  1978. X * The part after the first colon, except the last char, appears on the screen.
  1979. X * It is also placed into the manpage by 'Makefile' and 'torev'.
  1980. X */
  1981. X
  1982. Xchar *rev = "$Revision: 1.2b $";
  1983. X               /** ^^^^^^ **/ 
  1984. END_OF_FILE
  1985.   if test 242 -ne `wc -c <'ss_12b/version.c'`; then
  1986.     echo shar: \"'ss_12b/version.c'\" unpacked with wrong size!
  1987.   fi
  1988.   # end of 'ss_12b/version.c'
  1989. fi
  1990. echo shar: End of archive 7 \(of 11\).
  1991. cp /dev/null ark7isdone
  1992. MISSING=""
  1993. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  1994.     if test ! -f ark${I}isdone ; then
  1995.     MISSING="${MISSING} ${I}"
  1996.     fi
  1997. done
  1998. if test "${MISSING}" = "" ; then
  1999.     echo You have unpacked all 11 archives.
  2000.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2001. else
  2002.     echo You still must unpack the following archives:
  2003.     echo "        " ${MISSING}
  2004. fi
  2005. exit 0
  2006. exit 0 # Just in case...
  2007.