JWM Source Documentation
Functions
misc.c File Reference

Miscellaneous functions and macros. More...

#include "jwm.h"
#include "misc.h"
#include "debug.h"

Go to the source code of this file.

Functions

static char ToLower (char ch)
 Convert to lower case.
 
static char IsSymbolic (char ch)
 Determine if a character is a valid for a shell variable.
 
static char * GetSymbolName (const char *str)
 Get the name of a shell variable (returns a copy).
 
static void ReplaceSymbol (char **str, unsigned int offset, const char *name, const char *value)
 Replace "name" with "value" at offset in str (reallocates if needed).
 
char IsSpace (char ch, unsigned int *lineNumber)
 Determine if a character is a space character.
 
void ExpandPath (char **path)
 Perform shell-like macro path expansion.
 
void Trim (char *str)
 Trim leading and trailing whitespace from a string.
 
char * CopyString (const char *str)
 Copy a string.
 
float ParseFloat (const char *str)
 Parse a float.
 
int FindValue (const StringMappingType *mapping, int count, const char *key)
 Find a value in a string mapping.
 
const char * FindKey (const StringMappingType *mapping, int count, int value)
 Find a key in a string mapping.
 
int StrCmpNoCase (const char *a, const char *b)
 Case insensitive string compare.
 

Detailed Description

Miscellaneous functions and macros.

Author
Joe Wingbermuehle
Date
2004-2006

Definition in file misc.c.

Function Documentation

char* CopyString ( const char *  str)
void ExpandPath ( char **  path)

Perform shell-like macro path expansion.

Definition at line 151 of file misc.c.

References Assert, GetSymbolName(), Release, ReplaceSymbol(), and ScreenType::x.

Referenced by AddIconPath(), LoadImageBackground(), SetPathString(), TokenizeFile(), and TokenizePipe().

const char* FindKey ( const StringMappingType mapping,
int  count,
int  value 
)

Find a key in a string mapping.

Definition at line 264 of file misc.c.

References StringMappingType::key, and ScreenType::x.

Referenced by GetTokenTypeName().

int FindValue ( const StringMappingType mapping,
int  count,
const char *  key 
)
char * GetSymbolName ( const char *  str)
static

Get the name of a shell variable (returns a copy).

Definition at line 75 of file misc.c.

References Allocate, and IsSymbolic().

Referenced by ExpandPath().

char IsSpace ( char  ch,
unsigned int *  lineNumber 
)

Determine if a character is a space character.

Definition at line 21 of file misc.c.

Referenced by GetRootMenuIndexFromString(), Tokenize(), and Trim().

char IsSymbolic ( char  ch)
static

Determine if a character is a valid for a shell variable.

Definition at line 50 of file misc.c.

Referenced by GetSymbolName().

float ParseFloat ( const char *  str)

Parse a float.

Read a float in a locale-independent way.

Definition at line 229 of file misc.c.

Referenced by ParseOpacity().

void ReplaceSymbol ( char **  str,
unsigned int  offset,
const char *  name,
const char *  value 
)
static

Replace "name" with "value" at offset in str (reallocates if needed).

Definition at line 97 of file misc.c.

References Allocate, Assert, and Release.

Referenced by ExpandPath().

int StrCmpNoCase ( const char *  a,
const char *  b 
)

Case insensitive string compare.

Definition at line 276 of file misc.c.

References ToLower().

Referenced by LoadImage().

char ToLower ( char  ch)
static

Convert to lower case.

Definition at line 37 of file misc.c.

Referenced by StrCmpNoCase().

void Trim ( char *  str)

Trim leading and trailing whitespace from a string.

Definition at line 177 of file misc.c.

References Assert, IsSpace(), and ScreenType::x.

Referenced by AddIconPath(), and ReadValue().

joewing.net / Projects / JWM