diff options
author | Roland Mainz <roland.mainz@nrubsig.org> | 2005-03-11 16:23:00 +0000 |
---|---|---|
committer | Roland Mainz <roland.mainz@nrubsig.org> | 2005-03-11 16:23:00 +0000 |
commit | 6e96bd376c916c150a055447d4badc1fae84e47a (patch) | |
tree | 6567fee1f286c12039ae40151ba7d615fb3345a2 /src/parse.c | |
parent | d045cb62c62f09978798510deaec0acae0a6fb4d (diff) |
xc/programs/twm/add_window.c
xc/programs/twm/cursor.c
xc/programs/twm/events.c
xc/programs/twm/gc.c
xc/programs/twm/gram.y
xc/programs/twm/iconmgr.c
xc/programs/twm/icons.c
xc/programs/twm/list.c
xc/programs/twm/menus.c
xc/programs/twm/parse.c
xc/programs/twm/resize.c
xc/programs/twm/twm.c
//bugs.freedesktop.org/show_bug.cgi?id=2566) attachment #2083
(https://bugs.freedesktop.org/attachment.cgi?id=2083) ANSI-fy twm
window manager code. The conversion preserves the comments which
annotate variables and function arguments (these have been moved into
doxygen(esque?) "stubs" above each function. Patch by Mike Owens
<etc@filespanker.com>.
Diffstat (limited to 'src/parse.c')
-rw-r--r-- | src/parse.c | 138 |
1 files changed, 45 insertions, 93 deletions
diff --git a/src/parse.c b/src/parse.c index 6e6915e..3f8d801 100644 --- a/src/parse.c +++ b/src/parse.c @@ -98,21 +98,11 @@ int ConstrainedMoveTime = 400; /* milliseconds, event times */ int (*twmInputFunc)(void); -/*********************************************************************** - * - * Procedure: - * ParseTwmrc - parse the .twmrc file - * - * Inputs: - * filename - the filename to parse. A NULL indicates $HOME/.twmrc - * - *********************************************************************** +/** + * parse the .twmrc file + * \param filename the filename to parse. NULL indicates $HOME/.twmrc */ - -static int doparse (ifunc, srctypename, srcname) - int (*ifunc)(void); - char *srctypename; - char *srcname; +static int doparse (int (*ifunc)(void), char *srctypename, char*srcname) { mods = 0; ptr = 0; @@ -168,8 +158,7 @@ static int doparse (ifunc, srctypename, srcname) } -int ParseTwmrc (filename) - char *filename; +int ParseTwmrc (char *filename) { int i; char *home = NULL; @@ -235,8 +224,7 @@ int ParseTwmrc (filename) } } -int ParseStringList (sl) - char **sl; +int ParseStringList (char **sl) { stringListSource = sl; currentString = *sl; @@ -244,17 +232,11 @@ int ParseStringList (sl) } -/*********************************************************************** +/** + * redefinition of the lex input routine for file input * - * Procedure: - * twmFileInput - redefinition of the lex input routine for file input - * - * Returned Value: - * the next input character - * - *********************************************************************** + * \return the next input character */ - static int twmFileInput() { if (overflowlen) return (int) overflowbuff[--overflowlen]; @@ -288,19 +270,12 @@ static int twmStringListInput() } -/*********************************************************************** - * - * Procedure: - * twmUnput - redefinition of the lex unput routine - * - * Inputs: - * c - the character to push back onto the input stream +/* + * redefinition of the lex unput routine * - *********************************************************************** + * \param c the character to push back onto the input stream */ - -void twmUnput (c) - int c; +void twmUnput (int c) { if (overflowlen < sizeof overflowbuff) { overflowbuff[overflowlen++] = (unsigned char) c; @@ -312,29 +287,21 @@ void twmUnput (c) } -/*********************************************************************** - * - * Procedure: - * TwmOutput - redefinition of the lex output routine - * - * Inputs: - * c - the character to print +/** + * redefinition of the lex output routine * - *********************************************************************** + * \param c the character to print */ void -TwmOutput(c) - int c; +TwmOutput(int c) { putchar(c); } /********************************************************************** - * * Parsing table and routines - * ***********************************************************************/ typedef struct _TwmKeyword { @@ -625,9 +592,7 @@ static TwmKeyword keytable[] = { static int numkeywords = (sizeof(keytable)/sizeof(keytable[0])); -int parse_keyword (s, nump) - char *s; - int *nump; +int parse_keyword (char *s, int *nump) { register int lower = 0, upper = numkeywords - 1; @@ -655,8 +620,7 @@ int parse_keyword (s, nump) * action routines called by grammar */ -int do_single_keyword (keyword) - int keyword; +int do_single_keyword (int keyword) { switch (keyword) { case kw0_NoDefaults: @@ -764,9 +728,7 @@ int do_single_keyword (keyword) } -int do_string_keyword (keyword, s) - int keyword; - char *s; +int do_string_keyword (int keyword, char *s) { switch (keyword) { case kws_UsePPosition: @@ -832,9 +794,7 @@ int do_string_keyword (keyword, s) } -int do_number_keyword (keyword, num) - int keyword; - int num; +int do_number_keyword (int keyword, int num) { switch (keyword) { case kwn_ConstrainedMoveTime: @@ -885,10 +845,7 @@ int do_number_keyword (keyword, num) return 0; } -name_list **do_colorlist_keyword (keyword, colormode, s) - int keyword; - int colormode; - char *s; +name_list **do_colorlist_keyword (int keyword, int colormode, char *s) { switch (keyword) { case kwcl_BorderColor: @@ -938,10 +895,7 @@ name_list **do_colorlist_keyword (keyword, colormode, s) return NULL; } -int do_color_keyword (keyword, colormode, s) - int keyword; - int colormode; - char *s; +int do_color_keyword (int keyword, int colormode, char *s) { switch (keyword) { case kwc_DefaultForeground: @@ -988,12 +942,11 @@ int do_color_keyword (keyword, colormode, s) return 0; } -/* - * put_pixel_on_root() Save a pixel value in twm root window color property. +/** + * Save a pixel value in twm root window color property. */ void -put_pixel_on_root(pixel) - Pixel pixel; +put_pixel_on_root(Pixel pixel) { int i, addPixel = 1; Atom pixelAtom, retAtom; @@ -1015,28 +968,25 @@ put_pixel_on_root(pixel) (unsigned char *)&pixel, 1); } -/* - * do_string_savecolor() save a color from a string in the twmrc file. +/** + * save a color from a string in the twmrc file. */ void -do_string_savecolor(colormode, s) - int colormode; - char *s; +do_string_savecolor(int colormode, char *s) { Pixel p; GetColor(colormode, &p, s); put_pixel_on_root(p); } -/* - * do_var_savecolor() save a color from a var in the twmrc file. - */ typedef struct _cnode {int i; struct _cnode *next;} Cnode, *Cptr; Cptr chead = NULL; +/** + * save a color from a var in the twmrc file + */ void -do_var_savecolor(key) -int key; +do_var_savecolor(int key) { Cptr cptrav, cpnew; if (!chead) { @@ -1051,8 +1001,8 @@ int key; } } -/* - * assign_var_savecolor() traverse the var save color list placeing the pixels +/** + * traverse the var save color list placeing the pixels * in the root window property. */ void @@ -1104,8 +1054,7 @@ assign_var_savecolor() } static int -ParseUsePPosition (s) - register char *s; +ParseUsePPosition (char *s) { XmuCopyISOLatin1Lowered (s, s); @@ -1122,13 +1071,16 @@ ParseUsePPosition (s) } +/** + * + * \param list squeeze or dont-squeeze list + * \param name window name + * \param justify left, center, or right + * \param num signed num + * \param denom 0 or indicates fraction denom + */ void -do_squeeze_entry (list, name, justify, num, denom) - name_list **list; /* squeeze or dont-squeeze list */ - char *name; /* window name */ - int justify; /* left, center, right */ - int num; /* signed num */ - int denom; /* 0 or indicates fraction denom */ +do_squeeze_entry (name_list **list, char *name, int justify, int num, int denom) { int absnum = (num < 0 ? -num : num); |