Ignore:
Timestamp:
Oct 7, 2007, 11:47:15 PM (18 years ago)
Author:
bird
Message:

make more build...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/arith.y

    r809 r1217  
    3434 */
    3535
    36 #ifdef HAVE_SYS_CDEFS_H
    37 #include <sys/cdefs.h>
    38 #endif
     36#if 0
    3937#ifndef lint
    40 #if 0
    4138static char sccsid[] = "@(#)arith.y     8.3 (Berkeley) 5/4/95";
    4239#else
    4340__RCSID("$NetBSD: arith.y,v 1.17 2003/09/17 17:33:36 jmmv Exp $");
     41#endif /* not lint */
    4442#endif
    45 #endif /* not lint */
    4643
    4744#include <stdlib.h>
     
    5148#include "output.h"
    5249#include "memalloc.h"
    53 
     50#include "shinstance.h"
     51
     52shinstance *arith_psh;
    5453const char *arith_buf, *arith_startbuf;
    5554
     
    117116%%
    118117int
    119 arith(s)
    120         const char *s;
     118arith(shinstance *psh, const char *s)
    121119{
    122120        long result;
    123121
     122        INTOFF;
     123/* todo lock */
     124   arith_psh = psh;
    124125        arith_buf = arith_startbuf = s;
    125 
    126         INTOFF;
    127126        result = yyparse();
    128127        arith_lex_reset();      /* reprime lex */
     128   arith_psh = NULL;
     129/* todo unlock */
    129130        INTON;
    130131
     
    137138 */
    138139int
    139 expcmd(argc, argv)
    140         int argc;
    141         char **argv;
     140expcmd(shinstance *psh, int argc, char **argv)
    142141{
    143142        const char *p;
     
    152151                         * concatenate arguments
    153152                         */
    154                         STARTSTACKSTR(concat);
     153                        STARTSTACKSTR(psh, concat);
    155154                        ap = argv + 2;
    156155                        for (;;) {
    157156                                while (*p)
    158                                         STPUTC(*p++, concat);
     157                                        STPUTC(psh, *p++, concat);
    159158                                if ((p = *ap++) == NULL)
    160159                                        break;
    161                                 STPUTC(' ', concat);
     160                                STPUTC(psh, ' ', concat);
    162161                        }
    163                         STPUTC('\0', concat);
    164                         p = grabstackstr(concat);
     162                        STPUTC(psh, '\0', concat);
     163                        p = grabstackstr(psh, concat);
    165164                }
    166165        } else
    167166                p = "";
    168167
    169         i = arith(p);
    170 
    171         out1fmt("%ld\n", i);
     168        i = arith(psh, p);
     169
     170        out1fmt(psh, "%ld\n", i);
    172171        return (! i);
    173172}
     
    190189
    191190void
    192 yyerror(s)
    193         const char *s;
    194 {
    195 
     191yyerror(const char *s)
     192{
     193   shinstance *psh = arith_psh;
    196194        yyerrok;
    197195        yyclearin;
    198196        arith_lex_reset();      /* reprime lex */
    199         error("arithmetic expression: %s: \"%s\"", s, arith_startbuf);
     197/** @todo unlock */
     198        error(psh, "arithmetic expression: %s: \"%s\"", s, arith_startbuf);
    200199        /* NOTREACHED */
    201200}
Note: See TracChangeset for help on using the changeset viewer.