// Name: xlputils.cpp
// Purpose: Converts Latex to obsolete XLP format
// Author: Julian Smart
-// Modified by:
+// Modified by: Wlodzimiez ABX Skiba 2003/2004 Unicode support
+// Ron Lee
// Created: 7.9.93
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
static int indentLevel = 0;
static int noColumns = 0;
static int currentTab = 0;
-static bool tableVerticalLineLeft = FALSE;
-static bool tableVerticalLineRight = FALSE;
-static bool inTable = FALSE;
+static bool tableVerticalLineLeft = false;
+static bool tableVerticalLineRight = false;
+static bool inTable = false;
static int citeCount = 1;
wxList hyperLinks(wxKEY_INTEGER);
wxList hyperLabels(wxKEY_STRING);
{
int currentCol = GetCurrentColumn();
for (int i = currentCol; i < tabPos; i++)
- TexOutput(_T(" "), TRUE);
+ TexOutput(_T(" "), true);
}
static long xlpBlockId = 0;
long id1 = NewBlockId();
currentBlockId = NewBlockId();
- startedSections = TRUE;
+ startedSections = true;
wxFprintf(Contents, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, id1);
wxFprintf(Chapters, _T("\n\\hy-%d{%ld}{"), hyBLOCK_LARGE_VISIBLE_SECTION, currentBlockId);
wxFprintf(Index, _T("%ld %ld\n"), id1, currentBlockId);
long id1 = NewBlockId();
currentBlockId = NewBlockId();
- startedSections = TRUE;
+ startedSections = true;
if (DocumentStyle == LATEX_ARTICLE)
wxFprintf(Contents, _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, id1);
}
case ltVOID:
// if (start)
-// TexOutput(_T("void"), TRUE);
+// TexOutput(_T("void"), true);
break;
case ltBACKSLASHCHAR:
if (start)
- TexOutput(_T("\n"), TRUE);
+ TexOutput(_T("\n"), true);
break;
case ltPAR:
{
if (start)
{
if (ParSkip > 0)
- TexOutput(_T("\n"), TRUE);
- TexOutput(_T("\n"), TRUE);
+ TexOutput(_T("\n"), true);
+ TexOutput(_T("\n"), true);
}
break;
}
{
wxChar buf[100];
long id = NewBlockId();
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
TexOutput(buf);
}
else TexOutput(_T("}"));
{
wxChar buf[100];
long id = NewBlockId();
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_ITALIC, id);
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_ITALIC, id);
TexOutput(buf);
}
else TexOutput(_T("}"));
if (start)
{
long id = NewBlockId();
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
TexOutput(buf);
}
else TexOutput(_T("}"));
{
if (start)
{
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
TexOutput(buf);
}
else TexOutput(_T("}"));
{
if (start)
{
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
TexOutput(buf);
}
else TexOutput(_T("}"));
{
if (start)
{
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_NORMAL, NewBlockId());
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_NORMAL, NewBlockId());
TexOutput(buf);
}
else TexOutput(_T("}"));
{
if (start)
{
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
TexOutput(buf);
}
else TexOutput(_T("}\n"));
{
if (start)
{
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
TexOutput(buf);
}
else TexOutput(_T("}\n"));
{
case LATEX_ENUMERATE:
{
- wxSprintf(indentBuf, _T("\\hy-%d{%ld}{%d.} "),
+ wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{%d.} "),
hyBLOCK_BOLD, NewBlockId(), struc->currentItem);
TexOutput(indentBuf);
break;
}
case LATEX_ITEMIZE:
{
- wxSprintf(indentBuf, _T("\\hy-%d{%ld}{o} "),
+ wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{o} "),
hyBLOCK_BOLD, NewBlockId());
TexOutput(indentBuf);
break;
{
if (descriptionItemArg)
{
- wxSprintf(indentBuf, _T("\\hy-%d{%ld}{"),
+ wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{"),
hyBLOCK_BOLD, NewBlockId());
TexOutput(indentBuf);
TraverseChildrenFromChunk(descriptionItemArg);
}
break;
}
- }
+ }
}
}
break;
{
if (start && DocumentTitle && DocumentAuthor)
{
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
TexOutput(buf);
TraverseChildrenFromChunk(DocumentTitle);
TexOutput(_T("}\n\n"));
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
TexOutput(buf);
TraverseChildrenFromChunk(DocumentAuthor);
TexOutput(_T("}\n\n"));
case ltHARDY:
{
if (start)
- TexOutput(_T("HARDY"), TRUE);
+ TexOutput(_T("HARDY"), true);
break;
}
case ltWXCLIPS:
{
if (start)
- TexOutput(_T("wxCLIPS"), TRUE);
+ TexOutput(_T("wxCLIPS"), true);
break;
}
case ltVERBATIM:
{
wxChar buf[100];
long id = NewBlockId();
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
TexOutput(buf);
}
else TexOutput(_T("}"));
{
if (start)
{
- TexOutput(_T("\n------------------------------------------------------------------"), TRUE);
+ TexOutput(_T("\n------------------------------------------------------------------"), true);
}
break;
}
{
if (start)
{
- TexOutput(_T("--------------------------------------------------------------------------------"), TRUE);
+ TexOutput(_T("--------------------------------------------------------------------------------"), true);
}
break;
}
{
if (start)
{
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, NewBlockId());
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, NewBlockId());
TexOutput(buf);
}
else
case ltNUMBEREDBIBITEM:
{
if (!start)
- TexOutput(_T("\n\n"), TRUE);
+ TexOutput(_T("\n\n"), true);
break;
}
case ltCAPTION:
wxChar figBuf[40];
if (DocumentStyle != LATEX_ARTICLE)
- wxSprintf(figBuf, _T("Figure %d.%d: "), chapterNo, figureNo);
+ wxSnprintf(figBuf, sizeof(figBuf), _T("Figure %d.%d: "), chapterNo, figureNo);
else
- wxSprintf(figBuf, _T("Figure %d: "), figureNo);
+ wxSnprintf(figBuf, sizeof(figBuf), _T("Figure %d: "), figureNo);
TexOutput(figBuf);
}
{
if (!start && (arg_no == 1))
currentSection = GetArgChunk();
- return FALSE;
+ return false;
}
case ltFUNC:
{
if (!start && (arg_no == 1))
- TexOutput(_T(" "), TRUE);
+ TexOutput(_T(" "), true);
if (start && (arg_no == 3))
- TexOutput(_T("("), TRUE);
+ TexOutput(_T("("), true);
if (!start && (arg_no == 3))
- TexOutput(_T(")"), TRUE);
+ TexOutput(_T(")"), true);
break;
}
case ltPFUNC:
{
if (!start && (arg_no == 1))
- TexOutput(_T(" "), TRUE);
+ TexOutput(_T(" "), true);
if (start && (arg_no == 2))
- TexOutput(_T("(*"), TRUE);
+ TexOutput(_T("(*"), true);
if (!start && (arg_no == 2))
- TexOutput(_T(")"), TRUE);
+ TexOutput(_T(")"), true);
if (start && (arg_no == 3))
- TexOutput(_T("("), TRUE);
+ TexOutput(_T("("), true);
if (!start && (arg_no == 3))
- TexOutput(_T(")"), TRUE);
+ TexOutput(_T(")"), true);
break;
}
case ltCLIPSFUNC:
{
if (!start && (arg_no == 1))
- TexOutput(_T(" "), TRUE);
+ TexOutput(_T(" "), true);
if (start && (arg_no == 2))
{
- TexOutput(_T("("), TRUE);
+ TexOutput(_T("("), true);
long id = NewBlockId();
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
TexOutput(buf);
}
if (!start && (arg_no == 2))
TexOutput(_T("}"));
}
if (!start && (arg_no == 3))
- TexOutput(_T(")"), TRUE);
+ TexOutput(_T(")"), true);
break;
}
case ltPARAM:
if (start && (arg_no == 2))
{
long id = NewBlockId();
- wxSprintf(buf, _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
+ wxSnprintf(buf, sizeof(buf), _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
TexOutput(buf);
}
if (!start && (arg_no == 2))
if (start && (arg_no == 2))
{
long id = NewBlockId();
- wxSprintf(buf, _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
+ wxSnprintf(buf, sizeof(buf), _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
TexOutput(buf);
}
if (!start && (arg_no == 2))
case ltMEMBER:
{
if (!start && (arg_no == 1))
- TexOutput(_T(" "), TRUE);
+ TexOutput(_T(" "), true);
break;
}
case ltLABEL:
{
- return FALSE;
+ return false;
}
case ltREF:
{
{
TexOutput(sec);
}
- return FALSE;
+ return false;
}
break;
}
if (start)
{
currentBlockId = NewBlockId();
- wxSprintf(buf, _T("\\hy-%d{%ld}{"), hyBLOCK_RED_ITALIC, currentBlockId);
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_RED_ITALIC, currentBlockId);
TexOutput(buf);
}
else TexOutput(_T("}"));
hyperLinks.Append(currentBlockId, (wxObject *)copystring(label));
}
- return FALSE;
+ return false;
}
break;
}
{
if (arg_no == 1)
{
- return TRUE;
+ return true;
}
else if (arg_no == 2)
{
TexOutput(_T(" ("));
else
TexOutput(_T(")"));
- return TRUE;
+ return true;
}
break;
}
if (start && IsArgOptional())
{
descriptionItemArg = GetArgChunk();
- return FALSE;
+ return false;
}
break;
}
{
if (start)
{
- inTable = TRUE;
- tableVerticalLineLeft = FALSE;
- tableVerticalLineRight = FALSE;
+ inTable = true;
+ tableVerticalLineLeft = false;
+ tableVerticalLineRight = false;
wxChar *alignString = copystring(GetArgData());
if (len > 0)
{
if (alignString[0] == '|')
- tableVerticalLineLeft = TRUE;
+ tableVerticalLineLeft = true;
if (alignString[len-1] == '|')
- tableVerticalLineRight = TRUE;
+ tableVerticalLineRight = true;
}
for (int i = 0; i < len; i++)
// int tabPos = 80/noColumns;
currentTab = 0;
- return FALSE;
+ return false;
}
}
else if (arg_no == 2 && !start)
{
- inTable = FALSE;
+ inTable = false;
}
else if (arg_no == 2 && start)
- return TRUE;
+ return true;
break;
}
case ltMARGINPAR:
{
if (start)
{
- TexOutput(_T("----------------------------------------------------------------------\n"), TRUE);
- return TRUE;
+ TexOutput(_T("----------------------------------------------------------------------\n"), true);
+ return true;
}
else
- TexOutput(_T("\n----------------------------------------------------------------------\n"), TRUE);
+ TexOutput(_T("\n----------------------------------------------------------------------\n"), true);
break;
}
case ltBIBITEM:
if (ref)
{
if (ref->sectionNumber) delete[] ref->sectionNumber;
- wxSprintf(buf, _T("[%d]"), citeCount);
+ wxSnprintf(buf, sizeof(buf), _T("[%d]"), citeCount);
ref->sectionNumber = copystring(buf);
}
- wxSprintf(buf, _T("\\hy-%d{%ld}{[%d]} "), hyBLOCK_BOLD, NewBlockId(), citeCount);
+ wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{[%d]} "), hyBLOCK_BOLD, NewBlockId(), citeCount);
TexOutput(buf);
citeCount ++;
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
case ltTHEBIBLIOGRAPHY:
{
wxFprintf(Index, _T("%ld %ld\n"), id1, id2);
SetCurrentOutput(Chapters);
- return FALSE;
+ return false;
}
if (!start && (arg_no == 2))
{
}
- return TRUE;
+ return true;
}
case ltTWOCOLITEM:
case ltTWOCOLITEMRULED:
if (!start && (arg_no == 2))
TexOutput(_T("\n"));
- return TRUE;
+ return true;
}
/*
* Accents
}
}
}
- return FALSE;
+ return false;
}
case ltACCENT_ACUTE:
{
}
}
}
- return FALSE;
+ return false;
}
case ltACCENT_CARET:
{
}
}
}
- return FALSE;
+ return false;
}
case ltACCENT_TILDE:
{
}
}
}
- return FALSE;
+ return false;
}
case ltACCENT_UMLAUT:
{
}
}
}
- return FALSE;
+ return false;
}
case ltACCENT_DOT:
{
}
}
}
- return FALSE;
+ return false;
}
case ltACCENT_CADILLA:
{
}
}
}
- return FALSE;
+ return false;
}
default:
{
return DefaultOnArgument(macroId, arg_no, start);
}
}
- return TRUE;
+ return true;
}
bool XLPGo(void)
wxRemoveFile(_T("subsections.xlp"));
wxRemoveFile(_T("subsubsections.xlp"));
wxRemoveFile(_T("index.xlp"));
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}