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)  

funct1.c File Reference
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "main.h"
#include "convert.h"
#include "funct1.h"
#include "commands.h"
#include "stack.h"
#include "l2r_fonts.h"
#include "cfg.h"
#include "ignore.h"
#include "util.h"
#include "encode.h"
#include "parser.h"
#include "counters.h"
#include "lengths.h"
#include "definitions.h"
#include "preamble.h"
#include "xref.h"
#include "equation.h"
#include "direct.h"
#include "style.h"
Include dependency graph for funct1.c:

Go to the source code of this file.

Functions

void CmdPagestyle (int code)
 
void CmdHeader (int code)
 
char * roman_item (int n, bool upper)
 
void CmdStartParagraph (int code)
 
void CmdEndParagraph (int code)
 
static void DirectVspace (int vspace)
 
void CmdVspace (int code)
 
void CmdNewEnvironment (int code)
 
void CmdNewTheorem (int code)
 
void CmdIndent (int code)
 
void CmdSlashSlash (int code)
 
void CmdBeginEnd (int code)
 
void CmdAlign (int code)
 
void CmdToday (int code)
 
void CmdIgnore (int code)
 
void CmdLdots (int code)
 
void Environment (int code)
 
char * FormatUnitNumber (char *name)
 
void CmdSection (int code)
 
void CmdCaption (int code)
 
void CmdCounter (int code)
 
void CmdLength (int code)
 
void CmdQuote (int code)
 
void CmdList (int code)
 
void CmdItem (int code)
 
void CmdBox (int code)
 
void CmdVerb (int code)
 
void CmdVerbatim (int code)
 
void CmdVerse (int code)
 
void CmdIgnoreDef (int code)
 
void TranslateGerman (void)
 
void GermanPrint (int code)
 
void CmdIgnoreLet (int code)
 
void CmdQuad (int kk)
 
void CmdSpace (float kk)
 
void CmdFigure (int code)
 
void CmdIgnoreEnviron (int code)
 
void FixTildes (char *s)
 
void CmdTextColor (int code)
 
void CmdLink (int code)
 
void CmdColumn (int code)
 
void CmdNewPage (int code)
 
void Cmd_OptParam_Without_braces (int code)
 
void CmdBottom (int code)
 
void CmdAbstract (int code)
 
void CmdTitlepage (int code)
 
void CmdMinipage (int code)
 
void CmdColsep (int code)
 
void CmdVerbosityLevel (int code)
 
void CmdNonBreakSpace (int code)
 
void CmdInclude (int code)
 
void CmdIf (int code)
 
void CmdEndInput (int code)
 

Variables

bool twocolumn
 
int g_right_margin_indent
 
int g_left_margin_indent
 
static bool g_paragraph_no_indent = 0
 
static bool g_paragraph_inhibit_indent = 0
 
static int g_vertical_space_to_add = 0
 
bool g_processing_list_environment = 0
 

Function Documentation

◆ Cmd_OptParam_Without_braces()

void Cmd_OptParam_Without_braces ( int  code)

purpose: gets an optional parameter which isn't surrounded by braces but by spaces

Definition at line 1765 of file funct1.c.

References getTexChar(), isdigit, and ungetTexChar().

◆ CmdAbstract()

void CmdAbstract ( int  code)

parameter: code: on/off-option globals : article and titlepage from the documentstyle

Definition at line 1807 of file funct1.c.

References alignment, CmdEndParagraph(), CmdStartParagraph(), CmdVspace(), ConvertBabelName(), FIRST_PAR, FORMAT_REPORT, fprintRTF(), g_document_type, g_left_margin_indent, g_right_margin_indent, JUSTIFIED, ON, titlepage, and VSPACE_MEDIUM_SKIP.

◆ CmdAlign()

void CmdAlign ( int  code)

purpose : sets the alignment for a paragraph parameter : code: alignment centered, justified, left or right globals: alignment: alignment of paragraphs

Definition at line 514 of file funct1.c.

References alignment, CENTERED, CmdEndParagraph(), CmdIndent(), Convert(), diagnostics(), fprintRTF(), free, getBraceParam(), INDENT_INHIBIT, INDENT_NONE, JUSTIFIED, LEFT, OFF, ON, PAR_CENTER, PAR_CENTERLINE, PAR_LEFT, PAR_RAGGEDRIGHT, PAR_RIGHT, PAR_VCENTER, RIGHT, and s.

◆ CmdBeginEnd()

void CmdBeginEnd ( int  code)

purpose: reads the parameter after the \begin or \end-command; ( see also getBraceParam ) after reading the parameter the CallParamFunc-function calls the handling-routine for that special environment parameter: code: CMD_BEGIN: start of environment CMD_END: end of environment

Definition at line 446 of file funct1.c.

References CallParamFunc(), CMD_BEGIN, CmdEndParagraph(), CmdIndent(), CmdStartParagraph(), CmdVspace(), ConvertString(), diagnostics(), existsEnvironment(), existsTheorem(), expandEnvironment(), expandTheorem(), FIRST_PAR, fprintRTF(), free, getBraceParam(), getBracketParam(), i, INDENT_INHIBIT, OFF, ON, option, PopBrace(), PushBrace(), s, str, strcmp(), void, and VSPACE_SMALL_SKIP.

◆ CmdBottom()

void CmdBottom ( int  code)

purpose: ignore raggedbottom command

Definition at line 1795 of file funct1.c.

◆ CmdBox()

void CmdBox ( int  code)

◆ CmdCaption()

◆ CmdColsep()

void CmdColsep ( int  code)

purpose: hyperlatex support, handles '&' as in Convert() in convert.c only called by \S

Definition at line 1875 of file funct1.c.

References actCol, colFmt, diagnostics(), fprintRTF(), g_processing_tabular, GetTexMode(), MODE_DISPLAYMATH, NULL, and WARNING__.

◆ CmdColumn()

void CmdColumn ( int  code)

purpose: chooses between one/two-columns parameter: number of columns globals: twocolumn: true if twocolumn-mode is set

Definition at line 1722 of file funct1.c.

References FALSE, fprintRTF(), One_Column, TRUE, Two_Column, and twocolumn.

◆ CmdCounter()

void CmdCounter ( int  code)

purpose: handles \newcounter, \setcounter, \addtocounter, \value

Definition at line 975 of file funct1.c.

References COUNTER_ADD, COUNTER_NEW, COUNTER_SET, diagnostics(), fprintf, free, getBraceParam(), getCounter(), num, s, s2, s3, s4, setCounter(), sscanf(), and strchr.

◆ CmdEndInput()

void CmdEndInput ( int  code)

purpose: handles \endinput

Definition at line 2010 of file funct1.c.

References PopSource().

◆ CmdEndParagraph()

◆ CmdFigure()

void CmdFigure ( int  code)

purpose: Process \begin{figure} ... \end{figure} environment This is only complicated because we need to know what to label the caption before the caption is processed. So we just slurp the figure environment, extract the tag, and then process the environment as usual.

Definition at line 1560 of file funct1.c.

References caption, CmdEndParagraph(), CmdStartParagraph(), CmdVspace(), ConvertString(), diagnostics(), ExtractAndRemoveTag(), ExtractLabelTag(), FALSE, FIGURE, FIRST_PAR, free, g_figure_label, g_latex_figures, g_processing_figure, getBracketParam(), getTexUntil(), label, loc, ON, TRUE, VSPACE_SMALL_SKIP, and WriteLatexAsBitmap().

◆ CmdHeader()

void CmdHeader ( int  code)

purpose: converts the \markboth and \markright Command in Header information parameter: code: BOTH_SIDES, RIGHT_SIDE

globals : twoside,

Definition at line 735 of file preamble.c.

References BOTH_SIDES, diagnostics(), g_preambleTwoside, LEFT_SIDE, NULL, RIGHT_SIDE, RtfHeader(), and WARNING__.

◆ CmdIf()

void CmdIf ( int  code)

purpose: handles \ifx by skippint to next \fi

Definition at line 2000 of file funct1.c.

References FALSE, free, getTexUntil(), and s.

◆ CmdIgnore()

void CmdIgnore ( int  code)

purpose: allows handling of constructs that do not require changes to RTF

Definition at line 604 of file funct1.c.

Referenced by TranslateCommand().

◆ CmdIgnoreDef()

void CmdIgnoreDef ( int  code)

purpose: newenvironments or newcommands which are defined by the user aren't converted into Rtf and so they must be ignored

Definition at line 1431 of file funct1.c.

References getTexChar(), and parseBrace().

◆ CmdIgnoreEnviron()

void CmdIgnoreEnviron ( int  code)

purpose: function to ignore \begin{environ} ... \end{environ}

Definition at line 1602 of file funct1.c.

References ConvertString(), free, getTexUntil(), IGNORE_HTMLONLY, IGNORE_MINIPAGE, IGNORE_RAWHTML, NULL, ON, s, and strdup.

◆ CmdIgnoreLet()

void CmdIgnoreLet ( int  code)

purpose : ignore \let Format: \let\XXXXX = \YYYYYY or \let\XXXXX\YYYYYY

Definition at line 1521 of file funct1.c.

References getTexChar(), and skipSpaces().

◆ CmdInclude()

void CmdInclude ( int  code)

purpose: handles \input file, \input{file},

Definition at line 1965 of file funct1.c.

References diagnostics(), free, getBraceParam(), getNonSpace(), getTexChar(), i, isspace, name, NULL, PushSource(), s, strdup, strdup_together(), strstr(), t, ungetTexChar(), and WARNING__.

◆ CmdIndent()

void CmdIndent ( int  code)

purpose : set flags so that CmdStartParagraph() does the right thing

       INDENT_INHIBIT allows the next paragraph to be indented if
       a paragraph break occurs before CmdStartParagraph() is called

      INDENT_NONE tells CmdStartParagraph() to not indent the next paragraph

      INDENT_USUAL has CmdStartParagraph() use the value of \parindent

Definition at line 339 of file funct1.c.

References diagnostics(), FALSE, g_paragraph_inhibit_indent, g_paragraph_no_indent, GetTexMode(), INDENT_INHIBIT, INDENT_NONE, INDENT_USUAL, and TRUE.

Referenced by CmdAlign(), CmdBeginEnd(), CmdBox(), CmdItem(), CmdList(), CmdMusic(), CmdQuote(), CmdSlashSlash(), CmdTabbing(), CmdTable(), CmdVerbatim(), CmdVerse(), FinishRtfEquation(), Ignore_Environment(), and TabularPreamble().

◆ CmdItem()

void CmdItem ( int  code)

purpose : handles \item command. Since the \item command is delimited by a later \item command or the ending of an environment (\end{itemize}) this routine will get called recursively.

Definition at line 1166 of file funct1.c.

References CmdEndParagraph(), CmdIndent(), CmdStartParagraph(), ConvertString(), DESCRIPTION, diagnostics(), DirectVspace(), ENUMERATE, FALSE, FIRST_PAR, fprintRTF(), free, FrenchMode, g_enumerate_depth, g_processing_list_environment, getBracketParam(), getLength(), getNonBlank(), INDENT_NONE, INDENT_USUAL, ITEMIZE, RESET_ITEM_COUNTER, roman_item(), TRUE, and ungetTexChar().

Referenced by CmdList().

◆ CmdLdots()

void CmdLdots ( int  code)

purpose: converts the LaTeX-\ldots-command into "..." in Rtf

Definition at line 612 of file funct1.c.

References fprintRTF(), GetTexMode(), MODE_DISPLAYMATH, MODE_HORIZONTAL, MODE_MATH, and SetTexMode().

◆ CmdLength()

void CmdLength ( int  code)

purpose: handles \newlength, \setlength, \addtolength purpose: handle \textwidth=0.8in or \moveright0.1\textwidth

Definition at line 1018 of file funct1.c.

References diagnostics(), fprintf, free, getBraceParam(), getDimension(), getLength(), getNonSpace(), getTexChar(), LENGTH_ADD, LENGTH_NEW, LENGTH_SET, num, s, s1, setLength(), skipSpaces(), strlen(), and ungetTexChar().

◆ CmdLink()

void CmdLink ( int  code)

purpose: hyperlatex support for anchor}[ltx]{label} and \xlink{anchor}[printed reference]{URL}

Definition at line 1697 of file funct1.c.

References ConvertString(), diagnostics(), FixTildes(), fprintRTF(), free, getBraceParam(), getBracketParam(), and latex.

◆ CmdList()

void CmdList ( int  code)

◆ CmdMinipage()

void CmdMinipage ( int  code)

purpose: recognize and parse Minipage parameters currently this does nothing

Definition at line 1855 of file funct1.c.

References free, getBraceParam(), getBracketParam(), OFF, ON, and width.

◆ CmdNewEnvironment()

◆ CmdNewPage()

void CmdNewPage ( int  code)

purpose: starts a new page parameter: code: newpage or newcolumn-option globals: twocolumn: true if twocolumn-mode is set

Definition at line 1742 of file funct1.c.

References CmdEndParagraph(), fprintRTF(), NewColumn, NewPage, and twocolumn.

◆ CmdNewTheorem()

void CmdNewTheorem ( int  code)

◆ CmdNonBreakSpace()

void CmdNonBreakSpace ( int  code)

Definition at line 1957 of file funct1.c.

References fprintRTF(), getNonSpace(), and ungetTexChar().

◆ CmdPagestyle()

void CmdPagestyle ( int  code)

LEG030598 purpose: sets page numbering in rtf-output parameter:

globals : headings set to TRUE if the pagenumber is to go into the header pagenumbering set to TRUE if pagenumbering is to occur- default

Produces latex-like headers and footers. Needs to be terminated for:

  • headings chapter, section informations and page numbering
  • myheadings page nunmbering, combined with markboth, markright.

Definition at line 696 of file preamble.c.

References diagnostics(), FALSE, fprintRTF(), getBraceParam(), headings, pagenumbering, PlainPagestyle(), strcmp(), style, TRUE, and WARNING__.

◆ CmdQuad()

void CmdQuad ( int  kk)

purpose: inserts kk quad spaces (D. Taupin)

Definition at line 1539 of file funct1.c.

References fprintRTF(), and z.

◆ CmdQuote()

void CmdQuote ( int  code)

purpose: handles \begin{quote} ... \end{quote} \begin{quotation} ... \end{quotation} globals: indent which is the left-indent-position

Definition at line 1072 of file funct1.c.

References CmdEndParagraph(), CmdIndent(), CmdVspace(), diagnostics(), g_left_margin_indent, g_right_margin_indent, GENERIC_ENV, INDENT_INHIBIT, INDENT_USUAL, OFF, ON, PopEnvironment(), PushEnvironment(), QUOTATION, QUOTE, setLength(), and VSPACE_SMALL_SKIP.

◆ CmdSection()

◆ CmdSlashSlash()

◆ CmdSpace()

void CmdSpace ( float  kk)

purpose: inserts a space of width kk*space

Definition at line 1550 of file funct1.c.

References CurrentFontSize(), fprintRTF(), and size.

Referenced by TranslateCommand().

◆ CmdStartParagraph()

void CmdStartParagraph ( int  code)

purpose : RTF codes to create a new paragraph. If the paragraph should not be indented then emit \fi0 otherwise use the current value of \parindent as the indentation of the first line.

Sometimes it is necessary to know what the next paragraph will be before it has been parsed. For example, a section command should create a paragraph for the section title and then the next paragraph encountered should be handled like as a first paragraph. So status is set to 2 and decremented to 1 when the section title paragraph is started.

If the status is 1, then it is the first paragraph in a section. Usually the first paragraph is not indented. However, when the document is being typeset in french it should have normal indentation. Another special case occurs when the paragraph being typeset is in a list environment. In this case, we need to indent according to the current parindent to obtain the proper hanging indentation

If the status is 0, then use the default is to indent according to the current parindent. However, if the g_paragraph_inhibit_indent flag or the g_paragraph_no_indent flag is TRUE, then do not indent the next line. Typically these flags are set just after a figure or equation or table.

Note that when the code is ANY_PAR, the status flag is not touched.

Definition at line 65 of file funct1.c.

References alignment, diagnostics(), FALSE, FIRST_PAR, fprintRTF(), FrenchMode, g_left_margin_indent, g_paragraph_inhibit_indent, g_paragraph_no_indent, g_processing_list_environment, g_right_margin_indent, g_vertical_space_to_add, getLength(), GetTexMode(), MODE_HORIZONTAL, SetTexMode(), status, TexModeName, and TITLE_PAR.

Referenced by CmdAbstract(), CmdBeginEnd(), CmdBibitem(), CmdCaption(), CmdFigure(), CmdItem(), CmdMusic(), CmdSection(), CmdTabbing(), CmdThebibliography(), CmdVerbatim(), Ignore_Environment(), SetTexMode(), and TabularPreamble().

◆ CmdTextColor()

void CmdTextColor ( int  code)

purpose: hyperlatex support for \textcolor{color}{words to be in color}

Definition at line 1650 of file funct1.c.

References ConvertString(), diagnostics(), fprintRTF(), free, getBraceParam(), n, strcmp(), strdup_noendblanks(), and text.

◆ CmdTitlepage()

void CmdTitlepage ( int  code)

purpose: \begin{titlepage} ... \end{titlepage} add pagebreaks before and after this environment

Definition at line 1836 of file funct1.c.

References alignment, fprintRTF(), OFF, and ON.

◆ CmdToday()

void CmdToday ( int  code)

purpose: converts LaTeX \today into RTF \chdate

Definition at line 593 of file funct1.c.

References fprintRTF(), MODE_HORIZONTAL, and SetTexMode().

◆ CmdVerb()

void CmdVerb ( int  code)

purpose: converts the LaTeX-verb-environment to a similar Rtf-style \url probably does not handle line feeds properly

Definition at line 1289 of file funct1.c.

References diagnostics(), fprintRTF(), free, getDelimitedText(), getNonSpace(), getRawTexChar(), isalpha, MODE_HORIZONTAL, num, putRtfChar(), s, SetTexMode(), TexFontNumber(), text, TRUE, VERB_STAR, VERB_URL, and VERB_VERB.

◆ CmdVerbatim()

void CmdVerbatim ( int  code)

convert characters 1:1 until \end{verbatim} or \end{Verbatim} is reached VERBATIM_1 for \begin{verbatim} ... \end{verbatim} VERBATIM_2 for \begin{Verbatim} ... \end{Verbatim}

Definition at line 1339 of file funct1.c.

References CmdEndParagraph(), CmdIndent(), CmdStartParagraph(), ConvertAllttString(), ConvertString(), diagnostics(), FIRST_PAR, fprintRTF(), free, getTexUntil(), INDENT_NONE, num, ON, putRtfChar(), strdup, TexFontNumber(), UpdateLineNumber(), VERBATIM_1, VERBATIM_2, VERBATIM_3, and VERBATIM_4.

◆ CmdVerbosityLevel()

void CmdVerbosityLevel ( int  code)

purpose: insert \verbositylevel{5} in the tex file to set the verbosity in the LaTeX file!

Definition at line 1899 of file funct1.c.

References atoi(), free, g_verbosity_level, getBraceParam(), and s.

◆ CmdVerse()

void CmdVerse ( int  code)

purpose: converts the LaTeX-Verse-environment to a similar Rtf-style

Definition at line 1407 of file funct1.c.

References CmdEndParagraph(), CmdIndent(), CmdVspace(), diagnostics(), g_left_margin_indent, GENERIC_ENV, INDENT_INHIBIT, INDENT_USUAL, OFF, ON, PopEnvironment(), PushEnvironment(), setLength(), and VSPACE_SMALL_SKIP.

◆ CmdVspace()

void CmdVspace ( int  code)

purpose : vspace, vspace*, and vskip code == 0 if vspace or vspace* code == -1 if vskip code == 1 if \smallskip code == 2 if \medskip code == 3 if \bigskip

Definition at line 169 of file funct1.c.

References c, DirectVspace(), getDimension(), getLength(), getTexChar(), parseBrace(), VSPACE_BIG_SKIP, VSPACE_MEDIUM_SKIP, VSPACE_SMALL_SKIP, VSPACE_VSKIP, and VSPACE_VSPACE.

Referenced by CmdAbstract(), CmdBeginEnd(), CmdFigure(), CmdMusic(), CmdQuote(), CmdSection(), CmdThebibliography(), and CmdVerse().

◆ DirectVspace()

static void DirectVspace ( int  vspace)
static

Definition at line 163 of file funct1.c.

References g_vertical_space_to_add.

Referenced by CmdCaption(), CmdItem(), CmdList(), and CmdVspace().

◆ Environment()

void Environment ( int  code)

purpose: pushes/pops the new environment-commands on/from the stack parameter: code includes the type of the environment

Definition at line 624 of file funct1.c.

References CmdEndParagraph(), diagnostics(), ON, PopEnvironment(), and PushEnvironment().

◆ FixTildes()

void FixTildes ( char *  s)

Definition at line 1637 of file funct1.c.

References NULL, p, s, and strstr().

Referenced by CmdLink().

◆ FormatUnitNumber()

char* FormatUnitNumber ( char *  name)

purpose: returns the x.x.x number for the specified sectional unit.

Definition at line 642 of file funct1.c.

References FORMAT_ARTICLE, free, g_document_type, getCounter(), label, name, roman_item(), s, snprintf, strcmp(), strdup, and TRUE.

Referenced by CmdSection(), and expandTheorem().

◆ GermanPrint()

void GermanPrint ( int  code)

Definition at line 1500 of file funct1.c.

References fprintRTF(), GP_CK, GP_L, GP_LDBL, GP_R, and GP_RDBL.

◆ roman_item()

char * roman_item ( int  n,
bool  upper 
)

Definition at line 1915 of file funct1.c.

References i, n, s, strdup, and upper().

Referenced by CmdItem(), and FormatUnitNumber().

◆ TranslateGerman()

void TranslateGerman ( void  )

purpose: called on active german-mode and " character in input file to handle " as an active (meta-)character.

Definition at line 1446 of file funct1.c.

References fprintRTF(), and getTexChar().

Referenced by Convert().

Variable Documentation

◆ g_left_margin_indent

int g_left_margin_indent

◆ g_paragraph_inhibit_indent

bool g_paragraph_inhibit_indent = 0
static

Definition at line 60 of file funct1.c.

Referenced by CmdEndParagraph(), CmdIndent(), and CmdStartParagraph().

◆ g_paragraph_no_indent

bool g_paragraph_no_indent = 0
static

Definition at line 59 of file funct1.c.

Referenced by CmdIndent(), and CmdStartParagraph().

◆ g_processing_list_environment

bool g_processing_list_environment = 0

Definition at line 62 of file funct1.c.

Referenced by CmdBibitem(), CmdItem(), CmdList(), CmdStartParagraph(), and CmdThebibliography().

◆ g_right_margin_indent

int g_right_margin_indent

Definition at line 52 of file funct1.c.

Referenced by CmdAbstract(), CmdQuote(), CmdStartParagraph(), PopEnvironment(), and PushEnvironment().

◆ g_vertical_space_to_add

int g_vertical_space_to_add = 0
static

Definition at line 61 of file funct1.c.

Referenced by CmdStartParagraph(), and DirectVspace().

◆ twocolumn

bool twocolumn
extern

Definition at line 121 of file main.c.

Referenced by CmdColumn(), and CmdNewPage().