home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume27 / jam / part04 < prev    next >
Text File  |  1993-11-14  |  61KB  |  2,510 lines

  1. Newsgroups: comp.sources.unix
  2. From: seiwald@vix.com (Christopher Seiwald)
  3. Subject: v27i084: jam - just another make, Part04/05
  4. References: <1.753385306.22859@gw.home.vix.com>
  5. Sender: unix-sources-moderator@gw.home.vix.com
  6. Approved: vixie@gw.home.vix.com
  7.  
  8. Submitted-By: seiwald@vix.com (Christopher Seiwald)
  9. Posting-Number: Volume 27, Issue 84
  10. Archive-Name: jam/part04
  11.  
  12. Submitted-by: seiwald@vix.com
  13. Archive-name: jam - make(1) redux/part04
  14.  
  15. #!/bin/sh
  16. # This is part 04 of jam - make(1) redux
  17. # ============= regexp.h ==============
  18. if test -f 'regexp.h' -a X"$1" != X"-c"; then
  19.     echo 'x - skipping regexp.h (File already exists)'
  20. else
  21. echo 'x - extracting regexp.h (Text)'
  22. sed 's/^X//' << 'SHAR_EOF' > 'regexp.h' &&
  23. X/*
  24. X * Definitions etc. for regexp(3) routines.
  25. X *
  26. X * Caveat:  this is V8 regexp(3) [actually, a reimplementation thereof],
  27. X * not the System V one.
  28. X */
  29. X#define NSUBEXP  10
  30. Xtypedef struct regexp {
  31. X    char *startp[NSUBEXP];
  32. X    char *endp[NSUBEXP];
  33. X    char regstart;        /* Internal use only. */
  34. X    char reganch;        /* Internal use only. */
  35. X    char *regmust;        /* Internal use only. */
  36. X    int regmlen;        /* Internal use only. */
  37. X    char program[1];    /* Unwarranted chumminess with compiler. */
  38. X} regexp;
  39. X
  40. Xextern regexp *regcomp();
  41. Xextern int regexec();
  42. Xextern void regsub();
  43. Xextern void regerror();
  44. X
  45. X/*
  46. X * The first byte of the regexp internal "program" is actually this magic
  47. X * number; the start node begins in the second byte.
  48. X */
  49. X#define    MAGIC    0234
  50. SHAR_EOF
  51. chmod 0444 regexp.h ||
  52. echo 'restore of regexp.h failed'
  53. Wc_c="`wc -c < 'regexp.h'`"
  54. test 728 -eq "$Wc_c" ||
  55.     echo 'regexp.h: original size 728, current size' "$Wc_c"
  56. fi
  57. # ============= rules.c ==============
  58. if test -f 'rules.c' -a X"$1" != X"-c"; then
  59.     echo 'x - skipping rules.c (File already exists)'
  60. else
  61. echo 'x - extracting rules.c (Text)'
  62. sed 's/^X//' << 'SHAR_EOF' > 'rules.c' &&
  63. X/*
  64. X * Copyright 1993 Christopher Seiwald.
  65. X */
  66. X
  67. X# include "jam.h"
  68. X# include "lists.h"
  69. X# include "parse.h"
  70. X# include "variable.h"
  71. X# include "rules.h"
  72. X# include "newstr.h"
  73. X# include "hash.h"
  74. X
  75. X/*
  76. X * rules.c - access to RULEs, TARGETs, and ACTIONs
  77. X *
  78. X * External routines:
  79. X *
  80. X *    bindrule() - return pointer to RULE, creating it if necessary
  81. X *    bindtarget() - return pointer to TARGET, creating it if necessary
  82. X *    touchtarget() - mark a target to simulate being new
  83. X *    targetlist() - turn list of target names into a TARGET chain
  84. X *    actionlist - for each target, append an ACTION to its action chain
  85. X *    addsettings() - add a deferred "set" command to a target
  86. X *    usesettings() - set all target specific variables
  87. X *    pushsettings() - set all target specific variables
  88. X *    popsettings() - reset target specific variables to their pre-push values
  89. X *    donerules() - free RULE and TARGET tables
  90. X */
  91. X
  92. Xstatic struct hash *rulehash = 0;
  93. Xstatic struct hash *targethash = 0;
  94. X
  95. X
  96. X/*
  97. X * bindrule() - return pointer to RULE, creating it if necessary
  98. X */
  99. X
  100. XRULE *
  101. Xbindrule( rulename ) 
  102. Xchar     *rulename;
  103. X{
  104. X    RULE rule, *r = &rule;
  105. X
  106. X    if( !rulehash )
  107. X        rulehash = hashinit( sizeof( RULE ), "rules" );
  108. X
  109. X    r->name = rulename;
  110. X
  111. X    if( hashenter( rulehash, (HASHDATA **)&r ) )
  112. X    {
  113. X        r->name = newstr( rulename );    /* never freed */
  114. X        r->procedure = (PARSE *)0;
  115. X        r->actions = (char *)0;
  116. X        r->flags = 0;
  117. X    }
  118. X
  119. X    return r;
  120. X}
  121. X
  122. X/*
  123. X * bindtarget() - return pointer to TARGET, creating it if necessary
  124. X */
  125. X
  126. XTARGET *
  127. Xbindtarget( targetname )
  128. Xchar    *targetname;
  129. X{
  130. X    TARGET target, *t = ⌖
  131. X
  132. X    if( !targethash )
  133. X        targethash = hashinit( sizeof( TARGET ), "targets" );
  134. X
  135. X    t->name = targetname;
  136. X
  137. X    if( hashenter( targethash, (HASHDATA **)&t ) )
  138. X    {
  139. X        memset( (char *)t, '\0', sizeof( *t ) );
  140. X        t->name = newstr( targetname );    /* never freed */
  141. X    }
  142. X
  143. X    return t;
  144. X}
  145. X
  146. X/*
  147. X * touchtarget() - mark a target to simulate being new
  148. X */
  149. X
  150. Xvoid
  151. Xtouchtarget( t )
  152. Xchar *t;
  153. X{
  154. X    bindtarget( t )->flags |= T_FLAG_TOUCHED;
  155. X}
  156. X
  157. X/*
  158. X * targetlist() - turn list of target names into a TARGET chain
  159. X *
  160. X * Inputs:
  161. X *    chain    existing TARGETS to append to
  162. X *    targets    list of target names
  163. X */
  164. X
  165. XTARGETS *
  166. Xtargetlist( chain, targets )
  167. XTARGETS    *chain;
  168. XLIST     *targets;
  169. X{
  170. X    while( targets )
  171. X    {
  172. X        TARGETS *c;
  173. X
  174. X        c = (TARGETS *)malloc( sizeof( TARGETS ) );
  175. X        c->target = bindtarget( targets->string );
  176. X
  177. X        if( !chain ) chain = c;
  178. X        else chain->tail->next = c;
  179. X        chain->tail = c;
  180. X        c->next = 0;
  181. X
  182. X        targets = list_next( targets );
  183. X    }
  184. X
  185. X    return chain;
  186. X}
  187. X
  188. X/*
  189. X * actionlist - for each target, append an ACTION to its action chain
  190. X */
  191. X
  192. Xvoid
  193. Xactionlist( targets, action )
  194. XTARGETS    *targets;
  195. XACTION    *action;
  196. X{
  197. X    /* Append this action to the actions of each target */
  198. X
  199. X    for( ; targets; targets = targets->next )
  200. X    {
  201. X        ACTIONS *actions = (ACTIONS *)malloc( sizeof( ACTIONS ) );
  202. X        TARGET  *target = targets->target;
  203. X
  204. X        actions->action = action;
  205. X
  206. X        if( !target->actions ) target->actions = actions;
  207. X        else target->actions->tail->next = actions;
  208. X        target->actions->tail = actions;
  209. X        actions->next = 0;
  210. X    }
  211. X}
  212. X
  213. X/*
  214. X * addsettings() - add a deferred "set" command to a target
  215. X */
  216. X
  217. XSETTINGS *
  218. Xaddsettings( head, symbol, value )
  219. XSETTINGS *head;
  220. Xchar    *symbol;
  221. XLIST    *value;
  222. X{
  223. X    SETTINGS *v;
  224. X    
  225. X    /* Look for previous setting */
  226. X
  227. X    for( v = head; v; v = v->next )
  228. X        if( !strcmp( v->symbol, symbol ) )
  229. X        break;
  230. X
  231. X    /* If previous set, reset.  If not, alloc a new. */
  232. X
  233. X    if( v )
  234. X    {
  235. X        list_free( v->value );
  236. X        v->value = value;
  237. X        v = head;
  238. X    } 
  239. X    else 
  240. X    {
  241. X        v = (SETTINGS *)malloc( sizeof( *v ) );
  242. X        v->symbol = newstr( symbol );
  243. X        v->value = value;
  244. X        v->next = head;
  245. X    }
  246. X
  247. X    return v;
  248. X}
  249. X
  250. X/*
  251. X * pushsettings() - set all target specific variables
  252. X */
  253. X
  254. Xvoid
  255. Xpushsettings( v )
  256. XSETTINGS *v;
  257. X{
  258. X    for( ; v; v = v->next )
  259. X        v->value = var_swap( v->symbol, v->value );
  260. X}
  261. X
  262. X/*
  263. X * popsettings() - reset target specific variables to their pre-push values
  264. X */
  265. X
  266. Xvoid
  267. Xpopsettings( v )
  268. XSETTINGS *v;
  269. X{
  270. X    pushsettings( v );    /* just swap again */
  271. X}
  272. X
  273. X/*
  274. X * donerules() - free RULE and TARGET tables
  275. X */
  276. X
  277. Xvoid
  278. Xdonerules()
  279. X{
  280. X    hashdone( rulehash );
  281. X    hashdone( targethash );
  282. X}
  283. SHAR_EOF
  284. chmod 0444 rules.c ||
  285. echo 'restore of rules.c failed'
  286. Wc_c="`wc -c < 'rules.c'`"
  287. test 4141 -eq "$Wc_c" ||
  288.     echo 'rules.c: original size 4141, current size' "$Wc_c"
  289. fi
  290. # ============= rules.h ==============
  291. if test -f 'rules.h' -a X"$1" != X"-c"; then
  292.     echo 'x - skipping rules.h (File already exists)'
  293. else
  294. echo 'x - extracting rules.h (Text)'
  295. sed 's/^X//' << 'SHAR_EOF' > 'rules.h' &&
  296. X/*
  297. X * Copyright 1993 Christopher Seiwald.
  298. X */
  299. X
  300. X/*
  301. X * rules.h -  targets, rules, and related information
  302. X *
  303. X * This file describes the structures holding the targets, rules, and
  304. X * related information accumulated by interpreting the statements
  305. X * of the jam files.
  306. X *
  307. X * The following are defined:
  308. X *
  309. X *    RULE - a generic jam rule, the product of RULE and ACTIONS 
  310. X *    ACTIONS - a chain of ACTIONs 
  311. X *    ACTION - a RULE instance with targets and sources 
  312. X *    SETTINGS - variables to set when executing a TARGET's ACTIONS 
  313. X *    TARGETS - a chain of TARGETs 
  314. X *    TARGET - a file or "thing" that can be built 
  315. X */
  316. X
  317. Xtypedef struct _rule RULE;
  318. Xtypedef struct _target TARGET;
  319. Xtypedef struct _targets TARGETS;
  320. Xtypedef struct _action ACTION;
  321. Xtypedef struct _actions ACTIONS;
  322. Xtypedef struct _settings SETTINGS ;
  323. X
  324. X/* RULE - a generic jam rule, the product of RULE and ACTIONS */
  325. X
  326. Xstruct _rule {
  327. X    char    *name;
  328. X    PARSE    *procedure;        /* parse tree from RULE */
  329. X    char    *actions;        /* command string from ACTIONS */
  330. X    int    flags;            /* modifiers on ACTIONS */
  331. X
  332. X# define    RULE_NEWSRCS    0x01    /* $(>) is updated sources only */
  333. X# define    RULE_TOGETHER    0x02    /* combine actions on single target */
  334. X# define    RULE_IGNORE    0x04    /* ignore return status of executes */
  335. X# define    RULE_QUIETLY    0x08    /* don't mention it unless verbose */
  336. X# define    RULE_PIECEMEAL    0x10    /* split exec so each $(>) is small */
  337. X
  338. X} ;
  339. X
  340. X/* ACTIONS - a chain of ACTIONs */
  341. X
  342. Xstruct _actions {
  343. X    ACTIONS    *next;
  344. X    ACTIONS    *tail;            /* valid only for head */
  345. X    ACTION    *action;
  346. X} ;
  347. X
  348. X/* ACTION - a RULE instance with targets and sources */
  349. X
  350. Xstruct _action {
  351. X    RULE    *rule;
  352. X    TARGETS    *targets;
  353. X    TARGETS    *sources;        /* aka $(>) */
  354. X    int    progress;        /* see TARGET progress */
  355. X} ;
  356. X
  357. X/* SETTINGS - variables to set when executing a TARGET's ACTIONS */
  358. X
  359. Xstruct _settings {
  360. X    SETTINGS *next;
  361. X    char    *symbol;        /* symbol name for var_set() */
  362. X    LIST    *value;            /* symbol value for var_set() */
  363. X} ;
  364. X
  365. X/* TARGETS - a chain of TARGETs */
  366. X
  367. Xstruct _targets {
  368. X    TARGETS    *next;
  369. X    TARGETS    *tail;            /* valid only for head */
  370. X    TARGET    *target;
  371. X} ;
  372. X
  373. X/* TARGET - a file or "thing" that can be built */
  374. X
  375. Xstruct _target {
  376. X    char    *name;
  377. X    char    *boundname;        /* if search() relocates target */
  378. X    ACTIONS    *actions;        /* rules to execute, if any */
  379. X    TARGETS    *deps;            /* dependencies */
  380. X    SETTINGS *settings;        /* variables to define */
  381. X    time_t    time;            /* update time */
  382. X
  383. X    int    flags;            /* status info */
  384. X
  385. X# define     T_FLAG_TEMP     0x01    /* TEMPORARY applied */
  386. X# define     T_FLAG_NOCARE     0x02    /* NOCARE applied */
  387. X# define     T_FLAG_NOTIME     0x04    /* NOTIME applied */
  388. X# define    T_FLAG_TOUCHED    0x08    /* -t target applied */
  389. X
  390. X    int    binding;        /* how target relates to real file */
  391. X
  392. X# define     T_BIND_UNBOUND    0    /* a disembodied name */
  393. X# define     T_BIND_TEMP    1    /* a present temporary */
  394. X# define     T_BIND_EXISTS    2    /* name names a real file */
  395. X# define     T_BIND_MISSING    3    /* couldn't find real file */
  396. X
  397. X    int    fate;            /* make0()'s diagnosis */
  398. X
  399. X# define     T_FATE_INIT    0    /* nothing done to target */
  400. X# define     T_FATE_MAKING    1    /* make0(target) on stack */
  401. X# define     T_FATE_STABLE    2    /* target didn't need updating */
  402. X# define    T_FATE_TOUCHED    3    /* manually touched with -t */
  403. X                    /* ...rest mean new target... */ 
  404. X# define     T_FATE_ISTMP    4    /* unneeded temp target oddly present */
  405. X# define    T_FATE_MISSING    5    /* is missing, needs updating */
  406. X# define     T_FATE_OUTDATED    6    /* is out of date, needs updating */
  407. X# define     T_FATE_UPDATE    7    /* deps updated, needs updating */
  408. X# define     T_FATE_DONTKNOW    8    /* no rules to make missing target */
  409. X
  410. X    int    progress;        /* tracks make1() progress */
  411. X
  412. X# define    T_MAKE_INIT    0    /* make1(target) not yet called */
  413. X# define    T_MAKE_STABLE    1    /* make1(target) had nothing to do */
  414. X# define    T_MAKE_OK    2    /* make1(target) hasn't failed (yet) */
  415. X# define    T_MAKE_FAIL    3    /* make1(target) failed */
  416. X# define    T_MAKE_INTR    4    /* make1(target) interrupted by ^C */
  417. X
  418. X    TARGETS    *headers;        /* list of header file codependencies */
  419. X    time_t    htime;            /* collected update time for headers */
  420. X    int    hfate;            /* collected fate for headers */
  421. X} ;
  422. X
  423. XRULE    *bindrule();
  424. XTARGET    *bindtarget();
  425. Xvoid    touchtarget();
  426. XTARGETS    *targetlist();
  427. Xvoid    actionlist();
  428. XSETTINGS *addsettings();
  429. Xvoid     pushsettings();
  430. Xvoid     popsettings();
  431. SHAR_EOF
  432. chmod 0444 rules.h ||
  433. echo 'restore of rules.h failed'
  434. Wc_c="`wc -c < 'rules.h'`"
  435. test 4149 -eq "$Wc_c" ||
  436.     echo 'rules.h: original size 4149, current size' "$Wc_c"
  437. fi
  438. # ============= scan.c ==============
  439. if test -f 'scan.c' -a X"$1" != X"-c"; then
  440.     echo 'x - skipping scan.c (File already exists)'
  441. else
  442. echo 'x - extracting scan.c (Text)'
  443. sed 's/^X//' << 'SHAR_EOF' > 'scan.c' &&
  444. X/*
  445. X * Copyright 1993 Christopher Seiwald.
  446. X */
  447. X
  448. X# include "jam.h"
  449. X# include "jamgram.h"
  450. X# include "lists.h"
  451. X# include "parse.h"
  452. X# include "scan.h"
  453. X# include "newstr.h"
  454. X
  455. X/*
  456. X * scan.c - the jam yacc scanner
  457. X */
  458. X
  459. Xstruct keyword {
  460. X    char *word;
  461. X    int type;
  462. X} keywords[] = {
  463. X# include "jamgramtab.h"
  464. X    0, 0
  465. X} ;
  466. X
  467. X# define MAX_INCLUDES 10
  468. X
  469. Xstatic struct {
  470. X    char *string;
  471. X    FILE *file;
  472. X    char *fname;
  473. X    int line;
  474. X    char buf[ 512 ];
  475. X} includes[ MAX_INCLUDES ] = {0}, *incp = includes;
  476. X
  477. Xstatic int incdepth = 0;
  478. X
  479. Xint scan_asstring = 0;
  480. X
  481. Xstatic char *symdump();
  482. X
  483. X/* 
  484. X */
  485. X
  486. Xyyerror( s )
  487. Xchar *s;
  488. X{
  489. X    if( incdepth )
  490. X        printf( "%s: line %d: ", incp->fname, incp->line );
  491. X
  492. X    printf( "%s at %s\n", s, symdump( &yylval ) );
  493. X}
  494. X
  495. Xyyfparse( s )
  496. Xchar *s;
  497. X{
  498. X    FILE *f = stdin;
  499. X
  500. X    if( incdepth == MAX_INCLUDES )
  501. X    {
  502. X        printf( "%s: too many levels of nested includes\n", s );
  503. X        return;
  504. X    }
  505. X
  506. X    if( strcmp( s, "-" ) && !( f = fopen( s, "r" ) ) )
  507. X        perror( s );
  508. X
  509. X    incdepth++;
  510. X    incp = &includes[ incdepth - 1 ];
  511. X    incp->string = "";
  512. X    incp->file = f;
  513. X    incp->fname = s;
  514. X    incp->line = 0;
  515. X}
  516. X
  517. X/*
  518. X * get character routine
  519. X */
  520. X
  521. Xyyline()
  522. X{
  523. Xtop:
  524. X    if( incp->file )
  525. X    {
  526. X        if( fgets( incp->buf, sizeof( incp->buf ), incp->file ) )
  527. X        {
  528. X        incp->line++;
  529. X        incp->string = incp->buf;
  530. X        return *incp->string++;
  531. X        }
  532. X
  533. X        if( incp->file != stdin )
  534. X            fclose( incp->file );
  535. X    } 
  536. X
  537. X    if( !--incdepth )
  538. X        return EOF;
  539. X
  540. X    incp = &includes[ incdepth - 1 ];
  541. X
  542. X    if( !*incp->string )
  543. X        goto top;
  544. X
  545. X    return *incp->string++;
  546. X}
  547. X
  548. X/*
  549. X * yylex() - set yylval to current token; return its type
  550. X */
  551. X
  552. X# define yychar() ( *incp->string ? *incp->string++ : yyline() )
  553. X
  554. Xyylex()
  555. X{
  556. X    char buf[512];
  557. X    int c = *incp->string;
  558. X
  559. X    for( ;; )
  560. X    {
  561. X        while( !c || isspace( c ) && c != EOF )
  562. X            c = yychar();
  563. X        if( c != '#' )
  564. X            break;
  565. X        while( ( c = yychar() ) != EOF && c != '\n' )
  566. X            ;
  567. X    }
  568. X
  569. X    if( c == EOF )
  570. X    {
  571. X        yylval.type = EOF;
  572. X        return EOF;
  573. X    } 
  574. X    else if( c == '{' && scan_asstring )
  575. X    {
  576. X        /* look for closing { */
  577. X
  578. X        char *b = buf;
  579. X        int nest = 1;
  580. X
  581. X        while( ( c = yychar() ) != EOF )
  582. X        {
  583. X            if( c == '{' )
  584. X                nest++;
  585. X            else if( c == '}' )
  586. X                nest--;
  587. X            if( !nest )
  588. X                break;
  589. X            *b++ = c;
  590. X        }
  591. X        *b = 0;
  592. X        yylval.type = STRING;
  593. X        yylval.string = newstr( buf );
  594. X    }
  595. X    else 
  596. X    {
  597. X        /* look for white space to delimit word */
  598. X        /* "'s get stripped but preserve white space */
  599. X
  600. X        char *b = buf;
  601. X        int inquote = 0;
  602. X        int literal = 0;
  603. X        int hasquote = 0;
  604. X        struct keyword *k;
  605. X
  606. X        do {
  607. X            if( literal )
  608. X            *b++ = c, literal = 0;
  609. X            else if( c == '\\' )
  610. X            literal++;
  611. X            else if( c == '"' )
  612. X            inquote = !inquote, hasquote++;
  613. X            else
  614. X            *b++ = c;
  615. X        }
  616. X        while( ( c=yychar() ) != EOF && ( inquote || !isspace( c ) ) );
  617. X        incp->string--;
  618. X        *b = 0;
  619. X
  620. X        /* scan token table, except for $anything and quoted anything */
  621. X
  622. X        yylval.type = ARG;
  623. X
  624. X        if( *buf != '$' && !hasquote )
  625. X            for( k = keywords; k->word; k++ )
  626. X            if( *buf == *k->word && !strcmp( k->word, buf ) )
  627. X        {
  628. X            yylval.type = k->type;
  629. X            yylval.string = k->word;    /* used by symdump */
  630. X            break;
  631. X        }
  632. X
  633. X        if( yylval.type == ARG )
  634. X            yylval.string = newstr( buf );
  635. X    }
  636. X
  637. X    if( DEBUG_SCAN )
  638. X        printf( "scan %s\n", symdump( &yylval ) );
  639. X
  640. X    return yylval.type;
  641. X}
  642. X
  643. Xstatic char *
  644. Xsymdump( s )
  645. XYYSTYPE *s;
  646. X{
  647. X    static char buf[ 512 ];
  648. X
  649. X    switch( s->type )
  650. X    {
  651. X    case EOF:
  652. X        sprintf( buf, "EOF" );
  653. X        break;
  654. X    case 0:
  655. X        sprintf( buf, "unknown symbol %s", s->string );
  656. X        break;
  657. X    case ARG:
  658. X        sprintf( buf, "argument %s", s->string );
  659. X        break;
  660. X    case STRING:
  661. X        sprintf( buf, "string \"%s\"", s->string );
  662. X        break;
  663. X    default:
  664. X        sprintf( buf, "keyword %s", s->string );
  665. X        break;
  666. X    }
  667. X    return buf;
  668. X}
  669. SHAR_EOF
  670. chmod 0444 scan.c ||
  671. echo 'restore of scan.c failed'
  672. Wc_c="`wc -c < 'scan.c'`"
  673. test 3568 -eq "$Wc_c" ||
  674.     echo 'scan.c: original size 3568, current size' "$Wc_c"
  675. fi
  676. # ============= scan.h ==============
  677. if test -f 'scan.h' -a X"$1" != X"-c"; then
  678.     echo 'x - skipping scan.h (File already exists)'
  679. else
  680. echo 'x - extracting scan.h (Text)'
  681. sed 's/^X//' << 'SHAR_EOF' > 'scan.h' &&
  682. X/*
  683. X * Copyright 1993 Christopher Seiwald.
  684. X */
  685. X
  686. X/*
  687. X * scan.h - the jam yacc scanner
  688. X */
  689. X
  690. X/*
  691. X * needed by parser, scanner
  692. X */
  693. X
  694. X# define YYSTYPE YYSYMBOL
  695. X
  696. Xtypedef struct _YYSTYPE {
  697. X    int        type;
  698. X    char        *string;
  699. X    PARSE        *parse;
  700. X    LIST        *list;
  701. X    int        number;
  702. X} YYSTYPE;
  703. X
  704. Xextern YYSTYPE yylval;
  705. X
  706. Xextern int scan_asstring;
  707. SHAR_EOF
  708. chmod 0444 scan.h ||
  709. echo 'restore of scan.h failed'
  710. Wc_c="`wc -c < 'scan.h'`"
  711. test 312 -eq "$Wc_c" ||
  712.     echo 'scan.h: original size 312, current size' "$Wc_c"
  713. fi
  714. # ============= search.c ==============
  715. if test -f 'search.c' -a X"$1" != X"-c"; then
  716.     echo 'x - skipping search.c (File already exists)'
  717. else
  718. echo 'x - extracting search.c (Text)'
  719. sed 's/^X//' << 'SHAR_EOF' > 'search.c' &&
  720. X/*
  721. X * Copyright 1993 Christopher Seiwald.
  722. X */
  723. X
  724. X# include "jam.h"
  725. X# include "lists.h"
  726. X# include "search.h"
  727. X# include "timestamp.h"
  728. X# include "filesys.h"
  729. X# include "variable.h"
  730. X# include "newstr.h"
  731. X
  732. X/*
  733. X * search.c - find a target along $(SEARCH) or $(LOCATE) 
  734. X */
  735. X
  736. Xchar *
  737. Xsearch( target, time )
  738. Xchar    *target;
  739. Xtime_t    *time;
  740. X{
  741. X    FILENAME f[1];
  742. X    LIST    *varlist;
  743. X    char    buf[ MAXPATH ];
  744. X
  745. X    /* Parse the filename */
  746. X
  747. X    file_parse( target, f );
  748. X
  749. X    f->f_grist.ptr = 0;
  750. X    f->f_grist.len = 0;
  751. X
  752. X    if( varlist = var_get( "LOCATE" ) )
  753. X    {
  754. X        f->f_root.ptr = varlist->string;
  755. X        f->f_root.len = strlen( varlist->string );
  756. X
  757. X        file_build( f, buf );
  758. X
  759. X        if( DEBUG_SEARCH )
  760. X        printf( "locate %s: %s\n", target, buf );
  761. X
  762. X        timestamp( buf, time );
  763. X
  764. X        return newstr( buf );
  765. X    }
  766. X    else if( varlist = var_get( "SEARCH" ) )
  767. X    {
  768. X        while( varlist )
  769. X        {
  770. X        f->f_root.ptr = varlist->string;
  771. X        f->f_root.len = strlen( varlist->string );
  772. X
  773. X        file_build( f, buf );
  774. X
  775. X        if( DEBUG_SEARCH )
  776. X            printf( "search %s: %s\n", target, buf );
  777. X
  778. X        timestamp( buf, time );
  779. X
  780. X        if( *time )
  781. X            return newstr( buf );
  782. X
  783. X        varlist = list_next( varlist );
  784. X        }
  785. X    }
  786. X
  787. X    /* Look for the obvious */
  788. X    /* This is a questionable move.  Should we look in the */
  789. X    /* obvious place if SEARCH is set? */
  790. X
  791. X    f->f_root.ptr = 0;
  792. X    f->f_root.len = 0;
  793. X
  794. X    file_build( f, buf );
  795. X
  796. X    if( DEBUG_SEARCH )
  797. X        printf( "search %s: %s\n", target, buf );
  798. X
  799. X    timestamp( target, time );
  800. X
  801. X    return newstr( buf );
  802. X}
  803. SHAR_EOF
  804. chmod 0444 search.c ||
  805. echo 'restore of search.c failed'
  806. Wc_c="`wc -c < 'search.c'`"
  807. test 1438 -eq "$Wc_c" ||
  808.     echo 'search.c: original size 1438, current size' "$Wc_c"
  809. fi
  810. # ============= search.h ==============
  811. if test -f 'search.h' -a X"$1" != X"-c"; then
  812.     echo 'x - skipping search.h (File already exists)'
  813. else
  814. echo 'x - extracting search.h (Text)'
  815. sed 's/^X//' << 'SHAR_EOF' > 'search.h' &&
  816. X/*
  817. X * Copyright 1993 Christopher Seiwald.
  818. X */
  819. X
  820. X/*
  821. X * search.h - find a target along $(SEARCH) or $(LOCATE) 
  822. X */
  823. X
  824. Xchar *search();
  825. SHAR_EOF
  826. chmod 0444 search.h ||
  827. echo 'restore of search.h failed'
  828. Wc_c="`wc -c < 'search.h'`"
  829. test 129 -eq "$Wc_c" ||
  830.     echo 'search.h: original size 129, current size' "$Wc_c"
  831. fi
  832. # ============= timestamp.c ==============
  833. if test -f 'timestamp.c' -a X"$1" != X"-c"; then
  834.     echo 'x - skipping timestamp.c (File already exists)'
  835. else
  836. echo 'x - extracting timestamp.c (Text)'
  837. sed 's/^X//' << 'SHAR_EOF' > 'timestamp.c' &&
  838. X/*
  839. X * Copyright 1993 Christopher Seiwald.
  840. X */
  841. X
  842. X# include "jam.h"
  843. X# include "hash.h"
  844. X# include "filesys.h"
  845. X# include "timestamp.h"
  846. X# include "newstr.h"
  847. X
  848. X/*
  849. X * timestamp.c - get the timestamp of a file or archive member
  850. X */
  851. X
  852. X/*
  853. X * BINDING - all known files
  854. X */
  855. X
  856. Xtypedef struct _binding BINDING;
  857. X
  858. Xstruct _binding {
  859. X    char    *name;
  860. X    short    flags;
  861. X
  862. X# define BIND_SCANNED    0x01    /* if directory or arch, has been scanned */
  863. X
  864. X    short    progress;
  865. X
  866. X# define BIND_INIT    0    /* never seen */
  867. X# define BIND_NOENTRY    1    /* timestamp requested but file never found */
  868. X# define BIND_SPOTTED    2    /* file found but not timed yet */
  869. X# define BIND_MISSING    3    /* file found but can't get timestamp */
  870. X# define BIND_FOUND    4    /* file found and time stamped */
  871. X
  872. X    time_t    time;        /* update time - 0 if not exist */
  873. X} ;
  874. X
  875. Xstatic struct hash *bindhash = 0;
  876. Xstatic void time_enter();
  877. X
  878. Xstatic char *time_progress[] =
  879. X{
  880. X    "INIT",
  881. X    "NOENTRY",
  882. X    "SPOTTED",
  883. X    "MISSING",
  884. X    "FOUND"
  885. X} ;
  886. X
  887. X
  888. X/*
  889. X * timestamp() - return timestamp on a file, if present
  890. X */
  891. X
  892. Xvoid
  893. Xtimestamp( target, time )
  894. Xchar    *target;
  895. Xtime_t    *time;
  896. X{
  897. X    FILENAME f1, f2;
  898. X    BINDING    binding, *b = &binding;
  899. X    char buf[ MAXPATH ];
  900. X
  901. X    if( !bindhash )
  902. X        bindhash = hashinit( sizeof( BINDING ), "bindings" );
  903. X
  904. X    /* Quick path - is it there? */
  905. X
  906. X    b->name = target;
  907. X    b->time = b->flags = 0;
  908. X    b->progress = BIND_INIT;
  909. X
  910. X    if( hashenter( bindhash, (HASHDATA **)&b ) )
  911. X        b->name = newstr( target );        /* never freed */
  912. X
  913. X    if( b->progress != BIND_INIT )
  914. X        goto afterscanning;
  915. X
  916. X    b->progress = BIND_NOENTRY;
  917. X
  918. X    /* Not found - have to scan for it */
  919. X
  920. X    file_parse( target, &f1 );
  921. X    memset( (char *)&f2, '\0', sizeof( f2 ) );
  922. X
  923. X    /* Scan directory if not already done so */
  924. X
  925. X    {
  926. X        BINDING binding, *b = &binding;
  927. X
  928. X        f2.f_dir = f1.f_dir;
  929. X        file_build( &f2, buf );
  930. X
  931. X        b->name = buf;
  932. X        b->time = b->flags = 0;
  933. X        b->progress = BIND_INIT;
  934. X
  935. X        if( hashenter( bindhash, (HASHDATA **)&b ) )
  936. X        b->name = newstr( buf );    /* never freed */
  937. X
  938. X        if( !( b->flags & BIND_SCANNED ) )
  939. X        {
  940. X        file_dirscan( buf, time_enter );
  941. X        b->flags |= BIND_SCANNED;
  942. X        }
  943. X    }
  944. X
  945. X    /* Scan archive if not already done so */
  946. X
  947. X    if( f1.f_member.len )
  948. X    {
  949. X        BINDING binding, *b = &binding;
  950. X
  951. X        f2.f_base = f1.f_base;
  952. X        f2.f_suffix = f1.f_suffix;
  953. X        file_build( &f2, buf );
  954. X
  955. X        b->name = buf;
  956. X        b->time = b->flags = 0;
  957. X        b->progress = BIND_INIT;
  958. X
  959. X        if( hashenter( bindhash, (HASHDATA **)&b ) )
  960. X        b->name = newstr( buf );    /* never freed */
  961. X
  962. X        if( !( b->flags & BIND_SCANNED ) )
  963. X        {
  964. X        file_archscan( buf, time_enter );
  965. X        b->flags |= BIND_SCANNED;
  966. X        }
  967. X    }
  968. X
  969. X    afterscanning:
  970. X
  971. X    if( b->progress == BIND_SPOTTED )
  972. X    {
  973. X        if( file_time( b->name, &b->time ) < 0 )
  974. X        b->progress = BIND_MISSING;
  975. X        else
  976. X        b->progress = BIND_FOUND;
  977. X    }
  978. X
  979. X    *time = b->progress == BIND_FOUND ? b->time : 0;
  980. X
  981. X    if( DEBUG_BIND && b->progress == BIND_FOUND )
  982. X    {
  983. X        printf( "time ( %s ) : %s", target, ctime( time ) );
  984. X    }
  985. X}
  986. X
  987. Xstatic void
  988. Xtime_enter( target, found, time )
  989. Xchar    *target;
  990. Xint    found;
  991. Xtime_t    time;
  992. X{
  993. X    BINDING    binding, *b = &binding;
  994. X
  995. X    b->name = target;
  996. X    b->flags = 0;
  997. X
  998. X    if( hashenter( bindhash, (HASHDATA **)&b ) )
  999. X        b->name = newstr( target );        /* never freed */
  1000. X
  1001. X    b->time = time;
  1002. X    b->progress = found ? BIND_FOUND : BIND_SPOTTED;
  1003. X
  1004. X    if( DEBUG_BINDSCAN )
  1005. X        printf( "time ( %s ) : %s\n", target, time_progress[b->progress] );
  1006. X}
  1007. X
  1008. X/*
  1009. X * donestamps() - free timestamp tables
  1010. X */
  1011. X
  1012. Xvoid
  1013. Xdonestamps()
  1014. X{
  1015. X    hashdone( bindhash );
  1016. X}
  1017. SHAR_EOF
  1018. chmod 0444 timestamp.c ||
  1019. echo 'restore of timestamp.c failed'
  1020. Wc_c="`wc -c < 'timestamp.c'`"
  1021. test 3402 -eq "$Wc_c" ||
  1022.     echo 'timestamp.c: original size 3402, current size' "$Wc_c"
  1023. fi
  1024. # ============= timestamp.h ==============
  1025. if test -f 'timestamp.h' -a X"$1" != X"-c"; then
  1026.     echo 'x - skipping timestamp.h (File already exists)'
  1027. else
  1028. echo 'x - extracting timestamp.h (Text)'
  1029. sed 's/^X//' << 'SHAR_EOF' > 'timestamp.h' &&
  1030. X/*
  1031. X * Copyright 1993 Christopher Seiwald.
  1032. X */
  1033. X
  1034. X/*
  1035. X * timestamp.h - get the timestamp of a file or archive member
  1036. X */
  1037. X
  1038. Xvoid timestamp();
  1039. X
  1040. SHAR_EOF
  1041. chmod 0444 timestamp.h ||
  1042. echo 'restore of timestamp.h failed'
  1043. Wc_c="`wc -c < 'timestamp.h'`"
  1044. test 137 -eq "$Wc_c" ||
  1045.     echo 'timestamp.h: original size 137, current size' "$Wc_c"
  1046. fi
  1047. # ============= variable.c ==============
  1048. if test -f 'variable.c' -a X"$1" != X"-c"; then
  1049.     echo 'x - skipping variable.c (File already exists)'
  1050. else
  1051. echo 'x - extracting variable.c (Text)'
  1052. sed 's/^X//' << 'SHAR_EOF' > 'variable.c' &&
  1053. X/*
  1054. X * Copyright 1993 Christopher Seiwald.
  1055. X */
  1056. X
  1057. X# include "jam.h"
  1058. X# include "lists.h"
  1059. X# include "parse.h"
  1060. X# include "variable.h"
  1061. X# include "expand.h"
  1062. X# include "hash.h"
  1063. X# include "filesys.h"
  1064. X# include "newstr.h"
  1065. X
  1066. X/*
  1067. X * variable.c - handle jam multi-element variables
  1068. X *
  1069. X * External routines:
  1070. X *
  1071. X *    var_defines() - load a bunch of variable=value settings
  1072. X *    var_list() - variable expand an input list, generating a new list
  1073. X *    var_string() - expand a string with variables in it
  1074. X *    var_get() - get value of a user defined symbol
  1075. X *    var_set() - set a variable in jam's user defined symbol table
  1076. X *    var_swap() - swap a variable's value with the given one
  1077. X *    var_done() - free variable tables
  1078. X *
  1079. X * Internal routines:
  1080. X *
  1081. X *    var_dump() - dump a variable to stdout
  1082. X */
  1083. X
  1084. Xstatic struct hash *varhash = 0;
  1085. X
  1086. X/*
  1087. X * VARIABLE - a user defined multi-value variable
  1088. X */
  1089. X
  1090. Xtypedef struct _variable VARIABLE ;
  1091. X
  1092. Xstruct _variable {
  1093. X    char    *symbol;
  1094. X    LIST    *value;
  1095. X} ;
  1096. X
  1097. Xstatic void    var_dump();
  1098. X
  1099. X
  1100. X
  1101. X/*
  1102. X * var_defines() - load a bunch of variable=value settings
  1103. X */
  1104. X
  1105. Xvoid
  1106. Xvar_defines( e )
  1107. Xchar **e;
  1108. X{
  1109. X    for( ; *e; e++ )
  1110. X    {
  1111. X        char sym[ MAXSYM ], *val;
  1112. X
  1113. X        if( val = strchr( *e, '=' ) )
  1114. X        {
  1115. X        strncpy( sym, *e, val - *e );
  1116. X        sym[ val - *e ] = '\0';
  1117. X        var_set( sym, list_new( (LIST *)0, newstr( val + 1 ) ) );
  1118. X        }
  1119. X    }
  1120. X}
  1121. X
  1122. X/*
  1123. X * var_list() - variable expand an input list, generating a new list
  1124. X *
  1125. X * Returns a newly created list.
  1126. X */
  1127. X
  1128. XLIST *
  1129. Xvar_list( ilist, targets, sources )
  1130. XLIST    *ilist;
  1131. XLIST    *targets;
  1132. XLIST    *sources;
  1133. X{
  1134. X    LIST *olist = 0;
  1135. X
  1136. X    while( ilist )
  1137. X    {
  1138. X        char *s = ilist->string;
  1139. X        olist = var_expand( olist, s, s + strlen(s), targets, sources );
  1140. X        ilist = list_next( ilist );
  1141. X    }
  1142. X
  1143. X    return olist;
  1144. X}
  1145. X
  1146. X
  1147. X/*
  1148. X * var_string() - expand a string with variables in it
  1149. X *
  1150. X * Copies in to out; doesn't modify targets & sources.
  1151. X */
  1152. X
  1153. Xint
  1154. Xvar_string( in, out, targets, sources )
  1155. Xchar    *in;
  1156. Xchar    *out;
  1157. XLIST    *targets;
  1158. XLIST    *sources;
  1159. X{
  1160. X    char     *out0 = out;
  1161. X
  1162. X    while( *in )
  1163. X    {
  1164. X        char    *lastword;
  1165. X        int        dollar = 0;
  1166. X
  1167. X        /* Copy white space */
  1168. X
  1169. X        while( isspace( *in ) )
  1170. X        *out++ = *in++;
  1171. X
  1172. X        lastword = out;
  1173. X
  1174. X        /* Copy non-white space, watching for variables */
  1175. X
  1176. X        while( *in && !isspace( *in ) )
  1177. X        {
  1178. X        if( in[0] == '$' && in[1] == '(' )
  1179. X            dollar++;
  1180. X        *out++ = *in++;
  1181. X        }
  1182. X
  1183. X        /* If a variable encountered, expand it and and embed the */
  1184. X        /* space-separated members of the list in the output. */
  1185. X
  1186. X        if( dollar )
  1187. X        {
  1188. X        LIST    *l;
  1189. X
  1190. X        l = var_expand( (LIST *)0, lastword, out, targets, sources );
  1191. X
  1192. X        out = lastword;
  1193. X
  1194. X        for( ; l; l = list_next( l ) )
  1195. X        {
  1196. X            strcpy( out, l->string );
  1197. X            out += strlen( out );
  1198. X            *out++ = ' ';
  1199. X        }
  1200. X
  1201. X        list_free( l );
  1202. X        }
  1203. X    }
  1204. X    *out++ = '\0';
  1205. X
  1206. X    return out - out0;
  1207. X}
  1208. X
  1209. X/*
  1210. X * var_get() - get value of a user defined symbol
  1211. X *
  1212. X * Returns NULL if symbol unset.
  1213. X */
  1214. X
  1215. XLIST *
  1216. Xvar_get( symbol )
  1217. Xchar    *symbol;
  1218. X{
  1219. X    VARIABLE var, *v = &var;
  1220. X
  1221. X    v->symbol = symbol;
  1222. X
  1223. X    if( varhash && hashcheck( varhash, (HASHDATA **)&v ) )
  1224. X    {
  1225. X        if( DEBUG_VARGET )
  1226. X        var_dump( v->symbol, v->value, "get" );
  1227. X        return v->value;
  1228. X    }
  1229. X    
  1230. X    return 0;
  1231. X}
  1232. X
  1233. X/*
  1234. X * var_set() - set a variable in jam's user defined symbol table
  1235. X *
  1236. X * Copies symbol.  Takes ownership of list.
  1237. X */
  1238. X
  1239. Xvoid
  1240. Xvar_set( symbol, value )
  1241. Xchar    *symbol;
  1242. XLIST    *value;
  1243. X{
  1244. X    list_free( var_swap( symbol, value ) );
  1245. X}
  1246. X
  1247. X/*
  1248. X * var_swap() - swap a variable's value with the given one
  1249. X */
  1250. X
  1251. XLIST *
  1252. Xvar_swap( symbol, value )
  1253. Xchar    *symbol;
  1254. XLIST    *value;
  1255. X{
  1256. X    VARIABLE var, *v = &var;
  1257. X    LIST *oldvalue;
  1258. X
  1259. X    if( DEBUG_VARSET )
  1260. X        var_dump( symbol, value, "set" );
  1261. X
  1262. X    if( !varhash )
  1263. X        varhash = hashinit( sizeof( VARIABLE ), "variables" );
  1264. X
  1265. X    v->symbol = symbol;
  1266. X    v->value = 0;
  1267. X
  1268. X    if( hashenter( varhash, (HASHDATA **)&v ) )
  1269. X        v->symbol = newstr( symbol );    /* never freed */
  1270. X
  1271. X    oldvalue = v->value;
  1272. X    v->value = value;
  1273. X
  1274. X    return oldvalue;
  1275. X}
  1276. X
  1277. X
  1278. X
  1279. X/*
  1280. X * var_dump() - dump a variable to stdout
  1281. X */
  1282. X
  1283. Xstatic void
  1284. Xvar_dump( symbol, value, what )
  1285. Xchar    *symbol;
  1286. XLIST    *value;
  1287. Xchar    *what;
  1288. X{
  1289. X    printf( "%s %s = ", what, symbol );
  1290. X    list_print( value );
  1291. X    printf( "\n" );
  1292. X}
  1293. X
  1294. X/*
  1295. X * var_done() - free variable tables
  1296. X */
  1297. X
  1298. Xvoid
  1299. Xvar_done()
  1300. X{
  1301. X    hashdone( varhash );
  1302. X}
  1303. SHAR_EOF
  1304. chmod 0444 variable.c ||
  1305. echo 'restore of variable.c failed'
  1306. Wc_c="`wc -c < 'variable.c'`"
  1307. test 4103 -eq "$Wc_c" ||
  1308.     echo 'variable.c: original size 4103, current size' "$Wc_c"
  1309. fi
  1310. # ============= variable.h ==============
  1311. if test -f 'variable.h' -a X"$1" != X"-c"; then
  1312.     echo 'x - skipping variable.h (File already exists)'
  1313. else
  1314. echo 'x - extracting variable.h (Text)'
  1315. sed 's/^X//' << 'SHAR_EOF' > 'variable.h' &&
  1316. X/*
  1317. X * Copyright 1993 Christopher Seiwald.
  1318. X */
  1319. X
  1320. X/*
  1321. X * variable.h - handle jam multi-element variables
  1322. X */
  1323. X
  1324. XLIST *var_get();
  1325. Xvoid var_defines();
  1326. Xvoid var_set();
  1327. XLIST *var_swap();
  1328. XLIST *var_list();
  1329. Xint var_string();
  1330. SHAR_EOF
  1331. chmod 0444 variable.h ||
  1332. echo 'restore of variable.h failed'
  1333. Wc_c="`wc -c < 'variable.h'`"
  1334. test 213 -eq "$Wc_c" ||
  1335.     echo 'variable.h: original size 213, current size' "$Wc_c"
  1336. fi
  1337. # ============= jam.c ==============
  1338. if test -f 'jam.c' -a X"$1" != X"-c"; then
  1339.     echo 'x - skipping jam.c (File already exists)'
  1340. else
  1341. echo 'x - extracting jam.c (Text)'
  1342. sed 's/^X//' << 'SHAR_EOF' > 'jam.c' &&
  1343. X/*
  1344. X * /+\
  1345. X * +\    Copyright 1993 Christopher Seiwald.
  1346. X * \+/
  1347. X *
  1348. X * Permission is granted to use this software and distribute it
  1349. X * freely, as long as this notice is retained and modifications are
  1350. X * clearly marked.
  1351. X *
  1352. X * The author assumes no liability for the consequences of using this
  1353. X * software.
  1354. X */
  1355. X
  1356. X# include "jam.h"
  1357. X# include "option.h"
  1358. X# include "make.h"
  1359. X
  1360. X/*
  1361. X * jam.c - make redux
  1362. X *
  1363. X * See jam(1) and Jambase(5) for usage information.
  1364. X *
  1365. X * The top half of the code is structured such:
  1366. X *
  1367. X *                       jam 
  1368. X *                      / | \
  1369. X *                 +---+  |  \
  1370. X *                /       |   \
  1371. X *         jamgram     option  \
  1372. X *        /  |   \              \
  1373. X *       /   |    \              \
  1374. X *      /    |     \             |
  1375. X *  scan     |     compile      make
  1376. X *           |    /    \       / |  \
  1377. X *           |   /      \     /  |   \
  1378. X *           |  /        \   /   |    \
  1379. X *         parse         rules  search execute
  1380. X *                               |
  1381. X *                               |
  1382. X *                               |
  1383. X *                           timestamp
  1384. X *
  1385. X *
  1386. X * The support routines are called by all of the above, but themselves
  1387. X * are layered thus:
  1388. X *
  1389. X *                     variable|expand
  1390. X *                      /  |   |   |
  1391. X *                     /   |   |   |
  1392. X *                    /    |   |   |
  1393. X *                 lists   |   |   filesys
  1394. X *                    \    |   |
  1395. X *                     \   |   |
  1396. X *                      \  |   |
  1397. X *                     newstr  |
  1398. X *                        \    |
  1399. X *                         \   |
  1400. X *                          \  |
  1401. X *                          hash
  1402. X *
  1403. X * Roughly, the modules are:
  1404. X *
  1405. X *    compile.c - compile parsed jam statements
  1406. X *    execunix.c - execute a shell script on UNIX
  1407. X *    execvms.c - execute a shell script, ala VMS
  1408. X *    expand.c - expand a buffer, given variable values
  1409. X *    fileunix.c - manipulate file names and scan directories on UNIX
  1410. X *    filevms.c - manipulate file names and scan directories on VMS
  1411. X *    hash.c - simple in-memory hashing routines 
  1412. X *    headers.c - handle #includes in source files
  1413. X *    lists.c - maintain lists of strings
  1414. X *    make.c - bring a target up to date, once rules are in place
  1415. X *    newstr.c - string manipulation routines
  1416. X *    option.c - command line option processing
  1417. X *    parse.c - make and destroy parse trees as driven by the parser
  1418. X *    regexp.c - Henry Spencer's regexp
  1419. X *    rules.c - access to RULEs, TARGETs, and ACTIONs
  1420. X *    scan.c - the jam yacc scanner
  1421. X *    search.c - find a target along $(SEARCH) or $(LOCATE) 
  1422. X *    timestamp.c - get the timestamp of a file or archive member
  1423. X *    variable.c - handle jam multi-element variables
  1424. X *    jamgram.yy - jam grammar
  1425. X */
  1426. X
  1427. Xstruct globs globs = {
  1428. X    1,            /* debug */
  1429. X    0            /* noexec */
  1430. X} ;
  1431. X
  1432. X/* Symbols to be defined as true for use in Jambase */
  1433. X
  1434. Xstatic char *othersyms[] = { OTHERSYMS, 0 } ;
  1435. Xextern char **environ;
  1436. X
  1437. Xchar *usage = 
  1438. X    "jam [-n] [-f<Jambase>] [-d<debuglevel>] [-t<target>...] [target...]";
  1439. X
  1440. Xmain( argc, argv )
  1441. Xchar    **argv;
  1442. X{
  1443. X    int        n;
  1444. X    char        *s;
  1445. X    struct option    optv[N_OPTS];
  1446. X    char        *ruleset = JAMBASE;
  1447. X    char        *all = "all";
  1448. X
  1449. X    argc--, argv++;
  1450. X
  1451. X    if( ( n = getoptions( argc, argv, "d:f:t:n", optv ) ) < 0 )
  1452. X    {
  1453. X        printf( "usage: %s\n", usage );
  1454. X        exit( 1 );
  1455. X    }
  1456. X
  1457. X    argc -= n, argv += n;
  1458. X
  1459. X    /* Pick up interesting options */
  1460. X
  1461. X    if( ( s = getoptval( optv, 'n', 0 ) ) )
  1462. X        globs.noexec++;
  1463. X
  1464. X    if( ( s = getoptval( optv, 'd', 0 ) ) )
  1465. X        globs.debug = atoi( s );
  1466. X
  1467. X    /* load up environment variables */
  1468. X
  1469. X    var_defines( othersyms );
  1470. X    var_defines( environ );
  1471. X
  1472. X    /* Parse ruleset */
  1473. X
  1474. X    for( n = 0; s = getoptval( optv, 'f', n ); n++ )
  1475. X    {
  1476. X        yyfparse( s );
  1477. X        yyparse();
  1478. X    }
  1479. X
  1480. X    if( !n )
  1481. X    {
  1482. X        yyfparse( ruleset );
  1483. X        yyparse();
  1484. X    }
  1485. X
  1486. X    /* Manually touch -t targets */
  1487. X
  1488. X    for( n = 0; s = getoptval( optv, 't', n ); n++ )
  1489. X        touchtarget( s );
  1490. X
  1491. X    /* Now make target */
  1492. X
  1493. X    if( argc )
  1494. X        make( argc, argv );
  1495. X    else
  1496. X        make( 1, &all );
  1497. X
  1498. X    /* Widely scattered cleanup */
  1499. X
  1500. X    var_done();
  1501. X    donerules();
  1502. X    donestamps();
  1503. X    donestr();
  1504. X
  1505. X    return EXITOK;
  1506. X}
  1507. SHAR_EOF
  1508. chmod 0444 jam.c ||
  1509. echo 'restore of jam.c failed'
  1510. Wc_c="`wc -c < 'jam.c'`"
  1511. test 4003 -eq "$Wc_c" ||
  1512.     echo 'jam.c: original size 4003, current size' "$Wc_c"
  1513. fi
  1514. # ============= jam.h ==============
  1515. if test -f 'jam.h' -a X"$1" != X"-c"; then
  1516.     echo 'x - skipping jam.h (File already exists)'
  1517. else
  1518. echo 'x - extracting jam.h (Text)'
  1519. sed 's/^X//' << 'SHAR_EOF' > 'jam.h' &&
  1520. X/*
  1521. X * Copyright 1993 Christopher Seiwald.
  1522. X */
  1523. X
  1524. X/*
  1525. X * jam.h - includes and globals for jam
  1526. X */
  1527. X
  1528. X# ifdef VMS
  1529. X
  1530. X# ifdef __ALPHA
  1531. X
  1532. X# include <types.h>
  1533. X# include <file.h>
  1534. X# include <stat.h>
  1535. X# include <stdio.h>
  1536. X# include <ctype.h>
  1537. X# include <stdlib.h>
  1538. X# include <signal.h>
  1539. X# include <string.h>
  1540. X# include <time.h>
  1541. X
  1542. X# define OTHERSYMS "VMS=true","OS=OPENVMS"
  1543. X
  1544. X# else
  1545. X
  1546. X# include <types.h>
  1547. X# include <file.h>
  1548. X# include <stat.h>
  1549. X# include <stdio.h>
  1550. X# include <ctype.h>
  1551. X# include <signal.h>
  1552. X# include <string.h>
  1553. X# include <time.h>
  1554. X
  1555. X# define OTHERSYMS "VMS=true","OS=VMS"
  1556. X
  1557. X# endif 
  1558. X
  1559. X# define MAXCMD    1023 /* longest command */
  1560. X# define JAMBASE "Jambase.VMS"
  1561. X# define EXITOK 1
  1562. X
  1563. X# else
  1564. X
  1565. X# include <sys/types.h>
  1566. X# include <sys/file.h>
  1567. X# include <sys/stat.h>
  1568. X# include <fcntl.h>
  1569. X# ifndef ultrix
  1570. X# include <stdlib.h>
  1571. X# endif
  1572. X# include <stdio.h>
  1573. X# include <ctype.h>
  1574. X# ifndef __bsdi__
  1575. X# include <malloc.h>
  1576. X# endif
  1577. X# include <memory.h>
  1578. X# include <signal.h>
  1579. X# include <string.h>
  1580. X# include <time.h>
  1581. X
  1582. X# ifdef AIX
  1583. X# define OTHERSYMS "UNIX=true","OS=AIX"
  1584. X# endif
  1585. X# ifdef __bsdi__
  1586. X# define OTHERSYMS "UNIX=true","OS=BSDI"
  1587. X# endif
  1588. X# ifdef __DGUX
  1589. X# define OTHERSYMS "UNIX=true","OS=DGUX"
  1590. X# endif
  1591. X# ifdef __hpux
  1592. X# define OTHERSYMS "UNIX=true","OS=HPUX"
  1593. X# endif
  1594. X# ifdef __osf__
  1595. X# define OTHERSYMS "UNIX=true","OS=OSF"
  1596. X# endif
  1597. X# ifdef _SEQUENT_
  1598. X# define OTHERSYMS "UNIX=true","OS=PTX"
  1599. X# endif
  1600. X# ifdef __sgi
  1601. X# define OTHERSYMS "UNIX=true","OS=IRIX"
  1602. X# endif
  1603. X# ifdef sun
  1604. X# define OTHERSYMS "UNIX=true","OS=SUNOS"
  1605. X# endif
  1606. X# ifdef solaris
  1607. X# undef OTHERSYMS
  1608. X# define OTHERSYMS "UNIX=true","OS=SOLARIS"
  1609. X# endif
  1610. X# ifdef ultrix
  1611. X# define OTHERSYMS "UNIX=true","OS=ULTRIX"
  1612. X# endif
  1613. X# ifndef OTHERSYMS
  1614. X# define OTHERSYMS "UNIX=true"
  1615. X# endif
  1616. X
  1617. X# define JAMBASE "/usr/local/lib/jam/Jambase"
  1618. X# define MAXCMD    10240    /* longest command */
  1619. X# define EXITOK 0
  1620. X
  1621. X# endif /* UNIX */
  1622. X
  1623. X/* You probably don't need to much with these. */
  1624. X
  1625. X# define MAXSYM    1024    /* longest symbol in the environment */
  1626. X# define MAXARG 1024    /* longest single word on a line */
  1627. X# define MAXPATH 1024    /* longest filename */
  1628. X
  1629. X/* Jam private definitions below. */
  1630. X
  1631. Xstruct globs {
  1632. X    int    debug;
  1633. X    int    noexec;
  1634. X} ;
  1635. X
  1636. Xextern struct globs globs;
  1637. X
  1638. X# define DEBUG_MAKE    ( globs.debug >= 1 )    /* show actions when executed */
  1639. X# define DEBUG_MAKEQ    ( globs.debug >= 2 )    /* show even quiet actions */
  1640. X# define DEBUG_EXEC    ( globs.debug >= 2 )    /* show text of actons */
  1641. X# define DEBUG_MAKEPROG    ( globs.debug >= 3 )    /* show progress of make0 */
  1642. X
  1643. X# define DEBUG_BIND    ( globs.debug >= 4 )    /* show when files bound */
  1644. X# define DEBUG_COMPILE    ( globs.debug >= 5 )    /* show rule invocations */
  1645. X# define DEBUG_MEM    ( globs.debug >= 5 )    /* show memory use */
  1646. X# define DEBUG_HEADER    ( globs.debug >= 6 )    /* show result of header scan */
  1647. X# define DEBUG_BINDSCAN    ( globs.debug >= 6 )    /* show result of dir scan */
  1648. X# define DEBUG_SEARCH    ( globs.debug >= 6 )    /* show attempts at binding */
  1649. X
  1650. X# define DEBUG_IF    ( globs.debug >= 7 )    /* show 'if' calculations */
  1651. X# define DEBUG_VARSET    ( globs.debug >= 7 )    /* show variable settings */
  1652. X# define DEBUG_VARGET    ( globs.debug >= 8 )    /* show variable fetches */
  1653. X# define DEBUG_VAREXP    ( globs.debug >= 8 )    /* show variable expansions */
  1654. X# define DEBUG_LISTS    ( globs.debug >= 9 )    /* show list manipulation */
  1655. X# define DEBUG_SCAN    ( globs.debug >= 9 )    /* show scanner tokens */
  1656. X
  1657. SHAR_EOF
  1658. chmod 0444 jam.h ||
  1659. echo 'restore of jam.h failed'
  1660. Wc_c="`wc -c < 'jam.h'`"
  1661. test 3290 -eq "$Wc_c" ||
  1662.     echo 'jam.h: original size 3290, current size' "$Wc_c"
  1663. fi
  1664. # ============= jamgram.c ==============
  1665. if test -f 'jamgram.c' -a X"$1" != X"-c"; then
  1666.     echo 'x - skipping jamgram.c (File already exists)'
  1667. else
  1668. echo 'x - extracting jamgram.c (Text)'
  1669. sed 's/^X//' << 'SHAR_EOF' > 'jamgram.c' &&
  1670. Xextern char *malloc(), *realloc();
  1671. X# define _BANG 257
  1672. X# define _BANG_EQUALS 258
  1673. X# define _AMPERAMPER 259
  1674. X# define _LPAREN 260
  1675. X# define _RPAREN 261
  1676. X# define _COLON 262
  1677. X# define _SEMIC 263
  1678. X# define _LANGLE 264
  1679. X# define _LANGLE_EQUALS 265
  1680. X# define _EQUALS 266
  1681. X# define _RANGLE 267
  1682. X# define _RANGLE_EQUALS 268
  1683. X# define ACTIONS 269
  1684. X# define CASE 270
  1685. X# define DEFAULT 271
  1686. X# define ELSE 272
  1687. X# define FOR 273
  1688. X# define IF 274
  1689. X# define IGNORE 275
  1690. X# define IN 276
  1691. X# define INCLUDE 277
  1692. X# define ON 278
  1693. X# define PIECEMEAL 279
  1694. X# define QUIETLY 280
  1695. X# define RULE 281
  1696. X# define SWITCH 282
  1697. X# define TOGETHER 283
  1698. X# define UPDATED 284
  1699. X# define _LBRACE 285
  1700. X# define _BARBAR 286
  1701. X# define _RBRACE 287
  1702. X# define ARG 288
  1703. X# define STRING 289
  1704. X
  1705. X# line 47 "jamgram.y"
  1706. X#include "lists.h"
  1707. X#include "parse.h"
  1708. X#include "scan.h"
  1709. X#include "compile.h"
  1710. X#include "newstr.h"
  1711. X
  1712. X# define F0 (void (*)())0
  1713. X# define P0 (PARSE *)0
  1714. X# define L0 (LIST *)0
  1715. X# define S0 (char *)0
  1716. X
  1717. X# define pset( l,r )       parse_make( compile_set,P0,P0,S0,S0,l,r,0 )
  1718. X# define psettings( l,p ) parse_make( compile_settings,p,P0,S0,S0,l,L0,0 )
  1719. X# define pseton( l,r )       parse_make( F0,P0,P0,S0,S0,l,r,0 )
  1720. X# define psetdef( l,r )   parse_make( compile_setdefault,P0,P0,S0,S0,l,r,0 )
  1721. X# define prule( s,l,r )   parse_make( compile_rule,P0,P0,s,S0,l,r,0 )
  1722. X# define prules( l,r )      parse_make( compile_rules,l,r,S0,S0,L0,L0,0 )
  1723. X# define pfor( s,p,l )    parse_make( compile_foreach,p,P0,s,S0,l,L0,0 )
  1724. X# define psetc( s,p )     parse_make( compile_setcomp,p,P0,s,S0,L0,L0,0 )
  1725. X# define psete( s,s1,f )  parse_make( compile_setexec,P0,P0,s,s1,L0,L0,f )
  1726. X# define pincl( l )       parse_make( compile_include,P0,P0,S0,S0,l,L0,0 )
  1727. X# define pswitch( l,p )   parse_make( compile_switch,p,P0,S0,S0,l,L0,0 )
  1728. X# define pcases( l,r )    parse_make( F0,l,r,S0,S0,L0,L0,0 )
  1729. X# define pcase( s,p )     parse_make( F0,p,P0,s,S0,L0,L0,0 )
  1730. X# define pif( l,r )      parse_make( compile_if,l,r,S0,S0,L0,L0,0 )
  1731. X# define pthen( l,r )      parse_make( F0,l,r,S0,S0,L0,L0,0 )
  1732. X# define pcond( c,l,r )      parse_make( F0,l,r,S0,S0,L0,L0,c )
  1733. X# define pcomp( c,l,r )      parse_make( F0,P0,P0,S0,S0,l,r,c )
  1734. X
  1735. X#define yyclearin yychar = -1
  1736. X#define yyerrok yyerrflag = 0
  1737. Xextern int yychar;
  1738. Xextern int yyerrflag;
  1739. X#ifndef YYMAXDEPTH
  1740. X#define YYMAXDEPTH 150
  1741. X#endif
  1742. X#ifndef YYSTYPE
  1743. X#define YYSTYPE int
  1744. X#endif
  1745. XYYSTYPE yylval, yyval;
  1746. X# define YYERRCODE 256
  1747. Xint yyexca[] ={
  1748. X-1, 1,
  1749. X    0, -1,
  1750. X    -2, 0,
  1751. X-1, 4,
  1752. X    266, 35,
  1753. X    271, 35,
  1754. X    278, 35,
  1755. X    -2, 33,
  1756. X    };
  1757. X# define YYNPROD 43
  1758. X# define YYLAST 177
  1759. Xint yyact[]={
  1760. X
  1761. X    10,    84,    51,    83,     6,     8,    53,    52,     3,    27,
  1762. X    50,    49,     9,     7,    81,    47,    11,    10,    88,     4,
  1763. X    76,     6,     8,    29,    28,     3,    27,    23,    78,     9,
  1764. X     7,    27,    75,    11,    10,    82,     4,    17,     6,     8,
  1765. X    59,    57,     3,    26,    33,    27,     9,     7,    87,    27,
  1766. X    11,    10,    55,     4,    36,     6,     8,    27,    34,     3,
  1767. X    31,    27,    27,     9,     7,    39,    27,    11,    27,    63,
  1768. X     4,    40,    41,    38,    42,    43,    36,    79,    73,    14,
  1769. X    35,    37,    86,    21,    15,    25,    22,    36,    54,    48,
  1770. X     2,    16,    20,    61,    62,    27,    12,    13,    74,    24,
  1771. X    18,     5,     1,    37,     0,    19,     0,    30,     0,    32,
  1772. X     0,     0,    46,     0,     0,     0,     0,     0,     0,     0,
  1773. X     0,    64,    56,     0,    58,     0,    60,    44,    45,     0,
  1774. X     0,    67,    68,    69,    70,    71,    72,     0,     0,     0,
  1775. X     0,     0,    65,    66,     0,     0,     0,     0,     0,     0,
  1776. X     0,     0,    77,     0,     0,     0,    80,     0,     0,     0,
  1777. X     0,     0,     0,     0,    85,     0,     0,     0,     0,     0,
  1778. X     0,     0,    89,     0,     0,     0,    90 };
  1779. Xint yypact[]={
  1780. X
  1781. X -1000,  -218, -1000, -1000, -1000,  -187,  -251, -1000,  -174,  -261,
  1782. X -1000, -1000,  -220,  -239, -1000,  -206, -1000,  -232,  -227,  -205,
  1783. X  -193,  -174,  -174,  -218,  -273,  -235, -1000, -1000, -1000, -1000,
  1784. X  -222, -1000,  -226, -1000,  -201, -1000,  -174,  -174, -1000, -1000,
  1785. X -1000, -1000, -1000, -1000, -1000,  -183, -1000, -1000, -1000, -1000,
  1786. X -1000, -1000, -1000, -1000, -1000, -1000,  -231, -1000,  -243, -1000,
  1787. X  -257,  -210,  -201,  -274,  -252, -1000,  -172,  -279,  -279,  -279,
  1788. X  -279,  -279,  -279, -1000,  -286, -1000, -1000,  -262, -1000, -1000,
  1789. X -1000,  -180,  -224, -1000, -1000,  -269, -1000,  -218, -1000,  -218,
  1790. X -1000 };
  1791. Xint yypgo[]={
  1792. X
  1793. X     0,   102,    88,    85,    92,   101,    93,   105,    99,    98,
  1794. X    94,    89 };
  1795. Xint yyr1[]={
  1796. X
  1797. X     0,     1,     1,     3,     3,     2,     2,     2,     2,     2,
  1798. X     2,     2,     2,     2,     2,     2,     9,     2,     2,     7,
  1799. X     7,     7,     7,     7,     7,     7,     7,     7,     7,     7,
  1800. X     6,     6,    10,     4,     4,     5,     8,     8,    11,    11,
  1801. X    11,    11,    11 };
  1802. Xint yyr2[]={
  1803. X
  1804. X     0,     1,     5,     1,     5,     7,     7,    11,     9,    11,
  1805. X    13,    15,    11,    11,    15,     7,     1,    11,     7,     3,
  1806. X     7,     7,     7,     7,     7,     7,     5,     7,     7,     7,
  1807. X     1,     5,     9,     1,     5,     3,     1,     5,     3,     3,
  1808. X     3,     3,     3 };
  1809. Xint yychk[]={
  1810. X
  1811. X -1000,    -1,    -2,   277,   288,    -5,   273,   282,   274,   281,
  1812. X   269,   285,    -4,    -4,   266,   271,   278,   288,    -4,    -7,
  1813. X    -4,   257,   260,   288,    -8,    -3,   263,   288,   263,   262,
  1814. X    -4,   266,    -4,   276,   285,   285,   259,   286,   266,   258,
  1815. X   264,   265,   267,   268,    -7,    -7,    -2,   288,   -11,   284,
  1816. X   283,   275,   280,   279,    -2,   287,    -4,   263,    -4,   266,
  1817. X    -4,    -6,   -10,   270,    -3,    -7,    -7,    -4,    -4,    -4,
  1818. X    -4,    -4,    -4,   261,    -9,   263,   263,    -4,   285,   287,
  1819. X    -6,   288,   287,   289,   263,    -3,   262,   272,   287,    -3,
  1820. X    -2 };
  1821. Xint yydef[]={
  1822. X
  1823. X     1,    -2,     2,    33,    -2,     0,     0,    33,    33,     0,
  1824. X    36,     3,     0,     0,    33,     0,    33,     0,     0,     0,
  1825. X    19,    33,    33,     0,     0,     0,     5,    34,     6,    33,
  1826. X     0,    33,     0,    33,    30,     3,    33,    33,    33,    33,
  1827. X    33,    33,    33,    33,    26,     0,    15,    16,    37,    38,
  1828. X    39,    40,    41,    42,     4,    18,     0,     8,     0,    33,
  1829. X     0,     0,    30,     0,     0,    27,    28,    20,    21,    22,
  1830. X    23,    24,    25,    29,     0,     7,     9,     0,     3,    12,
  1831. X    31,     0,    13,    17,    10,     0,     3,     0,    11,    32,
  1832. X    14 };
  1833. Xtypedef struct { char *t_name; int t_val; } yytoktype;
  1834. X#ifndef YYDEBUG
  1835. X#    define YYDEBUG    0    /* don't allow debugging */
  1836. X#endif
  1837. X
  1838. X#if YYDEBUG
  1839. X
  1840. Xyytoktype yytoks[] =
  1841. X{
  1842. X    "_BANG",    257,
  1843. X    "_BANG_EQUALS",    258,
  1844. X    "_AMPERAMPER",    259,
  1845. X    "_LPAREN",    260,
  1846. X    "_RPAREN",    261,
  1847. X    "_COLON",    262,
  1848. X    "_SEMIC",    263,
  1849. X    "_LANGLE",    264,
  1850. X    "_LANGLE_EQUALS",    265,
  1851. X    "_EQUALS",    266,
  1852. X    "_RANGLE",    267,
  1853. X    "_RANGLE_EQUALS",    268,
  1854. X    "ACTIONS",    269,
  1855. X    "CASE",    270,
  1856. X    "DEFAULT",    271,
  1857. X    "ELSE",    272,
  1858. X    "FOR",    273,
  1859. X    "IF",    274,
  1860. X    "IGNORE",    275,
  1861. X    "IN",    276,
  1862. X    "INCLUDE",    277,
  1863. X    "ON",    278,
  1864. X    "PIECEMEAL",    279,
  1865. X    "QUIETLY",    280,
  1866. X    "RULE",    281,
  1867. X    "SWITCH",    282,
  1868. X    "TOGETHER",    283,
  1869. X    "UPDATED",    284,
  1870. X    "_LBRACE",    285,
  1871. X    "_BARBAR",    286,
  1872. X    "_RBRACE",    287,
  1873. X    "ARG",    288,
  1874. X    "STRING",    289,
  1875. X    "-unknown-",    -1    /* ends search */
  1876. X};
  1877. X
  1878. Xchar * yyreds[] =
  1879. X{
  1880. X    "-no such reduction-",
  1881. X    "stmts : /* empty */",
  1882. X    "stmts : stmts rule",
  1883. X    "rules : /* empty */",
  1884. X    "rules : rules rule",
  1885. X    "rule : INCLUDE args _SEMIC",
  1886. X    "rule : ARG args _SEMIC",
  1887. X    "rule : ARG args _COLON args _SEMIC",
  1888. X    "rule : arg1 _EQUALS args _SEMIC",
  1889. X    "rule : arg1 DEFAULT _EQUALS args _SEMIC",
  1890. X    "rule : arg1 ON args _EQUALS args _SEMIC",
  1891. X    "rule : FOR ARG IN args _LBRACE rules _RBRACE",
  1892. X    "rule : SWITCH args _LBRACE cases _RBRACE",
  1893. X    "rule : IF cond _LBRACE rules _RBRACE",
  1894. X    "rule : IF cond _LBRACE rules _RBRACE ELSE rule",
  1895. X    "rule : RULE ARG rule",
  1896. X    "rule : ACTIONS eflags ARG",
  1897. X    "rule : ACTIONS eflags ARG STRING",
  1898. X    "rule : _LBRACE rules _RBRACE",
  1899. X    "cond : args",
  1900. X    "cond : args _EQUALS args",
  1901. X    "cond : args _BANG_EQUALS args",
  1902. X    "cond : args _LANGLE args",
  1903. X    "cond : args _LANGLE_EQUALS args",
  1904. X    "cond : args _RANGLE args",
  1905. X    "cond : args _RANGLE_EQUALS args",
  1906. X    "cond : _BANG cond",
  1907. X    "cond : cond _AMPERAMPER cond",
  1908. X    "cond : cond _BARBAR cond",
  1909. X    "cond : _LPAREN cond _RPAREN",
  1910. X    "cases : /* empty */",
  1911. X    "cases : case cases",
  1912. X    "case : CASE ARG _COLON rules",
  1913. X    "args : /* empty */",
  1914. X    "args : args ARG",
  1915. X    "arg1 : ARG",
  1916. X    "eflags : /* empty */",
  1917. X    "eflags : eflags eflag",
  1918. X    "eflag : UPDATED",
  1919. X    "eflag : TOGETHER",
  1920. X    "eflag : IGNORE",
  1921. X    "eflag : QUIETLY",
  1922. X    "eflag : PIECEMEAL",
  1923. X};
  1924. X#endif /* YYDEBUG */
  1925. X#line 1 "/usr/lib/yaccpar"
  1926. X/*    @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10    */
  1927. X
  1928. X/*
  1929. X** Skeleton parser driver for yacc output
  1930. X*/
  1931. X
  1932. X/*
  1933. X** yacc user known macros and defines
  1934. X*/
  1935. X#define YYERROR        goto yyerrlab
  1936. X#define YYACCEPT    { free(yys); free(yyv); return(0); }
  1937. X#define YYABORT        { free(yys); free(yyv); return(1); }
  1938. X#define YYBACKUP( newtoken, newvalue )\
  1939. X{\
  1940. X    if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  1941. X    {\
  1942. X        yyerror( "syntax error - cannot backup" );\
  1943. X        goto yyerrlab;\
  1944. X    }\
  1945. X    yychar = newtoken;\
  1946. X    yystate = *yyps;\
  1947. X    yylval = newvalue;\
  1948. X    goto yynewstate;\
  1949. X}
  1950. X#define YYRECOVERING()    (!!yyerrflag)
  1951. X#ifndef YYDEBUG
  1952. X#    define YYDEBUG    1    /* make debugging available */
  1953. X#endif
  1954. X
  1955. X/*
  1956. X** user known globals
  1957. X*/
  1958. Xint yydebug;            /* set to 1 to get debugging */
  1959. X
  1960. X/*
  1961. X** driver internal defines
  1962. X*/
  1963. X#define YYFLAG        (-1000)
  1964. X
  1965. X/*
  1966. X** static variables used by the parser
  1967. X*/
  1968. Xstatic YYSTYPE *yyv;            /* value stack */
  1969. Xstatic int *yys;            /* state stack */
  1970. X
  1971. Xstatic YYSTYPE *yypv;            /* top of value stack */
  1972. Xstatic int *yyps;            /* top of state stack */
  1973. X
  1974. Xstatic int yystate;            /* current state */
  1975. Xstatic int yytmp;            /* extra var (lasts between blocks) */
  1976. X
  1977. Xint yynerrs;            /* number of errors */
  1978. X
  1979. Xint yyerrflag;            /* error recovery flag */
  1980. Xint yychar;            /* current input token number */
  1981. X
  1982. X
  1983. X/*
  1984. X** yyparse - return 0 if worked, 1 if syntax error not recovered from
  1985. X*/
  1986. Xint
  1987. Xyyparse()
  1988. X{
  1989. X    register YYSTYPE *yypvt;    /* top of value stack for $vars */
  1990. X    unsigned yymaxdepth = YYMAXDEPTH;
  1991. X
  1992. X    /*
  1993. X    ** Initialize externals - yyparse may be called more than once
  1994. X    */
  1995. X    yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
  1996. X    yys = (int*)malloc(yymaxdepth*sizeof(int));
  1997. X    if (!yyv || !yys)
  1998. X    {
  1999. X        yyerror( "out of memory" );
  2000. X        return(1);
  2001. X    }
  2002. X    yypv = &yyv[-1];
  2003. X    yyps = &yys[-1];
  2004. X    yystate = 0;
  2005. X    yytmp = 0;
  2006. X    yynerrs = 0;
  2007. X    yyerrflag = 0;
  2008. X    yychar = -1;
  2009. X
  2010. X    goto yystack;
  2011. X    {
  2012. X        register YYSTYPE *yy_pv;    /* top of value stack */
  2013. X        register int *yy_ps;        /* top of state stack */
  2014. X        register int yy_state;        /* current state */
  2015. X        register int  yy_n;        /* internal state number info */
  2016. X
  2017. X        /*
  2018. X        ** get globals into registers.
  2019. X        ** branch to here only if YYBACKUP was called.
  2020. X        */
  2021. X    yynewstate:
  2022. X        yy_pv = yypv;
  2023. X        yy_ps = yyps;
  2024. X        yy_state = yystate;
  2025. X        goto yy_newstate;
  2026. X
  2027. X        /*
  2028. X        ** get globals into registers.
  2029. X        ** either we just started, or we just finished a reduction
  2030. X        */
  2031. X    yystack:
  2032. X        yy_pv = yypv;
  2033. X        yy_ps = yyps;
  2034. X        yy_state = yystate;
  2035. X
  2036. X        /*
  2037. X        ** top of for (;;) loop while no reductions done
  2038. X        */
  2039. X    yy_stack:
  2040. X        /*
  2041. X        ** put a state and value onto the stacks
  2042. X        */
  2043. X#if YYDEBUG
  2044. X        /*
  2045. X        ** if debugging, look up token value in list of value vs.
  2046. X        ** name pairs.  0 and negative (-1) are special values.
  2047. X        ** Note: linear search is used since time is not a real
  2048. X        ** consideration while debugging.
  2049. X        */
  2050. X        if ( yydebug )
  2051. X        {
  2052. X            register int yy_i;
  2053. X
  2054. X            (void)printf( "State %d, token ", yy_state );
  2055. X            if ( yychar == 0 )
  2056. X                (void)printf( "end-of-file\n" );
  2057. X            else if ( yychar < 0 )
  2058. X                (void)printf( "-none-\n" );
  2059. X            else
  2060. X            {
  2061. X                for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  2062. X                    yy_i++ )
  2063. X                {
  2064. X                    if ( yytoks[yy_i].t_val == yychar )
  2065. X                        break;
  2066. X                }
  2067. X                (void)printf( "%s\n", yytoks[yy_i].t_name );
  2068. X            }
  2069. X        }
  2070. X#endif /* YYDEBUG */
  2071. X        if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
  2072. X        {
  2073. X            /*
  2074. X            ** reallocate and recover.  Note that pointers
  2075. X            ** have to be reset, or bad things will happen
  2076. X            */
  2077. X            int yyps_index = (yy_ps - yys);
  2078. X            int yypv_index = (yy_pv - yyv);
  2079. X            int yypvt_index = (yypvt - yyv);
  2080. X            yymaxdepth += YYMAXDEPTH;
  2081. X            yyv = (YYSTYPE*)realloc((char*)yyv,
  2082. X                yymaxdepth * sizeof(YYSTYPE));
  2083. X            yys = (int*)realloc((char*)yys,
  2084. X                yymaxdepth * sizeof(int));
  2085. X            if (!yyv || !yys)
  2086. X            {
  2087. X                yyerror( "yacc stack overflow" );
  2088. X                return(1);
  2089. X            }
  2090. X            yy_ps = yys + yyps_index;
  2091. X            yy_pv = yyv + yypv_index;
  2092. X            yypvt = yyv + yypvt_index;
  2093. X        }
  2094. X        *yy_ps = yy_state;
  2095. X        *++yy_pv = yyval;
  2096. X
  2097. X        /*
  2098. X        ** we have a new state - find out what to do
  2099. X        */
  2100. X    yy_newstate:
  2101. X        if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
  2102. X            goto yydefault;        /* simple state */
  2103. X#if YYDEBUG
  2104. X        /*
  2105. X        ** if debugging, need to mark whether new token grabbed
  2106. X        */
  2107. X        yytmp = yychar < 0;
  2108. X#endif
  2109. X        if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  2110. X            yychar = 0;        /* reached EOF */
  2111. X#if YYDEBUG
  2112. X        if ( yydebug && yytmp )
  2113. X        {
  2114. X            register int yy_i;
  2115. X
  2116. X            (void)printf( "Received token " );
  2117. X            if ( yychar == 0 )
  2118. X                (void)printf( "end-of-file\n" );
  2119. X            else if ( yychar < 0 )
  2120. X                (void)printf( "-none-\n" );
  2121. X            else
  2122. X            {
  2123. X                for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  2124. X                    yy_i++ )
  2125. X                {
  2126. X                    if ( yytoks[yy_i].t_val == yychar )
  2127. X                        break;
  2128. X                }
  2129. X                (void)printf( "%s\n", yytoks[yy_i].t_name );
  2130. X            }
  2131. X        }
  2132. X#endif /* YYDEBUG */
  2133. X        if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
  2134. X            goto yydefault;
  2135. X        if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )    /*valid shift*/
  2136. X        {
  2137. X            yychar = -1;
  2138. X            yyval = yylval;
  2139. X            yy_state = yy_n;
  2140. X            if ( yyerrflag > 0 )
  2141. X                yyerrflag--;
  2142. X            goto yy_stack;
  2143. X        }
  2144. X
  2145. X    yydefault:
  2146. X        if ( ( yy_n = yydef[ yy_state ] ) == -2 )
  2147. X        {
  2148. X#if YYDEBUG
  2149. X            yytmp = yychar < 0;
  2150. X#endif
  2151. X            if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  2152. X                yychar = 0;        /* reached EOF */
  2153. X#if YYDEBUG
  2154. X            if ( yydebug && yytmp )
  2155. X            {
  2156. X                register int yy_i;
  2157. X
  2158. X                (void)printf( "Received token " );
  2159. X                if ( yychar == 0 )
  2160. X                    (void)printf( "end-of-file\n" );
  2161. X                else if ( yychar < 0 )
  2162. X                    (void)printf( "-none-\n" );
  2163. X                else
  2164. X                {
  2165. X                    for ( yy_i = 0;
  2166. X                        yytoks[yy_i].t_val >= 0;
  2167. X                        yy_i++ )
  2168. X                    {
  2169. X                        if ( yytoks[yy_i].t_val
  2170. X                            == yychar )
  2171. X                        {
  2172. X                            break;
  2173. X                        }
  2174. X                    }
  2175. X                    (void)printf( "%s\n", yytoks[yy_i].t_name );
  2176. X                }
  2177. X            }
  2178. X#endif /* YYDEBUG */
  2179. X            /*
  2180. X            ** look through exception table
  2181. X            */
  2182. X            {
  2183. X                register int *yyxi = yyexca;
  2184. X
  2185. X                while ( ( *yyxi != -1 ) ||
  2186. X                    ( yyxi[1] != yy_state ) )
  2187. X                {
  2188. X                    yyxi += 2;
  2189. X                }
  2190. X                while ( ( *(yyxi += 2) >= 0 ) &&
  2191. X                    ( *yyxi != yychar ) )
  2192. X                    ;
  2193. X                if ( ( yy_n = yyxi[1] ) < 0 )
  2194. X                    YYACCEPT;
  2195. X            }
  2196. X        }
  2197. X
  2198. X        /*
  2199. X        ** check for syntax error
  2200. X        */
  2201. X        if ( yy_n == 0 )    /* have an error */
  2202. X        {
  2203. X            /* no worry about speed here! */
  2204. X            switch ( yyerrflag )
  2205. X            {
  2206. X            case 0:        /* new error */
  2207. X                yyerror( "syntax error" );
  2208. X                goto skip_init;
  2209. X            yyerrlab:
  2210. X                /*
  2211. X                ** get globals into registers.
  2212. X                ** we have a user generated syntax type error
  2213. X                */
  2214. X                yy_pv = yypv;
  2215. X                yy_ps = yyps;
  2216. X                yy_state = yystate;
  2217. X                yynerrs++;
  2218. X            skip_init:
  2219. X            case 1:
  2220. X            case 2:        /* incompletely recovered error */
  2221. X                    /* try again... */
  2222. X                yyerrflag = 3;
  2223. X                /*
  2224. X                ** find state where "error" is a legal
  2225. X                ** shift action
  2226. X                */
  2227. X                while ( yy_ps >= yys )
  2228. X                {
  2229. X                    yy_n = yypact[ *yy_ps ] + YYERRCODE;
  2230. X                    if ( yy_n >= 0 && yy_n < YYLAST &&
  2231. X                        yychk[yyact[yy_n]] == YYERRCODE)                    {
  2232. X                        /*
  2233. X                        ** simulate shift of "error"
  2234. X                        */
  2235. X                        yy_state = yyact[ yy_n ];
  2236. X                        goto yy_stack;
  2237. X                    }
  2238. X                    /*
  2239. X                    ** current state has no shift on
  2240. X                    ** "error", pop stack
  2241. X                    */
  2242. X#if YYDEBUG
  2243. X#    define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  2244. X                    if ( yydebug )
  2245. X                        (void)printf( _POP_, *yy_ps,
  2246. X                            yy_ps[-1] );
  2247. X#    undef _POP_
  2248. X#endif
  2249. X                    yy_ps--;
  2250. X                    yy_pv--;
  2251. X                }
  2252. X                /*
  2253. X                ** there is no state on stack with "error" as
  2254. X                ** a valid shift.  give up.
  2255. X                */
  2256. X                YYABORT;
  2257. X            case 3:        /* no shift yet; eat a token */
  2258. X#if YYDEBUG
  2259. X                /*
  2260. X                ** if debugging, look up token in list of
  2261. X                ** pairs.  0 and negative shouldn't occur,
  2262. X                ** but since timing doesn't matter when
  2263. X                ** debugging, it doesn't hurt to leave the
  2264. X                ** tests here.
  2265. X                */
  2266. X                if ( yydebug )
  2267. X                {
  2268. X                    register int yy_i;
  2269. X
  2270. X                    (void)printf( "Error recovery discards " );
  2271. X                    if ( yychar == 0 )
  2272. X                        (void)printf( "token end-of-file\n" );
  2273. X                    else if ( yychar < 0 )
  2274. X                        (void)printf( "token -none-\n" );
  2275. X                    else
  2276. X                    {
  2277. X                        for ( yy_i = 0;
  2278. X                            yytoks[yy_i].t_val >= 0;
  2279. X                            yy_i++ )
  2280. X                        {
  2281. X                            if ( yytoks[yy_i].t_val
  2282. X                                == yychar )
  2283. X                            {
  2284. X                                break;
  2285. X                            }
  2286. X                        }
  2287. X                        (void)printf( "token %s\n",
  2288. X                            yytoks[yy_i].t_name );
  2289. X                    }
  2290. X                }
  2291. X#endif /* YYDEBUG */
  2292. X                if ( yychar == 0 )    /* reached EOF. quit */
  2293. X                    YYABORT;
  2294. X                yychar = -1;
  2295. X                goto yy_newstate;
  2296. X            }
  2297. X        }/* end if ( yy_n == 0 ) */
  2298. X        /*
  2299. X        ** reduction by production yy_n
  2300. X        ** put stack tops, etc. so things right after switch
  2301. X        */
  2302. X#if YYDEBUG
  2303. X        /*
  2304. X        ** if debugging, print the string that is the user's
  2305. X        ** specification of the reduction which is just about
  2306. X        ** to be done.
  2307. X        */
  2308. X        if ( yydebug )
  2309. X            (void)printf( "Reduce by (%d) \"%s\"\n",
  2310. X                yy_n, yyreds[ yy_n ] );
  2311. X#endif
  2312. X        yytmp = yy_n;            /* value to switch over */
  2313. X        yypvt = yy_pv;            /* $vars top of value stack */
  2314. X        /*
  2315. X        ** Look in goto table for next state
  2316. X        ** Sorry about using yy_state here as temporary
  2317. X        ** register variable, but why not, if it works...
  2318. X        ** If yyr2[ yy_n ] doesn't have the low order bit
  2319. X        ** set, then there is no action to be done for
  2320. X        ** this reduction.  So, no saving & unsaving of
  2321. X        ** registers done.  The only difference between the
  2322. X        ** code just after the if and the body of the if is
  2323. X        ** the goto yy_stack in the body.  This way the test
  2324. X        ** can be made before the choice of what to do is needed.
  2325. X        */
  2326. X        {
  2327. X            /* length of production doubled with extra bit */
  2328. X            register int yy_len = yyr2[ yy_n ];
  2329. X
  2330. X            if ( !( yy_len & 01 ) )
  2331. X            {
  2332. X                yy_len >>= 1;
  2333. X                yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  2334. X                yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  2335. X                    *( yy_ps -= yy_len ) + 1;
  2336. X                if ( yy_state >= YYLAST ||
  2337. X                    yychk[ yy_state =
  2338. X                    yyact[ yy_state ] ] != -yy_n )
  2339. X                {
  2340. X                    yy_state = yyact[ yypgo[ yy_n ] ];
  2341. X                }
  2342. X                goto yy_stack;
  2343. X            }
  2344. X            yy_len >>= 1;
  2345. X            yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  2346. X            yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  2347. X                *( yy_ps -= yy_len ) + 1;
  2348. X            if ( yy_state >= YYLAST ||
  2349. X                yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
  2350. X            {
  2351. X                yy_state = yyact[ yypgo[ yy_n ] ];
  2352. X            }
  2353. X        }
  2354. X                    /* save until reenter driver code */
  2355. X        yystate = yy_state;
  2356. X        yyps = yy_ps;
  2357. X        yypv = yy_pv;
  2358. X    }
  2359. X    /*
  2360. X    ** code supplied by user is placed in this switch
  2361. X    */
  2362. X    switch( yytmp )
  2363. X    {
  2364. X        
  2365. Xcase 1:
  2366. X# line 85 "jamgram.y"
  2367. X{
  2368. X            compile_builtins();
  2369. X        } break;
  2370. Xcase 2:
  2371. X# line 89 "jamgram.y"
  2372. X{ 
  2373. X            (*(yypvt[-0].parse->func))( yypvt[-0].parse, L0, L0 );
  2374. X            parse_free( yypvt[-0].parse );
  2375. X        } break;
  2376. Xcase 3:
  2377. X# line 101 "jamgram.y"
  2378. X{ yyval.parse = prules( P0, P0 ); } break;
  2379. Xcase 4:
  2380. X# line 103 "jamgram.y"
  2381. X{ yyval.parse = prules( yypvt[-1].parse, yypvt[-0].parse ); } break;
  2382. Xcase 5:
  2383. X# line 107 "jamgram.y"
  2384. X{ yyval.parse = pincl( yypvt[-1].list ); } break;
  2385. Xcase 6:
  2386. X# line 109 "jamgram.y"
  2387. X{ yyval.parse = prule( yypvt[-2].string, yypvt[-1].list, L0 ); } break;
  2388. Xcase 7:
  2389. X# line 111 "jamgram.y"
  2390. X{ yyval.parse = prule( yypvt[-4].string, yypvt[-3].list, yypvt[-1].list ); } break;
  2391. Xcase 8:
  2392. X# line 113 "jamgram.y"
  2393. X{ yyval.parse = pset( yypvt[-3].list, yypvt[-1].list ); } break;
  2394. Xcase 9:
  2395. X# line 115 "jamgram.y"
  2396. X{ yyval.parse = psetdef( yypvt[-4].list, yypvt[-1].list ); } break;
  2397. Xcase 10:
  2398. X# line 117 "jamgram.y"
  2399. X{ yyval.parse = psettings( yypvt[-3].list, pseton( yypvt[-5].list, yypvt[-1].list ) ); } break;
  2400. Xcase 11:
  2401. X# line 119 "jamgram.y"
  2402. X{ yyval.parse = pfor( yypvt[-5].string, yypvt[-1].parse, yypvt[-3].list ); } break;
  2403. Xcase 12:
  2404. X# line 121 "jamgram.y"
  2405. X{ yyval.parse = pswitch( yypvt[-3].list, yypvt[-1].parse ); } break;
  2406. Xcase 13:
  2407. X# line 123 "jamgram.y"
  2408. X{ yyval.parse = pif( yypvt[-3].parse, pthen( yypvt[-1].parse, P0 ) ); } break;
  2409. Xcase 14:
  2410. X# line 125 "jamgram.y"
  2411. X{ yyval.parse = pif( yypvt[-5].parse, pthen( yypvt[-3].parse, yypvt[-0].parse ) ); } break;
  2412. Xcase 15:
  2413. X# line 127 "jamgram.y"
  2414. X{ yyval.parse = psetc( yypvt[-1].string, yypvt[-0].parse ); } break;
  2415. Xcase 16:
  2416. X# line 129 "jamgram.y"
  2417. X{ scan_asstring = 1; } break;
  2418. Xcase 17:
  2419. X# line 131 "jamgram.y"
  2420. X{ yyval.parse = psete( yypvt[-2].string, yypvt[-0].string, yypvt[-3].number );
  2421. X          scan_asstring = 0; } break;
  2422. Xcase 18:
  2423. X# line 134 "jamgram.y"
  2424. X{ yyval.parse = yypvt[-1].parse; } break;
  2425. Xcase 19:
  2426. X# line 142 "jamgram.y"
  2427. X{ yyval.parse = pcomp( COND_EXISTS, yypvt[-0].list, L0 ); } break;
  2428. Xcase 20:
  2429. X# line 144 "jamgram.y"
  2430. X{ yyval.parse = pcomp( COND_EQUALS, yypvt[-2].list, yypvt[-0].list ); } break;
  2431. Xcase 21:
  2432. X# line 146 "jamgram.y"
  2433. X{ yyval.parse = pcomp( COND_NOTEQ, yypvt[-2].list, yypvt[-0].list ); } break;
  2434. Xcase 22:
  2435. X# line 148 "jamgram.y"
  2436. X{ yyval.parse = pcomp( COND_LESS, yypvt[-2].list, yypvt[-0].list ); } break;
  2437. Xcase 23:
  2438. X# line 150 "jamgram.y"
  2439. X{ yyval.parse = pcomp( COND_LESSEQ, yypvt[-2].list, yypvt[-0].list ); } break;
  2440. Xcase 24:
  2441. X# line 152 "jamgram.y"
  2442. X{ yyval.parse = pcomp( COND_MORE, yypvt[-2].list, yypvt[-0].list ); } break;
  2443. Xcase 25:
  2444. X# line 154 "jamgram.y"
  2445. X{ yyval.parse = pcomp( COND_MOREEQ, yypvt[-2].list, yypvt[-0].list ); } break;
  2446. Xcase 26:
  2447. X# line 156 "jamgram.y"
  2448. X{ yyval.parse = pcond( COND_NOT, yypvt[-0].parse, P0 ); } break;
  2449. Xcase 27:
  2450. X# line 158 "jamgram.y"
  2451. X{ yyval.parse = pcond( COND_AND, yypvt[-2].parse, yypvt[-0].parse ); } break;
  2452. Xcase 28:
  2453. X# line 160 "jamgram.y"
  2454. X{ yyval.parse = pcond( COND_OR, yypvt[-2].parse, yypvt[-0].parse ); } break;
  2455. Xcase 29:
  2456. X# line 162 "jamgram.y"
  2457. X{ yyval.parse = yypvt[-1].parse; } break;
  2458. Xcase 30:
  2459. X# line 173 "jamgram.y"
  2460. X{ yyval.parse = P0; } break;
  2461. Xcase 31:
  2462. X# line 175 "jamgram.y"
  2463. X{ yyval.parse = pcases( yypvt[-1].parse, yypvt[-0].parse ); } break;
  2464. Xcase 32:
  2465. X# line 179 "jamgram.y"
  2466. X{ yyval.parse = pcase( yypvt[-2].string, yypvt[-0].parse ); } break;
  2467. Xcase 33:
  2468. X# line 188 "jamgram.y"
  2469. X{ yyval.list = L0; } break;
  2470. Xcase 34:
  2471. X# line 190 "jamgram.y"
  2472. X{ yyval.list = list_new( yypvt[-1].list, copystr( yypvt[-0].string ) ); } break;
  2473. Xcase 35:
  2474. X# line 194 "jamgram.y"
  2475. X{ yyval.list = list_new( L0, copystr( yypvt[-0].string ) ); } break;
  2476. Xcase 36:
  2477. X# line 203 "jamgram.y"
  2478. X{ yyval.number = 0; } break;
  2479. Xcase 37:
  2480. X# line 205 "jamgram.y"
  2481. X{ yyval.number = yypvt[-1].number | yypvt[-0].number; } break;
  2482. Xcase 38:
  2483. X# line 209 "jamgram.y"
  2484. X{ yyval.number = EXEC_UPDATED; } break;
  2485. Xcase 39:
  2486. X# line 211 "jamgram.y"
  2487. X{ yyval.number = EXEC_TOGETHER; } break;
  2488. Xcase 40:
  2489. X# line 213 "jamgram.y"
  2490. X{ yyval.number = EXEC_IGNORE; } break;
  2491. Xcase 41:
  2492. X# line 215 "jamgram.y"
  2493. X{ yyval.number = EXEC_QUIETLY; } break;
  2494. Xcase 42:
  2495. X# line 217 "jamgram.y"
  2496. X{ yyval.number = EXEC_PIECEMEAL; } break;
  2497. X    }
  2498. X    goto yystack;        /* reset registers in driver code */
  2499. X}
  2500. SHAR_EOF
  2501. chmod 0444 jamgram.c ||
  2502. echo 'restore of jamgram.c failed'
  2503. Wc_c="`wc -c < 'jamgram.c'`"
  2504. test 22556 -eq "$Wc_c" ||
  2505.     echo 'jamgram.c: original size 22556, current size' "$Wc_c"
  2506. fi
  2507. true || echo 'restore of jamgram.h failed'
  2508. echo End of part 4, continue with part 5
  2509. exit 0
  2510.