Aegis  4.25.D505
/home/archives/aegis/branch.4/branch.25/delta28933.505/common/arglex.h
Go to the documentation of this file.
00001 //
00002 // aegis - project change supervisor
00003 // Copyright (C) 1991-1995, 1999, 2001-2006, 2008, 2009, 2012 Peter Miller
00004 //
00005 // This program is free software; you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation; either version 3 of the License, or (at
00008 // your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program. If not, see <http://www.gnu.org/licenses/>.
00017 //
00018 
00019 #ifndef ARGLEX_H
00020 #define ARGLEX_H
00021 
00028 #define ARGLEX_END_MARKER { (const char *)0, 0, }
00029 
00030 enum
00031 {
00032     ARGLEX_PREFETCH_FAIL = -99,
00033     arglex_token_eoln = -20,
00034     arglex_token_help,
00035     arglex_token_number,
00036     arglex_token_number_incomplete,
00037     arglex_token_option,
00038     arglex_token_option_incomplete,
00039     arglex_token_page_length,
00040     arglex_token_page_width,
00041     arglex_token_stdio,
00042     arglex_token_string,
00043     arglex_token_string_incomplete,
00044     arglex_token_trace,
00045     arglex_token_version
00046 };
00047 
00048 struct arglex_table_ty
00049 {
00050     const char      *t_name;
00051     int             t_token;
00052 };
00053 
00054 struct arglex_value_ty
00055 {
00056     const char      *alv_string;
00057     long            alv_number;
00058 };
00059 
00060 extern int      arglex_token;
00061 extern arglex_value_ty arglex_value;
00062 
00063 void arglex_init(int, char **, arglex_table_ty *);
00064 int arglex(void);
00065 int arglex_prefetch(int *, int);
00066 
00109 bool arglex_compare(const char *formal, const char *actual,
00110     const char **partial);
00111 
00112 const char *arglex_token_name(int);
00113 
00114 arglex_table_ty *arglex_table_catenate(arglex_table_ty *, arglex_table_ty *);
00115 
00116 
00117 struct arglex_dispatch_ty
00118 {
00119     int             token;
00120     void            (*func)(void);
00121     int             priority;
00122 };
00123 
00124 
00141 void arglex_dispatch(const arglex_dispatch_ty *table, unsigned table_size,
00142     void (*otherwise)(void));
00143 
00144 void arglex_synthetic(int, char **, int);
00145 void arglex_retable(arglex_table_ty *);
00146 int arglex_get_string(void);
00147 
00149 #endif // ARGLEX_H
00150 // vim: set ts=8 sw=4 et :