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)  

tables.c File Reference
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
#include "main.h"
#include "convert.h"
#include "l2r_fonts.h"
#include "commands.h"
#include "funct1.h"
#include "tables.h"
#include "stack.h"
#include "cfg.h"
#include "parser.h"
#include "counters.h"
#include "util.h"
#include "lengths.h"
Include dependency graph for tables.c:

Go to the source code of this file.

Classes

struct  TabularT
 

Typedefs

typedef struct TabularT TabularT
 

Functions

void CmdTabjump (void)
 
void CmdTabset (void)
 
static void BeginCell (char align)
 
static void EndCell (void)
 
static char * ConvertFormatString (char *s)
 
static int TabularColumnPosition (int n)
 
static void TabularCountVert (char *s, int vert[])
 
static TabularT TabularPreamble (char *text, char *width, char *pos, char *cols)
 
static void TabularGetRow (char *table, char **row, char **next_row, int *height)
 
static char * TabularNextAmpersand (char *t)
 
static char * TabularNextCell (char *cell_start, char **cell_end)
 
static void TabularMultiParameters (char *cell, int *col_span, char *align, int *lvert, int *rvert)
 
static int TabularHline (char *row)
 
char * TabularCline (char *row, int columns)
 
static void TabularBeginRow (TabularT tabular, char *this_row, char *next_row, int first_row)
 
static void TabularEndRow (void)
 
char TabularColumnAlignment (int column)
 
static void TabularWriteRow (TabularT tabular, char *this_row, char *next_row, int height, int first_row)
 
void CmdTabular (int code)
 
static int TabbingColumnPosition (int n, int total)
 
static void TabbingNextCellEnd (char *t, char **cell_end, char **next_cell)
 
static char * TabbingNextCell (char *cell_start, char **cell_end)
 
static void TabbingBeginRow (int n, int n_total, char *align)
 
static void TabbingWriteRow (char *this_row, int n, int n_total, char *align)
 
static void TabbingGetRow (char *table, char **row, char **next_row)
 
static void TabbingGetColumnAlignments (char *row, char *align, int *n, int *next_left)
 
void CmdTabbing (int code)
 
void CmdTable (int code)
 
void CmdMultiCol (int code)
 
void CmdHline (int code)
 

Variables

int g_tabbing_left_position = 0
 
int g_tabbing_current_position = 0
 
intg_tabbing_locations = NULL
 
int tabcounter = 0
 
bool tabbing_return = 0
 
bool tabbing_on_itself = 0
 
long pos_begin_kill
 
bool g_processing_tabbing = 0
 
bool g_processing_tabular = 0
 
bool g_processing_table = 0
 
int colCount
 
int actCol
 
char * colFmt = NULL
 

Typedef Documentation

◆ TabularT

typedef struct TabularT TabularT

Function Documentation

◆ BeginCell()

static void BeginCell ( char  align)
static

purpose: emit RTF code to start each cell

Definition at line 74 of file tables.c.

References align, and fprintRTF().

Referenced by TabbingBeginRow(), TabbingWriteRow(), and TabularWriteRow().

◆ CmdHline()

void CmdHline ( int  code)

Definition at line 1072 of file tables.c.

References free, getBraceParam(), s, and skipSpaces().

◆ CmdMultiCol()

void CmdMultiCol ( int  code)

purpose: handles \multicolumn{n}{format}{content}

Definition at line 1040 of file tables.c.

References atoi(), check-c-linkage-decls::content, ConvertString(), diagnostics(), format, fprintRTF(), free, getBraceParam(), i, num, and strdup_noendblanks().

◆ CmdTabbing()

◆ CmdTabjump()

void CmdTabjump ( void  )

Definition at line 64 of file tables.c.

References fprintRTF().

Referenced by TranslateCommand().

◆ CmdTable()

void CmdTable ( int  code)

purpose: converts the LaTex-Table to a similar Rtf-style this converting is only partially so the user has to convert some part of the Table-environment by hand parameter: type of array-environment

Definition at line 1007 of file tables.c.

References CmdEndParagraph(), CmdIndent(), ConvertString(), ExtractLabelTag(), FALSE, free, g_processing_table, g_table_label, getBracketParam(), GetTexMode(), getTexUntil(), INDENT_NONE, MODE_VERTICAL, ON, and TRUE.

◆ CmdTabset()

void CmdTabset ( void  )

Definition at line 69 of file tables.c.

Referenced by TranslateCommand().

◆ CmdTabular()

void CmdTabular ( int  code)

◆ ConvertFormatString()

static char* ConvertFormatString ( char *  s)
static

purpose: convert latex formatting to something simpler

Definition at line 92 of file tables.c.

References braces, diagnostics(), i, s, strdup, and WARNING__.

Referenced by TabularMultiParameters(), and TabularPreamble().

◆ EndCell()

static void EndCell ( void  )
static

purpose: emit RTF code to end each cell

Definition at line 83 of file tables.c.

References fprintRTF().

Referenced by TabbingBeginRow(), TabbingWriteRow(), and TabularWriteRow().

◆ TabbingBeginRow()

static void TabbingBeginRow ( int  n,
int  n_total,
char *  align 
)
static

purpose: emit RTF to start one row of a tabbing environment

Definition at line 798 of file tables.c.

References align, BeginCell(), EndCell(), fprintRTF(), g_tabbing_left_position, i, n, and TabbingColumnPosition().

Referenced by TabbingWriteRow().

◆ TabbingColumnPosition()

static int TabbingColumnPosition ( int  n,
int  total 
)
static

purpose: return position of nth column

Definition at line 729 of file tables.c.

References getLength(), n, and gen-indic-table::total.

Referenced by TabbingBeginRow().

◆ TabbingGetColumnAlignments()

static void TabbingGetColumnAlignments ( char *  row,
char *  align,
int n,
int next_left 
)
static

purpose: scan one row of tabbing environment to obtain column alignments

Definition at line 891 of file tables.c.

References align, g_tabbing_left_position, i, n, and row.

Referenced by CmdTabbing().

◆ TabbingGetRow()

static void TabbingGetRow ( char *  table,
char **  row,
char **  next_row 
)
static

purpose: scan and duplicate the next row from the tabbing environment

Definition at line 851 of file tables.c.

References FALSE, free, isalpha, malloc, NULL, row, s, strdup_noendblanks(), strncmp(), strncpy(), and table.

Referenced by CmdTabbing().

◆ TabbingNextCell()

static char* TabbingNextCell ( char *  cell_start,
char **  cell_end 
)
static

purpose: scan and duplicate contents of the next cell

Definition at line 768 of file tables.c.

References dup(), dup2, end, free, my_strndup(), NULL, p, strdup_noendblanks(), strstr(), and TabbingNextCellEnd().

Referenced by TabbingWriteRow().

◆ TabbingNextCellEnd()

static void TabbingNextCellEnd ( char *  t,
char **  cell_end,
char **  next_cell 
)
static

purpose: find the next ampersand while avoiding &

Definition at line 739 of file tables.c.

References s, and t.

Referenced by TabbingNextCell().

◆ TabbingWriteRow()

static void TabbingWriteRow ( char *  this_row,
int  n,
int  n_total,
char *  align 
)
static

◆ TabularBeginRow()

static void TabularBeginRow ( TabularT  tabular,
char *  this_row,
char *  next_row,
int  first_row 
)
static

purpose: emit RTF to start one row of a table

      the vertical bar formatting codes for the entire row must be present at
      the start of the row.  The same holds for horizontal lines.  Only the first
      line may have an hlines above it.  Drawing hlines below depends on the
      next line containing an hline (i.e., after \\ that ends the row)

Definition at line 466 of file tables.c.

References align, bottom, cline, column, fprintRTF(), free, i, TabularT::n, n, right, row, TabularCline(), TabularColumnPosition(), TabularHline(), TabularMultiParameters(), TabularNextCell(), top, and TabularT::vert.

Referenced by TabularWriteRow().

◆ TabularCline()

char* TabularCline ( char *  row,
int  columns 
)

purpose: mark columns needing underline by \cline{ 1 - 2 } limited to 1-9 columns

Definition at line 410 of file tables.c.

References atoi(), cline, columns, i, m, malloc, n, NULL, row, s, strlen(), strstr(), TabularHline(), and cordic::x.

Referenced by TabularBeginRow().

◆ TabularColumnAlignment()

char TabularColumnAlignment ( int  column)

purpose: alignment for a column

Definition at line 544 of file tables.c.

References colFmt, and column.

Referenced by TabularWriteRow().

◆ TabularColumnPosition()

static int TabularColumnPosition ( int  n)
static

purpose: return position of nth column

Definition at line 142 of file tables.c.

References colCount, getLength(), and n.

Referenced by TabularBeginRow().

◆ TabularCountVert()

static void TabularCountVert ( char *  s,
int  vert[] 
)
static

purpose: fill vert[] with number of '|' for each column

Definition at line 152 of file tables.c.

References braces, diagnostics(), i, and s.

Referenced by TabularPreamble().

◆ TabularEndRow()

static void TabularEndRow ( void  )
static

purpose: emit RTF to finish one row of a table

Definition at line 535 of file tables.c.

References fprintRTF().

Referenced by TabularWriteRow().

◆ TabularGetRow()

static void TabularGetRow ( char *  table,
char **  row,
char **  next_row,
int height 
)
static

purpose: scan and duplicate the next row from a tabular environment and any height changes e.g. the & cell & is & here \[2pt] but & then & it & died \ will return "the & cell & is & here" and height should be 40 (twips)

Definition at line 221 of file tables.c.

References diagnostics(), FALSE, free, getDimension(), height, malloc, NULL, PopSource(), PushSource(), row, s, strncpy(), table, and TRUE.

Referenced by CmdTabular().

◆ TabularHline()

static int TabularHline ( char *  row)
static

purpose: count the number of \hline's in a line

Definition at line 392 of file tables.c.

References NULL, row, s, strstr(), and t.

Referenced by TabularBeginRow(), and TabularCline().

◆ TabularMultiParameters()

static void TabularMultiParameters ( char *  cell,
int col_span,
char *  align,
int lvert,
int rvert 
)
static

purpose: extract information from \multicolumn's on a line return col_span=0 if none are present

Definition at line 347 of file tables.c.

References align, atoi(), ConvertFormatString(), diagnostics(), format, free, getBraceParam(), NULL, num, p, PopSource(), PushSource(), strlen(), and strstr().

Referenced by TabularBeginRow(), and TabularWriteRow().

◆ TabularNextAmpersand()

static char* TabularNextAmpersand ( char *  t)
static

purpose: find the next ampersand while avoiding &

Definition at line 305 of file tables.c.

References s, and t.

Referenced by TabularNextCell().

◆ TabularNextCell()

static char* TabularNextCell ( char *  cell_start,
char **  cell_end 
)
static

purpose: scan and duplicate contents of the next cell

Definition at line 323 of file tables.c.

References dup(), dup2, end, free, my_strndup(), NULL, strdup, strdup_noendblanks(), and TabularNextAmpersand().

Referenced by TabularBeginRow(), and TabularWriteRow().

◆ TabularPreamble()

static TabularT TabularPreamble ( char *  text,
char *  width,
char *  pos,
char *  cols 
)
static

◆ TabularWriteRow()

static void TabularWriteRow ( TabularT  tabular,
char *  this_row,
char *  next_row,
int  height,
int  first_row 
)
static

Variable Documentation

◆ actCol

int actCol

Definition at line 61 of file tables.c.

Referenced by CmdColsep(), CmdSlashSlash(), Convert(), TabularPreamble(), and TabularWriteRow().

◆ colCount

int colCount

Definition at line 60 of file tables.c.

Referenced by CmdSlashSlash(), TabularColumnPosition(), TabularPreamble(), and TabularWriteRow().

◆ colFmt

char* colFmt = NULL

◆ g_processing_tabbing

bool g_processing_tabbing = 0

Definition at line 56 of file tables.c.

Referenced by CmdSlashSlash(), CmdTabbing(), and TranslateCommand().

◆ g_processing_table

bool g_processing_table = 0

Definition at line 58 of file tables.c.

Referenced by CmdCaption(), CmdLabel(), and CmdTable().

◆ g_processing_tabular

bool g_processing_tabular = 0

◆ g_tabbing_current_position

int g_tabbing_current_position = 0

Definition at line 49 of file tables.c.

◆ g_tabbing_left_position

int g_tabbing_left_position = 0

Definition at line 48 of file tables.c.

Referenced by CmdTabbing(), TabbingBeginRow(), TabbingGetColumnAlignments(), and TabbingWriteRow().

◆ g_tabbing_locations

int* g_tabbing_locations = NULL

Definition at line 50 of file tables.c.

◆ pos_begin_kill

long pos_begin_kill

Definition at line 55 of file tables.c.

◆ tabbing_on_itself

bool tabbing_on_itself = 0

Definition at line 54 of file tables.c.

◆ tabbing_return

bool tabbing_return = 0

Definition at line 53 of file tables.c.

◆ tabcounter

int tabcounter = 0

Definition at line 52 of file tables.c.

Referenced by CmdSlashSlash(), and Convert().