Removed DOH/Include

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4161 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2002-12-06 20:26:55 +00:00
commit 1cd4a401d0
9 changed files with 19 additions and 20 deletions

View file

@ -23,7 +23,7 @@ INCLUDES = -I$(srcdir)/../Include \
-I$(srcdir)/. \
-I$(srcdir)/../Swig \
-I$(srcdir)/../Preprocessor \
-I$(srcdir)/../DOH/Include \
-I$(srcdir)/../DOH \
-I../Include \
-I.

View file

@ -1 +0,0 @@
Makefile

View file

@ -1,9 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
#include "doh.h"
#include "dohobj.h"

View file

@ -28,9 +28,9 @@ LIBOBJS = void.@OBJEXT@ fio.@OBJEXT@ memory.@OBJEXT@ base.@OBJEXT@ file.@OBJEXT@
LIBSRCS = void.c fio.c memory.c base.c file.c list.c hash.c string.c
LIBHEADERS = $(srcdir)/Include/doh.h
LIBHEADERS = $(srcdir)/doh.h
LIB = libdoh.a
INCLUDES = -I$(srcdir)/Include
INCLUDES = -I$(srcdir)
CFLAGS = @CFLAGS@
SHELL = /bin/sh

382
SWIG/Source/DOH/doh.h Normal file
View file

@ -0,0 +1,382 @@
/* -----------------------------------------------------------------------------
* doh.h
*
* This file describes of the externally visible functions in DOH.
*
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
*
* Copyright (C) 1999-2000. The University of Chicago
* See the file LICENSE for information on usage and redistribution.
*
* $Header$
* ----------------------------------------------------------------------------- */
#ifndef _DOH_H
#define _DOH_H
/* Set the namespace prefix for DOH API functions. This can be used to control
visibility of the functions in libraries */
/* Set this macro if you want to change DOH linkage. You would do this if you
wanted to hide DOH in a library using a different set of names. Note: simply
change "Doh" to a new name. */
/*
#define DOH_NAMESPACE(x) Doh ## x
*/
#ifdef DOH_NAMESPACE
/* Namespace control. These macros define all of the public API names in DOH */
#define DohCheck DOH_NAMESPACE(Check)
#define DohIntern DOH_NAMESPACE(Intern)
#define DohDelete DOH_NAMESPACE(Delete)
#define DohCopy DOH_NAMESPACE(Copy)
#define DohClear DOH_NAMESPACE(Clear)
#define DohStr DOH_NAMESPACE(Str)
#define DohData DOH_NAMESPACE(Data)
#define DohDump DOH_NAMESPACE(Dump)
#define DohLen DOH_NAMESPACE(Len)
#define DohHashval DOH_NAMESPACE(Hashval)
#define DohCmp DOH_NAMESPACE(Cmp)
#define DohIncref DOH_NAMESPACE(Incref)
#define DohGetattr DOH_NAMESPACE(Getattr)
#define DohSetattr DOH_NAMESPACE(Setattr)
#define DohDelattr DOH_NAMESPACE(Delattr)
#define DohFirstkey DOH_NAMESPACE(Firstkey)
#define DohNextkey DOH_NAMESPACE(Nextkey)
#define DohKeys DOH_NAMESPACE(Keys)
#define DohGetInt DOH_NAMESPACE(GetInt)
#define DohGetDouble DOH_NAMESPACE(GetDouble)
#define DohGetChar DOH_NAMESPACE(GetChar)
#define DohSetChar DOH_NAMESPACE(SetChar)
#define DohSetInt DOH_NAMESPACE(SetInt)
#define DohSetDouble DOH_NAMESPACE(SetDouble)
#define DohSetVoid DOH_NAMESPACE(SetVoid)
#define DohGetVoid DOH_NAMESPACE(GetVoid)
#define DohGetitem DOH_NAMESPACE(Getitem)
#define DohSetitem DOH_NAMESPACE(Setitem)
#define DohDelitem DOH_NAMESPACE(Delitem)
#define DohInsertitem DOH_NAMESPACE(Insertitem)
#define DohFirstitem DOH_NAMESPACE(Firstitem)
#define DohNextitem DOH_NAMESPACE(Nextitem)
#define DohWrite DOH_NAMESPACE(Write)
#define DohRead DOH_NAMESPACE(Read)
#define DohSeek DOH_NAMESPACE(Seek)
#define DohTell DOH_NAMESPACE(Tell)
#define DohGetc DOH_NAMESPACE(Getc)
#define DohPutc DOH_NAMESPACE(Putc)
#define DohUngetc DOH_NAMESPACE(Ungetc)
#define DohGetline DOH_NAMESPACE(Getline)
#define DohSetline DOH_NAMESPACE(Setline)
#define DohGetfile DOH_NAMESPACE(Getfile)
#define DohSetfile DOH_NAMESPACE(Setfile)
#define DohReplace DOH_NAMESPACE(Replace)
#define DohChop DOH_NAMESPACE(Chop)
#define DohGetmeta DOH_NAMESPACE(Getmeta)
#define DohSetmeta DOH_NAMESPACE(Setmeta)
#define DohDelmeta DOH_NAMESPACE(Delmeta)
#define DohEncoding DOH_NAMESPACE(Encoding)
#define DohPrintf DOH_NAMESPACE(Printf)
#define DohvPrintf DOH_NAMESPACE(vPrintf)
#define DohPrintv DOH_NAMESPACE(Printv)
#define DohReadline DOH_NAMESPACE(Readline)
#define DohIsMapping DOH_NAMESPACE(IsMapping)
#define DohIsSequence DOH_NAMESPACE(IsSequence)
#define DohIsString DOH_NAMESPACE(IsString)
#define DohIsFile DOH_NAMESPACE(IsFile)
#define DohNewString DOH_NAMESPACE(NewString)
#define DohNewStringf DOH_NAMESPACE(NewStringf)
#define DohStrcmp DOH_NAMESPACE(Strcmp)
#define DohStrncmp DOH_NAMESPACE(Strncmp)
#define DohStrstr DOH_NAMESPACE(Strstr)
#define DohStrchr DOH_NAMESPACE(Strchr)
#define DohNewFile DOH_NAMESPACE(NewFile)
#define DohNewFileFromFile DOH_NAMESPACE(NewFileFromFile)
#define DohNewFileFromFd DOH_NAMESPACE(NewFileFromFd)
#define DohClose DOH_NAMESPACE(Close)
#define DohCopyto DOH_NAMESPACE(Copyto)
#define DohNewList DOH_NAMESPACE(NewList)
#define DohNewHash DOH_NAMESPACE(NewHash)
#define DohNewVoid DOH_NAMESPACE(NewVoid)
#define DohSplit DOH_NAMESPACE(Split)
#define DohNone DOH_NAMESPACE(None)
#define DohObjMalloc DOH_NAMESPACE(ObjMalloc)
#define DohObjFree DOH_NAMESPACE(ObjFree)
#define DohStringType DOH_NAMESPACE(StringType)
#define DohListType DOH_NAMESPACE(ListType)
#define DohHashType DOH_NAMESPACE(HashType)
#define DohFileType DOH_NAMESPACE(FileType)
#define DohVoidType DOH_NAMESPACE(VoidType)
#endif
#include <stdio.h>
#include <stdarg.h>
#define DOH_MAJOR_VERSION 0
#define DOH_MINOR_VERSION 1
typedef void DOH;
/*
* With dynamic typing, all DOH objects are technically of type 'void *'.
* However, to clarify the reading of source code, the following symbolic
* names are used.
*/
#define DOHString DOH
#define DOHList DOH
#define DOHHash DOH
#define DOHFile DOH
#define DOHVoid DOH
#define DOHString_or_char DOH
#define DOHObj_or_char DOH
#define DOH_BEGIN -1
#define DOH_END -2
#define DOH_CUR -3
#define DOH_CURRENT -3
/* Memory management */
#ifndef DohMalloc
#define DohMalloc malloc
#endif
#ifndef DohRealloc
#define DohRealloc realloc
#endif
#ifndef DohFree
#define DohFree free
#endif
extern int DohCheck(const DOH *ptr); /* Check if a DOH object */
extern void DohIntern(DOH *); /* Intern an object */
/* Basic object methods. Common to most objects */
extern void DohDelete(DOH *obj); /* Delete an object */
extern DOH *DohCopy(const DOH *obj);
extern void DohClear(DOH *obj);
extern DOHString *DohStr(const DOH *obj);
extern void *DohData(const DOH *obj);
extern int DohDump(const DOH *obj, DOHFile *out);
extern int DohLen(const DOH *obj);
extern int DohHashval(const DOH *obj);
extern int DohCmp(const DOH *obj1, const DOH *obj2);
extern void DohIncref(DOH *obj);
/* Mapping methods */
extern DOH *DohGetattr(DOH *obj, const DOHString_or_char *name);
extern int DohSetattr(DOH *obj, const DOHString_or_char *name, const DOHObj_or_char *value);
extern int DohDelattr(DOH *obj, const DOHString_or_char *name);
extern DOH *DohFirstkey(DOH *obj);
extern DOH *DohNextkey(DOH *obj);
extern DOH *DohKeys(DOH *obj);
extern int DohGetInt(DOH *obj, const DOHString_or_char *name);
extern double DohGetDouble(DOH *obj, const DOHString_or_char *name);
extern char *DohGetChar(DOH *obj, const DOHString_or_char *name);
extern void DohSetInt(DOH *obj, const DOHString_or_char *name, int);
extern void DohSetDouble(DOH *obj, const DOHString_or_char *name, double);
extern void *DohGetVoid(DOH *obj, const DOHString_or_char *name);
extern void DohSetVoid(DOH *obj, const DOHString_or_char *name, void *value);
/* Sequence methods */
extern DOH *DohGetitem(DOH *obj, int index);
extern int DohSetitem(DOH *obj, int index, const DOHObj_or_char *value);
extern int DohDelitem(DOH *obj, int index);
extern int DohInsertitem(DOH *obj, int index, const DOHObj_or_char *value);
extern DOH *DohFirstitem(DOH *obj);
extern DOH *DohNextitem(DOH *obj);
/* File methods */
extern int DohWrite(DOHFile *obj, void *buffer, int length);
extern int DohRead(DOHFile *obj, void *buffer, int length);
extern int DohSeek(DOHFile *obj, long offset, int whence);
extern long DohTell(DOHFile *obj);
extern int DohGetc(DOHFile *obj);
extern int DohPutc(int ch, DOHFile *obj);
extern int DohUngetc(int ch, DOHFile *obj);
/* Positional */
extern int DohGetline(DOH *obj);
extern void DohSetline(DOH *obj, int line);
extern DOH *DohGetfile(DOH *obj);
extern void DohSetfile(DOH *obj, DOH *file);
/* String Methods */
extern int DohReplace(DOHString *src, const DOHString_or_char *token, const DOHString_or_char *rep, int flags);
extern void DohChop(DOHString *src);
/* Meta-variables */
extern DOH *DohGetmeta(DOH *, const DOH *);
extern int DohSetmeta(DOH *, const DOH *, const DOH *value);
extern int DohDelmeta(DOH *, const DOH *);
/* Utility functions */
extern void DohEncoding(char *name, DOH *(*fn)(DOH *s));
extern int DohPrintf(DOHFile *obj, const char *format, ...);
extern int DohvPrintf(DOHFile *obj, const char *format, va_list ap);
extern int DohPrintv(DOHFile *obj, ...);
extern DOH *DohReadline(DOHFile *in);
/* Miscellaneous */
extern int DohIsMapping(const DOH *obj);
extern int DohIsSequence(const DOH *obj);
extern int DohIsString(const DOH *obj);
extern int DohIsFile(const DOH *obj);
extern void DohSetmark(DOH *obj, int x);
extern int DohGetmark(DOH *obj);
/* -----------------------------------------------------------------------------
* Strings.
* ----------------------------------------------------------------------------- */
extern DOHString *DohNewString(const DOH *c);
extern DOHString *DohNewStringf(const DOH *fmt, ...);
extern int DohStrcmp(const DOHString_or_char *s1, const DOHString_or_char *s2);
extern int DohStrncmp(const DOHString_or_char *s1, const DOHString_or_char *s2, int n);
extern char *DohStrstr(const DOHString_or_char *s1, const DOHString_or_char *s2);
extern char *DohStrchr(const DOHString_or_char *s1, int ch);
/* String replacement flags */
#define DOH_REPLACE_ANY 0x01
#define DOH_REPLACE_NOQUOTE 0x02
#define DOH_REPLACE_ID 0x04
#define DOH_REPLACE_FIRST 0x08
#define Replaceall(s,t,r) DohReplace(s,t,r,DOH_REPLACE_ANY)
#define Replaceid(s,t,r) DohReplace(s,t,r,DOH_REPLACE_ID)
/* -----------------------------------------------------------------------------
* Files
* ----------------------------------------------------------------------------- */
extern DOHFile *DohNewFile(DOH *file, const char *mode);
extern DOHFile *DohNewFileFromFile(FILE *f);
extern DOHFile *DohNewFileFromFd(int fd);
extern int DohClose(DOH *file);
extern int DohCopyto(DOHFile *input, DOHFile *output);
/* -----------------------------------------------------------------------------
* List
* ----------------------------------------------------------------------------- */
extern DOHList *DohNewList();
/* -----------------------------------------------------------------------------
* Hash
* ----------------------------------------------------------------------------- */
extern DOHHash *DohNewHash();
/* -----------------------------------------------------------------------------
* Void
* ----------------------------------------------------------------------------- */
extern DOHVoid *DohNewVoid(void *ptr, void (*del)(void *));
extern DOHList *DohSplit(DOHFile *input, char ch, int nsplits);
extern DOH *DohNone;
#ifndef DOH_LONG_NAMES
/* Macros to invoke the above functions. Includes the location of
the caller to simplify debugging if something goes wrong */
#define Delete DohDelete
#define Copy DohCopy
#define Clear DohClear
#define Str DohStr
#define Dump DohDump
#define Getattr DohGetattr
#define Setattr DohSetattr
#define Delattr DohDelattr
#define Hashval DohHashval
#define Getitem DohGetitem
#define Setitem DohSetitem
#define Delitem DohDelitem
#define Insert DohInsertitem
#define Append(s,x) DohInsertitem(s,DOH_END,x)
#define Push(s,x) DohInsertitem(s,DOH_BEGIN,x)
#define Len DohLen
#define Firstkey DohFirstkey
#define Nextkey DohNextkey
#define Data DohData
#define Char (char *) Data
#define Cmp DohCmp
#define Setline DohSetline
#define Getline DohGetline
#define Setfile DohSetfile
#define Getfile DohGetfile
#define Write DohWrite
#define Read DohRead
#define Seek DohSeek
#define Tell DohTell
#define Printf DohPrintf
#define Printv DohPrintv
#define Getc DohGetc
#define Putc DohPutc
#define Ungetc DohUngetc
#define Close DohClose
#define vPrintf DohvPrintf
#define GetInt DohGetInt
#define GetDouble DohGetDouble
#define GetChar DohGetChar
#define GetVoid DohGetVoid
#define SetInt DohSetInt
#define SetDouble DohSetDouble
#define SetChar DohSetattr
#define SetVoid DohSetVoid
#define Firstitem DohFirstitem
#define Nextitem DohNextitem
#define Readline DohReadline
#define Replace DohReplace
#define Chop DohChop
#define Getmeta DohGetmeta
#define Setmeta DohSetmeta
#define Delmeta DohDelmeta
#define NewString DohNewString
#define NewStringf DohNewStringf
#define NewHash DohNewHash
#define NewList DohNewList
#define NewFile DohNewFile
#define NewFileFromFile DohNewFileFromFile
#define NewFileFromFd DohNewFileFromFd
#define Close DohClose
#define NewVoid DohNewVoid
#define Keys DohKeys
#define Strcmp DohStrcmp
#define Strncmp DohStrncmp
#define Strstr DohStrstr
#define Strchr DohStrchr
#define Copyto DohCopyto
#define Split DohSplit
#define Setmark DohSetmark
#define Getmark DohGetmark
#define None DohNone
#endif
#ifdef NIL
#undef NIL
#endif
#define NIL (char *) NULL
#endif /* DOH_H */

133
SWIG/Source/DOH/dohint.h Normal file
View file

@ -0,0 +1,133 @@
/* -----------------------------------------------------------------------------
* dohint.h
*
* This file describes internally managed objects.
*
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
*
* Copyright (C) 1999-2000. The University of Chicago
* See the file LICENSE for information on usage and redistribution.
*
* $Header$
* ----------------------------------------------------------------------------- */
#ifndef _DOHINT_H
#define _DOHINT_H
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
#include "doh.h"
/* Hash objects */
typedef struct {
DOH *(*doh_getattr)(DOH *obj, DOH *name); /* Get attribute */
int (*doh_setattr)(DOH *obj, DOH *name, DOH *value); /* Set attribute */
int (*doh_delattr)(DOH *obj, DOH *name); /* Del attribute */
DOH *(*doh_firstkey)(DOH *obj); /* First key */
DOH *(*doh_nextkey)(DOH *obj); /* Next key */
DOH *(*doh_keys)(DOH *obj); /* All keys as a list */
} DohHashMethods;
/* List objects */
typedef struct {
DOH *(*doh_getitem)(DOH *obj, int index); /* Get item */
int (*doh_setitem)(DOH *obj, int index, DOH *value); /* Set item */
int (*doh_delitem)(DOH *obj, int index); /* Delete item */
int (*doh_insitem)(DOH *obj, int index, DOH *value); /* Insert item */
DOH *(*doh_firstitem)(DOH *obj); /* Iterators */
DOH *(*doh_nextitem)(DOH *obj);
} DohListMethods;
/* File methods */
typedef struct {
int (*doh_read)(DOH *obj, void *buffer, int nbytes); /* Read bytes */
int (*doh_write)(DOH *obj, void *buffer, int nbytes); /* Write bytes */
int (*doh_putc)(DOH *obj, int ch); /* Put character */
int (*doh_getc)(DOH *obj); /* Get character */
int (*doh_ungetc)(DOH *obj, int ch); /* Unget character */
int (*doh_seek)(DOH *obj, long offset, int whence); /* Seek */
long (*doh_tell)(DOH *obj); /* Tell */
int (*doh_close)(DOH *obj); /* Close */
} DohFileMethods;
/* String methods */
typedef struct {
int (*doh_replace)(DOH *obj, DOH *old, DOH *rep, int flags);
void (*doh_chop)(DOH *obj);
} DohStringMethods;
/* -----------------------------------------------------------------------------
* DohObjInfo
* ----------------------------------------------------------------------------- */
typedef struct DohObjInfo {
char *objname; /* Object name */
/* Basic object methods */
void (*doh_del)(DOH *obj); /* Delete object */
DOH *(*doh_copy)(DOH *obj); /* Copy and object */
void (*doh_clear)(DOH *obj); /* Clear an object */
/* I/O methods */
DOH *(*doh_str)(DOH *obj); /* Make a full string */
void *(*doh_data)(DOH *obj); /* Return raw data */
int (*doh_dump)(DOH *obj, DOH *out); /* Serialize on out */
/* Length and hash values */
int (*doh_len)(DOH *obj);
int (*doh_hashval)(DOH *obj);
/* Compare */
int (*doh_cmp)(DOH *obj1, DOH *obj2);
/* Positional */
void (*doh_setfile)(DOH *obj, DOHString_or_char *file);
DOH *(*doh_getfile)(DOH *obj);
void (*doh_setline)(DOH *obj, int line);
int (*doh_getline)(DOH *obj);
DohHashMethods *doh_hash; /* Hash methods */
DohListMethods *doh_list; /* List methods */
DohFileMethods *doh_file; /* File methods */
DohStringMethods *doh_string; /* String methods */
void *doh_reserved; /* Reserved */
void *clientdata; /* User data */
} DohObjInfo;
typedef struct {
void *data; /* Data pointer */
DohObjInfo *type;
void *meta; /* Meta data */
int flag_intern : 1; /* Interned object */
int flag_marked : 1; /* Mark flag. Used to avoid recursive loops in places */
int flag_user : 1; /* User flag */
int flag_usermark : 1; /* User marked */
int refcount : 28; /* Reference count (max 16 million) */
} DohBase;
/* Macros for decrefing and increfing (safe for null objects). */
#define Decref(a) if (a) ((DohBase *) a)->refcount--
#define Incref(a) if (a) ((DohBase *) a)->refcount++
#define Refcount(a) ((DohBase *) a)->refcount
/* Macros for manipulating objects in a safe manner */
#define ObjData(a) ((DohBase *)a)->data
#define ObjSetMark(a,x) ((DohBase *)a)->flag_marked = x
#define ObjGetMark(a) ((DohBase *)a)->flag_marked
#define ObjType(a) ((DohBase *)a)->type
extern DOH *DohObjMalloc(DohObjInfo *type, void *data); /* Allocate a DOH object */
extern void DohObjFree(DOH *ptr); /* Free a DOH object */
#endif /* DOHINT_H */

View file

@ -17,7 +17,7 @@ OBJS = main.@OBJEXT@ module.@OBJEXT@ emit.@OBJEXT@ overload.@OBJEXT@ lang.@O
SRCS = main.cxx module.cxx emit.cxx overload.cxx lang.cxx typepass.cxx allocate.cxx browser.cxx contract.cxx swigmain.cxx tcl8.cxx python.cxx perl5.cxx guile.cxx ruby.cxx mzscheme.cxx java.cxx php4.cxx ocaml.cxx xml.cxx pike.cxx s-exp.cxx
INCLUDES = -I$(srcdir)/../Include \
-I$(srcdir)/../DOH/Include \
-I$(srcdir)/../DOH \
-I$(srcdir)/../Preprocessor \
-I$(srcdir)/../Swig \
-I../Include

View file

@ -15,7 +15,7 @@ CC = @CC@
AR = @AR@
RANLIB = @RANLIB@
CFLAGS = @CFLAGS@
INCLUDES = -I$(srcdir)/. -I$(srcdir)/../Swig -I$(srcdir)/../DOH/Include -I$(srcdir)/../Include
INCLUDES = -I$(srcdir)/. -I$(srcdir)/../Swig -I$(srcdir)/../DOH -I$(srcdir)/../Include
TARGET = libcpp.a
.c.@OBJEXT@:

View file

@ -17,7 +17,7 @@ CC = @CC@
AR = @AR@
RANLIB = @RANLIB@
CFLAGS = @CFLAGS@
INCLUDES = -I$(srcdir)/. -I$(srcdir)/../DOH/Include -I$(srcdir)/../Include
INCLUDES = -I$(srcdir)/. -I$(srcdir)/../DOH -I$(srcdir)/../Include
TARGET = libswig.a
.c.@OBJEXT@: