Source to jet/jet.h


Enter a symbol's name here to quickly find it.

#ifndef _JET_H
#define _JET_H

/* #define DEBUG 1 */ /* debug the console */

#ifndef THINK_C
#include <Quickdraw.h>
#endif

#include "osbind.h"

#include <basepage.h>
#include <st-out.h>
#include <fcntl.h>
#include <errno.h>
#include <sysvars.h>
#include <linea.h>

#ifdef THINK_C
#define PATH_MAX 128
#endif

#include <limits.h>
#include <string.h>
#include <stdio.h>

#ifdef __GNUC__
#define INLINE inline
#else
#define INLINE
#endif

#define NO_PROC -1
#define JET_PROC 0

#define EMEMORY 1
#define EGESTALT 2

/* creators and types */
#define MINT 0x4d694e54 /* 'MiNT' */
#define ALPHA 0x414c4641 /* 'ALFA' */
#define BBEDIT 0x522a6368 /* 'R*ch' */
#define TEXT 0x54455854 /* 'TEXT' */
#define APPL 0x4150504c /* 'APPL' */
#define PREFS 0x50726566 /* 'Pref' */
#define KCHR 0x4B434852 /* 'KCHR' */

#define TOTROWS 500
#define TOTCOLS 132

/* possible flags for cursor state, etc. */
#define CURS_FSTATE	0x02		/* cursor in flash state */
#define CURS_ON		0x04		/* cursor on */
#define FINVERSE	0x10		/* invert text */

#define LEFT 4

#define SVAR_VERS 3

typedef struct {
	long version;
	void (*vbl)(void);
	long vbls;
	long vblq;
	void (*timer)(void);
	long hz200;
	long ticks;
	void (*five)(void);
	long sysbase;
	long logbase;
	long saveda5;
	long savedsp;
	void (*mac_env)(void);
	void (*mint_env)(void);
	short vm;
	void (*eventloop)(void);
	long (*rwabs)(short, void *, short, short, short, long);
	long (*mediach)(short);
	long (*getbpb)(short);
	long drvmap;
	long term;
	long crit;
	long resvec;
	long resval;
	struct { long buf[20]; } procinfo;
	short alias; /* indicates whether Alias Manager is present */
	short powerpc; /* non-zero indicates a power-pc emulating a 68LC040 */
	void (*jet_dispatch)(long selector);
	long reserved[4]; /* reserved for future expansion for YOUR use! */
} sysvars;

typedef struct {
	unsigned short version;	/* prefs version */
	Rect wrect;				/* position rect for main window */
	short swap_delete;		/* true if swapping delete key */
	short swap_control;		/* window columns, rows */
	short curs_flash;		/* true if swapping cursor */
	short fwrap;			/* true if wrapping at eol */
	short maxx, maxy;		/* window columns, rows */
} Prefs;

/* main.c */
#ifdef __GNUC__
extern long saveda5 asm("saveda5");
extern long savedsp asm("savedsp");
#else
extern long saveda5;
extern long savedsp;
#endif
extern BASEPAGE *curbp;
extern long old_md;
extern long *holdstart;
extern long *next_hold;
extern long jet_stack;
extern Prefs pref;

Boolean TrapAvailable(short theTrap);
void writeprefs(void);
void fatal(int code);

/* memory.c */
void init_memory(char *, char *);

/* os.c */
unsigned short mac2time(unsigned long);
unsigned short mac2date(unsigned long);

/* filesys.c */
void init_filesys(void);

/* console.c */
extern unsigned char kbshft;
extern _KBDVECS kbd;
extern long keymsg;
extern short keymod;
extern short maxx, maxy;
extern char *base[TOTROWS];

void init_console(void);
void curs_off(void);
void curs_on(void);
void curs_enable(void);
void curs_disable(void);
void refresh(void);
void resize(short, short);
void swap_curs(void);

/* events.c */
extern WindowPtr myWindow;
extern Rect conRect;
extern short fascent, fheight, fwidth, ftotal;
extern short curVal, maxVal;
extern Rect selectedChars;	/* selection in x,y coords */

void init_events(void);
void eventloop(void);
void scrollBottom(void);
void clearSelection(void);
Boolean emptySelection();
void offsetSelection(int);

/* vector.c */
extern long macusp;
extern long mintusp;
extern long macssp;
extern long mintssp;
extern short swap;
extern short vm;
extern short longframe;
extern short call_sr;
extern long call_pc;
extern long call_sp;
extern long call_regs[];
extern short syscall_max;
extern void *syscall_tab;
extern short dos_max;
extern void *dos_tab[];
extern short bios_max;
extern void *bios_tab[];
extern short xbios_max;
extern void *xbios_tab[];

extern sysvars sysvar;
extern long old_intr;
extern short intr_flag;

void init_vector(void);
void clean_vector(void);
void put_vector(void);
void pull_vector(void);

/* intr.c */
void mac_env(void);
void mint_env(void);
void dos(void);
void bios(void);
void xbios(void);
void aes(void);
void linea(void);
void out(void);
unsigned short spl7(void);
void spl(unsigned short);
void setsp(long);
void seta5(long);
long geta5(void);
void intr(void);
void nullVBL(void);
void Mem_Dispatch(void);

/* pascal.c */
void pES(void);
void pAEHandler(void);
void pScrollText(void);

#endif