w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Utility.h File Reference
#include "ChkTeX.h"
#include "OpSys.h"
Include dependency graph for Utility.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  HashEntry
 
struct  Hash
 
struct  Stack
 
struct  WordList
 
struct  FileNode
 

Macros

#define MINPUDDLE   256
 
#define WALLBYTES   4
 
#define FORWL(ind, list)   for(ind = 0; ind < (list).Stack.Used; ind++)
 
#define WORDLIST_DEFINED
 
#define ROTATEL(x, n)   ((x<<n) | (x>>((CHAR_BIT*sizeof(x)) - n)))
 
#define ROTATER(x, n)   ((x>>n) | (x<<((CHAR_BIT*sizeof(x)) - n)))
 
#define STRLEN(x)   (sizeof(x)/sizeof(x[0]) - 1)
 
#define strlwr   mystrlwr
 
#define strdup   mystrdup
 

Enumerations

enum  Strip { STRP_LFT = 0x01 , STRP_RGT = 0x02 , STRP_BTH = 0x03 }
 

Functions

int fexists (const char *Filename)
 
voidsfmemset (void *to, int c, long n)
 
voidsaferealloc (void *old, size_t newsize)
 
int strafter (const char *Str, const char *Cmp)
 
void strrep (char *String, const char From, const char To)
 
void strxrep (char *Buf, const char *Prot, const char To)
 
char * strip (char *String, const enum Strip What)
 
void strwrite (char *To, const char *From, unsigned long Len)
 
int strinfront (const char *Str, const char *Cmp)
 
char * strdupx (const char *String, int Extra)
 
void strmove (char *a, const char *b)
 
void ClearHash (struct Hash *h)
 
void InsertHash (char *a, struct Hash *h)
 
char * HasHash (const char *a, const struct Hash *h)
 
int InsertWord (const char *Word, struct WordList *WL)
 
char * HasWord (const char *Word, struct WordList *WL)
 
void MakeLower (struct WordList *wl)
 
void ListRep (struct WordList *wl, const char From, const char To)
 
void ClearWord (struct WordList *WL)
 
int StkPush (void *Data, struct Stack *Stack)
 
voidStkPop (struct Stack *Stack)
 
voidStkTop (struct Stack *Stack)
 
FILECurStkFile (struct Stack *stack)
 
const char * CurStkName (struct Stack *stack)
 
unsigned long CurStkLine (struct Stack *stack)
 
char * FGetsStk (char *Dest, unsigned long len, struct Stack *stack)
 
int PushFileName (const char *Name, struct Stack *stack)
 
int PushFile (const char *, FILE *, struct Stack *)
 
void FreeErrInfo (struct ErrInfo *ei)
 
struct ErrInfoPushChar (const char c, const unsigned long Line, const unsigned long Column, struct Stack *Stk, const char *LineCpy)
 
struct ErrInfoPushErr (const char *Data, const unsigned long Line, const unsigned long Column, const unsigned long ErrLen, const char *LineCpy, struct Stack *Stk)
 
struct ErrInfoTopChar (struct Stack *Stack)
 
struct ErrInfoTopErr (struct Stack *Stack)
 
struct ErrInfoPopErr (struct Stack *Stack)
 
struct ErrInfoTopMatch (struct Stack *Stack, char *String)
 
long BrackIndex (const char c)
 
void AddBracket (const char c)
 
char MatchBracket (const char c)
 
short substring (const char *source, char *dest, unsigned long pos, long len)
 
char * mystrlwr (char *String)
 
char * mystrdup (const char *String)
 
int strcasecmp (char *a, char *b)
 
static char * stpcpy (char *dest, const char *src)
 

Macro Definition Documentation

◆ FORWL

#define FORWL (   ind,
  list 
)    for(ind = 0; ind < (list).Stack.Used; ind++)

Definition at line 49 of file Utility.h.

◆ MINPUDDLE

#define MINPUDDLE   256

Definition at line 38 of file Utility.h.

◆ ROTATEL

#define ROTATEL (   x,
  n 
)    ((x<<n) | (x>>((CHAR_BIT*sizeof(x)) - n)))

Definition at line 93 of file Utility.h.

◆ ROTATER

#define ROTATER (   x,
  n 
)    ((x>>n) | (x<<((CHAR_BIT*sizeof(x)) - n)))

Definition at line 96 of file Utility.h.

◆ strdup

#define strdup   mystrdup

Definition at line 167 of file Utility.h.

◆ STRLEN

#define STRLEN (   x)    (sizeof(x)/sizeof(x[0]) - 1)

Definition at line 102 of file Utility.h.

◆ strlwr

#define strlwr   mystrlwr

Definition at line 162 of file Utility.h.

◆ WALLBYTES

#define WALLBYTES   4

Definition at line 43 of file Utility.h.

◆ WORDLIST_DEFINED

#define WORDLIST_DEFINED

Definition at line 83 of file Utility.h.

Enumeration Type Documentation

◆ Strip

enum Strip
Enumerator
STRP_LFT 
STRP_RGT 
STRP_BTH 

Definition at line 52 of file Utility.h.

Function Documentation

◆ AddBracket()

void AddBracket ( const char  c)

Definition at line 969 of file Utility.c.

References Brackets, BrackIndex(), and c.

Referenced by HandleBracket().

◆ BrackIndex()

long BrackIndex ( const char  c)

Definition at line 943 of file Utility.c.

References c, and L.

Referenced by AddBracket(), HandleBracket(), and MatchBracket().

◆ ClearHash()

void ClearHash ( struct Hash h)

Definition at line 469 of file Utility.c.

References free, h, HASH_SIZE, i, memset(), HashEntry::Next, and next.

Referenced by ClearWord(), and ReHash().

◆ ClearWord()

void ClearWord ( struct WordList WL)

◆ CurStkFile()

FILE* CurStkFile ( struct Stack stack)

Definition at line 787 of file Utility.c.

References fc-lang::fn, NULL, and StkTop().

Referenced by main().

◆ CurStkLine()

unsigned long CurStkLine ( struct Stack stack)

Definition at line 797 of file Utility.c.

References fc-lang::fn, L, and StkTop().

Referenced by main().

◆ CurStkName()

const char* CurStkName ( struct Stack stack)

Definition at line 764 of file Utility.c.

References fc-lang::fn, PseudoInName, StkTop(), strdup, and strlen().

Referenced by FindErr(), HandleBracket(), PerformBigCmd(), PrintStatus(), and PushErr().

◆ fexists()

int fexists ( const char *  Filename)

Definition at line 80 of file Utility.c.

References access, F_OK, FALSE, fclose, FILE, fopen, R_OK, and TRUE.

Referenced by HasFile(), OpenOut(), and SetupVars().

◆ FGetsStk()

char* FGetsStk ( char *  Dest,
unsigned long  len,
struct Stack stack 
)

Definition at line 725 of file Utility.c.

References fclose, fgets, fc-lang::fn, free, len, NULL, pmLongLines, PrintPrgErr(), StkPop(), StkTop(), and strlen().

Referenced by main().

◆ FreeErrInfo()

void FreeErrInfo ( struct ErrInfo ei)

Definition at line 920 of file Utility.c.

References ErrInfo::Data, ErrInfo::File, free, and ErrInfo::LineBuf.

Referenced by HandleBracket(), PerformBigCmd(), and PrintStatus().

◆ HasHash()

char* HasHash ( const char *  a,
const struct Hash h 
)

Definition at line 440 of file Utility.c.

References a, h, HASH_SIZE, HashWord(), i, HashEntry::Next, NULL, HashEntry::Str, and strcmp().

Referenced by HasWord().

◆ HasWord()

char* HasWord ( const char *  Word,
struct WordList WL 
)

◆ InsertHash()

void InsertHash ( char *  a,
struct Hash h 
)

Definition at line 413 of file Utility.c.

References a, calloc(), h, HASH_SIZE, HashWord(), malloc, HashEntry::Next, pmWordListErr, PrintPrgErr(), and HashEntry::Str.

Referenced by InsertWord(), and ReHash().

◆ InsertWord()

int InsertWord ( const char *  Word,
struct WordList WL 
)

◆ ListRep()

void ListRep ( struct WordList wl,
const char  From,
const char  To 
)

Definition at line 585 of file Utility.c.

References Stack::Data, FORWL, i, ReHash(), WordList::Stack, and strrep().

Referenced by SetupLists().

◆ MakeLower()

void MakeLower ( struct WordList wl)

Definition at line 574 of file Utility.c.

References Stack::Data, FORWL, i, ReHash(), WordList::Stack, and strlwr.

Referenced by SetupLists().

◆ MatchBracket()

char MatchBracket ( const char  c)

Definition at line 983 of file Utility.c.

References BrackIndex(), BrOrder, and c.

Referenced by HandleBracket().

◆ mystrdup()

char* mystrdup ( const char *  String)

Definition at line 240 of file Utility.c.

References Len, malloc, memcpy, NULL, and strlen().

◆ mystrlwr()

char* mystrlwr ( char *  String)

Definition at line 223 of file Utility.c.

References Bufptr, and tolower.

◆ PopErr()

struct ErrInfo* PopErr ( struct Stack Stack)

Definition at line 901 of file Utility.c.

References StkPop().

Referenced by HandleBracket(), PerformBigCmd(), and PrintStatus().

◆ PushChar()

struct ErrInfo* PushChar ( const char  c,
const unsigned long  Line,
const unsigned long  Column,
struct Stack Stk,
const char *  LineCpy 
)

Definition at line 816 of file Utility.c.

References Buf, c, ErrInfo::Column, and PushErr().

Referenced by HandleBracket().

◆ PushErr()

struct ErrInfo* PushErr ( const char *  Data,
const unsigned long  Line,
const unsigned long  Column,
const unsigned long  ErrLen,
const char *  LineCpy,
struct Stack Stk 
)

◆ PushFile()

int PushFile ( const char *  Name,
FILE fh,
struct Stack stack 
)

Definition at line 701 of file Utility.c.

References FALSE, FileNode::fh, fc-lang::fn, free, L, malloc, pmNoStackMem, PrintPrgErr(), StkPush(), strdup, and TRUE.

Referenced by main(), and PushFileName().

◆ PushFileName()

int PushFileName ( const char *  Name,
struct Stack stack 
)

Definition at line 681 of file Utility.c.

References BUFSIZ, FALSE, FILE, fopen, LocateFile(), NULL, pmNoTeXOpen, PrintPrgErr(), PushFile(), and TeXInputs.

Referenced by main().

◆ saferealloc()

void* saferealloc ( void old,
size_t  newsize 
)

Definition at line 301 of file Utility.c.

References b, free, malloc, n, NULL, and realloc.

Referenced by StkPop(), and StkPush().

◆ sfmemset()

void* sfmemset ( void to,
int  c,
long  n 
)

Definition at line 114 of file Utility.c.

References BUFSIZ, c, memset(), min, n, NULL, and to.

Referenced by PerformCommand().

◆ StkPop()

void* StkPop ( struct Stack Stack)

Definition at line 634 of file Utility.c.

References Stack::Data, max, MINPUDDLE, NULL, saferealloc(), Stack::Size, and Stack::Used.

Referenced by ClearWord(), FGetsStk(), and PopErr().

◆ StkPush()

int StkPush ( void Data,
struct Stack Stack 
)

Definition at line 601 of file Utility.c.

References Stack::Data, FALSE, MINPUDDLE, saferealloc(), Stack::Size, TRUE, and Stack::Used.

Referenced by InsertWord(), PushErr(), and PushFile().

◆ StkTop()

void* StkTop ( struct Stack Stack)

Definition at line 671 of file Utility.c.

References Stack::Data, NULL, and Stack::Used.

Referenced by CurStkFile(), CurStkLine(), CurStkName(), FGetsStk(), main(), and TopErr().

◆ stpcpy()

static char* stpcpy ( char *  dest,
const char *  src 
)
inlinestatic

Definition at line 177 of file Utility.h.

References dest, link_confs::src, strcpy(), and strlen().

Referenced by CheckSilentRegex(), and concatenated_filename().

◆ strafter()

int strafter ( const char *  Str,
const char *  Cmp 
)

Definition at line 355 of file Utility.c.

References strlen(), and strncmp().

Referenced by FindErr().

◆ strcasecmp()

int strcasecmp ( char *  a,
char *  b 
)

◆ strdupx()

char* strdupx ( const char *  String,
int  Extra 
)

Definition at line 260 of file Utility.c.

References Len, malloc, NULL, strlen(), and strncpy().

Referenced by InsertWord().

◆ strinfront()

int strinfront ( const char *  Str,
const char *  Cmp 
)

Definition at line 365 of file Utility.c.

References strlen().

Referenced by FindErr().

◆ strip()

◆ strmove()

void strmove ( char *  a,
const char *  b 
)

◆ strrep()

void strrep ( char *  String,
const char  From,
const char  To 
)

Definition at line 131 of file Utility.c.

References c.

Referenced by ListRep(), and main().

◆ strwrite()

void strwrite ( char *  To,
const char *  From,
unsigned long  Len 
)

Definition at line 323 of file Utility.c.

References BUFSIZ, i, j, Len, memset(), min, and strlen().

Referenced by FindErr(), PerformBigCmd(), and WipeArgument().

◆ strxrep()

void strxrep ( char *  Buf,
const char *  Prot,
const char  To 
)

Definition at line 147 of file Utility.c.

References Buf, c, and strchr.

Referenced by WipeArgument().

◆ substring()

short substring ( const char *  source,
char *  dest,
unsigned long  pos,
long  len 
)

Definition at line 47 of file Utility.c.

References dest, L, len, pos, and strlen().

Referenced by PerformCommand(), sarrayCreateLinesFromString(), u_strrstr_68(), and u_strstr_68().

◆ TopChar()

struct ErrInfo* TopChar ( struct Stack Stack)

◆ TopErr()

struct ErrInfo* TopErr ( struct Stack Stack)

Definition at line 911 of file Utility.c.

References StkTop().

◆ TopMatch()

struct ErrInfo* TopMatch ( struct Stack Stack,
char *  String 
)

Definition at line 876 of file Utility.c.

References Stack::Data, i, NULL, strcmp(), and Stack::Used.