Example #1
0
void write_flags(FILE *fp,int platform, int optimize)
{
  char tmp[1000];
  char nm[100];
  if (optimize)
    fprintf(fp,"CFLAGS_O=%s",include_path(platform));
  else
    fprintf(fp,"CFLAGS_D=%s",include_path(platform));

  if (optimize) 
    sprintf(nm,"%s_OPTIMIZE",plat_name[platform]);
  else
    sprintf(nm,"%s_DEBUG",plat_name[platform]);

  get_var(nm,tmp);
  fprintf(fp," %s ",tmp);


  if (platform!=DOS && platform!=LINUX)
    fprintf(fp,"-DBIG_ENDIANS ");
  if (platform==SUN)
    fprintf(fp,"-I/lusr/X11R5/include ");
  if (get_var("CFLAGS",z))
    fprintf(fp,"%s ",z);

  sprintf(tmp,"%s_FLAGS",plat_name[platform]);
  if (get_var(tmp,z))
    fprintf(fp,"%s ",z);


  fprintf(fp,"\n");
}
Example #2
0
void init_path(void)
{
    include_path(".");
    include_path("./data");
    include_path(CONFIG_PROGRAM_PATH);
    include_path(CONFIG_PROGRAM_PATH + std::string("/data"));
}
Example #3
0
  void convert(std::istream& in, std::ostream& out,
               const std::string& path = "")
  {
    tokenizer reader(in);

    for (tokenizer::token tok = reader.get_token();
         tok.kind != tokenizer::token::TOK_EOF;
         tok = reader.get_token()) {
      if (debug) {
        tok.print_token(std::cout);
        std::cout << std::endl;
      }

      switch (tok.kind) {
      case tokenizer::token::TOK_TEXT:
      case tokenizer::token::TOK_EQUATION:
        out << tok.text;
        break;

      case tokenizer::token::TOK_LITERAL:
        out << '@' << tok.text;
        break;

      case tokenizer::token::TOK_UNBREAKABLE_SPACE:
        out << "@tie{}";
        break;

      case tokenizer::token::TOK_COMMENT:
        out << "\n";
        break;

      case tokenizer::token::TOK_DIRECTIVE:
        if (tok.text == "documentclass") {
          out << "\\input texinfo  @c -*-texinfo-*-\n";
          out << "@setfilename std.info\n";
          out << "@settitle Title\n";
          out << "@contents\n";
          out << "@ifnottex\n";
          out << "@node Top,  , (dir), (dir)\n";
          out << "@top Overview\n\n";
          out << "@insertcopying\n";
          out << "@end ifnottex\n";

        }
        else if (tok.text == "usepackage" ||
                 tok.text == "input" ||
                 tok.text == "makeindex" ||
                 tok.text == "chapterstyle" ||
                 tok.text == "pagestyle" ||
                 tok.text == "frontmatter") {
          ;                     // ignore
        }
        else if (tok.text == "hyphenation") {
          ;                     // ignore
        }
        else if (tok.text == "rSec0") {
          out << "@node\n";
          out << "@chapter "
              << process_text(tok.brace_args.front(), path)
              << " [" << tok.bracket_arg << "] " << "\n";
          out << "@anchor{" << tok.bracket_arg << "}";
          pnum = 1;
        }
        else if (tok.text == "rSec1") {
          out << "@node\n";
          out << "@section "
              << process_text(tok.brace_args.front(), path)
              << " [" << tok.bracket_arg << "] " << "\n";
          out << "@anchor{" << tok.bracket_arg << "}";
          pnum = 1;
        }
        else if (tok.text == "rSec2") {
          out << "@node\n";
          out << "@subsection "
              << process_text(tok.brace_args.front(), path)
              << " [" << tok.bracket_arg << "] " << "\n";
          out << "@anchor{" << tok.bracket_arg << "}";
          pnum = 1;
        }
        else if (tok.text == "rSec3") {
          out << "@node\n";
          out << "@subsubsection "
              << process_text(tok.brace_args.front(), path)
              << " [" << tok.bracket_arg << "] " << "\n";
          out << "@anchor{" << tok.bracket_arg << "}";
          pnum = 1;
        }
        else if (tok.text == "rSec4") {
          out << "@subsubheading "
              << process_text(tok.brace_args.front(), path)
              << " [" << tok.bracket_arg << "] " << "\n";
          out << "@anchor{" << tok.bracket_arg << "}";
          pnum = 1;
        }
        else if (tok.text == "pnum") {
          out << "@noindent " << pnum++ << ".  ";
        }
        else if (tok.text == "include") {
          std::string name = tok.brace_args.front();
          if (name != "xref") {
            std::string   include_path(include_directory + '/' +
                                       name + ".tex");
            std::ifstream file(include_path.c_str());
            if (! file.good()) {
              std::cerr << "Error: Could not open file '"
                        << include_path << "'" << std::endl;
            } else {
              texinfo_converter converter;
              converter.convert(file, out, include_path);
            }
          }
        }
        else if (tok.text == "defn") {
          out << "@dfn{" << tok.brace_args.front() << "}";
        }
        else if (tok.text == "tcode") {
          out << "@code{" << tok.brace_args.front() << "}";
        }
        else if (tok.text == "term") {
          out << "@samp{" << tok.brace_args.front() << "}";
        }
        else if (tok.text == "ref") {
          out << "@ref{" << tok.brace_args.front() << "}";
        }
        else if (tok.text == "begin") {
          if (tok.brace_args.front() == "document")
            ;
          else if (tok.brace_args.front() == "itemize")
            out << "@itemize @bullet";
          else if (tok.brace_args.front() == "enumerate")
            out << "@enumerate";
          else if (tok.brace_args.front() == "codeblock")
            out << "@example";
          else if (tok.brace_args.front() == "ncsimplebnf")
            out << "@smallexample";
          else if (tok.brace_args.front() == "ncbnftab")
            out << "@smallexample";
          else if (tok.brace_args.front() == "tokentable" ||
                   tok.brace_args.front() == "floattable")
            out << "@multitable";
          else
            report_unrecognized(path, tok.linenum, "begin",
                                tok.brace_args.front());
        }
        else if (tok.text == "item") {
          out << "@item";
        }
        else if (tok.text == "end") {
          if (tok.brace_args.front() == "document")
            ;
          else if (tok.brace_args.front() == "itemize")
            out << "@end itemize";
          else if (tok.brace_args.front() == "enumerate")
            out << "@end enumerate";
          else if (tok.brace_args.front() == "codeblock")
            out << "@end example";
          else if (tok.brace_args.front() == "ncsimplebnf")
            out << "@end smallexample";
          else if (tok.brace_args.front() == "ncbnftab")
            out << "@end smallexample";
          else if (tok.brace_args.front() == "tokentable" ||
                   tok.brace_args.front() == "floattable")
            out << "@end multitable";
          else
            report_unrecognized(path, tok.linenum, "end",
                                tok.brace_args.front());
        }
        else if (tok.text == "enterexample") {
          out << "[@emph{Example:}";
        }
        else if (tok.text == "exitexample") {
          out << "---@emph{end example}]";
        }
        else if (tok.text == "enternote") {
          out << "[@emph{Note:}";
        }
        else if (tok.text == "exitnote") {
          out << "---@emph{end note}]";
        }
        else if (tok.text == "textit") {
          out << "@emph{" << tok.brace_args.front() << "}";
        }
        else if (tok.text == "grammarterm") {
          out << "@code{" << tok.brace_args.front() << "}";
        }
        else if (tok.text == "indextext") {
          out << "@cindex " << tok.brace_args.front();
        }
        else if (tok.text == "footnote" ||
                 tok.text == "terminal") {
          if (tok.text == "footnote")
            out << "@footnote{"
                << process_text(tok.brace_args.front(), path) << "}";
          else
            out << process_text(tok.brace_args.front(), path);
        }
        else if (tok.text == "terminal") {
          out << tok.brace_args.front();
        }
        else if (tok.text == "br") {
          ;                     // ignore
        }
        else if (tok.text == "opt") {
          out << "[opt]";
        }
        else {
          report_unrecognized(path, tok.linenum, tok.text);
        }
        break;

      default:
        break;
      }
    }
  }
Example #4
0
	inline void include_path(lua_State *L,const std::string& path)
	{
		include_path(L,path.c_str());
	}