Ignore:
Timestamp:
Sep 14, 2010, 1:13:20 AM (15 years ago)
Author:
bird
Message:

kash: trimmed down the arith stuff, making it not drag in libc bits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/generated/arith_lex.c

    r1233 r2415  
    1 #line 2 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"
    2 
    3 #line 4 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"
     1#line 2 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c"
     2
     3#line 4 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c"
    44
    55#define  YY_INT_ALIGNED short int
     
    478478#define YY_RESTORE_YY_MORE_OFFSET
    479479char *yytext;
    480 #line 1 "arith_lex.l"
    481 #line 3 "arith_lex.l"
     480#line 1 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
     481#define YY_NO_INPUT 1
     482/** @todo %option reentrant */
     483#line 33 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    482484/*      $NetBSD: arith_lex.l,v 1.13 2005/03/21 22:37:09 dsl Exp $       */
    483485
     
    522524#endif
    523525
     526#include <stdio.h>
    524527#include "arith.h"
    525528#include "error.h"
     
    535538        result = (*buf = *arith_buf++) ? 1 : YY_NULL;
    536539#define YY_NO_UNPUT
    537 #line 538 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"
     540
     541/* Avoid unnecessary libc bits. */
     542#undef  ECHO
     543#define ECHO \
     544        do {} while (0)
     545#undef  stdin
     546#define stdin  \
     547        NULL
     548#undef  stdout
     549#define stdout \
     550        NULL
     551#define YY_FATAL_ERROR(msg) \
     552        error(arith_psh, "arith: fatal error: %s", msg)
     553#line 554 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c"
    538554
    539555#define INITIAL 0
     
    565581#endif
    566582
    567     static void yyunput (int c,char *buf_ptr  );
    568    
    569583#ifndef yytext_ptr
    570584static void yy_flex_strncpy (char *,yyconst char *,int );
     
    688702        register int yy_act;
    689703   
    690 #line 60 "arith_lex.l"
    691 
    692 #line 693 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"
     704#line 104 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
     705
     706#line 707 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c"
    693707
    694708        if ( !(yy_init) )
     
    749763                        ++yy_cp;
    750764                        }
    751                 while ( yy_base[yy_current_state] != 48 );
     765                while ( yy_current_state != 38 );
     766                yy_cp = (yy_last_accepting_cpos);
     767                yy_current_state = (yy_last_accepting_state);
    752768
    753769yy_find_action:
    754770                yy_act = yy_accept[yy_current_state];
    755                 if ( yy_act == 0 )
    756                         { /* have to back up */
    757                         yy_cp = (yy_last_accepting_cpos);
    758                         yy_current_state = (yy_last_accepting_state);
    759                         yy_act = yy_accept[yy_current_state];
    760                         }
    761771
    762772                YY_DO_BEFORE_ACTION;
     
    776786/* rule 1 can match eol */
    777787YY_RULE_SETUP
    778 #line 61 "arith_lex.l"
     788#line 105 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    779789{ ; }
    780790        YY_BREAK
    781791case 2:
    782792YY_RULE_SETUP
    783 #line 62 "arith_lex.l"
     793#line 106 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    784794{ yylval = strtol(yytext, 0, 0); return(ARITH_NUM); }
    785795        YY_BREAK
    786796case 3:
    787797YY_RULE_SETUP
    788 #line 63 "arith_lex.l"
     798#line 107 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    789799{ yylval = strtol(yytext, 0, 0); return(ARITH_NUM); }
    790800        YY_BREAK
    791801case 4:
    792802YY_RULE_SETUP
    793 #line 64 "arith_lex.l"
     803#line 108 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    794804{ yylval = strtol(yytext, 0, 0); return(ARITH_NUM); }
    795805        YY_BREAK
    796806case 5:
    797807YY_RULE_SETUP
    798 #line 65 "arith_lex.l"
     808#line 109 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    799809{ char *v = lookupvar(arith_psh, yytext);
    800810                        if (v) {
     
    808818case 6:
    809819YY_RULE_SETUP
    810 #line 73 "arith_lex.l"
     820#line 117 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    811821{ return(ARITH_LPAREN); }
    812822        YY_BREAK
    813823case 7:
    814824YY_RULE_SETUP
    815 #line 74 "arith_lex.l"
     825#line 118 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    816826{ return(ARITH_RPAREN); }
    817827        YY_BREAK
    818828case 8:
    819829YY_RULE_SETUP
    820 #line 75 "arith_lex.l"
     830#line 119 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    821831{ return(ARITH_OR); }
    822832        YY_BREAK
    823833case 9:
    824834YY_RULE_SETUP
    825 #line 76 "arith_lex.l"
     835#line 120 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    826836{ return(ARITH_AND); }
    827837        YY_BREAK
    828838case 10:
    829839YY_RULE_SETUP
    830 #line 77 "arith_lex.l"
     840#line 121 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    831841{ return(ARITH_BOR); }
    832842        YY_BREAK
    833843case 11:
    834844YY_RULE_SETUP
    835 #line 78 "arith_lex.l"
     845#line 122 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    836846{ return(ARITH_BXOR); }
    837847        YY_BREAK
    838848case 12:
    839849YY_RULE_SETUP
    840 #line 79 "arith_lex.l"
     850#line 123 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    841851{ return(ARITH_BAND); }
    842852        YY_BREAK
    843853case 13:
    844854YY_RULE_SETUP
    845 #line 80 "arith_lex.l"
     855#line 124 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    846856{ return(ARITH_EQ); }
    847857        YY_BREAK
    848858case 14:
    849859YY_RULE_SETUP
    850 #line 81 "arith_lex.l"
     860#line 125 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    851861{ return(ARITH_NE); }
    852862        YY_BREAK
    853863case 15:
    854864YY_RULE_SETUP
    855 #line 82 "arith_lex.l"
     865#line 126 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    856866{ return(ARITH_GT); }
    857867        YY_BREAK
    858868case 16:
    859869YY_RULE_SETUP
    860 #line 83 "arith_lex.l"
     870#line 127 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    861871{ return(ARITH_GE); }
    862872        YY_BREAK
    863873case 17:
    864874YY_RULE_SETUP
    865 #line 84 "arith_lex.l"
     875#line 128 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    866876{ return(ARITH_LT); }
    867877        YY_BREAK
    868878case 18:
    869879YY_RULE_SETUP
    870 #line 85 "arith_lex.l"
     880#line 129 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    871881{ return(ARITH_LE); }
    872882        YY_BREAK
    873883case 19:
    874884YY_RULE_SETUP
    875 #line 86 "arith_lex.l"
     885#line 130 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    876886{ return(ARITH_LSHIFT); }
    877887        YY_BREAK
    878888case 20:
    879889YY_RULE_SETUP
    880 #line 87 "arith_lex.l"
     890#line 131 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    881891{ return(ARITH_RSHIFT); }
    882892        YY_BREAK
    883893case 21:
    884894YY_RULE_SETUP
    885 #line 88 "arith_lex.l"
     895#line 132 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    886896{ return(ARITH_MUL); }
    887897        YY_BREAK
    888898case 22:
    889899YY_RULE_SETUP
    890 #line 89 "arith_lex.l"
     900#line 133 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    891901{ return(ARITH_DIV); }
    892902        YY_BREAK
    893903case 23:
    894904YY_RULE_SETUP
    895 #line 90 "arith_lex.l"
     905#line 134 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    896906{ return(ARITH_REM); }
    897907        YY_BREAK
    898908case 24:
    899909YY_RULE_SETUP
    900 #line 91 "arith_lex.l"
     910#line 135 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    901911{ return(ARITH_ADD); }
    902912        YY_BREAK
    903913case 25:
    904914YY_RULE_SETUP
    905 #line 92 "arith_lex.l"
     915#line 136 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    906916{ return(ARITH_SUB); }
    907917        YY_BREAK
    908918case 26:
    909919YY_RULE_SETUP
    910 #line 93 "arith_lex.l"
     920#line 137 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    911921{ return(ARITH_BNOT); }
    912922        YY_BREAK
    913923case 27:
    914924YY_RULE_SETUP
    915 #line 94 "arith_lex.l"
     925#line 138 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    916926{ return(ARITH_NOT); }
    917927        YY_BREAK
    918928case 28:
    919929YY_RULE_SETUP
    920 #line 95 "arith_lex.l"
     930#line 139 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    921931{ error(arith_psh, "arith: syntax error: \"%s\"", arith_startbuf); }
    922932        YY_BREAK
    923933case 29:
    924934YY_RULE_SETUP
    925 #line 96 "arith_lex.l"
     935#line 140 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    926936ECHO;
    927937        YY_BREAK
    928 #line 929 "/home/bird/vax/gdrive/coding/kbuild/svn/trunk/out/linux.x86/release/obj/src/kash/arith_lex.c"
     938#line 939 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/out/darwin.x86/release/obj/kash/arith_lex.c"
    929939case YY_STATE_EOF(INITIAL):
    930940        yyterminate();
     
    9931003                        else
    9941004                                {
    995                                 yy_cp = (yy_c_buf_p);
     1005                                yy_cp = (yy_last_accepting_cpos);
     1006                                yy_current_state = (yy_last_accepting_state);
    9961007                                goto yy_find_action;
    9971008                                }
     
    12471258}
    12481259
    1249     static void yyunput (int c, register char * yy_bp )
    1250 {
    1251         register char *yy_cp;
    1252    
    1253     yy_cp = (yy_c_buf_p);
    1254 
    1255         /* undo effects of setting up yytext */
    1256         *yy_cp = (yy_hold_char);
    1257 
    1258         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
    1259                 { /* need to shift things up to make room */
    1260                 /* +2 for EOB chars. */
    1261                 register int number_to_move = (yy_n_chars) + 2;
    1262                 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
    1263                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
    1264                 register char *source =
    1265                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
    1266 
    1267                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
    1268                         *--dest = *--source;
    1269 
    1270                 yy_cp += (int) (dest - source);
    1271                 yy_bp += (int) (dest - source);
    1272                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
    1273                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
    1274 
    1275                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
    1276                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
    1277                 }
    1278 
    1279         *--yy_cp = (char) c;
    1280 
    1281         (yytext_ptr) = yy_bp;
    1282         (yy_hold_char) = *yy_cp;
    1283         (yy_c_buf_p) = yy_cp;
    1284 }
    1285 
    12861260#ifndef YY_NO_INPUT
    12871261#ifdef __cplusplus
     
    13321306                                        {
    13331307                                        if ( yywrap( ) )
    1334                                                 return EOF;
     1308                                                return 0;
    13351309
    13361310                                        if ( ! (yy_did_buffer_switch_on_eof) )
     
    14681442}
    14691443
    1470 #ifndef _UNISTD_H /* assume unistd.h has isatty() for us */
    1471 #ifdef __cplusplus
    1472 extern "C" {
    1473 #endif
    1474 #ifdef __THROW /* this is a gnuism */
    1475 extern int isatty (int ) __THROW;
    1476 #else
    1477 extern int isatty (int );
    1478 #endif
    1479 #ifdef __cplusplus
    1480 }
    1481 #endif
    1482 #endif
    1483    
    14841444/* Initializes or reinitializes a buffer.
    14851445 * This function is sometimes called more than once on the same buffer,
     
    15051465    }
    15061466
    1507         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
     1467        b->yy_is_interactive = 0;
    15081468   
    15091469        errno = oerrno;
     
    16311591}
    16321592
    1633 /** Setup the input buffer state to scan directly from a user-specified character buffer.
    1634  * @param base the character buffer
    1635  * @param size the size in bytes of the character buffer
    1636  *
    1637  * @return the newly allocated buffer state object.
    1638  */
    1639 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
    1640 {
    1641         YY_BUFFER_STATE b;
    1642    
    1643         if ( size < 2 ||
    1644              base[size-2] != YY_END_OF_BUFFER_CHAR ||
    1645              base[size-1] != YY_END_OF_BUFFER_CHAR )
    1646                 /* They forgot to leave room for the EOB's. */
    1647                 return 0;
    1648 
    1649         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
    1650         if ( ! b )
    1651                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
    1652 
    1653         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
    1654         b->yy_buf_pos = b->yy_ch_buf = base;
    1655         b->yy_is_our_buffer = 0;
    1656         b->yy_input_file = 0;
    1657         b->yy_n_chars = b->yy_buf_size;
    1658         b->yy_is_interactive = 0;
    1659         b->yy_at_bol = 1;
    1660         b->yy_fill_buffer = 0;
    1661         b->yy_buffer_status = YY_BUFFER_NEW;
    1662 
    1663         yy_switch_to_buffer(b  );
    1664 
    1665         return b;
    1666 }
    1667 
    1668 /** Setup the input buffer state to scan a string. The next call to yylex() will
    1669  * scan from a @e copy of @a str.
    1670  * @param str a NUL-terminated string to scan
    1671  *
    1672  * @return the newly allocated buffer state object.
    1673  * @note If you want to scan bytes that may contain NUL values, then use
    1674  *       yy_scan_bytes() instead.
    1675  */
    1676 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
    1677 {
    1678    
    1679         return yy_scan_bytes(yystr,strlen(yystr) );
    1680 }
    1681 
    1682 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
    1683  * scan from a @e copy of @a bytes.
    1684  * @param bytes the byte buffer to scan
    1685  * @param len the number of bytes in the buffer pointed to by @a bytes.
    1686  *
    1687  * @return the newly allocated buffer state object.
    1688  */
    1689 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
    1690 {
    1691         YY_BUFFER_STATE b;
    1692         char *buf;
    1693         yy_size_t n;
    1694         int i;
    1695    
    1696         /* Get memory for full buffer, including space for trailing EOB's. */
    1697         n = _yybytes_len + 2;
    1698         buf = (char *) yyalloc(n  );
    1699         if ( ! buf )
    1700                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
    1701 
    1702         for ( i = 0; i < _yybytes_len; ++i )
    1703                 buf[i] = yybytes[i];
    1704 
    1705         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
    1706 
    1707         b = yy_scan_buffer(buf,n );
    1708         if ( ! b )
    1709                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
    1710 
    1711         /* It's okay to grow etc. this buffer, and we should throw it
    1712          * away when we're done.
    1713          */
    1714         b->yy_is_our_buffer = 1;
    1715 
    1716         return b;
    1717 }
    1718 
    17191593#ifndef YY_EXIT_FAILURE
    17201594#define YY_EXIT_FAILURE 2
     
    17461620/* Accessor  methods (get/set functions) to struct members. */
    17471621
    1748 /** Get the current line number.
    1749  *
    1750  */
    1751 int yyget_lineno  (void)
    1752 {
    1753        
    1754     return yylineno;
    1755 }
    1756 
    1757 /** Get the input stream.
    1758  *
    1759  */
    1760 FILE *yyget_in  (void)
    1761 {
    1762         return yyin;
    1763 }
    1764 
    1765 /** Get the output stream.
    1766  *
    1767  */
    1768 FILE *yyget_out  (void)
    1769 {
    1770         return yyout;
    1771 }
    1772 
    1773 /** Get the length of the current token.
    1774  *
    1775  */
    1776 int yyget_leng  (void)
    1777 {
    1778         return yyleng;
    1779 }
    1780 
    17811622/** Get the current token.
    17821623 *
    17831624 */
    1784 
    1785 char *yyget_text  (void)
    1786 {
    1787         return yytext;
    1788 }
    1789 
    1790 /** Set the current line number.
    1791  * @param line_number
    1792  *
    1793  */
    1794 void yyset_lineno (int  line_number )
    1795 {
    1796    
    1797     yylineno = line_number;
    1798 }
    1799 
    1800 /** Set the input stream. This does not discard the current
    1801  * input buffer.
    1802  * @param in_str A readable stream.
    1803  *
    1804  * @see yy_switch_to_buffer
    1805  */
    1806 void yyset_in (FILE *  in_str )
    1807 {
    1808         yyin = in_str ;
    1809 }
    1810 
    1811 void yyset_out (FILE *  out_str )
    1812 {
    1813         yyout = out_str ;
    1814 }
    1815 
    1816 int yyget_debug  (void)
    1817 {
    1818         return yy_flex_debug;
    1819 }
    1820 
    1821 void yyset_debug (int  bdebug )
    1822 {
    1823         yy_flex_debug = bdebug ;
    1824 }
    18251625
    18261626static int yy_init_globals (void)
     
    18981698#endif
    18991699
    1900 void *yyalloc (yy_size_t  size )
    1901 {
    1902         return (void *) malloc( size );
    1903 }
    1904 
    1905 void *yyrealloc  (void * ptr, yy_size_t  size )
    1906 {
    1907         /* The cast to (char *) in the following accommodates both
    1908          * implementations that use char* generic pointers, and those
    1909          * that use void* generic pointers.  It works with the latter
    1910          * because both ANSI C and C++ allow castless assignment from
    1911          * any pointer type to void*, and deal with argument conversions
    1912          * as though doing an assignment.
    1913          */
    1914         return (void *) realloc( (char *) ptr, size );
    1915 }
    1916 
    1917 void yyfree (void * ptr )
    1918 {
    1919         free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
    1920 }
    1921 
    19221700#define YYTABLES_NAME "yytables"
    19231701
    1924 #line 96 "arith_lex.l"
     1702#line 140 "/Volumes/ScratchHFS/bird/kBuild/svn/trunk/src/kash/arith_lex.l"
    19251703
    19261704
     
    19331711}
    19341712
     1713void *
     1714yyalloc(yy_size_t cb)
     1715{
     1716        return sh_malloc(NULL, cb);
     1717}
     1718
     1719void *
     1720yyrealloc(void *pv,yy_size_t cb)
     1721{
     1722        return sh_realloc(NULL, pv, cb);
     1723}
     1724
     1725void
     1726yyfree(void *pv)
     1727{
     1728        sh_free(NULL, pv);
     1729}
     1730
     1731
Note: See TracChangeset for help on using the changeset viewer.