⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 oxbow.h

📁 OXCC is a multipass, interpreting C compiler with several language extensions. It generates an Archi
💻 H
📖 第 1 页 / 共 5 页
字号:
/* OXBOW.H a conglomeration of .h files */

#include <setjmp.h>

#define PLATFORM_WIN32	0x00000070
#define PLATFORM_32s    0x00000010
#define PLATFORM_95     0x00000020
#define PLATFORM_NT     0x00000040

#define PLATFORM_WIN16	0x00000080
#define PLATFORM_WIN30  0x00000080
#define PLATFORM_WIN31	0x00000081
#define PLATFORM_WFW31  0x00000082
#define PLATFORM_WINOS2 0x00000083

#define PLATFORM_OS2	0x00000100
#define PLATFORM_LINUX	0x00000200

#ifndef SUPPORT_LONG_LONG
#define SUPPORT_LONG_LONG 1
#endif

#ifndef SUPPORT_LONG_DOUBLE
#define SUPPORT_LONG_DOUBLE 0
#endif

#if SUPPORT_LONG_LONG
#define _LONGLONG_ long long
#else
#define _LONGLONG_ double
#endif

#ifdef __cplusplus
extern "C" {
#endif

enum evTypes {
#undef defEvent
#define defEvent(a,b) \
a=b,
#include <oxevents.h>
};

#undef max
#define max(a,b) \
({typedef _ta = (a), _tb = (b); \
_ta _a = (a); _tb _b = (b); \
_a > _b ? _a : _b; })

#undef min
#define min(a,b) \
({typedef _ta = (a), _tb = (b); \
_ta _a = (a); _tb _b = (b);\
_a < _b ? _a : _b; })

#define ROUNDING(a,b) ((a+(b-1))&~(b-1))
#define ROUNDUP(a,b) a = ROUNDING(a,b)
#define round_up(a,b) ROUNDING(a,b)
#define CALLER(a) (((unsigned*)&a)[-1])

typedef unsigned long SIZE_T;

/* deal with lack of support for _stdcall */
#define RETURN_WINAPI(PAR) \
    __asm__ ("1:nop\n\tnop\n\t.stabs \"__RetNT\",36," #PAR ",0,1b-2\n");
#define RETURN_CALLBACK(PAR) \
    __asm__ ("1:nop\n\tnop\n\t.stabs \"__RetNT\",36," #PAR ",0,1b-2\n");
#define RETURN_EXPORT(PAR) \
    __asm__ ("1:nop\n\tnop\n\t.stabs \"__RetNT\",36," #PAR ",0,1b-2\n");

/* CFF.H	-- user api include file for the cff library */
#ifndef __ITEMH__
#define __ITEMH__
#if SUPPORT_LONG_LONG
typedef unsigned long long  KeyItem;   /* type for a key's associated item */
#else
typedef double KeyItem;
#endif
#endif __ITEMH__

typedef union 			/* 2 BYTES */
	{
		unsigned short val;
		unsigned char b[2];
} SVAL;

typedef union			/* 4 BYTES */
	{
	unsigned long a0;
	void *a1;
	struct
		{
		SVAL	lo_word;
		SVAL	hi_word;
		} a2;
	struct
		{
			unsigned int pad :28;
			unsigned int type :4;
		} a3;
	struct
		{
			unsigned char b[4];
		} a4;
	int a8;
	short a9;
	char a10;
	float a11;
} ADDR;

#ifndef __STORH__
#define __STORH__
typedef union _stor	/* 8 BYTES */
	{
	KeyItem item;
	unsigned long	a0;
	void *a1;
	struct 
	{
		unsigned char b0 : 3;
		unsigned char b1 : 1;
		unsigned char b2 : 1;
		unsigned char b3 : 1;
		unsigned char b4 : 2;
	} bits;
	struct
		{
		unsigned short	lo_word;
		unsigned short	hi_word;
		unsigned int size :28;		/* in bytes or nibbles */
		unsigned int type :4;	    /* describes the STOR type */
		} a2;
	struct
		{
			short s0;
			short s1;
			short s2;
			short s3;
		} a3;
	struct
		{
			unsigned long	s0;
			unsigned long	s1;
		} a4;
	struct
		{
			long	s0;
			long	s1;
		} a4s;
	struct
		{
			void	*a0;
			void	*a1;
		} a4a;
	struct
		{
			unsigned char	b[8];
		} a5;
	struct
		{
			signed char	b[8];
		} a5t;
#if SUPPORT_LONG_LONG
	struct
		{
			unsigned long long dupname :48;
			unsigned long long dupid :16;
		} a6;
#endif
	struct
		{
			unsigned int home : 30;
			unsigned int full : 2;
		} a7;
	int a8;
	short a9;
	char a10;
	float a11;
	double a12;
#if SUPPORT_LONG_LONG
	long long a13;
	unsigned long long a14;
#endif
	unsigned char	Uuchar;
	char			Uchar;
	unsigned short	Uushort;
	short			Ushort;
	unsigned int	Uuint;
	int				Uint;
	unsigned long 	Uulong;
	long			Ulong;
#if SUPPORT_LONG_LONG
	unsigned long long Uulonglong;
	long long		Ulonglong;
#endif
	void *			Upointer;
	float			Ufloat;
	double			Udouble;
} STOR, Item;
#endif __STORH__

/* DEFINITIONS FOR "a2.type */
#define STO_INACTIVE (0)
#define STO_NIL  (1)
#define STO_VALUE (2)	
#define STO_CHUNK (3)
#define STO_KEYINFO (4)
#define STO_NILCHUNK (5)
#define STO_COMPCHUNK (6)
#define STO_ALLOCATED (7)
#define STO_DELETED (8)	/* always ored with non zero */
#define STOMASK (7)

typedef struct {
	unsigned long	name;
	unsigned short	xname;
	unsigned short	id;
} DupName;

typedef struct			/* 12 BYTES */
	{
		STOR c0;
		ADDR c1;
	} CAT;
#define CATEXACT  (8)
#define CATHASH (cat.c1.a0)

typedef struct	/* 20 bytes */
	{
		STOR	stor;
		CAT		cat;
} SDB;


/* DEFINE CFF OPEN MODES */

#define F_RDONLY	(0x0001)
#define F_WRONLY	(0x0002)
#define F_RDWR		(0x0003)
#define F_CREAT		(0x0004)
#define F_TEMP		(0x0008)
#define F_UNIQ		(0x0010)
#define F_EXCL		(0x0020)
#define F_BITMAP	(0x0040)
#define F_TRUNC		(0x0080)
#define F_APPEND	(0x0100)
#define F_DELETING	(0x0200)
#define F_FILEONLY	(0x0400)
#define F_BIGDIR	(0x0800)
#define F_HUGEDIR	(0x1000)
#define F_SETUP		(0x4000)
#define F_PARENTS	(0x4000)
#define F_SORTED	(0x8000)
#define F_UNTAGGED	(0x10000)
#define F_STAT		(0x20000)	/* TRULY READONLY */
#define F_TEXT		(0x40000)	/* DOS crap, default mode is binary */
#define F_ZIPFILE	(0x80000)	/* compress the file aspect */
#define F_ZIPDATA	(0x100000)	/* compress data chunks */
#define F_TEMPFILE	(F_RDWR|F_CREAT|F_UNIQ|F_TEMP)

/* BUFFER RELEASE MODES */
#define R_DIRTY		(0x80000000)
#define R_CLEAN		(0x40000000)
#define R_FLUSH		(0x20000000)

/* DEFINE SOME SYSTEM CALL VALUES */
#define S_READBLK (1)
#define S_WRITEBLK (2)
#define S_GETSPACE (3)
#define S_GIVESPACE (4)
#define S_CLOSE (5)
#define S_OPEN (6)
#define S_CREATE (7)
#define S_UNLINK (8)
#define S_SEEK (9)
#define S_FLUSH (10)
#define S_CLOSETRUNC (11)

#define S_SET (0)
#define S_CUR (1)
#define S_END (2)

/* DEFINE CFF OBJECT PROPERTIES -- returned by cfobtype(void *something) */
#define OB_SHARE	(0x00000001)
#define OB_ISDIR	(0x00000002)
#define OB_BMOK		(0x00000004)
#define OB_SMOK		(0x00000008)
#define OB_MEM		(0x00000010)
#define OB_RAWDEV	(0x00000020)
#define OB_CFILE	(0x00000040)
#define OB_SETUP	(0x00000080)
#define OB_FOD		(0x00000100)
#define OB_ROOTDIR	(0x00000200)
#define OB_DIRTY	(0x00000400)
#define OB_DELCLOSE	(0x00000800)
#define OB_WRITE	(0x00001000)
#define OB_BITMAP	(0x00002000)
#define OB_XFILE	(0x00004000)
#define OB_ISNEW	(0x00008000)
#define OB_SMEM		(0x00010000)
#define OB_FILEONLY	(0x40000000)
#define OB_HASHDIR	(0x20000000)
#define OB_TREEDIR	(0x10000000)
#define OB_UNTAGGED (0x08000000)
#define OB_PREALLOC (0x01000000)
#define OB_ZIPFILE	(0x00800000)
#define OB_ZIPDATA	(0x00400000)
#define OB_CHUNK	(0x00200000)
#define OB_VALUE	(0x00100000)

#ifndef NULL
#define NULL ((void *)0)
#endif

#ifndef EOF
#define EOF     (-1)
#endif

#define YES     (1)
#define NO      (0)
#define OK      (1)
#define NODUPS	(0)
#define OKDUPS	(1)
#define CNTDUPS (2)
#define DUPNAMES (4)

#define PREALLOC1 (8)
#define PREALLOC2 (16)
#define PREALLOC3 (32)

#define ERROR   (-1)
#define FOUND	(1)
#define NOTFOUND (0)
#define NONE	(-1)	/* no value */
#define INVALID (-4)	/* invalid value */
#define LESS	(-1)	/* a is less than b */
#define EQUAL	(0)		/* a and b are equal */
#define GREATER	(2)		/* a is greater than b */
#define	BOI	(-2)		/* beginning of index */
#define	EOI	(-3)		/* end of index */

typedef struct opninfo {
	long initial_entries;
	unsigned long bitmap_prealloc;
	long data_prealloc;
} OPNINFO;

typedef struct cfdirent {
	int d_namlen;
	char *d_name;
	unsigned long d_bytesalloc;
	unsigned long d_bytesused;
	unsigned long d_mode;
	unsigned long d_entrycnt;
	unsigned long d_ino;
	unsigned long d_mtime;
	unsigned long d_ctime;
	void *d_fpt;
} CFDIRENT;

/* Function codes for the cfmisc instruction */
enum CfMisc {
	CF_ALLOC,CF_USED,CF_DEPTH,CF_MARK,CF_HEAD,CF_TAIL,CF_NEXT,
	CF_PREV,CF_KEYLEN,CF_DATALEN,CF_MODBUFS,
	CF_CURBUFS,CF_SETKEYCMP,CF_SETITEMCMP,CF_SETERRFUNC,
	CF_LAZY,CF_VERYLAZY,CF_CLRLAZY,CF_ISNEW,CF_FLUSH,
	CF_FILESIZE,CF_FILEALLOC,CF_PREALLOC,CF_ALIGNMENT,
	CF_MAPSIZE,CF_ISSORTED,CF_KEY,CF_ITEM,CF_CREEP,
	CF_SETPRINTFUNC,CF_DATA,CF_GETMARK,CF_SETMARK
};

typedef struct cfstat {
		unsigned long	st_smhead;
		unsigned long	st_smtail;
		unsigned short	st_id;
		unsigned short	st_keysize;

		STOR		   st_dups;
		unsigned long  st_bmhead;
		unsigned long  st_bmtail;
        unsigned long  st_mode;
        short st_uid;
        short st_gid;
        long  st_mtime;
        long  st_ctime;

		unsigned long  st_highleaf;
        unsigned long  st_size;
		unsigned long  st_alloc;
		unsigned long  st_entrycnt;
		short 		   st_mapsize;
		unsigned short st_dupids;

        long  st_atime;
		long  st_filesize;
		long  st_filealloc;
		long  st_obtype;
		unsigned int st_filedups;
        long  st_ino;
        short st_blksize;
        short st_dev;
        short st_nlink;
        short st_rdev;
} CFSTAT;

/* MODE BITS */
#define M_AFMT		(0x30000000)
#define M_ROOTDIR	(0x80000000)
#define M_FILEONLY	(0x40000000)
#define M_HASHDIR	(0x20000000)
#define M_TREEDIR	(0x10000000)
#define M_UNTAGGED	(0x08000000)
#define M_BITMAP	(0x04000000)
#define M_EXTRNFILE	(0x02000000)
#define M_PREALLOC	(0x01000000)
#define M_ZIPFILE	(0x00800000)
#define M_ZIPDATA	(0x00400000)
#define M_CHUNK		(0x00200000)
#define M_VALUE		(0x00100000)
#define M_IFMT		(0x0000F000)
#define M_IFDIR		(0x00004000)
#define M_IFIFO		(0x00002000)
#define M_IFCHR		(0x00001000)
#define M_IFBLK		(0x00003000)
#define M_IFREG		(0x00008000)
#define M_IREAD		(0x00000100)
#define M_IWRITE	(0x00000080)
#define M_IEXEC		(0x00000040)


extern void *PERMCAT;
extern void *PERMINFO;
extern void *PERMFILE;
extern void *MEMTEMP;
#define MEMTMP MEMTEMP

extern char *cff_version;
extern char *cff_copyright;



/* STDIO STUFF */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -