CTWM
Loading...
Searching...
No Matches
/usr/src/RPM/BUILD/ctwm-4.1.0/parse.c File Reference
#include "ctwm.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "ctwm_atoms.h"
#include "screen.h"
#include "parse.h"
#include "parse_int.h"
#include "deftwmrc.h"
#include <ctype.h>
Include dependency graph for parse.c:

Go to the source code of this file.

Data Structures

struct  incl

Macros

#define BUF_LEN   300
#define TRY(fn)
#define MAX_INCLUDES   10

Functions

static bool ParseStringList (const char **sl)
int yyparse (void)
static int ParseTwmrc (const char *filename)
 Try parsing a file as a ctwmrc.
static bool doparse (int(*ifunc)(void), const char *srctypename, const char *srcname)
static int twmStringListInput (void)
static int twmFileInput (void)
bool LoadTwmrc (const char *filename)
 Principal entry point from top-level code to parse the config file.
void twmrc_error_prefix (void)

Variables

static FILE * twmrc
static int ptr = 0
static int len = 0
static char buff [300+1]
static const char ** stringListSource
static const char * currentString
int ConstrainedMoveTime = 400
bool ParseError
int RaiseDelay = 0
int(* twmInputFunc )(void)
static int twmrc_lineno
static struct incl rc_includes [10]
static int include_file = 0

Macro Definition Documentation

◆ BUF_LEN

#define BUF_LEN   300

Definition at line 76 of file parse.c.

Referenced by twmFileInput().

◆ MAX_INCLUDES

#define MAX_INCLUDES   10

Definition at line 350 of file parse.c.

Referenced by twmFileInput().

◆ TRY

#define TRY ( fn)
Value:
if((ret = ParseTwmrc(fn)) != -1) { goto DONE_TRYING; } (void)0
static int ParseTwmrc(const char *filename)
Try parsing a file as a ctwmrc.
Definition parse.c:239

Referenced by LoadTwmrc().

Function Documentation

◆ doparse()

bool doparse ( int(* ifunc )(void),
const char * srctypename,
const char * srcname )
static

Definition at line 313 of file parse.c.

References len, ParseError, ProgramName, ptr, twmInputFunc, twmrc_lineno, and yyparse().

Referenced by ParseStringList(), and ParseTwmrc().

◆ LoadTwmrc()

bool LoadTwmrc ( const char * filename)

Principal entry point from top-level code to parse the config file.

This tries the various permutations of config files we could load. For most possible names, we try loading $NAME.$SCREENNUM before trying $NAME. If a -f filename is given on the command line, it's passed in here, and the normal ~/.[c]twmrc* attempts are skipped if it's not found.

Parameters
filenameA filename given in the -f command-line argument (or NULL)
Returns
true/false for whether a valid config was parsed out from somewhere.

Definition at line 133 of file parse.c.

References defTwmrc, Home, ParseStringList(), ParseTwmrc(), ProgramName, Scr, and TRY.

Referenced by ctwm_main().

◆ ParseStringList()

bool ParseStringList ( const char ** sl)
static

Definition at line 285 of file parse.c.

References currentString, doparse(), stringListSource, and twmStringListInput().

Referenced by LoadTwmrc().

◆ ParseTwmrc()

int ParseTwmrc ( const char * filename)
static

Try parsing a file as a ctwmrc.

Parameters
filenameThe filename to try opening and parsing.
Returns
-1,0,1. 0/1 should be treated as false/true for whether parsing the file succeeded. -1 means the file couldn't be opened.

Definition at line 239 of file parse.c.

References CLarg, doparse(), start_m4(), twmFileInput(), and twmrc.

Referenced by LoadTwmrc().

◆ twmFileInput()

int twmFileInput ( void )
static

Definition at line 360 of file parse.c.

References BUF_LEN, buff, include_file, len, MAX_INCLUDES, ProgramName, ptr, rc_includes, twmrc, and twmrc_lineno.

Referenced by ParseTwmrc().

◆ twmrc_error_prefix()

◆ twmStringListInput()

int twmStringListInput ( void )
static

Definition at line 473 of file parse.c.

References currentString, and stringListSource.

Referenced by ParseStringList().

◆ yyparse()

int yyparse ( void )
extern

Referenced by doparse().

Variable Documentation

◆ buff

char buff[300+1]
static

Definition at line 77 of file parse.c.

Referenced by twmFileInput().

◆ ConstrainedMoveTime

int ConstrainedMoveTime = 400

Definition at line 92 of file parse.c.

Referenced by do_number_keyword(), f_raiseorsqueeze_impl(), and movewindow().

◆ currentString

const char * currentString
static

Definition at line 78 of file parse.c.

Referenced by ParseStringList(), and twmStringListInput().

◆ include_file

int include_file = 0
static

Definition at line 357 of file parse.c.

Referenced by twmFileInput().

◆ len

◆ ParseError

◆ ptr

int ptr = 0
static

Definition at line 74 of file parse.c.

Referenced by AddToList(), doparse(), GetColorFromList(), GetWindowConfig(), and twmFileInput().

◆ RaiseDelay

int RaiseDelay = 0

Definition at line 94 of file parse.c.

Referenced by do_number_keyword(), and HandleEnterNotify().

◆ rc_includes

struct incl rc_includes[ 10 ]
static

Referenced by twmFileInput().

◆ stringListSource

const char** stringListSource
static

Definition at line 78 of file parse.c.

Referenced by ParseStringList(), and twmStringListInput().

◆ twmInputFunc

int(* twmInputFunc) (void) ( void )

Definition at line 95 of file parse.c.

Referenced by doparse().

◆ twmrc

FILE* twmrc
static

Definition at line 72 of file parse.c.

Referenced by ParseTwmrc(), and twmFileInput().

◆ twmrc_lineno

int twmrc_lineno
static

Definition at line 97 of file parse.c.

Referenced by doparse(), twmFileInput(), and twmrc_error_prefix().