-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Over the years, fvwm has grown and its syntax/means of parsing those config lines has also gotten more confusing. To eventually address a change of syntax, this change lays the groundwork for that work. This change also has the consequence that the Repeat command has been removed. Fixes #642
- Loading branch information
1 parent
b6aa369
commit 228b74a
Showing
40 changed files
with
1,596 additions
and
947 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* -*-c-*- */ | ||
|
||
#ifndef FVWM_CMDPARSER_H | ||
#define FVWM_CMDPARSER_H | ||
|
||
/* ---------------------------- included header files ---------------------- */ | ||
|
||
/* ---------------------------- global definitions ------------------------- */ | ||
|
||
/* $0 through to $9 */ | ||
#define CMDPARSER_NUM_POS_ARGS 10 | ||
|
||
/* ---------------------------- global macros ------------------------------ */ | ||
|
||
/* ---------------------------- type definitions --------------------------- */ | ||
|
||
/* Enum for all the possible prefixes. */ | ||
typedef enum | ||
{ | ||
CP_PREFIX_NONE = 0, | ||
CP_PREFIX_MINUS = 0x1, | ||
CP_PREFIX_SILENT = 0x2, | ||
CP_PREFIX_KEEPRC = 0x4 | ||
} cmdparser_prefix_flags_t; | ||
|
||
/* Enum for types of things to execute. */ | ||
typedef enum | ||
{ | ||
CP_EXECTYPE_UNKNOWN = 0, | ||
CP_EXECTYPE_BUILTIN_FUNCTION, | ||
CP_EXECTYPE_COMPLEX_FUNCTION, | ||
CP_EXECTYPE_COMPLEX_FUNCTION_DOES_NOT_EXIST, | ||
CP_EXECTYPE_MODULECONFIG | ||
} cmdparser_execute_type_t; | ||
|
||
/* move this to the implementation file and use void* instead??? */ | ||
|
||
typedef struct | ||
{ | ||
/* !!!note: need to define which bits in here may be accessed by the | ||
* user and which are internal */ | ||
unsigned char is_created : 1; | ||
/* the original command line */ | ||
char *line; | ||
/* the current command line */ | ||
char *cline; | ||
/* the expanded command line */ | ||
char *expline; | ||
unsigned char do_free_expline : 1; | ||
/* the command name */ | ||
char *command; | ||
/* name of the complex function if present */ | ||
char *complex_function_name; | ||
/* current function nesting depth */ | ||
int call_depth; | ||
/* A string with all positional arguments of a complex function. May | ||
* be NULL if not in the context of a complex function. */ | ||
char *all_pos_args_string; | ||
/* An array of the first CMDPARSER_NUM_POS_ARGS positional arguments up | ||
* to and excluding the first NULL pointer. Must (not) all be NULL if | ||
* all_pos_args_string is (not) NULL. */ | ||
char *pos_arg_tokens[CMDPARSER_NUM_POS_ARGS]; | ||
} cmdparser_context_t; | ||
|
||
#endif /* FVWM_CMDPARSER_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* -*-c-*- */ | ||
|
||
#ifndef FVWM_CMDPARSER_HOOKS_H | ||
#define FVWM_CMDPARSER_HOOKS_H | ||
|
||
/* ---------------------------- included header files ---------------------- */ | ||
|
||
/* ---------------------------- global definitions ------------------------- */ | ||
|
||
/* ---------------------------- global macros ------------------------------ */ | ||
|
||
/* ---------------------------- type definitions --------------------------- */ | ||
|
||
typedef struct | ||
{ | ||
/* in general, functions in this structure that return int return | ||
* 0: success | ||
* > 0: unsuccessful but not an error condition | ||
* < 0: unsuccessful, error | ||
*/ | ||
int (*create_context)( | ||
/* context structure to initialise */ | ||
cmdparser_context_t *dest_context, | ||
/* context structure of the caller or NULL */ | ||
cmdparser_context_t *caller_context, | ||
/* input command line */ | ||
char *line, | ||
/* A string with all positional arguments of a complex | ||
* function. May be NULL if not in the context of a complex | ||
* function. */ | ||
char *all_pos_args_string, | ||
/* An array of the first CMDPARSER_NUM_POS_ARGS positional | ||
* arguments up to and excluding the first NULL pointer. Must | ||
* (not) all be NULL if all_pos_args_string is (not) NULL. */ | ||
char *pos_arg_tokens[] | ||
); | ||
int (*handle_line_start)(cmdparser_context_t *context); | ||
/* Returns a set of or'ed flags of which prefixes are present on the | ||
* command line. The prefixes are stripped. */ | ||
cmdparser_prefix_flags_t (*handle_line_prefix)( | ||
cmdparser_context_t *context); | ||
/* parses and returns the command name or returns a NULL pointer if not | ||
* possible */ | ||
const char *(*parse_command_name)( | ||
cmdparser_context_t *context, void *func_rc, const void *exc); | ||
/* returns 1 if the stored command is a module configuration command | ||
* and 0 otherwise */ | ||
int (*is_module_config)(cmdparser_context_t *context); | ||
/* expands the command line */ | ||
void (*expand_command_line)( | ||
cmdparser_context_t *context, int is_addto, void *func_rc, | ||
const void *exc); | ||
/* Release the expline field from the context structure and return it. | ||
* It is then the responsibility of the caller to free() it. */ | ||
void (*release_expanded_line)(cmdparser_context_t *context); | ||
/* Tries to find a builtin function, a complex function or a module | ||
* config line to execute and returns the type found or | ||
* CP_EXECTYPE_UNKNOWN if none of the above were identified. For a | ||
* builtin or a complex function, the pointer to the description is | ||
* returned in *ret_builtin or *ret_complex_function. Consumes the | ||
* the "Module" or the "Function" command from the input. Does not | ||
* consider builtin functions if *ret_builtin is != NULL when the | ||
* function is called. */ | ||
cmdparser_execute_type_t (*find_something_to_execute)( | ||
cmdparser_context_t *context, | ||
const func_t **ret_builtin, | ||
FvwmFunction **ret_complex_function); | ||
/* Release the context initialised with create_context(). */ | ||
void (*destroy_context)(cmdparser_context_t *context); | ||
/* Print the contents of the context. */ | ||
void (*debug)(cmdparser_context_t *context, const char *msg); | ||
} cmdparser_hooks_t; | ||
|
||
#endif /* FVWM_CMDPARSER_HOOKS_H */ |
Oops, something went wrong.