From 39d225cfc760c687baa7c9747a33192eb05c28d1 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Fri, 18 Jun 2004 15:37:08 +0000 Subject: [PATCH] Add PBOpenSync(), PBCloseSync(), PBControlSync() --- second/glue.S | 33 ++++++++++++++++++++++++++++++++- second/glue.h | 30 +++++++++++++++++++++++++++--- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/second/glue.S b/second/glue.S index 25754a7..eb1f8f3 100644 --- a/second/glue.S +++ b/second/glue.S @@ -177,7 +177,7 @@ DisposePtr: unlk %fp rts - /* int PBReadSync(ParamBlockRec_t* paramBlock) */ + /* OSErr PBReadSync(ParamBlockRec_t* paramBlock) */ .global PBReadSync PBReadSync: @@ -186,3 +186,34 @@ PBReadSync: dc.w 0xA002 /* PBReadSync */ unlk %fp rts + + /* OSErr PBOpenSync(ParmBlkPtr paramBlock) */ + + .global PBOpenSync +PBOpenSync: + link %fp, #0 + move.l 8(%fp), %a0 + dc.w 0xA000 /* PBOpenSync */ + unlk %fp + rts + + /* OSErr PBCloseSync(ParmBlkPtr paramBlock) */ + + .global PBCloseSync +PBCloseSync: + link %fp, #0 + move.l 8(%fp), %a0 + dc.w 0xA001 /* PBCloseSync */ + unlk %fp + rts + + /* OSErr PBControlSync(ParmBlkPtr paramBlock) */ + + .global PBControlSync +PBControlSync: + link %fp, #0 + move.l 8(%fp), %a0 + dc.w 0xA004 /* PBControlSync */ + unlk %fp + rts + diff --git a/second/glue.h b/second/glue.h index 3a6fa87..88e1374 100644 --- a/second/glue.h +++ b/second/glue.h @@ -4,7 +4,16 @@ * */ -#define noErr 0 +typedef int16_t OSErr; + +enum { + noErr = 0 +}; + +enum { + false = 0, + true = 1 +}; struct MachineLocation { @@ -27,6 +36,17 @@ enum { fsFromMark = 3 }; +/* access permissions : Inside Macintosh: Devices + * http://developer.apple.com/documentation/mac/Devices/ + */ + +enum { + fsCurPerm = 0, /* retain current permission */ + fsRdPerm = 1, /* allow reads only */ + fsWrPerm = 2, /* allow writes only */ + fsRdWrPerm = 3 /* allow reads and writes */ +}; + typedef struct ParamBlockRec ParamBlockRec_t; struct ParamBlockRec { @@ -48,6 +68,7 @@ struct ParamBlockRec { u_int16_t ioPosMode; /* positioning mode and newline char */ int32_t ioPosOffset; /* positionning offset */ } __attribute__((packed)); +typedef struct ParamBlockRec* ParmBlkPtr; #define ASSERT_PBR(a) if ( sizeof(ParamBlockRec_t) != 50 ) { a } @@ -55,8 +76,11 @@ extern void glue_display_properties(unsigned long *base, unsigned long *row_bytes, unsigned long *width, unsigned long *height, unsigned long *depth, unsigned long *video); -extern int Gestalt(unsigned long selector, long * response); +extern OSErr Gestalt(unsigned long selector, long * response); extern void ReadLocation(MachineLocation * loc); extern void* NewPtr(unsigned long byteCount); extern void DisposePtr(void* ptr); -extern int PBReadSync(ParamBlockRec_t* paramBlock); +extern OSErr PBReadSync(ParamBlockRec_t* paramBlock); +extern OSErr PBOpenSync(ParmBlkPtr paramBlock); +extern OSErr PBCloseSync(ParmBlkPtr paramBlock); +extern OSErr PBControlSync(ParmBlkPtr paramBlock);