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)  

stack.c File Reference
#include <stdlib.h>
#include "main.h"
#include "stack.h"
Include dependency graph for stack.c:

Go to the source code of this file.

Macros

#define STACKSIZE   1000
 

Functions

int BasicPush (int lev, int brack)
 
int BasicPop (int *lev, int *brack)
 
int getStackRecursionLevel (void)
 
void myprintStack (void)
 
void InitializeStack (void)
 
void PushLevels (void)
 
int PopLevels (void)
 
void CleanStack (void)
 
void PushBrace (void)
 
int PopBrace (void)
 

Variables

static int stack [1000]
 
static int top = 0
 
int BraceLevel = 0
 

Macro Definition Documentation

◆ STACKSIZE

#define STACKSIZE   1000

Definition at line 32 of file stack.c.

Function Documentation

◆ BasicPop()

int BasicPop ( int lev,
int brack 
)

purpose: pops the parameters lev and brack from the stack return: top of stack

Definition at line 90 of file stack.c.

References diagnostics(), ERROR, and top.

Referenced by CleanStack(), getStackRecursionLevel(), PopBrace(), and PopLevels().

◆ BasicPush()

int BasicPush ( int  lev,
int  brack 
)

purpose: pushes the parameters lev and brack on the stack return: top of stack

Definition at line 71 of file stack.c.

References diagnostics(), ERROR, STACKSIZE, and top.

Referenced by CleanStack(), getStackRecursionLevel(), PopBrace(), PushBrace(), and PushLevels().

◆ CleanStack()

void CleanStack ( void  )

purpose: removes multiple identical copies on top of stack

Definition at line 155 of file stack.c.

References BasicPop(), BasicPush(), diagnostics(), and top.

Referenced by Convert(), ConvertAllttString(), and PushLevels().

◆ getStackRecursionLevel()

int getStackRecursionLevel ( void  )

purpose: returns the recursion level for the current BraceLevel

Definition at line 132 of file stack.c.

References BasicPop(), BasicPush(), BraceLevel, RecursionLevel, size, and void.

◆ InitializeStack()

void InitializeStack ( void  )

purpose: pushes 0,1 and 1,1 on the stack to start things out

Definition at line 59 of file stack.c.

References BraceLevel, PushLevels(), and RecursionLevel.

Referenced by main().

◆ myprintStack()

void myprintStack ( void  )

Definition at line 43 of file stack.c.

References fprintf, i, and top.

◆ PopBrace()

int PopBrace ( void  )

purpose: to return the recursion level of the matching open brace search down through the stack for the lowest recursionlevel that matches the current bracelevel-1.

Definition at line 191 of file stack.c.

References BasicPop(), BasicPush(), BraceLevel, diagnostics(), and RecursionLevel.

Referenced by CmdBeginEnd(), CmdSlashSlash(), Convert(), ConvertAllttString(), and TranslateCommand().

◆ PopLevels()

int PopLevels ( void  )

purpose: wrapper to hide BraceLevel from rest of program

Definition at line 121 of file stack.c.

References BasicPop(), BraceLevel, level, and void.

◆ PushBrace()

void PushBrace ( void  )

purpose: sets up the stack so that a closing brace will cause all commands enclosed by the braces to be completed

Definition at line 179 of file stack.c.

References BasicPush(), BraceLevel, and RecursionLevel.

Referenced by CmdBeginEnd(), CmdSlashSlash(), Convert(), ConvertAllttString(), and TranslateCommand().

◆ PushLevels()

void PushLevels ( void  )

purpose: wrapper to hide BraceLevel from rest of program

Definition at line 109 of file stack.c.

References BasicPush(), BraceLevel, CleanStack(), diagnostics(), RecursionLevel, and void.

Referenced by Convert(), ConvertAllttString(), and InitializeStack().

Variable Documentation

◆ BraceLevel

int BraceLevel = 0

◆ stack

int stack[1000]
static

Definition at line 34 of file stack.c.

Referenced by stackCreate(), and stackDestroy().

◆ top

int top = 0
static

Definition at line 35 of file stack.c.

Referenced by BasicPop(), BasicPush(), CleanStack(), and myprintStack().