Ignore:
Timestamp:
Sep 3, 2002, 8:17:46 PM (23 years ago)
Author:
umoeller
Message:

Minor adjustments for new static handling.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/regexp.c

    r178 r222  
    6262#include <malloc.h>
    6363#include <memory.h>
     64
     65#include "setup.h"                      // code generation and debugging options
     66
    6467#define ERE_C
    6568#include "helpers\regexp.h"
     
    6770#define isword(c) (isalnum(c)||(c)=='_')
    6871
    69 static int val_of_hex(char c)
     72STATIC int val_of_hex(char c)
    7073{
    7174    if (c >= '0' && c <= '9')
     
    7881}
    7982
    80 static int escaped(const char *s)
     83STATIC int escaped(const char *s)
    8184{
    8285    if (s[0] == 'x' && isxdigit(s[1]))
     
    109112}
    110113
    111 static const char *past_escaped(const char *s)
     114STATIC const char *past_escaped(const char *s)
    112115{
    113116    if (s[0] == 'x' && isxdigit(s[1]))
     
    119122#define zero_cclass(cclass) memset(cclass, 0, 0x100 >> 3)
    120123
    121 static unsigned char bits[] =
     124STATIC unsigned char bits[] =
    122125{0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
    123126
     
    126129#define remove_from_cclass(n, cclass) (cclass[(unsigned char)(n)>>3] &= ~bits[(unsigned char)(n) & 7])
    127130
    128 static void invert_cclass(unsigned char *cclass)
     131STATIC void invert_cclass(unsigned char *cclass)
    129132{
    130133    int i;
     
    148151/* I use my own wrapper functions so I can take their addresses.
    149152 * Remember, isalnum etc. can be implemented as macros... */
    150 static BOOLEAN my_isalnum(int ch)
     153STATIC BOOLEAN my_isalnum(int ch)
    151154{
    152155    return isalnum(ch);
    153156}
    154 static BOOLEAN my_isalpha(int ch)
     157STATIC BOOLEAN my_isalpha(int ch)
    155158{
    156159    return isalpha(ch);
    157160}
    158 static BOOLEAN my_isblank(int ch)
     161STATIC BOOLEAN my_isblank(int ch)
    159162{
    160163    return ch == ' ' || ch == '\t';
    161164}
    162 static BOOLEAN my_iscntrl(int ch)
     165STATIC BOOLEAN my_iscntrl(int ch)
    163166{
    164167    return iscntrl(ch);
    165168}
    166 static BOOLEAN my_isdigit(int ch)
     169STATIC BOOLEAN my_isdigit(int ch)
    167170{
    168171    return isdigit(ch);
    169172}
    170 static BOOLEAN my_islower(int ch)
     173STATIC BOOLEAN my_islower(int ch)
    171174{
    172175    return islower(ch);
    173176}
    174 static BOOLEAN my_isprint(int ch)
     177STATIC BOOLEAN my_isprint(int ch)
    175178{
    176179    return isprint(ch);
    177180}
    178 static BOOLEAN my_ispunct(int ch)
     181STATIC BOOLEAN my_ispunct(int ch)
    179182{
    180183    return ispunct(ch);
    181184}
    182 static BOOLEAN my_isspace(int ch)
     185STATIC BOOLEAN my_isspace(int ch)
    183186{
    184187    return isspace(ch);
    185188}
    186 static BOOLEAN my_isupper(int ch)
     189STATIC BOOLEAN my_isupper(int ch)
    187190{
    188191    return isupper(ch);
    189192}
    190 static BOOLEAN my_isxdigit(int ch)
     193STATIC BOOLEAN my_isxdigit(int ch)
    191194{
    192195    return isxdigit(ch);
     
    201204POSIX_CCLASS;
    202205
    203 static POSIX_CCLASS posix_cclass[] =
     206STATIC POSIX_CCLASS posix_cclass[] =
    204207{
    205208    5, "alnum", my_isalnum,
     
    216219};
    217220
    218 static int find_posix(const char *str)
     221STATIC int find_posix(const char *str)
    219222{
    220223    int p;
     
    236239}
    237240
    238 static int cclass_thisch(const char *str)
     241STATIC int cclass_thisch(const char *str)
    239242{
    240243    switch (str[0])
     
    255258}
    256259
    257 static const char *cclass_nextch(const char *str)
     260STATIC const char *cclass_nextch(const char *str)
    258261{
    259262    int p;
     
    268271}
    269272
    270 static unsigned char *compile_cclass(const char *str,
     273STATIC unsigned char *compile_cclass(const char *str,
    271274                                     const char **str_after,
    272275                                     int erecf,
     
    424427};
    425428
    426 static MATCH null_match =
     429STATIC MATCH null_match =
    427430{MTYPE_NULL};
    428431
    429432#define NULL_MATCH (&null_match)
    430433
    431 static void delete_match(MATCH * match)
     434STATIC void delete_match(MATCH * match)
    432435{
    433436    if (match == NULL_MATCH)
     
    477480 */
    478481
    479 static unsigned shortest_match(const MATCH * match)
     482STATIC unsigned shortest_match(const MATCH * match)
    480483{
    481484    unsigned a, b;
     
    535538}
    536539
    537 static BOOLEAN got_backrefs(MATCH * match)
     540STATIC BOOLEAN got_backrefs(MATCH * match)
    538541{
    539542    switch (match->mtype)
     
    555558}
    556559
    557 static MATCH *remove_subs(MATCH * match)
     560STATIC MATCH *remove_subs(MATCH * match)
    558561{
    559562    switch (match->mtype)
     
    584587}
    585588
    586 static int count_sub(const MATCH * match)
     589STATIC int count_sub(const MATCH * match)
    587590{
    588591    switch (match->mtype)
     
    652655#define CH_BACK_END     (-2000+9)
    653656
    654 static int boring_string(const char *s)
     657STATIC int boring_string(const char *s)
    655658{
    656659    int n = 0;
     
    666669}
    667670
    668 static int thisch(const char *str)
     671STATIC int thisch(const char *str)
    669672{
    670673    int n;
     
    739742}
    740743
    741 static const char *nextch(const char *str)
     744STATIC const char *nextch(const char *str)
    742745{
    743746    int n;
     
    792795}
    793796
    794 static MATCH *compile_match(const char *str, const char **str_after, int erecf, int *rc);
    795 
    796 static const char *scan_number(const char *str, unsigned *num)
     797STATIC MATCH *compile_match(const char *str, const char **str_after, int erecf, int *rc);
     798
     799STATIC const char *scan_number(const char *str, unsigned *num)
    797800{
    798801    if (!isdigit(*str))
     
    805808}
    806809
    807 static MATCH *create_match(int *rc)
     810STATIC MATCH *create_match(int *rc)
    808811{
    809812    MATCH *match;
     
    817820}
    818821
    819 static MATCH *compile_term(const char *str, const char **str_after, int erecf, int *rc)
     822STATIC MATCH *compile_term(const char *str, const char **str_after, int erecf, int *rc)
    820823{
    821824    MATCH *match;
     
    995998}
    996999
    997 static MTYPE repeat_type_of(int c)
     1000STATIC MTYPE repeat_type_of(int c)
    9981001{
    9991002    switch (c)
     
    10121015}
    10131016
    1014 static MATCH *compile_factor(const char *str, const char **str_after, int erecf, int *rc)
     1017STATIC MATCH *compile_factor(const char *str, const char **str_after, int erecf, int *rc)
    10151018{
    10161019    MATCH *match, *parent;
     
    10841087}
    10851088
    1086 static MATCH *compile_factors(const char *str, const char **str_after, int erecf, int *rc)
     1089STATIC MATCH *compile_factors(const char *str, const char **str_after, int erecf, int *rc)
    10871090{
    10881091    MATCH *match;
     
    11201123
    11211124/*...scompile_match   \45\ factors\124\factors:0: */
    1122 static MATCH *compile_match(const char *str, const char **str_after, int erecf, int *rc)
     1125STATIC MATCH *compile_match(const char *str, const char **str_after, int erecf, int *rc)
    11231126{
    11241127    MATCH *match;
     
    11581161/*...sprint_tree:0: */
    11591162/*...sdo_indent:0: */
    1160 static void do_indent(int indent)
     1163STATIC void do_indent(int indent)
    11611164{
    11621165    while (indent--)
     
    11641167}
    11651168
    1166 static void print_tree(const MATCH * match, int indent)
     1169STATIC void print_tree(const MATCH * match, int indent)
    11671170{
    11681171    do_indent(indent);
     
    13271330
    13281331/*...screate_fsm:0: */
    1329 static FSM *create_fsm(int *rc)
     1332STATIC FSM *create_fsm(int *rc)
    13301333{
    13311334    FSM *fsm;
     
    13531356
    13541357/*...smalloc_state:0: */
    1355 static int malloc_state(FSM * fsm)
     1358STATIC int malloc_state(FSM * fsm)
    13561359{
    13571360    if (fsm->n_states == MAX_STATES)
     
    13651368 * Return TRUE if all went ok. */
    13661369
    1367 static BOOLEAN malloc_edge(int s, EDGE * edge, FSM * fsm)
     1370STATIC BOOLEAN malloc_edge(int s, EDGE * edge, FSM * fsm)
    13681371{
    13691372    int edge_no, n_edges = fsm->n_edges++;
     
    14311434/*...smake_fsm_from_match:0: */
    14321435/*...sadd_edge_to_fsm_character:0: */
    1433 static BOOLEAN add_edge_to_fsm_character(int s, int f, FSM * fsm, char character)
     1436STATIC BOOLEAN add_edge_to_fsm_character(int s, int f, FSM * fsm, char character)
    14341437{
    14351438    EDGE edge;
     
    14411444}
    14421445/*...sadd_edge_to_fsm_ncharacter:0: */
    1443 static BOOLEAN add_edge_to_fsm_ncharacter(int s, int f, FSM * fsm, char character)
     1446STATIC BOOLEAN add_edge_to_fsm_ncharacter(int s, int f, FSM * fsm, char character)
    14441447{
    14451448    EDGE edge;
     
    14511454}
    14521455/*...sadd_edge_to_fsm_string:0: */
    1453 static BOOLEAN add_edge_to_fsm_string(int s, int f, FSM * fsm, char *string)
     1456STATIC BOOLEAN add_edge_to_fsm_string(int s, int f, FSM * fsm, char *string)
    14541457{
    14551458    EDGE edge;
     
    14611464}
    14621465/*...sadd_edge_to_fsm_cclass:0: */
    1463 static BOOLEAN add_edge_to_fsm_cclass(int s, int f, FSM * fsm, unsigned char *cclass)
     1466STATIC BOOLEAN add_edge_to_fsm_cclass(int s, int f, FSM * fsm, unsigned char *cclass)
    14641467{
    14651468    EDGE edge;
     
    14711474}
    14721475/*...sadd_edge_to_fsm_dot:0: */
    1473 static BOOLEAN add_edge_to_fsm_dot(int s, int f, FSM * fsm)
     1476STATIC BOOLEAN add_edge_to_fsm_dot(int s, int f, FSM * fsm)
    14741477{
    14751478    EDGE edge;
     
    14801483}
    14811484/*...sadd_edge_to_fsm_word:0: */
    1482 static BOOLEAN add_edge_to_fsm_word(int s, int f, FSM * fsm)
     1485STATIC BOOLEAN add_edge_to_fsm_word(int s, int f, FSM * fsm)
    14831486{
    14841487    EDGE edge;
     
    14891492}
    14901493/*...sadd_edge_to_fsm_nword:0: */
    1491 static BOOLEAN add_edge_to_fsm_nword(int s, int f, FSM * fsm)
     1494STATIC BOOLEAN add_edge_to_fsm_nword(int s, int f, FSM * fsm)
    14921495{
    14931496    EDGE edge;
     
    14981501}
    14991502/*...sadd_edge_to_fsm_epsilon:0: */
    1500 static BOOLEAN add_edge_to_fsm_epsilon(int s, int f, FSM * fsm)
     1503STATIC BOOLEAN add_edge_to_fsm_epsilon(int s, int f, FSM * fsm)
    15011504{
    15021505    EDGE edge;
     
    15071510}
    15081511/*...sadd_edge_to_fsm_special:0: */
    1509 static BOOLEAN add_edge_to_fsm_special(int s, int f, FSM * fsm, ETYPE etype)
     1512STATIC BOOLEAN add_edge_to_fsm_special(int s, int f, FSM * fsm, ETYPE etype)
    15101513{
    15111514    EDGE edge;
     
    15171520}
    15181521/*...sadd_edge_to_fsm_back:0: */
    1519 static BOOLEAN add_edge_to_fsm_back(int s, int f, FSM * fsm, int n_span)
     1522STATIC BOOLEAN add_edge_to_fsm_back(int s, int f, FSM * fsm, int n_span)
    15201523{
    15211524    EDGE edge;
     
    15281531}
    15291532
    1530 static BOOLEAN make_fsm_from_match(MATCH * match, FSM * fsm, int *s, int *f)
     1533STATIC BOOLEAN make_fsm_from_match(MATCH * match, FSM * fsm, int *s, int *f)
    15311534{
    15321535    int n1, n2, n3, n4, i;
     
    18501853 * recursion on loops of epsilon moves. */
    18511854
    1852 static BOOLEAN is_finish_reachable(FSM * fsm, int state_no)
     1855STATIC BOOLEAN is_finish_reachable(FSM * fsm, int state_no)
    18531856{
    18541857    int edge_no;
     
    18801883
    18811884
    1882 static void finish_states(int f, FSM * fsm, FSM * fsm_without)
     1885STATIC void finish_states(int f, FSM * fsm, FSM * fsm_without)
    18831886{
    18841887    int state_no;
     
    18921895
    18931896/*...sdetermine_reachable:0: */
    1894 static void determine_reachable(int s, FSM * fsm, FSM * fsm_without)
     1897STATIC void determine_reachable(int s, FSM * fsm, FSM * fsm_without)
    18951898{
    18961899    int edge_no, to_state;
     
    19061909
    19071910/*...scopy_non_epsilons:0: */
    1908 static void copy_non_epsilons(FSM * fsm, FSM * fsm_without)
     1911STATIC void copy_non_epsilons(FSM * fsm, FSM * fsm_without)
    19091912{
    19101913    int state_no, edge_no;
     
    19301933 */
    19311934
    1932 static BOOLEAN copy_edges_reachable(
     1935STATIC BOOLEAN copy_edges_reachable(
    19331936                                       FSM * fsm,
    19341937                                       FSM * fsm_without,
     
    19691972
    19701973
    1971 static BOOLEAN follow_epsilons(FSM * fsm, FSM * fsm_without)
     1974STATIC BOOLEAN follow_epsilons(FSM * fsm, FSM * fsm_without)
    19721975{
    19731976    int state_no;
     
    19811984
    19821985
    1983 static BOOLEAN remove_epsilons(int s, int f, FSM * fsm, FSM * fsm_without)
     1986STATIC BOOLEAN remove_epsilons(int s, int f, FSM * fsm, FSM * fsm_without)
    19841987{
    19851988    // FSM with no epsilon moves will have the same number of states
     
    20562059#define NR
    20572060
    2058 static void NR walk_fsm(const char *str, int state_no, CONTEXT * cx);
    2059 
    2060 static void NR walk_fsm_gated(const char *str, CONTEXT * cx, EDGE * e)
     2061STATIC void NR walk_fsm(const char *str, int state_no, CONTEXT * cx);
     2062
     2063STATIC void NR walk_fsm_gated(const char *str, CONTEXT * cx, EDGE * e)
    20612064{
    20622065    if (e->gate != str)
     
    20712074}
    20722075
    2073 static void NR walk_fsm_ssub(const char *str, CONTEXT * cx, EDGE * e)
     2076STATIC void NR walk_fsm_ssub(const char *str, CONTEXT * cx, EDGE * e)
    20742077{
    20752078    SUBS subs;
     
    20852088}
    20862089
    2087 static void NR walk_fsm_esub(const char *str, CONTEXT * cx, EDGE * e)
     2090STATIC void NR walk_fsm_esub(const char *str, CONTEXT * cx, EDGE * e)
    20882091{
    20892092    SUBS *subs = cx->subs;
     
    21022105}
    21032106
    2104 static void NR walk_fsm(const char *str, int state_no, CONTEXT * cx)
     2107STATIC void NR walk_fsm(const char *str, int state_no, CONTEXT * cx)
    21052108{
    21062109    int edge_no;
     
    22412244}
    22422245
    2243 static const char *match_fsm(FSM * fsm,
     2246STATIC const char *match_fsm(FSM * fsm,
    22442247                             int eremf,
    22452248                             const char *str,
     
    22682271#ifdef DEBUG
    22692272/*...sprint_fsm:0: */
    2270 static void print_fsm(FSM * fsm, int s, BOOLEAN not_just_reachable)
     2273STATIC void print_fsm(FSM * fsm, int s, BOOLEAN not_just_reachable)
    22712274{
    22722275    int state_no, edge_no;
Note: See TracChangeset for help on using the changeset viewer.