コード例 #1
0
ファイル: vsnprintf.cpp プロジェクト: beanhome/dev
void VsnprintfTestCase::WrongFormatStrings()
{
    // test how wxVsnprintf() behaves with wrong format string:

#if 0
    // NB: the next 2 tests currently return an error but it would be nice
    //     if they didn't (see ticket #9367)

    // two positionals with the same index:
    r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%1$s %1$s"), "hello");
    CPPUNIT_ASSERT(r != -1);

    // three positionals with the same index mixed with other pos args:
    r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%4$d %2$f %1$s %2$s %3$d"), "hello", "world", 3, 4);
    CPPUNIT_ASSERT(r != -1);
#endif

    // a missing positional arg should result in an assert
    WX_ASSERT_FAILS_WITH_ASSERT(
            wxSnprintf(buf, MAX_TEST_LEN, wxT("%1$d %3$d"), 1, 2, 3) );

    // positional and non-positionals in the same format string:
    r = wxSnprintf(buf, MAX_TEST_LEN, wxT("%1$d %d %3$d"), 1, 2, 3);
    CPPUNIT_ASSERT_EQUAL(-1, r);
}
コード例 #2
0
ファイル: readshg.cpp プロジェクト: nealey/vera
bool SHGToMap(wxChar *filename, wxChar *defaultFile)
{
  // Test the SHG parser
  HotSpot *hotspots = NULL;
  int n = ParseSHG(filename, &hotspots);
  if (n == 0)
    return false;

  wxChar buf[100];
  wxSnprintf(buf, sizeof(buf), _T("Converting .SHG file to HTML map file: there are %d hotspots in %s."), n, filename);
  OnInform(buf);

  wxChar outBuf[256];
  wxStrcpy(outBuf, filename);
  StripExtension(outBuf);
  wxStrcat(outBuf, _T(".map"));

  FILE *fd = wxFopen(outBuf, _T("w"));
  if (!fd)
  {
    OnError(_T("Could not open .map file for writing."));
    delete[] hotspots;
    return false;
  }

  wxFprintf(fd, _T("default %s\n"), defaultFile);
  for (int i = 0; i < n; i++)
  {
    wxChar *refFilename = _T("??");
    
    TexRef *texRef = FindReference(hotspots[i].szHlpTopic_Macro);
    if (texRef)
      refFilename = texRef->refFile;
    else
    {
      wxChar buf[300];
      wxSnprintf(buf, sizeof(buf), _T("Warning: could not find hotspot reference %s"), hotspots[i].szHlpTopic_Macro);
      OnInform(buf);
    }
    wxFprintf(fd, _T("rect %s %d %d %d %d\n"), refFilename, (int)hotspots[i].left, (int)hotspots[i].top,
      (int)hotspots[i].right, (int)hotspots[i].bottom);
  }
  wxFprintf(fd, _T("\n"));

  fclose(fd);

  delete[] hotspots;
  return true;
}
コード例 #3
0
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
      wxChar buf[300];
      wxString platform = wxGetOsDescription();
      wxSnprintf(buf, sizeof(buf), _T("Tex2RTF Version %.2f %s\nLaTeX to RTF, WinHelp, and HTML Conversion\n\n(c) Julian Smart, George Tasker and others, 1999-2005"), versionNo, platform.c_str());
      wxMessageBox(buf, _T("About Tex2RTF"));
}
コード例 #4
0
ファイル: vsnprintf.cpp プロジェクト: beanhome/dev
void VsnprintfTestCase::N()
{
    int nchar;

    wxSnprintf(buf, MAX_TEST_LEN, wxT("%d %s%n\n"), 3, wxT("bears"), &nchar);
    CPPUNIT_ASSERT_EQUAL( 7, nchar );
}
コード例 #5
0
ファイル: PitchName.cpp プロジェクト: Kirushanr/audacity
// PitchName_Absolute does the same thing as PitchName, but appends 
// the register number, e.g., instead of "C" it will return "C4" 
// if the pitchNum corresonds to middle C.
wxChar * PitchName_Absolute(float pitchNum, bool bWantFlats /* = false */)
{
   PitchName(pitchNum, bWantFlats); 

	// PitchName sets p_PitchName to the next available char in gPitchName, 
	// so it's ready to append the register number.
   wxSnprintf(p_PitchName, 8, wxT("%d"), ((int)(pitchNum + 0.5) / 12));

   return gPitchName;
}
コード例 #6
0
void MyFrame::OnViewLatex(wxCommandEvent& WXUNUSED(event))
{
    ChooseInputFile();
    if (!InputFile.empty() && wxFileExists(InputFile))
    {
        textWindow->LoadFile(InputFile);
        wxChar buf[300];
        wxString str(wxFileNameFromPath(OutputFile));
        wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str.c_str());
        frame->SetTitle(buf);
    }
}
コード例 #7
0
void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
{
#if wxUSE_FILEDLG
    wxString s = wxFileSelector(_T("Save text to file"), wxEmptyString, wxEmptyString, _T("txt"), _T("*.txt"));
    if (!s.empty())
    {
        textWindow->SaveFile(s);
#if wxUSE_STATUSBAR
        wxChar buf[350];
        wxSnprintf(buf, sizeof(buf), _T("Saved text to %s"), (const wxChar*) s.c_str());
        frame->SetStatusText(buf, 0);
#endif // wxUSE_STATUSBAR
    }
#endif // wxUSE_FILEDLG
}
コード例 #8
0
ファイル: Key.cpp プロジェクト: stevewolter/rapidSTORM
void Key::cursor_value( const DataSource::PixelInfo& info, float value )
{
    bool approx = false;
    if ( std::isnan(value) ) {
        /* Search for color in key closest to info.color */
        std::vector<Color>::iterator element = 
            std::min_element( colors.begin(), colors.end(), 
                              DistanceTo(info.pixel) );
        
        value = values[ element - colors.begin() ];
        approx = true;
    }

    wxChar cbuffer[128];
    float remainder; const wxChar *SI_unit_prefix;
    make_SI_prefix( value, remainder, SI_unit_prefix );
    wxSnprintf(cbuffer, 128, wxT("%.3g %s"), 
        remainder, SI_unit_prefix);
    cursor->SetLabel( ((approx) ? wxT("ca. ") : wxT("")) + wxString(cbuffer) );
}
コード例 #9
0
void ShowOptions(void)
{
    wxChar buf[100];
    wxSnprintf(buf, sizeof(buf), _T("Tex2RTF version %.2f"), versionNo);
    OnInform(buf);
    OnInform(_T("Usage: tex2rtf [input] [output] [switches]\n"));
    OnInform(_T("where valid switches are"));
#ifndef NO_GUI
    OnInform(_T("    -interactive"));
#endif
    OnInform(_T("    -bufsize <size in K>"));
    OnInform(_T("    -charset <pc | pca | ansi | mac> (default ansi)"));
    OnInform(_T("    -twice"));
    OnInform(_T("    -sync"));
    OnInform(_T("    -checkcurlybraces"));
    OnInform(_T("    -checksyntax"));
    OnInform(_T("    -macros <filename>"));
    OnInform(_T("    -winhelp"));
    OnInform(_T("    -rtf"));
    OnInform(_T("    -html"));
    OnInform(_T("    -xlp\n"));
}
コード例 #10
0
ファイル: xlputils.cpp プロジェクト: nealey/vera
bool XLPOnArgument(int macroId, int arg_no, bool start)
{
  wxChar buf[300];
  switch (macroId)
  {
  case ltCHAPTER:
  case ltCHAPTERSTAR:
  case ltCHAPTERHEADING:
  case ltSECTION:
  case ltSECTIONSTAR:
  case ltSECTIONHEADING:
  case ltSUBSECTION:
  case ltSUBSECTIONSTAR:
  case ltSUBSUBSECTION:
  case ltSUBSUBSECTIONSTAR:
  case ltGLOSS:
  case ltMEMBERSECTION:
  case ltFUNCTIONSECTION:
  {
    if (!start && (arg_no == 1))
      currentSection = GetArgChunk();
    return false;
  }
  case ltFUNC:
  {
    if (!start && (arg_no == 1))
      TexOutput(_T(" "), true);
    if (start && (arg_no == 3))
      TexOutput(_T("("), true);
    if (!start && (arg_no == 3))
     TexOutput(_T(")"), true);
    break;
  }
  case ltPFUNC:
  {
    if (!start && (arg_no == 1))
      TexOutput(_T(" "), true);

    if (start && (arg_no == 2))
      TexOutput(_T("(*"), true);
    if (!start && (arg_no == 2))
      TexOutput(_T(")"), true);

    if (start && (arg_no == 3))
      TexOutput(_T("("), true);
    if (!start && (arg_no == 3))
      TexOutput(_T(")"), true);
    break;
  }
  case ltCLIPSFUNC:
  {
    if (!start && (arg_no == 1))
      TexOutput(_T(" "), true);
    if (start && (arg_no == 2))
    {
      TexOutput(_T("("), true);
      long id = NewBlockId();
      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);
    break;
  }
  case ltPARAM:
  {
    if (start && (arg_no == 2))
    {
      long id = NewBlockId();
      wxSnprintf(buf, sizeof(buf), _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
      TexOutput(buf);
    }
    if (!start && (arg_no == 2))
    {
      TexOutput(_T("}"));
    }
    break;
  }
  case ltCPARAM:
  {
    if (start && (arg_no == 2))
    {
      long id = NewBlockId();
      wxSnprintf(buf, sizeof(buf), _T(" \\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
      TexOutput(buf);
    }
    if (!start && (arg_no == 2))
    {
      TexOutput(_T("}"));
    }
    break;
  }
  case ltMEMBER:
  {
    if (!start && (arg_no == 1))
      TexOutput(_T(" "), true);
    break;
  }
  case ltLABEL:
  {
    return false;
  }
  case ltREF:
  {
    if (start)
    {
      wxChar *sec = NULL;

      wxChar *refName = GetArgData();
      if (refName)
      {
        TexRef *texRef = FindReference(refName);
        if (texRef)
        {
          sec = texRef->sectionNumber;
        }
      }
      if (sec)
      {
        TexOutput(sec);
      }
      return false;
    }
    break;
  }
  case ltHELPREF:
  case ltHELPREFN:
  case ltPOPREF:
  {
    if (arg_no == 1)
    {
      if (start)
      {
        currentBlockId = NewBlockId();
        wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_RED_ITALIC, currentBlockId);
        TexOutput(buf);
      }
      else TexOutput(_T("}"));
    }
    if (arg_no == 2)
    {
      if (start)
      {
        wxChar *label = GetArgData();
        hyperLinks.Append(currentBlockId, (wxObject *)copystring(label));
      }

      return false;
    }
    break;
  }
  case ltURLREF:
  {
    if (arg_no == 1)
    {
      return true;
    }
    else if (arg_no == 2)
    {
      if (start)
        TexOutput(_T(" ("));
      else
        TexOutput(_T(")"));
      return true;
    }
    break;
  }
  case ltITEM:
  {
    if (start && IsArgOptional())
    {
      descriptionItemArg = GetArgChunk();
      return false;
    }
    break;
  }
  case ltTABULAR:
  case ltSUPERTABULAR:
  {
    if (arg_no == 1)
    {
      if (start)
      {
        inTable = true;
        tableVerticalLineLeft = false;
        tableVerticalLineRight = false;

        wxChar *alignString = copystring(GetArgData());

        // Count the number of columns
        noColumns = 0;
        int len = wxStrlen(alignString);
        if (len > 0)
        {
          if (alignString[0] == '|')
            tableVerticalLineLeft = true;
          if (alignString[len-1] == '|')
            tableVerticalLineRight = true;
        }

        for (int i = 0; i < len; i++)
          if (isalpha(alignString[i]))
            noColumns ++;

/*
      // Experimental
      TexOutput(_T("\\brdrt\\brdrs"));
      if (tableVerticalLineLeft)
        TexOutput(_T("\\brdrl\\brdrs"));
      if (tableVerticalLineRight)
        TexOutput(_T("\\brdrr\\brdrs"));
*/

        // Calculate a rough size for each column
//        int tabPos = 80/noColumns;
        currentTab = 0;

        return false;
      }
    }
    else if (arg_no == 2 && !start)
    {
      inTable = false;
    }
    else if (arg_no == 2 && start)
      return true;
    break;
  }
  case ltMARGINPAR:
  case ltMARGINPAREVEN:
  case ltMARGINPARODD:
  case ltNORMALBOX:
  case ltNORMALBOXD:
  {
    if (start)
    {
      TexOutput(_T("----------------------------------------------------------------------\n"), true);
      return true;
    }
    else
      TexOutput(_T("\n----------------------------------------------------------------------\n"), true);
    break;
  }
  case ltBIBITEM:
  {
    wxChar buf[100];
    if (arg_no == 1 && start)
    {
      wxChar *citeKey = GetArgData();
      TexRef *ref = (TexRef *)TexReferences.Get(citeKey);
      if (ref)
      {
        if (ref->sectionNumber) delete[] ref->sectionNumber;
        wxSnprintf(buf, sizeof(buf), _T("[%d]"), citeCount);
        ref->sectionNumber = copystring(buf);
      }

      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{[%d]} "), hyBLOCK_BOLD, NewBlockId(), citeCount);
      TexOutput(buf);
      citeCount ++;
      return false;
    }
    return true;
  }
  case ltTHEBIBLIOGRAPHY:
  {
    if (start && (arg_no == 1))
    {
      citeCount = 1;

      SetCurrentOutput(Chapters);

      SetCurrentOutputs(Contents, Chapters);
      long id1 = NewBlockId();
      long id2 = NewBlockId();
      wxFprintf(Contents, _T("\\hy-%d{%ld}{%s}\n"), hyBLOCK_SMALL_HEADING, id1, ReferencesNameString);
      wxFprintf(Chapters, _T("\\hy-%d{%ld}{%s}\n\n\n"), hyBLOCK_LARGE_VISIBLE_SECTION, id2, ReferencesNameString);
      wxFprintf(Index, _T("%ld %ld\n"), id1, id2);

      SetCurrentOutput(Chapters);
      return false;
    }
    if (!start && (arg_no == 2))
    {
    }
    return true;
  }
  case ltTWOCOLITEM:
  case ltTWOCOLITEMRULED:
  {
    if (start && (arg_no == 2))
      TexOutput(_T("\n    "));

    if (!start && (arg_no == 2))
      TexOutput(_T("\n"));
    return true;
  }
  /*
   * Accents
   *
   */
  case ltACCENT_GRAVE:
  {
    if (start)
    {
      wxChar *val = GetArgData();
      if (val)
      {
        switch (val[0])
        {
          case _T('a'):
           TexOutput(_T("a"));
           break;
          case _T('e'):
           TexOutput(_T("e"));
           break;
          case _T('i'):
           TexOutput(_T("i"));
           break;
          case _T('o'):
           TexOutput(_T("o"));
           break;
          case _T('u'):
           TexOutput(_T("u"));
           break;
          case _T('A'):
           TexOutput(_T("a"));
           break;
          case _T('E'):
           TexOutput(_T("E"));
           break;
          case _T('I'):
           TexOutput(_T("I"));
           break;
          case _T('O'):
           TexOutput(_T("O"));
           break;
          case _T('U'):
           TexOutput(_T("U"));
           break;
          default:
           break;
        }
      }
    }
    return false;
  }
  case ltACCENT_ACUTE:
  {
    if (start)
    {
      wxChar *val = GetArgData();
      if (val)
      {
        switch (val[0])
        {
          case _T('a'):
           TexOutput(_T("a"));
           break;
          case _T('e'):
           TexOutput(_T("e"));
           break;
          case _T('i'):
           TexOutput(_T("i"));
           break;
          case _T('o'):
           TexOutput(_T("o"));
           break;
          case _T('u'):
           TexOutput(_T("u"));
           break;
          case _T('y'):
           TexOutput(_T("y"));
           break;
          case _T('A'):
           TexOutput(_T("A"));
           break;
          case _T('E'):
           TexOutput(_T("E"));
           break;
          case _T('I'):
           TexOutput(_T("I"));
           break;
          case _T('O'):
           TexOutput(_T("O"));
           break;
          case _T('U'):
           TexOutput(_T("U"));
           break;
          case _T('Y'):
           TexOutput(_T("Y"));
           break;
          default:
           break;
        }
      }
    }
    return false;
  }
  case ltACCENT_CARET:
  {
    if (start)
    {
      wxChar *val = GetArgData();
      if (val)
      {
        switch (val[0])
        {
          case _T('a'):
           TexOutput(_T("a"));
           break;
          case _T('e'):
           TexOutput(_T("e"));
           break;
          case _T('i'):
           TexOutput(_T("i"));
           break;
          case _T('o'):
           TexOutput(_T("o"));
           break;
          case _T('u'):
           TexOutput(_T("u"));
           break;
          case _T('A'):
           TexOutput(_T("A"));
           break;
          case _T('E'):
           TexOutput(_T("E"));
           break;
          case _T('I'):
           TexOutput(_T("I"));
           break;
          case _T('O'):
           TexOutput(_T("O"));
           break;
          case _T('U'):
           TexOutput(_T("U"));
           break;
          default:
           break;
        }
      }
    }
    return false;
  }
  case ltACCENT_TILDE:
  {
    if (start)
    {
      wxChar *val = GetArgData();
      if (val)
      {
        switch (val[0])
        {
          case _T('a'):
           TexOutput(_T("a"));
           break;
          case _T(' '):
           TexOutput(_T("~"));
           break;
          case _T('n'):
           TexOutput(_T("n"));
           break;
          case _T('o'):
           TexOutput(_T("o"));
           break;
          case _T('A'):
           TexOutput(_T("A"));
           break;
          case _T('N'):
           TexOutput(_T("N"));
           break;
          case _T('O'):
           TexOutput(_T("O"));
           break;
          default:
           break;
        }
      }
    }
    return false;
  }
  case ltACCENT_UMLAUT:
  {
    if (start)
    {
      wxChar *val = GetArgData();
      if (val)
      {
        switch (val[0])
        {
          case _T('a'):
           TexOutput(_T("a"));
           break;
          case _T('e'):
           TexOutput(_T("e"));
           break;
          case _T('i'):
           TexOutput(_T("i"));
           break;
          case _T('o'):
           TexOutput(_T("o"));
           break;
          case _T('u'):
           TexOutput(_T("u"));
           break;
          case _T('y'):
           TexOutput(_T("y"));
           break;
          case _T('A'):
           TexOutput(_T("A"));
           break;
          case _T('E'):
           TexOutput(_T("E"));
           break;
          case _T('I'):
           TexOutput(_T("I"));
           break;
          case _T('O'):
           TexOutput(_T("O"));
           break;
          case _T('U'):
           TexOutput(_T("U"));
           break;
          case _T('Y'):
           TexOutput(_T("Y"));
           break;
          default:
           break;
        }
      }
    }
    return false;
  }
  case ltACCENT_DOT:
  {
    if (start)
    {
      wxChar *val = GetArgData();
      if (val)
      {
        switch (val[0])
        {
          case _T('a'):
           TexOutput(_T("a"));
           break;
          case _T('A'):
           TexOutput(_T("A"));
           break;
          default:
           break;
        }
      }
    }
    return false;
  }
  case ltACCENT_CADILLA:
  {
    if (start)
    {
      wxChar *val = GetArgData();
      if (val)
      {
        switch (val[0])
        {
          case _T('c'):
           TexOutput(_T("c"));
           break;
          case _T('C'):
           TexOutput(_T("C"));
           break;
          default:
           break;
        }
      }
    }
    return false;
  }
  default:
  {
    return DefaultOnArgument(macroId, arg_no, start);
  }
  }
  return true;
}
コード例 #11
0
ファイル: table.cpp プロジェクト: AlanDrake/ags
bool ParseTableArgument(wxChar *value)
{
  noColumns = 0;
  int i = 0;
  int len = wxStrlen(value);
  bool isBorder = false;
  while (i < len)
  {
    int ch = value[i];
    if (ch == '|')
    {
      i ++;
      isBorder = true;
    }
    else if (ch == 'l')
    {
      TableData[noColumns].leftBorder = isBorder;
      TableData[noColumns].rightBorder = false;
      TableData[noColumns].justification = 'l';
      TableData[noColumns].width = 2000; // Estimate
      TableData[noColumns].absWidth = false;
//      TableData[noColumns].spacing = ??
      noColumns ++;
      i ++;
      isBorder = false;
    }
    else if (ch == 'c')
    {
      TableData[noColumns].leftBorder = isBorder;
      TableData[noColumns].rightBorder = false;
      TableData[noColumns].justification = 'c';
      TableData[noColumns].width = defaultTableColumnWidth; // Estimate
      TableData[noColumns].absWidth = false;
//      TableData[noColumns].spacing = ??
      noColumns ++;
      i ++;
      isBorder = false;
    }
    else if (ch == 'r')
    {
      TableData[noColumns].leftBorder = isBorder;
      TableData[noColumns].rightBorder = false;
      TableData[noColumns].justification = 'r';
      TableData[noColumns].width = 2000; // Estimate
      TableData[noColumns].absWidth = false;
//      TableData[noColumns].spacing = ??
      noColumns ++;
      i ++;
      isBorder = false;
    }
    else if (ch == 'p')
    {
      i ++;
      int j = 0;
      wxChar numberBuf[50];
      ch = value[i];
      if (ch == '{')
      {
        i++;
        ch = value[i];
      }

      while ((i < len) && (isdigit(ch) || ch == '.'))
      {
        numberBuf[j] = (wxChar)ch;
        j ++;
        i ++;
        ch = value[i];
      }
      // Assume we have 2 characters for units
      numberBuf[j] = value[i];
      j ++; i++;
      numberBuf[j] = value[i];
      j ++; i++;
      numberBuf[j] = 0;
      if (value[i] == '}') i++;

      TableData[noColumns].leftBorder = isBorder;
      TableData[noColumns].rightBorder = false;
      TableData[noColumns].justification = 'l';
      TableData[noColumns].width = 20*ParseUnitArgument(numberBuf);
      TableData[noColumns].absWidth = true;
//      TableData[noColumns].spacing = ??
      noColumns ++;
      isBorder = false;
    }
    else
    {
      wxChar *buf = new wxChar[wxStrlen(value) + 80];
      wxSnprintf(buf, wxStrlen(value) + 80, _T("Tabular first argument \"%s\" too complex!"), value);
      OnError(buf);
      delete[] buf;
      return false;
    }
  }
  if (isBorder)
    TableData[noColumns-1].rightBorder = true;
  return true;
}
コード例 #12
0
ファイル: prop.cpp プロジェクト: BackupTheBerlios/wxbeos-svn
wxChar *wxPropertyValidator::DoubleToString (double number) {
    static wxChar buf[20];
    wxSnprintf (buf, 20, wxT("%.6g"), number);
    return buf;
}
コード例 #13
0
ファイル: prop.cpp プロジェクト: BackupTheBerlios/wxbeos-svn
wxChar *wxPropertyValidator::FloatToString (float number) {
    static wxChar buf[20];
    wxSnprintf (buf, 20, wxT("%.6g"), number);
    return buf;
}
コード例 #14
0
bool Go(void)
{
#ifndef NO_GUI
  ChooseInputFile();
  ChooseOutputFile();
#endif

  if (InputFile.empty() || OutputFile.empty() || stopRunning)
    return false;

#ifndef NO_GUI
  if (isInteractive)
  {
    wxChar buf[300];
    wxString str = wxFileNameFromPath(InputFile);

    wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str);
    frame->SetTitle(buf);
  }

  wxStartTimer();
#endif

  // Find extension-less filename
  wxStrcpy(FileRoot, OutputFile.c_str());
  StripExtension(FileRoot);

  if (truncateFilenames && convertMode == TEX_HTML)
  {
    // Truncate to five characters. This ensures that
    // we can generate DOS filenames such as thing999. But 1000 files
    // may not be enough, of course...
    wxChar* sName = wxFileNameFromPath( FileRoot);  // this Julian's method is non-destructive reference

    if(sName)
      if(wxStrlen( sName) > 5)
        sName[5] = '\0';  // that should do!
  }

  wxSnprintf(ContentsName, 300, _T("%s.con"), FileRoot);
  wxSnprintf(TmpContentsName, 300, _T("%s.cn1"), FileRoot);
  wxSnprintf(TmpFrameContentsName, 300, _T("%s.frc"), FileRoot);
  wxSnprintf(WinHelpContentsFileName, 300, _T("%s.cnt"), FileRoot);
  wxSnprintf(RefFileName, 300, _T("%s.ref"), FileRoot);

  TexPathList.EnsureFileAccessible(InputFile);
  if (!bulletFile)
  {
    wxString s = TexPathList.FindValidPath(_T("bullet.bmp"));
    if (!s.empty())
    {
      wxString str = wxFileNameFromPath(s);
      bulletFile = copystring(str);
    }
  }

  if (wxFileExists(RefFileName))
    ReadTexReferences(RefFileName);

  bool success = false;

  if (!InputFile.empty() && !OutputFile.empty())
  {
    if (!wxFileExists(InputFile))
    {
      OnError(_T("Cannot open input file!"));
      TexCleanUp();
      return false;
    }
#if !defined(NO_GUI) && wxUSE_STATUSBAR
    if (isInteractive)
    {
      wxString buf;
      buf.Printf(_T("Working, pass %d...Click CLOSE to abort"), passNumber);
      frame->SetStatusText((wxChar *)buf.c_str());
    }
#endif
    OkToClose = false;
    OnInform(_T("Reading LaTeX file..."));
    TexLoadFile(InputFile);

    if (stopRunning)
    {
        OkToClose = true;
        return false;
    }

    switch (convertMode)
    {
      case TEX_RTF:
      {
        success = RTFGo();
        break;
      }
      case TEX_XLP:
      {
        success = XLPGo();
        break;
      }
      case TEX_HTML:
      {
        success = HTMLGo();
        break;
      }
    }
  }
  if (stopRunning)
  {
    OnInform(_T("*** Aborted by user."));
    success = false;
    stopRunning = false;
    OkToClose = true;
  }

  if (success)
  {
    WriteTexReferences(RefFileName);
    TexCleanUp();
    startedSections = false;

    wxString buf;
#ifndef NO_GUI
    long tim = wxGetElapsedTime();
    buf.Printf(_T("Finished PASS #%d in %ld seconds.\n"), passNumber, (long)(tim/1000.0));
    OnInform((wxChar *)buf.c_str());

    if (errorCount)
    {
        buf.Printf(_T("Errors encountered during this pass: %lu\n"), errorCount);
        OnInform((wxChar *)buf.c_str());
    }

#if wxUSE_STATUSBAR
    if (isInteractive)
    {
      buf.Printf(_T("Done, %d %s."), passNumber, (passNumber > 1) ? _T("passes") : _T("pass"));
      frame->SetStatusText((wxChar *)buf.c_str());
    }
#endif // wxUSE_STATUSBAR
#else
    buf.Printf(_T("Done, %d %s."), passNumber, (passNumber > 1) ? _T("passes") : _T("pass"));
    OnInform((wxChar *)buf.c_str());
    if (errorCount)
    {
        buf.Printf(_T("Errors encountered during this pass: %lu\n"), errorCount);
        OnInform((wxChar *)buf.c_str());
    }
#endif
    passNumber ++;
    errorCount = 0;
    OkToClose = true;
    return true;
  }

  TexCleanUp();
  startedSections = false;

#if !defined(NO_GUI) && wxUSE_STATUSBAR
  frame->SetStatusText(_T("Aborted by user."));
#endif // GUI

  OnInform(_T("Sorry, unsuccessful."));
  OkToClose = true;
  return false;
}
コード例 #15
0
ファイル: FFTviewerMain.cpp プロジェクト: myriadrf/RASDR
bool FFTviewerFrame::SaveConfiguration()
{
    char outbuf[80];
    char newline[3];
    memset(outbuf,0,sizeof(outbuf));
#define _N  (sizeof(outbuf)-1)
    wxSprintf(newline,"\r\n");
    if(g_CfgChanged) {
            g_CfgChanged = false; //Avoid repeated writes
            if(m_CFG_FileClassPtr == NULL) m_CFG_FileClassPtr = new wxFile();
            m_CFG_FileClassPtr->Create(g_CfgFileName,TRUE,wxS_DEFAULT);
            if(!m_CFG_FileClassPtr->IsOpened()) {
                cout << "CFG File Open Fail" << endl;
                if(m_CFG_FileClassPtr != NULL) {
                    m_CFG_FileClassPtr->Close();
                    delete m_CFG_FileClassPtr;
                    m_CFG_FileClassPtr = NULL;
                }
                return(false);
            }
            wxSnprintf(outbuf,_N,"RASDRproc Version %s - NOTE: Limit to 80 column to avoid problems %s",
                       AutoVersion::FULLVERSION_STRING,"...............................................................");
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%.12f // Center Frequency (GHz)",mSpectrum->m_RxFreq);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14g // Frequency Step",mSpectrum->m_frequencyStep);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // LPF Bandwidth (index)",LMLL_RxLPFGetLpfBw());
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // VGA1 Gain (index)",LMLL_RxFEGetRFB_TIA_RXFE());
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // VGA2 Gain (index)",LMLL_RxVGA2GetVga2G_u());
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // LNA Gain (index)",LMLL_RxFEGetG_LNA_RXFE());
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // Enable Averaging (0=no, 1=yes)",mSpectrum->chkAverage->GetValue());
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // Number of frames to average",mSpectrum->spinAvgCount->GetValue());
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // FFT log2(Samples/Frame) (N=2^integer; 10=1024, 11=2048, etc)",mSpectrum->spinFFTsamples->GetValue());
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // Sampling Frequency (MHz, integer, min=2, max=32)",mSpectrum->spinSamplingFreq->GetValue());
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // FFTOutput - Multiple Control (1=single 2=multiple suffixed)",g_NumbFFTFiles);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // FFTOutput - File Type Control (0=.csv for excel 1=General)",g_FFTFileType);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // FFTOutput - Time Standard Control (0=Local Time 1=UTC)",g_FFT_TimeStandard);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // FFTOutput - Number of Frames To Skip (integer)",g_FFTframeSkip);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // FFTOutput - Number of Frames to Write (integer)",g_FFTframesOut);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // PWROutput - Multiple Control (1=single 2=multiple suffixed)",g_NumbPWRFiles);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // PWROutput - File Type Control",g_PWRFileType);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // PWROutput - Time Standard Control (0=Local Time 1=UTC)",g_PWRTimeStandard);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // PWROutput - Recording Rate (seconds/sample)",g_PwrRecordRate);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // PWROutput - Plot Span (seconds)",g_PwrSpanSec);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // FFTOutput - Record Span (0=full range, 1=zoom/span)",g_FFTDataSource);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
 /*           m_CFG_FileClassPtr->Write(g_FFTfileName);
            m_CFG_FileClassPtr->Write(newline); */
            wxSnprintf(outbuf,_N,"%-14d // Background Subtraction Code (bit encoded, try 71, bit0=en)",g_backgroundDebugCfg);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%.12f // Integration Gain",g_integrationGain);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%14.10f // DC Offset for I samples",(g_DcOffsetI == 0.0?g_avgI:g_DcOffsetI));
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%14.10f // DC Offset for Q samples",(g_DcOffsetQ == 0.0?g_avgQ:g_DcOffsetQ));
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // Unlimited Averaging (0=no, 1=yes)", g_UnlimitedAveraging);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            // RSS Integration
            wxSnprintf(outbuf,_N,"%-14s // RSS Server IP",g_RSS_IP);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14hu // RSS Server Port (default=8888)", g_RSS_Port);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // RSS Channels (range is 100 to 512 unless extensions enabled)", g_RSS_Channels);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // RSS Server Enabled (0=disabled, 1=enabled)", g_RSS_Enable?1:0);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            // RSS RASDR Extension
            wxSnprintf(outbuf,_N,"%14.10f // RSS Frequency Offset (GHz)",g_RSS_FrequencyOffset);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%-14d // RSS Extensions Enabled (0=disabled, 1=enabled)", g_RSS_Extension?1:0);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%14.10f // RSS Channel Offset Adjustment",g_RSS_Offset);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%14.10f // RSS Channel Gain Adjustment",g_RSS_Gain);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%14.10f // RSS Channel Bias Adjustment",g_RSS_Bias);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%14.9f // RSS Channel Minimum Output Value",g_RSS_MinValue);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            wxSnprintf(outbuf,_N,"%14.9f // RSS Channel Maximum Output Value",g_RSS_MaxValue);
            m_CFG_FileClassPtr->Write(outbuf);
            m_CFG_FileClassPtr->Write(newline);
            //
            m_CFG_FileClassPtr->Flush();
            m_CFG_FileClassPtr->Close();
            delete m_CFG_FileClassPtr;
            m_CFG_FileClassPtr = NULL;

            cout << "Configuration Saved" << endl;
    }
    return(true);
}
コード例 #16
0
bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data, int WXUNUSED(size), wxIPCFormat WXUNUSED(format))
{
  wxStrcpy(Tex2RTFLastStatus, _T("OK"));

  wxChar firstArg[50];
  wxChar secondArg[300];
  if (SplitCommand(data, firstArg, secondArg))
  {
    bool hasArg = (wxStrlen(secondArg) > 0);
    if (wxStrcmp(firstArg, _T("INPUT")) == 0 && hasArg)
    {
        InputFile = secondArg;
        if (frame)
        {
            wxChar buf[100];
            wxString str = wxFileNameFromPath(InputFile);
            wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), (const wxChar*) str);
            frame->SetTitle(buf);
        }
    }
    else if (wxStrcmp(firstArg, _T("OUTPUT")) == 0 && hasArg)
    {
        OutputFile = secondArg;
    }
    else if (wxStrcmp(firstArg, _T("GO")) == 0)
    {
      wxStrcpy(Tex2RTFLastStatus, _T("WORKING"));
      if (!Go())
        wxStrcpy(Tex2RTFLastStatus, _T("CONVERSION ERROR"));
      else
        wxStrcpy(Tex2RTFLastStatus, _T("OK"));
    }
    else if (wxStrcmp(firstArg, _T("EXIT")) == 0)
    {
      if (frame) frame->Close();
    }
    else if (wxStrcmp(firstArg, _T("MINIMIZE")) == 0 || wxStrcmp(firstArg, _T("ICONIZE")) == 0)
    {
      if (frame)
        frame->Iconize(true);
    }
    else if (wxStrcmp(firstArg, _T("SHOW")) == 0 || wxStrcmp(firstArg, _T("RESTORE")) == 0)
    {
      if (frame)
      {
        frame->Iconize(false);
        frame->Show(true);
      }
    }
    else
    {
      // Try for a setting
      wxStrcpy(Tex2RTFLastStatus, RegisterSetting(firstArg, secondArg, false));
#if !defined(NO_GUI) && wxUSE_STATUSBAR
      if (frame && wxStrcmp(firstArg, _T("conversionMode")) == 0)
      {
        wxChar buf[100];
        wxStrcpy(buf, _T("In "));

        if (winHelp && (convertMode == TEX_RTF))
          wxStrcat(buf, _T("WinHelp RTF"));
        else if (!winHelp && (convertMode == TEX_RTF))
          wxStrcat(buf, _T("linear RTF"));
        else if (convertMode == TEX_HTML) wxStrcat(buf, _T("HTML"));
        else if (convertMode == TEX_XLP) wxStrcat(buf, _T("XLP"));
          wxStrcat(buf, _T(" mode."));
        frame->SetStatusText(buf, 1);
      }
#endif
    }
  }
  return true;
}
コード例 #17
0
ファイル: xlputils.cpp プロジェクト: nealey/vera
// Called on start/end of macro examination
void XLPOnMacro(int macroId, int no_args, bool start)
{
  wxChar buf[100];
  switch (macroId)
  {
  case ltCHAPTER:
  case ltCHAPTERSTAR:
  case ltCHAPTERHEADING:
  {
    if (!start)
    {
      sectionNo = 0;
      figureNo = 0;
      subsectionNo = 0;
      subsubsectionNo = 0;
      if (macroId != ltCHAPTERSTAR)
        chapterNo ++;

      SetCurrentOutputs(Contents, Chapters);
      long id1 = NewBlockId();
      currentBlockId = NewBlockId();

      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);

      OutputCurrentSection(); // Repeat section header

      wxFprintf(Contents, _T("}\n\n"));
      wxFprintf(Chapters, _T("}\n\n"));
      SetCurrentOutput(Chapters);
      wxChar *topicName = FindTopicName(GetNextChunk());
      hyperLabels.Append(topicName, (wxObject *)currentBlockId);
    }
    break;
  }
  case ltSECTION:
  case ltSECTIONSTAR:
  case ltSECTIONHEADING:
  case ltGLOSS:
  {
    if (!start)
    {
      subsectionNo = 0;
      subsubsectionNo = 0;

      if (macroId != ltSECTIONSTAR)
        sectionNo ++;

      SetCurrentOutputs(Chapters, Sections);
      long id1 = NewBlockId();
      currentBlockId = NewBlockId();

      startedSections = true;

      if (DocumentStyle == LATEX_ARTICLE)
        wxFprintf(Contents, _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, id1);
      else
        wxFprintf(Chapters, _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id1);
      wxFprintf(Sections, _T("\n\\hy-%d{%ld}{"), hyBLOCK_LARGE_VISIBLE_SECTION, currentBlockId);
      wxFprintf(Index, _T("%ld %ld\n"), id1, currentBlockId);

      OutputCurrentSection(); // Repeat section header

      if (DocumentStyle == LATEX_ARTICLE)
        wxFprintf(Contents, _T("}\n\n"));
      else
        wxFprintf(Chapters, _T("}\n\n"));
      wxFprintf(Sections, _T("}\n\n"));
      SetCurrentOutput(Sections);
      wxChar *topicName = FindTopicName(GetNextChunk());
      hyperLabels.Append(topicName, (wxObject *)currentBlockId);
    }
    break;
  }
  case ltSUBSECTION:
  case ltSUBSECTIONSTAR:
  case ltMEMBERSECTION:
  case ltFUNCTIONSECTION:
  {
    if (!start)
    {
      subsubsectionNo = 0;

      if (macroId != ltSUBSECTIONSTAR)
        subsectionNo ++;

      SetCurrentOutputs(Sections, Subsections);
      long id1 = NewBlockId();
      currentBlockId = NewBlockId();
      wxFprintf(Sections, _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id1);
      wxFprintf(Subsections, _T("\n\\hy-%d{%ld}{"), hyBLOCK_LARGE_VISIBLE_SECTION, currentBlockId);
      wxFprintf(Index, _T("%ld %ld\n"), id1, currentBlockId);

      OutputCurrentSection(); // Repeat section header

      wxFprintf(Sections, _T("}\n\n"));
      wxFprintf(Subsections, _T("}\n\n"));
      SetCurrentOutput(Subsections);
      wxChar *topicName = FindTopicName(GetNextChunk());
      hyperLabels.Append(topicName, (wxObject *)currentBlockId);
    }
    break;
  }
  case ltSUBSUBSECTION:
  case ltSUBSUBSECTIONSTAR:
  {
    if (!start)
    {
      if (macroId != ltSUBSUBSECTIONSTAR)
        subsubsectionNo ++;

      SetCurrentOutputs(Subsections, Subsubsections);
      long id1 = NewBlockId();
      currentBlockId = NewBlockId();
      wxFprintf(Subsections, _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id1);
      wxFprintf(Subsubsections, _T("\n\\hy-%d{%ld}{"), hyBLOCK_LARGE_VISIBLE_SECTION, currentBlockId);
      wxFprintf(Index, _T("%ld %ld\n"), id1, currentBlockId);

      OutputCurrentSection(); // Repeat section header

      wxFprintf(Subsections, _T("}\n\n"));
      wxFprintf(Subsubsections, _T("}\n\n"));
      SetCurrentOutput(Subsubsections);
      wxChar *topicName = FindTopicName(GetNextChunk());
      hyperLabels.Append(topicName, (wxObject *)currentBlockId);
    }
    break;
  }
  case ltFUNC:
  case ltPFUNC:
  case ltMEMBER:
  {
    SetCurrentOutput(Subsections);
    if (start)
    {
      long id = NewBlockId();
      wxFprintf(Subsections, _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
    }
    else
      wxFprintf(Subsections, _T("}"));
    break;
  }
  case ltVOID:
//    if (start)
//      TexOutput(_T("void"), true);
    break;
  case ltBACKSLASHCHAR:
    if (start)
      TexOutput(_T("\n"), true);
    break;
  case ltPAR:
  {
    if (start)
    {
      if (ParSkip > 0)
        TexOutput(_T("\n"), true);
      TexOutput(_T("\n"), true);
    }
    break;
  }
  case ltRMFAMILY:
  case ltTEXTRM:
  case ltRM:
  {
    break;
  }
  case ltTEXTBF:
  case ltBFSERIES:
  case ltBF:
  {
    if (start)
    {
      wxChar buf[100];
      long id = NewBlockId();
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_BOLD, id);
      TexOutput(buf);
    }
    else TexOutput(_T("}"));
    break;
  }
  case ltTEXTIT:
  case ltITSHAPE:
  case ltIT:
  {
    if (start)
    {
      wxChar buf[100];
      long id = NewBlockId();
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_ITALIC, id);
      TexOutput(buf);
    }
    else TexOutput(_T("}"));
    break;
  }
  case ltTTFAMILY:
  case ltTEXTTT:
  case ltTT:
  {
    if (start)
    {
      long id = NewBlockId();
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
      TexOutput(buf);
    }
    else TexOutput(_T("}"));
    break;
  }
  case ltSMALL:
  {
    if (start)
    {
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
      TexOutput(buf);
    }
    else TexOutput(_T("}"));
    break;
  }
  case ltTINY:
  {
    if (start)
    {
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_TEXT, NewBlockId());
      TexOutput(buf);
    }
    else TexOutput(_T("}"));
    break;
  }
  case ltNORMALSIZE:
  {
    if (start)
    {
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_NORMAL, NewBlockId());
      TexOutput(buf);
    }
    else TexOutput(_T("}"));
    break;
  }
  case ltlarge:
  {
    if (start)
    {
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
      TexOutput(buf);
    }
    else TexOutput(_T("}\n"));
    break;
  }
  case ltLARGE:
  {
    if (start)
    {
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
      TexOutput(buf);
    }
    else TexOutput(_T("}\n"));
    break;
  }
  case ltITEMIZE:
  case ltENUMERATE:
  case ltDESCRIPTION:
  case ltTWOCOLLIST:
  {
    if (start)
    {
//      tabCount ++;

//      if (indentLevel > 0)
//        TexOutput(_T("\\par\\par\n"));
      indentLevel ++;
      int listType;
      if (macroId == ltENUMERATE)
        listType = LATEX_ENUMERATE;
      else if (macroId == ltITEMIZE)
        listType = LATEX_ITEMIZE;
      else
        listType = LATEX_DESCRIPTION;
      itemizeStack.Insert(new ItemizeStruc(listType));

    }
    else
    {
      indentLevel --;

      if (itemizeStack.GetFirst())
      {
        ItemizeStruc *struc = (ItemizeStruc *)itemizeStack.GetFirst()->GetData();
        delete struc;
        delete itemizeStack.GetFirst();
      }
    }
    break;
  }
  case ltITEM:
  {
    wxNode *node = itemizeStack.GetFirst();
    if (node)
    {
      ItemizeStruc *struc = (ItemizeStruc *)node->GetData();
      if (!start)
      {
        struc->currentItem += 1;
        wxChar indentBuf[30];

        switch (struc->listType)
        {
          case LATEX_ENUMERATE:
          {
            wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{%d.} "),
              hyBLOCK_BOLD, NewBlockId(), struc->currentItem);
            TexOutput(indentBuf);
            break;
          }
          case LATEX_ITEMIZE:
          {
            wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{o} "),
              hyBLOCK_BOLD, NewBlockId());
            TexOutput(indentBuf);
            break;
          }
          default:
          case LATEX_DESCRIPTION:
          {
            if (descriptionItemArg)
            {
              wxSnprintf(indentBuf, sizeof(indentBuf), _T("\\hy-%d{%ld}{"),
                 hyBLOCK_BOLD, NewBlockId());
              TexOutput(indentBuf);
              TraverseChildrenFromChunk(descriptionItemArg);
              TexOutput(_T("} "));
              descriptionItemArg = NULL;
            }
            break;
          }
        }
      }
    }
    break;
  }
  case ltMAKETITLE:
  {
    if (start && DocumentTitle && DocumentAuthor)
    {
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_LARGE_HEADING, NewBlockId());
      TexOutput(buf);
      TraverseChildrenFromChunk(DocumentTitle);
      TexOutput(_T("}\n\n"));
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_SMALL_HEADING, NewBlockId());
      TexOutput(buf);
      TraverseChildrenFromChunk(DocumentAuthor);
      TexOutput(_T("}\n\n"));
      if (DocumentDate)
      {
        TraverseChildrenFromChunk(DocumentDate);
        TexOutput(_T("\n"));
      }
    }
    break;
  }
  case ltTABLEOFCONTENTS:
  {
    if (start)
    {
      FILE *fd = wxFopen(ContentsName, _T("r"));
      if (fd)
      {
        int ch = getc(fd);
        while (ch != EOF)
        {
          wxPutc(ch, Chapters);
          ch = getc(fd);
        }
        fclose(fd);
      }
      else
      {
        TexOutput(_T("RUN TEX2RTF AGAIN FOR CONTENTS PAGE\n"));
        OnInform(_T("Run Tex2RTF again to include contents page."));
      }
    }
    break;
  }
  case ltHARDY:
  {
    if (start)
      TexOutput(_T("HARDY"), true);
    break;
  }
  case ltWXCLIPS:
  {
    if (start)
      TexOutput(_T("wxCLIPS"), true);
    break;
  }
  case ltVERBATIM:
  {
    if (start)
    {
      wxChar buf[100];
      long id = NewBlockId();
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, id);
      TexOutput(buf);
    }
    else TexOutput(_T("}"));
    break;
  }
  case ltHRULE:
  {
    if (start)
    {
      TexOutput(_T("\n------------------------------------------------------------------"), true);
    }
    break;
  }
  case ltHLINE:
  {
    if (start)
    {
      TexOutput(_T("--------------------------------------------------------------------------------"), true);
    }
    break;
  }
  case ltSPECIALAMPERSAND:
  {
    if (start)
    {
      currentTab ++;
      int tabPos = (80/noColumns)*currentTab;
      PadToTab(tabPos);
    }
    break;
  }
  case ltTABULAR:
  case ltSUPERTABULAR:
  {
    if (start)
    {
      wxSnprintf(buf, sizeof(buf), _T("\\hy-%d{%ld}{"), hyBLOCK_TELETYPE, NewBlockId());
      TexOutput(buf);
    }
    else
      TexOutput(_T("}"));
    break;
  }
  case ltNUMBEREDBIBITEM:
  {
    if (!start)
      TexOutput(_T("\n\n"), true);
    break;
  }
  case ltCAPTION:
  case ltCAPTIONSTAR:
  {
    if (start)
    {
      figureNo ++;

      wxChar figBuf[40];
      if (DocumentStyle != LATEX_ARTICLE)
        wxSnprintf(figBuf, sizeof(figBuf), _T("Figure %d.%d: "), chapterNo, figureNo);
      else
        wxSnprintf(figBuf, sizeof(figBuf), _T("Figure %d: "), figureNo);

      TexOutput(figBuf);
    }
    else
    {
      wxChar *topicName = FindTopicName(GetNextChunk());

      AddTexRef(topicName, NULL, NULL,
           ((DocumentStyle != LATEX_ARTICLE) ? chapterNo : figureNo),
            ((DocumentStyle != LATEX_ARTICLE) ? figureNo : 0));
    }
    break;
  }
  default:
  {
    DefaultOnMacro(macroId, no_args, start);
    break;
  }
  }
}