Removed latex
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@59 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a8f930bb99
commit
1c93f89362
7 changed files with 54 additions and 906 deletions
|
|
@ -31,7 +31,6 @@ static char cvsroot[] = "$Header$";
|
|||
#include "guile.h"
|
||||
#include "debug.h"
|
||||
#include "ascii.h"
|
||||
#include "latex.h"
|
||||
#include "html.h"
|
||||
#include "nodoc.h"
|
||||
#include <ctype.h>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
# This makefile is now mostly constructed by ./configure.
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.2 2000/01/12 04:56:27 beazley
|
||||
# Removed latex
|
||||
#
|
||||
# Revision 1.1 2000/01/11 20:08:16 beazley
|
||||
# First checkin
|
||||
#
|
||||
|
|
@ -61,11 +64,11 @@ AR = @AR@
|
|||
########################################################################
|
||||
|
||||
LIBOBJS = main.o scanner.o symbol.o include.o types.o parms.o emit.o newdoc.o ascii.o \
|
||||
html.o latex.o cplus.o lang.o hash.o sstring.o wrapfunc.o getopt.o comment.o \
|
||||
html.o cplus.o lang.o hash.o sstring.o wrapfunc.o getopt.o comment.o \
|
||||
typemap.o naming.o
|
||||
|
||||
LIBSRCS = main.cxx scanner.cxx symbol.cxx include.cxx types.cxx parms.cxx emit.cxx \
|
||||
newdoc.cxx ascii.cxx html.cxx latex.cxx cplus.cxx lang.cxx hash.cxx \
|
||||
newdoc.cxx ascii.cxx html.cxx cplus.cxx lang.cxx hash.cxx \
|
||||
sstring.cxx wrapfunc.cxx getopt.cxx comment.cxx typemap.cxx naming.cxx
|
||||
|
||||
PARSER = parser.y
|
||||
|
|
@ -103,3 +106,12 @@ clean::
|
|||
nuke::
|
||||
rm -f Makefile *~ #* core a.out
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,348 +14,82 @@
|
|||
*******************************************************************************/
|
||||
|
||||
#include "internal.h"
|
||||
#include "doh.h"
|
||||
|
||||
static char cvsroot[] = "$Header$";
|
||||
|
||||
/*******************************************************************************
|
||||
* $Header$
|
||||
*
|
||||
* File : hash.cxx
|
||||
*
|
||||
* A very simple Hash table class. Could probably make it more elegant with
|
||||
* templates, but templates are pure evil...
|
||||
* This is now just a wrapper around the DOH hash table object.
|
||||
*******************************************************************************/
|
||||
|
||||
#define INIT_SIZE 119
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Hash::Hash()
|
||||
//
|
||||
// Constructor. Creates a new hash table.
|
||||
//
|
||||
// Inputs : None
|
||||
//
|
||||
// Output : New Hash object.
|
||||
//
|
||||
// Side Effects : None
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Hash::Hash() {
|
||||
int i;
|
||||
hashsize = INIT_SIZE;
|
||||
hashtable = new Node *[hashsize];
|
||||
for (i = 0; i < hashsize; i++) {
|
||||
hashtable[i] = 0;
|
||||
}
|
||||
index = -1;
|
||||
current = 0;
|
||||
data = NewHash();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Hash::~Hash()
|
||||
//
|
||||
// Destructor.
|
||||
//
|
||||
// Inputs : None
|
||||
//
|
||||
// Output : None
|
||||
//
|
||||
// Side Effects : Total destruction.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Hash::~Hash() {
|
||||
int i;
|
||||
Node *n,*next;
|
||||
|
||||
for (i = 0; i < hashsize; i++) {
|
||||
if (hashtable[i]) {
|
||||
n = hashtable[i];
|
||||
while (n) {
|
||||
next = n->next;
|
||||
delete n;
|
||||
n = next;
|
||||
}
|
||||
}
|
||||
}
|
||||
delete [] hashtable;
|
||||
Delete(data);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// int Hash::h1(const char *key)
|
||||
//
|
||||
// Hashing function.
|
||||
//
|
||||
// Inputs : ASCII character string.
|
||||
//
|
||||
// Output : Hash table index.
|
||||
//
|
||||
// Side Effects : None
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
int Hash::h1(const char *key) {
|
||||
int h = 0;
|
||||
const char *c;
|
||||
|
||||
c = key;
|
||||
while (*c) {
|
||||
h = (128*h + *c) % hashsize;
|
||||
c++;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// int Hash::add(const char *k, void *obj)
|
||||
//
|
||||
// Adds a new object to the hash table.
|
||||
//
|
||||
// Inputs :
|
||||
// k = Hash key
|
||||
// obj = Pointer to an object
|
||||
//
|
||||
// Output : 0 on success, -1 if item is already in hash table.
|
||||
//
|
||||
// Side Effects :
|
||||
// Makes a new hash table entry.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
int Hash::add(const char *k, void *obj) {
|
||||
|
||||
int hv;
|
||||
Node *n,*prev;
|
||||
|
||||
hv = h1(k); // Get hash value
|
||||
n = hashtable[hv];
|
||||
prev = n;
|
||||
while (n) {
|
||||
if (strcmp(n->key,k) == 0) return -1; // Already in hash table
|
||||
prev = n;
|
||||
n = n->next;
|
||||
}
|
||||
|
||||
// Safe to add this to the table
|
||||
|
||||
n = new Node(k,obj,0);
|
||||
if (prev) prev->next = n;
|
||||
else hashtable[hv] = n;
|
||||
DOH *v = NewVoid(obj,0);
|
||||
if (Getattr(data, (DOH *) k)) return -1;
|
||||
Setattr(data, (DOH *) k, v);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// int Hash::add(const char *k, void *obj, void (*d)(void *))
|
||||
//
|
||||
// Adds a new object to the hash table. Allows additional specification of
|
||||
// a callback function for object deletion.
|
||||
//
|
||||
// Inputs :
|
||||
// k = Hash key
|
||||
// obj = Object pointer
|
||||
// d = Deletion function
|
||||
//
|
||||
// Output : 0 on success, -1 if item is already in hash table.
|
||||
//
|
||||
// Side Effects :
|
||||
// Adds an entry to the hash table
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
int Hash::add(const char *k, void *obj, void (*d)(void *)) {
|
||||
|
||||
int hv;
|
||||
Node *n,*prev;
|
||||
|
||||
hv = h1(k); // Get hash value
|
||||
n = hashtable[hv];
|
||||
prev = n;
|
||||
while (n) {
|
||||
if (strcmp(n->key,k) == 0) return -1; // Already in hash table
|
||||
prev = n;
|
||||
n = n->next;
|
||||
}
|
||||
|
||||
// Safe to add this to the table
|
||||
|
||||
n = new Node(k,obj,d);
|
||||
if (prev) prev->next = n;
|
||||
else hashtable[hv] = n;
|
||||
DOH *v = NewVoid(obj,d);
|
||||
if (Getattr(data, (DOH *) k)) return -1;
|
||||
Setattr(data, (DOH *) k, v);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// void *Hash::lookup(const char *k)
|
||||
//
|
||||
// Looks up a value in the hash table. Returns a pointer to the object if found.
|
||||
//
|
||||
// Inputs : k = key value
|
||||
//
|
||||
// Output : Pointer to object or NULL if not found.
|
||||
//
|
||||
// Side Effects : None
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void *Hash::lookup(const char *k) {
|
||||
int hv;
|
||||
Node *n;
|
||||
DOH *v;
|
||||
v = Getattr(data,(DOH *)k);
|
||||
if (!v) return 0;
|
||||
return Data(v);
|
||||
}
|
||||
|
||||
hv = h1(k); // Get hash value
|
||||
n = hashtable[hv];
|
||||
void Hash::remove(const char *k) {
|
||||
Delattr(data,(DOH *)k);
|
||||
}
|
||||
|
||||
while (n) {
|
||||
if (strcmp(n->key,k) == 0) return n->object;
|
||||
n = n->next;
|
||||
void *Hash::first() {
|
||||
DOH *o;
|
||||
DOH *v = Firstkey(data);
|
||||
if (v) {
|
||||
o = Getattr(data,v);
|
||||
return Data(o);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// void Hash::remove(const char *k)
|
||||
//
|
||||
// Removes an item from the hash table. Does nothing if item isn't in the
|
||||
// hash table to begin with.
|
||||
//
|
||||
// Inputs : k = Key value
|
||||
//
|
||||
// Output : None
|
||||
//
|
||||
// Side Effects : Deletes item from hash table.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void Hash::remove(const char *k) {
|
||||
|
||||
int hv;
|
||||
Node *n,*prev;
|
||||
|
||||
hv = h1(k); // Get hash value
|
||||
n = hashtable[hv];
|
||||
prev = 0;
|
||||
while (n) {
|
||||
if (strcmp(n->key,k) == 0) {
|
||||
// Found it, kill the thing
|
||||
if (prev) {
|
||||
prev->next = n->next;
|
||||
} else {
|
||||
hashtable[hv] = n->next;
|
||||
}
|
||||
delete n;
|
||||
return;
|
||||
}
|
||||
prev = n;
|
||||
n = n->next;
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// void *Hash::first()
|
||||
//
|
||||
// Gets the first item from the hash table or NULL if empty.
|
||||
//
|
||||
// Inputs : None
|
||||
//
|
||||
// Output : First object in hash table or NULL if hash table is empty.
|
||||
//
|
||||
// Side Effects : Resets an internal iterator variable on the hash table.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void *Hash::first() {
|
||||
index = 0;
|
||||
current = 0;
|
||||
|
||||
while (!hashtable[index] && (index < hashsize))
|
||||
index++;
|
||||
|
||||
if (index >= hashsize) return 0;
|
||||
current = hashtable[index];
|
||||
return current->object;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// char *Hash::firstkey()
|
||||
//
|
||||
// Gets the first key from the hash table or NULL if empty.
|
||||
//
|
||||
// Inputs : None
|
||||
//
|
||||
// Output : First key in hash table or NULL if hash table is empty.
|
||||
//
|
||||
// Side Effects : Resets an internal iterator variable on the hash table.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
char *Hash::firstkey() {
|
||||
index = 0;
|
||||
current = 0;
|
||||
|
||||
while ((index < hashsize) && (!hashtable[index]))
|
||||
index++;
|
||||
|
||||
if (index >= hashsize) return 0;
|
||||
current = hashtable[index];
|
||||
return current->key;
|
||||
DOH *v = Firstkey(data);
|
||||
if (v) {
|
||||
return Char(v);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// void *Hash::next()
|
||||
//
|
||||
// Returns the next item in the hash table or NULL if there are no more entries.
|
||||
// A call to first() should generally be made before using this function.
|
||||
//
|
||||
// Inputs : None
|
||||
//
|
||||
// Output : Pointer to next object or NULL if there are no more objects.
|
||||
//
|
||||
// Side Effects : Updates an iterator variable private to the hash table.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void *Hash::next() {
|
||||
if (index < 0) return first();
|
||||
|
||||
// Try to move to the next entry
|
||||
|
||||
current = current->next;
|
||||
|
||||
if (current) {
|
||||
return current->object;
|
||||
} else {
|
||||
index++;
|
||||
while ((index < hashsize) && (!hashtable[index]))
|
||||
index++;
|
||||
if (index >= hashsize) return 0;
|
||||
current = hashtable[index];
|
||||
return current->object;
|
||||
DOH *o;
|
||||
DOH *v = Nextkey(data);
|
||||
if (v) {
|
||||
o = Getattr(data,v);
|
||||
return Data(o);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// char *Hash::nextkey()
|
||||
//
|
||||
// Returns the next key in the hash table or NULL if there are no more entries.
|
||||
// A call to firstkey() should generally be made before using this function.
|
||||
//
|
||||
// Inputs : None
|
||||
//
|
||||
// Output : Pointer to next key or NULL if there are no more objects.
|
||||
//
|
||||
// Side Effects : Updates an iterator variable private to the hash table.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
char *Hash::nextkey() {
|
||||
if (index < 0) return firstkey();
|
||||
|
||||
// Try to move to the next entry
|
||||
|
||||
current = current->next;
|
||||
|
||||
if (current) {
|
||||
return current->key;
|
||||
} else {
|
||||
index++;
|
||||
while (!hashtable[index] && (index < hashsize))
|
||||
index++;
|
||||
if (index >= hashsize) return 0;
|
||||
current = hashtable[index];
|
||||
return current->key;
|
||||
DOH *v = Nextkey(data);
|
||||
if (v) {
|
||||
return Char(v);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,492 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Simplified Wrapper and Interface Generator (SWIG)
|
||||
*
|
||||
* Author : David Beazley
|
||||
*
|
||||
* Department of Computer Science
|
||||
* University of Chicago
|
||||
* 1100 E 58th Street
|
||||
* Chicago, IL 60637
|
||||
* beazley@cs.uchicago.edu
|
||||
*
|
||||
* Please read the file LICENSE for the copyright and terms by which SWIG
|
||||
* can be used and distributed.
|
||||
*******************************************************************************/
|
||||
|
||||
/***********************************************************************
|
||||
* $Header$
|
||||
*
|
||||
* latex.c
|
||||
*
|
||||
* Latex specific functions for producing documentation.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#include "swig.h"
|
||||
#include "latex.h"
|
||||
|
||||
static char cvsroot[] = "$Header$";
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// LATEX::LATEX()
|
||||
//
|
||||
// Create new LaTeX handler
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
LATEX::LATEX() {
|
||||
sect_count = 0;
|
||||
|
||||
tag_pagestyle = "\\pagestyle{headings}";
|
||||
tag_parindent = "0.0in";
|
||||
tag_textwidth = "6.5in";
|
||||
tag_documentstyle = "[11pt]{article}";
|
||||
tag_oddsidemargin = "0.0in";
|
||||
tag_title = "{\\Large \\bf : }";
|
||||
tag_preformat = "{\\small \\begin{verbatim}:\\end{verbatim}}";
|
||||
tag_usage = "{\\tt \\bf : }";
|
||||
tag_descrip = "\\\\\n\\makebox[0.5in]{}\\begin{minipage}[t]{6in}:\n\\end{minipage}\\\\\n";
|
||||
tag_text = ":\\\\";
|
||||
tag_cinfo = "{\\tt : }\\\\";
|
||||
tag_section = "\\section{:}";
|
||||
tag_subsection="\\subsection{:}";
|
||||
tag_subsubsection="\\subsubsection{:}";
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// char *start_tag(char *tag) {
|
||||
//
|
||||
// Returns the start of a tag
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
char *LATEX::start_tag(char *tag) {
|
||||
static String stag;
|
||||
char *c;
|
||||
|
||||
stag = "";
|
||||
c = tag;
|
||||
while ((*c) && (*c != ':')) {
|
||||
stag << *c;
|
||||
c++;
|
||||
}
|
||||
return stag.get();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// char *end_tag(char *tag) {
|
||||
//
|
||||
// Returns the end of a tag
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
char *LATEX::end_tag(char *tag) {
|
||||
static String etag;
|
||||
char *c;
|
||||
|
||||
etag = "";
|
||||
c = tag;
|
||||
while ((*c) && (*c != ':')) {
|
||||
c++;
|
||||
}
|
||||
if (*c) {
|
||||
c++;
|
||||
while (*c) {
|
||||
etag << *c;
|
||||
c++;
|
||||
}
|
||||
}
|
||||
return etag.get();
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// LATEX::print_string(char *s, String &str)
|
||||
//
|
||||
// Dumps string s to str, but performs some LaTeX character replacements
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
void LATEX::print_string(char *s, String &str) {
|
||||
|
||||
char *c;
|
||||
c = s;
|
||||
while (*c) {
|
||||
switch(*c) {
|
||||
case '*':
|
||||
case '<':
|
||||
case '>':
|
||||
case '+':
|
||||
case '=':
|
||||
case '|':
|
||||
str << "$" << *c << "$";
|
||||
break;
|
||||
case '\\':
|
||||
str << "\\\\";
|
||||
break;
|
||||
case '_':
|
||||
str << "\\_";
|
||||
break;
|
||||
case '%':
|
||||
str << "\\%";
|
||||
break;
|
||||
case '$':
|
||||
str << "\\$";
|
||||
break;
|
||||
case '&':
|
||||
str << "\\&";
|
||||
break;
|
||||
case '#':
|
||||
str << "\\#";
|
||||
break;
|
||||
case '\n':
|
||||
str << "\\\\\n";
|
||||
break;
|
||||
default :
|
||||
str << *c;
|
||||
break;
|
||||
}
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// LATEX::print_decl(DocEntry *)
|
||||
//
|
||||
// Print a documentation entry
|
||||
// --------------------------------------------------------------
|
||||
|
||||
void LATEX::print_decl(DocEntry *de) {
|
||||
|
||||
char *c;
|
||||
|
||||
c = de->usage.get();
|
||||
|
||||
if (c) {
|
||||
s_doc << start_tag(tag_usage);
|
||||
print_string(c,s_doc);
|
||||
s_doc << end_tag(tag_usage) << "\n";
|
||||
}
|
||||
|
||||
// Check to see if there any information available
|
||||
|
||||
if ((strlen(de->cinfo.get()) && de->print_info) || strlen(de->text.get())) {
|
||||
|
||||
// There is additional information now. If we're in preformatting mode,
|
||||
// we need to handle things differently
|
||||
|
||||
s_doc << start_tag(tag_descrip) << "\n";
|
||||
|
||||
if (!de->format) {
|
||||
// Verbatim mode
|
||||
s_doc << start_tag(tag_preformat) << "\n";
|
||||
|
||||
// If there is any C annotation, print that
|
||||
if (de->print_info) {
|
||||
c = de->cinfo.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << "[ " << c << " ]\n";
|
||||
}
|
||||
}
|
||||
c = de->text.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << c;
|
||||
}
|
||||
s_doc << end_tag(tag_preformat) << "\n";
|
||||
} else {
|
||||
// We are in format mode now
|
||||
// We need to emit some stubs for the description format
|
||||
|
||||
// If there is any C annotation, print that
|
||||
if (de->print_info) {
|
||||
c = de->cinfo.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << start_tag(tag_cinfo) << "[ ";
|
||||
print_string(c,s_doc);
|
||||
s_doc << " ] " << end_tag(tag_cinfo) << "\n";
|
||||
}
|
||||
}
|
||||
// Print out descriptive text (if any).
|
||||
c = de->text.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << c << "\\\\\n";
|
||||
}
|
||||
}
|
||||
s_doc << end_tag(tag_descrip) << "\n";
|
||||
} else {
|
||||
s_doc << "\\\\\n"; // No description available, move to next line
|
||||
}
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------
|
||||
// LATEX::print_text(DocEntry *de)
|
||||
//
|
||||
// Print out some text. We use verbatim mode because of formatting
|
||||
// problems.
|
||||
// --------------------------------------------------------------
|
||||
|
||||
void LATEX::print_text(DocEntry *de) {
|
||||
char *c;
|
||||
c = de->text.get();
|
||||
if (strlen(c) > 0) {
|
||||
if (de->format) {
|
||||
s_doc << start_tag(tag_text) << "\n";
|
||||
s_doc << c;
|
||||
s_doc << end_tag(tag_text) << "\n\n";
|
||||
} else {
|
||||
s_doc << start_tag(tag_preformat) << "\n";
|
||||
s_doc << c;
|
||||
s_doc << end_tag(tag_preformat) << "\n\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LATEX::title(DocEntry *de) {
|
||||
char *c;
|
||||
|
||||
c = de->usage.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << start_tag(tag_title) << " ";
|
||||
print_string(c,s_doc);
|
||||
s_doc << end_tag(tag_title) << "\\\\\n";
|
||||
}
|
||||
|
||||
// Print out any C annotation and descriptive text
|
||||
// Check to see if there any information available
|
||||
|
||||
if ((strlen(de->cinfo.get()) && de->print_info) || strlen(de->text.get())) {
|
||||
|
||||
// There is additional information now. If we're in preformatting mode,
|
||||
// we need to handle things differently
|
||||
|
||||
if (!de->format) {
|
||||
// Verbatim mode
|
||||
s_doc << start_tag(tag_preformat) << "\n";
|
||||
|
||||
// If there is any C annotation, print that
|
||||
if (de->print_info) {
|
||||
c = de->cinfo.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << "[ " << c << " ]\n";
|
||||
}
|
||||
}
|
||||
|
||||
c = de->text.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << c;
|
||||
}
|
||||
s_doc << end_tag(tag_preformat) << "\n\n";
|
||||
} else {
|
||||
// We are in format mode now
|
||||
// We need to emit some stubs for the description format
|
||||
s_doc << start_tag(tag_text);
|
||||
|
||||
// If there is any C annotation, print that
|
||||
if (de->print_info) {
|
||||
c = de->cinfo.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << start_tag(tag_cinfo) << "[ ";
|
||||
print_string(c,s_doc);
|
||||
s_doc << " ] " << end_tag(tag_cinfo) << "\n";
|
||||
}
|
||||
}
|
||||
// Print out descriptive text (if any).
|
||||
c = de->text.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << c;
|
||||
}
|
||||
s_doc << end_tag(tag_text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LATEX::newsection(DocEntry *de,int sectnum) {
|
||||
char *c;
|
||||
char *tag;
|
||||
|
||||
sect_num[sect_count] = sectnum;
|
||||
sect_count++;
|
||||
switch (sect_count) {
|
||||
case 1: /* Section */
|
||||
tag = tag_section;
|
||||
break;
|
||||
case 2: /* Subsection */
|
||||
tag = tag_subsection;
|
||||
break;
|
||||
default: /* subsubsection */
|
||||
tag = tag_subsubsection;
|
||||
break;
|
||||
}
|
||||
|
||||
s_doc << start_tag(tag);
|
||||
c = de->usage.get();
|
||||
print_string(c,s_doc);
|
||||
s_doc << end_tag(tag);
|
||||
|
||||
|
||||
// Print out any C annotation and descriptive text
|
||||
// Check to see if there any information available
|
||||
|
||||
if ((strlen(de->cinfo.get()) && de->print_info) || strlen(de->text.get())) {
|
||||
|
||||
// There is additional information now. If we're in preformatting mode,
|
||||
// we need to handle things differently
|
||||
|
||||
if (!de->format) {
|
||||
// Verbatim mode
|
||||
s_doc << start_tag(tag_preformat) << "\n";
|
||||
|
||||
// If there is any C annotation, print that
|
||||
if (de->print_info) {
|
||||
c = de->cinfo.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << "[ " << c << " ]\n";
|
||||
}
|
||||
}
|
||||
|
||||
c = de->text.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << c;
|
||||
}
|
||||
s_doc << end_tag(tag_preformat) << "\n\n";
|
||||
} else {
|
||||
// We are in format mode now
|
||||
// We need to emit some stubs for the description format
|
||||
|
||||
s_doc << start_tag(tag_text);
|
||||
// If there is any C annotation, print that
|
||||
if (de->print_info) {
|
||||
c = de->cinfo.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << start_tag(tag_cinfo) << "[ ";
|
||||
print_string(c,s_doc);
|
||||
s_doc << " ] " << end_tag(tag_cinfo) << "\n";
|
||||
}
|
||||
}
|
||||
// Print out descriptive text (if any).
|
||||
c = de->text.get();
|
||||
if (strlen(c) > 0) {
|
||||
s_doc << c;
|
||||
}
|
||||
s_doc << end_tag(tag_text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LATEX::endsection() {
|
||||
if (sect_count > 0) sect_count--;
|
||||
}
|
||||
|
||||
void LATEX::separator() {
|
||||
}
|
||||
|
||||
void LATEX::init(char *filename) {
|
||||
char f[256];
|
||||
|
||||
sprintf(f,"%s.tex",filename);
|
||||
sprintf(fn,"%s",filename);
|
||||
f_doc = fopen(f,"w");
|
||||
if (f_doc == NULL) {
|
||||
fprintf(stderr, "Unable to open %s\n", fn);
|
||||
SWIG_exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
void LATEX::close(void) {
|
||||
|
||||
fprintf(f_doc,"\\documentstyle%s\n",tag_documentstyle);
|
||||
fprintf(f_doc,"\\setlength{\\parindent}{%s}\n",tag_parindent);
|
||||
fprintf(f_doc,"\\setlength{\\textwidth}{%s}\n",tag_textwidth);
|
||||
fprintf(f_doc,"\\setlength{\\oddsidemargin}{%s}\n",tag_oddsidemargin);
|
||||
fprintf(f_doc,"%s\n",tag_pagestyle);
|
||||
fprintf(f_doc,"\\begin{document}\n");
|
||||
fprintf(f_doc,"%s\n",s_doc.get());
|
||||
fprintf(f_doc,"\\end{document}\n");
|
||||
fclose(f_doc);
|
||||
if (Verbose)
|
||||
fprintf(stderr,"Documentation written to %s.tex\n", fn);
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// LATEX::style(char *name, char *value)
|
||||
//
|
||||
// Process style parameters
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
void LATEX::style(char *name, char *value) {
|
||||
if (strcmp(name,"latex_title") == 0) {
|
||||
if (value)
|
||||
tag_title = copy_string(value);
|
||||
} else if (strcmp(name,"latex_pagestyle") == 0) {
|
||||
if (value)
|
||||
tag_pagestyle = copy_string(value);
|
||||
} else if (strcmp(name,"latex_section") == 0) {
|
||||
if (value)
|
||||
tag_section = copy_string(value);
|
||||
} else if (strcmp(name,"latex_subsection") == 0) {
|
||||
if (value)
|
||||
tag_subsection = copy_string(value);
|
||||
} else if (strcmp(name,"latex_subsubsection") == 0) {
|
||||
if (value)
|
||||
tag_subsubsection = copy_string(value);
|
||||
} else if (strcmp(name,"latex_usage") == 0) {
|
||||
if (value)
|
||||
tag_usage = copy_string(value);
|
||||
} else if (strcmp(name,"latex_descrip") == 0) {
|
||||
if (value)
|
||||
tag_descrip = copy_string(value);
|
||||
} else if (strcmp(name,"latex_text") == 0) {
|
||||
if (value)
|
||||
tag_text = copy_string(value);
|
||||
} else if (strcmp(name,"latex_cinfo") == 0) {
|
||||
if (value)
|
||||
tag_cinfo = copy_string(value);
|
||||
} else if (strcmp(name,"latex_preformat") == 0) {
|
||||
if (value)
|
||||
tag_preformat = copy_string(value);
|
||||
} else if (strcmp(name,"latex_parindent") == 0) {
|
||||
if (value)
|
||||
tag_parindent = copy_string(value);
|
||||
} else if (strcmp(name,"latex_textwidth") == 0) {
|
||||
if (value)
|
||||
tag_textwidth = copy_string(value);
|
||||
} else if (strcmp(name,"latex_documentstyle") == 0) {
|
||||
if (value)
|
||||
tag_documentstyle = copy_string(value);
|
||||
} else if (strcmp(name,"latex_oddsidemargin") == 0) {
|
||||
if (value)
|
||||
tag_oddsidemargin = copy_string(value);
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// LATEX::parse_args(int argc, char **argv)
|
||||
//
|
||||
// Parse command line options
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
static char *latex_usage = "\
|
||||
LATEX Documentation Options (available with -dlatex)\n\
|
||||
None available.\n\n";
|
||||
|
||||
void LATEX::parse_args(int argc, char **argv) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < argc; i++) {
|
||||
if (argv[i]) {
|
||||
if (strcmp(argv[i],"-help") == 0) {
|
||||
fputs(latex_usage,stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* Simplified Wrapper and Interface Generator (SWIG)
|
||||
*
|
||||
* Author : David Beazley
|
||||
*
|
||||
* Department of Computer Science
|
||||
* University of Chicago
|
||||
* 1100 E 58th Street
|
||||
* Chicago, IL 60637
|
||||
* beazley@cs.uchicago.edu
|
||||
*
|
||||
* Please read the file LICENSE for the copyright and terms by which SWIG
|
||||
* can be used and distributed.
|
||||
*******************************************************************************/
|
||||
/***********************************************************************
|
||||
* $Header$
|
||||
*
|
||||
* latex.h
|
||||
*
|
||||
* Latex specific functions for producing documentation.
|
||||
***********************************************************************/
|
||||
class LATEX : public Documentation {
|
||||
private:
|
||||
FILE *f_doc;
|
||||
String s_doc;
|
||||
char fn[256];
|
||||
char *start_tag(char *);
|
||||
char *end_tag(char *);
|
||||
void print_string(char *s, String &str);
|
||||
int sect_count; // Section counter
|
||||
int sect_num[20]; // Section numbers
|
||||
// Style parameters
|
||||
|
||||
char *tag_parindent;
|
||||
char *tag_textwidth;
|
||||
char *tag_documentstyle;
|
||||
char *tag_oddsidemargin;
|
||||
char *tag_title;
|
||||
char *tag_preformat;
|
||||
char *tag_usage;
|
||||
char *tag_descrip;
|
||||
char *tag_text;
|
||||
char *tag_cinfo;
|
||||
char *tag_pagestyle;
|
||||
char *tag_section;
|
||||
char *tag_subsection;
|
||||
char *tag_subsubsection;
|
||||
|
||||
public:
|
||||
LATEX();
|
||||
void parse_args(int argc, char **argv);
|
||||
void title(DocEntry *de);
|
||||
void newsection(DocEntry *de, int sectnum);
|
||||
void endsection();
|
||||
void print_decl(DocEntry *de);
|
||||
void print_text(DocEntry *de);
|
||||
void separator();
|
||||
void init(char *filename);
|
||||
void close(void);
|
||||
void style(char *name, char *value);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -27,7 +27,6 @@ static char cvsroot[] = "$Header$";
|
|||
|
||||
#include "internal.h"
|
||||
#include "ascii.h"
|
||||
#include "latex.h"
|
||||
#include "html.h"
|
||||
#include "nodoc.h"
|
||||
#include <time.h>
|
||||
|
|
@ -43,7 +42,6 @@ static char *usage = "\
|
|||
\nDocumentation Options\n\
|
||||
-dascii - ASCII documentation.\n\
|
||||
-dhtml - HTML documentation.\n\
|
||||
-dlatex - LaTeX documentation.\n\
|
||||
-dnone - No documentation.\n\n\
|
||||
General Options\n\
|
||||
-c - Produce raw wrapper code (omit support code)\n\
|
||||
|
|
@ -209,9 +207,6 @@ int SWIG_main(int argc, char *argv[], Language *l, Documentation *d) {
|
|||
} else if (strcmp(argv[i],"-dhtml") == 0) {
|
||||
doc = new HTML;
|
||||
mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-dlatex") == 0) {
|
||||
doc = new LATEX;
|
||||
mark_arg(i);
|
||||
} else if (strcmp(argv[i],"-nocomment") == 0) {
|
||||
ignorecomments = 1;
|
||||
mark_arg(i);
|
||||
|
|
|
|||
|
|
@ -116,28 +116,7 @@ public:
|
|||
|
||||
class Hash {
|
||||
private:
|
||||
struct Node {
|
||||
Node(const char *k, void *obj, void (*d)(void *)) {
|
||||
key = new char[strlen(k)+1];
|
||||
strcpy(key,k);
|
||||
object = obj;
|
||||
del_proc = d;
|
||||
next = 0;
|
||||
};
|
||||
~Node() {
|
||||
delete key;
|
||||
if (del_proc) (*del_proc)(object);
|
||||
};
|
||||
char *key;
|
||||
void *object;
|
||||
struct Node *next;
|
||||
void (*del_proc)(void *);
|
||||
};
|
||||
int h1(const char *key); // Hashing function
|
||||
int hashsize; // Size of hash table
|
||||
Node **hashtable; // Actual hash table
|
||||
int index; // Current index (used by iterators)
|
||||
Node *current; // Current item in hash table
|
||||
void *data;
|
||||
public:
|
||||
Hash();
|
||||
~Hash();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue