NEWS/Changelog for previous commit.
[fvwm.git] / libs / Parse.h
blobc6b4d96e4c2cc94aa50265fd1fa7a93308bfa2a6
1 /* -*-c-*- */
3 #ifndef FVWMLIB_PARSE_H
4 #define FVWMLIB_PARSE_H
6 /* ---------------------------- included header files ---------------------- */
8 #include "libs/Strings.h"
10 /* ---------------------------- global definitions ------------------------- */
12 #define MAX_TOKEN_LENGTH 1023
14 /* ---------------------------- global macros ------------------------------ */
17 * Stuff for consistent parsing
19 #define IsQuote(c) ((c) == '"' || (c) == '\'' || (c) =='`')
20 #define IsBlockStart(c) ((c) == '[' || (c) == '{' || (c) == '(')
21 #define IsBlockEnd(c,cs) (((c) == ']' && (cs) == '[') || ((c) == '}' && (cs) == '{') || ((c) == ')' && (cs) == '('))
24 * function: FindToken
25 * description: find the entry of type 'struct_entry'
26 * holding 'key' in 'table'
27 * returns: pointer to the matching entry
28 * NULL if not found
30 * table must be sorted in ascending order for FindToken.
32 #define FindToken(key,table,struct_entry) \
33 (struct_entry *) bsearch( \
34 key, \
35 (char *)(table), \
36 sizeof(table) / sizeof(struct_entry), \
37 sizeof(struct_entry), \
38 (int(*)(const void*, const void*))XCmpToken)
40 /* ---------------------------- type definitions --------------------------- */
42 /* ---------------------------- exported variables (globals) --------------- */
44 /* ---------------------------- interface functions ------------------------ */
46 char *EscapeString(char *s, const char *qchars, char echar);
47 char *SkipQuote(
48 char *s, const char *qlong, const char *qstart, const char *qend);
49 char *GetQuotedString(
50 char *sin, char **sout, const char *delims, const char *qlong,
51 const char *qstart, const char *qend);
52 char *SkipSpaces(char *indata, char *spaces, int snum);
53 char *DoPeekToken(
54 char *indata, char **token, char *spaces, char *delims,
55 char *out_delim);
56 char *PeekToken(char *indata, char **token);
57 int MatchToken(char *pstr,char *tok);
59 /* old style parse routine: */
60 char *DoGetNextToken(
61 char *indata,char **token, char *spaces, char *delims,
62 char *out_delim);
63 char *GetNextToken(char *indata,char **token);
64 char *GetNextSimpleOption(char *indata, char **option);
65 char *GetNextFullOption(char *indata, char **option);
66 char *SkipNTokens(char *indata, unsigned int n);
67 char *GetModuleResource(char *indata, char **resource, char *module_name);
68 int GetSuffixedIntegerArguments(
69 char *action, char **ret_action, int *retvals, int num,
70 char *suffixlist, int *ret_suffixnum);
71 int GetIntegerArgumentsAnyBase(
72 char *action, char **ret_action, int *retvals,int num);
73 int SuffixToPercentValue(int value, int suffix, int *unit_table);
74 int GetIntegerArguments(char *action, char**ret_action, int *retvals,int num);
75 int GetTokenIndex(char *token, char **list, int len, char **next);
76 char *GetNextTokenIndex(char *action, char **list, int len, int *index);
77 int GetRectangleArguments(char *action, int *width, int *height);
78 int GetOnePercentArgument(char *action, int *value, int *unit_io);
79 int GetTwoPercentArguments(
80 char *action, int *val1, int *val2, int *val1_unit, int *val2_unit);
81 int ParseToggleArgument(
82 char *action, char **ret_action, int default_ret, char no_toggle);
83 int XCmpToken(const char *s, const char **t);
84 char *GetFileNameFromPath(char *path);
86 #endif