home *** CD-ROM | disk | FTP | other *** search
/ The UNIX CD Bookshelf / OREILLY_TUCB_UNIX_CD.iso / upt / examples / SOURCES / SC / RTR / SC. next >
Encoding:
Text File  |  1998-07-24  |  11.3 KB  |  375 lines

  1. *** Makefile.orig    Mon May 11 14:43:33 1992
  2. --- Makefile    Thu Sep 10 07:50:13 1992
  3. ***************
  4. *** 18,35 ****
  5.   
  6.   # This is where the install step puts it.
  7.   #EXDIR=/site/bin
  8. ! EXDIR=/usr/local/bin
  9.   
  10.   # This is where the man page goes.
  11. ! #MANDIR=/usr/local/src/man/man1    # reno
  12. ! #MANEXT=1            # reno
  13. ! MANDIR=/usr/man/manl
  14. ! MANEXT=l
  15.   MANMODE=644
  16.   
  17.   # This is where the library file (tutorial) goes.
  18.   #LIBDIR=/usr/local/share/$(name) # reno
  19. ! LIBDIR=/usr/local/lib/$(name)
  20.   
  21.   # Set SIMPLE for lex.c if you don't want arrow keys or lex.c blows up
  22.   SIMPLE=
  23. --- 18,35 ----
  24.   
  25.   # This is where the install step puts it.
  26.   #EXDIR=/site/bin
  27. ! EXDIR=<installdir>/bin
  28.   
  29.   # This is where the man page goes.
  30. ! MANDIR=<installsharedir>/man/man1
  31. ! MANEXT=1
  32. ! #MANDIR=/usr/man/manl
  33. ! #MANEXT=l
  34.   MANMODE=644
  35.   
  36.   # This is where the library file (tutorial) goes.
  37.   #LIBDIR=/usr/local/share/$(name) # reno
  38. ! LIBDIR=<installsharedir>/<prefix>lib/$(name)
  39.   
  40.   # Set SIMPLE for lex.c if you don't want arrow keys or lex.c blows up
  41.   SIMPLE=
  42. ***************
  43. *** 55,62 ****
  44.   #    System 5.3, SunOS 4.X, VMS, BSD4.4 (reno), and ANSI C Compliant systems
  45.   # use: SIGVOID=        for:
  46.   #  BSD systems (excluding reno, BSD4.4), and the UNIXPC 'cc'
  47. ! SIGVOID=-DSIGVOID
  48. ! #SIGVOID=
  49.   
  50.   # Set IEEE_MATH if you need setsticky() calls in your signal handlers
  51.   #
  52. --- 55,62 ----
  53.   #    System 5.3, SunOS 4.X, VMS, BSD4.4 (reno), and ANSI C Compliant systems
  54.   # use: SIGVOID=        for:
  55.   #  BSD systems (excluding reno, BSD4.4), and the UNIXPC 'cc'
  56. ! #SIGVOID=-DSIGVOID
  57. ! SIGVOID=
  58.   
  59.   # Set IEEE_MATH if you need setsticky() calls in your signal handlers
  60.   #
  61. ***************
  62. *** 67,84 ****
  63.   # Set RINT=    on/with (they have rint):
  64.   #    SunOS 4.0.3c compiler
  65.   #    BSD4.4 (reno)
  66. ! #RINT=
  67. ! RINT=-DRINT
  68.   
  69.   # Set RE_COMP if you have the re_comp/re_exec regular expression routines
  70.   # (most BSD based systems do).
  71. ! #RE_COMP=-DRE_COMP
  72. ! RE_COMP=
  73.   
  74.   # Set REGCMP if you have the regcmp/regex regular expression routines
  75.   # (most System V based systems do)
  76. ! REGCMP=-DREGCMP
  77. ! #REGCMP=
  78.   
  79.   # This is the name of a pager like "more".
  80.   # "pg" may be appropriate for SYSV.
  81. --- 67,84 ----
  82.   # Set RINT=    on/with (they have rint):
  83.   #    SunOS 4.0.3c compiler
  84.   #    BSD4.4 (reno)
  85. ! RINT=
  86. ! #RINT=-DRINT
  87.   
  88.   # Set RE_COMP if you have the re_comp/re_exec regular expression routines
  89.   # (most BSD based systems do).
  90. ! RE_COMP=-DRE_COMP
  91. ! #RE_COMP=
  92.   
  93.   # Set REGCMP if you have the regcmp/regex regular expression routines
  94.   # (most System V based systems do)
  95. ! #REGCMP=-DREGCMP
  96. ! REGCMP=
  97.   
  98.   # This is the name of a pager like "more".
  99.   # "pg" may be appropriate for SYSV.
  100. ***************
  101. *** 90,100 ****
  102.   
  103.   # path to crypt, do not define if you don't have crypt
  104.   # most systems
  105. ! CRYPT=-DCRYPT_PATH=\"/bin/crypt\"
  106.   # BSD
  107.   #CRYPT=-DCRYPT_PATH=\"/usr/bin/crypt\"
  108.   # other people?
  109. ! #CRYPT=-DCRYPT_PATH=\"/usr/local/bin/crypt\"
  110.   
  111.   # If you get errors about fmod being undefined when you try to
  112.   # compile, then define NO_FMOD (most likely BSD4.3 and Mt Xinu).
  113. --- 90,100 ----
  114.   
  115.   # path to crypt, do not define if you don't have crypt
  116.   # most systems
  117. ! #CRYPT=-DCRYPT_PATH=\"/bin/crypt\"
  118.   # BSD
  119.   #CRYPT=-DCRYPT_PATH=\"/usr/bin/crypt\"
  120.   # other people?
  121. ! CRYPT=-DCRYPT_PATH=\"<installdir>/bin/crypt\"
  122.   
  123.   # If you get errors about fmod being undefined when you try to
  124.   # compile, then define NO_FMOD (most likely BSD4.3 and Mt Xinu).
  125. ***************
  126. *** 133,140 ****
  127.   #         noticing the rows become 2, 3, 40, 41, 42... (etc).
  128.   #    Known systems/terminfos w/ curses problems:
  129.   #    {Esix Rev. D+, AT&T SysV3.2.1}:at386-m,xterm, HP-UX7.0:(not sure)
  130. ! IDLOKISBAD=-DIDLOKBAD
  131. ! #IDLOKISBAD=
  132.   
  133.   # If you don't have idlok() in your curses define NOIDLOK
  134.   NO_IDLOK=
  135. --- 133,140 ----
  136.   #         noticing the rows become 2, 3, 40, 41, 42... (etc).
  137.   #    Known systems/terminfos w/ curses problems:
  138.   #    {Esix Rev. D+, AT&T SysV3.2.1}:at386-m,xterm, HP-UX7.0:(not sure)
  139. ! #IDLOKISBAD=-DIDLOKBAD
  140. ! IDLOKISBAD=
  141.   
  142.   # If you don't have idlok() in your curses define NOIDLOK
  143.   NO_IDLOK=
  144. ***************
  145. *** 164,169 ****
  146. --- 164,171 ----
  147.   
  148.   #### SYSTEM DEFINES ####
  149.   
  150. + CC=gcc
  151.   # Use this for system AIX V3.1
  152.   #CFLAGS= -O -DSYSV2 -DCHTYPE=int -DNLS
  153.   #LDFLAGS=
  154. ***************
  155. *** 178,188 ****
  156.   #CFLAGS=  -DSYSV2 -g -pipe -traditional
  157.   
  158.   # Use this for system V.3
  159. ! CFLAGS=  -DSYSV3 -O
  160. ! LDFLAGS= -s
  161.   #CFLAGS=  -DSYSV3 -g
  162.   #LDFLAGS= -g
  163. ! LIB=-lm -lcurses -lPW
  164.   # with gcc also use:
  165.   #CC=gcc
  166.   #CFLAGS=  -DSYSV3 -O -pipe -traditional
  167. --- 180,190 ----
  168.   #CFLAGS=  -DSYSV2 -g -pipe -traditional
  169.   
  170.   # Use this for system V.3
  171. ! #CFLAGS=  -DSYSV3 -O
  172. ! #LDFLAGS= -s
  173.   #CFLAGS=  -DSYSV3 -g
  174.   #LDFLAGS= -g
  175. ! #LIB=-lm -lcurses -lPW
  176.   # with gcc also use:
  177.   #CC=gcc
  178.   #CFLAGS=  -DSYSV3 -O -pipe -traditional
  179. ***************
  180. *** 221,229 ****
  181.   #CFLAGS= -O -DBSD42 -pipe
  182.   
  183.   # Use this for BSD 4.3
  184. ! #CFLAGS= -O -DBSD43
  185. ! #LDFLAGS=
  186. ! #LIB=-lm -lcurses -ltermcap
  187.   
  188.   # Use this for SunOS 4.X if you have the System V package installed.
  189.   # This will link with the System V curses which is preferable to the
  190. --- 223,231 ----
  191.   #CFLAGS= -O -DBSD42 -pipe
  192.   
  193.   # Use this for BSD 4.3
  194. ! CFLAGS= -O -DBSD43
  195. ! LDFLAGS=
  196. ! LIB=-lm -lcurses -ltermcap
  197.   
  198.   # Use this for SunOS 4.X if you have the System V package installed.
  199.   # This will link with the System V curses which is preferable to the
  200. ***************
  201. *** 268,273 ****
  202. --- 270,276 ----
  203.   
  204.   # Use this for SCO Unix 3.2.2 and ODT 1.1
  205.   #CC=cc
  206. + #CC=gcc
  207.   #CFLAGS= -O -DSYSV3
  208.   #LDFLAGS=
  209.   #LIB=-lm -lcurses -lPW -lmalloc -lc_s
  210. --- interp.c.orig    Mon May 11 14:43:36 1992
  211. +++ interp.c    Thu Dec 28 16:20:59 1995
  212. @@ -1039,9 +1039,9 @@
  213.  #else /* VMS */
  214.  
  215.  char *
  216. -doext (command, value)
  217. +doexts (command, value)
  218.  char   *command;
  219. -double value;
  220. +char   *value;
  221.  {
  222.      static char *prevstr = (char *)0;    /* previous result */
  223.      static unsigned    prevlen = 0;
  224. @@ -1062,7 +1062,12 @@
  225.      } else {
  226.          FILE *pp;
  227.  
  228. -        (void) sprintf (buff, "%s %g", command, value); /* build cmd line */
  229. +            if (value) {
  230. +              (void) sprintf (buff, "%s %s", command, value); /* build cmd line */
  231. +              free(value);
  232. +            } else
  233. +              strcpy( buff, command );
  234. +
  235.          scxfree (command);
  236.  
  237.          error ("Running external function...");
  238. @@ -1102,6 +1107,17 @@
  239.      return (strcpy(scxmalloc((unsigned)1), ""));
  240.  }
  241.  
  242. +char *
  243. +doext (command, value)
  244. +char   *command;
  245. +double value;
  246. +{
  247. +    char *buff;
  248. +    buff = malloc( 40 );
  249. +    sprintf( buff, "%g", value );
  250. +    return doexts(  command, buff );
  251. +}
  252. +
  253.  #endif /* VMS */
  254.  
  255.  
  256. @@ -1268,7 +1284,8 @@
  257.           if (minc>maxc) c = maxc, maxc = minc, minc = c;
  258.               return dostindex(eval(se->e.o.left), minr, minc, maxr, maxc);
  259.          }
  260. -    case EXT:    return(doext(seval(se->e.o.left), eval(se->e.o.right)));
  261. +    case EXT:    return(doext (seval(se->e.o.left), eval(se->e.o.right)));
  262. +    case EXTS:   return(doexts(seval(se->e.o.left),seval(se->e.o.right)));
  263.      case SVAL:   return(dosval(seval(se->e.o.left), eval(se->e.o.right)));
  264.      case SUBSTR: return(dosubstr(seval(se->e.o.left),
  265.                  (int)eval(se->e.o.right->e.o.left) - 1,
  266. @@ -2077,6 +2094,7 @@
  267.           && constant (e -> e.o.left)
  268.           && constant (e -> e.o.right)
  269.           && e -> op != EXT     /* functions look like constants but aren't */
  270. +         && e -> op != EXTS     /* functions look like constants but aren't */
  271.           && e -> op != NVAL
  272.           && e -> op != SVAL
  273.           && e -> op != NOW
  274. @@ -2278,6 +2296,7 @@
  275.      case NVAL:    two_arg("@nval(", e); break;
  276.      case SVAL:    two_arg("@sval(", e); break;
  277.      case EXT:    two_arg("@ext(", e); break;
  278. +    case EXTS:    two_arg("@exts(", e); break;
  279.      case SUBSTR:    three_arg("@substr(", e); break;
  280.      case STINDEX:    index_arg("@stindex(", e); break;
  281.      case INDEX:    index_arg("@index(", e); break;
  282. --- sc.h.orig    Mon May 11 14:43:38 1992
  283. +++ sc.h    Thu Dec 28 15:22:46 1995
  284. @@ -207,6 +207,7 @@
  285.  #define LOWER OP_BASE + 56
  286.  #define CAPITAL OP_BASE + 57
  287.  #define NUMITER    OP_BASE + 58
  288. +#define EXTS OP_BASE + 59
  289.  
  290.  /* flag values */
  291.  #define is_valid     0001
  292. --- version.c.orig    Mon May 11 14:43:39 1992
  293. +++ version.c    Thu Dec 28 15:47:01 1995
  294. @@ -4,4 +4,4 @@
  295.   * The part after the first colon, except the last char, appears on the screen.
  296.   */
  297.  
  298. -char *rev = "$Revision: 6.21 $";
  299. +char *rev = "$Revision: 6.21RTR $";
  300. --- gram.y.rtr    Mon May 11 14:43:35 1992
  301. +++ gram.y    Thu Dec 28 15:23:07 1995
  302. @@ -157,6 +157,7 @@
  303.  %token K_ROWLIMIT
  304.  %token K_COLLIMIT
  305.  %token K_NUMITER
  306. +%token K_EXTS
  307.    
  308.  %left '?' ':'
  309.  %left '|'
  310. @@ -356,6 +357,7 @@
  311.      | '@' K_STINDEX  '(' e ',' var_or_range ')'
  312.           { $$ = new(STINDEX, $4, new_range(REDUCE | STINDEX, $6)); }
  313.      | '@' K_EXT  '(' e ',' e ')'    { $$ = new(EXT, $4, $6); }
  314. +    | '@' K_EXTS '(' e ',' e ')'    { $$ = new(EXTS, $4, $6); }
  315.      | '@' K_NVAL '(' e ',' e ')'    { $$ = new(NVAL, $4, $6); }
  316.      | '@' K_SVAL '(' e ',' e ')'    { $$ = new(SVAL, $4, $6); }
  317.      | '@' K_SUBSTR '(' e ',' e ',' e ')'
  318. --- help.c.orig    Mon May 11 14:43:35 1992
  319. +++ help.c    Sat Dec 30 11:48:52 1995
  320. @@ -433,17 +433,17 @@
  321.  "                       ``the lazy dog'' if A0 is ``the la''.",
  322.  "     @substr(se,e1,e2) Extract characters e1 through e2 from the",
  323.  "                       string expression se.  For example,",
  324. -"                       ``@substr(\"Nice jacket\" 4, 7)'' yields ",
  325. -"                       ``e ja''.",
  326. +"                       ``@substr(\"Nice jacket\", 4, 7)'' yields ``e ja''.",
  327.  "     @fmt(se,e)        Convert a number to a string using sprintf(3).",
  328.  "                       For example,  ``@fmt(\"*%6.3f*\",10.5)'' yields",
  329.  "                       ``*10.500*''.  Use formats are e, E, f, g, and G.", 
  330.  "     @sval(se,e)       Return the string value of a cell selected by name.",
  331. -"     @ext(se,e)        Call an external function (program or",
  332. -"                       script).  Convert e to a string and append it",
  333. -"                       to the command line as an argument.  @ext yields",
  334. -"                       a string: the first line printed to standard",
  335. -"                       output by the command.",
  336. +"     @ext(se,e)        Call an external function (program or script).",
  337. +"                       Convert e to a string and append it to the command",
  338. +"                       line as an argument.  @ext yields a string: the first",
  339. +"                       line printed to standard output by the command. Use",
  340. +"                       @ston if you need to convert the result to a number.",
  341. +"     @exts(se,se)      Similar to @ext, but the 2nd argument is a string.",
  342.  "     @coltoa(e)        Return the column letter(s) from the passed number",
  343.  "     @upper(e) @lower(e)   Return the string in upper/lower case",
  344.  "     @capital(e)       Return the string with words in upper case",
  345. --- sc.doc.orig    Sat Dec 30 11:38:22 1995
  346. +++ sc.doc    Sat Dec 30 11:53:51 1995
  347. @@ -215,14 +215,14 @@
  348.  .B e
  349.  External function execution.
  350.  When disabled, external functions (see
  351. -.IR @ext ()
  352. +.IR @ext/@exts ()
  353.  below) are not called.
  354.  This saves a lot of time at each screen update.
  355.  External functions are disabled by default.
  356.  If disabled, and external functions are used anywhere,
  357.  a warning is printed each time the screen is updated,
  358.  and the result of
  359. -.IR @ext ()
  360. +.IR @ext/@exts ()
  361.  is the value from the previous call, if any, or a null string.
  362.  .\" ----------
  363.  .TP
  364. @@ -2038,6 +2038,9 @@
  365.  You can also "hide" the second argument by ending the command line
  366.  (first argument) with `` #'' (shell comment).
  367.  .\" ----------
  368. +.TP 18
  369. +.BR @exts (se,se)
  370. +Just like @ext, but the second argument is also a string.
  371.  .TP 18
  372.  .BR @coltoa (e)
  373.  Returns a string name for a column from the numeric argument.
  374.