home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / unix / volume27 / conv123 / part01 < prev    next >
Encoding:
Text File  |  1993-09-05  |  73.1 KB  |  2,035 lines

  1. Newsgroups: comp.sources.unix
  2. From: greg@brooktree.com (Gregory Santos)
  3. Subject: v27i031: conv123 - convert ASCII files to Lotus-123 format, Part01/02
  4. Message-id: <1.747292168.20241@gw.home.vix.com>
  5. Sender: unix-sources-moderator@gw.home.vix.com
  6. Approved: vixie@gw.home.vix.com
  7.  
  8. Submitted-By: greg@brooktree.com (Gregory Santos)
  9. Posting-Number: Volume 27, Issue 31
  10. Archive-Name: conv123/part01
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of archive 1 (of 2)."
  19. # Contents:  MANIFEST Makefile README conv123.1 conv123.doc grph123.1
  20. #   grph123.doc int2s.c lotus.h s2int.c swapb.c swapb.h
  21. # Wrapped by vixie@gw.home.vix.com on Sun Sep  5 22:08:56 1993
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  25. else
  26. echo shar: Extracting \"'MANIFEST'\" \(530 characters\)
  27. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  28. X   File Name        Archive #    Description
  29. X-----------------------------------------------------------
  30. X MANIFEST                   1    
  31. X Makefile                   1    
  32. X README                     1    
  33. X conv123.1                  1    
  34. X conv123.c                  2    
  35. X conv123.doc                1    
  36. X grph123.1                  1    
  37. X grph123.c                  2    
  38. X grph123.doc                1    
  39. X int2s.c                    1    
  40. X lotus.h                    1    
  41. X s2int.c                    1    
  42. X swapb.c                    1    
  43. X swapb.h                    1    
  44. END_OF_FILE
  45. if test 530 -ne `wc -c <'MANIFEST'`; then
  46.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  47. fi
  48. # end of 'MANIFEST'
  49. fi
  50. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  51.   echo shar: Will not clobber existing file \"'Makefile'\"
  52. else
  53. echo shar: Extracting \"'Makefile'\" \(760 characters\)
  54. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  55. XBINDIR = /usr/local/bin
  56. XMANDIR = /usr/local/man/man1
  57. XOBJECTS1 = conv123.o int2s.o s2int.o
  58. XOBJECTS2 = grph123.o int2s.o s2int.o
  59. XCFLAGS = -O
  60. XLDFLAGS =
  61. X
  62. Xall:    c123 g123
  63. X
  64. Xc123: $(OBJECTS1)
  65. X    cc $(CFLAGS) $(OBJECTS1) -o conv123 $(LDFLAGS)
  66. X    chmod 755 ./conv123
  67. X
  68. Xg123: $(OBJECTS2)
  69. X    cc $(CFLAGS) $(OBJECTS2) -o grph123 $(LDFLAGS)
  70. X    chmod 755 ./grph123
  71. X
  72. Xclean:
  73. X    rm -f ./conv123.o
  74. X    rm -f ./grph123.o
  75. X    rm -f ./int2s.o
  76. X    rm -f ./s2int.o
  77. X    rm -f ./conv123
  78. X    rm -f ./grph123
  79. X
  80. Xinstall:
  81. X    cp ./conv123 $(BINDIR)
  82. X    cp ./grph123 $(BINDIR)
  83. X    cp ./conv123.1 $(MANDIR)
  84. X    cp ./grph123.1 $(MANDIR)
  85. X
  86. Xuninstall:
  87. X    rm -f $(BINDIR)/conv123
  88. X    rm -f $(BINDIR)/grph123
  89. X    rm -f $(MANDIR)/conv123.1
  90. X    rm -f $(MANDIR)/grph123.1
  91. X
  92. X$(OBJECTS1): conv123.c int2s.c s2int.c
  93. X$(OBJECTS2): grph123.c int2s.c s2int.c
  94. END_OF_FILE
  95. if test 760 -ne `wc -c <'Makefile'`; then
  96.     echo shar: \"'Makefile'\" unpacked with wrong size!
  97. fi
  98. # end of 'Makefile'
  99. fi
  100. if test -f 'README' -a "${1}" != "-c" ; then 
  101.   echo shar: Will not clobber existing file \"'README'\"
  102. else
  103. echo shar: Extracting \"'README'\" \(1955 characters\)
  104. sed "s/^X//" >'README' <<'END_OF_FILE'
  105. X
  106. Xconv123, grph123  9 Aug 1993 -- gss
  107. X
  108. Xconv123 is a utility for creating a binary-ready spreadsheet
  109. Xthat can be read in directly by Lotus/123(TM) or programs
  110. Xthat can read Lotus/123(TM) spreadsheets.  It grew out of
  111. Xthe need to take our corporate data and deliver it as a
  112. Xkind of inexpensive "executive information system" to
  113. Xmicro-computers that had been networked together, when it
  114. Xwas realized that the standard "import" function used to
  115. Xread ASCII data files was too restricting.
  116. X
  117. XIt is hoped that the straightforward ASCII input file format,
  118. Xdesigned for use with a report writer, will be suitable for
  119. Xmost data-generating methods, including 3rd and 4th generation
  120. Xlanguages.
  121. X
  122. XThis distribution also includes grph123, which produces a Lotus(TM)
  123. X"named graph" file.  Although requiring a different input file
  124. Xformat, this utility can be quite useful, permitting as it does
  125. Xthe creation of pre-formatted graph instructions for Lotus/123(TM),
  126. Xand also for those programs capable of interpreting such information
  127. X(e.g., Excel(TM)).
  128. X
  129. XThe utilities are fairly simple, currently supporting no options, and
  130. Xafter unpacking, should just require a simple "make" to create.
  131. XYou may want to edit the Makefile for compiler flags, or for target
  132. Xdirectory information ("BINDIR" and "MANDIR" variables) if you intend
  133. Xto "make install."
  134. X
  135. Xconv123 can be used as a filter (i.e., stdin or stdout redirected),
  136. Xalthough grph123 can re-direct only stdout.  They have been tested
  137. Xonly on HP-UX 8.0x (series 700 machines), AIX 3.2, and SunOS 4.x.  We
  138. Xreally don't feel much like enhancing them right now, but feel free to
  139. Xmail bugs reports (in any form) to greg@brooktree.com.
  140. X
  141. XBy the way: if you really must run this program on an Intel processor,
  142. Xbe sure to alter the "swapb" macro to do no swapping.  It is not
  143. Ximagined that there would be much need for this, as most Intel-based
  144. Xoperating systems should have utilities such as conv123 readily and
  145. Xinexpensively available.
  146. END_OF_FILE
  147. if test 1955 -ne `wc -c <'README'`; then
  148.     echo shar: \"'README'\" unpacked with wrong size!
  149. fi
  150. # end of 'README'
  151. fi
  152. if test -f 'conv123.1' -a "${1}" != "-c" ; then 
  153.   echo shar: Will not clobber existing file \"'conv123.1'\"
  154. else
  155. echo shar: Extracting \"'conv123.1'\" \(10097 characters\)
  156. sed "s/^X//" >'conv123.1' <<'END_OF_FILE'
  157. X.TH CONV123 1 "6 Aug 1993" "123 Utilities"
  158. X.SH NAME
  159. Xconv123 \- The ASCII to Lotus(TM) spreadsheet converter
  160. X
  161. X.SH SYNOPSIS
  162. X.B conv123
  163. X[inputfile] [outputfile]
  164. X
  165. X.SH DESCRIPTION
  166. X
  167. X.I conv123
  168. Xis a utility for reading a specially-formatted flat
  169. XASCII file and converting it into a Lotus/123(TM) ".wk1" file.
  170. XEach specially-formatted ASCII file creates one entire spreadsheet.
  171. XThis spreadsheet file is in its final, directly-readable 
  172. Xbinary form, and need undergo no further translation before being
  173. Xread directly by Lotus/123(TM).  This feature makes
  174. X.I conv123
  175. Xespecially
  176. Xsuited to networked environments, where report writers or programs
  177. Xrunning on transaction processing machines can easily and directly
  178. Xcreate spreadsheet output, instantly ready for copying, downloading,
  179. Xor direct access in the MS-DOS(TM) or Macintosh(TM) environments.
  180. XIn addition to individual data values, certain common aggregate
  181. Xfunctions (formulas) may be specified (sum,min,max,variance,std
  182. Xdeviation, and average), and five binary functions (addition,
  183. Xsubtraction, multiplication, division, and percentage) may also
  184. Xbe specified.
  185. X
  186. XThe input file format has been optimized for generation by a
  187. Xsimple top-down, left-to-right report generator,
  188. Xand is human-readable.  The input logic has been made fairly intelligent,
  189. Xautomatically discerning numeric and non-numeric values,
  190. Xcalculating formula ranges, and calculating the maximum number
  191. Xof decimal places in a row or column.
  192. X
  193. X.SH OPTIONS
  194. XThere are currently no command-line options for
  195. X.I conv123.
  196. X
  197. X
  198. X.SH PARAMETERS
  199. XThe only parameters are the input and output file names, both
  200. Xof which are optional;
  201. X.I conv123
  202. Xcan act as a filter, and by
  203. Xdefault accepts its input from stdin and sends its output to
  204. Xstdout.
  205. X
  206. X.SH INPUT FILE FORMAT
  207. XThe major feature of the input file format is a "definition"
  208. Xline, consisting of all dashes (-) and spaces.  Each string of
  209. Xcontiguous dashes on the "definition" line will become a column
  210. Xin Lotus/123(TM), the width of that column being determined by the
  211. Xnumber of dashes.  Characters in the input file that fall outside
  212. Xthese "column definitions" are ignored.  In addition, up to two
  213. Xlines above the "definition" line can be used for header information,
  214. Xthough this is not required.  There may not be any white space before
  215. Xthe first dash on the definition line; in other words, the definition
  216. Xline MUST begin in the first column of the input file.
  217. X
  218. XFollowing is an example input file, followed by a more detailed
  219. Xexplanation of its contents:
  220. X
  221. X                   Jan          Feb         Mar         Qtr
  222. X     Product      Sales        Sales       Sales       Total
  223. X    ---------  -----------  ----------- ----------- -----------
  224. X    widget-1     45000.87       54390.9    75947.12     @RSUM
  225. X    widget-2     47000.78       64550.0    73647.77     @RSUM
  226. X    widget-3     47800.11       67830.5    54536.37     @RSUM
  227. X    widget-4     33003.30       76530.7    98653.83     @RSUM
  228. X    widget-5     12000.44       64836.7    27637.91     @RSUM
  229. X
  230. X                     @CSUM        @CSUM       @CSUM     @CSUM
  231. X
  232. XThis is a fairly simple spreadsheet with ten rows and five
  233. Xcolumns.  The fifth column is actually made of formulas
  234. X("row sums"), as is the last row ("column sums").
  235. X.I conv123
  236. Xis
  237. Xsmart enough to know that each data value in the first column
  238. Xis non-numeric, and creates the formulas in the fifth column
  239. Xaccordingly, i.e., the "row sums" are sums of the values in
  240. Xthe second through the fourth columns.  In addition, since
  241. X.I conv123
  242. Xkeeps track of the maximum number of decimal places
  243. Xused in a given row or column, the number of decimal places
  244. Xdisplayed in Lotus/123(TM) will be two (2) for all formulas,
  245. Xwith the exception of the CSUM in the third column, which will
  246. Xdisplay with one (1) decimal place.  Note also that the position
  247. Xof the number or formula code in each column is not significant,
  248. Xas long as the entire values fits under the dashed-line column
  249. Xdefinition(s).  Also, most spreadsheet programs will re-position
  250. Xthe values within each cell as the values are displayed.
  251. X
  252. X
  253. X.SH FORMULA CODES
  254. XAs has been shown in the above example, cell contents may be
  255. Xdecimal numbers or character values, with the width of the cell
  256. Xdetermined by the width of the contiguous dashes in the "definition"
  257. Xline.  Cell contents may also be formula codes.  A formula code is
  258. Xa contiguous set of characters, always beginning with a commercial
  259. X"at" sign (@).  There are three types: row, column and both.  The
  260. Xtype indicator is a single upper case letter, one of "R" (row), "C"
  261. X(column) or "B" (both), immediately following the "@" ("at" sign).
  262. XThe formula function immediately follows the type indicator, and may
  263. Xbe an aggregate function or a binary function.  The range for an
  264. Xaggregate function is calculated automatically, being the range from
  265. Xthe earliest available cell -- i.e., the cell farthest "above" for
  266. Xcolumns, or farthest to the "left" for rows -- to the cell immediately
  267. Xadjacent to the formula definition.  Note that this "farthest" cell
  268. Xlocation is re-adjusted when a non-numeric cell definition is 
  269. Xencountered, being set to begin at the next numeric cell (this does
  270. Xnot include non-cells, i.e., positions within the spreadsheet with
  271. Xno value).  The automatic range start position may be overridden for
  272. X"row" functions by placing a numeric value at the end of the formula
  273. Xcode (still contiguous).  A numeric value at the end of a formula code
  274. Xis treated as an absolute column number, with the first column
  275. Xdefined as column one (1).
  276. X
  277. XThe range for a binary function is simply the last two adjacent
  278. Xcells "above" the formula definition for column functions, and
  279. X"left" of the formula definition for row functions.  The adjacent
  280. Xcell is always used in the calculation; an override number after
  281. Xthe function code in a row function is treated as an absolute
  282. Xcolumn number overriding the penultimate cell.  For commutative
  283. Xfunctions (addition and multiplication), order is not significant.
  284. XFor non-commutative functions (subtraction and division), the
  285. Xdefinition is a - b, or a/b, where a is the penultimate cell, and b
  286. Xis the immediately adjacent cell.  If there is an override column
  287. Xnumber, THIS ORDER IS REVERSED -- i.e., b - a and b/a, where a is
  288. Xthe overriding column number and b is the immediately adjacent cell.
  289. XThis situation is made clearer in the examples below.
  290. X
  291. XFollowing is a summary of the available functions, which MUST be in
  292. Xupper case where applicable:
  293. X
  294. X    SUM -- Performs addition on a range of cells.
  295. X    AVG -- Takes the average value on a range of cells.
  296. X    MIN -- Extracts the minimum value on a range of cells.
  297. X    MAX -- Extracts the minimum value on a range of cells.
  298. X    VAR -- Calculates the variance on a range of cells.
  299. X    STD -- Calculates the standard deviation on a range of cells.
  300. X     +  -- Adds two cells.
  301. X     -  -- Subtracts two cells.
  302. X     *  -- Multiplies two cells.
  303. X     /  -- Divides two cells.
  304. X     %  -- Divides two cells, and multiplies the result by 100.
  305. X    NUL -- This is actually not a function, but performs the task
  306. X           of a "placeholder", preventing the "resetting" of auto-
  307. X           matically calculated numeric ranges without creating
  308. X           cell contents.  This function is most frequently used to
  309. X           extend the row range of aggregate column functions.
  310. X
  311. X
  312. X.SH FORMULA EXAMPLES
  313. X    Here are some sample input lines, with result following.
  314. X
  315. X    input:
  316. X    ---------  -----------  ----------- ----------- -----------
  317. X    widget-1      100.00       200.00      300.00     @RSUM
  318. X
  319. X    result:
  320. X    ---------  -----------  ----------- ----------- -----------
  321. X    widget-1        100.00       200.00      300.00      600.00
  322. X
  323. X
  324. X    input:
  325. X    ---------  -----------  ----------- ----------- -----------
  326. X    widget-1       100.00       200.00      300.00     @R+
  327. X
  328. X    result:
  329. X    ---------  -----------  ----------- ----------- -----------
  330. X    widget-1        100.00       200.00      300.00      500.00
  331. X
  332. X
  333. X    input:
  334. X    ---------  -----------  ----------- ----------- -----------
  335. X    widget-1       100.00       200.00      300.00     @R/
  336. X
  337. X    result:
  338. X    ---------  -----------  ----------- ----------- -----------
  339. X    widget-1        100.00       200.00      300.00        0.67
  340. X
  341. X
  342. X    input:
  343. X    ---------  -----------  ----------- ----------- -----------
  344. X    widget-1       100.00       200.00      300.00     @R/3
  345. X
  346. X    result:
  347. X    ---------  -----------  ----------- ----------- -----------
  348. X    widget-1        100.00       200.00      300.00        1.50
  349. X
  350. X    Note in the above example that the order of divisor/dividend as
  351. X    regards the immediately adjacent cell is the reverse of the
  352. X    previous example.
  353. X
  354. X
  355. X input:
  356. X ---------  --------  -------- -------- ---------- ------- ----------
  357. X widget-1    100.00    200.00     @RSUM     300.00   400.0     @RSUM
  358. X widget-2    100.00    100.00     @RSUM     100.00   200.0     @RSUM4
  359. X                                   @NUL
  360. X              @CSUM     @BSUM     @CSUM
  361. X
  362. X result:
  363. X ---------  --------  -------- -------- ----------- ------- ----------
  364. X widget-1     100.00    200.00   300.00      300.00   400.0     700.00
  365. X widget-2     100.00    100.00   200.00      100.00   200.0     500.00
  366. X
  367. X              200.00    500.00     0.00
  368. X
  369. X
  370. X
  371. X.SH SPECIAL CONSIDERATIONS
  372. X
  373. XThe dashed-line definitions must begin at the first character
  374. Xof the line in which they occur.
  375. X
  376. XOutput files are basically in Lotus(TM) ".WK1" format, and output
  377. Xfiles should be named with this extension to provide maximum
  378. Xinformation to spreadsheet programs.
  379. X
  380. XBinary functions in column formula codes are allowed, but rarely
  381. Xmake much sense.
  382. X
  383. XThe program is simple by design, and makes no attempt to incorporate
  384. Xuseful, more complex features such as absolute cell positioning,
  385. Xgeneral-purpose formulae, macros, etc.  It also has not undergone
  386. Xa complete test suite.
  387. X
  388. X
  389. X.SH BUGS
  390. X
  391. XThe maximum number of columns is currently hard-coded into the 
  392. Xprogram at 124; memory should be dynamically allocated to support
  393. Xan arbitrary spreadsheet size.
  394. X
  395. XOptimizations could be applied at several points.
  396. X
  397. XStarting/ending points for formulae should be arbitrarily
  398. Xspecifiable.
  399. END_OF_FILE
  400. if test 10097 -ne `wc -c <'conv123.1'`; then
  401.     echo shar: \"'conv123.1'\" unpacked with wrong size!
  402. fi
  403. # end of 'conv123.1'
  404. fi
  405. if test -f 'conv123.doc' -a "${1}" != "-c" ; then 
  406.   echo shar: Will not clobber existing file \"'conv123.doc'\"
  407. else
  408. echo shar: Extracting \"'conv123.doc'\" \(10474 characters\)
  409. sed "s/^X//" >'conv123.doc' <<'END_OF_FILE'
  410. X
  411. X
  412. XNAME
  413. X    convert 123 - The ASCII to Lotus/123(TM) spreadsheet converter
  414. X
  415. XSYNOPSIS
  416. X    conv123 [inputfile] [outputfile]
  417. X
  418. XINTRODUCTION
  419. X    conv123 is a utility for reading a specially-formatted flat
  420. X    ASCII file and converting it into a Lotus/123(TM) ".wk1" file.
  421. X    Each specially-formatted ASCII file creates one entire spread-
  422. X    sheet.  This spreadsheet file is in its final, directly-readable 
  423. X    binary form, and need undergo no further translation before being
  424. X    read directly by Lotus/123(TM).  This feature makes conv123 especially
  425. X    suited to networked environments, where report writers or programs
  426. X    running on transaction processing machines can easily and directly
  427. X    create spreadsheet output, instantly ready for copying, downloading,
  428. X    or direct access in the MS-DOS(TM) or Macintosh(TM) environments.
  429. X    In addition to individual data values, certain common aggregate
  430. X    functions (formulas) may be specified (sum,min,max,variance,std
  431. X    deviation, and average), and five binary functions (addition,
  432. X    subtraction, multiplication, division, and percentage) may also
  433. X    be specified.
  434. X
  435. X    The input file format has been optimized for generation by a
  436. X    simple top-down, left-to-right report generator, and is human
  437. X    readable.  The input logic has been made fairly intelligent,
  438. X    automatically discerning between numeric and non-numeric values,
  439. X    calculating formula ranges, and calculating the maximum number
  440. X    of decimal places in a row or column.
  441. X
  442. XOPTIONS
  443. X    There are currently no command-line options for conv123.
  444. X
  445. XPARAMETERS
  446. X    The only parameters are the input and output file names, both
  447. X    of which are optional; conv123 can act as a filter, and by
  448. X    default accepts its input from stdin and sends its output to
  449. X    stdout.
  450. X
  451. XINPUT FILE FORMAT
  452. X    The major feature of the input file format is a "definition"
  453. X    line, consisting of all dashes (-) and spaces.  Each string of
  454. X    contiguous dashes on the "definition" line will become a column
  455. X    in Lotus/123(TM), the width of that column being determined by the
  456. X    number of dashes.  Characters in the input file that fall outside
  457. X    these "column definitions" are ignored.  In addition, up to two (2)
  458. X    lines above the "definition" line can be used for header information,
  459. X    though this is not required.  There may not be any white space before
  460. X    the first dash on the definition line; in other words, the definition
  461. X    line MUST begin in the first column of the input file.
  462. X
  463. X    Following is an example input file, followed by a more detailed
  464. X    explanation of its contents:
  465. X
  466. X                   Jan          Feb         Mar         Qtr
  467. X     Product      Sales        Sales       Sales       Total
  468. X    ---------  -----------  ----------- ----------- -----------
  469. X    widget-1     45000.87       54390.9    75947.12     @RSUM
  470. X    widget-2     47000.78       64550.0    73647.77     @RSUM
  471. X    widget-3     47800.11       67830.5    54536.37     @RSUM
  472. X    widget-4     33003.30       76530.7    98653.83     @RSUM
  473. X    widget-5     12000.44       64836.7    27637.91     @RSUM
  474. X
  475. X                     @CSUM        @CSUM       @CSUM     @CSUM
  476. X
  477. X    This is a fairly simple spreadsheet with ten rows and five
  478. X    columns.  The fifth column is actually made of formulas
  479. X    ("row sums"), as is the last row ("column sums").  conv123 is
  480. X    smart enough to know that each data value in the first column
  481. X    is non-numeric, and creates the formulas in the fifth column
  482. X    accordingly, i.e., the "row sums" are sums of the values in
  483. X    the second through the fourth columns.  In addition, since
  484. X    conv123 keeps track of the maximum number of decimal places
  485. X    used in a given row or column, the number of decimal places
  486. X    displayed in Lotus/123(TM) will be two (2) for all formulas,
  487. X    with the exception of the CSUM in the third column, which will
  488. X    display with one (1) decimal place.  Note also that the position
  489. X    of the number or formula code in each column is not significant,
  490. X    as long as the entire values fits under the dashed-line column
  491. X    definition(s).  Also, most spreadsheet programs will re-position
  492. X    the values within each cell as the values are displayed.
  493. X
  494. X
  495. XFORMULA CODES
  496. X    As has been shown in the above example, cell contents may be
  497. X    decimal numbers or character values, with the width of the cell
  498. X    determined by the width of the contiguous dashes in the "definition"
  499. X    line.  Cell contents may also be formula codes.  A formula code is
  500. X    a contiguous set of characters, always beginning with a commercial
  501. X    "at" sign (@).  There are three types: row, column and both.  The
  502. X    type indicator is a single upper case letter, one of "R" (row), "C"
  503. X    (column) or "B" (both), immediately following the "@" ("at" sign).
  504. X    The formula function immediately follows the type indicator, and may
  505. X    be and aggregate function or a binary function.  The range for an
  506. X    aggregate function is calculated automatically, being the range from
  507. X    the earliest available cell -- i.e., the cell farthest "above" for
  508. X    columns, or farthest to the "left" for rows -- to the cell immediately
  509. X    adjacent to the formula definition.  Note that this "farthest" cell
  510. X    location is re-adjusted when a non-numeric cell definition is 
  511. X    encountered, being set to begin at the next numeric cell (this does
  512. X    not include non-cells, i.e., positions within the spreadsheet with
  513. X    no value).  The automatic range start position may be overridden for
  514. X    "row" functions by placing a numeric value at the end of the formula
  515. X    code (still contiguous).  A numeric value at the end of a formula code
  516. X    is treated as an absolute starting column number, with the first column
  517. X    defined as column one (1).
  518. X
  519. X    The range for a binary function is simply the last two adjacent
  520. X    cells "above" the formula definition for column functions, and
  521. X    "left" of the formula definition for row functions.  The adjacent
  522. X    cell is always used in the calculation; an override number after
  523. X    the function code in a row function is treated as an absolute
  524. X    column number overriding the penultimate cell.  For commutative
  525. X    functions (addition and multiplication), order is not significant.
  526. X    For non-commutative functions (subtraction and division), the
  527. X    definition is a - b, or a/b, where a is the penultimate cell, and b
  528. X    is the immediately adjacent cell.  If there is an override column
  529. X    number, THIS ORDER IS REVERSED -- i.e., b - a and b/a, where a is
  530. X    the overriding column number and b is the immediately adjacent cell.
  531. X    This situation is made clearer in the examples below.
  532. X
  533. X    Following is a summary of the available functions, which MUST be in
  534. X    upper case where applicable:
  535. X
  536. X    SUM -- Performs addition on a range of cells.
  537. X    AVG -- Takes the average value on a range of cells.
  538. X    MIN -- Extracts the minimum value on a range of cells.
  539. X    MAX -- Extracts the minimum value on a range of cells.
  540. X    VAR -- Calculates the variance on a range of cells.
  541. X    STD -- Calculates the standard deviation on a range of cells.
  542. X     +  -- Adds two cells.
  543. X     -  -- Subtracts two cells.
  544. X     *  -- Multiplies two cells.
  545. X     /  -- Divides two cells.
  546. X     %  -- Divides two cells, and multiplies the result by 100.
  547. X    NUL -- This is actually not a function, but performs the task
  548. X           of a "placeholder", preventing the "resetting" of auto-
  549. X           matically calculated numeric ranges without creating
  550. X           cell contents.  This function is most frequently used to
  551. X           extend the row range of aggregate column functions.
  552. X
  553. X
  554. XFORMULA EXAMPLES
  555. X    Here are some sample input lines, with result following.
  556. X
  557. X    input:
  558. X    ---------  -----------  ----------- ----------- -----------
  559. X    widget-1      100.00       200.00      300.00     @RSUM
  560. X
  561. X    result:
  562. X    ---------  -----------  ----------- ----------- -----------
  563. X    widget-1        100.00       200.00      300.00      600.00
  564. X
  565. X
  566. X    input:
  567. X    ---------  -----------  ----------- ----------- -----------
  568. X    widget-1       100.00       200.00      300.00     @R+
  569. X
  570. X    result:
  571. X    ---------  -----------  ----------- ----------- -----------
  572. X    widget-1        100.00       200.00      300.00      500.00
  573. X
  574. X
  575. X    input:
  576. X    ---------  -----------  ----------- ----------- -----------
  577. X    widget-1       100.00       200.00      300.00     @R/
  578. X
  579. X    result:
  580. X    ---------  -----------  ----------- ----------- -----------
  581. X    widget-1        100.00       200.00      300.00        0.67
  582. X
  583. X
  584. X    input:
  585. X    ---------  -----------  ----------- ----------- -----------
  586. X    widget-1       100.00       200.00      300.00     @R/3
  587. X
  588. X    result:
  589. X    ---------  -----------  ----------- ----------- -----------
  590. X    widget-1        100.00       200.00      300.00        1.50
  591. X
  592. X    Note in the above example that the order of divisor/dividend as
  593. X    regards the immediately adjacent cell is the reverse of the
  594. X    previous example.
  595. X
  596. X
  597. X    input:
  598. X    ---------  ---------  --------- --------- ----------- ------- ----------
  599. X    widget-1     100.00     200.00      @RSUM      300.00   400.0     @RSUM
  600. X    widget-2     100.00     100.00      @RSUM      100.00   200.0     @RSUM4
  601. X                                         @NUL
  602. X                  @CSUM      @BSUM      @CSUM
  603. X
  604. X    result:
  605. X    ---------  ---------  --------- --------- ----------- ------- ----------
  606. X    widget-1      100.00     200.00    300.00      300.00   400.0     700.00
  607. X    widget-2      100.00     100.00    200.00      100.00   200.0     500.00
  608. X
  609. X                  200.00     500.00      0.00
  610. X
  611. X
  612. X
  613. XSPECIAL CONSIDERATIONS
  614. X
  615. X    The dashed-line definitions must begin at the first character
  616. X    of the line in which they occur.
  617. X
  618. X    Output files are basically in Lotus(TM) .WK1 format, and output
  619. X    files should be named with this extension to provide maximum
  620. X    information to spreadsheet programs.
  621. X
  622. X    Binary functions in column formula codes are allowed, but rarely
  623. X    make much sense.
  624. X
  625. X    The program is simple by design, and makes no attempt to incorporate
  626. X    useful, more complex features such as absolute cell positioning,
  627. X    general-purpose formulae, macros, etc.
  628. X
  629. X
  630. XBUGS
  631. X
  632. X    The maximum number of columns is currently hard-coded into the 
  633. X    program at 124; memory should be dynamically allocated to support
  634. X    an arbitrary spreadsheet size.
  635. X
  636. X    Optimizations could be applied at several points.
  637. X
  638. X    Starting/ending points for formulae should be arbitrarily
  639. X    specifiable.
  640. END_OF_FILE
  641. if test 10474 -ne `wc -c <'conv123.doc'`; then
  642.     echo shar: \"'conv123.doc'\" unpacked with wrong size!
  643. fi
  644. # end of 'conv123.doc'
  645. fi
  646. if test -f 'grph123.1' -a "${1}" != "-c" ; then 
  647.   echo shar: Will not clobber existing file \"'grph123.1'\"
  648. else
  649. echo shar: Extracting \"'grph123.1'\" \(14404 characters\)
  650. sed "s/^X//" >'grph123.1' <<'END_OF_FILE'
  651. X.TH GRPH123 1 "6 Aug 1993" "123 Utilities"
  652. X.SH NAME
  653. Xgrph123 \- The ASCII to Lotus(TM) named-graph spreadsheet converter
  654. X
  655. X.SH SYNOPSIS
  656. X.B grph123
  657. Xinputfile [outputfile]
  658. X
  659. X.SH DESCRIPTION
  660. X
  661. X.I grph123
  662. Xis a utility for reading a specially-formatted flat
  663. XASCII file and converting it into a Lotus/123(TM) ".WK1" file.
  664. XEach set of specially-formatted ASCII data creates one "named
  665. Xgraph" record, and stores the data for the named graph in a
  666. Xspreadsheet file, which may therefore contain multiple named
  667. Xgraphs.  This spreadsheet file is in its final, directly-readable
  668. Xbinary form, and need undergo no further translation
  669. Xor conversion before being read directly by Lotus/123(TM).  This
  670. Xfeature makes
  671. X.I grph123
  672. Xespecially suited to networked environments,
  673. Xwhere report writers or programs running on transaction processing
  674. Xmachines can easily and directly create spreadsheet/graph output,
  675. Xinstantly ready for copying, downloading, or direct access in the
  676. XMS-DOS(TM) or Macintosh(TM) environments.  Control of most of
  677. Xthe Lotus(TM) named graph features is allowed.  Familiarity with
  678. Xthe graph function of Lotus/123(TM) will help greatly in understanding
  679. Xthis utility.
  680. X
  681. X.SH OPTIONS
  682. XThere are currently no command-line options for
  683. X.I grph123.
  684. X
  685. X.SH PARAMETERS
  686. XThe only parameters are the input file name (required) and an
  687. Xoptional output file name.  If the output file name is not
  688. Xsupplied, output is sent to stdout, and may therefore be re-directed.  
  689. X.I grph123
  690. Xcannot currently be used as a filter, i.e.,
  691. Xhave its input "piped" to it.
  692. X
  693. X.SH INPUT FILE FORMAT
  694. XEach line of the input file has a one-character "type" at the
  695. Xstart of the line, followed by the data values suitable for that
  696. X"type" of line.  Each graph entry must have an "n"-type record,
  697. Xat least one "d"-type record, and an "e"-type record, in that
  698. Xorder.  All "d" (data)-type records for each graph should be 
  699. Xtogether, each "L"-type record must follow the associated "d"-type
  700. Xrecord, and all records for each graph must be contiguous.
  701. XBesides these restrictions (easy ones for report writers to
  702. Xmeet), record order is not significant to the utility.  This
  703. Xcan be an advantage if, for example, you wish to place the
  704. Xrecord controlling the x-axis or y-axis scale
  705. X.I after
  706. Xthe data,
  707. Xwhen you most conveniently know the minimum and maximum values.
  708. X
  709. X.I grph123
  710. Xattempts to understand each input line as well as it can,
  711. Xand ignores blank or null records, and white space at the beginning
  712. Xor end of a record, or in-between data values.  Input records that
  713. Xhave incorrect or insufficient data are ignored, and the Lotus/123(TM)
  714. Xdefaults are used (see DEFAULTS section below).  If string values
  715. Xhave embedded blanks, they must be surrounded by double quotes
  716. X("like this").
  717. X
  718. XFollowing is a description of each record type, followed by some
  719. Xexamples.  The "record type" is the letter that must be the first
  720. Xfield of each input record.  "Max size" is the maximum size (in
  721. Xbytes) of the field following.  If more than the maximum number
  722. Xof characters is supplied,
  723. X.I grph123
  724. Xusually truncates the input.
  725. X
  726. X Record Max
  727. X Type   Size                    Meaning
  728. X ------ ----  --------------------------------------------------
  729. X  n     15   This is the "name" record type, and is one of the
  730. X             required types.  The string value following is
  731. X             placed into the Lotus/123(TM) graph record as
  732. X             its name, which means that it appears on the
  733. X             circular menu after the Graph/Name/Use sequence.
  734. X
  735. X  Example:   n "Durable Ships"
  736. X
  737. X
  738. X  T     39   This the "main title" of the graph, and appears at
  739. X             the top of the graph, above the subtitle (if any).
  740. X
  741. X  Example:   T "SHIPMENTS OF DURABLE GOODS"
  742. X
  743. X
  744. X  t     39   This the "subtitle" of the graph, and appears at
  745. X             the top of the graph, below the main title.
  746. X
  747. X  Example:   t "Monthly for 1991"
  748. X
  749. X
  750. X  b     39   This the "bottom title" of the graph, and appears at
  751. X             the bottom of the graph, below the x-axis values
  752. X             on a non-pie chart.
  753. X
  754. X  Example:   b "Month"
  755. X
  756. X
  757. X  s     39   This the "side title" of the graph, and appears
  758. X             90-degrees rotated at the side of a non-pie chart,
  759. X             to the left of the y-axis.
  760. X
  761. X  Example:   s "Dollars"
  762. X
  763. X
  764. X  g          The "g" type record is an important one, and could
  765. X             be thought of as the "g)raph control" record.  Up to
  766. X             four fields may be specified on this record, which
  767. X             must be IN THIS ORDER (i.e., if you wish to specify
  768. X             the fourth field, the first three MUST ALSO be
  769. X             specified):
  770. X
  771. X           g [graph type] [grid control] [color control] [skip factor]
  772. X
  773. X             [graph type] is one of L)INE, B)AR, P)IE, S)TACKED-BAR,
  774. X             or X)Y.  Note that only the first letter of each field
  775. X             is actually significant and required, and that case is
  776. X             ignored.  This makes the examples: g line, g L, and
  777. X             g loquat equivalent expressions; the first example is
  778. X             preferred for clarity.  The default graph type is LINE.
  779. X
  780. X             [grid control] is one of n)one, h)orizonal, v)ertical, or
  781. X             b)oth.  The default grid control is NONE, or no grid.
  782. X
  783. X             [color control] is either of b)lack&white or c)olor.  If
  784. X             c)olor is specified, and the monitor being used is a
  785. X             color monitor, then each individual data range will be
  786. X             displayed in a different color.  The default color
  787. X             control is B)&W, or no color.
  788. X
  789. X             [skip factor] is an integer from 1 to 256, and is the
  790. X             number of values to skip between labeled data points.
  791. X             The default is (usually) no skipping.
  792. X
  793. X  Example:   g line horizontal color 2
  794. X
  795. X
  796. X  f          The "f" type record is the line f)ormat record, and
  797. X             is used to control the appearance of the line displayed
  798. X             on each of the six ranges allowed by Lotus/123(TM).
  799. X             There are, therefore, up to six values allowed on
  800. X             the record, controlling the appearance of lines on
  801. X             a LINE or XY graph.  The format of the "f"-type
  802. X             record is as follows:
  803. X
  804. X             f [line format]... [line format] (up to 6 times)
  805. X
  806. X             [line format] is one of n)one, l)ine, s)ymbol, or
  807. X             b)oth line and symbol.  The line format will be
  808. X             carried to the legend.  Here is an example of a
  809. X             line format record controlling three data ranges:
  810. X
  811. X  Example:   f line line both
  812. X
  813. X
  814. X  l     19   The "l" type record is the l)egend record, and is
  815. X             is used to define the text labeling displayed for
  816. X             each line example of the six ranges allowed by
  817. X             Lotus/123(TM).  There are, therefore, up to six
  818. X             string values allowed on the record, each a maxi-
  819. X             mum of 19 characters.
  820. X             The format of the "l"-type record is as follows:
  821. X
  822. X             l [legend string]... [legend string] (up to 6)
  823. X
  824. X             [legend string] is a delimited string of up to
  825. X             19 characters.
  826. X
  827. X  Example:   l "30 days" "60 days" "90 days"
  828. X
  829. X
  830. X  L          The "L"-type record is the L)abel record, and is
  831. X             is used to define the text labeling displayed for
  832. X             each data line of the six ranges allowed by
  833. X             Lotus/123(TM).  There are, therefore, up to six
  834. X             string values allowed on the record.  Each of these
  835. X             values is actually placed in the spreadsheet, so
  836. X             they may be of arbitrary length; however, they will
  837. X             be placed in the data row at the end of the y-axis
  838. X             data in columns of default length, so they may not
  839. X             be entirely visible when the spreadsheet is viewed.
  840. X             (See the "a"-type record below for information on
  841. X             how to orient the values around the data point(s)
  842. X             on the actual graph.)
  843. X
  844. X             It is possible to label EVERY data point on a graph.
  845. X             Each "L"-type record MUST follow the associated
  846. X             data record.  "L"-type records out of order will be
  847. X             ignored.  Each string value on the line matches
  848. X             the corresponding data point on the previous data
  849. X             record; therefore, if the earlier values (the ones
  850. X             toward the left of the line) are not to be labeled,
  851. X             their places must be held by a null string, represented
  852. X             by contiguous double quotes ("").
  853. X
  854. X             The format of the "L"-type record is as follows:
  855. X
  856. X             L [label string]... [label string] (up to 6)
  857. X
  858. X             [label string] is a delimited string, and must have
  859. X             double quotes surrounding the value if there are
  860. X             embedded blanks.
  861. X
  862. X  Example:   L 14.5 "" "not known" "15.90"
  863. X
  864. X
  865. X  a          The "a" type record is the label a)lignment record, and
  866. X             is used to control the position of the labels created
  867. X             by the "L"-type record for line or XY graphs.  Up to six
  868. X             values are allowed, each value controlling the display
  869. X             position of a data label range.
  870. X
  871. X             The format of the "a"-type record is as follows:
  872. X
  873. X             a [alignment]... [alignment] (up to 6 times)
  874. X
  875. X             [alignment] is one of c)enter, l)eft, r)ight, a)bove,
  876. X             or b)elow.
  877. X
  878. X  Example:   a above below
  879. X
  880. X
  881. X  d          The "d" type record is the d)ata record, and is
  882. X             one of the required types.  Each line of this
  883. X             record should contain a minimum of two values, an
  884. X             x-axis value and a y-axis value (independent and
  885. X             dependent variables).  Since Lotus/123(TM) allows
  886. X             up to six "data ranges" (dependent variables), each
  887. X             data record may contain up to seven values, one
  888. X             x-axis value and up to six y-axis values.
  889. X              
  890. X             The format of the "d"-type record is as follows:
  891. X
  892. X           d [x-axis value] [y-axis value]... (up to 6 y-axis values)
  893. X
  894. X             The x-axis values are string values for all types of
  895. X             graphs except the XY graph, where x-axis values are
  896. X             numeric.  X-axis string values follow the same rules
  897. X             as other string values, but should not exceed about
  898. X             12 characters or so, as they will start to crowd the
  899. X             visual output (you may wish to experiment with the
  900. X             skip factor in those cases).
  901. X
  902. X  Example:   d "Jan" 5000000.00 7300000.00
  903. X
  904. X
  905. X  p          The "p" type record is the decimal p)laces record, and
  906. X             is used to control the numer of decimal places in each
  907. X             dependent data range created by the "d"-type record.  Up
  908. X             to six integer values are allowed.
  909. X
  910. X             The format of the "p"-type record is as follows:
  911. X
  912. X             p [decimal places]... (up to 6 times)
  913. X
  914. X             [decimal places] is a decimal integer in the range 0
  915. X             to 6.  Integers below 0 or above six will be set at
  916. X             0 and 6 respectively.
  917. X
  918. X  Example:   p 3 3
  919. X
  920. X
  921. X  y          The "y" type record is the y)-axis min/max record, and
  922. X             is used to control the "scale" of the graph when the
  923. X             automatic scaling is insufficient or too inconsistent.
  924. X             There are two numeric values expected.
  925. X
  926. X             The format of the "y"-type record is as follows:
  927. X
  928. X             y [min value] [max value]
  929. X
  930. X             [min value] and [max value] are decimal numbers.
  931. X
  932. X  Example:   y 2000000.0 15000000
  933. X
  934. X
  935. X  x          The "x" type record is the x)-axis min/max record, and
  936. X             is used to control the "scale" of the graph when the
  937. X             automatic scaling is insufficient or too inconsistent.
  938. X             There are two numeric values expected.  Use some
  939. X             caution when specifying x-axis min and max values
  940. X             on non-XY graphs.
  941. X
  942. X             The format of the "x"-type record is as follows:
  943. X
  944. X             x [min value] [max value]
  945. X
  946. X             [min value] and [max value] are decimal numbers.
  947. X
  948. X  Example:   x 10.0 45.0
  949. X
  950. X
  951. X  e          The "e" type record is an important and required one,
  952. X             as it triggers actual graph record creation.  It MUST
  953. X             appear after all other graph information, and will
  954. X             reset internal flags in preparation for the next set
  955. X             of graph information.
  956. X
  957. X  Example:   e 
  958. X
  959. X
  960. X  #          The "#" type record is a comment record; any values
  961. X             may follow up to the end-of-line.
  962. X
  963. X  Example:   # This is a comment record
  964. X
  965. X
  966. X.SH MISSING VALUES
  967. XFor the purposes of this utility, a missing value may be defined by
  968. Xany value less than or equal to -2000000000.00 (minus two thousand
  969. Xmillion).
  970. X
  971. X.SH SPECIAL CONSIDERATIONS FOR PIE CHARTS
  972. XAlthough
  973. X.I grph123
  974. Xwill accept multiple data ranges for pie graphs,
  975. XLotus/123 makes use of only the A and B data ranges, with the
  976. XB data range controlling shading (or color if the color flag is 
  977. Xon and a color monitor is used) and explosion.  The X-axis
  978. Xvalues are used as labels, and percentages are displayed
  979. Xautomatically.  The bottom and side titles are not used.
  980. X
  981. X.SH FILE EXAMPLE
  982. XHere is an example of a file that defines two graphs.  The first is
  983. Xa line graph, and the second is a pie graph.  Note that in the first
  984. Xgraph example, the first x-axis value is in double quotes, and the
  985. Xfollowing ones are not; both are interpreted exactly the same way,
  986. Xsince there are no embedded blanks.  In addition, there are two
  987. X"data ranges" (dependent variables) in the first graph example,
  988. Xand all values are displayed with two decimal places, regardless
  989. Xof input format.
  990. X
  991. XIn the second (pie chart) example, the five slices of the pie are
  992. Xshaded in colors 1 through 5, with slice three exploded.
  993. X
  994. X # First, a line graph
  995. X n "30-60-90 graph1"
  996. X T "SUMMARY BACKLOG BY WEEK"
  997. X t "30-60-90 days"
  998. X b "Manufacturing Wk"
  999. X s "Dollar"
  1000. X g line horizontal b&w 2
  1001. X f both both
  1002. X l "30 day" "60 day"
  1003. X a above above
  1004. X d "9039" 6533515.10 14500000
  1005. X L           6.53      14.5
  1006. X d 9040 6229610.10 14220000
  1007. X L       labelit  "label it"
  1008. X d 9042 7685293.90 14500000
  1009. X d 9043 10008108.35 15800000
  1010. X p 2 2
  1011. X y 5000000 18000000
  1012. X e
  1013. X #
  1014. X # Now, a pie graph
  1015. X #
  1016. X n "Sales by Terr"
  1017. X T "SALES BY TERRITORY"
  1018. X t "August 1992"
  1019. X g PIE none color
  1020. X d widgets 45000 1
  1021. X d loffles 53000 2
  1022. X d scouse 50000.17 103
  1023. X d framjits 63000 4
  1024. X d gopples 77342 5
  1025. X p 2 0
  1026. X e
  1027. X
  1028. X.SH BUGS
  1029. X.I grph123
  1030. Xshould be able to run as a filter.
  1031. X
  1032. XTabs as delimiters do not behave consistently.
  1033. END_OF_FILE
  1034. if test 14404 -ne `wc -c <'grph123.1'`; then
  1035.     echo shar: \"'grph123.1'\" unpacked with wrong size!
  1036. fi
  1037. # end of 'grph123.1'
  1038. fi
  1039. if test -f 'grph123.doc' -a "${1}" != "-c" ; then 
  1040.   echo shar: Will not clobber existing file \"'grph123.doc'\"
  1041. else
  1042. echo shar: Extracting \"'grph123.doc'\" \(15182 characters\)
  1043. sed "s/^X//" >'grph123.doc' <<'END_OF_FILE'
  1044. X
  1045. X
  1046. XNAME
  1047. X    graph 123 - The ASCII to Lotus/123(TM) named graph converter
  1048. X
  1049. XSYNOPSIS
  1050. X    grph123 filename [outputfile]
  1051. X
  1052. XINTRODUCTION
  1053. X    grph123 is a utility for reading a specially-formatted flat
  1054. X    ASCII file and converting it into a Lotus/123(TM) ".WK1" file.
  1055. X    Each set of specially-formatted ASCII data creates one "named
  1056. X    graph" record, and stores the data for the named graph in a
  1057. X    spreadsheet file, which may therefore contain multiple named
  1058. X    graphs.  This spreadsheet file is in its final, directly-
  1059. X    readable binary form, and need undergo no further translation
  1060. X    or conversion before being read directly by Lotus/123(TM).  This
  1061. X    feature makes grph123 especially suited to networked environments,
  1062. X    where report writers or programs running on transaction processing
  1063. X    machines can easily and directly create spreadsheet/graph output,
  1064. X    instantly ready for copying, downloading, or direct access in the
  1065. X    MS-DOS(TM) or Macintosh(TM) environments.  Control of most of
  1066. X    the Lotus(TM) named graph features is allowed.  Familiarity with
  1067. X    the graph function of Lotus/123(TM) will help greatly in under-
  1068. X    standing this utility.
  1069. X
  1070. XOPTIONS
  1071. X    There are currently no command-line options for grph123.
  1072. X
  1073. XPARAMETERS
  1074. X    The only parameters are the input file name (required) and an
  1075. X    optional output file name.  If the output file name is not
  1076. X    supplied, output is sent to stdout, and may therefore be re-
  1077. X    directed.  grph123 cannot currently be used as a filter, i.e.,
  1078. X    have its input "piped" to it.
  1079. X
  1080. XINPUT FILE FORMAT
  1081. X    Each line of the input file has a one-character "type" at the
  1082. X    start of the line, followed by the data values suitable for that
  1083. X    "type" of line.  Each graph entry must have an "n"-type record,
  1084. X    at least one "d"-type record, and an "e"-type record, in that
  1085. X    order.  All "d" (data)-type records for each graph should be 
  1086. X    together, each "L"-type record must follow the associated "d"-type
  1087. X    record, and all records for each graph must be contiguous.
  1088. X    Besides these restrictions (easy ones for report writers to
  1089. X    meet), record order is not significant to the utility.  This
  1090. X    can be an advantage if, for example, you wish to place the
  1091. X    record controlling the x-axis or y-axis scale _after_ the data,
  1092. X    when you most conveniently know the minimum and maximum values.
  1093. X
  1094. X    grph123 attempts to understand each input line as well as it can,
  1095. X    and ignores blank or null records, and white space at the beginning
  1096. X    or end of a record, or in-between data values.  Input records that
  1097. X    have incorrect or insufficient data are ignored, and the Lotus/123(TM)
  1098. X    defaults are used (see DEFAULTS section below).  If string values
  1099. X    have embedded blanks, they must be surrounded by double quotes
  1100. X    ("like this").
  1101. X
  1102. X    Following is a description of each record type, followed by some
  1103. X    examples.  The "record type" is the letter that must be the first
  1104. X    field of each input record.  "Max size" is the maximum size (in
  1105. X    bytes) of the field following.  If more than the maximum number
  1106. X    of characters is supplied, grph123 usually truncates the input.
  1107. X
  1108. X    Record Max
  1109. X    Type   Size                    Meaning
  1110. X    ------ ----  --------------------------------------------------
  1111. X      n     15   This is the "name" record type, and is one of the
  1112. X                 required types.  The string value following is
  1113. X                 placed into the Lotus/123(TM) graph record as
  1114. X                 its name, which means that it appears on the
  1115. X                 circular menu after the Graph/Name/Use sequence.
  1116. X
  1117. X      Example:   n "Durable Ships"
  1118. X
  1119. X
  1120. X      T     39   This the "main title" of the graph, and appears at
  1121. X                 the top of the graph, above the subtitle (if any).
  1122. X
  1123. X      Example:   T "SHIPMENTS OF DURABLE GOODS"
  1124. X
  1125. X
  1126. X      t     39   This the "subtitle" of the graph, and appears at
  1127. X                 the top of the graph, below the main title.
  1128. X
  1129. X      Example:   t "Monthly for 1991"
  1130. X
  1131. X
  1132. X      b     39   This the "bottom title" of the graph, and appears at
  1133. X                 the bottom of the graph, below the x-axis values
  1134. X                 on a non-pie chart.
  1135. X
  1136. X      Example:   b "Month"
  1137. X
  1138. X
  1139. X      s     39   This the "side title" of the graph, and appears
  1140. X                 90-degrees rotated at the side of a non-pie chart,
  1141. X                 to the left of the y-axis.
  1142. X
  1143. X      Example:   s "Dollars"
  1144. X
  1145. X
  1146. X      g          The "g" type record is an important one, and could
  1147. X                 be thought of as the "g)raph control" record.  Up to
  1148. X                 four fields may be specified on this record, which
  1149. X                 must be IN THIS ORDER (i.e., if you wish to specify
  1150. X                 the fourth field, the first three MUST ALSO be
  1151. X                 specified):
  1152. X
  1153. X                 g [graph type] [grid control] [color control] [skip factor]
  1154. X
  1155. X                 [graph type] is one of L)INE, B)AR, P)IE, S)TACKED-BAR, or
  1156. X                 X)Y.  Note that only the first letter of each field is
  1157. X                 actually significant and required, and that case is ignored.
  1158. X                 This makes the examples: g line, g L, and g loquat
  1159. X                 equivalent expressions; the first example is preferred
  1160. X                 for clarity.  The default graph type is LINE.
  1161. X
  1162. X                 [grid control] is one of n)one, h)orizonal, v)ertical, or
  1163. X                 b)oth.  The default grid control is NONE, or no grid.
  1164. X
  1165. X                 [color control] is either of b)lack&white or c)olor.  If
  1166. X                 c)olor is specified, and the monitor being used is a
  1167. X                 color monitor, then each individual data range will be
  1168. X                 displayed in a different color.  The default color control
  1169. X                 is B)&W, or no color.
  1170. X
  1171. X                 [skip factor] is an integer from 1 to 256, and is the
  1172. X                 number of values to skip between labeled data points.
  1173. X                 The default is (usually) no skipping.
  1174. X
  1175. X      Example:   g line horizontal color 2
  1176. X
  1177. X
  1178. X      f          The "f" type record is the line f)ormat record, and
  1179. X                 is used to control the appearance of the line displayed
  1180. X                 on each of the six ranges allowed by Lotus/123(TM).
  1181. X                 There are, therefore, up to six values allowed on
  1182. X                 the record, controlling the appearance of lines on
  1183. X                 a LINE or XY graph.  The format of the "f"-type
  1184. X                 record is as follows:
  1185. X
  1186. X                 f [line format]... [line format] (up to 6 times)
  1187. X
  1188. X                 [line format] is one of n)one, l)ine, s)ymbol, or
  1189. X                 b)oth line and symbol.  The line format will be
  1190. X                 carried to the legend.  Here is an example of a
  1191. X                 line format record controlling three data ranges:
  1192. X
  1193. X      Example:   f line line both
  1194. X
  1195. X
  1196. X      l     19   The "l" type record is the l)egend record, and is
  1197. X                 is used to define the text labeling displayed for
  1198. X                 each line example of the six ranges allowed by
  1199. X                 Lotus/123(TM).  There are, therefore, up to six
  1200. X                 string values allowed on the record, each a maxi-
  1201. X                 mum of 19 characters.
  1202. X                 The format of the "l"-type record is as follows:
  1203. X
  1204. X                 l [legend string]... [legend string] (up to 6)
  1205. X
  1206. X                 [legend string] is a delimited string of up to
  1207. X                 19 characters.
  1208. X
  1209. X      Example:   l "30 days" "60 days" "90 days"
  1210. X
  1211. X
  1212. X      L          The "L"-type record is the L)abel record, and is
  1213. X                 is used to define the text labeling displayed for
  1214. X                 each data line of the six ranges allowed by
  1215. X                 Lotus/123(TM).  There are, therefore, up to six
  1216. X                 string values allowed on the record.  Each of these
  1217. X                 values is actually placed in the spreadsheet, so
  1218. X                 they may be of arbitrary length; however, they will
  1219. X                 be placed in the data row at the end of the y-axis
  1220. X                 data in columns of default length, so they may not
  1221. X                 be entirely visible when the spreadsheet is viewed.
  1222. X                 (See the "a"-type record below for information on
  1223. X                 how to orient the values around the data point(s)
  1224. X                 on the actual graph.)
  1225. X
  1226. X                 It is possible to label EVERY data point on a graph.
  1227. X                 Each "L"-type record MUST follow the associated
  1228. X                 data record.  "L"-type records out of order will be
  1229. X                 ignored.  Each string value on the line matches
  1230. X                 the corresponding data point on the previous data
  1231. X                 record; therefore, if the earlier values (the ones
  1232. X                 toward the left of the line) are not to be labeled,
  1233. X                 their places must be held by a null string, represented
  1234. X                 by contiguous double quotes ("").
  1235. X
  1236. X                 The format of the "L"-type record is as follows:
  1237. X
  1238. X                 L [label string]... [label string] (up to 6)
  1239. X
  1240. X                 [label string] is a delimited string, and must have
  1241. X                 double quotes surrounding the value if there are
  1242. X                 embedded blanks.
  1243. X
  1244. X      Example:   L 14.5 "" "not known" "15.90"
  1245. X
  1246. X
  1247. X      a          The "a" type record is the label a)lignment record, and
  1248. X                 is used to control the position of the labels created
  1249. X                 by the "L"-type record for line or XY graphs.  Up to six
  1250. X                 values are allowed, each value controlling the display
  1251. X                 position of a data label range.
  1252. X
  1253. X                 The format of the "a"-type record is as follows:
  1254. X
  1255. X                 a [alignment]... [alignment] (up to 6 times)
  1256. X
  1257. X                 [alignment] is one of c)enter, l)eft, r)ight, a)bove,
  1258. X                 or b)elow.
  1259. X
  1260. X      Example:   a above below
  1261. X
  1262. X
  1263. X      d          The "d" type record is the d)ata record, and is
  1264. X                 one of the required types.  Each line of this
  1265. X                 record should contain a minimum of two values, an
  1266. X                 x-axis value and a y-axis value (independent and
  1267. X                 dependent variables).  Since Lotus/123(TM) allows
  1268. X                 up to six "data ranges" (dependent variables), each
  1269. X                 data record may contain up to seven values, one
  1270. X                 x-axis value and up to six y-axis values.
  1271. X              
  1272. X                 The format of the "d"-type record is as follows:
  1273. X
  1274. X                 d [x-axis value] [y-axis value]... (up to 6 y-axis values)
  1275. X
  1276. X                 The x-axis values are string values for all types of
  1277. X                 graphs except the XY graph, where x-axis values are
  1278. X                 numeric.  X-axis string values follow the same rules
  1279. X                 as other string values, but should not exceed about
  1280. X                 12 characters or so, as they will start to crowd the
  1281. X                 visual output (you may wish to experiment with the
  1282. X                 skip factor in those cases).
  1283. X
  1284. X      Example:   d "Jan" 5000000.00 7300000.00
  1285. X
  1286. X
  1287. X      p          The "p" type record is the decimal p)laces record, and
  1288. X                 is used to control the numer of decimal places in each
  1289. X                 dependent data range created by the "d"-type record.  Up
  1290. X                 to six integer values are allowed.
  1291. X
  1292. X                 The format of the "p"-type record is as follows:
  1293. X
  1294. X                 p [decimal places]... (up to 6 times)
  1295. X
  1296. X                 [decimal places] is a decimal integer in the range 0
  1297. X                 to 6.  Integers below 0 or above six will be set at
  1298. X                 0 and 6 respectively.
  1299. X
  1300. X      Example:   p 3 3
  1301. X
  1302. X
  1303. X      y          The "y" type record is the y)-axis min/max record, and
  1304. X                 is used to control the "scale" of the graph when the
  1305. X                 automatic scaling is insufficient or too inconsistent.
  1306. X                 There are two numeric values expected.
  1307. X
  1308. X                 The format of the "y"-type record is as follows:
  1309. X
  1310. X                 y [min value] [max value]
  1311. X
  1312. X                 [min value] and [max value] are decimal numbers.
  1313. X
  1314. X      Example:   y 2000000.0 15000000
  1315. X
  1316. X
  1317. X      x          The "x" type record is the x)-axis min/max record, and
  1318. X                 is used to control the "scale" of the graph when the
  1319. X                 automatic scaling is insufficient or too inconsistent.
  1320. X                 There are two numeric values expected.  Use some
  1321. X                 caution when specifying x-axis min and max values
  1322. X                 on non-XY graphs.
  1323. X
  1324. X                 The format of the "x"-type record is as follows:
  1325. X
  1326. X                 x [min value] [max value]
  1327. X
  1328. X                 [min value] and [max value] are decimal numbers.
  1329. X
  1330. X      Example:   x 10.0 45.0
  1331. X
  1332. X
  1333. X      e          The "e" type record is an important and required one,
  1334. X                 as it triggers actual graph record creation.  It MUST
  1335. X                 appear after all other graph information, and will
  1336. X                 reset internal flags in preparation for the next set
  1337. X                 of graph information.
  1338. X
  1339. X      Example:   e 
  1340. X
  1341. X
  1342. X      #          The "#" type record is a comment record; any values
  1343. X                 may follow up to the end-of-line.
  1344. X
  1345. X      Example:   # This is a comment record
  1346. X
  1347. X
  1348. XMISSING VALUES
  1349. X    For the purposes of this utility, a missing value may be defined by
  1350. X    any value less than or equal to -2000000000.00 (minus two thousand
  1351. X    million).
  1352. X
  1353. XSPECIAL CONSIDERATIONS FOR PIE CHARTS
  1354. X    Although grph123 will accept multiple data ranges for pie graphs,
  1355. X    Lotus/123 makes use of only the A and B data ranges, with the
  1356. X    B data range controlling shading (or color if the color flag is 
  1357. X    on and a color monitor is used) and explosion.  The X-axis
  1358. X    values are used as labels, and percentages are displayed auto-
  1359. X    matically.  The bottom and side titles are not used.
  1360. X
  1361. XFILE EXAMPLE
  1362. X    Here is an example of a file that defines two graphs.  The first is
  1363. X    a line graph, and the second is a pie graph.  Note that in the first
  1364. X    graph example, the first x-axis value is in double quotes, and the
  1365. X    following ones are not; both are interpreted exactly the same way,
  1366. X    since there are no embedded blanks.  In addition, there are two
  1367. X    "data ranges" (dependent variables) in the first graph example,
  1368. X    and all values are displayed with two decimal places, regardless
  1369. X    of input format.
  1370. X
  1371. X    In the second (pie chart) example, the five slices of the pie are
  1372. X    shaded in colors 1 through 5, with slice three exploded.
  1373. X
  1374. X# First, a line graph
  1375. Xn "30-60-90 graph1"
  1376. XT "SUMMARY BACKLOG BY WEEK"
  1377. Xt "30-60-90 days"
  1378. Xb "Manufacturing Wk"
  1379. Xs "Dollar"
  1380. Xg line horizontal b&w 2
  1381. Xf both both
  1382. Xl "30 day" "60 day"
  1383. Xa above above
  1384. Xd "9039" 6533515.10 14500000
  1385. XL           6.53      14.5
  1386. Xd 9040 6229610.10 14220000
  1387. XL       labelit  "label it"
  1388. Xd 9042 7685293.90 14500000
  1389. Xd 9043 10008108.35 15800000
  1390. Xp 2 2
  1391. Xy 5000000 18000000
  1392. Xe
  1393. X#
  1394. X# Now, a pie graph
  1395. X#
  1396. Xn "Sales by Terr"
  1397. XT "SALES BY TERRITORY"
  1398. Xt "August 1992"
  1399. Xg PIE none color
  1400. Xd widgets 45000 1
  1401. Xd loffles 53000 2
  1402. Xd scouse 50000.17 103
  1403. Xd framjits 63000 4
  1404. Xd gopples 77342 5
  1405. Xp 2 0
  1406. Xe
  1407. X
  1408. XBUGS
  1409. Xgrph123 should be able to run as a filter.
  1410. XTabs as delimiters do not behave consistently.
  1411. END_OF_FILE
  1412. if test 15182 -ne `wc -c <'grph123.doc'`; then
  1413.     echo shar: \"'grph123.doc'\" unpacked with wrong size!
  1414. fi
  1415. # end of 'grph123.doc'
  1416. fi
  1417. if test -f 'int2s.c' -a "${1}" != "-c" ; then 
  1418.   echo shar: Will not clobber existing file \"'int2s.c'\"
  1419. else
  1420. echo shar: Extracting \"'int2s.c'\" \(151 characters\)
  1421. sed "s/^X//" >'int2s.c' <<'END_OF_FILE'
  1422. X
  1423. Xvoid
  1424. Xint2s(i,ptr)
  1425. Xint i;
  1426. Xchar *ptr;
  1427. X{
  1428. X    short si;
  1429. X    char *p;
  1430. X
  1431. X    si = i;
  1432. X    p = (char *)(&si);
  1433. X    *ptr++ = *p++;
  1434. X    *ptr = *p;
  1435. X
  1436. X    return;
  1437. X}
  1438. END_OF_FILE
  1439. if test 151 -ne `wc -c <'int2s.c'`; then
  1440.     echo shar: \"'int2s.c'\" unpacked with wrong size!
  1441. fi
  1442. # end of 'int2s.c'
  1443. fi
  1444. if test -f 'lotus.h' -a "${1}" != "-c" ; then 
  1445.   echo shar: Will not clobber existing file \"'lotus.h'\"
  1446. else
  1447. echo shar: Extracting \"'lotus.h'\" \(13529 characters\)
  1448. sed "s/^X//" >'lotus.h' <<'END_OF_FILE'
  1449. X/* @(#) $Revision: 1.0 */      
  1450. X
  1451. X/*
  1452. X * Definitions for .wks types of records, as structures
  1453. X * All elements are type char, even when numeric...
  1454. X * That's because they must be byte-aligned (and, by the
  1455. X * way, byte-swapped) in the .wks file.
  1456. X */
  1457. X
  1458. Xtypedef struct  {
  1459. X    char    opcode[2];        /* 02h (02d) */
  1460. X    char    record_length[2];    /* 2d */
  1461. X    char    ff_version[2];        /* file format version (0404h,1028d) */
  1462. X} BOF;
  1463. X
  1464. Xtypedef struct  {
  1465. X    char    opcode[2];        /* 06h (06d) */
  1466. X    char    record_length[2];    /* 8d */
  1467. X    char    start_column[2];
  1468. X    char    start_row[2];
  1469. X    char    end_column[2];
  1470. X    char    end_row[2];
  1471. X} RANGE;
  1472. X
  1473. Xtypedef struct  {
  1474. X    char    opcode[2];        /* 96h (150d) */
  1475. X    char    record_length[2];    /* variable */
  1476. X    char    column_number[2];
  1477. X    char    lowest_row[2];        /* lowest row number of active cell */
  1478. X    char    highest_row[2];        /* highest row number of active cell */
  1479. X} CPI;
  1480. X
  1481. Xtypedef struct  {
  1482. X    char    opcode[2];        /* 2Fh (47d) */
  1483. X    char    record_length[2];    /* 1d */
  1484. X    char    iteration_count[1];
  1485. X} CALCCOUNT;
  1486. X
  1487. Xtypedef struct  {
  1488. X    char    opcode[2];        /* 02h (02d) */
  1489. X    char    record_length[2];    /* 1d */
  1490. X    char    recalculation[1];    /* 00h is manual, FFh is automatic */
  1491. X} CALCMODE;
  1492. X
  1493. Xtypedef struct  {
  1494. X    char    opcode[2];        /* 03h (03d) */
  1495. X    char    record_length[2];    /* 1d */
  1496. X    char    calc_order[1];        /* 00h is natural recalc order */
  1497. X                    /* 01h is recalculation by column */
  1498. X                    /* FFh is recalculation by row */
  1499. X} CALCORDER;
  1500. X
  1501. Xtypedef struct  {
  1502. X    char    opcode[2];        /* 04h (04d) */
  1503. X    char    record_length[2];    /* 1d */
  1504. X    char    window_split[1];    /* 00h is not split */
  1505. X                    /* 01h is vertical split */
  1506. X                    /* FFh is horizontal split */
  1507. X} SPLIT;
  1508. X
  1509. Xtypedef struct  {
  1510. X    char    opcode[2];        /* 05h (05d) */
  1511. X    char    record_length[2];    /* 1d */
  1512. X    char    window_sync[1];        /* 00h is not synchronized */
  1513. X                    /* FFh is window synchronized */
  1514. X} SYNC;
  1515. X
  1516. Xtypedef struct  {
  1517. X    char    opcode[2];        /* 07h (07d) */
  1518. X    char    record_length[2];    /* 32d */
  1519. X    char    cc_column[2];        /* current cursor column */
  1520. X    char    cc_row[2];        /* current cursor row */
  1521. X    char    cell_format[1];
  1522. X    char    unused1[1];        /* must be 00h ? */
  1523. X    char    column_width[2];
  1524. X    char    ncol_on_screen[2];    /* number of columns on screen */
  1525. X    char    nrow_on_screen[2];    /* number of rows on screen */
  1526. X    char    leftmost_column[2];
  1527. X    char    top_row[2];
  1528. X    char    ntitle_col[2];        /* number of title columns */
  1529. X    char    ntitle_row[2];        /* number of title rows */
  1530. X    char    ltitle_col[2];        /* left title column */
  1531. X    char    ttitle_row[2];        /* top title row */
  1532. X    char    borderwd_col[2];    /* border width column */
  1533. X    char    borderwd_row[2];    /* border width row */
  1534. X    char    window_width[2];
  1535. X    char    unused2[1];        /* must be 00h */
  1536. X    char    unused3[1];        /* this spot was undocumented */
  1537. X} WINDOW1;
  1538. X
  1539. Xtypedef struct  {
  1540. X    char    opcode[2];        /* 08h (08d) */
  1541. X    char    record_length[2];    /* 3d */
  1542. X    char    column_number[2];
  1543. X    char    column_width[1];
  1544. X} COLW1;
  1545. X
  1546. Xtypedef struct  {
  1547. X    char    opcode[2];        /* 31h (49d) */
  1548. X    char    record_length[2];    /* 1d */
  1549. X    char    cursor_window[1];    /* 01h is cursor in window 1 */
  1550. X                    /* 02h is cursor in window 2 */
  1551. X} CURSORW12;
  1552. X
  1553. Xtypedef struct  {
  1554. X    char    opcode[2];        /* 0Bh (11d) */
  1555. X    char    record_length[2];    /* 24d */
  1556. X    char    range_name[16];
  1557. X    char    start_column[2];
  1558. X    char    start_row[2];
  1559. X    char    end_column[2];
  1560. X    char    end_row[2];
  1561. X} RNAME;
  1562. X
  1563. Xtypedef struct {
  1564. X    char    y_start_col[2];        /* y-range start column */
  1565. X    char    y_start_row[2];        /* y-range start row */
  1566. X    char    y_end_col[2];        /* y-range end column */
  1567. X    char    y_end_row[2];        /* y-range end row */
  1568. X} grange;
  1569. X
  1570. Xtypedef struct  {
  1571. X    char    opcode[2];        /* 2Eh (45d) */
  1572. X    char    record_length[2];    /* 453d */
  1573. X    char    graph_name[16];        /* null-terminated */
  1574. X    char    x_start_col[2];        /* x-range start column */
  1575. X    char    x_start_row[2];        /* x-range start row */
  1576. X    char    x_end_col[2];        /* x-range end column */
  1577. X    char    x_end_row[2];        /* x-range end row */
  1578. X    grange    yd_range[6];        /* y-range structures (data) */
  1579. X    grange    yl_range[6];        /* y-range structures (labels) */
  1580. X    char    graph_type[1];        /* 0=XY, 1=bar, 2=pie, 3=unused, */
  1581. X                    /* 4=line, 5=stacked bar      */
  1582. X    char    grid[1];        /* 0=none, 1=horizontal, 2=vertical */
  1583. X                    /* 3=both                */
  1584. X    char    color[1];        /* 0=b&w, FFh=color */
  1585. X    char    y_lformat[6];        /* y-range line formats */
  1586. X                    /* 0=none, 1=line, 2=symbol, */
  1587. X                    /* 3=line-symbol          */
  1588. X    char    y_dlalign[6];        /* y-range data label alignment */
  1589. X                    /* 0=center, 1=right, 2=below,  */
  1590. X                    /* 3=left, 4=above        */
  1591. X    char    x_scale[1];        /* 0=auto, 1=manual */
  1592. X    char    x_low_limit[8];        /* x-range lower limit (real) */
  1593. X    char    x_up_limit[8];        /* x-range upper limit (real) */
  1594. X    char    y_scale[1];        /* 0=auto, 1=manual */
  1595. X    char    y_low_limit[8];        /* y-range lower limit (real) */
  1596. X    char    y_up_limit[8];        /* y-range upper limit (real) */
  1597. X    char    first_title[40];    /* top of the graph */
  1598. X    char    second_title[40];    /* just below the first */
  1599. X    char    x_title[40];        /* bottom of the graph */
  1600. X    char    y_title[40];        /* side of the graph */
  1601. X    char    y_legend[6][20];
  1602. X    char    x_format[1];
  1603. X    char    y_format[1];
  1604. X    char    skip_factor[2];
  1605. X    char    unknown[2];
  1606. X} NGRAPH;
  1607. X
  1608. Xtypedef struct  {
  1609. X    char    opcode[2];        /* 18h (24d) */
  1610. X    char    record_length[2];    /* 25d */
  1611. X    char    table_ind[1];        /* 00h is no table */
  1612. X                    /* 01h is table 1 */
  1613. X                    /* 02h is table 2 */
  1614. X    char    table_start_column[2];
  1615. X    char    table_start_row[2];
  1616. X    char    table_end_column[2];
  1617. X    char    table_end_row[2];
  1618. X    char    cell1_start_column[2];
  1619. X    char    cell1_start_row[2];
  1620. X    char    cell1_end_column[2];
  1621. X    char    cell1_end_row[2];
  1622. X    char    cell2_start_column[2];
  1623. X    char    cell2_start_row[2];
  1624. X    char    cell2_end_column[2];
  1625. X    char    cell2_end_row[2];
  1626. X} TABLE;
  1627. X
  1628. Xtypedef struct  {
  1629. X    char    opcode[2];        /* 19h (25d) */
  1630. X    char    record_length[2];    /* 25d */
  1631. X    char    input_start_column[2];
  1632. X    char    input_start_row[2];
  1633. X    char    input_end_column[2];
  1634. X    char    input_end_row[2];
  1635. X    char    output_start_column[2];
  1636. X    char    output_start_row[2];
  1637. X    char    output_end_column[2];
  1638. X    char    output_end_row[2];
  1639. X    char    criteria_start_column[2];
  1640. X    char    criteria_start_row[2];
  1641. X    char    criteria_end_column[2];
  1642. X    char    criteria_end_row[2];
  1643. X    char    command[1];        /* 00h is no command */
  1644. X                    /* 01h is find */
  1645. X                    /* 02h is extract */
  1646. X                    /* 03h is delete */
  1647. X                    /* 04h is unique */
  1648. X} QRANGE; /* query range */
  1649. X
  1650. Xtypedef struct  {
  1651. X    char    opcode[2];        /* 1Ah (26d) */
  1652. X    char    record_length[2];    /* 8d */
  1653. X    char    start_column[2];
  1654. X    char    start_row[2];
  1655. X    char    end_column[2];
  1656. X    char    end_row[2];
  1657. X} PRANGE; /* print range */
  1658. X
  1659. Xtypedef struct  {
  1660. X    char    opcode[2];        /* h (d) */
  1661. X    char    record_length[2];    /* d */
  1662. X} FORMAT;
  1663. X
  1664. Xtypedef struct  {
  1665. X    char    opcode[2];        /* 1Ch (28d) */
  1666. X    char    record_length[2];    /* 8d */
  1667. X    char    start_column[2];
  1668. X    char    start_row[2];
  1669. X    char    end_column[2];
  1670. X    char    end_row[2];
  1671. X} FRANGE; /* fill range */
  1672. X
  1673. Xtypedef struct  {
  1674. X    char    opcode[2];        /* 1Bh (27d) */
  1675. X    char    record_length[2];    /* 8d */
  1676. X    char    start_column[2];
  1677. X    char    start_row[2];
  1678. X    char    end_column[2];
  1679. X    char    end_row[2];
  1680. X} SRANGE; /* sort range */
  1681. X
  1682. Xtypedef struct  {
  1683. X    char    opcode[2];        /* 1Dh (29d) */
  1684. X    char    record_length[2];    /* 9d */
  1685. X    char    start_column[2];
  1686. X    char    start_row[2];
  1687. X    char    end_column[2];
  1688. X    char    end_row[2];
  1689. X    char    sort_order[1];        /* 00h is descending, FFh ascending */
  1690. X} KRANGE; /* primary sort key range */
  1691. X
  1692. Xtypedef struct  {
  1693. X    char    opcode[2];        /* 23h (35d) */
  1694. X    char    record_length[2];    /* 9d */
  1695. X    char    start_column[2];
  1696. X    char    start_row[2];
  1697. X    char    end_column[2];
  1698. X    char    end_row[2];
  1699. X    char    sort_order[1];        /* 00h is descending, FFh ascending */
  1700. X} KRANGE2; /* secondary sort key range */
  1701. X
  1702. X
  1703. Xtypedef struct  {
  1704. X    char    opcode[2];        /* 67h (103d) */
  1705. X    char    record_length[2];    /* 25d */
  1706. X    char    depvar_start_column[2];
  1707. X    char    depvar_start_row[2];
  1708. X    char    depvar_end_column[2];
  1709. X    char    depvar_end_row[2];
  1710. X    char    indvar_start_column[2];
  1711. X    char    indvar_start_row[2];
  1712. X    char    invdar_end_column[2];
  1713. X    char    indvar_end_row[2];
  1714. X    char    output_start_column[2];
  1715. X    char    output_start_row[2];
  1716. X    char    output_end_column[2];
  1717. X    char    output_end_row[2];
  1718. X    char    zero_intercept[1];    /* 00h is not forced */
  1719. X                    /* -1 is forced intercept at origin */
  1720. X} RRANGES; /* linear regression ranges */
  1721. X
  1722. Xtypedef struct  {
  1723. X    char    opcode[2];        /* 20h (32d) */
  1724. X    char    record_length[2];    /* 16d */
  1725. X    char    values_start_column[2];
  1726. X    char    values_start_row[2];
  1727. X    char    values_end_column[2];
  1728. X    char    values_end_row[2];
  1729. X    char    bin_start_column[2];
  1730. X    char    bin_start_row[2];
  1731. X    char    bin_end_column[2];
  1732. X    char    bin_end_row[2];
  1733. X} HRANGE; /* distribution range */
  1734. X
  1735. Xtypedef struct  {
  1736. X    char    opcode[2];        /* 24h (36d) */
  1737. X    char    record_length[2];    /* 1d */
  1738. X    char    protection[1];        /* 00h is global off, 01h is on */
  1739. X} PROTECT; /* global protection */
  1740. X
  1741. Xtypedef struct  {
  1742. X    char    opcode[2];        /* 25h (37d) */
  1743. X    char    record_length[2];    /* 242d */
  1744. X    char    footer_string[242];    /* NULL terminated ASCII */
  1745. X} FOOTER; /* print footer */
  1746. X
  1747. Xtypedef struct  {
  1748. X    char    opcode[2];        /* 26h (38d) */
  1749. X    char    record_length[2];    /* 242d */
  1750. X    char    header_string[242];    /* NULL terminated ASCII */
  1751. X} HEADER; /* print header */
  1752. X
  1753. Xtypedef struct  {
  1754. X    char    opcode[2];        /* 27h (39d) */
  1755. X    char    record_length[2];    /* 40d */
  1756. X    char    setup_string[40];    /* NULL terminated ASCII */
  1757. X} SETUP; /* print setup string */
  1758. X
  1759. Xtypedef struct  {
  1760. X    char    opcode[2];        /* 28h (40d) */
  1761. X    char    record_length[2];    /* 10d */
  1762. X    char    left_margin[2];
  1763. X    char    right_margin[2];
  1764. X    char    page_length[2];
  1765. X    char    top_margin[2];
  1766. X    char    bottom_margin[2];
  1767. X} MARGINS;
  1768. X
  1769. Xtypedef struct  {
  1770. X    char    opcode[2];        /* 29h (41d) */
  1771. X    char    record_length[2];    /* 1d */
  1772. X    char    label_alignment[1];    /* 27h is left */
  1773. X                    /* 22h is right */
  1774. X                    /* 5Eh is center */
  1775. X} LABELFMT;
  1776. X
  1777. Xtypedef struct  {
  1778. X    char    opcode[2];        /* 2Ah (42d) */
  1779. X    char    record_length[2];    /* 16d */
  1780. X    char    border_start_column[2];
  1781. X    char    border_start_row[2];
  1782. X    char    border_end_column[2];
  1783. X    char    border_end_row[2];
  1784. X    char    col_start_column[2];
  1785. X    char    col_start_row[2];
  1786. X    char    col_end_column[2];
  1787. X    char    col_end_row[2];
  1788. X} TITLES; /* print borders */
  1789. X
  1790. X/***********************************************/
  1791. X/* Cell definitions                            */
  1792. X/***********************************************/
  1793. X
  1794. Xtypedef struct  {
  1795. X    char    opcode[2];        /* 0Ch (12d) */
  1796. X    char    record_length[2];    /* 5d */
  1797. X    char    format[1];
  1798. X    char    column[2];
  1799. X    char    row[2];
  1800. X} BLANK; /* blank cell */
  1801. X
  1802. Xtypedef struct  {
  1803. X    char    opcode[2];        /* 0Dh (13d) */
  1804. X    char    record_length[2];    /* 7d */
  1805. X    char    format[1];
  1806. X    char    column[2];
  1807. X    char    row[2];
  1808. X    char    value[2];
  1809. X} INTEGER;
  1810. X
  1811. Xtypedef struct  {
  1812. X    char    opcode[2];        /* 0Eh (14d) */
  1813. X    char    record_length[2];    /* 13d */
  1814. X    char    format[1];
  1815. X    char    column[2];
  1816. X    char    row[2];
  1817. X    char    value[8];
  1818. X} NUMBER;
  1819. X
  1820. Xtypedef struct  {
  1821. X    char    opcode[2];        /* 0Fh (15d) */
  1822. X    char    record_length[2];    /* variable */
  1823. X    char    format[1];
  1824. X    char    column[2];
  1825. X    char    row[2];
  1826. X    char    position[1];
  1827. X    char    string[239];        /* NULL terminated ASCII */
  1828. X} LABEL;
  1829. X
  1830. Xtypedef struct  {
  1831. X    char    opcode[2];        /* 10h (16d) */
  1832. X    char    record_length[2];    /* variable to 2064 */
  1833. X    char    format[1];
  1834. X    char    column[2];
  1835. X    char    row[2];
  1836. X    char    value[8];
  1837. X    char    formula_size[2];
  1838. X    char    formula_code[256];    /* NOTE: Lotus allows up to 2048! */
  1839. X} FORMULA;
  1840. X
  1841. X
  1842. Xtypedef struct  {
  1843. X    char    opcode[2];        /* 01h (01d) */
  1844. X    char    record_length[2];    /* 0d */
  1845. X} LEOF;  /* changed name to avoid using standard EOF */
  1846. X
  1847. X/**************************************/
  1848. X/* opcode value definitions           */
  1849. X/**************************************/
  1850. X
  1851. X#define BOF_op ((unsigned short)0x00)
  1852. X#define BOF_len ((unsigned short)2)
  1853. X
  1854. X#define LEOF_op ((unsigned short)0x01)
  1855. X#define LEOF_len ((unsigned short)0)
  1856. X
  1857. X#define CALCMODE_op ((unsigned short)0x02)
  1858. X#define CALCMODE_len ((unsigned short)1)
  1859. X
  1860. X#define CALCORDER_op ((unsigned short)0x03)
  1861. X#define CALCORDER_len ((unsigned short)1)
  1862. X
  1863. X#define SPLIT_op ((unsigned short)0x04)
  1864. X#define SPLIT_len ((unsigned short)1)
  1865. X
  1866. X#define SYNC_op ((unsigned short)0x05)
  1867. X#define SYNC_len ((unsigned short)1)
  1868. X
  1869. X#define RANGE_op ((unsigned short)0x06)
  1870. X#define RANGE_len ((unsigned short)8)
  1871. X
  1872. X#define WINDOW1_op ((unsigned short)0x07)
  1873. X#define WINDOW1_len ((unsigned short)32)
  1874. X
  1875. X#define COLW1_op ((unsigned short)0x08)
  1876. X#define COLW1_len ((unsigned short)3)
  1877. X
  1878. X#define NGRAPH_op ((unsigned short)0x2E)
  1879. X#define NGRAPH_len ((unsigned short)455)
  1880. X
  1881. X#define RNAME_op ((unsigned short)0x0B)
  1882. X#define RNAME_len ((unsigned short)24)
  1883. X
  1884. X#define BLANK_op ((unsigned short)0x0C)
  1885. X#define BLANK_len ((unsigned short)5)
  1886. X
  1887. X#define INTEGER_op ((unsigned short)0x0D)
  1888. X#define INTEGER_len ((unsigned short)7)
  1889. X
  1890. X#define NUMBER_op ((unsigned short)0x0E)
  1891. X#define NUMBER_len ((unsigned short)13)
  1892. X
  1893. X#define LABEL_op ((unsigned short)0x0F)
  1894. X/* #define LABEL_len ((unsigned short)) variable */
  1895. X
  1896. X#define FORMULA_op ((unsigned short)0x10)
  1897. X/* #define FORMULA_len ((unsigned short)) variable */
  1898. X
  1899. X#define TABLE_op ((unsigned short)0x18)
  1900. X#define TABLE_len ((unsigned short)25)
  1901. X
  1902. X#define QRANGE_op ((unsigned short)0x19)
  1903. X#define QRANGE_len ((unsigned short)25)
  1904. X
  1905. X#define PRANGE_op ((unsigned short)0x1A)
  1906. X#define PRANGE_len ((unsigned short)8)
  1907. X
  1908. X#define SRANGE_op ((unsigned short)0x1B)
  1909. X#define SRANGE_len ((unsigned short)8)
  1910. X
  1911. X#define FRANGE_op ((unsigned short)0x1C)
  1912. X#define FRANGE_len ((unsigned short)8)
  1913. X
  1914. X#define KRANGE_op ((unsigned short)0x1D)
  1915. X#define KRANGE_len ((unsigned short)9)
  1916. X
  1917. X#define HRANGE_op ((unsigned short)0x20)
  1918. X#define HRANGE_len ((unsigned short)16)
  1919. X
  1920. X#define PROTECT_op ((unsigned short)0x24)
  1921. X#define PROTECT_len ((unsigned short)1)
  1922. X
  1923. X#define FOOTER_op ((unsigned short)0x25)
  1924. X#define FOOTER_len ((unsigned short)242)
  1925. X
  1926. X#define HEADER_op ((unsigned short)0x26)
  1927. X#define HEADER_len ((unsigned short)242)
  1928. X
  1929. X#define SETUP_op ((unsigned short)0x27)
  1930. X#define SETUP_len ((unsigned short)40)
  1931. X
  1932. X#define MARGINS_op ((unsigned short)0x28)
  1933. X#define MARGINS_len ((unsigned short)10)
  1934. X
  1935. X#define LABELFMT_op ((unsigned short)0x29)
  1936. X#define LABELFMT_len ((unsigned short)1)
  1937. X
  1938. X#define TITLES_op ((unsigned short)0x2A)
  1939. X#define TITLES_len ((unsigned short)16)
  1940. X
  1941. X#define CALCCOUNT_op ((unsigned short)0x2F)
  1942. X#define CALCCOUNT_len ((unsigned short)1)
  1943. X
  1944. X#define UNFORMATTED_op ((unsigned short)0x30)
  1945. X#define UNFORMATTED_len ((unsigned short)1)
  1946. X
  1947. X#define CURSORW12_op ((unsigned short)0x31)
  1948. X#define CURSORW12_len ((unsigned short)1)
  1949. END_OF_FILE
  1950. if test 13529 -ne `wc -c <'lotus.h'`; then
  1951.     echo shar: \"'lotus.h'\" unpacked with wrong size!
  1952. fi
  1953. # end of 'lotus.h'
  1954. fi
  1955. if test -f 's2int.c' -a "${1}" != "-c" ; then 
  1956.   echo shar: Will not clobber existing file \"'s2int.c'\"
  1957. else
  1958. echo shar: Extracting \"'s2int.c'\" \(133 characters\)
  1959. sed "s/^X//" >'s2int.c' <<'END_OF_FILE'
  1960. X
  1961. Xint
  1962. Xs2int(ptr)
  1963. Xchar *ptr;
  1964. X{
  1965. X    union {
  1966. X    short i;
  1967. X    char c[2];
  1968. X    } u;
  1969. X
  1970. X    u.c[0] = *ptr++;
  1971. X    u.c[1] = *ptr;
  1972. X
  1973. X    return(u.i);
  1974. X}
  1975. END_OF_FILE
  1976. if test 133 -ne `wc -c <'s2int.c'`; then
  1977.     echo shar: \"'s2int.c'\" unpacked with wrong size!
  1978. fi
  1979. # end of 's2int.c'
  1980. fi
  1981. if test -f 'swapb.c' -a "${1}" != "-c" ; then 
  1982.   echo shar: Will not clobber existing file \"'swapb.c'\"
  1983. else
  1984. echo shar: Extracting \"'swapb.c'\" \(152 characters\)
  1985. sed "s/^X//" >'swapb.c' <<'END_OF_FILE'
  1986. X# include <stdio.h>
  1987. X# include "swapb.h"
  1988. X
  1989. Xmain()
  1990. X{
  1991. X    int j;
  1992. X    unsigned short i;
  1993. X
  1994. X    scanf("%x",&j);
  1995. X    i = (int)j;
  1996. X    printf("i = %4.4x\n",swapb(i));
  1997. X    return;
  1998. X}
  1999. END_OF_FILE
  2000. if test 152 -ne `wc -c <'swapb.c'`; then
  2001.     echo shar: \"'swapb.c'\" unpacked with wrong size!
  2002. fi
  2003. # end of 'swapb.c'
  2004. fi
  2005. if test -f 'swapb.h' -a "${1}" != "-c" ; then 
  2006.   echo shar: Will not clobber existing file \"'swapb.h'\"
  2007. else
  2008. echo shar: Extracting \"'swapb.h'\" \(64 characters\)
  2009. sed "s/^X//" >'swapb.h' <<'END_OF_FILE'
  2010. X# define swapb(i) ((i & 0377) * 256)  +  ((i & 0177400) / 256)
  2011. X
  2012. END_OF_FILE
  2013. if test 64 -ne `wc -c <'swapb.h'`; then
  2014.     echo shar: \"'swapb.h'\" unpacked with wrong size!
  2015. fi
  2016. # end of 'swapb.h'
  2017. fi
  2018. echo shar: End of archive 1 \(of 2\).
  2019. cp /dev/null ark1isdone
  2020. MISSING=""
  2021. for I in 1 2 ; do
  2022.     if test ! -f ark${I}isdone ; then
  2023.     MISSING="${MISSING} ${I}"
  2024.     fi
  2025. done
  2026. if test "${MISSING}" = "" ; then
  2027.     echo You have unpacked both archives.
  2028.     rm -f ark[1-9]isdone
  2029. else
  2030.     echo You still need to unpack the following archives:
  2031.     echo "        " ${MISSING}
  2032. fi
  2033. ##  End of shell archive.
  2034. exit 0
  2035.