*** empty log message ***

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@25 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 1999-11-19 16:26:26 +00:00
commit a12b8f43ac
9 changed files with 107 additions and 112 deletions

View file

@ -21,7 +21,7 @@
* Methods for base objects
*******************************************************************************/
#include "doh.h"
#include "dohint.h"
int doh_debug_level = 0;
@ -48,14 +48,15 @@ static DohObjInfo DohBaseType = {
0, /* doh_str */
0, /* doh_data */
0, /* doh_dump */
0, /* doh_load */
0, /* doh_len */
0, /* doh_hash */
0, /* doh_cmp */
0, /* doh_mapping */
0, /* doh_sequence */
0, /* doh_file */
0, /* reserved2 */
0, /* reserved3 */
0, /* doh_string */
0, /* doh_callable */
0, /* reserved4 */
0, /* reserved5 */
0, /* reserved6 */

View file

@ -13,7 +13,7 @@
* can be used and distributed.
****************************************************************************/
#include "doh.h"
#include "dohint.h"
/* ---------------------------------------------------------------------------
* $Header$
@ -53,24 +53,23 @@ static DohFileMethods FileFileMethods = {
};
static DohObjInfo FileType = {
"File", /* objname */
sizeof(File), /* objsize */
DelFile, /* sm_del */
0, /* sm_copy */
0, /* sm_clear */
0, /* sm_str */
0, /* doh_data */
0, /* doh_dump */
0, /* sm_len */
0, /* sm_hash */
0, /* doh_cmp */
0, /* doh_mapping */
0, /* doh_sequence */
&FileFileMethods,/* doh_file */
0,
0,
0,
0,
"File", /* objname */
sizeof(File), /* objsize */
DelFile, /* doh_del */
0, /* doh_copy */
0, /* doh_clear */
0, /* doh_str */
0, /* doh_data */
0, /* doh_dump */
0, /* doh_load */
0, /* doh_len */
0, /* doh_hash */
0, /* doh_cmp */
0, /* doh_mapping */
0, /* doh_sequence */
&FileFileMethods,/* doh_file */
0, /* doh_string */
0, /* doh_callable */
};
DohObjInfo *File_type() {

View file

@ -13,7 +13,7 @@
* can be used and distributed.
****************************************************************************/
#include "doh.h"
#include "dohint.h"
/* -----------------------------------------------------------------------------
* fio.c

View file

@ -13,7 +13,7 @@
* can be used and distributed.
****************************************************************************/
#include "doh.h"
#include "dohint.h"
/***********************************************************************
* $Header$
@ -84,22 +84,21 @@ static DohMappingMethods HashMappingMethods = {
static DohObjInfo HashType = {
"Hash", /* objname */
sizeof(Hash), /* size */
DelHash, /* sm_del */
CopyHash, /* sm_copy */
Hash_clear, /* sm_clear */
Hash_str, /* sm_str */
DelHash, /* doh_del */
CopyHash, /* doh_copy */
Hash_clear, /* doh_clear */
Hash_str, /* doh_str */
0, /* doh_data */
0, /* doh_dump */
Hash_len, /* sm_len */
0, /* sm_hash */
0, /* doh_load */
Hash_len, /* doh_len */
0, /* doh_hash */
0, /* doh_cmp */
&HashMappingMethods, /* doh_mapping */
0, /* doh_sequence */
0,
0,
0,
0,
0,
0, /* doh_file */
0, /* doh_string */
0, /* doh_callable */
};
DohObjInfo *Hash_type() {

View file

@ -21,7 +21,7 @@
* General purpose structure for keeping a list of reference counted Swig objects.
*******************************************************************************/
#include "doh.h"
#include "dohint.h"
typedef struct List {
DOHCOMMON;
@ -60,22 +60,20 @@ static DohSequenceMethods ListSeqMethods = {
static DohObjInfo ListType = {
"List", /* objname */
sizeof(List), /* List size */
DelList, /* sm_del */
CopyList, /* sm_copy */
List_clear, /* sm_clear */
List_str, /* sm_str */
DelList, /* doh_del */
CopyList, /* doh_copy */
List_clear, /* doh_clear */
List_str, /* doh_str */
0, /* doh_data */
List_dump, /* doh_dump */
List_len, /* sm_len */
0, /* sm_hash */
0, /* doh_load */
List_len, /* doh_len */
0, /* doh_hash */
0, /* doh_cmp */
0, /* doh_mapping */
&ListSeqMethods, /* doh_sequence */
0,
0,
0,
0,
0,
0, /* doh_string */
0, /* doh_callable */
};
DohObjInfo *List_type() {

View file

@ -13,7 +13,7 @@
* can be used and distributed.
****************************************************************************/
#include "doh.h"
#include "dohint.h"
#ifndef DOH_POOL_SIZE
#define DOH_POOL_SIZE 65536

View file

@ -13,7 +13,7 @@
* can be used and distributed.
****************************************************************************/
#include "doh.h"
#include "dohint.h"
/* ---------------------------------------------------------------------------
* $Header$
@ -80,22 +80,21 @@ static DohFileMethods StringFileMethods = {
static DohObjInfo StringType = {
"String", /* objname */
sizeof(String), /* objsize */
DelString, /* sm_del */
CopyString, /* sm_copy */
String_clear, /* sm_clear */
String_str, /* sm_str */
DelString, /* doh_del */
CopyString, /* doh_copy */
String_clear, /* doh_clear */
String_str, /* doh_str */
String_data, /* doh_data */
String_dump, /* doh_dump */
String_len, /* sm_len */
String_hash, /* sm_hash */
0, /* doh_load */
String_len, /* doh_len */
String_hash, /* doh_hash */
String_cmp, /* doh_cmp */
0, /* doh_mapping */
&StringSeqMethods, /* doh_sequence */
&StringFileMethods,/* doh_file */
0,
0,
0,
0,
0, /* doh_string */
0, /* doh_callable */
};
#define INIT_MAXSIZE 16
@ -716,11 +715,3 @@ String_replace(DOH *stro, DOH *token, DOH *rep, int flags)
if (flags & DOH_REPLACE_FIRST) count = 1;
replace_internal(str,Char(token),Char(rep),flags,str->str,count);
}
/* -----------------------------------------------------------------------------
* void String_trim(DOH *str, char *front, char *back)
*
* Trim a string.
* ----------------------------------------------------------------------------- */

View file

@ -13,7 +13,7 @@
* can be used and distributed.
****************************************************************************/
#include "doh.h"
#include "dohint.h"
/* -----------------------------------------------------------------------------
* void.c
@ -40,14 +40,15 @@ static DohObjInfo DohVoidType = {
0, /* doh_str */
Void_data, /* doh_data */
0, /* doh_dump */
0, /* doh_load */
0, /* doh_len */
0, /* doh_hash */
0, /* doh_cmp */
0, /* doh_mapping */
0, /* doh_sequence */
0, /* doh_file */
0, /* reserved2 */
0, /* reserved3 */
0, /* doh_string */
0, /* doh_callable */
0, /* reserved4 */
0, /* reserved5 */
0, /* reserved6 */

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* DOH (Dynamic Object Hack)
* DOH (Dave's Object Hack)
*
* Author : David Beazley
*
@ -17,51 +17,48 @@
* $Header$
*
* doh.h
*
* DOH is really not much more than an interface. This file describes
* the interface.
***********************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <stdarg.h>
#ifndef DOH_H
#define DOH_H
#define DOH_MAJOR_VERSION 0
#define DOH_MINOR_VERSION 1
#ifndef _DOH_H
#define _DOH_H
#ifdef __cplusplus
extern "C" {
#endif
#define DOH_MAJOR_VERSION 0
#define DOH_MINOR_VERSION 1
typedef void DOH;
#define DOH_BEGIN -1
#define DOH_END -2
#define DOH_CUR -3
#define DOH_CURRENT -3
/* -----------------------------------------------------------------------------
* Object classes
* These structures define the interface to various categories of objects.
* ----------------------------------------------------------------------------- */
/* Mapping Objects */
/* Mapping Objects (i.e., hash tables) */
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_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 */
} DohMappingMethods;
/* Sequence methods */
/* Sequence methods (i.e., lists) */
typedef struct {
DOH *(*doh_getitem)(DOH *obj, int index);
int (*doh_setitem)(DOH *obj, int index, DOH *value);
int (*doh_delitem)(DOH *obj, int index);
int (*doh_insitem)(DOH *obj, int index, DOH *value);
DOH *(*doh_firstitem)(DOH *obj);
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);
} DohSequenceMethods;
@ -77,25 +74,38 @@ typedef struct {
int (*doh_close)(DOH *obj);
} DohFileMethods;
/* String methods */
typedef struct {
int (*doh_replace)(DOH *obj, DOH *old, DOH *rep, int flags);
} DohStringMethods;
/* Callable */
typedef struct {
DOH (*doh_call)(DOH *obj, DOH *args); /* Callable */
} DohCallableMethods;
/* -----------------------------------------------------------------------------
* DohObjInfo
*
* Included in all DOH types.
* A pointer to this structure is included in all DOH types and is used to
* describe the properties of various objects.
* ----------------------------------------------------------------------------- */
typedef struct DohObjInfo {
char *objname; /* Object name */
int objsize; /* Object size */
char *objname; /* Object name */
int objsize; /* Object size */
/* 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 */
void (*doh_del)(DOH *obj); /* Delete object */
DOH *(*doh_copy)(DOH *obj); /* Copy and object */
void (*doh_clear)(DOH *obj); /* Clear an object */
/* Output 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 */
int (*doh_dump)(DOH *obj, DOH *out); /* Serialize on out */
DOH *(*doh_load)(DOH *in); /* Unserialize from in */
/* Length and hash values */
int (*doh_len)(DOH *obj);
@ -104,11 +114,11 @@ typedef struct DohObjInfo {
/* Compare */
int (*doh_cmp)(DOH *obj1, DOH *obj2);
DohMappingMethods *doh_mapping; /* Mapping methods */
DohSequenceMethods *doh_sequence; /* Sequence methods */
DohFileMethods *doh_file; /* File methods */
void *reserved2; /* Number methods */
void *reserved3;
DohMappingMethods *doh_mapping; /* Mapping methods */
DohSequenceMethods *doh_sequence; /* Sequence methods */
DohFileMethods *doh_file; /* File methods */
DohStringMethods *doh_string; /* String methods */
DohCallableMethods *doh_callable; /* Callable methods */
void *reserved4;
void *reserved5;
void *reserved6;
@ -237,9 +247,6 @@ extern DOH *DohReadline(DOH *in);
#endif
/* #define Scanf DohScanf
#define vScanf DohvScanf*/
/* -----------------------------------------------------------------------------
* DohBase
*
@ -309,7 +316,6 @@ extern DOH *Hash_keys(DOH *);
extern DOH *NewVoid(void *ptr, void (*del)(void *));
extern DOH *DohSplit(DOH *input, char *chs, int nsplits);
#define Split DohSplit