Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ifprintf.cc File Reference

#include "ifprintf.h"

Go to the source code of this file.

Functions

void set_indent (const char *s)
void indent ()
void outdent ()
void ifprintf (FILE *f, const char *c,...)

Variables

char * indent_current = 0
char * indent_amount = 0
int indentLevel = 0
int maxIndentLevel = 256


Function Documentation

void ifprintf FILE *  f,
const char *  c,
  ...
 

Definition at line 28 of file ifprintf.cc.

References indent_current.

Referenced by AST::Node::toASTFile().

00028                                           {
00029     fprintf(f, indent_current);
00030     va_list valist;
00031     va_start(valist, c);
00032     vfprintf(f, c, valist);
00033     va_end(valist);
00034 }

void indent  ) 
 

Definition at line 14 of file ifprintf.cc.

References indent_amount, indent_current, indentLevel, and maxIndentLevel.

Referenced by AST::Node::toASTFile().

00014              {
00015     indentLevel++;
00016     assert(indentLevel < maxIndentLevel);
00017     strcat(indent_current, indent_amount);
00018     assert(strlen(indent_current) == strlen(indent_amount) * indentLevel);
00019 }

void outdent  ) 
 

Definition at line 21 of file ifprintf.cc.

References indent_amount, indent_current, and indentLevel.

Referenced by AST::Node::toASTFile().

00021               {
00022     indentLevel--;
00023     assert(indentLevel >= 0 && "unindented too many times");
00024     indent_current[indentLevel * strlen(indent_amount)] = '\0';
00025     assert(strlen(indent_current) == strlen(indent_amount) * indentLevel);
00026 }

void set_indent const char *  s  ) 
 

Definition at line 7 of file ifprintf.cc.

References indent_amount, indent_current, indentLevel, and maxIndentLevel.

Referenced by main().

00007                               {
00008     assert(indent_current == 0 && "I am to lazy to allow changing of this");
00009     indent_amount = strdup(s);
00010     indent_current = new char[strlen(indent_amount) * maxIndentLevel];
00011     indentLevel = 0;
00012 }


Variable Documentation

char* indent_amount = 0
 

Definition at line 3 of file ifprintf.cc.

Referenced by indent(), outdent(), and set_indent().

char* indent_current = 0
 

Definition at line 2 of file ifprintf.cc.

Referenced by ifprintf(), indent(), outdent(), and set_indent().

int indentLevel = 0
 

Definition at line 4 of file ifprintf.cc.

Referenced by indent(), outdent(), and set_indent().

int maxIndentLevel = 256
 

Definition at line 5 of file ifprintf.cc.

Referenced by indent(), and set_indent().


Generated on Thu Oct 20 12:00:04 2005 for ASTree by  doxygen 1.4.2-20050421