Some cleanup
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@124 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
0e6dd6d138
commit
bae3344f6c
8 changed files with 199 additions and 230 deletions
|
|
@ -13,12 +13,13 @@
|
||||||
* can be used and distributed.
|
* can be used and distributed.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* $Header$
|
|
||||||
*
|
|
||||||
* File : base.c
|
* File : base.c
|
||||||
*
|
*
|
||||||
* Methods for base objects
|
* This file contains all of the basic DOH methods. These functions really
|
||||||
|
* just dispatch to the methods for each object.
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
#include "dohint.h"
|
#include "dohint.h"
|
||||||
|
|
|
||||||
|
|
@ -13,22 +13,37 @@
|
||||||
* can be used and distributed.
|
* can be used and distributed.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "dohint.h"
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* callable.c
|
* callable.c
|
||||||
*
|
*
|
||||||
* Callable object.
|
* Implements a callable function-like object.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "dohint.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DOHCOMMON;
|
DOHCOMMON;
|
||||||
DOH *(*func)(DOH *, DOH *);
|
DOH *(*func)(DOH *, DOH *);
|
||||||
} CallableObj;
|
} CallableObj;
|
||||||
|
|
||||||
void Callable_delete(DOH *);
|
static void
|
||||||
DOH *Callable_copy(DOH *);
|
Callable_delete(DOH *co) {
|
||||||
DOH *Callable_call(DOH *, DOH *);
|
DohObjFree(co);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DOH *
|
||||||
|
Callable_copy(DOH *co) {
|
||||||
|
CallableObj *c = (CallableObj *) co;
|
||||||
|
return NewCallable(c->func);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DOH *
|
||||||
|
Callable_call(DOH *co, DOH *args) {
|
||||||
|
CallableObj *c = (CallableObj *) co;
|
||||||
|
return (*c->func)(c,args);
|
||||||
|
}
|
||||||
|
|
||||||
static DohCallableMethods doh_callable_methods = {
|
static DohCallableMethods doh_callable_methods = {
|
||||||
Callable_call
|
Callable_call
|
||||||
|
|
@ -39,48 +54,34 @@ static DohObjInfo DohCallableType = {
|
||||||
sizeof(CallableObj), /* objsize */
|
sizeof(CallableObj), /* objsize */
|
||||||
Callable_delete, /* doh_del */
|
Callable_delete, /* doh_del */
|
||||||
Callable_copy, /* doh_copy */
|
Callable_copy, /* doh_copy */
|
||||||
0, /* doh_clear */
|
0, /* doh_clear */
|
||||||
0, /* doh_scope */
|
0, /* doh_scope */
|
||||||
0, /* doh_str */
|
0, /* doh_str */
|
||||||
0, /* doh_data */
|
0, /* doh_data */
|
||||||
0, /* doh_dump */
|
0, /* doh_dump */
|
||||||
0, /* doh_load */
|
0, /* doh_load */
|
||||||
0, /* doh_len */
|
0, /* doh_len */
|
||||||
0, /* doh_hash */
|
0, /* doh_hash */
|
||||||
0, /* doh_cmp */
|
0, /* doh_cmp */
|
||||||
0, /* doh_mapping */
|
0, /* doh_mapping */
|
||||||
0, /* doh_sequence */
|
0, /* doh_sequence */
|
||||||
0, /* doh_file */
|
0, /* doh_file */
|
||||||
0, /* doh_string */
|
0, /* doh_string */
|
||||||
&doh_callable_methods, /* doh_callable */
|
&doh_callable_methods, /* doh_callable */
|
||||||
0, /* doh_position */
|
0, /* doh_position */
|
||||||
0, /* reserved5 */
|
0, /* reserved5 */
|
||||||
0, /* reserved6 */
|
0, /* reserved6 */
|
||||||
0, /* user1 */
|
0, /* user1 */
|
||||||
0, /* user2 */
|
0, /* user2 */
|
||||||
0, /* user3 */
|
0, /* user3 */
|
||||||
0, /* user4 */
|
0, /* user4 */
|
||||||
};
|
};
|
||||||
|
|
||||||
DOH *NewCallable(DOH *(*func)(DOH *, DOH *)) {
|
DOH *
|
||||||
|
NewCallable(DOH *(*func)(DOH *, DOH *)) {
|
||||||
CallableObj *c;
|
CallableObj *c;
|
||||||
c = (CallableObj *) DohObjMalloc(sizeof(CallableObj));
|
c = (CallableObj *) DohObjMalloc(sizeof(CallableObj));
|
||||||
c->objinfo = &DohCallableType;
|
c->objinfo = &DohCallableType;
|
||||||
c->func = func;
|
c->func = func;
|
||||||
return (DOH *) c;
|
return (DOH *) c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Callable_delete(DOH *co) {
|
|
||||||
DohObjFree(co);
|
|
||||||
}
|
|
||||||
|
|
||||||
DOH *Callable_copy(DOH *co) {
|
|
||||||
CallableObj *c = (CallableObj *) co;
|
|
||||||
return NewCallable(c->func);
|
|
||||||
}
|
|
||||||
|
|
||||||
DOH *Callable_call(DOH *co, DOH *args) {
|
|
||||||
CallableObj *c = (CallableObj *) co;
|
|
||||||
return (*c->func)(c,args);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,34 +13,135 @@
|
||||||
* can be used and distributed.
|
* can be used and distributed.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
||||||
|
/* ---------------------------------------------------------------------------
|
||||||
|
* file.c
|
||||||
|
*
|
||||||
|
* This file implements a DOH file-like object.
|
||||||
|
* --------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "dohint.h"
|
#include "dohint.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------
|
typedef struct {
|
||||||
* $Header$
|
DOHCOMMON;
|
||||||
* string.c
|
FILE *filep;
|
||||||
|
int fd;
|
||||||
|
int closeondel;
|
||||||
|
} DohFile;
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* DelFile(DOH *s) - Delete a file
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static void
|
||||||
|
DelFile(DOH *so) {
|
||||||
|
DohFile *f = (DohFile *) so;
|
||||||
|
assert(f->refcount <= 0);
|
||||||
|
if (f->closeondel)
|
||||||
|
fclose(f->filep);
|
||||||
|
DohObjFree(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* int File_read(DOH *so, void *buffer, int len)
|
||||||
|
*
|
||||||
|
* Read data from the File
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static int
|
||||||
|
File_read(DOH *so, void *buffer, int len) {
|
||||||
|
DohFile *s = (DohFile *) so;
|
||||||
|
if (s->filep)
|
||||||
|
return fread(buffer,1,len,s->filep);
|
||||||
|
else
|
||||||
|
return read(s->fd,buffer,len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* int File_write(DOH *so, void *buffer, int len)
|
||||||
|
*
|
||||||
|
* Write data to the File
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
static int
|
||||||
|
File_write(DOH *so, void *buffer, int len) {
|
||||||
|
DohFile *s = (DohFile *) so;
|
||||||
|
if (s->filep)
|
||||||
|
return fwrite(buffer,1,len,s->filep);
|
||||||
|
else
|
||||||
|
return write(s->fd, buffer, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* int File_seek(DOH *so, long offset, int whence)
|
||||||
|
*
|
||||||
|
* Seek to a new position
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
static int
|
||||||
|
File_seek(DOH *so, long offset, int whence) {
|
||||||
|
DohFile *s = (DohFile *) so;
|
||||||
|
if (s->filep)
|
||||||
|
return fseek(s->filep,offset,whence);
|
||||||
|
else
|
||||||
|
return lseek(s->fd,offset,whence);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* long File_tell(DOH *so)
|
||||||
|
*
|
||||||
|
* Return current position
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
static long
|
||||||
|
File_tell(DOH *so) {
|
||||||
|
DohFile *s = (DohFile *) so;
|
||||||
|
if (s->filep)
|
||||||
|
return ftell(s->filep);
|
||||||
|
else
|
||||||
|
return lseek(s->fd,0,SEEK_CUR);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* int File_putc(DOH *obj, int ch)
|
||||||
*
|
*
|
||||||
* String support.
|
* Put a character on the output
|
||||||
* --------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
typedef struct File {
|
static int
|
||||||
DOHCOMMON;
|
File_putc(DOH *obj, int ch) {
|
||||||
FILE *filep;
|
DohFile *s = (DohFile *) obj;
|
||||||
int fd;
|
if (s->filep)
|
||||||
int closeondel;
|
return fputc(ch,s->filep);
|
||||||
} File;
|
return EOF;
|
||||||
|
}
|
||||||
|
|
||||||
/* Forward references */
|
/* -----------------------------------------------------------------------------
|
||||||
|
* int File_getc(DOH *obj)
|
||||||
|
*
|
||||||
|
* Get a character
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void DelFile(DOH *s);
|
static int
|
||||||
int File_read(DOH *s, void *buffer, int length);
|
File_getc(DOH *obj) {
|
||||||
int File_write(DOH *s, void *buffer, int length);
|
DohFile *s = (DohFile *) obj;
|
||||||
int File_putc(DOH *s, int ch);
|
if (s->filep)
|
||||||
int File_getc(DOH *s);
|
return fgetc(s->filep);
|
||||||
int File_ungetc(DOH *s, int ch);
|
return EOF;
|
||||||
int File_seek(DOH *s, long offset, int whence);
|
}
|
||||||
long File_tell(DOH *s);
|
|
||||||
|
|
||||||
|
/* -----------------------------------------------------------------------------
|
||||||
|
* int File_ungetc(DOH *obj, int ch)
|
||||||
|
*
|
||||||
|
* Put a character back onto the input
|
||||||
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
static int
|
||||||
|
File_ungetc(DOH *obj, int ch) {
|
||||||
|
DohFile *s = (DohFile *) obj;
|
||||||
|
if (s->filep)
|
||||||
|
return ungetc(ch, s->filep);
|
||||||
|
return EOF;
|
||||||
|
}
|
||||||
|
|
||||||
static DohFileMethods FileFileMethods = {
|
static DohFileMethods FileFileMethods = {
|
||||||
File_read,
|
File_read,
|
||||||
|
|
@ -53,9 +154,9 @@ static DohFileMethods FileFileMethods = {
|
||||||
0, /* close */
|
0, /* close */
|
||||||
};
|
};
|
||||||
|
|
||||||
static DohObjInfo FileType = {
|
static DohObjInfo DohFileType = {
|
||||||
"File", /* objname */
|
"DohFile", /* objname */
|
||||||
sizeof(File), /* objsize */
|
sizeof(DohFile), /* objsize */
|
||||||
DelFile, /* doh_del */
|
DelFile, /* doh_del */
|
||||||
0, /* doh_copy */
|
0, /* doh_copy */
|
||||||
0, /* doh_clear */
|
0, /* doh_clear */
|
||||||
|
|
@ -75,17 +176,13 @@ static DohObjInfo FileType = {
|
||||||
0, /* doh_position */
|
0, /* doh_position */
|
||||||
};
|
};
|
||||||
|
|
||||||
DohObjInfo *File_type() {
|
|
||||||
return &FileType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* NewFile(DOH *filename, char *mode)
|
* NewFile(DOH *filename, char *mode)
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
DOH *
|
DOH *
|
||||||
NewFile(DOH *fn, char *mode)
|
NewFile(DOH *fn, char *mode)
|
||||||
{
|
{
|
||||||
File *f;
|
DohFile *f;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
|
|
@ -93,12 +190,12 @@ NewFile(DOH *fn, char *mode)
|
||||||
file = fopen(filename,mode);
|
file = fopen(filename,mode);
|
||||||
if (!file) return 0;
|
if (!file) return 0;
|
||||||
|
|
||||||
f = (File *) DohObjMalloc(sizeof(File));
|
f = (DohFile *) DohObjMalloc(sizeof(DohFile));
|
||||||
if (!f) {
|
if (!f) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
f->objinfo = &FileType;
|
f->objinfo = &DohFileType;
|
||||||
f->filep = file;
|
f->filep = file;
|
||||||
f->fd = fileno(file);
|
f->fd = fileno(file);
|
||||||
f->closeondel = 1;
|
f->closeondel = 1;
|
||||||
|
|
@ -112,10 +209,10 @@ NewFile(DOH *fn, char *mode)
|
||||||
DOH *
|
DOH *
|
||||||
NewFileFromFile(FILE *file)
|
NewFileFromFile(FILE *file)
|
||||||
{
|
{
|
||||||
File *f;
|
DohFile *f;
|
||||||
f = (File *) DohObjMalloc(sizeof(File));
|
f = (DohFile *) DohObjMalloc(sizeof(DohFile));
|
||||||
if (!f) return 0;
|
if (!f) return 0;
|
||||||
f->objinfo = &FileType;
|
f->objinfo = &DohFileType;
|
||||||
f->filep = file;
|
f->filep = file;
|
||||||
f->fd = fileno(file);
|
f->fd = fileno(file);
|
||||||
f->closeondel = 0;
|
f->closeondel = 0;
|
||||||
|
|
@ -129,27 +226,16 @@ NewFileFromFile(FILE *file)
|
||||||
DOH *
|
DOH *
|
||||||
NewFileFromFd(int fd)
|
NewFileFromFd(int fd)
|
||||||
{
|
{
|
||||||
File *f;
|
DohFile *f;
|
||||||
f = (File *) DohObjMalloc(sizeof(File));
|
f = (DohFile *) DohObjMalloc(sizeof(DohFile));
|
||||||
if (!f) return 0;
|
if (!f) return 0;
|
||||||
f->objinfo = &FileType;
|
f->objinfo = &DohFileType;
|
||||||
f->filep = 0;
|
f->filep = 0;
|
||||||
f->fd = fd;
|
f->fd = fd;
|
||||||
f->closeondel = 0;
|
f->closeondel = 0;
|
||||||
return (DOH *) f;
|
return (DOH *) f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* DelFile(DOH *s) - Delete a file
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
void
|
|
||||||
DelFile(DOH *so) {
|
|
||||||
File *f = (File *) so;
|
|
||||||
assert(f->refcount <= 0);
|
|
||||||
if (f->closeondel)
|
|
||||||
fclose(f->filep);
|
|
||||||
DohObjFree(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* int File_check(DOH *f) - Check if f is a file
|
* int File_check(DOH *f) - Check if f is a file
|
||||||
|
|
@ -157,111 +243,13 @@ DelFile(DOH *so) {
|
||||||
int
|
int
|
||||||
File_check(DOH *f)
|
File_check(DOH *f)
|
||||||
{
|
{
|
||||||
File *df;
|
DohFile *df;
|
||||||
if (!DohCheck(f)) return 0;
|
if (!DohCheck(f)) return 0;
|
||||||
|
df = (DohFile *) f;
|
||||||
df = (File *) f;
|
if (df->objinfo == &DohFileType) return 1;
|
||||||
if (df->objinfo == &FileType) return 1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* int File_read(DOH *so, void *buffer, int len)
|
|
||||||
*
|
|
||||||
* Read data from the File
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
int
|
|
||||||
File_read(DOH *so, void *buffer, int len) {
|
|
||||||
File *s = (File *) so;
|
|
||||||
if (s->filep)
|
|
||||||
return fread(buffer,1,len,s->filep);
|
|
||||||
else
|
|
||||||
return read(s->fd,buffer,len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* int File_write(DOH *so, void *buffer, int len)
|
|
||||||
*
|
|
||||||
* Write data to the File
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
int
|
|
||||||
File_write(DOH *so, void *buffer, int len) {
|
|
||||||
File *s = (File *) so;
|
|
||||||
if (s->filep)
|
|
||||||
return fwrite(buffer,1,len,s->filep);
|
|
||||||
else
|
|
||||||
return write(s->fd, buffer, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* int File_seek(DOH *so, long offset, int whence)
|
|
||||||
*
|
|
||||||
* Seek to a new position
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
int
|
|
||||||
File_seek(DOH *so, long offset, int whence) {
|
|
||||||
File *s = (File *) so;
|
|
||||||
if (s->filep)
|
|
||||||
return fseek(s->filep,offset,whence);
|
|
||||||
else
|
|
||||||
return lseek(s->fd,offset,whence);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* long File_tell(DOH *so)
|
|
||||||
*
|
|
||||||
* Return current position
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
long
|
|
||||||
File_tell(DOH *so) {
|
|
||||||
File *s = (File *) so;
|
|
||||||
if (s->filep)
|
|
||||||
return ftell(s->filep);
|
|
||||||
else
|
|
||||||
return lseek(s->fd,0,SEEK_CUR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* int File_putc(DOH *obj, int ch)
|
|
||||||
*
|
|
||||||
* Put a character on the output
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
int File_putc(DOH *obj, int ch) {
|
|
||||||
File *s = (File *) obj;
|
|
||||||
if (s->filep)
|
|
||||||
return fputc(ch,s->filep);
|
|
||||||
return EOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* int File_getc(DOH *obj)
|
|
||||||
*
|
|
||||||
* Get a character
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
int File_getc(DOH *obj) {
|
|
||||||
File *s = (File *) obj;
|
|
||||||
if (s->filep)
|
|
||||||
return fgetc(s->filep);
|
|
||||||
return EOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
|
||||||
* int File_ungetc(DOH *obj, int ch)
|
|
||||||
*
|
|
||||||
* Put a character back onto the input
|
|
||||||
* ----------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
int File_ungetc(DOH *obj, int ch) {
|
|
||||||
File *s = (File *) obj;
|
|
||||||
if (s->filep)
|
|
||||||
return ungetc(ch, s->filep);
|
|
||||||
return EOF;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,17 @@
|
||||||
* can be used and distributed.
|
* can be used and distributed.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "dohint.h"
|
static char cvsroot[] = "$Header:";
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* fio.c
|
* fio.c
|
||||||
*
|
*
|
||||||
* Support for formatted I/O via fprintf, fscanf.
|
* This file provides support for formatted I/O via fprint style
|
||||||
|
* functions.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "dohint.h"
|
||||||
|
|
||||||
#define OBUFLEN 512
|
#define OBUFLEN 512
|
||||||
|
|
||||||
static int Writen(DOH *out, void *buffer, int len) {
|
static int Writen(DOH *out, void *buffer, int len) {
|
||||||
|
|
@ -38,7 +41,7 @@ static int Writen(DOH *out, void *buffer, int len) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* void DohEncoding(char *name, DOH *(*fn)(DOH *s))
|
* void DohEncoding(char *name, DOH *(*fn)(DOH *s))
|
||||||
*
|
*
|
||||||
* Register a printf encoding method.
|
* Register a printf named encoding method.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static DOH *encodings = 0;
|
static DOH *encodings = 0;
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
#include "doh.h"
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
DOH *d1, *d2, *d3;
|
|
||||||
DOH *f;
|
|
||||||
DOH *l;
|
|
||||||
DOH *h;
|
|
||||||
|
|
||||||
printf("starting...\n");
|
|
||||||
f = NewFile("foo","w");
|
|
||||||
printf("%x\n",f);
|
|
||||||
d1 = NewString("Hello");
|
|
||||||
d2 = NewString("World");
|
|
||||||
Append(d1,d2);
|
|
||||||
Printf(d1,"This is a test %d", 42);
|
|
||||||
Setattr(d1,"foo",d2);
|
|
||||||
Printf(f,"Hello World\n");
|
|
||||||
Printf(f,"%s\n",d1);
|
|
||||||
l = NewList();
|
|
||||||
Append(l,d1);
|
|
||||||
Append(l,d2);
|
|
||||||
Append(l,f);
|
|
||||||
h = NewHash();
|
|
||||||
Setattr(h,"foo",d1);
|
|
||||||
Setattr(h,"bar",l);
|
|
||||||
Printf(f,"%o\n",l);
|
|
||||||
Printf(f,"%o\n",h);
|
|
||||||
Printf(f,"%o\n", Getattr(h,"bar"));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -13,6 +13,8 @@
|
||||||
* can be used and distributed.
|
* can be used and distributed.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
||||||
#include "dohint.h"
|
#include "dohint.h"
|
||||||
|
|
||||||
#ifndef DOH_POOL_SIZE
|
#ifndef DOH_POOL_SIZE
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,16 @@
|
||||||
* can be used and distributed.
|
* can be used and distributed.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "dohint.h"
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------
|
||||||
* $Header$
|
|
||||||
* string.c
|
* string.c
|
||||||
*
|
*
|
||||||
* String support.
|
* String object.
|
||||||
* --------------------------------------------------------------------------- */
|
* --------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "dohint.h"
|
||||||
|
|
||||||
typedef struct String {
|
typedef struct String {
|
||||||
DOHXCOMMON;
|
DOHXCOMMON;
|
||||||
int maxsize; /* Max size allocated */
|
int maxsize; /* Max size allocated */
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@
|
||||||
* can be used and distributed.
|
* can be used and distributed.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "dohint.h"
|
|
||||||
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* void.c
|
* void.c
|
||||||
|
|
@ -21,6 +22,8 @@
|
||||||
* Void Object
|
* Void Object
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#include "dohint.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DOHCOMMON;
|
DOHCOMMON;
|
||||||
void *ptr;
|
void *ptr;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue