diff --git a/CocoaExecutor.xcodeproj/project.pbxproj b/CocoaExecutor.xcodeproj/project.pbxproj index 621a4aa1..0ca06eb8 100644 --- a/CocoaExecutor.xcodeproj/project.pbxproj +++ b/CocoaExecutor.xcodeproj/project.pbxproj @@ -973,7 +973,7 @@ 558B98751987FCBD00ADF159 /* default_ctab_values.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = default_ctab_values.cpp; sourceTree = ""; }; 558B98761987FCBD00ADF159 /* desk.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = desk.cpp; sourceTree = ""; }; 558B98771987FCBD00ADF159 /* desperate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = desperate.cpp; sourceTree = ""; }; - 558B98781987FCBD00ADF159 /* device.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = device.cpp; sourceTree = ""; usesTabs = 0; }; + 558B98781987FCBD00ADF159 /* device.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = device.cpp; sourceTree = ""; }; 558B98791987FCBD00ADF159 /* dialAlert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dialAlert.cpp; sourceTree = ""; }; 558B987A1987FCBD00ADF159 /* dialCreate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dialCreate.cpp; sourceTree = ""; }; 558B987B1987FCBD00ADF159 /* dialDispatch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dialDispatch.cpp; sourceTree = ""; }; diff --git a/OSX-only/CocoaExecutor/NeXT Classes/NEXT.mm b/OSX-only/CocoaExecutor/NeXT Classes/NEXT.mm index e0566c2d..84eb2f35 100644 --- a/OSX-only/CocoaExecutor/NeXT Classes/NEXT.mm +++ b/OSX-only/CocoaExecutor/NeXT Classes/NEXT.mm @@ -29,7 +29,6 @@ #include "ResourceMgr.h" using namespace Executor; -using namespace ByteSwap; PUBLIC keyboard_enum_t Executor::ROMlib_keyboard_type; @@ -373,8 +372,8 @@ #endif /* SANE_DEBUGGING */ ) { - p.h = BigEndianValue(MouseLocation.h); - p.v = BigEndianValue(MouseLocation.v); + p.h = CW(MouseLocation.h); + p.v = CW(MouseLocation.v); ROMlib_PPostEvent(osEvt, SUSPENDRESUMEBITS|SUSPEND|CONVERTCLIPBOARD, (HIDDEN_EvQElPtr *) 0, TickCount(), p, ROMlib_mods); } @@ -397,8 +396,8 @@ what = SUSPENDRESUMEBITS | RESUME; if (cvtclip) what |= CONVERTCLIPBOARD; - p.h = BigEndianValue(MouseLocation.h); - p.v = BigEndianValue(MouseLocation.v); + p.h = CW(MouseLocation.h); + p.v = CW(MouseLocation.v); ROMlib_PPostEvent(osEvt, what, (HIDDEN_EvQElPtr *) 0, TickCount(), p, ROMlib_mods); } @@ -408,8 +407,8 @@ { Point p; - p.h = BigEndianValue(MouseLocation.h); - p.v = BigEndianValue(MouseLocation.v); + p.h = CW(MouseLocation.h); + p.v = CW(MouseLocation.v); ROMlib_PPostEvent(keyDown, 0x0863, /* 0x63 == 'c' */ (HIDDEN_EvQElPtr *) 0, TickCount(), p, cmdKey|btnState); ROMlib_PPostEvent(keyUp, 0x0863, @@ -420,8 +419,8 @@ { Point p; - p.h = BigEndianValue(MouseLocation.h); - p.v = BigEndianValue(MouseLocation.v); + p.h = CW(MouseLocation.h); + p.v = CW(MouseLocation.v); ROMlib_PPostEvent(keyDown, 0x0976, /* 0x76 == 'v' */ (HIDDEN_EvQElPtr *) 0, TickCount(), p, cmdKey|btnState); ROMlib_PPostEvent(keyUp, 0x0976, @@ -431,8 +430,8 @@ PRIVATE void pinmouse(INTEGER *hp, INTEGER *vp, BOOLEAN swap) { if (swap) { - *hp = BigEndianValue(*hp); - *vp = BigEndianValue(*vp); + *hp = CW(*hp); + *vp = CW(*vp); } if (*hp < 0) @@ -446,15 +445,15 @@ PRIVATE void pinmouse(INTEGER *hp, INTEGER *vp, BOOLEAN swap) *vp = vdriver_height - 1; if (swap) { - *hp = BigEndianValue(*hp); - *vp = BigEndianValue(*vp); + *hp = CW(*hp); + *vp = CW(*vp); } } A1(PUBLIC, void, ROMlib_updatemouselocation, NSEvent *, neventp) /* INTERNAL */ { - MouseLocation.h = BigEndianValue ([neventp locationInWindow].x); - MouseLocation.v = BigEndianValue (vdriver_height - [neventp locationInWindow].y); + MouseLocation.h = CW ([neventp locationInWindow].x); + MouseLocation.v = CW (vdriver_height - [neventp locationInWindow].y); pinmouse(&MouseLocation.h, &MouseLocation.v, TRUE); } diff --git a/OSX-only/CocoaExecutor/NeXT Classes/NEXTkeyboard.cpp b/OSX-only/CocoaExecutor/NeXT Classes/NEXTkeyboard.cpp index f0ff98c8..fe49feff 100644 --- a/OSX-only/CocoaExecutor/NeXT Classes/NEXTkeyboard.cpp +++ b/OSX-only/CocoaExecutor/NeXT Classes/NEXTkeyboard.cpp @@ -13,12 +13,13 @@ keyboard_enum_t Executor::ROMlib_get_keyboard_type( void ) { NXEventHandle handle; NXEventSystemDevice dev[NX_EVS_DEVICE_MAX]; - unsigned int cnt = NX_EVS_DEVICE_INFO_COUNT, i; + unsigned int cnt, i; int interface, id; keyboard_enum_t retval; if ( (handle = NXOpenEventStatus()) == 0 ) return no_keyboard; + cnt = NX_EVS_DEVICE_INFO_COUNT; NXEventSystemInfo( handle, NX_EVS_DEVICE_INFO, (int *)dev, &cnt ); NXCloseEventStatus( handle ); interface = -1; diff --git a/OSX-only/CocoaExecutor/NeXT Classes/NEXTprint.mm b/OSX-only/CocoaExecutor/NeXT Classes/NEXTprint.mm index d2f0aaa2..6c4cdbf2 100644 --- a/OSX-only/CocoaExecutor/NeXT Classes/NEXTprint.mm +++ b/OSX-only/CocoaExecutor/NeXT Classes/NEXTprint.mm @@ -21,8 +21,6 @@ */ namespace Executor { -using namespace ByteSwap; - void ROMlib_newFont(char *font, float txSize) { [[NSFont fontWithName:[NSString stringWithCString:font encoding:NSMacOSRomanStringEncoding] size:txSize] set]; @@ -33,8 +31,8 @@ void ROMlib_updatenextpagerect(comRect *rp) NSSize new_paper_size; virtual_int_state_t block = block_virtual_ints(); - new_paper_size.height = BigEndianValue(rp->bottom) - BigEndianValue(rp->top); - new_paper_size.width = BigEndianValue(rp->right) - BigEndianValue(rp->left); + new_paper_size.height = CW(rp->bottom) - CW(rp->top); + new_paper_size.width = CW(rp->right) - CW(rp->left); [[NSPrintInfo sharedPrintInfo] setPaperSize:new_paper_size]; restore_virtual_ints(block); } @@ -56,17 +54,17 @@ void ROMlib_updatemacpagerect(comRect *paperp, comRect *page1p, CGFloat scaling_factor; new_size = [[NSPrintInfo sharedPrintInfo] paperSize]; - paperp->top = BigEndianValue(0 - HALFINCH); - paperp->left = BigEndianValue(0 - HALFINCH); + paperp->top = CW(0 - HALFINCH); + paperp->left = CW(0 - HALFINCH); scaling_factor = printer_scaling_factor (); - paperp->bottom = BigEndianValue(new_size.height * (1 / scaling_factor) - HALFINCH); - paperp->right = BigEndianValue(new_size.width * (1 / scaling_factor) - HALFINCH); + paperp->bottom = CW(new_size.height * (1 / scaling_factor) - HALFINCH); + paperp->right = CW(new_size.width * (1 / scaling_factor) - HALFINCH); page1p->top = page2p->top = 0; page1p->left = page2p->left = 0; - page1p->bottom = page2p->bottom = BigEndianValue(BigEndianValue(paperp->bottom) - HALFINCH); - page1p->right = page2p->right = BigEndianValue(BigEndianValue(paperp->right) - HALFINCH); + page1p->bottom = page2p->bottom = CW(CW(paperp->bottom) - HALFINCH); + page1p->right = page2p->right = CW(CW(paperp->right) - HALFINCH); restore_virtual_ints(block); } } diff --git a/src/AE.cpp b/src/AE.cpp index 9f82f9ed..07f874d4 100644 --- a/src/AE.cpp +++ b/src/AE.cpp @@ -35,9 +35,7 @@ boolean_t send_application_open_aevt_p; AEDesc * desc_out); } - using namespace Executor; -using namespace ByteSwap; /* dispatching apple events */ @@ -80,7 +78,7 @@ P1 (PUBLIC pascal trap, OSErr, AEProcessAppleEvent, if (err != bufferIsSmall) AE_RETURN_ERROR (errAEEventNotHandled); - evt_data = NewHandle (BigEndianValue (evt_data_size)); + evt_data = NewHandle (CL (evt_data_size)); if (MemError () != noErr) AE_RETURN_ERROR (MemError ()); @@ -110,7 +108,7 @@ P1 (PUBLIC pascal trap, OSErr, AEProcessAppleEvent, AEDisposeDesc (evt); AE_RETURN_ERROR (err); } - BigEndianInPlace (event_class); + event_class = CL (event_class); err = AEGetAttributePtr (evt, keyEventIDAttr, typeType, &dummy_type, @@ -120,7 +118,7 @@ P1 (PUBLIC pascal trap, OSErr, AEProcessAppleEvent, AEDisposeDesc (evt); AE_RETURN_ERROR (err); } - event_id = BigEndianValue (event_id); + event_id = CL (event_id); err = AEGetEventHandler (event_class, event_id, &hdlr, &refcon, FALSE); if (err != noErr) @@ -133,7 +131,7 @@ P1 (PUBLIC pascal trap, OSErr, AEProcessAppleEvent, } } hdlr = MR (hdlr); - refcon = BigEndianValue (refcon); + refcon = CL (refcon); { AppleEvent *reply = (AppleEvent*)alloca (sizeof *reply); @@ -151,7 +149,7 @@ P1 (PUBLIC pascal trap, OSErr, AEProcessAppleEvent, /* dummy */ -1, /* dummy */ -1, reply); - retval = CToPascalCall (&hdlr, + retval = CToPascalCall ((void*)hdlr, CTOP_EventHandlerTemplate, evt, reply, refcon); @@ -187,8 +185,8 @@ P7 (PUBLIC pascal trap, OSErr, AESend, /* ### not sure what error we should return here */ AE_RETURN_ERROR (errAEEventNotHandled); - target_type = BigEndianValue (target_type); - target_size = BigEndianValue (target_size); + target_type = CL (target_type); + target_size = CL (target_size); if (err != noErr) AE_RETURN_ERROR (err); @@ -434,7 +432,7 @@ P5 (PUBLIC pascal trap, OSErr, AECoercePtr, /* swap things to a normal state */ coercion_hdlr = MR (coercion_hdlr); - BigEndianInPlace (refcon); + refcon = CL (refcon); if (is_desc_hdlr_p) { @@ -444,14 +442,14 @@ P5 (PUBLIC pascal trap, OSErr, AECoercePtr, if (err != noErr) return memFullErr; - err = CToPascalCall (&coercion_hdlr, PTOC_CoerceDescTemplate, + err = CToPascalCall ((void*)coercion_hdlr, PTOC_CoerceDescTemplate, desc, result_type, refcon, desc_out); AEDisposeDesc (desc); } else { - err = CToPascalCall (&coercion_hdlr, PTOC_CoercePtrTemplate, + err = CToPascalCall ((void*)coercion_hdlr, PTOC_CoercePtrTemplate, data_type, data, data_size, result_type, refcon, desc_out); } @@ -484,7 +482,7 @@ parse_evt (const AppleEvent *evtp, AEDesc *desc_out) LONGINT n; retval = AECountItems (&d, &n); - n = BigEndianValue (n); + n = CL (n); if (retval == noErr) { Handle h; @@ -498,7 +496,7 @@ parse_evt (const AppleEvent *evtp, AEDesc *desc_out) LONGINT l; p->magic = CLC (APP_PARAMS_MAGIC); - p->n_fsspec = BigEndianValue (n); + p->n_fsspec = CW (n); for (l = 1; retval == noErr && l <= n; ++l) { AEDesc d2; @@ -568,11 +566,11 @@ P3 (PUBLIC pascal trap, OSErr, AECoerceDesc, /* swap things to a normal state */ coercion_hdlr = MR (coercion_hdlr); - refcon = BigEndianValue (refcon); + refcon = CL (refcon); if (is_desc_hdlr_p) { - err = CToPascalCall (&coercion_hdlr, PTOC_CoerceDescTemplate, + err = CToPascalCall((void*)coercion_hdlr, PTOC_CoerceDescTemplate, desc, result_type, refcon, desc_out); } else @@ -584,7 +582,7 @@ P3 (PUBLIC pascal trap, OSErr, AECoerceDesc, LOCK_HANDLE_EXCURSION_1 (desc_data, { - err = CToPascalCall (&coercion_hdlr, PTOC_CoercePtrTemplate, + err = CToPascalCall((void*)coercion_hdlr, PTOC_CoercePtrTemplate, desc_type, STARH (desc_data), GetHandleSize (desc_data), result_type, refcon, desc_out); diff --git a/src/AE_desc.cpp b/src/AE_desc.cpp index a23561a9..6f3228c5 100644 --- a/src/AE_desc.cpp +++ b/src/AE_desc.cpp @@ -16,7 +16,6 @@ char ROMlib_rcsid_AE_desc[] = #include "rsys/apple_events.h" using namespace Executor; -using namespace ByteSwap; #define LIST_CLASS_P(desc) \ ( DESC_TYPE_X (desc) == CLC (typeAEList) \ @@ -65,7 +64,7 @@ get_subdesc_info (Handle aggr_desc_h, subdesc_info_t *info, info->base_offset = (offsetof (ae_header_t, target) /* type, key, size */ + 12 - + BigEndianValue (inline_target_desc->size) + + CL (inline_target_desc->size) /* two unknown longs */ + 8); } @@ -102,7 +101,7 @@ desc_offset (Handle aggr_desc_h, int index, subdesc_info_t *info, else desc = (inline_desc_t *) t; - t += (BigEndianValue (desc->size) + t += (CL (desc->size) /* inline key desc header size */ + info->inline_desc_header_size); } @@ -189,7 +188,7 @@ aggr_desc_get_addr (Handle aggr_desc_h, if (index == info.count + 1) old_size = 0; else - old_size = BigEndianValue (inline_desc->size) + info.inline_desc_header_size; + old_size = CL (inline_desc->size) + info.inline_desc_header_size; if (delete_p) new_size = 0; @@ -205,7 +204,7 @@ aggr_desc_get_addr (Handle aggr_desc_h, SetHandleSize (aggr_desc_h, aggr_desc_size + diff); if (MemErr != CWC (noErr)) - AE_RETURN_ERROR (BigEndianValue (MemErr)); + AE_RETURN_ERROR (CW (MemErr)); aggr_desc_p = (char *) STARH (aggr_desc_h); if (aggr_desc_size < offset + old_size) abort (); @@ -224,7 +223,7 @@ aggr_desc_get_addr (Handle aggr_desc_h, aggr_desc_size - offset - old_size); SetHandleSize (aggr_desc_h, aggr_desc_size - diff); if (MemErr != CWC (noErr)) - AE_RETURN_ERROR (BigEndianValue (MemErr)); + AE_RETURN_ERROR (CW (MemErr)); aggr_desc_p = (char *) STARH (aggr_desc_h); } memset (aggr_desc_p + offset, '\000', new_size); @@ -241,7 +240,7 @@ aggr_desc_get_addr (Handle aggr_desc_h, if (attribute_p) { PARAM_OFFSET_X (aggr_desc_h) - = BigEndianValue (PARAM_OFFSET (aggr_desc_h) - old_size + new_size); + = CL (PARAM_OFFSET (aggr_desc_h) - old_size + new_size); } if (! delete_p) @@ -249,22 +248,22 @@ aggr_desc_get_addr (Handle aggr_desc_h, if (index == info.count + 1) { info.count ++; - *(info.count_p) = BigEndianValue (info.count); + *(info.count_p) = CL (info.count); } - inline_desc->size = BigEndianValue (*size_return); + inline_desc->size = CL (*size_return); } else { info.count --; - *(info.count_p) = BigEndianValue (info.count); + *(info.count_p) = CL (info.count); } } if (! delete_p) { *addr_return = (aggr_desc_p + offset); - *size_return = BigEndianValue (inline_desc->size); + *size_return = CL (inline_desc->size); } AE_RETURN_ERROR (noErr); @@ -287,13 +286,13 @@ find_key_index (Handle aggr_desc_h, int32 keyword, boolean_t attribute_p, inline_key_desc = (inline_key_desc_t *) t; - if (BigEndianValue (inline_key_desc->key) == keyword) + if (CL (inline_key_desc->key) == keyword) { *index_return = count; return TRUE; } - t += (BigEndianValue (inline_key_desc->size) + t += (CL (inline_key_desc->size) /* inline key desc header size */ + 12); } @@ -345,7 +344,7 @@ aggr_put_nth_desc (Handle aggr_handle, return FALSE; } - inline_desc->type = BigEndianValue (in_desc_type); + inline_desc->type = CL (in_desc_type); memcpy (inline_desc->data, STARH (in_desc_data), size); *out_failcode = noErr; @@ -378,7 +377,7 @@ aggr_get_nth_desc (Handle aggr_handle, LOCK_HANDLE_EXCURSION_1 (aggr_handle, { - err = AECreateDesc (BigEndianValue (inline_out_desc->type), + err = AECreateDesc (CL (inline_out_desc->type), (Ptr) inline_out_desc->data, size, out_desc); }); @@ -396,7 +395,7 @@ aggr_get_nth_desc (Handle aggr_handle, LOCK_HANDLE_EXCURSION_1 (aggr_handle, { - err = AECreateDesc (BigEndianValue (inline_out_desc->type), + err = AECreateDesc (CL (inline_out_desc->type), (Ptr) inline_out_desc->data, size, out_desc); }); @@ -439,8 +438,8 @@ aggr_put_key_desc (Handle aggr_handle, if (err != noErr) return FALSE; - inline_key_desc->key = BigEndianValue (keyword); - inline_key_desc->type = BigEndianValue (in_desc_type); + inline_key_desc->key = CL (keyword); + inline_key_desc->type = CL (in_desc_type); memcpy (inline_key_desc->data, STARH (in_desc_data), size); return TRUE; @@ -475,8 +474,8 @@ aggr_get_key_desc (Handle aggr_handle, LOCK_HANDLE_EXCURSION_1 (aggr_handle, { - err = AECreateDesc (BigEndianValue (target->type), - (Ptr) target->data, BigEndianValue (target->size), + err = AECreateDesc (CL (target->type), + (Ptr) target->data, CL (target->size), out_desc); }); if (err != noErr) @@ -527,7 +526,7 @@ aggr_get_key_desc (Handle aggr_handle, LOCK_HANDLE_EXCURSION_1 (aggr_handle, { - err = AECreateDesc (BigEndianValue (inline_key_desc->type), + err = AECreateDesc (CL (inline_key_desc->type), (Ptr) inline_key_desc->data, size, out_desc); }); @@ -582,7 +581,7 @@ ae_desc_to_ptr (descriptor_t *desc, memcpy (data, STARH (desc_data), copy_size); - *size_out = BigEndianValue (copy_size); + *size_out = CL (copy_size); } #if 0 @@ -620,7 +619,7 @@ dump_union_desc (union desc *foo, boolean_t key_pair_p) (type >> 0) & 0xFF); ae_desc_to_ptr (desc, (Ptr) data, 1024, &size); - size = BigEndianValue (size); + size = CL (size); switch (type) { @@ -704,13 +703,13 @@ P6 (PUBLIC pascal trap, OSErr, AECreateAppleEvent, event_data = (ae_header_t *)alloca (event_size); memset (event_data, '\000', event_size); - event_data->param_offset = BigEndianValue (event_size + 2); + event_data->param_offset = CL (event_size + 2); - event_data->event_class = BigEndianValue (event_class); - event_data->event_id = BigEndianValue (event_id); + event_data->event_class = CL (event_class); + event_data->event_id = CL (event_id); - event_data->target.size = BigEndianValue (target_size); - event_data->target.type = BigEndianValue (target_type); + event_data->target.size = CL (target_size); + event_data->target.type = CL (target_type); memcpy (&event_data->target.data[0], STARH (target_data), target_size); { @@ -758,7 +757,7 @@ P4 (PUBLIC pascal trap, OSErr, AECreateDesc, memset (STARH (h), 0, data_size); } - DESC_TYPE_X (desc_out) = BigEndianValue (type); + DESC_TYPE_X (desc_out) = CL (type); DESC_DATA_X (desc_out) = RM (h); AE_RETURN_ERROR (noErr); @@ -806,7 +805,7 @@ P4 (PUBLIC pascal trap, OSErr, AECreateList, memset (&header, '\000', sizeof header); - header.attribute_count = BigEndianValue (type); + header.attribute_count = CL (type); header.param_offset = CLC (0x18); AE_RETURN_ERROR (AECreateDesc (type, @@ -826,7 +825,7 @@ P2 (PUBLIC pascal trap, OSErr, AECountItems, if (err != noErr) AE_RETURN_ERROR (err); - *count_out = BigEndianValue (info.count); + *count_out = CL (info.count); AE_RETURN_ERROR (noErr); } @@ -931,7 +930,7 @@ P4 (PUBLIC pascal trap, OSErr, AESizeOfNthItem, AE_RETURN_ERROR (errAEIllegalIndex); *type_out = DESC_TYPE_X (desc); - *size_out = BigEndianValue (GetHandleSize ((Handle) DESC_DATA (desc))); + *size_out = CL (GetHandleSize ((Handle) DESC_DATA (desc))); AE_RETURN_ERROR (noErr); } @@ -1041,7 +1040,7 @@ P4 (PUBLIC pascal trap, OSErr, AESizeOfKeyDesc, AE_RETURN_ERROR (errAEDescNotFound); *type_out = DESC_TYPE_X (desc); - *size_out = BigEndianValue (GetHandleSize ((Handle) DESC_DATA (desc))); + *size_out = CL (GetHandleSize ((Handle) DESC_DATA (desc))); AE_RETURN_ERROR (noErr); } @@ -1155,7 +1154,7 @@ P4 (PUBLIC pascal trap, OSErr, AESizeOfAttribute, AE_RETURN_ERROR (errAEDescNotFound); *type_out = DESC_TYPE_X (desc); - *size_out = BigEndianValue (GetHandleSize ((Handle) DESC_DATA (desc))); + *size_out = CL (GetHandleSize ((Handle) DESC_DATA (desc))); AE_RETURN_ERROR (noErr); } diff --git a/src/AE_hdlr.cpp b/src/AE_hdlr.cpp index 488efb99..116cb0e0 100644 --- a/src/AE_hdlr.cpp +++ b/src/AE_hdlr.cpp @@ -17,7 +17,6 @@ char ROMlib_rcsid_AE_hdlr[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; #define hdlr_table(system_p, class) \ ({ \ @@ -131,14 +130,14 @@ hdlr_table_elt (AE_hdlr_table_h table, { n_elts ++; - AE_TABLE_N_ELTS_X (table) = BigEndianValue (n_elts); + AE_TABLE_N_ELTS_X (table) = CL (n_elts); SetHandleSize ((Handle) table, (sizeof (AE_hdlr_table_t) + n_elts * sizeof (AE_hdlr_table_elt_t))); if (MemErr != CWC (noErr)) - AE_RETURN_ERROR (BigEndianValue (MemErr)); + AE_RETURN_ERROR (CW (MemErr)); elts = AE_TABLE_ELTS (table); elt = &elts[n_elts - 1]; @@ -171,7 +170,7 @@ P5 (PUBLIC pascal trap, OSErr, _AE_hdlr_table_alloc, first argument */ table = (AE_hdlr_table_h) NewHandleClear (52); if (MemErr != CWC (noErr)) - AE_RETURN_ERROR (BigEndianValue (MemErr)); + AE_RETURN_ERROR (CW (MemErr)); AE_TABLE_N_ALLOCATED_BYTES_X (table) = CLC (52); AE_TABLE_N_ELTS_X (table) = CLC (0); @@ -201,7 +200,7 @@ P3 (PUBLIC pascal trap, OSErr, _AE_hdlr_delete, memmove (&elts[elt_offset + 1], &elts[elt_offset], (n_elts - elt_offset - 1) * sizeof *elts); - AE_TABLE_N_ELTS_X (table) = BigEndianValue (n_elts - 1); + AE_TABLE_N_ELTS_X (table) = CL (n_elts - 1); AE_RETURN_ERROR (noErr); } @@ -258,11 +257,11 @@ P5 (PUBLIC pascal trap, OSErr, AEInstallEventHandler, table = hdlr_table (system_handler_p, event); - selector.sel0 = BigEndianValue (event_class); - selector.sel1 = BigEndianValue (event_id); + selector.sel0 = CL (event_class); + selector.sel1 = CL (event_id); hdlr.fn = RM (hdlr_fn); - hdlr.refcon = BigEndianValue (refcon); + hdlr.refcon = CL (refcon); err = hdlr_table_elt (table, &selector, &hdlr, TRUE, &elt); if (err != noErr) @@ -307,8 +306,8 @@ P5 (PUBLIC pascal trap, OSErr, AEGetEventHandler, table = hdlr_table (system_handler_p, event); - selector.sel0 = BigEndianValue (event_class); - selector.sel1 = BigEndianValue (event_id); + selector.sel0 = CL (event_class); + selector.sel1 = CL (event_id); err = hdlr_table_elt (table, &selector, NULL, FALSE, &elt); if (err != noErr) @@ -361,11 +360,11 @@ P6 (PUBLIC pascal trap, OSErr, AEInstallCoercionHandler, table = hdlr_table (system_handler_p, coercion); - selector.sel0 = BigEndianValue (from_type); - selector.sel1 = BigEndianValue (to_type); + selector.sel0 = CL (from_type); + selector.sel1 = CL (to_type); hdlr.fn = RM (hdlr_fn); - hdlr.refcon = BigEndianValue (refcon); + hdlr.refcon = CL (refcon); err = hdlr_table_elt (table, &selector, &hdlr, TRUE, &elt); if (err != noErr) @@ -392,8 +391,8 @@ P6 (PUBLIC pascal trap, OSErr, AEGetCoercionHandler, table = hdlr_table (system_handler_p, coercion); - selector.sel0 = BigEndianValue (from_type); - selector.sel1 = BigEndianValue (to_type); + selector.sel0 = CL (from_type); + selector.sel1 = CL (to_type); err = hdlr_table_elt (table, &selector, NULL, FALSE, &elt); if (err != noErr) @@ -452,11 +451,11 @@ P3 (PUBLIC pascal trap, OSErr, AEInstallSpecialHandler, table = hdlr_table (system_handler_p, special); - selector.sel0 = BigEndianValue (function_class); - selector.sel1 = BigEndianValue (k_special_sel1); + selector.sel0 = CL (function_class); + selector.sel1 = CL (k_special_sel1); hdlr.fn = RM (hdlr_fn); - hdlr.refcon = BigEndianValue (-1); + hdlr.refcon = CL (-1); err = hdlr_table_elt (table, &selector, &hdlr, TRUE, &elt); if (err != noErr) @@ -479,8 +478,8 @@ P3 (PUBLIC pascal trap, OSErr, AEGetSpecialHandler, table = hdlr_table (system_handler_p, special); - selector.sel0 = BigEndianValue (function_class); - selector.sel1 = BigEndianValue (k_special_sel1); + selector.sel0 = CL (function_class); + selector.sel1 = CL (k_special_sel1); err = hdlr_table_elt (table, &selector, NULL, FALSE, &elt); if (err != noErr) @@ -501,8 +500,8 @@ P3 (PUBLIC pascal trap, OSErr, AERemoveSpecialHandler, table = hdlr_table (system_handler_p, special); - selector.sel0 = BigEndianValue (function_class); - selector.sel1 = BigEndianValue (k_special_sel1); + selector.sel0 = CL (function_class); + selector.sel1 = CL (k_special_sel1); /* #### fail if `hdlr' is not the currently installed handler? */ AE_RETURN_ERROR (_AE_hdlr_delete (table, 0, &selector)); diff --git a/src/CBridge.cpp b/src/CBridge.cpp index 17a1c32c..24f742ea 100644 --- a/src/CBridge.cpp +++ b/src/CBridge.cpp @@ -20,7 +20,7 @@ using namespace Executor; extern "C" { -#include "CFriendly.h" +#include "rsys/CFriendly.h" } #undef getthecrc diff --git a/src/Makefile.am b/src/Makefile.am index fd0b74bb..dc61a510 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,110 +4,116 @@ bin_PROGRAMS = executor noinst_PROGRAMS = map_to_c mkseedtables mkultable mksspairtable -ctl_bitmap_c_files = arrow_up_active.c arrow_up_inactive.c \ - arrow_down_active.c arrow_down_inactive.c \ - arrow_right_active.c arrow_right_inactive.c \ - arrow_left_active.c arrow_left_inactive.c \ - thumb_horiz.c thumb_vert.c +ctl_bitmap_c_files = arrow_up_active.cmap arrow_up_inactive.cmap \ + arrow_down_active.cmap arrow_down_inactive.cmap \ + arrow_right_active.cmap arrow_right_inactive.cmap \ + arrow_left_active.cmap arrow_left_inactive.cmap \ + thumb_horiz.cmap thumb_vert.cmap -wind_bitmap_c_files = zoom.c go_away.c active.c ractive.c grow.c +wind_bitmap_c_files = zoom.cmap go_away.cmap active.cmap ractive.cmap grow.cmap -CLEANFILES = $(ctl_bitmap_c_files) $(wind_bitmap_c_files) apple.c \ - seedtables.c ultable.c sspairtable.c rawpatstubs.c rawsrcstubs.c +CLEANFILES = $(ctl_bitmap_c_files) $(wind_bitmap_c_files) apple.cmap \ + seedtables.ctable ultable.ctable sspairtable.ctable rawpatstubs.cpp rawsrcstubs.cpp -$(ctl_bitmap_c_files) apple.c $(wind_bitmap_c_files): map_to_c +$(ctl_bitmap_c_files) apple.cpp $(wind_bitmap_c_files): map_to_c -.map.c: map_to_c +map_to_c_SOURCES = map_to_c/map_to_c.cpp +mkseedtables_SOURCES = mkseedtables/mkseedtables.c +mkultable_SOURCES = mkultable/mkultable.c +mksspairtable_SOURCES = mksspairtable/mksspairtable.c + +.map.cmap: map_to_c ./map_to_c < $< > $@ -seedtables.c: mkseedtables +seedtables.ctable: mkseedtables ./mkseedtables > $@ -ultable.c: mkultable +ultable.ctable: mkultable ./mkultable > $@ -sspairtable.c: mksspairtable +sspairtable.ctable: mksspairtable ./mksspairtable > $@ -rawpatstubs.c: $(srcdir)/makerawblt.pl $(srcdir)/pat-blitters.tmpl - $(PERL) $(srcdir)/makerawblt.pl < $(srcdir)/pat-blitters.tmpl > rawpatstubs.c +rawpatstubs.cpp: $(srcdir)/makerawblt.pl $(srcdir)/pat-blitters.tmpl + $(PERL) $(srcdir)/makerawblt.pl < $(srcdir)/pat-blitters.tmpl > rawpatstubs.cpp -rawsrcstubs.c: $(srcdir)/makerawblt.pl $(srcdir)/src-blitters.tmpl - $(PERL) $(srcdir)/makerawblt.pl < $(srcdir)/src-blitters.tmpl > rawsrcstubs.c +rawsrcstubs.cpp: $(srcdir)/makerawblt.pl $(srcdir)/src-blitters.tmpl + $(PERL) $(srcdir)/makerawblt.pl < $(srcdir)/src-blitters.tmpl > rawsrcstubs.cpp ctlArrows.$(OBJEXT): $(ctl_bitmap_c_files) -stdmbdf.$(OBJEXT): apple.c -qIMIV.$(OBJEXT): seedtables.c -qStdText.$(OBJEXT): ultable.c -qIMVI.$(OBJEXT): sspairtable.c -rawpatblt.$(OBJEXT): rawpatstubs.c -rawsrcblt.$(OBJEXT): rawsrcstubs.c +stdmbdf.$(OBJEXT): apple.cmap +qIMIV.$(OBJEXT): seedtables.ctable +qStdText.$(OBJEXT): ultable.ctable +qIMVI.$(OBJEXT): sspairtable.ctable +rawpatblt.$(OBJEXT): rawpatstubs.cpp +rawsrcblt.$(OBJEXT): rawsrcstubs.cpp windDocdef.$(OBJEXT): $(wind_bitmap_c_files) # These helper variables break the source into logical groups, but there's # no actual significance to them. -ctl_sources = ctlArrows.c ctlDisplay.c ctlIMIV.c ctlInit.c ctlMisc.c \ - ctlMouse.c ctlSet.c ctlSize.c ctlStddef.c ctlPopup.c +ctl_sources = ctlArrows.cpp ctlDisplay.cpp ctlIMIV.cpp ctlInit.cpp ctlMisc.cpp \ + ctlMouse.cpp ctlSet.cpp ctlSize.cpp ctlStddef.cpp ctlPopup.cpp -dial_sources = dialAlert.c dialCreate.c dialHandle.c dialInit.c dialManip.c \ - dialDispatch.c dialItem.c +dial_sources = dialAlert.cpp dialCreate.cpp dialHandle.cpp dialInit.cpp dialManip.cpp \ + dialDispatch.cpp dialItem.cpp -file_sources = fileAccess.c fileCreate.c fileDirs.c fileDouble.c fileInfo.c \ - fileMisc.c fileVolumes.c fileHighlevel.c dcache.c +file_sources = fileAccess.cpp fileCreate.cpp fileDirs.cpp fileDouble.cpp fileInfo.cpp \ + fileMisc.cpp fileVolumes.cpp fileHighlevel.cpp dcache.cpp -hfs_sources = hfsBtree.c hfsChanging.c hfsCreate.c hfsFile.c hfsHelper.c \ - hfsHier.c hfsMisc.c hfsVolume.c hfsWorkingdir.c hfsXbar.c +hfs_sources = hfsBtree.cpp hfsChanging.cpp hfsCreate.cpp hfsFile.cpp hfsHelper.cpp \ + hfsHier.cpp hfsMisc.cpp hfsVolume.cpp hfsWorkingdir.cpp hfsXbar.cpp -list_sources = listAccess.c listAddDel.c listCreate.c listDisplay.c \ - listMouse.c listOps.c listStdLDEF.c +list_sources = listAccess.cpp listAddDel.cpp listCreate.cpp listDisplay.cpp \ + listMouse.cpp listOps.cpp listStdLDEF.cpp -menu_sources = menu.c menuColor.c menuV.c stdmdef.c stdmbdf.c +menu_sources = menu.cpp menuColor.cpp menuV.cpp stdmdef.cpp stdmbdf.cpp -print_sources = PSprint.c PSstrings.c prError.c prInit.c prLowLevel.c \ - prPrinting.c prRecords.c +print_sources = PSprint.cpp PSstrings.cpp prError.cpp prInit.cpp prLowLevel.cpp \ + prPrinting.cpp prRecords.cpp -qd_sources = qBit.c qCConv.c qCGrafPort.c qCRegular.c qColor.c qColorMgr.c \ - qColorutil.c qCursor.c qGrafport.c qIMIV.c qIMV.c qIMVxfer.c \ - qMisc.c qPaletteMgr.c qPen.c qPicstuff.c qPicture.c \ - qPixMapConv.c qPoint.c qPoly.c qRect.c qRegion.c qRegular.c \ - qScale.c qStandard.c qStdArc.c qStdBits.c qStdLine.c qStdOval.c \ - qStdPic.c qStdPoly.c qStdRRect.c qStdRect.c qStdRgn.c \ - qStdText.c qText.c qGWorld.c qGDevice.c qIMVI.c qHooks.c \ - xdata.c xdblt.c rawpatblt.c rawsrcblt.c dirtyrect.c srcblt.c \ - qColorPicker.c qPict2.c image.c image_inits.c \ - default_ctab_values.c dcconvert.c rgbutil.c dcmaketables.c +qd_sources = qBit.cpp qCConv.cpp qCGrafPort.cpp qCRegular.cpp qColor.cpp qColorMgr.cpp \ + qColorutil.cpp qCursor.cpp qGrafport.cpp qIMIV.cpp qIMV.cpp qIMVxfer.cpp \ + qMisc.cpp qPaletteMgr.cpp qPen.cpp qPicstuff.cpp qPicture.cpp \ + qPixMapConv.cpp qPoint.cpp qPoly.cpp qRect.cpp qRegion.cpp qRegular.cpp \ + qScale.cpp qStandard.cpp qStdArc.cpp qStdBits.cpp qStdLine.cpp qStdOval.cpp \ + qStdPic.cpp qStdPoly.cpp qStdRRect.cpp qStdRect.cpp qStdRgn.cpp \ + qStdText.cpp qText.cpp qGWorld.cpp qGDevice.cpp qIMVI.cpp qHooks.cpp \ + xdata.cpp xdblt.cpp rawpatblt.cpp rawsrcblt.cpp dirtyrect.cpp srcblt.cpp \ + qColorPicker.cpp qPict2.cpp image.cpp image_inits.cpp \ + default_ctab_values.cpp dcconvert.cpp rgbutil.cpp dcmaketables.cpp -res_sources = resGet.c resGetinfo.c resGettype.c resIMIV.c resInit.c \ - resMisc.c resMod.c resOpen.c resSetcur.c resPartial.c +res_sources = resGet.cpp resGetinfo.cpp resGettype.cpp resIMIV.cpp resInit.cpp \ + resMisc.cpp resMod.cpp resOpen.cpp resSetcur.cpp resPartial.cpp -te_sources = teAccess.c teDisplay.c teEdit.c teIMIV.c teIMV.c teInit.c \ - teInsert.c teMisc.c teScrap.c +te_sources = teAccess.cpp teDisplay.cpp teEdit.cpp teIMIV.cpp teIMV.cpp teInit.cpp \ + teInsert.cpp teMisc.cpp teScrap.cpp -wind_sources = windColor.c windDisplay.c windDocdef.c windInit.c windMisc.c \ - windMouse.c windSize.c windUpdate.c +wind_sources = windColor.cpp windDisplay.cpp windDocdef.cpp windInit.cpp windMisc.cpp \ + windMouse.cpp windSize.cpp windUpdate.cpp -ae_sources = AE.c AE_desc.c AE_hdlr.c AE_coercion.c +ae_sources = AE.cpp AE_desc.cpp AE_hdlr.cpp AE_coercion.cpp -sound_sources = sounddriver.c sound.c soundIMVI.c soundfake.c snth5.c +sound_sources = sounddriver.cpp sound.cpp soundIMVI.cpp soundfake.cpp snth5.cpp \ + SpeechManager.cpp -num_sources = bindec.c float4.c float5.c float7.c floatnext.c toolmath.c \ - mathlib.c +num_sources = bindec.cpp float4.cpp float5.cpp float7.cpp floatnext.cpp toolmath.cpp \ + mathlib.cpp -misc_sources = desk.c device.c disk.c diskinit.c dump.c trapname.c font.c \ - gestalt.c globals.c iu.c launch.c main.c mman.c mmansubr.c notify.c hle.c \ - osevent.c osutil.c pack.c scrap.c script.c segment.c serial.c setuid.c \ - slash.c stdfile.c romlib_stubs.c syserr.c toolevent.c toolutil.c time.c \ - vbl.c syncint.c virtualint.c refresh.c autorefresh.c aboutbox.c \ - licensetext.c keycode.c option.c parseopt.c parsenum.c desperate.c \ - version.c shutdown.c uniquefile.c sigio_multiplex.c screen-dump.c \ - process.c alias.c string.c tempmem.c edition.c fontIMVI.c balloon.c \ - error.c adb.c color_wheel_bits.c finder.c system_error.c ibm_keycodes.c \ - splash.c icon.c redrawscreen.c ini.c checkpoint.c qt.c cleanup.c \ - paramline.c fauxdbm.c custom.c commtool.c cfm.c local_charset.c pef_hash.c \ - interfacelib.c mixed_mode.c suffix_maps.c appearance.c lockrange.c \ - emutrap.c emutraptables.c emustubs.c unix_like.c parse.y check_structs.c \ - executor.c mkvol/mkvol.c crc.c +misc_sources = desk.cpp device.cpp disk.cpp diskinit.cpp dump.cpp trapname.cpp font.cpp \ + gestalt.cpp globals.cpp iu.cpp launch.cpp main.cpp mman.cpp mmansubr.cpp notify.cpp hle.cpp \ + osevent.cpp osutil.cpp pack.cpp scrap.cpp script.cpp segment.cpp serial.cpp setuid.cpp \ + slash.cpp stdfile.cpp romlib_stubs.cpp syserr.cpp toolevent.cpp toolutil.cpp time.cpp \ + vbl.cpp syncint.cpp virtualint.cpp refresh.cpp autorefresh.cpp aboutbox.cpp \ + keycode.cpp option.cpp parseopt.cpp parsenum.cpp desperate.cpp \ + version.cpp shutdown.cpp uniquefile.cpp sigio_multiplex.cpp screen-dump.cpp \ + process.cpp alias.cpp string.cpp tempmem.cpp edition.cpp fontIMVI.cpp balloon.cpp \ + error.cpp adb.cpp color_wheel_bits.cpp finder.cpp system_error.cpp ibm_keycodes.cpp \ + splash.cpp icon.cpp redrawscreen.cpp ini.cpp checkpoint.cpp qt.cpp cleanup.cpp \ + paramline.c fauxdbm.cpp custom.cpp commtool.cpp cfm.cpp local_charset.cpp pef_hash.cpp \ + interfacelib.cpp mixed_mode.cpp suffix_maps.cpp appearance.cpp lockrange.cpp \ + emutrap.cpp emutraptables.cpp emustubs.cpp unix_like.cpp parse.y check_structs.cpp \ + executor.cpp mkvol/mkvol.cpp crc.cpp CBridge.cpp include_sources = hintemplate.h \ include/ADB.h \ @@ -373,7 +379,7 @@ AM_CPPFLAGS=-I$(srcdir)/include -I$(srcdir)/config/front-ends/$(front_end) -I$(s nodist_executor_SOURCES = if CONFIG_ARCH_ALPHA -arch_sources = config/arch/alpha/alpha.c config/arch/alpha/alpha.h +arch_sources = config/arch/alpha/alpha.cpp config/arch/alpha/alpha.h endif CONFIG_ARCH_ALPHA if CONFIG_ARCH_I386 @@ -381,7 +387,7 @@ if CONFIG_ARCH_I386 CLEANFILES += src-blitters.h src-blitters.s pat-blitters.h pat-blitters.s \ asmsamples.h src-blitters-stamp pat-blitters-stamp opfind -opfind_SOURCES = config/arch/i386/opfind.c +opfind_SOURCES = config/arch/i386/opfind.cpp opfind_CPPFLAGS = -DCOMPILE_FOR_BUILD $(AM_CPPFLAGS) @@ -390,19 +396,19 @@ x86patblt.$(OBJEXT): pat-blitters.s x86srcblt.$(OBJEXT): src-blitters.s pat-blitters-stamp pat-blitters.h pat-blitters.s: \ - config/arch/i386/opfind.c config/arch/i386/opfind.h \ + config/arch/i386/opfind.cpp config/arch/i386/opfind.h \ config/arch/i386/metaasm.pl config/arch/i386/pat-blitters.meta $(PERL) $(srcdir)/config/arch/i386/metaasm.pl $(METAASM_ARGS)\ $(srcdir)/config/arch/i386/pat-blitters.meta\ pat-blitters.s pat-blitters.h\ - config/arch/i386/opfind.c + config/arch/i386/opfind.cpp $(RM) asmsamples.h touch pat-blitters-stamp # We have src-blitters-stamp depend on pat-blitters-stamp so we don't # try to do two metaasm's at once. They would fight over `opfind'. src-blitters-stamp src-blitters.h src-blitters.s: \ - config/arch/i386/opfind.c config/arch/i386/opfind.h \ + config/arch/i386/opfind.cpp config/arch/i386/opfind.h \ config/arch/i386/metaasm.pl \ config/arch/i386/src-blitters.meta \ config/arch/i386/src-shift.meta \ @@ -413,10 +419,10 @@ src-blitters-stamp src-blitters.h src-blitters.s: \ $(PERL) $(srcdir)/config/arch/i386/metaasm.pl -define DST_SEG= $(METAASM_ARGS)\ $(srcdir)/config/arch/i386/src-blitters.meta\ src-blitters.s src-blitters.h\ - config/arch/i386/opfind.c + config/arch/i386/opfind.cpp touch src-blitters-stamp -arch_sources = config/arch/i386/i386.c \ +arch_sources = config/arch/i386/i386.cpp \ config/arch/i386/i386.h \ config/arch/i386/i386_djgpp_version.h \ config/arch/i386/opfind.h \ @@ -436,8 +442,8 @@ noinst_PROGRAMS += opfind arch_sources += config/arch/i386/x86patblt.S \ config/arch/i386/x86srcblt.S \ - config/arch/i386/xdstubtables.c \ - config/arch/i386/sbstubtables.c \ + config/arch/i386/xdstubtables.cpp \ + config/arch/i386/sbstubtables.cpp \ config/arch/i386/metaasm.pl endif !CONFIG_OS_MACOSX @@ -448,12 +454,12 @@ if CONFIG_ARCH_M68K nodist_executor_SOURCES += m68k-callback-stubs.s -arch_sources = config/arch/m68k/m68k.c \ - config/arch/m68k/m68k-callback.c \ +arch_sources = config/arch/m68k/m68k.cpp \ + config/arch/m68k/m68k-callback.cpp \ config/arch/m68k/m68k-callback-handler.s \ config/arch/m68k/m68k-call-emulator.s \ - config/arch/m68k/m68k-destroy.c \ - config/arch/m68k/m68k-stack.c \ + config/arch/m68k/m68k-destroy.cpp \ + config/arch/m68k/m68k-stack.cpp \ config/arch/m68k/m68k-trap-handler.s \ config/arch/m68k/trap.S \ config/arch/m68k/m68k-stack.h \ @@ -475,9 +481,9 @@ m68k-callback-stubs.s: config/arch/m68k/make_callback_stubs.pl \ # code from our old build system here, but commented out. This will fail, but # at least it will give anyone playing with the 68k build a hint. # -# m68k-callback.o: m68k-callback.c +# m68k-callback.o: m68k-callback.cpp # $(BUILD_GCC) $(BUILD_CFLAGS) -DNUM_CALLBACK_SLOTS=$(max_callbacks)\ -# $(HOST_ARCH_DIR)/m68k-callback.c -c -o m68k-callback.o +# $(HOST_ARCH_DIR)/m68k-callback.cpp -c -o m68k-callback.o endif CONFIG_ARCH_M68K @@ -487,9 +493,9 @@ if CONFIG_ARCH_POWERPC # get the compiler to help us run PPC binaries. That ability hasn't # worked since we started doing PPC builds on Mac OS X. -arch_sources = config/arch/powerpc/powerpc.c \ - config/arch/powerpc/ppc_call.c \ - config/arch/powerpc/ppc_stubs.c \ +arch_sources = config/arch/powerpc/powerpc.cpp \ + config/arch/powerpc/ppc_call.cpp \ + config/arch/powerpc/ppc_stubs.cpp \ config/arch/powerpc/powerpc.h config/arch/powerpc/ppc_stubs.h @@ -497,7 +503,7 @@ AM_CPPFLAGS += -D_GNU_SOURCE endif CONFIG_ARCH_POWERPC if CONFIG_ARCH_X86_64 -arch_sources = config/arch/x86_64/x86_64.c config/arch/x86_64/x86_64.h +arch_sources = config/arch/x86_64/x86_64.cpp config/arch/x86_64/x86_64.h endif CONFIG_ARCH_X86_64 @@ -506,16 +512,16 @@ if CONFIG_FRONT_END_DOS # we'll rip all the DOS support out of the code before ever making it go, but # if you're adventurous and want to play, feel free. -front_end_sources = config/front-ends/dos/dosclip.c \ - config/front-ends/dos/dosdisk.c \ - config/front-ends/dos/dosevents.c \ - config/front-ends/dos/vga.c \ - config/front-ends/dos/aspi.c \ - config/front-ends/dos/dosevq.c \ - config/front-ends/dos/dpmilock.c \ +front_end_sources = config/front-ends/dos/dosclip.cpp \ + config/front-ends/dos/dosdisk.cpp \ + config/front-ends/dos/dosevents.cpp \ + config/front-ends/dos/vga.cpp \ + config/front-ends/dos/aspi.cpp \ + config/front-ends/dos/dosevq.cpp \ + config/front-ends/dos/dpmilock.cpp \ config/front-ends/dos/deintr.S \ - config/front-ends/dos/dosmem.c \ - config/front-ends/dos/dosserial.c \ + config/front-ends/dos/dosmem.cpp \ + config/front-ends/dos/dosserial.cpp \ config/front-ends/dos/aspi.h \ config/front-ends/dos/dos.h \ config/front-ends/dos/dosdisk.h \ @@ -530,7 +536,7 @@ front_end_sources = config/front-ends/dos/dosclip.c \ config/front-ends/dos/itimer.h \ config/front-ends/dos/vga.h \ config/front-ends/dos/vgatables.h \ - vgavdriver.c + vgavdriver.cpp METAASM_ARGS = -define 'DST_SEG=%es:' @@ -546,15 +552,15 @@ endif CONFIG_FRONT_END_NEXTSTEP if CONFIG_FRONT_END_SDL -front_end_sources = config/front-ends/sdl/SDL_bmp.c \ - config/front-ends/sdl/sdlevents.c \ - config/front-ends/sdl/sdl_mem.c \ - config/front-ends/sdl/sdlquit.c \ - config/front-ends/sdl/sdlscrap.c \ - config/front-ends/sdl/sdlwin.c \ - config/front-ends/sdl/sdlwm.c \ - config/front-ends/sdl/syswm_map.c \ - config/front-ends/sdl/winmain.c \ +front_end_sources = config/front-ends/sdl/SDL_bmp.cpp \ + config/front-ends/sdl/sdlevents.cpp \ + config/front-ends/sdl/sdl_mem.cpp \ + config/front-ends/sdl/sdlquit.cpp \ + config/front-ends/sdl/sdlscrap.cpp \ + config/front-ends/sdl/sdlwin.cpp \ + config/front-ends/sdl/sdlwm.cpp \ + config/front-ends/sdl/syswm_map.cpp \ + config/front-ends/sdl/winmain.cpp \ config/front-ends/sdl/for_sam.h \ config/front-ends/sdl/host_bltmacros.h \ config/front-ends/sdl/host_vdriver.h \ @@ -571,7 +577,7 @@ front_end_sources = config/front-ends/sdl/SDL_bmp.c \ config/front-ends/sdl/syswm_vars.h if CONFIG_OS_LINUX -front_end_sources += config/front-ends/sdl/sdlX.c +front_end_sources += config/front-ends/sdl/sdlX.cpp endif CONFIG_OS_LINUX if CONFIG_OS_MACOSX @@ -584,12 +590,12 @@ if CONFIG_FRONT_END_SVGALIB # This is unlikely to work. Nobody has built the svgalib version of Executor # in a long time. -front_end_sources = config/front-ends/svgalib/svgalib.c \ - config/front-ends/svgalib/svgalibevent.c \ +front_end_sources = config/front-ends/svgalib/svgalib.cpp \ + config/front-ends/svgalib/svgalibevent.cpp \ config/front-ends/svgalib/host_bltmacros.h \ config/front-ends/svgalib/host_vdriver.h \ config/front-ends/svgalib/svgalib.h \ - vgavdriver.c + vgavdriver.cpp endif CONFIG_FRONT_END_SVGALIB @@ -597,9 +603,9 @@ if CONFIG_FRONT_END_WIN32 # This too is unlikely to work. I believe we stopped working on the win32 # port when Sam created SDL. -front_end_sources = config/front-ends/win32/winevents.c \ - config/front-ends/win32/wincursor.c \ - config/front-ends/win32/windriver.c \ +front_end_sources = config/front-ends/win32/winevents.cpp \ + config/front-ends/win32/wincursor.cpp \ + config/front-ends/win32/windriver.cpp \ config/front-ends/win32/host_bltmacros.h \ config/front-ends/win32/host_vdriver.h \ config/front-ends/win32/vk_to_mkv.h \ @@ -610,8 +616,8 @@ endif CONFIG_FRONT_END_WIN32 if CONFIG_FRONT_END_X -front_end_sources = config/front-ends/x/x.c \ - config/front-ends/x/x_keycodes.c \ +front_end_sources = config/front-ends/x/x.cpp \ + config/front-ends/x/x_keycodes.cpp \ config/front-ends/x/host_bltmacros.h \ config/front-ends/x/host_vdriver.h \ config/front-ends/x/x.h \ @@ -622,32 +628,32 @@ HAVE_IV = yes endif CONFIG_FRONT_END_X if CONFIG_HOST_ALPHA_DEC_OSF -host_sources = config/hosts/alpha-dec-osf/alpha-lowglobals-mem.c +host_sources = config/hosts/alpha-dec-osf/alpha-lowglobals-mem.cpp else !CONFIG_HOST_ALPHA_DEC_OSF host_sources = endif !CONFIG_HOST_ALPHA_DEC_OSF if CONFIG_OS_CYGWIN32 -os_sources = config/os/cygwin32/cygwin32.c \ - config/os/cygwin32/winfs.c \ - config/os/cygwin32/win_disk.c \ - config/os/cygwin32/win_stat.c \ - config/os/cygwin32/win_memory.c \ - config/os/cygwin32/win_serial.c \ - config/os/cygwin32/win_ntcd.c \ - config/os/cygwin32/win_print.c \ - config/os/cygwin32/win_beep.c \ - config/os/cygwin32/win_clip.c \ - config/os/cygwin32/win_temp.c \ - config/os/cygwin32/win_except.c \ - config/os/cygwin32/win_time.c \ - config/os/cygwin32/win_dongle.c \ - config/os/cygwin32/win_queue.c \ - config/os/cygwin32/win_screen.c \ - config/os/cygwin32/win_vxdiface.c \ - config/os/cygwin32/win_keyboard.c \ - config/os/cygwin32/win_launch.c \ - config/os/cygwin32/win_stdfile.c \ +os_sources = config/os/cygwin32/cygwin32.cpp \ + config/os/cygwin32/winfs.cpp \ + config/os/cygwin32/win_disk.cpp \ + config/os/cygwin32/win_stat.cpp \ + config/os/cygwin32/win_memory.cpp \ + config/os/cygwin32/win_serial.cpp \ + config/os/cygwin32/win_ntcd.cpp \ + config/os/cygwin32/win_print.cpp \ + config/os/cygwin32/win_beep.cpp \ + config/os/cygwin32/win_clip.cpp \ + config/os/cygwin32/win_temp.cpp \ + config/os/cygwin32/win_except.cpp \ + config/os/cygwin32/win_time.cpp \ + config/os/cygwin32/win_dongle.cpp \ + config/os/cygwin32/win_queue.cpp \ + config/os/cygwin32/win_screen.cpp \ + config/os/cygwin32/win_vxdiface.cpp \ + config/os/cygwin32/win_keyboard.cpp \ + config/os/cygwin32/win_launch.cpp \ + config/os/cygwin32/win_stdfile.cpp \ config/os/cygwin32/aspi.h \ config/os/cygwin32/cdenable.h \ config/os/cygwin32/cygwin32.h \ @@ -682,14 +688,14 @@ os_sources = config/os/cygwin32/cygwin32.c \ config/os/cygwin32/winfs.h bin_PROGRAMS += exemove -exemove_SOURCES = config/os/cygwin32/exemove.c +exemove_SOURCES = config/os/cygwin32/exemove.cpp endif CONFIG_OS_CYGWIN32 if CONFIG_OS_LINUX -os_sources = config/os/linux/linux.c \ - config/os/linux/linux_except.c \ - config/os/linux/lowglobals-mem.c \ +os_sources = config/os/linux/linux.cpp \ + config/os/linux/linux_except.cpp \ + config/os/linux/lowglobals-mem.cpp \ config/os/linux/linux.h \ config/os/linux/linux_except.h @@ -701,10 +707,10 @@ executor_LDFLAGS = -framework SDL -framework Cocoa endif CONFIG_OS_MACOSX if CONFIG_OS_MSDOS -os_sources = config/os/msdos/msdos.c \ - config/os/msdos/dpmimem.c \ - config/os/msdos/dpmicall.c \ - config/os/msdos/openmany.c \ +os_sources = config/os/msdos/msdos.cpp \ + config/os/msdos/dpmimem.cpp \ + config/os/msdos/dpmicall.cpp \ + config/os/msdos/openmany.cpp \ config/os/msdos/rmint70.S \ config/os/msdos/dpmicall.h \ config/os/msdos/dpmimem.h \ @@ -715,11 +721,11 @@ os_sources = config/os/msdos/msdos.c \ endif CONFIG_OS_MSDOS if CONFIG_OS_NEXT -os_sources = config/os/next/next.c config/os/next/next.h +os_sources = config/os/next/next.cpp config/os/next/next.h endif CONFIG_OS_NEXT if CONFIG_SOUND_DJGPP -sound_sources += config/sound/djgpp/djgpp-sound.c \ +sound_sources += config/sound/djgpp/djgpp-sound.cpp \ config/sound/djgpp/djgpp-sound.h \ config/sound/djgpp/sb_lib/sb_defs.h \ config/sound/djgpp/sb_lib/sb_dma.h \ @@ -729,13 +735,13 @@ sound_sources += config/sound/djgpp/djgpp-sound.c \ endif CONFIG_SOUND_DJGPP if CONFIG_SOUND_LINUX -sound_sources += config/sound/linux/linux-sound.c \ +sound_sources += config/sound/linux/linux-sound.cpp \ config/sound/linux/linux-sound.h endif CONFIG_SOUND_LINUX if CONFIG_SOUND_SDL -sound_sources += config/sound/sdl/sdl-sound.c \ +sound_sources += config/sound/sdl/sdl-sound.cpp \ config/sound/sdl/sdl-sound.h endif CONFIG_SOUND_SDL diff --git a/src/PSprint.mm b/src/PSprint.cpp similarity index 88% rename from src/PSprint.mm rename to src/PSprint.cpp index 9daa1039..0f158a64 100644 --- a/src/PSprint.mm +++ b/src/PSprint.cpp @@ -14,8 +14,10 @@ "$Id: PSprint.c 87 2005-05-25 01:57:33Z ctm $"; #endif +#ifdef MACOSX_ #import #import +#endif #include "MemoryMgr.h" #include "QuickDraw.h" @@ -35,7 +37,6 @@ #include using namespace Executor; -using namespace ByteSwap; typedef struct { @@ -50,6 +51,9 @@ PUBLIC FILE *ROMlib_printfile; #define DPSContext long +#if !defined(MACOSX_) +typedef enum { NO, YES } boolean; +#endif PRIVATE DPSContext DPSGetCurrentContext(void) { @@ -595,8 +599,8 @@ static void dumpimage( unsigned char *p, int numrows, int numbytes, { 1.0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }, }; - gray_fore = mac_old_color_to_ps_gray (BigEndianValue (thePortp->fgColor)); - gray_back = mac_old_color_to_ps_gray (BigEndianValue (thePortp->bkColor)); + gray_fore = mac_old_color_to_ps_gray (CL (thePortp->fgColor)); + gray_back = mac_old_color_to_ps_gray (CL (thePortp->bkColor)); pl = (uint32 *) patp; pat_is_black = ((gray_fore == 0 && gray_back == 0) || @@ -613,8 +617,8 @@ static void dumpimage( unsigned char *p, int numrows, int numbytes, long fg, bk; const char *fgs, *bks; - fg = BigEndianValue (thePortp->fgColor); - bk = BigEndianValue (thePortp->bkColor); + fg = CL (thePortp->fgColor); + bk = CL (thePortp->bkColor); if (fg == whiteColor) fgs = "white"; else if (fg == blackColor) @@ -686,7 +690,7 @@ static void doimage(LONGINT verb, comRect *rp, comGrafPtr thePortp) short pnMode; TEMP_ALLOC_DECL (temp_alloc_space); - pnMode = BigEndianValue (thePortp->pnMode); + pnMode = CW (thePortp->pnMode); switch (verb) { default: case paintVerb: @@ -712,28 +716,28 @@ static void doimage(LONGINT verb, comRect *rp, comGrafPtr thePortp) PSsetgray(gray_val); PSfill(); } else { - PSmoveto(BigEndianValue(rp->left), BigEndianValue(rp->bottom)); - PSlineto(BigEndianValue(rp->left), BigEndianValue(rp->top)); - PSlineto(BigEndianValue(rp->right), BigEndianValue(rp->top)); - PSlineto(BigEndianValue(rp->right), BigEndianValue(rp->bottom)); + PSmoveto(CW(rp->left), CW(rp->bottom)); + PSlineto(CW(rp->left), CW(rp->top)); + PSlineto(CW(rp->right), CW(rp->top)); + PSlineto(CW(rp->right), CW(rp->bottom)); PSclosepath(); - PSmoveto(BigEndianValue(rp->left)-1, BigEndianValue(rp->bottom)+1); - PSlineto(BigEndianValue(rp->right)+1, BigEndianValue(rp->bottom)+1); - PSlineto(BigEndianValue(rp->right)+1, BigEndianValue(rp->top)-1); - PSlineto(BigEndianValue(rp->left)-1, BigEndianValue(rp->top)-1); + PSmoveto(CW(rp->left)-1, CW(rp->bottom)+1); + PSlineto(CW(rp->right)+1, CW(rp->bottom)+1); + PSlineto(CW(rp->right)+1, CW(rp->top)-1); + PSlineto(CW(rp->left)-1, CW(rp->top)-1); PSclip(); - rowbytes = ((BigEndianValue(rp->right) - BigEndianValue(rp->left)) * 72 + 72 * 8 - 1)/ 72 / 8; - numrows = ((BigEndianValue(rp->bottom) - BigEndianValue(rp->top)) * 72 + 71) / 72; + rowbytes = ((CW(rp->right) - CW(rp->left)) * 72 + 72 * 8 - 1)/ 72 / 8; + numrows = ((CW(rp->bottom) - CW(rp->top)) * 72 + 71) / 72; if (rowbytes > 0 && numrows > 0) { numbytesneeded = rowbytes * numrows; TEMP_ALLOC_ALLOCATE (bytes, temp_alloc_space, numbytesneeded); - toshift = (BigEndianValue(rp->left) - BigEndianValue(thePortp->portBits.bounds.left)) & 7; + toshift = (CW(rp->left) - CW(thePortp->portBits.bounds.left)) & 7; for (i = 0; i < 8; ++i) pat[i] = (patp[i] << toshift) | (patp[i]>>(8 - toshift)); p = bytes; - for (i = BigEndianValue(rp->top) - BigEndianValue(thePortp->portBits.bounds.top); - i < BigEndianValue(rp->top) + numrows - BigEndianValue(thePortp->portBits.bounds.top); + for (i = CW(rp->top) - CW(thePortp->portBits.bounds.top); + i < CW(rp->top) + numrows - CW(thePortp->portBits.bounds.top); ++i) { c = pat[i&7]; @@ -742,7 +746,7 @@ static void doimage(LONGINT verb, comRect *rp, comGrafPtr thePortp) for (j = rowbytes; --j >= 0;) *p++ = c; } - PStranslate(BigEndianValue(rp->left), BigEndianValue(rp->top)); + PStranslate(CW(rp->left), CW(rp->top)); #if !defined(DONTSENDBIGARRAYS) PSsendchararray((char *) bytes, numbytesneeded); #endif /* DONTSENDBIGARRAYS */ @@ -862,8 +866,8 @@ you back to the intial (unbounded) clip path */ (rp->top != CWC (-32767) && rp->top != CWC (-32768)) || rp->right != CWC (32767) || rp->bottom != CWC (32767)) - PSrectclip (BigEndianValue (rp->left), BigEndianValue (rp->top), - BigEndianValue (rp->right) - BigEndianValue(rp->left), BigEndianValue (rp->bottom) - BigEndianValue (rp->top)); + PSrectclip (CW (rp->left), CW (rp->top), + CW (rp->right) - CW(rp->left), CW (rp->bottom) - CW (rp->top)); restore_virtual_ints (block); } @@ -885,8 +889,8 @@ static void commonupdate(comGrafPtr thePortp) if (thePortp->portBits.bounds.top != printport.portBits.bounds.top || thePortp->portBits.bounds.left != printport.portBits.bounds.left) { - dx = BigEndianValue(printport.portBits.bounds.left) - BigEndianValue(thePortp->portBits.bounds.left); - dy = BigEndianValue(printport.portBits.bounds.top) - BigEndianValue(thePortp->portBits.bounds.top); + dx = CW(printport.portBits.bounds.left) - CW(thePortp->portBits.bounds.left); + dy = CW(printport.portBits.bounds.top) - CW(thePortp->portBits.bounds.top); PStranslate(dx, dy); printport.portBits.bounds = thePortp->portBits.bounds; } @@ -901,7 +905,7 @@ static void commonupdate(comGrafPtr thePortp) if (thePortp->pnLoc.h != printport.pnLoc.h || thePortp->pnLoc.v != printport.pnLoc.v) { - PSmoveto(BigEndianValue(thePortp->pnLoc.h), BigEndianValue(thePortp->pnLoc.v)); + PSmoveto(CW(thePortp->pnLoc.h), CW(thePortp->pnLoc.v)); printport.pnLoc = thePortp->pnLoc; } @@ -1139,6 +1143,7 @@ static int matchpercentage(char *value, int indx, const char *tomatch) restore_virtual_ints (block); } } +#endif static char *fnametofont(StringPtr fname, LONGINT txFace) { @@ -1147,7 +1152,9 @@ static int matchpercentage(char *value, int indx, const char *tomatch) index = txFace & (bold|italic); findpreferred(fname, index, retval); +#ifdef MACOSX_ ROMlib_trytomatch(retval, index); +#endif if (txFace & outline) strcat(retval, "-Outline"); @@ -1243,7 +1250,9 @@ void NeXTSetText(StringPtr fname, LONGINT txFace, LONGINT txSize, font_size = substitute_font_if_needed (&font, txSize, &need_to_free); +#ifdef MACOSX_ ROMlib_newFont(font, font_size); +#endif PSsendchararray(font, strlen(font)); matrix[0] = font_size; matrix[1] = 0; @@ -1261,11 +1270,11 @@ void NeXTSetText(StringPtr fname, LONGINT txFace, LONGINT txSize, PRIVATE void SmartGetFontName (comGrafPtr thePortp, StringPtr fname) { - C_GetFontName (BigEndianValue (thePortp->txFont), fname); + C_GetFontName (CW (thePortp->txFont), fname); if (!fname[0]) - C_GetFontName (BigEndianValue (ApFontID), fname); + C_GetFontName (CW (ApFontID), fname); if (!fname[0]) - C_GetFontName (BigEndianValue (SysFontFam), fname); + C_GetFontName (CW (SysFontFam), fname); } /* @@ -1285,8 +1294,8 @@ static void txupdate(comGrafPtr thePortp) thePortp->txSize != printport.txSize || thePortp->spExtra != printport.spExtra) { SmartGetFontName(thePortp, fname); - NeXTSetText(fname, thePortp->txFace, BigEndianValue(thePortp->txSize), - BigEndianValue(thePortp->spExtra)); + NeXTSetText(fname, thePortp->txFace, CW(thePortp->txSize), + CL(thePortp->spExtra)); printport.txFont = thePortp->txFont; printport.txFace = thePortp->txFace; printport.txSize = thePortp->txSize; @@ -1300,7 +1309,7 @@ void pnupdate(comGrafPtr thePortp) #if 0 if (thePortp->pnSize.h != printport.pnSize.h || thePortp->pnSize.v != printport.pnSize.v) { - NeXTSetWidth(BigEndianValue(thePortp->pnSize)); + NeXTSetWidth(CW(thePortp->pnSize)); printport.pnSize = thePortp->pnSize; } #endif @@ -1329,18 +1338,18 @@ void pnupdate(comGrafPtr thePortp) froma = -90 + starta + arca; toa = -90 + starta; } - midx = ((float)BigEndianValue(rp->left) + BigEndianValue(rp->right ))/2; - midy = ((float)BigEndianValue(rp->top) + BigEndianValue(rp->bottom))/2; - xdiam = BigEndianValue(rp->right) - BigEndianValue(rp->left); - ydiam = BigEndianValue(rp->bottom) - BigEndianValue(rp->top); + midx = ((float)CW(rp->left) + CW(rp->right ))/2; + midy = ((float)CW(rp->top) + CW(rp->bottom))/2; + xdiam = CW(rp->right) - CW(rp->left); + ydiam = CW(rp->bottom) - CW(rp->top); PStranslate(midx, (midy)); PSnewpath(); PSscale(1, ydiam/xdiam); PSarc(0, 0, xdiam/2, froma, toa); if (verb == frameVerb) { - psh = BigEndianValue(thePortp->pnSize.h); - psv = BigEndianValue(thePortp->pnSize.v); + psh = CW(thePortp->pnSize.h); + psv = CW(thePortp->pnSize.v); if (ydiam > (2 * psv) && xdiam > (2 * psh)) { PSscale(1, xdiam/ydiam * (ydiam - 2*psv) / (xdiam - 2*psh)); PSarcn(0, 0, xdiam/2 - psh, toa, froma); @@ -1413,10 +1422,10 @@ void pnupdate(comGrafPtr thePortp) indexed_color_p = FALSE; block = block_virtual_ints (); commonupdate(thePortp); - srcwidth = BigEndianValue(srcrp->right) - BigEndianValue(srcrp->left); - srcheight = BigEndianValue(srcrp->bottom) - BigEndianValue(srcrp->top); - dstwidth = BigEndianValue(dstrp->right) - BigEndianValue(dstrp->left); - dstheight = BigEndianValue(dstrp->bottom) - BigEndianValue(dstrp->top); + srcwidth = CW(srcrp->right) - CW(srcrp->left); + srcheight = CW(srcrp->bottom) - CW(srcrp->top); + dstwidth = CW(dstrp->right) - CW(dstrp->left); + dstheight = CW(dstrp->bottom) - CW(dstrp->top); if (srcwidth && srcheight && dstwidth && dstheight) /* put in for output */ { /* from Tex-Edit 2.5 */ /* see the comment at the grestore below */ @@ -1428,7 +1437,7 @@ void pnupdate(comGrafPtr thePortp) if (srcbmp->rowBytes & CWC(0x8000)) { srcpmp = (comPixMap *) srcbmp; - pixelsize = BigEndianValue(srcpmp->pixelSize); + pixelsize = CW(srcpmp->pixelSize); if (pixelsize != 1 && mode != srcCopy) /*-->*/ goto DONE; direct_color_p = pixelsize > 8; @@ -1440,11 +1449,11 @@ void pnupdate(comGrafPtr thePortp) srcpmp = 0; pixelsize = 1; } - rowbytes = BigEndianValue(srcbmp->rowBytes) & ROWMASK; + rowbytes = CW(srcbmp->rowBytes) & ROWMASK; - PStranslate(BigEndianValue(dstrp->left), BigEndianValue(dstrp->top)); + PStranslate(CW(dstrp->left), CW(dstrp->top)); baseaddr = (unsigned char *)MR(srcbmp->baseAddr) - + (BigEndianValue(srcrp->top) - BigEndianValue(srcbmp->bounds.top)) * (LONGINT) rowbytes; + + (CW(srcrp->top) - CW(srcbmp->bounds.top)) * (LONGINT) rowbytes; /* NOTE: now that we don't send big arrays, I believe that doing the transformation below is a memory waste... Shouldn't we @@ -1468,7 +1477,7 @@ void pnupdate(comGrafPtr thePortp) matrix[1] = 0; matrix[2] = 0; matrix[3] = 1 / scaley; - matrix[4] = BigEndianValue(srcrp->left) - BigEndianValue(srcbmp->bounds.left); + matrix[4] = CW(srcrp->left) - CW(srcbmp->bounds.left); matrix[5] = 0; numbytes = ((int) srcwidth * pixelsize + 7) / 8; @@ -1534,15 +1543,15 @@ void pnupdate(comGrafPtr thePortp) unsigned char g; unsigned char b; - if (BigEndianValue (ctab[i].value) != i && !has_warned_p) + if (CW (ctab[i].value) != i && !has_warned_p) { warning_unexpected ("value = %d, i = %d", - BigEndianValue (ctab[i].value), i); + CW (ctab[i].value), i); has_warned_p = TRUE; } - r = BigEndianValue (ctab[i].rgb.red ) >> 8; - g = BigEndianValue (ctab[i].rgb.green) >> 8; - b = BigEndianValue (ctab[i].rgb.blue ) >> 8; + r = CW (ctab[i].rgb.red ) >> 8; + g = CW (ctab[i].rgb.green) >> 8; + b = CW (ctab[i].rgb.blue ) >> 8; DPSPrintf (DPSGetCurrentContext (), "%02x%02x%02x%c", r, g, b, (i % 8) == 7 ? '\n' : ' '); } @@ -1591,9 +1600,9 @@ void pnupdate(comGrafPtr thePortp) block = block_virtual_ints (); pnupdate(thePortp); - if (BigEndianValue(thePortp->pnSize.h) || BigEndianValue(thePortp->pnSize.v)) { - fromh = BigEndianValue(thePortp->pnLoc.h); - fromv = BigEndianValue(thePortp->pnLoc.v); + if (CW(thePortp->pnSize.h) || CW(thePortp->pnSize.v)) { + fromh = CW(thePortp->pnLoc.h); + fromv = CW(thePortp->pnLoc.v); toh = to.h; tov = to.v; @@ -1605,24 +1614,24 @@ void pnupdate(comGrafPtr thePortp) fromv = tov; tov = temp; } - psh = BigEndianValue(thePortp->pnSize.h); - psv = BigEndianValue(thePortp->pnSize.v); - r.right = BigEndianValue(toh + psh); - r.left = BigEndianValue(fromh); + psh = CW(thePortp->pnSize.h); + psv = CW(thePortp->pnSize.v); + r.right = CW(toh + psh); + r.left = CW(fromh); PSgsave(); PSnewpath(); PSmoveto(fromh, fromv); if (fromv < tov) { - r.top = BigEndianValue(fromv); - r.bottom = BigEndianValue(tov + psv); + r.top = CW(fromv); + r.bottom = CW(tov + psv); PSlineto(fromh + psh, fromv); PSlineto(toh + psh, tov); PSlineto(toh + psh, tov + psv); PSlineto(toh, tov + psv); PSlineto(fromh, fromv + psv); } else { - r.top = BigEndianValue(tov); - r.bottom = BigEndianValue(fromv + psv); + r.top = CW(tov); + r.bottom = CW(fromv + psv); PSlineto(toh, tov); PSlineto(toh + psh, tov); PSlineto(toh + psh, tov + psv); @@ -1663,19 +1672,19 @@ void pnupdate(comGrafPtr thePortp) block = block_virtual_ints (); pnupdate(thePortp); pp = MR(*ph)->polyPoints; - ep = (comPoint *) ((char *)MR(*ph) + BigEndianValue((MR(*ph))->polySize)); - firstp.h = BigEndianValue(pp[0].h); - firstp.v = BigEndianValue(pp[0].v); + ep = (comPoint *) ((char *)MR(*ph) + CW((MR(*ph))->polySize)); + firstp.h = CW(pp[0].h); + firstp.v = CW(pp[0].v); thePortp->pnLoc = pp[0]; - if (BigEndianValue(ep[-1].h) == firstp.h && BigEndianValue(ep[-1].v) == firstp.v) + if (CW(ep[-1].h) == firstp.h && CW(ep[-1].v) == firstp.v) ep--; if (ep > pp) { if (verb == frameVerb) { PSmoveto(firstp.h, firstp.v); for (++pp; pp < ep; pp++) { - pt.h = BigEndianValue(pp[0].h); - pt.v = BigEndianValue(pp[0].v); + pt.h = CW(pp[0].h); + pt.v = CW(pp[0].v); NeXTPrLine(pt, thePortp); thePortp->pnLoc = pp[0]; } @@ -1685,7 +1694,7 @@ void pnupdate(comGrafPtr thePortp) PSnewpath(); PSmoveto(firstp.h, firstp.v); for (++pp; pp < ep; pp++) { - PSlineto(BigEndianValue(pp->h), BigEndianValue(pp->v)); + PSlineto(CW(pp->h), CW(pp->v)); } PSlineto(firstp.h, firstp.v); PSclosepath(); @@ -1712,29 +1721,29 @@ void pnupdate(comGrafPtr thePortp) block = block_virtual_ints (); pnupdate(thePortp); sfactor = (float)height/width; - midy = ((float)BigEndianValue(rp->top) + BigEndianValue(rp->bottom))/2; + midy = ((float)CW(rp->top) + CW(rp->bottom))/2; PSgsave(); PSnewpath(); PSscale(1, sfactor); - PSmoveto(BigEndianValue(rp->left), midy/sfactor); - rl = BigEndianValue(rp->left); - rr = BigEndianValue(rp->right); - rt = BigEndianValue(rp->top)/sfactor; - rb = BigEndianValue(rp->bottom)/sfactor; + PSmoveto(CW(rp->left), midy/sfactor); + rl = CW(rp->left); + rr = CW(rp->right); + rt = CW(rp->top)/sfactor; + rb = CW(rp->bottom)/sfactor; PSarct(rl, rb, rr, rb, (float)width / 2); PSarct(rr, rb, rr, rt, (float)width / 2); PSarct(rr, rt, rl, rt, (float)width / 2); PSarct(rl, rt, rl, rb, (float)width / 2); PSclosepath(); if (verb == frameVerb) { - psh = BigEndianValue(thePortp->pnSize.h); - psv = BigEndianValue(thePortp->pnSize.v); + psh = CW(thePortp->pnSize.h); + psv = CW(thePortp->pnSize.v); sfactor2 = ((float)height - 2*psv) / (width - 2*psh) / sfactor; - rl = BigEndianValue(rp->left) + psh; - rr = BigEndianValue(rp->right) - psh; - rt = BigEndianValue(rp->top) + psv/sfactor2; - rb = BigEndianValue(rp->bottom) - psv/sfactor2; + rl = CW(rp->left) + psh; + rr = CW(rp->right) - psh; + rt = CW(rp->top) + psv/sfactor2; + rb = CW(rp->bottom) - psv/sfactor2; PSscale(1, sfactor2); PSmoveto(rl, midy/sfactor); @@ -1764,18 +1773,18 @@ void pnupdate(comGrafPtr thePortp) pnupdate(thePortp); PSgsave(); PSnewpath(); - PSmoveto(BigEndianValue(rp->left) , BigEndianValue(rp->top)); - PSlineto(BigEndianValue(rp->left) , BigEndianValue(rp->bottom)); - PSlineto(BigEndianValue(rp->right), BigEndianValue(rp->bottom)); - PSlineto(BigEndianValue(rp->right), BigEndianValue(rp->top)); + PSmoveto(CW(rp->left) , CW(rp->top)); + PSlineto(CW(rp->left) , CW(rp->bottom)); + PSlineto(CW(rp->right), CW(rp->bottom)); + PSlineto(CW(rp->right), CW(rp->top)); PSclosepath(); if (verb == frameVerb) { - psh = BigEndianValue(thePortp->pnSize.h); - psv = BigEndianValue(thePortp->pnSize.v); - PSmoveto(BigEndianValue(rp->left) + psh, BigEndianValue(rp->top) + psv); - PSlineto(BigEndianValue(rp->right) - psh, BigEndianValue(rp->top) + psv); - PSlineto(BigEndianValue(rp->right) - psh, BigEndianValue(rp->bottom) - psv); - PSlineto(BigEndianValue(rp->left) + psh, BigEndianValue(rp->bottom) - psv); + psh = CW(thePortp->pnSize.h); + psv = CW(thePortp->pnSize.v); + PSmoveto(CW(rp->left) + psh, CW(rp->top) + psv); + PSlineto(CW(rp->right) - psh, CW(rp->top) + psv); + PSlineto(CW(rp->right) - psh, CW(rp->bottom) - psv); + PSlineto(CW(rp->left) + psh, CW(rp->bottom) - psv); PSclosepath(); } PSclip(); @@ -1805,7 +1814,7 @@ void pnupdate(comGrafPtr thePortp) (Ptr) p, &num, &den, NULL); restore_virtual_ints (block); RESTOREA5; - return (float) retval * BigEndianValue (num.h) / BigEndianValue (den.h); + return (float) retval * CW (num.h) / CW (den.h); } static int numspacesin(const char *str) @@ -1847,9 +1856,9 @@ static void dopsunderline(comGrafPtr thePortp, short total, substitute_font_if_needed (&font, 0, &need_to_free); PSgsave(); PSnewpath(); - PSsendfloat(BigEndianValue(thePortp->pnLoc.h)); - PSsendfloat(BigEndianValue(thePortp->pnLoc.v)); - PSsendfloat(BigEndianValue(thePortp->txSize)); + PSsendfloat(CW(thePortp->pnLoc.h)); + PSsendfloat(CW(thePortp->pnLoc.v)); + PSsendfloat(CW(thePortp->txSize)); PSsendchararray(font, strlen(font)); if (need_to_free) free (font); @@ -2129,8 +2138,8 @@ static void doashow(char *translated, LONGINT n, int i, short total) { PSgsave (); DPSPrintf (DPSGetCurrentContext (), "initclip\n"); - PStranslate (BigEndianValue (thePortp->pnLoc.h) + rotation.center_x, - BigEndianValue (thePortp->pnLoc.v) + rotation.center_y); + PStranslate (CW (thePortp->pnLoc.h) + rotation.center_x, + CW (thePortp->pnLoc.v) + rotation.center_y); PSrotate (rotation.angle); PSmoveto (-rotation.center_x, -rotation.center_y); } @@ -2168,7 +2177,7 @@ static void doashow(char *translated, LONGINT n, int i, short total) substitute_fonts_p && (thePortp->txFont == CWC (geneva)), translated, n); - thePortp->pnLoc.h = BigEndianValue(BigEndianValue(thePortp->pnLoc.h) + total); + thePortp->pnLoc.h = CW(CW(thePortp->pnLoc.h) + total); printport.pnLoc.h = thePortp->pnLoc.h; } if (rotation.rotated_p) @@ -2229,4 +2238,3 @@ static void doashow(char *translated, LONGINT n, int i, short total) } } -#endif diff --git a/src/SpeechManager-MacBridge.h b/src/SpeechManager-MacBridge.h index c5e8014b..18eeab0c 100644 --- a/src/SpeechManager-MacBridge.h +++ b/src/SpeechManager-MacBridge.h @@ -11,57 +11,55 @@ #include "SpeechManager.h" -#define __private_extern __attribute__((visibility("hidden"))) - namespace MacBridge { - __private_extern Executor::NumVersion SpeechManagerVersion (void); - __private_extern int16 SpeechBusy (void); - __private_extern int16 SpeechBusySystemWide(void); - __private_extern Executor::OSErr CountVoices (int16 *numVoices); - __private_extern Executor::OSErr DisposeSpeechChannel (Executor::SpeechChannel chan); - __private_extern Executor::OSErr SpeakString (Executor::Str255 textToBeSpoken); + PUBLIC Executor::NumVersion SpeechManagerVersion (void); + PUBLIC int16 SpeechBusy (void); + PUBLIC int16 SpeechBusySystemWide(void); + PUBLIC Executor::OSErr CountVoices (int16 *numVoices); + PUBLIC Executor::OSErr DisposeSpeechChannel (Executor::SpeechChannel chan); + PUBLIC Executor::OSErr SpeakString (Executor::Str255 textToBeSpoken); - __private_extern Executor::OSErr StopSpeech (Executor::SpeechChannel chan); - __private_extern Executor::OSErr ContinueSpeech (Executor::SpeechChannel chan); + PUBLIC Executor::OSErr StopSpeech (Executor::SpeechChannel chan); + PUBLIC Executor::OSErr ContinueSpeech (Executor::SpeechChannel chan); - __private_extern Executor::OSErr GetIndVoice (int16 index, Executor::VoiceSpec *voice); - __private_extern Executor::OSErr NewSpeechChannel (Executor::VoiceSpec *voice, Executor::SpeechChannel *chan); - __private_extern Executor::OSErr StopSpeechAt (Executor::SpeechChannel chan, int32 whereToStop); - __private_extern Executor::OSErr PauseSpeechAt (Executor::SpeechChannel chan, int32 whereToPause); - __private_extern Executor::OSErr SetSpeechRate(Executor::SpeechChannel chan, Executor::Fixed rate); - __private_extern Executor::OSErr GetSpeechRate (Executor::SpeechChannel chan, Executor::Fixed *rate); - __private_extern Executor::OSErr SetSpeechPitch (Executor::SpeechChannel chan, Executor::Fixed pitch); - __private_extern Executor::OSErr GetSpeechPitch (Executor::SpeechChannel chan, Executor::Fixed *pitch); - __private_extern Executor::OSErr UseDictionary (Executor::SpeechChannel chan, Executor::Handle dictionary); - __private_extern Executor::OSErr MakeVoiceSpec (Executor::OSType creator, Executor::OSType id, Executor::VoiceSpec *voice); - __private_extern Executor::OSErr GetVoiceDescription ( + PUBLIC Executor::OSErr GetIndVoice (int16 index, Executor::VoiceSpec *voice); + PUBLIC Executor::OSErr NewSpeechChannel (Executor::VoiceSpec *voice, Executor::SpeechChannel *chan); + PUBLIC Executor::OSErr StopSpeechAt (Executor::SpeechChannel chan, int32 whereToStop); + PUBLIC Executor::OSErr PauseSpeechAt (Executor::SpeechChannel chan, int32 whereToPause); + PUBLIC Executor::OSErr SetSpeechRate(Executor::SpeechChannel chan, Executor::Fixed rate); + PUBLIC Executor::OSErr GetSpeechRate (Executor::SpeechChannel chan, Executor::Fixed *rate); + PUBLIC Executor::OSErr SetSpeechPitch (Executor::SpeechChannel chan, Executor::Fixed pitch); + PUBLIC Executor::OSErr GetSpeechPitch (Executor::SpeechChannel chan, Executor::Fixed *pitch); + PUBLIC Executor::OSErr UseDictionary (Executor::SpeechChannel chan, Executor::Handle dictionary); + PUBLIC Executor::OSErr MakeVoiceSpec (Executor::OSType creator, Executor::OSType id, Executor::VoiceSpec *voice); + PUBLIC Executor::OSErr GetVoiceDescription ( const Executor::VoiceSpec *voice, Executor::VoiceDescription *info, Executor::LONGINT infoLength ); - __private_extern Executor::OSErr GetVoiceInfo ( + PUBLIC Executor::OSErr GetVoiceInfo ( const Executor::VoiceSpec *voice, Executor::OSType selector, void *voiceInfo ); - __private_extern Executor::OSErr SpeakText (Executor::SpeechChannel chan, const void *textBuf, Executor::ULONGINT textBytes); - __private_extern Executor::OSErr SetSpeechInfo ( + PUBLIC Executor::OSErr SpeakText (Executor::SpeechChannel chan, const void *textBuf, Executor::ULONGINT textBytes); + PUBLIC Executor::OSErr SetSpeechInfo ( Executor::SpeechChannel chan, Executor::OSType selector, const void *speechInfo ); - __private_extern Executor::OSErr GetSpeechInfo ( + PUBLIC Executor::OSErr GetSpeechInfo ( Executor::SpeechChannel chan, Executor::OSType selector, void *speechInfo ); - __private_extern Executor::OSErr SpeakBuffer ( + PUBLIC Executor::OSErr SpeakBuffer ( Executor::SpeechChannel chan, const void *textBuf, Executor::ULONGINT textBytes, int32 controlFlags ); - __private_extern Executor::OSErr TextToPhonemes (Executor::SpeechChannel chan, const void *textBuf, Executor::ULONGINT textBytes, Executor::Handle phonemeBuf, Executor::LONGINT *phonemeBytes); + PUBLIC Executor::OSErr TextToPhonemes (Executor::SpeechChannel chan, const void *textBuf, Executor::ULONGINT textBytes, Executor::Handle phonemeBuf, Executor::LONGINT *phonemeBytes); } diff --git a/src/aboutbox.cpp b/src/aboutbox.cpp index 47eb175a..996224b7 100644 --- a/src/aboutbox.cpp +++ b/src/aboutbox.cpp @@ -56,7 +56,6 @@ char ROMlib_rcsid_aboutbox[] = #define COPYRIGHT_STRING_2 "All rights reserved." using namespace Executor; -using namespace ByteSwap; static struct { const char *name;char *text; ControlHandle ctl; } about_box_buttons[] = { { LICENSE_BUTTON_NAME, NULL /* generated on the fly from licensetext.c */, @@ -512,10 +511,10 @@ create_about_box () /* Set up the rectangle enclosing each button. */ r.top = CWC (ABOUT_BOX_HEIGHT - 30); r.bottom = CWC (ABOUT_BOX_HEIGHT - 30 + BUTTON_HEIGHT); - r.left = BigEndianValue ((b * ABOUT_BOX_WIDTH / NELEM (about_box_buttons)) + r.left = CW ((b * ABOUT_BOX_WIDTH / NELEM (about_box_buttons)) + (ABOUT_BOX_WIDTH / NELEM (about_box_buttons) - BUTTON_WIDTH) / 2); - r.right = BigEndianValue (BigEndianValue (r.left) + BUTTON_WIDTH); + r.right = CW (CW (r.left) + BUTTON_WIDTH); str255_from_c_string (str, about_box_buttons[b].name); about_box_buttons[b].ctl = NewControl (about_box, &r, str, TRUE, 0, @@ -602,7 +601,7 @@ draw_status_info (boolean_t executor_p) #define MB (1024 * 1024U) gestalt_success_p = (C_GestaltTablesOnly (gestaltLogicalRAMSize, &total_ram) == noErr); - total_ram = BigEndianValue (total_ram); + total_ram = CL (total_ram); if (gestalt_success_p) sprintf (total_ram_string, "%s%u.%02u MB", ram_tag, total_ram / MB, (total_ram % MB) * 100 / MB); @@ -662,7 +661,7 @@ event_loop (boolean_t executor_p) TEIdle (about_te); - switch (BigEndianValue (evt.what)) { + switch (CW (evt.what)) { case updateEvt: BeginUpdate (about_box); PenNormal (); @@ -693,7 +692,7 @@ event_loop (boolean_t executor_p) { char ch; - ch = BigEndianValue (evt.message) & 0xFF; + ch = CL (evt.message) & 0xFF; switch (ch) { case '\r': case NUMPAD_ENTER: diff --git a/src/adb.cpp b/src/adb.cpp index b2abc78c..b5c7c9e1 100644 --- a/src/adb.cpp +++ b/src/adb.cpp @@ -43,7 +43,6 @@ char ROMlib_rcsid_adb[] = */ using namespace Executor; -using namespace ByteSwap; PUBLIC void Executor::ADBReInit (void) @@ -151,7 +150,7 @@ call_patched_adb_vector (char *message) save_a0 = EM_A0; EM_D0 = SPOOFED_MOUSE_ADDR << 4; /* based on Apeiron's code */ EM_A0 = (unsigned long) US_TO_SYN68K(message); - CALL_EMULATOR ((syn68k_addr_t) BigEndianValue ((long) adb_service_procp)); + CALL_EMULATOR ((syn68k_addr_t) CL ((long) adb_service_procp)); EM_D0 = save_d0; EM_A0 = save_a0; } @@ -190,8 +189,8 @@ Executor::adb_apeiron_hack (boolean_t deltas_p, ...) boolean_t button_is_down; char message[3]; - x = BigEndianValue (MouseLocation.h); - y = BigEndianValue (MouseLocation.v); + x = CW (MouseLocation.h); + y = CW (MouseLocation.v); button_is_down = !(ROMlib_mods & btnState); /* begin code for PegLeg */ diff --git a/src/alias.cpp b/src/alias.cpp index fdf82fd4..7ebd7171 100644 --- a/src/alias.cpp +++ b/src/alias.cpp @@ -28,7 +28,6 @@ char ROMlib_rcsid_alias[] = #define paramErr (-50) using namespace Executor; -using namespace ByteSwap; /* NOTE: if we want to be more like the Mac, we should have a 'fld#',0 resource that will have in it: type, four bytes of 0, pascal string, @@ -79,8 +78,8 @@ get_sys_vref_and_dirid (INTEGER *sys_vrefp, LONGINT *sys_diridp) err = PBGetWDInfo (&wdp, FALSE); if (err == noErr) { - *sys_vrefp = BigEndianValue (wdp.ioWDVRefNum); - *sys_diridp = BigEndianValue (wdp.ioWDDirID); + *sys_vrefp = CW (wdp.ioWDVRefNum); + *sys_diridp = CL (wdp.ioWDDirID); } return err; } @@ -112,7 +111,7 @@ try_to_find (INTEGER vref, const char *str, INTEGER *vrefp, LONGINT *diridp) { warning_trace_info ("ino = %ld, ufs.ino = %ld", (long) ST_INO (sbuf), (long) vcbextrap->u.ufs.ino); - if (vref != BigEndianValue (vcbp->vcbVRefNum)) + if (vref != CW (vcbp->vcbVRefNum)) err = fnfErr; else { @@ -143,7 +142,7 @@ look_for_volume (const char *vol_name, INTEGER *vrefp, LONGINT *diridp) retval = PBGetVInfo (&pbr, FALSE); if (retval == noErr) { - *vrefp = BigEndianValue (pbr.volumeParam.ioVRefNum); + *vrefp = CW (pbr.volumeParam.ioVRefNum); *diridp = 2; } return retval; @@ -161,12 +160,13 @@ last_chance_tmp_vref_and_dirid (INTEGER vref, INTEGER *tmp_vrefp, OSErr retval; HParamBlockRec pb = {0}; - pb.volumeParam.ioVRefNum = BigEndianValue (vref); + pb.volumeParam.ioVRefNum = CW (vref); retval = PBHGetVInfo (&pb, FALSE); if (retval == noErr) { - static const unsigned char *top_level_names[] = { - "\ptmp", - "\ptemp", + static char *top_level_names[] = + { + "\3tmp", + "\4temp", }; int i; OSErr err; @@ -185,7 +185,7 @@ last_chance_tmp_vref_and_dirid (INTEGER vref, INTEGER *tmp_vrefp, hpb.dirInfo.ioDrDirID = CLC (2); err = PBGetCatInfo (&hpb, FALSE); if (err == noErr && (hpb.hFileInfo.ioFlAttrib & ATTRIB_ISADIR)) - *tmp_diridp = BigEndianValue (hpb.dirInfo.ioDrDirID); + *tmp_diridp = CL (hpb.dirInfo.ioDrDirID); } if (err != noErr) *tmp_diridp = CLC (2); @@ -262,14 +262,14 @@ test_directory (INTEGER vref, LONGINT dirid, const char *sub_dirp, str255_from_c_string (file_name, sub_dirp); cpb.hFileInfo.ioNamePtr = (StringPtr) RM ((Ptr) file_name); - cpb.hFileInfo.ioVRefNum = BigEndianValue (vref); + cpb.hFileInfo.ioVRefNum = CW (vref); cpb.hFileInfo.ioFDirIndex = CWC (0); - cpb.hFileInfo.ioDirID = BigEndianValue (dirid); + cpb.hFileInfo.ioDirID = CL (dirid); err = PBGetCatInfo (&cpb, FALSE); if (err == noErr && !(cpb.hFileInfo.ioFlAttrib & ATTRIB_ISADIR)) err = dupFNErr; if (err == noErr) - *new_idp = BigEndianValue (cpb.dirInfo.ioDrDirID); + *new_idp = CL (cpb.dirInfo.ioDrDirID); return err; } @@ -302,8 +302,8 @@ P5 (PUBLIC pascal trap, OSErr, FindFolder, retval = create_directory (sys_vref, sys_dirid, sub_dir, &new_id); if (retval == noErr) { - *foundVRefNum = BigEndianValue (sys_vref); - *foundDirID = BigEndianValue (new_id); + *foundVRefNum = CW (sys_vref); + *foundDirID = CL (new_id); } } } @@ -320,8 +320,8 @@ P5 (PUBLIC pascal trap, OSErr, FindFolder, { /* NOTE: IMVI 9-44 tells us to not create System Folder if it doesn't already exist */ - *foundVRefNum = BigEndianValue (sys_vref); - *foundDirID = BigEndianValue (sys_dirid); + *foundVRefNum = CW (sys_vref); + *foundDirID = CL (sys_dirid); } } break; @@ -341,8 +341,8 @@ P5 (PUBLIC pascal trap, OSErr, FindFolder, warning_unimplemented ("Didn't attempt to create folder"); if (retval == noErr) { - *foundVRefNum = BigEndianValue (tmp_vref); - *foundDirID = BigEndianValue (tmp_dirid); + *foundVRefNum = CW (tmp_vref); + *foundDirID = CL (tmp_dirid); } } break; @@ -494,14 +494,14 @@ parse2 (AliasHandle ah, const void *addrs[], int count) headp = (alias_head_t *) STARH (ah); partp = (INTEGER *) (&headp[1]); - ep = (INTEGER *) ((char *) headp + MIN (size, BigEndianValue (headp->length))); + ep = (INTEGER *) ((char *) headp + MIN (size, CW (headp->length))); memset (addrs, 0, count * sizeof addrs[0]); for (; partp < ep && *partp != CWC (-1); - partp = (INTEGER *) ((char *) partp + EVENUP (4 + BigEndianValue (partp[1])))) + partp = (INTEGER *) ((char *) partp + EVENUP (4 + CW (partp[1])))) { int part; - part = BigEndianValue (*partp); + part = CW (*partp); if (part < count) addrs[part] = partp + 1; } @@ -642,9 +642,9 @@ assemble_pieces (AliasHandle *ahp, alias_head_t *headp, INTEGER n_pieces, ...) void *p; tag = va_arg (va, int); - tag_x = BigEndianValue (tag); + tag_x = CW (tag); length = va_arg (va, int); - length_x = BigEndianValue (length); + length_x = CW (length); p = va_arg (va, void *); memcpy (op, &tag_x, sizeof tag_x); op += sizeof tag_x; diff --git a/src/appearance.cpp b/src/appearance.cpp index 16b16b2e..e64551ba 100644 --- a/src/appearance.cpp +++ b/src/appearance.cpp @@ -21,7 +21,6 @@ char ROMlib_rcsid_appearance[] = #include "rsys/options.h" using namespace Executor; -using namespace ByteSwap; PRIVATE appearance_t appearance = appearance_sys7; @@ -31,8 +30,8 @@ PRIVATE appearance_t appearance = appearance_sys7; PRIVATE StringPtr res_filenames[] = { - (StringPtr) "\pmac.rsrc", - (StringPtr) "\pwindows.rsrc", + (StringPtr) "\010mac.rsrc", + (StringPtr) "\014windows.rsrc", }; /* Exactly the same as CountTypes, except only the resource file with the @@ -187,7 +186,7 @@ silently_replace_resources (INTEGER master_file_rn, INTEGER from_file_rn) INTEGER res_num, res_num_max; GetIndTypeRN (from_file_rn, &type, type_num); - type = BigEndianValue (type); + type = CL (type); res_num_max = CountResourcesRN (from_file_rn, type); for (res_num = 1; res_num <= res_num_max; ++res_num) { @@ -198,7 +197,7 @@ silently_replace_resources (INTEGER master_file_rn, INTEGER from_file_rn) h = GetIndResourceRN (from_file_rn, type, res_num); GetResInfo (h, &id, &t, name); - id = BigEndianValue (id); + id = CW (id); LoadResource (h); DetachResource (h); AddResourceRN (master_file_rn, h, type, id, name); @@ -216,10 +215,10 @@ Executor::ROMlib_set_appearance (void) if (appearance < 0 || appearance >= NELEM (res_filenames)) appearance = (appearance_t)0; - res_file = OpenRFPerm (res_filenames[appearance], BigEndianValue (BootDrive), fsRdPerm); + res_file = OpenRFPerm (res_filenames[appearance], CW (BootDrive), fsRdPerm); if (res_file != CWC (-1)) { - silently_replace_resources (BigEndianValue (SysMap), res_file); + silently_replace_resources (CW (SysMap), res_file); CloseResFile (res_file); } else if (appearance != 0) diff --git a/src/cfm.cpp b/src/cfm.cpp index bda54e89..51ca499e 100644 --- a/src/cfm.cpp +++ b/src/cfm.cpp @@ -35,7 +35,6 @@ #include "ppc_stubs.h" using namespace Executor; -using namespace ByteSwap; typedef enum { @@ -85,7 +84,7 @@ try_to_get_memory (void **addrp, syn68k_addr_t default_syn_address, uint32 total_size, int alignment) { OSErr retval; -#if !(defined(linux) || defined(MACOSX_)) +#if !defined(linux) retval = paramErr; #else void *default_address; @@ -379,7 +378,7 @@ repeatedly_relocate (uint32 count, uint8 **relocAddressp, uint32 val) p = (uint32 *) *relocAddressp; while (count-- > 0) { - *p = BigEndianValue (BigEndianValue (*p) + val); + *p = CL (CL (*p) + val); ++p; } *relocAddressp = (uint8 *) p; @@ -475,15 +474,15 @@ check_vanddir (INTEGER vref, LONGINT dirid, int descend_count, Str63 library, retval = fragLibNotFound; pb.hFileInfo.ioNamePtr = RM (&s[0]); - pb.hFileInfo.ioVRefNum = BigEndianValue (vref); + pb.hFileInfo.ioVRefNum = CW (vref); err = noErr; errcount = 0; for (dirindex = 1; retval != noErr && err != fnfErr && errcount != 3; dirindex++) { - pb.hFileInfo.ioFDirIndex = BigEndianValue (dirindex); - pb.hFileInfo.ioDirID = BigEndianValue (dirid); + pb.hFileInfo.ioFDirIndex = CW (dirindex); + pb.hFileInfo.ioDirID = CL (dirid); err = PBGetCatInfo(&pb, FALSE); if (err) { @@ -500,7 +499,7 @@ check_vanddir (INTEGER vref, LONGINT dirid, int descend_count, Str63 library, { if (descend_count > 0) { - retval = check_vanddir (vref, BigEndianValue (pb.hFileInfo.ioDirID), + retval = check_vanddir (vref, CL (pb.hFileInfo.ioDirID), descend_count-1, library, arch, loadflags, cidp, mainaddrp, errName); @@ -941,7 +940,7 @@ begin_closure (uint32 n_libs, PEFImportedLibrary_t *libs, OSErr err; retval = (typeof (retval)) NewPtr (sizeof *retval + n_libs * sizeof (lib_t)); - N_LIBS_X (retval) = BigEndianValue (n_libs); + N_LIBS_X (retval) = CL (n_libs); #warning eventually need to worry about errors @@ -1439,13 +1438,13 @@ try_to_mmap_file (FSSpecPtr fsp, LONGINT offset, LONGINT length, retval = noErr; /* canonicalize fsp to make sure */ - vref = BigEndianValue (fsp->vRefNum); + vref = CW (fsp->vRefNum); if (ISWDNUM (vref) || pstr_index_after (fsp->name, ':', 0)) { FSSpecPtr newfsp; newfsp = alloca (sizeof *newfsp); - retval = FSMakeFSSpec (vref, BigEndianValue (fsp->parID), fsp->name, newfsp); + retval = FSMakeFSSpec (vref, CL (fsp->parID), fsp->name, newfsp); if (retval == noErr) fsp = newfsp; } diff --git a/src/check_structs.cpp b/src/check_structs.cpp index a359e205..a70e92bc 100644 --- a/src/check_structs.cpp +++ b/src/check_structs.cpp @@ -206,10 +206,10 @@ void Executor::check_structs(void) check (FXInfo, 16); check (DInfo, 16); check (DXInfo, 16); - check (ioParam, 50); - check (fileParam, 80); - check (volumeParam, 64); - check (cntrlParam, 50); + check (IOParam, 50); + check (FileParam, 80); + check (VolumeParam, 64); + check (CntrlParam, 50); check (ParamBlockRec, 80); check (HIoParam, 50); check (HFileParam, 80); diff --git a/src/commtool.cpp b/src/commtool.cpp index 20d11215..1067ffcc 100644 --- a/src/commtool.cpp +++ b/src/commtool.cpp @@ -18,7 +18,6 @@ char ROMlib_rcsid_commtool[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; PUBLIC INTEGER Executor::CRMGetCRMVersion (void) @@ -53,7 +52,7 @@ Executor::CRMInstall (QElemPtr qp) CRMRecPtr prevp; prevp = (CRMRecPtr) MR (commtool_head.qTail); - ((CRMRecPtr)qp)->crmDeviceID = BigEndianValue (BigEndianValue (prevp->crmDeviceID) + 1); + ((CRMRecPtr)qp)->crmDeviceID = CL (CL (prevp->crmDeviceID) + 1); } Enqueue (qp, &commtool_head); @@ -77,11 +76,11 @@ Executor::CRMSearch (QElemPtr qp) CRMRecPtr p; LONGINT min; - min = BigEndianValue (((CRMRecPtr)qp)->crmDeviceID) + 1; + min = CL (((CRMRecPtr)qp)->crmDeviceID) + 1; block = block_virtual_ints (); for (p = (CRMRecPtr) MR (commtool_head.qHead); - p && BigEndianValue (p->crmDeviceID) < min; + p && CL (p->crmDeviceID) < min; p = (CRMRecPtr) MR (p->qLink)) ; restore_virtual_ints (block); diff --git a/src/config/arch/i386/i386.c b/src/config/arch/i386/i386.cpp similarity index 97% rename from src/config/arch/i386/i386.c rename to src/config/arch/i386/i386.cpp index 180a226c..0c8bec8e 100644 --- a/src/config/arch/i386/i386.c +++ b/src/config/arch/i386/i386.cpp @@ -18,7 +18,7 @@ arch_type_t arch_type; boolean_t -arch_init (void) +Executor::arch_init (void) { #if !defined (ALWAYS_ON_I486) uint32 scratch1, scratch2; diff --git a/src/config/arch/i386/i386.h b/src/config/arch/i386/i386.h index e17bdf32..201836e3 100644 --- a/src/config/arch/i386/i386.h +++ b/src/config/arch/i386/i386.h @@ -26,7 +26,7 @@ #define SWAP16_FUNC_DEFN \ -extern inline uint16 \ +inline uint16 \ swap16 (uint16 n) \ { \ return (n >> 8) | (n << 8); \ @@ -35,7 +35,7 @@ swap16 (uint16 n) \ #if defined (ALWAYS_ON_I486) #define SWAP32_FUNC_DEFN \ -extern inline uint32 \ +inline uint32 \ swap32 (uint32 n) \ { \ /* We can use bswap on the i486, but never on the i386. */ \ @@ -44,7 +44,7 @@ swap32 (uint32 n) \ } #else /* !ALWAYS_ON_I486 */ #define SWAP32_FUNC_DEFN \ -extern inline uint32 \ +inline uint32 \ swap32 (uint32 n) \ { \ __asm__ ("rorw $8,%w0\n\t" \ diff --git a/src/config/arch/i386/opfind.c b/src/config/arch/i386/opfind.cpp similarity index 99% rename from src/config/arch/i386/opfind.c rename to src/config/arch/i386/opfind.cpp index a9bb2544..55e78e0a 100644 --- a/src/config/arch/i386/opfind.c +++ b/src/config/arch/i386/opfind.cpp @@ -550,7 +550,7 @@ main (int argc, char *argv[]) code_size = compute_code_size (); /* Figure out which bytes vary. */ - vary_mask = alloca (code_size); + vary_mask = (unsigned char*) alloca (code_size); compute_vary_mask (vary_mask, code_size); if (!strcmp (argv[2], "-genasm")) diff --git a/src/config/arch/i386/sbstubtables.c b/src/config/arch/i386/sbstubtables.cpp similarity index 100% rename from src/config/arch/i386/sbstubtables.c rename to src/config/arch/i386/sbstubtables.cpp diff --git a/src/config/arch/i386/xdstubtables.c b/src/config/arch/i386/xdstubtables.cpp similarity index 100% rename from src/config/arch/i386/xdstubtables.c rename to src/config/arch/i386/xdstubtables.cpp diff --git a/src/config/front-ends/x/x.c b/src/config/front-ends/x/x.cpp similarity index 96% rename from src/config/front-ends/x/x.c rename to src/config/front-ends/x/x.cpp index 7b510734..ab20baed 100644 --- a/src/config/front-ends/x/x.c +++ b/src/config/front-ends/x/x.cpp @@ -69,6 +69,7 @@ char ROMlib_rcsid_x[] = "$Id: x.c 89 2005-05-25 04:15:34Z ctm $"; #include "rsys/x.h" #include "rsys/parse.h" #include "rsys/osevent.h" +#include "rsys/notmac.h" #include "x_keycodes.h" @@ -82,6 +83,8 @@ ROMlib_set_use_scancodes (boolean_t val) /* These variables are required by the vdriver interface. */ +namespace Executor +{ uint8 *vdriver_fbuf; int vdriver_row_bytes; @@ -96,7 +99,10 @@ int vdriver_max_bpp, vdriver_log2_max_bpp; rgb_spec_t *vdriver_rgb_spec; -boolean_t vdriver_grayscale_p; +bool vdriver_grayscale_p; +} + +using namespace Executor; /* save the original sigio flag; used when we shutdown */ static int orig_sigio_flag; @@ -191,18 +197,17 @@ static XrmOptionDescRec opts[] = { "-debug", ".debug", XrmoptionSepArg, 0 }, }; -static option_t x_opts[] = +void +Executor::vdriver_opt_register (void) { + opt_register ("vdriver", { { "synchronous", "run in synchronous mode", opt_no_arg }, { "geometry", "specify the executor window geometry", opt_sep }, { "privatecmap", "have executor use a private x colormap", opt_no_arg }, { "truecolor", "have executor use a TrueColor visual", opt_no_arg }, -}; +}); -void -vdriver_opt_register (void) -{ - opt_register ("vdriver", x_opts, NELEM (x_opts)); +//x_opts, NELEM (x_opts)); } static XrmDatabase xdb; @@ -339,7 +344,7 @@ alloc_x_image (int bpp, int width, int height, XShmSegmentInfo *shminfo; /* note: this memory doesn't get reclaimed */ - shminfo = malloc (sizeof *shminfo); + shminfo = (XShmSegmentInfo*)malloc (sizeof *shminfo); memset (shminfo, '\0', sizeof *shminfo); x_image = XShmCreateImage (x_dpy, visual->visual, @@ -361,7 +366,7 @@ alloc_x_image (int bpp, int width, int height, else { fbuf = (unsigned char *) (shminfo->shmaddr = x_image->data - = shmat (shminfo->shmid, 0, 0)); + = (char*)shmat (shminfo->shmid, 0, 0)); if (fbuf == (unsigned char *) -1) { /* do we need to delete the shmid here? */ @@ -400,7 +405,7 @@ alloc_x_image (int bpp, int width, int height, { warning_unexpected ("not using shared memory"); row_bytes = ((width * bpp + 31) / 32) * 4; - fbuf = calloc (row_bytes * height, 1); + fbuf = (unsigned char*)calloc (row_bytes * height, 1); x_image = XCreateImage (x_dpy, visual->visual, bpp, ZPixmap, 0, (char *) fbuf, width, height, 8, row_bytes); resultant_bpp = x_image->bits_per_pixel; @@ -1194,12 +1199,12 @@ x_event_handler (int signo) } boolean_t -vdriver_init (int _max_width, int _max_height, int _max_bpp, +Executor::vdriver_init (int _max_width, int _max_height, int _max_bpp, boolean_t fixed_p, int *argc, char *argv[]) { int i; - XVisualInfo *visuals, template; + XVisualInfo *visuals, vistemplate; int n_visuals; int dummy_int; unsigned int geom_width, geom_height; @@ -1278,10 +1283,10 @@ vdriver_init (int _max_width, int _max_height, int _max_bpp, vdriver_x_modes.size[1].height = max_height; /* first attempt to find a 8bpp pseudocolor visual */ - template.screen = x_screen; - template.depth = 8; - template.class = PseudoColor; - template.colormap_size = 256; + vistemplate.screen = x_screen; + vistemplate.depth = 8; + vistemplate.c_class = PseudoColor; + vistemplate.colormap_size = 256; visual = NULL; @@ -1290,7 +1295,7 @@ vdriver_init (int _max_width, int _max_height, int _max_bpp, visuals = XGetVisualInfo (x_dpy, ( VisualScreenMask | VisualDepthMask | VisualClassMask | VisualColormapSizeMask), - &template, &n_visuals); + &vistemplate, &n_visuals); if (n_visuals) { /* just use the first visual that came up */ @@ -1301,13 +1306,13 @@ vdriver_init (int _max_width, int _max_height, int _max_bpp, if (visual == NULL) { /* now try for 4bpp */ - template.depth = 4; - template.colormap_size = 16; + vistemplate.depth = 4; + vistemplate.colormap_size = 16; visuals = XGetVisualInfo (x_dpy, ( VisualScreenMask | VisualDepthMask | VisualClassMask | VisualColormapSizeMask), - &template, &n_visuals); + &vistemplate, &n_visuals); if (n_visuals) { /* just use the first visual that came up */ @@ -1319,12 +1324,12 @@ vdriver_init (int _max_width, int _max_height, int _max_bpp, if (visual == NULL) { /* now try for 1bpp */ - template.depth = 1; - template.class = StaticGray; + vistemplate.depth = 1; + vistemplate.c_class = StaticGray; visuals = XGetVisualInfo (x_dpy, ( VisualScreenMask | VisualDepthMask | VisualClassMask), - &template, &n_visuals); + &vistemplate, &n_visuals); if (n_visuals) { /* just use the first visual that came up */ @@ -1336,12 +1341,12 @@ vdriver_init (int _max_width, int _max_height, int _max_bpp, if (visual == NULL) { - template.screen = x_screen; - template.class = TrueColor; + vistemplate.screen = x_screen; + vistemplate.c_class = TrueColor; visuals = XGetVisualInfo (x_dpy, (VisualScreenMask | VisualClassMask), - &template, &n_visuals); + &vistemplate, &n_visuals); if (n_visuals) { for (i = 0; i < n_visuals; i ++) @@ -1439,7 +1444,7 @@ vdriver_init (int _max_width, int _max_height, int _max_bpp, void -vdriver_flush_display (void) +Executor::vdriver_flush_display (void) { XFlush (x_dpy); } @@ -1605,7 +1610,7 @@ alloc_x_window (int width, int height, int bpp, boolean_t grayscale_p) XFlush (x_dpy); } -int host_cursor_depth = 1; +int Executor::host_cursor_depth = 1; Cursor create_x_cursor (char *data, char *mask, @@ -1616,7 +1621,10 @@ create_x_cursor (char *data, char *mask, int i; static XColor x_black = { 0, 0, 0, 0 }, - x_white = { ~0, ~0, ~0, ~0 }; + x_white = { (unsigned long)~0, + (unsigned short)~0, + (unsigned short)~0, + (unsigned short)~0 }; for (i = 0; i < 32; i++) { @@ -1649,7 +1657,7 @@ create_x_cursor (char *data, char *mask, } void -host_set_cursor (char *cursor_data, +Executor::host_set_cursor (char *cursor_data, unsigned short cursor_mask[16], int hotspot_x, int hotspot_y) { @@ -1667,7 +1675,7 @@ host_set_cursor (char *cursor_data, } int -host_set_cursor_visible (int show_p) +Executor::host_set_cursor_visible (int show_p) { int orig_cursor_visible_p = cursor_visible_p; @@ -2022,7 +2030,7 @@ static ColorSpec cmap[256]; static uint8 depth_table_space[DEPTHCONV_MAX_TABLE_SIZE]; void -vdriver_get_colors (int first_color, int num_colors, +Executor::vdriver_get_colors (int first_color, int num_colors, ColorSpec *colors) { gui_fatal ("`!vdriver_fixed_clut_p' and `vdriver_get_colors ()' called"); @@ -2030,7 +2038,7 @@ vdriver_get_colors (int first_color, int num_colors, void -vdriver_set_colors (int first_color, int num_colors, +Executor::vdriver_set_colors (int first_color, int num_colors, const ColorSpec *colors) { int i; @@ -2107,7 +2115,7 @@ vdriver_set_colors (int first_color, int num_colors, } int -vdriver_update_screen_rects (int num_rects, const vdriver_rect_t *r, +Executor::vdriver_update_screen_rects (int num_rects, const vdriver_rect_t *r, boolean_t cursor_p) { boolean_t convert_p; @@ -2165,7 +2173,7 @@ vdriver_update_screen_rects (int num_rects, const vdriver_rect_t *r, } int -vdriver_update_screen (int top, int left, int bottom, int right, +Executor::vdriver_update_screen (int top, int left, int bottom, int right, boolean_t cursor_p) { vdriver_rect_t r; @@ -2189,7 +2197,7 @@ vdriver_update_screen (int top, int left, int bottom, int right, } void -vdriver_shutdown (void) +Executor::vdriver_shutdown (void) { if (x_dpy == NULL) return; @@ -2218,7 +2226,7 @@ vdriver_x_mode_t vdriver_x_modes = boolean_t -vdriver_acceptable_mode_p (int width, int height, int bpp, +Executor::vdriver_acceptable_mode_p (int width, int height, int bpp, boolean_t grayscale_p, boolean_t exact_match_p) { @@ -2243,7 +2251,7 @@ vdriver_acceptable_mode_p (int width, int height, int bpp, } boolean_t -vdriver_set_mode (int width, int height, int bpp, boolean_t grayscale_p) +Executor::vdriver_set_mode (int width, int height, int bpp, boolean_t grayscale_p) { if (!x_window) { @@ -2319,7 +2327,7 @@ vdriver_set_mode (int width, int height, int bpp, boolean_t grayscale_p) /* Compute the rgb spec. */ vdriver_rgb_spec = (conversion_func == NULL - ? (visual->class == TrueColor + ? (visual->c_class == TrueColor ? &x_rgb_spec : NULL) : (vdriver_bpp == 32 @@ -2332,7 +2340,7 @@ vdriver_set_mode (int width, int height, int bpp, boolean_t grayscale_p) } vdriver_accel_result_t -vdriver_accel_rect_fill (int top, int left, int bottom, +Executor::vdriver_accel_rect_fill (int top, int left, int bottom, int right, uint32 color) { XGCValues gc_values; @@ -2386,20 +2394,20 @@ vdriver_accel_rect_fill (int top, int left, int bottom, /* stuff from x.c */ void -host_beep_at_user ( void ) +Executor::host_beep_at_user ( void ) { /* 50 for now */ XBell (x_dpy, 0); } void -PutScrapX (int type, int length, char *p, int scrap_count) +Executor::PutScrapX (OSType type, LONGINT length, char *p, int scrap_count) { if (type == TICK ("TEXT")) { if (selectiontext) free (selectiontext); - selectiontext = malloc (length); + selectiontext = (char*)malloc (length); if (selectiontext) { selectionlength = length; @@ -2423,7 +2431,7 @@ WeOwnScrapX (void) } int -GetScrapX (int type, char **h) +Executor::GetScrapX (OSType type, char **h) { int retval; @@ -2484,7 +2492,7 @@ ROMlib_SetTitle (char *newtitle) memset (&xsh, 0, sizeof xsh); XSetStandardProperties (x_dpy, x_window, newtitle, newtitle, None, - (void *) 0, 0, &xsh); + nullptr, 0, &xsh); } char * @@ -2509,14 +2517,14 @@ lookupkeysymX (char *evt) } void -autorepeatonX (void) +Executor::autorepeatonX (void) { XAutoRepeatOn (x_dpy); XSync (x_dpy, 0); } void -querypointerX (int *xp, int *yp, int *modp) +Executor::querypointerX (int *xp, int *yp, int *modp) { Window dummy_window; Window child_window; @@ -2532,7 +2540,7 @@ querypointerX (int *xp, int *yp, int *modp) /* host functions that should go away */ void -host_flush_shadow_screen (void) +Executor::host_flush_shadow_screen (void) { int top_long, left_long, bottom_long, right_long; @@ -2541,7 +2549,7 @@ host_flush_shadow_screen (void) */ if (shadow_fbuf == NULL) { - shadow_fbuf = malloc (fbuf_size); + shadow_fbuf = (unsigned char*) malloc (fbuf_size); memcpy (shadow_fbuf, vdriver_fbuf, vdriver_row_bytes * vdriver_height); vdriver_update_screen (0, 0, vdriver_height, vdriver_width, FALSE); } diff --git a/src/config/front-ends/x/x_keycodes.c b/src/config/front-ends/x/x_keycodes.cpp similarity index 100% rename from src/config/front-ends/x/x_keycodes.c rename to src/config/front-ends/x/x_keycodes.cpp diff --git a/src/config/os/linux/linux.c b/src/config/os/linux/linux.cpp similarity index 100% rename from src/config/os/linux/linux.c rename to src/config/os/linux/linux.cpp diff --git a/src/config/os/linux/linux_except.c b/src/config/os/linux/linux_except.cpp similarity index 100% rename from src/config/os/linux/linux_except.c rename to src/config/os/linux/linux_except.cpp diff --git a/src/config/os/linux/lowglobals-mem.c b/src/config/os/linux/lowglobals-mem.cpp similarity index 100% rename from src/config/os/linux/lowglobals-mem.c rename to src/config/os/linux/lowglobals-mem.cpp diff --git a/src/config/sound/OBSOLETE_dummy/dummy-sound.h b/src/config/sound/dummy/dummy-sound.h similarity index 100% rename from src/config/sound/OBSOLETE_dummy/dummy-sound.h rename to src/config/sound/dummy/dummy-sound.h diff --git a/src/config/sound/OBSOLETE_dummy/dummy.make b/src/config/sound/dummy/dummy.make similarity index 100% rename from src/config/sound/OBSOLETE_dummy/dummy.make rename to src/config/sound/dummy/dummy.make diff --git a/src/configure.ac b/src/configure.ac index 0f5cc46a..dcd61a75 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -2,7 +2,7 @@ AC_INIT(executor, 2.1.17, ctm@ardi.com) AC_CANONICAL_SYSTEM AM_INIT_AUTOMAKE([-Wall]) -AC_CONFIG_SRCDIR([executor.c]) +AC_CONFIG_SRCDIR([executor.cpp]) AC_CONFIG_HEADERS([config.h]) # Normalize to our old names @@ -40,7 +40,7 @@ esac # Checks for programs. AM_PROG_AS AC_PROG_CC -AM_PROG_CC_C_O +AC_PROG_CXX AC_PROG_RANLIB AM_PROG_AS AC_PROG_YACC diff --git a/src/ctlArrows.cpp b/src/ctlArrows.cpp index 9f372f06..ece79c1c 100644 --- a/src/ctlArrows.cpp +++ b/src/ctlArrows.cpp @@ -23,7 +23,6 @@ char ROMlib_rcsid_ctlArrows[] = #include "rsys/wind.h" using namespace Executor; -using namespace ByteSwap; namespace Executor { #include "arrow_up_active.cmap" @@ -175,7 +174,7 @@ validate_colors_for_control (ControlHandle ctl) int index; c_ctab_entry = &c_ctab_table[i]; - index = BigEndianValue (c_ctab_entry->value); + index = CW (c_ctab_entry->value); if (index >= 0 && index < NELEM (ctl_ctab_colors)) ctl_ctab_colors[index] = c_ctab_entry->rgb; } @@ -308,16 +307,16 @@ draw_arrow (ControlHandle ctl, int part) if (vert_p) { if (part == inUpButton) - r.bottom = BigEndianValue (BigEndianValue (r.top) + width); + r.bottom = CW (CW (r.top) + width); else - r.top = BigEndianValue (BigEndianValue (r.bottom) - width); + r.top = CW (CW (r.bottom) - width); } else { if (part == inUpButton) - r.right = BigEndianValue (BigEndianValue (r.left) + height); + r.right = CW (CW (r.left) + height); else - r.left = BigEndianValue (BigEndianValue (r.right) - height); + r.left = CW (CW (r.right) - height); } active_p = (CTL_HILITE (ctl) == part); @@ -341,17 +340,17 @@ draw_page (ControlHandle ctl) width = RECT_WIDTH (&r); if (SB_VERT_P (height, width)) { - r.top = BigEndianValue (BigEndianValue (r.top) + width); - r.bottom = BigEndianValue (BigEndianValue (r.bottom) - width); - r.left = BigEndianValue (BigEndianValue (r.left) + 1); - r.right = BigEndianValue (BigEndianValue (r.right) - 1); + r.top = CW (CW (r.top) + width); + r.bottom = CW (CW (r.bottom) - width); + r.left = CW (CW (r.left) + 1); + r.right = CW (CW (r.right) - 1); } else { - r.left = BigEndianValue (BigEndianValue (r.left) + height); - r.right = BigEndianValue (BigEndianValue (r.right) - height); - r.top = BigEndianValue (BigEndianValue (r.top) + 1); - r.bottom = BigEndianValue (BigEndianValue (r.bottom) - 1); + r.left = CW (CW (r.left) + height); + r.right = CW (CW (r.right) - height); + r.top = CW (CW (r.top) + 1); + r.bottom = CW (CW (r.bottom) - 1); } /* page_{fg, bk} colors are dependent on whether or not the sb is @@ -382,22 +381,22 @@ thumb_rect (ControlHandle ctl, Rect *thumb_rect_out) if (SB_VERT_P (height, width)) { thumb_rect_out->top - = BigEndianValue ((short) (BigEndianValue (r.top) + width + = CW ((short) (CW (r.top) + width + ((val - min) * ((LONGINT) height - 3 * width) / diff))); - thumb_rect_out->bottom = BigEndianValue (BigEndianValue (thumb_rect_out->top) + width); - thumb_rect_out->left = BigEndianValue (BigEndianValue (r.left) + 1); - thumb_rect_out->right = BigEndianValue (BigEndianValue (r.right) - 1); + thumb_rect_out->bottom = CW (CW (thumb_rect_out->top) + width); + thumb_rect_out->left = CW (CW (r.left) + 1); + thumb_rect_out->right = CW (CW (r.right) - 1); } else { thumb_rect_out->left - = BigEndianValue ((short) (BigEndianValue (r.left) + height + = CW ((short) (CW (r.left) + height + ((val - min) * ((LONGINT) width - 3 * height) / diff))); - thumb_rect_out->right = BigEndianValue (BigEndianValue (thumb_rect_out->left) + height); - thumb_rect_out->top = BigEndianValue (BigEndianValue (r.top) + 1); - thumb_rect_out->bottom = BigEndianValue (BigEndianValue (r.bottom) - 1); + thumb_rect_out->right = CW (CW (thumb_rect_out->left) + height); + thumb_rect_out->top = CW (CW (r.top) + 1); + thumb_rect_out->bottom = CW (CW (r.bottom) - 1); } } else @@ -423,8 +422,8 @@ LocalToGlobalRect (Rect *rp) PRIVATE void GlobalToLocalRgn (RgnHandle rgn) { - OffsetRgn (rgn, BigEndianValue (PORT_BOUNDS (thePort).left), - BigEndianValue (PORT_BOUNDS (thePort).top)); + OffsetRgn (rgn, CW (PORT_BOUNDS (thePort).left), + CW (PORT_BOUNDS (thePort).top)); } typedef struct @@ -458,15 +457,15 @@ draw_thumb (ControlHandle ctl) { dst_rect.top = new_thumb.top; dst_rect.bottom = new_thumb.bottom; - dst_rect.left = BigEndianValue (BigEndianValue (new_thumb.left) - 1); - dst_rect.right = BigEndianValue (BigEndianValue (new_thumb.right) + 1); + dst_rect.left = CW (CW (new_thumb.left) - 1); + dst_rect.right = CW (CW (new_thumb.right) + 1); } else { dst_rect.left = new_thumb.left; dst_rect.right = new_thumb.right; - dst_rect.top = BigEndianValue (BigEndianValue (new_thumb.top) - 1); - dst_rect.bottom = BigEndianValue (BigEndianValue (new_thumb.bottom) + 1); + dst_rect.top = CW (CW (new_thumb.top) - 1); + dst_rect.bottom = CW (CW (new_thumb.bottom) + 1); } /* if the old_thumb rect is empty, ie., the thumb was not @@ -558,22 +557,22 @@ where (ControlHandle ctl, Point p) width = RECT_WIDTH (&r); if (SB_VERT_P (height, width)) { - if (p.v <= BigEndianValue (r.top) + width) + if (p.v <= CW (r.top) + width) return inUpButton; - else if (p.v >= BigEndianValue (r.bottom) - width) + else if (p.v >= CW (r.bottom) - width) return inDownButton; - else if (p.v < BigEndianValue (thumbr.top)) + else if (p.v < CW (thumbr.top)) return inPageUp; else return inPageDown; } else { - if (p.h <= BigEndianValue (r.left) + height) + if (p.h <= CW (r.left) + height) return inUpButton; - else if (p.h >= BigEndianValue (r.right) - height) + else if (p.h >= CW (r.right) - height) return inDownButton; - else if (p.h < BigEndianValue (thumbr.left)) + else if (p.h < CW (thumbr.left)) return inPageUp; else return inPageDown; @@ -598,10 +597,10 @@ P4 (PUBLIC pascal, void, new_pos_ctl, INTEGER, depth, INTEGER, flags, r = CTL_RECT (ctl); - top = BigEndianValue (r.top); - left = BigEndianValue (r.left); - bottom = BigEndianValue (r.bottom); - right = BigEndianValue (r.right); + top = CW (r.top); + left = CW (r.left); + bottom = CW (r.bottom); + right = CW (r.right); height = bottom - top; width = right - left; @@ -616,8 +615,8 @@ P4 (PUBLIC pascal, void, new_pos_ctl, INTEGER, depth, INTEGER, flags, if (SB_VERT_P (height, width)) { a = top + width; - thumb_top = BigEndianValue (thumbr.top) + HiWord (p) - a; - CTL_VALUE_X (ctl) = BigEndianValue (min + (thumb_top + thumb_top = CW (thumbr.top) + HiWord (p) - a; + CTL_VALUE_X (ctl) = CW (min + (thumb_top * ((LONGINT) max - min + 1) / (bottom - a - (2 * width) + 1))); if (CTL_VIS_X (ctl) == 255) @@ -626,8 +625,8 @@ P4 (PUBLIC pascal, void, new_pos_ctl, INTEGER, depth, INTEGER, flags, else { a = left + height; - thumb_left = BigEndianValue (thumbr.left) + LoWord(p) - a; - CTL_VALUE_X (ctl) = BigEndianValue (min + (thumb_left + thumb_left = CW (thumbr.left) + LoWord(p) - a; + CTL_VALUE_X (ctl) = CW (min + (thumb_left * ((LONGINT) max - min + 1) / (right - a - (2 * height) + 1))); if (CTL_VIS_X (ctl) == 255) @@ -822,29 +821,29 @@ P4 (PUBLIC pascal, LONGINT, cdef16, /* IMI-328 */ break; case thumbCntl: pl = (struct lsastr *) param; - p.v = BigEndianValue (pl->limitRect.top); - p.h = BigEndianValue (pl->limitRect.left); + p.v = CW (pl->limitRect.top); + p.h = CW (pl->limitRect.left); pl->slopRect = pl->limitRect = CTL_RECT (c); thumbr = HxX (CTL_DATA (c), rgnBBox); GlobalToLocalRect (&thumbr); rp = &thumbr; - height = BigEndianValue (pl->slopRect.bottom) - BigEndianValue (pl->slopRect.top); - width = BigEndianValue (pl->slopRect.right) - BigEndianValue (pl->slopRect.left); + height = CW (pl->slopRect.bottom) - CW (pl->slopRect.top); + width = CW (pl->slopRect.right) - CW (pl->slopRect.left); if (SB_VERT_P (height, width)) { pl->axis = CWC (vAxisOnly); - pl->limitRect.top = BigEndianValue (BigEndianValue (pl->limitRect.top) - + (width - (BigEndianValue (rp->top) - p.v))); - pl->limitRect.bottom = BigEndianValue (BigEndianValue (pl->limitRect.bottom) - - (width - (p.v - BigEndianValue (rp->bottom)) - 1)); + pl->limitRect.top = CW (CW (pl->limitRect.top) + + (width - (CW (rp->top) - p.v))); + pl->limitRect.bottom = CW (CW (pl->limitRect.bottom) + - (width - (p.v - CW (rp->bottom)) - 1)); } else { pl->axis = CWC (hAxisOnly); - pl->limitRect.left = BigEndianValue (BigEndianValue (pl->limitRect.left) - + height - (BigEndianValue (rp->left) - p.h)); - pl->limitRect.right = BigEndianValue (BigEndianValue (pl->limitRect.right) - - height - (p.h - BigEndianValue (rp->right)) - 1); + pl->limitRect.left = CW (CW (pl->limitRect.left) + + height - (CW (rp->left) - p.h)); + pl->limitRect.right = CW (CW (pl->limitRect.right) + - height - (p.h - CW (rp->right)) - 1); } InsetRect (&pl->slopRect, -20, -20); break; diff --git a/src/ctlInit.cpp b/src/ctlInit.cpp index 41229423..82a3af84 100644 --- a/src/ctlInit.cpp +++ b/src/ctlInit.cpp @@ -24,7 +24,6 @@ char ROMlib_rcsid_ctlInit[] = #include "rsys/resource.h" using namespace Executor; -using namespace ByteSwap; PUBLIC BOOLEAN Executor::ROMlib_cdef0_is_rectangular = FALSE; @@ -70,7 +69,7 @@ P9(PUBLIC pascal trap, ControlHandle, NewControl, WindowPtr, wst, Rect *, r, acNext, RM (tmp), acOwner, RM (retval), acCTable, (CCTabHandle) RM (GetResource (TICK("cctb"), 0)), - acFlags, BigEndianValue (procid & 0x0F), + acFlags, CW (procid & 0x0F), acReserved, CLC (0), acRefCon, CLC (0)); str255assign (CTL_TITLE (retval), title); @@ -88,12 +87,12 @@ P9(PUBLIC pascal trap, ControlHandle, NewControl, WindowPtr, wst, Rect *, r, contrlOwner, RM (wst), contrlVis, vis ? 255 : 0, contrlHilite, 0, - contrlValue, BigEndianValue (value), - contrlMin, BigEndianValue (min), - contrlMax, BigEndianValue (max), + contrlValue, CW (value), + contrlMin, CW (min), + contrlMax, CW (max), contrlData, CLC_NULL, contrlAction, CLC_NULL, - contrlRfCon, BigEndianValue (rc)); + contrlRfCon, CL (rc)); WINDOW_CONTROL_LIST_X (wst) = RM (retval); @@ -129,7 +128,7 @@ P2(PUBLIC pascal trap, ControlHandle, GetNewControl, /* IMI-321 */ (StringPtr) ((char *) &HxX(wh, _crect) + 22), /* _ctitle */ Hx(wh, _cvisible) ? 255 : 0, Hx(wh, _cvalue), Hx(wh, _cmin), Hx(wh, _cmax), Hx(wh, _cprocid), - BigEndianValue(*(LONGINT *)((char *)&HxX(wh, _crect) + 18))); /* _crefcon */ + CL(*(LONGINT *)((char *)&HxX(wh, _crect) + 18))); /* _crefcon */ if (ctab_res_h) SetCtlColor (retval, (CCTabHandle) ctab_res_h); return retval; diff --git a/src/ctlMisc.cpp b/src/ctlMisc.cpp index 4edf7da1..fce0427a 100644 --- a/src/ctlMisc.cpp +++ b/src/ctlMisc.cpp @@ -24,7 +24,6 @@ char ROMlib_rcsid_ctlMisc[] = macros */ using namespace Executor; -using namespace ByteSwap; AuxCtlHandle Executor::default_aux_ctl; @@ -107,7 +106,7 @@ Executor::lookup_aux_ctl (ControlHandle ctl) P2(PUBLIC pascal trap, void, SetCRefCon, ControlHandle, c, /* IMI-327 */ LONGINT, data) { - HxX(c, contrlRfCon) = BigEndianValue(data); + HxX(c, contrlRfCon) = CL(data); } P1(PUBLIC pascal trap, LONGINT, GetCRefCon, ControlHandle, c) /* IMI-327 */ diff --git a/src/ctlMouse.cpp b/src/ctlMouse.cpp index 3e91b40d..0ec483cb 100644 --- a/src/ctlMouse.cpp +++ b/src/ctlMouse.cpp @@ -89,7 +89,7 @@ A3(PRIVATE inline, void, CALLACTION, ControlHandle, ch, INTEGER, inpart, else if (a == (ProcPtr) P_ROMlib_stdftrack) C_ROMlib_stdftrack(ch, inpart); else - CToPascalCall(&a, CTOP_ROMlib_mytrack, ch, inpart); + CToPascalCall((void*)a, CTOP_ROMlib_mytrack, ch, inpart); HOOKRESTOREREGS(); } @@ -116,8 +116,8 @@ P3 (PUBLIC pascal trap, INTEGER, TrackControl, /* IMI-323 */ if (!partstart) { GetMouse (&p); - BigEndianInPlace(p.h); - BigEndianInPlace(p.v); + p.h = BigEndianValue(p.h); + p.v = BigEndianValue(p.v); partstart = inpart = TestControl (c, p); } @@ -147,8 +147,8 @@ P3 (PUBLIC pascal trap, INTEGER, TrackControl, /* IMI-323 */ while (!GetOSEvent(mUpMask, &ev)) { GlobalToLocal(&ev.where); - whereunswapped.h = BigEndianValue(ev.where.h); - whereunswapped.v = BigEndianValue(ev.where.v); + whereunswapped.h = CW(ev.where.h); + whereunswapped.v = CW(ev.where.v); inpart = TestControl(c, whereunswapped); CTLCALL(c, autoTrack, inpart); } @@ -166,8 +166,8 @@ P3 (PUBLIC pascal trap, INTEGER, TrackControl, /* IMI-323 */ Quicken. */ if (!CTLCALL (c, dragCntl, partstart)) { - thumb._tlimit.left = BigEndianValue(p.h); - thumb._tlimit.top = BigEndianValue(p.v); + thumb._tlimit.left = CW(p.h); + thumb._tlimit.top = CW(p.v); CTLCALL(c, thumbCntl, (LONGINT) (long) &thumb); rh = NewRgn(); @@ -175,7 +175,7 @@ P3 (PUBLIC pascal trap, INTEGER, TrackControl, /* IMI-323 */ PATASSIGN(DragPattern, ltGray); l = DragTheRgn(rh, p, &thumb._tlimit, &thumb._tslop, - BigEndianValue(thumb._taxis), a); + CW(thumb._taxis), a); if ((uint32) l != 0x80008000) { CTLCALL(c, posCntl, l); @@ -194,8 +194,8 @@ P3 (PUBLIC pascal trap, INTEGER, TrackControl, /* IMI-323 */ while (!OSEventAvail(mUpMask, &ev) && StillDown()) { GlobalToLocal(&ev.where); - whereunswapped.h = BigEndianValue(ev.where.h); - whereunswapped.v = BigEndianValue(ev.where.v); + whereunswapped.h = CW(ev.where.h); + whereunswapped.v = CW(ev.where.v); inpart = TestControl(c, whereunswapped); if (inpart && inpart != partstart) inpart = 0; @@ -209,8 +209,8 @@ P3 (PUBLIC pascal trap, INTEGER, TrackControl, /* IMI-323 */ } GetOSEvent(mUpMask, &ev); GlobalToLocal(&ev.where); - whereunswapped.h = BigEndianValue(ev.where.h); - whereunswapped.v = BigEndianValue(ev.where.v); + whereunswapped.h = CW(ev.where.h); + whereunswapped.v = CW(ev.where.v); if (HxX(c, contrlHilite)) { HxX(c, contrlHilite) = 0; diff --git a/src/ctlPopup.cpp b/src/ctlPopup.cpp index 06ad1ca8..227986b6 100644 --- a/src/ctlPopup.cpp +++ b/src/ctlPopup.cpp @@ -23,7 +23,6 @@ char ROMlib_rcsid_ctlPopup[] = #include "rsys/menu.h" using namespace Executor; -using namespace ByteSwap; #if 0 /* It's not clear why Cotton had all these global variables, but it is clear that in at least one case he was using one @@ -59,7 +58,7 @@ init (ControlHandle ctl) HandToHand (&hh); flags = CTL_VALUE (ctl); - POPUP_MENU_ID_X (data) = BigEndianValue (mid); + POPUP_MENU_ID_X (data) = CW (mid); POPUP_MENU_X (data) = RM ((MenuHandle) hh.p); } /* private fields */ @@ -71,7 +70,7 @@ init (ControlHandle ctl) CTL_ACTION_X (ctl) = (ProcPtr) CLC (-1); CTL_VALUE_X (ctl) = CWC (1); CTL_MIN_X (ctl) = CWC (1); - CTL_MAX_X (ctl) = BigEndianValue (CountMItems (mh)); + CTL_MAX_X (ctl) = CW (CountMItems (mh)); CheckItem (mh, 1, TRUE); } @@ -172,10 +171,10 @@ draw (ControlHandle ctl, draw_state_t draw_state, } ctl_rect = &CTL_RECT (ctl); - top = BigEndianValue (ctl_rect->top); - left = BigEndianValue (ctl_rect->left); - bottom = BigEndianValue (ctl_rect->bottom); - right = BigEndianValue (ctl_rect->right); + top = CW (ctl_rect->top); + left = CW (ctl_rect->left); + bottom = CW (ctl_rect->bottom); + right = CW (ctl_rect->right); title = CTL_TITLE (ctl); @@ -191,10 +190,10 @@ draw (ControlHandle ctl, draw_state_t draw_state, } GetFontInfo (&font_info); - ascent = BigEndianValue (font_info.ascent); + ascent = CW (font_info.ascent); height = ( ascent - + BigEndianValue (font_info.descent) - + BigEndianValue (font_info.leading)); + + CW (font_info.descent) + + CW (font_info.leading)); title_width = POPUP_TITLE_WIDTH (data); icon_p = get_icon_info (item_info, &icon_info, TRUE); @@ -241,7 +240,7 @@ draw (ControlHandle ctl, draw_state_t draw_state, erase_rect.left = ctl_rect->left; erase_rect.bottom = ctl_rect->bottom; if (title_only_p) - erase_rect.right = BigEndianValue (left + title_width); + erase_rect.right = CW (left + title_width); else erase_rect.right = ctl_rect->right; EraseRect (&erase_rect); @@ -259,10 +258,10 @@ draw (ControlHandle ctl, draw_state_t draw_state, then should probably hilite from `center - icon_info.height / 2' to `center + icon_info.height / 2' */ - t_rect.top = BigEndianValue (baseline - ascent); - t_rect.left = BigEndianValue (left); - t_rect.bottom = BigEndianValue (baseline - ascent + height); - t_rect.right = BigEndianValue (left + title_width); + t_rect.top = CW (baseline - ascent); + t_rect.left = CW (left); + t_rect.bottom = CW (baseline - ascent + height); + t_rect.right = CW (left + title_width); PenMode (patCopy); EraseRect (&t_rect); @@ -304,10 +303,10 @@ draw (ControlHandle ctl, draw_state_t draw_state, RGBForeColor (&ROMlib_black_rgb_color); RGBBackColor (&ROMlib_white_rgb_color); - t_rect.top = BigEndianValue (draw_top); - t_rect.left = BigEndianValue (item_left - 1); - t_rect.bottom = BigEndianValue (draw_bottom - 1); - t_rect.right = BigEndianValue (right - 1); + t_rect.top = CW (draw_top); + t_rect.left = CW (item_left - 1); + t_rect.bottom = CW (draw_bottom - 1); + t_rect.right = CW (right - 1); EraseRect (&t_rect); @@ -331,10 +330,10 @@ draw (ControlHandle ctl, draw_state_t draw_state, if (icon_p) { - t_rect.top = BigEndianValue (center - icon_info.height / 2); - t_rect.left = BigEndianValue (item_left); - t_rect.bottom = BigEndianValue (BigEndianValue (t_rect.top) + (icon_info.height - ICON_PAD)); - t_rect.right = BigEndianValue (BigEndianValue (t_rect.left) + (icon_info.width - ICON_PAD)); + t_rect.top = CW (center - icon_info.height / 2); + t_rect.left = CW (item_left); + t_rect.bottom = CW (CW (t_rect.top) + (icon_info.height - ICON_PAD)); + t_rect.right = CW (CW (t_rect.left) + (icon_info.width - ICON_PAD)); if (icon_info.color_icon_p) PlotCIcon (&t_rect, (CIconHandle) icon_info.icon); @@ -357,7 +356,7 @@ draw (ControlHandle ctl, draw_state_t draw_state, if (title_right - title_left < StringWidth (item_title)) { int i, width; - Str15 ellipsis = "\p..."; + Str15 ellipsis = "\03..."; title_right -= StringWidth ((StringPtr) ellipsis); @@ -408,10 +407,10 @@ draw (ControlHandle ctl, draw_state_t draw_state, arrow_bitmap.rowBytes = CWC (2); SetRect (&arrow_bitmap.bounds, 0, 0, /* right, bottom */ 11, 6); - dst_rect.top = BigEndianValue (center - 3); - dst_rect.left = BigEndianValue (right - 22); - dst_rect.bottom = BigEndianValue (center - 3 + /* arrows are `6' tall */ 6); - dst_rect.right = BigEndianValue (right - 22 + dst_rect.top = CW (center - 3); + dst_rect.left = CW (right - 22); + dst_rect.bottom = CW (center - 3 + /* arrows are `6' tall */ 6); + dst_rect.right = CW (right - 22 + /* arrows are `11' wide */ 11); CopyBits (&arrow_bitmap, PORT_BITS_FOR_COPY (thePort), &arrow_bitmap.bounds, &dst_rect, srcCopy, NULL); @@ -516,13 +515,13 @@ P4 (PUBLIC pascal, int32, cdef1008, TRUE, TRUE, &top, &left); port_bounds = &PORT_BOUNDS (CTL_OWNER (ctl)); - top -= BigEndianValue (port_bounds->top); - left -= BigEndianValue (port_bounds->left); + top -= CW (port_bounds->top); + left -= CW (port_bounds->left); CalcMenuSize (mh); value = PopUpMenuSelect (mh, top, left, orig_value); if (value) - CTL_VALUE_X (ctl) = BigEndianValue (value); + CTL_VALUE_X (ctl) = CW (value); draw (ctl, draw_state, window_font, window_size, window_font_p, FALSE, FALSE, NULL, NULL); diff --git a/src/ctlSet.cpp b/src/ctlSet.cpp index 3776c4ee..da40b8d8 100644 --- a/src/ctlSet.cpp +++ b/src/ctlSet.cpp @@ -17,7 +17,6 @@ char ROMlib_rcsid_ctlSet[] = #include "rsys/ctl.h" using namespace Executor; -using namespace ByteSwap; P2(PUBLIC pascal trap, void, SetCtlValue, ControlHandle, c, /* IMI-326 */ INTEGER, v) @@ -31,7 +30,7 @@ P2(PUBLIC pascal trap, void, SetCtlValue, ControlHandle, c, /* IMI-326 */ else if (v > Hx(c, contrlMax)) HxX(c, contrlValue) = HxX(c, contrlMax); else - HxX(c, contrlValue) = BigEndianValue(v); + HxX(c, contrlValue) = CW(v); CTLCALL (c, drawCntl, ALLINDICATORS); }); @@ -51,9 +50,9 @@ P2(PUBLIC pascal trap, void, SetCtlMin, ControlHandle, c, /* IMI-326 */ (c, { SetPort(HxP(c, contrlOwner)); - HxX(c, contrlMin) = BigEndianValue(v); + HxX(c, contrlMin) = CW(v); if (Hx(c, contrlValue) < v) - HxX(c, contrlValue) = BigEndianValue(v); + HxX(c, contrlValue) = CW(v); CTLCALL(c, drawCntl, ALLINDICATORS); }); } @@ -74,9 +73,9 @@ P2(PUBLIC pascal trap, void, SetCtlMax, ControlHandle, c, /* IMI-327 */ if (v < Hx(c, contrlMin)) v = Hx(c, contrlMin); - HxX(c, contrlMax) = BigEndianValue(v); + HxX(c, contrlMax) = CW(v); if (Hx(c, contrlValue) > v) - HxX(c, contrlValue) = BigEndianValue(v); + HxX(c, contrlValue) = CW(v); CTLCALL(c, drawCntl, ALLINDICATORS); }); } diff --git a/src/ctlSize.cpp b/src/ctlSize.cpp index a6056397..89507e04 100644 --- a/src/ctlSize.cpp +++ b/src/ctlSize.cpp @@ -19,27 +19,26 @@ char ROMlib_rcsid_ctlSize[] = #include "rsys/ctl.h" using namespace Executor; -using namespace ByteSwap; P3(PUBLIC pascal trap, void, MoveControl, ControlHandle, c, /* IMI-325 */ INTEGER, h, INTEGER, v) { if (Hx(c, contrlVis)) { HideControl(c); - HxX(c, contrlRect.right) = BigEndianValue(Hx(c, contrlRect.right) + HxX(c, contrlRect.right) = CW(Hx(c, contrlRect.right) + h - Hx(c, contrlRect.left)); - HxX(c, contrlRect.bottom) = BigEndianValue(Hx(c, contrlRect.bottom) + HxX(c, contrlRect.bottom) = CW(Hx(c, contrlRect.bottom) + v - Hx(c, contrlRect.top)); - HxX(c, contrlRect.left) = BigEndianValue(h); - HxX(c, contrlRect.top) = BigEndianValue(v); + HxX(c, contrlRect.left) = CW(h); + HxX(c, contrlRect.top) = CW(v); ShowControl(c); } else { - HxX(c, contrlRect.right) = BigEndianValue(Hx(c, contrlRect.right) + + HxX(c, contrlRect.right) = CW(Hx(c, contrlRect.right) + h - Hx(c, contrlRect.left)); - HxX(c, contrlRect.bottom) = BigEndianValue(Hx(c, contrlRect.bottom) + + HxX(c, contrlRect.bottom) = CW(Hx(c, contrlRect.bottom) + v - Hx(c, contrlRect.top)); - HxX(c, contrlRect.left) = BigEndianValue(h); - HxX(c, contrlRect.top) = BigEndianValue(v); + HxX(c, contrlRect.left) = CW(h); + HxX(c, contrlRect.top) = CW(v); } } @@ -72,11 +71,11 @@ P3(PUBLIC pascal trap, void, SizeControl, ControlHandle, c, /* IMI-326 */ { if (Hx(c, contrlVis)) { HideControl(c); - HxX(c, contrlRect.right) = BigEndianValue(Hx(c, contrlRect.left) + width); - HxX(c, contrlRect.bottom) = BigEndianValue(Hx(c, contrlRect.top) + height); + HxX(c, contrlRect.right) = CW(Hx(c, contrlRect.left) + width); + HxX(c, contrlRect.bottom) = CW(Hx(c, contrlRect.top) + height); ShowControl(c); } else { - HxX(c, contrlRect.right) = BigEndianValue(Hx(c, contrlRect.left) + width); - HxX(c, contrlRect.bottom) = BigEndianValue(Hx(c, contrlRect.top) + height); + HxX(c, contrlRect.right) = CW(Hx(c, contrlRect.left) + width); + HxX(c, contrlRect.bottom) = CW(Hx(c, contrlRect.top) + height); } } diff --git a/src/ctlStddef.cpp b/src/ctlStddef.cpp index e2c82b00..3125775b 100644 --- a/src/ctlStddef.cpp +++ b/src/ctlStddef.cpp @@ -21,7 +21,6 @@ char ROMlib_rcsid_ctlStddef[] = #include "rsys/cquick.h" using namespace Executor; -using namespace ByteSwap; enum { @@ -64,7 +63,7 @@ validate_colors_for_control (ControlHandle ctl) int j; for (j = 0; j < def_ctl_ctab_size; j ++) - if (BigEndianValue (def_ctl_ctab_table[j].value) == i) + if (CW (def_ctl_ctab_table[j].value) == i) ctl_ctab_colors[i] = def_ctl_ctab_table[j].rgb; } } @@ -86,18 +85,18 @@ validate_colors_for_control (ControlHandle ctl) ColorSpec *c_ctab_entry; c_ctab_entry = &c_ctab_table[i]; - if (BigEndianValue (c_ctab_entry->value) >= n_ctl_colors) + if (CW (c_ctab_entry->value) >= n_ctl_colors) { /* don't make so much noise; our own default control color table will set off this warning */ #if 0 warning_unexpected ("control color table with index `%d' > %d or < 0; ignored", - BigEndianValue (c_ctab_entry->value), n_ctl_colors); + CW (c_ctab_entry->value), n_ctl_colors); #endif continue; } - ctl_ctab_colors[BigEndianValue (c_ctab_entry->value)] = c_ctab_entry->rgb; + ctl_ctab_colors[CW (c_ctab_entry->value)] = c_ctab_entry->rgb; } } @@ -192,7 +191,7 @@ drawlabel (StringPtr str, Rect *rp, justenum just) temp->bytec = i - temp->firstb; if (just == justmiddle) { - mid = (BigEndianValue(rp->left) + BigEndianValue(rp->right)) / 2; + mid = (CW(rp->left) + CW(rp->right)) / 2; for (i = 0; i < nlines; i++) infop[i].left = mid - TextWidth ((Ptr) str, infop[i].firstb, infop[i].bytec) / 2; @@ -200,11 +199,11 @@ drawlabel (StringPtr str, Rect *rp, justenum just) else { for (i = 0; i < nlines; i++) - infop[i].left = BigEndianValue(rp->left); + infop[i].left = CW(rp->left); } - incr = BigEndianValue(fi.ascent) + BigEndianValue(fi.descent) + BigEndianValue(fi.leading); - top = (BigEndianValue(rp->top) + BigEndianValue(rp->bottom)) / 2 - - (nlines * incr - BigEndianValue(fi.leading) + 1) / 2 + BigEndianValue(fi.ascent); + incr = CW(fi.ascent) + CW(fi.descent) + CW(fi.leading); + top = (CW(rp->top) + CW(rp->bottom)) / 2 - + (nlines * incr - CW(fi.leading) + 1) / 2 + CW(fi.ascent); for (i = 0; i < nlines; i++, top += incr) { MoveTo(infop[i].left, top); @@ -247,8 +246,8 @@ draw_push (ControlHandle c, int16 part) Rect r; r = CTL_RECT (c); - h = BigEndianValue (r.right) - BigEndianValue(r.left); - v = (BigEndianValue (r.bottom) - BigEndianValue (r.top)) / 2; + h = CW (r.right) - CW(r.left); + v = (CW (r.bottom) - CW (r.top)) / 2; if (h > v) h = v; save = PORT_CLIP_REGION_X (CTL_OWNER (c)); @@ -291,7 +290,7 @@ add_title (ControlHandle c) PORT_CLIP_REGION_X (control_owner) = RM (NewRgn ()); r = CTL_RECT (c); RectRgn (PORT_CLIP_REGION (control_owner), &r); - r.left = BigEndianValue (BigEndianValue (r.left) + 16); + r.left = CW (CW (r.left) + 16); drawlabel (CTL_TITLE (c), &r, justleft); DisposeRgn (PORT_CLIP_REGION (control_owner)); PORT_CLIP_REGION_X (control_owner) = save; @@ -305,14 +304,14 @@ draw_check (ControlHandle c, int16 part) if (!part) { r = CTL_RECT (c); - r.right = BigEndianValue (BigEndianValue (r.right) - 2); + r.right = CW (CW (r.right) - 2); EraseRect (&r); add_title (c); } - r.left = BigEndianValue (BigEndianValue (CTL_RECT (c).left) + 2); - r.top = BigEndianValue ((BigEndianValue (CTL_RECT (c).top) + BigEndianValue (CTL_RECT (c).bottom)) / 2 - 6); - r.bottom = BigEndianValue (BigEndianValue (r.top) + 12); - r.right = BigEndianValue (BigEndianValue (r.left) + 12); + r.left = CW (CW (CTL_RECT (c).left) + 2); + r.top = CW ((CW (CTL_RECT (c).top) + CW (CTL_RECT (c).bottom)) / 2 - 6); + r.bottom = CW (CW (r.top) + 12); + r.right = CW (CW (r.left) + 12); EraseRect (&r); RGBForeColor (¤t_control_colors[frame_color]); @@ -323,10 +322,10 @@ draw_check (ControlHandle c, int16 part) if (CTL_VALUE (c)) { PenSize (1, 1); - MoveTo (BigEndianValue (r.left) + 1, BigEndianValue (r.top) + 1); - LineTo (BigEndianValue (r.right) - 2, BigEndianValue (r.bottom) - 2); - MoveTo (BigEndianValue (r.right) - 2, BigEndianValue (r.top) + 1); - LineTo (BigEndianValue (r.left) + 1, BigEndianValue (r.bottom) - 2); + MoveTo (CW (r.left) + 1, CW (r.top) + 1); + LineTo (CW (r.right) - 2, CW (r.bottom) - 2); + MoveTo (CW (r.right) - 2, CW (r.top) + 1); + LineTo (CW (r.left) + 1, CW (r.bottom) - 2); } } @@ -338,14 +337,14 @@ draw_radio (ControlHandle c, int16 part) if (!part) { r = CTL_RECT (c); - r.right = BigEndianValue (BigEndianValue (r.right) - 2); + r.right = CW (CW (r.right) - 2); EraseRect (&r); add_title (c); } - r.left = BigEndianValue (BigEndianValue (CTL_RECT (c).left) + 2); - r.top = BigEndianValue ((BigEndianValue (CTL_RECT (c).top) + BigEndianValue (CTL_RECT (c).bottom)) / 2 - 6); - r.bottom = BigEndianValue (BigEndianValue (r.top) + 12); - r.right = BigEndianValue (BigEndianValue (r.left) + 12); + r.left = CW (CW (CTL_RECT (c).left) + 2); + r.top = CW ((CW (CTL_RECT (c).top) + CW (CTL_RECT (c).bottom)) / 2 - 6); + r.bottom = CW (CW (r.top) + 12); + r.right = CW (CW (r.left) + 12); EraseRect (&r); if (CTL_HILITE (c) == inCheckBox) diff --git a/src/dcmaketables.cpp b/src/dcmaketables.cpp index eeb20c83..399a4646 100644 --- a/src/dcmaketables.cpp +++ b/src/dcmaketables.cpp @@ -11,8 +11,6 @@ char ROMlib_rcsid_dcmaketables[] = #include "rsys/depthconv.h" #include "rsys/cquick.h" -using namespace ByteSwap; - namespace Executor { /* This file contains routines to construct lookup tables used for @@ -155,7 +153,7 @@ maketable_ ## bpp1 ## _ ## bpp2 (void *d, const uint32 *map) \ new1 |= (v & ((1UL << bpp2) - 1)) << l; \ if (l == 0) \ { \ - dst[0] = dst[3] = BigEndianValue (new1); \ + dst[0] = dst[3] = CW (new1); \ dst[1] = dst[2] = CWC (0); \ dst += 4; \ l = 16 - bpp2; \ @@ -451,7 +449,7 @@ depthconv_make_ind_to_rgb_table (void *table_space, unsigned in_bpp, * to counteract the byte swap that will happen later when * the raw table is built. */ - raw_map[i] = (out_bpp == 16) ? BigEndianValue (v) : BigEndianValue (v); + raw_map[i] = (out_bpp == 16) ? CW (v) : CL (v); } } diff --git a/src/desk.cpp b/src/desk.cpp index 13b85c76..89f49573 100644 --- a/src/desk.cpp +++ b/src/desk.cpp @@ -28,7 +28,6 @@ char ROMlib_rcsid_desk[] = #include "rsys/aboutbox.h" using namespace Executor; -using namespace ByteSwap; P1(PUBLIC pascal trap, INTEGER, OpenDeskAcc, Str255, acc) /* IMI-440 */ { @@ -44,7 +43,7 @@ P1(PUBLIC pascal trap, INTEGER, OpenDeskAcc, Str255, acc) /* IMI-440 */ } if (OpenDriver(acc, &retval) == noErr) { - retval = BigEndianValue(retval); + retval = CW(retval); dctlh = GetDCtlEntry(retval); if (dctlh) { @@ -76,8 +75,8 @@ P2(PUBLIC pascal trap, void, SystemClick, EventRecord *, evp, WindowPtr, wp) LONGINT templ; if (wp) { - p.h = BigEndianValue(evp->where.h); - p.v = BigEndianValue(evp->where.v); + p.h = CW(evp->where.h); + p.v = CW(evp->where.v); if (PtInRgn (p, WINDOW_STRUCT_REGION (wp))) { pointaslong = ((LONGINT)p.v << 16)|(unsigned short)p.h; @@ -92,10 +91,10 @@ P2(PUBLIC pascal trap, void, SystemClick, EventRecord *, evp, WindowPtr, wp) SelectWindow(wp); break; case wInDrag: - bounds.top = BigEndianValue (BigEndianValue (MBarHeight) + 4); - bounds.left = BigEndianValue (BigEndianValue (GD_BOUNDS (MR (TheGDevice)).left) + 4); - bounds.bottom = BigEndianValue (BigEndianValue (GD_BOUNDS (MR (TheGDevice)).bottom) - 4); - bounds.right = BigEndianValue (BigEndianValue (GD_BOUNDS (MR (TheGDevice)).right) - 4); + bounds.top = CW (CW (MBarHeight) + 4); + bounds.left = CW (CW (GD_BOUNDS (MR (TheGDevice)).left) + 4); + bounds.bottom = CW (CW (GD_BOUNDS (MR (TheGDevice)).bottom) - 4); + bounds.right = CW (CW (GD_BOUNDS (MR (TheGDevice)).right) - 4); DragWindow(wp, p, &bounds); break; case wInGoAway: @@ -108,7 +107,7 @@ P2(PUBLIC pascal trap, void, SystemClick, EventRecord *, evp, WindowPtr, wp) ROMlib_hook(desk_deskhooknumber); EM_D0 = -1; EM_A0 = (LONGINT) (long) US_TO_SYN68K(evp); - CALL_EMULATOR((syn68k_addr_t) (long) BigEndianValue((long) DeskHook)); + CALL_EMULATOR((syn68k_addr_t) (long) CL((long) DeskHook)); } } } @@ -136,12 +135,12 @@ P0(PUBLIC pascal trap, void, SystemTask) DCtlHandle dctlh; INTEGER i; - for (i = 0; i < BigEndianValue(UnitNtryCnt); ++i) { + for (i = 0; i < CW(UnitNtryCnt); ++i) { dctlh = MR(MR(UTableBase)[i].p); if ((HxX(dctlh, dCtlFlags) & CWC(NEEDTIMEBIT)) && TickCount() >= Hx(dctlh, dCtlCurTicks)) { Control(itorn(i), accRun, (Ptr) 0); - HxX(dctlh, dCtlCurTicks) = BigEndianValue(Hx(dctlh, dCtlCurTicks) + + HxX(dctlh, dCtlCurTicks) = CL(Hx(dctlh, dCtlCurTicks) + Hx(dctlh, dCtlDelay)); } } @@ -188,7 +187,7 @@ P1(PUBLIC pascal trap, BOOLEAN, SystemEvent, EventRecord *, evp) rn = WINDOW_KIND (wp); if ((retval = rn < 0)) { dctlh = rntodctlh(rn); - if (Hx(dctlh, dCtlEMask) & (1 << BigEndianValue(evp->what))) { + if (Hx(dctlh, dCtlEMask) & (1 << CW(evp->what))) { templ = (LONGINT) (long) RM(evp); Control(rn, accEvent, (Ptr) &templ); } @@ -206,10 +205,10 @@ P1(PUBLIC pascal trap, void, SystemMenu, LONGINT, menu) INTEGER i; DCtlHandle dctlh; - for (i = 0; i < BigEndianValue(UnitNtryCnt); ++i) { + for (i = 0; i < CW(UnitNtryCnt); ++i) { dctlh = MR(MR(UTableBase)[i].p); if (HxX(dctlh, dCtlMenu) == MBarEnable) { - menu = BigEndianValue(menu); + menu = CL(menu); Control(itorn(i), accMenu, (Ptr) &menu); /*-->*/ break; } diff --git a/src/device.cpp b/src/device.cpp index daf0de5c..81d722fb 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -24,7 +24,6 @@ char ROMlib_rcsid_device[] = #include "rsys/serial.h" using namespace Executor; -using namespace ByteSwap; /* * NOTE: The device manager now executes "native code" and code read @@ -46,7 +45,7 @@ A4(PUBLIC, OSErr, ROMlib_dispatch, ParmBlkPtr, p, /* INTERNAL */ typedef OSErr (*devfp_t)(ParmBlkPtr, DCtlPtr); devfp_t procp; - devicen = -BigEndianValue(p->cntrlParam.ioCRefNum) - 1; + devicen = -CW(p->cntrlParam.ioCRefNum) - 1; if (devicen < 0 || devicen >= NDEVICES) retval = badUnitErr; else if (UTableBase == (DCtlHandlePtr) (long) CLC(0xFFFFFFFF) || @@ -54,7 +53,7 @@ A4(PUBLIC, OSErr, ROMlib_dispatch, ParmBlkPtr, p, /* INTERNAL */ retval = unitEmptyErr; else { HLock((Handle) h); - p->ioParam.ioTrap = BigEndianValue(trapn); + p->ioParam.ioTrap = CW(trapn); if (async) p->ioParam.ioTrap |= CWC(asyncTrpBit); else @@ -158,7 +157,7 @@ A4(PUBLIC, OSErr, ROMlib_dispatch, ParmBlkPtr, p, /* INTERNAL */ } if (routine < Close) - retval = BigEndianValue(p->ioParam.ioResult); /* see II-193 */ + retval = CW(p->ioParam.ioResult); /* see II-193 */ } } fs_err_hook (retval); @@ -209,8 +208,8 @@ A3(PUBLIC, OSErr, Control, INTEGER, rn, INTEGER, code, OSErr err; pb.cntrlParam.ioVRefNum = 0; - pb.cntrlParam.ioCRefNum = BigEndianValue(rn); - pb.cntrlParam.csCode = BigEndianValue(code); + pb.cntrlParam.ioCRefNum = CW(rn); + pb.cntrlParam.csCode = CW(code); if (param) BlockMove(param, (Ptr) pb.cntrlParam.csParam, (Size) sizeof(pb.cntrlParam.csParam)); @@ -225,8 +224,8 @@ A3(PUBLIC, OSErr, Status, INTEGER, rn, INTEGER, code, Ptr, param) /* IMII-179 */ OSErr retval; pb.cntrlParam.ioVRefNum = 0; - pb.cntrlParam.ioCRefNum = BigEndianValue(rn); - pb.cntrlParam.csCode = BigEndianValue(code); + pb.cntrlParam.ioCRefNum = CW(rn); + pb.cntrlParam.csCode = CW(code); retval = PBStatus(&pb, FALSE); if (param) BlockMove((Ptr) pb.cntrlParam.csParam, param, @@ -240,7 +239,7 @@ A1(PUBLIC, OSErr, KillIO, INTEGER, rn) /* IMII-179 */ ParamBlockRec pb; OSErr err; - pb.cntrlParam.ioCRefNum = BigEndianValue(rn); + pb.cntrlParam.ioCRefNum = CW(rn); err = PBKillIO(&pb, FALSE); fs_err_hook (err); return err; @@ -267,16 +266,16 @@ PUBLIC driverinfo *ROMlib_otherdrivers = 0; /* for extensibility */ PRIVATE driverinfo knowndrivers[] = { #if defined (LINUX) || defined (MACOSX_) || defined (MSDOS) || defined (CYGWIN32) { (OSErr(*)())ROMlib_serialopen, (OSErr(*)())ROMlib_serialprime, (OSErr(*)())ROMlib_serialctl, - (OSErr(*)())ROMlib_serialstatus, (OSErr(*)())ROMlib_serialclose, (StringPtr) "\p.AIn", -6, }, + (OSErr(*)())ROMlib_serialstatus, (OSErr(*)())ROMlib_serialclose, (StringPtr) "\04.AIn", -6, }, { (OSErr(*)())ROMlib_serialopen, (OSErr(*)())ROMlib_serialprime, (OSErr(*)())ROMlib_serialctl, - (OSErr(*)())ROMlib_serialstatus, (OSErr(*)())ROMlib_serialclose, (StringPtr) "\p.AOut", -7, }, + (OSErr(*)())ROMlib_serialstatus, (OSErr(*)())ROMlib_serialclose, (StringPtr) "\05.AOut", -7, }, { (OSErr(*)())ROMlib_serialopen, (OSErr(*)())ROMlib_serialprime, (OSErr(*)())ROMlib_serialctl, - (OSErr(*)())ROMlib_serialstatus, (OSErr(*)())ROMlib_serialclose, (StringPtr) "\p.BIn", -8, }, + (OSErr(*)())ROMlib_serialstatus, (OSErr(*)())ROMlib_serialclose, (StringPtr) "\04.BIn", -8, }, { (OSErr(*)())ROMlib_serialopen, (OSErr(*)())ROMlib_serialprime, (OSErr(*)())ROMlib_serialctl, - (OSErr(*)())ROMlib_serialstatus, (OSErr(*)())ROMlib_serialclose, (StringPtr) "\p.BOut", -9, }, + (OSErr(*)())ROMlib_serialstatus, (OSErr(*)())ROMlib_serialclose, (StringPtr) "\05.BOut", -9, }, #endif }; @@ -291,103 +290,103 @@ A2(PUBLIC, OSErr, ROMlib_driveropen, ParmBlkPtr, pbp, /* INTERNAL */ ramdriverhand ramdh; ResType typ; BOOLEAN alreadyopen; - + ZONE_SAVE_EXCURSION - (SysZone, - { - err = noErr; + (SysZone, + { + err = noErr; - if ((ramdh = - (ramdriverhand) GetNamedResource(TICK("DRVR"), - MR(pbp->ioParam.ioNamePtr)))) { - LoadResource((Handle) ramdh); - GetResInfo((Handle) ramdh, &devicen, &typ, (StringPtr) 0); - BigEndianInPlace(devicen); - h = MR(MR(UTableBase)[devicen].p); - alreadyopen = h && (HxX(h, dCtlFlags) & CWC(DRIVEROPENBIT)); - if (!h && !(h = MR(MR(UTableBase)[devicen].p = - RM((DCtlHandle) NewHandle(sizeof(DCtlEntry)))))) - err = MemError(); - else if (!alreadyopen) { - memset((char *) STARH(h), 0, sizeof(DCtlEntry)); - HxX(h, dCtlDriver) = (umacdriverptr) RM(ramdh); - HxX(h, dCtlFlags) = HxX(ramdh, drvrFlags) | CWC(RAMBASEDBIT); - HxX(h, dCtlRefNum) = BigEndianValue(- (devicen + 1)); - HxX(h, dCtlDelay) = HxX(ramdh, drvrDelay); - HxX(h, dCtlEMask) = HxX(ramdh, drvrEMask); - HxX(h, dCtlMenu) = HxX(ramdh, drvrMenu); - if (HxX(h, dCtlFlags) & CWC(NEEDTIMEBIT)) - HxX(h, dCtlCurTicks) = BigEndianValue(TickCount() + Hx(h, dCtlDelay)); - else - HxX(h, dCtlCurTicks) = CLC(0x7FFFFFFF); - /* - * NOTE: this code doesn't check to see if something is already open. - * TODO: fix this - */ - pbp->cntrlParam.ioCRefNum = HxX(h, dCtlRefNum); - err = ROMlib_dispatch(pbp, a, Open, 0); - } else - { - pbp->cntrlParam.ioCRefNum = HxX(h, dCtlRefNum); - err = noErr; - } - } else { - - dip = 0; - if (ROMlib_otherdrivers) { - for (dip = ROMlib_otherdrivers; dip->open && - !EqualString(dip->name, MR(pbp->ioParam.ioNamePtr), FALSE, TRUE); - dip++) - ; - if (!dip->open) - dip = 0; - } - if (!dip) { - for (dip = knowndrivers, edip = dip + NELEM(knowndrivers); - dip != edip && - !EqualString(dip->name, MR(pbp->ioParam.ioNamePtr), FALSE, TRUE); - dip++) - ; - if (dip == edip) - dip = 0; - } - if (dip) { - devicen = -dip->refnum -1; - if (devicen < 0 || devicen >= NDEVICES) - err = badUnitErr; - else if (MR(UTableBase)[devicen].p) - err = noErr; /* note: if we choose to support desk */ - /* accessories, we will have to */ - /* check to see if this is one and */ - /* call the open routine if it is */ - else { - if (!(h = MR(MR(UTableBase)[devicen].p = - RM((DCtlHandle) NewHandle(sizeof(DCtlEntry)))))) - err = MemError(); - else { - memset((char *) STARH(h), 0, sizeof(DCtlEntry)); - up = (umacdriverptr) NewPtr(sizeof(umacdriver)); - if (!(HxX(h, dCtlDriver) = RM(up))) - err = MemError(); - else { - up->udrvrOpen = (ProcPtr) RM(dip->open); - up->udrvrPrime = (ProcPtr) RM(dip->prime); - up->udrvrCtl = (ProcPtr) RM(dip->ctl); - up->udrvrStatus = (ProcPtr) RM(dip->status); - up->udrvrClose = (ProcPtr) RM(dip->close); - str255assign(up->udrvrName, dip->name); - err = noErr; - } - } - } - if (err == noErr) { - pbp->cntrlParam.ioCRefNum = BigEndianValue(dip->refnum); - err = ROMlib_dispatch(pbp, a, Open, 0); - } - } else - err = dInstErr; - } - }); + if ((ramdh = + (ramdriverhand) GetNamedResource(TICK("DRVR"), + MR(pbp->ioParam.ioNamePtr)))) { + LoadResource((Handle) ramdh); + GetResInfo((Handle) ramdh, &devicen, &typ, (StringPtr) 0); + devicen = CW(devicen); + h = MR(MR(UTableBase)[devicen].p); + alreadyopen = h && (HxX(h, dCtlFlags) & CWC(DRIVEROPENBIT)); + if (!h && !(h = MR(MR(UTableBase)[devicen].p = + RM((DCtlHandle) NewHandle(sizeof(DCtlEntry)))))) + err = MemError(); + else if (!alreadyopen) { + memset((char *) STARH(h), 0, sizeof(DCtlEntry)); + HxX(h, dCtlDriver) = (umacdriverptr) RM(ramdh); + HxX(h, dCtlFlags) = HxX(ramdh, drvrFlags) | CWC(RAMBASEDBIT); + HxX(h, dCtlRefNum) = CW(- (devicen + 1)); + HxX(h, dCtlDelay) = HxX(ramdh, drvrDelay); + HxX(h, dCtlEMask) = HxX(ramdh, drvrEMask); + HxX(h, dCtlMenu) = HxX(ramdh, drvrMenu); + if (HxX(h, dCtlFlags) & CWC(NEEDTIMEBIT)) + HxX(h, dCtlCurTicks) = CL(TickCount() + Hx(h, dCtlDelay)); + else + HxX(h, dCtlCurTicks) = CLC(0x7FFFFFFF); + /* + * NOTE: this code doesn't check to see if something is already open. + * TODO: fix this + */ + pbp->cntrlParam.ioCRefNum = HxX(h, dCtlRefNum); + err = ROMlib_dispatch(pbp, a, Open, 0); + } else + { + pbp->cntrlParam.ioCRefNum = HxX(h, dCtlRefNum); + err = noErr; + } + } else { + + dip = 0; + if (ROMlib_otherdrivers) { + for (dip = ROMlib_otherdrivers; dip->open && + !EqualString(dip->name, MR(pbp->ioParam.ioNamePtr), FALSE, TRUE); + dip++) + ; + if (!dip->open) + dip = 0; + } + if (!dip) { + for (dip = knowndrivers, edip = dip + NELEM(knowndrivers); + dip != edip && + !EqualString(dip->name, MR(pbp->ioParam.ioNamePtr), FALSE, TRUE); + dip++) + ; + if (dip == edip) + dip = 0; + } + if (dip) { + devicen = -dip->refnum -1; + if (devicen < 0 || devicen >= NDEVICES) + err = badUnitErr; + else if (MR(UTableBase)[devicen].p) + err = noErr; /* note: if we choose to support desk */ + /* accessories, we will have to */ + /* check to see if this is one and */ + /* call the open routine if it is */ + else { + if (!(h = MR(MR(UTableBase)[devicen].p = + RM((DCtlHandle) NewHandle(sizeof(DCtlEntry)))))) + err = MemError(); + else { + memset((char *) STARH(h), 0, sizeof(DCtlEntry)); + up = (umacdriverptr) NewPtr(sizeof(umacdriver)); + if (!(HxX(h, dCtlDriver) = RM(up))) + err = MemError(); + else { + up->udrvrOpen = (ProcPtr) RM(dip->open); + up->udrvrPrime = (ProcPtr) RM(dip->prime); + up->udrvrCtl = (ProcPtr) RM(dip->ctl); + up->udrvrStatus = (ProcPtr) RM(dip->status); + up->udrvrClose = (ProcPtr) RM(dip->close); + str255assign(up->udrvrName, dip->name); + err = noErr; + } + } + } + if (err == noErr) { + pbp->cntrlParam.ioCRefNum = CW(dip->refnum); + err = ROMlib_dispatch(pbp, a, Open, 0); + } + } else + err = dInstErr; + } + }); fs_err_hook (err); return err; } @@ -411,8 +410,9 @@ A1(PUBLIC, OSErr, CloseDriver, INTEGER, rn) /* IMII-178 */ ParamBlockRec pb; OSErr err; - pb.cntrlParam.ioCRefNum = BigEndianValue(rn); + pb.cntrlParam.ioCRefNum = CW(rn); err = PBClose(&pb, FALSE); fs_err_hook (err); return err; } + diff --git a/src/dialAlert.cpp b/src/dialAlert.cpp index 91d41aba..5677309c 100644 --- a/src/dialAlert.cpp +++ b/src/dialAlert.cpp @@ -25,7 +25,6 @@ char ROMlib_rcsid_dialAlert[] = #include "rsys/dial.h" using namespace Executor; -using namespace ByteSwap; int16 alert_extra_icon_id = -32768; @@ -53,7 +52,7 @@ P2 (PUBLIC pascal trap, INTEGER, Alert, INTEGER, id, /* IMI-418 */ if (id != Cx(ANumber)) { - ANumber = BigEndianValue(id); + ANumber = CW(id); ACount = 0; } ah = (alth) GetResource(TICK("ALRT"), id); @@ -64,9 +63,9 @@ P2 (PUBLIC pascal trap, INTEGER, Alert, INTEGER, id, /* IMI-418 */ } LoadResource((Handle) ah); - n = (Hx(ah, altstag) >> (4 * BigEndianValue(ACount))) & 0xF; - ACount = BigEndianValue(BigEndianValue(ACount) + 1); - if (BigEndianValue(ACount) > 3) + n = (Hx(ah, altstag) >> (4 * CW(ACount))) & 0xF; + ACount = CW(CW(ACount) + 1); + if (CW(ACount) > 3) ACount = CWC(3); BEEP(n & 3); if (! (n & 4)) @@ -139,7 +138,7 @@ P2 (PUBLIC pascal trap, INTEGER, Alert, INTEGER, id, /* IMI-418 */ Handle icon_item_h; icon_item_h = NewHandle (sizeof icon_item_template); - icon_item_template.res_id = BigEndianValue (alert_extra_icon_id); + icon_item_template.res_id = CW (alert_extra_icon_id); memcpy (STARH (icon_item_h), &icon_item_template, sizeof icon_item_template); @@ -169,13 +168,13 @@ P2 (PUBLIC pascal trap, INTEGER, Alert, INTEGER, id, /* IMI-418 */ else FrameRect(&r); } - dp->aDefItem = BigEndianValue(defbut); + dp->aDefItem = CW(defbut); ModalDialog (fp, &hit); }); HSetState (DIALOG_ITEMS (dp), flags); DisposDialog ((DialogPtr) dp); }); - return BigEndianValue (hit); + return CW (hit); } P2 (PUBLIC pascal trap, INTEGER, StopAlert, INTEGER, id, /* IMI-419 */ @@ -229,18 +228,18 @@ A2(PRIVATE, void, lockditl, INTEGER, id, BOOLEAN, flag) itmp ip; if((ih = lockres(TICK("DITL"), id, flag))) { - nitem = BigEndianValue(*MR(*(INTEGER **)ih)); + nitem = CW(*MR(*(INTEGER **)ih)); ip = (itmp)((INTEGER *) STARH(ih) + 1); while (nitem-- >= 0) { if ((CB(ip->itmtype) & RESCTL) == RESCTL) { - h = lockres(TICK("CNTL"), BigEndianValue(*(INTEGER *)(&(ip->itmlen)+1)), + h = lockres(TICK("CNTL"), CW(*(INTEGER *)(&(ip->itmlen)+1)), flag); - procid = BigEndianValue(*MR(*(INTEGER **)h)) + 8; + procid = CW(*MR(*(INTEGER **)h)) + 8; lockres(TICK("CDEF"), procid >> 4, flag); } else if (CB(ip->itmtype) & iconItem) - lockres(TICK("ICON"), BigEndianValue(*(INTEGER *)(&(ip->itmlen)+1)), flag); + lockres(TICK("ICON"), CW(*(INTEGER *)(&(ip->itmlen)+1)), flag); else if (CB(ip->itmtype) & picItem) - lockres(TICK("PICT"), BigEndianValue(*(INTEGER *)(&(ip->itmlen)+1)), flag); + lockres(TICK("PICT"), CW(*(INTEGER *)(&(ip->itmlen)+1)), flag); BUMPIP(ip); } } diff --git a/src/dialCreate.cpp b/src/dialCreate.cpp index b8887e42..baae3fa4 100644 --- a/src/dialCreate.cpp +++ b/src/dialCreate.cpp @@ -31,7 +31,6 @@ char ROMlib_rcsid_dialCreate[] = #include "rsys/host.h" using namespace Executor; -using namespace ByteSwap; #define _PtrToHand(ptr, hand, len) \ ((void) \ @@ -59,7 +58,7 @@ Executor::dialog_create_item (DialogPeek dp, itmp dst, itmp src, /* many items have a resource id at the beginning of the resource data */ - res_id = BigEndianValue (*data); + res_id = CW (*data); if (CB (dst->itmtype) & ctrlItem) { @@ -68,11 +67,11 @@ Executor::dialog_create_item (DialogPeek dp, itmp dst, itmp src, ControlHandle ctl; r = dst->itmr; - if (BigEndianValue (r.left) > 8192) + if (CW (r.left) > 8192) { visible_p = FALSE; - r.left = BigEndianValue (BigEndianValue (r.left) - 16384); - r.right = BigEndianValue (BigEndianValue (r.right) - 16384); + r.left = CW (CW (r.left) - 16384); + r.right = CW (CW (r.right) - 16384); } if ((CB (dst->itmtype) & resCtrl) == resCtrl) @@ -88,7 +87,7 @@ Executor::dialog_create_item (DialogPeek dp, itmp dst, itmp src, top = ctl_rect->top; left = ctl_rect->left; if (r.top != top || r.left != left) - MoveControl (ctl, BigEndianValue (r.left), BigEndianValue (r.top)); + MoveControl (ctl, CW (r.left), CW (r.top)); } } else @@ -127,8 +126,8 @@ Executor::dialog_create_item (DialogPeek dp, itmp dst, itmp src, CCTabHandle color_table; - color_table_bytes = BigEndianValue (ctl_color_info->data); - color_table_offset = BigEndianValue (ctl_color_info->offset); + color_table_bytes = CW (ctl_color_info->data); + color_table_offset = CW (ctl_color_info->offset); color_table_base = ((char *) item_color_info + color_table_offset); @@ -234,10 +233,10 @@ ROMlib_new_dialog_common (DialogPtr dp, { Rect newr; - TextFont (BigEndianValue (DlgFont)); + TextFont (CW (DlgFont)); newr.top = newr.left = CWC (0); - newr.bottom = BigEndianValue (BigEndianValue (bounds->bottom) - BigEndianValue (bounds->top)); - newr.right = BigEndianValue (BigEndianValue (bounds->right) - BigEndianValue (bounds->left)); + newr.bottom = CW (CW (bounds->bottom) - CW (bounds->top)); + newr.right = CW (CW (bounds->right) - CW (bounds->left)); InvalRect (&newr); WINDOW_KIND_X (dp) = CWC (dialogKind); @@ -280,7 +279,7 @@ ROMlib_new_dialog_common (DialogPtr dp, ip = (INTEGER *) STARH (items); itp = (itmp) (ip + 1); - i = BigEndianValue (*ip); + i = CW (*ip); item_no = 1; while (i-- >= 0) { @@ -358,9 +357,9 @@ Executor::dialog_compute_rect (Rect *dialog_rect, Rect *dst_rect, parent_rect = &PORT_RECT (parent); - top = BigEndianValue (parent_rect->top) + 16; - left = ( ( BigEndianValue (parent_rect->left) - + BigEndianValue (parent_rect->right)) / 2 + top = CW (parent_rect->top) + 16; + left = ( ( CW (parent_rect->left) + + CW (parent_rect->right)) / 2 + dialog_width / 2); SetRect (dst_rect, @@ -449,7 +448,7 @@ P1(PUBLIC pascal trap, void, CloseDialog, DialogPtr, dp) /* IMI-413 */ { /* #### should `items' be locked? */ ip = (INTEGER *) STARH (items); - i = BigEndianValue(*ip); + i = CW(*ip); itp = (itmp)(ip + 1); while (i-- >= 0) { diff --git a/src/dialDispatch.cpp b/src/dialDispatch.cpp index 98bdd1df..5a42dc98 100644 --- a/src/dialDispatch.cpp +++ b/src/dialDispatch.cpp @@ -14,13 +14,12 @@ char ROMlib_rcsid_dialDispatch[] = #include "DialogMgr.h" using namespace Executor; -using namespace ByteSwap; /* traps from the DialogDispatch trap */ P1 (PUBLIC pascal trap, OSErr, GetStdFilterProc, ProcPtr *, proc) { - *proc = (ProcPtr)RM (&P_ROMlib_myfilt); + *proc = (ProcPtr) RM (P_ROMlib_myfilt); warning_unimplemented ("no specs"); /* i.e. no documentation on how this routine is *supposed* to work, so we may be blowing off something @@ -35,7 +34,7 @@ P2 (PUBLIC pascal trap, OSErr, SetDialogDefaultItem, DialogPtr, dialog, dp = (DialogPeek) dialog; - dp->aDefItem = BigEndianValue (new_item); + dp->aDefItem = CW (new_item); warning_unimplemented ("no specs"); return noErr; } diff --git a/src/dialHandle.cpp b/src/dialHandle.cpp index 399fae32..1627488b 100644 --- a/src/dialHandle.cpp +++ b/src/dialHandle.cpp @@ -38,7 +38,6 @@ char ROMlib_rcsid_dialHandle[] = #include "rsys/osevent.h" using namespace Executor; -using namespace ByteSwap; P3(PUBLIC pascal, BOOLEAN, ROMlib_myfilt, DialogPeek, dp, EventRecord *, evt, INTEGER *, ith) /* IMI-415 */ @@ -51,7 +50,7 @@ P3(PUBLIC pascal, BOOLEAN, ROMlib_myfilt, DialogPeek, dp, EventRecord *, evt, if (Cx(evt->what) == keyDown && ((Cx(evt->message) & 0xFF) == '\r' || (Cx(evt->message) & 0xFF) == NUMPAD_ENTER)) { - ip = ROMlib_dpnotoip(dp, BigEndianValue(*ith = dp->aDefItem), &flags); + ip = ROMlib_dpnotoip(dp, CW(*ith = dp->aDefItem), &flags); if (ip && (CB(ip->itmtype) & ctrlItem)) { c = (ControlHandle) MR(ip->itmhand); if (Hx(c, contrlVis) && U(Hx(c, contrlHilite)) != INACTIVE) { @@ -97,7 +96,7 @@ ROMlib_CALLMODALPROC (DialogPtr dp, { ROMlib_hook(dial_modalnumber); HOOKSAVEREGS(); - retval = CToPascalCall(&fp, CTOP_ROMlib_myfilt, dp, evtp, ip); + retval = CToPascalCall((void*)fp, CTOP_ROMlib_myfilt, dp, evtp, ip); HOOKRESTOREREGS(); } return retval; @@ -121,7 +120,7 @@ ROMlib_CALLUSERITEM (DialogPtr dp, else { ROMlib_hook(dial_usernumber); - CToPascalCall(&temph, CTOP_ROMlib_filebox, dp, inum); + CToPascalCall((void*)temph, CTOP_ROMlib_filebox, dp, inum); } } @@ -169,7 +168,7 @@ P2 (PUBLIC pascal trap, void, ModalDialog, ProcPtr, fp, /* IMI-415 */ dp = (DialogPeek) FrontWindow (); if (dp->window.windowKind != CWC (dialogKind) && - BigEndianValue (dp->window.windowKind) >= 0) + CW (dp->window.windowKind) >= 0) *item = CWC (-1); else { @@ -187,10 +186,10 @@ P2 (PUBLIC pascal trap, void, ModalDialog, ProcPtr, fp, /* IMI-415 */ if (idle) TEIdle (idle); GetNextEvent (DIALOGEVTS, &evt); - whereunswapped.h = BigEndianValue (evt.where.h); - whereunswapped.v = BigEndianValue (evt.where.v); + whereunswapped.h = CW (evt.where.h); + whereunswapped.v = CW (evt.where.v); - mousedown_p = (BigEndianValue (evt.what) == mouseDown); + mousedown_p = (CW (evt.what) == mouseDown); /* dummy initializations to keep gcc happy */ temp_wp = NULL; @@ -247,7 +246,7 @@ P2 (PUBLIC pascal trap, void, ModalDialog, ProcPtr, fp, /* IMI-415 */ dp = (DialogPeek) FrontWindow (); if (dp->window.windowKind != CWC (dialogKind) && - BigEndianValue (dp->window.windowKind) >= 0) + CW (dp->window.windowKind) >= 0) *item = CWC (-1); else { @@ -265,10 +264,10 @@ P2 (PUBLIC pascal trap, void, ModalDialog, ProcPtr, fp, /* IMI-415 */ if (idle) TEIdle (idle); GetNextEvent (DIALOGEVTS, &evt); - whereunswapped.h = BigEndianValue (evt.where.h); - whereunswapped.v = BigEndianValue (evt.where.v); + whereunswapped.h = CW (evt.where.h); + whereunswapped.v = CW (evt.where.v); - mousedown_p = (BigEndianValue (evt.what) == mouseDown); + mousedown_p = (CW (evt.what) == mouseDown); /* dummy initializations to keep gcc happy */ temp_wp = NULL; @@ -315,8 +314,8 @@ P1(PUBLIC pascal trap, BOOLEAN, IsDialogEvent, /* IMI-416 */ if (dp && dp->window.windowKind == CWC(dialogKind)) { if (dp->editField != -1) TEIdle(MR(dp->textH)); - p.h = BigEndianValue(evt->where.h); - p.v = BigEndianValue(evt->where.v); + p.h = CW(evt->where.h); + p.v = CW(evt->where.v); /*-->*/ return evt->what != CWC(mouseDown) || (FindWindow(p, &wp) == inContent && MR(wp.p) == (WindowPtr) dp); } @@ -344,8 +343,8 @@ Executor::get_item_style_info (DialogPtr dp, int item_no, uint16 flags; int style_info_offset; - flags = BigEndianValue (item_color_info->data); - style_info_offset = BigEndianValue (item_color_info->offset); + flags = CW (item_color_info->data); + style_info_offset = CW (item_color_info->offset); *style_info = *(item_style_info_t *) ((char *) items_color_info + style_info_offset); @@ -353,7 +352,7 @@ Executor::get_item_style_info (DialogPtr dp, int item_no, { char *font_name; - font_name = (char *) items_color_info + BigEndianValue (style_info->font); + font_name = (char *) items_color_info + CW (style_info->font); GetFNum ((StringPtr) font_name, &style_info->font); } @@ -379,11 +378,11 @@ Executor::ROMlib_drawiptext (DialogPtr dp, itmp ip, int item_no) restore_draw_state_p = TRUE; if (flags & TEdoFont) - TextFont (BigEndianValue (style_info.font)); + TextFont (CW (style_info.font)); if (flags & TEdoFace) TextFace (CB (style_info.face)); if (flags & TEdoSize) - TextSize (BigEndianValue (style_info.size)); + TextSize (CW (style_info.size)); if (flags & TEdoColor) RGBForeColor (&style_info.foreground); #if 1 @@ -589,8 +588,8 @@ P3 (PUBLIC pascal trap, BOOLEAN, DialogSelect, /* IMI-417 */ gp = thePort; SetPort((GrafPtr) dp); GlobalToLocal(&localp); - localp.h = BigEndianValue(localp.h); - localp.v = BigEndianValue(localp.v); + localp.h = CW(localp.h); + localp.v = CW(localp.v); SetPort(gp); intp = (INTEGER *) STARH(MR(dp->items)); iend = Cx(*intp) + 2; @@ -621,7 +620,7 @@ P3 (PUBLIC pascal trap, BOOLEAN, DialogSelect, /* IMI-417 */ } if (itemenabled) { - *itemp = BigEndianValue(i); + *itemp = CW(i); retval = TRUE; break; } @@ -641,14 +640,14 @@ P3 (PUBLIC pascal trap, BOOLEAN, DialogSelect, /* IMI-417 */ default: TEKey (c, DIALOG_TEXTH (dp)); } - *itemp = BigEndianValue(BigEndianValue(dp->editField)+1); - ip = ROMlib_dpnotoip(dp, BigEndianValue(*itemp), &flags); + *itemp = CW(CW(dp->editField)+1); + ip = ROMlib_dpnotoip(dp, CW(*itemp), &flags); if (ip) retval = !(CB(ip->itmtype) & itemDisable); else { warning_unexpected ("couldn't resolve editField -- dp = %p, " - "BigEndianValue (*itemp) = %d", dp, BigEndianValue (*itemp)); + "CW (*itemp) = %d", dp, CW (*itemp)); retval = FALSE; } HSetState(MR(((DialogPeek) dp)->items), flags); diff --git a/src/dialInit.cpp b/src/dialInit.cpp index 9a01d1a3..050a70db 100644 --- a/src/dialInit.cpp +++ b/src/dialInit.cpp @@ -20,7 +20,6 @@ char ROMlib_rcsid_dialInit[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; P1(PUBLIC, pascal void, ROMlib_mysound, INTEGER, i) { @@ -43,24 +42,18 @@ P1 (PUBLIC pascal trap, void, InitDialogs, ProcPtr, rp) /* IMI-411 */ DlgFont = CWC (systemFont); ResumeProc = RM (rp); ErrorSound ((ProcPtr) P_ROMlib_mysound); - - PtrToHand (nothing, &DAStrings_H[0], (LONGINT) 1); - HIDDEN_Ptr *afg = DAStrings_H[0].p; - DAStrings_H[0].p = RM (afg); + DAStrings_H[0].p = RM (DAStrings_H[0].p); PtrToHand (nothing, &DAStrings_H[1], (LONGINT) 1); - afg = DAStrings_H[1].p; - DAStrings_H[1].p = RM (afg); + DAStrings_H[1].p = RM (DAStrings_H[1].p); PtrToHand (nothing, &DAStrings_H[2], (LONGINT) 1); - afg = DAStrings_H[2].p; - DAStrings_H[2].p = RM (afg); + DAStrings_H[2].p = RM (DAStrings_H[2].p); PtrToHand (nothing, &DAStrings_H[3], (LONGINT) 1); - afg = DAStrings_H[2].p; - DAStrings_H[3].p = RM (afg); + DAStrings_H[3].p = RM (DAStrings_H[3].p); }); } A1(PUBLIC, void, SetDAFont, INTEGER, i) /* IMI-412 */ { - DlgFont = BigEndianValue(i); + DlgFont = CW(i); } diff --git a/src/dialItem.cpp b/src/dialItem.cpp index 40062f4d..22aa0fd9 100644 --- a/src/dialItem.cpp +++ b/src/dialItem.cpp @@ -18,7 +18,6 @@ char ROMlib_rcsid_dialItem[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; #define _GetDItem(dp, item_no, item_type, item_h, item_rect) \ ({ \ @@ -54,8 +53,8 @@ Executor::AppendDITL (DialogPtr dp, Handle new_items_h, DITLMethod method) _GetDItem (dp, method, &item_type, &item_h, &item_rect); resize_p = FALSE; - base_pt.v = BigEndianValue (item_rect.top); - base_pt.h = BigEndianValue (item_rect.left); + base_pt.v = CW (item_rect.top); + base_pt.h = CW (item_rect.left); } else { @@ -70,12 +69,12 @@ Executor::AppendDITL (DialogPtr dp, Handle new_items_h, DITLMethod method) case appendDITLRight: resize_p = TRUE; base_pt.v = 0; - base_pt.h = BigEndianValue (dp_port_rect->right); + base_pt.h = CW (dp_port_rect->right); break; case appendDITLBottom: resize_p = TRUE; - base_pt.v = BigEndianValue (dp_port_rect->bottom); + base_pt.v = CW (dp_port_rect->bottom); base_pt.h = 0; break; } @@ -93,7 +92,7 @@ Executor::AppendDITL (DialogPtr dp, Handle new_items_h, DITLMethod method) int i; base_itemp = (char *) STARH (items_h); - item_count = BigEndianValue (*(int16 *) base_itemp) + 1; + item_count = CW (*(int16 *) base_itemp) + 1; itemp = (itmp) ((int16 *) STARH (items_h) + 1); for (i = 0; i < item_count; i ++) @@ -126,14 +125,14 @@ Executor::AppendDITL (DialogPtr dp, Handle new_items_h, DITLMethod method) int i; base_itemp = (char *) STARH (items_h); - item_count = BigEndianValue (*(int16 *) base_itemp) + 1; + item_count = CW (*(int16 *) base_itemp) + 1; base_new_itemp = (char *) STARH (new_items_h); new_itemp = (itmp) ((int16 *) STARH (new_items_h) + 1); - new_item_count = BigEndianValue (*(int16 *) base_new_itemp) + 1; + new_item_count = CW (*(int16 *) base_new_itemp) + 1; /* update the count for the new items */ - *(int16 *) base_itemp = BigEndianValue (item_count + new_item_count - 1); + *(int16 *) base_itemp = CW (item_count + new_item_count - 1); THEPORT_SAVE_EXCURSION (dp, @@ -152,8 +151,8 @@ Executor::AppendDITL (DialogPtr dp, Handle new_items_h, DITLMethod method) InvalRect (&itemp->itmr); - width = MAX (width, BigEndianValue (itemp->itmr.left)); - height = MAX (height, BigEndianValue (itemp->itmr.bottom)); + width = MAX (width, CW (itemp->itmr.left)); + height = MAX (height, CW (itemp->itmr.bottom)); BUMPIP (new_itemp); } @@ -187,7 +186,7 @@ Executor::ShortenDITL (DialogPtr dp, int16 n_items) { base_itemp = (char *) STARH (item_h); itemp = (itmp) ((int16 *) STARH (item_h) + 1); - count = BigEndianValue (*(int16 *) base_itemp) + 1; + count = CW (*(int16 *) base_itemp) + 1; if (count < n_items) n_items = count; @@ -262,7 +261,7 @@ Executor::ShortenDITL (DialogPtr dp, int16 n_items) } } } - *(int16 *) base_itemp = BigEndianValue (first_item_to_dispose - 1); + *(int16 *) base_itemp = CW (first_item_to_dispose - 1); }); SetHandleSize ((Handle) item_h, item_h_size); @@ -275,7 +274,7 @@ Executor::CountDITL (DialogPtr dp) int16 count; items = DIALOG_ITEMS (dp); - count = BigEndianValue (*(int16 *) STARH (items)) + 1; + count = CW (*(int16 *) STARH (items)) + 1; return count; } diff --git a/src/dialManip.cpp b/src/dialManip.cpp index 95ec32dd..4f0d790f 100644 --- a/src/dialManip.cpp +++ b/src/dialManip.cpp @@ -23,7 +23,6 @@ char ROMlib_rcsid_dialManip[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; namespace Executor { PRIVATE itmp htoip(Handle h, @@ -34,22 +33,14 @@ namespace Executor { P4(PUBLIC pascal trap, void, ParamText, StringPtr, p0, /* IMI-421 */ StringPtr, p1, StringPtr, p2, StringPtr, p3) { - if (p0) { - Handle aType = (DAStrings_H[0].p); - PtrToXHand((Ptr) p0, aType, (LONGINT)U(p0[0])+1); - } - if (p1) { - Handle aType = (DAStrings_H[1].p); - PtrToXHand((Ptr) p1, aType, (LONGINT)U(p1[0])+1); - } - if (p2){ - Handle aType = (DAStrings_H[2].p); - PtrToXHand((Ptr) p2, aType, (LONGINT)U(p2[0])+1); - } - if (p3) { - Handle aType = (DAStrings_H[3].p); - PtrToXHand((Ptr) p3, aType, (LONGINT)U(p3[0])+1); - } + if (p0) + PtrToXHand((Ptr) p0, MR(DAStrings_H[0].p), (LONGINT)U(p0[0])+1); + if (p1) + PtrToXHand((Ptr) p1, MR(DAStrings_H[1].p), (LONGINT)U(p1[0])+1); + if (p2) + PtrToXHand((Ptr) p2, MR(DAStrings_H[2].p), (LONGINT)U(p2[0])+1); + if (p3) + PtrToXHand((Ptr) p3, MR(DAStrings_H[3].p), (LONGINT)U(p3[0])+1); } A3 (PUBLIC, itmp, ROMlib_dpnotoip, DialogPeek, dp, /* INTERNAL */ @@ -62,7 +53,7 @@ A3 (PUBLIC, itmp, ROMlib_dpnotoip, DialogPeek, dp, /* INTERNAL */ items = DIALOG_ITEMS (dp); *flags = hlock_return_orig_state (items); intp = (INTEGER *) STARH (items); - if (itemno <= 0 || itemno > BigEndianValue (*intp) + 1) + if (itemno <= 0 || itemno > CW (*intp) + 1) retval = 0; else { @@ -94,7 +85,7 @@ A4 (PRIVATE, itmp, htoip, Handle, h, ip = (int16 *) STARH (items); retval = (itmp) (ip + 1); - for (i = BigEndianValue (*ip) + 1, nop = 1; i --; BUMPIP (retval)) + for (i = CW (*ip) + 1, nop = 1; i --; BUMPIP (retval)) { if (MR (retval->itmhand) == h) { @@ -120,14 +111,14 @@ P5(PUBLIC pascal trap, void, GetDItem, DialogPtr, dp, /* IMI-421 */ if (ip) { if (itype) - *itype = BigEndianValue((INTEGER) ip->itmtype); + *itype = CW((INTEGER) ip->itmtype); else { /* test on Mac shows unconditional write of *itype */ /* of course this is very rude, but that's what the Mac did when we tested it. Perhaps they've fixed that now and we too should fix it. ARGH! */ - *(INTEGER *) (US_TO_SYN68K(itype)) = BigEndianValue((INTEGER) ip->itmtype); + *(INTEGER *) (US_TO_SYN68K(itype)) = CW((INTEGER) ip->itmtype); } if (item) /* We didn't test what happens when item is 0 on Mac */ (*item).p = ip->itmhand; @@ -160,7 +151,7 @@ settexth (DialogPeek dp, itmp ip, int item_no) item_text_h = ITEM_H (ip); length = GetHandleSize (item_text_h); - TEP_LENGTH_X (tep) = BigEndianValue (length); + TEP_LENGTH_X (tep) = CW (length); /* this is not a leak, always a duplicate */ TEP_HTEXT_X (tep) = RM (item_text_h); @@ -182,11 +173,11 @@ settexth (DialogPeek dp, itmp ip, int item_no) if (get_item_style_info ((DialogPtr) dp, item_no, &flags, &style_info)) { if (flags & TEdoFont) - te_style_font = BigEndianValue (style_info.font); + te_style_font = CW (style_info.font); if (flags & TEdoFace) te_style_face = CB (style_info.face); if (flags & TEdoSize) - te_style_size = BigEndianValue (style_info.size); + te_style_size = CW (style_info.size); if (flags & TEdoColor) te_style_color = style_info.foreground; @@ -218,7 +209,7 @@ settexth (DialogPeek dp, itmp ip, int item_no) TE_STYLE_SIZE_FOR_N_RUNS (1)); HxX (te_style, runs[0].startChar) = CWC (0); HxX (te_style, runs[0].styleIndex) = CWC (0); - HxX (te_style, runs[1].startChar) = BigEndianValue (length + 1); + HxX (te_style, runs[1].startChar) = CW (length + 1); HxX (te_style, runs[1].styleIndex) = CWC (-1); style_table = TE_STYLE_STYLE_TABLE (te_style); SetHandleSize ((Handle) style_table, @@ -228,8 +219,8 @@ settexth (DialogPeek dp, itmp ip, int item_no) tx_size_save_x = PORT_TX_SIZE_X (current_port); tx_face_save = PORT_TX_FACE (current_port); - PORT_TX_FONT_X (current_port) = BigEndianValue (te_style_font); - PORT_TX_SIZE_X (current_port) = BigEndianValue (te_style_size); + PORT_TX_FONT_X (current_port) = CW (te_style_font); + PORT_TX_SIZE_X (current_port) = CW (te_style_size); PORT_TX_FACE (current_port) = CB (te_style_face); GetFontInfo (&finfo); @@ -241,19 +232,19 @@ settexth (DialogPeek dp, itmp ip, int item_no) HASSIGN_7 (style_table, stCount, CWC (1), - stFont, BigEndianValue (te_style_font), + stFont, CW (te_style_font), stFace, te_style_face, - stSize, BigEndianValue (te_style_size), + stSize, CW (te_style_size), stColor, te_style_color, - stHeight, BigEndianValue (BigEndianValue (finfo.ascent) - + BigEndianValue (finfo.descent) - + BigEndianValue (finfo.leading)), + stHeight, CW (CW (finfo.ascent) + + CW (finfo.descent) + + CW (finfo.leading)), stAscent, finfo.ascent); } else { - TEP_TX_FONT_X (tep) = BigEndianValue (te_style_font); - TEP_TX_SIZE_X (tep) = BigEndianValue (te_style_size); + TEP_TX_FONT_X (tep) = CW (te_style_font); + TEP_TX_SIZE_X (tep) = CW (te_style_size); TEP_TX_FACE (tep) = CB (te_style_face); } } @@ -264,7 +255,7 @@ settexth (DialogPeek dp, itmp ip, int item_no) if (WINDOW_VISIBLE_X (dp)) TEActivate (te); - DIALOG_EDIT_FIELD_X (dp) = BigEndianValue (item_no - 1); + DIALOG_EDIT_FIELD_X (dp) = CW (item_no - 1); DIALOG_EDIT_OPEN_X (dp) = CW (! (ITEM_TYPE (ip) & itemDisable)); } @@ -424,11 +415,11 @@ P2 (PUBLIC pascal trap, void, HideDItem, DialogPtr, dp, /* IMIV-59 */ SignedByte flags; ip = ROMlib_dpnotoip((DialogPeek) dp, item, &flags); - if (ip && BigEndianValue (ip->itmr.left) < 8192) + if (ip && CW (ip->itmr.left) < 8192) { r = ip->itmr; - ip->itmr.left = BigEndianValue (BigEndianValue (ip->itmr.left) + 16384); - ip->itmr.right = BigEndianValue (BigEndianValue (ip->itmr.right) + 16384); + ip->itmr.left = CW (CW (ip->itmr.left) + 16384); + ip->itmr.right = CW (CW (ip->itmr.right) + 16384); if (CB (ip->itmtype) & editText) { InsetRect (&r, -3, -3); @@ -466,10 +457,10 @@ P2 (PUBLIC pascal trap, void, ShowDItem, DialogPtr, dp, /* IMIV-59 */ SignedByte flags; ip = ROMlib_dpnotoip ((DialogPeek) dp, item, &flags); - if (ip && BigEndianValue (ip->itmr.left) > 8192) + if (ip && CW (ip->itmr.left) > 8192) { - ip->itmr.left = BigEndianValue (BigEndianValue (ip->itmr.left) - 16384); - ip->itmr.right = BigEndianValue (BigEndianValue (ip->itmr.right) - 16384); + ip->itmr.left = CW (CW (ip->itmr.left) - 16384); + ip->itmr.right = CW (CW (ip->itmr.right) - 16384); r = ip->itmr; if (CB (ip->itmtype) & editText) { diff --git a/src/diskinit.cpp b/src/diskinit.cpp index cc18567a..f07d2ba2 100644 --- a/src/diskinit.cpp +++ b/src/diskinit.cpp @@ -16,12 +16,11 @@ char ROMlib_rcsid_diskinit[] = #include "rsys/common.h" #include "DiskInit.h" #include "rsys/glue.h" -#include "mkvol.h" +#include "mkvol/mkvol.h" #include "rsys/hfs.h" #include "rsys/blockinterrupts.h" using namespace Executor; -using namespace ByteSwap; P0(PUBLIC pascal trap, void, DILoad) { @@ -77,17 +76,17 @@ raw_read_write (func_t func, our_file_info_t *op, LONGINT *lengthp, ParamBlockRec pbr; check_virtual_interrupt (); - pbr.ioParam.ioVRefNum = BigEndianValue (op->vref); - pbr.ioParam.ioRefNum = BigEndianValue (op->dref); + pbr.ioParam.ioVRefNum = CW (op->vref); + pbr.ioParam.ioRefNum = CW (op->dref); pbr.ioParam.ioBuffer = (Ptr) RM (buf); - pbr.ioParam.ioReqCount = BigEndianValue (*lengthp); + pbr.ioParam.ioReqCount = CL (*lengthp); pbr.ioParam.ioPosMode = CWC (fsFromStart); - pbr.ioParam.ioPosOffset = BigEndianValue (op->pos); + pbr.ioParam.ioPosOffset = CL (op->pos); retval = func (&pbr, FALSE); if (retval == noErr) { - *lengthp = BigEndianValue (pbr.ioParam.ioActCount); - op->pos += BigEndianValue (pbr.ioParam.ioActCount); + *lengthp = CL (pbr.ioParam.ioActCount); + op->pos += CL (pbr.ioParam.ioActCount); } return retval; } diff --git a/src/dump.cpp b/src/dump.cpp index 612c5dee..0f3ea193 100644 --- a/src/dump.cpp +++ b/src/dump.cpp @@ -47,17 +47,17 @@ char ROMlib_rcsid_dump[] = #define deref(x) (*(x)) #define Cx(x) (x) -#define BigEndianValue(x) (x) +#define CW(x) (x) #define CWC(x) (x) -#define BigEndianValue(x) (x) +#define CL(x) (x) #define CLC(x) (x) #define theCPort ((CGrafPtr) thePort) #define CGrafPort_p(port) (((char *)(port))[6] & 0xC0) #define ROWBYTES_VALUE_BITS (0x3FFF) -#define RECT_HEIGHT(r) (BigEndianValue ((r)->bottom) - BigEndianValue ((r)->top)) -#define RECT_WIDTH(r) (BigEndianValue ((r)->right) - BigEndianValue ((r)->left)) +#define RECT_HEIGHT(r) (CW ((r)->bottom) - CW ((r)->top)) +#define RECT_WIDTH(r) (CW ((r)->right) - CW ((r)->left)) /* window accessors */ #define WINDOW_PORT(wp) (&((WindowPeek) (wp))->port) @@ -110,11 +110,11 @@ char ROMlib_rcsid_dump[] = #define DIALOG_EDIT_OPEN_X(dialog) (((DialogPeek) (dialog))->editOpen) #define DIALOG_ADEF_ITEM_X(dialog) (((DialogPeek) (dialog))->aDefItem) -#define DIALOG_ITEMS(dialog) (BigEndianValue (DIALOG_ITEMS_X (dialog))) -#define DIALOG_TEXTH(dialog) (BigEndianValue (DIALOG_TEXTH_X (dialog))) -#define DIALOG_EDIT_FIELD(dialog) (BigEndianValue (DIALOG_EDIT_FIELD_X (dialog))) -#define DIALOG_EDIT_OPEN(dialog) (BigEndianValue (DIALOG_EDIT_OPEN_X (dialog))) -#define DIALOG_ADEF_ITEM(dialog) (BigEndianValue (DIALOG_ADEF_ITEM_X (dialog))) +#define DIALOG_ITEMS(dialog) (CL (DIALOG_ITEMS_X (dialog))) +#define DIALOG_TEXTH(dialog) (CL (DIALOG_TEXTH_X (dialog))) +#define DIALOG_EDIT_FIELD(dialog) (CW (DIALOG_EDIT_FIELD_X (dialog))) +#define DIALOG_EDIT_OPEN(dialog) (CW (DIALOG_EDIT_OPEN_X (dialog))) +#define DIALOG_ADEF_ITEM(dialog) (CW (DIALOG_ADEF_ITEM_X (dialog))) enum pixpat_pattern_types { @@ -140,7 +140,6 @@ enum pixpat_pattern_types #include using namespace Executor; -using namespace ByteSwap; FILE *Executor::o_fp = NULL; @@ -251,9 +250,9 @@ void Executor::dump_rect (Rect *r) { iprintf ((o_fp, "%s(Rect *%p) {\n", field_name.c_str(), r)); indent += 2; - iprintf ((o_fp, "top 0x%x; left 0x%x;\n", BigEndianValue (r->top), BigEndianValue (r->left))); + iprintf ((o_fp, "top 0x%x; left 0x%x;\n", CW (r->top), CW (r->left))); iprintf ((o_fp, "bottom 0x%x; right 0x%x; }\n", - BigEndianValue (r->bottom), BigEndianValue (r->right))); indent -= 2; + CW (r->bottom), CW (r->right))); indent -= 2; fflush (o_fp); } @@ -270,7 +269,7 @@ void Executor::dump_point (Point x) { iprintf ((o_fp, "%s(Point) { v 0x%x; h 0x%x; }\n", - field_name.c_str(), BigEndianValue (x.v), BigEndianValue (x.h))); + field_name.c_str(), CW (x.v), CW (x.h))); fflush (o_fp); } @@ -287,10 +286,10 @@ Executor::dump_bitmap_data (BitMap *x, int depth, Rect *rect) if (!rect) rect = &x->bounds; - row_bytes = BigEndianValue (x->rowBytes) & ROWBYTES_VALUE_BITS; + row_bytes = CW (x->rowBytes) & ROWBYTES_VALUE_BITS; addr = (char *) - &MR (x->baseAddr)[(BigEndianValue (rect->top) - BigEndianValue (x->bounds.top)) * row_bytes - + ((BigEndianValue (rect->left) - BigEndianValue (x->bounds.left)) + &MR (x->baseAddr)[(CW (rect->top) - CW (x->bounds.top)) * row_bytes + + ((CW (rect->left) - CW (x->bounds.left)) * depth) / 8]; rows = RECT_HEIGHT (&x->bounds); bytes_per_row = (RECT_WIDTH (&x->bounds) * depth + 7) / 8; @@ -345,7 +344,7 @@ Executor::dump_bitmap (BitMap *x, Rect *rect) iprintf ((o_fp, "baseAddr %p;\n", MR (x->baseAddr))); if (dump_verbosity >= 3) dump_bitmap_data (x, 1, rect); - iprintf ((o_fp, "rowBytes 0x%hx;\n", (unsigned short) BigEndianValue (x->rowBytes))); + iprintf ((o_fp, "rowBytes 0x%hx;\n", (unsigned short) CW (x->rowBytes))); dump_field (dump_rect, &x->bounds, "bounds"); indent -= 2; iprintf ((o_fp, "}\n")); fflush (o_fp); @@ -397,7 +396,7 @@ void Executor::dump_grafport_real (GrafPtr x) { iprintf ((o_fp, "%s(GrafPort *%p) {\n", field_name.c_str(), x)); indent += 2; - iprintf ((o_fp, "device %d;\n", BigEndianValue (x->device))); + iprintf ((o_fp, "device %d;\n", CW (x->device))); dump_field (dump_bitmap_null_rect, &x->portBits, "portBits"); dump_field (dump_rect, &x->portRect, "portRect"); dump_field (dump_handle, MR (x->visRgn), "visRgn"); @@ -406,18 +405,18 @@ Executor::dump_grafport_real (GrafPtr x) dump_field (dump_pattern, x->fillPat, "fillPat"); dump_field (dump_point, x->pnLoc, "pnLoc"); dump_field (dump_point, x->pnSize, "pnSize"); - iprintf ((o_fp, "pnMode %d;\n", BigEndianValue (x->pnMode))); + iprintf ((o_fp, "pnMode %d;\n", CW (x->pnMode))); dump_field (dump_pattern, x->pnPat, "pnPat"); - iprintf ((o_fp, "pnVis %d;\n", BigEndianValue (x->pnVis))); - iprintf ((o_fp, "txFont %d;\n", BigEndianValue (x->txFont))); + iprintf ((o_fp, "pnVis %d;\n", CW (x->pnVis))); + iprintf ((o_fp, "txFont %d;\n", CW (x->txFont))); iprintf ((o_fp, "txFace %d;\n", x->txFace)); - iprintf ((o_fp, "txMode %d;\n", BigEndianValue (x->txMode))); - iprintf ((o_fp, "txSize %d;\n", BigEndianValue (x->txSize))); - iprintf ((o_fp, "spExtra %d;\n", BigEndianValue (x->spExtra))); - iprintf ((o_fp, "fgColor 0x%x;\n", BigEndianValue (x->fgColor))); - iprintf ((o_fp, "bkColor 0x%x;\n", BigEndianValue (x->bkColor))); - iprintf ((o_fp, "colrBit %d;\n", BigEndianValue (x->colrBit))); - iprintf ((o_fp, "patStretch %d;\n", BigEndianValue (x->patStretch))); + iprintf ((o_fp, "txMode %d;\n", CW (x->txMode))); + iprintf ((o_fp, "txSize %d;\n", CW (x->txSize))); + iprintf ((o_fp, "spExtra %d;\n", CL (x->spExtra))); + iprintf ((o_fp, "fgColor 0x%x;\n", CL (x->fgColor))); + iprintf ((o_fp, "bkColor 0x%x;\n", CL (x->bkColor))); + iprintf ((o_fp, "colrBit %d;\n", CW (x->colrBit))); + iprintf ((o_fp, "patStretch %d;\n", CW (x->patStretch))); dump_field (dump_handle, MR (x->picSave), "picSave"); dump_field (dump_handle, MR (x->rgnSave), "rgnSave"); dump_field (dump_handle, MR (x->polySave), "polySave"); @@ -443,9 +442,9 @@ Executor::dump_rgb_color (RGBColor *x) { iprintf ((o_fp, "%s(RGBColor) { red 0x%lx; green 0x%lx, blue 0x%lx; }\n", field_name.c_str(), - (long) BigEndianValue (x->red), - (long) BigEndianValue (x->green), - (long) BigEndianValue (x->blue))); + (long) CW (x->red), + (long) CW (x->green), + (long) CW (x->blue))); fflush (o_fp); } @@ -455,21 +454,21 @@ Executor::dump_ctab (CTabHandle ctab) CTabPtr x = deref (ctab); iprintf ((o_fp, "%s(ColorTable **%p) {\n", field_name.c_str(), ctab)); indent += 2; - iprintf ((o_fp, "ctSeed 0x%x;\n", BigEndianValue (x->ctSeed))); - iprintf ((o_fp, "ctFlags 0x%x;\n", BigEndianValue (x->ctFlags))); - iprintf ((o_fp, "ctSize %d;\n", BigEndianValue (x->ctSize))); + iprintf ((o_fp, "ctSeed 0x%x;\n", CL (x->ctSeed))); + iprintf ((o_fp, "ctFlags 0x%x;\n", CW (x->ctFlags))); + iprintf ((o_fp, "ctSize %d;\n", CW (x->ctSize))); if (dump_verbosity >= 2) { int i; iprintf ((o_fp, "ctTable\n")); - for (i = 0; i <= BigEndianValue (x->ctSize); i ++) + for (i = 0; i <= CW (x->ctSize); i ++) { iprintf ((o_fp, "%d:[0x%x] { 0x%lx, 0x%lx, 0x%lx }\n", - i, BigEndianValue (x->ctTable[i].value), - (long) BigEndianValue (x->ctTable[i].rgb.red), - (long) BigEndianValue (x->ctTable[i].rgb.green), - (long) BigEndianValue (x->ctTable[i].rgb.blue))); + i, CW (x->ctTable[i].value), + (long) CW (x->ctTable[i].rgb.red), + (long) CW (x->ctTable[i].rgb.green), + (long) CW (x->ctTable[i].rgb.blue))); } indent -= 2; iprintf ((o_fp, "}\n")); } @@ -486,8 +485,8 @@ Executor::dump_itab (ITabHandle itab) ITabPtr x = deref (itab); iprintf ((o_fp, "%s(ITab **%p) {\n", field_name.c_str(), itab)); indent += 2; - iprintf ((o_fp, "iTabSeed 0x%x;\n", BigEndianValue (x->iTabSeed))); - iprintf ((o_fp, "iTabRes %d;\n", BigEndianValue (x->iTabRes))); + iprintf ((o_fp, "iTabSeed 0x%x;\n", CL (x->iTabSeed))); + iprintf ((o_fp, "iTabRes %d;\n", CW (x->iTabRes))); /* we always omit the inverse table... */ iprintf ((o_fp, "[iTTable field omitted]; }\n")); indent -= 2; @@ -523,7 +522,7 @@ Executor::dump_pixpat (PixPatHandle pixpat) iprintf ((o_fp, "[pat{Map, Data} field omitted]; }\n")); } dump_field (dump_handle, MR (x->patXData), "patXData"); - iprintf ((o_fp, "patXValid %d;\n", BigEndianValue (x->patXValid))); + iprintf ((o_fp, "patXValid %d;\n", CW (x->patXValid))); if (dump_verbosity && x->patXMap && !x->patXValid) @@ -546,20 +545,20 @@ dump_pixmap_ptr (PixMapPtr x, Rect *rect) { if (!rect) rect = &x->bounds; - dump_bitmap_data ((BitMap *) x, BigEndianValue (x->pixelSize), rect); + dump_bitmap_data ((BitMap *) x, CW (x->pixelSize), rect); } - iprintf ((o_fp, "rowBytes 0x%hx;\n", (unsigned short) BigEndianValue (x->rowBytes))); + iprintf ((o_fp, "rowBytes 0x%hx;\n", (unsigned short) CW (x->rowBytes))); dump_field (dump_rect, &x->bounds, "bounds"); - iprintf ((o_fp, "pmVersion 0x%x;\n", BigEndianValue (x->pmVersion))); - iprintf ((o_fp, "packType 0x%x;\n", BigEndianValue (x->packType))); - iprintf ((o_fp, "packSize 0x%x;\n", BigEndianValue (x->packSize))); + iprintf ((o_fp, "pmVersion 0x%x;\n", CW (x->pmVersion))); + iprintf ((o_fp, "packType 0x%x;\n", CW (x->packType))); + iprintf ((o_fp, "packSize 0x%x;\n", CW (x->packSize))); iprintf ((o_fp, "hRes 0x%x, vRes 0x%x;\n", - BigEndianValue (x->hRes), BigEndianValue (x->vRes))); - iprintf ((o_fp, "pixelType 0x%x;\n", BigEndianValue (x->pixelType))); - iprintf ((o_fp, "pixelSize %d;\n", BigEndianValue (x->pixelSize))); - iprintf ((o_fp, "cmpCount %d;\n", BigEndianValue (x->cmpCount))); - iprintf ((o_fp, "cmpSize %d;\n", BigEndianValue (x->cmpSize))); - iprintf ((o_fp, "planeBytes 0x%x;\n", BigEndianValue (x->planeBytes))); + CW (x->hRes), CW (x->vRes))); + iprintf ((o_fp, "pixelType 0x%x;\n", CW (x->pixelType))); + iprintf ((o_fp, "pixelSize %d;\n", CW (x->pixelSize))); + iprintf ((o_fp, "cmpCount %d;\n", CW (x->cmpCount))); + iprintf ((o_fp, "cmpSize %d;\n", CW (x->cmpSize))); + iprintf ((o_fp, "planeBytes 0x%x;\n", CL (x->planeBytes))); if (dump_verbosity && x->pmTable) dump_field (dump_ctab, MR (x->pmTable), "pmTable"); @@ -587,20 +586,20 @@ Executor::dump_pixmap (PixMapHandle pixmap, Rect *rect) { if (!rect) rect = &x->bounds; - dump_bitmap_data ((BitMap *) x, BigEndianValue (x->pixelSize), rect); + dump_bitmap_data ((BitMap *) x, CW (x->pixelSize), rect); } - iprintf ((o_fp, "rowBytes 0x%hx;\n", (unsigned short) BigEndianValue (x->rowBytes))); + iprintf ((o_fp, "rowBytes 0x%hx;\n", (unsigned short) CW (x->rowBytes))); dump_field (dump_rect, &x->bounds, "bounds"); - iprintf ((o_fp, "pmVersion 0x%x;\n", BigEndianValue (x->pmVersion))); - iprintf ((o_fp, "packType 0x%x;\n", BigEndianValue (x->packType))); - iprintf ((o_fp, "packSize 0x%x;\n", BigEndianValue (x->packSize))); + iprintf ((o_fp, "pmVersion 0x%x;\n", CW (x->pmVersion))); + iprintf ((o_fp, "packType 0x%x;\n", CW (x->packType))); + iprintf ((o_fp, "packSize 0x%x;\n", CW (x->packSize))); iprintf ((o_fp, "hRes 0x%x, vRes 0x%x;\n", - BigEndianValue (x->hRes), BigEndianValue (x->vRes))); - iprintf ((o_fp, "pixelType 0x%x;\n", BigEndianValue (x->pixelType))); - iprintf ((o_fp, "pixelSize %d;\n", BigEndianValue (x->pixelSize))); - iprintf ((o_fp, "cmpCount %d;\n", BigEndianValue (x->cmpCount))); - iprintf ((o_fp, "cmpSize %d;\n", BigEndianValue (x->cmpSize))); - iprintf ((o_fp, "planeBytes 0x%x;\n", BigEndianValue (x->planeBytes))); + CW (x->hRes), CW (x->vRes))); + iprintf ((o_fp, "pixelType 0x%x;\n", CW (x->pixelType))); + iprintf ((o_fp, "pixelSize %d;\n", CW (x->pixelSize))); + iprintf ((o_fp, "cmpCount %d;\n", CW (x->cmpCount))); + iprintf ((o_fp, "cmpSize %d;\n", CW (x->cmpSize))); + iprintf ((o_fp, "planeBytes 0x%x;\n", CL (x->planeBytes))); if (dump_verbosity && x->pmTable) dump_field (dump_ctab, MR (x->pmTable), "pmTable"); @@ -646,16 +645,16 @@ void Executor::dump_cgrafport_real (CGrafPtr x) { iprintf ((o_fp, "%s(CGrafPort *%p) {\n", field_name.c_str(), x)); indent += 2; - iprintf ((o_fp, "device 0x%x;\n", BigEndianValue (x->device))); + iprintf ((o_fp, "device 0x%x;\n", CW (x->device))); if (dump_verbosity && x->portPixMap) dump_field (dump_pixmap_null_rect, MR (x->portPixMap), "portPixMap"); else dump_field (dump_handle, MR (x->portPixMap), "portPixMap"); - iprintf ((o_fp, "portVersion 0x%x;\n", BigEndianValue (x->portVersion))); + iprintf ((o_fp, "portVersion 0x%x;\n", CW (x->portVersion))); dump_field (dump_handle, MR (x->grafVars), "grafVars"); - iprintf ((o_fp, "chExtra %d;\n", BigEndianValue (x->chExtra))); - iprintf ((o_fp, "pnLocHFrac 0x%x;\n", BigEndianValue (x->pnLocHFrac))); + iprintf ((o_fp, "chExtra %d;\n", CW (x->chExtra))); + iprintf ((o_fp, "pnLocHFrac 0x%x;\n", CW (x->pnLocHFrac))); dump_field (dump_rect, &x->portRect, "portRect"); dump_field (dump_handle, MR (x->visRgn), "visRgn"); dump_field (dump_handle, MR (x->clipRgn), "clipRgn"); @@ -668,7 +667,7 @@ Executor::dump_cgrafport_real (CGrafPtr x) dump_field (dump_rgb_color, &x->rgbBkColor, "rgbBkColor"); dump_field (dump_point, x->pnLoc, "pnLoc"); dump_field (dump_point, x->pnSize, "pnSize"); - iprintf ((o_fp, "pnMode %d;\n", BigEndianValue (x->pnMode))); + iprintf ((o_fp, "pnMode %d;\n", CW (x->pnMode))); if (dump_verbosity && x->pnPixPat) dump_field (dump_pixpat, MR (x->pnPixPat), "pnPixPat"); @@ -679,16 +678,16 @@ Executor::dump_cgrafport_real (CGrafPtr x) dump_field (dump_pixpat, MR (x->fillPixPat), "fillPixPat"); else dump_field (dump_handle, MR (x->fillPixPat), "fillPixPat"); - iprintf ((o_fp, "pnVis %d;\n", BigEndianValue (x->pnVis))); - iprintf ((o_fp, "txFont %d;\n", BigEndianValue (x->txFont))); + iprintf ((o_fp, "pnVis %d;\n", CW (x->pnVis))); + iprintf ((o_fp, "txFont %d;\n", CW (x->txFont))); iprintf ((o_fp, "txFace %d;\n", x->txFace)); - iprintf ((o_fp, "txMode %d;\n", BigEndianValue (x->txMode))); - iprintf ((o_fp, "txSize %d;\n", BigEndianValue (x->txSize))); - iprintf ((o_fp, "spExtra %d;\n", BigEndianValue (x->spExtra))); - iprintf ((o_fp, "fgColor 0x%x;\n", BigEndianValue (x->fgColor))); - iprintf ((o_fp, "bkColor 0x%x;\n", BigEndianValue (x->bkColor))); - iprintf ((o_fp, "colrBit %d;\n", BigEndianValue (x->colrBit))); - iprintf ((o_fp, "patStretch %x;\n", BigEndianValue (x->patStretch))); + iprintf ((o_fp, "txMode %d;\n", CW (x->txMode))); + iprintf ((o_fp, "txSize %d;\n", CW (x->txSize))); + iprintf ((o_fp, "spExtra %d;\n", CL (x->spExtra))); + iprintf ((o_fp, "fgColor 0x%x;\n", CL (x->fgColor))); + iprintf ((o_fp, "bkColor 0x%x;\n", CL (x->bkColor))); + iprintf ((o_fp, "colrBit %d;\n", CW (x->colrBit))); + iprintf ((o_fp, "patStretch %x;\n", CW (x->patStretch))); dump_field (dump_handle, MR (x->picSave), "picSave"); dump_field (dump_handle, MR (x->rgnSave), "rgnSave"); dump_field (dump_handle, MR (x->polySave), "polySave"); @@ -704,16 +703,16 @@ Executor::dump_gdevice (GDHandle gdev) SProcHndl proc; iprintf ((o_fp, "%s(GDevice **%p) {\n", field_name.c_str(), gdev)); indent += 2; - iprintf ((o_fp, "gdID 0x%x;\n", BigEndianValue (x->gdID))); - iprintf ((o_fp, "gdType 0x%x;\n", BigEndianValue (x->gdType))); + iprintf ((o_fp, "gdID 0x%x;\n", CW (x->gdID))); + iprintf ((o_fp, "gdType 0x%x;\n", CW (x->gdType))); if (dump_verbosity && x->gdITable) dump_field (dump_itab, MR (x->gdITable), "gdITable"); else dump_field (dump_handle, MR (x->gdITable), "gdITable"); - iprintf ((o_fp, "gdResPref 0x%x;\n", BigEndianValue (x->gdResPref))); + iprintf ((o_fp, "gdResPref 0x%x;\n", CW (x->gdResPref))); #if 0 - dump_field (dump_handle, BigEndianValue (x->gdSearchProc), "gdSearchProc"); + dump_field (dump_handle, CL (x->gdSearchProc), "gdSearchProc"); #else iprintf ((o_fp, "gdSearchProc %p;\n", MR (x->gdSearchProc))); for (proc = MR (x->gdSearchProc); proc; proc = HxP (proc, nxtSrch)) @@ -721,20 +720,20 @@ Executor::dump_gdevice (GDHandle gdev) proc, HxP (proc, nxtSrch), HxP (proc, srchProc))); #endif dump_field (dump_handle, MR (x->gdCompProc), "gdCompProc"); - iprintf ((o_fp, "gdFlags 0x%hx;\n", (unsigned short) BigEndianValue (x->gdFlags))); + iprintf ((o_fp, "gdFlags 0x%hx;\n", (unsigned short) CW (x->gdFlags))); if (dump_verbosity && x->gdPMap) dump_field (dump_pixmap_null_rect, MR (x->gdPMap), "gdPMap"); else dump_field (dump_handle, MR (x->gdPMap), "gdPMap"); - iprintf ((o_fp, "gdRefCon 0x%x;\n", BigEndianValue (x->gdRefCon))); + iprintf ((o_fp, "gdRefCon 0x%x;\n", CL (x->gdRefCon))); if (dump_verbosity && x->gdNextGD) dump_field (dump_gdevice, (GDHandle) MR (x->gdNextGD), "gdNextGD"); else dump_field (dump_handle, MR (x->gdNextGD), "gdNextGD"); dump_field (dump_rect, &x->gdRect, "gdRect"); - iprintf ((o_fp, "gdMode 0x%x;\n", BigEndianValue (x->gdMode))); + iprintf ((o_fp, "gdMode 0x%x;\n", CW (x->gdMode))); iprintf ((o_fp, "[CC, Reserved fields omitted]; }\n")); indent -= 2; fflush (o_fp); } @@ -772,34 +771,34 @@ Executor::dump_palette (PaletteHandle palette) iprintf ((o_fp, "%s(PaletteHandle **%p) {\n", field_name.c_str(), palette)); indent += 2; - iprintf ((o_fp, "pmEntries 0x%x;\n", BigEndianValue (x->pmEntries))); + iprintf ((o_fp, "pmEntries 0x%x;\n", CW (x->pmEntries))); if (pmWindow (x) && dump_verbosity >= 2 && 0) dump_grafport ((GrafPtr) MR (pmWindow (x))); else dump_field (dump_handle, MR (pmWindow (x)), "pmWindow"); - iprintf ((o_fp, "pmPrivate 0x%x\n", BigEndianValue (pmPrivate (x)))); - iprintf ((o_fp, "pmDevices 0x%lx\n", (long) BigEndianValue (pmDevices (x)))); + iprintf ((o_fp, "pmPrivate 0x%x\n", CW (pmPrivate (x)))); + iprintf ((o_fp, "pmDevices 0x%lx\n", (long) CL (pmDevices (x)))); iprintf ((o_fp, "pmSeeds 0x%lx\n", (long) MR (pmSeeds (x)))); if (dump_verbosity >= 2) { int i; iprintf ((o_fp, "pmInfo\n")); - for (i = 0; i < BigEndianValue (x->pmEntries); i ++) + for (i = 0; i < CW (x->pmEntries); i ++) { iprintf ((o_fp, "%3x { rgb { 0x%lx, 0x%lx, 0x%lx }\n", i, - (long) BigEndianValue (x->pmInfo[i].ciRGB.red), - (long) BigEndianValue (x->pmInfo[i].ciRGB.green), - (long) BigEndianValue (x->pmInfo[i].ciRGB.blue))); + (long) CW (x->pmInfo[i].ciRGB.red), + (long) CW (x->pmInfo[i].ciRGB.green), + (long) CW (x->pmInfo[i].ciRGB.blue))); iprintf ((o_fp, " usage 0x%x; tolerance 0x%x;\n", - BigEndianValue (x->pmInfo[i].ciUsage), - BigEndianValue (x->pmInfo[i].ciTolerance))); + CW (x->pmInfo[i].ciUsage), + CW (x->pmInfo[i].ciTolerance))); iprintf ((o_fp, " flags 0x%x; private 0x%lx; };\n", - BigEndianValue (ciFlags (&x->pmInfo[i])), - (unsigned long) BigEndianValue (ciPrivate (&x->pmInfo[i])))); + CW (ciFlags (&x->pmInfo[i])), + (unsigned long) CL (ciPrivate (&x->pmInfo[i])))); } indent -= 2; iprintf ((o_fp, "}\n")); } @@ -817,7 +816,7 @@ Executor::dump_ccrsr (CCrsrHandle ccrsr) iprintf ((o_fp, "%s(CCrsrHandle **%p) {\n", field_name.c_str(), ccrsr)); indent += 2; - iprintf ((o_fp, "crsrType 0x%hx;\n", BigEndianValue (x->crsrType))); + iprintf ((o_fp, "crsrType 0x%hx;\n", CW (x->crsrType))); if (x->crsrMap && dump_verbosity >= 1) dump_field (dump_pixmap_null_rect, MR (x->crsrMap), "crsrMap"); @@ -832,9 +831,9 @@ Executor::dump_ccrsr (CCrsrHandle ccrsr) int depth; /* dump the expanded pixel data */ - depth = BigEndianValue (x->crsrXValid); + depth = CW (x->crsrXValid); bm.baseAddr = RM (deref (MR (x->crsrXData))); - bm.rowBytes = BigEndianValue (2 * depth); + bm.rowBytes = CW (2 * depth); bm.bounds.top = bm.bounds.left = CWC (0); bm.bounds.bottom = CWC (16); bm.bounds.right = CWC (16); @@ -846,13 +845,13 @@ Executor::dump_ccrsr (CCrsrHandle ccrsr) } else dump_field (dump_handle, MR (x->crsrXData), "crsrXData"); - iprintf ((o_fp, "crsrXValid %d;\n", BigEndianValue (x->crsrXValid))); + iprintf ((o_fp, "crsrXValid %d;\n", CW (x->crsrXValid))); dump_field (dump_handle, MR (x->crsrXHandle), "crsrXHandle"); dump_field (dump_bits16, x->crsr1Data, "crsr1Data"); dump_field (dump_bits16, x->crsrMask, "crsrMask"); dump_field (dump_point, x->crsrHotSpot, "crsrHotSpot"); - iprintf ((o_fp, "crsrXTable %x\n", BigEndianValue (x->crsrXTable))); - iprintf ((o_fp, "crsrID 0x%x; }\n", BigEndianValue (x->crsrID))); indent -= 2; + iprintf ((o_fp, "crsrXTable %x\n", CW (x->crsrXTable))); + iprintf ((o_fp, "crsrID 0x%x; }\n", CW (x->crsrID))); indent -= 2; fflush (o_fp); } @@ -943,7 +942,7 @@ dump_dialog_items (DialogPeek dp) int i; item_data = (int16 *) STARH (DIALOG_ITEMS (dp)); - n_items = BigEndianValue (*item_data); + n_items = CW (*item_data); items = (itmp) &item_data[1]; fprintf (o_fp, "%d items:\n", n_items); for (i = 0; i < n_items; i ++) @@ -952,10 +951,10 @@ dump_dialog_items (DialogPeek dp) item = items; fprintf (o_fp, "item %d; type %d, hand %p, (%d, %d, %d, %d)\n", - i, BigEndianValue ((int16) item->itmtype), + i, CW ((int16) item->itmtype), MR (item->itmhand), - BigEndianValue (item->itmr.top), BigEndianValue (item->itmr.left), - BigEndianValue (item->itmr.bottom), BigEndianValue (item->itmr.right)); + CW (item->itmr.top), CW (item->itmr.left), + CW (item->itmr.bottom), CW (item->itmr.right)); BUMPIP (items); } } @@ -982,9 +981,9 @@ Executor::dump_aux_win (AuxWinHandle awh) iprintf ((o_fp, "awOwner %p;\n", MR (aw->awOwner))); dump_field (dump_ctab, MR (aw->awCTable), "awCTable"); dump_field (dump_handle, MR (aw->dialogCItem), "dialogCItem"); - iprintf ((o_fp, "awFlags 0x%lx;\n", (long) BigEndianValue (aw->awFlags))); + iprintf ((o_fp, "awFlags 0x%lx;\n", (long) CL (aw->awFlags))); iprintf ((o_fp, "awReserved 0x%lx;\n", (long) MR (aw->awReserved))); - iprintf ((o_fp, "awRefCon 0x%lx; }\n", (long) BigEndianValue (aw->awRefCon))); + iprintf ((o_fp, "awRefCon 0x%lx; }\n", (long) CL (aw->awRefCon))); indent -= 2; fflush (o_fp); @@ -1019,7 +1018,7 @@ Executor::dump_rgn (RgnHandle rgn) iprintf ((o_fp, "%s(RgnHandle **%p) {\n", field_name.c_str(), rgn)); indent += 2; x = deref (rgn); - iprintf ((o_fp, "rgnSize %d\n", BigEndianValue (x->rgnSize))); + iprintf ((o_fp, "rgnSize %d\n", CW (x->rgnSize))); dump_field (dump_rect, &x->rgnBBox, "rgnBBox"); iprintf ((o_fp, "[special data omitted]; }\n")); indent -= 2; fflush (o_fp); @@ -1182,7 +1181,7 @@ dump_te (TEHandle te) line_starts = TE_LINE_STARTS (te); for (i = 0; i <= n_lines; i ++) - iprintf ((o_fp, "lineStart[%d]: %d\n", i, BigEndianValue (line_starts[i]))); + iprintf ((o_fp, "lineStart[%d]: %d\n", i, CW (line_starts[i]))); } { @@ -1258,7 +1257,7 @@ CountResourcesRN (LONGINT type, INTEGER rn) INTEGER retval; MAP_SAVE_EXCURSION - (BigEndianValue (rn), + (CW (rn), { retval = Count1Resources (type); }); @@ -1272,7 +1271,7 @@ GetIndResourceRN (LONGINT type, INTEGER i, INTEGER rn) Handle retval; MAP_SAVE_EXCURSION - (BigEndianValue (rn), + (CW (rn), { retval = Get1IndResource (type, i); }); @@ -1284,7 +1283,7 @@ static void AddResourceRN (Handle h, LONGINT type, INTEGER id, Str255 name, INTEGER rn) { MAP_SAVE_EXCURSION - (BigEndianValue (rn), + (CW (rn), { AddResource (h, type, id, name); }); @@ -1305,11 +1304,11 @@ copy_resources (INTEGER new_rn, INTEGER old_rn, LONGINT type) Handle h; INTEGER id; Str255 name; - ULONGINT ignored; + LONGINT ignored; h = GetIndResourceRN (type, i, old_rn); GetResInfo (h, &id, &ignored, name); - id = BigEndianValue (id); + id = CW (id); DetachResource (h); AddResourceRN (h, type, id, name, new_rn); } diff --git a/src/emustubs.cpp b/src/emustubs.cpp index ee7322bc..33256cb1 100644 --- a/src/emustubs.cpp +++ b/src/emustubs.cpp @@ -68,7 +68,6 @@ char ROMlib_rcsid_emustubs[] = #include "rsys/mixed_mode.h" namespace Executor { - using namespace ByteSwap; #define PUBLIC #undef PRIVATE @@ -1792,20 +1791,20 @@ STUB (CommToolboxDispatch) arg_block = (comm_toolbox_dispatch_args_t *) SYN68K_TO_US(EM_A0); - selector = BigEndianValue (arg_block->selector); + selector = CW (arg_block->selector); switch (selector) { case 0x0402: AppendDITL (MR (arg_block->args.append_args.dp), MR (arg_block->args.append_args.new_items_h), - BigEndianValue (arg_block->args.append_args.method)); + CW (arg_block->args.append_args.method)); break; case 0x0403: EM_D0 = CountDITL (MR (arg_block->args.count_args.dp)); break; case 0x0404: ShortenDITL (MR (arg_block->args.shorten_args.dp), - BigEndianValue (arg_block->args.shorten_args.n_items)); + CW (arg_block->args.shorten_args.n_items)); break; case 1286: EM_D0 = CRMGetCRMVersion (); @@ -2438,7 +2437,7 @@ STUB(Gestalt) default: l = 0; EM_D0 = Gestalt(EM_D0, &l); - EM_A0 = BigEndianValue (l); + EM_A0 = CL (l); break; case 0xA3AD: if (EM_D0 == DONGLE_GESTALT) @@ -2510,70 +2509,70 @@ STUB (HGetState) STUB(HSetState) { HSetState ((Handle) SYN68K_TO_US_CHECK0(EM_A0), EM_D0); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (HLock) { HLock ((Handle) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (HUnlock) { HUnlock ((Handle) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (HPurge) { HPurge ((Handle) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (HNoPurge) { HNoPurge ((Handle) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (HSetRBit) { HSetRBit ((Handle) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (HClrRBit) { HClrRBit ((Handle) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (InitApplZone) { InitApplZone (); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (SetApplBase) { SetApplBase ((Ptr) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (MoreMasters) { MoreMasters (); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -2582,67 +2581,67 @@ STUB (InitZone) initzonehiddenargs_t *ip; ip = (initzonehiddenargs_t *) SYN68K_TO_US(EM_A0); - InitZone ((ProcPtr)MR (ip->pGrowZone), BigEndianValue (ip->cMoreMasters), + InitZone ((ProcPtr)MR (ip->pGrowZone), CW (ip->cMoreMasters), (Ptr)MR (ip->limitPtr), (THz)MR (ip->startPtr)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (SetZone) { SetZone ((THz) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (DisposHandle) { DisposHandle ((Handle) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (GetHandleSize) { EM_D0 = GetHandleSize ((Handle) SYN68K_TO_US_CHECK0(EM_A0)); - if (BigEndianValue (MemErr) < 0) - EM_D0 = BigEndianValue (MemErr); + if (CW (MemErr) < 0) + EM_D0 = CW (MemErr); RTS (); } STUB (SetHandleSize) { SetHandleSize ((Handle) SYN68K_TO_US_CHECK0(EM_A0), EM_D0); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (ReallocHandle) { ReallocHandle ((Handle) SYN68K_TO_US_CHECK0(EM_A0), EM_D0); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (DisposPtr) { DisposPtr ((Ptr) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (GetPtrSize) { EM_D0 = GetPtrSize ((Ptr) SYN68K_TO_US_CHECK0(EM_A0)); - if (BigEndianValue (MemErr) < 0) - EM_D0 = BigEndianValue (MemErr); + if (CW (MemErr) < 0) + EM_D0 = CW (MemErr); RTS (); } STUB (SetPtrSize) { SetPtrSize ((Ptr) SYN68K_TO_US_CHECK0(EM_A0), EM_D0); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -2661,14 +2660,14 @@ STUB (CompactMem) STUB (ResrvMem) { _ResrvMem_flags (EM_D0, SYS_P (EM_D1, 0xA040)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS(); } STUB (PurgeMem) { _PurgeMem_flags (EM_D0, SYS_P (EM_D1, 0xA04D)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -2677,21 +2676,21 @@ STUB (BlockMove) BlockMove_the_trap ((Ptr) SYN68K_TO_US_CHECK0(EM_A0), (Ptr) SYN68K_TO_US_CHECK0(EM_A1), EM_D0, !(EM_D1 & 0x200)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (MaxApplZone) { MaxApplZone (); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (MoveHHi) { MoveHHi ((Handle) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -2710,21 +2709,21 @@ STUB (StackSpace) STUB (SetApplLimit) { SetApplLimit ((Ptr) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (SetGrowZone) { SetGrowZone ((ProcPtr) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS(); } STUB (GetZone) { EM_A0 = (uint32) US_TO_SYN68K_CHECK0(GetZone ()); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -2732,7 +2731,7 @@ STUB (NewEmptyHandle) { EM_A0 = (uint32) US_TO_SYN68K_CHECK0(_NewEmptyHandle_flags (SYS_P (EM_D1, 0xA166))); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -2742,7 +2741,7 @@ STUB (NewHandle) EM_A0 = (uint32) US_TO_SYN68K_CHECK0(_NewHandle_flags (EM_D0, SYS_P (EM_D1, 0xA122), CLEAR_P (EM_D1, 0xA122))); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -2750,7 +2749,7 @@ STUB (HandleZone) { EM_A0 = (uint32) US_TO_SYN68K_CHECK0(HandleZone ((Handle) SYN68K_TO_US_CHECK0(EM_A0))); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -2759,7 +2758,7 @@ STUB (RecoverHandle) EM_A0 = (uint32) US_TO_SYN68K_CHECK0( _RecoverHandle_flags ((Ptr) SYN68K_TO_US_CHECK0(EM_A0), SYS_P (EM_D1, 0xA128))); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -2767,14 +2766,14 @@ STUB (NewPtr) { EM_A0 = (uint32) US_TO_SYN68K_CHECK0(_NewPtr_flags (EM_D0, SYS_P (EM_D1, 0xA11E), CLEAR_P (EM_D1, 0xA11E))); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } STUB (PtrZone) { EM_A0 = (uint32) US_TO_SYN68K_CHECK0(PtrZone ((Ptr) SYN68K_TO_US_CHECK0(EM_A0))); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -2797,7 +2796,7 @@ STUB (PurgeSpace) STUB (EmptyHandle) { EmptyHandle ((Handle) SYN68K_TO_US_CHECK0(EM_A0)); - EM_D0 = BigEndianValue (MemErr); + EM_D0 = CW (MemErr); RTS (); } @@ -3047,7 +3046,7 @@ STUB (modeswitch) retaddr = POPADDR (); rp = (RoutineDescriptor *)((char *)ignoreme); /* UGH! */ - n_routines = BigEndianValue (rp->routineCount) + 1; + n_routines = CW (rp->routineCount) + 1; for (i = 0; i < n_routines && rp->routineRecords[i].ISA != CBC (kPowerPCISA); ++i) @@ -3058,7 +3057,7 @@ STUB (modeswitch) return retaddr; } - procinfo = BigEndianValue (rp->routineRecords[i].procInfo); + procinfo = CL (rp->routineRecords[i].procInfo); convention = procinfo & 0xf; if (convention == kRegisterBased) diff --git a/src/emutrap.cpp b/src/emutrap.cpp index 0fd46aa4..e4762ca7 100644 --- a/src/emutrap.cpp +++ b/src/emutrap.cpp @@ -362,7 +362,7 @@ CToRoutineDescriptorCall (const RoutineDescriptor *p, unsigned long long magic, case 2: { arg = (uint16) va_arg (ap, unsigned long); - arg = BigEndianValue (arg); + arg = CW (arg); procinfo |= STACK_ROUTINE_PARAMETER (n_args, kTwoByteCode); } break; @@ -372,15 +372,15 @@ CToRoutineDescriptorCall (const RoutineDescriptor *p, unsigned long long magic, #if defined (powerpc) arg = *(uint32 *)arg; #endif - arg = (BigEndianValue ((uint16) arg) | - (BigEndianValue (arg >> 16) << 16)); + arg = (CW ((uint16) arg) | + (CW (arg >> 16) << 16)); procinfo |= STACK_ROUTINE_PARAMETER (n_args, kFourByteCode); } break; case 4: { arg = (uint32) va_arg (ap, unsigned long); - arg = BigEndianValue (arg); + arg = CL (arg); procinfo |= STACK_ROUTINE_PARAMETER (n_args, kFourByteCode); } break; @@ -466,10 +466,10 @@ CToRoutineDescriptorCall (const RoutineDescriptor *p, unsigned long long magic, retval = CB (retval); break; case 2: - retval = BigEndianValue (retval); + retval = CW (retval); break; case 4: - retval = BigEndianValue (retval); + retval = CL (retval); break; case 5: retval = (long) SYN68K_TO_US_CHECK0_CHECKNEG1 (retval); diff --git a/src/executor.cpp b/src/executor.cpp index 8ea2fe4b..33b92360 100644 --- a/src/executor.cpp +++ b/src/executor.cpp @@ -59,7 +59,6 @@ char ROMlib_rcsid_executor[] = #define PUBLIC using namespace Executor; -using namespace ByteSwap; #define FASTALINETRAPS @@ -592,7 +591,7 @@ PUBLIC void Executor::executor_main( void ) SoundBase = RM(NewPtr(370 * sizeof(INTEGER))); #if 0 - memset(BigEndianValue(SoundBase), 0, (LONGINT) 370 * sizeof(INTEGER)); + memset(CL(SoundBase), 0, (LONGINT) 370 * sizeof(INTEGER)); #else /* !0 */ for (i = 0; i < 370; ++i) ((INTEGER *) MR(SoundBase))[i] = CWC (0x8000); /* reference 0 sound */ @@ -603,7 +602,7 @@ PUBLIC void Executor::executor_main( void ) ROM85 = CWC(0x3FFF); a5 = US_TO_SYN68K((LONGINT) &tmpA5); - CurrentA5 = (Ptr) BigEndianValue(a5); + CurrentA5 = (Ptr) CL(a5); InitGraf((Ptr) quickbytes + sizeof(quickbytes) - 4); InitFonts(); InitCRM (); @@ -625,7 +624,7 @@ PUBLIC void Executor::executor_main( void ) memcpy(FinderName+1, BROWSER_NAME, FinderName[0]); CountAppFiles(&mess, &count); - count = BigEndianValue (count); + count = CW (count); if (count > 0) GetAppFiles(1, &thefile); else @@ -662,8 +661,8 @@ PUBLIC void Executor::executor_main( void ) if (count > 0) { p = ROMlib_find_best_creator_type_match - (BigEndianValue (hpb.hFileInfo.ioFlFndrInfo.fdCreator), - BigEndianValue (hpb.hFileInfo.ioFlFndrInfo.fdType)); + (CL (hpb.hFileInfo.ioFlFndrInfo.fdCreator), + CL (hpb.hFileInfo.ioFlFndrInfo.fdType)); } else { @@ -709,11 +708,11 @@ PUBLIC void Executor::executor_main( void ) wdpb.ioVRefNum = hpb.hFileInfo.ioVRefNum; wdpb.ioWDDirID = hpb.hFileInfo.ioFlParID; - SFSaveDisk_Update (BigEndianValue (hpb.hFileInfo.ioVRefNum), fName); + SFSaveDisk_Update (CW (hpb.hFileInfo.ioVRefNum), fName); CurDirStore = hpb.hFileInfo.ioFlParID; wdpb.ioWDProcID = CLC (T('X','c','t','r')); wdpb.ioNamePtr = 0; PBOpenWD(&wdpb, FALSE); - exevrefnum = BigEndianValue(wdpb.ioVRefNum); + exevrefnum = CW(wdpb.ioVRefNum); Launch (CurApName, exevrefnum); } diff --git a/src/fauxdbm.c b/src/fauxdbm.cpp similarity index 100% rename from src/fauxdbm.c rename to src/fauxdbm.cpp diff --git a/src/fileAccess.cpp b/src/fileAccess.cpp index 37023015..45c5ffe6 100644 --- a/src/fileAccess.cpp +++ b/src/fileAccess.cpp @@ -143,12 +143,12 @@ A3(PUBLIC, OSErr, FSOpen, StringPtr, filen, INTEGER, vrn, /* IMIV-109 */ OSErr temp; pbr.ioParam.ioNamePtr = RM(filen); - pbr.ioParam.ioVRefNum = BigEndianValue(vrn); + pbr.ioParam.ioVRefNum = CW(vrn); pbr.ioParam.ioVersNum = 0; pbr.ioParam.ioPermssn = fsCurPerm; pbr.ioParam.ioMisc = 0; temp = PBOpen(&pbr, 0); - *rn = BigEndianValue(pbr.ioParam.ioRefNum); + *rn = CW(pbr.ioParam.ioRefNum); fs_err_hook (temp); return(temp); } @@ -160,12 +160,12 @@ A3(PUBLIC, OSErr, OpenRF, StringPtr, filen, INTEGER, vrn, /* IMIV-109 */ OSErr temp; pbr.ioParam.ioNamePtr = RM(filen); - pbr.ioParam.ioVRefNum = BigEndianValue(vrn); + pbr.ioParam.ioVRefNum = CW(vrn); pbr.ioParam.ioVersNum = 0; pbr.ioParam.ioPermssn = fsCurPerm; pbr.ioParam.ioMisc = 0; temp = PBOpenRF(&pbr, 0); - *rn = BigEndianValue(pbr.ioParam.ioRefNum); + *rn = CW(pbr.ioParam.ioRefNum); fs_err_hook (temp); return(temp); } @@ -176,12 +176,12 @@ A3(PUBLIC, OSErr, FSRead, INTEGER, rn, LONGINT *, count, /* IMIV-109 */ ParamBlockRec pbr; OSErr temp; - pbr.ioParam.ioRefNum = BigEndianValue(rn); + pbr.ioParam.ioRefNum = CW(rn); pbr.ioParam.ioBuffer = RM(buffp); - pbr.ioParam.ioReqCount = BigEndianValue(*count); + pbr.ioParam.ioReqCount = CL(*count); pbr.ioParam.ioPosMode = CWC(fsAtMark); temp = PBRead(&pbr, 0); - *count = BigEndianValue(pbr.ioParam.ioActCount); + *count = CL(pbr.ioParam.ioActCount); fs_err_hook (temp); return(temp); } @@ -205,12 +205,12 @@ A3(PUBLIC, OSErr, FSWrite, INTEGER, rn, LONGINT *, count, /* IMIV-110 */ ParamBlockRec pbr; OSErr temp; - pbr.ioParam.ioRefNum = BigEndianValue(rn); + pbr.ioParam.ioRefNum = CW(rn); pbr.ioParam.ioBuffer = RM(buffp); - pbr.ioParam.ioReqCount = BigEndianValue(*count); + pbr.ioParam.ioReqCount = CL(*count); pbr.ioParam.ioPosMode = CWC(fsAtMark); temp = PBWrite(&pbr, 0); - *count = BigEndianValue(pbr.ioParam.ioActCount); + *count = CL(pbr.ioParam.ioActCount); fs_err_hook (temp); return(temp); } @@ -233,9 +233,9 @@ A2(PUBLIC, OSErr, GetFPos, INTEGER, rn, LONGINT *, filep) /* IMIV-110 */ ParamBlockRec pbr; OSErr temp; - pbr.ioParam.ioRefNum = BigEndianValue(rn); + pbr.ioParam.ioRefNum = CW(rn); temp = PBGetFPos(&pbr, 0); - *filep = BigEndianValue(pbr.ioParam.ioPosOffset); + *filep = CL(pbr.ioParam.ioPosOffset); fs_err_hook (temp); return(temp); } @@ -246,8 +246,8 @@ A3(PUBLIC, OSErr, SetFPos, INTEGER, rn, INTEGER, posmode, /* IMIV-110 */ ParamBlockRec pbr; OSErr err; - pbr.ioParam.ioRefNum = BigEndianValue(rn); - pbr.ioParam.ioPosMode = BigEndianValue(posmode); + pbr.ioParam.ioRefNum = CW(rn); + pbr.ioParam.ioPosMode = CW(posmode); pbr.ioParam.ioPosOffset = Cx(possoff); err = PBSetFPos(&pbr, 0); fs_err_hook (err); @@ -261,7 +261,7 @@ A2(PUBLIC, OSErr, GetEOF, INTEGER, rn, LONGINT *, eof) /* IMIV-111 */ pbr.ioParam.ioRefNum = Cx(rn); temp = PBGetEOF(&pbr, 0); - *eof = BigEndianValue(pbr.ioParam.ioMisc); + *eof = CL(pbr.ioParam.ioMisc); fs_err_hook (temp); return(temp); } @@ -286,7 +286,7 @@ A2(PUBLIC, OSErr, Allocate, INTEGER, rn, LONGINT *, count) /* IMIV-112 */ pbr.ioParam.ioRefNum = Cx(rn); pbr.ioParam.ioReqCount = *count; temp = PBAllocate(&pbr, 0); - *count = BigEndianValue(pbr.ioParam.ioActCount); + *count = CL(pbr.ioParam.ioActCount); fs_err_hook (temp); return(temp); } @@ -299,7 +299,7 @@ A2(PUBLIC, OSErr, AllocContig, INTEGER, rn, LONGINT *, count) pbr.ioParam.ioRefNum = Cx(rn); pbr.ioParam.ioReqCount = *count; temp = PBAllocContig(&pbr, 0); - *count = BigEndianValue(pbr.ioParam.ioActCount); + *count = CL(pbr.ioParam.ioActCount); fs_err_hook (temp); return(temp); } @@ -599,7 +599,7 @@ A5(PUBLIC, VCB *, ROMlib_breakoutioname, ParmBlkPtr, pb, /* INTERNAL */ else if (v < 0) { if (ISWDNUM(v)) { wdp = WDNUMTOWDP(v); - *diridp = BigEndianValue(wdp->dirid); + *diridp = CL(wdp->dirid); retval = MR(wdp->vcbp); } else retval = ROMlib_vcbbyvrn(v); @@ -607,7 +607,7 @@ A5(PUBLIC, VCB *, ROMlib_breakoutioname, ParmBlkPtr, pb, /* INTERNAL */ if (!retval && (usedefault || (!pb->ioParam.ioNamePtr && !pb->ioParam.ioVRefNum))) { retval = MR(DefVCBPtr); - *diridp = BigEndianValue(DefDirID); + *diridp = CL(DefDirID); } } return retval; @@ -1069,7 +1069,7 @@ static int n = 0; *pprn = 2 + 94 * n++; return noErr; #endif - length =BigEndianValue( *(short *)MR(FCBSPtr)); + length =CW( *(short *)MR(FCBSPtr)); fcbp = (fcbrec *) ((short *)MR(FCBSPtr)+1); efcbp = (fcbrec *) ((char *)MR(FCBSPtr) + length); for (;fcbp < efcbp && fcbp->fdfnum; @@ -1115,7 +1115,7 @@ A4(PRIVATE, OSErr, PBOpenForkD, ParmBlkPtr, pb, BOOLEAN, a, err = getprn(&prn); if (err == noErr) { fp = (fcbrec *) (MR(FCBSPtr) + prn); - fp->fdfnum = BigEndianValue((LONGINT) ST_INO(sbuf)); + fp->fdfnum = CL((LONGINT) ST_INO(sbuf)); fp->fcfd = -1; fp->fcflags = 0; fp->fcbTypByt = 0; @@ -1133,7 +1133,7 @@ A4(PRIVATE, OSErr, PBOpenForkD, ParmBlkPtr, pb, BOOLEAN, a, if (ST_INO(sbuf) == vcbp->u.ufs.ino) /* the stat for us */ fp->fcparid = CLC (2); else - fp->fcparid = BigEndianValue((LONGINT) ST_INO(sbuf)); + fp->fcparid = CL((LONGINT) ST_INO(sbuf)); filename[save_index] = save_char; if (fork == ResourceFork) { newname = ROMlib_resname(pathname, filename, endname); @@ -1191,7 +1191,7 @@ A4(PRIVATE, OSErr, PBOpenForkD, ParmBlkPtr, pb, BOOLEAN, a, if (err == noErr) err = ROMlib_geteofostype(fp); fp->fcvptr = RM((VCB *) vcbp); - pb->ioParam.ioRefNum = BigEndianValue(prn); + pb->ioParam.ioRefNum = CW(prn); namelen = strlen (filename); namelen -= ROMlib_UNIX7_to_Mac (filename, namelen); namelen = MIN(namelen, 31); @@ -1227,7 +1227,7 @@ A2(PUBLIC, OSErr, ufsPBHOpen, HParmBlkPtr, pb, /* INTERNAL */ { OSErr err; - err = PBOpenForkD((ParmBlkPtr) pb, a, DataFork, BigEndianValue(pb->fileParam.ioDirID)); + err = PBOpenForkD((ParmBlkPtr) pb, a, DataFork, CL(pb->fileParam.ioDirID)); fs_err_hook (err); return err; } @@ -1282,7 +1282,7 @@ A2(PUBLIC, OSErr, ufsPBHOpenRF, HParmBlkPtr, pb, /* INTERNAL */ OSErr err; err = PBOpenForkD((ParmBlkPtr) pb, a, ResourceFork, - BigEndianValue(pb->fileParam.ioDirID)); + CL(pb->fileParam.ioDirID)); fs_err_hook (err); return err; } @@ -1391,7 +1391,7 @@ A3(PRIVATE, OSErr, PBLockUnlockRange, ParmBlkPtr, pb, BOOLEAN, a, err = ROMlib_maperrno(); if (err == noErr) err = ROMlib_lockunlockrange (fd, toseek, - BigEndianValue (pb->ioParam.ioReqCount), op); + CL (pb->ioParam.ioReqCount), op); if (err == noErr) err = cleanup (fd, toseek, BigEndianValue (pb->ioParam.ioReqCount)); lseek(fd, curseek, SEEK_SET); @@ -1488,8 +1488,8 @@ A2(PUBLIC, OSErr, ufsPBRead, ParmBlkPtr, pb, BOOLEAN, a) /* INTERNAL */ if (pb->ioParam.ioRefNum == 0x5003) { printf ("read IN mode = %d, offset = %5d, req = %5d\n", - BigEndianValue (pb->ioParam.ioPosMode), - BigEndianValue (pb->ioParam.ioPosOffset), BigEndianValue (pb->ioParam.ioReqCount)); + CW (pb->ioParam.ioPosMode), + CL (pb->ioParam.ioPosOffset), CL (pb->ioParam.ioReqCount)); } #endif @@ -1531,9 +1531,9 @@ A2(PUBLIC, OSErr, ufsPBRead, ParmBlkPtr, pb, BOOLEAN, a) /* INTERNAL */ if (pb->ioParam.ioRefNum == 0x5003) { printf ("read OUT mode = %d, offset = %5d, req = %5d, act = %d, err = %d\n", - BigEndianValue (pb->ioParam.ioPosMode), - BigEndianValue (pb->ioParam.ioPosOffset), BigEndianValue (pb->ioParam.ioReqCount), - BigEndianValue (pb->ioParam.ioActCount), + CW (pb->ioParam.ioPosMode), + CL (pb->ioParam.ioPosOffset), CL (pb->ioParam.ioReqCount), + CL (pb->ioParam.ioActCount), err); } #endif @@ -1567,7 +1567,7 @@ A2(PUBLIC, OSErr, ufsPBWrite, ParmBlkPtr, pb, BOOLEAN, a) /* INTERNAL */ #endif /* SUN */ #endif /* WEHAVEENOUGHSWAPSPACETORUNSUNSGOOFYLITTLERPCTHINGYS */ if (err == noErr && Cx(pb->ioParam.ioPosOffset) + rc > Cx(fp->fcleof)) { - fp->fcleof = BigEndianValue(BigEndianValue(pb->ioParam.ioPosOffset) + rc); + fp->fcleof = CL(CL(pb->ioParam.ioPosOffset) + rc); err = ROMlib_seteof(fp); } if (err == noErr) { @@ -1625,8 +1625,8 @@ A2(PUBLIC, OSErr, ufsPBSetFPos, ParmBlkPtr, pb, /* INTERNAL */ if (pb->ioParam.ioRefNum == 0x5003) { printf ("seek IN mode = %d, offset = %5d\n", - BigEndianValue (pb->ioParam.ioPosMode), - BigEndianValue (pb->ioParam.ioPosOffset)); + CW (pb->ioParam.ioPosMode), + CL (pb->ioParam.ioPosOffset)); } #endif @@ -1637,8 +1637,8 @@ A2(PUBLIC, OSErr, ufsPBSetFPos, ParmBlkPtr, pb, /* INTERNAL */ if (pb->ioParam.ioRefNum == 0x5003) { printf ("seek OUT mode = %d, offset = %5d, err = %d\n", - BigEndianValue (pb->ioParam.ioPosMode), - BigEndianValue (pb->ioParam.ioPosOffset), err); + CW (pb->ioParam.ioPosMode), + CL (pb->ioParam.ioPosOffset), err); } #endif return err; @@ -1678,7 +1678,7 @@ A2(PUBLIC, OSErr, ufsPBAllocate, ParmBlkPtr, pb, /* INTERNAL */ fp = PRNTOFPERR(Cx(pb->ioParam.ioRefNum), &err); if (err == noErr) { - fp->fcleof = BigEndianValue(BigEndianValue(fp->fcleof) + BigEndianValue(pb->ioParam.ioReqCount)); + fp->fcleof = CL(CL(fp->fcleof) + CL(pb->ioParam.ioReqCount)); err = ROMlib_seteof(fp); pb->ioParam.ioActCount = pb->ioParam.ioReqCount; } diff --git a/src/fileCreate.cpp b/src/fileCreate.cpp index 1be77b0c..a3f8e097 100644 --- a/src/fileCreate.cpp +++ b/src/fileCreate.cpp @@ -22,7 +22,6 @@ char ROMlib_rcsid_fileCreate[] = #include "rsys/suffix_maps.h" using namespace Executor; -using namespace ByteSwap; A4(PUBLIC, OSErr, Create, StringPtr, filen, INTEGER, vrn, /* IMIV-112 */ OSType, creator, OSType, filtyp) @@ -32,15 +31,15 @@ A4(PUBLIC, OSErr, Create, StringPtr, filen, INTEGER, vrn, /* IMIV-112 */ LONGINT t; pbr.fileParam.ioNamePtr = RM(filen); - pbr.fileParam.ioVRefNum = BigEndianValue(vrn); + pbr.fileParam.ioVRefNum = CW(vrn); pbr.fileParam.ioFVersNum = 0; temp = PBCreate(&pbr, 0); if (temp != noErr) return(temp); - OSASSIGN(pbr.fileParam.ioFlFndrInfo.fdType, BigEndianValue(filtyp)); - OSASSIGN(pbr.fileParam.ioFlFndrInfo.fdCreator, BigEndianValue(creator)); + OSASSIGN(pbr.fileParam.ioFlFndrInfo.fdType, CL(filtyp)); + OSASSIGN(pbr.fileParam.ioFlFndrInfo.fdCreator, CL(creator)); pbr.fileParam.ioFlFndrInfo.fdFlags = 0; ZEROPOINT(pbr.fileParam.ioFlFndrInfo.fdLocation); pbr.fileParam.ioFlFndrInfo.fdFldr = 0; @@ -64,7 +63,7 @@ A2(PUBLIC, OSErr, FSDelete, StringPtr, filen, INTEGER, vrn) /* IMIV-113 */ ParamBlockRec pbr; pbr.fileParam.ioNamePtr = RM(filen); - pbr.fileParam.ioVRefNum = BigEndianValue(vrn); + pbr.fileParam.ioVRefNum = CW(vrn); pbr.fileParam.ioFVersNum = 0; return(PBDelete(&pbr, 0)); } @@ -96,7 +95,7 @@ A4(PRIVATE, OSErr, PBCreateForD, ParmBlkPtr, pb, BOOLEAN, a, if (fd >= 0) { dirid = 0; ROMlib_dbm_store(vcbp, pathname, &dirid, TRUE); - ((HParmBlkPtr) pb)->fileParam.ioDirID = BigEndianValue(dirid); + ((HParmBlkPtr) pb)->fileParam.ioDirID = CL(dirid); } } @@ -139,7 +138,7 @@ A4(PRIVATE, OSErr, PBCreateForD, ParmBlkPtr, pb, BOOLEAN, a, sizeof(newparam.fileParam.ioFlCrDat)); memset(&newparam.fileParam.ioFlMdDat, 0, sizeof(newparam.fileParam.ioFlMdDat)); - swapped_dir = BigEndianValue(dir); + swapped_dir = CL(dir); if (!ROMlib_creator_and_type_from_filename (strlen (pathname), pathname, NULL, NULL)) ROMlib_PBGetSetFInfoD(&newparam, FALSE, Set, &swapped_dir, FALSE); diff --git a/src/fileDouble.cpp b/src/fileDouble.cpp index 82f26d43..96106aba 100644 --- a/src/fileDouble.cpp +++ b/src/fileDouble.cpp @@ -23,11 +23,11 @@ namespace Executor { }; int afpd_conventions_p; int netatalk_conventions_p; - char apple_double_quote_char; const char *apple_double_fork_prefix; int apple_double_fork_prefix_length; } + using namespace Executor; using namespace ByteSwap; @@ -251,7 +251,7 @@ A5(PRIVATE, BOOLEAN, getsetentry, GetOrSetType, gors, LONGINT, fd, *lengthp = 0x7FFFFFFF; /* unlimited */ } else if (lengthp) - *lengthp = BigEndianValue(sdp[1].offset) - BigEndianValue(sdp[0].offset); + *lengthp = CL(sdp[1].offset) - CL(sdp[0].offset); break; case Set: *sdp = *savesdp; @@ -281,7 +281,7 @@ A1(PUBLIC, LONGINT, ROMlib_FORKOFFSET, fcbrec *, fp) /* INTERNAL */ /*-->*/ return 0L; idwanted = IDWANTED(fp); if (getsetentry(Get, fp->fcfd, IDWANTED(fp), &d, NULL)) - return BigEndianValue(d.offset); + return CL(d.offset); else return RESOURCEPREAMBLE; } @@ -318,7 +318,7 @@ A1(PUBLIC, OSErr, ROMlib_seteof, fcbrec *, fp) /* INTERNAL */ gui_assert(0); /* TODO: We need to move stuff around. There are many things we could do */ } else if (leof < peof) { - d.length = BigEndianValue(leof); + d.length = CL(leof); getsetentry(Set, fd, idwanted, &d, NULL); } } else @@ -346,8 +346,8 @@ A1(PUBLIC, OSErr, ROMlib_seteof, fcbrec *, fp) /* INTERNAL */ ROMlib_fcblocks[i].fcvptr == fp->fcvptr && (ROMlib_fcblocks[i].fcflags & fcfisres) == (fp->fcflags & fcfisres)) { - ROMlib_fcblocks[i].fcleof = BigEndianValue(leof); - ROMlib_fcblocks[i].fcPLen = BigEndianValue(peof); + ROMlib_fcblocks[i].fcleof = CL(leof); + ROMlib_fcblocks[i].fcPLen = CL(peof); } } } @@ -400,7 +400,7 @@ A1(PUBLIC, OSErr, ROMlib_geteofostype, fcbrec *, fp) /* INTERNAL */ else fp->fcPLen = fp->fcleof = d.length; } else - fp->fcleof = fp->fcPLen = BigEndianValue((int)sbuf.st_size); + fp->fcleof = fp->fcPLen = CL((int)sbuf.st_size); if (err == noErr) { if (!getsetentry(Get, fd, Finder_Info_ID, &d, NULL) || (!getsetpiece(Get, fd, &d, (char *) &finfo, sizeof(finfo)))) @@ -409,7 +409,7 @@ A1(PUBLIC, OSErr, ROMlib_geteofostype, fcbrec *, fp) /* INTERNAL */ if (ROMlib_creator_and_type_from_filename (fp->fcname[0], (char *) fp->fcname+1, NULL, &type)) - fp->fcbFType = BigEndianValue (type); + fp->fcbFType = CL (type); else fp->fcbFType = TICKX("TEXT"); } @@ -453,7 +453,7 @@ fprintf(stderr, "%s(%d): open '%s' fails\n", __FILE__, __LINE__, rpathname); memset(datep, 0, sizeof(*datep)); memset(finfop, 0, sizeof(*finfop)); memset(fxinfop, 0, sizeof(*fxinfop)); - *lenp = BigEndianValue((int)sbuf.st_size); + *lenp = CL((int)sbuf.st_size); *rlenp = 0; break; case Set: @@ -474,9 +474,9 @@ fprintf(stderr, "%s(%d): open '%s' fails\n", __FILE__, __LINE__, rpathname); getsetpiece(Get, rfd, &d, (char *) datep, sizeof(*datep)); else { - datep->crdat = BigEndianValue (UNIXTIMETOMACTIME (MIN (sbuf.st_ctime, sbuf.st_mtime))); - datep->moddat = BigEndianValue (UNIXTIMETOMACTIME (sbuf.st_mtime)); - datep->accessdat = BigEndianValue (UNIXTIMETOMACTIME (sbuf.st_atime)); + datep->crdat = CL (UNIXTIMETOMACTIME (MIN (sbuf.st_ctime, sbuf.st_mtime))); + datep->moddat = CL (UNIXTIMETOMACTIME (sbuf.st_mtime)); + datep->accessdat = CL (UNIXTIMETOMACTIME (sbuf.st_atime)); datep->backupdat = 0; } @@ -491,7 +491,7 @@ fprintf(stderr, "%s(%d): open '%s' fails\n", __FILE__, __LINE__, rpathname); if (fxinfop) *fxinfop = sfinfo.fxinfo; - *lenp = BigEndianValue((int)sbuf.st_size); + *lenp = CL((int)sbuf.st_size); } if (getsetentry(Get, rfd, Resource_Fork_ID, &d, NULL)) *rlenp = d.length; diff --git a/src/fileHighlevel.cpp b/src/fileHighlevel.cpp index 5dc45a1e..fce4aee8 100644 --- a/src/fileHighlevel.cpp +++ b/src/fileHighlevel.cpp @@ -26,7 +26,6 @@ char ROMlib_rcsid_fileHighlevel[] = #include "rsys/executor.h" using namespace Executor; -using namespace ByteSwap; /* * extract the last component of a name: @@ -85,7 +84,7 @@ P4 (PUBLIC pascal trap, OSErr, FSMakeFSSpec, str255assign (local_file_name, file_name); hpb.volumeParam.ioNamePtr = (StringPtr) RM ((Ptr) local_file_name); - hpb.volumeParam.ioVRefNum = BigEndianValue (vRefNum); + hpb.volumeParam.ioVRefNum = CW (vRefNum); if (file_name[0]) hpb.volumeParam.ioVolIndex = CLC (-1); else @@ -99,12 +98,12 @@ P4 (PUBLIC pascal trap, OSErr, FSMakeFSSpec, str255assign (local_file_name, file_name); cpb.hFileInfo.ioNamePtr = (StringPtr) RM ((Ptr) local_file_name); - cpb.hFileInfo.ioVRefNum = BigEndianValue (vRefNum); + cpb.hFileInfo.ioVRefNum = CW (vRefNum); if (file_name[0]) cpb.hFileInfo.ioFDirIndex = CWC (0); else cpb.hFileInfo.ioFDirIndex = CWC (-1); - cpb.hFileInfo.ioDirID = BigEndianValue (dir_id); + cpb.hFileInfo.ioDirID = CL (dir_id); retval = PBGetCatInfo (&cpb, FALSE); if (retval == noErr) { @@ -117,16 +116,16 @@ P4 (PUBLIC pascal trap, OSErr, FSMakeFSSpec, OSErr err; cpb.hFileInfo.ioNamePtr = (StringPtr)CLC (0); - cpb.hFileInfo.ioVRefNum = BigEndianValue (vRefNum); + cpb.hFileInfo.ioVRefNum = CW (vRefNum); cpb.hFileInfo.ioFDirIndex = CWC (-1); - cpb.hFileInfo.ioDirID = BigEndianValue (dir_id); + cpb.hFileInfo.ioDirID = CL (dir_id); err = PBGetCatInfo (&cpb, FALSE); if (err == noErr) { if (cpb.hFileInfo.ioFlAttrib & ATTRIB_ISADIR) { spec->vRefNum = hpb.volumeParam.ioVRefNum; - spec->parID = BigEndianValue (dir_id); + spec->parID = CL (dir_id); extract_name ((StringPtr) spec->name, file_name); } else @@ -175,18 +174,18 @@ get_fcb_info (FSSpecPtr fsp) retval = 0; swapped_vrefnum = fsp->vRefNum; - swapped_fnum = BigEndianValue (get_file_num (fsp)); + swapped_fnum = CL (get_file_num (fsp)); - fcbsptr = (char *) BigEndianValue (FCBSPtr); - total_length = BigEndianValue(*(short *)fcbsptr); - fcbp = (filecontrolblock *) ((short *)BigEndianValue(FCBSPtr)+1); - efcbp = (filecontrolblock *) ((char *)BigEndianValue(FCBSPtr) + total_length); - fcb_size = BigEndianValue (FSFCBLen); + fcbsptr = (char *) CL (FCBSPtr); + total_length = CW(*(short *)fcbsptr); + fcbp = (filecontrolblock *) ((short *)CL(FCBSPtr)+1); + efcbp = (filecontrolblock *) ((char *)CL(FCBSPtr) + total_length); + fcb_size = CW (FSFCBLen); for (;fcbp < efcbp; fcbp = (filecontrolblock *) ((char *)fcbp + fcb_size)) { HVCB *vptr; - vptr = BigEndianValue (fcbp->fcbVPtr); + vptr = CL (fcbp->fcbVPtr); if (vptr && vptr->vcbVRefNum == swapped_vrefnum && fcbp->fcbFlNum == swapped_fnum) { @@ -254,7 +253,7 @@ restore_fcb (const save_fcb_info_t *infop) { char *fcbsptr; - fcbsptr = (char *) BigEndianValue (FCBSPtr); + fcbsptr = (char *) CL (FCBSPtr); if (infop) { if (infop->refnum) @@ -293,7 +292,7 @@ create_temp_name (Str63 name, int i) err = GetCurrentProcess (&psn); if (err == noErr) sprintf ((char *) name+1, - "%x%x.%x", BigEndianValue (psn.highLongOfPSN), BigEndianValue (psn.lowLongOfPSN), i); + "%x%x.%x", CL (psn.highLongOfPSN), CL (psn.lowLongOfPSN), i); else sprintf ((char *) name+1, "%d.%x", err, i); name[0] = strlen ((char *) name+1); @@ -421,7 +420,7 @@ P4 (PUBLIC pascal trap, OSErr, FSpCreate, { OSErr retval; - retval = HCreate (BigEndianValue (spec->vRefNum), BigEndianValue (spec->parID), spec->name, + retval = HCreate (CW (spec->vRefNum), CL (spec->parID), spec->name, creator, file_type); return retval; } @@ -557,7 +556,7 @@ P4 (PUBLIC pascal trap, void, FSpCreateResFile, FSSpecPtr, spec, OSType, creator, OSType, file_type, ScriptCode, script) { - HCreateResFile_helper (BigEndianValue (spec->vRefNum), BigEndianValue (spec->parID), + HCreateResFile_helper (CW (spec->vRefNum), CL (spec->parID), spec->name, creator, file_type, script); } @@ -567,7 +566,7 @@ P2 (PUBLIC pascal trap, INTEGER, FSpOpenResFile, { INTEGER retval; - retval = HOpenResFile (BigEndianValue (spec->vRefNum), BigEndianValue (spec->parID), spec->name, + retval = HOpenResFile (CW (spec->vRefNum), CL (spec->parID), spec->name, perms); return retval; } @@ -583,8 +582,8 @@ Executor::HCreate (INTEGER vref, LONGINT dirid, Str255 name, OSType creator, OST OSErr retval; hpb.fileParam.ioNamePtr = RM (name); - hpb.fileParam.ioVRefNum = BigEndianValue (vref); - hpb.fileParam.ioDirID = BigEndianValue (dirid); + hpb.fileParam.ioVRefNum = CW (vref); + hpb.fileParam.ioDirID = CL (dirid); retval = PBHCreate (&hpb, FALSE); if (retval == noErr) { @@ -592,9 +591,9 @@ Executor::HCreate (INTEGER vref, LONGINT dirid, Str255 name, OSType creator, OST retval = PBHGetFInfo (&hpb, FALSE); if (retval == noErr) { - hpb.fileParam.ioFlFndrInfo.fdCreator = BigEndianValue (creator); - hpb.fileParam.ioFlFndrInfo.fdType = BigEndianValue (type); - hpb.fileParam.ioDirID = BigEndianValue (dirid); + hpb.fileParam.ioFlFndrInfo.fdCreator = CL (creator); + hpb.fileParam.ioFlFndrInfo.fdType = CL (type); + hpb.fileParam.ioDirID = CL (dirid); retval = PBHSetFInfo (&hpb, FALSE); } } @@ -609,12 +608,12 @@ Executor::HOpenRF (INTEGER vref, LONGINT dirid, Str255 name, SignedByte perm, OSErr retval; hpb.fileParam.ioNamePtr = RM (name); - hpb.fileParam.ioVRefNum = BigEndianValue (vref); + hpb.fileParam.ioVRefNum = CW (vref); hpb.ioParam.ioPermssn = CB (perm); hpb.ioParam.ioMisc = CLC (0); - hpb.fileParam.ioDirID = BigEndianValue (dirid); + hpb.fileParam.ioDirID = CL (dirid); retval = PBHOpenRF (&hpb, FALSE); if (retval == noErr) - *refp = BigEndianValue (hpb.ioParam.ioRefNum); + *refp = CW (hpb.ioParam.ioRefNum); return retval; } diff --git a/src/fileInfo.cpp b/src/fileInfo.cpp index 7d95ec26..c15a2ba2 100644 --- a/src/fileInfo.cpp +++ b/src/fileInfo.cpp @@ -26,7 +26,6 @@ char ROMlib_rcsid_fileInfo[] = #include using namespace Executor; -using namespace ByteSwap; #if 0 #if defined (CYGWIN32) @@ -58,7 +57,7 @@ A3 (PUBLIC, OSErr, GetFInfo, StringPtr, filen, INTEGER, vrn, /* IMIV-113 */ OSErr temp; pbr.fileParam.ioNamePtr = RM (filen); - pbr.fileParam.ioVRefNum = BigEndianValue (vrn); + pbr.fileParam.ioVRefNum = CW (vrn); pbr.fileParam.ioFVersNum = 0; pbr.fileParam.ioFDirIndex = CWC (0); temp = PBGetFInfo (&pbr, 0); @@ -81,8 +80,8 @@ PUBLIC OSErr HGetFInfo (INTEGER vref, LONGINT dirid, Str255 name, memset (&pbr, 0, sizeof pbr); pbr.fileParam.ioNamePtr = RM (name); - pbr.fileParam.ioVRefNum = BigEndianValue (vref); - pbr.fileParam.ioDirID = BigEndianValue (dirid); + pbr.fileParam.ioVRefNum = CW (vref); + pbr.fileParam.ioDirID = CL (dirid); retval = PBHGetFInfo (&pbr, FALSE); if (retval == noErr) { @@ -104,7 +103,7 @@ A3(PUBLIC, OSErr, SetFInfo, StringPtr, filen, INTEGER, vrn, /* IMIV-114 */ LONGINT t; pbr.fileParam.ioNamePtr = RM(filen); - pbr.fileParam.ioVRefNum = BigEndianValue(vrn); + pbr.fileParam.ioVRefNum = CW(vrn); pbr.fileParam.ioFVersNum = 0; pbr.fileParam.ioFDirIndex = CWC (0); temp = PBGetFInfo(&pbr, 0); @@ -128,7 +127,7 @@ A2(PUBLIC, OSErr, SetFLock, StringPtr, filen, INTEGER, vrn) /* IMIV-114 */ ParamBlockRec pbr; pbr.fileParam.ioNamePtr = RM(filen); - pbr.fileParam.ioVRefNum = BigEndianValue(vrn); + pbr.fileParam.ioVRefNum = CW(vrn); pbr.fileParam.ioFVersNum = 0; return(PBSetFLock(&pbr, 0)); } @@ -138,7 +137,7 @@ A2(PUBLIC, OSErr, RstFLock, StringPtr, filen, INTEGER, vrn) /* IMIV-114 */ ParamBlockRec pbr; pbr.fileParam.ioNamePtr = RM(filen); - pbr.fileParam.ioVRefNum = BigEndianValue(vrn); + pbr.fileParam.ioVRefNum = CW(vrn); pbr.fileParam.ioFVersNum = 0; return(PBRstFLock(&pbr, 0)); } @@ -149,7 +148,7 @@ A3(PUBLIC, OSErr, Rename, StringPtr, filen, INTEGER, vrn, /* IMIV-114 */ ParamBlockRec pbr; pbr.ioParam.ioNamePtr = RM(filen); - pbr.ioParam.ioVRefNum = BigEndianValue(vrn); + pbr.ioParam.ioVRefNum = CW(vrn); pbr.ioParam.ioVersNum = 0; pbr.ioParam.ioMisc = RM((LONGINT) (long) newf); return(PBRename(&pbr, 0)); @@ -281,11 +280,11 @@ Executor::open_attrib_bits (LONGINT file_id, VCB *vcbp, INTEGER *refnump) *refnump = 0; for (i = 0; i < NFCB; i++) { - if (BigEndianValue(ROMlib_fcblocks[i].fdfnum) == file_id + if (CL(ROMlib_fcblocks[i].fdfnum) == file_id && MR(ROMlib_fcblocks[i].fcvptr) == vcbp) { if (*refnump == 0) - *refnump = BigEndianValue(i * 94 + 2); + *refnump = CW(i * 94 + 2); if (ROMlib_fcblocks[i].fcflags & fcfisres) retval |= ATTRIB_RESOPEN; else @@ -326,15 +325,15 @@ A5(PUBLIC, OSErr, ROMlib_PBGetSetFInfoD, ParmBlkPtr, pb, /* INTERNAL */ } if (op == Get) { - if (dodirs && (BigEndianValue(pb->fileParam.ioFDirIndex) < 0)) + if (dodirs && (CW(pb->fileParam.ioFDirIndex) < 0)) indext = IGNORENAME; /* IMIV-156 */ - else if (BigEndianValue(pb->fileParam.ioFDirIndex) > 0) + else if (CW(pb->fileParam.ioFDirIndex) > 0) indext = FDirIndex; else indext = NoIndex; } else indext = NoIndex; - if ((err = ROMlib_nami(pb, BigEndianValue(*dir), indext, &pathname, &filename, &endname, + if ((err = ROMlib_nami(pb, CL(*dir), indext, &pathname, &filename, &endname, !dodirs, &vcbp, &datasbuf)) != noErr) /*-->*/ goto theend; rpathname = ROMlib_resname(pathname, filename, endname); @@ -342,7 +341,7 @@ A5(PUBLIC, OSErr, ROMlib_PBGetSetFInfoD, ParmBlkPtr, pb, /* INTERNAL */ LONGINT file_num; file_num = ST_INO (datasbuf); - pb->fileParam.ioFlNum = BigEndianValue (file_num); + pb->fileParam.ioFlNum = CL (file_num); if (S_ISDIR (datasbuf.st_mode)) { LONGINT dirid; @@ -437,12 +436,12 @@ A5(PUBLIC, OSErr, ROMlib_PBGetSetFInfoD, ParmBlkPtr, pb, /* INTERNAL */ ((CInfoPBPtr) pb)->dirInfo.ioDrParID = CLC(1); } else { *dir = ((CInfoPBPtr) pb)->dirInfo.ioDrDirID = - BigEndianValue((LONGINT) ST_INO (datasbuf)); + CL((LONGINT) ST_INO (datasbuf)); if (ST_INO (parentsbuf) == vcbp->u.ufs.ino) ((CInfoPBPtr) pb)->dirInfo.ioDrParID = CLC(2); else ((CInfoPBPtr) pb)->dirInfo.ioDrParID = - BigEndianValue((LONGINT) ST_INO (parentsbuf)); + CL((LONGINT) ST_INO (parentsbuf)); } } else { /* actually what happens here doesn't really matter, since @@ -451,15 +450,15 @@ A5(PUBLIC, OSErr, ROMlib_PBGetSetFInfoD, ParmBlkPtr, pb, /* INTERNAL */ if (ST_INO (datasbuf) == vcbp->u.ufs.ino) { *dir = CLC(2); /* root directory number */ } else - *dir = BigEndianValue((LONGINT) ST_INO (datasbuf)); - pb->fileParam.ioFlNum = BigEndianValue((LONGINT) ST_INO (datasbuf)); + *dir = CL((LONGINT) ST_INO (datasbuf)); + pb->fileParam.ioFlNum = CL((LONGINT) ST_INO (datasbuf)); } } else { if (ST_INO (parentsbuf) == vcbp->u.ufs.ino) *dir = CLC(2); /* root directory number */ else - *dir = BigEndianValue((LONGINT) ST_INO (parentsbuf)); - pb->fileParam.ioFlNum = BigEndianValue((LONGINT) ST_INO (datasbuf)); + *dir = CL((LONGINT) ST_INO (parentsbuf)); + pb->fileParam.ioFlNum = CL((LONGINT) ST_INO (datasbuf)); if (dodirs) { ((CInfoPBPtr) pb)->hFileInfo.ioFlParID = *dir; ((CInfoPBPtr) pb)->hFileInfo.ioFlClpSiz = CLC(512); @@ -480,14 +479,14 @@ A5(PUBLIC, OSErr, ROMlib_PBGetSetFInfoD, ParmBlkPtr, pb, /* INTERNAL */ pathname, &creator, &type)) { - pb->fileParam.ioFlFndrInfo.fdCreator = BigEndianValue (creator); - pb->fileParam.ioFlFndrInfo.fdType = BigEndianValue (type); + pb->fileParam.ioFlFndrInfo.fdCreator = CL (creator); + pb->fileParam.ioFlFndrInfo.fdType = CL (type); } } - pb->fileParam.ioFlLgLen = BigEndianValue((int)datasbuf.st_size); + pb->fileParam.ioFlLgLen = CL(datasbuf.st_size); pb->fileParam.ioFlRLgLen = 0; pb->fileParam.ioFlCrDat = - BigEndianValue(UNIXTIMETOMACTIME(datasbuf.st_ctime)); + CL(UNIXTIMETOMACTIME(datasbuf.st_ctime)); if (dodirs) memset(&((CInfoPBPtr) pb)->hFileInfo.ioFlXFndrInfo, 0, sizeof(((CInfoPBPtr) pb)->hFileInfo.ioFlXFndrInfo)); @@ -506,7 +505,7 @@ A5(PUBLIC, OSErr, ROMlib_PBGetSetFInfoD, ParmBlkPtr, pb, /* INTERNAL */ pb->fileParam.ioFlVersNum = 0; pb->fileParam.ioFlStBlk = -1; /* NOT SUPPORTED */ pb->fileParam.ioFlRStBlk = -1; /* NOT SUPPORTED */ - pb->fileParam.ioFlMdDat = BigEndianValue(UNIXTIMETOMACTIME( + pb->fileParam.ioFlMdDat = CL(UNIXTIMETOMACTIME( MAX(resourcesbuf.st_mtime, datasbuf.st_mtime))); if (dodirs) ((CInfoPBPtr) pb)->hFileInfo.ioFlBkDat = 0; @@ -521,7 +520,7 @@ A5(PUBLIC, OSErr, ROMlib_PBGetSetFInfoD, ParmBlkPtr, pb, /* INTERNAL */ if (ROMlib_creator_and_type_from_filename (strlen (filename), filename, &creator, &type) - && finfo.fdType == BigEndianValue (type) && finfo.fdCreator == BigEndianValue (creator)) + && finfo.fdType == CL (type) && finfo.fdCreator == CL (creator)) err = noErr; else if ((err = ROMlib_hiddenbyname(Set, pathname, rpathname, &dateinfo, &finfo, @@ -535,7 +534,7 @@ A5(PUBLIC, OSErr, ROMlib_PBGetSetFInfoD, ParmBlkPtr, pb, /* INTERNAL */ accessupdatetimes[0].tv_sec = datasbuf.st_atime; accessupdatetimes[0].tv_usec = 0; accessupdatetimes[1].tv_sec = - MACTIMETOGUNIXTIME(BigEndianValue(pb->fileParam.ioFlMdDat)); + MACTIMETOGUNIXTIME(CL(pb->fileParam.ioFlMdDat)); accessupdatetimes[1].tv_usec = 0; Uutimes(pathname, accessupdatetimes); #endif /* MACBLITZ */ @@ -714,7 +713,7 @@ A2(PUBLIC, OSErr, ufsPBSetFLock, ParmBlkPtr, pb, /* INTERNAL */ A2(PUBLIC, OSErr, ufsPBHSetFLock, HParmBlkPtr, /* INTERNAL */ pb, BOOLEAN, a) { - return PBLockUnlock((ParmBlkPtr) pb, a, BigEndianValue(pb->fileParam.ioDirID), Lock); + return PBLockUnlock((ParmBlkPtr) pb, a, CL(pb->fileParam.ioDirID), Lock); } A2(PUBLIC, OSErr, ufsPBRstFLock, ParmBlkPtr, pb, /* INTERNAL */ @@ -726,7 +725,7 @@ A2(PUBLIC, OSErr, ufsPBRstFLock, ParmBlkPtr, pb, /* INTERNAL */ A2(PUBLIC, OSErr, ufsPBHRstFLock, HParmBlkPtr, pb, /* INTERNAL */ BOOLEAN, a) { - return PBLockUnlock((ParmBlkPtr) pb, a, BigEndianValue(pb->fileParam.ioDirID), Unlock); + return PBLockUnlock((ParmBlkPtr) pb, a, CL(pb->fileParam.ioDirID), Unlock); } A2(PUBLIC, OSErr, ufsPBSetFVers, ParmBlkPtr, pb, /* INTERNAL */ @@ -746,7 +745,7 @@ A2(PUBLIC, OSErr, ufsPBRename, ParmBlkPtr, pb, /* INTERNAL */ A2(PUBLIC, OSErr, ufsPBHRename, HParmBlkPtr, pb, /* INTERNAL */ BOOLEAN, a) { - return ROMlib_PBMoveOrRename((ParmBlkPtr) pb, a, BigEndianValue(pb->fileParam.ioDirID), - BigEndianValue(pb->fileParam.ioDirID), (char *) (long) MR(pb->ioParam.ioMisc), + return ROMlib_PBMoveOrRename((ParmBlkPtr) pb, a, CL(pb->fileParam.ioDirID), + CL(pb->fileParam.ioDirID), (char *) (long) MR(pb->ioParam.ioMisc), HRename); } diff --git a/src/fileMisc.cpp b/src/fileMisc.cpp index 450f6292..f11d54d3 100644 --- a/src/fileMisc.cpp +++ b/src/fileMisc.cpp @@ -48,7 +48,6 @@ char ROMlib_rcsid_fileMisc[] = #include using namespace Executor; -using namespace ByteSwap; /* NOTE: calling most of the routines here is a sign that the user may be depending on the internal layout of things a bit too much */ @@ -105,7 +104,7 @@ A2(PUBLIC, OSErr, ufsPBGetFCBInfo, FCBPBPtr, pb, /* INTERNAL */ if (pb->ioNamePtr) str255assign(MR(pb->ioNamePtr), fp->fcname); pb->ioVRefNum = MR(fp->fcvptr)->vcbVRefNum; - pb->ioRefNum = BigEndianValue(rn); + pb->ioRefNum = CW(rn); pb->ioFCBFlNm = fp->fdfnum; pb->ioFCBFlags = (fp->fcflags << 8) | (unsigned char)fp->fcbTypByt; pb->ioFCBStBlk = 0; @@ -192,7 +191,7 @@ Executor::ROMlib_addtodq (ULONGINT drvsize, const char *devicename, INTEGER part dno = 0; for (dp = (DrvQEl *) MR(DrvQHdr.qHead); dp; dp = (DrvQEl *) MR(dp->qLink)) { dqp = (DrvQExtra *) ((char *)dp - sizeof(LONGINT)); - if (dqp->partition == BigEndianValue(partition) && + if (dqp->partition == CW(partition) && slashstrcmp((char *) dqp->devicename, devicename) == 0) { dno = Cx(dqp->dq.dQDrive); /*-->*/ break; @@ -212,21 +211,21 @@ Executor::ROMlib_addtodq (ULONGINT drvsize, const char *devicename, INTEGER part dno = ROMlib_ejdriveno++; } dqp = (DrvQExtra *) NewPtr(sizeof(DrvQExtra)); - dqp->flags = BigEndianValue(1 << 7); /* is not single sided */ + dqp->flags = CL(1 << 7); /* is not single sided */ if (flags & DRIVE_FLAGS_LOCKED) - dqp->flags = BigEndianValue(BigEndianValue(dqp->flags) | 1L << 31); + dqp->flags = CL(CL(dqp->flags) | 1L << 31); if (flags & DRIVE_FLAGS_FIXED) - dqp->flags = BigEndianValue(BigEndianValue(dqp->flags) | 8L << 16); + dqp->flags = CL(CL(dqp->flags) | 8L << 16); else - dqp->flags = BigEndianValue(BigEndianValue(dqp->flags) | 2); /* IMIV-181 says + dqp->flags = CL(CL(dqp->flags) | 2); /* IMIV-181 says it can be 1 or 2 */ /* dqp->dq.qLink will be set up when we Enqueue this baby */ - dqp->dq.dQDrvSz = BigEndianValue(drvsize); - dqp->dq.dQDrvSz2 = BigEndianValue(drvsize>>16); + dqp->dq.dQDrvSz = CW(drvsize); + dqp->dq.dQDrvSz2 = CW(drvsize>>16); dqp->dq.qType = CWC(1); - dqp->dq.dQDrive = BigEndianValue(dno); - dqp->dq.dQRefNum = BigEndianValue(drefnum); + dqp->dq.dQDrive = CW(dno); + dqp->dq.dQRefNum = CW(drefnum); dqp->dq.dQFSID = 0; if (!devicename) dqp->devicename = 0; @@ -235,7 +234,7 @@ Executor::ROMlib_addtodq (ULONGINT drvsize, const char *devicename, INTEGER part dqp->devicename = NewPtr(strl + 1); strcpy((char *) dqp->devicename, devicename); } - dqp->partition = BigEndianValue(partition); + dqp->partition = CW(partition); if (hfsp) dqp->hfs = *hfsp; else @@ -374,7 +373,7 @@ PRIVATE void ROMlib_automount_helper(char *path, char *aliasp) HVCB *vcbp; vcbp = - ROMlib_vcbbyvrn (BigEndianValue (pb.ioParam.ioVRefNum)); + ROMlib_vcbbyvrn (CW (pb.ioParam.ioVRefNum)); str255_from_c_string (vcbp->vcbVN, aliasp); /* hack in name */ /*-->*/ return; @@ -470,7 +469,7 @@ substr (const char *source_string, source_substring_len * dest_substring_len) + 1; else max_len = source_string_len + 1; - retval = malloc (max_len); + retval = (char*)malloc (max_len); if (retval) { const char *ip; @@ -505,7 +504,7 @@ convert_executors_to_appnames (char *str) else { appname_len = strlen (ROMlib_appname); - appname = alloca (appname_len + 1); + appname = (char*)alloca (appname_len + 1); memcpy (appname, ROMlib_appname, appname_len + 1); dash = strchr (appname, '-'); if (dash) @@ -826,7 +825,7 @@ A0(PUBLIC, void, ROMlib_fileinit) /* INTERNAL */ savezone = TheZone; TheZone = SysZone; FCBSPtr = RM(NewPtr((Size) sizeof(fcbhidden))); - ((fcbhidden *)MR(FCBSPtr))->nbytes = BigEndianValue(sizeof(fcbhidden)); + ((fcbhidden *)MR(FCBSPtr))->nbytes = CW(sizeof(fcbhidden)); for (i = 0 ; i < NFCB ; i++) { ROMlib_fcblocks[i].fdfnum = 0; @@ -851,7 +850,7 @@ A0(PUBLIC, void, ROMlib_fileinit) /* INTERNAL */ WDCBsPtr = RM(NewPtr((Size) wdlen)); TheZone = savezone; memset (MR(WDCBsPtr), 0, wdlen); - *(INTEGER *)MR(WDCBsPtr) = BigEndianValue(wdlen); + *(INTEGER *)MR(WDCBsPtr) = CW(wdlen); ROMlib_ConfigurationFolder = copystr(getenv(CONFIGURATIONFOLDER)); ROMlib_SystemFolder = copystr(getenv(SYSTEMFOLDER)); @@ -986,9 +985,9 @@ A0(PUBLIC, void, ROMlib_fileinit) /* INTERNAL */ if (is_unix_path (ROMlib_DefaultFolder) && Ustat(ROMlib_DefaultFolder, &sbuf) == 0) { - CurDirStore = BigEndianValue((LONGINT) ST_INO (sbuf)); + CurDirStore = CL((LONGINT) ST_INO (sbuf)); vcbp = ROMlib_vcbbybiggestunixname(ROMlib_DefaultFolder); - SFSaveDisk = BigEndianValue(-BigEndianValue(vcbp->vcbVRefNum)); + SFSaveDisk = CW(-CW(vcbp->vcbVRefNum)); } if (is_unix_path (ROMlib_SystemFolder)) { if (Ustat(ROMlib_SystemFolder, &sbuf) < 0) { @@ -997,7 +996,7 @@ A0(PUBLIC, void, ROMlib_fileinit) /* INTERNAL */ } cpb.hFileInfo.ioNamePtr = RM((StringPtr) SYSMACNAME); cpb.hFileInfo.ioVRefNum = -1; - cpb.hFileInfo.ioDirID = BigEndianValue((LONGINT) ST_INO (sbuf)); + cpb.hFileInfo.ioDirID = CL((LONGINT) ST_INO (sbuf)); } else { sysnamelen = 1+strlen(ROMlib_SystemFolder)+1+strlen(SYSMACNAME+1)+1; sysname = (char*)alloca(sysnamelen); @@ -1167,7 +1166,7 @@ Executor::PRNTOFPERR (INTEGER prn, OSErr *errp) fcbrec *retval; OSErr err; - if (prn < 0 || prn >= BigEndianValue(*(short *)MR(FCBSPtr)) || (prn % 94) != 2) { + if (prn < 0 || prn >= CW(*(short *)MR(FCBSPtr)) || (prn % 94) != 2) { retval = 0; err = rfNumErr; } else { diff --git a/src/fileVolumes.cpp b/src/fileVolumes.cpp index 033daf02..5957fa5a 100644 --- a/src/fileVolumes.cpp +++ b/src/fileVolumes.cpp @@ -38,7 +38,6 @@ char ROMlib_rcsid_fileVolumes[] = #define RETURN(x) { err = (x); goto DONE; } using namespace Executor; -using namespace ByteSwap; /* * For now we just use 101 entries in our hash table, no matter what. @@ -153,7 +152,7 @@ recsetdp (VCBExtra * vcbp, datum *dp, hashlink_t *hlp, chain_t *therest) ourlen = strlen (hlp->dirname+1); /* don't count flag byte */ dp->dsize = ourlen + chaincount(therest) + 1; - dp->dptr = malloc(dp->dsize); + dp->dptr = (char*)malloc(dp->dsize); strcpy((char*)dp->dptr, hlp->dirname+1); chainfill((char*)((uintptr_t)dp->dptr + ourlen), therest); } @@ -422,7 +421,7 @@ PRIVATE BOOLEAN filesystems_match(rkey_t *keyp, VCBExtra *vcbp) BOOLEAN retval; namlen = strlen(vcbp->unixname); - if (namlen == BigEndianValue(keyp->filesystemlen)) + if (namlen == CW(keyp->filesystemlen)) retval = strncmp(vcbp->unixname, keyp->hostnameandroot + keyp->hostnamelen, namlen) == 0; else @@ -565,9 +564,9 @@ PRIVATE void readadbm(const char *dbmname, VCBExtra *vcbp) DBM_FETCH (&content, db, key); if (content.dsize) { contentp = (rcontent_t *) content.dptr; - dirid = BigEndianValue(keyp->dirid); + dirid = CL(keyp->dirid); hashinsert(vcbp, extractpathname(contentp), &dirid, - BigEndianValue(contentp->parid), new1); + CL(contentp->parid), new1); } } } @@ -601,14 +600,14 @@ PRIVATE void writeadbm(const char *dbmname, VCBExtra *vcbp, dirnamelen = strlen(deletep->dirname+1); key.dsize = sizeof(rkey_t) + ROMlib_hostnamelen + unamelen - 1; content.dsize = sizeof(rcontent_t) + dirnamelen - 1; - keyp->dirid = BigEndianValue(deletep->dirid); - keyp->filesystemlen = BigEndianValue(unamelen); + keyp->dirid = CL(deletep->dirid); + keyp->filesystemlen = CW(unamelen); keyp->hostnamelen = ROMlib_hostnamelen; dst = keyp->hostnameandroot; memcpy(dst, ROMlib_hostname, ROMlib_hostnamelen); dst += ROMlib_hostnamelen; memcpy(dst, vcbp->unixname, unamelen); - contentp->parid = BigEndianValue(deletep->parid); + contentp->parid = CL(deletep->parid); strcpy(contentp->path, deletep->dirname+1); dbm_store(db, key, content, DBM_REPLACE); keyp->hostnamelen = 0; @@ -684,7 +683,7 @@ A1(PUBLIC, OSErr, ufsPBMountVol, ParmBlkPtr, pb) /* INTERNAL */ strcpy(vp->unixname, ROMlib_volumename); vp->vcb.vcbDrvNum = pb->ioParam.ioVRefNum; --ROMlib_nextvrn; - vp->vcb.vcbVRefNum = BigEndianValue(ROMlib_nextvrn); + vp->vcb.vcbVRefNum = CW(ROMlib_nextvrn); vp->u.ufs.ino = ST_INO (sbuf); if (strcmp("/", ROMlib_volumename + SLASH_CHAR_OFFSET) == 0) { name = ROMlib_volumename; @@ -746,11 +745,11 @@ A4(PUBLIC, OSErr, GetVInfo, INTEGER, drv, StringPtr, voln, /* IMIV-107 */ OSErr temp; pbr.volumeParam.ioVolIndex = 0; - pbr.volumeParam.ioVRefNum = BigEndianValue(drv); + pbr.volumeParam.ioVRefNum = CW(drv); pbr.volumeParam.ioNamePtr = RM(voln); temp = PBGetVInfo(&pbr, 0); *vrn = pbr.volumeParam.ioVRefNum; - *freeb = BigEndianValue(Cx(pbr.volumeParam.ioVFrBlk) * Cx(pbr.volumeParam.ioVAlBlkSiz)); + *freeb = CL(Cx(pbr.volumeParam.ioVFrBlk) * Cx(pbr.volumeParam.ioVAlBlkSiz)); return(temp); } @@ -782,7 +781,7 @@ A2(PUBLIC, OSErr, SetVol, StringPtr, voln, INTEGER, vrn) /* IMIV-107 */ ParamBlockRec pbr; pbr.volumeParam.ioNamePtr = RM(voln); - pbr.volumeParam.ioVRefNum = BigEndianValue(vrn); + pbr.volumeParam.ioVRefNum = CW(vrn); return(PBSetVol(&pbr, 0)); } @@ -791,7 +790,7 @@ A2(PUBLIC, OSErr, FlushVol, StringPtr, voln, INTEGER, vrn) /* IMIV-108 */ ParamBlockRec pbr; pbr.ioParam.ioNamePtr = RM(voln); - pbr.ioParam.ioVRefNum = BigEndianValue(vrn); + pbr.ioParam.ioVRefNum = CW(vrn); return(PBFlushVol(&pbr, 0)); } @@ -800,7 +799,7 @@ A2(PUBLIC, OSErr, UnmountVol, StringPtr, voln, INTEGER, vrn) /* IMIV-108 */ ParamBlockRec pbr; pbr.ioParam.ioNamePtr = RM(voln); - pbr.ioParam.ioVRefNum = BigEndianValue(vrn); + pbr.ioParam.ioVRefNum = CW(vrn); return(PBUnmountVol(&pbr)); } @@ -809,7 +808,7 @@ A2(PUBLIC, OSErr, Eject, StringPtr, voln, INTEGER, vrn) /* IMIV-108 */ ParamBlockRec pbr; pbr.ioParam.ioNamePtr = RM(voln); - pbr.ioParam.ioVRefNum = BigEndianValue(vrn); + pbr.ioParam.ioVRefNum = CW(vrn); return(PBEject(&pbr)); } @@ -840,7 +839,7 @@ A4(PRIVATE, VCB *, findvcb, StringPtr, sp, INTEGER, vrn, BOOLEAN *, iswd, /*-->*/ return MR(DefVCBPtr); } if (vrn < 0) { - *vrnp = BigEndianValue(vrn); + *vrnp = CW(vrn); if (ISWDNUM(vrn)) { *iswd = TRUE; vcbptr = WDNUMTOWDP(vrn)->vcbp; @@ -961,18 +960,18 @@ A1(PRIVATE, VCB *, common, ParmBlkPtr, pb) pseudo_block_size = find_pseudo_block_size (sbuf.f_blocks, sbuf.f_bsize); - vcbp->vcbAlBlkSiz = BigEndianValue (pseudo_block_size); + vcbp->vcbAlBlkSiz = CL (pseudo_block_size); nm_al_blks = ((long long) sbuf.f_blocks * sbuf.f_bsize / pseudo_block_size); short_nm_al_blks = MIN (nm_al_blks, 65535); - vcbp->vcbNmAlBlks = BigEndianValue (short_nm_al_blks); + vcbp->vcbNmAlBlks = CW (short_nm_al_blks); effective_free_blocks = geteuid() ? sbuf.f_bavail : sbuf.f_bfree; free_bks = ((long long) effective_free_blocks * sbuf.f_bsize / pseudo_block_size); short_free_bks = MIN (free_bks, 65535); - vcbp->vcbFreeBks = BigEndianValue (short_free_bks); - vcbp->vcbFilCnt = BigEndianValue(sbuf.f_files); + vcbp->vcbFreeBks = CW (short_free_bks); + vcbp->vcbFilCnt = CL(sbuf.f_files); } if (pb->volumeParam.ioNamePtr) str255assign(MR(pb->volumeParam.ioNamePtr), vcbp->vcbVN); diff --git a/src/float4.cpp b/src/float4.cpp index d6e8586a..7b829032 100644 --- a/src/float4.cpp +++ b/src/float4.cpp @@ -27,7 +27,6 @@ char ROMlib_rcsid_float4[] = #include "rsys/float_fcw.h" using namespace Executor; -using namespace ByteSwap; #if !defined (CYGWIN32) @@ -196,7 +195,7 @@ P_SAVED0D1A0A1_2 (PUBLIC pascal trap, void, ROMlib_Fsetenv, INTEGER *, * handling. */ - env = BigEndianValue (*dp); + env = CW (*dp); halts_enabled = env & 0x1F; env &= ~0x1F; @@ -310,7 +309,7 @@ P_SAVED0D1A0A1_2 (PUBLIC pascal trap, void, ROMlib_Fsetenv, INTEGER *, gui_abort (); #endif - warning_floating_point ("setenv(0x%04X)", (unsigned) (uint16) BigEndianValue (*dp)); + warning_floating_point ("setenv(0x%04X)", (unsigned) (uint16) CW (*dp)); } @@ -396,7 +395,7 @@ P_SAVED0D1A0A1_2 (PUBLIC pascal trap, void, ROMlib_Fgetenv, INTEGER *, env = (env & ~0x1F) | halts_enabled; /* Return the computed environment word. */ - *(unsigned short *) dp = BigEndianValue(env); + *(unsigned short *) dp = CW(env); warning_floating_point ("Returning 0x%04X", (unsigned) env); } @@ -448,7 +447,7 @@ P_SAVED0D1A0A1_2 (PUBLIC pascal trap, void, ROMlib_Ftestxcp, INTEGER *, warning_floating_point (NULL_STRING); /* Fetch the current environment. */ C_ROMlib_Fgetenv (&env, 0); - env = BigEndianValue (env); + env = CW (env); /* Clear dp's high byte. */ *dp &= CWC (0x00FF); @@ -478,7 +477,7 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_FscalbX, INTEGER *, DECLAREINOUT(); /* FIXME - may lose precision! */ - scale = BigEndianValue(*(short *)sp); + scale = CW(*(short *)sp); ieee_to_x80 (out = scalb (in = x80_to_ieee (dp), scale), dp); warning_floating_point ("scalb(" IEEE_T_FORMAT ", %d) == " IEEE_T_FORMAT "", @@ -581,10 +580,10 @@ do { \ dest op ( in1 = f32_to_ieee ((const f32_t *) sp)); \ break; \ case FI_OPERAND: \ - dest op (in1 = BigEndianValue (*(short *) sp)); \ + dest op (in1 = CW (*(short *) sp)); \ break; \ case FL_OPERAND: \ - dest op (in1 = BigEndianValue (*(long *)(sp))); \ + dest op (in1 = CL (*(long *)(sp))); \ break; \ case FC_OPERAND: \ dest op (in1 = comp_to_ieee ((const comp_t *) sp)); \ @@ -685,10 +684,10 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_FX2x, x80_t *, ieee_to_f32 (val, (f32_t *) dp); break; case FI_OPERAND: - *(short *)dp = BigEndianValue( (signed short) rint (val)); + *(short *)dp = CW( (signed short) rint (val)); break; case FL_OPERAND: - *(long *)dp = BigEndianValue( (LONGINT) rint (val)); + *(long *)dp = CL( (LONGINT) rint (val)); break; case FC_OPERAND: ieee_to_comp (val, (comp_t *) dp); @@ -722,10 +721,10 @@ P_SAVED1A0A1_3 (PUBLIC pascal trap, void, ROMlib_Fremx, void *, sp, n2 = f32_to_ieee ((const f32_t *) sp); break; case FI_OPERAND: - n2 = BigEndianValue(*(short *)sp); + n2 = CW(*(short *)sp); break; case FL_OPERAND: - n2 = BigEndianValue(*(long *)sp); + n2 = CL(*(long *)sp); break; case FC_OPERAND: n2 = comp_to_ieee ((const comp_t *) sp); @@ -788,10 +787,10 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, FCMP_RETURN_TYPE, ROMlib_Fcmpx, n2 = f32_to_ieee ((const f32_t *) sp); break; case FI_OPERAND: - n2 = BigEndianValue(*(short *)sp); + n2 = CW(*(short *)sp); break; case FL_OPERAND: - n2 = BigEndianValue (* (long *)sp); + n2 = CL (* (long *)sp); break; case FC_OPERAND: n2 = comp_to_ieee ((const comp_t *) sp); @@ -912,10 +911,10 @@ P_SAVED0D1A0A1_4 (PUBLIC pascal trap, void, ROMlib_Fx2dec, DecForm *, n = f32_to_ieee ((const f32_t *) sp); break; case FI_OPERAND: - n = BigEndianValue (*(short *)sp); + n = CW (*(short *)sp); break; case FL_OPERAND: - n = BigEndianValue (*(long *)sp); + n = CL (*(long *)sp); break; case FC_OPERAND: n = comp_to_ieee ((const comp_t *) sp); @@ -927,7 +926,7 @@ P_SAVED0D1A0A1_4 (PUBLIC pascal trap, void, ROMlib_Fx2dec, DecForm *, in = n; /* Fetch the number of digits they are interested in. */ - digits = BigEndianValue (*(short *) (&sp2->digits)); + digits = CW (*(short *) (&sp2->digits)); /* Compute sign. */ if (n < 0) @@ -1002,7 +1001,7 @@ P_SAVED0D1A0A1_4 (PUBLIC pascal trap, void, ROMlib_Fx2dec, DecForm *, if (c_string[0] == '\0') strcpy (c_string, "0"); - dp->exp = BigEndianValue (exponent); + dp->exp = CW (exponent); } /* See if the generated string is too LONGINT. */ @@ -1017,7 +1016,7 @@ P_SAVED0D1A0A1_4 (PUBLIC pascal trap, void, ROMlib_Fx2dec, DecForm *, old_len = strlen (c_string); c_string[SIGDIGLEN] = 0; new_len = SIGDIGLEN; - dp->exp = BigEndianValue (BigEndianValue (dp->exp) + old_len - new_len); + dp->exp = CW (CW (dp->exp) + old_len - new_len); } #endif @@ -1028,7 +1027,7 @@ P_SAVED0D1A0A1_4 (PUBLIC pascal trap, void, ROMlib_Fx2dec, DecForm *, warning_floating_point ("Fx2dec(" IEEE_T_FORMAT ", digits=%d) == %s%s * 10**%d", (IEEE_T_PRINT_CAST) in, digits, dp->sgn ? "-" : "", - c_string, BigEndianValue (dp->exp)); + c_string, CW (dp->exp)); } #if defined (CYGWIN32) @@ -1109,10 +1108,10 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_Fdec2x, Decimal *, ieee_to_f32 (n, (f32_t *) dp); break; case FI_OPERAND: - *(short *) dp = BigEndianValue( (signed short) rint (n)); + *(short *) dp = CW( (signed short) rint (n)); break; case FL_OPERAND: - *(long *) dp = BigEndianValue( (LONGINT) rint (n)); + *(long *) dp = CL( (LONGINT) rint (n)); break; case FC_OPERAND: ieee_to_comp (n, (comp_t *) dp); @@ -1124,7 +1123,7 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_Fdec2x, Decimal *, warning_floating_point ("Fdec2x(%s%.*s * 10**%d) == " IEEE_T_FORMAT "", sp->sgn ? "-" : "", (uint8) sp->sig[0], &sp->sig[1], - BigEndianValue (sp->exp), (IEEE_T_PRINT_CAST) in); + CW (sp->exp), (IEEE_T_PRINT_CAST) in); } @@ -1132,7 +1131,7 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_Fclassx, void *, sp, INTEGER *, dp, unsigned short, sel) { static const unsigned char eight_zeros[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - unsigned short first_word = BigEndianValue (*(unsigned short *)sp); + unsigned short first_word = CW (*(unsigned short *)sp); warning_floating_point (NULL_STRING); @@ -1198,7 +1197,7 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_Fclassx, void *, #define S_NORMNUM_MASK 0x78000000 #define S_FRAC_MASK 0x07FFFFFF #define S_QNAN_MASK 0x04000000 - ULONGINT v = BigEndianValue (*(uint32 *)sp); + ULONGINT v = CL (*(uint32 *)sp); if ((v & S_INF_OR_NAN) == S_INF_OR_NAN) { if ((v & S_FRAC_MASK) == 0) @@ -1238,6 +1237,6 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_Fclassx, void *, * sign bit, we only need to check the first byte of the type. */ if (*(signed char *)sp < 0) - *dp = BigEndianValue (0 - BigEndianValue (*dp)); + *dp = CW (0 - CW (*dp)); } diff --git a/src/float5.cpp b/src/float5.cpp index 419ef191..dd29b5d8 100644 --- a/src/float5.cpp +++ b/src/float5.cpp @@ -16,7 +16,6 @@ char ROMlib_rcsid_float5[] = #include "rsys/floatconv.h" using namespace Executor; -using namespace ByteSwap; P_SAVED0D1A0A1_1 (PUBLIC pascal trap, void, ROMlib_FlnX, x80_t *, dp) { @@ -104,7 +103,7 @@ P_SAVED0D1A0A1_2(PUBLIC pascal trap, void, ROMlib_Fxpwri, INTEGER *, sp, DECLAREIN2OUT(); /* FIXME - may lose precision! */ - ieee_to_x80 (out = pow (in1 = x80_to_ieee (dp), in2 = BigEndianValue(*(short *)sp)), dp); + ieee_to_x80 (out = pow (in1 = x80_to_ieee (dp), in2 = CW(*(short *)sp)), dp); warning_floating_point ("xpwri(%f, %f) == %f", (double) in1, (double) in2, (double) out); } diff --git a/src/float7.cpp b/src/float7.cpp index 3098dd79..4f87650a 100644 --- a/src/float7.cpp +++ b/src/float7.cpp @@ -15,7 +15,6 @@ char ROMlib_rcsid_float7[] = #include using namespace Executor; -using namespace ByteSwap; #define LOWER(x) ((x) | 0x20) /* converts to lower case if x is A-Z */ @@ -33,8 +32,8 @@ P3(PUBLIC pascal trap, void, ROMlib_Fdec2str, DecForm * volatile, sp2, char backwardsexp[MAXEXPSIZE]; warning_floating_point (NULL_STRING); - digits = BigEndianValue (sp2->digits); - style = BigEndianValue (sp2->style); + digits = CW (sp2->digits); + style = CW (sp2->style); switch(style & DECIMALTYPEMASK) { case FloatDecimal: @@ -55,7 +54,7 @@ P3(PUBLIC pascal trap, void, ROMlib_Fdec2str, DecForm * volatile, sp2, i = 1; } dp[i + 2] = 'e'; - exponent = BigEndianValue (sp->exp) + sp->sig[0] - 1; + exponent = CW (sp->exp) + sp->sig[0] - 1; if (exponent < 0) { dp[i+3] = '-'; exponent = -exponent; @@ -82,9 +81,9 @@ P3(PUBLIC pascal trap, void, ROMlib_Fdec2str, DecForm * volatile, sp2, beforedecimal = 0; sp->sig[0] = 0; } else { - beforedecimal = sp->sig[0] + BigEndianValue (sp->exp); + beforedecimal = sp->sig[0] + CW (sp->exp); } - afterdecimal = (-BigEndianValue (sp->exp) > digits) ? -BigEndianValue (sp->exp) : digits; + afterdecimal = (-CW (sp->exp) > digits) ? -CW (sp->exp) : digits; if (sp->sgn) { dp[1] = '-'; i = 1; @@ -150,7 +149,7 @@ P5(PUBLIC pascal trap, void, ROMlib_Fxstr2dec, Decstr volatile, sp2, { int index, expsgn, implicitexp; - index = BigEndianValue (*sp); + index = CW (*sp); warning_floating_point ("xstr2dec(\"%.*s\")", lastchar - index + 1, (const char *) sp2 + index); while (((sp2[index] == ' ')||(sp2[index] == '\t')) && (index <= lastchar)) @@ -184,7 +183,7 @@ P5(PUBLIC pascal trap, void, ROMlib_Fxstr2dec, Decstr volatile, sp2, dp2->sig[1] = 'N'; /*-->*/ goto abortlookahead; /* should I use a break or return instead? */ } - *sp = BigEndianValue (index); /* The base is legit. Check exponent. */ + *sp = CW (index); /* The base is legit. Check exponent. */ dp2->exp = CWC (0); if (LOWER(sp2[index]) == 'e') { index++; @@ -200,25 +199,25 @@ P5(PUBLIC pascal trap, void, ROMlib_Fxstr2dec, Decstr volatile, sp2, /*-->*/ goto abortlookahead; /* should I use a break or return instead? */ } while (isdigit(sp2[index]) && (index <= lastchar)) { - INTEGER newexp = BigEndianValue (dp2->exp); + INTEGER newexp = CW (dp2->exp); newexp *= 10; newexp += sp2[index] - '0'; - dp2->exp = BigEndianValue (newexp); + dp2->exp = CW (newexp); index++; } if (expsgn) - dp2->exp = BigEndianValue (-1 * BigEndianValue (dp2->exp)); + dp2->exp = CW (-1 * CW (dp2->exp)); } - *sp = BigEndianValue (index); + *sp = CW (index); abortlookahead: - dp2->exp = BigEndianValue (BigEndianValue (dp2->exp) + implicitexp - dp2->sig[0]); + dp2->exp = CW (CW (dp2->exp) + implicitexp - dp2->sig[0]); *dp = CB (!sp2[index] || (index > lastchar)); while (dp2->sig[0] > 1 && dp2->sig[1] == '0') /* gunch leading */ memmove(dp2->sig+1, dp2->sig+2, --dp2->sig[0]); /* zeros */ warning_floating_point ("xstr2dec returning %s%.*s * 10**%d", dp2->sgn ? "-" : "", - dp2->sig[0], dp2->sig + 1, BigEndianValue (dp2->exp)); + dp2->sig[0], dp2->sig + 1, CW (dp2->exp)); } diff --git a/src/floatnext.cpp b/src/floatnext.cpp index 2f328045..22296a6f 100644 --- a/src/floatnext.cpp +++ b/src/floatnext.cpp @@ -13,7 +13,6 @@ char ROMlib_rcsid_floatnext[] = #include "rsys/floatconv.h" using namespace Executor; -using namespace ByteSwap; /* Subtracts one from the given multi-byte big endian unsigned number. */ static void @@ -78,9 +77,9 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_FnextX, /* Determine the classes of both X and Y. */ ROMlib_Fclassx (x, &x_class_swapped, sel); - x_class = BigEndianValue (x_class_swapped); + x_class = CW (x_class_swapped); ROMlib_Fclassx (y, &y_class_swapped, sel); - y_class = BigEndianValue (y_class_swapped); + y_class = CW (y_class_swapped); normalize_x80_p = FALSE; /* default, avoid gcc warnings. */ @@ -103,13 +102,13 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_FnextX, byte_size = 4; break; case FI_OPERAND: - xv = BigEndianValue (*(short *)x); - yv = BigEndianValue (*(short *)y); + xv = CW (*(short *)x); + yv = CW (*(short *)y); byte_size = 2; break; case FL_OPERAND: - xv = BigEndianValue(*(long *)x); - yv = BigEndianValue(*(long *)y); + xv = CL(*(long *)x); + yv = CL(*(long *)y); byte_size = 4; break; case FC_OPERAND: @@ -192,10 +191,10 @@ P_SAVED0D1A0A1_3 (PUBLIC pascal trap, void, ROMlib_FnextX, result = f32_to_ieee ((const f32_t *) x); break; case FI_OPERAND: - result = BigEndianValue (*(short *)x); + result = CW (*(short *)x); break; case FL_OPERAND: - result = BigEndianValue (*(long *)x); + result = CL (*(long *)x); break; case FC_OPERAND: result = comp_to_ieee ((const comp_t *) x); diff --git a/src/font.cpp b/src/font.cpp index e9254e41..05171a62 100644 --- a/src/font.cpp +++ b/src/font.cpp @@ -22,7 +22,6 @@ char ROMlib_rcsid_font[] = #include "rsys/glue.h" using namespace Executor; -using namespace ByteSwap; #define MAXTABLES 12 @@ -49,7 +48,7 @@ P0(PUBLIC pascal trap, void, InitFonts) /* IMI-222 */ TheZone = saveZone; beenhere = TRUE; } - ApFontID = BigEndianValue(Cx(SPFont) + 1); + ApFontID = CW(Cx(SPFont) + 1); SysFontSiz = CWC(12); SysFontFam = 0; #if 0 @@ -100,9 +99,9 @@ P2(PUBLIC pascal trap, void, GetFontName, INTEGER, fnum, /* IMI-223 */ ResType rest; if (fnum == systemFont) - fnum = BigEndianValue(SysFontFam); + fnum = CW(SysFontFam); else if (fnum == applFont) - fnum = BigEndianValue(ApFontID); + fnum = CW(ApFontID); SetResLoad(FALSE); h = GetResource(TICK("FONT"), FONTRESID(fnum, 0)); if (!h) @@ -148,7 +147,7 @@ P2(PUBLIC pascal trap, void, GetFNum, StringPtr, fnam, /* IMI-223 */ if (ResError()) *fnum = 0; else if (shift) - *fnum =BigEndianValue( BigEndianValue(*(unsigned short *) fnum) >> 7); + *fnum =CW( CW(*(unsigned short *) fnum) >> 7); SetResLoad(TRUE); } @@ -293,15 +292,15 @@ A0(PRIVATE, INTEGER *, findfondwidths) retval = 0; if (STARH((FHandle) MR(LastFOND))->ffFamID == WIDTHPTR->aFID && - (offset = BigEndianValue(STARH((FHandle)MR(LastFOND))->ffWTabOff))) { + (offset = CL(STARH((FHandle)MR(LastFOND))->ffWTabOff))) { bitsmatched = -1; want = Cx(WIDTHPTR->aFace); /* * NOTE: we add 3 to lastchar - firstchar to include the missing character * entry and what appears to be a zero entry located thereafter. */ - tabsize = (BigEndianValue(STARH((FHandle)MR(LastFOND))->ffLastChar) - - BigEndianValue(STARH((FHandle)MR(LastFOND))->ffFirstChar) + 3) + tabsize = (CW(STARH((FHandle)MR(LastFOND))->ffLastChar) - + CW(STARH((FHandle)MR(LastFOND))->ffFirstChar) + 3) * sizeof(INTEGER) + sizeof(INTEGER); numentriesminusone = (INTEGER *) ((char *) &STARH((FHandle)MR(LastFOND))->ffFlags + offset); @@ -350,7 +349,7 @@ PRIVATE void buildtabdata(howtobuild_t howtobuild, INTEGER extra, WIDTHPTR->usedFam = 0; /* don't really know what this should be */ widp = &fp->owTLoc + Cx(fp->owTLoc) + (lastchar - firstchar + 2); fixed_extra = FIXED(extra); - misswidth = FIXED8(BigEndianValue(widp[lastchar - firstchar + 1])) + fixed_extra; + misswidth = FIXED8(CW(widp[lastchar - firstchar + 1])) + fixed_extra; /* NOTE: this assumes missing characters have the missing width in the table. If this is wrong we need to look for missing characters @@ -358,23 +357,23 @@ PRIVATE void buildtabdata(howtobuild_t howtobuild, INTEGER extra, for (c = 0, p = WIDTHPTR->tabData, ep = p + 256; p < ep; c++) { if (c < firstchar || c > lastchar) - *p++ = BigEndianValue(misswidth); + *p++ = CL(misswidth); else - *p++ = BigEndianValue(FIXED8(BigEndianValue(*widp++)) + fixed_extra); + *p++ = CL(FIXED8(CW(*widp++)) + fixed_extra); } break; case FontInt: WIDTHPTR->usedFam = 0; widp = &fp->owTLoc + Cx(fp->owTLoc); - misswidth = FIXED((BigEndianValue(widp[lastchar - firstchar + 1]) & 0xFF) + extra); + misswidth = FIXED((CW(widp[lastchar - firstchar + 1]) & 0xFF) + extra); for (c = 0, p = WIDTHPTR->tabData, ep = p + 256; p < ep; c++) { if (c < firstchar || c > lastchar) - *p++ = BigEndianValue(misswidth); + *p++ = CL(misswidth); else { *p++ = (width = *widp++) == -1 ? - BigEndianValue(misswidth) + CL(misswidth) : - BigEndianValue(FIXED((BigEndianValue(width) & 0xFF) + extra)); + CL(FIXED((CW(width) & 0xFF) + extra)); } } break; @@ -383,20 +382,20 @@ PRIVATE void buildtabdata(howtobuild_t howtobuild, INTEGER extra, hOutputInverse = FixRatio(1<<8, Cx(WIDTHPTR->hOutput)); widp = fondwidthtable; fixed_extra = FIXED(extra); - misswidth = FIXED4 (BigEndianValue (widp[lastchar - firstchar + 1])); + misswidth = FIXED4 (CW (widp[lastchar - firstchar + 1])); misswidth = font_width_expand (misswidth, fixed_extra, hOutputInverse); for (c = 0, p = WIDTHPTR->tabData, ep = p + 256; p < ep; c++) { if (c < firstchar || c > lastchar) - *p++ = BigEndianValue(misswidth); + *p++ = CL(misswidth); else { - *p++ = BigEndianValue(FixMul(FIXED4(BigEndianValue(*widp)) + fixed_extra, + *p++ = CL(FixMul(FIXED4(CW(*widp)) + fixed_extra, hOutputInverse)); widp++; } } break; } - WIDTHPTR->tabData[' '] = BigEndianValue(Cx(WIDTHPTR->tabData[' ']) + + WIDTHPTR->tabData[' '] = CL(Cx(WIDTHPTR->tabData[' ']) + Cx(WIDTHPTR->sExtra)); } @@ -439,25 +438,25 @@ A1(PRIVATE, void, buildtable, INTEGER, extra) denomh = Cx(WIDTHPTR->inDenom.h); denomv = Cx(WIDTHPTR->inDenom.v); if (WIDTHPTR->fSize == WIDTHPTR->aSize) { - WIDTHPTR->hOutput = BigEndianValue(FixRatio(numerh, denomh) >> 8); - WIDTHPTR->vOutput = BigEndianValue(FixRatio(numerv, denomv) >> 8); + WIDTHPTR->hOutput = CW(FixRatio(numerh, denomh) >> 8); + WIDTHPTR->vOutput = CW(FixRatio(numerv, denomv) >> 8); WIDTHPTR->hFactor = WIDTHPTR->vFactor = CWC(256); } else if (Cx(WIDTHPTR->fSize) < Cx(WIDTHPTR->aSize) && FScaleDisable) { - WIDTHPTR->hOutput = BigEndianValue(FixRatio(numerh, denomh) >> 8); - WIDTHPTR->vOutput = BigEndianValue(FixRatio(numerv, denomv) >> 8); + WIDTHPTR->hOutput = CW(FixRatio(numerh, denomh) >> 8); + WIDTHPTR->vOutput = CW(FixRatio(numerv, denomv) >> 8); WIDTHPTR->hFactor = - WIDTHPTR->vFactor = BigEndianValue(FixRatio(Cx(WIDTHPTR->aSize), + WIDTHPTR->vFactor = CW(FixRatio(Cx(WIDTHPTR->aSize), Cx(WIDTHPTR->fSize)) >> 8); } else { tempfix = FixRatio(Cx(WIDTHPTR->aSize), Cx(WIDTHPTR->fSize)); - WIDTHPTR->hOutput = BigEndianValue(FixMul(tempfix, FixRatio(numerh, denomh)) >> 8); - WIDTHPTR->vOutput = BigEndianValue(FixMul(tempfix, FixRatio(numerv, denomv)) >> 8); + WIDTHPTR->hOutput = CW(FixMul(tempfix, FixRatio(numerh, denomh)) >> 8); + WIDTHPTR->vOutput = CW(FixMul(tempfix, FixRatio(numerv, denomv)) >> 8); WIDTHPTR->hFactor = WIDTHPTR->vFactor = CWC(256); } #if 0 /* WTF is going on here? */ - WIDTHPTR->style = BigEndianValue(extra); + WIDTHPTR->style = CW(extra); #endif buildtabdata(howtobuild, extra, fondwidthtable); @@ -565,7 +564,7 @@ A0(PRIVATE, INTEGER, closestface) /* no args, uses WIDTHPTR */ ip = &STARH((FHandle)MR(LastFOND))->ffVersion + 1; nmatch = -1; want = Cx(WIDTHPTR->aFace); - for (p = (fatabentry *) (ip + 1), ep = p + BigEndianValue(*ip) + 1; + for (p = (fatabentry *) (ip + 1), ep = p + CW(*ip) + 1; p < ep && Cx(p->size) <= size; p++) { if (!bestp) bestp = p; /* pick something */ @@ -604,7 +603,7 @@ at_least_one_fond_entry (INTEGER family) * TODO: NFNT below */ -#define AVAILABLE(x) (WIDTHPTR->fSize = BigEndianValue((x)), WIDTHPTR->tabFont = \ +#define AVAILABLE(x) (WIDTHPTR->fSize = CW((x)), WIDTHPTR->tabFont = \ RM(GetResource(TICK("FONT"), FONTRESID(family, (x))))) A1(PRIVATE, void, newwidthtable, FMInput *, fmip) @@ -682,25 +681,25 @@ A1(PRIVATE, void, newwidthtable, FMInput *, fmip) WIDTHPTR->tabFont = 0; while (!WIDTHPTR->tabFont && n_tried_sys_font < 2) { WIDTHPTR->fHand = RM((Handle) fh); - WIDTHPTR->fID = BigEndianValue(family); + WIDTHPTR->fID = CW(family); if (fh) { LastFOND = RM((FamRecHandle) fh); findclosestfond(fh, Cx(fmip->size), &powerof2, &lesser, &greater); if (powerof2 == Cx(fmip->size)) - WIDTHPTR->fSize = BigEndianValue(powerof2); + WIDTHPTR->fSize = CW(powerof2); else { if (FScaleDisable) - WIDTHPTR->fSize = lesser ? BigEndianValue(lesser) : BigEndianValue(greater); + WIDTHPTR->fSize = lesser ? CW(lesser) : CW(greater); else { if (powerof2) - WIDTHPTR->fSize = BigEndianValue(powerof2); + WIDTHPTR->fSize = CW(powerof2); else { if (!greater || (lesser && Cx(fmip->size) - lesser <= greater - Cx(fmip->size))) - WIDTHPTR->fSize = BigEndianValue(lesser); + WIDTHPTR->fSize = CW(lesser); else - WIDTHPTR->fSize = BigEndianValue(greater); + WIDTHPTR->fSize = CW(greater); } } } @@ -722,7 +721,7 @@ A1(PRIVATE, void, newwidthtable, FMInput *, fmip) if (!AVAILABLE(Cx(fmip->size))) { if (FScaleDisable) { findclosestfont(family, Cx(fmip->size), &lesser, &greater); - WIDTHPTR->fSize = lesser ? BigEndianValue(lesser) : BigEndianValue(greater); + WIDTHPTR->fSize = lesser ? CW(lesser) : CW(greater); WIDTHPTR->tabFont = RM(GetResource(TICK("FONT"), FONTRESID(family, Cx(WIDTHPTR->fSize)))); } else { @@ -731,9 +730,9 @@ A1(PRIVATE, void, newwidthtable, FMInput *, fmip) findclosestfont(family, Cx(fmip->size), &lesser, &greater); if (lesser && (Cx(fmip->size) - lesser <= greater - Cx(fmip->size))) - WIDTHPTR->fSize = BigEndianValue(lesser); + WIDTHPTR->fSize = CW(lesser); else - WIDTHPTR->fSize = BigEndianValue(greater); + WIDTHPTR->fSize = CW(greater); WIDTHPTR->tabFont = RM(GetResource(TICK("FONT"), FONTRESID(family, Cx(WIDTHPTR->fSize)))); } @@ -819,10 +818,10 @@ P1(PUBLIC pascal trap, FMOutPtr, FMSwapFont, FMInput *, fmip) /* IMI-223 */ ROMlib_fmo.ulThick = 0; ROMlib_fmo.shadow = 0; ROMlib_fmo.extra = 0; - ROMlib_fmo.numer.h = BigEndianValue( + ROMlib_fmo.numer.h = CW( (LONGINT) Cx(fmip->numer.h) * 256 * Cx(fmip->size) / Cx(fmip->denom.h) / Cx(WIDTHPTR->fSize)); - ROMlib_fmo.numer.v = BigEndianValue( + ROMlib_fmo.numer.v = CW( (LONGINT) Cx(fmip->numer.v) * 256 * Cx(fmip->size) / Cx(fmip->denom.v) / Cx(WIDTHPTR->fSize)); ROMlib_fmo.denom.h = CWC(256); @@ -856,11 +855,11 @@ P1(PUBLIC pascal trap, FMOutPtr, FMSwapFont, FMInput *, fmip) /* IMI-223 */ * characters. This will cause serious trouble when we allocate * too small a bitmap */ - ROMlib_fmo.ascent = BigEndianValue(fp->ascent) + !!ROMlib_fmo.shadow; - ROMlib_fmo.descent = BigEndianValue(fp->descent) + ROMlib_fmo.shadow; - ROMlib_fmo.widMax = BigEndianValue(fp->widMax) + !!ROMlib_fmo.shadow + + ROMlib_fmo.ascent = CW(fp->ascent) + !!ROMlib_fmo.shadow; + ROMlib_fmo.descent = CW(fp->descent) + ROMlib_fmo.shadow; + ROMlib_fmo.widMax = CW(fp->widMax) + !!ROMlib_fmo.shadow + ROMlib_fmo.shadow + ROMlib_fmo.bold; - ROMlib_fmo.leading = BigEndianValue(fp->leading); + ROMlib_fmo.leading = CW(fp->leading); } else { LoadResource(MR(ROMlib_fmo.fontHandle)); WidthPtr = (*MR(WidthTabHandle)).p; @@ -872,7 +871,7 @@ P1(PUBLIC pascal trap, FMOutPtr, FMSwapFont, FMInput *, fmip) /* IMI-223 */ return &ROMlib_fmo; } -#define SCALE(x) FixRatio(x * BigEndianValue(fmop->numer.v), BigEndianValue(fmop->denom.v)) +#define SCALE(x) FixRatio(x * CW(fmop->numer.v), CW(fmop->denom.v)) P1(PUBLIC pascal trap, void, FontMetrics, FMetricRec *, metrp) /* IMIV-32 */ { @@ -894,10 +893,10 @@ P1(PUBLIC pascal trap, void, FontMetrics, FMetricRec *, metrp) /* IMIV-32 */ /* TODO: check out thePort->device and use the FOND stuff if not going to the screen */ - metrp->ascent = BigEndianValue(SCALE(Cx(fmop->ascent))); - metrp->descent = BigEndianValue(SCALE(Cx(fmop->descent))); - metrp->leading = BigEndianValue(SCALE(Cx(fmop->leading))); - metrp->widMax = BigEndianValue(SCALE(Cx(fmop->widMax))); + metrp->ascent = CL(SCALE(Cx(fmop->ascent))); + metrp->descent = CL(SCALE(Cx(fmop->descent))); + metrp->leading = CL(SCALE(Cx(fmop->leading))); + metrp->widMax = CL(SCALE(Cx(fmop->widMax))); metrp->wTabHandle = (Handle) WidthTabHandle; } diff --git a/src/gensplash.cpp b/src/gensplash.cpp index 1878d93d..1bef6c5b 100644 --- a/src/gensplash.cpp +++ b/src/gensplash.cpp @@ -106,9 +106,9 @@ ppm_read_write_bits (int height, int width, int row_bytes, fscanf (fp, "%d %d %d", &red, &green, &blue); - color.red = BigEndianValue ((red * 65535) / max_cmp_value); - color.green = BigEndianValue ((green * 65535) / max_cmp_value); - color.blue = BigEndianValue ((blue * 65535) / max_cmp_value); + color.red = CW ((red * 65535) / max_cmp_value); + color.green = CW ((green * 65535) / max_cmp_value); + color.blue = CW ((blue * 65535) / max_cmp_value); pixel = (pixel << bpp) | color_pixel (&color); } @@ -248,13 +248,13 @@ output file `%s'\n", &top, &left, &bottom, &right); rect = &header.button_rects[i]; - rect->top = BigEndianValue (top); - rect->left = BigEndianValue (left); - rect->bottom = BigEndianValue (bottom); - rect->right = BigEndianValue (right); + rect->top = CW (top); + rect->left = CW (left); + rect->bottom = CW (bottom); + rect->right = CW (right); } - header.n_buttons = BigEndianValue (n_buttons); + header.n_buttons = CW (n_buttons); } init_color_buf (); @@ -265,9 +265,9 @@ output file `%s'\n", fscanf (paramfp, "bk_color %d %d %d", &red, &green, &blue); - color.red = BigEndianValue (red); - color.green = BigEndianValue (green); - color.blue = BigEndianValue (blue); + color.red = CW (red); + color.green = CW (green); + color.blue = CW (blue); header.bg_pixel = color_pixel (&color); } @@ -343,20 +343,20 @@ output file `%s'\n", ppm_read_write_bits (button_height, button_width, button_row_bytes, buttonfp, button_bits); - header.button_height = BigEndianValue (button_height); - header.button_y = BigEndianValue (splash_height - 12 - button_height); - header.button_x_byte = BigEndianValue ((splash_width - 16 - button_width) + header.button_height = CW (button_height); + header.button_y = CW (splash_height - 12 - button_height); + header.button_x_byte = CW ((splash_width - 16 - button_width) >> (3 - log2_bpp)); - header.button_row_bytes = BigEndianValue (button_row_bytes); + header.button_row_bytes = CL (button_row_bytes); - header.bpp = BigEndianValue (bpp); - header.log2_bpp = BigEndianValue (log2_bpp); + header.bpp = CL (bpp); + header.log2_bpp = CL (log2_bpp); - header.color_count = BigEndianValue (1 << bpp); + header.color_count = CL (1 << bpp); - header.color_offset = BigEndianValue (sizeof header); - header.splash_bits_offset = BigEndianValue (sizeof header + (sizeof *color_buf << bpp)); - header.button_bits_offset = BigEndianValue (BigEndianValue (header.splash_bits_offset) + header.color_offset = CL (sizeof header); + header.splash_bits_offset = CL (sizeof header + (sizeof *color_buf << bpp)); + header.button_bits_offset = CL (CL (header.splash_bits_offset) + splash_row_bytes * splash_height); retval = write (outfd, &header, sizeof header); diff --git a/src/gestalt.cpp b/src/gestalt.cpp index ac0601e5..3b9ac7a0 100644 --- a/src/gestalt.cpp +++ b/src/gestalt.cpp @@ -21,7 +21,6 @@ char ROMlib_rcsid_gestalt[] = #include "rsys/vdriver.h" using namespace Executor; -using namespace ByteSwap; typedef struct { @@ -372,7 +371,7 @@ gestalt_helper(OSType selector, LONGINT *responsep, BOOLEAN searchlist, *responsep = CLC (0); /* better safe than sorry */ if (searchlist && (gp = find_selector_on_list(selector))) - retval = CToPascalCall(&gp->selectorFunction, CTOP_GestaltTablesOnly, + retval = CToPascalCall((void*)gp->selectorFunction, CTOP_GestaltTablesOnly, selector, responsep); else { @@ -386,7 +385,7 @@ gestalt_helper(OSType selector, LONGINT *responsep, BOOLEAN searchlist, else { retval = noErr; - *responsep = BigEndianValue (gep->value); + *responsep = CL (gep->value); } } } @@ -397,7 +396,7 @@ gestalt_helper(OSType selector, LONGINT *responsep, BOOLEAN searchlist, (selector >> 16) & 0xFF, (selector >> 8) & 0xFF, (selector) & 0xFF, - BigEndianValue (*responsep), + CL (*responsep), retval); return retval; @@ -465,7 +464,7 @@ Executor::ROMlib_add_to_gestalt_list (OSType selector, OSErr retval, uint32 new_ entryp = (typeof (entryp)) ((char *) gestalt_listp + listp_size); entryp->selector = selector; entryp->retval = retval; - entryp->value = BigEndianValue (new_value); + entryp->value = CL (new_value); listp_size += sizeof *gestalt_listp; } } diff --git a/src/globals.c b/src/globals.c deleted file mode 100644 index 9b2e7605..00000000 --- a/src/globals.c +++ /dev/null @@ -1,326 +0,0 @@ -/* Copyright 1990, 1996 by Abacus Research and - * Development, Inc. All rights reserved. - */ - -#if !defined (OMIT_RCSID_STRINGS) -char ROMlib_rcsid_globals[] = - "$Id: globals.c 63 2004-12-24 18:19:43Z ctm $"; -#endif - -#include "rsys/common.h" - -#if !defined (nilhandle_H) - -#include "MemoryMgr.h" -#include "DeviceMgr.h" -#include "SoundDvr.h" -#include "QuickDraw.h" -#include "CQuickDraw.h" -#include "FontMgr.h" -#include "WindowMgr.h" -#include "ControlMgr.h" -#include "MenuMgr.h" -#include "AppleEvents.h" - -#define DATA(type, name, suffix, address, supported, manager, citation) \ -type name suffix - -DATA(HIDDEN_Ptr, nilhandle_H,, 0x00, TRUE-b, rsys/misc, MADEUP); -/* - * NOTE: MacWrite starts writing longwords at location 0x80 for TRAPs - */ -DATA(LONGINT, trapvectors,[10], 0x80, TRUE-b, rsys/misc, WHOKNOWS); -DATA(HIDDEN_Ptr, dodusesit_H,, 0xE4, TRUE-b, rsys/misc, WHOKNOWS); -DATA(INTEGER, monkeylives,, 0x100, TRUE-b, OSEvent, SysEqu.a); -DATA(INTEGER, ScrVRes,, 0x102, TRUE , QuickDraw, IMI-473); -DATA(INTEGER, ScrHRes,, 0x104, TRUE , QuickDraw, IMI-473); -DATA(INTEGER, ScreenRow,, 0x106, TRUE , QuickDraw, ThinkC); -DATA(HIDDEN_Ptr, MemTop_H,, 0x108, TRUE , MemoryMgr, IMII-19); -DATA(HIDDEN_Ptr, BufPtr_H,, 0x10C, TRUE-b, MemoryMgr, IMII-19); -DATA(HIDDEN_Ptr, HeapEnd_H,, 0x114, TRUE , MemoryMgr, IMII-19); -DATA(HIDDEN_THz, TheZone_H,, 0x118, TRUE , MemoryMgr, IMII-31); -DATA(HIDDEN_DCtlHandlePtr, UTableBase_H,,0x11C, FALSE, DeviceMgr, IMII-192); -DATA(Byte, loadtrap,, 0x12D, TRUE-b, SegmentLdr, SysEqu.a); -DATA(Byte, CPUFlag,, 0x12F, TRUE-b, StartMgr, IMV-348); -DATA(HIDDEN_Ptr, ApplLimit_H,, 0x130, TRUE , MemoryMgr, IMII-19); -DATA(INTEGER, SysEvtMask,, 0x144, TRUE , OSEvent, IMII-70); -DATA(QHdr, EventQueue,, 0x14A, TRUE , OSEvent, IMII-71); -DATA(HIDDEN_LONGINT, RndSeed_L,, 0x156, TRUE , QuickDraw, IMI-195); -DATA(INTEGER, SysVersion,, 0x15A, TRUE , OSUtil, ThinkC); -DATA(Byte, SEvtEnb,, 0x15C, FALSE , DeskMgr, IMI-443); -DATA(QHdr, VBLQueue,, 0x160, TRUE , VRetraceMgr, IMII-352); -DATA(HIDDEN_ULONGINT,Ticks_UL,, 0x16A, TRUE , OSEvent, IMI-260); -DATA(Byte, MBState,, 0x172, True-b, EventMgr, PegLeg); -DATA(unsigned char, KeyMap,[16], 0x174, TRUE-b, EventMgr, SysEqu.a); -/* was LONGINT KeypadMap[2]; */ -DATA(INTEGER, KeyThresh,, 0x18E, TRUE , ToolboxEvent, IMI-246); -DATA(INTEGER, KeyRepThresh,, 0x190, TRUE , ToolboxEvent, IMI-246); -DATA(HIDDEN_ProcPtr, Lvl1DT_H,[8], 0x192, FALSE , DeviceMgr, IMII-197); -/* - * Hypercard does a movel to this location. - */ -DATA(LONGINT, hyperlong,, 0x1AA, TRUE-b, rsys/misc, WHOKNOWS); -DATA(HIDDEN_ProcPtr, Lvl2DT_H,[8], 0x1B2, FALSE , DeviceMgr, IMII-198); -DATA(INTEGER, UnitNtryCnt,, 0x1D2, TRUE-b, DeviceMgr, ThinkC); -DATA(HIDDEN_Ptr, VIA_H,, 0x1D4, TRUE-b, DeviceMgr, IMIII-39); -DATA(HIDDEN_Ptr, SCCRd_H,, 0x1D8, FALSE , DeviceMgr, IMII-199); -DATA(HIDDEN_Ptr, SCCWr_H,, 0x1DC, FALSE , DeviceMgr, IMII-199); -DATA(HIDDEN_Ptr, IWM_H,, 0x1E0, FALSE , DeviceMgr, ThinkC); -DATA(Byte, Scratch20,[20], 0x1E4, TRUE , MemoryMgr, IMI-85); -DATA(Byte, SPValid,, 0x1F8, TRUE , OSUtil, IMII-392); -DATA(Byte, SPATalkA,, 0x1F9, TRUE , OSUtil, IMII-392); -DATA(Byte, SPATalkB,, 0x1FA, TRUE , OSUtil, IMII-392); -DATA(Byte, SPConfig,, 0x1FB, TRUE , OSUtil, IMII-392); -DATA(INTEGER, SPPortA,, 0x1FC, TRUE , OSUtil, IMII-392); -DATA(INTEGER, SPPortB,, 0x1FE, TRUE , OSUtil, IMII-392); -DATA(LONGINT, SPAlarm,, 0x200, TRUE , OSUtil, IMII-392); -DATA(INTEGER, SPFont,, 0x204, TRUE , OSUtil, IMII-392); -DATA(Byte, SPKbd,, 0x206, TRUE , OSUtil, IMII-369); -DATA(Byte, SPPrint,, 0x207, TRUE , OSUtil, IMII-392); -DATA(Byte, SPVolCtl,, 0x208, TRUE , OSUtil, IMII-392); -DATA(Byte, SPClikCaret,, 0x209, TRUE , OSUtil, IMII-392); -DATA(Byte, SPMisc2,, 0x20B, TRUE , OSUtil, IMII-392); -DATA(ULONGINT, Time,, 0x20C, TRUE , OSUtil, IMI-260); -DATA(INTEGER, BootDrive,, 0x210, TRUE , FileMgr, IMIV-212); -DATA(INTEGER, SFSaveDisk,, 0x214, TRUE , StdFilePkg, IMIV-72); -DATA(Byte, KbdLast,, 0x218, FALSE , QuickDraw, IMV-367); -DATA(Byte, KbdType,, 0x21E, FALSE , QuickDraw, IMV-367); -DATA(INTEGER, MemErr,, 0x220, TRUE , MemoryMgr, IMIV-80); -DATA(Byte, SdVolume,, 0x260, TRUE-b, SoundDvr, IMII-232); -DATA(HIDDEN_FTSndRecPtr,SoundPtr_H,, 0x262, FALSE , SoundDvr, IMII-227); -DATA(HIDDEN_Ptr, SoundBase_H,, 0x266, TRUE-b, SoundDvr, IMIII-21); -DATA(Byte, SoundActive,, 0x27E, TRUE , SoundDvr, MPW); -DATA(Byte, SoundLevel,, 0x27F, FALSE , SoundDvr, IMII-234); -DATA(INTEGER, CurPitch,, 0x280, TRUE-b, SoundDvr, IMII-226); -/* - * NOTE: mathones is a LONGINT that Mathematica looks at that contains -1 - * on a Mac+ - */ -DATA(LONGINT, mathones,, 0x282, TRUE-b, rsys/misc, WHOKNOWS); -/* - * NOTE: Theoretically ROM85 is mentioned in IMV, but I don't know where. - * On a Mac+ the value 0x7FFF is stored there. - * tim: It is at least on page IMV-328. - */ -DATA(INTEGER, ROM85,, 0x28E, TRUE-b, MacTypes, IMV-328); -DATA(Byte, PortBUse,, 0x291, TRUE-b, AppleTalk, IMII-305); -DATA(Byte, ScreenVars,[8], 0x292, FALSE , QuickDraw, MPW); -/* - * NOTE: Key1Trans in the keyboard translator procedure, and Key2Trans in the - * numeric keypad translator procedure (MPW). - */ -DATA(HIDDEN_Ptr, Key1Trans_H,, 0x29E, FALSE , QuickDraw, MPW); -DATA(HIDDEN_Ptr, Key2Trans_H,, 0x2A2, FALSE , QuickDraw, MPW); -DATA(HIDDEN_THz, SysZone_H,, 0x2A6, TRUE , MemoryMgr, IMII-19); -DATA(HIDDEN_THz, ApplZone_H,, 0x2AA, TRUE , MemoryMgr, IMII-19); -DATA(HIDDEN_Ptr, ROMBase_H,, 0x2AE, TRUE-b, MemoryMgr, IMIV-236); -DATA(HIDDEN_Ptr, RAMBase_H,, 0x2B2, FALSE , MemoryMgr, IMI-87); -DATA(HIDDEN_AE_info_ptr,AE_info_H,, 0x2B6, TRUE, AppleEvents, AEGizmo); -DATA(HIDDEN_Ptr, DSAlertTab_H,, 0x2BA, TRUE , SysErr, IMII-359); -DATA(HIDDEN_ProcPtr, ExtStsDT_H,[4], 0x2BE, FALSE , DeviceMgr, IMII-199); -DATA(HIDDEN_Ptr, ABusVars_H,, 0x2D8, FALSE , AppleTalk, IMII-328); -DATA(HIDDEN_Ptr, ABusDCE_H,, 0x2DC, FALSE , AppleTalk, MPW); -DATA(Byte, FinderName,[16], 0x2E0, TRUE , SegmentLdr, IMII-59); -DATA(LONGINT, DoubleTime,, 0x2F0, TRUE , ToolboxEvent, IMI-260); -DATA(LONGINT, CaretTime,, 0x2F4, TRUE , ToolboxEvent, IMI-260); -DATA(Byte, ScrDmpEnb,, 0x2F8, TRUE , ToolboxEvent, IMI-258); -DATA(LONGINT, BufTgFNum,, 0x2FC, FALSE , DiskDvr, IMII-212); -DATA(INTEGER, BufTgFFlg,, 0x300, FALSE , DiskDvr, IMII-212); -DATA(INTEGER, BufTgFBkNum,, 0x302, FALSE , DiskDvr, IMII-212); -DATA(LONGINT, BufTgDate,, 0x304, FALSE , DiskDvr, IMII-212); -DATA(QHdr, DrvQHdr,, 0x308, TRUE , FileMgr, IMIV-182); -DATA(HIDDEN_Ptr, heapcheck_H,, 0x316, TRUE-b, MemoryMgr, SysEqu.a); -DATA(LONGINT, Lo3Bytes,, 0x31A, TRUE , MemoryMgr, IMI-85); -DATA(LONGINT, MinStack,, 0x31E, TRUE-b, MemoryMgr, IMII-17); -DATA(LONGINT, DefltStack,, 0x322, TRUE-b, MemoryMgr, IMII-17); -DATA(HIDDEN_Handle, GZRootHnd_H,, 0x328, TRUE , MemoryMgr, IMI-43); -DATA(HIDDEN_Handle, GZMoveHnd_H,, 0x330, FALSE , MemoryMgr, LowMem.h); -DATA(HIDDEN_ProcPtr, EjectNotify_H,, 0x338, FALSE , FileMgr, ThinkC); -DATA(HIDDEN_ProcPtr, IAZNotify_H,, 0x33C, TRUE-b, MemoryMgr, ThinkC); -DATA(HIDDEN_Ptr, FCBSPtr_H,, 0x34E, TRUE , FileMgr, IMIV-179); -DATA(HIDDEN_VCBPtr, DefVCBPtr_H,, 0x352, TRUE , FileMgr, IMIV-178); -DATA(QHdr, VCBQHdr,, 0x356, TRUE , FileMgr, IMIV-178); -DATA(QHdr, FSQHdr,, 0x360, TRUE , FileMgr, IMIV-176); -DATA(HIDDEN_Ptr, WDCBsPtr_H,, 0x372, TRUE , FileMgr, idunno); -DATA(INTEGER, DefVRefNum,, 0x384, TRUE , FileMgr, MPW); -DATA(LONGINT, CurDirStore,, 0x398, TRUE , StdFilePkg, IMIV-72); -/* - * Note: MacLinkPC+ loads 0x358 into a register (i.e. the address of the - * pointer to the first element on the VCB queue) and then uses - * 72 off of it (0x3A0) and 78 off of it (0x3A6). As LONGINT as - * there are zeros there, that doesn't hurt us, but normally, - * we'd have negative ones in there. Hence we describe them - * here and set them to zero in executor. - */ -/* DATA(HIDDEN_Ptr, FmtDefaults_H,, 0x39E, FALSE , FileMgr, ThinkC); */ -DATA(INTEGER, MCLKPCmiss1,, 0x3A0, TRUE-b, MacLinkPC, badaccess); -DATA(INTEGER, MCLKPCmiss2,, 0x3A6, TRUE-b, MacLinkPC, badaccess); -DATA(HIDDEN_Ptr, ToExtFS_H,, 0x3F2, FALSE , FileMgr, IMIV-212); -DATA(INTEGER, FSFCBLen,, 0x3F6, TRUE , FileMgr, IMIV-97); -DATA(Rect, DSAlertRect,, 0x3F8, TRUE , SysErr, IMII-362); -DATA(HIDDEN_ProcPtr, JUnknown574_H,, 0x574, TRUE-b, QuickDraw, IMV); -DATA(HIDDEN_ProcPtr, JADBProc_H,, 0x6B8, FALSE , QuickDraw, IMV); -/* - * JFLUSH is a guess from disassembling some of Excel 3.0 - */ -DATA(HIDDEN_ProcPtr, JFLUSH_H,, 0x6F4, TRUE-b, idunno, guess); -DATA(HIDDEN_ProcPtr, JResUnknown1_H,, 0x700, TRUE-b, idunno, resedit); -DATA(HIDDEN_ProcPtr, JResUnknown2_H,, 0x714, TRUE-b, idunno, resedit); -DATA(HIDDEN_ProcPtr, JHideCursor_H,, 0x800, TRUE-b, QuickDraw, Private.a); -DATA(HIDDEN_ProcPtr, JShowCursor_H,, 0x804, TRUE-b, QuickDraw, Private.a); -DATA(HIDDEN_ProcPtr, JShieldCursor_H,, 0x808, TRUE-b, QuickDraw, Private.a); -DATA(HIDDEN_ProcPtr, JScrnAddr_H,, 0x80C, FALSE , QuickDraw, Private.a); -DATA(HIDDEN_ProcPtr, JScrnSize_H,, 0x810, FALSE , QuickDraw, Private.a); -DATA(HIDDEN_ProcPtr, JInitCrsr_H,, 0x814, TRUE-b, QuickDraw, Private.a); -DATA(HIDDEN_ProcPtr, JSetCrsr_H,, 0x818, TRUE-b, QuickDraw, Private.a); -DATA(HIDDEN_ProcPtr, JCrsrObscure_H,, 0x81C, TRUE-b, QuickDraw, Private.a); -DATA(HIDDEN_ProcPtr, JUpdateProc_H,, 0x820, FALSE , QuickDraw, Private.a); -DATA(HIDDEN_Ptr, ScrnBase_H,, 0x824, TRUE , QuickDraw, IMII-19); -/* - * MouseLocation used to be 0x830, but that doesn't jibe with what I've - * seen of Crystal Quest --ctm - */ -DATA(Point, MTemp,, 0x828, True-b, QuickDraw, PegLeg); -DATA(Point, MouseLocation,, 0x82C, TRUE , QuickDraw, Vamp); -DATA(Point, MouseLocation2,, 0x830, TRUE , QuickDraw, MacAttack); -DATA(Rect, CrsrPin,, 0x834, FALSE , QuickDraw, ThinkC); -DATA(HIDDEN_GDHandle,MainDevice_H,, 0x8A4, TRUE , QuickDraw, IMV); -DATA(HIDDEN_GDHandle,DeviceList_H,, 0x8A8, TRUE , QuickDraw, IMV); -DATA(Byte, QDColors,, 0x8B0, FALSE , QuickDraw, IMV); -DATA(BOOLEAN, CrsrVis,, 0x8CC, TRUE , QuickDraw, SysEqu.a); -DATA(Byte, CrsrBusy,, 0x8CD, TRUE , QuickDraw, SysEqu.a); -DATA(INTEGER, CrsrState,, 0x8D0, TRUE , QuickDraw, SysEqu.a); -DATA(LONGINT, mousemask,, 0x8D6, TRUE-b, QuickDraw, .a); -DATA(LONGINT, mouseoffset,, 0x8DA, TRUE-b, QuickDraw, SysEqu.a); -DATA(INTEGER, JournalFlag,, 0x8DE, FALSE , ToolboxEvent, IMI-261); -DATA(HIDDEN_ProcPtr, JSwapFont_H,, 0x8E0, TRUE-b, FontMgr, Private.a); -DATA(HIDDEN_Handle, WidthListHand_H,, 0x8E4, TRUE , FontMgr, IMIV-42); -DATA(INTEGER, JournalRef,, 0x8E8, FALSE , ToolboxEvent, IMI-261); -DATA(INTEGER, CrsrThresh,, 0x8EC, FALSE , OSUtil, IMII-372); -DATA(HIDDEN_ProcPtr, JCrsrTask_H,, 0x8EE, TRUE , , ); -DATA(Byte, WWExist,, 0x8F2, TRUE , SysError, SysEqu.a); -DATA(Byte, QDExist,, 0x8F3, TRUE , SysError, SysEqu.a); -DATA(HIDDEN_Ptr, JFetch_H,, 0x8F4, FALSE , DeviceMgr, IMII-194); -DATA(HIDDEN_Ptr, JStash_H,, 0x8F8, FALSE , DeviceMgr, IMII-195); -DATA(HIDDEN_Ptr, JIODone_H,, 0x8FC, FALSE , DeviceMgr, IMII-195); -DATA(INTEGER, CurApRefNum,, 0x900, TRUE , SegmentLdr, IMII-58); -DATA(HIDDEN_Ptr, CurrentA5_H,, 0x904, TRUE , MemoryMgr, IMI-95); -DATA(HIDDEN_Ptr, CurStackBase_H,, 0x908, TRUE-b, MemoryMgr, IMII-19); -/* - * NOTE: IMIII says CurApName is 32 bytes LONGINT, but it looks to me like - * it is really 34 bytes LONGINT. - */ -DATA(Byte, CurApName,[34], 0x910, TRUE , SegmentLdr, IMII-58); -DATA(INTEGER, CurJTOffset,, 0x934, TRUE-b, SegmentLdr, IMII-62); -DATA(INTEGER, CurPageOption,, 0x936, TRUE , SegmentLdr, IMII-60); -DATA(Byte, HiliteMode,, 0x938, TRUE-b, QuickDraw, IMV); -/* - * NOTE: Since we don't support printing yet, starting PrintErr at 0 - * is what we mean by supporting it. - */ -DATA(INTEGER, PrintErr,, 0x944, TRUE-b, PrintMgr, IMII-161); -/* - * NOTE: The graphing program looks for a -1 in 0x952 - */ -DATA(INTEGER, graphlooksat,, 0x952, TRUE-b, rsys/misc, WHOKNOWS); -/* - * NOTE: MacWrite stores a copy of the trap address for LoadSeg in 954 - */ -DATA(LONGINT, macwritespace,, 0x954, TRUE-b, rsys/misc, WHOKNOWS); -DATA(LONGINT, ScrapSize,, 0x960, TRUE , ScrapMgr, IMI-457); -DATA(HIDDEN_Handle, ScrapHandle_H,, 0x964, TRUE , ScrapMgr, IMI-457); -DATA(INTEGER, ScrapCount,, 0x968, TRUE , ScrapMgr, IMI-457); -DATA(INTEGER, ScrapState,, 0x96A, TRUE , ScrapMgr, IMI-457); -DATA(HIDDEN_StringPtr, ScrapName_H,, 0x96C, TRUE , ScrapMgr, IMI-457); -DATA(HIDDEN_Handle, ROMFont0_H,, 0x980, TRUE , FontMgr, IMI-233); -DATA(INTEGER, ApFontID,, 0x984, TRUE , FontMgr, IMIV-31); -DATA(FMInput, ROMlib_myfmi,, 0x988, TRUE , FontMgr, ToolEqu.a); -DATA(FMOutput, ROMlib_fmo,, 0x998, TRUE , FontMgr, Private.a); -DATA(Byte, ToolScratch,[8], 0x9CE, TRUE , MemoryMgr, IMI-85); -DATA(HIDDEN_WindowPeek,WindowList_H,, 0x9D6, TRUE , WindowMgr, IMI-274); -DATA(INTEGER, SaveUpdate,, 0x9DA, TRUE , WindowMgr, IMI-297); -DATA(INTEGER, PaintWhite,, 0x9DC, TRUE , WindowMgr, IMI-297); -DATA(HIDDEN_GrafPtr, WMgrPort_H,, 0x9DE, TRUE , WindowMgr, IMI-282); -DATA(HIDDEN_RgnHandle,OldStructure_H,, 0x9E6, TRUE , WindowMgr, IMI-296); -DATA(HIDDEN_RgnHandle,OldContent_H,, 0x9EA, TRUE , WindowMgr, IMI-296); -DATA(HIDDEN_RgnHandle,GrayRgn_H,, 0x9EE, TRUE , WindowMgr, IMI-282); -DATA(HIDDEN_RgnHandle,SaveVisRgn_H,, 0x9F2, TRUE , WindowMgr, IMI-293); -DATA(HIDDEN_ProcPtr, DragHook_H,, 0x9F6, TRUE , WindowMgr, IMI-324); -DATA(Byte, Scratch8,[8], 0x9FA, TRUE , MemoryMgr, IMI-85); -DATA(LONGINT, OneOne,, 0xA02, TRUE , MemoryMgr, IMI-85); -DATA(LONGINT, MinusOne,, 0xA06, TRUE , MemoryMgr, IMI-85); -DATA(INTEGER, TopMenuItem,, 0xA0A, TRUE , MenuMgr, IMV-249); -DATA(INTEGER, AtMenuBottom,, 0xA0C, TRUE , MenuMgr, IMV-249); -DATA(HIDDEN_Handle, MenuList_H,, 0xA1C, TRUE , MenuMgr, IMI-346); -DATA(INTEGER, MBarEnable,, 0xA20, TRUE , MenuMgr, IMI-356); -DATA(INTEGER, MenuFlash,, 0xA24, TRUE , MenuMgr, IMI-361); -DATA(INTEGER, TheMenu,, 0xA26, TRUE , MenuMgr, IMI-357); -DATA(HIDDEN_ProcPtr, MBarHook_H,, 0xA2C, TRUE , MenuMgr, IMI-356); -DATA(HIDDEN_ProcPtr, MenuHook_H,, 0xA30, TRUE , MenuMgr, IMI-356); -DATA(Pattern, DragPattern,, 0xA34, TRUE , WindowMgr, IMI-324); -DATA(Pattern, DeskPattern,, 0xA3C, TRUE , WindowMgr, IMI-282); -DATA(Byte, macfpstate,[6], 0xA4A, TRUE-b, unknown, ToolEqu.a); -DATA(HIDDEN_Handle, TopMapHndl_H,, 0xA50, TRUE , ResourceMgr, IMI-115); -DATA(HIDDEN_Handle, SysMapHndl_H,, 0xA54, TRUE , ResourceMgr, IMI-114); -DATA(INTEGER, SysMap,, 0xA58, TRUE , ResourceMgr, IMI-114); -DATA(INTEGER, CurMap,, 0xA5A, TRUE , ResourceMgr, IMI-117); -DATA(INTEGER, resreadonly,, 0xA5C, FALSE , ResourceMgr, ToolEqu.a); -DATA(BOOLEAN, ResLoad,, 0xA5E, TRUE , ResourceMgr, IMI-118); -DATA(INTEGER, ResErr,, 0xA60, TRUE , ResourceMgr, IMI-118); -DATA(Byte, FScaleDisable,, 0xA63, TRUE , FontMgr, IMI-222); -DATA(HIDDEN_WindowPtr,CurActivate_H,, 0xA64, TRUE , WindowMgr, IMI-280); -DATA(HIDDEN_WindowPtr,CurDeactive_H,, 0xA68, TRUE , WindowMgr, IMI-280); -DATA(HIDDEN_ProcPtr, DeskHook_H,, 0xA6C, TRUE , WindowMgr, IMI-282); -DATA(HIDDEN_ProcPtr, TEDoText_H,, 0xA70, TRUE , TextEdit, IMI-391); -DATA(HIDDEN_ProcPtr, TERecal_H,, 0xA74, FALSE , TextEdit, IMI-391); -DATA(Byte, ApplScratch,[12], 0xA78, TRUE , MemoryMgr, IMI-85); -DATA(HIDDEN_WindowPtr,GhostWindow_H,, 0xA84, TRUE , WindowMgr, IMI-287); -DATA(HIDDEN_ProcPtr, ResumeProc_H,, 0xA8C, TRUE , DialogMgr, IMI-411); -DATA(INTEGER, ANumber,, 0xA98, TRUE , DialogMgr, IMI-423); -DATA(INTEGER, ACount,, 0xA9A, TRUE , DialogMgr, IMI-423); -DATA(HIDDEN_ProcPtr, DABeeper_H,, 0xA9C, TRUE , DialogMgr, IMI-411); -DATA(HIDDEN_Handle, DAStrings_H,[4], 0xAA0, TRUE , DialogMgr, IMI-421); -DATA(INTEGER, TEScrpLength,, 0xAB0, TRUE , TextEdit, IMI-389); -DATA(HIDDEN_Handle, TEScrpHandle_H,, 0xAB4, TRUE , TextEdit, IMI-389); -DATA(HIDDEN_Handle, AppPacks_H,[8], 0xAB8, TRUE-b , PackageMgr, ThinkC); -DATA(Byte, SysResName,[20], 0xAD8, TRUE , ResourceMgr, IMI-114); -DATA(HIDDEN_Handle, AppParmHandle_H,, 0xAEC, TRUE , SegmentLdr, IMII-57); -DATA(INTEGER, DSErrCode,, 0xAF0, TRUE , MacTypes, IMII-362); -DATA(HIDDEN_ProcPtr, ResErrProc_H,, 0xAF2, TRUE , ResourceMgr, IMI-116); -DATA(INTEGER, DlgFont,, 0xAFA, TRUE , DialogMgr, IMI-412); -DATA(HIDDEN_WidthTablePtr,WidthPtr_H,, 0xB10, TRUE , FontMgr, IMIV-42); -DATA(INTEGER, SCSIFlags,, 0xB22, TRUE-b, uknown, Private.a); -DATA(HIDDEN_WidthTableHandle,WidthTabHandle_H,,0xB2A,TRUE, FontMgr, IMIV-42); -DATA(LONGINT, LastSPExtra,, 0xB4C, TRUE-b, rsys/misc, WHOKNOWS); -DATA(LONGINT, MenuDisable,, 0xB54, TRUE , MenuMgr, IMV-249); -DATA(HIDDEN_Handle, MBDFHndl_H,, 0xB58, TRUE , MenuMgr, Private.a); -DATA(HIDDEN_Handle, MBSaveLoc_H,, 0xB5C, TRUE , MenuMgr, Private.a); -DATA(Byte, RomMapInsert,, 0xB9E, FALSE , ResourceMgr, IMIV-19); -DATA(Byte, TmpResLoad,, 0xB9F, FALSE , ResourceMgr, IMIV-19); -DATA(LONGINT, IntlSpec,, 0xBA0, TRUE , FontMgr, IMIV-42); -DATA(INTEGER, SysFontFam,, 0xBA6, TRUE , FontMgr, IMIV-31); -DATA(INTEGER, SysFontSiz,, 0xBA8, TRUE , FontMgr, IMIV-31); -DATA(INTEGER, MBarHeight,, 0xBAA, TRUE , MenuMgr, IMV-253); -DATA(INTEGER, TESysJust,, 0xBAC, TRUE-b, ScriptMgr, ToolEqu.a); -DATA(HIDDEN_FamRecHandle, LastFOND_H,, 0xBC2, TRUE , FontMgr, IMIV-36); -DATA(INTEGER, fondid,, 0xBC6, TRUE-b, FontMgr, ToolEqu.a); -DATA(Byte, FractEnable,, 0xBF4, TRUE , FontMgr, IMIV-32); -DATA(Byte, MMUType,, 0xCB1, FALSE , OSUtil, MPW); -DATA(Byte, MMU32Bit,, 0xCB2, TRUE-b, OSUtil, IMV-592); -DATA(HIDDEN_GDHandle,TheGDevice_H,, 0xCC8, TRUE , QuickDraw, IMV); -DATA(HIDDEN_AuxWinHandle,AuxWinHead_H,, 0xCD0, TRUE , WindowMgr, IMV-200); -DATA(HIDDEN_AuxCtlHandle,AuxCtlHead_H,, 0xCD4, TRUE , ControlMgr, IMV-216); -DATA(HIDDEN_PixPatHandle, DeskCPat_H,, 0xCD8, TRUE , WindowMgr, SysEqua.a); -DATA(INTEGER, TimeDBRA,, 0xD00, FALSE , StartMgr, IMV); -DATA(INTEGER, TimeSCCDB,, 0xD02, FALSE , StartMgr, IMV); -DATA(HIDDEN_ProcPtr, JVBLTask_H,, 0xD28, FALSE , VRetraceMgr, IMV); -DATA(HIDDEN_CGrafPtr,WMgrCPort_H,, 0xD2C, FALSE , QuickDraw, IMV-205); -DATA(HIDDEN_Handle, SynListHandle_H,, 0xD32, FALSE , FontMgr, IMV-182); -DATA(HIDDEN_MCTableHandle,MenuCInfo_H,, 0xD50, TRUE , QuickDraw, IMV-242); -DATA(QHdr, DTQueue,, 0xD92, FALSE , OSUtil, IMV-466); -DATA(HIDDEN_ProcPtr, JDTInstall_H,, 0xD9C, FALSE , OSUtil, IMV); -DATA(RGBColor, HiliteRGB,, 0xDA0, TRUE , QuickDraw, IMV-62); -DATA(INTEGER, TimeSCSIDB,, 0xDA6, FALSE , StartMgr, IMV); -DATA(LONGINT, lastlowglobal,, 0x2000, TRUE-b, rsys/misc, MadeUp); - -#endif diff --git a/src/hfsBtree.cpp b/src/hfsBtree.cpp index 5e79b49a..f5657b6f 100644 --- a/src/hfsBtree.cpp +++ b/src/hfsBtree.cpp @@ -101,17 +101,17 @@ PRIVATE void checkcache(short refnum) return; printf("\n"); - fcbp = (filecontrolblock *)((char *)BigEndianValue(FCBSPtr) + refnum); - vcbp = BigEndianValue(fcbp->fcbVPtr); - headp = (cachehead *) BigEndianValue(vcbp->vcbCtlBuf); + fcbp = (filecontrolblock *)((char *)CL(FCBSPtr) + refnum); + vcbp = CL(fcbp->fcbVPtr); + headp = (cachehead *) CL(vcbp->vcbCtlBuf); printf("headp = 0x%lx, nitems = %d, flink = 0x%lx, blink = 0x%lx\n", - headp, BigEndianValue(headp->nitems), BigEndianValue(headp->flink), BigEndianValue(headp->blink)); - for (i = BigEndianValue(headp->nitems), cachep = BigEndianValue(headp->flink); --i >= -3; - cachep = BigEndianValue(cachep->flink)) + headp, CW(headp->nitems), CL(headp->flink), CL(headp->blink)); + for (i = CW(headp->nitems), cachep = CL(headp->flink); --i >= -3; + cachep = CL(cachep->flink)) printf("0x%lx:0x%x ", cachep, cachep->flags); printf("\n\n"); - for (i = BigEndianValue(headp->nitems), cachep = BigEndianValue(headp->blink); --i >= -3; - cachep = BigEndianValue(cachep->blink)) + for (i = CW(headp->nitems), cachep = CL(headp->blink); --i >= -3; + cachep = CL(cachep->blink)) printf("0x%lx ", cachep); printf("\n"); } @@ -124,7 +124,7 @@ PUBLIC cacheentry *Executor::ROMlib_addrtocachep(Ptr addr, HVCB *vcbp) INTEGER i; headp = (cachehead *) MR(vcbp->vcbCtlBuf); - for (i = BigEndianValue(headp->nitems), retval = MR(headp->flink); --i >= 0 && + for (i = CW(headp->nitems), retval = MR(headp->flink); --i >= 0 && (addr < (Ptr) retval || addr > (Ptr) retval + sizeof(cacheentry)); retval = MR(retval->flink)) ; @@ -133,7 +133,7 @@ PUBLIC cacheentry *Executor::ROMlib_addrtocachep(Ptr addr, HVCB *vcbp) #define BTENTRY(btp, n) \ ((anykey *)((char *) (btp) + \ - BigEndianValue(((short *)((char *)(btp) + PHYSBSIZE - sizeof(short)))[-(n)]))) + CW(((short *)((char *)(btp) + PHYSBSIZE - sizeof(short)))[-(n)]))) #define BTOFFSET(btp, n) \ ((short *)((char *)(btp) + PHYSBSIZE - sizeof(short))-(n)) @@ -165,8 +165,8 @@ PUBLIC OSErr Executor::ROMlib_errortype(btparam *btpb) if (retval == dirNFErr) warning_trace_info ("catkeyp->ckrParID = %d, " "btpb->tofind.catk.ckrParID = %d", - BigEndianValue (catkeyp->ckrParID), - BigEndianValue (btpb->tofind.catk.ckrParID)); + CL (catkeyp->ckrParID), + CL (btpb->tofind.catk.ckrParID)); fs_err_hook (retval); return retval; } @@ -189,17 +189,17 @@ PRIVATE void checkbtp(btnode *btp) INTEGER i; char keylen; - flink = BigEndianValue(btp->ndFLink); - blink = BigEndianValue(btp->ndBLink); + flink = CL(btp->ndFLink); + blink = CL(btp->ndBLink); switch (btp->ndType) { case indexnode: if (btp->ndLevel > 5) warning_unexpected ("level(%d) > 5 on indexnode", btp->ndLevel); offsetp = BTOFFSET(btp, 0); expected = sizeof(btnode); - for (i = BigEndianValue(btp->ndNRecs)+1; --i >= 0; --offsetp) { - if (BigEndianValue(*offsetp) != expected) - if (BigEndianValue(*offsetp) < expected) + for (i = CW(btp->ndNRecs)+1; --i >= 0; --offsetp) { + if (CW(*offsetp) != expected) + if (CW(*offsetp) < expected) warning_unexpected ("unexpected offset"); else warning_unexpected ("curiously large offset"); @@ -219,9 +219,9 @@ PRIVATE void checkbtp(btnode *btp) warning_unexpected ("level != 1 on leafnode"); offsetp = BTOFFSET(btp, 0); expected = sizeof(btnode); - for (i = BigEndianValue(btp->ndNRecs)+1; --i >= 0; --offsetp) { - if (BigEndianValue(*offsetp) != expected) - if (BigEndianValue(*offsetp) < expected) + for (i = CW(btp->ndNRecs)+1; --i >= 0; --offsetp) { + if (CW(*offsetp) != expected) + if (CW(*offsetp) < expected) warning_unexpected ("unexpected offset"); else warning_unexpected ("curiously large offset\n"); @@ -263,7 +263,7 @@ PUBLIC BOOLEAN Executor::ROMlib_searchnode(btnode *btp, void *key, compfp fp, #if defined (CATFILEDEBUG) checkbtp(btp); #endif /* CATFILEDEBUG */ - high = BigEndianValue(btp->ndNRecs)-1; + high = CW(btp->ndNRecs)-1; totest = BTENTRY(btp, high); /* test last one by hand then use as sentinel */ switch ((*fp)(key, totest)) { case firstisless: @@ -345,7 +345,7 @@ PUBLIC OSErr Executor::ROMlib_putcache(cacheentry *cachep) BufTgDate = Time; #endif err = ROMlib_transphysblk (&((VCBExtra *)vcbp)->u.hfs, - BigEndianValue(cachep->physblock) * PHYSBSIZE, 1, + CL(cachep->physblock) * PHYSBSIZE, 1, (Ptr) cachep->buf, writing, (LONGINT *) 0); vcbsync(vcbp); } @@ -380,7 +380,7 @@ PUBLIC OSErr Executor::ROMlib_getcache(cacheentry **retpp, uint16 refnum, ULONGI OSErr err; ULONGINT physbyte; LONGINT filenum; - forktype forkwanted; + Forktype forkwanted; #if 1 INTEGER badnesscount; #endif @@ -388,20 +388,20 @@ PUBLIC OSErr Executor::ROMlib_getcache(cacheentry **retpp, uint16 refnum, ULONGI ROMlib_index_cached = FALSE; fcbp = (filecontrolblock *)((char *)MR(FCBSPtr) + refnum); vcbp = MR(fcbp->fcbVPtr); - filenum = BigEndianValue(fcbp->fcbFlNum); + filenum = CL(fcbp->fcbFlNum); forkwanted = fcbp->fcbMdRByt & RESOURCEBIT ? resourcefork : datafork; headp = (cachehead *) MR(vcbp->vcbCtlBuf); - count = BigEndianValue(headp->nitems); + count = CW(headp->nitems); lastp = 0; lastdirtyp = 0; lastfreep = 0; #if 1 badnesscount = 0; #endif - for (retval = MR(headp->flink); --count >= 0 && (BigEndianValue(retval->logblk) != logbno || - BigEndianValue(retval->refnum) != refnum || MR(retval->vptr) != vcbp || - BigEndianValue(retval->fileno) != filenum || retval->forktype != forkwanted); + for (retval = MR(headp->flink); --count >= 0 && (CL(retval->logblk) != logbno || + CW(retval->refnum) != refnum || MR(retval->vptr) != vcbp || + CL(retval->fileno) != filenum || retval->forktype != forkwanted); retval = MR(retval->flink)) { if (!(retval->flags & CACHEBUSY)) { if (retval->flags & CACHEDIRTY) { @@ -439,9 +439,9 @@ PUBLIC OSErr Executor::ROMlib_getcache(cacheentry **retpp, uint16 refnum, ULONGI makefirst(headp, retval); if (count < 0) { retval->vptr = RM(vcbp); - retval->fileno = BigEndianValue(filenum); - retval->refnum = BigEndianValue(refnum); - retval->logblk = BigEndianValue(logbno); + retval->fileno = CL(filenum); + retval->refnum = CW(refnum); + retval->logblk = CL(logbno); retval->flags = CACHEBUSY; retval->forktype = forkwanted; @@ -452,7 +452,7 @@ PUBLIC OSErr Executor::ROMlib_getcache(cacheentry **retpp, uint16 refnum, ULONGI fs_err_hook (err); return err; } - retval->physblock = BigEndianValue(physbyte / PHYSBSIZE); + retval->physblock = CL(physbyte / PHYSBSIZE); if (!(flags&GETCACHENOREAD)) err = ROMlib_transphysblk(&((VCBExtra *)vcbp)->u.hfs, physbyte, 1, (Ptr) retval->buf, reading, @@ -483,7 +483,7 @@ PUBLIC void Executor::ROMlib_checkleaves(INTEGER refnum) if (err != noErr) warning_unexpected ("getcache error"); block0p = (btblock0 *) block0cachep->buf; - node = BigEndianValue(block0p->firstleaf); + node = CL(block0p->firstleaf); expectedblink = 0; while (node != 0) { err = ROMlib_getcache(&cachep, refnum, node, 0); @@ -493,12 +493,12 @@ PUBLIC void Executor::ROMlib_checkleaves(INTEGER refnum) #if defined (CATFILEDEBUG) checkbtp(btp); #endif /* CATFILEDEBUG */ - if (BigEndianValue(btp->ndBLink) != expectedblink) + if (CL(btp->ndBLink) != expectedblink) warning_unexpected ("bad blink"); expectedblink = node; - node = BigEndianValue(btp->ndFLink); + node = CL(btp->ndFLink); } - if (BigEndianValue(block0p->lastleaf) != expectedblink) + if (CL(block0p->lastleaf) != expectedblink) warning_unexpected ("bad block0p->blink"); } #endif /* CATFILEDEBUG */ @@ -512,7 +512,7 @@ PUBLIC OSErr Executor::ROMlib_cleancache(HVCB *vcbp) headp = (cachehead *) MR(vcbp->vcbCtlBuf); err = noErr; - for (i = BigEndianValue(headp->nitems), cachep = (cacheentry *) (headp + 1); --i >= 0; + for (i = CW(headp->nitems), cachep = (cacheentry *) (headp + 1); --i >= 0; ++cachep) { if (MR(cachep->vptr) == vcbp) cachep->flags &= ~CACHEBUSY; @@ -532,7 +532,7 @@ PUBLIC OSErr Executor::ROMlib_flushcachevcbp(HVCB *vcbp) err = noErr; if (headp) { - for (i = BigEndianValue(headp->nitems), cachep = (cacheentry *) (headp + 1); + for (i = CW(headp->nitems), cachep = (cacheentry *) (headp + 1); --i >= 0; ++cachep) { if (MR(cachep->vptr) == vcbp && (cachep->flags & CACHEDIRTY)) @@ -579,7 +579,7 @@ PUBLIC OSErr Executor::ROMlib_keyfind(btparam *btpb) btpb->leafindex = 0; return noErr; } - node = BigEndianValue(((btblock0 *)cachep->buf)->root); + node = CL(((btblock0 *)cachep->buf)->root); tep->logbno = 0; tep++->cachep = cachep; #if !defined (LETGCCWAIL) @@ -604,7 +604,7 @@ PUBLIC OSErr Executor::ROMlib_keyfind(btparam *btpb) found = ROMlib_searchnode((btnode *)cachep->buf, &btpb->tofind, btpb->fp, &btpb->foundp, (INTEGER *) &tep->after); if (type == indexnode) - node = BigEndianValue(*(LONGINT *) DATAPFROMKEY(btpb->foundp)); + node = CL(*(LONGINT *) DATAPFROMKEY(btpb->foundp)); else { btpb->leafindex = tep - btpb->trail; btpb->success = found; @@ -633,14 +633,14 @@ PUBLIC OSErr Executor::ROMlib_btnext(anykey **nextpp, anykey *keyp, HVCB *vcbp) cachep = ROMlib_addrtocachep((Ptr) keyp, vcbp); btp = (btnode *) cachep->buf; - for (i = BigEndianValue(btp->ndNRecs); --i >= 0 && BTENTRY(btp, i) != keyp;) + for (i = CW(btp->ndNRecs); --i >= 0 && BTENTRY(btp, i) != keyp;) ; if (i < 0) retval = 0; - else if (i < BigEndianValue(btp->ndNRecs) - 1) + else if (i < CW(btp->ndNRecs) - 1) retval = BTENTRY(btp, i+1); - else if ((node = BigEndianValue(btp->ndFLink))) { - err = ROMlib_getcache(&cachep, BigEndianValue(cachep->refnum), node, (cacheflagtype)0); + else if ((node = CL(btp->ndFLink))) { + err = ROMlib_getcache(&cachep, CW(cachep->refnum), node, (cacheflagtype)0); if (err != noErr) { fs_err_hook (err); @@ -673,15 +673,15 @@ PRIVATE OSErr MapBitSetOrClr(cacheentry *block0cachep, LONGINT bit, INTEGER nrecs, nmapnodes; OSErr err; - refnum = BigEndianValue(block0cachep->refnum); + refnum = CW(block0cachep->refnum); cachep = block0cachep; block0p = (btblock0 *) block0cachep->buf; - nnodes = BigEndianValue(block0p->nnodes); + nnodes = CL(block0p->nnodes); gui_assert(bit < nnodes); btp = (btnode *) block0p; done = FALSE; do { - nrecs = BigEndianValue(btp->ndNRecs); + nrecs = CW(btp->ndNRecs); mapstart = (unsigned char *) BTENTRY(btp, nrecs-1); mapend = (unsigned char *) BTENTRY(btp, nrecs); nmapnodes = (mapend - mapstart) * 8; @@ -695,7 +695,7 @@ PRIVATE OSErr MapBitSetOrClr(cacheentry *block0cachep, LONGINT bit, } else { if (btp->ndFLink) { bit -= nmapnodes; - err = ROMlib_getcache(&cachep, refnum, BigEndianValue(btp->ndFLink), (cacheflagtype)0); + err = ROMlib_getcache(&cachep, refnum, CL(btp->ndFLink), (cacheflagtype)0); if (err != noErr) { fs_err_hook (err); @@ -728,23 +728,23 @@ PRIVATE OSErr add_free_nodes(cacheentry *block0cachep, ULONGINT n_new_nodes) OSErr err; cacheentry *oldcachep; - refnum = BigEndianValue(block0cachep->refnum); + refnum = CW(block0cachep->refnum); block0p = (btblock0 *) block0cachep->buf; - nnodes = BigEndianValue(block0p->nnodes); + nnodes = CL(block0p->nnodes); first_free_node = nnodes; btp = (btnode *) block0p; oldcachep = block0cachep; done = FALSE; - block0p->nnodes = BigEndianValue(nnodes + n_new_nodes); + block0p->nnodes = CL(nnodes + n_new_nodes); do { - nrecs = BigEndianValue(btp->ndNRecs); + nrecs = CW(btp->ndNRecs); mapstart = (unsigned char *) BTENTRY(btp, nrecs-1); mapend = (unsigned char *) BTENTRY(btp, nrecs); nmapnodes = (mapend - mapstart) * 8; if (nnodes + n_new_nodes > nmapnodes) { if (btp->ndFLink) { nnodes -= nmapnodes; - err = ROMlib_getcache(&newcachep, refnum, BigEndianValue(btp->ndFLink), (cacheflagtype)0); + err = ROMlib_getcache(&newcachep, refnum, CL(btp->ndFLink), (cacheflagtype)0); if (err != noErr) { fs_err_hook (err); @@ -761,7 +761,7 @@ PRIVATE OSErr add_free_nodes(cacheentry *block0cachep, ULONGINT n_new_nodes) /*-->*/ return err; } newbtp = (btnode *) newcachep->buf; - btp->ndFLink = BigEndianValue(first_free_node); + btp->ndFLink = CL(first_free_node); memset((char *) newbtp, 0, PHYSBSIZE); newbtp->ndType = CB(mapnode); /* 2 */ newbtp->ndNRecs = CWC(1); @@ -777,7 +777,7 @@ PRIVATE OSErr add_free_nodes(cacheentry *block0cachep, ULONGINT n_new_nodes) } else done = TRUE; } while (!done); - block0p->nfreenodes = BigEndianValue(BigEndianValue(block0p->nfreenodes) + n_new_nodes); + block0p->nfreenodes = CL(CL(block0p->nfreenodes) + n_new_nodes); return noErr; } @@ -812,15 +812,15 @@ PRIVATE OSErr MapFindFirstBitAndSet(cacheentry *block0cachep, ULONGINT retval; ULONGINT n; - refnum = BigEndianValue(block0cachep->refnum); + refnum = CW(block0cachep->refnum); cachep = block0cachep; block0p = (btblock0 *) block0cachep->buf; - nnodes = BigEndianValue(block0p->nnodes); + nnodes = CL(block0p->nnodes); btp = (btnode *) block0p; done = FALSE; retval = 0; do { - nrecs = BigEndianValue(btp->ndNRecs); + nrecs = CW(btp->ndNRecs); mapstart = (unsigned char *) BTENTRY(btp, nrecs-1); mapend = (unsigned char *) BTENTRY(btp, nrecs); nmapnodes = (mapend - mapstart) * 8; @@ -833,7 +833,7 @@ PRIVATE OSErr MapFindFirstBitAndSet(cacheentry *block0cachep, } else { if (btp->ndFLink) { retval += nmapnodes; - err = ROMlib_getcache(&cachep, refnum, BigEndianValue(btp->ndFLink), (cacheflagtype)0); + err = ROMlib_getcache(&cachep, refnum, CL(btp->ndFLink), (cacheflagtype)0); if (err != noErr) { fs_err_hook (err); @@ -860,7 +860,7 @@ PRIVATE OSErr deletenode(cacheentry *todeletep) OSErr err; INTEGER refnum; - refnum = BigEndianValue(todeletep->refnum); + refnum = CW(todeletep->refnum); err = ROMlib_getcache(&block0cachep, refnum, 0L, GETCACHESAVE); if (err != noErr) { @@ -872,16 +872,16 @@ PRIVATE OSErr deletenode(cacheentry *todeletep) #if defined (CATFILEDEBUG) checkbtp(btp); #endif /* CATFILEDEBUG */ - node = BigEndianValue(todeletep->logblk); + node = CL(todeletep->logblk); #if 0 if (btp->ndType == leafnode) { #endif - flink = BigEndianValue(btp->ndFLink); - blink = BigEndianValue(btp->ndBLink); - if (BigEndianValue(block0p->firstleaf) == node) - block0p->firstleaf = BigEndianValue(flink); - if (BigEndianValue(block0p->lastleaf) == node) - block0p->lastleaf = BigEndianValue(blink); + flink = CL(btp->ndFLink); + blink = CL(btp->ndBLink); + if (CL(block0p->firstleaf) == node) + block0p->firstleaf = CL(flink); + if (CL(block0p->lastleaf) == node) + block0p->lastleaf = CL(blink); if (blink) { err = ROMlib_getcache(&linkcachep, refnum, blink, (cacheflagtype)0); if (err != noErr) @@ -890,7 +890,7 @@ PRIVATE OSErr deletenode(cacheentry *todeletep) return err; } linkbtp = (btnode *) linkcachep->buf; - linkbtp->ndFLink = BigEndianValue(flink); + linkbtp->ndFLink = CL(flink); linkcachep->flags |= CACHEDIRTY; } if (flink) { @@ -901,13 +901,13 @@ PRIVATE OSErr deletenode(cacheentry *todeletep) return err; } linkbtp = (btnode *) linkcachep->buf; - linkbtp->ndBLink = BigEndianValue(blink); + linkbtp->ndBLink = CL(blink); linkcachep->flags |= CACHEDIRTY; } #if 0 } #endif - block0p->nfreenodes = BigEndianValue(BigEndianValue(block0p->nfreenodes) + 1); + block0p->nfreenodes = CL(CL(block0p->nfreenodes) + 1); MapBitSetOrClr(block0cachep, node, FALSE); block0cachep->flags |= CACHEDIRTY; memset(todeletep->buf, 0, PHYSBSIZE); @@ -918,8 +918,8 @@ PRIVATE OSErr deletenode(cacheentry *todeletep) typedef enum { leavealone, doleft, doright } whichnodetype; #define FREESIZE(btp) \ - (((char *) (btp) + PHYSBSIZE - (BigEndianValue((btp)->ndNRecs)+1)*sizeof(short)) - \ - (char *) BTENTRY((btp), BigEndianValue((btp)->ndNRecs))) + (((char *) (btp) + PHYSBSIZE - (CW((btp)->ndNRecs)+1)*sizeof(short)) - \ + (char *) BTENTRY((btp), CW((btp)->ndNRecs))) #define SIZECUTOFF ((PHYSBSIZE - (int) sizeof(btnode)) / 2) @@ -942,21 +942,21 @@ PRIVATE OSErr merge(cacheentry *leftp, cacheentry *rightp) checkbtp(leftbtp); checkbtp(rightbtp); #endif - nrecs = BigEndianValue(rightbtp->ndNRecs); + nrecs = CW(rightbtp->ndNRecs); datastart = (char *) BTENTRY(rightbtp, 0); datastop = (char *) BTENTRY(rightbtp, nrecs); datasize = datastop - datastart; - memmove(BTENTRY(leftbtp, BigEndianValue(leftbtp->ndNRecs)), datastart, datasize); + memmove(BTENTRY(leftbtp, CW(leftbtp->ndNRecs)), datastart, datasize); - offsetp = BTOFFSET(leftbtp, BigEndianValue(leftbtp->ndNRecs)); + offsetp = BTOFFSET(leftbtp, CW(leftbtp->ndNRecs)); n = 0; for (i = nrecs, n = 0; --i >= 0; ++n) { - offsetp[-1] = BigEndianValue(BigEndianValue(offsetp[0]) + (char *) BTENTRY(rightbtp, n+1) - + offsetp[-1] = CW(CW(offsetp[0]) + (char *) BTENTRY(rightbtp, n+1) - (char *) BTENTRY(rightbtp, n)); --offsetp; } - leftbtp->ndNRecs = BigEndianValue(BigEndianValue(leftbtp->ndNRecs) + (nrecs)); + leftbtp->ndNRecs = CW(CW(leftbtp->ndNRecs) + (nrecs)); if (!(rightp->flags & CACHEBUSY)) warning_unexpected ("not busy"); if (!(leftp->flags & CACHEBUSY)) @@ -995,7 +995,7 @@ PRIVATE OSErr shuffle(cacheentry *leftp, cacheentry *rightp) if (leftfreesize < rightfreesize) { /* copy from left to right; almost the same code as below */ /* NOTE: if you find a bug here, look for a similar bug below */ - n = BigEndianValue(leftbtp->ndNRecs) - 1; + n = CW(leftbtp->ndNRecs) - 1; while (rightfreesize > SIZECUTOFF) { numtocopy++; recstart = (char *) BTENTRY(leftbtp, n); @@ -1005,28 +1005,28 @@ PRIVATE OSErr shuffle(cacheentry *leftp, cacheentry *rightp) rightfreesize -= sizeof(INTEGER) + recsize; --n; } - rightdatasize = (char *) BTENTRY(rightbtp, BigEndianValue(rightbtp->ndNRecs)) - + rightdatasize = (char *) BTENTRY(rightbtp, CW(rightbtp->ndNRecs)) - rightbtentry0; memmove(rightbtentry0+bytestoshift, rightbtentry0, rightdatasize); memmove(rightbtentry0, recstart, bytestoshift); - offsetp = BTOFFSET(rightbtp, BigEndianValue(rightbtp->ndNRecs) + numtocopy); - for (i = BigEndianValue(rightbtp->ndNRecs); --i >= 0;) { - offsetp[0] = BigEndianValue(BigEndianValue(offsetp[numtocopy]) + bytestoshift); + offsetp = BTOFFSET(rightbtp, CW(rightbtp->ndNRecs) + numtocopy); + for (i = CW(rightbtp->ndNRecs); --i >= 0;) { + offsetp[0] = CW(CW(offsetp[numtocopy]) + bytestoshift); ++offsetp; } offsetp = BTOFFSET(rightbtp, 0); ++n; for (i = numtocopy; --i >= 0;) { - offsetp[-1] = BigEndianValue(BigEndianValue(offsetp[0]) + (char *) BTENTRY(leftbtp, n+1) - + offsetp[-1] = CW(CW(offsetp[0]) + (char *) BTENTRY(leftbtp, n+1) - (char *) BTENTRY(leftbtp, n)); --offsetp; ++n; } - leftbtp ->ndNRecs = BigEndianValue(BigEndianValue(leftbtp ->ndNRecs) - (numtocopy)); - rightbtp->ndNRecs = BigEndianValue(BigEndianValue(rightbtp->ndNRecs) + (numtocopy)); + leftbtp ->ndNRecs = CW(CW(leftbtp ->ndNRecs) - (numtocopy)); + rightbtp->ndNRecs = CW(CW(rightbtp->ndNRecs) + (numtocopy)); } else { /* copy from right to left; almost the same code as above */ /* NOTE: if you find a bug here, look for a similar bug above */ @@ -1040,29 +1040,29 @@ PRIVATE OSErr shuffle(cacheentry *leftp, cacheentry *rightp) leftfreesize -= sizeof(INTEGER) + recsize; ++n; } - rightdatasize = (char *) BTENTRY(rightbtp, BigEndianValue(rightbtp->ndNRecs)) - + rightdatasize = (char *) BTENTRY(rightbtp, CW(rightbtp->ndNRecs)) - recend; - memmove(BTENTRY(leftbtp, BigEndianValue(leftbtp->ndNRecs)), + memmove(BTENTRY(leftbtp, CW(leftbtp->ndNRecs)), rightbtentry0, bytestoshift); memmove(rightbtentry0, recend, rightdatasize); - offsetp = BTOFFSET(leftbtp, BigEndianValue(leftbtp->ndNRecs)); + offsetp = BTOFFSET(leftbtp, CW(leftbtp->ndNRecs)); n = 0; for (i = numtocopy; --i >= 0;) { - offsetp[-1] = BigEndianValue(BigEndianValue(offsetp[0]) + (char *) BTENTRY(rightbtp, n+1) - + offsetp[-1] = CW(CW(offsetp[0]) + (char *) BTENTRY(rightbtp, n+1) - (char *) BTENTRY(rightbtp, n)); --offsetp; ++n; } offsetp = BTOFFSET(rightbtp, 1); - for (i = BigEndianValue(rightbtp->ndNRecs) - numtocopy; --i >= 0;) { - offsetp[0] = BigEndianValue(BigEndianValue(offsetp[-numtocopy]) - bytestoshift); + for (i = CW(rightbtp->ndNRecs) - numtocopy; --i >= 0;) { + offsetp[0] = CW(CW(offsetp[-numtocopy]) - bytestoshift); --offsetp; } - rightbtp->ndNRecs = BigEndianValue(BigEndianValue(rightbtp->ndNRecs) - (numtocopy)); - leftbtp ->ndNRecs = BigEndianValue(BigEndianValue(leftbtp->ndNRecs) + (numtocopy)); + rightbtp->ndNRecs = CW(CW(rightbtp->ndNRecs) - (numtocopy)); + leftbtp ->ndNRecs = CW(CW(leftbtp->ndNRecs) + (numtocopy)); } #if defined (CATFILEDEBUG) @@ -1120,7 +1120,7 @@ PRIVATE OSErr pullout(cacheentry *selfcachep, INTEGER selfindex, modrightkey = FALSE; *todeletep = -1; btp = (btnode *) selfcachep->buf; - if (selfindex < 0 || selfindex >= BigEndianValue(btp->ndNRecs)) { + if (selfindex < 0 || selfindex >= CW(btp->ndNRecs)) { warning_unexpected ("fried selfindex"); err = fsDSIntErr; fs_err_hook (err); @@ -1135,16 +1135,16 @@ PRIVATE OSErr pullout(cacheentry *selfcachep, INTEGER selfindex, selfcachep->flags |= CACHEDIRTY; startp = (char *) BTENTRY(btp, selfindex); stopp = (char *) BTENTRY(btp, selfindex+1); - freep = (char *) BTENTRY(btp, BigEndianValue(btp->ndNRecs)); + freep = (char *) BTENTRY(btp, CW(btp->ndNRecs)); memmove(startp, stopp, freep - stopp); - ntoadjust = BigEndianValue(btp->ndNRecs) - selfindex; + ntoadjust = CW(btp->ndNRecs) - selfindex; offsetp = BTOFFSET(btp, selfindex); adjust = stopp - startp; while (--ntoadjust >= 0) { - *offsetp = BigEndianValue(BigEndianValue(offsetp[-1]) - adjust); + *offsetp = CW(CW(offsetp[-1]) - adjust); --offsetp; } - btp->ndNRecs = BigEndianValue(BigEndianValue(btp->ndNRecs) - 1); + btp->ndNRecs = CW(CW(btp->ndNRecs) - 1); if (selfindex == 0) modselfkey = TRUE; @@ -1164,11 +1164,11 @@ PRIVATE OSErr pullout(cacheentry *selfcachep, INTEGER selfindex, checkbtp(parentbtp); #endif /* CATFILEDEBUG */ if (parentindex > 0) - left = BigEndianValue(*(LONGINT *)DATAPFROMKEY(BTENTRY(parentbtp, parentindex-1))); + left = CL(*(LONGINT *)DATAPFROMKEY(BTENTRY(parentbtp, parentindex-1))); else left = -1; - if (parentindex < BigEndianValue(parentbtp->ndNRecs) - 1) - right = BigEndianValue(*(LONGINT *)DATAPFROMKEY(BTENTRY(parentbtp, parentindex+1))); + if (parentindex < CW(parentbtp->ndNRecs) - 1) + right = CL(*(LONGINT *)DATAPFROMKEY(BTENTRY(parentbtp, parentindex+1))); else right = -1; } else { @@ -1176,7 +1176,7 @@ PRIVATE OSErr pullout(cacheentry *selfcachep, INTEGER selfindex, right = -1; } if (left >= 0) { - err = ROMlib_getcache(&leftcachep, BigEndianValue(selfcachep->refnum), left, GETCACHESAVE); + err = ROMlib_getcache(&leftcachep, CW(selfcachep->refnum), left, GETCACHESAVE); if (err != noErr) { fs_err_hook (err); @@ -1201,7 +1201,7 @@ PRIVATE OSErr pullout(cacheentry *selfcachep, INTEGER selfindex, } } if (!done && right >= 0) { - err = ROMlib_getcache(&rightcachep, BigEndianValue(selfcachep->refnum), right, + err = ROMlib_getcache(&rightcachep, CW(selfcachep->refnum), right, GETCACHESAVE); if (err != noErr) { @@ -1292,8 +1292,8 @@ PRIVATE OSErr maketrailentrybusy(trailentry *tep, uint16 refnum) HVCB *SWvcbp; SWvcbp = ((filecontrolblock *)((char *)MR(FCBSPtr) + refnum))->fcbVPtr; - if (BigEndianValue(tep->cachep->refnum) != refnum || - BigEndianValue(tep->cachep->logblk) != tep->logbno || tep->cachep->vptr != SWvcbp) + if (CW(tep->cachep->refnum) != refnum || + CL(tep->cachep->logblk) != tep->logbno || tep->cachep->vptr != SWvcbp) err = ROMlib_getcache(&tep->cachep, refnum, tep->logbno, GETCACHESAVE); else { err = noErr; @@ -1322,7 +1322,7 @@ PRIVATE OSErr deleteroot(cacheentry *oldrootp, cacheentry *block0cachep) /* update height, root */ block0p = (btblock0 *) block0cachep->buf; - block0p->height = BigEndianValue(BigEndianValue(block0p->height) - 1); + block0p->height = CW(CW(block0p->height) - 1); block0p->root = *(ULONGINT *) DATAPFROMKEY(BTENTRY((btnode *) oldrootp->buf, 0)); if (!(block0cachep->flags & CACHEBUSY)) @@ -1359,7 +1359,7 @@ PRIVATE OSErr updatenumentries(cacheentry *block0cachep, INTEGER adjust) btblock0 *block0p; block0p = (btblock0 *) block0cachep->buf; - block0p->numentries = BigEndianValue(BigEndianValue(block0p->numentries) + (adjust)); + block0p->numentries = CL(CL(block0p->numentries) + (adjust)); if (!(block0cachep->flags & CACHEBUSY)) warning_unexpected ("not busy"); block0cachep->flags |= CACHEDIRTY; @@ -1395,7 +1395,7 @@ PUBLIC OSErr Executor::ROMlib_btdelete(btparam *btpb) tep = btpb->trail + btpb->leafindex; selfindex = tep->after; done = FALSE; - refnum = BigEndianValue(btpb->trail[0].cachep->refnum); + refnum = CW(btpb->trail[0].cachep->refnum); if (((btblock0 *)btpb->trail[0].cachep->buf)->numentries == CLC(1)) { err = maketrailentrybusy(&btpb->trail[1], refnum); if (err != noErr) @@ -1503,7 +1503,7 @@ PUBLIC OSErr Executor::ROMlib_makecatparam(btparam *btpb, HVCB *vcbp, LONGINT di btpb->vcbp = vcbp; retval = ROMlib_makecatkey((catkey *) &btpb->tofind, dirid, namelen, namep); btpb->fp = ROMlib_catcompare; - btpb->refnum = BigEndianValue(vcbp->vcbCTRef); + btpb->refnum = CW(vcbp->vcbCTRef); btpb->leafindex = -1; fs_err_hook (retval); return retval; @@ -1556,32 +1556,32 @@ PRIVATE OSErr valenceadjust(btparam *btpb, INTEGER toadjust, filekind kind) } if (err == noErr) { err = ROMlib_makecatparam(&btparamblock, btpb->vcbp, - BigEndianValue(btpb->tofind.catk.ckrParID), 0, (Ptr) 0); + CL(btpb->tofind.catk.ckrParID), 0, (Ptr) 0); if (err == noErr) err = ROMlib_keyfind(&btparamblock); if (err == noErr && btparamblock.success) { thdp = (threadrec *) DATAPFROMKEY(btparamblock.foundp); - err = ROMlib_makecatkey((catkey *) &btparamblock.tofind, BigEndianValue(thdp->thdParID), + err = ROMlib_makecatkey((catkey *) &btparamblock.tofind, CL(thdp->thdParID), thdp->thdCName[0], (Ptr) thdp->thdCName+1); /* don't need to remake btparamblock */ if (err == noErr) err = ROMlib_keyfind(&btparamblock); if (err == noErr && btparamblock.success) { drp = (directoryrec *) DATAPFROMKEY(btparamblock.foundp); - drp->dirVal = BigEndianValue(BigEndianValue(drp->dirVal) + (toadjust)); + drp->dirVal = CW(CW(drp->dirVal) + (toadjust)); err = ROMlib_dirtyleaf(drp, btpb->vcbp); if (err == noErr) { - *countadj = BigEndianValue(BigEndianValue(*countadj) + (toadjust)); + *countadj = CL(CL(*countadj) + (toadjust)); if (drp->dirDirID == CLC(2)) { if (kind == directory) btpb->vcbp->vcbNmRtDirs = - BigEndianValue(BigEndianValue(btpb->vcbp->vcbNmRtDirs) + toadjust); + CW(CW(btpb->vcbp->vcbNmRtDirs) + toadjust); else btpb->vcbp->vcbNmFls = - BigEndianValue(BigEndianValue(btpb->vcbp->vcbNmFls) + toadjust); + CW(CW(btpb->vcbp->vcbNmFls) + toadjust); } - btpb->vcbp->vcbFlags |= BigEndianValue(VCBDIRTY); + btpb->vcbp->vcbFlags |= CW(VCBDIRTY); } } else { if (err == noErr) { @@ -1626,7 +1626,7 @@ PUBLIC OSErr Executor::ROMlib_dirdelete(btparam *btpb) LONGINT dirid; drp = (directoryrec *) DATAPFROMKEY(btpb->foundp); - dirid = BigEndianValue(drp->dirDirID); + dirid = CL(drp->dirDirID); err = ROMlib_filedelete(btpb, directory); if (err == noErr) { /* nuke the thread record */ err = ROMlib_makecatkey((catkey *) &btpb->tofind, dirid, 0, (Ptr) 0); @@ -1653,7 +1653,7 @@ PRIVATE OSErr savebusybuffers(HVCB *vcbp, saverec_t ***savehandlep) OSErr err; headp = (cachehead *) MR(vcbp->vcbCtlBuf); - count = BigEndianValue(headp->nitems); + count = CW(headp->nitems); retval = (saverec_t **) NewHandle((Size) 0); if (retval == 0) @@ -1665,8 +1665,8 @@ PRIVATE OSErr savebusybuffers(HVCB *vcbp, saverec_t ***savehandlep) cursize = 0; for (cachep = MR(headp->flink); --count >= 0; cachep = MR(cachep->flink)) { if (cachep->flags & CACHEBUSY) { - tempsaverec.refnum = BigEndianValue(cachep->refnum); - tempsaverec.logbno = BigEndianValue(cachep->logblk); + tempsaverec.refnum = CW(cachep->refnum); + tempsaverec.logbno = CL(cachep->logblk); SetHandleSize((Handle) retval, cursize + sizeof(tempsaverec)); memmove((char *) MR(*retval) + cursize, &tempsaverec, sizeof(tempsaverec)); @@ -1704,16 +1704,16 @@ PRIVATE OSErr getfreenode(cacheentry **newcachepp, cacheentry *block0cachep) cacheentry *newcachep; btblock0 *block0p; ULONGINT nblocksalloced, newblock; - ioParam iop; + IOParam iop; INTEGER refnum, flags; filecontrolblock *fcbp; saverec_t **busysave; - refnum = BigEndianValue(block0cachep->refnum); + refnum = CW(block0cachep->refnum); block0p = (btblock0 *) block0cachep->buf; if (block0p->nfreenodes == CLC(0)) { fcbp = (filecontrolblock *) ((char *)MR(FCBSPtr) + refnum); - iop.ioRefNum = BigEndianValue(refnum); + iop.ioRefNum = CW(refnum); iop.ioReqCount = fcbp->fcbClmpSize; /* We never add more than one extra mapping page, so we need @@ -1726,7 +1726,7 @@ PRIVATE OSErr getfreenode(cacheentry **newcachepp, cacheentry *block0cachep) max_bytes_we_can_map = (MAP_PAGE_MAP_END - MAP_PAGE_MAP_BEGIN) * 8 * PHYSBSIZE; - if (BigEndianValue (iop.ioReqCount) > max_bytes_we_can_map) + if (CL (iop.ioReqCount) > max_bytes_we_can_map) iop.ioReqCount = CLC (max_bytes_we_can_map); } @@ -1743,7 +1743,7 @@ PRIVATE OSErr getfreenode(cacheentry **newcachepp, cacheentry *block0cachep) MR(fcbp->fcbVPtr)->vcbFlags |= CWC(VCBDIRTY); ROMlib_flushvcbp(MR(fcbp->fcbVPtr)); /* just setting DIRTY isn't safe */ err1 = restorebusybuffers(busysave); - if (err == noErr || (err == dskFulErr && BigEndianValue(iop.ioActCount) > 0)) + if (err == noErr || (err == dskFulErr && CL(iop.ioActCount) > 0)) err = err1; fcbp->fcbMdRByt = flags; if (err != noErr) @@ -1751,7 +1751,7 @@ PRIVATE OSErr getfreenode(cacheentry **newcachepp, cacheentry *block0cachep) fs_err_hook (err); return err; } - nblocksalloced = BigEndianValue(iop.ioActCount) / PHYSBSIZE; + nblocksalloced = CL(iop.ioActCount) / PHYSBSIZE; if (nblocksalloced <= 0) { warning_unexpected ("nblocksalloced <= 0"); err = fsDSIntErr; @@ -1771,7 +1771,7 @@ PRIVATE OSErr getfreenode(cacheentry **newcachepp, cacheentry *block0cachep) fs_err_hook (err); /*-->*/ return err; } - block0p->nfreenodes = BigEndianValue(BigEndianValue(block0p->nfreenodes) - 1); + block0p->nfreenodes = CL(CL(block0p->nfreenodes) - 1); if (!(block0cachep->flags & CACHEBUSY)) warning_unexpected ("not busy"); block0cachep->flags |= CACHEDIRTY; @@ -1791,7 +1791,7 @@ PRIVATE OSErr getnewnode(cacheentry **newcachepp, cacheentry *leftp) INTEGER refnum; ULONGINT newnode, leftnode, flink; - refnum = BigEndianValue(leftp->refnum); + refnum = CW(leftp->refnum); err = ROMlib_getcache(&block0cachep, refnum, 0L, GETCACHESAVE); if (err != noErr) { @@ -1802,24 +1802,24 @@ PRIVATE OSErr getnewnode(cacheentry **newcachepp, cacheentry *leftp) err = getfreenode(&newcachep, block0cachep); *newcachepp = newcachep; newbtp = (btnode *) newcachep->buf; - newnode = BigEndianValue(newcachep->logblk); + newnode = CL(newcachep->logblk); leftbtp = (btnode *) leftp->buf; #if defined (CATFILEDEBUG) checkbtp(leftbtp); #endif /* CATFILEDEBUG */ - memmove(newbtp, leftbtp, (sizeof(BigEndianValue(leftbtp->ndFLink)) - + sizeof(BigEndianValue(leftbtp->ndBLink)) + memmove(newbtp, leftbtp, (sizeof(CL(leftbtp->ndFLink)) + + sizeof(CL(leftbtp->ndBLink)) + sizeof(leftbtp->ndType) + sizeof(leftbtp->ndLevel))); - leftnode = BigEndianValue(leftp->logblk); - if (BigEndianValue(block0p->lastleaf) == leftnode) - block0p->lastleaf = BigEndianValue(newnode); - leftbtp->ndFLink = BigEndianValue(newnode); + leftnode = CL(leftp->logblk); + if (CL(block0p->lastleaf) == leftnode) + block0p->lastleaf = CL(newnode); + leftbtp->ndFLink = CL(newnode); if (!(leftp->flags & CACHEBUSY)) warning_unexpected ("not busy"); leftp->flags |= CACHEDIRTY; - newbtp->ndBLink = BigEndianValue(leftnode); - if ((flink = BigEndianValue(newbtp->ndFLink))) { + newbtp->ndBLink = CL(leftnode); + if ((flink = CL(newbtp->ndFLink))) { err = ROMlib_getcache(&linkcachep, refnum, flink, (cacheflagtype)0); if (err != noErr) { @@ -1827,7 +1827,7 @@ PRIVATE OSErr getnewnode(cacheentry **newcachepp, cacheentry *leftp) return err; } linkbtp = (btnode *) linkcachep->buf; - linkbtp->ndBLink = BigEndianValue(newnode); + linkbtp->ndBLink = CL(newnode); linkcachep->flags |= CACHEDIRTY; } if (!(block0cachep->flags & CACHEBUSY)) @@ -1870,7 +1870,7 @@ PRIVATE OSErr slipin(cacheentry *cachep, INTEGER after, anykey *keyp, #endif /* CATFILEDEBUG */ vcbp = MR(cachep->vptr); firstoffset = (short *)((char *)btp + PHYSBSIZE) - 1; - nrecs = BigEndianValue(btp->ndNRecs); + nrecs = CW(btp->ndNRecs); keysize = EVENUP(((catkey *)keyp)->ckrKeyLen + 1); datasize = EVENUP(datasize); sizeneeded = keysize + datasize + sizeof(INTEGER); @@ -1883,10 +1883,10 @@ PRIVATE OSErr slipin(cacheentry *cachep, INTEGER after, anykey *keyp, memmove(keylocp, keyp, keysize); memmove(keylocp + keysize, data, datasize); for (i = nrecs - after, offsetp = &firstoffset[-nrecs - 1]; --i >= 0;) { - offsetp[0] = BigEndianValue(BigEndianValue(offsetp[1]) + datasize + keysize); + offsetp[0] = CW(CW(offsetp[1]) + datasize + keysize); ++offsetp; } - btp->ndNRecs = BigEndianValue(BigEndianValue(btp->ndNRecs) + 1); + btp->ndNRecs = CW(CW(btp->ndNRecs) + 1); if (cachepp) *cachepp = 0; if (!(cachep->flags & CACHEBUSY)) @@ -1905,7 +1905,7 @@ PRIVATE OSErr slipin(cacheentry *cachep, INTEGER after, anykey *keyp, fs_err_hook (err); return err; } - newnode = BigEndianValue(newcachep->logblk); + newnode = CL(newcachep->logblk); newbtp = (btnode *) newcachep->buf; if (cachepp) *cachepp = newcachep; @@ -1934,11 +1934,11 @@ PRIVATE OSErr slipin(cacheentry *cachep, INTEGER after, anykey *keyp, offsetp = (INTEGER *) ((char *)newbtp + PHYSBSIZE); for (i = noffsets; --i >= 0;) { --offsetp; - *offsetp = BigEndianValue(BigEndianValue(*offsetp) - shim); + *offsetp = CW(CW(*offsetp) - shim); } - newbtp->ndNRecs = BigEndianValue(noffsets - 1); - btp->ndNRecs = BigEndianValue(newfirst); + newbtp->ndNRecs = CW(noffsets - 1); + btp->ndNRecs = CW(newfirst); #if defined (CATFILEDEBUG) checkbtp(btp); @@ -1988,8 +1988,8 @@ PRIVATE OSErr makenewroot(cacheentry *leftp, cacheentry *rightp, newbtp->ndFLink = 0; newbtp->ndBLink = 0; newbtp->ndType = indexnode; - block0p->height = BigEndianValue(BigEndianValue(block0p->height) + 1); - newbtp->ndLevel = BigEndianValue(block0p->height); + block0p->height = CW(CW(block0p->height) + 1); + newbtp->ndLevel = CW(block0p->height); leftbtp = (btnode *) leftp->buf; if (rightp) { rightbtp = (btnode *) rightp->buf; @@ -2008,22 +2008,22 @@ PRIVATE OSErr makenewroot(cacheentry *leftp, cacheentry *rightp, block0p->root = newcachep->logblk; block0cachep->flags |= CACHEDIRTY; offsetp = BTOFFSET(newbtp, 0); - keylen = EVENUP(BigEndianValue(block0p->indexkeylen) + 1); - offsetp[ 0] = BigEndianValue(sizeof(btnode)); + keylen = EVENUP(CW(block0p->indexkeylen) + 1); + offsetp[ 0] = CW(sizeof(btnode)); keydst = (char *) BTENTRY(newbtp, 0); memmove(keydst, BTENTRY(leftbtp, 0), keylen); *keydst = keylen - 1; *(ULONGINT *)(keydst + keylen) = leftp->logblk; if (rightp) { --offsetp; - offsetp[0] = BigEndianValue(BigEndianValue(offsetp[1]) + keylen + sizeof(ULONGINT)); + offsetp[0] = CW(CW(offsetp[1]) + keylen + sizeof(ULONGINT)); keydst = (char *) BTENTRY(newbtp, 1); memmove(keydst, BTENTRY(rightbtp, 0), keylen); *keydst = keylen-1; *(ULONGINT *)(keydst + keylen) = rightp->logblk; } --offsetp; - offsetp[0] = BigEndianValue(BigEndianValue(offsetp[1]) + keylen + sizeof(ULONGINT)); + offsetp[0] = CW(CW(offsetp[1]) + keylen + sizeof(ULONGINT)); #if defined (CATFILEDEBUG) checkbtp(newbtp); checkbtp(leftbtp); @@ -2066,7 +2066,7 @@ PRIVATE OSErr makefirstentry(btparam *btpb, char *datap, INTEGER datasize) memmove(keydst, &btpb->tofind, keylen); memmove(keydst+keylen, datap, datasize); --offsetp; - offsetp[0] = BigEndianValue(BigEndianValue(offsetp[1]) + keylen + EVENUP(datasize)); + offsetp[0] = CW(CW(offsetp[1]) + keylen + EVENUP(datasize)); if (!(leafp->flags & CACHEBUSY)) warning_unexpected ("not busy"); leafp->flags |= CACHEDIRTY; @@ -2074,9 +2074,9 @@ PRIVATE OSErr makefirstentry(btparam *btpb, char *datap, INTEGER datasize) block0p->height = CWC(1); block0p->root = leafp->logblk; block0p->numentries = CLC(1); - newnode = BigEndianValue(leafp->logblk); - block0p->firstleaf = BigEndianValue(newnode); - block0p->lastleaf = BigEndianValue(newnode); + newnode = CL(leafp->logblk); + block0p->firstleaf = CL(newnode); + block0p->lastleaf = CL(newnode); if (!(block0cachep->flags & CACHEBUSY)) warning_unexpected ("not busy"); block0cachep->flags |= CACHEDIRTY; @@ -2106,8 +2106,8 @@ PRIVATE OSErr btcreate(btparam *btpb, void *datap, INTEGER datasize) } block0p = (btblock0 *) block0cachep->buf; vcbp = MR(block0cachep->vptr); - potentialfree = BigEndianValue(block0p->nfreenodes); - potentialfree += BigEndianValue(vcbp->vcbFreeBks) * (BigEndianValue(vcbp->vcbAlBlkSiz) / PHYSBSIZE); + potentialfree = CL(block0p->nfreenodes); + potentialfree += CW(vcbp->vcbFreeBks) * (CL(vcbp->vcbAlBlkSiz) / PHYSBSIZE); /* @@ -2121,7 +2121,7 @@ PRIVATE OSErr btcreate(btparam *btpb, void *datap, INTEGER datasize) * I think in non-contrived situations this is EXTREMELY unlikely to occur. */ - if (potentialfree < (ULONGINT) BigEndianValue(block0p->height) + 1) + if (potentialfree < (ULONGINT) CW(block0p->height) + 1) { err = dskFulErr; fs_err_hook (err); @@ -2152,7 +2152,7 @@ PRIVATE OSErr btcreate(btparam *btpb, void *datap, INTEGER datasize) datatoinsertp = (char*)datap; sizetoinsert = datasize; done = FALSE; - refnum = BigEndianValue(block0cachep->refnum); + refnum = CW(block0cachep->refnum); while (!done) { err = maketrailentrybusy(tep, refnum); err = slipin(tep->cachep, tep->after, keytoinsertp, datatoinsertp, @@ -2181,7 +2181,7 @@ PRIVATE OSErr btcreate(btparam *btpb, void *datap, INTEGER datasize) #if 0 keylen = BTENTRY((btnode *)tep->cachep->buf, 0)->keylen; #else - keylen = BigEndianValue(block0p->indexkeylen); + keylen = CW(block0p->indexkeylen); #endif keytoinsertp = BTENTRY(newbtp, 0); if (keytoinsertp->keylen < keylen) { @@ -2259,7 +2259,7 @@ PUBLIC OSErr Executor::ROMlib_dircreate(btparam *btpb, directoryrec *data) if (err == noErr) { makethreadrec(&rec, ((catkey *) &btpb->tofind)->ckrParID, ((catkey *) &btpb->tofind)->ckrCName); - err = ROMlib_makecatkey((catkey *) &btpb->tofind, BigEndianValue(data->dirDirID), 0, (Ptr) 0); + err = ROMlib_makecatkey((catkey *) &btpb->tofind, CL(data->dirDirID), 0, (Ptr) 0); btpb->leafindex = -1; if (err == noErr) err = btcreate(btpb, &rec, sizeof(rec)); @@ -2274,12 +2274,12 @@ PUBLIC xtntkey *Executor::ROMlib_newextentrecord(filecontrolblock *fcbp, uint16 HVCB *vcbp; btparam btparamrec; OSErr err; - forktype forkwanted; + Forktype forkwanted; vcbp = MR(fcbp->fcbVPtr); forkwanted = fcbp->fcbMdRByt & RESOURCEBIT ? resourcefork : datafork; memset(&rec, 0, sizeof(rec)); - ROMlib_makextntparam(&btparamrec, vcbp, forkwanted, BigEndianValue(fcbp->fcbFlNum), newabn); + ROMlib_makextntparam(&btparamrec, vcbp, forkwanted, CL(fcbp->fcbFlNum), newabn); if ((err = btcreate(&btparamrec, rec, sizeof(rec))) != noErr) { warning_unexpected ("couldn't create new xtntrec"); return 0; @@ -2302,7 +2302,7 @@ PUBLIC OSErr Executor::ROMlib_btrename(btparam *btpb, StringPtr newnamep) newbtparam = *btpb; err = ROMlib_makecatkey((catkey *) &newbtparam.tofind, - BigEndianValue(((catkey *) &btpb->tofind)->ckrParID), newnamep[0], + CL(((catkey *) &btpb->tofind)->ckrParID), newnamep[0], (Ptr) newnamep+1); newbtparam.leafindex = -1; /* I don't think this line does anything */ /* useful, but I noticed it the day that */ @@ -2349,7 +2349,7 @@ PUBLIC OSErr Executor::ROMlib_btrename(btparam *btpb, StringPtr newnamep) err = ROMlib_btdelete(btpb); if (err == noErr && ((filerec *)datap)->cdrType == DIRTYPE) { err = ROMlib_makecatkey((catkey *) &newbtparam.tofind, - BigEndianValue(((directoryrec *)datap)->dirDirID), 0, (Ptr) 0); + CL(((directoryrec *)datap)->dirDirID), 0, (Ptr) 0); newbtparam.leafindex = -1; if (err == noErr) err = btlegitimize(&newbtparam); @@ -2380,12 +2380,12 @@ PUBLIC OSErr Executor::ROMlib_btcreateemptyfile(btparam *btpb) rec.cdrType = FILETYPE; rec.filFlags = STARTFLAGS; rec.filFlNum = vcbp->vcbNxtCNID; - vcbp->vcbNxtCNID = BigEndianValue(BigEndianValue(vcbp->vcbNxtCNID) + 1); + vcbp->vcbNxtCNID = CL(CL(vcbp->vcbNxtCNID) + 1); vcbp->vcbFlags |= CWC(VCBDIRTY); rec.filMdDat = rec.filCrDat = Time; err = ROMlib_filecreate(btpb, &rec, regular); #if defined (CATFILEDEBUG) - ROMlib_checkleaves(BigEndianValue(vcbp->vcbCTRef)); + ROMlib_checkleaves(CW(vcbp->vcbCTRef)); #endif /* CATFILEDEBUG */ fs_err_hook (err); return err; @@ -2402,7 +2402,7 @@ PUBLIC OSErr Executor::ROMlib_btcreateemptydir(btparam *btpb, LONGINT *newidp) rec.cdrType = DIRTYPE; rec.dirFlags = STARTFLAGS; *newidp = rec.dirDirID = vcbp->vcbNxtCNID; - vcbp->vcbNxtCNID = BigEndianValue(BigEndianValue(vcbp->vcbNxtCNID) + 1); + vcbp->vcbNxtCNID = CL(CL(vcbp->vcbNxtCNID) + 1); vcbp->vcbFlags |= CWC(VCBDIRTY); rec.dirMdDat = rec.dirCrDat = Time; err = ROMlib_dircreate(btpb, &rec); @@ -2414,10 +2414,10 @@ PUBLIC OSErr Executor::ROMlib_btcreateemptydir(btparam *btpb, LONGINT *newidp) * NOTE: ROMlib_getcache clears the ROMlib_index_cached flag */ -PUBLIC OSErr Executor::ROMlib_btpbindex (ioParam *pb, LONGINT dirid, HVCB **vcbpp, +PUBLIC OSErr Executor::ROMlib_btpbindex (IOParam *pb, LONGINT dirid, HVCB **vcbpp, filerec **frpp, catkey **catkeypp, BOOLEAN filesonly) { - ioParam newpb; + IOParam newpb; btparam btparamrec; filekind kind; OSErr err; @@ -2440,7 +2440,7 @@ PUBLIC OSErr Executor::ROMlib_btpbindex (ioParam *pb, LONGINT dirid, HVCB **vcbp save_dirid = dirid; save_vRefNum = pb->ioVRefNum; } - new_count = BigEndianValue(((fileParam *)pb)->ioFDirIndex); + new_count = CW(((FileParam *)pb)->ioFDirIndex); if (ROMlib_index_cached && new_count >= save_count) count = new_count - save_count; else @@ -2458,7 +2458,7 @@ PUBLIC OSErr Executor::ROMlib_btpbindex (ioParam *pb, LONGINT dirid, HVCB **vcbp if (err == noErr) { if (!ROMlib_index_cached) { save_vcbp = btparamrec.vcbp; - save_dirid = BigEndianValue(btparamrec.foundp->catk.ckrParID); /* Could have */ + save_dirid = CL(btparamrec.foundp->catk.ckrParID); /* Could have */ /* changed due to */ /* Working Dir ID */ } @@ -2471,13 +2471,13 @@ PUBLIC OSErr Executor::ROMlib_btpbindex (ioParam *pb, LONGINT dirid, HVCB **vcbp save_cachep = btparamrec.trail[btparamrec.leafindex].cachep; save_index = btparamrec.trail[btparamrec.leafindex].after; } - refnum = BigEndianValue(save_cachep->refnum); + refnum = CW(save_cachep->refnum); btp = (btnode *) save_cachep->buf; for (done = count == 0; !done;) { - if (++save_index < BigEndianValue(btp->ndNRecs)) { + if (++save_index < CW(btp->ndNRecs)) { ; /* nothing to do here; bumping save_index was sufficient */ - } else if ((flink = BigEndianValue(btp->ndFLink))) { + } else if ((flink = CL(btp->ndFLink))) { save_cachep->flags &= ~CACHEBUSY; err = ROMlib_getcache(&save_cachep, refnum, flink, GETCACHESAVE); @@ -2489,7 +2489,7 @@ PUBLIC OSErr Executor::ROMlib_btpbindex (ioParam *pb, LONGINT dirid, HVCB **vcbp done = TRUE; save_entryp = BTENTRY(btp, save_index); if (save_dirid != 1 && - BigEndianValue(save_entryp->catk.ckrParID) != save_dirid) + CL(save_entryp->catk.ckrParID) != save_dirid) done = TRUE; else if (!done) { save_frp = (filerec *) DATAPFROMKEY(save_entryp); diff --git a/src/hfsChanging.cpp b/src/hfsChanging.cpp index 26e20597..8c734021 100644 --- a/src/hfsChanging.cpp +++ b/src/hfsChanging.cpp @@ -23,7 +23,7 @@ typedef enum { UnlockOp } changeop; -PRIVATE OSErr PBFInfoHelper(changeop op, fileParam *pb, LONGINT dirid, +PRIVATE OSErr PBFInfoHelper(changeop op, FileParam *pb, LONGINT dirid, BOOLEAN async) { OSErr err, err1; @@ -35,11 +35,11 @@ PRIVATE OSErr PBFInfoHelper(changeop op, fileParam *pb, LONGINT dirid, vcbp = 0; if (op == GetOp && (BigEndianValue(pb->ioFDirIndex) > 0)) - err = ROMlib_btpbindex((ioParam *) pb, dirid, &vcbp, &frp, &catkeyp, + err = ROMlib_btpbindex((IOParam *) pb, dirid, &vcbp, &frp, &catkeyp, TRUE); else { kind = regular; - err = ROMlib_findvcbandfile((ioParam *) pb, dirid, &btparamrec, &kind, + err = ROMlib_findvcbandfile((IOParam *) pb, dirid, &btparamrec, &kind, FALSE); if (err == noErr) { if (btparamrec.success) { @@ -53,9 +53,9 @@ PRIVATE OSErr PBFInfoHelper(changeop op, fileParam *pb, LONGINT dirid, if (err == noErr) { switch (op) { case GetOp: - if (BigEndianValue(pb->ioFDirIndex) > 0 && pb->ioNamePtr) + if (CW(pb->ioFDirIndex) > 0 && pb->ioNamePtr) str255assign(MR(pb->ioNamePtr), catkeyp->ckrCName); - pb->ioFlAttrib = CB (open_attrib_bits (BigEndianValue (frp->filFlNum), vcbp, + pb->ioFlAttrib = CB (open_attrib_bits (CL (frp->filFlNum), vcbp, &pb->ioFRefNum)); pb->ioFlAttrib |= frp->filFlags & CB (INHERITED_FLAG_BITS); pb->ioFlVersNum = 0; @@ -99,48 +99,48 @@ PRIVATE OSErr PBFInfoHelper(changeop op, fileParam *pb, LONGINT dirid, PUBLIC OSErr Executor::hfsPBGetFInfo(ParmBlkPtr pb, BOOLEAN async) { - return PBFInfoHelper(GetOp, (fileParam *) pb, 0L, async); + return PBFInfoHelper(GetOp, (FileParam *) pb, 0L, async); } PUBLIC OSErr Executor::hfsPBHGetFInfo(HParmBlkPtr pb, BOOLEAN async) { - return PBFInfoHelper(GetOp, (fileParam *) pb, BigEndianValue(pb->fileParam.ioDirID), async); + return PBFInfoHelper(GetOp, (FileParam *) pb, BigEndianValue(pb->fileParam.ioDirID), async); } PUBLIC OSErr Executor::hfsPBSetFInfo(ParmBlkPtr pb, BOOLEAN async) { - return PBFInfoHelper(SetOp, (fileParam *) pb, 0L, async); + return PBFInfoHelper(SetOp, (FileParam *) pb, 0L, async); } PUBLIC OSErr Executor::hfsPBHSetFInfo(HParmBlkPtr pb, BOOLEAN async) { - return PBFInfoHelper(SetOp, (fileParam *) pb, BigEndianValue(pb->fileParam.ioDirID), async); + return PBFInfoHelper(SetOp, (FileParam *) pb, BigEndianValue(pb->fileParam.ioDirID), async); } PUBLIC OSErr Executor::hfsPBSetFLock(ParmBlkPtr pb, BOOLEAN async) { - return PBFInfoHelper(LockOp, (fileParam *) pb, 0L, async); + return PBFInfoHelper(LockOp, (FileParam *) pb, 0L, async); } PUBLIC OSErr Executor::hfsPBHSetFLock(HParmBlkPtr pb, BOOLEAN async) { - return PBFInfoHelper(LockOp, (fileParam *) pb, BigEndianValue(pb->fileParam.ioDirID), async); + return PBFInfoHelper(LockOp, (FileParam *) pb, BigEndianValue(pb->fileParam.ioDirID), async); } PUBLIC OSErr Executor::hfsPBRstFLock(ParmBlkPtr pb, BOOLEAN async) { - return PBFInfoHelper(UnlockOp, (fileParam *) pb, 0L, async); + return PBFInfoHelper(UnlockOp, (FileParam *) pb, 0L, async); } PUBLIC OSErr Executor::hfsPBHRstFLock(HParmBlkPtr pb, BOOLEAN async) { - return PBFInfoHelper(UnlockOp, (fileParam *) pb, + return PBFInfoHelper(UnlockOp, (FileParam *) pb, BigEndianValue (pb->fileParam.ioDirID), async); } PUBLIC OSErr Executor::hfsPBSetFVers(ParmBlkPtr pb, BOOLEAN async) { - PBRETURN((ioParam *)pb, wrgVolTypErr); + PBRETURN((IOParam *)pb, wrgVolTypErr); } PUBLIC void @@ -152,11 +152,11 @@ ROMlib_fcbrename (HVCB *vcbp, LONGINT swapped_parid, StringPtr oldnamep, HVCB *swapped_vcbp; swapped_vcbp = RM (vcbp); - length = BigEndianValue(*(short *)MR(FCBSPtr)); + length = CW(*(short *)MR(FCBSPtr)); fcbp = (filecontrolblock *) ((short *)MR(FCBSPtr)+1); efcbp = (filecontrolblock *) ((char *)MR(FCBSPtr) + length); for (;fcbp < efcbp; - fcbp = (filecontrolblock *) ((char *)fcbp + BigEndianValue(FSFCBLen))) + fcbp = (filecontrolblock *) ((char *)fcbp + CW(FSFCBLen))) { if (fcbp->fcbDirID == swapped_parid && fcbp->fcbVPtr == swapped_vcbp @@ -166,11 +166,11 @@ ROMlib_fcbrename (HVCB *vcbp, LONGINT swapped_parid, StringPtr oldnamep, } PRIVATE OSErr -renamehelper(ioParam *pb, BOOLEAN async, LONGINT dirid, filekind kind) +renamehelper(IOParam *pb, BOOLEAN async, LONGINT dirid, filekind kind) { OSErr err, err1; btparam btparamrec, btparamrec2; - ioParam npb; + IOParam npb; err = ROMlib_findvcbandfile(pb, dirid, &btparamrec, &kind, FALSE); if (err == noErr) @@ -195,7 +195,7 @@ renamehelper(ioParam *pb, BOOLEAN async, LONGINT dirid, filekind kind) btparamrec.tofind.catk.ckrParID, (StringPtr) &btparamrec.tofind.catk.ckrCName[0], - (StringPtr) BigEndianValue (pb->ioMisc)); + (StringPtr) CL (pb->ioMisc)); } err1 = ROMlib_cleancache(btparamrec.vcbp); if (err1 == noErr) @@ -228,11 +228,11 @@ renamehelper(ioParam *pb, BOOLEAN async, LONGINT dirid, filekind kind) PUBLIC OSErr Executor::hfsPBRename(ParmBlkPtr pb, BOOLEAN async) { - return renamehelper((ioParam *) pb, async, 0L, regular); + return renamehelper((IOParam *) pb, async, 0L, regular); } PUBLIC OSErr Executor::hfsPBHRename(HParmBlkPtr pb, BOOLEAN async) { - return renamehelper((ioParam *) pb, async, BigEndianValue(pb->fileParam.ioDirID), + return renamehelper((IOParam *) pb, async, BigEndianValue(pb->fileParam.ioDirID), (filekind)(regular|directory)); } diff --git a/src/hfsCreate.cpp b/src/hfsCreate.cpp index c8c0bed9..321f433f 100644 --- a/src/hfsCreate.cpp +++ b/src/hfsCreate.cpp @@ -34,21 +34,21 @@ PRIVATE OSErr freeallblocks(HVCB *vcbp, filerec *frp) (LONGINT) sizeof(frp->filExtRec)); fcbp->fcbMdRByt = WRITEBIT; pbr.ioParam.ioMisc = 0; - pbr.ioParam.ioRefNum = BigEndianValue((char *) fcbp - (char *) MR(FCBSPtr)); - retval = ROMlib_allochelper((ioParam *) &pbr, FALSE, seteof, FALSE); + pbr.ioParam.ioRefNum = CW((char *) fcbp - (char *) MR(FCBSPtr)); + retval = ROMlib_allochelper((IOParam *) &pbr, FALSE, seteof, FALSE); if (retval == noErr) { fcbp->fcbPLen = frp->filRPyLen; memmove((char *) fcbp->fcbExtRec, (char *) frp->filRExtRec, (LONGINT) sizeof(frp->filRExtRec)); fcbp->fcbMdRByt = WRITEBIT|RESOURCEBIT; - retval = ROMlib_allochelper((ioParam *) &pbr, FALSE, seteof, FALSE); + retval = ROMlib_allochelper((IOParam *) &pbr, FALSE, seteof, FALSE); } } fcbp->fcbFlNum = 0; return retval; } -PRIVATE OSErr createhelper(ioParam *pb, BOOLEAN async, createop op, +PRIVATE OSErr createhelper(IOParam *pb, BOOLEAN async, createop op, LONGINT dirid, filekind kind) { OSErr err, err1; @@ -68,7 +68,7 @@ PRIVATE OSErr createhelper(ioParam *pb, BOOLEAN async, createop op, else { if (curkind == directory) { drp = (directoryrec *) DATAPFROMKEY(btparamrec.foundp); - err = ROMlib_dirbusy(BigEndianValue(drp->dirDirID), vcbp); + err = ROMlib_dirbusy(CL(drp->dirDirID), vcbp); if (err == noErr) { if (drp->dirVal != 0) @@ -80,7 +80,7 @@ PRIVATE OSErr createhelper(ioParam *pb, BOOLEAN async, createop op, err = ROMlib_dirdelete(&btparamrec); } else { frp = (filerec *) DATAPFROMKEY(btparamrec.foundp); - if (ROMlib_alreadyopen(vcbp, BigEndianValue(frp->filFlNum), + if (ROMlib_alreadyopen(vcbp, CL(frp->filFlNum), (SignedByte *) 0, 0, eitherbusy) != noErr) err = fBsyErr; #if 0 @@ -125,29 +125,29 @@ PRIVATE OSErr createhelper(ioParam *pb, BOOLEAN async, createop op, PUBLIC OSErr Executor::hfsPBCreate(ParmBlkPtr pb, BOOLEAN async) { - return createhelper((ioParam *) pb, async, create, (LONGINT) 0, regular); + return createhelper((IOParam *) pb, async, create, (LONGINT) 0, regular); } PUBLIC OSErr Executor::hfsPBHCreate(HParmBlkPtr pb, BOOLEAN async) { - return createhelper((ioParam *)pb, async, create, BigEndianValue(pb->fileParam.ioDirID), + return createhelper((IOParam *)pb, async, create, BigEndianValue(pb->fileParam.ioDirID), regular); } PUBLIC OSErr Executor::hfsPBDirCreate(HParmBlkPtr pb, BOOLEAN async) { - return createhelper((ioParam *)pb, async, create, BigEndianValue(pb->fileParam.ioDirID), + return createhelper((IOParam *)pb, async, create, BigEndianValue(pb->fileParam.ioDirID), directory); } PUBLIC OSErr Executor::hfsPBDelete(ParmBlkPtr pb, BOOLEAN async) { - return createhelper((ioParam *) pb, async, delete1, (LONGINT) 0, + return createhelper((IOParam *) pb, async, delete1, (LONGINT) 0, (filekind)(regular | directory)); } PUBLIC OSErr Executor::hfsPBHDelete(HParmBlkPtr pb, BOOLEAN async) { - return createhelper((ioParam *)pb, async, delete1, BigEndianValue(pb->fileParam.ioDirID), + return createhelper((IOParam *)pb, async, delete1, BigEndianValue(pb->fileParam.ioDirID), (filekind)(regular | directory)); } diff --git a/src/hfsFile.cpp b/src/hfsFile.cpp index 34a68713..ed946f02 100644 --- a/src/hfsFile.cpp +++ b/src/hfsFile.cpp @@ -22,11 +22,11 @@ PUBLIC filecontrolblock *Executor::ROMlib_getfreefcbp( void ) short length; filecontrolblock *fcbp, *efcbp; - length = BigEndianValue(*(short *)MR(FCBSPtr)); + length = CW(*(short *)MR(FCBSPtr)); fcbp = (filecontrolblock *) ((short *)MR(FCBSPtr)+1); efcbp = (filecontrolblock *) ((char *)MR(FCBSPtr) + length); for (;fcbp < efcbp && Cx(fcbp->fcbFlNum); - fcbp = (filecontrolblock *) ((char *)fcbp + BigEndianValue(FSFCBLen))) + fcbp = (filecontrolblock *) ((char *)fcbp + CW(FSFCBLen))) ; return fcbp < efcbp ? fcbp : 0; } @@ -36,9 +36,9 @@ PUBLIC filecontrolblock *Executor::ROMlib_refnumtofcbp(uint16 refnum) uint16 len; filecontrolblock *retval; - if (refnum < sizeof(short) || refnum % BigEndianValue(FSFCBLen) != sizeof(short)) + if (refnum < sizeof(short) || refnum % CW(FSFCBLen) != sizeof(short)) return 0; - len = BigEndianValue(*(uint16 *)MR(FCBSPtr)); + len = CW(*(uint16 *)MR(FCBSPtr)); if (refnum >= len) return 0; retval = (filecontrolblock *)((char *)MR(FCBSPtr) + refnum); @@ -47,9 +47,9 @@ PUBLIC filecontrolblock *Executor::ROMlib_refnumtofcbp(uint16 refnum) return retval; } -PRIVATE LONGINT pbabsoffset(ioParam *pb, filecontrolblock *fcbp) +PRIVATE LONGINT pbabsoffset(IOParam *pb, filecontrolblock *fcbp) { - switch (BigEndianValue(pb->ioPosMode) & 0x3) { + switch (CW(pb->ioPosMode) & 0x3) { case fsAtMark: return Cx(fcbp->fcbCrPs); case fsFromStart: @@ -107,9 +107,9 @@ PUBLIC compretval Executor::ROMlib_xtntcompare(void *firstp, void *secondp) else if (Cx(xp1->xkrFkType) > Cx(xp2->xkrFkType)) return firstisgreater; else { - if (BigEndianValue(xp1->xkrFABN) < BigEndianValue(xp2->xkrFABN)) + if (CW(xp1->xkrFABN) < CW(xp2->xkrFABN)) return firstisless; - else if (BigEndianValue(xp1->xkrFABN) > BigEndianValue(xp2->xkrFABN)) + else if (CW(xp1->xkrFABN) > CW(xp2->xkrFABN)) return firstisgreater; else return same; @@ -131,16 +131,16 @@ PUBLIC compretval Executor::ROMlib_catcompare(void *firstp, void *secondp) FALSE, TRUE); } -PUBLIC void Executor::ROMlib_makextntkey(xtntkey *keyp, forktype forkwanted, LONGINT flnum, +PUBLIC void Executor::ROMlib_makextntkey(xtntkey *keyp, Forktype forkwanted, LONGINT flnum, uint16 bno) { keyp->xkrKeyLen = 7; keyp->xkrFkType = forkwanted; - keyp->xkrFNum = BigEndianValue(flnum); - keyp->xkrFABN = BigEndianValue(bno); + keyp->xkrFNum = CL(flnum); + keyp->xkrFABN = CW(bno); } -PUBLIC void Executor::ROMlib_makextntparam(btparam *btpb, HVCB *vcbp, forktype forkwanted, +PUBLIC void Executor::ROMlib_makextntparam(btparam *btpb, HVCB *vcbp, Forktype forkwanted, LONGINT flnum, uint16 bno) { btpb->vcbp = vcbp; @@ -152,14 +152,14 @@ PUBLIC void Executor::ROMlib_makextntparam(btparam *btpb, HVCB *vcbp, forktype f PRIVATE xtntkey *fcbpbnotoxkeyp(filecontrolblock *fcbp, uint16 bno) { - forktype forkwanted; + Forktype forkwanted; xtntkey *xkeyp; btparam btparamblock; OSErr err; forkwanted = fcbp->fcbMdRByt & RESOURCEBIT ? resourcefork : datafork; ROMlib_makextntparam(&btparamblock, MR(fcbp->fcbVPtr), forkwanted, - BigEndianValue(fcbp->fcbFlNum), bno); + CL(fcbp->fcbFlNum), bno); err = ROMlib_keyfind(&btparamblock); #if 0 ROMlib_cleancache(btparamblock.vcbp); @@ -192,7 +192,7 @@ PUBLIC LONGINT Executor::ROMlib_logtophys(filecontrolblock *fcbp, LONGINT absoff if (!xkeyp) return -1; retblock = xtntbnotophys((xtntdesc *) DATAPFROMKEY(xkeyp), - bno - BigEndianValue(xkeyp->xkrFABN), &nphysalcontig); + bno - CW(xkeyp->xkrFABN), &nphysalcontig); if (retblock == -1) return -1; } @@ -201,7 +201,7 @@ PUBLIC LONGINT Executor::ROMlib_logtophys(filecontrolblock *fcbp, LONGINT absoff return Cx(vcbp->vcbAlBlSt) * (LONGINT) PHYSBSIZE + retblock * alblksiz + skip; } -PRIVATE OSErr pbtofcbp(ioParam *pb, filecontrolblock **fcbpp, accesstype rw) +PRIVATE OSErr pbtofcbp(IOParam *pb, filecontrolblock **fcbpp, accesstype rw) { OSErr retval; @@ -228,10 +228,10 @@ PRIVATE void setbits(HVCB *vcbp, ULONGINT bno, ULONGINT ntoset, unsigned char lo ULONGINT first_map_block, last_map_block; if (lookfor) - vcbp->vcbFreeBks = BigEndianValue(BigEndianValue(vcbp->vcbFreeBks) - (ntoset)); + vcbp->vcbFreeBks = CW(CW(vcbp->vcbFreeBks) - (ntoset)); else - vcbp->vcbFreeBks = BigEndianValue(BigEndianValue(vcbp->vcbFreeBks) + (ntoset)); - vcbp->vcbFlags |= BigEndianValue(VCBDIRTY); + vcbp->vcbFreeBks = CW(CW(vcbp->vcbFreeBks) + (ntoset)); + vcbp->vcbFlags |= CW(VCBDIRTY); /* bno -= Cx(vcbp->vcbAlBlSt); not sure about this */ ebno = bno + ntoset; cp = (unsigned char *) MR(vcbp->vcbMAdr) + bno / 8 + MADROFFSET; @@ -348,7 +348,7 @@ PRIVATE BOOLEAN fillextent(xtntdesc *xp, ULONGINT *nallocneededp, HVCB *vcbp, toextend = MIN(toextend, needed); needed -= toextend; setbits(vcbp, Cx(xp->blockstart) + Cx(xp->blockcount), toextend, 1); - xp->blockcount = BigEndianValue(BigEndianValue(xp->blockcount) + (toextend)); + xp->blockcount = CW(CW(xp->blockcount) + (toextend)); } ++xp; } @@ -363,34 +363,34 @@ PRIVATE BOOLEAN fillextent(xtntdesc *xp, ULONGINT *nallocneededp, HVCB *vcbp, * even in the best case it couldn't be more than the number you already * know about. */ - for (search = countbits(vcbp, 0, 1) /*Cx(vcbp->vcbAlBlSt)*/; max - search > BigEndianValue(tmpxtnt[2].blockcount);) { + for (search = countbits(vcbp, 0, 1) /*Cx(vcbp->vcbAlBlSt)*/; max - search > CW(tmpxtnt[2].blockcount);) { nfree = countbits(vcbp, search, 0); #if 0 if (nfree == 0) warning_unexpected ("nfree == 0"); #endif if (nfree >= needed) { - tmpxtnt[0].blockcount = BigEndianValue(nfree); - tmpxtnt[0].blockstart = BigEndianValue(search); + tmpxtnt[0].blockcount = CW(nfree); + tmpxtnt[0].blockstart = CW(search); break; } - if (nfree > BigEndianValue(tmpxtnt[1].blockcount)) { - if (nfree > BigEndianValue(tmpxtnt[0].blockcount)) { + if (nfree > CW(tmpxtnt[1].blockcount)) { + if (nfree > CW(tmpxtnt[0].blockcount)) { tmpxtnt[2].blockcount = tmpxtnt[1].blockcount; tmpxtnt[2].blockstart = tmpxtnt[1].blockstart; tmpxtnt[1].blockcount = tmpxtnt[0].blockcount; tmpxtnt[1].blockstart = tmpxtnt[0].blockstart; - tmpxtnt[0].blockcount = BigEndianValue(nfree); - tmpxtnt[0].blockstart = BigEndianValue(search); + tmpxtnt[0].blockcount = CW(nfree); + tmpxtnt[0].blockstart = CW(search); } else { tmpxtnt[2].blockcount = tmpxtnt[1].blockcount; tmpxtnt[2].blockstart = tmpxtnt[1].blockstart; - tmpxtnt[1].blockcount = BigEndianValue(nfree); - tmpxtnt[1].blockstart = BigEndianValue(search); + tmpxtnt[1].blockcount = CW(nfree); + tmpxtnt[1].blockstart = CW(search); } } else if (nfree > tmpxtnt[2].blockcount) { - tmpxtnt[2].blockcount = BigEndianValue(nfree); - tmpxtnt[2].blockstart = BigEndianValue(search); + tmpxtnt[2].blockcount = CW(nfree); + tmpxtnt[2].blockstart = CW(search); } search += nfree; search += countbits(vcbp, search, 1); @@ -398,13 +398,13 @@ PRIVATE BOOLEAN fillextent(xtntdesc *xp, ULONGINT *nallocneededp, HVCB *vcbp, tmpxp = tmpxtnt; while (needed > 0 && --nempty >= 0 && tmpxp->blockcount) { xp->blockstart = tmpxp->blockstart; - xp->blockcount = BigEndianValue(MIN(BigEndianValue(tmpxp->blockcount), needed)); + xp->blockcount = CW(MIN(CW(tmpxp->blockcount), needed)); #if 1 if (xp->blockcount == 0) warning_unexpected ("blockcount = 0"); #endif - needed -= BigEndianValue(xp->blockcount); - setbits(vcbp, BigEndianValue(xp->blockstart), BigEndianValue(xp->blockcount), 1); + needed -= CW(xp->blockcount); + setbits(vcbp, CW(xp->blockstart), CW(xp->blockcount), 1); ++xp; ++tmpxp; } @@ -417,28 +417,28 @@ PRIVATE BOOLEAN fillextent(xtntdesc *xp, ULONGINT *nallocneededp, HVCB *vcbp, PRIVATE void smokexpvcbp(ULONGINT tosmoke, xtntdesc *xp, HVCB *vcbp) { - if (tosmoke <= BigEndianValue(xp[2].blockcount)) { - xp[2].blockcount = BigEndianValue(BigEndianValue(xp[2].blockcount) - (tosmoke)); - setbits(vcbp, BigEndianValue(xp[2].blockstart) + BigEndianValue(xp[2].blockcount), tosmoke, 0); + if (tosmoke <= CW(xp[2].blockcount)) { + xp[2].blockcount = CW(CW(xp[2].blockcount) - (tosmoke)); + setbits(vcbp, CW(xp[2].blockstart) + CW(xp[2].blockcount), tosmoke, 0); } else { - setbits(vcbp, BigEndianValue(xp[2].blockstart), BigEndianValue(xp[2].blockcount), 0); - tosmoke -= BigEndianValue(xp[2].blockcount); + setbits(vcbp, CW(xp[2].blockstart), CW(xp[2].blockcount), 0); + tosmoke -= CW(xp[2].blockcount); xp[2].blockcount = CWC(0); - if (tosmoke <= BigEndianValue(xp[1].blockcount)) { - xp[1].blockcount = BigEndianValue(BigEndianValue(xp[1].blockcount) - tosmoke); - setbits(vcbp, BigEndianValue(xp[1].blockstart) + BigEndianValue(xp[1].blockcount), + if (tosmoke <= CW(xp[1].blockcount)) { + xp[1].blockcount = CW(CW(xp[1].blockcount) - tosmoke); + setbits(vcbp, CW(xp[1].blockstart) + CW(xp[1].blockcount), tosmoke, 0); } else { - setbits(vcbp, BigEndianValue(xp[1].blockstart), BigEndianValue(xp[1].blockcount), 0); - tosmoke -= BigEndianValue(xp[1].blockcount); + setbits(vcbp, CW(xp[1].blockstart), CW(xp[1].blockcount), 0); + tosmoke -= CW(xp[1].blockcount); xp[1].blockcount = CWC(0); - xp[0].blockcount = BigEndianValue(BigEndianValue(xp[0].blockcount) - tosmoke); - setbits(vcbp, BigEndianValue(xp[0].blockstart) + BigEndianValue(xp[0].blockcount), tosmoke, 0); + xp[0].blockcount = CW(CW(xp[0].blockcount) - tosmoke); + setbits(vcbp, CW(xp[0].blockstart) + CW(xp[0].blockcount), tosmoke, 0); } } } -PUBLIC OSErr Executor::ROMlib_allochelper(ioParam *pb, BOOLEAN async, alloctype alloc, +PUBLIC OSErr Executor::ROMlib_allochelper(IOParam *pb, BOOLEAN async, alloctype alloc, BOOLEAN writefcbp) { filecontrolblock *fcbp; @@ -518,7 +518,7 @@ PUBLIC OSErr Executor::ROMlib_allochelper(ioParam *pb, BOOLEAN async, alloctype xp = fcbp->fcbExtRec; totallength = Cx(vcbp->vcbAlBlkSiz) * - (BigEndianValue(xp[0].blockcount) + BigEndianValue(xp[1].blockcount) + BigEndianValue(xp[2].blockcount)); + (CW(xp[0].blockcount) + CW(xp[1].blockcount) + CW(xp[2].blockcount)); if (needtoshrink) { if (neweof < totallength) { tosmoke = (totallength - neweof) / Cx(vcbp->vcbAlBlkSiz); @@ -536,9 +536,9 @@ PUBLIC OSErr Executor::ROMlib_allochelper(ioParam *pb, BOOLEAN async, alloctype } xp = (xtntdesc *) DATAPFROMKEY(xtkeyp); totallength = Cx(vcbp->vcbAlBlkSiz) * - (BigEndianValue(xp[0].blockcount) + BigEndianValue(xp[1].blockcount) + - BigEndianValue(xp[2].blockcount)); - tosmoke = BigEndianValue(xtkeyp->xkrFABN) * Cx(vcbp->vcbAlBlkSiz) + totallength + (CW(xp[0].blockcount) + CW(xp[1].blockcount) + + CW(xp[2].blockcount)); + tosmoke = CW(xtkeyp->xkrFABN) * Cx(vcbp->vcbAlBlkSiz) + totallength - neweof; savetype = Cx(xtkeyp->xkrFkType); if (tosmoke < totallength) { @@ -566,16 +566,16 @@ PUBLIC OSErr Executor::ROMlib_allochelper(ioParam *pb, BOOLEAN async, alloctype gui_assert(xtkeyp && Cx(xtkeyp->xkrFNum) == Cx(fcbp->fcbFlNum) && Cx(xtkeyp->xkrFkType) == savetype); xp = (xtntdesc *) DATAPFROMKEY(btparamrec.foundp); - setbits(vcbp, BigEndianValue(xp[0].blockstart), BigEndianValue(xp[0].blockcount), 0); - setbits(vcbp, BigEndianValue(xp[1].blockstart), BigEndianValue(xp[1].blockcount), 0); - setbits(vcbp, BigEndianValue(xp[2].blockstart), BigEndianValue(xp[2].blockcount), 0); - newabn = BigEndianValue(btparamrec.tofind.xtntk.xkrFABN) + - BigEndianValue(xp[0].blockcount) + BigEndianValue(xp[1].blockcount) + - BigEndianValue(xp[2].blockcount); + setbits(vcbp, CW(xp[0].blockstart), CW(xp[0].blockcount), 0); + setbits(vcbp, CW(xp[1].blockstart), CW(xp[1].blockcount), 0); + setbits(vcbp, CW(xp[2].blockstart), CW(xp[2].blockcount), 0); + newabn = CW(btparamrec.tofind.xtntk.xkrFABN) + + CW(xp[0].blockcount) + CW(xp[1].blockcount) + + CW(xp[2].blockcount); err = ROMlib_btdelete(&btparamrec); if (err != noErr) goto done; - btparamrec.tofind.xtntk.xkrFABN = BigEndianValue(newabn); + btparamrec.tofind.xtntk.xkrFABN = CW(newabn); err = ROMlib_keyfind(&btparamrec); if (err != noErr) goto done; @@ -602,7 +602,7 @@ PUBLIC OSErr Executor::ROMlib_allochelper(ioParam *pb, BOOLEAN async, alloctype goto done; } xp = (xtntdesc *) DATAPFROMKEY(xtkeyp); - newabn = BigEndianValue(xtkeyp->xkrFABN); + newabn = CW(xtkeyp->xkrFABN); if (fillextent(xp, &nallocneeded, vcbp, &newabn)) ROMlib_dirtyleaf((anykey *)xtkeyp, vcbp); } @@ -639,7 +639,7 @@ PUBLIC OSErr Executor::ROMlib_allochelper(ioParam *pb, BOOLEAN async, alloctype break; case allocany: case alloccontig: - pb->ioActCount = BigEndianValue(neweof - Cx(fcbp->fcbPLen)); + pb->ioActCount = CL(neweof - Cx(fcbp->fcbPLen)); break; default: warning_unexpected ("unknown allocator2"); @@ -647,7 +647,7 @@ PUBLIC OSErr Executor::ROMlib_allochelper(ioParam *pb, BOOLEAN async, alloctype fs_err_hook (err); PBRETURN(pb, err); } - fcbp->fcbPLen = BigEndianValue(neweof); + fcbp->fcbPLen = CL(neweof); fcbp->fcbMdRByt |= 0x80; if (err == noErr) @@ -659,7 +659,7 @@ PUBLIC OSErr Executor::ROMlib_allochelper(ioParam *pb, BOOLEAN async, alloctype PUBLIC OSErr Executor::hfsPBSetEOF(ParmBlkPtr pb, BOOLEAN async) { OSErr err; - err = ROMlib_allochelper((ioParam *) pb, async, seteof, TRUE); + err = ROMlib_allochelper((IOParam *) pb, async, seteof, TRUE); fs_err_hook (err); return err; } @@ -667,7 +667,7 @@ PUBLIC OSErr Executor::hfsPBSetEOF(ParmBlkPtr pb, BOOLEAN async) PUBLIC OSErr Executor::hfsPBAllocate(ParmBlkPtr pb, BOOLEAN async) { OSErr err; - err = ROMlib_allochelper((ioParam *) pb, async, allocany, TRUE); + err = ROMlib_allochelper((IOParam *) pb, async, allocany, TRUE); fs_err_hook (err); return err; } @@ -676,14 +676,14 @@ PUBLIC OSErr Executor::hfsPBAllocContig(ParmBlkPtr pb, BOOLEAN async) { OSErr err; - err = ROMlib_allochelper((ioParam *) pb, async, alloccontig, TRUE); + err = ROMlib_allochelper((IOParam *) pb, async, alloccontig, TRUE); fs_err_hook (err); return err; } -#define RETURN(x) do { pb->ioResult = BigEndianValue(x); goto DONE; } while (0) +#define RETURN(x) do { pb->ioResult = CW(x); goto DONE; } while (0) -PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) +PRIVATE OSErr PBReadWrite(IOParam *pb, BOOLEAN async, accesstype rw) { filecontrolblock *fcbp; LONGINT absoffset, totransfer, neweot, templ, physblock, actl; @@ -721,7 +721,7 @@ PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) fs_err_hook (err); RETURN(err); } - pb->ioPosOffset = BigEndianValue(absoffset); + pb->ioPosOffset = CL(absoffset); if (totransfer < 0) { err = paramErr; @@ -732,13 +732,13 @@ PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) if (neweot > Cx(fcbp->fcbEOF)) { if (rw == reading) { totransfer = Cx(fcbp->fcbEOF) - absoffset; - pb->ioResult = BigEndianValue(eofErr); + pb->ioResult = CW(eofErr); } else { templ = (LONGINT) Cx(pb->ioMisc); #if defined(MAC) - pb->ioMisc = BigEndianValue((Ptr) neweot); + pb->ioMisc = CL((Ptr) neweot); #else /* !defined(MAC) */ - pb->ioMisc = BigEndianValue((LONGINT) neweot); + pb->ioMisc = CL((LONGINT) neweot); #endif /* !defined(MAC) */ PBSetEOF((ParmBlkPtr) pb, FALSE); if (pb->ioResult != CWC(noErr)) @@ -784,8 +784,8 @@ PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) } } - pb->ioPosOffset = BigEndianValue(BigEndianValue(pb->ioPosOffset) + (ntocopy)); - pb->ioActCount = BigEndianValue(BigEndianValue(pb->ioActCount) + (ntocopy)); + pb->ioPosOffset = CL(CL(pb->ioPosOffset) + (ntocopy)); + pb->ioActCount = CL(CL(pb->ioActCount) + (ntocopy)); totransfer -= ntocopy; absoffset += PHYSBSIZE; physblock += PHYSBSIZE; @@ -810,7 +810,7 @@ PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) if (((LONGINT)bufp & 3) == 0) { newerr = ROMlib_transphysblk (&vcbp->hfs, physblock, thisrun, bufp, rw, &actl); - actl = BigEndianValue(actl); + actl = CL(actl); if (rw == reading) ROMlib_destroy_blocks((syn68k_addr_t) US_TO_SYN68K(bufp), actl, TRUE); } else { @@ -826,7 +826,7 @@ PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) (LONGINT) PHYSBSIZE * i, 1, (Ptr) tempbuf, rw, &actl2); - actl2 = BigEndianValue(actl2); + actl2 = CL(actl2); if (rw == reading) BlockMove((Ptr) tempbuf, (Ptr) bufp + (LONGINT) PHYSBSIZE * i, (Size) actl2); @@ -844,7 +844,7 @@ PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) newerr = ROMlib_transphysblk (&((VCBExtra *) vcbp)->u.hfs, physblock, thisrun, bufp, rw, &actl); - actl = BigEndianValue(actl); + actl = CL(actl); if (ntoslide) { BlockMove(bufp, bufp + ntoslide, actl); switch (ntoslide) { @@ -864,8 +864,8 @@ PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) ROMlib_destroy_blocks((syn68k_addr_t) (long) US_TO_SYN68K(bufp), actl, TRUE); #endif - pb->ioPosOffset = BigEndianValue(BigEndianValue(pb->ioPosOffset) + (actl)); - pb->ioActCount = BigEndianValue(BigEndianValue(pb->ioActCount) + (actl)); + pb->ioPosOffset = CL(CL(pb->ioPosOffset) + (actl)); + pb->ioActCount = CL(CL(pb->ioActCount) + (actl)); if (newerr != noErr) { fs_err_hook (newerr); @@ -911,8 +911,8 @@ PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) RETURN(newerr); } } - pb->ioPosOffset = BigEndianValue(BigEndianValue(pb->ioPosOffset) + (totransfer)); - pb->ioActCount = BigEndianValue(BigEndianValue(pb->ioActCount) + (totransfer)); + pb->ioPosOffset = CL(CL(pb->ioPosOffset) + (totransfer)); + pb->ioActCount = CL(CL(pb->ioActCount) + (totransfer)); } fcbp->fcbCrPs = pb->ioPosOffset; DONE: @@ -921,9 +921,9 @@ PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) else newerr = noErr; if (pb->ioResult == noErr) - pb->ioResult = BigEndianValue(newerr); - fs_err_hook (BigEndianValue (pb->ioResult)); - return BigEndianValue(pb->ioResult); + pb->ioResult = CW(newerr); + fs_err_hook (CW (pb->ioResult)); + return CW(pb->ioResult); } #undef RETURN @@ -931,7 +931,7 @@ PRIVATE OSErr PBReadWrite(ioParam *pb, BOOLEAN async, accesstype rw) PUBLIC OSErr Executor::hfsPBRead(ParmBlkPtr pb, BOOLEAN async) { OSErr err; - err = PBReadWrite((ioParam *) pb, async, reading); + err = PBReadWrite((IOParam *) pb, async, reading); fs_err_hook (err); return err; } @@ -940,7 +940,7 @@ PUBLIC OSErr Executor::hfsPBWrite(ParmBlkPtr pb, BOOLEAN async) { OSErr err; - err = PBReadWrite((ioParam *) pb, async, writing); + err = PBReadWrite((IOParam *) pb, async, writing); fs_err_hook (err); return err; } @@ -962,7 +962,7 @@ PRIVATE OSErr dirtyfcbp(filecontrolblock *fcbp) refnum = (char *) fcbp - (char *) MR(FCBSPtr); vcbp = MR(fcbp->fcbVPtr); if ((catpos = Cx(fcbp->fcbCatPos))) { - err = Executor::ROMlib_getcache(&cachep, BigEndianValue(MR(fcbp->fcbVPtr)->vcbCTRef), + err = Executor::ROMlib_getcache(&cachep, CW(MR(fcbp->fcbVPtr)->vcbCTRef), catpos, (cacheflagtype)0); if (err != noErr) { @@ -978,7 +978,7 @@ PRIVATE OSErr dirtyfcbp(filecontrolblock *fcbp) btparamrec.vcbp = MR (fcbp->fcbVPtr); btparamrec.tofind.catk = key; btparamrec.fp = Executor::ROMlib_catcompare; - btparamrec.refnum = BigEndianValue (MR (fcbp->fcbVPtr)->vcbCTRef); + btparamrec.refnum = CW (MR (fcbp->fcbVPtr)->vcbCTRef); err = ROMlib_keyfind (&btparamrec); if (err == noErr) { @@ -1025,7 +1025,7 @@ PRIVATE OSErr dirtyfcbp(filecontrolblock *fcbp) cachep->flags |= CACHEDIRTY; } else if (refnum == Cx(vcbp->vcbXTRef) || refnum == Cx(vcbp->vcbCTRef)) { err = noErr; - vcbp->vcbFlags |= BigEndianValue(VCBDIRTY); + vcbp->vcbFlags |= CW(VCBDIRTY); } else { warning_unexpected ("no catpos (nor are we XTRef or CTRef)"); err = fsDSIntErr; @@ -1052,7 +1052,7 @@ PUBLIC OSErr Executor::hfsPBFlushFile(ParmBlkPtr pb, BOOLEAN async) err = ROMlib_flushvcbp (MR(fcbp->fcbVPtr)); fs_err_hook (err); - PBRETURN((ioParam *) pb, err); + PBRETURN((IOParam *) pb, err); } PUBLIC OSErr Executor::hfsPBClose(ParmBlkPtr pb, BOOLEAN async) @@ -1069,7 +1069,7 @@ PUBLIC OSErr Executor::hfsPBClose(ParmBlkPtr pb, BOOLEAN async) fcbp->fcbFlNum = 0; } fs_err_hook (err); - PBRETURN((ioParam *) pb, err); + PBRETURN((IOParam *) pb, err); } PUBLIC OSErr Executor::ROMlib_makecatkey(catkey *keyp, LONGINT dirid, INTEGER namelen, @@ -1086,7 +1086,7 @@ PUBLIC OSErr Executor::ROMlib_makecatkey(catkey *keyp, LONGINT dirid, INTEGER na keyp->ckrKeyLen = namelen + 1 + sizeof(LONGINT) + 1; keyp->ckrResrv1 = 0; - keyp->ckrParID = BigEndianValue(dirid); + keyp->ckrParID = CL(dirid); keyp->ckrCName[0] = namelen; memmove(keyp->ckrCName+1, namep, (LONGINT) namelen); fs_err_hook (retval); @@ -1182,7 +1182,7 @@ PRIVATE OSErr findentry(LONGINT dirid, StringPtr name, btparam *btpb, if (colonp) { /* expect a directory */ switch (rectype) { case DIRTYPE: - dirid = BigEndianValue(((directoryrec *)recp)->dirDirID); + dirid = CL(((directoryrec *)recp)->dirDirID); break; case THREADTYPE: if (((catkey *) &btpb->tofind)->ckrCName[0]) { @@ -1191,7 +1191,7 @@ PRIVATE OSErr findentry(LONGINT dirid, StringPtr name, btparam *btpb, fs_err_hook (err); /*-->*/ return err; } - dirid = BigEndianValue(((threadrec *)recp)->thdParID); + dirid = CL(((threadrec *)recp)->thdParID); break; default: warning_unexpected ("unknown rectype1 in findentry"); @@ -1226,7 +1226,7 @@ PRIVATE OSErr findentry(LONGINT dirid, StringPtr name, btparam *btpb, *kindp = thread; /* we're done now */ else if ((ignorename || endp == namep) && (*kindp & directory)) { - dirid = BigEndianValue(((threadrec *)recp)->thdParID); + dirid = CL(((threadrec *)recp)->thdParID); if (ignorename || coloncoloncount == 1) { namep = ((threadrec *)recp)->thdCName+1; namelen = ((threadrec *)recp)->thdCName[0]; @@ -1272,7 +1272,7 @@ PRIVATE BOOLEAN dir_prefixes_volume(StringPtr dirnamep, StringPtr volnamep) return dirnamep[volnamep[0]+1] == ':'; } -PUBLIC OSErr Executor::ROMlib_findvcbandfile(ioParam *pb, LONGINT dirid, btparam *btpb, +PUBLIC OSErr Executor::ROMlib_findvcbandfile(IOParam *pb, LONGINT dirid, btparam *btpb, filekind *kindp, BOOLEAN ignorename) { OSErr err; @@ -1296,7 +1296,7 @@ PUBLIC OSErr Executor::ROMlib_findvcbandfile(ioParam *pb, LONGINT dirid, btparam savep = pb->ioNamePtr; if (ignorename) pb->ioNamePtr = 0; - btpb->vcbp = ROMlib_findvcb(BigEndianValue(pb->ioVRefNum), MR(pb->ioNamePtr), &dir, + btpb->vcbp = ROMlib_findvcb(CW(pb->ioVRefNum), MR(pb->ioNamePtr), &dir, TRUE); pb->ioNamePtr = savep; if (dir == 0) @@ -1318,7 +1318,7 @@ PUBLIC OSErr Executor::ROMlib_findvcbandfile(ioParam *pb, LONGINT dirid, btparam && dir_prefixes_volume(MR(pb->ioNamePtr), btpb->vcbp->vcbVN)) dirid = 1; else - ROMlib_adjustdirid(&dirid, btpb->vcbp, BigEndianValue(pb->ioVRefNum)); + ROMlib_adjustdirid(&dirid, btpb->vcbp, CW(pb->ioVRefNum)); if (!ignorename && dirid == 2 && pb->ioNamePtr && MR(pb->ioNamePtr)[0] == 0 && (*kindp & directory)) @@ -1373,11 +1373,11 @@ PUBLIC OSErr Executor::ROMlib_alreadyopen(HVCB *vcbp, LONGINT flnum, SignedByte if (*permp == fsRdPerm) return noErr; busybit = busy == resourcebusy ? RESOURCEBIT : 0; - length = BigEndianValue(*(short *)MR(FCBSPtr)); + length = CW(*(short *)MR(FCBSPtr)); fcbp = (filecontrolblock *) ((short *)MR(FCBSPtr)+1); efcbp = (filecontrolblock *) ((char *)MR(FCBSPtr) + length); - for (;fcbp < efcbp; fcbp = (filecontrolblock *) ((char *)fcbp + BigEndianValue(FSFCBLen))) - if (MR(fcbp->fcbVPtr) == vcbp && BigEndianValue(fcbp->fcbFlNum) == flnum && + for (;fcbp < efcbp; fcbp = (filecontrolblock *) ((char *)fcbp + CW(FSFCBLen))) + if (MR(fcbp->fcbVPtr) == vcbp && CL(fcbp->fcbFlNum) == flnum && (busy == eitherbusy || (fcbp->fcbMdRByt & RESOURCEBIT) == busybit) && ((fcbp->fcbMdRByt & WRITEBIT) || permp == &temp)) @@ -1391,14 +1391,14 @@ PUBLIC OSErr Executor::ROMlib_alreadyopen(HVCB *vcbp, LONGINT flnum, SignedByte break; case fsWrPerm: case fsRdWrPerm: - *refnump = BigEndianValue((char *) fcbp - (char *) MR(FCBSPtr)); + *refnump = CW((char *) fcbp - (char *) MR(FCBSPtr)); err = opWrErr; fs_err_hook (err); return err; break; case fsRdWrShPerm: if (!(fcbp->fcbMdRByt & SHAREDBIT)) { - *refnump = BigEndianValue((char *) fcbp - (char *) MR(FCBSPtr)); + *refnump = CW((char *) fcbp - (char *) MR(FCBSPtr)); err = opWrErr; fs_err_hook (err); return err; @@ -1408,7 +1408,7 @@ PUBLIC OSErr Executor::ROMlib_alreadyopen(HVCB *vcbp, LONGINT flnum, SignedByte return noErr; } -PRIVATE OSErr PBOpenHelper(ioParam *pb, forktype ft, LONGINT dirid, BOOLEAN async) +PRIVATE OSErr PBOpenHelper(IOParam *pb, Forktype ft, LONGINT dirid, BOOLEAN async) { filecontrolblock *fcbp; OSErr err; @@ -1436,7 +1436,7 @@ PRIVATE OSErr PBOpenHelper(ioParam *pb, forktype ft, LONGINT dirid, BOOLEAN asyn } permssn = pb->ioPermssn; frp = (filerec *) DATAPFROMKEY(btparamrec.foundp); - err = ROMlib_alreadyopen(btparamrec.vcbp, BigEndianValue(frp->filFlNum), &permssn, + err = ROMlib_alreadyopen(btparamrec.vcbp, CL(frp->filFlNum), &permssn, &pb->ioRefNum, ft == resourcefork ? resourcebusy : databusy ); if (err != noErr) { @@ -1527,7 +1527,7 @@ PRIVATE OSErr PBOpenHelper(ioParam *pb, forktype ft, LONGINT dirid, BOOLEAN asyn fcbp->fcbCatPos = cachep->logblk; fcbp->fcbDirID = catkeyp->ckrParID; str255assign(fcbp->fcbCName, catkeyp->ckrCName); - pb->ioRefNum = BigEndianValue((char *) fcbp - (char *) MR(FCBSPtr)); + pb->ioRefNum = CW((char *) fcbp - (char *) MR(FCBSPtr)); PBRETURN(pb, noErr); } @@ -1536,7 +1536,7 @@ PRIVATE OSErr PBOpenHelper(ioParam *pb, forktype ft, LONGINT dirid, BOOLEAN asyn PUBLIC OSErr Executor::hfsPBOpen(ParmBlkPtr pb, BOOLEAN async) { OSErr err; - err = PBOpenHelper((ioParam *) pb, datafork, 0L, async); + err = PBOpenHelper((IOParam *) pb, datafork, 0L, async); fs_err_hook (err); return err; } @@ -1544,7 +1544,7 @@ PUBLIC OSErr Executor::hfsPBOpen(ParmBlkPtr pb, BOOLEAN async) PUBLIC OSErr Executor::hfsPBOpenRF(ParmBlkPtr pb, BOOLEAN async) { OSErr err; - err = PBOpenHelper((ioParam *) pb, resourcefork, 0L, async); + err = PBOpenHelper((IOParam *) pb, resourcefork, 0L, async); fs_err_hook (err); return err; } @@ -1553,7 +1553,7 @@ PUBLIC OSErr Executor::hfsPBHOpen(HParmBlkPtr pb, BOOLEAN async) { OSErr err; - err = PBOpenHelper((ioParam *) pb, datafork, BigEndianValue(pb->fileParam.ioDirID), + err = PBOpenHelper((IOParam *) pb, datafork, BigEndianValue(pb->fileParam.ioDirID), async); fs_err_hook (err); return err; @@ -1563,7 +1563,7 @@ PUBLIC OSErr Executor::hfsPBHOpenRF(HParmBlkPtr pb, BOOLEAN async) { OSErr err; - err = PBOpenHelper((ioParam *) pb, resourcefork, BigEndianValue(pb->fileParam.ioDirID), + err = PBOpenHelper((IOParam *) pb, resourcefork, BigEndianValue(pb->fileParam.ioDirID), async); fs_err_hook (err); return err; @@ -1579,12 +1579,12 @@ PUBLIC OSErr Executor::hfsPBHOpenRF(HParmBlkPtr pb, BOOLEAN async) PUBLIC OSErr Executor::hfsPBLockRange(ParmBlkPtr pb, BOOLEAN async) { - PBRETURN((ioParam *) pb, noErr); + PBRETURN((IOParam *) pb, noErr); } PUBLIC OSErr Executor::hfsPBUnlockRange(ParmBlkPtr pb, BOOLEAN async) { - PBRETURN((ioParam *) pb, noErr); + PBRETURN((IOParam *) pb, noErr); } PUBLIC OSErr Executor::hfsPBGetFPos(ParmBlkPtr pb, BOOLEAN async) @@ -1592,19 +1592,19 @@ PUBLIC OSErr Executor::hfsPBGetFPos(ParmBlkPtr pb, BOOLEAN async) filecontrolblock *fcbp; OSErr err; - fcbp = ROMlib_refnumtofcbp(BigEndianValue(pb->ioParam.ioRefNum)); + fcbp = ROMlib_refnumtofcbp(CW(pb->ioParam.ioRefNum)); if (!fcbp) { err = rfNumErr; fs_err_hook (err); -/*-->*/ PBRETURN((ioParam *) pb, err); +/*-->*/ PBRETURN((IOParam *) pb, err); } pb->ioParam.ioReqCount = 0; pb->ioParam.ioActCount = 0; pb->ioParam.ioPosMode = 0; pb->ioParam.ioPosOffset = fcbp->fcbCrPs; - PBRETURN((ioParam *) pb, noErr); + PBRETURN((IOParam *) pb, noErr); } PUBLIC OSErr Executor::hfsPBSetFPos(ParmBlkPtr pb, BOOLEAN async) @@ -1613,25 +1613,25 @@ PUBLIC OSErr Executor::hfsPBSetFPos(ParmBlkPtr pb, BOOLEAN async) LONGINT newpos; OSErr retval; - fcbp = ROMlib_refnumtofcbp(BigEndianValue(pb->ioParam.ioRefNum)); + fcbp = ROMlib_refnumtofcbp(CW(pb->ioParam.ioRefNum)); if (!fcbp) { retval = rfNumErr; fs_err_hook (retval); -/*-->*/ PBRETURN((ioParam *) pb, retval); +/*-->*/ PBRETURN((IOParam *) pb, retval); } retval = noErr; - newpos = pbabsoffset((ioParam *) pb, fcbp); + newpos = pbabsoffset((IOParam *) pb, fcbp); if (newpos < 0) retval = posErr; else if (newpos > Cx(fcbp->fcbEOF)) { retval = eofErr; fcbp->fcbCrPs = fcbp->fcbEOF; } else - fcbp->fcbCrPs = BigEndianValue(newpos); + fcbp->fcbCrPs = CL(newpos); pb->ioParam.ioPosOffset = fcbp->fcbCrPs; fs_err_hook (retval); - PBRETURN((ioParam *) pb, retval); + PBRETURN((IOParam *) pb, retval); } PUBLIC OSErr Executor::hfsPBGetEOF(ParmBlkPtr pb, BOOLEAN async) @@ -1639,12 +1639,12 @@ PUBLIC OSErr Executor::hfsPBGetEOF(ParmBlkPtr pb, BOOLEAN async) filecontrolblock *fcbp; OSErr err; - fcbp = ROMlib_refnumtofcbp(BigEndianValue(pb->ioParam.ioRefNum)); + fcbp = ROMlib_refnumtofcbp(CW(pb->ioParam.ioRefNum)); if (!fcbp) { err = rfNumErr; fs_err_hook (err); -/*-->*/ PBRETURN((ioParam *) pb, err); +/*-->*/ PBRETURN((IOParam *) pb, err); } #if defined(MAC) pb->ioParam.ioMisc = (Ptr) fcbp->fcbEOF; @@ -1652,5 +1652,5 @@ PUBLIC OSErr Executor::hfsPBGetEOF(ParmBlkPtr pb, BOOLEAN async) pb->ioParam.ioMisc = fcbp->fcbEOF; #endif /* !defined(MAC) */ - PBRETURN((ioParam *) pb, noErr); + PBRETURN((IOParam *) pb, noErr); } diff --git a/src/hfsHelper.cpp b/src/hfsHelper.cpp index dfa82411..2f632ef1 100644 --- a/src/hfsHelper.cpp +++ b/src/hfsHelper.cpp @@ -31,11 +31,12 @@ char ROMlib_rcsid_hfsHelper[] = #include #include #include +#if defined(MACOSX_) #include #endif +#endif using namespace Executor; -using namespace ByteSwap; #if !defined(MAC) @@ -286,7 +287,7 @@ read_driver_block_size (LONGINT fd, LONGINT bsize, LONGINT maxbytes, { if (aligned_buf[0] == 0x45 && aligned_buf[1] == 0x52) { - retval = (unsigned short) BigEndianValue (*(unsigned short *) &aligned_buf[2]); + retval = (unsigned short) CW (*(unsigned short *) &aligned_buf[2]); warning_fs_log ("fd = 0x%x, block size = %d", fd, retval); } } @@ -335,9 +336,9 @@ Executor::try_to_mount_disk (const char *dname, LONGINT floppyfd, LONGINT *messp if (floppyfd < 0) /*-->*/return; - drivenum = BigEndianValue(dqp->dq.dQDrive); + drivenum = CW(dqp->dq.dQDrive); - pb.ioParam.ioVRefNum = BigEndianValue(drivenum); + pb.ioParam.ioVRefNum = CW(drivenum); foundmap = FALSE; first = TRUE; @@ -357,16 +358,16 @@ Executor::try_to_mount_disk (const char *dname, LONGINT floppyfd, LONGINT *messp dqp = ROMlib_addtodq (2048L * 2, dname, partition, OURHFSDREF, flags, &hfs); - drivenum = BigEndianValue(dqp->dq.dQDrive); - pb.ioParam.ioVRefNum = BigEndianValue(drivenum); + drivenum = CW(dqp->dq.dQDrive); + pb.ioParam.ioVRefNum = CW(drivenum); } - dqp->hfs.offset = hfs.offset + (BigEndianValue (partp->pmPyPartStart) + dqp->hfs.offset = hfs.offset + (CL (partp->pmPyPartStart) * driver_block_size); err = hfsPBMountVol(&pb, floppyfd, dqp->hfs.offset, bsize, maxbytes, flags, dqp); mess = ((LONGINT) err << 16) | drivenum; if (first) { - *messp = BigEndianValue(mess); + *messp = CL(mess); first = FALSE; } else PPostEvent(diskEvt, mess, (HIDDEN_EvQElPtr *) 0); @@ -389,17 +390,17 @@ Executor::try_to_mount_disk (const char *dname, LONGINT floppyfd, LONGINT *messp ++partition; dqp = ROMlib_addtodq (2048L * 2, dname, partition, OURHFSDREF, flags, &hfs); - drivenum = BigEndianValue(dqp->dq.dQDrive); - pb.ioParam.ioVRefNum = BigEndianValue(drivenum); + drivenum = CW(dqp->dq.dQDrive); + pb.ioParam.ioVRefNum = CW(drivenum); } dqp->hfs.offset = hfs.offset + - (BigEndianValue (oldmapp->oldmapentry[i].pdStart) + (CL (oldmapp->oldmapentry[i].pdStart) * driver_block_size); err = hfsPBMountVol(&pb, floppyfd, dqp->hfs.offset, bsize, maxbytes, flags, dqp); mess = ((LONGINT) err << 16) | drivenum; if (first) { - *messp = BigEndianValue(mess); + *messp = CL(mess); first = FALSE; } else PPostEvent(diskEvt, mess, (HIDDEN_EvQElPtr *) 0); @@ -446,7 +447,7 @@ Executor::try_to_mount_disk (const char *dname, LONGINT floppyfd, LONGINT *messp dqp->hfs.offset = offset; err = hfsPBMountVol(&pb, floppyfd, offset, bsize, maxbytes, flags, dqp); - *messp = BigEndianValue(((LONGINT) err << 16) | drivenum); + *messp = CL(((LONGINT) err << 16) | drivenum); } } } @@ -603,10 +604,10 @@ Executor::ROMlib_transphysblk (hfs_access_t *hfsp, LONGINT physblock, short nphy pb.ioVRefNum = vcbp->vcbDrvNum; pb.ioRefNum = vcbp->vcbDRefNum; - pb.ioBuffer = BigEndianValue(bufp); - pb.ioReqCount = BigEndianValue(PHYSBSIZE * (LONGINT nphysblocks)); - pb.ioPosMode = BigEndianValue(fsFromStart); - pb.ioPosOffset = BigEndianValue(physblock); + pb.ioBuffer = CL(bufp); + pb.ioReqCount = CL(PHYSBSIZE * (LONGINT nphysblocks)); + pb.ioPosMode = CW(fsFromStart); + pb.ioPosOffset = CL(physblock); err = rw == reading ? PBRead ((ParmBlkPtr) &pb, FALSE) : PBWrite((ParmBlkPtr) &pb, FALSE); if (actp) @@ -632,7 +633,7 @@ Executor::ROMlib_transphysblk (hfs_access_t *hfsp, LONGINT physblock, short nphy memmove(bufp, newbufp, (LONGINT) nphysblocks * PHYSBSIZE); #endif if (actp) - *actp = err != noErr ? 0 : BigEndianValue((LONGINT) nphysblocks * PHYSBSIZE); + *actp = err != noErr ? 0 : CL((LONGINT) nphysblocks * PHYSBSIZE); #endif @@ -668,7 +669,7 @@ PUBLIC void *Executor::ROMlib_indexqueue(QHdr *qp, short index) QElemPtr p; #if 0 - for (p = BigEndianValue(qp->qHead); (--index > 0) && p; p = BigEndianValue(p->qLink)) + for (p = CL(qp->qHead); (--index > 0) && p; p = CL(p->qLink)) ; #else for (p = MR(qp->qHead); (--index > 0) && p; p = MR(p->vcbQElem.qLink)) diff --git a/src/hfsHier.cpp b/src/hfsHier.cpp index 52eb8ea8..18fd1930 100644 --- a/src/hfsHier.cpp +++ b/src/hfsHier.cpp @@ -35,7 +35,7 @@ PRIVATE OSErr cathelper(CInfoPBPtr pb, BOOLEAN async, catop op) vcbp = 0; if (BigEndianValue(pb->hFileInfo.ioFDirIndex) > 0 && op == catGet) { - err = ROMlib_btpbindex((ioParam *) pb, BigEndianValue(pb->hFileInfo.ioDirID), &vcbp, &frp, + err = ROMlib_btpbindex((IOParam *) pb, BigEndianValue(pb->hFileInfo.ioDirID), &vcbp, &frp, &catkeyp, FALSE); if (err != noErr) goto done; @@ -54,14 +54,14 @@ PRIVATE OSErr cathelper(CInfoPBPtr pb, BOOLEAN async, catop op) break; } } else { - if (BigEndianValue(pb->hFileInfo.ioFDirIndex) < 0) { + if (CW(pb->hFileInfo.ioFDirIndex) < 0) { kind = directory; ignorename = TRUE; } else { kind = filekind(regular | directory); ignorename = FALSE; } - err = ROMlib_findvcbandfile((ioParam *) pb, BigEndianValue(pb->hFileInfo.ioDirID), + err = ROMlib_findvcbandfile((IOParam *) pb, BigEndianValue(pb->hFileInfo.ioDirID), &btparamrec, &kind, ignorename); if (err != noErr) goto done; @@ -84,7 +84,7 @@ PRIVATE OSErr cathelper(CInfoPBPtr pb, BOOLEAN async, catop op) if (UPDATE_IONAMEPTR_P(*pbf)) str255assign(MR(pbf->ioNamePtr), catkeyp->ckrCName); pbf->ioACUser = 0; - pbf->ioFlAttrib = CB (open_attrib_bits (BigEndianValue (frp->filFlNum), vcbp, + pbf->ioFlAttrib = CB (open_attrib_bits (CL (frp->filFlNum), vcbp, &pbf->ioFRefNum)); pbf->ioFlAttrib |= frp->filFlags & CB (INHERITED_FLAG_BITS); memmove(&pbf->ioFlFndrInfo, &frp->filUsrWds, @@ -169,7 +169,7 @@ PRIVATE OSErr cathelper(CInfoPBPtr pb, BOOLEAN async, catop op) if (err == noErr) err = err1; fs_err_hook (err); - PBRETURN((ioParam *) pb, err); + PBRETURN((IOParam *) pb, err); } @@ -198,24 +198,24 @@ PRIVATE OSErr parentchild(HVCB *vcbp, catkey *parentcatp, btparam btparamrec; err = noErr; - parid = BigEndianValue(parentdirp->dirDirID); - if (parid == BigEndianValue(childdirp->dirDirID)) + parid = CL(parentdirp->dirDirID); + if (parid == CL(childdirp->dirDirID)) err = badMovErr; /* can't move into oneself */ else if (parentdirp->dirVal != 0) { /* no need to check if no children */ if (parid <= 2) /* automatic disqualification; can't move */ err = badMovErr; /* root directory */ else { - newid = BigEndianValue(childcatp->ckrParID); + newid = CL(childcatp->ckrParID); err = ROMlib_makecatparam(&btparamrec, vcbp, (LONGINT) 0, 0, (Ptr) 0); - ctref = BigEndianValue(vcbp->vcbCTRef); + ctref = CW(vcbp->vcbCTRef); while (err == noErr && newid > 2 && newid != parid) { - btparamrec.tofind.catk.ckrParID = BigEndianValue(newid); + btparamrec.tofind.catk.ckrParID = CL(newid); err = ROMlib_keyfind(&btparamrec); if (err == noErr && !btparamrec.success) { err = fsDSIntErr; warning_unexpected ("no success in parentchild"); } - newid = BigEndianValue( + newid = CL( ((threadrec *)DATAPFROMKEY(btparamrec.foundp))->thdParID); } if (err == noErr) @@ -230,7 +230,7 @@ PUBLIC OSErr Executor::hfsPBCatMove(CMovePBPtr pb, BOOLEAN async) { OSErr err, err1; filekind srccurkind, dstcurkind; - ioParam iop; + IOParam iop; btparam srcbtparam, dstdirbtparam, dstbtparam; directoryrec *dstdirdrp; directoryrec srcdrec; @@ -238,15 +238,15 @@ PUBLIC OSErr Executor::hfsPBCatMove(CMovePBPtr pb, BOOLEAN async) BOOLEAN ignorename; srccurkind = (filekind)(regular | directory); - err = ROMlib_findvcbandfile((ioParam *) pb, BigEndianValue(pb->ioDirID), &srcbtparam, + err = ROMlib_findvcbandfile((IOParam *) pb, BigEndianValue(pb->ioDirID), &srcbtparam, &srccurkind, FALSE); if (err == noErr) { err = ROMlib_writevcbp(srcbtparam.vcbp); - iop = *(ioParam *)pb; + iop = *(IOParam *)pb; iop.ioNamePtr = pb->ioNewName; dstcurkind = directory; ignorename = iop.ioNamePtr == 0; - err = ROMlib_findvcbandfile(&iop, BigEndianValue(pb->ioNewDirID), &dstdirbtparam, &dstcurkind, + err = ROMlib_findvcbandfile(&iop, CL(pb->ioNewDirID), &dstdirbtparam, &dstcurkind, ignorename); if (err == noErr) { if (srcbtparam.vcbp != dstdirbtparam.vcbp) @@ -254,7 +254,7 @@ PUBLIC OSErr Executor::hfsPBCatMove(CMovePBPtr pb, BOOLEAN async) else { dstdirdrp = (directoryrec *) DATAPFROMKEY(dstdirbtparam.foundp); dstbtparam = dstdirbtparam; - err = ROMlib_makecatkey((catkey *) &dstbtparam.tofind, BigEndianValue(dstdirdrp->dirDirID), + err = ROMlib_makecatkey((catkey *) &dstbtparam.tofind, CL(dstdirdrp->dirDirID), srcbtparam.foundp->catk.ckrCName[0], (Ptr) srcbtparam.foundp->catk.ckrCName+1); dstbtparam.leafindex = -1; diff --git a/src/hfsMisc.cpp b/src/hfsMisc.cpp index 5177fd5a..fae4bf8e 100644 --- a/src/hfsMisc.cpp +++ b/src/hfsMisc.cpp @@ -15,7 +15,6 @@ char ROMlib_rcsid_hfsMisc[] = #include "rsys/file.h" using namespace Executor; -using namespace ByteSwap; #if defined (TESTFCB) PUBLIC void testfcb() @@ -24,24 +23,24 @@ PUBLIC void testfcb() filecontrolblock *fp; INTEGER i; - length = BigEndianValue(*(short *)BigEndianValue(FCBSPtr)); - fp = (filecontrolblock *)((short *)BigEndianValue(FCBSPtr) + 1); + length = CW(*(short *)CL(FCBSPtr)); + fp = (filecontrolblock *)((short *)CL(FCBSPtr) + 1); printf("length = %d, length / 94 = %d, length mod 94 = %d\n", length, length / 94, length % 94); for (i = 0; i < 40 && i < length / 94; i++, fp++) { printf("# %ld flags 0x%x vers %d sblk %d EOF %ld PLEN %ld mark %ld\n" "vptr 0x%lx pbuffer 0x%lx FlPos %d clmpsiz %ld BTCBPtr 0x%lx\n" "ext (%d %d) (%d %d) (%d %d) FNDR '%c%c%c%c' CatPos 0x%lx\n" - "parid %ld name %s\n", BigEndianValue(fp->fcbFlNum), fp->fcbMdRByt, - fp->fcbTypByt, BigEndianValue(fp->fcbSBlk), BigEndianValue(fp->fcbEOF), BigEndianValue(fp->fcbPLen), BigEndianValue(fp->fcbCrPs), - BigEndianValue(fp->fcbVPtr), BigEndianValue(fp->fcbBfAdr), BigEndianValue(fp->fcbFlPos), BigEndianValue(fp->fcbClmpSize), - BigEndianValue(fp->fcbBTCBPtr), - BigEndianValue(fp->fcbExtRec[0].blockstart), BigEndianValue(fp->fcbExtRec[0].blockcount), - BigEndianValue(fp->fcbExtRec[1].blockstart), BigEndianValue(fp->fcbExtRec[1].blockcount), - BigEndianValue(fp->fcbExtRec[2].blockstart), BigEndianValue(fp->fcbExtRec[2].blockcount), - (short) (BigEndianValue(fp->fcbFType) >> 24), (short) (BigEndianValue(fp->fcbFType) >> 16), - (short) BigEndianValue(fp->fcbFType) >> 8, (short) BigEndianValue(fp->fcbFType), - BigEndianValue(fp->fcbCatPos), BigEndianValue(fp->fcbDirID), fp->fcbCName+1); + "parid %ld name %s\n", CL(fp->fcbFlNum), fp->fcbMdRByt, + fp->fcbTypByt, CW(fp->fcbSBlk), CL(fp->fcbEOF), CL(fp->fcbPLen), CL(fp->fcbCrPs), + CL(fp->fcbVPtr), CL(fp->fcbBfAdr), CW(fp->fcbFlPos), CL(fp->fcbClmpSize), + CL(fp->fcbBTCBPtr), + CW(fp->fcbExtRec[0].blockstart), CW(fp->fcbExtRec[0].blockcount), + CW(fp->fcbExtRec[1].blockstart), CW(fp->fcbExtRec[1].blockcount), + CW(fp->fcbExtRec[2].blockstart), CW(fp->fcbExtRec[2].blockcount), + (short) (CL(fp->fcbFType) >> 24), (short) (CL(fp->fcbFType) >> 16), + (short) CL(fp->fcbFType) >> 8, (short) CL(fp->fcbFType), + CL(fp->fcbCatPos), CL(fp->fcbDirID), fp->fcbCName+1); } } #endif /* TESTFCB */ @@ -73,10 +72,10 @@ A2(PUBLIC trap, OSErrRET, PBGetFCBInfo, FCBPBPtr, pb, BOOLEAN, async) filecontrolblock *fcbp, *efcbp; INTEGER i; - if ((i = BigEndianValue(pb->ioFCBIndx)) > 0) { + if ((i = CW(pb->ioFCBIndx)) > 0) { fcbp = (filecontrolblock *) (MR(FCBSPtr) + sizeof(INTEGER)); - efcbp = (filecontrolblock *) (MR(FCBSPtr) + BigEndianValue(*(INTEGER *)MR(FCBSPtr))); - if (BigEndianValue(pb->ioVRefNum) < 0) { + efcbp = (filecontrolblock *) (MR(FCBSPtr) + CW(*(INTEGER *)MR(FCBSPtr))); + if (CW(pb->ioVRefNum) < 0) { for (;fcbp != efcbp; fcbp++) if (fcbp->fcbFlNum && MR(fcbp->fcbVPtr)->vcbVRefNum == pb->ioVRefNum && --i <= 0) @@ -84,7 +83,7 @@ A2(PUBLIC trap, OSErrRET, PBGetFCBInfo, FCBPBPtr, pb, BOOLEAN, async) } else if (pb->ioVRefNum == 0) { for (;fcbp != efcbp && (fcbp->fcbFlNum == 0 || --i > 0); fcbp++) ; - } else /* if (BigEndianValue(pb->ioVRefNum) > 0 */ { + } else /* if (CW(pb->ioVRefNum) > 0 */ { for (;fcbp != efcbp; fcbp++) if (fcbp->fcbFlNum && MR(fcbp->fcbVPtr)->vcbDrvNum == pb->ioVRefNum && --i <= 0) @@ -92,28 +91,28 @@ A2(PUBLIC trap, OSErrRET, PBGetFCBInfo, FCBPBPtr, pb, BOOLEAN, async) } if (fcbp == efcbp) PBRETURN(pb, fnOpnErr); - pb->ioRefNum = BigEndianValue((char *) fcbp - (char *) MR(FCBSPtr)); + pb->ioRefNum = CW((char *) fcbp - (char *) MR(FCBSPtr)); } else { - fcbp = ROMlib_refnumtofcbp(BigEndianValue(pb->ioRefNum)); + fcbp = ROMlib_refnumtofcbp(CW(pb->ioRefNum)); if (!fcbp) PBRETURN(pb, rfNumErr); } if (pb->ioNamePtr) str255assign(MR(pb->ioNamePtr), fcbp->fcbCName); pb->ioFCBFlNm = fcbp->fcbFlNum; - pb->ioFCBFlags = BigEndianValue((fcbp->fcbMdRByt <<8) | (unsigned char) fcbp->fcbTypByt); + pb->ioFCBFlags = CW((fcbp->fcbMdRByt <<8) | (unsigned char) fcbp->fcbTypByt); pb->ioFCBStBlk = fcbp->fcbSBlk; pb->ioFCBEOF = fcbp->fcbEOF; if (MR(fcbp->fcbVPtr)->vcbCTRef) { pb->ioFCBCrPs = fcbp->fcbCrPs; /* HFS */ pb->ioFCBPLen = fcbp->fcbPLen; } else { - pb->ioFCBCrPs = BigEndianValue((ULONGINT)(lseek(((fcbrec *)fcbp)->fcfd, 0, SEEK_CUR) - /* UFS */ + pb->ioFCBCrPs = CL((ULONGINT)(lseek(((fcbrec *)fcbp)->fcfd, 0, SEEK_CUR) - /* UFS */ FORKOFFSET((fcbrec *) fcbp))); pb->ioFCBPLen = fcbp->fcbEOF; } pb->ioFCBVRefNum = MR(fcbp->fcbVPtr)->vcbVRefNum; - if (BigEndianValue(pb->ioFCBIndx) <= 0 || pb->ioVRefNum == 0) + if (CW(pb->ioFCBIndx) <= 0 || pb->ioVRefNum == 0) pb->ioVRefNum = pb->ioFCBVRefNum; pb->ioFCBClpSiz = fcbp->fcbClmpSize; pb->ioFCBParID = fcbp->fcbDirID; diff --git a/src/hfsVolume.cpp b/src/hfsVolume.cpp index 8a1c90cc..6c96ac1a 100644 --- a/src/hfsVolume.cpp +++ b/src/hfsVolume.cpp @@ -20,7 +20,6 @@ char ROMlib_rcsid_hfsVolume[] = #endif using namespace Executor; -using namespace ByteSwap; /* * TODO: support read and write count. This will make it possible to @@ -96,20 +95,20 @@ PRIVATE OSErr readvolumebitmap(HVCB *vcbp, volumeinfoPtr vp) words = (long *) vp; warning_fs_log ("sigword = 0x%02x (%08lx %08lx %08lx %08lx)", - BigEndianValue (vp->drSigWord), BigEndianValue (words[0]), BigEndianValue (words[1]), - BigEndianValue (words[2]), BigEndianValue (words[3])); + CW (vp->drSigWord), CL (words[0]), CL (words[1]), + CL (words[2]), CL (words[3])); } else { nphysrequired = NPHYSREQ(ROUNDUP8(Cx(vp->drNmAlBlks)) / 8); vcbp->vcbMAdr = RM(NewPtr_aligned_4(PHYSBSIZE * nphysrequired + MADROFFSET, 0)); - vcbp->vcbMLen = BigEndianValue(nphysrequired + MADROFFSET); + vcbp->vcbMLen = CW(nphysrequired + MADROFFSET); /*really add MADROFFSET?*/ if (!vcbp->vcbMAdr) err = MemError(); else err = ROMlib_transphysblk (&((VCBExtra *) vcbp)->u.hfs, - BigEndianValue(vp->drVBMSt) * (ULONGINT) PHYSBSIZE, + CW(vp->drVBMSt) * (ULONGINT) PHYSBSIZE, nphysrequired, MR(vcbp->vcbMAdr) + MADROFFSET, reading, (LONGINT *) 0); @@ -133,7 +132,7 @@ PRIVATE OSErr initcache(HVCB *vcbp) return MemError(); TheZone = savezone; headp = (cachehead *) MR(vcbp->vcbCtlBuf); - headp->nitems = BigEndianValue(NCACHEENTRIES); + headp->nitems = CW(NCACHEENTRIES); headp->flags = 0; headp->flink = RM((cacheentry *)(headp + 1)); headp->blink = RM(MR(headp->flink) + NCACHEENTRIES - 1); @@ -177,8 +176,8 @@ check_volume_size (volumeinfoPtr vp) unsigned short nmalblks; unsigned long dralblksiz; - nmalblks = BigEndianValue (vp->drNmAlBlks); - dralblksiz = BigEndianValue (vp->drAlBlkSiz); + nmalblks = CW (vp->drNmAlBlks); + dralblksiz = CL (vp->drAlBlkSiz); retval = ((long long) nmalblks * dralblksiz >= 2LL * 1024 * 1024 * 1024 ? paramErr : noErr); if (retval != noErr) @@ -212,7 +211,7 @@ PRIVATE OSErr readvolumeinfo(HVCB *vcbp) /* call once during mounting */ } #define VOLUMEINFOBACKUP(vcbp) \ - ((BigEndianValue(vcbp->vcbNmAlBlks) * Cx(vcbp->vcbAlBlkSiz)) + \ + ((CW(vcbp->vcbNmAlBlks) * Cx(vcbp->vcbAlBlkSiz)) + \ (Cx(vcbp->vcbAlBlSt) * PHYSBSIZE)) void Executor::vcbsync(HVCB *vcbp) @@ -265,7 +264,7 @@ OSErr Executor::ROMlib_flushvcbp(HVCB *vcbp) memmove(&vip->drCTExtRec, &fcbp->fcbExtRec, (LONGINT) sizeof(fcbp->fcbExtRec)); retval = writevolumeinfo(vcbp, p); - vcbp->vcbFlags &= BigEndianValue(~VCBDIRTY); + vcbp->vcbFlags &= CW(~VCBDIRTY); } } return retval; @@ -358,7 +357,7 @@ Executor::ROMlib_dqbydrive (short vrefnum) DrvQExtra *retval; short swapped_vrefnum; - swapped_vrefnum = BigEndianValue (vrefnum); + swapped_vrefnum = CW (vrefnum); retval = 0; for (dp = (DrvQEl *) MR (DrvQHdr.qHead); dp && (retval = (DrvQExtra *) ((char *) dp - sizeof(LONGINT)), @@ -405,13 +404,13 @@ PUBLIC HVCB *Executor::ROMlib_findvcb(short vrefnum, StringPtr name, LONGINT *di wdp = WDNUMTOWDP(vrefnum); vcbp = MR(wdp->vcbp); if (diridp) - *diridp = BigEndianValue(wdp->dirid); + *diridp = CL(wdp->dirid); } else vcbp = ROMlib_vcbbyvrn(vrefnum); } else if (usedefault || (!name && !vrefnum)) { vcbp = (HVCB *) MR(DefVCBPtr); if (diridp) - *diridp = BigEndianValue(DefDirID); + *diridp = CL(DefDirID); } } return vcbp; @@ -443,17 +442,17 @@ PRIVATE INTEGER openxtnt(LONGINT filnum, LONGINT clpsize, LONGINT filsize, xtntr fcbp = ROMlib_getfreefcbp(); if (fcbp) { - fcbp->fcbFlNum = BigEndianValue(filnum); + fcbp->fcbFlNum = CL(filnum); fcbp->fcbMdRByt = 0; fcbp->fcbTypByt = 0; fcbp->fcbSBlk = 0; - fcbp->fcbEOF = BigEndianValue(filsize); - fcbp->fcbPLen = BigEndianValue(filsize); + fcbp->fcbEOF = CL(filsize); + fcbp->fcbPLen = CL(filsize); fcbp->fcbCrPs = 0; fcbp->fcbVPtr = RM(vcbp); fcbp->fcbBfAdr = 0; fcbp->fcbFlPos = 0; - fcbp->fcbClmpSize = BigEndianValue(clpsize); + fcbp->fcbClmpSize = CL(clpsize); fcbp->fcbBTCBPtr = 0; memmove(fcbp->fcbExtRec, xtr, (LONGINT) sizeof(xtntrec)); fcbp->fcbFType = 0; @@ -486,7 +485,7 @@ Executor::hfsPBMountVol (ParmBlkPtr pb, LONGINT floppyfd, LONGINT offset, LONGIN "flags = 0x%x", floppyfd, offset, bsize, maxbytes, flags); saveZone = TheZone; TheZone = SysZone; - vcbp = ROMlib_vcbbydrive(BigEndianValue(pb->volumeParam.ioVRefNum)); + vcbp = ROMlib_vcbbydrive(CW(pb->volumeParam.ioVRefNum)); if (vcbp) err = volOnLinErr; else { @@ -522,37 +521,37 @@ Executor::hfsPBMountVol (ParmBlkPtr pb, LONGINT floppyfd, LONGINT offset, LONGIN } memmove(&vcbp->vcbSigWord, &vip->drSigWord, (LONGINT) 64); - nblocks = (BigEndianValue(vcbp->vcbAlBlkSiz) / PHYSBSIZE) * - BigEndianValue(vcbp->vcbNmAlBlks) + BigEndianValue(vcbp->vcbAlBlSt) + 2; - dqp->dq.dQDrvSz = BigEndianValue(nblocks); - dqp->dq.dQDrvSz2 = BigEndianValue(nblocks >> 16); + nblocks = (CL(vcbp->vcbAlBlkSiz) / PHYSBSIZE) * + CW(vcbp->vcbNmAlBlks) + CW(vcbp->vcbAlBlSt) + 2; + dqp->dq.dQDrvSz = CW(nblocks); + dqp->dq.dQDrvSz2 = CW(nblocks >> 16); dqp->dq.qType = 1; vcbp->vcbDrvNum = pb->volumeParam.ioVRefNum; - vcbp->vcbDRefNum = BigEndianValue(drvtodref(Cx(pb->volumeParam.ioVRefNum))); + vcbp->vcbDRefNum = CW(drvtodref(Cx(pb->volumeParam.ioVRefNum))); vcbp->vcbFSID = 0; if (!alreadythere) - vcbp->vcbVRefNum = BigEndianValue(--ROMlib_nextvrn); + vcbp->vcbVRefNum = CW(--ROMlib_nextvrn); vcbp->vcbDirIndex = 0; vcbp->vcbDirBlk = 0; vcbp->vcbFlags = 0; memmove(&vcbp->vcbVolBkUp, &vip->drVolBkUp, (LONGINT) 66); vcbp->vcbXTAlBlks = - BigEndianValue(Cx(vip->drXTFlSize) / Cx(vip->drAlBlkSiz)); + CW(Cx(vip->drXTFlSize) / Cx(vip->drAlBlkSiz)); vcbp->vcbCTAlBlks = - BigEndianValue(Cx(vip->drCTFlSize) / Cx(vip->drAlBlkSiz)); + CW(Cx(vip->drCTFlSize) / Cx(vip->drAlBlkSiz)); - vcbp->vcbXTRef = BigEndianValue(openxtnt(XTNUM, Cx(vip->drXTClpSiz), + vcbp->vcbXTRef = CW(openxtnt(XTNUM, Cx(vip->drXTClpSiz), Cx(vip->drXTFlSize), vip->drXTExtRec, vcbp)); - vcbp->vcbCTRef = BigEndianValue(openxtnt(CTNUM, Cx(vip->drCTClpSiz), + vcbp->vcbCTRef = CW(openxtnt(CTNUM, Cx(vip->drCTClpSiz), Cx(vip->drCTFlSize), vip->drCTExtRec, vcbp)); vcbp->vcbDirIDM = 0; vcbp->vcbOffsM = 0; vcbp->vcbAtrb = 0; if (flags & DRIVE_FLAGS_FIXED) - vcbp->vcbAtrb |= BigEndianValue(VNONEJECTABLEBIT); + vcbp->vcbAtrb |= CW(VNONEJECTABLEBIT); if (!vcbp->vcbCTRef) err = tmfoErr; @@ -583,7 +582,7 @@ Executor::hfsPBMountVol (ParmBlkPtr pb, LONGINT floppyfd, LONGINT offset, LONGIN flags |= DRIVE_FLAGS_LOCKED; } if (flags & DRIVE_FLAGS_LOCKED) - vcbp->vcbAtrb |= BigEndianValue(VHARDLOCKBIT); + vcbp->vcbAtrb |= CW(VHARDLOCKBIT); if (!alreadythere) Enqueue((QElemPtr) vcbp, &VCBQHdr); pb->volumeParam.ioVRefNum = vcbp->vcbVRefNum; @@ -598,12 +597,12 @@ Executor::hfsPBMountVol (ParmBlkPtr pb, LONGINT floppyfd, LONGINT offset, LONGIN } TheZone = saveZone; warning_fs_log ("err = %d", err); - PBRETURN((volumeParam *) pb, err); + PBRETURN((VolumeParam *) pb, err); } PRIVATE void goofyclip(unsigned short *up) { - if (BigEndianValue(*up) > 0x7C00) /* IMIV-130 */ + if (CW(*up) > 0x7C00) /* IMIV-130 */ *up = CWC (0x7C00); } @@ -618,7 +617,7 @@ PRIVATE LONGINT getworkingdir(INTEGER vrefnum) if (ISWDNUM(vrefnum)) { wdp = WDNUMTOWDP(vrefnum); - retval = BigEndianValue(wdp->dirid); + retval = CL(wdp->dirid); } else retval = 0; return retval; @@ -678,13 +677,13 @@ PRIVATE OSErr commonGetVInfo(HVolumeParam *pb, BOOLEAN async, fstype fs) if (!vcbp) /*-->*/ PBRETURN(pb, nsvErr); - if (/*BigEndianValue (pb->ioVolIndex) >= 0 &&*/ pb->ioNamePtr) + if (/*CW (pb->ioVolIndex) >= 0 &&*/ pb->ioNamePtr) str255assign(MR(pb->ioNamePtr), (StringPtr) vcbp->vcbVN); pb->ioVCrDate = vcbp->vcbCrDate; pb->ioVAtrb = vcbp->vcbAtrb; if (workingdirnum) - pb->ioVNmFls = BigEndianValue(getnmfls(vcbp, workingdirnum)); + pb->ioVNmFls = CW(getnmfls(vcbp, workingdirnum)); else pb->ioVNmFls = vcbp->vcbNmFls; @@ -696,9 +695,9 @@ PRIVATE OSErr commonGetVInfo(HVolumeParam *pb, BOOLEAN async, fstype fs) pb->ioVFrBlk = vcbp->vcbFreeBks; switch (fs) { case mfs: - ((volumeParam *) pb)->ioVLsBkUp = vcbp->vcbVolBkUp; - ((volumeParam *) pb)->ioVDirSt = 0; - ((volumeParam *) pb)->ioVBlLn = 0; + ((VolumeParam *) pb)->ioVLsBkUp = vcbp->vcbVolBkUp; + ((VolumeParam *) pb)->ioVDirSt = 0; + ((VolumeParam *) pb)->ioVBlLn = 0; if (!workingdirnum) pb->ioVRefNum = vcbp->vcbVRefNum; goofyclip((unsigned short *) &pb->ioVNmAlBlks); @@ -758,22 +757,22 @@ PUBLIC OSErr Executor::hfsPBSetVInfo(HParmBlkPtr pb, BOOLEAN async) MR(pb->volumeParam.ioNamePtr)); vcbp->vcbCrDate = pb->volumeParam.ioVCrDate; vcbp->vcbLsMod = pb->volumeParam.ioVLsMod; - vcbp->vcbAtrb = BigEndianValue((Cx(vcbp->vcbAtrb) & ~ATRBMASK) | + vcbp->vcbAtrb = CW((Cx(vcbp->vcbAtrb) & ~ATRBMASK) | (Cx(pb->volumeParam.ioVAtrb) & ATRBMASK)); vcbp->vcbClpSiz = pb->volumeParam.ioVClpSiz; vcbp->vcbVolBkUp = pb->volumeParam.ioVBkUp; vcbp->vcbVSeqNum = pb->volumeParam.ioVSeqNum; memmove(vcbp->vcbFndrInfo, pb->volumeParam.ioVFndrInfo, (LONGINT) 32); - vcbp->vcbFlags |= BigEndianValue(VCBDIRTY); + vcbp->vcbFlags |= CW(VCBDIRTY); err = noErr; } } else err = nsvErr; - PBRETURN((volumeParam *) pb, err); + PBRETURN((VolumeParam *) pb, err); } -PRIVATE OSErr getvolcommon(volumeParam *pb) +PRIVATE OSErr getvolcommon(VolumeParam *pb) { OSErr err; @@ -792,8 +791,8 @@ PUBLIC OSErr Executor::hfsPBGetVol(ParmBlkPtr pb, BOOLEAN async) { OSErr err; - err = getvolcommon((volumeParam *) pb); - PBRETURN((volumeParam *) pb, err); + err = getvolcommon((VolumeParam *) pb); + PBRETURN((VolumeParam *) pb, err); } PUBLIC LONGINT Executor::DefDirID = CLC(2); @@ -803,7 +802,7 @@ PUBLIC OSErr Executor::hfsPBHGetVol(WDPBPtr pb, BOOLEAN async) wdentry *wdp; OSErr err; - err = getvolcommon((volumeParam *) pb); + err = getvolcommon((VolumeParam *) pb); pb->ioWDDirID = DefDirID; if (err == noErr) { if (ISWDNUM(Cx(DefVRefNum))) { @@ -827,7 +826,7 @@ PUBLIC OSErr Executor::hfsPBHGetVol(WDPBPtr pb, BOOLEAN async) * */ -PRIVATE OSErr setvolhelper(volumeParam *pb, BOOLEAN aysnc, LONGINT dirid, +PRIVATE OSErr setvolhelper(VolumeParam *pb, BOOLEAN aysnc, LONGINT dirid, BOOLEAN convertzeros) { HVCB *vcbp, *newDefVCBPtr; @@ -853,17 +852,17 @@ PRIVATE OSErr setvolhelper(volumeParam *pb, BOOLEAN aysnc, LONGINT dirid, newDefVCBPtr = RM(vcbp); newDefDirID = CLC(0); if (newdir > 2) { /* picked up working directory */ - newDefDirID = dirid ? BigEndianValue(dirid) : BigEndianValue(newdir); + newDefDirID = dirid ? CL(dirid) : CL(newdir); newDefVRefNum = pb->ioVRefNum; } else if (newdir == 1) { /* picked up by name */ - newDefDirID = BigEndianValue(newdir); + newDefDirID = CL(newdir); newDefVRefNum = vcbp->vcbVRefNum; } else { newDefVRefNum = pb->ioVRefNum; if (dirid == 0 && convertzeros) newDefDirID = CLC(2); else - newDefDirID = BigEndianValue(dirid); + newDefDirID = CL(dirid); } if (!convertzeros && pb->ioNamePtr) { /* this could change things */ @@ -873,7 +872,7 @@ PRIVATE OSErr setvolhelper(volumeParam *pb, BOOLEAN aysnc, LONGINT dirid, cpb.hFileInfo.ioNamePtr = pb->ioNamePtr; cpb.hFileInfo.ioVRefNum = pb->ioVRefNum; cpb.hFileInfo.ioFDirIndex = CWC (0); - cpb.hFileInfo.ioDirID = BigEndianValue(dirid); + cpb.hFileInfo.ioDirID = CL(dirid); /* * NOTE: the else case was added after seeing Excel 4 Installer do a setvol * to a file, presumably with the intent to set it to the parent id. @@ -903,12 +902,12 @@ PRIVATE OSErr setvolhelper(volumeParam *pb, BOOLEAN aysnc, LONGINT dirid, PUBLIC OSErr Executor::hfsPBSetVol(ParmBlkPtr pb, BOOLEAN async) { - return setvolhelper((volumeParam *) pb, async, 0, TRUE); + return setvolhelper((VolumeParam *) pb, async, 0, TRUE); } PUBLIC OSErr Executor::hfsPBHSetVol(WDPBPtr pb, BOOLEAN async) { - return setvolhelper((volumeParam *) pb, async, Cx(pb->ioWDDirID), FALSE); + return setvolhelper((VolumeParam *) pb, async, Cx(pb->ioWDDirID), FALSE); } PUBLIC OSErr Executor::hfsPBFlushVol(ParmBlkPtr pb, BOOLEAN async) @@ -922,21 +921,21 @@ PUBLIC OSErr Executor::hfsPBFlushVol(ParmBlkPtr pb, BOOLEAN async) err = ROMlib_flushvcbp(vcbp); else err = nsvErr; - PBRETURN((volumeParam *) pb, err); + PBRETURN((VolumeParam *) pb, err); } PRIVATE void closeallvcbfiles(HVCB *vcbp) { filecontrolblock *fcbp, *efcbp; - ioParam iopb; + IOParam iopb; short length; - length = BigEndianValue(*(short *)MR(FCBSPtr)); + length = CW(*(short *)MR(FCBSPtr)); fcbp = (filecontrolblock *) ((short *)MR(FCBSPtr)+1); efcbp = (filecontrolblock *) ((char *)MR(FCBSPtr) + length); for (;fcbp < efcbp; fcbp = (filecontrolblock *) ((char *)fcbp + Cx(FSFCBLen))) if (fcbp->fcbFlNum && MR(fcbp->fcbVPtr) == vcbp) { - iopb.ioRefNum = BigEndianValue((char *) fcbp - (char *) MR(FCBSPtr)); + iopb.ioRefNum = CW((char *) fcbp - (char *) MR(FCBSPtr)); /* my */PBFlushFile((ParmBlkPtr) &iopb, FALSE); } } @@ -958,13 +957,13 @@ PUBLIC OSErr Executor::hfsPBUnmountVol(ParmBlkPtr pb) DisposPtr((Ptr) vcbp); } else err = nsvErr; - PBRETURN((volumeParam *) pb, err); + PBRETURN((VolumeParam *) pb, err); } -PRIVATE OSErr offlinehelper(volumeParam *pb, HVCB *vcbp) +PRIVATE OSErr offlinehelper(VolumeParam *pb, HVCB *vcbp) { OSErr err, err1, err2; - ioParam iop; + IOParam iop; err = /* my */PBFlushVol((ParmBlkPtr) pb, FALSE); err1 = 0; @@ -1010,13 +1009,13 @@ PUBLIC OSErr Executor::hfsPBOffLine(ParmBlkPtr pb) MR(pb->volumeParam.ioNamePtr), (LONGINT *) 0, FALSE); if (vcbp) { if (vcbp->vcbDrvNum) { - vcbp->vcbDRefNum = BigEndianValue(-Cx(vcbp->vcbDrvNum)); - err = offlinehelper((volumeParam *) pb, vcbp); + vcbp->vcbDRefNum = CW(-Cx(vcbp->vcbDrvNum)); + err = offlinehelper((VolumeParam *) pb, vcbp); } else err = noErr; } else err = nsvErr; - PBRETURN((volumeParam *) pb, err); + PBRETURN((VolumeParam *) pb, err); } PUBLIC OSErr Executor::hfsPBEject(ParmBlkPtr pb) @@ -1031,10 +1030,10 @@ PUBLIC OSErr Executor::hfsPBEject(ParmBlkPtr pb) if (vcbp) { if (Cx(vcbp->vcbDrvNum)) { vcbp->vcbDRefNum = vcbp->vcbDrvNum; - err = offlinehelper((volumeParam *) pb, vcbp); + err = offlinehelper((VolumeParam *) pb, vcbp); } else { if (Cx(vcbp->vcbDRefNum) < 0) /* offline */ - vcbp->vcbDRefNum = BigEndianValue(Cx(vcbp->vcbDRefNum) * -1); + vcbp->vcbDRefNum = CW(Cx(vcbp->vcbDRefNum) * -1); err = noErr; } } else @@ -1048,17 +1047,17 @@ PUBLIC OSErr Executor::hfsPBEject(ParmBlkPtr pb) if (err == noErr) err = ROMlib_ejectfloppy(vcbp ? ((VCBExtra *) vcbp)->u.hfs.fd : -1); #endif - PBRETURN((volumeParam *) pb, err); + PBRETURN((VolumeParam *) pb, err); } -PUBLIC OSErr Executor::ROMlib_pbvolrename(ioParam *pb, StringPtr newnamep) +PUBLIC OSErr Executor::ROMlib_pbvolrename(IOParam *pb, StringPtr newnamep) { OSErr err; HParamBlockRec hpb; Str255 name_copy; str255assign (name_copy, MR (pb->ioNamePtr)); - hpb.volumeParam.ioNamePtr = (StringPtr) BigEndianValue ((long) name_copy); + hpb.volumeParam.ioNamePtr = (StringPtr) CL ((long) name_copy); hpb.volumeParam.ioVRefNum = pb->ioVRefNum; hpb.volumeParam.ioVolIndex = CWC(-1); err = /* my */PBHGetVInfo((HParmBlkPtr) &hpb, FALSE); diff --git a/src/hfsWorkingdir.cpp b/src/hfsWorkingdir.cpp index 9d5f6065..d6e85065 100644 --- a/src/hfsWorkingdir.cpp +++ b/src/hfsWorkingdir.cpp @@ -15,7 +15,6 @@ char ROMlib_rcsid_hfsWorkingdir[] = #include "MemoryMgr.h" using namespace Executor; -using namespace ByteSwap; /* * TODO: use this working directory stuff in ROMlib @@ -26,8 +25,8 @@ PUBLIC OSErr Executor::ROMlib_dirbusy(LONGINT dirid, HVCB *vcbp) #if defined(MAC) wdentry *wdp, *ewdp; - for (wdp = (wdentry *) (BigEndianValue(WDCBsPtr) + sizeof(INTEGER)), - ewdp = (wdentry *) (BigEndianValue(WDCBsPtr) + BigEndianValue(*(INTEGER *)BigEndianValue(WDCBsPtr))); + for (wdp = (wdentry *) (CL(WDCBsPtr) + sizeof(INTEGER)), + ewdp = (wdentry *) (CL(WDCBsPtr) + CW(*(INTEGER *)CL(WDCBsPtr))); wdp != ewdp; wdp++) ; return wdp == ewdp ? noErr : fBsyErr; @@ -46,18 +45,18 @@ PUBLIC OSErr Executor::ROMlib_mkwd(WDPBPtr pb, HVCB *vcbp, LONGINT dirid, LONGIN firstfreep = 0; for (wdp = (wdentry *) (MR(WDCBsPtr) + sizeof(INTEGER)), - ewdp = (wdentry *) (MR(WDCBsPtr) +BigEndianValue(*(INTEGER *)MR(WDCBsPtr))); + ewdp = (wdentry *) (MR(WDCBsPtr) +CW(*(INTEGER *)MR(WDCBsPtr))); wdp != ewdp; wdp++) { if (!firstfreep && !wdp->vcbp) firstfreep = wdp; - if (MR(wdp->vcbp) == vcbp && BigEndianValue(wdp->dirid) == dirid && - BigEndianValue(wdp->procid) == procid) { - pb->ioVRefNum = BigEndianValue(WDPTOWDNUM(wdp)); + if (MR(wdp->vcbp) == vcbp && CL(wdp->dirid) == dirid && + CL(wdp->procid) == procid) { + pb->ioVRefNum = CW(WDPTOWDNUM(wdp)); /*-->*/ return noErr; } } if (!firstfreep) { - n_wd_bytes = BigEndianValue(*(INTEGER *) MR(WDCBsPtr)); + n_wd_bytes = CW(*(INTEGER *) MR(WDCBsPtr)); new_n_wd_bytes = (n_wd_bytes - sizeof(INTEGER)) * 2 + sizeof(INTEGER); saveZone = TheZone; TheZone = SysZone; @@ -69,7 +68,7 @@ PUBLIC OSErr Executor::ROMlib_mkwd(WDPBPtr pb, HVCB *vcbp, LONGINT dirid, LONGIN BlockMove( MR(WDCBsPtr), newptr, n_wd_bytes); DisposPtr( MR(WDCBsPtr) ); WDCBsPtr = RM(newptr); - *(INTEGER *) newptr = BigEndianValue(new_n_wd_bytes); + *(INTEGER *) newptr = CW(new_n_wd_bytes); firstfreep = (wdentry *) (newptr + n_wd_bytes); retval = noErr; } @@ -77,9 +76,9 @@ PUBLIC OSErr Executor::ROMlib_mkwd(WDPBPtr pb, HVCB *vcbp, LONGINT dirid, LONGIN retval = noErr; if (retval == noErr) { firstfreep->vcbp = RM(vcbp); - firstfreep->dirid = BigEndianValue(dirid); - firstfreep->procid = BigEndianValue(procid); - pb->ioVRefNum = BigEndianValue(WDPTOWDNUM(firstfreep)); + firstfreep->dirid = CL(dirid); + firstfreep->procid = CL(procid); + pb->ioVRefNum = CW(WDPTOWDNUM(firstfreep)); retval = noErr; } return retval; @@ -95,7 +94,7 @@ PUBLIC OSErr Executor::hfsPBOpenWD(WDPBPtr pb, BOOLEAN async) StringPtr namep; kind = (filekind)(regular|directory); - retval = ROMlib_findvcbandfile((ioParam *)pb, Cx(pb->ioWDDirID), + retval = ROMlib_findvcbandfile((IOParam *)pb, Cx(pb->ioWDDirID), &btparamrec, &kind, FALSE); if (retval != noErr) PBRETURN(pb, retval); @@ -106,10 +105,10 @@ PUBLIC OSErr Executor::hfsPBOpenWD(WDPBPtr pb, BOOLEAN async) namep = MR (pb->ioNamePtr); if (kind == directory && namep && namep[0]) dirid = - BigEndianValue(((directoryrec *) DATAPFROMKEY(btparamrec.foundp))->dirDirID); + CL(((directoryrec *) DATAPFROMKEY(btparamrec.foundp))->dirDirID); else - dirid = BigEndianValue(pb->ioWDDirID); - retval = ROMlib_mkwd(pb, vcbp, dirid, BigEndianValue(pb->ioWDProcID)); + dirid = CL(pb->ioWDDirID); + retval = ROMlib_mkwd(pb, vcbp, dirid, CL(pb->ioWDProcID)); PBRETURN(pb, retval); } @@ -144,7 +143,7 @@ PUBLIC OSErr Executor::hfsPBGetWDInfo(WDPBPtr pb, BOOLEAN async) if (Cx(pb->ioWDIndex) > 0) { i = Cx(pb->ioWDIndex); wdp = (wdentry *) (MR(WDCBsPtr) + sizeof(INTEGER)); - ewdp = (wdentry *) (MR(WDCBsPtr) + BigEndianValue(*(INTEGER *)MR(WDCBsPtr))); + ewdp = (wdentry *) (MR(WDCBsPtr) + CW(*(INTEGER *)MR(WDCBsPtr))); if (Cx(pb->ioVRefNum) < 0) { for (;wdp != ewdp; wdp++) if (wdp->vcbp && MR(wdp->vcbp)->vcbVRefNum == pb->ioVRefNum && --i <= 0) @@ -170,7 +169,7 @@ PUBLIC OSErr Executor::hfsPBGetWDInfo(WDPBPtr pb, BOOLEAN async) str255assign(MR(pb->ioNamePtr), (StringPtr) vcbp->vcbVN); pb->ioWDProcID = 0; pb->ioVRefNum = pb->ioWDVRefNum = vcbp->vcbVRefNum; - pb->ioWDDirID = BigEndianValue((vcbp == MR(DefVCBPtr)) ? DefDirID : 2); + pb->ioWDDirID = CL((vcbp == MR(DefVCBPtr)) ? DefDirID : 2); foundelsewhere = TRUE; } } @@ -199,7 +198,7 @@ Executor::GetWDInfo (INTEGER wd, INTEGER *vrefp, LONGINT *dirp, LONGINT *procp) WDPBRec wdp; memset (&wdp, 0, sizeof wdp); - wdp.ioVRefNum = BigEndianValue (wd); + wdp.ioVRefNum = CW (wd); retval = PBGetWDInfo (&wdp, FALSE); if (retval == noErr) { @@ -217,9 +216,9 @@ PUBLIC void Executor::ROMlib_adjustdirid(LONGINT *diridp, HVCB *vcbp, INTEGER vr if (*(ULONGINT *) diridp <= 1 && ISWDNUM(vrefnum)) { wdp = WDNUMTOWDP(vrefnum); if (MR(wdp->vcbp) == vcbp) - *diridp = BigEndianValue(wdp->dirid); - } else if (*diridp == 0 && !vrefnum /* vcbp == BigEndianValue(DefVCBPtr) */) - *diridp = BigEndianValue(DefDirID); + *diridp = CL(wdp->dirid); + } else if (*diridp == 0 && !vrefnum /* vcbp == CL(DefVCBPtr) */) + *diridp = CL(DefDirID); if (*diridp == 0) *diridp = 2; } diff --git a/src/hfsXbar.cpp b/src/hfsXbar.cpp index 9aadd7b5..fa466207 100644 --- a/src/hfsXbar.cpp +++ b/src/hfsXbar.cpp @@ -18,7 +18,6 @@ char ROMlib_rcsid_hfsXbar[] = #include "rsys/prefs.h" using namespace Executor; -using namespace ByteSwap; /* * TODO: pass the information gleaned by hfsvol and hfsfil into the @@ -32,7 +31,7 @@ void cachecheck(HVCB *vcbp) cachehead *headp; INTEGER i; - headp = (cachehead *) BigEndianValue(vcbp->vcbCtlBuf); + headp = (cachehead *) CL(vcbp->vcbCtlBuf); for (i = Cx(headp->nitems), cachep = Cx(headp->flink); --i >= 0; cachep = Cx(cachep->flink)) if (Cx(cachep->flags) & CACHEBUSY) @@ -40,7 +39,7 @@ void cachecheck(HVCB *vcbp) } #endif /* defined(CACHECHECK) */ -PRIVATE BOOLEAN hfsvol(ioParam *pb) +PRIVATE BOOLEAN hfsvol(IOParam *pb) { HVCB *vcbp; LONGINT dir; @@ -61,7 +60,7 @@ PRIVATE BOOLEAN hfsvol(ioParam *pb) return FALSE; } -PRIVATE BOOLEAN hfsIvol(volumeParam *pb) /* potentially Indexed vol */ +PRIVATE BOOLEAN hfsIvol(VolumeParam *pb) /* potentially Indexed vol */ { BOOLEAN retval; HVCB *vcbp; @@ -72,11 +71,11 @@ PRIVATE BOOLEAN hfsIvol(volumeParam *pb) /* potentially Indexed vol */ if (vcbp && vcbp->vcbCTRef) retval = TRUE; } else - retval = hfsvol((ioParam *) pb); + retval = hfsvol((IOParam *) pb); return retval; } -PRIVATE BOOLEAN hfsfil(ioParam *pb) +PRIVATE BOOLEAN hfsfil(IOParam *pb) { filecontrolblock *fcbp; HVCB *vcbp; @@ -99,7 +98,7 @@ A2(PUBLIC trap, OSErrRET, PBHRename, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBHRename(pb, async); else retval = ufsPBHRename(pb, async); @@ -110,7 +109,7 @@ A2(PUBLIC trap, OSErrRET, PBHCreate, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBHCreate(pb, async); else retval = ufsPBHCreate(pb, async); @@ -121,7 +120,7 @@ A2(PUBLIC trap, OSErrRET, PBDirCreate, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBDirCreate(pb, async); else retval = ufsPBDirCreate(pb, async); @@ -132,7 +131,7 @@ A2(PUBLIC trap, OSErrRET, PBHDelete, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBHDelete(pb, async); else retval = ufsPBHDelete(pb, async); @@ -166,7 +165,7 @@ A2(PUBLIC trap, OSErrRET, PBRead, ParmBlkPtr, pb, BOOLEAN, async) if (ROMlib_directdiskaccess) { dqp = ROMlib_dqbydrive(Cx(pb->ioParam.ioVRefNum)); if (!dqp) { - pb->ioParam.ioResult = BigEndianValue(nsvErr); + pb->ioParam.ioResult = CW(nsvErr); pb->ioParam.ioActCount = 0; } else { if (dqp->hfs.fd == -1) @@ -177,10 +176,10 @@ A2(PUBLIC trap, OSErrRET, PBRead, ParmBlkPtr, pb, BOOLEAN, async) pb->ioParam.ioActCount = 0; } else if (Cx(pb->ioParam.ioPosMode) != fsFromStart) { - pb->ioParam.ioResult = BigEndianValue(paramErr); /* for now */ + pb->ioParam.ioResult = CW(paramErr); /* for now */ pb->ioParam.ioActCount = 0; } else - pb->ioParam.ioResult = BigEndianValue(ROMlib_transphysblk(&dqp->hfs, + pb->ioParam.ioResult = CW(ROMlib_transphysblk(&dqp->hfs, Cx(pb->ioParam.ioPosOffset), Cx(pb->ioParam.ioReqCount) / PHYSBSIZE, MR(pb->ioParam.ioBuffer), reading, @@ -188,7 +187,7 @@ A2(PUBLIC trap, OSErrRET, PBRead, ParmBlkPtr, pb, BOOLEAN, async) } } else { - pb->ioParam.ioResult = BigEndianValue(vLckdErr); + pb->ioParam.ioResult = CW(vLckdErr); pb->ioParam.ioActCount = 0; } retval = Cx(pb->ioParam.ioResult); @@ -203,17 +202,17 @@ A2(PUBLIC trap, OSErrRET, PBRead, ParmBlkPtr, pb, BOOLEAN, async) ParamBlockRec pbr; pbr = *pb; - to_find = BigEndianValue (pb->ioParam.ioPosMode) >> 8; + to_find = CW (pb->ioParam.ioPosMode) >> 8; pbr.ioParam.ioPosMode &= CWC (0x7F); - buf = (char*)alloca (BigEndianValue (pb->ioParam.ioReqCount)); + buf = (char*)alloca (CL (pb->ioParam.ioReqCount)); pbr.ioParam.ioBuffer = (Ptr) RM (buf); retval = PBRead (&pbr, FALSE); pb->ioParam.ioActCount = pbr.ioParam.ioActCount; pb->ioParam.ioPosOffset = pbr.ioParam.ioPosOffset; - act_count = BigEndianValue (pb->ioParam.ioActCount); + act_count = CL (pb->ioParam.ioActCount); p_to_find = (char*)memchr (buf, to_find, act_count); if (to_find == '\r' && ROMlib_newlinetocr) @@ -242,7 +241,7 @@ A2(PUBLIC trap, OSErrRET, PBRead, ParmBlkPtr, pb, BOOLEAN, async) newpb.ioParam.ioRefNum = pb->ioParam.ioRefNum; newpb.ioParam.ioPosMode = CWC (fsFromMark); - newpb.ioParam.ioPosOffset = BigEndianValue (- to_backup); + newpb.ioParam.ioPosOffset = CL (- to_backup); newerr = PBSetFPos (&newpb, FALSE); if (newerr != noErr) warning_unexpected ("err = %d", newerr); @@ -252,14 +251,14 @@ A2(PUBLIC trap, OSErrRET, PBRead, ParmBlkPtr, pb, BOOLEAN, async) *p = '\r'; } memcpy (MR (pb->ioParam.ioBuffer), MR (pbr.ioParam.ioBuffer), - BigEndianValue (pb->ioParam.ioActCount)); + CL (pb->ioParam.ioActCount)); ROMlib_destroy_blocks ((syn68k_addr_t) (long) US_TO_SYN68K(MR (pb->ioParam.ioBuffer)), - BigEndianValue (pb->ioParam.ioActCount), TRUE); + CL (pb->ioParam.ioActCount), TRUE); } else { - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBRead(pb, async); else retval = ufsPBRead(pb, async); @@ -281,22 +280,22 @@ A2(PUBLIC trap, OSErrRET, PBWrite, ParmBlkPtr, pb, BOOLEAN, async) switch (Cx(pb->ioParam.ioRefNum)) { case OURHFSDREF: if (!ROMlib_directdiskaccess) - pb->ioParam.ioResult = BigEndianValue(vLckdErr); + pb->ioParam.ioResult = CW(vLckdErr); else { dqp = ROMlib_dqbydrive(Cx(pb->ioParam.ioVRefNum)); if (dqp && dqp->hfs.fd == -1) try_to_reopen (dqp); vcbp = ROMlib_vcbbydrive (Cx(pb->ioParam.ioVRefNum)); if (!dqp) - pb->ioParam.ioResult = BigEndianValue(nsvErr); + pb->ioParam.ioResult = CW(nsvErr); else if (vcbp && (Cx(vcbp->vcbAtrb) & VSOFTLOCKBIT)) - pb->ioParam.ioResult = BigEndianValue(vLckdErr); + pb->ioParam.ioResult = CW(vLckdErr); else if (vcbp && (Cx(vcbp->vcbAtrb) & VHARDLOCKBIT)) - pb->ioParam.ioResult = BigEndianValue(wPrErr); + pb->ioParam.ioResult = CW(wPrErr); else if (Cx(pb->ioParam.ioPosMode) != fsFromStart) - pb->ioParam.ioResult = BigEndianValue(paramErr); /* for now */ + pb->ioParam.ioResult = CW(paramErr); /* for now */ else - pb->ioParam.ioResult = BigEndianValue(ROMlib_transphysblk(&dqp->hfs, + pb->ioParam.ioResult = CW(ROMlib_transphysblk(&dqp->hfs, Cx(pb->ioParam.ioPosOffset), Cx(pb->ioParam.ioReqCount) / PHYSBSIZE, MR(pb->ioParam.ioBuffer), writing, @@ -311,7 +310,7 @@ A2(PUBLIC trap, OSErrRET, PBWrite, ParmBlkPtr, pb, BOOLEAN, async) #if 0 case SOUND_DRIVER_REF: p = (char *) Cx(pb->ioParam.ioBuffer); - if (BigEndianValue(*(short *)p) == ffMode) { + if (CW(*(short *)p) == ffMode) { n = Cx(pb->ioParam.ioReqCount); ROMlib_dosound(p + 4, n - 4, (void (*)(void)) 0); } @@ -319,7 +318,7 @@ A2(PUBLIC trap, OSErrRET, PBWrite, ParmBlkPtr, pb, BOOLEAN, async) break; #endif default: - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBWrite(pb, async); else retval = ufsPBWrite(pb, async); @@ -332,7 +331,7 @@ A2(PUBLIC trap, OSErrRET, PBClose, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBClose(pb, async); else retval = ufsPBClose(pb, async); @@ -358,7 +357,7 @@ A2(PUBLIC trap, OSErrRET, PBHOpen, HParmBlkPtr, pb, BOOLEAN, async) pb->ioParam.ioNamePtr && MR(pb->ioParam.ioNamePtr)[0] && MR(pb->ioParam.ioNamePtr)[1] == '.') retval = ROMlib_driveropen((ParmBlkPtr) pb, async); - else if (hfsvol((ioParam *) pb)) + else if (hfsvol((IOParam *) pb)) retval = hfsPBHOpen(pb, async); else retval = ufsPBHOpen(pb, async); @@ -369,7 +368,7 @@ A2(PUBLIC trap, OSErrRET, PBOpenDF, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBHOpen(pb, async); else retval = ufsPBHOpen(pb, async); @@ -380,7 +379,7 @@ A2(PUBLIC trap, OSErrRET, PBHOpenRF, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBHOpenRF(pb, async); else retval = ufsPBHOpenRF(pb, async); @@ -414,7 +413,7 @@ A2(PUBLIC trap, OSErrRET, PBGetCatInfo, CInfoPBPtr, pb, BOOLEAN, async) BOOLEAN ishfs; StringPtr savep; - if (BigEndianValue(pb->dirInfo.ioFDirIndex) < 0 && pb->hFileInfo.ioDirID == CLC (1)) + if (CW(pb->dirInfo.ioFDirIndex) < 0 && pb->hFileInfo.ioDirID == CLC (1)) retval = -43; /* perhaps we should check for a valid volume first */ else @@ -422,7 +421,7 @@ A2(PUBLIC trap, OSErrRET, PBGetCatInfo, CInfoPBPtr, pb, BOOLEAN, async) savep = pb->dirInfo.ioNamePtr; if (pb->dirInfo.ioFDirIndex != CWC (0)) /* IMIV-155, 156 */ pb->dirInfo.ioNamePtr = 0; - ishfs = hfsvol((ioParam *) pb); + ishfs = hfsvol((IOParam *) pb); pb->dirInfo.ioNamePtr = savep; if (ishfs) @@ -437,7 +436,7 @@ A2(PUBLIC trap, OSErrRET, PBSetCatInfo, CInfoPBPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBSetCatInfo(pb, async); else retval = ufsPBSetCatInfo(pb, async); @@ -448,7 +447,7 @@ A2(PUBLIC trap, OSErrRET, PBCatMove, CMovePBPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBCatMove(pb, async); else retval = ufsPBCatMove(pb, async); @@ -459,7 +458,7 @@ A2(PUBLIC trap, OSErrRET, PBGetVInfo, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsIvol((volumeParam *) pb)) + if (hfsIvol((VolumeParam *) pb)) retval = hfsPBGetVInfo(pb, async); else retval = ufsPBGetVInfo(pb, async); @@ -470,7 +469,7 @@ A1(PUBLIC trap, OSErrRET, PBUnmountVol, ParmBlkPtr, pb) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBUnmountVol(pb); else retval = ufsPBUnmountVol(pb); @@ -481,7 +480,7 @@ A1(PUBLIC trap, OSErrRET, PBEject, ParmBlkPtr, pb) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBEject(pb); else retval = ufsPBEject(pb); @@ -492,7 +491,7 @@ A2(PUBLIC trap, OSErrRET, PBAllocate, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBAllocate(pb, async); else retval = ufsPBAllocate(pb, async); @@ -503,7 +502,7 @@ A2(PUBLIC trap, OSErrRET, PBAllocContig, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBAllocContig(pb, async); else retval = ufsPBAllocContig(pb, async); @@ -517,9 +516,9 @@ A2(PUBLIC trap, OSErrRET, PBHGetFInfo, HParmBlkPtr, pb, BOOLEAN, async) StringPtr savep; savep = pb->ioParam.ioNamePtr; - if (BigEndianValue(pb->fileParam.ioFDirIndex) > 0) /* IMIV-155, 156 */ + if (CW(pb->fileParam.ioFDirIndex) > 0) /* IMIV-155, 156 */ pb->ioParam.ioNamePtr = 0; - ishfs = hfsvol((ioParam *) pb); + ishfs = hfsvol((IOParam *) pb); pb->ioParam.ioNamePtr = savep; if (ishfs) @@ -533,7 +532,7 @@ A2(PUBLIC trap, OSErrRET, PBSetEOF, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBSetEOF(pb, async); else retval = ufsPBSetEOF(pb, async); @@ -547,7 +546,7 @@ A2(PUBLIC trap, OSErrRET, PBOpen, ParmBlkPtr, pb, BOOLEAN, async) if (pb->ioParam.ioNamePtr && MR(pb->ioParam.ioNamePtr)[0] && MR(pb->ioParam.ioNamePtr)[1] == '.') retval = ROMlib_driveropen(pb, async); - else if (hfsvol((ioParam *) pb)) + else if (hfsvol((IOParam *) pb)) retval = hfsPBOpen(pb, async); else retval = ufsPBOpen(pb, async); @@ -577,7 +576,7 @@ A2(PUBLIC trap, OSErrRET, PBOpenRF, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBOpenRF(pb, async); else retval = ufsPBOpenRF(pb, async); @@ -588,7 +587,7 @@ A2(PUBLIC trap, OSErrRET, PBLockRange, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBLockRange(pb, async); else retval = ufsPBLockRange(pb, async); @@ -599,7 +598,7 @@ A2(PUBLIC trap, OSErrRET, PBUnlockRange, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBUnlockRange(pb, async); else retval = ufsPBUnlockRange(pb, async); @@ -610,7 +609,7 @@ A2(PUBLIC trap, OSErrRET, PBGetFPos, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBGetFPos(pb, async); else retval = ufsPBGetFPos(pb, async); @@ -621,7 +620,7 @@ A2(PUBLIC trap, OSErrRET, PBSetFPos, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBSetFPos(pb, async); else retval = ufsPBSetFPos(pb, async); @@ -632,7 +631,7 @@ A2(PUBLIC trap, OSErrRET, PBGetEOF, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBGetEOF(pb, async); else retval = ufsPBGetEOF(pb, async); @@ -643,7 +642,7 @@ A2(PUBLIC trap, OSErrRET, PBFlushFile, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) retval = hfsPBFlushFile(pb, async); else retval = ufsPBFlushFile(pb, async); @@ -654,7 +653,7 @@ A2(PUBLIC trap, OSErrRET, PBCreate, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBCreate(pb, async); else retval = ufsPBCreate(pb, async); @@ -665,7 +664,7 @@ A2(PUBLIC trap, OSErrRET, PBDelete, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBDelete(pb, async); else retval = ufsPBDelete(pb, async); @@ -676,7 +675,7 @@ A2(PUBLIC trap, OSErrRET, PBOpenWD, WDPBPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBOpenWD(pb, async); else retval = ufsPBOpenWD(pb, async); @@ -706,9 +705,9 @@ A2(PUBLIC trap, OSErrRET, PBGetFInfo, ParmBlkPtr, pb, BOOLEAN, async) OSErr retval; savep = pb->ioParam.ioNamePtr; - if (BigEndianValue(pb->fileParam.ioFDirIndex) > 0) /* IMIV-155, 156 */ + if (CW(pb->fileParam.ioFDirIndex) > 0) /* IMIV-155, 156 */ pb->ioParam.ioNamePtr = 0; - ishfs = hfsvol((ioParam *) pb); + ishfs = hfsvol((IOParam *) pb); pb->ioParam.ioNamePtr = savep; if (ishfs) @@ -722,7 +721,7 @@ A2(PUBLIC trap, OSErrRET, PBSetFInfo, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBSetFInfo(pb, async); else retval = ufsPBSetFInfo(pb, async); @@ -733,7 +732,7 @@ A2(PUBLIC trap, OSErrRET, PBHSetFInfo, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBHSetFInfo(pb, async); else retval = ufsPBHSetFInfo(pb, async); @@ -744,7 +743,7 @@ A2(PUBLIC trap, OSErrRET, PBSetFLock, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBSetFLock(pb, async); else retval = ufsPBSetFLock(pb, async); @@ -755,7 +754,7 @@ A2(PUBLIC trap, OSErrRET, PBHSetFLock, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBHSetFLock(pb, async); else retval = ufsPBHSetFLock(pb, async); @@ -766,7 +765,7 @@ A2(PUBLIC trap, OSErrRET, PBRstFLock, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBRstFLock(pb, async); else retval = ufsPBRstFLock(pb, async); @@ -777,7 +776,7 @@ A2(PUBLIC trap, OSErrRET, PBHRstFLock, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBHRstFLock(pb, async); else retval = ufsPBHRstFLock(pb, async); @@ -788,7 +787,7 @@ A2(PUBLIC trap, OSErrRET, PBSetFVers, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBSetFVers(pb, async); else retval = ufsPBSetFVers(pb, async); @@ -799,7 +798,7 @@ A2(PUBLIC trap, OSErrRET, PBRename, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBRename(pb, async); else retval = ufsPBRename(pb, async); @@ -830,7 +829,7 @@ A2(PUBLIC trap, OSErrRET, PBRename, ParmBlkPtr, pb, BOOLEAN, async) A1(PUBLIC trap, OSErr, PBMountVol, ParmBlkPtr, pb) { #if 0 - if (hfsfil((ioParam *) pb)) + if (hfsfil((IOParam *) pb)) return hfsPBMountVol(pb); else return ufsPBMountVol(pb); @@ -838,7 +837,7 @@ A1(PUBLIC trap, OSErr, PBMountVol, ParmBlkPtr, pb) INTEGER vref; OSErr retval; - vref = BigEndianValue(pb->ioParam.ioVRefNum); + vref = CW(pb->ioParam.ioVRefNum); if (vref == 1 || vref == 2) retval = noErr; else @@ -851,7 +850,7 @@ A2(PUBLIC trap, OSErrRET, PBHGetVInfo, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsIvol((volumeParam *) pb)) + if (hfsIvol((VolumeParam *) pb)) retval = hfsPBHGetVInfo(pb, async); else retval = ufsPBHGetVInfo(pb, async); @@ -887,7 +886,7 @@ A2(PUBLIC trap, OSErrRET, PBHGetVolParms, HParmBlkPtr, pb, BOOLEAN, async) if (vcbp) { infop = (getvolparams_info_t *) MR (pb->ioParam.ioBuffer); - rc = BigEndianValue (pb->ioParam.ioReqCount); + rc = CL (pb->ioParam.ioReqCount); nused = 0; if (roomfor (infop, vMVersion, rc)) { @@ -914,7 +913,7 @@ A2(PUBLIC trap, OSErrRET, PBHGetVolParms, HParmBlkPtr, pb, BOOLEAN, async) infop->vMForeignPrivID = CWC (2); /* fsUnixPriv + 1 */ nused += sizeof (infop->vMForeignPrivID); } - pb->ioParam.ioActCount = BigEndianValue((LONGINT) nused); + pb->ioParam.ioActCount = CL((LONGINT) nused); err = noErr; } else @@ -929,7 +928,7 @@ A2(PUBLIC trap, OSErrRET, PBSetVInfo, HParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBSetVInfo(pb, async); else retval = ufsPBSetVInfo(pb, async); @@ -972,7 +971,7 @@ A2(PUBLIC trap, OSErrRET, PBFlushVol, ParmBlkPtr, pb, BOOLEAN, async) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBFlushVol(pb, async); else retval = ufsPBFlushVol(pb, async); @@ -983,7 +982,7 @@ A1(PUBLIC trap, OSErrRET, PBOffLine, ParmBlkPtr, pb) { OSErr retval; - if (hfsvol((ioParam *) pb)) + if (hfsvol((IOParam *) pb)) retval = hfsPBOffLine(pb); else retval = ufsPBOffLine(pb); diff --git a/src/hle.cpp b/src/hle.cpp index f6af5040..f2952b40 100644 --- a/src/hle.cpp +++ b/src/hle.cpp @@ -13,7 +13,6 @@ char ROMlib_rcsid_hle[] = #include "MemoryMgr.h" using namespace Executor; -using namespace ByteSwap; typedef struct hle_q_elt { @@ -93,12 +92,12 @@ P4 (PUBLIC pascal trap, OSErr, AcceptHighLevelEvent, /* #### *sender_id_return = ...; */ *refcon_return = current_hle_msg->userRefCon; - if (BigEndianValue (*msg_buf_length_return) < BigEndianValue (current_hle_msg->msgLength)) + if (CL (*msg_buf_length_return) < CL (current_hle_msg->msgLength)) retval = bufferIsSmall; if (retval == noErr) memcpy (msg_buf, (Ptr) MR (current_hle_msg->theMsgEvent.when), - BigEndianValue (current_hle_msg->msgLength)); + CL (current_hle_msg->msgLength)); *msg_buf_length_return = current_hle_msg->msgLength; @@ -115,7 +114,7 @@ P3 (PUBLIC pascal trap, Boolean, GetSpecificHighLevelEvent, Boolean evt_handled_p; evt_handled_p - = CToPascalCall (&fn, CTOP_GetSpecificHighLevelEventProcTemplate, + = CToPascalCall((void*)fn, CTOP_GetSpecificHighLevelEventProcTemplate, t->hle_msg, /* ##### target id */ NULL); @@ -175,9 +174,9 @@ P6 (PUBLIC pascal trap, OSErr, PostHighLevelEvent, hle_msg->theMsgEvent.when = (int32) RM (msg_buf_copy); hle_msg->theMsgEvent.modifiers = CWC (-1); - hle_msg->userRefCon = BigEndianValue (refcon); - hle_msg->postingOptions = BigEndianValue (post_options); - hle_msg->msgLength = BigEndianValue (msg_length); + hle_msg->userRefCon = CL (refcon); + hle_msg->postingOptions = CL (post_options); + hle_msg->msgLength = CL (msg_length); /* stick the new msg */ elt = (hle_q_elt_t *) NewPtr (sizeof *t); diff --git a/src/icon.cpp b/src/icon.cpp index 39899f8a..45850afe 100644 --- a/src/icon.cpp +++ b/src/icon.cpp @@ -22,7 +22,6 @@ char ROMlib_rcsid_icon[] = #include "rsys/icon.h" using namespace Executor; -using namespace ByteSwap; #define ICON_RETURN_ERROR(error) \ ({ \ @@ -276,8 +275,8 @@ P1 (PUBLIC pascal trap, CIconHandle, GetCIcon, cicon_res = STARH (cicon_res_handle); height = RECT_HEIGHT (&cicon_res->iconPMap.bounds); - mask_data_size = BigEndianValue (cicon_res->iconMask.rowBytes) * height; - bmap_data_size = BigEndianValue (cicon_res->iconBMap.rowBytes) * height; + mask_data_size = CW (cicon_res->iconMask.rowBytes) * height; + bmap_data_size = CW (cicon_res->iconBMap.rowBytes) * height; new_size = sizeof(CIcon) - sizeof(INTEGER) + mask_data_size + bmap_data_size; cicon_handle = (CIconHandle) NewHandle (new_size); @@ -305,11 +304,11 @@ P1 (PUBLIC pascal trap, CIconHandle, GetCIcon, pmap_ctab_offset = bmap_data_offset + bmap_data_size; tmp_ctab = (CTabPtr) ((char *) &cicon_res->iconMaskData + pmap_ctab_offset); - pmap_ctab_size = sizeof (ColorTable) + (BigEndianValue (tmp_ctab->ctSize) + pmap_ctab_size = sizeof (ColorTable) + (CW (tmp_ctab->ctSize) * sizeof (ColorSpec)); pmap_data_offset = pmap_ctab_offset + pmap_ctab_size; - pmap_data_size = (BigEndianValue (cicon->iconPMap.rowBytes) + pmap_data_size = (CW (cicon->iconPMap.rowBytes) & ROWBYTES_VALUE_BITS) * height; cicon->iconMask.baseAddr = CLC_NULL; @@ -324,7 +323,7 @@ P1 (PUBLIC pascal trap, CIconHandle, GetCIcon, BlockMove ((Ptr) &cicon_res->iconMaskData + pmap_ctab_offset, (Ptr) STARH (color_table), pmap_ctab_size); - CTAB_SEED_X (color_table) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (color_table) = CL (GetCTSeed ()); cicon->iconPMap.pmTable = RM (color_table); cicon->iconPMap.baseAddr = CLC_NULL; @@ -565,19 +564,19 @@ P4 (PUBLIC pascal trap, OSErr, PlotIconSuite, memset (&icon_rect, '\000', sizeof icon_rect); icon_size = (little_icon_p ? 16 : 32); - icon_rect.bottom = icon_rect.right = BigEndianValue (icon_size); + icon_rect.bottom = icon_rect.right = CW (icon_size); icon_pm.baseAddr = icon_data->p; - icon_pm.rowBytes = BigEndianValue ( (icon_size * icon_bpp / 8) + icon_pm.rowBytes = CW ( (icon_size * icon_bpp / 8) | PIXMAP_DEFAULT_ROW_BYTES); icon_pm.bounds = icon_rect; - icon_pm.pixelSize = icon_pm.cmpSize = BigEndianValue (icon_bpp); + icon_pm.pixelSize = icon_pm.cmpSize = CW (icon_bpp); icon_pm.cmpCount = CWC (1); icon_pm.pmTable = RM (color_table); mask_bm.baseAddr = (Ptr) RM ((char *) STARH (icon_mask) + icon_size * icon_size / 8); - mask_bm.rowBytes = BigEndianValue (icon_size / 8); + mask_bm.rowBytes = CW (icon_size / 8); mask_bm.bounds = icon_rect; CopyMask ((BitMap *) &icon_pm, &mask_bm, @@ -607,7 +606,7 @@ P1 (PUBLIC pascal trap, short, GetSuiteLabel, cotton_suite_layout_t *suitep; suitep = (cotton_suite_layout_t *) STARH (suite); - retval = BigEndianValue (suitep->label); + retval = CW (suitep->label); return retval; } @@ -618,7 +617,7 @@ P2 (PUBLIC pascal trap, OSErr, SetSuiteLabel, cotton_suite_layout_t *suitep; suitep = (cotton_suite_layout_t *) STARH (suite); - suitep->label = BigEndianValue (label); + suitep->label = CW (label); retval = noErr; return retval; @@ -633,13 +632,13 @@ label_info_t; PRIVATE label_info_t labels[7] = { - { { 0, 0, 0,}, "\pEssential", }, - { { 0, 0, 0,}, "\pHot", }, - { { 0, 0, 0,}, "\pIn Progress", }, - { { 0, 0, 0,}, "\pCool", }, - { { 0, 0, 0,}, "\pPersonal", }, - { { 0, 0, 0,}, "\pProject 1", }, - { { 0, 0, 0,}, "\pProject 2", }, + { { 0, 0, 0,}, "\011Essential", }, + { { 0, 0, 0,}, "\03Hot", }, + { { 0, 0, 0,}, "\013In Progress", }, + { { 0, 0, 0,}, "\04Cool", }, + { { 0, 0, 0,}, "\010Personal", }, + { { 0, 0, 0,}, "\011Project 1", }, + { { 0, 0, 0,}, "\011Project 2", }, }; P3 (PUBLIC pascal trap, OSErr, GetLabel, diff --git a/src/image.cpp b/src/image.cpp index d0be523a..3c1ac3c3 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -17,7 +17,6 @@ char ROMlib_rcsid_image[] = #include "rsys/image.h" using namespace Executor; -using namespace ByteSwap; #define MAX_ROWBYTES_FOR_WIDTH(w) ((((w) * 32 + 31) / 32) * 4) @@ -46,15 +45,15 @@ Executor::image_init (pixel_image_desc_t *image_desc) IMAGE_X_BITS_VALID (retval, i) = -1; PIXMAP_BASEADDR_X (bits) = (Ptr) RM (image_desc->bits[i].raw_bits); - PIXMAP_SET_ROWBYTES_X (bits, BigEndianValue (image_desc->bits[i].row_bytes)); - bounds.top = BigEndianValue (image_desc->bounds.top); - bounds.left = BigEndianValue (image_desc->bounds.left); - bounds.bottom = BigEndianValue (image_desc->bounds.bottom); - bounds.right = BigEndianValue (image_desc->bounds.right); + PIXMAP_SET_ROWBYTES_X (bits, CW (image_desc->bits[i].row_bytes)); + bounds.top = CW (image_desc->bounds.top); + bounds.left = CW (image_desc->bounds.left); + bounds.bottom = CW (image_desc->bounds.bottom); + bounds.right = CW (image_desc->bounds.right); retval->bounds = bounds; PIXMAP_BOUNDS (bits) = bounds; bpp = image_desc->bits[i].bpp; - PIXMAP_CMP_SIZE_X (bits) = PIXMAP_PIXEL_SIZE_X (bits) = BigEndianValue (bpp); + PIXMAP_CMP_SIZE_X (bits) = PIXMAP_PIXEL_SIZE_X (bits) = CW (bpp); if (i == 0) { /* the `zero' image is simply a 1bbp black and white image */ @@ -71,12 +70,12 @@ Executor::image_init (pixel_image_desc_t *image_desc) bits_ctab = PIXMAP_TABLE (bits); SetHandleSize ((Handle) bits_ctab, CTAB_STORAGE_FOR_SIZE ((1 << bpp) - 1)); - CTAB_SIZE_X (bits_ctab) = BigEndianValue ((1 << bpp) - 1); + CTAB_SIZE_X (bits_ctab) = CW ((1 << bpp) - 1); bits_ctab_table = CTAB_TABLE (bits_ctab); for (j = 0; j <= (1 << bpp) - 1; j ++) - bits_ctab_table[j].value = BigEndianValue (j); + bits_ctab_table[j].value = CW (j); CTAB_FLAGS_X (bits_ctab) = CWC (0); - CTAB_SEED_X (bits_ctab) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (bits_ctab) = CL (GetCTSeed ()); } { @@ -90,7 +89,7 @@ Executor::image_init (pixel_image_desc_t *image_desc) p = NewPtr (x_row_bytes * height); memset (p, 0, x_row_bytes * height); PIXMAP_BASEADDR_X (x_bits) = RM (p); - PIXMAP_SET_ROWBYTES_X (x_bits, BigEndianValue (x_row_bytes)); + PIXMAP_SET_ROWBYTES_X (x_bits, CW (x_row_bytes)); } } @@ -190,5 +189,5 @@ Executor::image_update_ctab (pixel_image_t *image, const RGBColor *new_colors, } if (ctab_changed_p) - CTAB_SEED_X (bits_ctab) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (bits_ctab) = CL (GetCTSeed ()); } diff --git a/src/include/FileMgr.h b/src/include/FileMgr.h index 48770634..f581b64c 100644 --- a/src/include/FileMgr.h +++ b/src/include/FileMgr.h @@ -212,7 +212,7 @@ typedef struct { LONGINT ioActCount; INTEGER ioPosMode; LONGINT ioPosOffset; -} ioParam; +} IOParam; typedef struct { COMMONFSQUEUEDEFS; @@ -232,7 +232,7 @@ typedef struct { LONGINT ioFlRPyLen; LONGINT ioFlCrDat; LONGINT ioFlMdDat; -} fileParam; +} FileParam; typedef struct { COMMONFSQUEUEDEFS; @@ -250,20 +250,20 @@ typedef struct { uint16_t ioAlBlSt; LONGINT ioVNxtFNum; uint16_t ioVFrBlk; -} volumeParam; +} VolumeParam; typedef struct { COMMONFSQUEUEDEFS; INTEGER ioCRefNum; INTEGER csCode; INTEGER csParam[11]; -} cntrlParam; +} CntrlParam; typedef union { - ioParam ioParam; - fileParam fileParam; - volumeParam volumeParam; - cntrlParam cntrlParam; + IOParam ioParam; + FileParam fileParam; + VolumeParam volumeParam; + CntrlParam cntrlParam; } ParamBlockRec; typedef ParamBlockRec *ParmBlkPtr; diff --git a/src/include/MacTypes.h b/src/include/MacTypes.h index 577982d3..ca0a2720 100644 --- a/src/include/MacTypes.h +++ b/src/include/MacTypes.h @@ -69,8 +69,8 @@ typedef double Extended; typedef LONGINT Size; typedef INTEGER OSErr; -typedef ULONGINT OSType; -typedef ULONGINT ResType; +typedef LONGINT OSType; +typedef LONGINT ResType; typedef LONGINT OSErrRET; /* for smashing d0 just like the Mac */ typedef LONGINT INTEGERRET; diff --git a/src/include/rsys/hfs.h b/src/include/rsys/hfs.h index 2ef91d16..73a8501f 100644 --- a/src/include/rsys/hfs.h +++ b/src/include/rsys/hfs.h @@ -199,7 +199,7 @@ typedef struct PACKED { } filecontrolblock; enum { datafork, resourcefork = 0xFF }; -typedef unsigned char forktype; +typedef unsigned char Forktype; typedef enum { databusy, resourcebusy, eitherbusy } busyconcern_t; @@ -264,7 +264,7 @@ typedef struct PACKED _cacheentry { ULONGINT physblock; ULONGINT logblk; unsigned char flags; - forktype forktype; + Forktype forktype; char buf[PHYSBSIZE]; } cacheentry; @@ -400,7 +400,7 @@ extern xtntkey *ROMlib_newextentrecord(filecontrolblock *fcbp, uint16 newabn); extern OSErr ROMlib_btrename(btparam *btpb, StringPtr newnamep); extern OSErr ROMlib_btcreateemptyfile(btparam *btpb); extern OSErr ROMlib_btcreateemptydir(btparam *btpb, LONGINT *newidp); -extern OSErr ROMlib_btpbindex (ioParam *pb, LONGINT dirid, HVCB **vcbpp, +extern OSErr ROMlib_btpbindex (IOParam *pb, LONGINT dirid, HVCB **vcbpp, filerec **frpp, catkey **catkeypp, BOOLEAN onlyfiles); extern OSErr ROMlib_cleancache(HVCB *vcbp); extern OSErr ROMlib_flushcachevcbp(HVCB *vcbp); @@ -415,18 +415,18 @@ extern filecontrolblock *ROMlib_getfreefcbp( void ); extern filecontrolblock *ROMlib_refnumtofcbp(uint16 refnum); extern compretval ROMlib_xtntcompare(void *firstp, void *secondp); extern compretval ROMlib_catcompare(void *firstp, void *secondp); -extern void ROMlib_makextntkey(xtntkey *keyp, forktype forkwanted, LONGINT flnum, +extern void ROMlib_makextntkey(xtntkey *keyp, Forktype forkwanted, LONGINT flnum, uint16 bno); -extern void ROMlib_makextntparam(btparam *btpb, HVCB *vcbp, forktype forkwanted, +extern void ROMlib_makextntparam(btparam *btpb, HVCB *vcbp, Forktype forkwanted, LONGINT flnum, uint16 bno); extern LONGINT ROMlib_logtophys(filecontrolblock *fcbp, LONGINT absoffset, LONGINT *nphyscontigp); extern OSErr ROMlib_makecatkey(catkey *keyp, LONGINT dirid, INTEGER namelen, Ptr namep); -extern OSErr ROMlib_findvcbandfile(ioParam *pb, LONGINT dirid, btparam *btpb, +extern OSErr ROMlib_findvcbandfile(IOParam *pb, LONGINT dirid, btparam *btpb, filekind *kindp, BOOLEAN ignorename); extern OSErr ROMlib_alreadyopen(HVCB *vcbp, LONGINT flnum, SignedByte *permp, INTEGER *refnump, busyconcern_t busy); -extern OSErr ROMlib_allochelper(ioParam *pb, BOOLEAN async, alloctype alloc, +extern OSErr ROMlib_allochelper(IOParam *pb, BOOLEAN async, alloctype alloc, BOOLEAN ROMlib_writefcbp); /* public entries in helper.c */ @@ -457,7 +457,7 @@ extern HVCB *ROMlib_findvcb(short vrefnum, StringPtr name, LONGINT *diridp, BOOLEAN usedefault); extern OSErr ROMlib_mkwd(WDPBPtr pb, HVCB *vcbp, LONGINT dirid, LONGINT procid); -extern OSErr ROMlib_pbvolrename(ioParam *pb, StringPtr newnamep); +extern OSErr ROMlib_pbvolrename(IOParam *pb, StringPtr newnamep); extern OSErr ROMlib_flushvcbp(HVCB *vcbp); extern HVCB *ROMlib_vcbbyvrn(short vrefnum); extern VCBExtra *ROMlib_vcbbyunixname(char *uname); diff --git a/src/include/rsys/option.h b/src/include/rsys/option.h index 81549850..5aec56a8 100644 --- a/src/include/rsys/option.h +++ b/src/include/rsys/option.h @@ -4,7 +4,7 @@ #include namespace Executor { -typedef enum option_kind : int option_kind_t; enum option_kind : int +typedef enum option_kind { /* this option has no argument; it evaluates to `def' if provided */ opt_no_arg, @@ -18,7 +18,7 @@ typedef enum option_kind : int option_kind_t; enum option_kind : int opt_ignore, /* ignore this option and its argument */ opt_sep_ignore, -}; +} option_kind_t; typedef struct option { @@ -90,10 +90,10 @@ int opt_int_val (opt_database_t &db, std::string opt, int *retval, boolean_t *parse_error_p); int opt_val (opt_database_t &db, std::string opt, std::string *retval); -void opt_put_val (opt_database_t &db, std::string &opt, std::string value, +void opt_put_val (opt_database_t &db, const std::string &opt, std::string value, priority_t pri, int temp_val_p); -void opt_put_int_val (opt_database_t &db, std::string &opt, int value, +void opt_put_int_val (opt_database_t &db, const std::string &opt, int value, priority_t pri, int temp_val_p); diff --git a/src/include/rsys/stdfile.h b/src/include/rsys/stdfile.h index 38883c98..cce72bfe 100644 --- a/src/include/rsys/stdfile.h +++ b/src/include/rsys/stdfile.h @@ -42,7 +42,8 @@ extern void ROMlib_init_stdfile(void); #if defined(LINUX) extern int linuxfloppy_open(int disk, LONGINT *bsizep, - drive_flags_t *flagsp, const char *dname); + drive_flags_t *flagsp, const char *dname); +extern int linuxfloppy_close(int disk); #endif diff --git a/src/interfacelib.cpp b/src/interfacelib.cpp index 080d18b7..f1d6f1d3 100644 --- a/src/interfacelib.cpp +++ b/src/interfacelib.cpp @@ -106,7 +106,7 @@ PRIVATE int32 LMGetLastSPExtra (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (LastSPExtra); + return CW (LastSPExtra); } PRIVATE GDHandle @@ -134,14 +134,14 @@ PRIVATE INTEGER LMGetResErr (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (ResErr); + return CW (ResErr); } PRIVATE INTEGER LMGetPrintErr (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (PrintErr); + return CW (PrintErr); } PRIVATE Ptr @@ -155,7 +155,7 @@ PRIVATE uint32 LMGetCaretTime (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (CaretTime); + return CL (CaretTime); } #if 0 @@ -178,7 +178,7 @@ PRIVATE INTEGER LMGetAtMenuBottom (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (AtMenuBottom); + return CW (AtMenuBottom); } PRIVATE uint8 @@ -210,14 +210,14 @@ PRIVATE INTEGER LMGetTopMenuItem (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (TopMenuItem); + return CW (TopMenuItem); } PRIVATE uint32 LMGetDoubleTime (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (DoubleTime); + return CL (DoubleTime); } PRIVATE StringHandle @@ -245,7 +245,7 @@ PRIVATE int16 LMGetROM85 (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (ROM85); + return CW (ROM85); } PRIVATE uint8 @@ -259,7 +259,7 @@ PRIVATE INTEGER LMGetScrHRes (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (ScrHRes); + return CW (ScrHRes); } PRIVATE StringPtr @@ -273,7 +273,7 @@ PRIVATE INTEGER LMGetSysMap (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (SysMap); + return CW (SysMap); } PRIVATE THz @@ -308,7 +308,7 @@ PRIVATE uint32 LMGetTicks (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (Ticks); + return CL (Ticks); } PRIVATE uint8 @@ -343,7 +343,7 @@ PRIVATE INTEGER LMGetMBarHeight (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (MBarHeight); + return CW (MBarHeight); } PRIVATE Handle @@ -357,35 +357,35 @@ PRIVATE INTEGER LMGetScrVRes (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (ScrVRes); + return CW (ScrVRes); } PRIVATE void LMSetMenuDisable (int32 val) { warning_trace_info (NULL_STRING); - MenuDisable = BigEndianValue (val); + MenuDisable = CL (val); } PRIVATE void LMSetAtMenuBottom (INTEGER val) { warning_trace_info (NULL_STRING); - AtMenuBottom = BigEndianValue (val); + AtMenuBottom = CW (val); } PRIVATE void LMSetTopMenuItem (INTEGER val) { warning_trace_info (NULL_STRING); - TopMenuItem = BigEndianValue (val); + TopMenuItem = CW (val); } PRIVATE void LMSetSFSaveDisk (INTEGER val) { warning_trace_info (NULL_STRING); - SFSaveDisk = BigEndianValue (val); + SFSaveDisk = CW (val); } PRIVATE void @@ -420,7 +420,7 @@ PRIVATE void LMSetResErr (INTEGER val) { warning_trace_info (NULL_STRING); - ResErr = BigEndianValue (val); + ResErr = CW (val); } PRIVATE void @@ -434,21 +434,21 @@ PRIVATE void LMSetCurDirStore (INTEGER val) { warning_trace_info (NULL_STRING); - CurDirStore = BigEndianValue (val); + CurDirStore = CW (val); } PRIVATE INTEGER LMGetCurApRefNum (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (CurApRefNum); + return CW (CurApRefNum); } PRIVATE LONGINT LMGetCurDirStore (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (CurDirStore); + return CL (CurDirStore); } PRIVATE uint8 @@ -462,7 +462,7 @@ PRIVATE INTEGER LMGetSysFontSize (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (SysFontSiz); + return CW (SysFontSiz); } PRIVATE INTEGER @@ -481,14 +481,14 @@ PRIVATE INTEGER LMGetSFSaveDisk (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (SFSaveDisk); + return CW (SFSaveDisk); } PRIVATE INTEGER LMGetSysFontFam (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (SysFontFam); + return CW (SysFontFam); } PRIVATE Handle @@ -502,14 +502,14 @@ PRIVATE void LMSetSysFontFam (INTEGER val) { warning_trace_info (NULL_STRING); - SysFontFam = BigEndianValue (val); + SysFontFam = CW (val); } PRIVATE void LMSetSysFontSize (INTEGER val) { warning_trace_info (NULL_STRING); - SysFontSiz = BigEndianValue (val); + SysFontSiz = CW (val); } PRIVATE WindowPtr @@ -523,14 +523,14 @@ PRIVATE INTEGER LMGetCurJTOffset (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (CurJTOffset); + return CW (CurJTOffset); } PRIVATE INTEGER LMGetCurMap (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (CurMap); + return CW (CurMap); } PRIVATE Ptr @@ -544,7 +544,7 @@ PRIVATE INTEGER LMGetFSFCBLen (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (FSFCBLen); + return CW (FSFCBLen); } PRIVATE Handle @@ -566,7 +566,7 @@ PRIVATE INTEGER LMGetHWCfgFlags (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (SCSIFlags); + return CW (SCSIFlags); } PRIVATE Byte @@ -587,21 +587,21 @@ PRIVATE INTEGER LMGetKeyThresh (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (KeyThresh); + return CW (KeyThresh); } PRIVATE INTEGER LMGetSysEvtMask (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (SysEvtMask); + return CW (SysEvtMask); } PRIVATE INTEGER LMGetTEScrpLength (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (TEScrpLength); + return CW (TEScrpLength); } PRIVATE uint32 @@ -609,7 +609,7 @@ LMGetTime (void) { warning_trace_info (NULL_STRING); GetDateTime (&Time); - return BigEndianValue (Time); + return CL (Time); } PRIVATE WindowPeek @@ -623,14 +623,14 @@ PRIVATE INTEGER LMGetTESysJust (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (TESysJust); + return CW (TESysJust); } PRIVATE INTEGER LMGetBootDrive (void) { warning_trace_info (NULL_STRING); - return BigEndianValue (BootDrive); + return CW (BootDrive); } PRIVATE Byte @@ -659,7 +659,7 @@ PRIVATE void LMSetTESysJust (INTEGER val) { warning_trace_info (NULL_STRING); - TESysJust = BigEndianValue (val); + TESysJust = CW (val); } PRIVATE void @@ -680,7 +680,7 @@ PRIVATE void LMSetCurMap (INTEGER val) { warning_trace_info (NULL_STRING); - CurMap = BigEndianValue (val); + CurMap = CW (val); } PRIVATE void @@ -702,14 +702,14 @@ LMSetLastSPExtra (LONGINT val) { warning_trace_info (NULL_STRING); warning_unimplemented ("val = 0x%x", val); - LastSPExtra = BigEndianValue (val); + LastSPExtra = CL (val); } PRIVATE void LMSetMBarHeight (INTEGER val) { warning_trace_info (NULL_STRING); - MBarHeight = BigEndianValue (val); + MBarHeight = CW (val); } PRIVATE void @@ -724,7 +724,7 @@ PRIVATE void LMSetTEScrpLength (INTEGER val) { warning_trace_info (NULL_STRING); - TEScrpLength = BigEndianValue (val); + TEScrpLength = CW (val); } PRIVATE void @@ -960,7 +960,7 @@ CloseWD (INTEGER wdref) WDPBRec pb; memset (&pb, 0, sizeof pb); - pb.ioVRefNum = BigEndianValue (wdref); + pb.ioVRefNum = CW (wdref); retval = PBCloseWD (&pb, FALSE); warning_trace_info ("retval = %d", retval); return retval; @@ -1008,8 +1008,8 @@ HRstFLock (INTEGER vref, LONGINT dirid, Str255 file) HParamBlockRec pb; memset (&pb, 0, sizeof pb); - pb.ioParam.ioVRefNum = BigEndianValue (vref); - pb.fileParam.ioDirID = BigEndianValue (dirid); + pb.ioParam.ioVRefNum = CW (vref); + pb.fileParam.ioDirID = CL (dirid); pb.ioParam.ioNamePtr = file; warning_trace_info (NULL_STRING); retval = PBHRstFLock (&pb, FALSE); @@ -1023,8 +1023,8 @@ HDelete (INTEGER vrefnum, LONGINT dirid, Str255 filename) HParamBlockRec pb; memset (&pb, 0, sizeof pb); - pb.ioParam.ioVRefNum = BigEndianValue (vrefnum); - pb.fileParam.ioDirID = BigEndianValue (dirid); + pb.ioParam.ioVRefNum = CW (vrefnum); + pb.fileParam.ioDirID = CL (dirid); pb.ioParam.ioNamePtr = filename; retval = PBHDelete (&pb, FALSE); warning_trace_info ("HDelete(%d, %d, %.*s) = %d", vrefnum, dirid, @@ -1039,8 +1039,8 @@ HOpenDF (INTEGER vref, LONGINT dirid, Str255 file, int8 perm, INTEGER *refp) HParamBlockRec pb; memset (&pb, 0, sizeof pb); - pb.ioParam.ioVRefNum = BigEndianValue (vref); - pb.fileParam.ioDirID = BigEndianValue (dirid); + pb.ioParam.ioVRefNum = CW (vref); + pb.fileParam.ioDirID = CL (dirid); pb.ioParam.ioNamePtr = file; pb.ioParam.ioPermssn = perm; warning_trace_info (NULL_STRING); @@ -2361,7 +2361,7 @@ SetCurrentA5 (void) uint32 retval; retval = (uint32) SYN68K_TO_US (EM_A5); - EM_A5 = (uint32) BigEndianValue (CurrentA5); + EM_A5 = (uint32) CL (CurrentA5); warning_trace_info ("old = 0x%x, new = 0x%x", retval, EM_A5); return retval; } @@ -2485,9 +2485,9 @@ OpenWD (INTEGER vref, LONGINT dirid, LONGINT procid, INTEGER *wdrefp) OSErr retval; memset (&wdpb, 0, sizeof wdpb); - wdpb.ioVRefNum = BigEndianValue (vref); - wdpb.ioWDDirID = BigEndianValue (dirid); - wdpb.ioWDProcID = BigEndianValue (procid); + wdpb.ioVRefNum = CW (vref); + wdpb.ioWDDirID = CL (dirid); + wdpb.ioWDProcID = CL (procid); retval = PBOpenWD (&wdpb, FALSE); if (retval == noErr) *wdrefp = wdpb.ioVRefNum; @@ -2502,8 +2502,8 @@ DirCreate (INTEGER vref, LONGINT parid, Str255 dirname, LONGINT *outdir) HParamBlockRec hpb; memset (&hpb, 0, sizeof hpb); - hpb.ioParam.ioVRefNum = BigEndianValue (vref); - hpb.fileParam.ioDirID = BigEndianValue (parid); + hpb.ioParam.ioVRefNum = CW (vref); + hpb.fileParam.ioDirID = CL (parid); hpb.ioParam.ioNamePtr = RM ((Ptr) dirname); retval = PBDirCreate (&hpb, FALSE); if (retval == noErr) @@ -2735,8 +2735,8 @@ HSetVol (StringPtr volName, INTEGER vref, LONGINT dirid) WDPBRec wdp; wdp.ioNamePtr = RM (volName); - wdp.ioVRefNum = BigEndianValue (vref); - wdp.ioWDDirID = BigEndianValue (dirid); + wdp.ioVRefNum = CW (vref); + wdp.ioWDDirID = CL (dirid); retval = PBHSetVol (&wdp, FALSE); warning_trace_info ("retval = %d", retval); return retval; @@ -2749,8 +2749,8 @@ HOpen (INTEGER vref, LONGINT dirid, Str255 filename, SignedByte perm, OSErr retval; HParamBlockRec hpb; - hpb.ioParam.ioVRefNum = BigEndianValue (vref); - hpb.fileParam.ioDirID = BigEndianValue (dirid); + hpb.ioParam.ioVRefNum = CW (vref); + hpb.fileParam.ioDirID = CL (dirid); hpb.ioParam.ioNamePtr = RM (filename); hpb.ioParam.ioPermssn = CB (perm); retval = PBHOpen (&hpb, FALSE); @@ -2768,8 +2768,8 @@ HSetFInfo (INTEGER vref, LONGINT dirid, Str255 filename, FInfo *finfop) OSErr retval; HParamBlockRec hpb; - hpb.ioParam.ioVRefNum = BigEndianValue (vref); - hpb.fileParam.ioDirID = BigEndianValue (dirid); + hpb.ioParam.ioVRefNum = CW (vref); + hpb.fileParam.ioDirID = CL (dirid); hpb.ioParam.ioNamePtr = RM (filename); hpb.fileParam.ioFlFndrInfo = *finfop; retval = PBHSetFInfo (&hpb, FALSE); @@ -2812,7 +2812,7 @@ MPPOpen_stub (void) PRIVATE void SetDialogFont (INTEGER font) { - DlgFont = BigEndianValue (font); + DlgFont = CW (font); warning_trace_info (NULL_STRING); } diff --git a/src/iu.cpp b/src/iu.cpp index f75cfb41..6b070662 100644 --- a/src/iu.cpp +++ b/src/iu.cpp @@ -21,7 +21,6 @@ char ROMlib_rcsid_iu[] = #include using namespace Executor; -using namespace ByteSwap; /* * outl adds the characters in the four bytes of a longint to the place @@ -165,19 +164,19 @@ P4(PUBLIC pascal trap, void, IUDatePString, LONGINT, date, /* IMI-505 */ if (h && (int0p = (Intl0Ptr) STARH(h))) { switch (Cx(int0p->dateOrder)) { case mdy: - month(BigEndianValue(dtr.month), int0p, Cx(int0p->dateSep), &op); - day (BigEndianValue(dtr.day), int0p, Cx(int0p->dateSep), &op); - year (BigEndianValue(dtr.year), int0p, 0, &op); + month(CW(dtr.month), int0p, Cx(int0p->dateSep), &op); + day (CW(dtr.day), int0p, Cx(int0p->dateSep), &op); + year (CW(dtr.year), int0p, 0, &op); break; case dmy: - day (BigEndianValue(dtr.day), int0p, Cx(int0p->dateSep), &op); - month(BigEndianValue(dtr.month), int0p, Cx(int0p->dateSep), &op); - year (BigEndianValue(dtr.year), int0p, 0, &op); + day (CW(dtr.day), int0p, Cx(int0p->dateSep), &op); + month(CW(dtr.month), int0p, Cx(int0p->dateSep), &op); + year (CW(dtr.year), int0p, 0, &op); break; case ymd: - year (BigEndianValue(dtr.year), int0p, Cx(int0p->dateSep), &op); - month(BigEndianValue(dtr.month), int0p, Cx(int0p->dateSep), &op); - day (BigEndianValue(dtr.day), int0p, 0, &op); + year (CW(dtr.year), int0p, Cx(int0p->dateSep), &op); + month(CW(dtr.month), int0p, Cx(int0p->dateSep), &op); + day (CW(dtr.day), int0p, 0, &op); break; } } @@ -186,20 +185,20 @@ P4(PUBLIC pascal trap, void, IUDatePString, LONGINT, date, /* IMI-505 */ abbrev = form == longDate ? 0 : Cx(int1p->abbrLen); outl(Cx(int1p->st0), &op); if (!Cx(int1p->suppressDay)) { - outs(int1p->days[BigEndianValue(dtr.dayOfWeek)-1], abbrev, &op); + outs(int1p->days[CW(dtr.dayOfWeek)-1], abbrev, &op); outl(Cx(int1p->st1), &op); } if (Cx(int1p->lngDateFmt)) { - outs(int1p->months[BigEndianValue(dtr.month)-1], abbrev, &op); + outs(int1p->months[CW(dtr.month)-1], abbrev, &op); outl(Cx(int1p->st2), &op); - outn(BigEndianValue(dtr.day), Cx(int1p->dayLeading0), &op); + outn(CW(dtr.day), Cx(int1p->dayLeading0), &op); } else { - outn(BigEndianValue(dtr.day), Cx(int1p->dayLeading0), &op); + outn(CW(dtr.day), Cx(int1p->dayLeading0), &op); outl(Cx(int1p->st2), &op); - outs(int1p->months[BigEndianValue(dtr.month)-1], abbrev, &op); + outs(int1p->months[CW(dtr.month)-1], abbrev, &op); } outl(Cx(int1p->st3), &op); - outn(BigEndianValue(dtr.year), FALSE, &op); + outn(CW(dtr.year), FALSE, &op); outl(Cx(int1p->st4), &op); } } @@ -261,20 +260,20 @@ P4(PUBLIC pascal trap, void, IUTimePString, LONGINT, date, /* IMI-505 */ if (h && (int0p = (Intl0Ptr) STARH(h))) { Secs2Date(date, &dtr); if (int0p->timeCycle) - outn((BigEndianValue(dtr.hour) % 12) == 0 ? 12 : BigEndianValue(dtr.hour) % 12, + outn((CW(dtr.hour) % 12) == 0 ? 12 : CW(dtr.hour) % 12, Cx(int0p->timeFmt) & hrLeadingZ, &op); else - outn(BigEndianValue(dtr.hour), Cx(int0p->timeFmt) & hrLeadingZ, &op); + outn(CW(dtr.hour), Cx(int0p->timeFmt) & hrLeadingZ, &op); *op++ = int0p->timeSep; - outn(BigEndianValue(dtr.minute), Cx(int0p->timeFmt) & minLeadingZ, &op); + outn(CW(dtr.minute), Cx(int0p->timeFmt) & minLeadingZ, &op); if (secs) { *op++ = int0p->timeSep; - outn(BigEndianValue(dtr.second), Cx(int0p->timeFmt) & secLeadingZ, &op); + outn(CW(dtr.second), Cx(int0p->timeFmt) & secLeadingZ, &op); } /* IMI-499 is misleading about the timenSuff fields. The first four are used for AM, the second four for PM. Yes, that's dumb. But that's how the Mac works. Sigh. */ - if (!int0p->timeCycle && BigEndianValue(dtr.hour) < 12) + if (!int0p->timeCycle && CW(dtr.hour) < 12) for (ip = (char *) &int0p->time1Suff, ep = ip + 4; ip != ep && *ip;) *op++ = *ip++; @@ -282,7 +281,7 @@ P4(PUBLIC pascal trap, void, IUTimePString, LONGINT, date, /* IMI-505 */ for (ip = (char *) &int0p->time5Suff, ep = ip + 4; ip != ep && *ip;) *op++ = *ip++; - else if (BigEndianValue(dtr.hour) < 12) + else if (CW(dtr.hour) < 12) outl(Cx(int0p->mornStr), &op); else outl(Cx(int0p->eveStr), &op); diff --git a/src/iv-stubs.cpp b/src/iv-stubs.cpp index 01c1f7df..3128ef10 100644 --- a/src/iv-stubs.cpp +++ b/src/iv-stubs.cpp @@ -32,7 +32,6 @@ char ROMlib_rcsid_vi_stubs[] #include using namespace Executor; -using namespace ByteSwap; #define print_errno_error_message(call, msg) \ ({ \ @@ -69,9 +68,9 @@ send_image (int width, int height, color = &header.image_color_map[i]; color_spec = &CTAB_TABLE (ctab)[i]; - color->red = BigEndianValue (color_spec->rgb.red); - color->green = BigEndianValue (color_spec->rgb.green); - color->blue = BigEndianValue (color_spec->rgb.blue); + color->red = CW (color_spec->rgb.red); + color->green = CW (color_spec->rgb.green); + color->blue = CW (color_spec->rgb.blue); } /* connect to server, and send */ gethostname (hostname, 1024); @@ -126,8 +125,8 @@ dump_grafport_image (GrafPort *port) r = PORT_RECT (port); bounds = PORT_BOUNDS (port); OffsetRect (&bounds, - BigEndianValue (r.left) - BigEndianValue (bounds.left), - BigEndianValue (r.top) - BigEndianValue (bounds.top)); + CW (r.left) - CW (bounds.left), + CW (r.top) - CW (bounds.top)); SectRect (&r, &bounds, &r); dump_image (&port->portBits, &r); } @@ -149,7 +148,7 @@ dump_image (BitMap *bogo_bitmap, Rect *rect) height = RECT_HEIGHT (rect); /* destination must be 8bpp */ - depth = BigEndianValue (pixmap->pixelSize); + depth = CW (pixmap->pixelSize); if (depth != 8) { int map_width, map_height; @@ -163,7 +162,7 @@ dump_image (BitMap *bogo_bitmap, Rect *rect) map_row_bytes = ((width * 8 + 31) / 32) * 4; base_addr = (char*)alloca (map_row_bytes * height); - new_pixmap.rowBytes = BigEndianValue (map_row_bytes); + new_pixmap.rowBytes = CW (map_row_bytes); new_pixmap.baseAddr = RM ((Ptr) base_addr); new_pixmap.pixelSize = CWC (8); @@ -174,7 +173,7 @@ dump_image (BitMap *bogo_bitmap, Rect *rect) conv_table = (ColorTable*)alloca (CTAB_STORAGE_FOR_SIZE (1 << depth)); for (i = 0; i < (1 << depth); i ++) - conv_table->ctTable[i].value = BigEndianValue (i); + conv_table->ctTable[i].value = CW (i); convert_pixmap (pixmap, &new_pixmap, rect, conv_table); @@ -183,15 +182,15 @@ dump_image (BitMap *bogo_bitmap, Rect *rect) } else { - map_row_bytes = BigEndianValue ((unsigned short) pixmap->rowBytes + map_row_bytes = CW ((unsigned short) pixmap->rowBytes & ~ROWBYTES_FLAG_BITS_X); base_addr = MR ((char *) pixmap->baseAddr); } row_bytes = width; _base_addr - = &base_addr[(BigEndianValue (rect->top) - BigEndianValue (pixmap->bounds.top)) * map_row_bytes - + (BigEndianValue (rect->left) - BigEndianValue (pixmap->bounds.left))]; + = &base_addr[(CW (rect->top) - CW (pixmap->bounds.top)) * map_row_bytes + + (CW (rect->left) - CW (pixmap->bounds.left))]; send_image (width, height, map_row_bytes, row_bytes, _base_addr, @@ -209,7 +208,7 @@ dump_rgn_as_image (RgnHandle rh) bm.bounds = RGN_BBOX (rh); row_bytes = ((RECT_WIDTH (&bm.bounds) + 31) / 32) * 4; - bm.rowBytes = BigEndianValue (row_bytes); + bm.rowBytes = CW (row_bytes); baseaddr = (char*)alloca (row_bytes * RECT_HEIGHT (&bm.bounds)); bm.baseAddr = RM ((Ptr) baseaddr); memset (baseaddr, '\377', row_bytes * RECT_HEIGHT (&bm.bounds)); diff --git a/src/keycode.mm b/src/keycode.cpp similarity index 99% rename from src/keycode.mm rename to src/keycode.cpp index a2e96065..7e8fb2f5 100644 --- a/src/keycode.mm +++ b/src/keycode.cpp @@ -48,8 +48,10 @@ #include "rsys/common.h" #include "rsys/next.h" +#ifdef MACOSX_ #import "MacAppClass.h" #import "MacViewClass.h" +#endif #include "rsys/soundopts.h" #include "rsys/blockinterrupts.h" diff --git a/src/launch.cpp b/src/launch.cpp index 992fa351..bcb05017 100644 --- a/src/launch.cpp +++ b/src/launch.cpp @@ -88,7 +88,6 @@ char ROMlib_rcsid_launch[] = #include "rsys/appearance.h" using namespace Executor; -using namespace ByteSwap; PRIVATE boolean_t ppc_launch_p = FALSE; @@ -362,7 +361,7 @@ PRIVATE void beginexecutingat( LONGINT startpc ) EM_A2 = EM_D3; EM_A3 = 0; EM_A4 = 0; - EM_A5 = BigEndianValue((LONGINT) CurrentA5); /* was smashed when we + EM_A5 = CL((LONGINT) CurrentA5); /* was smashed when we initialized above */ EM_A6 = 0x1EF; @@ -389,9 +388,9 @@ PUBLIC void Executor::SFSaveDisk_Update (INTEGER vrefnum, Str255 filename) str255assign (save_name, filename); pbr.volumeParam.ioNamePtr = (StringPtr) RM ((long) save_name); pbr.volumeParam.ioVolIndex = CWC (-1); - pbr.volumeParam.ioVRefNum = BigEndianValue (vrefnum); + pbr.volumeParam.ioVRefNum = CW (vrefnum); PBGetVInfo (&pbr, FALSE); - SFSaveDisk = BigEndianValue (-BigEndianValue (pbr.volumeParam.ioVRefNum)); + SFSaveDisk = CW (-CW (pbr.volumeParam.ioVRefNum)); } PUBLIC uint32 Executor::ROMlib_version_long; @@ -420,7 +419,7 @@ Executor::ROMlib_find_cfrg (Handle cfrg, OSType arch, uint8 type, Str255 name) cfrgp = (cfrg_resource_t *) STARH (cfrg); cfirp = (cfir_t *) ((char *) cfrgp + sizeof *cfrgp); - desired_arch_x = BigEndianValue (arch); + desired_arch_x = CL (arch); type_x = CB (type); for (n_descripts = CFRG_N_DESCRIPTS (cfrgp); n_descripts > 0 && !cfrg_match (cfirp, desired_arch_x, type_x, name); @@ -528,11 +527,11 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, CInfoPBRec hpb; hpb.hFileInfo.ioNamePtr = RM(&fName[0]); - hpb.hFileInfo.ioVRefNum = BigEndianValue(vRefNum); + hpb.hFileInfo.ioVRefNum = CW(vRefNum); hpb.hFileInfo.ioFDirIndex = CWC (0); hpb.hFileInfo.ioDirID = 0; PBGetCatInfo(&hpb, FALSE); - wdpb.ioVRefNum = BigEndianValue(vRefNum); + wdpb.ioVRefNum = CW(vRefNum); wdpb.ioWDDirID = hpb.hFileInfo.ioFlParID; } else @@ -547,7 +546,7 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, wdpb.ioWDProcID = T('X','c','t','r'); wdpb.ioNamePtr = 0; PBOpenWD(&wdpb, FALSE); - ROMlib_exevrefnum = BigEndianValue(wdpb.ioVRefNum); + ROMlib_exevrefnum = CW(wdpb.ioVRefNum); ROMlib_exefname = CurApName; #if 0 /* I'm skeptical that this is correct */ @@ -555,7 +554,7 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, CloseResFile(CurMap); #endif SetVol((StringPtr) 0, ROMlib_exevrefnum); - CurApRefNum = BigEndianValue(OpenResFile(ROMlib_exefname)); + CurApRefNum = CW(OpenResFile(ROMlib_exefname)); /* setupsignals(); */ @@ -572,19 +571,19 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, BlockMove((Ptr) ROMlib_exeuname, (Ptr) ename+1, elen); ename[0] = elen; - ROMlib_creator = BigEndianValue(finfo.fdCreator); + ROMlib_creator = CL(finfo.fdCreator); #define LEMMINGSHACK #if defined(LEMMINGSHACK) { - if (finfo.fdCreator == BigEndianValue(TICK("Psyg")) - || finfo.fdCreator == BigEndianValue(TICK("Psod"))) + if (finfo.fdCreator == CL(TICK("Psyg")) + || finfo.fdCreator == CL(TICK("Psod"))) ROMlib_flushoften = TRUE; } #endif /* defined(LEMMINGSHACK) */ #if defined (ULTIMA_III_HACK) - ROMlib_ultima_iii_hack = (finfo.fdCreator == BigEndianValue(TICK("Ult3"))); + ROMlib_ultima_iii_hack = (finfo.fdCreator == CL(TICK("Ult3"))); #endif h = GetResource(T('v','e','r','s'), 2); @@ -613,8 +612,8 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, ROMlib_MacSize.first = INITIALPAIRVALUE; ROMlib_directdiskaccess = FALSE; ROMlib_clear_gestalt_list (); - ParseConfigFile ((StringPtr) "\pExecutorDefault", 0); - ParseConfigFile (ename, err == noErr ? BigEndianValue(finfo.fdCreator) : 0); + ParseConfigFile ((StringPtr) "\017ExecutorDefault", 0); + ParseConfigFile (ename, err == noErr ? CL(finfo.fdCreator) : 0); ROMlib_clockonoff(!ROMlib_noclock); if ((ROMlib_ScreenSize.first != INITIALPAIRVALUE || ROMlib_MacSize.first != INITIALPAIRVALUE)) @@ -658,9 +657,9 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, size_info_t *size_resource; size_resource = (size_info_t *) STARH (size_resource_h); - size_info.size_flags = BigEndianValue (size_resource->size_flags); - size_info.preferred_size = BigEndianValue (size_resource->preferred_size); - size_info.minimum_size = BigEndianValue (size_resource->minimum_size); + size_info.size_flags = CW (size_resource->size_flags); + size_info.preferred_size = CL (size_resource->preferred_size); + size_info.minimum_size = CL (size_resource->minimum_size); size_info.size_resource_present_p = TRUE; } else @@ -680,7 +679,7 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, == SZisHighLevelEventAware); } - h = GetResource(BigEndianValue(finfo.fdCreator), 0); + h = GetResource(CL(finfo.fdCreator), 0); if (h) { namelen = *MR(*(unsigned char **)h); namebuf = (char*)alloca(namelen+1); @@ -694,7 +693,7 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, lp = 0; /* just to shut GCC up */ jumplen = jumpoff = 0; /* just to shut GCC up */ a5 = (LONGINT) (long) US_TO_SYN68K (&tmpa5); - CurrentA5 = (Ptr) BigEndianValue (a5); + CurrentA5 = (Ptr) CL (a5); InitGraf ((Ptr) quickbytes + grafSize - 4); } else @@ -702,10 +701,10 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, HLock(code0); lp = (LONGINT *) STARH(code0); - abovea5 = BigEndianValue(*lp++); - belowa5 = BigEndianValue(*lp++); - jumplen = BigEndianValue(*lp++); - jumpoff = BigEndianValue(*lp++); + abovea5 = CL(*lp++); + belowa5 = CL(*lp++); + jumplen = CL(*lp++); + jumpoff = CL(*lp++); /* * NOTE: The stack initialization code that was here has been moved @@ -715,17 +714,17 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, #if defined(SYN68K) EM_A7 -= abovea5 + belowa5; - CurStackBase = (Ptr) BigEndianValue(EM_A7); + CurStackBase = (Ptr) CL(EM_A7); #else /* !defined(SYN68K) */ ROMlib_foolgcc = alloca(abovea5 + belowa5); CurStackBase - = BigEndianValue(MAC_STACK_START + MAC_STACK_SIZE - (abovea5 + belowa5)); + = CL(MAC_STACK_START + MAC_STACK_SIZE - (abovea5 + belowa5)); #endif /* !defined(SYN68K) */ CurrentA5 = RM(MR(CurStackBase) + belowa5); /* set CurrentA5 */ BufPtr = RM(MR(CurrentA5) + abovea5); - CurJTOffset = BigEndianValue(jumpoff); - a5 = BigEndianValue((LONGINT) CurrentA5); + CurJTOffset = CW(jumpoff); + a5 = CL((LONGINT) CurrentA5); } GetDateTime((LONGINT *) &Time); @@ -770,7 +769,7 @@ PRIVATE void launchchain(StringPtr fName, INTEGER vRefNum, BOOLEAN resetmemory, ROMlib_uaf = 0; if (code0) - beginexecutingat(BigEndianValue((LONGINT) CurrentA5) + BigEndianValue(CurJTOffset) + 2); + beginexecutingat(CL((LONGINT) CurrentA5) + CW(CurJTOffset) + 2); else { FSSpec fs; @@ -1063,7 +1062,7 @@ PRIVATE void reset_low_globals(void) MBSaveLoc = 0; SysFontFam = 0; - SysVersion = BigEndianValue (system_version); + SysVersion = CW (system_version); FSFCBLen = CWC (94); /* @@ -1162,7 +1161,7 @@ PRIVATE void reset_low_globals(void) } SysEvtMask = CWC(~(1L<< keyUp)); /* EVERYTHING except keyUp */ SdVolume = 7; /* for Beebop 2 */ - CurrentA5 = (Ptr) BigEndianValue (EM_A5); + CurrentA5 = (Ptr) CL (EM_A5); } PRIVATE void reset_traps(void) @@ -1263,18 +1262,18 @@ PRIVATE void reinitialize_things(void) } } - length = BigEndianValue(*(short *)MR(FCBSPtr)); + length = CW(*(short *)MR(FCBSPtr)); fcbp = (filecontrolblock *) ((short *)MR(FCBSPtr)+1); efcbp = (filecontrolblock *) ((char *)MR(FCBSPtr) + length); for (;fcbp < efcbp; - fcbp = (filecontrolblock *) ((char *)fcbp + BigEndianValue(FSFCBLen))) + fcbp = (filecontrolblock *) ((char *)fcbp + CW(FSFCBLen))) { INTEGER rn; rn = (char *) fcbp - (char *) MR(FCBSPtr); if (fcbp->fcbCName[0] /* && rn != Param_ram_rn */ - && rn != BigEndianValue (SysMap) + && rn != CW (SysMap) && rn != special_fn) FSClose((char *) fcbp - (char *) MR(FCBSPtr)); } @@ -1313,7 +1312,7 @@ ROMlib_filename_from_fsspec (char **strp, FSSpec *fsp) memset (&pbr, 0, sizeof pbr); pbr.ioParam.ioVRefNum = fsp->vRefNum; pbr.ioParam.ioNamePtr = (StringPtr) RM ((Ptr) fsp->name); - retval = ROMlib_nami (&pbr, BigEndianValue (fsp->parID), NoIndex, strp, &filename, + retval = ROMlib_nami (&pbr, CL (fsp->parID), NoIndex, strp, &filename, &endname, FALSE, &vcbp, &sbuf); return retval; } @@ -1359,7 +1358,7 @@ Executor::NewLaunch (StringPtr fName_arg, INTEGER vRefNum_arg, LaunchParamBlockR if (lpbp->launchAppParameters) { ap = MR (lpbp->launchAppParameters); - n_filenames += BigEndianValue (ap->n_fsspec); + n_filenames += CW (ap->n_fsspec); } n_filename_bytes = n_filenames * sizeof *filenames; filenames = (char**)alloca (n_filename_bytes); diff --git a/src/listAccess.cpp b/src/listAccess.cpp index d591c0f8..71ef6cec 100644 --- a/src/listAccess.cpp +++ b/src/listAccess.cpp @@ -17,7 +17,6 @@ char ROMlib_rcsid_listAccess[] = #include "rsys/hook.h" using namespace Executor; -using namespace ByteSwap; P4(PUBLIC pascal trap, void, LFind, INTEGER *, offsetp, /* IMIV-274 */ INTEGER *, lenp, Cell, cell, ListHandle, list) @@ -26,7 +25,7 @@ P4(PUBLIC pascal trap, void, LFind, INTEGER *, offsetp, /* IMIV-274 */ if ((ip = ROMlib_getoffp(cell, list))) { *offsetp = *ip++ & CWC(0x7FFF); - *lenp = BigEndianValue((BigEndianValue(*ip) & 0x7FFF) - BigEndianValue(*offsetp)); + *lenp = CW((CW(*ip) & 0x7FFF) - CW(*offsetp)); } else *offsetp = *lenp = CWC(-1); } @@ -38,8 +37,8 @@ P4(PUBLIC pascal trap, BOOLEAN, LNextCell, BOOLEAN, hnext, /* IMIV-274 */ Cell scratch; INTEGER right, bottom; - scratch.v = BigEndianValue(cellp->v); - scratch.h = BigEndianValue(cellp->h); + scratch.v = CW(cellp->v); + scratch.h = CW(cellp->h); right = Hx(list, dataBounds.right); bottom = Hx(list, dataBounds.bottom); if (hnext) { @@ -58,8 +57,8 @@ P4(PUBLIC pascal trap, BOOLEAN, LNextCell, BOOLEAN, hnext, /* IMIV-274 */ retval = FALSE; } if (retval) { - cellp->v = BigEndianValue(scratch.v); - cellp->h = BigEndianValue(scratch.h); + cellp->v = CW(scratch.v); + cellp->h = CW(scratch.h); } return retval; } @@ -74,14 +73,14 @@ P3(PUBLIC pascal trap, void, LRect, Rect *, cellrect, /* IMIV-274 */ csize.h = Hx(list, cellSize.h); csize.v = Hx(list, cellSize.v); *cellrect = HxX(list, rView); - cellrect->top = BigEndianValue(BigEndianValue(cellrect->top) + + cellrect->top = CW(CW(cellrect->top) + ((cell.v - Hx(list, visible.top)) * csize.v)); - cellrect->left = BigEndianValue(BigEndianValue(cellrect->left) + + cellrect->left = CW(CW(cellrect->left) + ((cell.h - Hx(list, visible.left)) * csize.h)); - if ((temp = BigEndianValue(cellrect->top) + csize.v) < BigEndianValue(cellrect->bottom)) - cellrect->bottom = BigEndianValue(temp); - if ((temp = BigEndianValue(cellrect->left) + csize.h) < BigEndianValue(cellrect->right)) - cellrect->right = BigEndianValue(temp); + if ((temp = CW(cellrect->top) + csize.v) < CW(cellrect->bottom)) + cellrect->bottom = CW(temp); + if ((temp = CW(cellrect->left) + csize.h) < CW(cellrect->right)) + cellrect->right = CW(temp); } else { cellrect->top = cellrect->left = cellrect->bottom = cellrect->right = CWC(0); @@ -121,7 +120,7 @@ A5(static inline, INTEGER, ROMlib_CALLCMP, Ptr, p1, Ptr, p2, INTEGER, l1, else { ROMlib_hook(list_cmpnumber); HOOKSAVEREGS(); - retval = CToPascalCall(&fp, CTOP_IUMagString, p1, p2, l1, l2); + retval = CToPascalCall((void*)fp, CTOP_IUMagString, p1, p2, l1, l2); HOOKRESTOREREGS(); } return retval; @@ -142,27 +141,27 @@ P5(PUBLIC pascal trap, BOOLEAN, LSearch, Ptr, dp, /* IMIV-274 */ HLock((Handle) HxP(list, cells)); fp = proc ? (cmpf) proc : (cmpf) P_IUMagString; - cell.h = BigEndianValue(cellp->h); - cell.v = BigEndianValue(cellp->v); + cell.h = CW(cellp->h); + cell.v = CW(cellp->v); swappedcell = *cellp; /* TODO: SPEEDUP: the following is a stupid way to do the loop, instead ip and ep should be used! */ - while ((C_LFind(&off, &len, cell, list), len = BigEndianValue (len), off = BigEndianValue (off), + while ((C_LFind(&off, &len, cell, list), len = CW (len), off = CW (off), len != -1) && CALLCMP(dp, (Ptr) STARH(HxP(list, cells)) + off, dl, len, fp) != 0) if (!C_LNextCell(TRUE, TRUE, &swappedcell, list)) { cell.h = Hx(list, dataBounds.right); cell.v = Hx(list, dataBounds.bottom); } else { - cell.h = BigEndianValue (swappedcell.h); - cell.v = BigEndianValue (swappedcell.v); + cell.h = CW (swappedcell.h); + cell.v = CW (swappedcell.v); } HUnlock((Handle) HxP(list, cells)); HUnlock((Handle) list); if (len != -1) { - cellp->h = BigEndianValue(cell.h); - cellp->v = BigEndianValue(cell.v); + cellp->h = CW(cell.h); + cellp->v = CW(cell.v); /*-->*/ return TRUE; } else return FALSE; @@ -182,9 +181,9 @@ P3(PUBLIC pascal trap, void, LSize, INTEGER, width, /* IMIV-274 */ oldright = Hx(list, rView.right); oldbottom = Hx(list, rView.bottom); newright = Hx(list, rView.left) + width; - HxX(list, rView.right) = BigEndianValue(newright); + HxX(list, rView.right) = CW(newright); newbottom = Hx(list, rView.top) + height; - HxX(list, rView.bottom) = BigEndianValue(newbottom); + HxX(list, rView.bottom) = CW(newbottom); ch = HxP(list, hScroll); cv = HxP(list, vScroll); @@ -204,12 +203,12 @@ P3(PUBLIC pascal trap, void, LSize, INTEGER, width, /* IMIV-274 */ MoveControl(cv, newright, Hx(list, rView.top) - 1); SizeControl(cv, 16, newbottom - Hx(list, rView.top) + 2); } - r.top = BigEndianValue(MIN(oldbottom, newbottom)); - r.bottom = BigEndianValue(MAX(oldbottom, newbottom)); - r.left = BigEndianValue(Hx(list, rView.left) - 1); - r.right = BigEndianValue(MAX(oldright, newright)); + r.top = CW(MIN(oldbottom, newbottom)); + r.bottom = CW(MAX(oldbottom, newbottom)); + r.left = CW(Hx(list, rView.left) - 1); + r.right = CW(MAX(oldright, newright)); if (ch) - r.bottom = BigEndianValue(BigEndianValue(r.bottom) + (16)); + r.bottom = CW(CW(r.bottom) + (16)); RectRgn(rectrgn, &r); UnionRgn(rectrgn, updatergn, updatergn); } else { /* just right different */ @@ -219,12 +218,12 @@ P3(PUBLIC pascal trap, void, LSize, INTEGER, width, /* IMIV-274 */ if (cv) MoveControl(cv, newright, Hx(list, rView.top) - 1); } - r.left = BigEndianValue(MIN(oldright, newright)); - r.right = BigEndianValue(MAX(oldright, newright)); - r.top = BigEndianValue(Hx(list, rView.top) - 1); - r.bottom = BigEndianValue(MAX(oldbottom, newbottom)); + r.left = CW(MIN(oldright, newright)); + r.right = CW(MAX(oldright, newright)); + r.top = CW(Hx(list, rView.top) - 1); + r.bottom = CW(MAX(oldbottom, newbottom)); if (cv) - r.right = BigEndianValue(BigEndianValue(r.right) + (16)); + r.right = CW(CW(r.right) + (16)); RectRgn(rectrgn, &r); UnionRgn(rectrgn, updatergn, updatergn); } else if (newbottom != oldbottom) { /* just bottom different */ @@ -233,12 +232,12 @@ P3(PUBLIC pascal trap, void, LSize, INTEGER, width, /* IMIV-274 */ if (cv) { SizeControl(cv, 16, newbottom - Hx(list, rView.top) + 2); } - r.top = BigEndianValue(MIN(oldbottom, newbottom)); - r.bottom = BigEndianValue(MAX(oldbottom, newbottom)); - r.left = BigEndianValue(Hx(list, rView.left) - 1); - r.right = BigEndianValue(MAX(oldright, newright)); + r.top = CW(MIN(oldbottom, newbottom)); + r.bottom = CW(MAX(oldbottom, newbottom)); + r.left = CW(Hx(list, rView.left) - 1); + r.right = CW(MAX(oldright, newright)); if (ch) - r.bottom = BigEndianValue(BigEndianValue(r.bottom) + (16)); + r.bottom = CW(CW(r.bottom) + (16)); RectRgn(rectrgn, &r); UnionRgn(rectrgn, updatergn, updatergn); } diff --git a/src/listAddDel.cpp b/src/listAddDel.cpp index 13b0fc50..3e40237f 100644 --- a/src/listAddDel.cpp +++ b/src/listAddDel.cpp @@ -15,7 +15,6 @@ char ROMlib_rcsid_listAddDel[] = #include "rsys/list.h" using namespace Executor; -using namespace ByteSwap; P3(PUBLIC pascal trap, INTEGER, LAddColumn, INTEGER, count, /* IMIV-271 */ INTEGER, coln, ListHandle, list) @@ -36,7 +35,7 @@ P3(PUBLIC pascal trap, INTEGER, LAddColumn, INTEGER, count, /* IMIV-271 */ if (coln < Hx(list, dataBounds.left)) coln = Hx(list, dataBounds.left); - HxX(list, dataBounds.right) = BigEndianValue(Hx(list, dataBounds.right) + count); + HxX(list, dataBounds.right) = CW(Hx(list, dataBounds.right) + count); if (noffsets) { TRAPBEGIN(); @@ -55,11 +54,11 @@ P3(PUBLIC pascal trap, INTEGER, LAddColumn, INTEGER, count, /* IMIV-271 */ ip -= nafter; op -= nafter; BlockMove(ip, op, nafter); - offset = BigEndianValue(*(INTEGER *)op) & 0x7FFF; + offset = CW(*(INTEGER *)op) & 0x7FFF; for (i = 0; ++i <= count; ) { op -= sizeof(INTEGER); - *(INTEGER *)op = BigEndianValue(offset); + *(INTEGER *)op = CW(offset); } ip -= nbefore; op -= nbefore; @@ -72,10 +71,10 @@ P3(PUBLIC pascal trap, INTEGER, LAddColumn, INTEGER, count, /* IMIV-271 */ if (Hx(list, listFlags) & DODRAW) { todraw = HxX(list, dataBounds); - todraw.left = BigEndianValue(coln); + todraw.left = CW(coln); SectRect(&todraw, &HxX(list, visible), &todraw); - for (c.v = BigEndianValue(todraw.top) ; c.v < BigEndianValue(todraw.bottom); c.v++) - for (c.h = BigEndianValue(todraw.left) ; c.h < BigEndianValue(todraw.right); c.h++) + for (c.v = CW(todraw.top) ; c.v < CW(todraw.bottom); c.v++) + for (c.h = CW(todraw.left) ; c.h < CW(todraw.right); c.h++) C_LDraw(c, list); } TRAPEND(); @@ -101,7 +100,7 @@ P3(PUBLIC pascal trap, INTEGER, LAddRow, INTEGER, count, /* IMIV-271 */ if (rown < Hx(list, dataBounds.top)) rown = Hx(list, dataBounds.top); - HxX(list, dataBounds.bottom) = BigEndianValue(Hx(list, dataBounds.bottom) + count); + HxX(list, dataBounds.bottom) = CW(Hx(list, dataBounds.bottom) + count); if (noffsets) { TRAPBEGIN(); @@ -115,11 +114,11 @@ P3(PUBLIC pascal trap, INTEGER, LAddRow, INTEGER, count, /* IMIV-271 */ *--op = *--ip; /* sentinel */ ip -= nafter; op -= nafter; - offset = BigEndianValue(*ip) & 0x7FFF; + offset = CW(*ip) & 0x7FFF; BlockMove((Ptr) ip, (Ptr) op, nafter * sizeof(INTEGER)); /* move the after rows */ while (--noffsets >= 0) - *--op = BigEndianValue(offset); + *--op = CW(offset); p.h = Hx(list, cellSize.h); p.v = Hx(list, cellSize.v); @@ -127,10 +126,10 @@ P3(PUBLIC pascal trap, INTEGER, LAddRow, INTEGER, count, /* IMIV-271 */ if (Hx(list, listFlags) & DODRAW) { todraw = HxX(list, dataBounds); - todraw.top = BigEndianValue(rown); + todraw.top = CW(rown); SectRect(&todraw, &HxX(list, visible), &todraw); - for (c.v = BigEndianValue(todraw.top) ; c.v < BigEndianValue(todraw.bottom); c.v++) - for (c.h = BigEndianValue(todraw.left) ; c.h < BigEndianValue(todraw.right); c.h++) + for (c.v = CW(todraw.top) ; c.v < CW(todraw.bottom); c.v++) + for (c.h = CW(todraw.left) ; c.h < CW(todraw.right); c.h++) C_LDraw(c, list); } TRAPEND(); @@ -153,10 +152,10 @@ compute_visible_rect (Rect *rp, ListHandle list, INTEGER top, INTEGER left, new_bottom = new_top + (bottom - top ) * v; new_right = new_left + (right - left) * h; - rp->top = BigEndianValue (new_top); - rp->left = BigEndianValue (new_left); - rp->bottom = BigEndianValue (new_bottom); - rp->right = BigEndianValue (new_right); + rp->top = CW (new_top); + rp->left = CW (new_left); + rp->bottom = CW (new_bottom); + rp->right = CW (new_right); SectRect (rp, &HxX (list, rView), rp); } @@ -203,7 +202,7 @@ P3(PUBLIC pascal trap, void, LDelColumn, INTEGER, count, /* IMIV-271 */ if (coln > Hx(list, dataBounds.right)) coln = Hx(list, dataBounds.right); - HxX(list, dataBounds.right) = BigEndianValue(Hx(list, dataBounds.right) - count); + HxX(list, dataBounds.right) = CW(Hx(list, dataBounds.right) - count); if (noffsets) { INTEGER visible_right, bounds_right; @@ -218,11 +217,11 @@ P3(PUBLIC pascal trap, void, LDelColumn, INTEGER, count, /* IMIV-271 */ /* SPEEDUP: partial loop unrolling ... combine things and don't bother adding delta when we know that it's zero */ while (--nrows >= 0) { - off1 = BigEndianValue(*ip) & 0x7FFF; + off1 = CW(*ip) & 0x7FFF; for (i = nbefore; --i >= 0; ) /* copy before-offsets */ - *op++ = BigEndianValue(BigEndianValue(*ip++) - delta); + *op++ = CW(CW(*ip++) - delta); - off2 = BigEndianValue(*ip) & 0x7FFF; + off2 = CW(*ip) & 0x7FFF; ntomove = off2 - off1; BlockMove(dataip, dataop, ntomove); /* copy before-data */ dataip += ntomove; @@ -230,22 +229,22 @@ P3(PUBLIC pascal trap, void, LDelColumn, INTEGER, count, /* IMIV-271 */ ip += count; /* skip count offsets */ - off3 = BigEndianValue(*ip) & 0x7FFF; + off3 = CW(*ip) & 0x7FFF; ntomove = off3 - off2; dataip += ntomove; /* skip appropriate data */ delta += ntomove; /* note this */ - off4 = BigEndianValue(*ip) & 0x7FFF; + off4 = CW(*ip) & 0x7FFF; for (i = nafter; --i >= 0; ) /* copy after-offsets */ - *op++ = BigEndianValue(BigEndianValue(*ip++) - delta); + *op++ = CW(CW(*ip++) - delta); - off5 = BigEndianValue(*ip) & 0x7FFF; + off5 = CW(*ip) & 0x7FFF; ntomove = off5 - off4; BlockMove(dataip, dataop, ntomove); /* copy before-data */ dataip += ntomove; dataop += ntomove; } - *op++ = BigEndianValue(BigEndianValue(*ip++) - delta); /* sentinel */ + *op++ = CW(CW(*ip++) - delta); /* sentinel */ SetHandleSize((Handle) list, GetHandleSize((Handle) list) - noffsets * sizeof(INTEGER)); SetHandleSize((Handle) HxP(list, cells), @@ -273,7 +272,7 @@ P3(PUBLIC pascal trap, void, LDelColumn, INTEGER, count, /* IMIV-271 */ if (visible_left > 0 && visible_right > bounds_right) { --visible_left; - HxX(list, visible.left) = BigEndianValue (visible_left); + HxX(list, visible.left) = CW (visible_left); coln = visible_left; } } @@ -288,10 +287,10 @@ P3(PUBLIC pascal trap, void, LDelColumn, INTEGER, count, /* IMIV-271 */ EraseRect (&eraser); todraw = HxX(list, dataBounds); - todraw.left = BigEndianValue(coln); + todraw.left = CW(coln); SectRect(&todraw, &HxX(list, visible), &todraw); - for (c.v = BigEndianValue(todraw.top) ; c.v < BigEndianValue(todraw.bottom); c.v++) - for (c.h = BigEndianValue(todraw.left) ; c.h < BigEndianValue(todraw.right); c.h++) + for (c.v = CW(todraw.top) ; c.v < CW(todraw.bottom); c.v++) + for (c.h = CW(todraw.left) ; c.h < CW(todraw.right); c.h++) C_LDraw(c, list); } TRAPEND(); @@ -337,7 +336,7 @@ P3(PUBLIC pascal trap, void, LDelRow, INTEGER, count, /* IMIV-272 */ ncols = Hx(list, dataBounds.right) - Hx(list, dataBounds.left); noffsets = count * ncols; - HxX(list, dataBounds.bottom) = BigEndianValue(Hx(list, dataBounds.bottom) - count); + HxX(list, dataBounds.bottom) = CW(Hx(list, dataBounds.bottom) - count); if (noffsets) { INTEGER visible_bottom, bounds_bottom; @@ -348,14 +347,14 @@ P3(PUBLIC pascal trap, void, LDelRow, INTEGER, count, /* IMIV-272 */ nafter = nrows * ncols - nbefore; ip = op = (unsigned short int *) HxX(list, cellArray) + nbefore; ip += noffsets; - off1 = BigEndianValue(*op) & 0x7FFF; - off2 = BigEndianValue(*ip) & 0x7FFF; + off1 = CW(*op) & 0x7FFF; + off2 = CW(*ip) & 0x7FFF; delta = off2 - off1; while (--nafter >= 0) - *op++ = BigEndianValue(BigEndianValue(*ip++) - delta); - off3 = BigEndianValue(*ip) & 0x7FFF; - *op = BigEndianValue(BigEndianValue(*ip) - delta); /* sentinel */ + *op++ = CW(CW(*ip++) - delta); + off3 = CW(*ip) & 0x7FFF; + *op = CW(CW(*ip) - delta); /* sentinel */ ntomove = off3 - off2; BlockMove((Ptr) STARH(HxP(list, cells)) + off2, @@ -387,7 +386,7 @@ P3(PUBLIC pascal trap, void, LDelRow, INTEGER, count, /* IMIV-272 */ if (visible_top > 0 && visible_bottom > bounds_bottom) { --visible_top; - HxX(list, visible.top) = BigEndianValue (visible_top); + HxX(list, visible.top) = CW (visible_top); rown = visible_top; } } @@ -401,11 +400,11 @@ P3(PUBLIC pascal trap, void, LDelRow, INTEGER, count, /* IMIV-272 */ EraseRect (&eraser); todraw = HxX(list, dataBounds); - todraw.top = BigEndianValue(rown); + todraw.top = CW(rown); SectRect(&todraw, &HxX(list, visible), &todraw); - for (c.v = BigEndianValue(todraw.top) ; c.v < BigEndianValue(todraw.bottom); c.v++) - for (c.h = BigEndianValue(todraw.left) ; c.h < BigEndianValue(todraw.right); c.h++) + for (c.v = CW(todraw.top) ; c.v < CW(todraw.bottom); c.v++) + for (c.h = CW(todraw.left) ; c.h < CW(todraw.right); c.h++) C_LDraw(c, list); } TRAPEND(); diff --git a/src/listCreate.cpp b/src/listCreate.cpp index 7d18ec0a..1ac0a125 100644 --- a/src/listCreate.cpp +++ b/src/listCreate.cpp @@ -16,29 +16,28 @@ char ROMlib_rcsid_listCreate[] = #include "rsys/list.h" using namespace Executor; -using namespace ByteSwap; #define STEF_lActivefix A3(PUBLIC, void, ROMlib_vminmax, INTEGER *, minp, /* INTERNAL */ INTEGER *, maxp, ListPtr, lp) { - *minp = BigEndianValue(lp->dataBounds.top); - *maxp = *minp + BigEndianValue(lp->dataBounds.bottom) - BigEndianValue(lp->visible.bottom) + - BigEndianValue(lp->visible.top); - if (BigEndianValue(lp->cellSize.v) * (BigEndianValue(lp->visible.bottom) - BigEndianValue(lp->visible.top)) > - BigEndianValue(lp->rView.bottom) - BigEndianValue(lp->rView.top)) + *minp = CW(lp->dataBounds.top); + *maxp = *minp + CW(lp->dataBounds.bottom) - CW(lp->visible.bottom) + + CW(lp->visible.top); + if (CW(lp->cellSize.v) * (CW(lp->visible.bottom) - CW(lp->visible.top)) > + CW(lp->rView.bottom) - CW(lp->rView.top)) ++*maxp; } A3(PUBLIC, void, ROMlib_hminmax, INTEGER *, minp, /* INTERNAL */ INTEGER *, maxp, ListPtr, lp) { - *minp = BigEndianValue(lp->dataBounds.left); - *maxp = *minp + BigEndianValue(lp->dataBounds.right) - BigEndianValue(lp->visible.right) + - BigEndianValue(lp->visible.left); - if (BigEndianValue(lp->cellSize.h) * (BigEndianValue(lp->visible.right) - BigEndianValue(lp->visible.left)) > - BigEndianValue(lp->rView.right) - BigEndianValue(lp->rView.left)) + *minp = CW(lp->dataBounds.left); + *maxp = *minp + CW(lp->dataBounds.right) - CW(lp->visible.right) + + CW(lp->visible.left); + if (CW(lp->cellSize.h) * (CW(lp->visible.right) - CW(lp->visible.left)) > + CW(lp->rView.right) - CW(lp->rView.left)) ++*maxp; } @@ -120,8 +119,8 @@ P9(PUBLIC pascal trap, ListHandle, LNew, Rect *, rview, /* IMIV-270 */ Handle temph; LISTDECL(); - noffs = (BigEndianValue(bounds->right) - BigEndianValue(bounds->left)) * - (BigEndianValue(bounds->bottom) - BigEndianValue(bounds->top)) +1; + noffs = (CW(bounds->right) - CW(bounds->left)) * + (CW(bounds->bottom) - CW(bounds->top)) +1; retval = (ListHandle) NewHandle(sizeof(ListRec) - sizeof(HxX(retval, cellArray)) + (noffs+1) * sizeof(INTEGER)); if (!retval) @@ -175,10 +174,10 @@ P9(PUBLIC pascal trap, ListHandle, LNew, Rect *, rview, /* IMIV-270 */ lp->listFlags = draw ? DODRAW : 0; if (scrollv) { r = lp->rView; - r.top = BigEndianValue(BigEndianValue(r.top) - 1); + r.top = CW(CW(r.top) - 1); r.left = r.right; - r.right = BigEndianValue(BigEndianValue(r.right) + (16)); - r.bottom = BigEndianValue(BigEndianValue(r.bottom) + 1); + r.right = CW(CW(r.right) + (16)); + r.bottom = CW(CW(r.bottom) + 1); ROMlib_vminmax(&min, &max, lp); lp->vScroll = RM(NewControl((WindowPtr) wind, &r, (StringPtr) "", draw && lp->lActive, min, min, max, scrollBarProc, (LONGINT) 0)); @@ -188,10 +187,10 @@ P9(PUBLIC pascal trap, ListHandle, LNew, Rect *, rview, /* IMIV-270 */ if (scrollh) { r = lp->rView; - r.left = BigEndianValue(BigEndianValue(r.left) - 1); + r.left = CW(CW(r.left) - 1); r.top = r.bottom; - r.bottom = BigEndianValue(BigEndianValue(r.bottom) + (16)); - r.right = BigEndianValue(BigEndianValue(r.right) + 1); + r.bottom = CW(CW(r.bottom) + (16)); + r.right = CW(CW(r.right) + 1); ROMlib_hminmax(&min, &max, lp); lp->hScroll = RM(NewControl((WindowPtr) wind, &r, (StringPtr) "", draw && lp->lActive, min, min, max, scrollBarProc, (LONGINT) 0)); diff --git a/src/listDisplay.cpp b/src/listDisplay.cpp index 0ca09919..cfbd888a 100644 --- a/src/listDisplay.cpp +++ b/src/listDisplay.cpp @@ -17,7 +17,6 @@ char ROMlib_rcsid_listDisplay[] = #include "rsys/hook.h" using namespace Executor; -using namespace ByteSwap; P2(PUBLIC pascal trap, void, LDraw, Cell, cell, /* IMIV-275 */ ListHandle, list) @@ -30,9 +29,9 @@ P2(PUBLIC pascal trap, void, LDraw, Cell, cell, /* IMIV-275 */ LISTDECL(); if ((ip = ROMlib_getoffp(cell, list))) { - off0 = BigEndianValue(ip[0]) & 0x7FFF; - off1 = BigEndianValue(ip[1]) & 0x7FFF; - setit = (BigEndianValue(ip[0]) & 0x8000) && Hx(list, lActive); + off0 = CW(ip[0]) & 0x7FFF; + off1 = CW(ip[1]) & 0x7FFF; + setit = (CW(ip[0]) & 0x8000) && Hx(list, lActive); saveport = thePort; SetPort(HxP(list, port)); saveclip = PORT_CLIP_REGION_X (thePort); @@ -104,8 +103,8 @@ P3(PUBLIC pascal trap, void, LScroll, INTEGER, ncol, /* IMIV-275 */ ncol = tmpi; } - HxX(list, visible.top) = BigEndianValue(Hx(list, visible.top) + nrow); - HxX(list, visible.left) = BigEndianValue(Hx(list, visible.left) + ncol); + HxX(list, visible.top) = CW(Hx(list, visible.top) + nrow); + HxX(list, visible.left) = CW(Hx(list, visible.left) + ncol); p.h = Hx(list, cellSize.h); p.v = Hx(list, cellSize.v); @@ -133,8 +132,8 @@ P1(PUBLIC pascal trap, void, LAutoScroll, ListHandle, list) /* IMIV-275 */ cell.h = HxX(list, dataBounds.left); cell.v = HxX(list, dataBounds.top); if (C_LGetSelect(TRUE, &cell, list)) { - cell.h = BigEndianValue(cell.h); - cell.v = BigEndianValue(cell.v); + cell.h = CW(cell.h); + cell.v = CW(cell.v); if (!PtInRect(cell, &HxX(list, visible))) { C_LScroll(cell.h - Hx(list, visible.left), cell.v - Hx(list, visible.top), list); @@ -157,24 +156,24 @@ P2(PUBLIC pascal trap, void, LUpdate, RgnHandle, rgn, /* IMIV-275 */ csize.h = Hx(list, cellSize.h); csize.v = Hx(list, cellSize.v); C_LRect(&r, c, list); - top = BigEndianValue(r.top); - left = BigEndianValue(r.left); + top = CW(r.top); + left = CW(r.left); bottom = top + (Hx(list, visible.bottom) - Hx(list, visible.top)) * csize.v; right = left + (Hx(list, visible.right) - Hx(list, visible.left)) * csize.h; - while (BigEndianValue(r.top) < bottom) { - while (BigEndianValue(r.left) < right) { + while (CW(r.top) < bottom) { + while (CW(r.left) < right) { if (RectInRgn(&r, rgn)) C_LDraw(c, list); - r.left = BigEndianValue(BigEndianValue(r.left ) + (csize.h)); - r.right = BigEndianValue(BigEndianValue(r.right) + (csize.h)); + r.left = CW(CW(r.left ) + (csize.h)); + r.right = CW(CW(r.right) + (csize.h)); c.h++; } c.h = cleft; c.v++; - r.top = BigEndianValue(BigEndianValue(r.top) + (csize.v)); - r.bottom = BigEndianValue(BigEndianValue(r.bottom) + (csize.v)); - r.left = BigEndianValue(left); - r.right = BigEndianValue(left + csize.h); + r.top = CW(CW(r.top) + (csize.v)); + r.bottom = CW(CW(r.bottom) + (csize.v)); + r.left = CW(left); + r.right = CW(left + csize.h); } if ((ch = HxP(list, hScroll))) { if (RectInRgn(&HxX(ch, contrlRect), rgn)) @@ -218,9 +217,9 @@ P2(PUBLIC pascal trap, void, LActivate, BOOLEAN, act, /* IMIV-276 */ c.v++) { for (c.h = Hx(list, visible.left); c.h < Hx(list, visible.right); c.h++) { - if ((ip = ROMlib_getoffp(c, list)) && (BigEndianValue(*ip) & 0x8000)) { - off0 = BigEndianValue(ip[0]) & 0x7FFF; - off1 = BigEndianValue(ip[1]) & 0x7FFF; + if ((ip = ROMlib_getoffp(c, list)) && (CW(*ip) & 0x8000)) { + off0 = CW(ip[0]) & 0x7FFF; + off1 = CW(ip[1]) & 0x7FFF; saveclip = PORT_CLIP_REGION_X (thePort); PORT_CLIP_REGION_X (thePort) = RM (NewRgn ()); C_LRect(&r, c, list); @@ -260,7 +259,7 @@ Executor::ROMlib_listcall (INTEGER mess, BOOLEAN sel, Rect *rp, Cell cell, INTEG else { ROMlib_hook(list_ldefnumber); HOOKSAVEREGS(); - CToPascalCall(&lp, CTOP_ldef0, mess, sel, rp, cell, off, len, lhand); + CToPascalCall((void*)lp, CTOP_ldef0, mess, sel, rp, cell, off, len, lhand); HOOKRESTOREREGS(); } } diff --git a/src/listMouse.cpp b/src/listMouse.cpp index 27232f9b..be7137e7 100644 --- a/src/listMouse.cpp +++ b/src/listMouse.cpp @@ -23,7 +23,6 @@ char ROMlib_rcsid_listMouse[] = #include "rsys/hook.h" using namespace Executor; -using namespace ByteSwap; #if defined (BINCOMPAT) typedef pascal BOOLEAN (*clickproc)( void ); @@ -44,14 +43,14 @@ namespace Executor { A2(PRIVATE, void, findcell, Cell *, cp, ListHandle, list) { - cp->h = BigEndianValue((BigEndianValue(cp->h) - Hx(list, rView.left)) / Hx(list, cellSize.h) + + cp->h = CW((CW(cp->h) - Hx(list, rView.left)) / Hx(list, cellSize.h) + Hx(list, visible.left)); - cp->v = BigEndianValue((BigEndianValue(cp->v) - Hx(list, rView.top)) / Hx(list, cellSize.v) + + cp->v = CW((CW(cp->v) - Hx(list, rView.top)) / Hx(list, cellSize.v) + Hx(list, visible.top)); - if (BigEndianValue(cp->h) >= Hx(list, visible.right)) + if (CW(cp->h) >= Hx(list, visible.right)) cp->h = CWC(32767); - if (BigEndianValue(cp->v) >= Hx(list, visible.bottom)) + if (CW(cp->v) >= Hx(list, visible.bottom)) cp->v = CWC(32767); } @@ -65,15 +64,15 @@ A4(PRIVATE, void, setselectnilflag, BOOLEAN, setit, Cell, cell, LISTDECL(); if ((ip = ROMlib_getoffp(cell, list))) { - off0wbit = BigEndianValue(*ip); + off0wbit = CW(*ip); if (setit) - *ip = BigEndianValue(off0wbit | 0x8000); + *ip = CW(off0wbit | 0x8000); else - *ip = BigEndianValue(off0wbit & 0x7FFF); + *ip = CW(off0wbit & 0x7FFF); if (PtInRect(cell, &HxX(list, visible)) && (!(off0wbit & 0x8000) ^ !setit)) { off0 = off0wbit & 0x7FFF; - off1 = BigEndianValue(ip[1]) & 0x7FFF; + off1 = CW(ip[1]) & 0x7FFF; if (hiliteempty || off0 != off1) { C_LRect(&r, cell, list); @@ -108,12 +107,12 @@ A4(PRIVATE, void, rectvalue, register Rect *, rp, register INTEGER, value, LISTDECL(); LISTBEGIN(list); - for (c.v = BigEndianValue(rp->top) ; c.v < BigEndianValue(rp->bottom); c.v++) { - c.h = BigEndianValue(rp->left); + for (c.v = CW(rp->top) ; c.v < CW(rp->bottom); c.v++) { + c.h = CW(rp->left); if ((sp = ip = ROMlib_getoffp(c, list))) { - for (ep = ip + (BigEndianValue(rp->right) - BigEndianValue(rp->left)); ip != ep; ip++) - if (!(BigEndianValue(*ip) & 0x8000) ^ !value) { - c.h = BigEndianValue(rp->left) + (ip - sp); + for (ep = ip + (CW(rp->right) - CW(rp->left)); ip != ep; ip++) + if (!(CW(*ip) & 0x8000) ^ !value) { + c.h = CW(rp->left) + (ip - sp); setselectnilflag(value, c, list, hiliteempty); } } @@ -128,10 +127,10 @@ A5(PRIVATE, void, rect2value, register Rect *, in, register Rect *, butnotin, register INTEGER *ip; Cell c; - for (c.v = BigEndianValue(in->top) ; c.v < BigEndianValue(in->bottom); c.v++) - for (c.h = BigEndianValue(in->left) ; c.h < BigEndianValue(in->right); c.h++) + for (c.v = CW(in->top) ; c.v < CW(in->bottom); c.v++) + for (c.h = CW(in->left) ; c.h < CW(in->right); c.h++) if (!PtInRect(c, butnotin) && (ip = ROMlib_getoffp(c, list))) - if (!(BigEndianValue(*ip) & 0x8000) ^ !value) + if (!(CW(*ip) & 0x8000) ^ !value) setselectnilflag(value, c, list, hiliteempty); } @@ -144,8 +143,8 @@ A1(PRIVATE, void, scrollbyvalues, ListHandle, list) h = (ch = HxP(list, hScroll)) ? GetCtlValue(ch) : Hx(list, visible.left); v = (ch = HxP(list, vScroll)) ? GetCtlValue(ch) : Hx(list, visible.top); C_LScroll(h - Hx(list, visible.left), v - Hx(list, visible.top), list); - HxX(list, visible.left) = BigEndianValue(h); - HxX(list, visible.top) = BigEndianValue(v); + HxX(list, visible.left) = CW(h); + HxX(list, visible.top) = CW(v); p.h = Hx(list, cellSize.h); p.v = Hx(list, cellSize.v); C_LCellSize(p, list); @@ -159,9 +158,9 @@ P2(PUBLIC, pascal void, ROMlib_mytrack, ControlHandle, ch, INTEGER, part) lp = (ListPtr) (long) STARH((Handle) (long) MR(HxX(ch, contrlRfCon))); page = ch == MR(lp->hScroll) ? - BigEndianValue(lp->visible.right) - BigEndianValue(lp->visible.left) - 1 + CW(lp->visible.right) - CW(lp->visible.left) - 1 : - BigEndianValue(lp->visible.bottom) - BigEndianValue(lp->visible.top) - 1; + CW(lp->visible.bottom) - CW(lp->visible.top) - 1; switch (part) { case inUpButton: @@ -196,7 +195,7 @@ A1(static inline, BOOLEAN, ROMlib_CALLCLICK, clickproc, fp) ROMlib_hook(list_clicknumber); HOOKSAVEREGS(); - retval = CToPascalCall(&fp, CTOP_Button); + retval = CToPascalCall((void*)fp, CTOP_Button); HOOKRESTOREREGS(); return retval; } @@ -224,12 +223,12 @@ P3(PUBLIC pascal trap, BOOLEAN, LClick, Point, pt, /* IMIV-273 */ if (PtInRect(pt, &HxX(list, rView))) { TRAPBEGIN(); flags = Hx(list, selFlags); - newcell.h = BigEndianValue(pt.h); - newcell.v = BigEndianValue(pt.v); + newcell.h = CW(pt.h); + newcell.v = CW(pt.v); findcell(&newcell, list); if (newcell.h == HxX(list, lastClick.h) && newcell.v == HxX(list, lastClick.v) && - TickCount() < Hx(list, clikTime) + BigEndianValue(DoubleTime)) + TickCount() < Hx(list, clikTime) + CL(DoubleTime)) doubleclick = TRUE; HxX(list, lastClick) = newcell; hiliteempty = !(flags & lNoNilHilite); @@ -263,113 +262,113 @@ P3(PUBLIC pascal trap, BOOLEAN, LClick, Point, pt, /* IMIV-273 */ anchor.top = anchor.bottom = 0; if (extend) { rswapped = HxX(list, dataBounds); - r.top = BigEndianValue(rswapped.top); - r.left = BigEndianValue(rswapped.left); - r.bottom = BigEndianValue(rswapped.bottom); - r.right = BigEndianValue(rswapped.right); + r.top = CW(rswapped.top); + r.left = CW(rswapped.left); + r.bottom = CW(rswapped.bottom); + r.right = CW(rswapped.right); for (c.h = r.left; c.h < r.right ; c.h++) for (c.v = r.top; c.v < r.bottom ; c.v++) { - cswapped.h = BigEndianValue(c.h); - cswapped.v = BigEndianValue(c.v); + cswapped.h = CW(c.h); + cswapped.v = CW(c.v); if (C_LGetSelect(FALSE, &cswapped, list)) goto out1; } out1: - c.h = BigEndianValue(cswapped.h); - c.v = BigEndianValue(cswapped.v); + c.h = CW(cswapped.h); + c.v = CW(cswapped.v); if (c.h != r.right) { - anchor.left = BigEndianValue(c.h); + anchor.left = CW(c.h); for (c.h = r.right-1; c.h >= r.left ; c.h--) for (c.v = r.top; c.v < r.bottom ; c.v++) { - cswapped.h = BigEndianValue(c.h); - cswapped.v = BigEndianValue(c.v); + cswapped.h = CW(c.h); + cswapped.v = CW(c.v); if (C_LGetSelect(FALSE, &cswapped, list)) goto out2; } out2: - c.h = BigEndianValue(cswapped.h); - c.v = BigEndianValue(cswapped.v); - anchor.right = BigEndianValue(c.h + 1); + c.h = CW(cswapped.h); + c.v = CW(cswapped.v); + anchor.right = CW(c.h + 1); - cswapped.h = BigEndianValue(r.left); - cswapped.v = BigEndianValue(r.top); + cswapped.h = CW(r.left); + cswapped.v = CW(r.top); C_LGetSelect(TRUE, &cswapped, list); anchor.top = cswapped.v; for (c.v = r.bottom - 1; c.v >= r.top ; c.v--) for (c.h = r.left; c.h < r.right ; c.h++) { - cswapped.h = BigEndianValue(c.h); - cswapped.v = BigEndianValue(c.v); + cswapped.h = CW(c.h); + cswapped.v = CW(c.v); if (C_LGetSelect(FALSE, &cswapped, list)) goto out3; } out3: - anchor.bottom = BigEndianValue(BigEndianValue(cswapped.v) + 1); + anchor.bottom = CW(CW(cswapped.v) + 1); } } if (anchor.top == anchor.bottom) { anchor.top = newcell.v; anchor.left = newcell.h; - anchor.bottom = BigEndianValue(BigEndianValue(anchor.top) + 1); - anchor.right = BigEndianValue(BigEndianValue(anchor.left) + 1); + anchor.bottom = CW(CW(anchor.top) + 1); + anchor.right = CW(CW(anchor.left) + 1); } - c.h = BigEndianValue(anchor.left); - c.v = BigEndianValue(anchor.top); + c.h = CW(anchor.left); + c.v = CW(anchor.top); C_LRect(&rswapped, c, list); - if (pt.h < BigEndianValue(rswapped.right) && pt.v < BigEndianValue(rswapped.bottom)) { - anchor.top = BigEndianValue(BigEndianValue(anchor.bottom) - 1); - anchor.left = BigEndianValue(BigEndianValue(anchor.right) - 1); + if (pt.h < CW(rswapped.right) && pt.v < CW(rswapped.bottom)) { + anchor.top = CW(CW(anchor.bottom) - 1); + anchor.left = CW(CW(anchor.right) - 1); } else { - anchor.bottom = BigEndianValue(BigEndianValue(anchor.top) + 1); - anchor.right = BigEndianValue(BigEndianValue(anchor.left) + 1); + anchor.bottom = CW(CW(anchor.top) + 1); + anchor.right = CW(CW(anchor.left) + 1); } oldselrect = (flags & lUseSense) ? anchor : HxX(list, dataBounds); } - HxX(list, clikTime) = BigEndianValue(TickCount()); - HxX(list, clikLoc.h) = BigEndianValue(pt.h); - HxX(list, clikLoc.v) = BigEndianValue(pt.v); + HxX(list, clikTime) = CL(TickCount()); + HxX(list, clikLoc.h) = CW(pt.h); + HxX(list, clikLoc.v) = CW(pt.v); oldcell.h = CWC(32767); - evt.where.h = BigEndianValue(pt.h); - evt.where.v = BigEndianValue(pt.v); + evt.where.h = CW(pt.h); + evt.where.v = CW(pt.v); pinrect = HxX(list, rView); - pinrect.left = BigEndianValue(BigEndianValue(pinrect.left) - 1); - pinrect.bottom = BigEndianValue(BigEndianValue(pinrect.bottom) - 1); + pinrect.left = CW(CW(pinrect.left) - 1); + pinrect.bottom = CW(CW(pinrect.bottom) - 1); do { HxX(list, mouseLoc) = evt.where; if (HxP(list, lClikLoop)) if (CALLCLICK(HxP(list, lClikLoop))) /*-->*/ break; - p.h = BigEndianValue(evt.where.h); - p.v = BigEndianValue(evt.where.v); + p.h = CW(evt.where.h); + p.v = CW(evt.where.v); if (!PtInRect(p, &HxX(list, rView))) { ctlchanged = FALSE; scrollh = HxP(list, hScroll); scrollv = HxP(list, vScroll); dh = 0; dv = 0; - if (BigEndianValue(evt.where.h) < Hx(list, rView.left)) { + if (CW(evt.where.h) < Hx(list, rView.left)) { if (scrollh) { SetCtlValue(scrollh, GetCtlValue(scrollh)-1); ctlchanged = TRUE; } else dh = -1; - } else if (BigEndianValue(evt.where.h) > Hx(list, rView.right)) { + } else if (CW(evt.where.h) > Hx(list, rView.right)) { if (scrollh) { SetCtlValue(scrollh, GetCtlValue(scrollh)+1); ctlchanged = TRUE; } else dh = 1; } - if (BigEndianValue(evt.where.v) < Hx(list, rView.top)) { + if (CW(evt.where.v) < Hx(list, rView.top)) { if (scrollv) { SetCtlValue(scrollv, GetCtlValue(scrollv)-1); ctlchanged = TRUE; } else dv = -1; - } else if (BigEndianValue(evt.where.v) > Hx(list, rView.bottom)) { + } else if (CW(evt.where.v) > Hx(list, rView.bottom)) { if (scrollv) { SetCtlValue(scrollv, GetCtlValue(scrollv)+1); ctlchanged = TRUE; @@ -381,17 +380,17 @@ P3(PUBLIC pascal trap, BOOLEAN, LClick, Point, pt, /* IMIV-273 */ else C_LScroll(dh, dv, list); } - p.h = BigEndianValue(evt.where.h); - p.v = BigEndianValue(evt.where.v); + p.h = CW(evt.where.h); + p.v = CW(evt.where.v); l = PinRect(&pinrect, p); - newcell.h = BigEndianValue(LoWord(l)); - newcell.v = BigEndianValue(HiWord(l)); + newcell.h = CW(LoWord(l)); + newcell.v = CW(HiWord(l)); findcell(&newcell, list); if (userects) { newcellr.top = newcell.v; newcellr.left = newcell.h; - newcellr.bottom = BigEndianValue(BigEndianValue(newcellr.top) + 1); - newcellr.right = BigEndianValue(BigEndianValue(newcellr.left) + 1); + newcellr.bottom = CW(CW(newcellr.top) + 1); + newcellr.right = CW(CW(newcellr.left) + 1); UnionRect(&anchor, &newcellr, &newselrect); rect2value(&oldselrect, &newselrect, !cellvalue, list, hiliteempty); @@ -401,13 +400,13 @@ P3(PUBLIC pascal trap, BOOLEAN, LClick, Point, pt, /* IMIV-273 */ if (newcell.h != oldcell.h || newcell.v != oldcell.v) { if (onlyone && oldcell.h != 32767) { - oldcellunswapped.h = BigEndianValue(oldcell.h); - oldcellunswapped.v = BigEndianValue(oldcell.v); + oldcellunswapped.h = CW(oldcell.h); + oldcellunswapped.v = CW(oldcell.v); setselectnilflag(FALSE, oldcellunswapped, list, hiliteempty); } - newcellunswapped.h = BigEndianValue(newcell.h); - newcellunswapped.v = BigEndianValue(newcell.v); + newcellunswapped.h = CW(newcell.h); + newcellunswapped.v = CW(newcell.v); setselectnilflag(cellvalue, newcellunswapped, list, hiliteempty); oldcell = newcell; diff --git a/src/listOps.cpp b/src/listOps.cpp index 65b134cb..b38e022b 100644 --- a/src/listOps.cpp +++ b/src/listOps.cpp @@ -15,7 +15,6 @@ char ROMlib_rcsid_listOps[] = #include "rsys/list.h" using namespace Executor; -using namespace ByteSwap; A2(PUBLIC, INTEGER *, ROMlib_getoffp, Cell, cell, /* INTERNAL */ ListHandle, list) @@ -24,9 +23,9 @@ A2(PUBLIC, INTEGER *, ROMlib_getoffp, Cell, cell, /* INTERNAL */ INTEGER ncols, *retval; if (list && PtInRect(cell, rp = &HxX(list, dataBounds))) { - ncols = BigEndianValue(rp->right) - BigEndianValue(rp->left); - retval = HxX(list, cellArray) + ncols * (cell.v - BigEndianValue(rp->top)) + - (cell.h - BigEndianValue(rp->left)); + ncols = CW(rp->right) - CW(rp->left); + retval = HxX(list, cellArray) + ncols * (cell.v - CW(rp->top)) + + (cell.h - CW(rp->left)); } else retval = 0; return retval; @@ -53,9 +52,9 @@ A5(PRIVATE, void, cellhelper, AddOrRep, addorrep, Ptr, dp, INTEGER, dl, ep = ROMlib_getoffp(temp, list) + 1; ip_offset = (char *) ip - (char *) STARH (list); ep_offset = (char *) ep - (char *) STARH (list); - off0 = BigEndianValue(ip[0]) & 0x7FFF; - off1 = BigEndianValue(ip[1]) & 0x7FFF; - off2 = BigEndianValue(ep[0]) & 0x7FFF; + off0 = CW(ip[0]) & 0x7FFF; + off1 = CW(ip[1]) & 0x7FFF; + off2 = CW(ep[0]) & 0x7FFF; len = off1 - off0; /* @@ -107,7 +106,7 @@ A5(PRIVATE, void, cellhelper, AddOrRep, addorrep, Ptr, dp, INTEGER, dl, if (delta) { while (++ip <= ep) - *ip = BigEndianValue(BigEndianValue(*ip) + (delta)); + *ip = CW(CW(*ip) + (delta)); } if (Hx(list, listFlags) & DODRAW) C_LDraw(cell, list); @@ -133,13 +132,13 @@ P4(PUBLIC pascal trap, void, LGetCell, Ptr, dp, INTEGER *, dlp, /* IMIV-272 */ INTEGER ntomove; if ((ip = ROMlib_getoffp(cell, list))) { - off1 = BigEndianValue(*ip++) & 0x7fff; - off2 = BigEndianValue(*ip) & 0x7fff; + off1 = CW(*ip++) & 0x7fff; + off2 = CW(*ip) & 0x7fff; ntomove = off2 - off1; - if (ntomove > BigEndianValue(*dlp)) - ntomove = BigEndianValue(*dlp); + if (ntomove > CW(*dlp)) + ntomove = CW(*dlp); BlockMove((Ptr) STARH(HxP(list, cells)) + off1, dp, (Size) ntomove); - *dlp = BigEndianValue(ntomove); + *dlp = CW(ntomove); } } @@ -158,29 +157,29 @@ P2(PUBLIC pascal trap, void, LCellSize, Point, csize, /* IMIV-273 */ INTEGER nh, nv; lp = STARH(list); - if (!(lp->cellSize.h = BigEndianValue(csize.h))) - lp->cellSize.h = BigEndianValue((BigEndianValue(lp->rView.right) - BigEndianValue(lp->rView.left)) / - MAX(1, (BigEndianValue(lp->dataBounds.right) - - BigEndianValue(lp->dataBounds.left)))); - if (!(lp->cellSize.v = BigEndianValue(csize.v))) { + if (!(lp->cellSize.h = CW(csize.h))) + lp->cellSize.h = CW((CW(lp->rView.right) - CW(lp->rView.left)) / + MAX(1, (CW(lp->dataBounds.right) + - CW(lp->dataBounds.left)))); + if (!(lp->cellSize.v = CW(csize.v))) { gp = thePort; SetPort(MR(lp->port)); GetFontInfo(&fi); lp = STARH(list); /* could have moved */ - lp->cellSize.v = BigEndianValue(BigEndianValue(fi.ascent) + BigEndianValue(fi.descent) + BigEndianValue(fi.leading)); + lp->cellSize.v = CW(CW(fi.ascent) + CW(fi.descent) + CW(fi.leading)); SetPort(gp); } lp->visible.right = lp->dataBounds.right; lp->visible.bottom = lp->dataBounds.bottom; - nh = (BigEndianValue(lp->rView.right) - BigEndianValue(lp->rView.left) + BigEndianValue(lp->cellSize.h) - 1) / - BigEndianValue(lp->cellSize.h); - nv = (BigEndianValue(lp->rView.bottom) - BigEndianValue(lp->rView.top) + BigEndianValue(lp->cellSize.v) - 1) / - BigEndianValue(lp->cellSize.v); - if (BigEndianValue(lp->visible.right) - BigEndianValue(lp->visible.left) > nh) - lp->visible.right = BigEndianValue(BigEndianValue(lp->visible.left) + nh); - - if (BigEndianValue(lp->visible.bottom) - BigEndianValue(lp->visible.top) > nv) - lp->visible.bottom = BigEndianValue(BigEndianValue(lp->visible.top) + nv); + nh = (CW(lp->rView.right) - CW(lp->rView.left) + CW(lp->cellSize.h) - 1) / + CW(lp->cellSize.h); + nv = (CW(lp->rView.bottom) - CW(lp->rView.top) + CW(lp->cellSize.v) - 1) / + CW(lp->cellSize.v); + if (CW(lp->visible.right) - CW(lp->visible.left) > nh) + lp->visible.right = CW(CW(lp->visible.left) + nh); + + if (CW(lp->visible.bottom) - CW(lp->visible.top) > nv) + lp->visible.bottom = CW(CW(lp->visible.top) + nv); { ControlHandle control; @@ -216,11 +215,11 @@ P3(PUBLIC pascal trap, BOOLEAN, LGetSelect, BOOLEAN, next, /* IMIV-273 */ if (!list || !cellp) retval = FALSE; else if (next) { - c.h = BigEndianValue(cellp->h); - c.v = BigEndianValue(cellp->v); + c.h = CW(cellp->h); + c.v = CW(cellp->v); if (!(ip = ROMlib_getoffp(c, list))) { temp.h = 0; - temp.h = BigEndianValue(cellp->v) + 1; + temp.h = CW(cellp->v) + 1; ip = ROMlib_getoffp(temp, list); } if (!ip) @@ -229,7 +228,7 @@ P3(PUBLIC pascal trap, BOOLEAN, LGetSelect, BOOLEAN, next, /* IMIV-273 */ temp.h = Hx(list, dataBounds.right) - 1; temp.v = Hx(list, dataBounds.bottom) - 1; ep = ROMlib_getoffp(temp, list) + 1; - while (ip != ep && !(BigEndianValue(*ip) & 0x8000)) + while (ip != ep && !(CW(*ip) & 0x8000)) ip++; if (ip == ep) retval = FALSE; @@ -238,18 +237,18 @@ P3(PUBLIC pascal trap, BOOLEAN, LGetSelect, BOOLEAN, next, /* IMIV-273 */ ncols = Hx(list, dataBounds.right) - Hx(list, dataBounds.left); rown = nint / ncols; coln = nint % ncols; - cellp->v = BigEndianValue(Hx(list, dataBounds.top) + rown); - cellp->h = BigEndianValue(Hx(list, dataBounds.left) + coln); + cellp->v = CW(Hx(list, dataBounds.top) + rown); + cellp->h = CW(Hx(list, dataBounds.left) + coln); retval = TRUE; } } } else { - p.h = BigEndianValue(cellp->h); - p.v = BigEndianValue(cellp->v); + p.h = CW(cellp->h); + p.v = CW(cellp->v); if (!(ip = ROMlib_getoffp(p, list))) retval = FALSE; else - retval = (BigEndianValue(*ip) & 0x8000) ? TRUE : FALSE; + retval = (CW(*ip) & 0x8000) ? TRUE : FALSE; } return retval; } diff --git a/src/listStdLDEF.cpp b/src/listStdLDEF.cpp index c874c1be..e9422c91 100644 --- a/src/listStdLDEF.cpp +++ b/src/listStdLDEF.cpp @@ -16,8 +16,6 @@ namespace Executor { void C_ldef0(INTEGER, BOOLEAN, Rect*, Cell, INTEGER, INTEGER, ListHandle); } -using namespace ByteSwap; - A5(PRIVATE, void, draw, BOOLEAN, sel, Rect *, rect, INTEGER, doff, INTEGER, dl, ListHandle, list) { @@ -27,7 +25,7 @@ A5(PRIVATE, void, draw, BOOLEAN, sel, Rect *, rect, INTEGER, doff, savePort = thePort; SetPort(HxP(list, port)); EraseRect(rect); - MoveTo(BigEndianValue(rect->left) + Hx(list, indent.h), BigEndianValue(rect->top) + Hx(list, indent.v)); + MoveTo(CW(rect->left) + Hx(list, indent.h), CW(rect->top) + Hx(list, indent.v)); HLock((Handle) HxP(list, cells)); DrawText((Ptr) STARH(HxP(list, cells)) + doff, 0, dl); HUnlock((Handle) HxP(list, cells)); diff --git a/src/main.cpp b/src/main.cpp index fb8abc9a..9cf0713f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -114,6 +114,10 @@ namespace Executor { void NeXTMain(); } #endif +namespace Executor { + PRIVATE void setstartdir(char *); +} + #include @@ -543,7 +547,6 @@ extern void willsetperms( void ); extern void badfilesystem( void ); namespace Executor { PRIVATE void misc_self_examination(char*); - PRIVATE void setstartdir(char *); } A1(PRIVATE, void, misc_self_examination, char *, us) @@ -581,7 +584,7 @@ A1(PRIVATE, void, misc_self_examination, char *, us) exit(6); } - if (fseek(ROMlib_fp, BigEndianValue(arch.offset), SEEK_SET) == -1) { + if (fseek(ROMlib_fp, CL(arch.offset), SEEK_SET) == -1) { fprintf(stderr, "couldn't seek after load seg command\n"); exit(17); } @@ -899,7 +902,7 @@ setup_trap_vectors (void) /* Set up the trap vector for the timer interrupt. */ timer_callback = callback_install (catchalarm, NULL); - *(syn68k_addr_t *)SYN68K_TO_US(M68K_TIMER_VECTOR * 4) = BigEndianValue (timer_callback); + *(syn68k_addr_t *)SYN68K_TO_US(M68K_TIMER_VECTOR * 4) = CL (timer_callback); /* Fill in unhandled trap vectors so they cause graceful deaths. * Skip over those trap vectors which are known to have legitimate @@ -931,7 +934,7 @@ setup_trap_vectors (void) { syn68k_addr_t c; c = callback_install (unhandled_trap, (void *) i); - *(syn68k_addr_t *)SYN68K_TO_US(i * 4) = BigEndianValue (c); + *(syn68k_addr_t *)SYN68K_TO_US(i * 4) = CL (c); } } #endif /* SYN68K */ @@ -1195,10 +1198,10 @@ zap_comments (char *buf, int n_left) char *s; \ char *retval; \ \ - s = alloca (2 + strlen(filename) + 1); \ + s = (char*)alloca (2 + strlen(filename) + 1); \ sprintf (s, "+/%s", filename); \ s = copystr (s); \ - retval = alloca (strlen (s) + 1); \ + retval = (char*)alloca (strlen (s) + 1); \ strcpy (retval, s); \ free (s); \ retval; \ @@ -1448,7 +1451,7 @@ int main(int argc, char** argv) ROMlib_set_use_scancodes (TRUE); #endif -#if defined (SDL) +#if defined (Sound_SDL_Sound) if (opt_val (common_db, "sdlaudio", &arg)) ROMlib_set_sdl_audio_driver_name (arg); @@ -1894,7 +1897,7 @@ int main(int argc, char** argv) MenuList = 0; MBSaveLoc = 0; - SysVersion = BigEndianValue (system_version); + SysVersion = CW (system_version); FSFCBLen = CWC (94); ScrapState = CWC (-1); @@ -1934,7 +1937,7 @@ int main(int argc, char** argv) UTableBase = (DCtlHandlePtr) (long) RM (NewPtr (sizeof (UTableBase[0].p) * NDEVICES)); memset (MR (UTableBase), 0, sizeof (UTableBase[0].p) * NDEVICES); - UnitNtryCnt = BigEndianValue (NDEVICES); + UnitNtryCnt = CW (NDEVICES); TheZone = ApplZone; if (graphics_p) { @@ -1946,13 +1949,13 @@ int main(int argc, char** argv) make_rgb_spec (&mac_16bpp_rgb_spec, 16, TRUE, 0, 5, 10, 5, 5, 5, 0, - BigEndianValue (GetCTSeed ())); - + CL (GetCTSeed ())); + make_rgb_spec (&mac_32bpp_rgb_spec, - 32, TRUE, 0, - 8, 16, 8, 8, 8, 0, - BigEndianValue (GetCTSeed ())); - + 32, TRUE, 0, + 8, 16, 8, 8, 8, 0, + CL (GetCTSeed ())); + gd_allocate_main_device (); } @@ -2082,7 +2085,9 @@ int main(int argc, char** argv) complain_if_no_ghostscript (); #endif +#ifdef MACOSX_ NeXTMain(); +#endif executor_main (); diff --git a/src/menu.cpp b/src/menu.cpp index d051b641..c39024d2 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -47,7 +47,6 @@ char ROMlib_rcsid_menu[] = #include "rsys/stubify.h" using namespace Executor; -using namespace ByteSwap; typedef pascal void (*menuhookp)( void ); @@ -105,7 +104,7 @@ P0(PUBLIC pascal trap, void, DrawMenuBar) Hx(MENULIST, muoff) + sizeof(muelem) + 4)) #define HIEROFF \ - BigEndianValue(HIEROFFX) + CW(HIEROFFX) #define MINMENULISTSIZE ((Size) sizeof(INTEGER) * 4 + sizeof(HIDDEN_Handle)) @@ -183,7 +182,7 @@ P0(PUBLIC pascal trap, void, InitMenus) { int n_entries; - n_entries = BigEndianValue (*(uint16 *) STARH (default_mcinfo)); + n_entries = CW (*(uint16 *) STARH (default_mcinfo)); MenuCInfo = (MCTableHandle) RM (NewHandle (n_entries * sizeof (MCEntry))); BlockMove ((Ptr) (&((uint16 *) STARH (default_mcinfo))[1]), @@ -207,7 +206,7 @@ P2(PUBLIC pascal trap, MenuHandle, NewMenu, INTEGER, mid, StringPtr, str) if (!str) str = (StringPtr) ""; retval = (MenuHandle) NewHandle((Size) SIZEOFMINFO + U(str[0]) + 1); - HxX(retval, menuID) = BigEndianValue(mid); + HxX(retval, menuID) = CW(mid); HxX(retval, menuWidth) = HxX(retval, menuHeight) = 0; /* menuHeight calculated elsewhere */ SetResLoad(TRUE); @@ -269,14 +268,14 @@ P1 (PUBLIC pascal trap, MenuHandle, GetMenu, int16, rid) entry.mctReserved = 0; mct_res = (mct_res_t *) STARH (mct_res_h); - for (i = 0; i < BigEndianValue (mct_res->n_entries); i ++) + for (i = 0; i < CW (mct_res->n_entries); i ++) { memcpy (&entry, &mct_res->entries[i], sizeof mct_res->entries[i]); SetMCEntries (1, &entry); } */ mct_res = (mct_res_t *) STARH (mct_res_h); - SetMCEntries (BigEndianValue (mct_res->n_entries), + SetMCEntries (CW (mct_res->n_entries), &mct_res->entries[0]); }); @@ -292,7 +291,7 @@ P1 (PUBLIC pascal trap, MenuHandle, GetMenu, int16, rid) MemErr = CWC (noErr); temph = GetResource (TICK("MDEF"), - BigEndianValue (*(int16 *)&HxX(retval, menuProc))); + CW (*(int16 *)&HxX(retval, menuProc))); if (SIZEOFMINFO != 15) Munger ((Handle) retval, (int32) 6, (Ptr) 0, (int32) 0, (Ptr) "x", (int32) 2); @@ -350,9 +349,9 @@ A7(PRIVATE, void, app, StringPtr, str, char, icon, char, marker, eip->menitem++; if (disflag) - STARH(eip->menh)->enableFlags &= BigEndianValue(~((LONGINT)1 << eip->menitem)); + STARH(eip->menh)->enableFlags &= CL(~((LONGINT)1 << eip->menitem)); else - STARH(eip->menh)->enableFlags |= BigEndianValue((LONGINT)1 << eip->menitem); + STARH(eip->menh)->enableFlags |= CL((LONGINT)1 << eip->menitem); newsize = eip->menoff + SIZEOFMEXT + 1 + U(str[0]); SetHandleSize((Handle) eip->menh, newsize); /* @@ -583,7 +582,7 @@ P2(PUBLIC pascal trap, void, DelMenuItem, MenuHandle, mh, /* IMIV-56 */ if (item < 32) { unchangedmask = (1L << item) - 1; /* 2s complement dependent */ HxX(mh, enableFlags) = - BigEndianValue(((Hx(mh, enableFlags) >> 1) & ~unchangedmask) | + CL(((Hx(mh, enableFlags) >> 1) & ~unchangedmask) | (Hx(mh, enableFlags) & unchangedmask) | 0x80000000); } @@ -641,7 +640,7 @@ A4(PRIVATE, void, xInsertResMenu, MenuHandle, mh, StringPtr, str, ep = sp + hsize; while (sp != ep) *dp++ = *sp++; - HxX(mh, enableFlags) = BigEndianValue(Hx(mh, enableFlags) | + HxX(mh, enableFlags) = CL(Hx(mh, enableFlags) | oldeflags << (endinf.menitem - after)); #if 0 /* RagTime suggests that at least for InsMenuItem */ /* CalcMenuSize shouldn't be called */ @@ -684,7 +683,7 @@ P2(PUBLIC pascal trap, void, InsertMenu, MenuHandle, mh, INTEGER, before) { mpend = HxX(MENULIST, mulist) + HIEROFF / sizeof(muelem); for (mp = FIRSTHIER; - mp != mpend && (BigEndianValue(STARH(MR(mp->muhandle))->menuID) != mid1); + mp != mpend && (CW(STARH(MR(mp->muhandle))->menuID) != mid1); mp++) ; if (mp != mpend) /* already there */ @@ -700,7 +699,7 @@ P2(PUBLIC pascal trap, void, InsertMenu, MenuHandle, mh, INTEGER, before) mpend = HxX(MENULIST, mulist) + Hx(MENULIST, muoff) / sizeof(muelem); for (mp = HxX(MENULIST, mulist); mp != mpend; mp++) { - if ((mid2 = BigEndianValue(STARH(MR(mp->muhandle))->menuID)) == mid1) + if ((mid2 = CW(STARH(MR(mp->muhandle))->menuID)) == mid1) /*-->*/ return; if (mid2 == before) bindex = mp; @@ -721,10 +720,10 @@ P2(PUBLIC pascal trap, void, InsertMenu, MenuHandle, mh, INTEGER, before) Munger(MR(MenuList), binoff, (Ptr) 0, (LONGINT) 0, (Ptr) &newmuelem, (LONGINT) sizeof(newmuelem)); } - HxX(MENULIST, muoff) = BigEndianValue(Hx(MENULIST, muoff) + sizeof(muelem)); + HxX(MENULIST, muoff) = CW(Hx(MENULIST, muoff) + sizeof(muelem)); MBDFCALL(mbCalc, 0, binoff); } - HIEROFFX = BigEndianValue(HIEROFF + sizeof(muelem)); + HIEROFFX = CW(HIEROFF + sizeof(muelem)); } } @@ -737,7 +736,7 @@ P1 (PUBLIC pascal trap, void, DeleteMenu, int16, mid) mpend = HxX(MENULIST, mulist) + Hx(MENULIST, muoff) / sizeof(muelem); for (mp = HxX(MENULIST, mulist); - mp != mpend && BigEndianValue(STARH(MR(mp->muhandle))->menuID) != mid; + mp != mpend && CW(STARH(MR(mp->muhandle))->menuID) != mid; mp++) ; if (mp != mpend) @@ -745,14 +744,14 @@ P1 (PUBLIC pascal trap, void, DeleteMenu, int16, mid) deleteloc = (LONGINT) ((char *)mp - (char *)STARH(MR(MenuList))); Munger (MR (MenuList), deleteloc, (Ptr) 0, (int32) sizeof (muelem), (Ptr) "", (int32) 0); - HxX(MENULIST, muoff) = BigEndianValue(Hx(MENULIST, muoff) - sizeof(muelem)); + HxX(MENULIST, muoff) = CW(Hx(MENULIST, muoff) - sizeof(muelem)); MBDFCALL(mbCalc, 0, deleteloc); } else { mpend = HxX(MENULIST, mulist) + HIEROFF / sizeof(muelem); for (mp = FIRSTHIER; - mp != mpend && (BigEndianValue(STARH(MR(mp->muhandle))->menuID) != mid); + mp != mpend && (CW(STARH(MR(mp->muhandle))->menuID) != mid); mp++) ; if (mp == mpend) @@ -761,7 +760,7 @@ P1 (PUBLIC pascal trap, void, DeleteMenu, int16, mid) (int32) ((char *)mp - (char *) STARH (MR (MenuList))), (Ptr) 0, (int32) sizeof(muelem), (Ptr) "", (int32) 0); } - HIEROFFX = BigEndianValue (HIEROFF - sizeof (muelem)); + HIEROFFX = CW (HIEROFF - sizeof (muelem)); } typedef mbartype *mbarptr; @@ -848,7 +847,7 @@ menu_id_exists_p (int id) initpairs (mps); for (mp = mps[nonhier].startp; mp != mps[nonhier].endp; mp ++) { - if (BigEndianValue (STARH (MR (mp->muhandle))->menuID) == id) + if (CW (STARH (MR (mp->muhandle))->menuID) == id) return TRUE; } return FALSE; @@ -863,7 +862,7 @@ A1(PUBLIC, INTEGER, ROMlib_mentosix, INTEGER, menuid) initpairs(mps); for (i = (int) nonhier; i <= (int) hier; i++) { for (mp = mps[i].startp, mpend = mps[i].endp; - mp < mpend && BigEndianValue(STARH(MR(mp->muhandle))->menuID) != menuid; mp++) + mp < mpend && CW(STARH(MR(mp->muhandle))->menuID) != menuid; mp++) ; if (mp < mpend) /*-->*/ return (char *) mp - (char *) STARH(MR(MenuList)); @@ -886,10 +885,10 @@ A2(PRIVATE, BOOLEAN, mtoggle, INTEGER, mid, highstate, h) P1 (PUBLIC pascal trap, void, HiliteMenu, INTEGER, mid) { - if (mid != BigEndianValue (TheMenu)) + if (mid != CW (TheMenu)) { if (TheMenu) - mtoggle (BigEndianValue (TheMenu), RESTORE); + mtoggle (CW (TheMenu), RESTORE); if (! menu_id_exists_p (mid)) mid = 0; if (mid) @@ -899,7 +898,7 @@ P1 (PUBLIC pascal trap, void, HiliteMenu, INTEGER, mid) mtoggle (mid, HILITE); } } - TheMenu = BigEndianValue (mid); + TheMenu = CW (mid); } A1(static inline, void, ROMlib_CALLMENUHOOK, menuhookp, fp) @@ -933,10 +932,10 @@ A1(PRIVATE, INTEGER, wheretowhich, LONGINT, offset) A1(PRIVATE, void, shadowrect, Rect *, rp) { - rp->top = BigEndianValue(BigEndianValue(rp->top) - 1); - rp->left = BigEndianValue(BigEndianValue(rp->left) - 1); - rp->bottom = BigEndianValue(BigEndianValue(rp->bottom) + 2); - rp->right = BigEndianValue(BigEndianValue(rp->right) + 2); + rp->top = CW(CW(rp->top) - 1); + rp->left = CW(CW(rp->left) - 1); + rp->bottom = CW(CW(rp->bottom) + 2); + rp->right = CW(CW(rp->right) + 2); } A3(PRIVATE, void, restoren, INTEGER, ntodrop, RgnHandle, restoredrgn, @@ -978,7 +977,7 @@ A2(PRIVATE, MenuHandle, menunumtomh, INTEGER, mid, INTEGER *, sixp) mpend = HxX(MENULIST, mulist) + HIEROFF / sizeof(muelem); for (mp = FIRSTHIER; mp != mpend && - BigEndianValue(STARH(MR(mp->muhandle))->menuID) != mid; mp++) + CW(STARH(MR(mp->muhandle))->menuID) != mid; mp++) ; if (mp != mpend) { *sixp = (char *) mp - (char *)STARH(MR(MenuList)); @@ -1045,8 +1044,8 @@ int32 Executor::ROMlib_menuhelper (MenuHandle mh, Rect *saverp, while (!done) { GetMouse (&pt); - pt.h = BigEndianValue (pt.h); - pt.v = BigEndianValue (pt.v); + pt.h = CW (pt.h); + pt.v = CW (pt.v); pointaslong = ((int32) pt.v << 16) | (unsigned short) pt.h; where = MBDFCALL (mbHit, 0, pointaslong); if (MenuHook) @@ -1057,9 +1056,9 @@ int32 Executor::ROMlib_menuhelper (MenuHandle mh, Rect *saverp, { PORT_TX_FACE_X (MR (wmgr_port)) = (Style) CB (0); PORT_TX_FONT_X (MR (wmgr_port)) = CWC (0); - item = BigEndianValue(item); + item = CW(item); MENUCALL (mChooseMsg, mh, &r, pt, &item); - item = BigEndianValue(item); + item = CW(item); if (item != olditem || changedmenus) { if (firstitem == -1) @@ -1083,9 +1082,9 @@ int32 Executor::ROMlib_menuhelper (MenuHandle mh, Rect *saverp, item = olditem; PORT_TX_FACE_X (MR (wmgr_port)) = (Style) CB (0); PORT_TX_FONT_X (MR (wmgr_port)) = CWC (0); - item = BigEndianValue(item); + item = CW(item); MENUCALL (mChooseMsg, mh, &r, pt, &item); - item = BigEndianValue(item); + item = CW(item); DisposeRgn (PORT_CLIP_REGION (MR (wmgr_port))); PORT_CLIP_REGION_X (MR (wmgr_port)) = saveclip; } @@ -1177,9 +1176,9 @@ int32 Executor::ROMlib_menuhelper (MenuHandle mh, Rect *saverp, { MR (wmgr_port)->txFace = (Style) 0; MR (wmgr_port)->txFont = 0; - item = BigEndianValue(item); + item = CW(item); MENUCALL(mChooseMsg, mh, &r, pt, &item); - item = BigEndianValue(item); + item = CW(item); } else item = 0; @@ -1191,8 +1190,8 @@ int32 Executor::ROMlib_menuhelper (MenuHandle mh, Rect *saverp, whichmenuhit = wheretowhich(where); newentry = (mbdfentry *)STARH(MR(MBSaveLoc)) + whichmenuhit; oldentry = (mbdfentry *)STARH(MR(MBSaveLoc)) + oldwhichmenuhit; - oldentry->mbReserved = BigEndianValue((ULONGINT)item); - olditem = item = BigEndianValue(newentry->mbReserved); + oldentry->mbReserved = CL((ULONGINT)item); + olditem = item = CL(newentry->mbReserved); changedmenus = TRUE; mh = MR(((muelem *) ((char *)STARH(MR(MenuList)) + where))->muhandle); templ = where; @@ -1245,9 +1244,9 @@ int32 Executor::ROMlib_menuhelper (MenuHandle mh, Rect *saverp, tempp.h = 0; PORT_TX_FACE_X (MR (wmgr_port)) = (Style) CB (0); PORT_TX_FONT_X (MR (wmgr_port)) = CWC (0); - tempi = BigEndianValue(tempi); + tempi = CW(tempi); MENUCALL(mChooseMsg, mh, &r, tempp, &tempi); - tempi = BigEndianValue(tempi); + tempi = CW(tempi); #if !defined(MACOSX_) if (MenuFlash) { @@ -1256,15 +1255,15 @@ int32 Executor::ROMlib_menuhelper (MenuHandle mh, Rect *saverp, Delay(3L, (LONGINT *) 0); PORT_TX_FACE_X (MR (wmgr_port)) = (Style) CB (0); PORT_TX_FONT_X (MR (wmgr_port)) = CWC (0); - tempi = BigEndianValue(tempi); + tempi = CW(tempi); MENUCALL(mChooseMsg, mh, &r, pt, &tempi); - tempi = BigEndianValue(tempi); + tempi = CW(tempi); Delay(3L, (LONGINT *) 0); PORT_TX_FACE_X (MR (wmgr_port)) = (Style) CB (0); PORT_TX_FONT_X (MR (wmgr_port)) = CWC (0); - tempi = BigEndianValue(tempi); + tempi = CW(tempi); MENUCALL(mChooseMsg, mh, &r, tempp, &tempi); - tempi = BigEndianValue(tempi); + tempi = CW(tempi); } Delay(3L, (LONGINT *) 0); } @@ -1332,7 +1331,7 @@ P1(PUBLIC pascal trap, void, FlashMenuBar, INTEGER, mid) TheMenu = 0; } else { l |= (LONGINT) HILITE << 16; - TheMenu = BigEndianValue(mid); + TheMenu = CW(mid); } MBDFCALL(mbHilite, 0, l); } @@ -1486,13 +1485,13 @@ P3(PUBLIC pascal trap, void, GetItem, MenuHandle, mh, INTEGER, item, P2(PUBLIC pascal trap, void, DisableItem, MenuHandle, mh, INTEGER, item) { if (mh) - HxX(mh, enableFlags) = BigEndianValue(Hx(mh, enableFlags) & ~((LONGINT)1<mmarker); + *markp = CW((INTEGER) (unsigned char) mep->mmarker); } P3(PUBLIC pascal trap, void, SetItemIcon, MenuHandle, mh, INTEGER, item, @@ -1542,7 +1541,7 @@ P3(PUBLIC pascal trap, void, GetItemIcon, MenuHandle, mh, INTEGER, item, mextp mep; if ((mep = ROMlib_mitemtop(mh, item, (StringPtr *) 0))) - *iconp = BigEndianValue((INTEGER) (unsigned char) Cx(mep->micon)); + *iconp = CW((INTEGER) (unsigned char) Cx(mep->micon)); } P3(PUBLIC pascal trap, void, SetItemStyle, MenuHandle, mh, INTEGER, item, @@ -1562,7 +1561,7 @@ P3(PUBLIC pascal trap, void, GetItemStyle, MenuHandle, mh, INTEGER, item, mextp mep; if ((mep = ROMlib_mitemtop(mh, item, (StringPtr *) 0))) - *stylep = BigEndianValue((INTEGER) (unsigned char) Cx(mep->mstyle)); + *stylep = CW((INTEGER) (unsigned char) Cx(mep->mstyle)); } P1(PUBLIC pascal trap, INTEGER, CountMItems, MenuHandle, mh) @@ -1588,7 +1587,7 @@ P1(PUBLIC pascal trap, MenuHandle, GetMHandle, INTEGER, mid) mpend = HxX(MENULIST, mulist) + HIEROFF / sizeof(muelem); for (mp = FIRSTHIER; - mp != mpend && BigEndianValue(STARH(MR(mp->muhandle))->menuID) != mid; mp++) + mp != mpend && CW(STARH(MR(mp->muhandle))->menuID) != mid; mp++) ; if (mp != mpend) retval = MR(mp->muhandle); @@ -1596,7 +1595,7 @@ P1(PUBLIC pascal trap, MenuHandle, GetMHandle, INTEGER, mid) { mpend = HxX(MENULIST, mulist) + Hx(MENULIST, muoff) / sizeof(muelem); for (mp = HxX(MENULIST, mulist); - mp != mpend && BigEndianValue(STARH(MR(mp->muhandle))->menuID) != mid; mp++) + mp != mpend && CW(STARH(MR(mp->muhandle))->menuID) != mid; mp++) ; if (mp != mpend) retval = MR(mp->muhandle); @@ -1609,7 +1608,7 @@ P1(PUBLIC pascal trap, MenuHandle, GetMHandle, INTEGER, mid) P1(PUBLIC pascal trap, void, SetMenuFlash, INTEGER, i) { - MenuFlash = BigEndianValue(i); + MenuFlash = CW(i); } A0(PUBLIC, BOOLEAN, ROMlib_shouldalarm) diff --git a/src/menuV.cpp b/src/menuV.cpp index 050a69b8..18bc1563 100644 --- a/src/menuV.cpp +++ b/src/menuV.cpp @@ -23,7 +23,6 @@ char ROMlib_rcsid_menuV[] = #include "rsys/prefs.h" using namespace Executor; -using namespace ByteSwap; P1(PUBLIC pascal trap, void, InitProcMenu, INTEGER, mbid) { @@ -44,7 +43,7 @@ P1(PUBLIC pascal trap, void, InitProcMenu, INTEGER, mbid) * the bits are not masked off. */ MBDFHndl = RM(GetResource(TICK("MBDF"), mbid)); - HxX(MENULIST, mufu) = BigEndianValue(mbid); + HxX(MENULIST, mufu) = CW(mbid); MBDFCALL(mbInit, 0, 0L); } @@ -59,7 +58,7 @@ P3(PUBLIC pascal trap, void, GetItemCmd, MenuHandle, mh, INTEGER, item, mextp mep; if ((mep = ROMlib_mitemtop(mh, item, (StringPtr *) 0))) - *cmdp = BigEndianValue((unsigned short) (unsigned char) mep->mkeyeq); + *cmdp = CW((unsigned short) (unsigned char) mep->mkeyeq); } P3(PUBLIC pascal trap, void, SetItemCmd, MenuHandle, mh, INTEGER, item, @@ -119,7 +118,7 @@ P4(PUBLIC pascal trap, LONGINT, PopUpMenuSelect, MenuHandle, mh, INTEGER, top, THEPORT_SAVE_EXCURSION (MR (wmgr_port), { - tempi = BigEndianValue (tempi); + tempi = CW (tempi); MENUCALL (mPopUpRect, mh, &saver, p, &tempi); TopMenuItem = tempi; where = ROMlib_mentosix (Hx (mh, menuID)); diff --git a/src/mixed_mode.cpp b/src/mixed_mode.cpp index 94aef298..d1ec8c98 100644 --- a/src/mixed_mode.cpp +++ b/src/mixed_mode.cpp @@ -42,7 +42,7 @@ P3 (PUBLIC pascal trap, UniversalProcPtr, NewRoutineDescriptor, ProcPtr, proc, p->reserved2 = CBC (0); p->selectorInfo = CBC (0); p->routineCount = CWC (0); - p->routineRecords[0].procInfo = BigEndianValue (info); + p->routineRecords[0].procInfo = CL (info); p->routineRecords[0].reserved1 = CBC (0); p->routineRecords[0].ISA = CB (isa); p->routineRecords[0].routineFlags = CWC (kSelectorsAreNotIndexable); diff --git a/src/mkvol/mkvol.cpp b/src/mkvol/mkvol.cpp index 88bc06bd..8aa89d99 100644 --- a/src/mkvol/mkvol.cpp +++ b/src/mkvol/mkvol.cpp @@ -461,7 +461,7 @@ write_catalog (info_t * infop) } #define STR_ID 0 -#define STR_NAME "\pFinder 1.0" +#define STR_NAME "\012Finder 1.0" /* * NOTE: the "-1" below is because both the byte count and the null zero @@ -526,7 +526,8 @@ write_desktop (info_t * infop) } , CLC (DATLEN - sizeof (LONGINT)), - STR_NAME, + //STR_NAME, + { 10, 'F','i','n','d','e','r',' ','1','.','0'}, { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/src/mman.cpp b/src/mman.cpp index dd2e99bf..420ec2de 100644 --- a/src/mman.cpp +++ b/src/mman.cpp @@ -42,7 +42,10 @@ char ROMlib_rcsid_mman[] = #endif /* LINUX */ +#ifdef MACOSX_ #include +#endif + using namespace ByteSwap; @@ -616,7 +619,7 @@ MoreMasters (void) void print_free (void) { - printf ("%d %d\n", BigEndianValue (MR(ApplZone)->zcbFree), BigEndianValue (MR(SysZone)->zcbFree)); + printf ("%d %d\n", CL (MR(ApplZone)->zcbFree), CL (MR(SysZone)->zcbFree)); } #endif @@ -639,9 +642,9 @@ InitZone (ProcPtr pGrowZone, int16 cMoreMasters, zone->bkLim = RM ((Ptr) last_block); zone->purgePtr = CLC_NULL; zone->hFstFree = CLC_NULL; - zone->zcbFree = BigEndianValue ((uint32) limitPtr - (uint32) zone - 64); + zone->zcbFree = CL ((uint32) limitPtr - (uint32) zone - 64); zone->gzProc = RM (pGrowZone); - zone->moreMast = BigEndianValue (cMoreMasters); + zone->moreMast = CW (cMoreMasters); zone->flags = CWC (0); zone->minCBFree = CWC (0); zone->purgeProc = CLC_NULL; @@ -795,7 +798,7 @@ DisposHandle (Handle h) MM_SLAM ("entry"); if (TTS_HACK && - h == (Handle) (BigEndianValue (*(long *)SYN68K_TO_US (256)) + ROMlib_offset)) + h == (Handle) (CL (*(long *)SYN68K_TO_US (256)) + ROMlib_offset)) h = 0; if (h) @@ -937,7 +940,7 @@ SetHandleSize (Handle h, Size newsize) ROMlib_memnomove_p = save_memnomove_p; ZONE_ZCB_FREE_X (current_zone) - = BigEndianValue (ZONE_ZCB_FREE (current_zone) - PSIZE (nextblock)); + = CL (ZONE_ZCB_FREE (current_zone) - PSIZE (nextblock)); SETPSIZE (block, oldpsize + PSIZE (nextblock)); SETSIZEC (block, 0); @@ -1160,7 +1163,7 @@ ReallocHandle (Handle h, Size size) { SETPSIZE (oldb, newsize); ZONE_ZCB_FREE_X (current_zone) - = BigEndianValue (ZONE_ZCB_FREE (current_zone) - PSIZE (newb)); + = CL (ZONE_ZCB_FREE (current_zone) - PSIZE (newb)); ROMlib_setupblock (oldb, size, REL, h, state); goto done; } @@ -1353,7 +1356,7 @@ SetPtrSize (Ptr p, Size newsize) if (ROMlib_makespace (&nextblock, newsize - oldpsize)) { ZONE_ZCB_FREE_X (current_zone) - = BigEndianValue (ZONE_ZCB_FREE_X (current_zone) - PSIZE (nextblock)); + = CL (ZONE_ZCB_FREE_X (current_zone) - PSIZE (nextblock)); SETPSIZE (block, oldpsize + PSIZE (nextblock)); SETSIZEC (block, 0); @@ -2081,7 +2084,7 @@ ROMlib_installhandle (Handle sh, Handle dh) block_header_t *sb = HANDLE_TO_BLOCK (sh); ROMlib_freeblock (db); SETMASTER (dh, STARH (sh)); - BLOCK_LOCATION_OFFSET_X (sb) = BigEndianValue ((uint32) dh - (uint32) MR (TheZone)); + BLOCK_LOCATION_OFFSET_X (sb) = CL ((uint32) dh - (uint32) MR (TheZone)); sh->p = (Ptr) ZONE_HFST_FREE_X (MR (TheZone)); ZONE_HFST_FREE_X (MR (TheZone)) = RM ((Ptr) sh); } @@ -2094,7 +2097,7 @@ MemError (void) { MM_SLAM ("entry"); - return BigEndianValue (MemErr); + return CW (MemErr); } THz diff --git a/src/mmansubr.cpp b/src/mmansubr.cpp index c31f3613..89df08af 100644 --- a/src/mmansubr.cpp +++ b/src/mmansubr.cpp @@ -24,7 +24,6 @@ char ROMlib_rcsid_mmansubr[] = #include using namespace Executor; -using namespace ByteSwap; /* Attempts to notify the user of a catastrophic heap failure then exits. */ void @@ -298,7 +297,7 @@ addr_info (char *addr) return; /* blah */ - id = BigEndianValue (id); + id = CW (id); type = MR (type); res_name[res_name[0] + 1] = '\0'; @@ -602,10 +601,10 @@ Executor::ROMlib_setupblock (block_header_t *block, #endif if (olduse == FREE) - ZONE_ZCB_FREE_X (current_zone) = BigEndianValue (ZONE_ZCB_FREE (current_zone) + ZONE_ZCB_FREE_X (current_zone) = CL (ZONE_ZCB_FREE (current_zone) - PSIZE (block)); else - ZONE_ZCB_FREE_X (current_zone) = BigEndianValue (ZONE_ZCB_FREE (current_zone) + ZONE_ZCB_FREE_X (current_zone) = CL (ZONE_ZCB_FREE (current_zone) + oldsize - asize); } @@ -643,7 +642,7 @@ Executor::ROMlib_freeblock (block_header_t *block) THz current_zone; current_zone = MR (TheZone); - ZONE_ZCB_FREE_X (current_zone) = BigEndianValue (ZONE_ZCB_FREE (current_zone) + ZONE_ZCB_FREE_X (current_zone) = CL (ZONE_ZCB_FREE (current_zone) + PSIZE (block)); mm_set_block_fields_offset (block, FREE_BLOCK_STATE, FREE, 0, PSIZE (block), @@ -983,7 +982,7 @@ Executor::ROMlib_relalloc (Size size, block_header_t ** newblk) SETSIZEC (b, 0); SET_BLOCK_STATE (b, FREE_BLOCK_STATE); - ZONE_ZCB_FREE_X (current_zone) = BigEndianValue (ZONE_ZCB_FREE (current_zone) + ZONE_ZCB_FREE_X (current_zone) = CL (ZONE_ZCB_FREE (current_zone) + newsize); HeapEnd = (Ptr) ZONE_BK_LIM (current_zone); return noErr; diff --git a/src/notify.cpp b/src/notify.cpp index e864491e..6d7f84d1 100644 --- a/src/notify.cpp +++ b/src/notify.cpp @@ -14,7 +14,6 @@ char ROMlib_rcsid_notify[] = #include "rsys/hook.h" using namespace Executor; -using namespace ByteSwap; /* Forward declarations in NotifyMgr.h (DO NOT DELETE THIS LINE) */ @@ -53,7 +52,7 @@ A1(PUBLIC trap, OSErrRET, NMInstall, NMRecPtr, nmptr) savea0 = EM_A0; savea1 = EM_A1; PUSHADDR((LONGINT) (long) US_TO_SYN68K(nmptr)); - CALL_EMULATOR((syn68k_addr_t) BigEndianValue((long) nmptr->nmResp)); + CALL_EMULATOR((syn68k_addr_t) CL((long) nmptr->nmResp)); EM_D0 = saved0; EM_D1 = saved1; EM_D2 = saved2; diff --git a/src/option.mm b/src/option.cpp similarity index 97% rename from src/option.mm rename to src/option.cpp index f66ca078..aa759170 100644 --- a/src/option.mm +++ b/src/option.cpp @@ -18,8 +18,10 @@ #include "rsys/parsenum.h" #include "rsys/notmac.h" +#ifdef MACOSX_ #import #import +#endif using namespace Executor; using namespace std; @@ -334,7 +336,7 @@ } PRIVATE opt_val_t * -opt_lookup_helper (opt_database_t &db, string &opt) +opt_lookup_helper (opt_database_t &db, const string &opt) { opt_val_t *retval = nullptr; @@ -351,12 +353,12 @@ } opt_val_t * -opt_lookup (opt_database_t &db, string &opt) +opt_lookup (opt_database_t &db, const string &opt) { opt_val_t *retval; retval = opt_lookup_helper (db, opt); - +#ifdef MACOSX_ if (!retval || retval->t_val == "") { NSUserDefaults *defaults; @@ -382,12 +384,12 @@ } } } - +#endif return retval; } void -Executor::opt_put_val (opt_database_t &db, string &opt, string val, +Executor::opt_put_val (opt_database_t &db, const string &opt, string val, priority_t pri, int temp_val_p) { opt_val_t *opt_val = opt_lookup_helper (db, opt); @@ -416,7 +418,7 @@ } void -Executor::opt_put_int_val (opt_database_t &db, string &opt, int valint, +Executor::opt_put_int_val (opt_database_t &db, const string &opt, int valint, priority_t pri, int temp_val_p) { char *val, buf[256]; diff --git a/src/osevent.cpp b/src/osevent.cpp index 5ad6986d..8f3724b8 100644 --- a/src/osevent.cpp +++ b/src/osevent.cpp @@ -47,13 +47,14 @@ char ROMlib_rcsid_osevent[] = #include "rsys/string.h" #include "rsys/keyboard.h" +#if defined(MACOSX_) #include "contextswitch.h" +#endif #include "DialogMgr.h" #include "SegmentLdr.h" using namespace Executor; -using namespace ByteSwap; #define NEVENT 20 @@ -117,7 +118,7 @@ Executor::ROMlib_set_keyboard (const char *keyboardname) if (new_h) { GetResInfo (new_h, &kchr_id, 0, 0); - kchr_id = BigEndianValue (kchr_id); + kchr_id = CW (kchr_id); LoadResource (new_h); if (kchr_ptr) { @@ -188,7 +189,7 @@ Executor::ROMlib_xlate (INTEGER virt, INTEGER modifiers, boolean_t down_p) return retval; } -extern char ROMlib_started; +char ROMlib_started; /* flag used by Mac frontend */ A1(PUBLIC, void, ROMlib_eventinit, boolean_t, graphics_valid_p) /* INTERNAL */ { @@ -214,11 +215,11 @@ A1(PUBLIC, void, ROMlib_eventinit, boolean_t, graphics_valid_p) /* INTERNAL */ main_gd_bounds = &GD_BOUNDS (MR (MainDevice)); #if defined (MSDOS) - init_dos_events (BigEndianValue (main_gd_bounds->right), - BigEndianValue (main_gd_bounds->bottom)); + init_dos_events (CW (main_gd_bounds->right), + CW (main_gd_bounds->bottom)); #elif defined (EVENT_SVGALIB) - if (!event_init (BigEndianValue (main_gd_bounds->right), - BigEndianValue (main_gd_bounds->bottom))) + if (!event_init (CW (main_gd_bounds->right), + CW (main_gd_bounds->bottom))) { fprintf (stderr, "Unable to initialize svgalib events.\n" @@ -356,11 +357,11 @@ A3(PUBLIC trap, OSErrRET, PPostEvent, INTEGER, evcode, /* IMIV-85 */ if (!((1 << evcode)&Cx(SysEvtMask))) /*-->*/ return evtNotEnb; qp = geteventelem(); - qp->evtQWhat = BigEndianValue(evcode); - qp->evtQMessage = BigEndianValue(evmsg); - qp->evtQWhen = BigEndianValue(tmpticks); + qp->evtQWhat = CW(evcode); + qp->evtQMessage = CL(evmsg); + qp->evtQWhen = CL(tmpticks); qp->evtQWhere = ROMlib_curs; - qp->evtQModifiers = BigEndianValue(ROMlib_mods); + qp->evtQModifiers = CW(ROMlib_mods); Enqueue((QElemPtr) qp, &EventQueue); if (qelp) (*qelp).p = qp; @@ -398,8 +399,8 @@ A3(PRIVATE, OSErrRET, _PPostEvent, INTEGER, evcode, A6(PUBLIC, OSErrRET, ROMlib_PPostEvent, INTEGER, evcode, LONGINT, evmsg, HIDDEN_EvQElPtr *, qelp, LONGINT, when, Point, where, INTEGER, butmods) { - MouseLocation2.h = ROMlib_curs.h = BigEndianValue(where.h); - MouseLocation2.v = ROMlib_curs.v = BigEndianValue(where.v); + MouseLocation2.h = ROMlib_curs.h = CW(where.h); + MouseLocation2.v = ROMlib_curs.v = CW(where.v); ROMlib_mods = butmods; return _PPostEvent(evcode, evmsg, qelp); @@ -465,7 +466,7 @@ A3(PRIVATE, BOOLEAN, OSEventCommon, INTEGER, evmask, EventRecord *, eventp, (Ptr) &psn, sizeof psn, target); CountAppFiles (&dummy, &count); - count = BigEndianValue (count); + count = CW (count); if (count) { @@ -490,7 +491,7 @@ A3(PRIVATE, BOOLEAN, OSEventCommon, INTEGER, evmask, EventRecord *, eventp, TEMP_C_STRING_FROM_STR255 (file.fName)); #endif - FSMakeFSSpec (BigEndianValue (file.vRefNum), 0, file.fName, &spec); + FSMakeFSSpec (CW (file.vRefNum), 0, file.fName, &spec); AEPutPtr (list, i, typeFSS, (Ptr) &spec, sizeof spec); } @@ -556,7 +557,7 @@ A3(PRIVATE, BOOLEAN, OSEventCommon, INTEGER, evmask, EventRecord *, eventp, } retval = TRUE; } else { - eventp->when = BigEndianValue(TickCount()); + eventp->when = CL(TickCount()); { #if defined(X) || defined(MACOSX_) @@ -565,8 +566,8 @@ A3(PRIVATE, BOOLEAN, OSEventCommon, INTEGER, evmask, EventRecord *, eventp, LONGINT newmods; querypointerX(&x, &y, &newmods); - eventp->where.h = MouseLocation2.h = ROMlib_curs.h = BigEndianValue(x); - eventp->where.v = MouseLocation2.v = ROMlib_curs.v = BigEndianValue(y); + eventp->where.h = MouseLocation2.h = ROMlib_curs.h = CW(x); + eventp->where.v = MouseLocation2.v = ROMlib_curs.v = CW(y); } else #endif MouseLocation2 = eventp->where = ROMlib_curs; @@ -577,16 +578,16 @@ A3(PRIVATE, BOOLEAN, OSEventCommon, INTEGER, evmask, EventRecord *, eventp, LONGINT x, y; querypointerX (&x, &y, NULL); - eventp->where.h = MouseLocation2.h = ROMlib_curs.h = BigEndianValue (x); - eventp->where.v = MouseLocation2.v = ROMlib_curs.v = BigEndianValue (y); + eventp->where.h = MouseLocation2.h = ROMlib_curs.h = CW (x); + eventp->where.v = MouseLocation2.v = ROMlib_curs.v = CW (y); } #endif - eventp->modifiers = BigEndianValue(ROMlib_mods); + eventp->modifiers = CW(ROMlib_mods); if ((evmask & autoKeyMask) && lastdown != -1 && ticks > autoticks) { autoticks = ticks + Cx(KeyRepThresh); eventp->what = CWC(autoKey); - eventp->message = BigEndianValue(lastdown); + eventp->message = CL(lastdown); retval = TRUE; } else { eventp->what = CWC(nullEvent); @@ -630,7 +631,7 @@ A2(PUBLIC trap, BOOLEANRET, OSEventAvail, INTEGER, evmask, A1(PUBLIC trap, void, SetEventMask, INTEGER, evmask) { - SysEvtMask = BigEndianValue(evmask); + SysEvtMask = CW(evmask); } A0(PUBLIC, QHdrPtr, GetEvQHdr) diff --git a/src/osutil.cpp b/src/osutil.cpp index 87829beb..3a00e8e9 100644 --- a/src/osutil.cpp +++ b/src/osutil.cpp @@ -38,7 +38,6 @@ char ROMlib_rcsid_osutil[] = #endif using namespace Executor; -using namespace ByteSwap; /* * NOTE: HandToHand is not directly called by the outside world. @@ -625,7 +624,7 @@ A1(PUBLIC, void, GetTime, DateTimeRec *, d) LONGINT secs; GetDateTime(&secs); - Secs2Date(BigEndianValue(secs), d); + Secs2Date(CL(secs), d); } A1(PUBLIC, void, SetTime, DateTimeRec *, d) @@ -645,7 +644,7 @@ A0(PRIVATE, void, setdefaults) SPValid = VALID; SPAlarm = SPATalkB = SPATalkA = SPConfig = 0; SPPrint = SPPortB = SPPortA = CW(baud9600 | stop10 | data8 | noParity); - SPFont = BigEndianValue(geneva - 1); + SPFont = CW(geneva - 1); SPKbd = 0x63; SPVolCtl = 3; SPClikCaret = 0x88; @@ -694,11 +693,11 @@ A0(PRIVATE, void, deriveglobals) (tmg.tm_min * 60) + tmg.tm_sec; ROMlib_GMTcorrect = gmtimenow - ltimenow; - KeyThresh = BigEndianValue((short) ((SPKbd >> 4) & 0xF) * 4); - KeyRepThresh = BigEndianValue((short) (SPKbd & 0xF) * 4); - MenuFlash = BigEndianValue((short) (SPMisc2 >> 2) & 3); - CaretTime = BigEndianValue((short) (SPClikCaret & 0xF) * 4); - DoubleTime = BigEndianValue((short) (SPClikCaret & 0xF0) / 4); + KeyThresh = CW((short) ((SPKbd >> 4) & 0xF) * 4); + KeyRepThresh = CW((short) (SPKbd & 0xF) * 4); + MenuFlash = CW((short) (SPMisc2 >> 2) & 3); + CaretTime = CL((short) (SPClikCaret & 0xF) * 4); + DoubleTime = CL((short) (SPClikCaret & 0xF0) / 4); } A0(PUBLIC trap, OSErrRET, InitUtil) /* IMII-380 */ @@ -724,10 +723,10 @@ A0(PUBLIC trap, OSErrRET, InitUtil) /* IMII-380 */ SPPortB = sp.portB; SPAlarm = sp.alarm; SPFont = sp.font; - SPKbd = BigEndianValue(sp.kbdPrint) >> 8; - SPPrint = BigEndianValue(sp.kbdPrint); - SPVolCtl = BigEndianValue(sp.volClik) >> 8; - SPClikCaret = BigEndianValue(sp.volClik); + SPKbd = CW(sp.kbdPrint) >> 8; + SPPrint = CW(sp.kbdPrint); + SPVolCtl = CW(sp.volClik) >> 8; + SPClikCaret = CW(sp.volClik); #if !defined (BIGENDIAN) SPMisc2 = sp.misc; #else @@ -770,8 +769,8 @@ A0(PUBLIC trap, OSErrRET, WriteParam) /* IMII-382 */ sp.portB = SPPortB; sp.alarm = SPAlarm; sp.font = SPFont; - sp.kbdPrint = BigEndianValue((short) (SPKbd << 8) | (SPPrint & 0xff)); - sp.volClik = BigEndianValue((short) (SPVolCtl << 8) | (SPClikCaret & 0xff)); + sp.kbdPrint = CW((short) (SPKbd << 8) | (SPPrint & 0xff)); + sp.volClik = CW((short) (SPVolCtl << 8) | (SPClikCaret & 0xff)); #if !defined (BIGENDIAN) sp.misc = SPMisc2; #else @@ -835,9 +834,9 @@ A2(PUBLIC, LONGINT, NGetTrapAddress, INTEGER, n, INTEGER, ttype) /* IMII-384 */ LONGINT retval; retval = (LONGINT) ((ttype == OSTrap) ? - (LONGINT) BigEndianValue((int) ostraptable[n&(NOSENTRIES-1)]) + (LONGINT) CL((long) ostraptable[n&(NOSENTRIES-1)]) : - (LONGINT) BigEndianValue((int) tooltraptable[n&(NTOOLENTRIES-1)])); + (LONGINT) CL((long) tooltraptable[n&(NTOOLENTRIES-1)])); warning_trace_info ("n = 0x%x, ttype = %d, retval = %p", (uint16) n, ttype, (void *) retval); return retval; @@ -1001,12 +1000,12 @@ A2(PUBLIC trap, OSErrRET, SysEnvirons, INTEGER, vers, SysEnvRecPtr, p) if (vers <= 0) /*-->*/ return envBadVers; - p->environsVersion = BigEndianValue (vers); + p->environsVersion = CW (vers); p->machineType = CWC (53); p->systemVersion = SysVersion; #if !defined (SYN68K) - p->processor = BigEndianValue(ROMlib_processor); + p->processor = CW(ROMlib_processor); p->hasFPU = ROMlib_hasFPU; #else /* SYN68K */ p->processor = CWC(env68040); diff --git a/src/parseopt.cpp b/src/parseopt.cpp index f58a0f54..2155e4ec 100644 --- a/src/parseopt.cpp +++ b/src/parseopt.cpp @@ -17,6 +17,7 @@ char ROMlib_rcsid_parseopt[] = #include "rsys/version.h" #include +#include using namespace Executor; using namespace std; @@ -31,7 +32,7 @@ Executor::ROMlib_parse_version (string vers, uint32 *version_out) { boolean_t success_p; int major_version, minor_version, teeny_version; - const char *major_str, *minor_str, *teeny_str; + char *major_str, *minor_str, *teeny_str; char *temp_str, *system_str; /* Copy the version to a temp string we can manipulate. */ diff --git a/src/pef_hash.cpp b/src/pef_hash.cpp index 2adfc3a3..33cbfe6f 100644 --- a/src/pef_hash.cpp +++ b/src/pef_hash.cpp @@ -17,7 +17,6 @@ char ROMlib_rcsid_pef_hash[] = #include using namespace Executor; -using namespace ByteSwap; /* * @@ -156,7 +155,7 @@ update_export_hash_table (uint32 *hashp, int hash_index, int first_index, new_value = ((run_count << CHAIN_COUNT_SHIFT) | (first_index & FIRST_INDEX_MASK)); - hashp[hash_index] = BigEndianValue (new_value); + hashp[hash_index] = CL (new_value); } @@ -211,10 +210,10 @@ ROMlib_build_pef_hash (const map_entry_t table[], int count) PEFLIH_TERM_OFFSET_X (retval) = CLC (-1); /* totalImportedSymbolCount, relocSectionCount, relocInstrOffset are all already 0 */ - PEFLIH_STRINGS_OFFSET_X (retval) = BigEndianValue (string_table_offset); - PEFLIH_HASH_OFFSET_X (retval) = BigEndianValue (hash_offset); - PEFLIH_HASH_TABLE_POWER_X (retval) = BigEndianValue (hash_power); - PEFLIH_SYMBOL_COUNT_X (retval) = BigEndianValue (count); + PEFLIH_STRINGS_OFFSET_X (retval) = CL (string_table_offset); + PEFLIH_HASH_OFFSET_X (retval) = CL (hash_offset); + PEFLIH_HASH_TABLE_POWER_X (retval) = CL (hash_power); + PEFLIH_SYMBOL_COUNT_X (retval) = CL (count); hashp = (typeof (hashp)) ((char *) retval + hash_offset); exportp = (typeof (exportp)) ((char *) retval + export_offset); @@ -233,7 +232,7 @@ ROMlib_build_pef_hash (const map_entry_t table[], int count) strlen (table[i].symbol_name)); sorted[i].hash_index = PEFHashTableIndex (sorted[i].hash_word, hash_power); - sorted[i].class_and_name_x = BigEndianValue ((kPEFTVectSymbol << 24) | + sorted[i].class_and_name_x = CL ((kPEFTVectSymbol << 24) | name_offset); sorted[i].value = (uint32) RM (&table[i].value); length = strlen (table[i].symbol_name); @@ -287,9 +286,9 @@ lookup_by_index (const pef_hash_t *hashp, int index, int name_offset; retval = &hashp->symbol_table[index]; - name_offset = BigEndianValue (retval->classAndName) & NAME_MASK; + name_offset = CL (retval->classAndName) & NAME_MASK; *namep = hashp->symbol_names + name_offset; - *namelen = BigEndianValue (hashp->export_key_table[index]) >> 16; + *namelen = CL (hashp->export_key_table[index]) >> 16; } return retval; @@ -342,12 +341,12 @@ lookup_by_name (const ConnectionID connp, offset = PEFLIH_STRINGS_OFFSET (lihp); string_tablep = (typeof (string_tablep)) ((char *) lihp + offset); - chain_count_and_first_index = BigEndianValue (hash_entries[hash_index]); + chain_count_and_first_index = CL (hash_entries[hash_index]); chain_count = ((chain_count_and_first_index >> CHAIN_COUNT_SHIFT) & CHAIN_COUNT_MASK); index = ((chain_count_and_first_index >> FIRST_INDEX_SHIFT) & FIRST_INDEX_MASK); - hash_word_swapped = BigEndianValue (hash_word); + hash_word_swapped = CL (hash_word); for (past_index = index + chain_count; index < past_index && (export_key_table[index] != hash_word_swapped || @@ -405,19 +404,19 @@ P4 (PUBLIC pascal trap, OSErr, FindSymbol, ConnectionID, connID, switch (section_index) { case -2: /* absolute address */ - *symAddr = (Ptr) BigEndianValue (val); + *symAddr = (Ptr) CL (val); break; case -3: /* re-exported */ warning_unimplemented ("name = '%.*s', val = 0x%x", symName[0], symName+1, val); - *symAddr = (Ptr) BigEndianValue (val); + *symAddr = (Ptr) CL (val); break; default: { uint32 sect_start; sect_start = connID->sects[section_index].start; - *symAddr = (Ptr) BigEndianValue (val + sect_start); + *symAddr = (Ptr) CL (val + sect_start); } break; } diff --git a/src/prError.cpp b/src/prError.cpp index 2baba931..957b4e69 100644 --- a/src/prError.cpp +++ b/src/prError.cpp @@ -14,14 +14,13 @@ char ROMlib_rcsid_prError[] = #include "PrintMgr.h" using namespace Executor; -using namespace ByteSwap; P0(PUBLIC pascal trap, INTEGER, PrError) { - return BigEndianValue(PrintErr); + return CW(PrintErr); } P1(PUBLIC pascal trap, void, PrSetError, INTEGER, iErr) { - PrintErr = BigEndianValue(iErr); + PrintErr = CW(iErr); } diff --git a/src/prLowLevel.cpp b/src/prLowLevel.cpp index b5a70161..6bfd192e 100644 --- a/src/prLowLevel.cpp +++ b/src/prLowLevel.cpp @@ -33,14 +33,15 @@ char ROMlib_rcsid_prLowLevel[] = #include "rsys/options.h" #include "rsys/string.h" #include "rsys/osevent.h" +#ifdef MACOSX_ #include "contextswitch.h" +#endif #if defined (CYGWIN32) #include "win_print.h" #endif using namespace Executor; -using namespace ByteSwap; PUBLIC uint32 ROMlib_PrDrvrVers = 70; @@ -141,13 +142,13 @@ P2(PUBLIC pascal, void, ROMlib_myjobproc, DialogPtr, dp, INTEGER, itemno) first = GetDILong (dp, PRINT_FIRST_BOX_NO, 1); last = GetDILong (dp, PRINT_LAST_BOX_NO, 9999); - HxX(hPrint, prJob.iFstPage) = BigEndianValue (first); - HxX(hPrint, prJob.iLstPage) = BigEndianValue (last); + HxX(hPrint, prJob.iFstPage) = CW (first); + HxX(hPrint, prJob.iLstPage) = CW (last); } { num_copies = GetDILong (dp, PRINT_COPIES_BOX_NO, 1); - HxX(hPrint, prJob.iCopies) = BigEndianValue (num_copies); + HxX(hPrint, prJob.iCopies) = CW (num_copies); } #if defined (CYGWIN32) #warning TODO use better x and y coords @@ -385,8 +386,8 @@ get_popup_bounding_box (Rect *rp, DialogPtr dp, INTEGER itemno) INTEGER unused; GetDItem (dp, itemno, &unused, NULL, rp); - rp->left = BigEndianValue (BigEndianValue (rp->left) - 1); - rp->bottom = BigEndianValue (BigEndianValue (rp->bottom) + 3); + rp->left = CW (CW (rp->left) - 1); + rp->bottom = CW (CW (rp->bottom) + 3); } #endif @@ -540,7 +541,7 @@ A2(static inline, TPPrDlg, ROMlib_CALLPRINITPROC, THPrint, hPrint, retval = C_PrJobInit(hPrint); else { HOOKSAVEREGS(); - retval = (TPPrDlg) CToPascalCall(&fp, CTOP_PrStlInit, hPrint); + retval = (TPPrDlg) CToPascalCall((void*)fp, CTOP_PrStlInit, hPrint); HOOKRESTOREREGS(); } return retval; @@ -559,7 +560,7 @@ A3(static inline, void, ROMlib_CALLPRITEMPROC, TPPrDlg, prrecptr, C_ROMlib_mystlproc((DialogPtr) prrecptr, item); else { HOOKSAVEREGS(); - CToPascalCall(&fp, CTOP_ROMlib_myjobproc, prrecptr, item); + CToPascalCall((void*)fp, CTOP_ROMlib_myjobproc, prrecptr, item); HOOKRESTOREREGS(); } } @@ -579,7 +580,7 @@ P3(PUBLIC, pascal BOOLEAN, ROMlib_stlfilterproc, DialogPeek, dp, { char c; - c = BigEndianValue (evt->message) & 0xFF; + c = CL (evt->message) & 0xFF; if (c == '\r' || c == NUMPAD_ENTER) { maybe_wait_for_keyup (); @@ -600,8 +601,8 @@ P3(PUBLIC, pascal BOOLEAN, ROMlib_stlfilterproc, DialogPeek, dp, gp = thePort; SetPort((GrafPtr) dp); GlobalToLocal(&localp); - localp.h = BigEndianValue(localp.h); - localp.v = BigEndianValue(localp.v); + localp.h = CW(localp.h); + localp.v = CW(localp.v); SetPort(gp); GetDItem ((DialogPtr) dp, OK, &unused, &h, &r); if (PtInRect (localp, &r)) @@ -670,7 +671,7 @@ P3(PUBLIC, pascal BOOLEAN, ROMlib_numsonlyfilterproc, DialogPeek, dp, case '\r': case NUMPAD_ENTER: maybe_wait_for_keyup (); - *ith = BigEndianValue(OK); + *ith = CW(OK); return TRUE; break; default: @@ -946,10 +947,10 @@ adjust_menu_common (TPPrDlg dlg, INTEGER item, heading_t heading, ini_key_t defk INTEGER unused; GetDItem ((DialogPtr) dlg, item, &unused, &h, &r); - r.right = BigEndianValue (BigEndianValue (r.left) + max_wid + 38); + r.right = CW (CW (r.left) + max_wid + 38); SetDItem ((DialogPtr) dlg, item, ctrlItem, MR (h.p), &r); - SizeControl (ch, BigEndianValue (r.right) - BigEndianValue (r.left), - BigEndianValue (r.bottom) - BigEndianValue (r.top)); + SizeControl (ch, CW (r.right) - CW (r.left), + CW (r.bottom) - CW (r.top)); } SetCtlMax (ch, i); if (default_index > -1) @@ -980,11 +981,7 @@ adjust_port (TPPrDlg dlg) #else HideDItem ((DialogPtr) dlg, LAYOUT_PORT_LABEL_NO); HideDItem ((DialogPtr) dlg, LAYOUT_PORT_MENU_NO); - if (ROMlib_port) - { - free (ROMlib_port); - ROMlib_port = NULL; - } + ROMlib_port = ""; #endif } @@ -1105,9 +1102,9 @@ P1(PUBLIC pascal trap, TPPrDlg, PrStlInit, THPrint, hPrint) new1 = StringWidth (new_type_label); HUnlock (h); - r.left = BigEndianValue (BigEndianValue(r.left) + orig - new1); + r.left = CW (CW(r.left) + orig - new1); SetDItem ((DialogPtr) retval, LAYOUT_PRINTER_TYPE_LABEL_NO, - BigEndianValue (item_type), h, &r); + CW (item_type), h, &r); SetIText (GetDIText ((DialogPtr) retval, LAYOUT_PRINTER_NAME_NO), new_printer_name); SetIText (GetDIText ((DialogPtr) retval, @@ -1166,7 +1163,7 @@ P2(PUBLIC pascal trap, BOOLEAN, PrDlgMain, THPrint, hPrint, ProcPtr, initfptr) else { ModalDialog((ProcPtr) MR(prrecptr->pFltrProc), &item); - item = BigEndianValue(item); + item = CW(item); } CALLPRITEMPROC(prrecptr, item, MR(prrecptr->pItemProc)); @@ -1213,7 +1210,7 @@ P1(PUBLIC pascal trap, void, PrGeneral, Ptr, pData) /* IMV-410 */ tgp = (TGnlData *) pData; ((TGnlData *) pData)->iError = CWC(OpNotImpl); - switch (BigEndianValue(tgp->iOpCode)) { + switch (CW(tgp->iOpCode)) { case GetRslData: { TGetRslBlk *resolp; @@ -1233,8 +1230,8 @@ P1(PUBLIC pascal trap, void, PrGeneral, Ptr, pData) /* IMV-410 */ else { resolp->iRslRecCnt = CWC (2); - resolp->rgRslRec[1].iXRsl = BigEndianValue (ROMlib_optional_res_x); - resolp->rgRslRec[1].iYRsl = BigEndianValue (ROMlib_optional_res_y); + resolp->rgRslRec[1].iXRsl = CW (ROMlib_optional_res_x); + resolp->rgRslRec[1].iYRsl = CW (ROMlib_optional_res_y); } } break; @@ -1244,15 +1241,15 @@ P1(PUBLIC pascal trap, void, PrGeneral, Ptr, pData) /* IMV-410 */ resolp = (TSetRslBlk *) pData; if (!((resolp->iXRsl == CWC (72) && resolp->iYRsl == CWC (72)) || - (resolp->iXRsl == BigEndianValue (ROMlib_optional_res_x) && - resolp->iYRsl == BigEndianValue (ROMlib_optional_res_y)))) + (resolp->iXRsl == CW (ROMlib_optional_res_x) && + resolp->iYRsl == CW (ROMlib_optional_res_y)))) resolp->iError = CWC (NoSuchRsl); else { resolp->iError = CWC (noErr); ROMlib_set_default_resolution (MR (resolp->hPrint), - BigEndianValue (resolp->iYRsl), - BigEndianValue (resolp->iXRsl)); + CW (resolp->iYRsl), + CW (resolp->iXRsl)); } } break; diff --git a/src/prPrinting.cpp b/src/prPrinting.cpp index 4f505a0e..77b103da 100644 --- a/src/prPrinting.cpp +++ b/src/prPrinting.cpp @@ -26,7 +26,9 @@ char ROMlib_rcsid_prPrinting[] = #include "rsys/vdriver.h" #include "rsys/file.h" #include "rsys/cleanup.h" +#ifdef MACOSX_ #include "contextswitch.h" +#endif #include "rsys/prefs.h" #if defined (MSDOS) || defined (CYGWIN32) @@ -264,14 +266,14 @@ P3(PUBLIC pascal trap, void, PrComment, INTEGER, kind, INTEGER, size, break; case rotatebegin: ip = (INTEGER *) STARH(hand); - flippage = BigEndianValue(ip[0]); - angle = BigEndianValue(ip[1]); + flippage = CW(ip[0]); + angle = CW(ip[1]); ROMlib_rotatebegin(flippage, angle); break; case rotatecenter: fp = (Fixed *) STARH(hand); - yoffset = BigEndianValue(fp[0]); - xoffset = BigEndianValue(fp[1]); + yoffset = CL(fp[0]); + xoffset = CL(fp[1]); ROMlib_rotatecenter( Cx(thePort->pnLoc.v) + (double) yoffset / (1L << 16), Cx(thePort->pnLoc.h) + @@ -420,13 +422,13 @@ open_ps_file (boolean_t *need_pclosep) *need_pclosep = FALSE; #if defined (LINUX) - if (strcmp (ROMlib_printer, "PostScript File") != 0) + if (ROMlib_printer != "PostScript File") { value_t prog; prog = find_key ("Printer", ROMlib_printer); - if (prog) - retval = popen (prog, "w"); + if (prog != "") + retval = popen (prog.c_str(), "w"); if (retval) { old_pipe_signal = signal (SIGPIPE, SIG_IGN); @@ -436,13 +438,13 @@ open_ps_file (boolean_t *need_pclosep) #endif #if defined (MSDOS) || defined (CYGWIN32) - if (strcmp (ROMlib_printer, "Direct To Port") == 0) + if (ROMlib_printer == "Direct To Port") { value_t port; port = find_key ("Port", ROMlib_port); - if (port) - retval = fopen (port, "w"); + if (port != "") + retval = fopen (port.c_str(), "w"); } #endif @@ -454,7 +456,7 @@ open_ps_file (boolean_t *need_pclosep) if (!retval) { #if !defined (MSDOS) && !defined (CYGWIN32) - if (strcmp (ROMlib_printer, "PostScript File") == 0) + if (ROMlib_printer == "PostScript File") #endif { if (!ROMlib_spool_file) diff --git a/src/prRecords.cpp b/src/prRecords.cpp index 14ab7d3a..609172c2 100644 --- a/src/prRecords.cpp +++ b/src/prRecords.cpp @@ -19,7 +19,6 @@ char ROMlib_rcsid_prRecords[] = #include "rsys/print.h" using namespace Executor; -using namespace ByteSwap; PRIVATE void set_wDev (THPrint hPrint) @@ -33,18 +32,18 @@ Executor::ROMlib_set_default_resolution (THPrint hPrint, INTEGER vres, INTEGER h printer_init (); update_printing_globals (); - HxX(hPrint, prInfo.iVRes) = BigEndianValue (vres); - HxX(hPrint, prInfo.iHRes) = BigEndianValue (hres); + HxX(hPrint, prInfo.iVRes) = CW (vres); + HxX(hPrint, prInfo.iHRes) = CW (hres); HxX(hPrint, prInfo.rPage.top) = CWC (0); HxX(hPrint, prInfo.rPage.left) = CWC (0); - HxX(hPrint, prInfo.rPage.bottom) = BigEndianValue ((ROMlib_paper_y - 72) * vres / 72); - HxX(hPrint, prInfo.rPage.right) = BigEndianValue ((ROMlib_paper_x - 72) * hres / 72); + HxX(hPrint, prInfo.rPage.bottom) = CW ((ROMlib_paper_y - 72) * vres / 72); + HxX(hPrint, prInfo.rPage.right) = CW ((ROMlib_paper_x - 72) * hres / 72); - HxX(hPrint, rPaper.top) = BigEndianValue ((INTEGER) (-0.5 * vres)); - HxX(hPrint, rPaper.bottom) = BigEndianValue ((INTEGER) + HxX(hPrint, rPaper.top) = CW ((INTEGER) (-0.5 * vres)); + HxX(hPrint, rPaper.bottom) = CW ((INTEGER) ((ROMlib_paper_y - 36) * vres / 72)); - HxX(hPrint, rPaper.left) = BigEndianValue ((INTEGER) (-0.5 * hres)); - HxX(hPrint, rPaper.right) = BigEndianValue ((INTEGER) + HxX(hPrint, rPaper.left) = CW ((INTEGER) (-0.5 * hres)); + HxX(hPrint, rPaper.right) = CW ((INTEGER) ((ROMlib_paper_x - 36) * hres / 72)); ROMlib_resolution_x = hres; @@ -59,7 +58,7 @@ P1(PUBLIC pascal trap, void, PrintDefault, THPrint, hPrint) LaserWriter we're using wants */ memset((char *) STARH(hPrint), 0, sizeof(TPrint)); - HxX(hPrint, iPrVersion) = BigEndianValue (ROMlib_PrDrvrVers); + HxX(hPrint, iPrVersion) = CW (ROMlib_PrDrvrVers); ROMlib_set_default_resolution (hPrint, 72, 72); @@ -76,7 +75,7 @@ P1(PUBLIC pascal trap, void, PrintDefault, THPrint, hPrint) HxX(hPrint, prInfoPT.iHRes) = CWC(72); HxX(hPrint, prInfoPT.rPage) = HxX(hPrint, prInfo.rPage); - HxX(hPrint, prXInfo.iRowBytes) = BigEndianValue((Hx(hPrint, prXInfo.iBandH) + 7) / 8); + HxX(hPrint, prXInfo.iRowBytes) = CW((Hx(hPrint, prXInfo.iBandH) + 7) / 8); /* TODO: what about the rest of prXInfo? (is zero for now) */ HxX(hPrint, prJob.iFstPage) = CWC(1); diff --git a/src/process.cpp b/src/process.cpp index f2deab7a..47287609 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -18,7 +18,6 @@ char ROMlib_rcsid_process[] = #include "rsys/process.h" using namespace Executor; -using namespace ByteSwap; #define declare_handle_type(type_prefix) \ typedef type_prefix ## _t *type_prefix ## _ptr; \ @@ -28,7 +27,7 @@ using namespace ByteSwap; declare_handle_type (size_resource); #define SIZE_FLAGS_X(size) (HxX (size, flags)) -#define SIZE_FLAGS(size) (BigEndianValue (SIZE_FLAGS_X (size))) +#define SIZE_FLAGS(size) (CW (SIZE_FLAGS_X (size))) static size_resource_handle get_size_resource () @@ -101,8 +100,8 @@ Executor::process_create (boolean_t desk_accessory_p, /* + stack size */); info->launch_ticks = TickCount (); - info->serial_number.highLongOfPSN = BigEndianValue (-1); - info->serial_number.lowLongOfPSN = BigEndianValue (next_free_psn ++); + info->serial_number.highLongOfPSN = CL (-1); + info->serial_number.lowLongOfPSN = CL (next_free_psn ++); info->next = process_info_list; process_info_list = info; @@ -178,21 +177,21 @@ P2 (PUBLIC pascal trap, OSErr, GetProcessInformation, return paramErr; PROCESS_INFO_SERIAL_NUMBER (process_info) = info->serial_number; - PROCESS_INFO_TYPE_X (process_info) = BigEndianValue (info->type); - PROCESS_INFO_SIGNATURE_X (process_info) = BigEndianValue (info->signature); - PROCESS_INFO_MODE_X (process_info) = BigEndianValue (info->mode); + PROCESS_INFO_TYPE_X (process_info) = CL (info->type); + PROCESS_INFO_SIGNATURE_X (process_info) = CL (info->signature); + PROCESS_INFO_MODE_X (process_info) = CL (info->mode); PROCESS_INFO_LOCATION_X (process_info) = (Ptr) ApplZone; - PROCESS_INFO_SIZE_X (process_info) = BigEndianValue (info->size); + PROCESS_INFO_SIZE_X (process_info) = CL (info->size); /* ### set current zone to applzone? */ PROCESS_INFO_FREE_MEM_X (process_info) = FreeMem (); PROCESS_INFO_LAUNCHER (process_info) = no_process; - PROCESS_INFO_LAUNCH_DATE_X (process_info) = BigEndianValue (info->launch_ticks); + PROCESS_INFO_LAUNCH_DATE_X (process_info) = CL (info->launch_ticks); current_ticks = TickCount (); PROCESS_INFO_ACTIVE_TIME_X (process_info) - = BigEndianValue (current_ticks - info->launch_ticks); + = CL (current_ticks - info->launch_ticks); return noErr; } diff --git a/src/qBit.cpp b/src/qBit.cpp index 378d9ca6..7bb42dd4 100644 --- a/src/qBit.cpp +++ b/src/qBit.cpp @@ -22,7 +22,6 @@ char ROMlib_rcsid_qBit[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; P6 (PUBLIC pascal trap, void, CopyBits, BitMap *, src_bitmap, BitMap *, dst_bitmap, @@ -135,7 +134,7 @@ P6 (PUBLIC pascal trap, void, CopyBits, PtrToHand ((Ptr) dst_bitmap, &t, sizeof (PixMap)); bogo_port_pixmap = (PixMapHandle) t.p; - CPORT_PIXMAP_X_NO_ASSERT (theCPort) = BigEndianValue (bogo_port_pixmap); + CPORT_PIXMAP_X_NO_ASSERT (theCPort) = CL (bogo_port_pixmap); CPORT_VERSION_X_NO_ASSERT (theCPort) = CPORT_FLAG_BITS_X; } else @@ -143,8 +142,8 @@ P6 (PUBLIC pascal trap, void, CopyBits, big_region = NewRgn (); SetRectRgn (big_region, -32767, -32767, 32767, 32767); - PORT_VIS_REGION_X (thePort) = BigEndianValue (big_region); - PORT_CLIP_REGION_X (thePort) = BigEndianValue (big_region); + PORT_VIS_REGION_X (thePort) = CL (big_region); + PORT_CLIP_REGION_X (thePort) = CL (big_region); SetRect (&PORT_RECT (thePort), -32767, -32767, 32767, 32767); if (src_bitmap == &thePort->portBits) @@ -203,38 +202,38 @@ P4 (PUBLIC pascal trap, void, ScrollRect, Rect *, rp, INTEGER, dh, INTEGER, dv, srcr = *rp; #if 0 - OffsetRect(&srcr, -BigEndianValue (PORT_BOUNDS (thePort).left), - -BigEndianValue (PORT_BOUNDS (thePort).top)); /* loc to glob */ + OffsetRect(&srcr, -CW (PORT_BOUNDS (thePort).left), + -CW (PORT_BOUNDS (thePort).top)); /* loc to glob */ #endif dstr = srcr; updatergn2 = NewRgn(); RectRgn(updatergn2, &srcr); if (dh > 0) { - dstr.left = BigEndianValue(BigEndianValue(dstr.left) + dh); - srcr.right = BigEndianValue(BigEndianValue(srcr.right) - dh); + dstr.left = CW(CW(dstr.left) + dh); + srcr.right = CW(CW(srcr.right) - dh); } else { - srcr.left = BigEndianValue(BigEndianValue(srcr.left) - dh); - dstr.right = BigEndianValue(BigEndianValue(dstr.right) + dh); + srcr.left = CW(CW(srcr.left) - dh); + dstr.right = CW(CW(dstr.right) + dh); } if (dv > 0) { - dstr.top = BigEndianValue(BigEndianValue(dstr.top) + dv); - srcr.bottom = BigEndianValue(BigEndianValue(srcr.bottom) - dv); + dstr.top = CW(CW(dstr.top) + dv); + srcr.bottom = CW(CW(srcr.bottom) - dv); } else { - srcr.top = BigEndianValue(BigEndianValue(srcr.top) - dv); - dstr.bottom = BigEndianValue(BigEndianValue(dstr.bottom) + dv); + srcr.top = CW(CW(srcr.top) - dv); + dstr.bottom = CW(CW(dstr.bottom) + dv); } RectRgn(temp = NewRgn(), &dstr); DiffRgn(updatergn2, temp, updatergn2); #if 0 OffsetRgn(updatergn2, - BigEndianValue (PORT_BOUNDS (thePort).left), - BigEndianValue (PORT_BOUNDS (thePort).top)); /* glob to loc */ + CW (PORT_BOUNDS (thePort).left), + CW (PORT_BOUNDS (thePort).top)); /* glob to loc */ #endif UnionRgn(updatergn2, temp2, updatergn2); diff --git a/src/qCConv.cpp b/src/qCConv.cpp index 669e7868..68b4d28f 100644 --- a/src/qCConv.cpp +++ b/src/qCConv.cpp @@ -12,7 +12,6 @@ char ROMlib_rcsid_qCConv[] = #include "CQuickDraw.h" using namespace Executor; -using namespace ByteSwap; /* cmy and rgb color spaces are simply complements */ @@ -29,7 +28,7 @@ P2 (PUBLIC pascal trap, void, RGB2CMY, RGBColor *, rgb_color, CMYColor *, cmy_color) { - /* use `bar = ~foo' instead of `bar = BigEndianValue (MaxSmallFract - BigEndianValue (foo))' + /* use `bar = ~foo' instead of `bar = CW (MaxSmallFract - CW (foo))' to compute the complement value */ cmy_color->cyan = ~rgb_color->red; @@ -50,16 +49,16 @@ static inline unsigned short value (unsigned long n1, unsigned long n2, unsigned long hue) { if (hue < ANGLE_TO_SF (60)) - return BigEndianValue (n1 + SF_MULT (n2 - n1, + return CW (n1 + SF_MULT (n2 - n1, SF_MULT (hue, C_TO_SF (6)))); else if (hue < ANGLE_TO_SF (180)) - return BigEndianValue (n2); + return CW (n2); else if (hue < ANGLE_TO_SF (240)) - return BigEndianValue (n1 + SF_MULT (n2 - n1, + return CW (n1 + SF_MULT (n2 - n1, SF_MULT (ANGLE_TO_SF (240) - hue, C_TO_SF (6)))); else - return BigEndianValue (n1); + return CW (n1); } @@ -78,9 +77,9 @@ P2 (PUBLIC pascal trap, void, HSL2RGB, unsigned long m1, m2; /* the hue represents a angle in the range [0, 360) */ - unsigned long h = BigEndianValue (hsl_color->hue); - unsigned long s = BigEndianValue (hsl_color->saturation); - unsigned long l = BigEndianValue (hsl_color->lightness); + unsigned long h = CW (hsl_color->hue); + unsigned long s = CW (hsl_color->saturation); + unsigned long l = CW (hsl_color->lightness); if (l <= (MaxSmallFract / 2)) m2 = SF_MULT (l, (C_TO_SF (1) + s)); @@ -102,9 +101,9 @@ P2 (PUBLIC pascal trap, void, RGB2HSL, RGBColor *, rgb_color, HSLColor *, hsl_color) { - unsigned long r = BigEndianValue (rgb_color->red); - unsigned long g = BigEndianValue (rgb_color->green); - unsigned long b = BigEndianValue (rgb_color->blue); + unsigned long r = CW (rgb_color->red); + unsigned long g = CW (rgb_color->green); + unsigned long b = CW (rgb_color->blue); unsigned long max = MAX (r, MAX (g, b)); unsigned long min = MIN (r, MIN (g, b)); @@ -163,9 +162,9 @@ P2 (PUBLIC pascal trap, void, RGB2HSL, gui_fatal("r = 0x%lx, g = 0x%lx, b = 0x%lx", r, g, b); } - hsl_color->hue = BigEndianValue (h); - hsl_color->saturation = BigEndianValue (s); - hsl_color->lightness = BigEndianValue (l); + hsl_color->hue = CW (h); + hsl_color->saturation = CW (s); + hsl_color->lightness = CW (l); } P2 (PUBLIC pascal trap, void, HSV2RGB, @@ -181,9 +180,9 @@ P2 (PUBLIC pascal trap, void, HSV2RGB, else { /* the hue represents a angle in the range [0, 360) */ - unsigned long h = BigEndianValue (hsv_color->hue); - unsigned long s = BigEndianValue (hsv_color->saturation); - unsigned long v = BigEndianValue (hsv_color->value); + unsigned long h = CW (hsv_color->hue); + unsigned long s = CW (hsv_color->saturation); + unsigned long v = CW (hsv_color->value); /* one of the six color verticies of the hex cone, [0, 6) */ unsigned sextant = SF_TO_C (h * 6); @@ -199,35 +198,35 @@ P2 (PUBLIC pascal trap, void, HSV2RGB, switch (sextant) { case 0: - rgb_color->red = BigEndianValue (v); - rgb_color->green = BigEndianValue (t); - rgb_color->blue = BigEndianValue (p); + rgb_color->red = CW (v); + rgb_color->green = CW (t); + rgb_color->blue = CW (p); break; case 1: - rgb_color->red = BigEndianValue (q); - rgb_color->green = BigEndianValue (v); - rgb_color->blue = BigEndianValue (p); + rgb_color->red = CW (q); + rgb_color->green = CW (v); + rgb_color->blue = CW (p); break; case 2: - rgb_color->red = BigEndianValue (p); - rgb_color->green = BigEndianValue (v); - rgb_color->blue = BigEndianValue (t); + rgb_color->red = CW (p); + rgb_color->green = CW (v); + rgb_color->blue = CW (t); break; case 3: - rgb_color->red = BigEndianValue (p); - rgb_color->green = BigEndianValue (q); - rgb_color->blue = BigEndianValue (v); + rgb_color->red = CW (p); + rgb_color->green = CW (q); + rgb_color->blue = CW (v); break; case 4: - rgb_color->red = BigEndianValue (t); - rgb_color->green = BigEndianValue (p); - rgb_color->blue = BigEndianValue (v); + rgb_color->red = CW (t); + rgb_color->green = CW (p); + rgb_color->blue = CW (v); break; case 5: case 6: - rgb_color->red = BigEndianValue (v); - rgb_color->green = BigEndianValue (p); - rgb_color->blue = BigEndianValue (q); + rgb_color->red = CW (v); + rgb_color->green = CW (p); + rgb_color->blue = CW (q); break; default: gui_fatal ("sextant = %d", sextant); @@ -239,9 +238,9 @@ P2 (PUBLIC pascal trap, void, RGB2HSV, RGBColor *, rgb_color, HSVColor *, hsv_color) { - unsigned long r = BigEndianValue (rgb_color->red); - unsigned long g = BigEndianValue (rgb_color->green); - unsigned long b = BigEndianValue (rgb_color->blue); + unsigned long r = CW (rgb_color->red); + unsigned long g = CW (rgb_color->green); + unsigned long b = CW (rgb_color->blue); unsigned long max = MAX (r, MAX (g, b)); unsigned long min = MIN (r, MIN (g, b)); @@ -294,9 +293,9 @@ P2 (PUBLIC pascal trap, void, RGB2HSV, gui_fatal ("r = 0x%lx, g = 0x%lx, b = 0x%lx", r, g, b); } - hsv_color->hue = BigEndianValue (h); - hsv_color->saturation = BigEndianValue (s); - hsv_color->value = BigEndianValue (v); + hsv_color->hue = CW (h); + hsv_color->saturation = CW (s); + hsv_color->value = CW (v); } P1 (PUBLIC pascal trap, SmallFract, Fix2SmallFract, diff --git a/src/qCGrafPort.cpp b/src/qCGrafPort.cpp index b5ca6587..7d5224d6 100644 --- a/src/qCGrafPort.cpp +++ b/src/qCGrafPort.cpp @@ -22,7 +22,6 @@ char ROMlib_rcsid_qCGrafport[] = #include "rsys/evil.h" using namespace Executor; -using namespace ByteSwap; P1 (PUBLIC pascal trap, void, OpenCPort, CGrafPtr, port) @@ -169,7 +168,7 @@ P1 (PUBLIC pascal trap, void, RGBForeColor, CPORT_RGB_FG_COLOR (theCPort) = *color; /* pick the best color and store it into `theCPort->fgColor' */ - PORT_FG_COLOR_X (theCPort) = BigEndianValue (Color2Index (color)); + PORT_FG_COLOR_X (theCPort) = CL (Color2Index (color)); } else { @@ -178,9 +177,9 @@ P1 (PUBLIC pascal trap, void, RGBForeColor, basic_qd_color = high_bits_to_colors - [BigEndianValue (color->red) >> 15] - [BigEndianValue (color->green) >> 15] - [BigEndianValue (color->blue) >> 15]; + [CW (color->red) >> 15] + [CW (color->green) >> 15] + [CW (color->blue) >> 15]; ForeColor (basic_qd_color); } @@ -205,7 +204,7 @@ P1 (PUBLIC pascal trap, void, RGBBackColor, CPORT_RGB_BK_COLOR (theCPort) = *color; /* pick the best color and store it into `theCPort->bkColor' */ - PORT_BK_COLOR_X (theCPort) = BigEndianValue (Color2Index (color)); + PORT_BK_COLOR_X (theCPort) = CL (Color2Index (color)); } else { @@ -214,9 +213,9 @@ P1 (PUBLIC pascal trap, void, RGBBackColor, basic_qd_color = high_bits_to_colors - [BigEndianValue (color->red) >> 15] - [BigEndianValue (color->green) >> 15] - [BigEndianValue (color->blue) >> 15]; + [CW (color->red) >> 15] + [CW (color->green) >> 15] + [CW (color->blue) >> 15]; BackColor (basic_qd_color); } @@ -491,7 +490,7 @@ P1 (PUBLIC pascal trap, PixPatHandle, GetPixPat, INTEGER, pixpat_id) ctab_ptr = (CTabPtr) ((char *) STARH (pixpat_res) + (int) PIXMAP_TABLE_AS_OFFSET (patmap)); ctab_size = (sizeof (ColorTable) - + (sizeof (ColorSpec) * BigEndianValue (ctab_ptr->ctSize))); + + (sizeof (ColorSpec) * CW (ctab_ptr->ctSize))); /* SetHandleSize ((Handle) PIXMAP_TABLE (patmap), ctab_size); */ @@ -503,8 +502,8 @@ P1 (PUBLIC pascal trap, PixPatHandle, GetPixPat, INTEGER, pixpat_id) (Ptr) STARH (PIXMAP_TABLE (patmap)), ctab_size); - /* ctab_ptr->ctSeed = BigEndianValue (GetCTSeed ()); */ - CTAB_SEED_X (PIXMAP_TABLE (patmap)) = BigEndianValue (GetCTSeed ()); + /* ctab_ptr->ctSeed = CL (GetCTSeed ()); */ + CTAB_SEED_X (PIXMAP_TABLE (patmap)) = CL (GetCTSeed ()); }); #if 0 @@ -571,7 +570,7 @@ P2 (PUBLIC pascal trap, void, MakeRGBPat, SetHandleSize ((Handle) PIXMAP_TABLE (patmap), (Size) (sizeof (ColorTable) + (4 * sizeof (ColorSpec)))); - CTAB_SEED_X (PIXMAP_TABLE (patmap)) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (PIXMAP_TABLE (patmap)) = CL (GetCTSeed ()); CTAB_SIZE_X (PIXMAP_TABLE (patmap)) = CWC (5); CTAB_TABLE (PIXMAP_TABLE (patmap))[4].rgb = *color; } diff --git a/src/qColor.cpp b/src/qColor.cpp index 8684c3cf..2b4a3b21 100644 --- a/src/qColor.cpp +++ b/src/qColor.cpp @@ -22,7 +22,6 @@ char ROMlib_rcsid_qColor[] = #include "rsys/qcolor.h" using namespace Executor; -using namespace ByteSwap; /* color quickdraw global stuff */ @@ -93,7 +92,7 @@ P1(PUBLIC pascal trap, void, ForeColor, LONGINT, c) if (CGrafPort_p (the_port)) RGBForeColor (ROMlib_qd_color_to_rgb (c)); else - PORT_FG_COLOR_X (the_port) = BigEndianValue (c); + PORT_FG_COLOR_X (the_port) = CL (c); } } @@ -107,13 +106,13 @@ P1(PUBLIC pascal trap, void, BackColor, LONGINT, c) if (CGrafPort_p (the_port)) RGBBackColor (ROMlib_qd_color_to_rgb (c)); else - PORT_BK_COLOR_X (the_port) = BigEndianValue (c); + PORT_BK_COLOR_X (the_port) = CL (c); } } P1(PUBLIC pascal trap, void, ColorBit, INTEGER, b) { - PORT_COLR_BIT_X (thePort) = BigEndianValue (b); + PORT_COLR_BIT_X (thePort) = CW (b); } typedef CTabHandle clut_res_handle; @@ -159,8 +158,8 @@ P1 (PUBLIC pascal trap, CTabHandle, GetCTable, /* if the color table is b/w, set the seed to be the b/w clut seed */ /* #### ctab_id or a new seed? */ - CTAB_SEED_X (ctab) = BigEndianValue (ctab_id == 33 ? 1 : ctab_id); - CTAB_SIZE_X (ctab) = BigEndianValue (ctab_size); + CTAB_SEED_X (ctab) = CL (ctab_id == 33 ? 1 : ctab_id); + CTAB_SIZE_X (ctab) = CW (ctab_size); CTAB_FLAGS_X (ctab) = CTAB_GDEVICE_BIT_X; table = CTAB_TABLE (ctab); @@ -168,13 +167,13 @@ P1 (PUBLIC pascal trap, CTabHandle, GetCTable, stride = 0xFFFF0000UL / ctab_size; for (c = 0xFFFF0000UL, i = 0; i < ctab_size; c -= stride, i ++) { - table[i].value = BigEndianValue (i); + table[i].value = CW (i); table[i].rgb.red = table[i].rgb.green = table[i].rgb.blue - = BigEndianValue ((c + 0x8000) >> 16); + = CW ((c + 0x8000) >> 16); } /* Make sure the last entry is _exactly_ black. */ - table[ctab_size].value = BigEndianValue (ctab_size); + table[ctab_size].value = CW (ctab_size); table[ctab_size].rgb.red = table[ctab_size].rgb.green = table[ctab_size].rgb.blue = CWC (0); @@ -204,7 +203,7 @@ P1 (PUBLIC pascal trap, CTabHandle, GetCTable, ctab_handle_size); /* #### ctab_id or a new seed? */ - CTAB_SEED_X (ctab) = BigEndianValue (ctab_id); + CTAB_SEED_X (ctab) = CL (ctab_id); } else if (ctab_id >= 0 && ctab_id <= 8) { @@ -215,9 +214,9 @@ P1 (PUBLIC pascal trap, CTabHandle, GetCTable, ctab_size = (1 << ctab_id) - 1; ctab = (CTabHandle) NewHandle (CTAB_STORAGE_FOR_SIZE (ctab_size)); - CTAB_SIZE_X (ctab) = BigEndianValue (ctab_size); + CTAB_SIZE_X (ctab) = CW (ctab_size); CTAB_FLAGS_X (ctab) = CTAB_GDEVICE_BIT_X; - CTAB_SEED_X (ctab) = BigEndianValue (ctab_id); + CTAB_SEED_X (ctab) = CL (ctab_id); ctab_table = CTAB_TABLE (ctab); memcpy (ctab_table, default_ctab_colors[ROMlib_log2[ctab_id]], diff --git a/src/qColorMgr.cpp b/src/qColorMgr.cpp index 283a9eab..53a49aa6 100644 --- a/src/qColorMgr.cpp +++ b/src/qColorMgr.cpp @@ -25,7 +25,6 @@ char ROMlib_rcsid_qColorMgr[] = #include "rsys/dirtyrect.h" using namespace Executor; -using namespace ByteSwap; INTEGER ROMlib_qd_error; @@ -65,9 +64,9 @@ itable_hash (RGBColor *rgbp, int resolution) int retval; uint16 red, green, blue; - red = BigEndianValue (rgbp->red) >> (16 - resolution); - green = BigEndianValue (rgbp->green) >> (16 - resolution); - blue = BigEndianValue (rgbp->blue) >> (16 - resolution); + red = CW (rgbp->red) >> (16 - resolution); + green = CW (rgbp->green) >> (16 - resolution); + blue = CW (rgbp->blue) >> (16 - resolution); switch (resolution) { @@ -117,9 +116,9 @@ rgb_diff (RGBColor *rgb1p, RGBColor *rgb2p) */ - retval = (ABS (BigEndianValue (rgb1p->red & 0xff) - BigEndianValue (rgb2p->red & 0xff)) + - ABS (BigEndianValue (rgb1p->green & 0xff) - BigEndianValue (rgb2p->green & 0xff)) + - ABS (BigEndianValue (rgb1p->blue & 0xff) - BigEndianValue (rgb2p->blue & 0xff))); + retval = (ABS (CW (rgb1p->red & 0xff) - CW (rgb2p->red & 0xff)) + + ABS (CW (rgb1p->green & 0xff) - CW (rgb2p->green & 0xff)) + + ABS (CW (rgb1p->blue & 0xff) - CW (rgb2p->blue & 0xff))); return retval; } @@ -127,9 +126,9 @@ rgb_diff (RGBColor *rgb1p, RGBColor *rgb2p) /* FIXME: may have to round instead of cleave off the low bits */ #define RGB_TO_ITAB_INDEX(rgb, resolution) \ - (((BigEndianValue ((rgb)->red) >> (16 - (resolution))) << (2 * (resolution))) \ - | ((BigEndianValue ((rgb)->green) >> (16 - (resolution))) << (resolution)) \ - | ((BigEndianValue ((rgb)->blue) >> (16 - (resolution))))) + (((CW ((rgb)->red) >> (16 - (resolution))) << (2 * (resolution))) \ + | ((CW ((rgb)->green) >> (16 - (resolution))) << (resolution)) \ + | ((CW ((rgb)->blue) >> (16 - (resolution))))) static uint32 ROMlib_search_proc (RGBColor *rgb) @@ -148,9 +147,9 @@ ROMlib_search_proc (RGBColor *rgb) : &mac_32bpp_rgb_spec; retval = (*rgb_spec->rgbcolor_to_pixel) (rgb_spec, rgb, TRUE); if (pixel_size == 16) - retval = BigEndianValue (retval); + retval = CW (retval); else if (pixel_size == 32) - retval = BigEndianValue (retval); + retval = CL (retval); else gui_fatal ("unknown pixel size `%d'", pixel_size); } @@ -258,7 +257,7 @@ P1 (PUBLIC pascal trap, LONGINT, Color2Index, if (! success_p) position = ROMlib_search_proc (rgb); else - position = BigEndianValue (position); /* They filled this in in big endian order. */ + position = CL (position); /* They filled this in in big endian order. */ return position; } @@ -307,7 +306,7 @@ P1 (PUBLIC pascal trap, BOOLEAN, RealColor, closest = &(CTAB_TABLE (table)[index].rgb); /* high `resolution' bits */ - mask = BigEndianValue (((1 << resolution) - 1) << (16 - resolution)); + mask = CW (((1 << resolution) - 1) << (16 - resolution)); return !(((rgb->red ^ closest->red) & mask) || ((rgb->green ^ closest->green) & mask) @@ -396,12 +395,12 @@ P3 (PUBLIC pascal trap, void, GetSubTable, color table */ /* if (gd_ctab_p) - color->value = BigEndianValue (ctab_index); + color->value = CW (ctab_index); else color->value = target_ctab_table[ctab_index].value; color->rgb = target_ctab_table[ctab_index].rgb; */ - color->value = BigEndianValue (ctab_index); + color->value = CW (ctab_index); } PIXMAP_TABLE_X (gd_pmap) = gdev_ctab_save; @@ -423,12 +422,12 @@ Executor::average_color (GDHandle gd, gd_pmap = GD_PMAP (gd); gd_pixel_size = PIXMAP_PIXEL_SIZE (gd_pmap); - in_between.red = BigEndianValue (((BigEndianValue (c1->red) * ratio) - + (BigEndianValue (c2->red) * (65535 - ratio))) / 65535); - in_between.green = BigEndianValue (((BigEndianValue (c1->green) * ratio) - + (BigEndianValue (c2->green) * (65535 - ratio))) / 65535); - in_between.blue = BigEndianValue (((BigEndianValue (c1->blue) * ratio) - + (BigEndianValue (c2->blue) * (65535 - ratio))) / 65535); + in_between.red = CW (((CW (c1->red) * ratio) + + (CW (c2->red) * (65535 - ratio))) / 65535); + in_between.green = CW (((CW (c1->green) * ratio) + + (CW (c2->green) * (65535 - ratio))) / 65535); + in_between.blue = CW (((CW (c1->blue) * ratio) + + (CW (c2->blue) * (65535 - ratio))) / 65535); if (gd_pixel_size <= 8) { CTabHandle gd_ctab; @@ -698,7 +697,7 @@ P3 (PUBLIC pascal trap, void, MakeITable, #endif SetHandleSize ((Handle) inverse_table, new_size); } - ITAB_RES_X (inverse_table) = BigEndianValue (resolution); + ITAB_RES_X (inverse_table) = CW (resolution); itab_table = ITAB_TABLE (inverse_table); @@ -740,12 +739,12 @@ P3 (PUBLIC pascal trap, void, MakeITable, if (CTAB_FLAGS_X (color_table) & CTAB_GDEVICE_BIT_X) new_value = i; else - new_value = BigEndianValue (color->value); + new_value = CW (color->value); /* Save away the color for this index, in native endian byte order. */ - color_for_index[new_value].rgb.red = BigEndianValue (color->rgb.red); - color_for_index[new_value].rgb.green = BigEndianValue (color->rgb.green); - color_for_index[new_value].rgb.blue = BigEndianValue (color->rgb.blue); + color_for_index[new_value].rgb.red = CW (color->rgb.red); + color_for_index[new_value].rgb.green = CW (color->rgb.green); + color_for_index[new_value].rgb.blue = CW (color->rgb.blue); current_red = color_for_index[new_value].rgb.red; current_blue = color_for_index[new_value].rgb.blue; @@ -917,7 +916,7 @@ P2 (PUBLIC pascal trap, void, ReserveEntry, /* Only change the seed when necessary. */ if (old_value != entry->value) - CTAB_SEED_X (ctab) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (ctab) = CL (GetCTSeed ()); } P3 (PUBLIC pascal trap, void, SetEntries, @@ -967,7 +966,7 @@ P3 (PUBLIC pascal trap, void, SetEntries, for (i = 0; i <= count; i ++) { - int index = BigEndianValue (atable[i].value); + int index = CW (atable[i].value); if (index < min) min = index; @@ -997,7 +996,7 @@ P3 (PUBLIC pascal trap, void, SetEntries, if (ctab_changed_p) { - CTAB_SEED_X (ctab) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (ctab) = CL (GetCTSeed ()); if (gd == MR (MainDevice)) { if (num_colors > 0) @@ -1073,7 +1072,7 @@ P1 (PUBLIC pascal trap, void, DelComp, P1 (PUBLIC pascal trap, void, SetClientID, INTEGER, id) { - GD_ID_X (MR (TheGDevice)) = BigEndianValue (id); + GD_ID_X (MR (TheGDevice)) = CW (id); } P3 (PUBLIC pascal trap, void, SaveEntries, CTabHandle, src, CTabHandle, result, @@ -1087,18 +1086,18 @@ P3 (PUBLIC pascal trap, void, SaveEntries, CTabHandle, src, CTabHandle, result, src = PIXMAP_TABLE (GD_PMAP (MR (TheGDevice))); src_ctab_size = CTAB_SIZE (src); - req_size = BigEndianValue (selection->reqLSize); + req_size = CW (selection->reqLSize); SetHandleSize ((Handle) result, CTAB_STORAGE_FOR_SIZE (req_size)); - CTAB_SIZE_X (result) = BigEndianValue (req_size); + CTAB_SIZE_X (result) = CW (req_size); /* #### should this set the color table seed? */ - CTAB_SEED_X (result) = BigEndianValue (GetCTSeed ()); - CTAB_FLAGS_X (result) = BigEndianValue (0); + CTAB_SEED_X (result) = CL (GetCTSeed ()); + CTAB_FLAGS_X (result) = CW (0); for (i = 0; i <= req_size; i ++) { - int req_index = BigEndianValue (selection->reqLData[i]); + int req_index = CW (selection->reqLData[i]); if (req_index >= 0 && req_index <= src_ctab_size) @@ -1127,11 +1126,11 @@ P3 (PUBLIC pascal trap, void, RestoreEntries, CTabHandle, src, CTabHandle, dst, dst = PIXMAP_TABLE (GD_PMAP (MR (TheGDevice))); dst_ctab_size = CTAB_SIZE (dst); - req_size = BigEndianValue (selection->reqLSize); + req_size = CW (selection->reqLSize); for (i = 0; i < req_size; i ++) { - int req_index = BigEndianValue (selection->reqLData[i]); + int req_index = CW (selection->reqLData[i]); if (req_index >= 0 && req_index <= dst_ctab_size) diff --git a/src/qColorPicker.cpp b/src/qColorPicker.cpp index 3b37c33c..05d36a28 100644 --- a/src/qColorPicker.cpp +++ b/src/qColorPicker.cpp @@ -31,7 +31,6 @@ char ROMlib_rcsid_qColorPicker[] = #include using namespace Executor; -using namespace ByteSwap; /* sanity defines */ @@ -220,8 +219,8 @@ compute_bounds (Point maybe_top_left) /* centered horizontally, with a third of the space above the window, and two-thirds below */ - top = BigEndianValue (gd_rect->top) + (gd_height - height) / 3; - left = BigEndianValue (gd_rect->left) + (gd_width - width) / 2; + top = CW (gd_rect->top) + (gd_height - height) / 3; + left = CW (gd_rect->left) + (gd_width - width) / 2; } else { @@ -229,10 +228,10 @@ compute_bounds (Point maybe_top_left) left = maybe_top_left.h; } - color_picker_window_bounds->top = BigEndianValue (top); - color_picker_window_bounds->left = BigEndianValue (left); - color_picker_window_bounds->bottom = BigEndianValue (top + height); - color_picker_window_bounds->right = BigEndianValue (left + width); + color_picker_window_bounds->top = CW (top); + color_picker_window_bounds->left = CW (left); + color_picker_window_bounds->bottom = CW (top + height); + color_picker_window_bounds->right = CW (left + width); } typedef enum miniarrow_hilite @@ -402,24 +401,24 @@ text_box_init (void) *te_bounds = *frame_bounds; InsetRect (te_bounds, 4, 4); - baseline = ( ( BigEndianValue (frame_bounds->top) - + BigEndianValue (frame_bounds->bottom)) / 2 + baseline = ( ( CW (frame_bounds->top) + + CW (frame_bounds->bottom)) / 2 - font_height / 2 + font_ascent); title_pt = &box->title_pt; label_pt = &box->label_pt; title_pt->v = label_pt->v = baseline; - title_pt->h = BigEndianValue (template_bounds->left) + offset - StringWidth (title); - label_pt->h = BigEndianValue (frame_bounds->right) + space_width / 2; + title_pt->h = CW (template_bounds->left) + offset - StringWidth (title); + label_pt->h = CW (frame_bounds->right) + space_width / 2; miniarrow_bounds = &box->miniarrow_rect; *miniarrow_bounds = *frame_bounds; - miniarrow_bounds->left = BigEndianValue ( label_pt->h + miniarrow_bounds->left = CW ( label_pt->h + label_width + space_width / 2); - miniarrow_bounds->right = BigEndianValue ( label_pt->h + miniarrow_bounds->right = CW ( label_pt->h + label_width + space_width / 2 + 22); @@ -566,8 +565,8 @@ text_box_miniarrow_update (struct text_box *box, miniarrow_rect = &box->miniarrow_rect; - center_x = (BigEndianValue (miniarrow_rect->left) + BigEndianValue (miniarrow_rect->right)) / 2; - center_y = (BigEndianValue (miniarrow_rect->top) + BigEndianValue (miniarrow_rect->bottom)) / 2; + center_x = (CW (miniarrow_rect->left) + CW (miniarrow_rect->right)) / 2; + center_y = (CW (miniarrow_rect->top) + CW (miniarrow_rect->bottom)) / 2; SetRect (&dst_rect, center_x - 13 / 2, center_y - 22 / 2, @@ -658,13 +657,13 @@ text_box_update_value_1 (struct text_box *box, int newval, switch (box->i) { case red_index: - current_color.red = BigEndianValue (red); + current_color.red = CW (red); break; case green_index: - current_color.green = BigEndianValue (green); + current_color.green = CW (green); break; case blue_index: - current_color.blue = BigEndianValue (blue); + current_color.blue = CW (blue); break; case hue_index: case saturation_index: @@ -712,18 +711,18 @@ hue_saturation_update (int new_hue, int new_saturation, if (full_update_p) { - hsl_color.hue = BigEndianValue (hue); - hsl_color.saturation = BigEndianValue (saturation); - hsl_color.lightness = BigEndianValue (lightness); + hsl_color.hue = CW (hue); + hsl_color.saturation = CW (saturation); + hsl_color.lightness = CW (lightness); HSL2RGB (&hsl_color, &rgb_color); text_box_update_value_1 (&text_boxes[red_index], - BigEndianValue (rgb_color.red), TRUE, TRUE); + CW (rgb_color.red), TRUE, TRUE); text_box_update_value_1 (&text_boxes[green_index], - BigEndianValue (rgb_color.green), TRUE, TRUE); + CW (rgb_color.green), TRUE, TRUE); text_box_update_value_1 (&text_boxes[blue_index], - BigEndianValue (rgb_color.blue), TRUE, TRUE); + CW (rgb_color.blue), TRUE, TRUE); compare_box_update (); } @@ -775,17 +774,17 @@ text_box_update_value (struct text_box *box, int newval, { text_box_update_value_1 (box, newval, update_if_p, TRUE); - rgb_color.red = BigEndianValue (red); - rgb_color.green = BigEndianValue (green); - rgb_color.blue = BigEndianValue (blue); + rgb_color.red = CW (red); + rgb_color.green = CW (green); + rgb_color.blue = CW (blue); RGB2HSL (&rgb_color, &hsl_color); - hue_saturation_update (BigEndianValue (hsl_color.hue), BigEndianValue (hsl_color.saturation), + hue_saturation_update (CW (hsl_color.hue), CW (hsl_color.saturation), FALSE); text_box_update_value_1 (&text_boxes[lightness_index], - BigEndianValue (hsl_color.lightness), TRUE, TRUE); + CW (hsl_color.lightness), TRUE, TRUE); break; } @@ -795,18 +794,18 @@ text_box_update_value (struct text_box *box, int newval, { text_box_update_value_1 (box, newval, update_if_p, TRUE); - hsl_color.hue = BigEndianValue (hue); - hsl_color.saturation = BigEndianValue (saturation); - hsl_color.lightness = BigEndianValue (lightness); + hsl_color.hue = CW (hue); + hsl_color.saturation = CW (saturation); + hsl_color.lightness = CW (lightness); HSL2RGB (&hsl_color, &rgb_color); text_box_update_value_1 (&text_boxes[red_index], - BigEndianValue (rgb_color.red), TRUE, TRUE); + CW (rgb_color.red), TRUE, TRUE); text_box_update_value_1 (&text_boxes[green_index], - BigEndianValue (rgb_color.green), TRUE, TRUE); + CW (rgb_color.green), TRUE, TRUE); text_box_update_value_1 (&text_boxes[blue_index], - BigEndianValue (rgb_color.blue), TRUE, TRUE); + CW (rgb_color.blue), TRUE, TRUE); break; } } @@ -872,7 +871,7 @@ event_loop (void) TEIdle (te); - switch (BigEndianValue (evt.what)) + switch (CW (evt.what)) { case mouseDown: { @@ -919,8 +918,8 @@ event_loop (void) { int center_y; - center_y = ( BigEndianValue (box->miniarrow_rect.top) - + BigEndianValue (box->miniarrow_rect.bottom)) / 2; + center_y = ( CW (box->miniarrow_rect.top) + + CW (box->miniarrow_rect.bottom)) / 2; integer_increment_p = FALSE; track_kount = 0; @@ -1039,17 +1038,17 @@ event_loop (void) #define current_compare_box_label ((StringPtr) "\005New: ") - MoveTo (( BigEndianValue (orig_compare_box_bounds->left) + MoveTo (( CW (orig_compare_box_bounds->left) - StringWidth (orig_compare_box_label)), - ( ( BigEndianValue (orig_compare_box_bounds->top) - + BigEndianValue (orig_compare_box_bounds->bottom)) / 2 + ( ( CW (orig_compare_box_bounds->top) + + CW (orig_compare_box_bounds->bottom)) / 2 - font_height / 2 + font_ascent)); DrawString (orig_compare_box_label); - MoveTo (( BigEndianValue (current_compare_box_bounds->left) + MoveTo (( CW (current_compare_box_bounds->left) - StringWidth (current_compare_box_label)), - ( ( BigEndianValue (current_compare_box_bounds->top) - + BigEndianValue (current_compare_box_bounds->bottom)) / 2 + ( ( CW (current_compare_box_bounds->top) + + CW (current_compare_box_bounds->bottom)) / 2 - font_height / 2 + font_ascent)); DrawString (current_compare_box_label); @@ -1062,7 +1061,7 @@ event_loop (void) { char ch; - ch = BigEndianValue (evt.message) & 0xFF; + ch = CL (evt.message) & 0xFF; switch (ch) { case '\r': @@ -1090,7 +1089,7 @@ event_loop (void) default: warning_unexpected ("unknown event.what `%d'", - BigEndianValue (evt.what)); + CW (evt.what)); break; } } @@ -1116,10 +1115,10 @@ color_wheel_init (void) *color_wheel_bounds = *template_color_wheel_bounds; OffsetRect (color_wheel_bounds, - StringWidth (label_0_degs), font_height); - color_wheel_center_y = ( BigEndianValue (color_wheel_bounds->top) - + BigEndianValue (color_wheel_bounds->bottom)) / 2; - color_wheel_center_x = ( BigEndianValue (color_wheel_bounds->left) - + BigEndianValue (color_wheel_bounds->right)) / 2; + color_wheel_center_y = ( CW (color_wheel_bounds->top) + + CW (color_wheel_bounds->bottom)) / 2; + color_wheel_center_x = ( CW (color_wheel_bounds->left) + + CW (color_wheel_bounds->right)) / 2; /* the colorwheel appears to be 192 pixels on a side, but it is really 208 pixels to handle target overlap */ @@ -1127,11 +1126,11 @@ color_wheel_init (void) bpp = PIXMAP_PIXEL_SIZE (GD_PMAP (MR (MainDevice))); color_wheel_pixmap.baseAddr = (Ptr)RM ((bpp == 8) - ? (intptr_t)&color_wheel_bits_8 + ? color_wheel_bits_8 : (bpp == 4 - ? (intptr_t)&color_wheel_bits_4 - : (gui_abort (), NULL))); - color_wheel_pixmap.rowBytes = BigEndianValue ((bpp == 8) + ? color_wheel_bits_4 + : (gui_abort (), nullptr))); + color_wheel_pixmap.rowBytes = CW ((bpp == 8) ? 0x80D0 : (bpp == 4 ? 0x8068 @@ -1167,14 +1166,14 @@ color_wheel_target_update (boolean_t short_cut_p) return; /* erase the current target */ - dst_rect.top = BigEndianValue (current_target_y - 7); - dst_rect.left = BigEndianValue (current_target_x - 7); - dst_rect.bottom = BigEndianValue (current_target_y + 9); - dst_rect.right = BigEndianValue (current_target_x + 9); + dst_rect.top = CW (current_target_y - 7); + dst_rect.left = CW (current_target_x - 7); + dst_rect.bottom = CW (current_target_y + 9); + dst_rect.right = CW (current_target_x + 9); src_rect = dst_rect; - OffsetRect (&src_rect, - BigEndianValue (color_wheel_bounds->left), - - BigEndianValue (color_wheel_bounds->top)); + OffsetRect (&src_rect, - CW (color_wheel_bounds->left), + - CW (color_wheel_bounds->top)); CopyBits ((BitMap *) &color_wheel_pixmap, PORT_BITS_FOR_COPY (thePort), &src_rect, &dst_rect, srcCopy, NULL); @@ -1259,11 +1258,11 @@ color_wheel_notice_lightness_change (void) for (i = 0; i < (int) NELEM (color_desc); i ++) { /* one half */ - hsl_color.lightness = BigEndianValue (lightness); - hsl_color.hue = BigEndianValue ( color_desc[i].angle + hsl_color.lightness = CW (lightness); + hsl_color.hue = CW ( color_desc[i].angle * 0xFFFF / 360.0); - hsl_color.saturation = BigEndianValue ( color_desc[i].dist + hsl_color.saturation = CW ( color_desc[i].dist * 0xFFFF); HSL2RGB (&hsl_color, &rgb_color); @@ -1292,10 +1291,10 @@ P4 (PUBLIC pascal trap, BOOLEAN, GetColor, GetFontInfo (&font_info); - font_height = ( BigEndianValue (font_info.ascent) - + BigEndianValue (font_info.descent) - + BigEndianValue (font_info.leading)); - font_ascent = BigEndianValue (font_info.ascent); + font_height = ( CW (font_info.ascent) + + CW (font_info.descent) + + CW (font_info.leading)); + font_ascent = CW (font_info.ascent); space_width = CharWidth (' '); } @@ -1303,15 +1302,15 @@ P4 (PUBLIC pascal trap, BOOLEAN, GetColor, { HSLColor *hsl_color = (HSLColor *)alloca (sizeof *hsl_color); - red = BigEndianValue (in_color->red); - green = BigEndianValue (in_color->green); - blue = BigEndianValue (in_color->blue); + red = CW (in_color->red); + green = CW (in_color->green); + blue = CW (in_color->blue); RGB2HSL (in_color, hsl_color); - hue = BigEndianValue (hsl_color->hue); - saturation = BigEndianValue (hsl_color->saturation); - lightness = BigEndianValue (hsl_color->lightness); + hue = CW (hsl_color->hue); + saturation = CW (hsl_color->saturation); + lightness = CW (hsl_color->lightness); color_wheel_noticed_lightness = -1; @@ -1364,7 +1363,7 @@ P4 (PUBLIC pascal trap, BOOLEAN, GetColor, LOCK_HANDLE_EXCURSION_1 (color_wheel_color_table, { - CTAB_SIZE_X (color_wheel_color_table) = BigEndianValue (23); + CTAB_SIZE_X (color_wheel_color_table) = CW (23); color_wheel_colors = CTAB_TABLE (color_wheel_color_table); color_wheel_notice_lightness_change (); diff --git a/src/qColorutil.cpp b/src/qColorutil.cpp index 2f243230..6bf83483 100644 --- a/src/qColorutil.cpp +++ b/src/qColorutil.cpp @@ -16,7 +16,6 @@ char ROMlib_rcsid_qColorutil[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; /* ctab with `zero' as the seed; if StdBits encounters a source pixmap with this as its color table, no depth conversion will be @@ -95,7 +94,7 @@ Executor::validate_fg_bk_ctab (void) if (memcmp (&old_fg, fg, sizeof old_fg) || memcmp (&old_bk, bk, sizeof old_bk)) - CTAB_SEED_X (ROMlib_fg_bk_ctab) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (ROMlib_fg_bk_ctab) = CL (GetCTSeed ()); return ROMlib_fg_bk_ctab; } @@ -139,7 +138,7 @@ Executor::validate_relative_bw_ctab (void) if (memcmp (&old_entry0, entry0, sizeof old_entry0) || memcmp (&old_entry1, entry1, sizeof old_entry1)) - CTAB_SEED_X (ROMlib_relative_bw_ctab) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (ROMlib_relative_bw_ctab) = CL (GetCTSeed ()); return ROMlib_relative_bw_ctab; } @@ -168,7 +167,7 @@ Executor::ROMlib_color_init (void) /* allocate and initialize ROMlib_bw_ctab */ ROMlib_bw_ctab = (CTabHandle) NewHandle (CTAB_STORAGE_FOR_SIZE (1)); CTAB_SIZE_X (ROMlib_bw_ctab) = CWC (1); - CTAB_SEED_X (ROMlib_bw_ctab) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (ROMlib_bw_ctab) = CL (GetCTSeed ()); CTAB_FLAGS_X (ROMlib_bw_ctab) = CWC (0); bw_ctab_table = CTAB_TABLE (ROMlib_bw_ctab); diff --git a/src/qCursor.cpp b/src/qCursor.cpp index ef15a437..756496f4 100644 --- a/src/qCursor.cpp +++ b/src/qCursor.cpp @@ -31,7 +31,6 @@ char ROMlib_rcsid_qCursor[] = #if !defined (CURSOR_DEBUG) using namespace Executor; -using namespace ByteSwap; #define HOST_SET_CURSOR(d,m,x,y) host_set_cursor (d,m,x,y) @@ -129,7 +128,7 @@ P1(PUBLIC pascal trap, void, SetCursor, Cursor *, cp) if (host_cursor_depth == 1) { HOST_SET_CURSOR ((char *) cp->data, (unsigned short *) cp->mask, - BigEndianValue (cp->hotSpot.h), BigEndianValue (cp->hotSpot.v)); + CW (cp->hotSpot.h), CW (cp->hotSpot.v)); } else { @@ -155,7 +154,7 @@ P1(PUBLIC pascal trap, void, SetCursor, Cursor *, cp) target_pixmap.cmpCount = CWC (1); target_pixmap.pixelType = CWC (0); target_pixmap.pixelSize = target_pixmap.cmpSize - = BigEndianValue (host_cursor_depth); + = CW (host_cursor_depth); /* the target pixmap colortable is not used by `convert_pixmap ()' target_pixmap.pmTable = ...; */ @@ -163,7 +162,7 @@ P1(PUBLIC pascal trap, void, SetCursor, Cursor *, cp) &ROMlib_cursor_rect, NULL); HOST_SET_CURSOR (data_baseaddr, (unsigned short *) cp->mask, - BigEndianValue (cp->hotSpot.h), BigEndianValue (cp->hotSpot.v)); + CW (cp->hotSpot.h), CW (cp->hotSpot.v)); } current_crsr = *cp; @@ -188,14 +187,14 @@ P0(PUBLIC pascal trap, void, InitCursor) P0(PUBLIC pascal trap, void, HideCursor) /* IMI-168 */ { ROMlib_restorecursor(); - CrsrState = BigEndianValue(BigEndianValue(CrsrState) - 1); + CrsrState = CW(CW(CrsrState) - 1); } P0(PUBLIC pascal trap, void, ShowCursor) /* IMI-168 */ { - if ( (CrsrState = BigEndianValue(BigEndianValue(CrsrState) + 1)) == 0 ) + if ( (CrsrState = CW(CW(CrsrState) + 1)) == 0 ) ROMlib_showcursor(); - if (BigEndianValue(CrsrState) > 0) + if (CW(CrsrState) > 0) CrsrState = 0; } @@ -205,7 +204,7 @@ namespace Executor { A1(PRIVATE, void, wewantpointermovements, INTEGER, x) { - CrsrState = BigEndianValue(BigEndianValue(CrsrState) + x); + CrsrState = CW(CW(CrsrState) + x); ROMlib_bewaremovement = TRUE; } @@ -220,8 +219,8 @@ P2(PUBLIC pascal trap, void, ShieldCursor, Rect *, rp, Point, p) /* IMI-474 */ EventRecord evt; GetOSEvent(0, &evt); - evt.where.v = BigEndianValue(evt.where.v) + p.v; - evt.where.h = BigEndianValue(evt.where.h) + p.h; + evt.where.v = CW(evt.where.v) + p.v; + evt.where.h = CW(evt.where.h) + p.h; if (PtInRect(evt.where, rp)) HideCursor(); else @@ -265,10 +264,10 @@ P1 (PUBLIC pascal trap, CCrsrHandle, GetCCursor, INTEGER, crsr_id) BlockMove ((Ptr) &resource->crsr, (Ptr) ccrsr, sizeof (CCrsr)); - /* NOTE: use BigEndianValue below instead of MR because they're overloading + /* NOTE: use CL below instead of MR because they're overloading crsrMap to have an offset rather than a handle */ - cursor_pixel_map_offset = BigEndianValue ((uint32) ccrsr->crsrMap); + cursor_pixel_map_offset = CL ((uint32) ccrsr->crsrMap); cursor_pixel_map_resource = (PixMapPtr) ((char *) resource + cursor_pixel_map_offset); @@ -278,7 +277,7 @@ P1 (PUBLIC pascal trap, CCrsrHandle, GetCCursor, INTEGER, crsr_id) (Ptr) STARH (cursor_pixel_map), sizeof *cursor_pixel_map_resource); - ccrsr_data_offset = BigEndianValue ((long) ccrsr->crsrData); + ccrsr_data_offset = CL ((long) ccrsr->crsrData); ccrsr_ctab_offset = (int) PIXMAP_TABLE_AS_OFFSET (MR (ccrsr->crsrMap)); ccrsr_data_size = ccrsr_ctab_offset - ccrsr_data_offset; @@ -289,7 +288,7 @@ P1 (PUBLIC pascal trap, CCrsrHandle, GetCCursor, INTEGER, crsr_id) ccrsr_data_size); tmp_ctab = (CTabPtr) ((char *) resource + ccrsr_ctab_offset); - ccrsr_ctab_size = CTAB_STORAGE_FOR_SIZE (BigEndianValue (tmp_ctab->ctSize)); + ccrsr_ctab_size = CTAB_STORAGE_FOR_SIZE (CW (tmp_ctab->ctSize)); h = RM (NewHandle (ccrsr_ctab_size)); PIXMAP_TABLE_X (MR (ccrsr->crsrMap)) = (CTabHandle) h; BlockMove ((Ptr) tmp_ctab, @@ -391,8 +390,8 @@ P1 (PUBLIC pascal trap, void, SetCCursor, /* only fields used by `convert_pixmap ()', baseAddr is filled in below */ memset (&ccrsr_xmap, 0, sizeof ccrsr_xmap); - ccrsr_xmap.rowBytes = BigEndianValue (2 * host_cursor_depth); - ccrsr_xmap.pixelSize = BigEndianValue (host_cursor_depth); + ccrsr_xmap.rowBytes = CW (2 * host_cursor_depth); + ccrsr_xmap.pixelSize = CW (host_cursor_depth); src = *STARH (CCRSR_MAP (ccrsr)); src.baseAddr = CCRSR_DATA (ccrsr)->p; @@ -404,7 +403,7 @@ P1 (PUBLIC pascal trap, void, SetCCursor, &ROMlib_cursor_rect, NULL); }); }); - CCRSR_XVALID_X (ccrsr) = BigEndianValue (host_cursor_depth); + CCRSR_XVALID_X (ccrsr) = CW (host_cursor_depth); CCRSR_ID_X (ccrsr) = CTAB_SEED_X (PIXMAP_TABLE (gd_pmap)); } @@ -414,14 +413,14 @@ P1 (PUBLIC pascal trap, void, SetCCursor, { HOST_SET_CURSOR ((char *) STARH (ccrsr_xdata), (unsigned short *) CCRSR_MASK (ccrsr), - BigEndianValue (hot_spot->h), BigEndianValue (hot_spot->v)); + CW (hot_spot->h), CW (hot_spot->v)); }); } else { HOST_SET_CURSOR ((char *) CCRSR_1DATA (ccrsr), (unsigned short *) CCRSR_MASK (ccrsr), - BigEndianValue (hot_spot->h), BigEndianValue (hot_spot->v)); + CW (hot_spot->h), CW (hot_spot->v)); } }); diff --git a/src/qGDevice.cpp b/src/qGDevice.cpp index 07cf4d01..a39c96b9 100644 --- a/src/qGDevice.cpp +++ b/src/qGDevice.cpp @@ -26,7 +26,6 @@ char ROMlib_rcsid_gdev[] = #include "rsys/executor.h" using namespace Executor; -using namespace ByteSwap; /* * determined experimentally -- this fix is needed for Energy Scheming because @@ -84,24 +83,24 @@ Executor::gd_allocate_main_device (void) GDevices with noDriver set. Looking around Apple's site shows that - people set this2 bit when + people set this bit when they're creating offscreen gDevices. It's not clear whether or not we should - be setting this2 bit. + be setting this bit. | (1 << noDriver) */ ); gd_set_bpp (graphics_device, !vdriver_grayscale_p, vdriver_fixed_clut_p, vdriver_bpp); gd_pixmap = GD_PMAP (graphics_device); - PIXMAP_SET_ROWBYTES_X (gd_pixmap, BigEndianValue (vdriver_row_bytes)); + PIXMAP_SET_ROWBYTES_X (gd_pixmap, CW (vdriver_row_bytes)); PIXMAP_BASEADDR_X (gd_pixmap) = (Ptr) RM (vdriver_fbuf); gd_rect = &GD_RECT (graphics_device); gd_rect->top = gd_rect->left = CWC (0); - gd_rect->bottom = BigEndianValue (vdriver_height); - gd_rect->right = BigEndianValue (vdriver_width); + gd_rect->bottom = CW (vdriver_height); + gd_rect->right = CW (vdriver_width); PIXMAP_BOUNDS (gd_pixmap) = *gd_rect; /* add ourselves to the device list */ @@ -156,8 +155,8 @@ P2 (PUBLIC pascal trap, GDHandle, NewGDevice, CTAB_FLAGS_X (PIXMAP_TABLE (GD_PMAP (this2))) |= CTAB_GDEVICE_BIT_X; GD_REF_CON_X (this2) = CWC (0); /* ??? */ - GD_REF_NUM_X (this2) = BigEndianValue (ref_num); /* ??? */ - GD_MODE_X (this2) = BigEndianValue (mode); /* ??? */ + GD_REF_NUM_X (this2) = CW (ref_num); /* ??? */ + GD_MODE_X (this2) = CL (mode); /* ??? */ GD_NEXT_GD_X (this2) = (GDHandle)RM (NULL); @@ -219,11 +218,11 @@ Executor::gd_set_bpp (GDHandle gd, boolean_t color_p, boolean_t fixed_p, int bpp gd_color_table = PIXMAP_TABLE (gd_pixmap); SetHandleSize ((Handle) gd_color_table, CTAB_STORAGE_FOR_SIZE ((1 << bpp) - 1)); - CTAB_SIZE_X (gd_color_table) = BigEndianValue ((1 << bpp) - 1); + CTAB_SIZE_X (gd_color_table) = CW ((1 << bpp) - 1); vdriver_get_colors (0, 1 << bpp, CTAB_TABLE (gd_color_table)); - CTAB_SEED_X (gd_color_table) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (gd_color_table) = CL (GetCTSeed ()); } } else @@ -267,9 +266,9 @@ P3 (PUBLIC pascal trap, void, SetDeviceAttribute, BOOLEAN, value) { if (value) - GD_FLAGS_X (gdh) |= BigEndianValue (1 << attribute); + GD_FLAGS_X (gdh) |= CW (1 << attribute); else - GD_FLAGS_X (gdh) &= BigEndianValue (~(1 << attribute)); + GD_FLAGS_X (gdh) &= CW (~(1 << attribute)); } P1 (PUBLIC pascal trap, void, SetGDevice, @@ -372,8 +371,8 @@ P4 (PUBLIC pascal trap, void, DeviceLoop, gd_rect = GD_RECT (gd); port_bounds = &(PORT_BOUNDS (thePort)); OffsetRect (&gd_rect, - BigEndianValue (port_bounds->left), - BigEndianValue (port_bounds->top)); + CW (port_bounds->left), + CW (port_bounds->top)); /* Intersect GDevice rect with the specified region. */ RectRgn (gd_rect_rgn, &gd_rect); @@ -387,7 +386,7 @@ P4 (PUBLIC pascal trap, void, DeviceLoop, if ((flags & allDevices) || !EmptyRgn (sect_rgn)) { - CToPascalCall (&drawing_proc, CTOP_DeviceLoopDrawingProcTemplate, + CToPascalCall((void*)drawing_proc, CTOP_DeviceLoopDrawingProcTemplate, PIXMAP_PIXEL_SIZE (GD_PMAP (gd)), GD_FLAGS (gd), gd, user_data); } @@ -462,7 +461,7 @@ P4 (PUBLIC pascal trap, OSErr, SetDepth, if (gdh != MR (MainDevice)) { warning_unexpected ("Setting the depth of a device not the screen; " - "this2 violates bogus assumptions in SetDepth."); + "this violates bogus assumptions in SetDepth."); } gd_pixmap = GD_PMAP (gdh); @@ -491,8 +490,8 @@ P4 (PUBLIC pascal trap, OSErr, SetDepth, gui_fatal ("vdriver not initialized, unable to change bpp"); gd_set_bpp (gdh, !vdriver_grayscale_p, vdriver_fixed_clut_p, bpp); - PIXMAP_SET_ROWBYTES_X (gd_pixmap, BigEndianValue (vdriver_row_bytes)); - screenBitsX.rowBytes = BigEndianValue (vdriver_row_bytes); + PIXMAP_SET_ROWBYTES_X (gd_pixmap, CW (vdriver_row_bytes)); + screenBitsX.rowBytes = CW (vdriver_row_bytes); cursor_reset_current_cursor (); diff --git a/src/qGWorld.cpp b/src/qGWorld.cpp index a3f8f803..f98b87a1 100644 --- a/src/qGWorld.cpp +++ b/src/qGWorld.cpp @@ -20,7 +20,6 @@ char ROMlib_rcsid_qGWorld[] = #include "rsys/qcolor.h" using namespace Executor; -using namespace ByteSwap; gw_info_t *gw_info_head, *gw_info_free; @@ -157,8 +156,8 @@ P6 (PUBLIC pascal trap, QDErr, NewGWorld, { Rect *temp_bounds = (Rect*)alloca (sizeof *temp_bounds); - temp_bounds->bottom = BigEndianValue (RECT_HEIGHT (bounds)); - temp_bounds->right = BigEndianValue (RECT_WIDTH (bounds)); + temp_bounds->bottom = CW (RECT_HEIGHT (bounds)); + temp_bounds->right = CW (RECT_WIDTH (bounds)); temp_bounds->top = temp_bounds->left = CWC (0); @@ -191,7 +190,7 @@ P6 (PUBLIC pascal trap, QDErr, NewGWorld, gd_pixmap = GD_PMAP (gw_gd); row_bytes = ((RECT_WIDTH (bounds) * depth + 31) / 32) * 4; - PIXMAP_SET_ROWBYTES_X (gd_pixmap, BigEndianValue (row_bytes)); + PIXMAP_SET_ROWBYTES_X (gd_pixmap, CW (row_bytes)); gd_pixmap_baseaddr = NewHandle (row_bytes * RECT_HEIGHT (bounds)); if (MemError () != noErr) @@ -220,9 +219,9 @@ P6 (PUBLIC pascal trap, QDErr, NewGWorld, { PIXMAP_PIXEL_TYPE_X (gd_pixmap) = CWC (0); PIXMAP_CMP_COUNT_X (gd_pixmap) = CWC (1); - PIXMAP_CMP_SIZE_X (gd_pixmap) = BigEndianValue (depth); + PIXMAP_CMP_SIZE_X (gd_pixmap) = CW (depth); } - PIXMAP_PIXEL_SIZE_X (gd_pixmap) = BigEndianValue (depth); + PIXMAP_PIXEL_SIZE_X (gd_pixmap) = CW (depth); if (ctab == NULL && depth <= 8) { int ctab_max_elt = (1 << depth) - 1; @@ -231,8 +230,8 @@ P6 (PUBLIC pascal trap, QDErr, NewGWorld, SetHandleSize ((Handle) ctab, CTAB_STORAGE_FOR_SIZE (ctab_max_elt)); - CTAB_SIZE_X (ctab) = BigEndianValue (ctab_max_elt); - CTAB_SEED_X (ctab) = BigEndianValue ((int32) depth); + CTAB_SIZE_X (ctab) = CW (ctab_max_elt); + CTAB_SEED_X (ctab) = CL ((int32) depth); CTAB_FLAGS_X (ctab) = CTAB_GDEVICE_BIT_X; memcpy (CTAB_TABLE (ctab), default_ctab_colors[ROMlib_log2[depth]], @@ -276,7 +275,7 @@ P6 (PUBLIC pascal trap, QDErr, NewGWorld, which may not match `depth' */ row_bytes = ((RECT_WIDTH (bounds) * depth + 31) / 32) * 4; - PIXMAP_SET_ROWBYTES_X (gw_pixmap, BigEndianValue (row_bytes)); + PIXMAP_SET_ROWBYTES_X (gw_pixmap, CW (row_bytes)); gw_pixmap_baseaddr = NewHandle (row_bytes * RECT_HEIGHT (bounds)); if (MemError () != noErr) @@ -414,7 +413,7 @@ P6 (PUBLIC pascal trap, GWorldFlags, UpdateGWorld, *temp_bounds = *bounds; OffsetRect (temp_bounds, - - BigEndianValue (temp_bounds->left), - BigEndianValue (temp_bounds->top)); + - CW (temp_bounds->left), - CW (temp_bounds->top)); bounds = temp_bounds; } } @@ -475,17 +474,17 @@ P6 (PUBLIC pascal trap, GWorldFlags, UpdateGWorld, dst_rect = *gw_bounds_ret; OffsetRect (&src_rect, - - BigEndianValue (src_rect.left), - BigEndianValue (src_rect.top)); + - CW (src_rect.left), - CW (src_rect.top)); OffsetRect (&dst_rect, - - BigEndianValue (dst_rect.left), - BigEndianValue (dst_rect.top)); + - CW (dst_rect.left), - CW (dst_rect.top)); SectRect (&src_rect, &dst_rect, &temp_rect); src_rect = dst_rect = temp_rect; OffsetRect (&src_rect, - BigEndianValue (gw_bounds->left), BigEndianValue (gw_bounds->top)); + CW (gw_bounds->left), CW (gw_bounds->top)); OffsetRect (&dst_rect, - BigEndianValue (gw_bounds_ret->left), BigEndianValue (gw_bounds_ret->top)); + CW (gw_bounds_ret->left), CW (gw_bounds_ret->top)); } CopyBits (PORT_BITS_FOR_COPY (gw), @@ -723,7 +722,7 @@ P4 (PUBLIC pascal trap, QDErr, NewScreenBuffer, rowbytes = ((width * bpp + 31) / 32) * 4; - PIXMAP_SET_ROWBYTES_X (pixels, BigEndianValue (rowbytes)); + PIXMAP_SET_ROWBYTES_X (pixels, CW (rowbytes)); /* not clear if we should be allocating a ptr or a handle for the pixmap baseaddr */ diff --git a/src/qGrafport.cpp b/src/qGrafport.cpp index edea7a0d..7622e359 100644 --- a/src/qGrafport.cpp +++ b/src/qGrafport.cpp @@ -22,7 +22,6 @@ char ROMlib_rcsid_qGrafport[] = #include "rsys/picture.h" using namespace Executor; -using namespace ByteSwap; P1(PUBLIC pascal trap, void, InitGraf, Ptr, gp) { @@ -36,7 +35,7 @@ P1(PUBLIC pascal trap, void, InitGraf, Ptr, gp) /* screenBitsX flag bits must not be set */ screenBitsX.baseAddr = PIXMAP_BASEADDR_X (main_gd_pixmap); - screenBitsX.rowBytes = BigEndianValue (PIXMAP_ROWBYTES (main_gd_pixmap) / + screenBitsX.rowBytes = CW (PIXMAP_ROWBYTES (main_gd_pixmap) / PIXMAP_PIXEL_SIZE (main_gd_pixmap)); screenBitsX.bounds = PIXMAP_BOUNDS (main_gd_pixmap); @@ -68,7 +67,7 @@ P1(PUBLIC pascal trap, void, InitGraf, Ptr, gp) arrowX.hotSpot.h = arrowX.hotSpot.v = CWC(1); CrsrState = 0; - RndSeed = BigEndianValue (TickCount ()); + RndSeed = CL (TickCount ()); ScrVRes = ScrHRes = CWC(72); ScreenRow = screenBitsX.rowBytes; randSeedX = CLC (1); @@ -187,8 +186,8 @@ P1(PUBLIC pascal trap, void, SetPortBits, BitMap *, bm) P2(PUBLIC pascal trap, void, PortSize, INTEGER, w, INTEGER, h) { - PORT_RECT (thePort).bottom = BigEndianValue (BigEndianValue (PORT_RECT (thePort).top) + h); - PORT_RECT (thePort).right = BigEndianValue (BigEndianValue (PORT_RECT (thePort).left) + w); + PORT_RECT (thePort).bottom = CW (CW (PORT_RECT (thePort).top) + h); + PORT_RECT (thePort).right = CW (CW (PORT_RECT (thePort).left) + w); } P2 (PUBLIC pascal trap, void, MovePortTo, INTEGER, lg, INTEGER, tg) @@ -200,8 +199,8 @@ P2 (PUBLIC pascal trap, void, MovePortTo, INTEGER, lg, INTEGER, tg) current_port = thePort; port_bounds = &PORT_BOUNDS (current_port); port_rect = &PORT_RECT (current_port); - lg = BigEndianValue (port_rect->left) - lg; - tg = BigEndianValue (port_rect->top) - tg; + lg = CW (port_rect->left) - lg; + tg = CW (port_rect->top) - tg; w = RECT_WIDTH (port_bounds); h = RECT_HEIGHT (port_bounds); SetRect (port_bounds, lg, tg, lg + w, tg + h); @@ -220,9 +219,9 @@ P2 (PUBLIC pascal trap, void, SetOrigin, INTEGER, h, INTEGER, v) PICOP (OP_Origin); - swappeddh = BigEndianValue(dh); + swappeddh = CW(dh); PICWRITE (&swappeddh, sizeof swappeddh); - swappeddv = BigEndianValue(dv); + swappeddv = CW(dv); PICWRITE (&swappeddv, sizeof swappeddv); }); OffsetRect (&PORT_BOUNDS (thePort), dh, dv); diff --git a/src/qHooks.cpp b/src/qHooks.cpp index b62c2d23..4358387d 100644 --- a/src/qHooks.cpp +++ b/src/qHooks.cpp @@ -46,7 +46,7 @@ Executor::ROMlib_CALLTEXT (INTEGER bc, Ptr bufp, Point num, Point den) { ROMlib_hook (q_textprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdText, bc, bufp, num, den); + CToPascalCall((void*)pp, CTOP_StdText, bc, bufp, num, den); HOOKRESTOREREGS (); } else @@ -66,7 +66,7 @@ Executor::ROMlib_CALLLINE (Point p) { ROMlib_hook (q_lineprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdLine, p); + CToPascalCall((void*)pp, CTOP_StdLine, p); HOOKRESTOREREGS (); } else @@ -85,7 +85,7 @@ Executor::ROMlib_CALLRECT (GrafVerb v, Rect * rp) { ROMlib_hook (q_rectprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdRect, v, rp); + CToPascalCall((void*)pp, CTOP_StdRect, v, rp); HOOKRESTOREREGS (); } else @@ -104,7 +104,7 @@ Executor::ROMlib_CALLOVAL (GrafVerb v, Rect * rp) { ROMlib_hook (q_ovalprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdOval, v, rp); + CToPascalCall((void*)pp, CTOP_StdOval, v, rp); HOOKRESTOREREGS (); } else @@ -123,7 +123,7 @@ Executor::ROMlib_CALLRRECT (GrafVerb v, Rect * rp, INTEGER ow, INTEGER oh) { ROMlib_hook (q_rrectprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdRRect, v, rp, ow, oh); + CToPascalCall((void*)pp, CTOP_StdRRect, v, rp, ow, oh); HOOKRESTOREREGS (); } else @@ -142,7 +142,7 @@ Executor::ROMlib_CALLARC (GrafVerb v, Rect * rp, INTEGER starta, INTEGER arca) { ROMlib_hook (q_arcprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdArc, v, rp, starta, arca); + CToPascalCall((void*)pp, CTOP_StdArc, v, rp, starta, arca); HOOKRESTOREREGS (); } else @@ -162,7 +162,7 @@ Executor::ROMlib_CALLRGN (GrafVerb v, RgnHandle rh) { ROMlib_hook (q_rgnprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdRgn, v, rh); + CToPascalCall((void*)pp, CTOP_StdRgn, v, rh); HOOKRESTOREREGS (); } else @@ -181,7 +181,7 @@ Executor::ROMlib_CALLPOLY (GrafVerb v, PolyHandle rh) { ROMlib_hook (q_polyprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdPoly, v, rh); + CToPascalCall((void*)pp, CTOP_StdPoly, v, rh); HOOKRESTOREREGS (); } else @@ -201,7 +201,7 @@ Executor::ROMlib_CALLBITS (BitMap * bmp, const Rect *srcrp, const Rect *dstrp, { ROMlib_hook (q_bitsprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdBits, bmp, srcrp, dstrp, mode, maskrh); + CToPascalCall((void*)pp, CTOP_StdBits, bmp, srcrp, dstrp, mode, maskrh); HOOKRESTOREREGS (); } else @@ -220,7 +220,7 @@ Executor::ROMlib_CALLCOMMENT (INTEGER kind, INTEGER size, Handle datah) { ROMlib_hook (q_commentprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdComment, kind, size, datah); + CToPascalCall((void*)pp, CTOP_StdComment, kind, size, datah); HOOKRESTOREREGS (); } else @@ -241,7 +241,7 @@ Executor::ROMlib_CALLTXMEAS (INTEGER bc, Ptr bufp, Point * nump, Point * denp, { ROMlib_hook (q_txmeasprocnumber); HOOKSAVEREGS (); - retval = CToPascalCall (&pp, CTOP_StdTxMeas, bc, bufp, + retval = CToPascalCall((void*)pp, CTOP_StdTxMeas, bc, bufp, nump, denp, fip); HOOKRESTOREREGS (); } @@ -262,7 +262,7 @@ Executor::ROMlib_PICWRITE (Ptr addr, INTEGER count) { ROMlib_hook (q_putpicprocnumber); HOOKSAVEREGS (); - CToPascalCall (&pp, CTOP_StdPutPic, addr, count); + CToPascalCall((void*)pp, CTOP_StdPutPic, addr, count); HOOKRESTOREREGS (); } else diff --git a/src/qIMIV.cpp b/src/qIMIV.cpp index e3d2bb9f..d6358958 100644 --- a/src/qIMIV.cpp +++ b/src/qIMIV.cpp @@ -31,7 +31,6 @@ namespace Executor { } using namespace Executor; -using namespace ByteSwap; #define DOLEFT 1 #define DORIGHT 2 @@ -224,14 +223,14 @@ A9 (PRIVATE, void, xSeedFill, unsigned char *, srcp, unsigned char *, dstp, width, Negate); if (dstp >= (unsigned char *) MR(screenBitsX.baseAddr)) { byteoff = dstp - (unsigned char *) MR(screenBitsX.baseAddr); - voff = byteoff / BigEndianValue(screenBitsX.rowBytes); - if (voff < BigEndianValue(screenBitsX.bounds.bottom) - BigEndianValue(screenBitsX.bounds.top)) + voff = byteoff / CW(screenBitsX.rowBytes); + if (voff < CW(screenBitsX.bounds.bottom) - CW(screenBitsX.bounds.top)) { - dirty_rect_accrue (BigEndianValue (screenBitsX.bounds.top) + voff, - (BigEndianValue (screenBitsX.bounds.left) - + (byteoff % BigEndianValue(screenBitsX.rowBytes) * 8L)), - BigEndianValue (temprect.top) + height, - BigEndianValue (temprect.left) + (LONGINT) width * 16); + dirty_rect_accrue (CW (screenBitsX.bounds.top) + voff, + (CW (screenBitsX.bounds.left) + + (byteoff % CW(screenBitsX.rowBytes) * 8L)), + CW (temprect.top) + height, + CW (temprect.left) + (LONGINT) width * 16); } } TRAPEND(); @@ -272,10 +271,10 @@ create_scratch_bitmap_if_necessary (uint8 **_fbuf, offset = fbuf - screen_fbuf; - src_rect->top = BigEndianValue (offset / screen_row_bytes); - src_rect->bottom = BigEndianValue (offset / screen_row_bytes + height); - src_rect->left = BigEndianValue ((offset % screen_row_bytes) * 8); - src_rect->right = BigEndianValue ((offset % screen_row_bytes) * 8 + src_rect->top = CW (offset / screen_row_bytes); + src_rect->bottom = CW (offset / screen_row_bytes + height); + src_rect->left = CW ((offset % screen_row_bytes) * 8); + src_rect->right = CW ((offset % screen_row_bytes) * 8 + word_width * 16); *src_pm = *STARH (gd_pmap); @@ -389,16 +388,16 @@ copy_mask_1 (BitMap *src_bm, BitMap *mask_bm, BitMap *dst_bm, dst_top = dst_bottom = *dst_rect; src_bottom.top = src_top.bottom - = BigEndianValue (BigEndianValue (src_top.bottom) - src_half); + = CW (CW (src_top.bottom) - src_half); mask_bottom.top = mask_top.bottom - = BigEndianValue (BigEndianValue (mask_top.bottom) - mask_half); + = CW (CW (mask_top.bottom) - mask_half); dst_bottom.top = dst_top.bottom - = BigEndianValue (BigEndianValue (dst_top.bottom) - dst_half); + = CW (CW (dst_top.bottom) - dst_half); mask_top_bm = *mask_bm; mask_bottom_bm = *mask_bm; mask_bottom_bm.bounds.top = mask_top_bm.bounds.bottom - = BigEndianValue (BigEndianValue (mask_top_bm.bounds.bottom) - mask_half); + = CW (CW (mask_top_bm.bounds.bottom) - mask_half); copy_mask_1 (src_bm, &mask_top_bm, dst_bm, &src_top, &mask_top, &dst_top); @@ -427,7 +426,7 @@ P6 (PUBLIC pascal trap, void, CopyMask, /* IMIV-24 */ TEMP_ALLOC_ALLOCATE (mask_bits, temp_mask_bits, row_bytes * RECT_HEIGHT (mask_rect)); mask_bm.baseAddr = (Ptr)RM (mask_bits); - mask_bm.rowBytes = BigEndianValue (row_bytes); + mask_bm.rowBytes = CW (row_bytes); mask_bm.bounds = *mask_rect; CopyBits (mask_bogo_map, &mask_bm, diff --git a/src/qIMV.cpp b/src/qIMV.cpp index 20844735..98e355a0 100644 --- a/src/qIMV.cpp +++ b/src/qIMV.cpp @@ -18,7 +18,6 @@ char ROMlib_rcsid_qIMV[] = #include "rsys/tempalloc.h" using namespace Executor; -using namespace ByteSwap; /* these stubs are here to make my Pic V2 code work */ @@ -87,10 +86,10 @@ P3 (PUBLIC pascal trap, void, GetCPixel, INTEGER, h, INTEGER, v, temp_pm.pmTable = RM (ctab); pixmap_set_pixel_fields (&temp_pm, bpp); - src_rect.top = BigEndianValue (v); - src_rect.bottom = BigEndianValue (v + 1); - src_rect.left = BigEndianValue (h); - src_rect.right = BigEndianValue (h + 1); + src_rect.top = CW (v); + src_rect.bottom = CW (v + 1); + src_rect.left = CW (h); + src_rect.right = CW (h + 1); dst_rect = temp_pm.bounds; @@ -117,7 +116,7 @@ P3 (PUBLIC pascal trap, void, GetCPixel, INTEGER, h, INTEGER, v, /* non-device color tables aren't guaranteed to be sorted, so we need to hunt for an entry with the specified value */ - swapped_pixval = BigEndianValue (pixval); + swapped_pixval = CW (pixval); for (i = CTAB_SIZE (ctab); i >= 0; i--) if (cspec[i].value == swapped_pixval) break; @@ -143,10 +142,10 @@ P3 (PUBLIC pascal trap, void, SetCPixel, INTEGER, h, INTEGER, v, RGBColor save_fg_rgb; int32 save_fg; - temp_rect.top = BigEndianValue (v); - temp_rect.bottom = BigEndianValue (v + 1); - temp_rect.left = BigEndianValue (h); - temp_rect.right = BigEndianValue (h + 1); + temp_rect.top = CW (v); + temp_rect.bottom = CW (v + 1); + temp_rect.left = CW (h); + temp_rect.right = CW (h + 1); port = thePort; cgrafport_p = CGrafPort_p (port); @@ -226,7 +225,7 @@ P8 (PUBLIC pascal trap, void, SeedCFill, BitMap *, srcbp, BitMap *, dstbp, } else { - mr.matchData = BigEndianValue (matchdata); + mr.matchData = CL (matchdata); } GetCPixel (seedh, seedv, &pixel); @@ -249,11 +248,11 @@ P8 (PUBLIC pascal trap, void, SeedCFill, BitMap *, srcbp, BitMap *, dstbp, height = RECT_HEIGHT (srcrp); temp_rect.top = temp_rect.left = CWC (0); - temp_rect.right = BigEndianValue (width); - temp_rect.bottom = BigEndianValue (height); + temp_rect.right = CW (width); + temp_rect.bottom = CW (height); row_words = (width + 15) / 16; - temp_bitmap1.rowBytes = BigEndianValue (row_words * 2); + temp_bitmap1.rowBytes = CW (row_words * 2); TEMP_ALLOC_ALLOCATE (t, temp_bitmap1_bits, row_words * 2 * height); temp_bitmap1.baseAddr = (Ptr)RM (t); memset (MR (temp_bitmap1.baseAddr), '\377', row_words * 2 * height); @@ -309,7 +308,7 @@ P7 (PUBLIC pascal trap, void, CalcCMask, BitMap *, srcbp, BitMap *, dstbp, } else { - mr.matchData = BigEndianValue (matchdata); + mr.matchData = CL (matchdata); } mr.red = seedrgbp->red; @@ -330,8 +329,8 @@ P7 (PUBLIC pascal trap, void, CalcCMask, BitMap *, srcbp, BitMap *, dstbp, height = RECT_HEIGHT (srcrp); temp_rect.top = temp_rect.left = CWC (0); - temp_rect.right = BigEndianValue (width); - temp_rect.bottom = BigEndianValue (height); + temp_rect.right = CW (width); + temp_rect.bottom = CW (height); row_words = (width + 15) / 16; temp_bitmap1.rowBytes = CW (row_words * 2); diff --git a/src/qIMVI.cpp b/src/qIMVI.cpp index 49f0aec2..eaa71be5 100644 --- a/src/qIMVI.cpp +++ b/src/qIMVI.cpp @@ -21,7 +21,6 @@ char ROMlib_rcsid_qIMVI[] = #include "sspairtable.ctable" using namespace Executor; -using namespace ByteSwap; /* * Basically a region is just a bunch of stop start pairs where the pairs @@ -75,14 +74,14 @@ P2 (PUBLIC pascal trap, OSErr, BitMapToRegion, RgnHandle, rh, return rgnTooBigErr; \ } \ else \ - *outp++ = BigEndianValue(v); \ + *outp++ = CW(v); \ } while (0) - top = BigEndianValue(bmp->bounds.top); - left = BigEndianValue(bmp->bounds.left); - bottom = BigEndianValue(bmp->bounds.bottom); - right = BigEndianValue(bmp->bounds.right); - rowbytes = BigEndianValue(bmp->rowBytes) & ROWMASK; + top = CW(bmp->bounds.top); + left = CW(bmp->bounds.left); + bottom = CW(bmp->bounds.bottom); + right = CW(bmp->bounds.right); + rowbytes = CW(bmp->rowBytes) & ROWMASK; linelen = (right - left + 7) / 8; if (linelen <= 0) /*-->*/ goto it_is_empty; @@ -151,7 +150,7 @@ P2 (PUBLIC pascal trap, OSErr, BitMapToRegion, RgnHandle, rh, HxX(rh, rgnBBox) = bmp->bounds; /* #warning we are not setting the bounding box properly */ #if 1 - HxX(rh, rgnSize) = BigEndianValue(rgnsize); + HxX(rh, rgnSize) = CW(rgnsize); #else RGN_SET_SMALL (rh); #endif diff --git a/src/qIMVxfer.cpp b/src/qIMVxfer.cpp index 59a95eca..f91da2cc 100644 --- a/src/qIMVxfer.cpp +++ b/src/qIMVxfer.cpp @@ -14,7 +14,6 @@ char ROMlib_rcsid_qIMVxfer[] = #include "rsys/cquick.h" using namespace Executor; -using namespace ByteSwap; /* Helper function: creates a new, sorted table so the value is the * same as the index (although we don't bother filling in most of the @@ -26,8 +25,8 @@ sort_table (CTabPtr old, CTabPtr new1, unsigned max_color) int i; memset (&new1->ctTable, 0, (max_color + 1) * sizeof (ColorSpec)); - for (i = BigEndianValue (old->ctSize); i >= 0; i--) - new1->ctTable[BigEndianValue (old->ctTable[i].value) & max_color].rgb = + for (i = CW (old->ctSize); i >= 0; i--) + new1->ctTable[CW (old->ctTable[i].value) & max_color].rgb = old->ctTable[i].rgb; return new1; @@ -116,7 +115,7 @@ Executor::convert_transparent (const PixMap *src1, const PixMap *src2, boolean_t copy1_p, copy2_p; write_back_data_t write_back1, write_back2; - bits_per_pixel = BigEndianValue (src1->pixelSize); + bits_per_pixel = CW (src1->pixelSize); rgb_spec = pixmap_rgb_spec (src1); /* For bits_per_pixel == 1, you are just supposed to use the original @@ -156,7 +155,7 @@ Executor::convert_transparent (const PixMap *src1, const PixMap *src2, src1_rowbytes = BITMAP_ROWBYTES (src1); src2_rowbytes = BITMAP_ROWBYTES (src2); dst_rowbytes = (width * bits_per_pixel + 31) / 32 * 4; - dst->rowBytes = BigEndianValue (dst_rowbytes); + dst->rowBytes = CW (dst_rowbytes); /* We want to run x from 0 to width; adding these offsets gives us * the real x for the source bitmaps. @@ -164,8 +163,8 @@ Executor::convert_transparent (const PixMap *src1, const PixMap *src2, if (tile_src1_p) src1_deltax = pat_x_offset; else - src1_deltax = BigEndianValue (r1->left) - BigEndianValue (src1->bounds.left); - src2_deltax = BigEndianValue (r2->left) - BigEndianValue (src2->bounds.left); + src1_deltax = CW (r1->left) - CW (src1->bounds.left); + src2_deltax = CW (r2->left) - CW (src2->bounds.left); /* Compute a pointer to the base of the first row of each bitmap. */ if (tile_src1_p) @@ -178,12 +177,12 @@ Executor::convert_transparent (const PixMap *src1, const PixMap *src2, { src1_row_base = (unsigned char *) (MR (src1->baseAddr) - + ((BigEndianValue (r1->top) - BigEndianValue (src1->bounds.top)) * src1_rowbytes)); + + ((CW (r1->top) - CW (src1->bounds.top)) * src1_rowbytes)); } src2_row_base = (unsigned char *) (MR (src2->baseAddr) - + (BigEndianValue (r2->top) - BigEndianValue (src2->bounds.top)) * src2_rowbytes); + + (CW (r2->top) - CW (src2->bounds.top)) * src2_rowbytes); dst_row_base = (unsigned char *) MR (dst->baseAddr); #define RGB_TO_INDIRECT_PIXEL(rgb, pixel) \ @@ -199,10 +198,10 @@ Executor::convert_transparent (const PixMap *src1, const PixMap *src2, switch (bpp) \ { \ case 16: \ - (pixel) = BigEndianValue (swapped_pixel); \ + (pixel) = CW (swapped_pixel); \ break; \ case 32: \ - (pixel) = BigEndianValue (swapped_pixel); \ + (pixel) = CL (swapped_pixel); \ break; \ default: \ gui_fatal ("unknown bpp"); \ @@ -390,7 +389,7 @@ Executor::convert_pixmap_with_IMV_mode (const PixMap *src1, const PixMap *src2, boolean_t copy1_p, copy2_p; write_back_data_t write_back1, write_back2; - bits_per_pixel = BigEndianValue (src1->pixelSize); + bits_per_pixel = CW (src1->pixelSize); rgb_spec = pixmap_rgb_spec (src1); /* For bits_per_pixel == 1, you are just supposed to use the original @@ -482,7 +481,7 @@ Executor::convert_pixmap_with_IMV_mode (const PixMap *src1, const PixMap *src2, src1_rowbytes = BITMAP_ROWBYTES (src1); src2_rowbytes = BITMAP_ROWBYTES (src2); dst_rowbytes = (width * bits_per_pixel + 31) / 32 * 4; - dst->rowBytes = BigEndianValue (dst_rowbytes); + dst->rowBytes = CW (dst_rowbytes); /* We want to run x from 0 to width; adding these offsets gives us * the real x for the source bitmaps. @@ -490,8 +489,8 @@ Executor::convert_pixmap_with_IMV_mode (const PixMap *src1, const PixMap *src2, if (tile_src1_p) src1_deltax = pat_x_offset; else - src1_deltax = BigEndianValue (r1->left) - BigEndianValue (src1->bounds.left); - src2_deltax = BigEndianValue (r2->left) - BigEndianValue (src2->bounds.left); + src1_deltax = CW (r1->left) - CW (src1->bounds.left); + src2_deltax = CW (r2->left) - CW (src2->bounds.left); /* Compute a pointer to the base of the first row of each bitmap. */ if (tile_src1_p) @@ -502,17 +501,17 @@ Executor::convert_pixmap_with_IMV_mode (const PixMap *src1, const PixMap *src2, else { src1_row_base = (unsigned char *) (MR (src1->baseAddr) - + ((BigEndianValue (r1->top) - BigEndianValue (src1->bounds.top)) + + ((CW (r1->top) - CW (src1->bounds.top)) * src1_rowbytes)); } src2_row_base = (unsigned char *) (MR (src2->baseAddr) - + (BigEndianValue (r2->top) - BigEndianValue (src2->bounds.top)) * src2_rowbytes); + + (CW (r2->top) - CW (src2->bounds.top)) * src2_rowbytes); dst_row_base = (unsigned char *) MR (dst->baseAddr); /* Fetch the "op color" fields, in case they are needed. */ - op_red = BigEndianValue (op_color->red); - op_green = BigEndianValue (op_color->green); - op_blue = BigEndianValue (op_color->blue); + op_red = CW (op_color->red); + op_green = CW (op_color->green); + op_blue = CW (op_color->blue); #define CONVERT_BITS(read1, read2, write, next1, transform, bpp) \ { \ @@ -555,9 +554,9 @@ Executor::convert_pixmap_with_IMV_mode (const PixMap *src1, const PixMap *src2, ({ \ const RGBColor *color; \ color = &ctab->ctTable[pixel].rgb; \ - (r) = BigEndianValue (color->red); \ - (g) = BigEndianValue (color->green); \ - (b) = BigEndianValue (color->blue); \ + (r) = CW (color->red); \ + (g) = CW (color->green); \ + (b) = CW (color->blue); \ })) #define DIRECT_PIXEL_TO_RGB(bpp, pixel, red_out, green_out, blue_out, \ dummy_ctab) \ @@ -566,9 +565,9 @@ Executor::convert_pixmap_with_IMV_mode (const PixMap *src1, const PixMap *src2, RGBColor color; \ \ (*rgb_spec->pixel_to_rgbcolor) (rgb_spec, (pixel), &color); \ - (red_out) = BigEndianValue (color.red); \ - (green_out) = BigEndianValue (color.green); \ - (blue_out) = BigEndianValue (color.blue); \ + (red_out) = CW (color.red); \ + (green_out) = CW (color.green); \ + (blue_out) = CW (color.blue); \ })) #define PIXEL_TO_RGB(bpp, pixel, red, green, blue, ctab) \ ((void) \ diff --git a/src/qMisc.cpp b/src/qMisc.cpp index 5e3696f5..2f4d8792 100644 --- a/src/qMisc.cpp +++ b/src/qMisc.cpp @@ -22,7 +22,6 @@ char ROMlib_rcsid_qMisc[] = #include "rsys/region.h" using namespace Executor; -using namespace ByteSwap; namespace Executor { static BOOLEAN EquivRect(Rect*, Rect*); @@ -42,8 +41,8 @@ P0(PUBLIC pascal trap, INTEGER, Random) RndSeed = Cx(TickCount()); /* what better? */ if (RANDSEED >= 0x80000000) - randSeedX = BigEndianValue((RANDSEED & 0x7FFFFFFF) + 1); - randSeedX = BigEndianValue((RANDSEED * 16807 + + randSeedX = CL((RANDSEED & 0x7FFFFFFF) + 1); + randSeedX = CL((RANDSEED * 16807 + ( (((RANDSEED >> 14) * 16807) + (((RANDSEED & ((1<<14)-1)) * 16807) >> 14)) @@ -71,10 +70,10 @@ P2 (PUBLIC pascal trap, BOOLEAN, GetPixel, INTEGER, h, INTEGER, v) temp_bm.bounds.right = CWC (1); temp_bm.rowBytes = CWC (4); - src_rect.top = BigEndianValue (v); - src_rect.bottom = BigEndianValue (v + 1); - src_rect.left = BigEndianValue (h); - src_rect.right = BigEndianValue (h + 1); + src_rect.top = CW (v); + src_rect.bottom = CW (v + 1); + src_rect.left = CW (h); + src_rect.right = CW (h + 1); dst_rect = temp_bm.bounds; @@ -121,12 +120,12 @@ P3(PUBLIC pascal trap, void, ScalePt, Point *, pt, Rect *, srcr, Rect *, dstr) dstdh = Cx(dstr->right) - Cx(dstr->left); dstdv = Cx(dstr->bottom) - Cx(dstr->top); - pt->h = BigEndianValue(((((LONGINT) BigEndianValue(pt->h) * dstdh) << 1) / srcdh + 1) >> 1); - pt->v = BigEndianValue(((((LONGINT) BigEndianValue(pt->v) * dstdv) << 1) / srcdv + 1) >> 1); + pt->h = CW(((((LONGINT) CW(pt->h) * dstdh) << 1) / srcdh + 1) >> 1); + pt->v = CW(((((LONGINT) CW(pt->v) * dstdv) << 1) / srcdv + 1) >> 1); - if (BigEndianValue(pt->v) < 1) + if (CW(pt->v) < 1) pt->v = CWC(1); - if (BigEndianValue(pt->h) < 1) + if (CW(pt->h) < 1) pt->h = CWC(1); } } @@ -140,12 +139,12 @@ P3(PUBLIC pascal trap, void, MapPt, Point *, pt, Rect *, srcr, Rect *, dstr) dstdh = Cx(dstr->right) - Cx(dstr->left); dstdv = Cx(dstr->bottom) - Cx(dstr->top); - pt->h = BigEndianValue(BigEndianValue(pt->h) - (Cx(srcr->left))); - pt->v = BigEndianValue(BigEndianValue(pt->v) - (Cx(srcr->top))); - pt->h = BigEndianValue((LONGINT) BigEndianValue(pt->h) * dstdh / srcdh); - pt->v = BigEndianValue((LONGINT) BigEndianValue(pt->v) * dstdv / srcdv); - pt->h = BigEndianValue(BigEndianValue(pt->h) + (Cx(dstr->left))); - pt->v = BigEndianValue(BigEndianValue(pt->v) + (Cx(dstr->top))); + pt->h = CW(CW(pt->h) - (Cx(srcr->left))); + pt->v = CW(CW(pt->v) - (Cx(srcr->top))); + pt->h = CW((LONGINT) CW(pt->h) * dstdh / srcdh); + pt->v = CW((LONGINT) CW(pt->v) * dstdv / srcdv); + pt->h = CW(CW(pt->h) + (Cx(dstr->left))); + pt->v = CW(CW(pt->v) + (Cx(dstr->top))); } P3(PUBLIC pascal trap, void, MapRect, Rect *, r, Rect *, srcr, Rect *, dstr) @@ -175,10 +174,10 @@ P3(PUBLIC pascal trap, void, MapRgn, RgnHandle, rh, Rect *, srcr, Rect *, dstr) if (RGN_SMALL_P (rh)) MapRect(&HxX(rh, rgnBBox), srcr, dstr); else { - srcdh = BigEndianValue(srcr->right) - (xoff1 = BigEndianValue(srcr->left)); - dstdh = BigEndianValue(dstr->right) - (xoff2 = BigEndianValue(dstr->left)); - srcdv = BigEndianValue(srcr->bottom) - (yoff1 = BigEndianValue(srcr->top) ); - dstdv = BigEndianValue(dstr->bottom) - (yoff2 = BigEndianValue(dstr->top) ); + srcdh = CW(srcr->right) - (xoff1 = CW(srcr->left)); + dstdh = CW(dstr->right) - (xoff2 = CW(dstr->left)); + srcdv = CW(srcr->bottom) - (yoff1 = CW(srcr->top) ); + dstdv = CW(dstr->bottom) - (yoff2 = CW(dstr->top) ); xcoff = FixRatio(dstdh, srcdh); ycoff = FixRatio(dstdv, srcdv); ip = op = (INTEGER *) STARH(rh) + 5; @@ -187,11 +186,11 @@ P3(PUBLIC pascal trap, void, MapRgn, RgnHandle, rh, Rect *, srcr, Rect *, dstr) mergebuf = buf1; freebuf = buf2; do { - done = (newv = BigEndianValue(*ip++)) == 32767; + done = (newv = CW(*ip++)) == 32767; MAPV(newv); if (newv != oldv || done) { if (mergebuf[0] != 32767) { - *op++ = BigEndianValue(oldv); + *op++ = CW(oldv); saveop = op; hold = IMPOSSIBLE; for (tempp = mergebuf; (x1 = *tempp++) != 32767;) { @@ -201,12 +200,12 @@ P3(PUBLIC pascal trap, void, MapRgn, RgnHandle, rh, Rect *, srcr, Rect *, dstr) else if (hold == x1) hold = IMPOSSIBLE; else { - *op++ = BigEndianValue(hold); + *op++ = CW(hold); hold = (unsigned short) x1; } } if (hold != IMPOSSIBLE) - *op++ = BigEndianValue(hold); + *op++ = CW(hold); gui_assert(!((op - saveop)&1)); if (op == saveop) --op; @@ -219,17 +218,17 @@ P3(PUBLIC pascal trap, void, MapRgn, RgnHandle, rh, Rect *, srcr, Rect *, dstr) } if (!done) { for (tempp = freebuf, ipe = mergebuf, - x1 = BigEndianValue(*ip++), x2 = *ipe++;;) { + x1 = CW(*ip++), x2 = *ipe++;;) { if (x1 < x2) { *tempp++ = x1; - x1 = BigEndianValue(*ip++); + x1 = CW(*ip++); } else if (x1 > x2) { *tempp++ = x2; x2 = *ipe++; } else { if (x1 == 32767) /*-->*/ break; - x1 = BigEndianValue(*ip++); + x1 = CW(*ip++); x2 = *ipe++; } } diff --git a/src/qPaletteMgr.cpp b/src/qPaletteMgr.cpp index 44f5ffce..832bba33 100644 --- a/src/qPaletteMgr.cpp +++ b/src/qPaletteMgr.cpp @@ -25,7 +25,6 @@ char ROMlib_rcsid_qPaletteMgr[] = #include "rsys/dirtyrect.h" using namespace Executor; -using namespace ByteSwap; #define GD_CLUT_P(gd) (GD_TYPE_X (gd) == CWC (clutType)) @@ -33,17 +32,17 @@ using namespace ByteSwap; #define CI_ALLOCATED_ENTRY_P(entry) ((entry)->ciPrivate & CI_ALLOCATED_BIT_X) #define CI_SET_ALLOCATED_ENTRY(entry, index) \ - ((entry)->ciPrivate = CI_ALLOCATED_BIT_X | BigEndianValue (((index) & 0xFF) << 16)) + ((entry)->ciPrivate = CI_ALLOCATED_BIT_X | CL (((index) & 0xFF) << 16)) #define CI_DEALLOCATE_ENTRY(entry) \ ((entry)->ciPrivate = CLC (0)) #define CI_ENTRY_INDEX(entry) \ - ((BigEndianValue ((entry)->ciPrivate) >> 16) & 0xFF) + ((CL ((entry)->ciPrivate) >> 16) & 0xFF) #define CI_ENTRY_INDEX_X(entry) \ - (BigEndianValue (CI_ENTRY_INDEX (entry))) + (CL (CI_ENTRY_INDEX (entry))) #define CI_USAGE_X(entry) ((entry)->ciUsage) -#define CI_USAGE(entry) (BigEndianValue (CI_USAGE_X (entry))) +#define CI_USAGE(entry) (CW (CI_USAGE_X (entry))) #define CI_TOLERANCE_X(entry) ((entry)->ciTolerance) -#define CI_TOLERANCE(entry) (BigEndianValue (CI_TOLERANCE_X (entry))) +#define CI_TOLERANCE(entry) (CW (CI_TOLERANCE_X (entry))) #define CI_USAGE_HAS_BITS_P(entry, bits) \ ((CI_USAGE (entry) & 0xF) == (bits)) #define CI_RGB(entry) ((entry)->ciRGB) @@ -221,9 +220,9 @@ P0 (PUBLIC pascal trap, INTEGER, PMgrVersion) static inline int rgb_delta (RGBColor *c1, RGBColor *c2) { - return MAX (MAX (ABS (BigEndianValue (c1->red) - BigEndianValue (c2->red)), - ABS (BigEndianValue (c1->green) - BigEndianValue (c2->green))), - ABS (BigEndianValue (c1->blue) - BigEndianValue (c2->blue))); + return MAX (MAX (ABS (CW (c1->red) - CW (c2->red)), + ABS (CW (c1->green) - CW (c2->green))), + ABS (CW (c1->blue) - CW (c2->blue))); } int @@ -581,7 +580,7 @@ pm_do_updates_gd_changed (void) gd_pixmap = GD_PMAP (gd); gd_ctab = PIXMAP_TABLE (gd_pixmap); - CTAB_SEED_X (gd_ctab) = BigEndianValue (GetCTSeed ()); + CTAB_SEED_X (gd_ctab) = CL (GetCTSeed ()); PaintWhite = 0; front_w = FrontWindow (); @@ -868,7 +867,7 @@ P4 (PUBLIC pascal trap, PaletteHandle, NewPalette, PALETTE_SEEDS_X (new_palette) = RM (NewHandle (sizeof (int))); PALETTE_SET_MODIFIED (new_palette); - PALETTE_ENTRIES_X (new_palette) = BigEndianValue (entries); + PALETTE_ENTRIES_X (new_palette) = CW (entries); info = PALETTE_INFO (new_palette); i = 0; @@ -881,16 +880,16 @@ P4 (PUBLIC pascal trap, PaletteHandle, NewPalette, for (; i < entries && i <= max_colors; i ++) { info[i].ciRGB = colors[i].rgb; - info[i].ciUsage = BigEndianValue (src_usage); - info[i].ciTolerance = BigEndianValue (src_tolerance); + info[i].ciUsage = CW (src_usage); + info[i].ciTolerance = CW (src_tolerance); } } for (; i < entries; i ++) { info[i].ciRGB = ROMlib_black_rgb_color; - info[i].ciUsage = BigEndianValue (src_usage); - info[i].ciTolerance = BigEndianValue (src_tolerance); + info[i].ciUsage = CW (src_usage); + info[i].ciTolerance = CW (src_tolerance); } return new_palette; @@ -1134,7 +1133,7 @@ set_palette_common (WindowPtr dst_window, PaletteHandle src_palette, #if 0 /* clear the palette bits, and set the new update */ PALETTE_PRIVATE_X (src_palette) &= ~PALETTE_UPDATE_FLAG_BITS_X; - PALETTE_PRIVATE_X (src_palette) |= BigEndianValue (c_update); + PALETTE_PRIVATE_X (src_palette) |= CW (c_update); #else elt->c_update = c_update; #endif @@ -1165,7 +1164,7 @@ P2 (PUBLIC pascal trap, void, SetPaletteUpdates, PaletteHandle, palette, INTEGER, update) { PALETTE_PRIVATE_X (palette) &= ~PALETTE_UPDATE_FLAG_BITS_X; - PALETTE_PRIVATE_X (palette) |= BigEndianValue (update); + PALETTE_PRIVATE_X (palette) |= CW (update); } P1 (PUBLIC pascal trap, INTEGER, GetPaletteUpdates, @@ -1205,7 +1204,7 @@ P1 (PUBLIC pascal trap, PaletteHandle, GetPalette, int gd_index_mask; \ \ gd_index_mask = CTAB_SIZE (PIXMAP_TABLE (GD_PMAP (MR (TheGDevice)))); \ - index_macro_x (thePort) = BigEndianValue ((entry) & gd_index_mask); \ + index_macro_x (thePort) = CL ((entry) & gd_index_mask); \ } \ else if (CI_USAGE_X (info) & CWC (pmAnimated)) \ { \ @@ -1267,7 +1266,7 @@ P1 (PUBLIC pascal trap, void, RestoreFore, ColorSpec *, cp) goto USE_RGB_ANYWAY; break; default: - warning_unexpected ("value = 0x%x (using rgb)", BigEndianValue (cp->value)); + warning_unexpected ("value = 0x%x (using rgb)", CW (cp->value)); /* FALL THROUGH */ case CWC (useRGB): USE_RGB_ANYWAY: @@ -1293,7 +1292,7 @@ P1 (PUBLIC pascal trap, void, RestoreBack, ColorSpec *, cp) goto USE_RGB_ANYWAY; break; default: - warning_unexpected ("value = 0x%x (using rgb)", BigEndianValue (cp->value)); + warning_unexpected ("value = 0x%x (using rgb)", CW (cp->value)); /* FALL THROUGH */ case CWC (useRGB): USE_RGB_ANYWAY: @@ -1379,7 +1378,7 @@ P5 (PUBLIC pascal trap, void, AnimatePalette, /* Compute the number of entries in the table to modify. */ dst_length = MIN ((CTAB_SIZE (src_ctab) + 1) - src_index, dst_length); - dst_length = MIN (BigEndianValue (palette->pmEntries) - dst_entry, dst_length); + dst_length = MIN (CW (palette->pmEntries) - dst_entry, dst_length); src_cspec = &CTAB_TABLE (src_ctab)[src_index]; @@ -1452,8 +1451,8 @@ P4 (PUBLIC pascal trap, void, SetEntryUsage, } entry = &PALETTE_INFO (dst_palette)[entry_index]; - CI_USAGE_X (entry) = BigEndianValue (src_usage); - CI_TOLERANCE_X (entry) = BigEndianValue (src_tolerance); + CI_USAGE_X (entry) = CW (src_usage); + CI_TOLERANCE_X (entry) = CW (src_tolerance); pm_deallocate_entry (entry, FALSE); @@ -1480,7 +1479,7 @@ P4 (PUBLIC pascal trap, void, CTab2Palette, /* resize the palette */ SetHandleSize ((Handle) dst_palette, PALETTE_STORAGE_FOR_ENTRIES (ctab_size + 1)); - PALETTE_ENTRIES_X (dst_palette) = BigEndianValue (ctab_size + 1); + PALETTE_ENTRIES_X (dst_palette) = CW (ctab_size + 1); ctab_table = CTAB_TABLE (src_ctab); palette_info = PALETTE_INFO (dst_palette); @@ -1492,8 +1491,8 @@ P4 (PUBLIC pascal trap, void, CTab2Palette, pm_deallocate_entry (entry, FALSE); entry->ciRGB = ctab_table[i].rgb; - entry->ciUsage = BigEndianValue (src_usage); - entry->ciTolerance = BigEndianValue (src_tolerance); + entry->ciUsage = CW (src_usage); + entry->ciTolerance = CW (src_tolerance); } PALETTE_SET_MODIFIED (dst_palette); } @@ -1517,13 +1516,13 @@ P2 (PUBLIC pascal trap, void, Palette2CTab, CTAB_SEED_X (dst_ctab) = CLC (0); CTAB_FLAGS_X (dst_ctab) = CWC (0); - CTAB_SIZE_X (dst_ctab) = BigEndianValue (palette_entries - 1); + CTAB_SIZE_X (dst_ctab) = CW (palette_entries - 1); palette_info = PALETTE_INFO (src_palette); ctab_table = CTAB_TABLE (dst_ctab); for (i = 0; i < palette_entries; i ++) { - ctab_table[i].value = BigEndianValue (i); + ctab_table[i].value = CW (i); ctab_table[i].rgb = palette_info[i].ciRGB; } @@ -1561,7 +1560,7 @@ P1 (PUBLIC pascal trap, LONGINT, Entry2Index, INTEGER, entry_index) return CI_ENTRY_INDEX (entry); } else - gui_fatal ("unhandled entry usage `%d'", BigEndianValue (entry->ciUsage)); + gui_fatal ("unhandled entry usage `%d'", CW (entry->ciUsage)); } P5 (PUBLIC pascal trap, void, CopyPalette, diff --git a/src/qPen.cpp b/src/qPen.cpp index 8ab50ec7..ecc703f1 100644 --- a/src/qPen.cpp +++ b/src/qPen.cpp @@ -18,18 +18,17 @@ char ROMlib_rcsid_qPen[] = #include "rsys/picture.h" using namespace Executor; -using namespace ByteSwap; P0(PUBLIC pascal trap, void, HidePen) { if (thePortX) - PORT_PEN_VIS_X (thePort) = BigEndianValue (PORT_PEN_VIS (thePort) - 1); + PORT_PEN_VIS_X (thePort) = CW (PORT_PEN_VIS (thePort) - 1); } P0(PUBLIC pascal trap, void, ShowPen) { if (thePortX) - PORT_PEN_VIS_X (thePort) = BigEndianValue (PORT_PEN_VIS (thePort) + 1); + PORT_PEN_VIS_X (thePort) = CW (PORT_PEN_VIS (thePort) + 1); } P1(PUBLIC pascal trap, void, GetPen, Point *, ptp) @@ -139,15 +138,15 @@ P2(PUBLIC pascal trap, void, PenSize, INTEGER, w, INTEGER, h) { if (thePortX) { - PORT_PEN_SIZE (thePort).h = BigEndianValue (w); - PORT_PEN_SIZE (thePort).v = BigEndianValue (h); + PORT_PEN_SIZE (thePort).h = CW (w); + PORT_PEN_SIZE (thePort).v = CW (h); } } P1(PUBLIC pascal trap, void, PenMode, INTEGER, m) { if (thePortX) - PORT_PEN_MODE_X (thePort) = BigEndianValue (m); + PORT_PEN_MODE_X (thePort) = CW (m); } P1(PUBLIC pascal trap, void, PenPat, Pattern, pp) @@ -190,8 +189,8 @@ P2(PUBLIC pascal trap, void, MoveTo, INTEGER, h, INTEGER, v) { if (thePortX) { - PORT_PEN_LOC (thePort).h = BigEndianValue (h); - PORT_PEN_LOC (thePort).v = BigEndianValue (v); + PORT_PEN_LOC (thePort).h = CW (h); + PORT_PEN_LOC (thePort).v = CW (v); } } @@ -199,8 +198,8 @@ P2(PUBLIC pascal trap, void, Move, INTEGER, dh, INTEGER, dv) { if (thePortX) { - PORT_PEN_LOC (thePort).h = BigEndianValue (BigEndianValue (PORT_PEN_LOC (thePort).h) + (dh)); - thePort->pnLoc.v = BigEndianValue (BigEndianValue (PORT_PEN_LOC (thePort).v) + (dv)); + PORT_PEN_LOC (thePort).h = CW (CW (PORT_PEN_LOC (thePort).h) + (dh)); + thePort->pnLoc.v = CW (CW (PORT_PEN_LOC (thePort).v) + (dv)); } } @@ -212,8 +211,8 @@ P2(PUBLIC pascal trap, void, LineTo, INTEGER, h, INTEGER, v) p.h = h; p.v = v; CALLLINE(p); - PORT_PEN_LOC (thePort).h = BigEndianValue(p.h); - PORT_PEN_LOC (thePort).v = BigEndianValue(p.v); + PORT_PEN_LOC (thePort).h = CW(p.h); + PORT_PEN_LOC (thePort).v = CW(p.v); } } @@ -222,11 +221,11 @@ P2(PUBLIC pascal trap, void, Line, INTEGER, dh, INTEGER, dv) Point p; if (thePortX) { - p.h = BigEndianValue (PORT_PEN_LOC (thePort).h) + dh; - p.v = BigEndianValue (PORT_PEN_LOC (thePort).v) + dv; + p.h = CW (PORT_PEN_LOC (thePort).h) + dh; + p.v = CW (PORT_PEN_LOC (thePort).v) + dv; CALLLINE(p); - PORT_PEN_LOC (thePort).h = BigEndianValue(p.h); - PORT_PEN_LOC (thePort).v = BigEndianValue(p.v); + PORT_PEN_LOC (thePort).h = CW(p.h); + PORT_PEN_LOC (thePort).v = CW(p.v); } } diff --git a/src/qPicstuff.cpp b/src/qPicstuff.cpp index 8ee855ef..2980ee7f 100644 --- a/src/qPicstuff.cpp +++ b/src/qPicstuff.cpp @@ -29,7 +29,6 @@ char ROMlib_rcsid_qPicstuff[] = #include "rsys/executor.h" using namespace Executor; -using namespace ByteSwap; /* * Hooray for static variables. We have to do something like this because @@ -216,22 +215,22 @@ A2(PRIVATE, void, txratio, Point, num, Point, den) A2(PRIVATE, void, line, Point, op, Point, np) { - PORT_PEN_LOC (thePort).h = BigEndianValue (op.h); - PORT_PEN_LOC (thePort).v = BigEndianValue (op.v); + PORT_PEN_LOC (thePort).h = CW (op.h); + PORT_PEN_LOC (thePort).v = CW (op.v); CALLLINE(np); - PORT_PEN_LOC (thePort).h = BigEndianValue (np.h); - PORT_PEN_LOC (thePort).v = BigEndianValue (np.v); + PORT_PEN_LOC (thePort).h = CW (np.h); + PORT_PEN_LOC (thePort).v = CW (np.v); } A3(PRIVATE, void, shrtline, Point, op, SignedByte, dh, SignedByte, dv) { - PORT_PEN_LOC (thePort).h = BigEndianValue(op.h); - PORT_PEN_LOC (thePort).v = BigEndianValue(op.v); + PORT_PEN_LOC (thePort).h = CW(op.h); + PORT_PEN_LOC (thePort).v = CW(op.v); op.h += dh; op.v += dv; CALLLINE (op); - PORT_PEN_LOC (thePort).h = BigEndianValue(op.h); - PORT_PEN_LOC (thePort).v = BigEndianValue(op.v); + PORT_PEN_LOC (thePort).h = CW(op.h); + PORT_PEN_LOC (thePort).v = CW(op.v); } PRIVATE void setnumerdenom(Point *nump, Point *denp) @@ -276,12 +275,12 @@ namespace Executor { PRIVATE void setpicclip(RgnHandle rh); PRIVATE void eatRegion(RgnHandle rh, Size hs); PRIVATE void eatRect(Rect *rp); - PRIVATE void eatPixMap(register PixMapPtr pixp, INTEGER rowb); + PRIVATE void eatPixMap(PixMapPtr pixp, INTEGER rowb); PRIVATE void eatBitMap(BitMap * bp, INTEGER rowb); PRIVATE Size eatpixdata(PixMapPtr pixmap, BOOLEAN * freep); - PRIVATE void eatbitdata(register BitMap * bp, BOOLEAN packed); + PRIVATE void eatbitdata(BitMap * bp, BOOLEAN packed); PRIVATE void eatRGBColor(RGBColor * rgbp); - PRIVATE void eatColorTable(register PixMapPtr pixmap); + PRIVATE void eatColorTable(PixMapPtr pixmap); PRIVATE void eatPattern(Pattern pat); PRIVATE void eatPixPat(PixPatHandle pixpat); PRIVATE unsigned short nextop(INTEGER vers); @@ -292,10 +291,10 @@ A3(PRIVATE, void, longtext, Point, pt, StringPtr, s, Point *, pp) Point save, numer, denom; save = PORT_PEN_LOC (thePort); - pp->h = BigEndianValue (pt.h); - pp->v = BigEndianValue (pt.v); - PORT_PEN_LOC (thePort).h = BigEndianValue (pt.h); - PORT_PEN_LOC (thePort).v = BigEndianValue (pt.v); + pp->h = CW (pt.h); + pp->v = CW (pt.v); + PORT_PEN_LOC (thePort).h = CW (pt.h); + PORT_PEN_LOC (thePort).v = CW (pt.v); setnumerdenom (&numer, &denom); CALLTEXT ((INTEGER) U(s[0]), (Ptr) (s+1), numer, denom); PORT_PEN_LOC (thePort) = save; @@ -305,7 +304,7 @@ A3(PRIVATE, void, dhtext, unsigned char, dh, StringPtr, s, Point *, pp) { Point save, numer, denom; - pp->h = BigEndianValue(BigEndianValue(pp->h) + (dh)); + pp->h = CW(CW(pp->h) + (dh)); save = PORT_PEN_LOC (thePort); PORT_PEN_LOC (thePort) = *pp; setnumerdenom (&numer, &denom); @@ -317,7 +316,7 @@ A3(PRIVATE, void, dvtext, unsigned char, dv, StringPtr, s, Point *, pp) { Point save, numer, denom; - pp->v = BigEndianValue (BigEndianValue (pp->v) + (dv)); + pp->v = CW (CW (pp->v) + (dv)); save = PORT_PEN_LOC (thePort); PORT_PEN_LOC (thePort) = *pp; setnumerdenom (&numer, &denom); @@ -330,8 +329,8 @@ A4(PRIVATE, void, dhdvtext, Byte, dh, Byte, dv, { Point save, numer, denom; - pp->h = BigEndianValue(BigEndianValue(pp->h) + (dh)); - pp->v = BigEndianValue(BigEndianValue(pp->v) + (dv)); + pp->h = CW(CW(pp->h) + (dh)); + pp->v = CW(CW(pp->v) + (dv)); save = PORT_PEN_LOC (thePort); PORT_PEN_LOC (thePort) = *pp; setnumerdenom(&numer, &denom); @@ -375,8 +374,8 @@ A2 (PRIVATE, void, origin, INTEGER, dh, INTEGER, dv) { OffsetRect (&srcpicframe, dh, dv); - txtpoint.h = BigEndianValue (BigEndianValue (txtpoint.h) - dh); - txtpoint.v = BigEndianValue (BigEndianValue (txtpoint.v) - dv); + txtpoint.h = CW (CW (txtpoint.h) - dh); + txtpoint.v = CW (CW (txtpoint.v) - dv); } A1(PRIVATE, void, pnlochfrac, INTEGER, f) @@ -416,10 +415,10 @@ A2(PRIVATE, void, pnsize, INTEGER, pv, INTEGER, ph) { Point p; - p.h = BigEndianValue(ph); - p.v = BigEndianValue(pv); + p.h = CW(ph); + p.v = CW(pv); ScalePt(&p, &srcpicframe, &dstpicframe); - PenSize(BigEndianValue(p.h), BigEndianValue(p.v)); + PenSize(CW(p.h), CW(p.v)); } A1(PRIVATE, void, textface, Byte, f) @@ -551,7 +550,7 @@ PRIVATE void W_TextFont( INTEGER f ) INTEGER new_f; GetFNum (sp, &new_f); if (new_f) - f = BigEndianValue (new_f); + f = CW (new_f); } TextFont( f ); } @@ -778,7 +777,7 @@ fontname (INTEGER hsize, Handle hand) StringPtr sp; p = (char *) STARH (hand); - i = BigEndianValue (*(INTEGER *)p); + i = CW (*(INTEGER *)p); sp = (StringPtr) p + 2; add_assoc (i, sp); } @@ -996,7 +995,7 @@ PRIVATE Byte eatByte() Byte retval; if (procp) - CToPascalCall(&procp, CTOP_StdGetPic, &retval, sizeof(Byte)); + CToPascalCall((void*)procp, CTOP_StdGetPic, &retval, sizeof(Byte)); else retval = *nextbytep; ++nextbytep; @@ -1008,7 +1007,7 @@ PRIVATE INTEGER eatINTEGERX() INTEGER retval; if (procp) - CToPascalCall(&procp, CTOP_StdGetPic, &retval, sizeof(INTEGER)); + CToPascalCall((void*)procp, CTOP_StdGetPic, &retval, sizeof(INTEGER)); else retval = *(INTEGER *)nextbytep; nextbytep += sizeof(INTEGER); @@ -1020,7 +1019,7 @@ PRIVATE INTEGER eatINTEGER() INTEGER retval; retval = eatINTEGERX(); - return BigEndianValue(retval); + return CW(retval); } PRIVATE LONGINT eatLONGINTX() @@ -1028,7 +1027,7 @@ PRIVATE LONGINT eatLONGINTX() LONGINT retval; if (procp) - CToPascalCall(&procp, CTOP_StdGetPic, &retval, sizeof(LONGINT)); + CToPascalCall((void*)procp, CTOP_StdGetPic, &retval, sizeof(LONGINT)); else retval = *(LONGINT *)nextbytep; nextbytep += sizeof(LONGINT); @@ -1040,14 +1039,14 @@ PRIVATE LONGINT eatLONGINT() LONGINT retval; retval = eatLONGINTX(); - return BigEndianValue(retval); + return CL(retval); } PRIVATE void eatString(Str255 str) { str[0] = eatByte(); if (procp) - CToPascalCall(&procp, CTOP_StdGetPic, str+1, str[0]); + CToPascalCall((void*)procp, CTOP_StdGetPic, str+1, str[0]); else BlockMove((Ptr) nextbytep, (Ptr) str+1, str[0]); nextbytep += str[0]; @@ -1060,7 +1059,7 @@ PRIVATE void eatNBytes(LONGINT n) if (procp) { TEMP_ALLOC_DECL (temp_alloc_space); TEMP_ALLOC_ALLOCATE (bufp, temp_alloc_space, n); - CToPascalCall(&procp, CTOP_StdGetPic, bufp, n); + CToPascalCall((void*)procp, CTOP_StdGetPic, bufp, n); TEMP_ALLOC_FREE (temp_alloc_space); } nextbytep += n; @@ -1074,13 +1073,13 @@ A2(PRIVATE, void, eatRegion, RgnHandle, rh, Size, hs) if (procp) { state = HGetState((Handle) rh); HLock((Handle) rh); - CToPascalCall(&procp, CTOP_StdGetPic, (Ptr) STARH(rh) + sizeof(INTEGER), + CToPascalCall((void*)procp, CTOP_StdGetPic, (Ptr) STARH(rh) + sizeof(INTEGER), hs - sizeof(INTEGER)); HSetState((Handle) rh, state); } else BlockMove((Ptr) nextbytep, (Ptr) STARH(rh) + sizeof(INTEGER), hs - sizeof(INTEGER)); - HxX(rh, rgnSize) = BigEndianValue(hs); + HxX(rh, rgnSize) = CW(hs); nextbytep += hs - sizeof(INTEGER); } @@ -1092,12 +1091,12 @@ A1(PRIVATE, void, eatRect, Rect *, rp) rp->right = eatINTEGERX(); } -A2(PRIVATE, void, eatPixMap, register PixMapPtr, pixp, INTEGER, rowb) +A2(PRIVATE, void, eatPixMap, PixMapPtr, pixp, INTEGER, rowb) { /* TODO: byte swapping stuff, testing */ /* x(pixp->baseAddr) = 0; will be set later */ - pixp->rowBytes = rowb ? BigEndianValue(rowb) : eatINTEGERX(); + pixp->rowBytes = rowb ? CW(rowb) : eatINTEGERX(); eatRect(&pixp->bounds); pixp->pmVersion = eatINTEGERX(); pixp->packType = eatINTEGERX(); @@ -1118,7 +1117,7 @@ A2(PRIVATE, void, eatPixMap, register PixMapPtr, pixp, INTEGER, rowb) A2(PRIVATE, void, eatBitMap, BitMap *, bp, INTEGER, rowb) { bp->baseAddr = 0; - bp->rowBytes = rowb ? BigEndianValue(rowb) : eatINTEGERX(); + bp->rowBytes = rowb ? CW(rowb) : eatINTEGERX(); eatRect(&bp->bounds); } @@ -1176,7 +1175,7 @@ A2(PRIVATE, Size, eatpixdata, PixMapPtr, pixmap, BOOLEAN *, freep) HLock (h); if (procp) - CToPascalCall (&procp, CTOP_StdGetPic, STARH (h), pic_data_size); + CToPascalCall((void*)procp, CTOP_StdGetPic, STARH (h), pic_data_size); else if (pixmap->packType == CWC (2)) memcpy (STARH (h), nextbytep, pic_data_size); @@ -1221,7 +1220,7 @@ A2(PRIVATE, Size, eatpixdata, PixMapPtr, pixmap, BOOLEAN *, freep) { temph = NewHandle (length); HLock (temph); - CToPascalCall (&procp, CTOP_StdGetPic, STARH (temph), length); + CToPascalCall((void*)procp, CTOP_StdGetPic, STARH (temph), length); inp = (Byte *) STARH (temph); } else @@ -1293,7 +1292,7 @@ A2(PRIVATE, Size, eatpixdata, PixMapPtr, pixmap, BOOLEAN *, freep) return final_data_size; } -A2(PRIVATE, void, eatbitdata, register BitMap *, bp, BOOLEAN, packed) +A2(PRIVATE, void, eatbitdata, BitMap *, bp, BOOLEAN, packed) { INTEGER rowb; Size datasize; @@ -1304,8 +1303,8 @@ A2(PRIVATE, void, eatbitdata, register BitMap *, bp, BOOLEAN, packed) INTEGER length; Handle temph; - rowb = BigEndianValue(bp->rowBytes) & ROWMASK; - datasize = (LONGINT) rowb * (BigEndianValue(bp->bounds.bottom) - BigEndianValue(bp->bounds.top)); + rowb = CW(bp->rowBytes) & ROWMASK; + datasize = (LONGINT) rowb * (CW(bp->bounds.bottom) - CW(bp->bounds.top)); if (!packed) { if (procp) { h = NewHandle(datasize); @@ -1319,7 +1318,7 @@ A2(PRIVATE, void, eatbitdata, register BitMap *, bp, BOOLEAN, packed) TheZone = savezone; } HLock(h); - CToPascalCall(&procp, CTOP_StdGetPic, STARH(h), datasize); + CToPascalCall((void*)procp, CTOP_StdGetPic, STARH(h), datasize); bp->baseAddr = (*h).p; } else bp->baseAddr = RM((Ptr) nextbytep); @@ -1342,7 +1341,7 @@ A2(PRIVATE, void, eatbitdata, register BitMap *, bp, BOOLEAN, packed) if (procp) { temph = NewHandle(length); HLock(temph); - CToPascalCall(&procp, CTOP_StdGetPic, STARH(temph), length); + CToPascalCall((void*)procp, CTOP_StdGetPic, STARH(temph), length); inp = (Byte *) STARH(temph); } else { inp = nextbytep; @@ -1374,16 +1373,16 @@ A1(PRIVATE, void, eatRGBColor, RGBColor *, rgbp) rgbp->blue = eatINTEGERX(); } -A1(PRIVATE, void, eatColorTable, register PixMapPtr, pixmap) +A1(PRIVATE, void, eatColorTable, PixMapPtr, pixmap) { - register CTabPtr cp; - register ColorSpec *cspecp, *cspecep; - register CTabHandle ch; + CTabPtr cp; + ColorSpec *cspecp, *cspecep; + CTabHandle ch; ch = MR(pixmap->pmTable); cp = STARH(ch); /* cp->ctSeed = */ eatLONGINTX(); - cp->ctSeed = BigEndianValue (GetCTSeed ()); + cp->ctSeed = CL (GetCTSeed ()); cp->ctFlags = eatINTEGERX(); cp->ctSize = eatINTEGERX(); SetHandleSize((Handle) ch, (Size)sizeof(ColorTable) - sizeof(cp->ctTable) + @@ -1505,10 +1504,10 @@ P2(PUBLIC pascal trap, void, DrawPicture, PicHandle, pic, Rect *, destrp) INTEGER hsize; void (*f)(); INTEGER vers; - Fixed scaleh, scalev, tempf; /* "auto": cc -a bug avoidance */ + Fixed scaleh, scalev, tempf; RGBColor rgb; BitMap bm; - PixMap pm; /* "auto": cc -a bug avoidance */ + PixMap pm; BOOLEAN packed; GrafPort saveport, *the_port; CGrafPtr the_cport; @@ -1555,8 +1554,8 @@ P2(PUBLIC pascal trap, void, DrawPicture, PicHandle, pic, Rect *, destrp) #endif /* LETGCCWAIL */ #if 0 - if (!pic || (BigEndianValue (destrp->top) == BigEndianValue (destrp->bottom) - && BigEndianValue (destrp->left) == BigEndianValue (destrp->right))) + if (!pic || (CW (destrp->top) == CW (destrp->bottom) + && CW (destrp->left) == CW (destrp->right))) return; #else if (!pic || !pic->p || EmptyRect(destrp) || EmptyRect(&HxX(pic, picFrame))) @@ -1628,8 +1627,8 @@ P2(PUBLIC pascal trap, void, DrawPicture, PicHandle, pic, Rect *, destrp) /* this will fail if we are actually drawing to a color graph port; we'll get spew colors instead of b/w, so let ForeColor or BackColor do the work */ - the_port->fgColor = BigEndianValue(blackColor); - the_port->bkColor = BigEndianValue(whiteColor); + the_port->fgColor = CL(blackColor); + the_port->bkColor = CL(whiteColor); #else ForeColor (blackColor); BackColor (whiteColor); @@ -1671,8 +1670,8 @@ P2(PUBLIC pascal trap, void, DrawPicture, PicHandle, pic, Rect *, destrp) reduce(&picnumh, &picdenh); reduce(&picnumv, &picdenv); - txtpoint.h = BigEndianValue(BigEndianValue(dstpicframe.left) - BigEndianValue(srcpicframe.left)); - txtpoint.v = BigEndianValue(BigEndianValue(dstpicframe.top) - BigEndianValue(srcpicframe.top)); + txtpoint.h = CW(CW(dstpicframe.left) - CW(srcpicframe.left)); + txtpoint.v = CW(CW(dstpicframe.top) - CW(srcpicframe.top)); scaleh = FixRatio (RECT_WIDTH (&dstpicframe), RECT_WIDTH (&srcpicframe)); scalev = FixRatio (RECT_HEIGHT (&dstpicframe), RECT_HEIGHT (&srcpicframe)); @@ -1719,8 +1718,8 @@ P2(PUBLIC pascal trap, void, DrawPicture, PicHandle, pic, Rect *, destrp) pp->h = eatINTEGERX(); if (sc & SCALEIT) MapPt(pp, &srcpicframe, destrp); - pp->h = BigEndianValue(pp->h); - pp->v = BigEndianValue(pp->v); + pp->h = CW(pp->h); + pp->v = CW(pp->v); ++pp; break; case RCT: @@ -1745,7 +1744,7 @@ P2(PUBLIC pascal trap, void, DrawPicture, PicHandle, pic, Rect *, destrp) if (procp) { state2 = HGetState(hand); HLock(hand); - CToPascalCall(&procp, CTOP_StdGetPic, STARH(hand), + CToPascalCall((void*)procp, CTOP_StdGetPic, STARH(hand), hsize); HSetState(hand, state2); } else @@ -1918,11 +1917,11 @@ P2(PUBLIC pascal trap, void, DrawPicture, PicHandle, pic, Rect *, destrp) } } if (opcode == OP_OvSize) { - points[0].h = BigEndianValue(points[0].h); - points[0].v = BigEndianValue(points[0].v); + points[0].h = CW(points[0].h); + points[0].v = CW(points[0].v); ScalePt(&points[0], &srcpicframe, &dstpicframe); - points[0].h = BigEndianValue(points[0].h); - points[0].v = BigEndianValue(points[0].v); + points[0].h = CW(points[0].h); + points[0].v = CW(points[0].v); ovh = points[0].v; ovw = points[0].h; } else if (opcode == OP_Version) { diff --git a/src/qPict2.cpp b/src/qPict2.cpp index 713f0056..08aa1e1c 100644 --- a/src/qPict2.cpp +++ b/src/qPict2.cpp @@ -18,7 +18,6 @@ char ROMlib_rcsid_qPic2[] = #include "rsys/rgbutil.h" using namespace Executor; -using namespace ByteSwap; P1 (PUBLIC pascal trap, OSErr, DisposePictInfo, PictInfoID, pict_info_id) @@ -72,9 +71,9 @@ P6 (PUBLIC pascal trap, OSErr, GetPictInfo, ({ \ const RGBColor *color; \ color = &CTAB_TABLE (color_table)[pixel].rgb; \ - (r) = BigEndianValue (color->red); \ - (g) = BigEndianValue (color->green); \ - (b) = BigEndianValue (color->blue); \ + (r) = CW (color->red); \ + (g) = CW (color->green); \ + (b) = CW (color->blue); \ })) #define DIRECT_PIXEL_TO_RGB(bpp, pixel, red_out, green_out, blue_out, \ dummy_color_table) \ @@ -83,9 +82,9 @@ P6 (PUBLIC pascal trap, OSErr, GetPictInfo, RGBColor color; \ \ (*rgb_spec->pixel_to_rgbcolor) (rgb_spec, (pixel), &color); \ - (red_out) = BigEndianValue (color.red); \ - (green_out) = BigEndianValue (color.green); \ - (blue_out) = BigEndianValue (color.blue); \ + (red_out) = CW (color.red); \ + (green_out) = CW (color.green); \ + (blue_out) = CW (color.blue); \ })) #define PIXEL_TO_RGB(bpp, pixel, red, green, blue, color_table) \ ((void) \ @@ -194,10 +193,10 @@ P6 (PUBLIC pascal trap, OSErr, GetPixMapInfo, bank_index \ = ((red & mask) >> 1) | ((green & mask) >> 6) | ((blue & mask) >> 11); \ \ - count = BigEndianValue (bank[bank_index]); \ + count = CW (bank[bank_index]); \ if (! count) \ unique_colors ++; \ - bank[bank_index] = BigEndianValue (count + 1); \ + bank[bank_index] = CW (count + 1); \ }) switch (bpp) @@ -308,9 +307,9 @@ P6 (PUBLIC pascal trap, OSErr, GetPixMapInfo, color_table = (CTabHandle) NewHandle (CTAB_STORAGE_FOR_SIZE (colors_requested)); - CTAB_SEED_X (color_table) = BigEndianValue (GetCTSeed ()); - CTAB_FLAGS_X (color_table) = BigEndianValue (0); - CTAB_SIZE_X (color_table) = BigEndianValue (colors_requested); + CTAB_SEED_X (color_table) = CL (GetCTSeed ()); + CTAB_FLAGS_X (color_table) = CW (0); + CTAB_SIZE_X (color_table) = CW (colors_requested); table = CTAB_TABLE (color_table); @@ -319,7 +318,7 @@ P6 (PUBLIC pascal trap, OSErr, GetPixMapInfo, for (i = 0, t = head; i < colors_requested && t; i ++, t = t->next) { - table[i].value = BigEndianValue (i); + table[i].value = CW (i); #define TILE(x) (((uint32) (x) * 0x8421UL) >> 4) @@ -334,7 +333,7 @@ P6 (PUBLIC pascal trap, OSErr, GetPixMapInfo, popular colors in the pixmap */ memset (pict_info, '\000', sizeof *pict_info); - pict_info->uniqueColors = BigEndianValue (unique_colors); + pict_info->uniqueColors = CL (unique_colors); if (verb & returnPalette) { diff --git a/src/qPicture.cpp b/src/qPicture.cpp index cb88973d..bdd59cbf 100644 --- a/src/qPicture.cpp +++ b/src/qPicture.cpp @@ -18,7 +18,6 @@ char ROMlib_rcsid_qPicture[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; PUBLIC PicHandle Executor::ROMlib_OpenPicture_helper (const Rect *pf, const OpenCPicParams *params) @@ -37,7 +36,7 @@ PUBLIC PicHandle Executor::ROMlib_OpenPicture_helper (const Rect *pf, HxX(ph, picSize) = CWC(10 + 16 * sizeof(INTEGER)); HxX(ph, picFrame) = *pf; ip = &HxX(ph, picSize) + 5; - ip[0] = BigEndianValue(OP_Version); + ip[0] = CW(OP_Version); ip[1] = CWC (0x2FF); /* see the explanation in IM-V p. 93 */ ip[2] = CWC (0x0c00); /* see IM:Imaging with QuickDraw A-22 - A-24 */ @@ -69,7 +68,7 @@ PUBLIC PicHandle Executor::ROMlib_OpenPicture_helper (const Rect *pf, ip[15] = CWC (0x001e); HxX(pch, picsize) = CLC(INITIALPICSIZE); - HxX(pch, pichowfar) = BigEndianValue((LONGINT) Hx(ph, picSize)); + HxX(pch, pichowfar) = CL((LONGINT) Hx(ph, picSize)); temprh = RM(NewRgn()); HxX(pch, picclip) = temprh; /* -32766 below is an attempt to force a reload */ @@ -152,7 +151,7 @@ PRIVATE void updateapat( Pattern srcpat, Pattern dstpat, INTEGER opcode) PRIVATE void updateaninteger( INTEGER src, INTEGER *dstp, INTEGER opcode) { - src = BigEndianValue(src); + src = CW(src); if (*dstp != src) { *dstp = src; PICOP(opcode); @@ -296,16 +295,16 @@ PRIVATE void updatetxnumtxden( Point num, Point den ) pch = (piccachehand) PORT_PIC_SAVE (thePort); if (Hx(pch, pictxnum.h) != num.h || Hx(pch, pictxnum.v) != num.v || Hx(pch, pictxden.v) != den.v || Hx(pch, pictxden.h) != den.h) { - HxX(pch, pictxnum.h) = BigEndianValue(num.h); - HxX(pch, pictxnum.v) = BigEndianValue(num.v); - HxX(pch, pictxden.h) = BigEndianValue(den.h); - HxX(pch, pictxden.v) = BigEndianValue(den.v); + HxX(pch, pictxnum.h) = CW(num.h); + HxX(pch, pictxnum.v) = CW(num.v); + HxX(pch, pictxden.h) = CW(den.h); + HxX(pch, pictxden.v) = CW(den.v); PICOP(OP_TxRatio); - num.h = BigEndianValue(num.h); - num.v = BigEndianValue(num.v); + num.h = CW(num.h); + num.v = CW(num.v); PICWRITE(&num, sizeof(num)); - den.h = BigEndianValue(den.h); - den.v = BigEndianValue(den.v); + den.h = CW(den.h); + den.v = CW(den.v); PICWRITE(&den, sizeof(den)); } } diff --git a/src/qPixMapConv.cpp b/src/qPixMapConv.cpp index e085d05e..4b876336 100644 --- a/src/qPixMapConv.cpp +++ b/src/qPixMapConv.cpp @@ -24,7 +24,6 @@ char ROMlib_rcsid_qPixMapConv[] = #include "rsys/vdriver.h" using namespace Executor; -using namespace ByteSwap; static uint32 depth_table_space[DEPTHCONV_MAX_UINT32_TABLE_SIZE]; @@ -53,7 +52,7 @@ Executor::pixmap_black_white (const PixMap *pixmap, { int bpp; - bpp = BigEndianValue (pixmap->pixelSize); + bpp = CW (pixmap->pixelSize); *black_return = (1 << bpp) - 1; *white_return = 0; @@ -98,10 +97,10 @@ Executor::pixmap_copy (const PixMap *src_pm, const Rect *src_rect, pixmaps */ *return_pm = *src_pm; - row_bytes = ((width * BigEndianValue (src_pm->pixelSize) + 31) / 32) * 4; + row_bytes = ((width * CW (src_pm->pixelSize) + 31) / 32) * 4; return_pm->baseAddr = RM (NewPtr (height * row_bytes)); - return_pm->rowBytes = BigEndianValue ( row_bytes + return_pm->rowBytes = CW ( row_bytes | PIXMAP_DEFAULT_ROW_BYTES); return_pm->bounds = *return_rect; @@ -117,7 +116,7 @@ Executor::pixmap_copy (const PixMap *src_pm, const Rect *src_rect, pixmap_black_white (src_pm, &black_pixel, &white_pixel); ROMlib_blt_rgn_update_dirty_rect (rgn, srcCopy, - FALSE, BigEndianValue (src_pm->pixelSize), + FALSE, CW (src_pm->pixelSize), src_pm, return_pm, src_rect, return_rect, black_pixel, white_pixel); @@ -174,7 +173,7 @@ Executor::canonical_from_bogo_color (uint32 index, if (rgb_spec == mac_rgb_spec) { if (pixel_out) - *pixel_out = BigEndianValue (index); + *pixel_out = CW (index); if (rgb_out) (rgb_spec->pixel_to_rgbcolor) (rgb_spec, index, rgb_out); return; @@ -186,7 +185,7 @@ Executor::canonical_from_bogo_color (uint32 index, if (rgb_spec == mac_rgb_spec) { if (pixel_out) - *pixel_out = BigEndianValue (index); + *pixel_out = CL (index); if (rgb_out) (rgb_spec->pixel_to_rgbcolor) (rgb_spec, index, rgb_out); return; @@ -325,13 +324,13 @@ Executor::pixmap_set_pixel_fields (PixMap *pixmap, int bpp) if (bpp <= 8) { pixmap->pixelType = CWC (Indirect); - pixmap->cmpSize = pixmap->pixelSize = BigEndianValue (bpp); + pixmap->cmpSize = pixmap->pixelSize = CW (bpp); pixmap->cmpCount = CWC (1); } else { pixmap->pixelType = CWC (RGBDirect); - pixmap->pixelSize = BigEndianValue (bpp); + pixmap->pixelSize = CW (bpp); pixmap->cmpCount = CWC (3); switch (bpp) { @@ -357,7 +356,7 @@ sort_color_table (CTabHandle dsth, const CTabHandle srch) /* Claris Home Page has some PICTs with color tables that are too large, so we make sure we don't try to copy too much. */ - src_ct_size = MIN (BigEndianValue (src->ctSize), BigEndianValue (dst->ctSize)); + src_ct_size = MIN (CW (src->ctSize), CW (dst->ctSize)); if (src->ctFlags & CTAB_GDEVICE_BIT_X) { @@ -373,10 +372,10 @@ sort_color_table (CTabHandle dsth, const CTabHandle srch) src_table = src->ctTable; dst_table = dst->ctTable; - max_ctab_elt = BigEndianValue (dst->ctSize); + max_ctab_elt = CW (dst->ctSize); dst->ctSeed = src->ctSeed; for (i = src_ct_size; i >= 0; i--) - dst_table[BigEndianValue (src_table[i].value) & max_ctab_elt].rgb + dst_table[CW (src_table[i].value) & max_ctab_elt].rgb = src_table[i].rgb; } } @@ -401,8 +400,8 @@ Executor::convert_pixmap (const PixMap *src, PixMap *dst, TEMP_ALLOC_DECL (temp_scratch_pm_bits); /* Grab some useful information about the PixMaps. */ - src_bpp = BigEndianValue (src->pixelSize); - dst_bpp = BigEndianValue (dst->pixelSize); + src_bpp = CW (src->pixelSize); + dst_bpp = CW (dst->pixelSize); width = RECT_WIDTH (rect); height = RECT_HEIGHT (rect); @@ -451,7 +450,7 @@ Executor::convert_pixmap (const PixMap *src, PixMap *dst, mapping = (CTabHandle) (NewHandle (CTAB_STORAGE_FOR_SIZE (max_mapping_elt))); - CTAB_SIZE_X (mapping) = BigEndianValue (max_mapping_elt); + CTAB_SIZE_X (mapping) = CW (max_mapping_elt); CTAB_FLAGS_X (mapping) = CWC (0); /* the source color table may not specify all possible colors, so set unspecified colors to some sane value @@ -590,8 +589,8 @@ Executor::convert_pixmap (const PixMap *src, PixMap *dst, /* using BITMAP_... on a PixMap * is slimy */ src_row_bytes = BITMAP_ROWBYTES (src); src_base = (uint8 *) (MR (src->baseAddr) - + (BigEndianValue (rect->top) - BigEndianValue (src->bounds.top)) * src_row_bytes - + (BigEndianValue (rect->left) - BigEndianValue (src->bounds.left)) * src_bpp / 8); + + (CW (rect->top) - CW (src->bounds.top)) * src_row_bytes + + (CW (rect->left) - CW (src->bounds.left)) * src_bpp / 8); dst_row_bytes = BITMAP_ROWBYTES (dst); dst_base = (uint8 *) MR (dst->baseAddr); diff --git a/src/qPoint.cpp b/src/qPoint.cpp index b7f33a96..6d1460f7 100644 --- a/src/qPoint.cpp +++ b/src/qPoint.cpp @@ -14,24 +14,23 @@ char ROMlib_rcsid_qPoint[] = #include "rsys/cquick.h" using namespace Executor; -using namespace ByteSwap; P2(PUBLIC pascal trap, void, AddPt, Point, src, Point *, dst) { - dst->h = BigEndianValue(BigEndianValue(dst->h) + (src.h)); - dst->v = BigEndianValue(BigEndianValue(dst->v) + (src.v)); + dst->h = CW(CW(dst->h) + (src.h)); + dst->v = CW(CW(dst->v) + (src.v)); } P2(PUBLIC pascal trap, void, SubPt, Point, src, Point *, dst) { - dst->h = BigEndianValue(BigEndianValue(dst->h) - (src.h)); - dst->v = BigEndianValue(BigEndianValue(dst->v) - (src.v)); + dst->h = CW(CW(dst->h) - (src.h)); + dst->v = CW(CW(dst->v) - (src.v)); } P3(PUBLIC pascal trap, void, SetPt, Point *, pt, INTEGER, h, INTEGER, v) { - pt->h = BigEndianValue (h); - pt->v = BigEndianValue (v); + pt->h = CW (h); + pt->v = CW (v); } P2(PUBLIC pascal trap, BOOLEAN, EqualPt, Point, p1, Point, p2) @@ -42,15 +41,15 @@ P2(PUBLIC pascal trap, BOOLEAN, EqualPt, Point, p1, Point, p2) P1(PUBLIC pascal trap, void, LocalToGlobal, Point *, pt) { if (thePortX) { - pt->h = BigEndianValue(BigEndianValue(pt->h) - (BigEndianValue (PORT_BOUNDS (thePort).left))); - pt->v = BigEndianValue(BigEndianValue(pt->v) - (BigEndianValue (PORT_BOUNDS (thePort).top))); + pt->h = CW(CW(pt->h) - (CW (PORT_BOUNDS (thePort).left))); + pt->v = CW(CW(pt->v) - (CW (PORT_BOUNDS (thePort).top))); } } P1(PUBLIC pascal trap, void, GlobalToLocal, Point *, pt) { if (thePortX) { - pt->h = BigEndianValue(BigEndianValue(pt->h) + (Cx (PORT_BOUNDS (thePort).left))); - pt->v = BigEndianValue(BigEndianValue(pt->v) + (Cx (PORT_BOUNDS (thePort).top))); + pt->h = CW(CW(pt->h) + (Cx (PORT_BOUNDS (thePort).left))); + pt->v = CW(CW(pt->v) + (Cx (PORT_BOUNDS (thePort).top))); } } diff --git a/src/qPoly.cpp b/src/qPoly.cpp index c35e2c49..e4bb426b 100644 --- a/src/qPoly.cpp +++ b/src/qPoly.cpp @@ -19,7 +19,6 @@ char ROMlib_rcsid_qPoly[] = #include "rsys/cquick.h" using namespace Executor; -using namespace ByteSwap; P0(PUBLIC pascal trap, PolyHandle, OpenPoly) { @@ -42,21 +41,21 @@ P0(PUBLIC pascal trap, void, ClosePoly) for (ip = (INTEGER *)((char *)STARH(ph) + SMALLPOLY), ep = (INTEGER *)((char *)STARH(ph) + Hx(ph, polySize)); ip != ep;) { - if ((i = BigEndianValue(*ip)) <= top) + if ((i = CW(*ip)) <= top) top = i; ++ip; if (i >= bottom) bottom = i; - if ((i = BigEndianValue(*ip)) <= left) + if ((i = CW(*ip)) <= left) left = i; ++ip; if (i >= right) right = i; } - HxX(ph, polyBBox.top) = BigEndianValue(top); - HxX(ph, polyBBox.left) = BigEndianValue(left); - HxX(ph, polyBBox.bottom) = BigEndianValue(bottom); - HxX(ph, polyBBox.right) = BigEndianValue(right); + HxX(ph, polyBBox.top) = CW(top); + HxX(ph, polyBBox.left) = CW(left); + HxX(ph, polyBBox.bottom) = CW(bottom); + HxX(ph, polyBBox.right) = CW(right); PORT_POLY_SAVE_X (thePort) = (Handle)CWC (0); ShowPen(); } @@ -72,15 +71,15 @@ P3(PUBLIC pascal trap, void, OffsetPoly, PolyHandle, poly, Point *pp, *ep; if (dh || dv) { - HxX(poly, polyBBox.top) = BigEndianValue(Hx(poly, polyBBox.top) + dv); - HxX(poly, polyBBox.bottom) = BigEndianValue(Hx(poly, polyBBox.bottom) + dv); - HxX(poly, polyBBox.left) = BigEndianValue(Hx(poly, polyBBox.left) + dh); - HxX(poly, polyBBox.right) = BigEndianValue(Hx(poly, polyBBox.right) + dh); + HxX(poly, polyBBox.top) = CW(Hx(poly, polyBBox.top) + dv); + HxX(poly, polyBBox.bottom) = CW(Hx(poly, polyBBox.bottom) + dv); + HxX(poly, polyBBox.left) = CW(Hx(poly, polyBBox.left) + dh); + HxX(poly, polyBBox.right) = CW(Hx(poly, polyBBox.right) + dh); pp = HxX(poly, polyPoints); ep = (Point *) (((char *) STARH(poly)) + Hx(poly, polySize)); while (pp != ep) { - pp->h = BigEndianValue(BigEndianValue(pp->h) + (dh)); - pp->v = BigEndianValue(BigEndianValue(pp->v) + (dv)); + pp->h = CW(CW(pp->h) + (dh)); + pp->v = CW(CW(pp->v) + (dv)); pp++; } } diff --git a/src/qRect.cpp b/src/qRect.cpp index f95a01bf..25c82461 100644 --- a/src/qRect.cpp +++ b/src/qRect.cpp @@ -14,15 +14,14 @@ char ROMlib_rcsid_qRect[] = #include "ToolboxUtil.h" using namespace Executor; -using namespace ByteSwap; P5(PUBLIC pascal trap, void, SetRect, Rect *, r, INTEGER, left, INTEGER, top, INTEGER, right, INTEGER, bottom) { - r->top = BigEndianValue(top); - r->left = BigEndianValue(left); - r->bottom = BigEndianValue(bottom); - r->right = BigEndianValue(right); + r->top = CW(top); + r->left = CW(left); + r->bottom = CW(bottom); + r->right = CW(right); } P3(PUBLIC pascal trap, void, OffsetRect, Rect *, r, INTEGER, dh, INTEGER, dv) @@ -41,7 +40,7 @@ P3(PUBLIC pascal trap, void, InsetRect, Rect *, r, INTEGER, dh, INTEGER, dv) SWAPPED_OPW (r->right, -, dh); #if defined (INCOMPATIBLEBUTSANE) - if (BigEndianValue(r->top) >= BigEndianValue(r->bottom) || BigEndianValue(r->left) >= BigEndianValue(r->right)) + if (CW(r->top) >= CW(r->bottom) || CW(r->left) >= CW(r->right)) RECT_ZERO (r); #endif /* INCOMPATIBLEBUTSANE */ } @@ -49,15 +48,15 @@ P3(PUBLIC pascal trap, void, InsetRect, Rect *, r, INTEGER, dh, INTEGER, dv) P3(PUBLIC pascal trap, BOOLEAN, SectRect, const Rect *, s1, const Rect *, s2, Rect *, dest) { - if ( BigEndianValue (s1->top) < BigEndianValue (s2->bottom) - && BigEndianValue (s2->top) < BigEndianValue (s1->bottom) - && BigEndianValue (s1->left) < BigEndianValue (s2->right) - && BigEndianValue (s2->left) < BigEndianValue (s1->right)) + if ( CW (s1->top) < CW (s2->bottom) + && CW (s2->top) < CW (s1->bottom) + && CW (s1->left) < CW (s2->right) + && CW (s2->left) < CW (s1->right)) { - dest->top = BigEndianValue (MAX (BigEndianValue (s1->top), BigEndianValue (s2->top))); - dest->left = BigEndianValue (MAX (BigEndianValue (s1->left), BigEndianValue (s2->left))); - dest->bottom = BigEndianValue (MIN (BigEndianValue (s1->bottom), BigEndianValue (s2->bottom))); - dest->right = BigEndianValue (MIN (BigEndianValue (s1->right), BigEndianValue (s2->right))); + dest->top = CW (MAX (CW (s1->top), CW (s2->top))); + dest->left = CW (MAX (CW (s1->left), CW (s2->left))); + dest->bottom = CW (MIN (CW (s1->bottom), CW (s2->bottom))); + dest->right = CW (MIN (CW (s1->right), CW (s2->right))); return !EmptyRect (dest); } else @@ -69,8 +68,8 @@ P3(PUBLIC pascal trap, BOOLEAN, SectRect, const Rect *, s1, const Rect *, s2, P1(PUBLIC pascal trap, BOOLEAN, EmptyRect, Rect *, r) { - return(BigEndianValue(r->top) >= BigEndianValue(r->bottom) || - BigEndianValue(r->left) >= BigEndianValue(r->right)); + return(CW(r->top) >= CW(r->bottom) || + CW(r->left) >= CW(r->right)); } P3(PUBLIC pascal trap, void, UnionRect, Rect *, s1, Rect *, s2, Rect *, dest) @@ -80,10 +79,10 @@ P3(PUBLIC pascal trap, void, UnionRect, Rect *, s1, Rect *, s2, Rect *, dest) else if (EmptyRect(s2)) *dest = *s1; else { - dest->top = BigEndianValue(MIN (BigEndianValue(s1->top), BigEndianValue(s2->top))); - dest->left = BigEndianValue(MIN (BigEndianValue(s1->left), BigEndianValue(s2->left))); - dest->bottom = BigEndianValue(MAX (BigEndianValue(s1->bottom), BigEndianValue(s2->bottom))); - dest->right = BigEndianValue(MAX (BigEndianValue(s1->right), BigEndianValue(s2->right))); + dest->top = CW(MIN (CW(s1->top), CW(s2->top))); + dest->left = CW(MIN (CW(s1->left), CW(s2->left))); + dest->bottom = CW(MAX (CW(s1->bottom), CW(s2->bottom))); + dest->right = CW(MAX (CW(s1->right), CW(s2->right))); } } @@ -91,19 +90,19 @@ P2(PUBLIC pascal trap, BOOLEAN, PtInRect, Point, p, Rect *, r) { BOOLEAN retval; - retval = ( p.h >= BigEndianValue(r->left) - && p.h < BigEndianValue(r->right) - && p.v >= BigEndianValue(r->top) - && p.v < BigEndianValue(r->bottom)); + retval = ( p.h >= CW(r->left) + && p.h < CW(r->right) + && p.v >= CW(r->top) + && p.v < CW(r->bottom)); return retval; } P3(PUBLIC pascal trap, void, Pt2Rect, Point, p1, Point, p2, Rect *, dest) { - dest->top = BigEndianValue(MIN (p1.v, p2.v)); - dest->left = BigEndianValue(MIN (p1.h, p2.h)); - dest->bottom = BigEndianValue(MAX (p1.v, p2.v)); - dest->right = BigEndianValue(MAX (p1.h, p2.h)); + dest->top = CW(MIN (p1.v, p2.v)); + dest->left = CW(MIN (p1.h, p2.h)); + dest->bottom = CW(MAX (p1.v, p2.v)); + dest->right = CW(MAX (p1.h, p2.h)); } P3(PUBLIC pascal trap, void, PtToAngle, Rect *, rp, Point, p, INTEGER *, angle) @@ -117,8 +116,8 @@ P3(PUBLIC pascal trap, void, PtToAngle, Rect *, rp, Point, p, INTEGER *, angle) * just call atan2()? */ - dx = p.h - (BigEndianValue (rp->left) + BigEndianValue (rp->right)) / 2; - dy = p.v - (BigEndianValue (rp->top) + BigEndianValue (rp->bottom)) / 2; + dx = p.h - (CW (rp->left) + CW (rp->right)) / 2; + dy = p.v - (CW (rp->top) + CW (rp->bottom)) / 2; if (dx != 0) { @@ -137,7 +136,7 @@ P3(PUBLIC pascal trap, void, PtToAngle, Rect *, rp, Point, p, INTEGER *, angle) a = 180; } - *angle = BigEndianValue (a); + *angle = CW (a); } P2 (PUBLIC pascal trap, BOOLEAN, EqualRect, const Rect *, r1, const Rect *, r2) diff --git a/src/qRegion.cpp b/src/qRegion.cpp index 09669040..1a10d595 100644 --- a/src/qRegion.cpp +++ b/src/qRegion.cpp @@ -21,7 +21,6 @@ char ROMlib_rcsid_qRegion[] = #include "rsys/safe_alloca.h" using namespace Executor; -using namespace ByteSwap; #undef ALLOCABEGIN #define ALLOCABEGIN SAFE_DECL(); @@ -57,7 +56,7 @@ ROMlib_sledgehammer_rgn (RgnHandle rgn) start_ip = ip = RGN_DATA (rgn); /* #### verify that `y's are increasing also */ - for (y = BigEndianValue (*ip++); y != RGN_STOP; y = BigEndianValue (*ip++)) + for (y = CW (*ip++); y != RGN_STOP; y = CW (*ip++)) { /* #### verify that there are an even numbers of `x's */ if (special_rgn_p) @@ -71,7 +70,7 @@ ROMlib_sledgehammer_rgn (RgnHandle rgn) { int32 prev_x = INT32_MIN; - for (x = BigEndianValue (*ip++); x != RGN_STOP; x = BigEndianValue (*ip++)) + for (x = CW (*ip++); x != RGN_STOP; x = CW (*ip++)) gui_assert (x > prev_x); } } @@ -135,7 +134,7 @@ Executor::ROMlib_sizergn (RgnHandle rh, boolean_t special_p) /* INTERNAL */ { while (*ip != RGN_STOP_X) { - y = BigEndianValue (*ip++); + y = CW (*ip++); while ((i = *ip++) != RGN_STOP) { if (i < left) /* testing every element is a waste here */ @@ -149,8 +148,8 @@ Executor::ROMlib_sizergn (RgnHandle rh, boolean_t special_p) /* INTERNAL */ { while (*ip != RGN_STOP_X) { - y = BigEndianValue (*ip++); - while ((i = BigEndianValue (*ip++)) != RGN_STOP) + y = CW (*ip++); + while ((i = CW (*ip++)) != RGN_STOP) { if (i < left) /* testing every element is a waste here */ left = i; @@ -188,9 +187,9 @@ Executor::ROMlib_sizergn (RgnHandle rh, boolean_t special_p) /* INTERNAL */ HASSIGN_3 (rh, - rgnBBox.left, BigEndianValue (left), - rgnBBox.bottom, BigEndianValue (y), - rgnBBox.right, BigEndianValue (right)); + rgnBBox.left, CW (left), + rgnBBox.bottom, CW (y), + rgnBBox.right, CW (right)); } } @@ -267,13 +266,13 @@ P3 (PUBLIC pascal trap, void, OffsetRgn, RgnHandle, rh, ep = (INTEGER *) ((char *) ip + RGNP_SIZE (rp)) - 6; ip < ep; ip++) { - *ip = BigEndianValue (BigEndianValue (*ip) + (dv)); + *ip = CW (CW (*ip) + (dv)); ++ip; do { - *ip = BigEndianValue (BigEndianValue (*ip) + (dh)); + *ip = CW (CW (*ip) + (dh)); ++ip; - *ip = BigEndianValue (BigEndianValue (*ip) + (dh)); + *ip = CW (CW (*ip) + (dh)); ++ip; } while (*ip != RGN_STOP_X); @@ -301,7 +300,7 @@ P2 (PUBLIC pascal trap, BOOLEAN, PtInRgn, Point, p, RgnHandle, rh) *endpoints = RGN_STOP; ipe = endpoints; op = endpoints + NHPAIR; - while ((v = BigEndianValue (*ipr++)) != RGN_STOP) + while ((v = CW (*ipr++)) != RGN_STOP) { if (v > p.v) { @@ -312,9 +311,9 @@ P2 (PUBLIC pascal trap, BOOLEAN, PtInRgn, Point, p, RgnHandle, rh) } while (*ipr != RGN_STOP_X || *ipe != RGN_STOP) { - if (BigEndianValue (*ipr) < *ipe) - *op++ = BigEndianValue (*ipr++); - else if (*ipe < BigEndianValue (*ipr)) + if (CW (*ipr) < *ipe) + *op++ = CW (*ipr++); + else if (*ipe < CW (*ipr)) *op++ = *ipe++; else { @@ -353,9 +352,9 @@ P2 (PUBLIC pascal trap, BOOLEAN, PtInRgn, Point, p, RgnHandle, rh) op = freebuf; \ while (*ipr != RGN_STOP_X || *ipe != RGN_STOP) \ { \ - if (BigEndianValue (*ipr) < *ipe) \ - *op++ = BigEndianValue (*ipr++); \ - else if (*ipe < BigEndianValue (*ipr)) \ + if (CW (*ipr) < *ipe) \ + *op++ = CW (*ipr++); \ + else if (*ipe < CW (*ipr)) \ *op++ = *ipe++; \ else \ { \ @@ -395,14 +394,14 @@ P2 (PUBLIC pascal trap, BOOLEAN, PtInRgn, Point, p, RgnHandle, rh) \ ipe = cur; \ ipr = new; \ - *out++ = BigEndianValue (vx); \ + *out++ = CW (vx); \ hold = (LONGINT) (long) out; \ while (*ipr != RGN_STOP || *ipe != RGN_STOP) \ { \ if (*ipr < *ipe) \ - *out++ = BigEndianValue (*ipr++); \ + *out++ = CW (*ipr++); \ else if (*ipe < *ipr) \ - *out++ = BigEndianValue (*ipe++); \ + *out++ = CW (*ipe++); \ else \ { \ ipr++; \ @@ -413,7 +412,7 @@ P2 (PUBLIC pascal trap, BOOLEAN, PtInRgn, Point, p, RgnHandle, rh) --out; \ else \ { \ - *out++ = BigEndianValue (RGN_STOP); \ + *out++ = CW (RGN_STOP); \ } \ ipe = cur; \ cur = new; \ @@ -477,7 +476,7 @@ P2 (PUBLIC pascal trap, BOOLEAN, PtInRgn, Point, p, RgnHandle, rh) sp2 = src2; \ newsource \ newdest \ - *outp++ = BigEndianValue(y); \ + *outp++ = CW(y); \ outptr = outp; \ while (sstart != RGN_STOP && dstart != RGN_STOP) { \ if (sstop <= dstart) \ @@ -691,8 +690,8 @@ A3(PRIVATE, void, sectbinop, RgnHandle, srcrgn1, RgnHandle, srcrgn2, *src1ep = *src2ep = *sectsegep = *sectcurep = *freeep = *(src1ep+1) = *(src2ep+1) = RGN_STOP; - v1 = BigEndianValue(*ipr1++); - v2 = BigEndianValue(*ipr2++); + v1 = CW(*ipr1++); + v2 = CW(*ipr2++); wehavepairs = FALSE; /* whether or not scan lines have stuff */ switch (nspecial) { case 0: @@ -700,17 +699,17 @@ A3(PRIVATE, void, sectbinop, RgnHandle, srcrgn1, RgnHandle, srcrgn2, if (v1 < v2) { merge(ipr1, src1ep, freeep) /* no semi ... macro */ vx = v1; - v1 = BigEndianValue(*ipr1++); + v1 = CW(*ipr1++); } else if (v2 < v1) { merge(ipr2, src2ep, freeep) vx = v2; - v2 = BigEndianValue(*ipr2++); + v2 = CW(*ipr2++); } else { /* equal */ merge(ipr1, src1ep, freeep) merge(ipr2, src2ep, freeep) vx = v1; - v1 = BigEndianValue(*ipr1++); - v2 = BigEndianValue(*ipr2++); + v1 = CW(*ipr1++); + v2 = CW(*ipr2++); } sect(src1ep, src2ep, sectsegep) outputrgn(vx, sectcurep, sectsegep, tptr); @@ -722,17 +721,17 @@ A3(PRIVATE, void, sectbinop, RgnHandle, srcrgn1, RgnHandle, srcrgn2, if (v1 < v2) { nextline(ipr1, src1ep) /* no semi ... macro */ vx = v1; - v1 = BigEndianValue(*ipr1++); + v1 = CW(*ipr1++); } else if (v2 < v1) { merge(ipr2, src2ep, freeep) vx = v2; - v2 = BigEndianValue(*ipr2++); + v2 = CW(*ipr2++); } else { /* equal */ nextline(ipr1, src1ep) merge(ipr2, src2ep, freeep) vx = v1; - v1 = BigEndianValue(*ipr1++); - v2 = BigEndianValue(*ipr2++); + v1 = CW(*ipr1++); + v2 = CW(*ipr2++); } #if !defined (NDEBUG) assertincreasing(src1ep); @@ -747,17 +746,17 @@ A3(PRIVATE, void, sectbinop, RgnHandle, srcrgn1, RgnHandle, srcrgn2, if (v1 < v2) { nextline(ipr1, src1ep) /* no semi ... macro */ vx = v1; - v1 = BigEndianValue(*ipr1++); + v1 = CW(*ipr1++); } else if (v2 < v1) { nextline(ipr2, src2ep) vx = v2; - v2 = BigEndianValue(*ipr2++); + v2 = CW(*ipr2++); } else { /* equal */ nextline(ipr1, src1ep) nextline(ipr2, src2ep) vx = v1; - v1 = BigEndianValue(*ipr1++); - v2 = BigEndianValue(*ipr2++); + v1 = CW(*ipr1++); + v2 = CW(*ipr2++); } sectline(src1ep, src2ep, tptr, vx) } @@ -817,11 +816,11 @@ A4(PRIVATE, void, binop, optype, op, RgnHandle, srcrgn1, RgnHandle, srcrgn2, rp = &(RGN_BBOX (srcrgn1)); r1[0] = rp->top; r1[1] = rp->left; - r1[2] = rp->right != RGN_STOP_X ? rp->right : BigEndianValue(RGN_STOP - 1); + r1[2] = rp->right != RGN_STOP_X ? rp->right : CW(RGN_STOP - 1); r1[3] = RGN_STOP_X; - r1[4] = rp->bottom != RGN_STOP_X ? rp->bottom : BigEndianValue(RGN_STOP - 1); + r1[4] = rp->bottom != RGN_STOP_X ? rp->bottom : CW(RGN_STOP - 1); r1[5] = rp->left; - r1[6] = rp->right != RGN_STOP_X ? rp->right : BigEndianValue(RGN_STOP - 1); + r1[6] = rp->right != RGN_STOP_X ? rp->right : CW(RGN_STOP - 1); r1[7] = RGN_STOP_X; r1[8] = RGN_STOP_X; ipr1 = r1; @@ -831,11 +830,11 @@ A4(PRIVATE, void, binop, optype, op, RgnHandle, srcrgn1, RgnHandle, srcrgn2, rp = &(RGN_BBOX (srcrgn2)); r2[0] = rp->top; r2[1] = rp->left; - r2[2] = rp->right != RGN_STOP ? rp->right : BigEndianValue(RGN_STOP - 1); + r2[2] = rp->right != RGN_STOP ? rp->right : CW(RGN_STOP - 1); r2[3] = RGN_STOP_X; - r2[4] = rp->bottom != RGN_STOP ? rp->bottom : BigEndianValue(RGN_STOP - 1); + r2[4] = rp->bottom != RGN_STOP ? rp->bottom : CW(RGN_STOP - 1); r2[5] = rp->left; - r2[6] = rp->right != RGN_STOP ? rp->right : BigEndianValue(RGN_STOP - 1); + r2[6] = rp->right != RGN_STOP ? rp->right : CW(RGN_STOP - 1); r2[7] = RGN_STOP_X; r2[8] = RGN_STOP_X; ipr2 = r2; @@ -844,23 +843,23 @@ A4(PRIVATE, void, binop, optype, op, RgnHandle, srcrgn1, RgnHandle, srcrgn2, *src1ep = *src2ep = *sectsegep = *sectcurep = *freeep = *(src1ep+1) = *(src2ep+1) = RGN_STOP; - v1 = BigEndianValue(*ipr1++); - v2 = BigEndianValue(*ipr2++); + v1 = CW(*ipr1++); + v2 = CW(*ipr2++); while (v1 != RGN_STOP || v2 != RGN_STOP) { if (v1 < v2) { merge(ipr1, src1ep, freeep) /* no semi ... macro */ vx = v1; - v1 = BigEndianValue(*ipr1++); + v1 = CW(*ipr1++); } else if (v2 < v1) { merge(ipr2, src2ep, freeep) vx = v2; - v2 = BigEndianValue(*ipr2++); + v2 = CW(*ipr2++); } else { /* equal */ merge(ipr1, src1ep, freeep) merge(ipr2, src2ep, freeep) vx = v1; - v1 = BigEndianValue(*ipr1++); - v2 = BigEndianValue(*ipr2++); + v1 = CW(*ipr1++); + v2 = CW(*ipr2++); } switch (op) { case sectop: @@ -878,7 +877,7 @@ A4(PRIVATE, void, binop, optype, op, RgnHandle, srcrgn1, RgnHandle, srcrgn2, *tptr++ = RGN_STOP_X; gui_assert(sizeof(INTEGER) * (tptr - temppoints) <= 2 * (Hx(srcrgn1, rgnSize) + Hx(srcrgn2, rgnSize) + 18 * sizeof(INTEGER))); - HxX(dstrgn, rgnSize) = BigEndianValue(RGN_SMALL_SIZE + sizeof(INTEGER) * (tptr - temppoints)); + HxX(dstrgn, rgnSize) = CW(RGN_SMALL_SIZE + sizeof(INTEGER) * (tptr - temppoints)); /* TODO fix rgnBBox here */ ReallocHandle((Handle) dstrgn, RGN_SMALL_SIZE + sizeof(INTEGER) * (tptr - temppoints)); @@ -909,7 +908,7 @@ Executor::nonspecial_rgn_to_special_rgn (const INTEGER *src, INTEGER *dst) INTEGER *next_prev; /* Fetch the first X on this new scanline. */ - srcx = BigEndianValue (src[1]); + srcx = CW (src[1]); if (srcx == RGN_STOP) { /* The row with which to XOR is empty, so just extend the @@ -928,8 +927,8 @@ Executor::nonspecial_rgn_to_special_rgn (const INTEGER *src, INTEGER *dst) prevx = prev[1]; if (prevx == RGN_STOP) { - for (; (dst[1] = BigEndianValue (src[1])) != RGN_STOP; src += 2, dst += 2) - dst[2] = BigEndianValue (src[2]); + for (; (dst[1] = CW (src[1])) != RGN_STOP; src += 2, dst += 2) + dst[2] = CW (src[2]); src += 2; dst += 2; prev = next_prev; @@ -954,7 +953,7 @@ Executor::nonspecial_rgn_to_special_rgn (const INTEGER *src, INTEGER *dst) if (srcx < prevx) { *dst++ = srcx; - srcx = BigEndianValue (*src++); + srcx = CW (*src++); if (srcx == RGN_STOP) goto read_prev_only; } @@ -967,7 +966,7 @@ Executor::nonspecial_rgn_to_special_rgn (const INTEGER *src, INTEGER *dst) } else /* srcx == prevx */ { - srcx = BigEndianValue (*src++); + srcx = CW (*src++); prevx = *prev++; if (srcx == RGN_STOP) goto read_prev_only; @@ -994,7 +993,7 @@ Executor::nonspecial_rgn_to_special_rgn (const INTEGER *src, INTEGER *dst) while (srcx != RGN_STOP) { *dst++ = srcx; - srcx = BigEndianValue (*src++); + srcx = CW (*src++); } do_next: @@ -1017,10 +1016,10 @@ static INTEGER npairs; #define DECL void rhtopandinseth(RgnHandle rh, INTEGER *p, register INTEGER dh) #define STATEDECL SignedByte state; -#define SETIO ip = &HxX(rh, rgnSize) + 5; op = p; y = BigEndianValue(*ip++); npairs = 0; \ +#define SETIO ip = &HxX(rh, rgnSize) + 5; op = p; y = CW(*ip++); npairs = 0; \ state = HGetState((Handle) rh); \ HLock((Handle) rh) -#define NEXTPAIR (x = BigEndianValue(*ip++)) == RGN_STOP ? (y = BigEndianValue(*ip++), 0) : 1 +#define NEXTPAIR (x = CW(*ip++)) == RGN_STOP ? (y = CW(*ip++), 0) : 1 #define INCLXY(x, y) *op++ = y, *op++ = x, npairs++ #define UNSETIO HSetState((Handle) rh, state); INCLXY(RGN_STOP, RGN_STOP) @@ -1104,16 +1103,16 @@ A2(PRIVATE, void, ptorh, INTEGER *, p, RgnHandle, rh) op = RGN_DATA (rh); if (npairs) { /* decrement one 'cause of the 32767 sentinel */ - *op++ = BigEndianValue(oy = *p); + *op++ = CW(oy = *p); for (;npairs; npairs -= 2) { if ((y = *p++) != oy) { *op++ = RGN_STOP_X; - *op++ = BigEndianValue(y); + *op++ = CW(y); oy = y; } - *op++ = BigEndianValue(*p++); + *op++ = CW(*p++); ++p; /* if Cx((*ip)++ != oy) error! */ - *op++ = BigEndianValue(*p++); + *op++ = CW(*p++); } } *op++ = RGN_STOP_X; /* need one or two? */ @@ -1132,7 +1131,7 @@ P3(PUBLIC pascal trap, void, InsetRgn, RgnHandle, rh, INTEGER, dh, INTEGER, dv) #define INSANEBUTNECESSARY #if defined (INSANEBUTNECESSARY) rp = &RGN_BBOX (rh); - if (BigEndianValue(rp->top) >= BigEndianValue(rp->bottom) || BigEndianValue(rp->left) >= BigEndianValue(rp->right)) + if (CW(rp->top) >= CW(rp->bottom) || CW(rp->left) >= CW(rp->right)) RECT_ZERO (rp); #endif /* INSANEBUTNECESSARY */ } else { @@ -1159,10 +1158,10 @@ justone (const Rect *rp, RgnHandle rgn, RgnHandle dest) { const Rect *rp2 = &RGN_BBOX (rgn); - if ( BigEndianValue (rp->left) <= BigEndianValue (rp2->left) - && BigEndianValue (rp->top) <= BigEndianValue (rp2->top) - && BigEndianValue (rp->right) >= BigEndianValue (rp2->right) - && BigEndianValue (rp->bottom) >= BigEndianValue (rp2->bottom)) + if ( CW (rp->left) <= CW (rp2->left) + && CW (rp->top) <= CW (rp2->top) + && CW (rp->right) >= CW (rp2->right) + && CW (rp->bottom) >= CW (rp2->bottom)) { CopyRgn (rgn, dest); return TRUE; @@ -1252,7 +1251,7 @@ P3(PUBLIC pascal trap, void, XorRgn, RgnHandle, s1, RgnHandle, s2, if (RGN_SMALL_P (s1)) { temp2.p = (RgnPtr) ALLOCA( RGN_SMALL_SIZE + 9 * sizeof(INTEGER) ); #if 0 - BlockMove(BigEndianValue(*(Ptr *) s1), (Ptr) temp2.p, RGN_SMALL_SIZE); + BlockMove(CL(*(Ptr *) s1), (Ptr) temp2.p, RGN_SMALL_SIZE); #else memcpy((Ptr) temp2.p, MR(*(Ptr *) s1), RGN_SMALL_SIZE); #endif @@ -1274,7 +1273,7 @@ P3(PUBLIC pascal trap, void, XorRgn, RgnHandle, s1, RgnHandle, s2, if (RGN_SMALL_P (s2)) { temp3.p = (RgnPtr) ALLOCA (RGN_SMALL_SIZE + 9 * sizeof (INTEGER)); #if 0 - BlockMove(BigEndianValue(*(Ptr *) s2), (Ptr) temp3.p, RGN_SMALL_SIZE); + BlockMove(CL(*(Ptr *) s2), (Ptr) temp3.p, RGN_SMALL_SIZE); #else memcpy((Ptr) temp3.p, STARH (s2), RGN_SMALL_SIZE); #endif @@ -1298,73 +1297,73 @@ P3(PUBLIC pascal trap, void, XorRgn, RgnHandle, s1, RgnHandle, s2, op = RGN_DATA (dest); left = RGN_STOP; right = -32768; bottom = -32768; - for (y1 = BigEndianValue(*ip1++), y2 = BigEndianValue(*ip2++); y1 != RGN_STOP || y2 != RGN_STOP;) { + for (y1 = CW(*ip1++), y2 = CW(*ip2++); y1 != RGN_STOP || y2 != RGN_STOP;) { if (y1 < y2) { bottom = y1; - *op++ = BigEndianValue(y1); + *op++ = CW(y1); while ((*op++ = *ip1++) != RGN_STOP_X) { - x1 = BigEndianValue(op[-1]); + x1 = CW(op[-1]); if (x1 < left) left = x1; if (x1 > right) right = x1; } - y1 = BigEndianValue(*ip1++); + y1 = CW(*ip1++); } else if (y2 < y1) { bottom = y2; - *op++ = BigEndianValue(y2); + *op++ = CW(y2); while ((*op++ = *ip2++) != RGN_STOP_X) { - x2 = BigEndianValue(op[-1]); + x2 = CW(op[-1]); if (x2 < left) left = x2; if (x2 > right) right = x2; } - y2 = BigEndianValue(*ip2++); + y2 = CW(*ip2++); } else { cnt = 0; - for (x1 = BigEndianValue(*ip1++), x2 = BigEndianValue(*ip2++); + for (x1 = CW(*ip1++), x2 = CW(*ip2++); x1 != RGN_STOP || x2 != RGN_STOP;) { if (x1 < x2) { if (!cnt) { bottom = y1; - *op++ = BigEndianValue(y1); + *op++ = CW(y1); if (x1 < left) left = x1; } else if (x1 > right) right = x1; - *op++ = BigEndianValue(x1); + *op++ = CW(x1); cnt++; - x1 = BigEndianValue(*ip1++); + x1 = CW(*ip1++); } else if (x2 < x1) { if (!cnt) { bottom = y1; - *op++ = BigEndianValue(y1); + *op++ = CW(y1); if (x2 < left) left = x2; } else if (x2 > right) right = x2; - *op++ = BigEndianValue(x2); + *op++ = CW(x2); cnt++; - x2 = BigEndianValue(*ip2++); + x2 = CW(*ip2++); } else { - x1 = BigEndianValue(*ip1++); - x2 = BigEndianValue(*ip2++); + x1 = CW(*ip1++); + x2 = CW(*ip2++); } } if (cnt) *op++ = RGN_STOP_X; - y1 = BigEndianValue(*ip1++); - y2 = BigEndianValue(*ip2++); + y1 = CW(*ip1++); + y2 = CW(*ip2++); } } *op++ = RGN_STOP_X; HASSIGN_5 (dest, rgnBBox.top, *RGN_DATA (dest), - rgnBBox.left, BigEndianValue (left), - rgnBBox.bottom, BigEndianValue (bottom), - rgnBBox.right, BigEndianValue (right), - rgnSize, BigEndianValue ((char *) op - (char *) STARH (dest))); + rgnBBox.left, CW (left), + rgnBBox.bottom, CW (bottom), + rgnBBox.right, CW (right), + rgnSize, CW ((char *) op - (char *) STARH (dest))); if (rgn_is_rect_p (dest)) RGN_SET_SMALL (dest); if (finalrestingplace) { @@ -1429,7 +1428,7 @@ A1(PUBLIC, void, ROMlib_printrgn, RgnHandle, h) if (!RGN_SMALL_P (h)) { ip = RGN_DATA (h); - while ((y = BigEndianValue (*ip++)) != RGN_STOP) + while ((y = CW (*ip++)) != RGN_STOP) { printf ("%ld:", (long) y); if (special) @@ -1439,7 +1438,7 @@ A1(PUBLIC, void, ROMlib_printrgn, RgnHandle, h) } else { - while ((x = BigEndianValue (*ip++)) != RGN_STOP) + while ((x = CW (*ip++)) != RGN_STOP) printf (" %ld", (long) x); } printf (" 32767\n"); diff --git a/src/qRegular.cpp b/src/qRegular.cpp index 33f0630b..30415c2f 100644 --- a/src/qRegular.cpp +++ b/src/qRegular.cpp @@ -19,7 +19,6 @@ char ROMlib_rcsid_qRegular[] = #include "rsys/wind.h" using namespace Executor; -using namespace ByteSwap; P1(PUBLIC pascal trap, void, FrameRect, Rect *, r) { @@ -88,8 +87,8 @@ rect_matches_control_item (WindowPtr w, Rect *rp) Rect r; r = CTL_RECT (c); - retval = ((BigEndianValue (r.top) - BigEndianValue (rp->top) == BigEndianValue (rp->bottom) - BigEndianValue (r.bottom)) && - (BigEndianValue (r.left) - BigEndianValue (rp->left) == BigEndianValue (rp->right) - BigEndianValue (r.right))); + retval = ((CW (r.top) - CW (rp->top) == CW (rp->bottom) - CW (r.bottom)) && + (CW (r.left) - CW (rp->left) == CW (rp->right) - CW (r.right))); } return retval; diff --git a/src/qScale.cpp b/src/qScale.cpp index 652948d7..6ec226f9 100644 --- a/src/qScale.cpp +++ b/src/qScale.cpp @@ -14,7 +14,6 @@ char ROMlib_rcsid_qScale[] = #include "rsys/cquick.h" using namespace Executor; -using namespace ByteSwap; /* This routine scales old_bitmap and stores the result in dst_bitmap. * The only field of dst_bitmap that needs to be valid on entry is @@ -40,7 +39,7 @@ Executor::scale_blt_bitmap (const blt_bitmap_t *src_bitmap, blt_bitmap_t *dst_bi old_height = RECT_HEIGHT (old_rect); new_height = RECT_HEIGHT (new_rect); - /* If the old bitmap was empty, just create a new1, empty bitmap. We + /* If the old bitmap was empty, just create a new, empty bitmap. We * do this to avoid dividing by zero. */ if (new_width == 0 || new_height == 0) @@ -60,8 +59,8 @@ Executor::scale_blt_bitmap (const blt_bitmap_t *src_bitmap, blt_bitmap_t *dst_bi src_rowbytes = BITMAP_ROWBYTES (src_bitmap); dst_row_base = (uint8 *) MR (dst_bitmap->baseAddr); src_base = (uint8 *) (MR (src_bitmap->baseAddr) - + ((BigEndianValue (old_rect->top) - BigEndianValue (src_bitmap->bounds.top)) * src_rowbytes)); - left_x = (BigEndianValue (old_rect->left) - BigEndianValue (src_bitmap->bounds.left)) << 16; + + ((CW (old_rect->top) - CW (src_bitmap->bounds.top)) * src_rowbytes)); + left_x = (CW (old_rect->left) - CW (src_bitmap->bounds.left)) << 16; old_v = -1; /* This macro expresses the main horizontal scaling loop. The bits @@ -190,6 +189,6 @@ Executor::scale_blt_bitmap (const blt_bitmap_t *src_bitmap, blt_bitmap_t *dst_bi (1 << log2_bits_per_pixel)); } - BITMAP_SET_ROWBYTES_X (dst_bitmap, BigEndianValue (dst_rowbytes)); + BITMAP_SET_ROWBYTES_X (dst_bitmap, CW (dst_rowbytes)); dst_bitmap->bounds = *new_rect; } diff --git a/src/qStdArc.cpp b/src/qStdArc.cpp index 2c84b1cf..db15477c 100644 --- a/src/qStdArc.cpp +++ b/src/qStdArc.cpp @@ -19,7 +19,6 @@ char ROMlib_rcsid_qStdArc[] = #include "rsys/picture.h" using namespace Executor; -using namespace ByteSwap; #define returnhv(hh, vv) { ptp->h = hh; ptp->v = vv; return; } @@ -30,8 +29,8 @@ namespace Executor { A3(PRIVATE, void, getpoint, INTEGER, angle, Rect *, r, Point *, ptp) { - INTEGER left = BigEndianValue(r->left), top = BigEndianValue(r->top), - right = BigEndianValue(r->right), bottom = BigEndianValue(r->bottom); + INTEGER left = CW(r->left), top = CW(r->top), + right = CW(r->right), bottom = CW(r->bottom); INTEGER radh = (right - left) / 2, radv = (bottom - top) / 2; INTEGER centh = left + radh, @@ -68,11 +67,11 @@ A3(PRIVATE, void, getpoint, INTEGER, angle, Rect *, r, Point *, ptp) A3(PRIVATE, INTEGER, findwall, Rect *, r, INTEGER, h, INTEGER, v) { - if (v == BigEndianValue(r->top)) /* the order of tests is important */ + if (v == CW(r->top)) /* the order of tests is important */ return(RTop); /* don't change them if you don't see */ - else if (h == BigEndianValue(r->right)) /* why */ + else if (h == CW(r->right)) /* why */ return(RRight); - else if (v == BigEndianValue(r->bottom)) + else if (v == CW(r->bottom)) return(RBottom); else return(RLeft); @@ -81,8 +80,8 @@ A3(PRIVATE, INTEGER, findwall, Rect *, r, INTEGER, h, INTEGER, v) P4 (PUBLIC pascal trap, void, StdArc, GrafVerb, verb, Rect *, r, INTEGER, starta, INTEGER, arca) { - INTEGER left = BigEndianValue(r->left), top = BigEndianValue(r->top), - right = BigEndianValue(r->right), bottom = BigEndianValue(r->bottom); + INTEGER left = CW(r->left), top = CW(r->top), + right = CW(r->right), bottom = CW(r->bottom); INTEGER ewall; Point spt, ept; register INTEGER h, v; @@ -108,9 +107,9 @@ P4 (PUBLIC pascal trap, void, StdArc, GrafVerb, verb, Rect *, r, ROMlib_drawingverbrectpicupdate( verb, r ); PICOP(OP_frameArc + (int) verb); PICWRITE(r, sizeof(*r)); - swappedstarta = BigEndianValue(starta); + swappedstarta = CW(starta); PICWRITE(&swappedstarta, sizeof(swappedstarta)); - swappedarca = BigEndianValue(arca); + swappedarca = CW(arca); PICWRITE(&swappedarca, sizeof(swappedarca)); }); diff --git a/src/qStdBits.cpp b/src/qStdBits.cpp index a98b5395..0aebefcc 100644 --- a/src/qStdBits.cpp +++ b/src/qStdBits.cpp @@ -28,7 +28,6 @@ char ROMlib_rcsid_qStdBits[] = #include "rsys/tempalloc.h" using namespace Executor; -using namespace ByteSwap; static void ROMlib_real_copy_bits (PixMap *src, PixMap *dst, const Rect *src_rect, const Rect *dst_rect, @@ -38,10 +37,10 @@ static boolean_t src_dst_overlap_and_dst_below_src_p (const Rect *srcr, const Rect *dstr, int dh, int dv) { - if ( (BigEndianValue (dstr->top)) < (BigEndianValue (srcr->bottom) + dv) - && (BigEndianValue (srcr->top) + dv) <= (BigEndianValue (dstr->top)) - && (BigEndianValue (srcr->left) + dh) < (BigEndianValue (dstr->right)) - && (BigEndianValue (dstr->left)) < (BigEndianValue (srcr->right) + dh)) + if ( (CW (dstr->top)) < (CW (srcr->bottom) + dv) + && (CW (srcr->top) + dv) <= (CW (dstr->top)) + && (CW (srcr->left) + dh) < (CW (dstr->right)) + && (CW (dstr->left)) < (CW (srcr->right) + dh)) return TRUE; else return FALSE; @@ -51,7 +50,7 @@ static inline boolean_t dy_zero_p (const Rect *srcr, const Rect *dstr, int dh, int dv) { - return (BigEndianValue (srcr->top) + dv) == BigEndianValue (dstr->top); + return (CW (srcr->top) + dv) == CW (dstr->top); } void @@ -90,8 +89,8 @@ void Executor::canonicalize_bogo_map (BitMap *bogo_map, PixMap **canonical_addr, struct cleanup_info *info) { - int high_bits = ((unsigned short) BigEndianValue (bogo_map->rowBytes)) >> 14; - int low_bit = ((unsigned short) BigEndianValue (bogo_map->rowBytes)) & 1; + int high_bits = ((unsigned short) CW (bogo_map->rowBytes)) >> 14; + int low_bit = ((unsigned short) CW (bogo_map->rowBytes)) & 1; switch (high_bits) { @@ -199,7 +198,7 @@ Executor::canonicalize_bogo_map (BitMap *bogo_map, PixMap **canonical_addr, } #if !defined (NDEBUG) if ( (RECT_WIDTH (&BITMAP_BOUNDS (*canonical_addr)) - * BigEndianValue ((*canonical_addr)->pixelSize) + * CW ((*canonical_addr)->pixelSize) / 8) > BITMAP_ROWBYTES (*canonical_addr)) warning_unexpected ("unlikely map"); @@ -249,7 +248,7 @@ write_copybits_picdata (PixMap *src, PixMap *dst, } row_bytes = BITMAP_ROWBYTES (src); - pixel_size = BigEndianValue (src->pixelSize); + pixel_size = CW (src->pixelSize); direct_bits_p = (pixel_size == 16 || pixel_size == 32); if (pixel_size == 32) @@ -308,7 +307,7 @@ write_copybits_picdata (PixMap *src, PixMap *dst, PICWRITE (&zero, sizeof zero); PICWRITE (&ctab->ctFlags, sizeof ctab->ctFlags); PICWRITE (&ctab->ctSize, sizeof ctab->ctSize); - for (i = 0; i <= BigEndianValue (ctab->ctSize); i ++) + for (i = 0; i <= CW (ctab->ctSize); i ++) { ColorSpec *elt; @@ -321,7 +320,7 @@ write_copybits_picdata (PixMap *src, PixMap *dst, PICWRITE (src_rect, sizeof *src_rect); PICWRITE (dst_rect, sizeof *dst_rect); - swapped_mode = BigEndianValue (mode); + swapped_mode = CW (mode); PICWRITE (&swapped_mode, sizeof swapped_mode); if (mask) { @@ -391,7 +390,7 @@ write_copybits_picdata (PixMap *src, PixMap *dst, ip.p = MR (ip.p); count = op.p - (Ptr) packed_line; parity += count + countsize; - swappedcount = BigEndianValue (count); + swappedcount = CW (count); PICWRITE (countloc, countsize); PICWRITE (packed_line, count); } @@ -415,8 +414,8 @@ Executor::ROMlib_bogo_stdbits (BitMap *src_bogo_map, BitMap *dst_bogo_map, struct cleanup_info cleanup_info[2]; - if (BigEndianValue (dst_rect->bottom) <= BigEndianValue (dst_rect->top) - || BigEndianValue (dst_rect->right) <= BigEndianValue (dst_rect->left) + if (CW (dst_rect->bottom) <= CW (dst_rect->top) + || CW (dst_rect->right) <= CW (dst_rect->left) || (mask && !SectRect (dst_rect, &HxX (mask, rgnBBox), &dummy_rect))) return; @@ -467,8 +466,8 @@ Executor::StdBitsPicSaveFlag (BitMap *src_bogo_map, struct cleanup_info cleanup_info[2]; - if (BigEndianValue (dst_rect->bottom) <= BigEndianValue (dst_rect->top) - || BigEndianValue (dst_rect->right) <= BigEndianValue (dst_rect->left) + if (CW (dst_rect->bottom) <= CW (dst_rect->top) + || CW (dst_rect->right) <= CW (dst_rect->left) || (mask && !SectRect (dst_rect, &HxX (mask, rgnBBox), &dummy_rect))) return; @@ -556,7 +555,7 @@ ROMlib_real_copy_bits_helper (PixMap *src, PixMap *dst, #endif dst_rgb_spec = pixmap_rgb_spec (dst); - dst_depth = BigEndianValue (dst->pixelSize); + dst_depth = CW (dst->pixelSize); switch (dst_depth) { @@ -574,7 +573,7 @@ ROMlib_real_copy_bits_helper (PixMap *src, PixMap *dst, conversion on the src, so it matches that of the depth */ if (src->pixelSize != dst->pixelSize || (src->pmTable != dst->pmTable && - (BigEndianValue (src->pixelSize) < 16 + (CW (src->pixelSize) < 16 && (CTAB_SEED_X (MR (src->pmTable)) /* we assume the destination has the same color table as the current graphics device */ @@ -597,7 +596,7 @@ ROMlib_real_copy_bits_helper (PixMap *src, PixMap *dst, } #endif /* SAVE_CURSOR */ - src_depth = BigEndianValue (src->pixelSize); + src_depth = CW (src->pixelSize); switch (src_depth) { @@ -615,25 +614,25 @@ ROMlib_real_copy_bits_helper (PixMap *src, PixMap *dst, coordinates; and round down (up) to the byte boundary, and re-translate to boundary-relative bitmap coords */ widened_src_rect->left - = BigEndianValue (((BigEndianValue (src_rect->left) - BigEndianValue (src->bounds.left)) + = CW (((CW (src_rect->left) - CW (src->bounds.left)) & ~src_sub_byte_bits) - + BigEndianValue (src->bounds.left)); + + CW (src->bounds.left)); widened_src_rect->right - = BigEndianValue ((((BigEndianValue (src_rect->right) - BigEndianValue (src->bounds.left)) + = CW ((((CW (src_rect->right) - CW (src->bounds.left)) + src_sub_byte_bits) - & ~src_sub_byte_bits) + BigEndianValue (src->bounds.left)); + & ~src_sub_byte_bits) + CW (src->bounds.left)); /* the new_src should `be a pixmap' (have the pixmap bits set in the rowBytes) only if the dst is a pixmap; convert_pixmap does different things if the destination is a bitmap */ new_src->rowBytes = ( PIXMAP_DEFAULT_ROW_BYTES_X - | BigEndianValue ((((RECT_WIDTH (widened_src_rect) + | CW ((((RECT_WIDTH (widened_src_rect) * dst_depth) + 31) / 32) * 4)); /* Allocate temporary storage for the new_src_bits bitmap. */ n_bytes_needed = (BITMAP_ROWBYTES (new_src) - * (BigEndianValue (src_rect->bottom) - BigEndianValue (src_rect->top))); + * (CW (src_rect->bottom) - CW (src_rect->top))); TEMP_ALLOC_ALLOCATE (new_src_bits, temp_depth_bits, n_bytes_needed); new_src->baseAddr = (Ptr)RM (new_src_bits); @@ -671,7 +670,7 @@ ROMlib_real_copy_bits_helper (PixMap *src, PixMap *dst, new_src_row_bytes = (((RECT_WIDTH (dst_rect) * dst_depth + /* dst_sub_byte_bits */ 7) / 8) + 3) & ~3; - new_src->rowBytes = BigEndianValue (new_src_row_bytes) | PIXMAP_DEFAULT_ROW_BYTES_X; + new_src->rowBytes = CW (new_src_row_bytes) | PIXMAP_DEFAULT_ROW_BYTES_X; TEMP_ALLOC_ALLOCATE (scale_base, temp_scale_bits, new_src_row_bytes * RECT_HEIGHT (dst_rect)); @@ -703,12 +702,12 @@ ROMlib_real_copy_bits_helper (PixMap *src, PixMap *dst, if (src->baseAddr == dst->baseAddr && (src_dst_overlap_and_dst_below_src_p (src_rect, dst_rect, - BigEndianValue (dst->bounds.left) - BigEndianValue (src->bounds.left), - BigEndianValue (dst->bounds.top) - BigEndianValue (src->bounds.top))) + CW (dst->bounds.left) - CW (src->bounds.left), + CW (dst->bounds.top) - CW (src->bounds.top))) && (! RGN_SMALL_P (mask_region) || dy_zero_p (src_rect, dst_rect, - BigEndianValue (dst->bounds.left) - BigEndianValue (src->bounds.left), - BigEndianValue (dst->bounds.top) - BigEndianValue (src->bounds.top)))) + CW (dst->bounds.left) - CW (src->bounds.left), + CW (dst->bounds.top) - CW (src->bounds.top)))) { PixMap *new_src; void *overlap_bits; @@ -732,10 +731,10 @@ ROMlib_real_copy_bits_helper (PixMap *src, PixMap *dst, SectRect (&src->bounds, src_rect, &clipped_src_rect); height = RECT_HEIGHT (&clipped_src_rect); - offset = BigEndianValue (clipped_src_rect.top) - BigEndianValue (src_rect->top); + offset = CW (clipped_src_rect.top) - CW (src_rect->top); - copy_rect.top = BigEndianValue (BigEndianValue (src_rect->top) + offset); - copy_rect.bottom = BigEndianValue (BigEndianValue (src_rect->top) + offset + height); + copy_rect.top = CW (CW (src_rect->top) + offset); + copy_rect.bottom = CW (CW (src_rect->top) + offset + height); copy_rect.left = src->bounds.left; copy_rect.right = src->bounds.right; @@ -810,12 +809,12 @@ ROMlib_real_copy_bits (PixMap *src, PixMap *dst, { int default_nbits, new_nbits; - default_nbits = (RECT_WIDTH (src_rect) * BigEndianValue (dst->pixelSize) * + default_nbits = (RECT_WIDTH (src_rect) * CW (dst->pixelSize) * RECT_HEIGHT (src_rect)); - new_nbits = ((RECT_WIDTH (dst_rect) * BigEndianValue (src->pixelSize) * + new_nbits = ((RECT_WIDTH (dst_rect) * CW (src->pixelSize) * RECT_HEIGHT (dst_rect)) + - (RECT_WIDTH (dst_rect) * BigEndianValue (dst->pixelSize) * + (RECT_WIDTH (dst_rect) * CW (dst->pixelSize) * RECT_HEIGHT (dst_rect))); shrink_first_p = (new_nbits < default_nbits); } @@ -845,14 +844,14 @@ ROMlib_real_copy_bits (PixMap *src, PixMap *dst, #endif /* SAVE_CURSOR */ new_src = (PixMap *) alloca (sizeof *new_src); - src_depth = BigEndianValue (src->pixelSize); + src_depth = CW (src->pixelSize); temp_row_bytes = (RECT_WIDTH (dst_rect) * src_depth + 31) / 32 * 4; temp_bytes_needed = temp_row_bytes * RECT_HEIGHT (dst_rect); TEMP_ALLOC_ALLOCATE (temp_bits, temp_alloc_bits, temp_bytes_needed); *new_src = *src; new_src->baseAddr = (Ptr)RM (temp_bits); - new_src->rowBytes = BigEndianValue (temp_row_bytes | PIXMAP_DEFAULT_ROWBYTES); + new_src->rowBytes = CW (temp_row_bytes | PIXMAP_DEFAULT_ROWBYTES); new_src->bounds = *dst_rect; scale_blt_bitmap ((blt_bitmap_t *) src, (blt_bitmap_t *) new_src, diff --git a/src/qStdLine.cpp b/src/qStdLine.cpp index aab083d8..16cc28e8 100644 --- a/src/qStdLine.cpp +++ b/src/qStdLine.cpp @@ -19,7 +19,6 @@ char ROMlib_rcsid_qStdLine[] = #include "rsys/picture.h" using namespace Executor; -using namespace ByteSwap; /* * eight scan convert routines... all very similar. @@ -85,9 +84,9 @@ A8(PRIVATE, void, scodydxx1x2, register LONGINT, y1, register INTEGER, x1, *opp2 = op2; } -#define OUT2(y, x1, x2) (*op++ = BigEndianValue(y), \ - *op++ = BigEndianValue(x1), \ - *op++ = BigEndianValue(x2), \ +#define OUT2(y, x1, x2) (*op++ = CW(y), \ + *op++ = CW(x1), \ + *op++ = CW(x2), \ *op++ = RGNSTOPX) A5(PRIVATE, INTEGER *, scrdydxx1x2, register LONGINT, y1, register INTEGER, x1, @@ -206,7 +205,7 @@ A5(PRIVATE, INTEGER *, scrdxdyx1x2, register INTEGER, y1, register LONGINT, x1, OUT2(y1++, x1 >> 16, ox); ox = x1 >> 16; } - op[-3] = BigEndianValue(x2-1); + op[-3] = CW(x2-1); return op; } @@ -276,7 +275,7 @@ A3(PRIVATE, void, regionify1, register INTEGER *, ip1, if (y1 < y2) { x1 = *ip1++; gui_assert(x1 < x2 || (x1 == 32767 && x2 == 32767)); - *op++ = BigEndianValue(y1); + *op++ = CW(y1); *op++ = x1; if (x1 == 32767) /*-->*/ break; @@ -286,7 +285,7 @@ A3(PRIVATE, void, regionify1, register INTEGER *, ip1, } else if (y1 > y2) { x2 = *ip2++; gui_assert(x1 < x2 || (x1 == 32767 && x2 == 32767)); - *op++ = BigEndianValue(y2); + *op++ = CW(y2); *op++ = x1; if (x1 == 32767) /*-->*/ break; @@ -299,7 +298,7 @@ A3(PRIVATE, void, regionify1, register INTEGER *, ip1, x1 = *ip1++; x2 = *ip2++; gui_assert(x1 < x2 || (x1 == 32767 && x2 == 32767)); - *op++ = BigEndianValue(y1); + *op++ = CW(y1); *op++ = x1; if (x1 == 32767) /*-->*/ break; @@ -310,7 +309,7 @@ A3(PRIVATE, void, regionify1, register INTEGER *, ip1, } } *op++ = CWC(32767); - rp->rgnSize = BigEndianValue(-32768 + (op - (INTEGER *) rp) * sizeof(INTEGER)); + rp->rgnSize = CW(-32768 + (op - (INTEGER *) rp) * sizeof(INTEGER)); } #define SWAP std::swap @@ -332,13 +331,13 @@ P1(PUBLIC pascal trap, void, StdLine, Point, p) PAUSEDECL; r32767 = 32767; - x1 = BigEndianValue (PORT_PEN_LOC (thePort).h); - y1 = BigEndianValue (PORT_PEN_LOC (thePort).v); + x1 = CW (PORT_PEN_LOC (thePort).h); + y1 = CW (PORT_PEN_LOC (thePort).v); x2 = p.h; y2 = p.v; - px = BigEndianValue (PORT_PEN_SIZE (thePort).h); - py = BigEndianValue (PORT_PEN_SIZE (thePort).v); + px = CW (PORT_PEN_SIZE (thePort).h); + py = CW (PORT_PEN_SIZE (thePort).v); if (PORT_POLY_SAVE_X (thePort) && (x1 != x2 || y1 != y2)) { ph = (PolyHandle) PORT_POLY_SAVE (thePort); @@ -346,16 +345,16 @@ P1(PUBLIC pascal trap, void, StdLine, Point, p) if (psize == SMALLPOLY) { SetHandleSize((Handle) ph, psize + 2 * sizeof(Point)); oip = (INTEGER *)((char *) STARH(ph) + psize); - *oip++ = BigEndianValue(y1); - *oip++ = BigEndianValue(x1); - HxX(ph, polySize) = BigEndianValue(Hx(ph, polySize) + 2 * sizeof(Point)); + *oip++ = CW(y1); + *oip++ = CW(x1); + HxX(ph, polySize) = CW(Hx(ph, polySize) + 2 * sizeof(Point)); } else { SetHandleSize((Handle) ph, psize + sizeof(Point)); oip = (INTEGER *)((char *) STARH(ph) + psize); - HxX(ph, polySize) = BigEndianValue(Hx(ph, polySize) + sizeof(Point)); + HxX(ph, polySize) = CW(Hx(ph, polySize) + sizeof(Point)); } - *oip++ = BigEndianValue(y2); - *oip++ = BigEndianValue(x2); + *oip++ = CW(y2); + *oip++ = CW(x2); } PIC_SAVE_EXCURSION @@ -363,8 +362,8 @@ P1(PUBLIC pascal trap, void, StdLine, Point, p) ROMlib_drawingpicupdate(); PICOP(OP_Line); PICWRITE(&PORT_PEN_LOC (thePort), sizeof (PORT_PEN_LOC (thePort))); - swappedp.h = BigEndianValue(p.h); - swappedp.v = BigEndianValue(p.v); + swappedp.h = CW(p.h); + swappedp.v = CW(p.v); PICWRITE(&swappedp, sizeof(swappedp)); }) @@ -390,15 +389,15 @@ P1(PUBLIC pascal trap, void, StdLine, Point, p) } if (PORT_REGION_SAVE_X (thePort) && y1 == y2 && x1 != x2) { rp.p = (RgnPtr) ALLOCA(SMALLRGN + 5 * sizeof(INTEGER)); - (rp.p)->rgnBBox.top = BigEndianValue(y1); - (rp.p)->rgnBBox.left = BigEndianValue(x1); - (rp.p)->rgnBBox.bottom = BigEndianValue(y2); - (rp.p)->rgnBBox.right = BigEndianValue(x1); + (rp.p)->rgnBBox.top = CW(y1); + (rp.p)->rgnBBox.left = CW(x1); + (rp.p)->rgnBBox.bottom = CW(y2); + (rp.p)->rgnBBox.right = CW(x1); (rp.p)->rgnSize = CWC(SMALLRGN + 5 * sizeof(INTEGER)); oip = (INTEGER *) ((char *)rp.p + SMALLRGN); - *oip++ = BigEndianValue(y1); - *oip++ = BigEndianValue(x1); - *oip++ = BigEndianValue(x2); + *oip++ = CW(y1); + *oip++ = CW(x1); + *oip++ = CW(x2); *oip++ = RGNSTOPX; *oip++ = RGNSTOPX; rp.p = RM(rp.p); @@ -420,10 +419,10 @@ P1(PUBLIC pascal trap, void, StdLine, Point, p) /* size allocated below is overkill */ rp.p = (RgnPtr) ALLOCA(SMALLRGN + (dy + 1) * sizeof(INTEGER) * 6 + sizeof(INTEGER)); - (rp.p)->rgnBBox.top = BigEndianValue(y1); - (rp.p)->rgnBBox.left = BigEndianValue(MIN(x1, x2)); - (rp.p)->rgnBBox.bottom = BigEndianValue(y2); - (rp.p)->rgnBBox.right = BigEndianValue(MAX(x1, x2)); + (rp.p)->rgnBBox.top = CW(y1); + (rp.p)->rgnBBox.left = CW(MIN(x1, x2)); + (rp.p)->rgnBBox.bottom = CW(y2); + (rp.p)->rgnBBox.right = CW(MAX(x1, x2)); if (dy >= dx) if (x2 > x1) @@ -436,7 +435,7 @@ P1(PUBLIC pascal trap, void, StdLine, Point, p) else op = scrdxdyx1x2(y1, x1+1, dy, dx, (INTEGER *)rp.p + 5); *op++ = RGNSTOPX; - (rp.p)->rgnSize = BigEndianValue((char *) op - (char *) rp.p); + (rp.p)->rgnSize = CW((char *) op - (char *) rp.p); rp.p = RM(rp.p); XorRgn (&rp, (RgnHandle) PORT_REGION_SAVE (thePort), @@ -451,10 +450,10 @@ P1(PUBLIC pascal trap, void, StdLine, Point, p) rp.p = (RgnPtr) ALLOCA(SMALLRGN + (dy + py + 1) * sizeof(LONGINT) * 4 + 3 * 2 * sizeof(LONGINT)); /* Cx(rp->rgnSize) gets filled in later */ - (rp.p)->rgnBBox.top = BigEndianValue(y1); - (rp.p)->rgnBBox.left = BigEndianValue(MIN(x1, x2)); - (rp.p)->rgnBBox.bottom = BigEndianValue(y2 + py); - (rp.p)->rgnBBox.right = BigEndianValue(MAX(x1, x2) + px); + (rp.p)->rgnBBox.top = CW(y1); + (rp.p)->rgnBBox.left = CW(MIN(x1, x2)); + (rp.p)->rgnBBox.bottom = CW(y2 + py); + (rp.p)->rgnBBox.right = CW(MAX(x1, x2) + px); op = destpoints = (INTEGER *) ALLOCA(MAXNPOINTS(dy) * sizeof(INTEGER)); op2 = destpoints2 = (INTEGER *) ALLOCA(MAXNPOINTS(dy) * sizeof(INTEGER)); diff --git a/src/qStdOval.cpp b/src/qStdOval.cpp index 3a337483..3de85414 100644 --- a/src/qStdOval.cpp +++ b/src/qStdOval.cpp @@ -17,7 +17,6 @@ char ROMlib_rcsid_qStdOval[] = #include "rsys/picture.h" using namespace Executor; -using namespace ByteSwap; P2(PUBLIC pascal trap, void, StdOval, GrafVerb, v, Rect *, rp) { @@ -34,8 +33,8 @@ P2(PUBLIC pascal trap, void, StdOval, GrafVerb, v, Rect *, rp) }); PAUSERECORDING; - if (BigEndianValue(rp->bottom) - BigEndianValue(rp->top) < 4 && - BigEndianValue(rp->right) - BigEndianValue(rp->left) < 4) + if (CW(rp->bottom) - CW(rp->top) < 4 && + CW(rp->right) - CW(rp->left) < 4) StdRect(v, rp); else { rh = ROMlib_circrgn(rp); @@ -47,11 +46,11 @@ P2(PUBLIC pascal trap, void, StdOval, GrafVerb, v, Rect *, rp) (RgnHandle) PORT_REGION_SAVE (thePort)); if (PORT_PEN_VIS (thePort) >= 0) { - r.top = BigEndianValue (BigEndianValue (rp->top) + BigEndianValue (PORT_PEN_SIZE (thePort).v)); - r.left = BigEndianValue (BigEndianValue (rp->left) + BigEndianValue (PORT_PEN_SIZE (thePort).h)); - r.bottom = BigEndianValue (BigEndianValue (rp->bottom) - BigEndianValue (PORT_PEN_SIZE (thePort).v)); - r.right = BigEndianValue (BigEndianValue (rp->right) - BigEndianValue (PORT_PEN_SIZE (thePort).h)); - if (BigEndianValue (r.top) < BigEndianValue (r.bottom) && BigEndianValue (r.left) < BigEndianValue (r.right)) + r.top = CW (CW (rp->top) + CW (PORT_PEN_SIZE (thePort).v)); + r.left = CW (CW (rp->left) + CW (PORT_PEN_SIZE (thePort).h)); + r.bottom = CW (CW (rp->bottom) - CW (PORT_PEN_SIZE (thePort).v)); + r.right = CW (CW (rp->right) - CW (PORT_PEN_SIZE (thePort).h)); + if (CW (r.top) < CW (r.bottom) && CW (r.left) < CW (r.right)) { rh2 = ROMlib_circrgn(&r); XorRgn(rh, rh2, rh); diff --git a/src/qStdPic.cpp b/src/qStdPic.cpp index e2b1d11b..150675a7 100644 --- a/src/qStdPic.cpp +++ b/src/qStdPic.cpp @@ -20,7 +20,6 @@ char ROMlib_rcsid_qStdPic[] = #include "rsys/text.h" using namespace Executor; -using namespace ByteSwap; P3(PUBLIC pascal trap, void, StdComment, INTEGER, kind, INTEGER, size, Handle, hand) @@ -38,11 +37,11 @@ P3(PUBLIC pascal trap, void, StdComment, INTEGER, kind, INTEGER, size, break; } - kind = BigEndianValue(kind); + kind = CW(kind); if (size) { PICSAVEBEGIN(OP_LongComment); PICWRITE(&kind, sizeof(kind)); - swappedsize = BigEndianValue(size); + swappedsize = CW(size); PICWRITE(&swappedsize, sizeof(swappedsize)); state = HGetState(hand); HLock(hand); @@ -76,16 +75,16 @@ P2(PUBLIC pascal trap, void, StdPutPic, Ptr, sp, INTEGER, bc) oldhowfar = Hx(pch, pichowfar); ph = HxP(pch, pichandle); newhowfar = Hx(pch, pichowfar) + bc; - HxX(pch, pichowfar) = BigEndianValue(newhowfar); + HxX(pch, pichowfar) = CL(newhowfar); if (newhowfar > 32766) HxX(ph, picSize) = CWC (32766); else - HxX(ph, picSize) = BigEndianValue (newhowfar); + HxX(ph, picSize) = CW (newhowfar); if (Hx(pch, pichowfar) > Hx(pch, picsize)) { newsize = (Hx(pch, pichowfar) + 0xFF) & ~(LONGINT) 0xFF; SetHandleSize((Handle) ph, newsize); - HxX(pch, picsize) = BigEndianValue(newsize); + HxX(pch, picsize) = CL(newsize); } memmove((char *) STARH(ph) + oldhowfar, sp, bc); } diff --git a/src/qStdPoly.cpp b/src/qStdPoly.cpp index 8a8b3061..079dc9ef 100644 --- a/src/qStdPoly.cpp +++ b/src/qStdPoly.cpp @@ -20,7 +20,6 @@ char ROMlib_rcsid_qStdPoly[] = #include "rsys/picture.h" using namespace Executor; -using namespace ByteSwap; namespace Executor { PRIVATE void polyrgn(PolyHandle, RgnHandle); @@ -38,16 +37,16 @@ A2(PRIVATE, void, polyrgn, PolyHandle, ph, RgnHandle, rh) ep = (Point *) ((char *) STARH(ph) + Hx(ph, polySize)); firstp.h = Hx(ph, polyPoints[0].h); firstp.v = Hx(ph, polyPoints[0].v); - if (BigEndianValue(ep[-1].h) == firstp.h && BigEndianValue(ep[-1].v) == firstp.v) + if (CW(ep[-1].h) == firstp.h && CW(ep[-1].v) == firstp.v) ep--; tmpvis = PORT_PEN_VIS_X (thePort); PORT_PEN_VIS_X (thePort) = CWC (0); OpenRgn(); - MoveTo(BigEndianValue(pp->h), BigEndianValue(pp->v)); + MoveTo(CW(pp->h), CW(pp->v)); pp++; while (pp != ep) { - LineTo(BigEndianValue(pp->h), BigEndianValue(pp->v)); + LineTo(CW(pp->h), CW(pp->v)); pp++; } LineTo(firstp.h, firstp.v); @@ -92,13 +91,13 @@ P2(PUBLIC pascal trap, void, StdPoly, GrafVerb, verb, PolyHandle, ph) TRAPBEGIN (); pp = HxX(ph, polyPoints); ep = (Point *) ((char *) STARH(ph) + Hx(ph, polySize)); - firstp.h = BigEndianValue(pp[0].h); - firstp.v = BigEndianValue(pp[0].v); + firstp.h = CW(pp[0].h); + firstp.v = CW(pp[0].v); MoveTo (firstp.h, firstp.v); for (++pp; pp != ep; pp++) { - p.h = BigEndianValue(pp[0].h); - p.v = BigEndianValue(pp[0].v); + p.h = CW(pp[0].h); + p.v = CW(pp[0].v); StdLine(p); PORT_PEN_LOC (thePort) = pp[0]; } diff --git a/src/qStdRRect.cpp b/src/qStdRRect.cpp index c727d9cb..bec54a85 100644 --- a/src/qStdRRect.cpp +++ b/src/qStdRRect.cpp @@ -18,16 +18,15 @@ char ROMlib_rcsid_qStdRRect[] = #include "rsys/picture.h" using namespace Executor; -using namespace ByteSwap; #define TERM (*ip++ = RGNSTOPX) #define ADD4(y, x1, x2) \ - (*ip++ = BigEndianValue((y)), *ip++ = BigEndianValue((x1)), *ip++ = BigEndianValue((x2)), TERM) + (*ip++ = CW((y)), *ip++ = CW((x1)), *ip++ = CW((x2)), TERM) #define ADD6(y, x1, x2, x3, x4) \ - (*ip++ = BigEndianValue((y)), *ip++ = BigEndianValue((x1)), *ip++ = BigEndianValue((x2)), \ - *ip++ = BigEndianValue((x3)), *ip++ = BigEndianValue((x4)), TERM) + (*ip++ = CW((y)), *ip++ = CW((x1)), *ip++ = CW((x2)), \ + *ip++ = CW((x3)), *ip++ = CW((x4)), TERM) A1(PUBLIC, RgnHandle, ROMlib_circrgn, Rect *, r) /* INTERNAL */ { @@ -47,10 +46,10 @@ A1(PUBLIC, RgnHandle, ROMlib_circrgn, Rect *, r) /* INTERNAL */ ox = 0; #endif /* LETGCCWAIL */ - top = BigEndianValue(r->top); - bottom = BigEndianValue(r->bottom); + top = CW(r->top); + bottom = CW(r->bottom); dv = bottom - top; - dh = (right = BigEndianValue(r->right)) - (left = BigEndianValue(r->left)); + dh = (right = CW(r->right)) - (left = CW(r->left)); maxsize = 10 + (6 * dv + 1) * sizeof(INTEGER); rh = (RgnHandle) NewHandle(maxsize); @@ -75,7 +74,7 @@ A1(PUBLIC, RgnHandle, ROMlib_circrgn, Rect *, r) /* INTERNAL */ TERM; } } - HxX(rh, rgnSize) = BigEndianValue((char *) ip - (char *) STARH(rh)); + HxX(rh, rgnSize) = CW((char *) ip - (char *) STARH(rh)); SetHandleSize((Handle) rh, (Size) Hx(rh, rgnSize)); /*-->*/ return rh; } @@ -94,8 +93,8 @@ A1(PUBLIC, RgnHandle, ROMlib_circrgn, Rect *, r) /* INTERNAL */ rad = dv; } - centl = BigEndianValue(r->left) + dh / 2; - centr = BigEndianValue(r->left) + (dh + 1) / 2; + centl = CW(r->left) + dh / 2; + centr = CW(r->left) + (dh + 1) / 2; centt = top + dv / 2; first = TRUE; @@ -133,19 +132,19 @@ A1(PUBLIC, RgnHandle, ROMlib_circrgn, Rect *, r) /* INTERNAL */ else nx = savex / 2; if (first) { - *op++ = BigEndianValue(top); - *op++ = BigEndianValue(centl - nx); - *op++ = BigEndianValue(centr + nx); + *op++ = CW(top); + *op++ = CW(centl - nx); + *op++ = CW(centr + nx); *op++ = RGNSTOPX; ox = nx; first = FALSE; } else { if (nx != ox) { - *op++ = BigEndianValue(centt - oy); - *op++ = BigEndianValue(centl - nx); - *op++ = BigEndianValue(centl - ox); - *op++ = BigEndianValue(centr + ox); - *op++ = BigEndianValue(centr + nx); + *op++ = CW(centt - oy); + *op++ = CW(centl - nx); + *op++ = CW(centl - ox); + *op++ = CW(centr + ox); + *op++ = CW(centr + nx); *op++ = RGNSTOPX; ox = nx; } @@ -161,7 +160,7 @@ A1(PUBLIC, RgnHandle, ROMlib_circrgn, Rect *, r) /* INTERNAL */ while (ip != ep && *ip != RGNSTOPX) ip -= 2; ip2 = ip + 1; - *op++ = BigEndianValue(bottom - (BigEndianValue(*ip2++) - top)); + *op++ = CW(bottom - (CW(*ip2++) - top)); while ((*op++ = *ip2++) != RGNSTOPX) ; } @@ -172,7 +171,7 @@ A1(PUBLIC, RgnHandle, ROMlib_circrgn, Rect *, r) /* INTERNAL */ SetEmptyRgn (rh); else { - HxX(rh, rgnSize) = BigEndianValue(sizeof(INTEGER) * (op - (INTEGER *) STARH(rh))); + HxX(rh, rgnSize) = CW(sizeof(INTEGER) * (op - (INTEGER *) STARH(rh))); SetHandleSize((Handle) rh, (Size) Hx(rh, rgnSize)); } @@ -194,8 +193,8 @@ P4(PUBLIC pascal trap, void, StdRRect, GrafVerb, verb, Rect *, r, PIC_SAVE_EXCURSION ({ - p.h = BigEndianValue (width); - p.v = BigEndianValue (height); + p.h = CW (width); + p.v = CW (height); ROMlib_drawingverbrectovalpicupdate (verb, r, &p); PICOP (OP_frameRRect + (int) verb); PICWRITE (r, sizeof(*r)); @@ -206,13 +205,13 @@ P4(PUBLIC pascal trap, void, StdRRect, GrafVerb, verb, Rect *, r, /*-->*/ return; PAUSERECORDING; - ovaldx = BigEndianValue(r->right) - BigEndianValue(r->left) - width; - ovaldy = BigEndianValue(r->bottom) - BigEndianValue(r->top) - height; + ovaldx = CW(r->right) - CW(r->left) - width; + ovaldy = CW(r->bottom) - CW(r->top) - height; if (width < 4 && height < 4) StdRect(verb, r); else { - rectdx = BigEndianValue(r->right) - BigEndianValue(r->left) - width/2; - rectdy = BigEndianValue(r->bottom) - BigEndianValue(r->top) - height/2; + rectdx = CW(r->right) - CW(r->left) - width/2; + rectdy = CW(r->bottom) - CW(r->top) - height/2; rh = NewRgn(); corner = NewRgn(); @@ -220,12 +219,12 @@ P4(PUBLIC pascal trap, void, StdRRect, GrafVerb, verb, Rect *, r, RectRgn(rh, r); - SetRect(&tempr, BigEndianValue(r->left), BigEndianValue(r->top), - BigEndianValue(r->left)+width, BigEndianValue(r->top)+height); + SetRect(&tempr, CW(r->left), CW(r->top), + CW(r->left)+width, CW(r->top)+height); oval = ROMlib_circrgn(&tempr); - SetRect(&tempr, BigEndianValue(r->left), BigEndianValue(r->top), - BigEndianValue(r->left)+width/2, BigEndianValue(r->top)+height/2); + SetRect(&tempr, CW(r->left), CW(r->top), + CW(r->left)+width/2, CW(r->top)+height/2); RectRgn(smallr, &tempr); DiffRgn(smallr, oval, corner); diff --git a/src/qStdRect.cpp b/src/qStdRect.cpp index 6694cbaa..0e715c2c 100644 --- a/src/qStdRect.cpp +++ b/src/qStdRect.cpp @@ -18,7 +18,6 @@ char ROMlib_rcsid_qStdRect[] = #include "rsys/picture.h" using namespace Executor; -using namespace ByteSwap; P2(PUBLIC pascal trap, void, StdRect, GrafVerb, v, Rect *, rp) { @@ -29,16 +28,16 @@ P2(PUBLIC pascal trap, void, StdRect, GrafVerb, v, Rect *, rp) #define MOREINSANECOMPATIBILITY #if defined (MOREINSANECOMPATIBILITY) if (v == frame && PORT_REGION_SAVE_X (thePort)) { - if (BigEndianValue(rp->left) > BigEndianValue(rp->right)) { + if (CW(rp->left) > CW(rp->right)) { patcheduprect = *rp; patcheduprect.left = rp->right; patcheduprect.right = rp->left; - if (BigEndianValue(rp->top) > BigEndianValue(rp->bottom)) { + if (CW(rp->top) > CW(rp->bottom)) { patcheduprect.top = rp->bottom; patcheduprect.bottom = rp->top; } rp = &patcheduprect; - } else if (BigEndianValue(rp->top) > BigEndianValue(rp->bottom)) { + } else if (CW(rp->top) > CW(rp->bottom)) { patcheduprect = *rp; patcheduprect.top = rp->bottom; patcheduprect.bottom = rp->top; diff --git a/src/qStdRgn.cpp b/src/qStdRgn.cpp index 273da4e7..e16bbaf2 100644 --- a/src/qStdRgn.cpp +++ b/src/qStdRgn.cpp @@ -31,7 +31,6 @@ char ROMlib_rcsid_qStdRgn[] = #include "rsys/dirtyrect.h" using namespace Executor; -using namespace ByteSwap; PUBLIC WriteWhenType Executor::ROMlib_when = WriteInBltrgn; @@ -131,7 +130,7 @@ Executor::ROMlib_blt_rgn_update_dirty_rect bbox_height = RECT_HEIGHT (&bbox); row_bytes = ((bbox_width * bpp + 31) / 32) * 4; - new_src_pm->rowBytes = BigEndianValue (row_bytes); + new_src_pm->rowBytes = CW (row_bytes); TEMP_ALLOC_ALLOCATE (new_bits, temp_alloc_space, row_bytes * bbox_height); new_src_pm->baseAddr = (Ptr) RM (new_bits); @@ -140,15 +139,15 @@ Executor::ROMlib_blt_rgn_update_dirty_rect new_src_pm->pmTable = RM (ROMlib_dont_depthconv_ctab); - top = (BigEndianValue (src_rect->top) - + (BigEndianValue (bbox.top) - BigEndianValue (dst_rect->top))); - left = (BigEndianValue (src_rect->left) - + (BigEndianValue (bbox.left) - BigEndianValue (dst_rect->left))); + top = (CW (src_rect->top) + + (CW (bbox.top) - CW (dst_rect->top))); + left = (CW (src_rect->left) + + (CW (bbox.left) - CW (dst_rect->left))); - convert_src_rect.top = BigEndianValue (top); - convert_src_rect.left = BigEndianValue (left); - convert_src_rect.bottom = BigEndianValue (top + bbox_height); - convert_src_rect.right = BigEndianValue (left + bbox_width); + convert_src_rect.top = CW (top); + convert_src_rect.left = CW (left); + convert_src_rect.bottom = CW (top + bbox_height); + convert_src_rect.right = CW (left + bbox_width); if (mode == transparent || mode == hilite) @@ -218,11 +217,11 @@ Executor::ROMlib_blt_rgn_update_dirty_rect if (screen_dst_p && update_dirty_p) { const Rect *r = &RGN_BBOX (rh); - int dst_top = BigEndianValue (dst_pm->bounds.top); - int dst_left = BigEndianValue (dst_pm->bounds.left); + int dst_top = CW (dst_pm->bounds.top); + int dst_left = CW (dst_pm->bounds.left); - dirty_rect_accrue (BigEndianValue (r->top) - dst_top, BigEndianValue (r->left) - dst_left, - BigEndianValue (r->bottom) - dst_top, BigEndianValue (r->right) - dst_left); + dirty_rect_accrue (CW (r->top) - dst_top, CW (r->left) - dst_left, + CW (r->bottom) - dst_top, CW (r->right) - dst_left); if (ROMlib_when == WriteInBltrgn) { dirty_rect_update_screen (); @@ -352,8 +351,8 @@ blt_pattern_to_bitmap_simple_mode (RgnHandle rh, INTEGER mode, } dst_pixmap.bounds = dst->bounds; - dst_top = BigEndianValue (dst_pixmap.bounds.top); - dst_left = BigEndianValue (dst_pixmap.bounds.left); + dst_top = CW (dst_pixmap.bounds.top); + dst_left = CW (dst_pixmap.bounds.left); /* Actually do the blt. */ update_dirty_p = xdblt_pattern (rh, mode, -dst_left, -dst_top, src, @@ -363,8 +362,8 @@ blt_pattern_to_bitmap_simple_mode (RgnHandle rh, INTEGER mode, if (screen_dst_p && update_dirty_p) { const Rect *r = &RGN_BBOX (rh); - dirty_rect_accrue (BigEndianValue (r->top) - dst_top, BigEndianValue (r->left) - dst_left, - BigEndianValue (r->bottom) - dst_top, BigEndianValue (r->right) - dst_left); + dirty_rect_accrue (CW (r->top) - dst_top, CW (r->left) - dst_left, + CW (r->bottom) - dst_top, CW (r->right) - dst_left); if (ROMlib_when == WriteInBltrgn) { dirty_rect_update_screen (); @@ -391,8 +390,8 @@ blt_pixpat_to_pixmap_simple_mode (RgnHandle rh, INTEGER mode, screen_dst_p = active_screen_addr_p (dst); - dst_top = BigEndianValue (dst->bounds.top); - dst_left = BigEndianValue (dst->bounds.left); + dst_top = CW (dst->bounds.top); + dst_left = CW (dst->bounds.left); if (src->patType == CWC (pixpat_old_style_pattern)) { @@ -476,8 +475,8 @@ blt_pixpat_to_pixmap_simple_mode (RgnHandle rh, INTEGER mode, if (screen_dst_p && update_dirty_p) { const Rect *r = &RGN_BBOX (rh); - dirty_rect_accrue (BigEndianValue (r->top) - dst_top, BigEndianValue (r->left) - dst_left, - BigEndianValue (r->bottom) - dst_top, BigEndianValue (r->right) - dst_left); + dirty_rect_accrue (CW (r->top) - dst_top, CW (r->left) - dst_left, + CW (r->bottom) - dst_top, CW (r->right) - dst_left); if (ROMlib_when == WriteInBltrgn) { dirty_rect_update_screen (); @@ -505,7 +504,7 @@ blt_fancy_pat_mode_to_pixmap (RgnHandle rh, int mode, TEMP_ALLOC_DECL (temp_alloc_space); /* Set up xdata for the thing being blitted. */ - bpp = BigEndianValue (pixmap->pixelSize); + bpp = CW (pixmap->pixelSize); log2_bpp = ROMlib_log2[bpp]; if (!pixpat_handle) @@ -543,9 +542,9 @@ blt_fancy_pat_mode_to_pixmap (RgnHandle rh, int mode, x = STARH (xh); pattern_pm.bounds.top = CWC (0); pattern_pm.bounds.left = CWC (0); - pattern_pm.bounds.bottom = BigEndianValue (x->height_minus_1 + 1); - pattern_pm.bounds.right = BigEndianValue ((x->row_bytes << (5 - x->log2_bpp)) >> 2); - pattern_pm.rowBytes = BigEndianValue (x->row_bytes); + pattern_pm.bounds.bottom = CW (x->height_minus_1 + 1); + pattern_pm.bounds.right = CW ((x->row_bytes << (5 - x->log2_bpp)) >> 2); + pattern_pm.rowBytes = CW (x->row_bytes); if (x->pat_bits) pattern_pm.baseAddr = (Ptr) RM (x->pat_bits); else @@ -584,7 +583,7 @@ blt_fancy_pat_mode_to_pixmap (RgnHandle rh, int mode, bbox = RGN_BBOX (rh); converted_pm.bounds = bbox; row_bytes = (((RECT_WIDTH (&bbox) << log2_bpp) + 31U) / 32) * 4; - converted_pm.rowBytes = BigEndianValue (row_bytes); + converted_pm.rowBytes = CW (row_bytes); TEMP_ALLOC_ALLOCATE (new_bits, temp_alloc_space, row_bytes * RECT_HEIGHT (&bbox)); converted_pm.baseAddr = (Ptr) RM (new_bits); @@ -636,11 +635,11 @@ blt_fancy_pat_mode_to_pixmap (RgnHandle rh, int mode, if (active_screen_addr_p (pixmap)) { const Rect *r = &RGN_BBOX (rh); - int dst_top = BigEndianValue (pixmap->bounds.top); - int dst_left = BigEndianValue (pixmap->bounds.left); + int dst_top = CW (pixmap->bounds.top); + int dst_left = CW (pixmap->bounds.left); - dirty_rect_accrue (BigEndianValue (r->top) - dst_top, BigEndianValue (r->left) - dst_left, - BigEndianValue (r->bottom) - dst_top, BigEndianValue (r->right) - dst_left); + dirty_rect_accrue (CW (r->top) - dst_top, CW (r->left) - dst_left, + CW (r->bottom) - dst_top, CW (r->right) - dst_left); if (ROMlib_when == WriteInBltrgn) { dirty_rect_update_screen (); @@ -728,7 +727,7 @@ P2 (PUBLIC pascal trap, void, StdRgn, (rgn, { RgnPtr rp = STARH (rgn); - PICWRITE (rp, BigEndianValue (rp->rgnSize)); + PICWRITE (rp, CW (rp->rgnSize)); }); }); @@ -754,7 +753,7 @@ P2 (PUBLIC pascal trap, void, StdRgn, /* construct the frame */ /* #warning "We inset the region AFTER we've clipped it to the port bounds???" */ - InsetRgn (rh, BigEndianValue (pen_size.h), BigEndianValue (pen_size.v)); + InsetRgn (rh, CW (pen_size.h), CW (pen_size.v)); XorRgn (rgn, rh, rh); /* now `paint' the frame */ diff --git a/src/qStdText.cpp b/src/qStdText.cpp index 98487e96..9a3e4383 100644 --- a/src/qStdText.cpp +++ b/src/qStdText.cpp @@ -24,7 +24,6 @@ char ROMlib_rcsid_qStdText[] = #include "rsys/safe_alloca.h" using namespace Executor; -using namespace ByteSwap; #undef ALLOCABEGIN @@ -59,20 +58,20 @@ A5(PRIVATE, void, charblit, BitMap *, fbmp, BitMap *, tbmp, /* INTERNAL */ /*-->*/ return; /* Find the first column of pixels to be copied. */ - firstfrom = BigEndianValue(srect->left) - BigEndianValue(fbmp->bounds.left); + firstfrom = CW(srect->left) - CW(fbmp->bounds.left); /* Find the last column of pixels to be copied. */ - lastfrom = BigEndianValue(srect->right) - BigEndianValue(fbmp->bounds.left); + lastfrom = CW(srect->right) - CW(fbmp->bounds.left); /* Find the first column pixels are to be copied to. */ - firstto = BigEndianValue(drect->left) - BigEndianValue(tbmp->bounds.left); + firstto = CW(drect->left) - CW(tbmp->bounds.left); /* Find the last column pixels are to be copied to. */ - lastto = BigEndianValue(drect->right) - BigEndianValue(tbmp->bounds.left); - numrows = BigEndianValue(srect->bottom) - BigEndianValue(srect->top); + lastto = CW(drect->right) - CW(tbmp->bounds.left); + numrows = CW(srect->bottom) - CW(srect->top); /* * If it is to be put into italics, start with the characters * shifted over and shift them back one pixel at a time later. @@ -91,10 +90,10 @@ A5(PRIVATE, void, charblit, BitMap *, fbmp, BitMap *, tbmp, /* INTERNAL */ */ firstfromword = (unsigned short *) (MR(fbmp->baseAddr) + BITMAP_ROWBYTES (fbmp) * - (BigEndianValue(srect->top) - BigEndianValue(fbmp->bounds.top) - 1)) + firstfrom / 16; + (CW(srect->top) - CW(fbmp->bounds.top) - 1)) + firstfrom / 16; firsttoword = (unsigned short *) (MR(tbmp->baseAddr) + BITMAP_ROWBYTES (tbmp) * - (BigEndianValue(drect->top) - BigEndianValue(tbmp->bounds.top) - 1)) + firstto / 16; + (CW(drect->top) - CW(tbmp->bounds.top) - 1)) + firstto / 16; /* * Calculate the number of words to be taken from one bitmap and the * number to be put to the other minus one. The minus one is because @@ -151,18 +150,18 @@ A5(PRIVATE, void, charblit, BitMap *, fbmp, BitMap *, tbmp, /* INTERNAL */ nextfromword = firstfromword += numfromwords; \ nexttoword = firsttoword += numtowords; \ /* Read the first two words and mask off the unused bits */ \ - nextlong = (((ULONGINT) BigEndianValue(*nextfromword) << 16) + \ - BigEndianValue(*(nextfromword + 1))) & firstmask; \ + nextlong = (((ULONGINT) CW(*nextfromword) << 16) + \ + CW(*(nextfromword + 1))) & firstmask; \ nextfromword += 2; \ for ( j = wordstodo ; --j >= 0 ; ) { \ /* Write the next word, calculated by taking the appropriate \ * 16 bits from a LONGINT. */ \ - *nexttoword++ |= BigEndianValue(nextlong >> shiftsize); \ + *nexttoword++ |= CW(nextlong >> shiftsize); \ /* Prepare the LONGINT for the next pass. */ \ - nextlong = (nextlong << 16) + BigEndianValue(*nextfromword++); \ + nextlong = (nextlong << 16) + CW(*nextfromword++); \ } \ /* Write the last word with the appropriate bits masked out. */ \ - *nexttoword |= BigEndianValue((nextlong & lastmask) >> shiftsize); \ + *nexttoword |= CW((nextlong & lastmask) >> shiftsize); \ } @@ -278,10 +277,10 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, PAUSEDECL; p = (unsigned char *) textbufp; - num.h = BigEndianValue (nump->h); - num.v = BigEndianValue (nump->v); - den.h = BigEndianValue (denp->h); - den.v = BigEndianValue (denp->v); + num.h = CW (nump->h); + num.v = CW (nump->v); + den.h = CW (denp->h); + den.v = CW (denp->v); retval = 0; if (action == text_helper_measure) { @@ -310,11 +309,11 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, Point swapped_num; Point swapped_den; - swapped_num.h = BigEndianValue (num.h); - swapped_num.v = BigEndianValue (num.v); - swapped_den.h = BigEndianValue (den.h); - swapped_den.v = BigEndianValue (den.v); - PORT_PEN_LOC (thePort).h = BigEndianValue (BigEndianValue (PORT_PEN_LOC (thePort).h) + swapped_num.h = CW (num.h); + swapped_num.v = CW (num.v); + swapped_den.h = CW (den.h); + swapped_den.v = CW (den.v); + PORT_PEN_LOC (thePort).h = CW (CW (PORT_PEN_LOC (thePort).h) + (CALLTXMEAS (n, textbufp, &swapped_num, &swapped_den, 0))); @@ -327,31 +326,31 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, fmi.size = PORT_TX_SIZE_X (thePort); fmi.face = PORT_TX_FACE_X (thePort); fmi.device = PORT_DEVICE_X (thePort); - fmi.numer.h = BigEndianValue(num.h); - fmi.numer.v = BigEndianValue(num.v); - fmi.denom.h = BigEndianValue(den.h); - fmi.denom.v = BigEndianValue(den.v); + fmi.numer.h = CW(num.h); + fmi.numer.v = CW(num.v); + fmi.denom.h = CW(den.h); + fmi.denom.v = CW(den.v); fmop = FMSwapFont(&fmi); if (action == text_helper_measure) { if (fmop->numer.h && fmop->denom.h) - nump->h = BigEndianValue((LONGINT) Cx(fmop->numer.h) << 8 / Cx(fmop->denom.h)); + nump->h = CW((LONGINT) Cx(fmop->numer.h) << 8 / Cx(fmop->denom.h)); else nump->h = fmop->numer.h; if (fmop->numer.v && fmop->denom.h) - nump->v = BigEndianValue((LONGINT) Cx(fmop->numer.v) << 8 / Cx(fmop->denom.h)); + nump->v = CW((LONGINT) Cx(fmop->numer.v) << 8 / Cx(fmop->denom.h)); else nump->v = fmop->numer.v; denp->h = WIDTHPTR->hFactor; denp->v = WIDTHPTR->hFactor; if (finfop) { - finfop->ascent = BigEndianValue((unsigned short) CB(fmop->ascent)); - finfop->descent = BigEndianValue((unsigned short) CB(fmop->descent)); - finfop->widMax = BigEndianValue((unsigned short) CB(fmop->widMax)); - finfop->leading = BigEndianValue((unsigned short) CB(fmop->leading)); + finfop->ascent = CW((unsigned short) CB(fmop->ascent)); + finfop->descent = CW((unsigned short) CB(fmop->descent)); + finfop->widMax = CW((unsigned short) CB(fmop->widMax)); + finfop->leading = CW((unsigned short) CB(fmop->leading)); } } @@ -369,9 +368,9 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, HLock(MR(fmop->fontHandle)); fp = (FontRec *) STARH(MR(fmop->fontHandle)); fmap.baseAddr = RM((Ptr) (&fp->rowWords + 1)); - fmap.rowBytes = BigEndianValue(BigEndianValue(fp->rowWords) * 2); + fmap.rowBytes = CW(CW(fp->rowWords) * 2); fmap.bounds.left = fmap.bounds.top = 0; - fmap.bounds.right = BigEndianValue(BigEndianValue(fp->rowWords) * 16); + fmap.bounds.right = CW(CW(fp->rowWords) * 16); fmap.bounds.bottom = fp->fRectHeight; srect.top = misrect.top = 0; srect.bottom = misrect.bottom = fp->fRectHeight; @@ -382,26 +381,26 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, misrect.left = *(locp + Cx(fp->lastChar) - Cx(fp->firstChar) + 1); misrect.right = *(locp + Cx(fp->lastChar) - Cx(fp->firstChar) + 2); drect.left = PORT_PEN_LOC (thePort).h; - drect.top = BigEndianValue(BigEndianValue (PORT_PEN_LOC (thePort).v) - BigEndianValue(fp->ascent)); - drect.bottom = BigEndianValue(BigEndianValue(drect.top) + Cx(fp->fRectHeight)); + drect.top = CW(CW (PORT_PEN_LOC (thePort).v) - CW(fp->ascent)); + drect.bottom = CW(CW(drect.top) + Cx(fp->fRectHeight)); hOutput = Cx(WIDTHPTR->hOutput); vOutput = Cx(WIDTHPTR->vOutput); hOutputInverse = FixRatio (1 << 8, hOutput); space_extra = PORT_SP_EXTRA (thePort); - spacewidth = (BigEndianValue (WIDTHPTR->tabData[' ']) + space_extra - - BigEndianValue (WIDTHPTR->sExtra)); + spacewidth = (CL (WIDTHPTR->tabData[' ']) + space_extra + - CL (WIDTHPTR->sExtra)); if (action == text_helper_draw) { Point swapped_num; Point swapped_den; - swapped_num.h = BigEndianValue (num.h); - swapped_num.v = BigEndianValue (num.v); - swapped_den.h = BigEndianValue (den.h); - swapped_den.v = BigEndianValue (den.v); + swapped_num.h = CW (num.h); + swapped_num.v = CW (num.v); + swapped_den.h = CW (den.h); + swapped_den.v = CW (den.v); strwidth = text_helper (n, textbufp, &swapped_num, &swapped_den, 0, 0, text_helper_measure); @@ -426,30 +425,30 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, if (strwidth <= 0) /*-->*/ return 0; - stylemap.rowBytes = BigEndianValue((strwidth - Cx(fp->kernMax) + leftitalicoffset + + stylemap.rowBytes = CW((strwidth - Cx(fp->kernMax) + leftitalicoffset + rightitalicoffset + 31)/32 * 4); - stylemap.bounds.top = BigEndianValue (BigEndianValue (PORT_PEN_LOC (thePort).v) + stylemap.bounds.top = CW (CW (PORT_PEN_LOC (thePort).v) - CB(fmop->ascent)); #if 0 - stylemap.bounds.bottom = BigEndianValue (BigEndianValue (PORT_PEN_LOC (thePort).v) + stylemap.bounds.bottom = CW (CW (PORT_PEN_LOC (thePort).v) + descent); #else { int height; height = MAX (CB(fmop->ascent) + descent, Cx (fp->fRectHeight)); - stylemap.bounds.bottom = BigEndianValue (BigEndianValue (PORT_PEN_LOC (thePort).v) + stylemap.bounds.bottom = CW (CW (PORT_PEN_LOC (thePort).v) - CB(fmop->ascent) + height); } #endif - stylemap.bounds.left = BigEndianValue (BigEndianValue (PORT_PEN_LOC (thePort).h) + stylemap.bounds.left = CW (CW (PORT_PEN_LOC (thePort).h) + Cx(fp->kernMax) - leftitalicoffset); - stylemap.bounds.right = BigEndianValue(BigEndianValue(PORT_PEN_LOC (thePort).h) + stylemap.bounds.right = CW(CW(PORT_PEN_LOC (thePort).h) + strwidth + rightitalicoffset); if (fmop->shadow) - stylemap.bounds.left = BigEndianValue(BigEndianValue(stylemap.bounds.left) - 1); - nbytes = ((BigEndianValue(stylemap.bounds.bottom) - BigEndianValue(stylemap.bounds.top)) * - BigEndianValue(stylemap.rowBytes)); + stylemap.bounds.left = CW(CW(stylemap.bounds.left) - 1); + nbytes = ((CW(stylemap.bounds.bottom) - CW(stylemap.bounds.top)) * + CW(stylemap.rowBytes)); stylemap.baseAddr = RM((Ptr) ALLOCA(nbytes)); memset(MR(stylemap.baseAddr), 0, nbytes); bmp = &stylemap; @@ -473,30 +472,30 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, first = Cx(fp->firstChar); max = Cx(fp->lastChar) - Cx(fp->firstChar); - misintwidth = BigEndianValue(misrect.right) - BigEndianValue(misrect.left); + misintwidth = CW(misrect.right) - CW(misrect.left); misfixwidth = FIXED(misintwidth); - left = FIXED(BigEndianValue(PORT_PEN_LOC (thePort).h)) + FIXEDONEHALF; + left = FIXED(CW(PORT_PEN_LOC (thePort).h)) + FIXEDONEHALF; left_begin = left; widths = WIDTHPTR->tabData; kernmax = Cx(fp->kernMax); leftmost = left >> 16; - WIDTHPTR->tabData[' '] = BigEndianValue (spacewidth); - WIDTHPTR->sExtra = BigEndianValue (space_extra); + WIDTHPTR->tabData[' '] = CL (spacewidth); + WIDTHPTR->sExtra = CL (space_extra); if (action == text_helper_draw) ASSERT_SAFE(MR(stylemap.baseAddr)); for (ep = p + n; p != ep; p++) { if (charlocp) - *charlocp++ = BigEndianValue ((left - left_begin + 0xffff) >> 16); + *charlocp++ = CW ((left - left_begin + 0xffff) >> 16); c = *p; - width = BigEndianValue(widths[c]); + width = CL(widths[c]); if ((c -= Cx(fp->firstChar)) < 0 || c > max - || (wid = BigEndianValue(widp[c])) == -1) + || (wid = CW(widp[c])) == -1) { - drect.left = BigEndianValue(left >> 16); - if (BigEndianValue(drect.left) < leftmost) - leftmost = BigEndianValue(drect.left); - drect.right = BigEndianValue(BigEndianValue(drect.left) + misintwidth); + drect.left = CW(left >> 16); + if (CW(drect.left) < leftmost) + leftmost = CW(drect.left); + drect.right = CW(CW(drect.left) + misintwidth); if (action == text_helper_draw) { charblit(&fmap, bmp, &misrect, &drect, TRUE); @@ -511,11 +510,11 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, { srect.left = locp[c]; srect.right = locp[c+1]; - drect.left = BigEndianValue(left >> 16); - drect.left = BigEndianValue(BigEndianValue(drect.left) + (offset = (wid >> 8) + kernmax)); - if (BigEndianValue(drect.left) < leftmost) - leftmost = BigEndianValue(drect.left); - drect.right = BigEndianValue(BigEndianValue(drect.left) + BigEndianValue(srect.right) - BigEndianValue(srect.left)); + drect.left = CW(left >> 16); + drect.left = CW(CW(drect.left) + (offset = (wid >> 8) + kernmax)); + if (CW(drect.left) < leftmost) + leftmost = CW(drect.left); + drect.right = CW(CW(drect.left) + CW(srect.right) - CW(srect.left)); if (action == text_helper_draw) { charblit(&fmap, bmp, &srect, &drect, TRUE); @@ -533,7 +532,7 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, } } if (charlocp) - *charlocp = BigEndianValue ((left - left_begin + 0xffff) >> 16); + *charlocp = CW ((left - left_begin + 0xffff) >> 16); if (action == text_helper_measure) { retval = (left - left_begin + 0xFFFF) >> 16; @@ -541,7 +540,7 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, else { ASSERT_SAFE(MR(stylemap.baseAddr)); - stylemap.bounds.right = BigEndianValue((left >> 16) + rightitalicoffset); + stylemap.bounds.right = CW((left >> 16) + rightitalicoffset); if (PORT_TX_FACE (thePort) & (int) bold) { stylemap2 = stylemap; @@ -558,8 +557,8 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, ASSERT_SAFE(MR(stylemap.baseAddr)); for (i = 0; i++ < Cx(fmop->bold);) { - drect.left = BigEndianValue(BigEndianValue(drect.left) + 1); - srect.right = BigEndianValue(BigEndianValue(srect.right) - 1); + drect.left = CW(CW(drect.left) + 1); + srect.right = CW(CW(srect.right) - 1); charblit(&stylemap2, bmp, &srect, &drect, FALSE); ASSERT_SAFE(MR(stylemap.baseAddr)); } @@ -615,22 +614,22 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, srect = stylemap.bounds; drect = srect; - srect.left = BigEndianValue(BigEndianValue(srect.left) + 1); - drect.right = BigEndianValue(BigEndianValue(drect.right) - 1); + srect.left = CW(CW(srect.left) + 1); + drect.right = CW(CW(drect.right) - 1); ASSERT_SAFE(MR(stylemap.baseAddr)); charblit(&stylemap2, &stylemap3, &srect, &drect, FALSE); ASSERT_SAFE(MR(stylemap.baseAddr)); - srect.left = BigEndianValue(BigEndianValue(srect.left) - 1); /* restore */ - drect.right = BigEndianValue(BigEndianValue(drect.right) + 1); + srect.left = CW(CW(srect.left) - 1); /* restore */ + drect.right = CW(CW(drect.right) + 1); for (i = 0; i++ < Cx(fmop->shadow); ) { - drect.left = BigEndianValue(BigEndianValue(drect.left) + 1); - srect.right = BigEndianValue(BigEndianValue(srect.right) - 1); + drect.left = CW(CW(drect.left) + 1); + srect.right = CW(CW(srect.right) - 1); charblit(&stylemap2, &stylemap3, &srect, &drect, FALSE); } ASSERT_SAFE(MR(stylemap.baseAddr)); - drect.left = BigEndianValue(BigEndianValue(drect.left) - Cx(fmop->shadow)); /* restore */ - srect.right = BigEndianValue(BigEndianValue(srect.right) + Cx(fmop->shadow)); + drect.left = CW(CW(drect.left) - Cx(fmop->shadow)); /* restore */ + srect.right = CW(CW(srect.right) + Cx(fmop->shadow)); #if 0 BlockMove(MR(stylemap3.baseAddr), MR(bmp->baseAddr), (Size) nbytes); @@ -638,40 +637,40 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, memcpy(MR(bmp->baseAddr), MR(stylemap3.baseAddr), (Size) nbytes); #endif - srect.top = BigEndianValue(BigEndianValue(srect.top) + 1); - drect.bottom = BigEndianValue(BigEndianValue(drect.bottom) - 1); + srect.top = CW(CW(srect.top) + 1); + drect.bottom = CW(CW(drect.bottom) - 1); ASSERT_SAFE(MR(stylemap.baseAddr)); charblit(&stylemap3, bmp, &srect, &drect, FALSE); - srect.top = BigEndianValue(BigEndianValue(srect.top) - 1); /* restore */ - drect.bottom = BigEndianValue(BigEndianValue(drect.bottom) + 1); + srect.top = CW(CW(srect.top) - 1); /* restore */ + drect.bottom = CW(CW(drect.bottom) + 1); ASSERT_SAFE(MR(stylemap.baseAddr)); for (i = 0; i++ < Cx(fmop->shadow); ) { - drect.top = BigEndianValue(BigEndianValue(drect.top) + 1); - srect.bottom = BigEndianValue(BigEndianValue(srect.bottom) - 1); + drect.top = CW(CW(drect.top) + 1); + srect.bottom = CW(CW(srect.bottom) - 1); charblit(&stylemap3, bmp, &srect, &drect, FALSE); } - drect.top = BigEndianValue(BigEndianValue(drect.top) - Cx(fmop->shadow)); /* restore */ - srect.bottom = BigEndianValue(BigEndianValue(srect.bottom) + Cx(fmop->shadow)); + drect.top = CW(CW(drect.top) - Cx(fmop->shadow)); /* restore */ + srect.bottom = CW(CW(srect.bottom) + Cx(fmop->shadow)); ASSERT_SAFE(MR(stylemap3.baseAddr)); ASSERT_SAFE(MR(stylemap.baseAddr)); } - drect.top = BigEndianValue(BigEndianValue(bmp->bounds.top) + drect.top = CW(CW(bmp->bounds.top) - (FixMul((LONGINT) CB(fmop->ascent) << 16, (Fixed) (vOutput - 256) << 8) >> 16)); - drect.left = BigEndianValue(leftmost); - drect.bottom = BigEndianValue(BigEndianValue(drect.top) - + (FixMul((LONGINT) (BigEndianValue(bmp->bounds.bottom) - - BigEndianValue(bmp->bounds.top)) << 16, + drect.left = CW(leftmost); + drect.bottom = CW(CW(drect.top) + + (FixMul((LONGINT) (CW(bmp->bounds.bottom) + - CW(bmp->bounds.top)) << 16, (Fixed) vOutput << 8) >> 16)); - drect.right = BigEndianValue(leftmost + - (FixMul((LONGINT) (BigEndianValue(bmp->bounds.right) + drect.right = CW(leftmost + + (FixMul((LONGINT) (CW(bmp->bounds.right) - leftmost) << 16, (Fixed) hOutput << 8) >> 16)); srect = bmp->bounds; - srect.left = BigEndianValue(leftmost); + srect.left = CW(leftmost); ASSERT_SAFE(MR(stylemap.baseAddr)); StdBits(bmp, &srect, &drect, PORT_TX_MODE (thePort) & 0x37, (RgnHandle)0); ASSERT_SAFE(MR(stylemap.baseAddr)); @@ -683,7 +682,7 @@ Executor::text_helper (LONGINT n, Ptr textbufp, Point *nump, Point *denp, ASSERT_SAFE (MR (stylemap2.baseAddr)); } - PORT_PEN_LOC (thePort).h = BigEndianValue(BigEndianValue(drect.right) - + PORT_PEN_LOC (thePort).h = CW(CW(drect.right) - (FixMul((LONGINT) rightitalicoffset << 16, (Fixed) hOutput << 8) >> 16)); ASSERT_SAFE(MR(stylemap.baseAddr)); @@ -721,10 +720,10 @@ P4(PUBLIC pascal trap, void, StdText, INTEGER, n, Ptr, textbufp, Point swapped_num; Point swapped_den; - swapped_num.h = BigEndianValue (num.h); - swapped_num.v = BigEndianValue (num.v); - swapped_den.h = BigEndianValue (den.h); - swapped_den.v = BigEndianValue (den.v); + swapped_num.h = CW (num.h); + swapped_num.v = CW (num.v); + swapped_den.h = CW (den.h); + swapped_den.v = CW (den.v); text_helper (n, textbufp, &swapped_num, &swapped_den, 0, 0, text_helper_draw); } diff --git a/src/qText.cpp b/src/qText.cpp index c9eb6c04..2a587b84 100644 --- a/src/qText.cpp +++ b/src/qText.cpp @@ -19,12 +19,11 @@ char ROMlib_rcsid_qText[] = #include "rsys/glue.h" using namespace Executor; -using namespace ByteSwap; P1(PUBLIC pascal trap, void, TextFont, INTEGER, f) { if (thePort) - PORT_TX_FONT_X (thePort) = BigEndianValue(f); + PORT_TX_FONT_X (thePort) = CW(f); } P1(PUBLIC pascal trap, void, TextFace, INTEGER, thef) @@ -36,19 +35,19 @@ P1(PUBLIC pascal trap, void, TextFace, INTEGER, thef) P1(PUBLIC pascal trap, void, TextMode, INTEGER, m) { if (thePort) - PORT_TX_MODE_X (thePort) = BigEndianValue(m); + PORT_TX_MODE_X (thePort) = CW(m); } P1(PUBLIC pascal trap, void, TextSize, INTEGER, s) { if (thePort) - PORT_TX_SIZE_X (thePort) = BigEndianValue(s); + PORT_TX_SIZE_X (thePort) = CW(s); } P1(PUBLIC pascal trap, void, SpaceExtra, Fixed, e) { if (thePort) - PORT_SP_EXTRA_X (thePort) = BigEndianValue(e); + PORT_SP_EXTRA_X (thePort) = CL(e); } P1(PUBLIC pascal trap, void, DrawChar, CHAR, thec) @@ -99,7 +98,7 @@ P1(PUBLIC pascal trap, INTEGER, CharWidth, CHAR, thec) c = thec; np.h = np.v = dp.h = dp.v = CWC(256); retval = CALLTXMEAS(1, (Ptr) &c, &np, &dp, &fi); - return FixMul((LONGINT) retval << 16, (Fixed) BigEndianValue(np.h) << 8) / ((LONGINT) BigEndianValue(dp.h) << 8); + return FixMul((LONGINT) retval << 16, (Fixed) CW(np.h) << 8) / ((LONGINT) CW(dp.h) << 8); } P1(PUBLIC pascal trap, INTEGER, StringWidth, StringPtr, s) @@ -111,7 +110,7 @@ P1(PUBLIC pascal trap, INTEGER, StringWidth, StringPtr, s) np.h = np.v = dp.h = dp.v = CWC (256); retval = CALLTXMEAS((INTEGER)U(s[0]), (Ptr) s+1, &np, &dp, &fi); return FixMul ((LONGINT) retval << 16, - (Fixed) BigEndianValue (np.h) << 8) / ((LONGINT) BigEndianValue (dp.h) << 8); + (Fixed) CW (np.h) << 8) / ((LONGINT) CW (dp.h) << 8); } P3(PUBLIC pascal trap, INTEGER, TextWidth, Ptr, tb, INTEGER, fb, INTEGER, bc) @@ -123,7 +122,7 @@ P3(PUBLIC pascal trap, INTEGER, TextWidth, Ptr, tb, INTEGER, fb, INTEGER, bc) np.h = np.v = dp.h = dp.v = CWC(256); retval = CALLTXMEAS(bc, tb+fb, &np, &dp, &fi); return FixMul ((LONGINT) retval << 16, - (Fixed) BigEndianValue(np.h) << 8) / ((LONGINT) BigEndianValue(dp.h) << 8); + (Fixed) CW(np.h) << 8) / ((LONGINT) CW(dp.h) << 8); } P1(PUBLIC pascal trap, void, GetFontInfo, FontInfo *, ip) @@ -135,7 +134,7 @@ P1(PUBLIC pascal trap, void, GetFontInfo, FontInfo *, ip) pd.v = CWC(1); pd.h = CWC(1); CALLTXMEAS(0, (Ptr) "", &pn, &pd, ip); - ip->ascent = BigEndianValue(BigEndianValue(ip->ascent ) * BigEndianValue(pn.v) / BigEndianValue(pd.v)); - ip->descent = BigEndianValue(BigEndianValue(ip->descent) * BigEndianValue(pn.v) / BigEndianValue(pd.v)); - ip->leading = BigEndianValue(BigEndianValue(ip->leading) * BigEndianValue(pn.v) / BigEndianValue(pd.v)); + ip->ascent = CW(CW(ip->ascent ) * CW(pn.v) / CW(pd.v)); + ip->descent = CW(CW(ip->descent) * CW(pn.v) / CW(pd.v)); + ip->leading = CW(CW(ip->leading) * CW(pn.v) / CW(pd.v)); } diff --git a/src/rawpatblt.cpp b/src/rawpatblt.cpp index 8df6f4e0..af6c6be3 100644 --- a/src/rawpatblt.cpp +++ b/src/rawpatblt.cpp @@ -23,7 +23,6 @@ namespace Executor { } using namespace Executor; -using namespace ByteSwap; /* Dummy table, not actually dereferenced. */ const void *xdblt_nop_table[1] = { NULL }; @@ -97,7 +96,7 @@ xdblt_canon_pattern (void) log2_bpp = xdblt_log2_bpp; rgn = xdblt_rgn_start; - y = BigEndianValue (*rgn++); + y = CW (*rgn++); if (y == RGNSTOP) goto done_with_scanlines; @@ -187,7 +186,7 @@ xdblt_canon_pattern (void) * so we have to look two bytes farther to find the next y * value. Special regions store y's as big endian. */ - next_y = BigEndianValue (rgn[1]); + next_y = CW (rgn[1]); rgn += 2; if (next_y == RGNSTOP) goto done_with_scanlines; diff --git a/src/rawsrcblt.cpp b/src/rawsrcblt.cpp index 971a1ada..bb2b4b8c 100644 --- a/src/rawsrcblt.cpp +++ b/src/rawsrcblt.cpp @@ -32,7 +32,6 @@ namespace Executor { } using namespace Executor; -using namespace ByteSwap; const void **srcblt_noshift_stubs[8] = { srcblt_copy_noshift_labels, @@ -107,7 +106,7 @@ srcblt_bitmap (void) log2_bpp = srcblt_log2_bpp; rgn = srcblt_rgn_start; - y = BigEndianValue (*rgn++); + y = CW (*rgn++); if (y == RGNSTOP) goto done_with_scanlines; @@ -197,7 +196,7 @@ srcblt_bitmap (void) * so we have to look two bytes farther to find the next y * value. Special regions store y's as big endian. */ - next_y = BigEndianValue (rgn[1]); + next_y = CW (rgn[1]); rgn += 2; if (next_y == RGNSTOP) goto done_with_scanlines; diff --git a/src/resGet.cpp b/src/resGet.cpp index bd7956bd..6556f14d 100644 --- a/src/resGet.cpp +++ b/src/resGet.cpp @@ -37,7 +37,6 @@ namespace Executor { } using namespace Executor; -using namespace ByteSwap; P1(PUBLIC pascal trap, void, SetResLoad, BOOLEAN, load) { @@ -51,7 +50,7 @@ A2(PRIVATE, INTEGER, countmapresources, resmaphand, map, ResType, typ) retval = 0; WALKTR(map, i, tr) - if (BigEndianValue(tr->rtyp) == typ) { + if (CL(tr->rtyp) == typ) { retval += 1 + Cx(tr->nres); break; } @@ -93,7 +92,7 @@ A3(PRIVATE, Handle, getindmapresource, resmaphand, map, ResType, typ, resref *rr; WALKTR(map, i, tr) - if (BigEndianValue(tr->rtyp) == typ) { + if (CL(tr->rtyp) == typ) { nr = Cx(tr->nres) + 1; WALKRR(map, tr, j, rr) if (--*indx == 0) @@ -157,7 +156,7 @@ A4(PUBLIC, OSErr, ROMlib_maptypidtop, resmaphand, map, /* INTERNAL */ resref *rr; WALKTR(map, i, tr) - if (BigEndianValue(tr->rtyp) == typ) { + if (CL(tr->rtyp) == typ) { WALKRR(map, tr, j, rr) if (Cx(rr->rid) == id) { *ptr = rr; @@ -400,7 +399,7 @@ A3(PRIVATE, Handle, getnamedmapresource, resmaphand, map, ResType, typ, resref *rr; WALKTR(map, i, tr) - if (BigEndianValue(tr->rtyp) == typ) { + if (CL(tr->rtyp) == typ) { WALKRR(map, tr, j, rr) if (Cx(rr->noff) != -1 && EqualString((StringPtr) ( (char *)STARH(map) + Hx(map, namoff) + Cx(rr->noff)), diff --git a/src/resGetinfo.cpp b/src/resGetinfo.cpp index 1568b5a5..eaa72250 100644 --- a/src/resGetinfo.cpp +++ b/src/resGetinfo.cpp @@ -20,7 +20,6 @@ char ROMlib_rcsid_resGetinfo[] = #define STEF_GetResInfoFix using namespace Executor; -using namespace ByteSwap; P1(PUBLIC pascal trap, INTEGER, UniqueID, ResType, typ) { @@ -150,7 +149,7 @@ A2(PUBLIC, LONGINT, ROMlib_SizeResource, Handle, res, BOOLEAN, usehandle) return -1; } else - retval = BigEndianValue (l[3]); + retval = CL (l[3]); } } else @@ -158,7 +157,7 @@ A2(PUBLIC, LONGINT, ROMlib_SizeResource, Handle, res, BOOLEAN, usehandle) not_compressed_after_all: lc = sizeof(retval); ROMlib_setreserr(FSReadAll(Hx(map, resfn), &lc, (Ptr) &retval)); - retval = BigEndianValue(retval); + retval = CL(retval); if (ResErr != noErr) /*-->*/ return -1; } diff --git a/src/resInit.cpp b/src/resInit.cpp index 9f9299db..46332dc0 100644 --- a/src/resInit.cpp +++ b/src/resInit.cpp @@ -23,7 +23,6 @@ char ROMlib_rcsid_resInit[] = #include "rsys/appearance.h" using namespace Executor; -using namespace ByteSwap; /* extracts an int32 from a string of the form [^(]*([0-9]*).* * () == 0, any invalid string == -1 @@ -94,7 +93,7 @@ P0(PUBLIC pascal trap, INTEGER, InitResources) ROMlib_setreserr (noErr); str255assign(SysResName, SYSMACNAME); - SysMap = BigEndianValue (OpenRFPerm ((StringPtr) SYSMACNAME, Cx (BootDrive), + SysMap = CW (OpenRFPerm ((StringPtr) SYSMACNAME, Cx (BootDrive), fsCurPerm)); if (SysMap == CWC (-1)) @@ -124,7 +123,7 @@ P0(PUBLIC pascal trap, INTEGER, InitResources) }); - return BigEndianValue(SysMap); + return CW(SysMap); } P0(PUBLIC pascal trap, void, RsrcZoneInit) /* no op */ diff --git a/src/resMisc.cpp b/src/resMisc.cpp index 9bde1f8b..d200e815 100644 --- a/src/resMisc.cpp +++ b/src/resMisc.cpp @@ -15,24 +15,23 @@ char ROMlib_rcsid_resMisc[] = #include "rsys/hook.h" using namespace Executor; -using namespace ByteSwap; A1(PUBLIC, INTEGER, ROMlib_setreserr, INTEGER, reserr) /* INTERNAL */ { - ResErr = BigEndianValue(reserr); + ResErr = CW(reserr); if (ResErr != noErr && ResErrProc) { ROMlib_hook(res_reserrprocnumber); EM_D0 = (unsigned short) reserr; /* TODO: is unsigned short correct? */ - CALL_EMULATOR((syn68k_addr_t) BigEndianValue((long) ResErrProc)); + CALL_EMULATOR((syn68k_addr_t) CL((long) ResErrProc)); } - return BigEndianValue(ResErr); + return CW(ResErr); } P0(PUBLIC pascal trap, INTEGER, ResError) { - return BigEndianValue(ResErr); + return CW(ResErr); } P1(PUBLIC pascal trap, INTEGER, GetResFileAttrs, INTEGER, rn) @@ -57,5 +56,5 @@ P2(PUBLIC pascal trap, void, SetResFileAttrs, INTEGER, rn, INTEGER, attrs) if (!map) return; /* don't set reserr. I kid you not, see I-127 */ else - HxX(map, resfatr) = BigEndianValue (attrs); + HxX(map, resfatr) = CW (attrs); } diff --git a/src/resMod.cpp b/src/resMod.cpp index de286f2f..492b1fe5 100644 --- a/src/resMod.cpp +++ b/src/resMod.cpp @@ -21,7 +21,6 @@ char ROMlib_rcsid_resMod[] = using namespace Executor; -using namespace ByteSwap; typedef res_sorttype_t *sorttypeptr; MAKE_HIDDEN(sorttypeptr); @@ -57,7 +56,7 @@ P3(PUBLIC pascal trap, void, SetResInfo, Handle, res, INTEGER, id, ROMlib_setreserr(resAttrErr); /* IV-18 */ return; } - rr->rid = BigEndianValue(id); + rr->rid = CW(id); if (name) { sl = U(name[0]); if (U(*(sp = (char *)STARH(map) + Hx(map, namoff) + Cx(rr->noff))) < sl || @@ -66,8 +65,8 @@ P3(PUBLIC pascal trap, void, SetResInfo, Handle, res, INTEGER, id, err = MemError(); if (ROMlib_setreserr(err)) return; - rr->noff = BigEndianValue(Hx(map, rh.maplen) - Hx(map, namoff)); - HxX(map, rh.maplen) = BigEndianValue(Hx(map, rh.maplen) + sl + 1); + rr->noff = CW(Hx(map, rh.maplen) - Hx(map, namoff)); + HxX(map, rh.maplen) = CL(Hx(map, rh.maplen) + sl + 1); sp = (char *)STARH(map) + Hx(map, namoff) + Cx(rr->noff); warning_unimplemented ("we leak space here"); } @@ -120,20 +119,20 @@ A2(PRIVATE, LONGINT, addtype, resmaphand, map, ResType, typ) LONGINT off; WALKTR(map, i, tr) - if (tr->rtyp == BigEndianValue(typ)) + if (tr->rtyp == CL(typ)) return((LONGINT)((char *)tr - (char *)STARH(map))); EWALKTR(tr) ROMlib_invalar(); - t.rtyp = BigEndianValue(typ); + t.rtyp = CL(typ); t.nres = CWC(-1); - t.rloff = BigEndianValue(NAMEOFF(map) - TYPEOFF(map)); + t.rloff = CW(NAMEOFF(map) - TYPEOFF(map)); off = (LONGINT)((char *)tr - (char *) STARH(map)); Munger((Handle) map, off, (Ptr) "", (LONGINT)0, (Ptr) &t, sizeof(t)); - NUMTMINUS1X(map) = BigEndianValue(NUMTMINUS1(map) + 1); - MAPLENX(map) = BigEndianValue(MAPLEN(map) + sizeof(t)); - NAMEOFFX(map) = BigEndianValue(NAMEOFF(map) + sizeof(t)); + NUMTMINUS1X(map) = CW(NUMTMINUS1(map) + 1); + MAPLENX(map) = CL(MAPLEN(map) + sizeof(t)); + NAMEOFFX(map) = CW(NAMEOFF(map) + sizeof(t)); WALKTR(map, i, tr) - tr->rloff = BigEndianValue(BigEndianValue(tr->rloff) + sizeof(t)); + tr->rloff = CW(CW(tr->rloff) + sizeof(t)); EWALKTR(tr) return(off); } @@ -153,7 +152,7 @@ A2(PRIVATE, LONGINT, addname, resmaphand, map, StringPtr, name) Munger((Handle) map, MAPLEN(map), (Ptr) "", (LONGINT)0, (Ptr) name, namelen); retval = MAPLEN(map) - NAMEOFF(map); - MAPLENX(map) = BigEndianValue(MAPLEN(map) + namelen); + MAPLENX(map) = CL(MAPLEN(map) + namelen); } return retval; } @@ -183,8 +182,8 @@ P4(PUBLIC pascal trap, void, AddResource, Handle, data, ResType, typ, } ROMlib_setreserr(noErr); toff = addtype(map, typ); - r.rid = BigEndianValue(id); - r.noff = BigEndianValue(addname(map, name)); + r.rid = CW(id); + r.noff = CW(addname(map, name)); r.ratr = CB(resChanged); r.doff[0] = r.doff[1] = r.doff[2] = 0xff; HxX(map, resfatr) |= CWC(mapChanged); @@ -205,15 +204,15 @@ P4(PUBLIC pascal trap, void, AddResource, Handle, data, ResType, typ, sizeof(resref)); roff -= TYPEOFF(map); /* roff is from the beginning of the typelist */ - MAPLENX(map) = BigEndianValue(MAPLEN(map) + sizeof(resref)); - NAMEOFFX(map) = BigEndianValue(NAMEOFF(map) + sizeof(resref)); + MAPLENX(map) = CL(MAPLEN(map) + sizeof(resref)); + NAMEOFFX(map) = CW(NAMEOFF(map) + sizeof(resref)); tr2 = (typref *)((char *)STARH(map) + toff); - tr2->nres = BigEndianValue(BigEndianValue(tr2->nres) + 1); + tr2->nres = CW(CW(tr2->nres) + 1); WALKTR(map, i, tr) if (Cx(tr->rloff) >= roff && tr != tr2) /* if (Cx(tr->rloff) > roff) would probably work, but I'm chicken -- ctm */ - tr->rloff = BigEndianValue(BigEndianValue(tr->rloff) + sizeof(resref)); + tr->rloff = CW(CW(tr->rloff) + sizeof(resref)); EWALKTR(tr) } @@ -253,34 +252,34 @@ P1(PUBLIC pascal trap, void, RmveResource, Handle, res) nlen = U(*((char *)STARH(map) + nmoff)) + 1; Munger((Handle) map, nmoff, (Ptr)0, nlen, (Ptr) "", (LONGINT) 0); nmoff -= NAMEOFF(map); - MAPLENX(map) = BigEndianValue(MAPLEN(map) - nlen); + MAPLENX(map) = CL(MAPLEN(map) - nlen); } else nmoff = 0x7fff; HxX(map, resfatr) |= CWC(mapChanged|mapCompact); Munger((Handle) map, rroff, (Ptr)0, (LONGINT)sizeof(resref), (Ptr) "", (LONGINT) 0); rroff -= TYPEOFF(map); - MAPLENX(map) = BigEndianValue(MAPLEN(map) - sizeof(resref)); - NAMEOFFX(map) = BigEndianValue(NAMEOFF(map) - sizeof(resref)); + MAPLENX(map) = CL(MAPLEN(map) - sizeof(resref)); + NAMEOFFX(map) = CW(NAMEOFF(map) - sizeof(resref)); tr = (typref *)((char *) STARH(map) + troff); - tr->nres = BigEndianValue(BigEndianValue(tr->nres) - 1); + tr->nres = CW(CW(tr->nres) - 1); if (tr->nres == -1) { ROMlib_invalar(); - NUMTMINUS1X(map) = BigEndianValue(NUMTMINUS1(map) - 1); + NUMTMINUS1X(map) = CW(NUMTMINUS1(map) - 1); Munger((Handle) map, troff, (Ptr)0, (LONGINT)sizeof(typref), (Ptr) "", (LONGINT) 0); tloss = sizeof(typref); - MAPLENX(map) = BigEndianValue(MAPLEN(map) - sizeof(typref)); - NAMEOFFX(map) = BigEndianValue(NAMEOFF(map) - sizeof(typref)); + MAPLENX(map) = CL(MAPLEN(map) - sizeof(typref)); + NAMEOFFX(map) = CW(NAMEOFF(map) - sizeof(typref)); } else tloss = 0; WALKTR(map, i, tr) if (Cx(tr->rloff) > rroff) - tr->rloff = BigEndianValue(BigEndianValue(tr->rloff) - sizeof(resref)); - tr->rloff = BigEndianValue(BigEndianValue(tr->rloff) - tloss); + tr->rloff = CW(CW(tr->rloff) - sizeof(resref)); + tr->rloff = CW(CW(tr->rloff) - tloss); WALKRR(map, tr, j, rr) if (Cx(rr->noff) > nmoff) - rr->noff = BigEndianValue(BigEndianValue(rr->noff) - nlen); + rr->noff = CW(CW(rr->noff) - nlen); EWALKRR(rr) EWALKTR(tr) } @@ -324,9 +323,9 @@ A2(PUBLIC, void, ROMlib_wr, resmaphand, map, resref *, rr) /* INTERNAL */ if (rr->doff[0] == 0xFF && rr->doff[1] == 0xFF && rr->doff[2] == 0xFF) { newloc = Hx(map, rh.rmapoff) - Hx(map, rh.rdatoff); - HxX(map, rh.rmapoff) = BigEndianValue(Hx(map, rh.rmapoff) + rsize + + HxX(map, rh.rmapoff) = CL(Hx(map, rh.rmapoff) + rsize + sizeof(LONGINT)); - HxX(map, rh.datlen) = BigEndianValue(Hx(map, rh.datlen) + rsize + + HxX(map, rh.datlen) = CL(Hx(map, rh.datlen) + rsize + sizeof(LONGINT)); B3ASSIGN(rr->doff, newloc); } else @@ -336,7 +335,7 @@ A2(PUBLIC, void, ROMlib_wr, resmaphand, map, resref *, rr) /* INTERNAL */ if (ResErr != noErr) return; lc = sizeof(LONGINT); - swappedrsize = BigEndianValue(rsize); + swappedrsize = CL(rsize); ROMlib_setreserr(FSWriteAll(Hx(map, resfn), &lc, (Ptr) &swappedrsize)); if (ResErr != noErr) return; @@ -381,7 +380,7 @@ A4(PRIVATE, void, getdat, INTEGER, fn, LONGINT, datoff, LONGINT, doff, SetFPos(fn, fsFromStart, datoff + doff); lc = sizeof(LONGINT); FSReadAll(fn, &lc, (Ptr) &size); - size = BigEndianValue(size); + size = CL(size); gui_assert(size >= 0); *h = NewHandle(size); gui_assert(*h); @@ -403,7 +402,7 @@ A4(PRIVATE, void, putdat, INTEGER, fn, LONGINT, datoff, LONGINT *, doffp, gui_assert(*doffp >= 0); SetFPos(fn, fsFromStart, datoff + *doffp); lc = sizeof(LONGINT); - swappedsize = BigEndianValue(size); + swappedsize = CL(size); FSWriteAll(fn, &lc, (Ptr) &swappedsize); lc = size; HLock(h); @@ -425,15 +424,15 @@ A4(PRIVATE, LONGINT, walkst, res_sorttype_t *, sp, res_sorttype_t *, sep, INTEGE B3ASSIGN(sp->rrptr->doff, doff); #if 0 if (sp->rrptr->ratr & resChanged) { - putdat(fn, datoff, &doff, (Handle) BigEndianValue(sp->rrptr->rhand)); - } else if (!sp->rrptr->rhand || !*(Handle)BigEndianValue(sp->rrptr->rhand)) { + putdat(fn, datoff, &doff, (Handle) CL(sp->rrptr->rhand)); + } else if (!sp->rrptr->rhand || !*(Handle)CL(sp->rrptr->rhand)) { getdat(fn, datoff, sp->diskoff, &h); putdat(fn, datoff, &doff, h); DisposHandle(h); } else if (doff != sp->diskoff) - putdat(fn, datoff, &doff, (Handle) BigEndianValue(sp->rrptr->rhand)); + putdat(fn, datoff, &doff, (Handle) CL(sp->rrptr->rhand)); else - doff += GetHandleSize((Handle) BigEndianValue(sp->rrptr->rhand)) + + doff += GetHandleSize((Handle) CL(sp->rrptr->rhand)) + sizeof(LONGINT); #else if (sp->rrptr->ratr & resChanged) @@ -447,7 +446,7 @@ A4(PRIVATE, LONGINT, walkst, res_sorttype_t *, sp, res_sorttype_t *, sep, INTEGE lc = sizeof(LONGINT); FSReadAll(fn, &lc, (Ptr) &size); gui_assert(lc == sizeof(LONGINT)); - size = BigEndianValue(size); + size = CL(size); gui_assert(size >= 0); doff += size + sizeof(LONGINT); } else { @@ -486,8 +485,8 @@ A1(PRIVATE, void, compactdata, resmaphand, map) HSetState((Handle) map, mapstate); HxX(map, resfatr) |= CWC(mapChanged); HxX(map, resfatr) &= CWC(~mapCompact); - HxX(map, rh.rmapoff) = BigEndianValue(sizeof(reshead) + sizeof(rsrvrec) + datlen); - HxX(map, rh.datlen) = BigEndianValue(datlen); + HxX(map, rh.rmapoff) = CL(sizeof(reshead) + sizeof(rsrvrec) + datlen); + HxX(map, rh.datlen) = CL(datlen); DisposHandle((Handle) st); } @@ -500,7 +499,7 @@ P1(PUBLIC pascal trap, void, UpdateResFile, INTEGER, rn) BOOLEAN needtowalk; fcbrec *fp; OSErr err; - ioParam iopb; + IOParam iopb; map = ROMlib_rntohandl(rn, (Handle *)0); if (!map) { diff --git a/src/resOpen.cpp b/src/resOpen.cpp index 9e111edb..31230258 100644 --- a/src/resOpen.cpp +++ b/src/resOpen.cpp @@ -23,7 +23,6 @@ char ROMlib_rcsid_resOpen[] = #include "rsys/prefs.h" using namespace Executor; -using namespace ByteSwap; PUBLIC void Executor::HCreateResFile_helper (INTEGER vrefnum, LONGINT parid, Str255 name, @@ -51,7 +50,7 @@ Executor::HCreateResFile_helper (INTEGER vrefnum, LONGINT parid, Str255 name, FSClose(f); return; } - buf.bhead.rdatoff = buf.bhead.rmapoff = BigEndianValue(sizeof(reshead) + + buf.bhead.rdatoff = buf.bhead.rmapoff = CL(sizeof(reshead) + sizeof(rsrvrec)); buf.bhead.datlen = CLC(0); /* No data */ buf.bhead.maplen = CLC(sizeof(resmap) + sizeof(INTEGER)); @@ -101,7 +100,7 @@ Handle Executor::ROMlib_mgetres(resmaphand map, resref *rr) EM_A2 = (LONGINT) (long) US_TO_SYN68K(rr); #define TEMPORARYHACKUNTILWESWAPTABLES #if !defined(TEMPORARYHACKUNTILWESWAPTABLES) - EM_A0 = (LONGINT) BigEndianValue(ostraptable[0xFC]); + EM_A0 = (LONGINT) CL(ostraptable[0xFC]); #else /* defined(TEMPORARYHACKUNTILWESWAPTABLES) */ EM_A0 = (LONGINT) (long) ostraptable[0xFC]; #endif @@ -182,7 +181,7 @@ decompress_setup (INTEGER rn, int32 *dlenp, int32 *final_sizep, int32 *offsetp, LONGINT save_pos; GetFPos (rn, &save_pos); - *dcmp_handlep = GetResource (TICK("dcmp"), BigEndianValue (info.dcmpID)); + *dcmp_handlep = GetResource (TICK("dcmp"), CW (info.dcmpID)); SetFPos (rn, fsFromStart, save_pos); if (!*dcmp_handlep) @@ -193,7 +192,7 @@ decompress_setup (INTEGER rn, int32 *dlenp, int32 *final_sizep, int32 *offsetp, int32 working_size; LoadResource (*dcmp_handlep); - final_size = BigEndianValue (info.uncompressedSize); + final_size = CL (info.uncompressedSize); /* * The MacTech article says that the workingBufferFractionalSize @@ -313,7 +312,7 @@ PRIVATE Handle mgetres_helper (resmaphand map, resref *rr, int32 dlen, state = hlock_return_orig_state (dcmp_handle); dcmp = (typeof (dcmp)) STARH (dcmp_handle); HLock (retval); - CToPascalCall (&dcmp, CTOP_dcmp_template, + CToPascalCall((void*)dcmp, CTOP_dcmp_template, xxx, STARH (retval), dcmp_workspace, dlen); HUnlock (retval); @@ -370,7 +369,7 @@ Executor::ROMlib_mgetres2 (resmaphand map, resref *rr) retval = NULL; else { - dlen = BigEndianValue (dlen); + dlen = CL (dlen); if (ResLoad) retval = mgetres_helper (map, rr, dlen, retval); else if (!rr->rhand) @@ -551,7 +550,7 @@ P4 (PUBLIC pascal trap, INTEGER, HOpenResFile, INTEGER, vref, LONGINT, dirid, str255assign (local_name, fn); pbr.volumeParam.ioNamePtr = (StringPtr) RM ((Ptr) local_name); - pbr.volumeParam.ioVRefNum = BigEndianValue (vref); + pbr.volumeParam.ioVRefNum = CW (vref); pbr.volumeParam.ioVolIndex = CLC (-1); err = PBHGetVInfo (&pbr, FALSE); if (err) @@ -561,9 +560,9 @@ P4 (PUBLIC pascal trap, INTEGER, HOpenResFile, INTEGER, vref, LONGINT, dirid, } cpb.hFileInfo.ioNamePtr = RM (fn); - cpb.hFileInfo.ioVRefNum = BigEndianValue (vref); + cpb.hFileInfo.ioVRefNum = CW (vref); cpb.hFileInfo.ioFDirIndex = CWC (0); - cpb.hFileInfo.ioDirID = BigEndianValue (dirid); + cpb.hFileInfo.ioDirID = CL (dirid); if ((ROMlib_setreserr(PBGetCatInfo(&cpb, 0))) == noErr && perm > fsRdPerm) { @@ -573,7 +572,7 @@ P4 (PUBLIC pascal trap, INTEGER, HOpenResFile, INTEGER, vref, LONGINT, dirid, cpb.hFileInfo.ioDirID); if (fref != -1) { - CurMap = BigEndianValue (fref); + CurMap = CW (fref); /*-->*/ return fref; } } @@ -584,22 +583,22 @@ P4 (PUBLIC pascal trap, INTEGER, HOpenResFile, INTEGER, vref, LONGINT, dirid, ROMlib_invalar(); pbr.ioParam.ioNamePtr = RM (fn); - pbr.ioParam.ioVRefNum = BigEndianValue (vref); + pbr.ioParam.ioVRefNum = CW (vref); pbr.fileParam.ioFDirIndex = CWC (0); pbr.ioParam.ioPermssn = CB (perm); pbr.ioParam.ioMisc = CLC (0); - pbr.fileParam.ioDirID = BigEndianValue (dirid); + pbr.fileParam.ioDirID = CL (dirid); ROMlib_setreserr(PBHOpenRF(&pbr, FALSE)); if (ResErr != noErr) return(-1); - f = BigEndianValue(pbr.ioParam.ioRefNum); + f = CW(pbr.ioParam.ioRefNum); lc = sizeof(hd); ROMlib_setreserr(FSReadAll(f, &lc, (Ptr)&hd)); if (ResErr != noErr) { FSClose(f); return(-1); } - map = (resmaphand) NewHandle(BigEndianValue(hd.maplen)); + map = (resmaphand) NewHandle(CL(hd.maplen)); err = MemError(); if (ROMlib_setreserr(err)) { FSClose(f); @@ -612,7 +611,7 @@ P4 (PUBLIC pascal trap, INTEGER, HOpenResFile, INTEGER, vref, LONGINT, dirid, FSClose(f); return(-1); } - lc = BigEndianValue(hd.maplen); + lc = CL(hd.maplen); ROMlib_setreserr(FSReadAll(f, &lc, (Ptr) STARH(map))); if (ResErr != noErr) { DisposHandle((Handle) map); @@ -654,9 +653,9 @@ P4 (PUBLIC pascal trap, INTEGER, HOpenResFile, INTEGER, vref, LONGINT, dirid, } HxX(map, nextmap) = TopMapHndl; - HxX(map, resfn) = BigEndianValue(f); + HxX(map, resfn) = CW(f); TopMapHndl = RM((Handle) map); - CurMap = BigEndianValue(f); + CurMap = CW(f); /* check for resprload bits */ diff --git a/src/resPartial.cpp b/src/resPartial.cpp index 51144471..9b2241fe 100644 --- a/src/resPartial.cpp +++ b/src/resPartial.cpp @@ -15,7 +15,6 @@ char ROMlib_rcsid_resPartial[] = #include "rsys/file.h" using namespace Executor; -using namespace ByteSwap; P4 (PUBLIC pascal trap, void, ReadPartialResource, Handle, res, int32, offset, Ptr, buffer, int32, count) @@ -36,7 +35,7 @@ P4 (PUBLIC pascal trap, void, ReadPartialResource, LONGINT loc; cur_size = ROMlib_SizeResource (res, FALSE); - err = BigEndianValue (ResErr); + err = CW (ResErr); if (err == noErr && (uint32) offset + count > (uint32) cur_size) err = inputOutOfBounds; else diff --git a/src/resSetcur.cpp b/src/resSetcur.cpp index 1577d269..c00fb3bf 100644 --- a/src/resSetcur.cpp +++ b/src/resSetcur.cpp @@ -14,7 +14,6 @@ char ROMlib_rcsid_resSetcur[] = #include "rsys/resource.h" using namespace Executor; -using namespace ByteSwap; P0(PUBLIC pascal trap, INTEGER, CurResFile) { @@ -84,7 +83,7 @@ P1(PUBLIC pascal trap, void, UseResFile, INTEGER, rn) rn = Cx(SysMap); ROMlib_invalar(); if (ROMlib_rntohandl(rn, &map)) { - CurMap = BigEndianValue(rn); + CurMap = CW(rn); ROMlib_setreserr(noErr); } else ROMlib_setreserr(resFNotFound); diff --git a/src/rgbutil.cpp b/src/rgbutil.cpp index 86b6c64a..d2309a99 100644 --- a/src/rgbutil.cpp +++ b/src/rgbutil.cpp @@ -14,7 +14,6 @@ char ROMlib_rcsid_rgbutil[] = #include "rsys/cquick.h" using namespace Executor; -using namespace ByteSwap; /* This file contains routines useful for manipulating RGB pixels. * @@ -45,7 +44,7 @@ make_component_map (uint16 *map, int num_bits, boolean_t swap_p) v = i << (16 - num_bits); for (shift = num_bits; shift < 16; shift += num_bits) v |= v >> shift; - map[i] = swap_p ? BigEndianValue (v) : v; + map[i] = swap_p ? CW (v) : v; } /* Fill out the rest of the table with duplicate entries. */ @@ -81,7 +80,7 @@ rgb_extract_from_swapped_16bpp_pixel (const rgb_spec_t *rgb_spec, const rgb_map_t *table; table = &rgb_spec->map; - in = BigEndianValue (in); + in = CW (in); /* NOTE: we & 0xFF here because our lookup tables are built in * such a way as to ignore any extraneous high bits. This way we @@ -101,7 +100,7 @@ rgb_extract_from_swapped_32bpp_pixel (const rgb_spec_t *rgb_spec, const rgb_map_t *table; table = &rgb_spec->map; - in = BigEndianValue (in); + in = CL (in); /* NOTE: we & 0xFF here because our lookup tables are built in * such a way as to ignore any extraneous high bits. This way we @@ -195,9 +194,9 @@ rgbcolor_to_pixel (const rgb_spec_t *spec, if (spec->big_endian_p) { if (spec->bpp == 16) - v = (uint16) BigEndianValue (v); /* cast masks off extra cruft in high bits. */ + v = (uint16) CW (v); /* cast masks off extra cruft in high bits. */ else - v = BigEndianValue (v); + v = CL (v); } return v; diff --git a/src/scrap.cpp b/src/scrap.cpp index 14af0948..13bf0182 100644 --- a/src/scrap.cpp +++ b/src/scrap.cpp @@ -29,7 +29,6 @@ char ROMlib_rcsid_scrap[] = #endif using namespace Executor; -using namespace ByteSwap; P0(PUBLIC pascal trap, PScrapStuff, InfoScrap) { @@ -46,12 +45,12 @@ A1(PRIVATE, OSErr, cropen, INTEGER *, fp) { OSErr retval; - retval = FSOpen(MR(ScrapName), BigEndianValue (BootDrive), fp); + retval = FSOpen(MR(ScrapName), CW (BootDrive), fp); if (retval == fnfErr) { - retval = Create(MR(ScrapName), BigEndianValue (BootDrive), TICK("MACS"), TICK("CLIP")); + retval = Create(MR(ScrapName), CW (BootDrive), TICK("MACS"), TICK("CLIP")); if (retval != noErr) return(retval); - return(FSOpen(MR(ScrapName), BigEndianValue (BootDrive), fp)); + return(FSOpen(MR(ScrapName), CW (BootDrive), fp)); } return(retval); } @@ -86,7 +85,7 @@ P0(PUBLIC pascal trap, LONGINT, LoadScrap) LONGINT l = Cx(ScrapSize); if (ScrapState == 0) { - retval = FSOpen(MR(ScrapName), BigEndianValue (BootDrive), &f); + retval = FSOpen(MR(ScrapName), CW (BootDrive), &f); if (retval != noErr) return(retval); @@ -131,7 +130,7 @@ A0(PUBLIC, LONGINT, ROMlib_ZeroScrap) } else if (Cx(ScrapState) > 0) SetHandleSize(MR(ScrapHandle), (Size)0); ScrapSize = 0; - ScrapCount = BigEndianValue(BigEndianValue(ScrapCount) + 1); + ScrapCount = CW(CW(ScrapCount) + 1); return noErr; } @@ -154,18 +153,18 @@ P3(PUBLIC pascal trap, LONGINT, PutScrap, LONGINT, len, ResType, rest, Ptr, p) /*-->*/ return(retval); } #if defined(X) || defined(MACOSX_) || defined (SDL) - PutScrapX(rest, len, (char *) p, BigEndianValue (ScrapCount)); + PutScrapX(rest, len, (char *) p, CW (ScrapCount)); #endif /* defined(X) */ if (Cx(ScrapState) == 0) { - retval = FSOpen(MR(ScrapName), BigEndianValue (BootDrive), &f); + retval = FSOpen(MR(ScrapName), CW (BootDrive), &f); if (retval != noErr) /*-->*/ return(retval); SetFPos(f, fsFromStart, (LONGINT)Cx(ScrapSize)); l = 4; - rest = BigEndianValue(rest); + rest = CL(rest); FSWriteAll(f, &l, (Ptr) &rest); l = 4; - swappedlen = BigEndianValue(len); + swappedlen = CL(len); FSWriteAll(f, &l, (Ptr) &swappedlen); l = len = (len + 1) & -2L; FSWriteAll(f, &len, p); @@ -173,15 +172,15 @@ P3(PUBLIC pascal trap, LONGINT, PutScrap, LONGINT, len, ResType, rest, Ptr, p) } else { SetHandleSize(MR(ScrapHandle), (Size)Cx(ScrapSize) + 8); if (MemErr != noErr) -/*-->*/ return BigEndianValue(MemErr); +/*-->*/ return CW(MemErr); /* alignment stuff */ lp = (LONGINT *)((char *)STARH(MR(ScrapHandle)) + Cx(ScrapSize)); - *lp++ = BigEndianValue(rest); - *lp++ = BigEndianValue(len); + *lp++ = CL(rest); + *lp++ = CL(len); len = (len + 1) & -2L; PtrAndHand(p, MR(ScrapHandle), (Size)len); } - ScrapSize = BigEndianValue(BigEndianValue(ScrapSize) + 8 + len); + ScrapSize = CL(CL(ScrapSize) + 8 + len); return noErr; } @@ -273,15 +272,15 @@ P3(PUBLIC pascal trap, LONGINT, GetScrap, Handle, h, ResType, rest, /*-->*/ RETURN(retval); } if (ScrapState == 0) { - retval = FSOpen(MR(ScrapName), BigEndianValue (BootDrive), &f); + retval = FSOpen(MR(ScrapName), CW (BootDrive), &f); if (retval != noErr) /*-->*/ RETURN(retval); found = FALSE; while (l < Cx(ScrapSize) && !found) { ltoread = 8; FSReadAll(f, <oread, (Ptr) restlen); - s = BigEndianValue(restlen[1]); - if (rest == BigEndianValue(restlen[0])) + s = CL(restlen[1]); + if (rest == CL(restlen[0])) found = TRUE; else { incr = (8 + s + 1) & ~1L; @@ -295,7 +294,7 @@ P3(PUBLIC pascal trap, LONGINT, GetScrap, Handle, h, ResType, rest, } ReallocHandle(h, s); if (MemErr != noErr) -/*-->*/ RETURN(BigEndianValue(MemErr)); +/*-->*/ RETURN(CW(MemErr)); HLock(h); ltoread = s; FSReadAll(f, <oread, STARH(h)); @@ -305,9 +304,9 @@ P3(PUBLIC pascal trap, LONGINT, GetScrap, Handle, h, ResType, rest, HLock(MR(ScrapHandle)); p = MR(*(unsigned char **)MR(ScrapHandle)); #if 1 || !defined(QUADALIGN) - while (l < Cx(ScrapSize) && rest != BigEndianValue(*(LONGINT *)p)) + while (l < Cx(ScrapSize) && rest != CL(*(LONGINT *)p)) { - s = BigEndianValue (*((LONGINT *) p + 1)); + s = CL (*((LONGINT *) p + 1)); incr = (8 + s + 1) & ~1L; l += incr; p += incr; @@ -317,7 +316,7 @@ P3(PUBLIC pascal trap, LONGINT, GetScrap, Handle, h, ResType, rest, HUnlock(MR(ScrapHandle)); /*-->*/ RETURN(noTypeErr); } - s = BigEndianValue (*((LONGINT *)p + 1)); + s = CL (*((LONGINT *)p + 1)); #else /* QUADALIGN */ while (l < Cx(ScrapSize) && rest != SNAGLONG(p)) { incr = 8 + ((s = SNAGLONG(p + sizeof(LONGINT))) + 1) & -2L; @@ -334,7 +333,7 @@ P3(PUBLIC pascal trap, LONGINT, GetScrap, Handle, h, ResType, rest, PtrToXHand((Ptr) (p+8), h, s); HUnlock(MR(ScrapHandle)); } - *off = BigEndianValue(l+8); + *off = CL(l+8); RETURN(s); } @@ -444,8 +443,8 @@ ctab_from_surface (SDL_Surface *surfp) n_colors = SDL_n_colors (surfp); retval = (CTabHandle) NewHandle (CTAB_STORAGE_FOR_SIZE (n_colors-1)); - CTAB_SIZE_X (retval) = BigEndianValue (n_colors - 1); - CTAB_SEED_X (retval) = BigEndianValue (GetCTSeed ()); + CTAB_SIZE_X (retval) = CW (n_colors - 1); + CTAB_SEED_X (retval) = CL (GetCTSeed ()); CTAB_FLAGS_X (retval) = CTAB_GDEVICE_BIT_X; for (i = 0, ip = SDL_colors (surfp), op = CTAB_TABLE (retval); @@ -501,8 +500,8 @@ gworld_from_surface (SDL_Surface *surfp) r.top = CWC (0); r.left = CWC (0); - r.bottom = BigEndianValue (n_lines); - r.right = BigEndianValue (pixels_per_line); + r.bottom = CW (n_lines); + r.right = CW (pixels_per_line); { CGrafPtr save_port; GDHandle save_device; diff --git a/src/screen-dump.cpp b/src/screen-dump.cpp index ef482b73..fc66b04f 100644 --- a/src/screen-dump.cpp +++ b/src/screen-dump.cpp @@ -27,7 +27,6 @@ char ROMlib_rcsid_screendump[] = #include "rsys/screen-dump.h" using namespace Executor; -using namespace ByteSwap; #define II_little_endian 0x4949 #define MM_big_endian 0x4D4D @@ -143,7 +142,7 @@ dump_indirect_pm (PixMap *pm) height = RECT_HEIGHT (&pm->bounds); width = RECT_WIDTH (&pm->bounds); - bpp = BigEndianValue (pm->pixelSize); + bpp = CW (pm->pixelSize); if ( (bpp != 8 && bpp != 4) || VDRIVER_BYPASS_INTERNAL_FBUF_P ()) @@ -158,7 +157,7 @@ dump_indirect_pm (PixMap *pm) row_bytes = (width * bpp + 31) / 32 * 4; tiff_pm->baseAddr = (Ptr)RM (fbuf); - tiff_pm->rowBytes = BigEndianValue (row_bytes | PIXMAP_DEFAULT_ROW_BYTES); + tiff_pm->rowBytes = CW (row_bytes | PIXMAP_DEFAULT_ROW_BYTES); tiff_pm->bounds = pm->bounds; pixmap_set_pixel_fields (tiff_pm, bpp); @@ -247,9 +246,9 @@ dump_indirect_pm (PixMap *pm) for (i = 0; i <= color_table_size; i ++) { - color_map[i ] = BigEndianValue (color_table[i].rgb.red); - color_map[i + (1 << bpp)] = BigEndianValue (color_table[i].rgb.green); - color_map[i + (2 << bpp)] = BigEndianValue (color_table[i].rgb.blue); + color_map[i ] = CW (color_table[i].rgb.red); + color_map[i + (1 << bpp)] = CW (color_table[i].rgb.green); + color_map[i + (2 << bpp)] = CW (color_table[i].rgb.blue); } } @@ -322,7 +321,7 @@ Executor::do_dump_screen (void) int log2_bpp; gd_pm = STARH (gd_pmh); - log2_bpp = ROMlib_log2[BigEndianValue (gd_pm->pixelSize)]; + log2_bpp = ROMlib_log2[CW (gd_pm->pixelSize)]; (*dump_fns[log2_bpp]) (gd_pm); }); diff --git a/src/script.cpp b/src/script.cpp index 37eac235..0a5a100f 100644 --- a/src/script.cpp +++ b/src/script.cpp @@ -30,7 +30,6 @@ char ROMlib_rcsid_script[] = #include using namespace Executor; -using namespace ByteSwap; /* * NOTE: these are stubs to help me make FileMaker Pro go. @@ -217,10 +216,10 @@ P7 (PUBLIC pascal trap, void, NMeasureJust, Ptr, text, int32, length, warning_unimplemented ("slop = %d, run_pos = %d", slop, run_pos); - numerx.v = BigEndianValue (numer.v); - numerx.h = BigEndianValue (numer.h); - denomx.v = BigEndianValue (denomx.v); - denomx.h = BigEndianValue (denomx.h); + numerx.v = CW (numer.v); + numerx.h = CW (numer.h); + denomx.v = CW (denomx.v); + denomx.h = CW (denomx.h); xStdTxMeas (length, (uint8 *) text, &numerx, &denomx, NULL, (int16 *) charLocs); @@ -324,8 +323,8 @@ P6(PUBLIC pascal trap, void, FindWord, Ptr, textbufp, INTEGER, length, ++stop) ; - offsets[0] = BigEndianValue(start); - offsets[1] = BigEndianValue(stop); + offsets[0] = CW(start); + offsets[1] = CW(stop); offsets[2] = 0; /* Testing on Brute shows we should zero this memory */ offsets[3] = 0; offsets[4] = 0; @@ -339,8 +338,8 @@ P4(PUBLIC pascal trap, void, HiliteText, Ptr, textbufp, INTEGER, firstoffset, #if defined (BINCOMPAT) ROMlib_hook(script_notsupported); #endif /* BINCOMPAT */ - offsets[0] = BigEndianValue(firstoffset); - offsets[1] = BigEndianValue(secondoffset); + offsets[0] = CW(firstoffset); + offsets[1] = CW(secondoffset); offsets[2] = 0; offsets[3] = 0; offsets[4] = 0; @@ -372,8 +371,8 @@ P3 (PUBLIC pascal trap, void, DrawJust, Ptr, textbufp, { Fixed extra; - extra = BigEndianValue (save_sp_extra_x) + FixRatio (slop, n_spaces); - PORT_SP_EXTRA_X (thePort) = BigEndianValue (extra); + extra = CL (save_sp_extra_x) + FixRatio (slop, n_spaces); + PORT_SP_EXTRA_X (thePort) = CL (extra); } DrawText (textbufp, 0, length); PORT_SP_EXTRA_X (thePort) = save_sp_extra_x; @@ -414,7 +413,7 @@ this_date_rec(DateTimeRec *p) LONGINT now; GetDateTime (&now); - now = BigEndianValue (now); + now = CL (now); Secs2Date (now, p); } @@ -425,7 +424,7 @@ this_century (void) int retval; this_date_rec (&d); - retval = BigEndianValue (d.year) / 100 * 100; + retval = CW (d.year) / 100 * 100; return retval; } @@ -462,14 +461,14 @@ P5 (PUBLIC pascal trap, String2DateStatus, String2Date, else if (year_length < 3) year += this_century (); - *length_used_ret = BigEndianValue (offset); + *length_used_ret = CL (offset); /* not clear what we should do with other fields, some should probably be zeroed */ - date_time->year = BigEndianValue (year); - date_time->month = BigEndianValue (month); - date_time->day = BigEndianValue (day); + date_time->year = CW (year); + date_time->month = CW (month); + date_time->day = CW (day); retval = longDateFound; } else @@ -498,7 +497,7 @@ P7 (PUBLIC pascal trap, StyledLineBreakCode, StyledLineBreak, int width = 0; /* ### are we losing information here? */ - text_width = Fix2Long (BigEndianValue (*text_width_fp)); + text_width = Fix2Long (CL (*text_width_fp)); for (current_index = text_start, current_char = text[current_index]; current_index < text_end; @@ -507,7 +506,7 @@ P7 (PUBLIC pascal trap, StyledLineBreakCode, StyledLineBreak, /* ### do we do this? */ if (current_char == '\r') { - *text_offset = BigEndianValue (current_index + 1); + *text_offset = CL (current_index + 1); return smBreakWord; } @@ -529,23 +528,23 @@ P7 (PUBLIC pascal trap, StyledLineBreakCode, StyledLineBreak, if (*text_offset) { /* beginning of the line, break here */ - *text_offset = BigEndianValue (current_index - 1); + *text_offset = CL (current_index - 1); return smBreakChar; } - *text_offset = BigEndianValue (current_index - 1); + *text_offset = CL (current_index - 1); return smBreakWord; } else { - *text_offset = BigEndianValue (last_word_break); + *text_offset = CL (last_word_break); return smBreakWord; } } } /* if we got here, that means the run did not extend past the end of the current line */ - *text_width_fp = BigEndianValue (Long2Fix (text_width - width)); - *text_offset = BigEndianValue (current_index); + *text_width_fp = CL (Long2Fix (text_width - width)); + *text_offset = CL (current_index); return smBreakOverflow; } @@ -681,17 +680,17 @@ P2 (PUBLIC pascal trap, void, LongDate2Secs, LongDateRec *, ldatep, LONGINT high, low; INTEGER hour; - hour = BigEndianValue (ldatep->hour); + hour = CW (ldatep->hour); if (ldatep->pm && hour < 12) hour += 12; - secs = ROMlib_long_long_secs (BigEndianValue (ldatep->year), BigEndianValue (ldatep->month), - BigEndianValue (ldatep->day), hour, - BigEndianValue (ldatep->minute), BigEndianValue (ldatep->second)); + secs = ROMlib_long_long_secs (CW (ldatep->year), CW (ldatep->month), + CW (ldatep->day), hour, + CW (ldatep->minute), CW (ldatep->second)); high = secs >> 32; low = secs; - secs_outp[0] = BigEndianValue (high); - secs_outp[1] = BigEndianValue (low); + secs_outp[0] = CL (high); + secs_outp[1] = CL (low); } P2 (PUBLIC pascal trap, void, LongSecs2Date, ULONGINT *, secs_inp, @@ -701,14 +700,14 @@ P2 (PUBLIC pascal trap, void, LongSecs2Date, ULONGINT *, secs_inp, long long secs; INTEGER pm; - secs = ((long long) BigEndianValue (secs_inp[0]) << 32) | BigEndianValue (secs_inp[1]); + secs = ((long long) CL (secs_inp[0]) << 32) | CL (secs_inp[1]); date_to_swapped_fields (secs, &ldatep->year, &ldatep->month, &ldatep->day, &ldatep->hour, &ldatep->minute, &ldatep->second, &ldatep->dayOfWeek, &ldatep->dayOfYear, &ldatep->weekOfYear); - pm = (BigEndianValue (ldatep->hour) > 12) ? 1 : 0; - ldatep->pm = BigEndianValue (pm); + pm = (CW (ldatep->hour) > 12) ? 1 : 0; + ldatep->pm = CW (pm); } /* @@ -767,7 +766,7 @@ GetFormatOrder A0(PUBLIC, INTEGER, GetAppFont) { - return BigEndianValue (ApFontID); + return CW (ApFontID); } #if 0 @@ -841,10 +840,10 @@ P6(PUBLIC pascal trap, void, DrawJustified, Point swapped_denom; warning_unimplemented ("poorly implemented"); - swapped_numer.h = BigEndianValue (numer.h); - swapped_numer.v = BigEndianValue (numer.v); - swapped_denom.h = BigEndianValue (denom.h); - swapped_denom.v = BigEndianValue (denom.v); + swapped_numer.h = CW (numer.h); + swapped_numer.v = CW (numer.v); + swapped_denom.h = CW (denom.h); + swapped_denom.v = CW (denom.v); text_helper (textLength, textPtr, &swapped_numer, &swapped_denom, 0, 0, text_helper_draw); } @@ -880,10 +879,10 @@ P9(PUBLIC pascal trap, INTEGER, PixelToChar, locs = (INTEGER*)alloca( sizeof(INTEGER) * (textLen + 1)); - swapped_numer.h = BigEndianValue (numer.h); - swapped_numer.v = BigEndianValue (numer.v); - swapped_denom.h = BigEndianValue (denom.h); - swapped_denom.v = BigEndianValue (denom.v); + swapped_numer.h = CW (numer.h); + swapped_numer.v = CW (numer.v); + swapped_denom.h = CW (denom.h); + swapped_denom.v = CW (denom.v); int_pix_width = pixelWidth >> 16; @@ -894,19 +893,19 @@ P9(PUBLIC pascal trap, INTEGER, PixelToChar, to account for slop (probably better in the long run). Right now, we do neither. Ick. */ - if (int_pix_width >= BigEndianValue(locs[textLen])) + if (int_pix_width >= CW(locs[textLen])) { retval = textLen; *leadingEdgep = FALSE; - *widthRemainingp = pixelWidth - (BigEndianValue(locs[textLen]) << 16); + *widthRemainingp = pixelWidth - (CW(locs[textLen]) << 16); } else { *widthRemainingp = CLC (-1); - for (i = 0; int_pix_width > BigEndianValue(locs[i]); ++i) + for (i = 0; int_pix_width > CW(locs[i]); ++i) ; if ((i > 0) && - ((int_pix_width - BigEndianValue(locs[i-1])) > (BigEndianValue(locs[i]) - int_pix_width))) + ((int_pix_width - CW(locs[i-1])) > (CW(locs[i]) - int_pix_width))) { retval = i - 1; *leadingEdgep = FALSE; @@ -935,10 +934,10 @@ P8(PUBLIC pascal trap, INTEGER, CharToPixel, warning_unimplemented ("poorly implemented"); - swapped_numer.h = BigEndianValue (numer.h); - swapped_numer.v = BigEndianValue (numer.v); - swapped_denom.h = BigEndianValue (denom.h); - swapped_denom.v = BigEndianValue (denom.v); + swapped_numer.h = CW (numer.h); + swapped_numer.v = CW (numer.v); + swapped_denom.h = CW (denom.h); + swapped_denom.v = CW (denom.v); retval = text_helper (offset, textBuf, &swapped_numer, &swapped_denom, 0, 0, text_helper_measure); retval += (slop / textLen) >> 16; diff --git a/src/segment.cpp b/src/segment.cpp index ad3f8960..1c69d476 100644 --- a/src/segment.cpp +++ b/src/segment.cpp @@ -69,7 +69,6 @@ typedef HIDDEN_finderinfoptr *finderinfohand; } using namespace Executor; -using namespace ByteSwap; PUBLIC int Executor::ROMlib_cacheheuristic = FALSE; @@ -525,7 +524,7 @@ A2(PUBLIC, void, ROMlib_seginit, LONGINT, argc, char **, argv) /* INTERNAL */ if (argv_to_appfile(fullpathname, &app)) { #if 0 - CurApRefNum = BigEndianValue(OpenRFPerm(app.fName, BigEndianValue(app.vRefNum), fsCurPerm)); + CurApRefNum = CW(OpenRFPerm(app.fName, CW(app.vRefNum), fsCurPerm)); #endif CurApName[0] = MIN(app.fName[0], sizeof(CurApName)-1); BlockMove((Ptr) app.fName+1, (Ptr) CurApName+1, (Size) CurApName[0]); @@ -553,7 +552,7 @@ A2(PUBLIC, void, ROMlib_seginit, LONGINT, argc, char **, argv) /* INTERNAL */ ROMlib_startupscreen = FALSE; ROMlib_exit = TRUE; newcount = Hx(fh, count) + 1; - HxX(fh, count) = BigEndianValue(newcount); + HxX(fh, count) = CW(newcount); SetHandleSize((Handle) fh, (char *) &HxX(fh, files)[newcount] - (char *)STARH(fh)); HxX(fh, files)[Hx(fh, count)-1] = app; @@ -561,7 +560,7 @@ A2(PUBLIC, void, ROMlib_seginit, LONGINT, argc, char **, argv) /* INTERNAL */ if (ROMlib_toopen) { if (argv_to_appfile(ROMlib_toopen, &app)) { newcount = Hx(fh, count) + 1; - HxX(fh, count) = BigEndianValue(newcount); + HxX(fh, count) = CW(newcount); SetHandleSize((Handle) fh, (char *) &HxX(fh, files)[newcount] - (char *) STARH(fh)); HxX(fh, files)[Hx(fh, count)-1] = app; @@ -575,7 +574,7 @@ A2(PUBLIC, void, ROMlib_seginit, LONGINT, argc, char **, argv) /* INTERNAL */ ROMlib_startupscreen = FALSE; ROMlib_exit = TRUE; newcount = Hx(fh, count) + 1; - HxX(fh, count) = BigEndianValue(newcount); + HxX(fh, count) = CW(newcount); SetHandleSize((Handle) fh, (char *) &HxX(fh, files)[newcount] - (char *) STARH(fh)); HxX(fh, files)[Hx(fh, count)-1] = app; @@ -607,7 +606,7 @@ A1(PUBLIC, void, ClrAppFiles, INTEGER, index) /* IMII-58 */ if (STARH((finderinfohand)MR(AppParmHandle))->files[index-1].fType) { STARH((finderinfohand)MR(AppParmHandle))->files[index-1].fType = 0; STARH((finderinfohand)MR(AppParmHandle))->count = - BigEndianValue(BigEndianValue(STARH((finderinfohand)MR(AppParmHandle))->count) - 1); + CW(CW(STARH((finderinfohand)MR(AppParmHandle))->count) - 1); } } @@ -654,7 +653,7 @@ PRIVATE BOOLEAN valid_browser( void ) OSErr err; FInfo finfo; - err = GetFInfo(FinderName, BigEndianValue(BootDrive), &finfo); + err = GetFInfo(FinderName, CW(BootDrive), &finfo); return !ROMlib_nobrowser && err == noErr && finfo.fdType == TICKX("APPL"); } @@ -669,7 +668,7 @@ PRIVATE void launch_browser( void ) ? MIN (flag_bpp, vdriver_max_bpp) : vdriver_max_bpp), 0, 0); - Launch(FinderName, BigEndianValue(BootDrive)); + Launch(FinderName, CW(BootDrive)); } P0(PUBLIC pascal trap, void, ExitToShell) @@ -727,7 +726,7 @@ P0(PUBLIC pascal trap, void, ExitToShell) if (QDExist == EXIST_NO) { a5 = (LONGINT) US_TO_SYN68K(&tmpA5); - CurrentA5 = (Ptr) BigEndianValue(a5); + CurrentA5 = (Ptr) CL(a5); InitGraf((Ptr) quickbytes + sizeof(quickbytes) - 4); } InitFonts(); @@ -762,7 +761,7 @@ P0(PUBLIC pascal trap, void, ExitToShell) CurApName[0] = MIN(reply.fName[0], 31); BlockMove((Ptr) reply.fName+1, (Ptr) CurApName+1, (Size) CurApName[0]); - Launch(CurApName, BigEndianValue(reply.vRefNum)); + Launch(CurApName, CW(reply.vRefNum)); } } } @@ -851,7 +850,7 @@ P1(PUBLIC pascal trap, void, LoadSeg, INTEGER volatile, segno) ResLoad = -1; /* CricketDraw III's behaviour suggested this */ newcode = GetResource(TICK("CODE"), segno); HLock(newcode); - taboff = BigEndianValue(((INTEGER *) STARH(newcode))[0]); + taboff = CW(((INTEGER *) STARH(newcode))[0]); if ((uint16) taboff == 0xA89F) /* magic compressed resource signature */ { /* We are totally dead here. We almost certainly can't use @@ -864,16 +863,16 @@ P1(PUBLIC pascal trap, void, LoadSeg, INTEGER volatile, segno) launch_compressed_lt7); C_ExitToShell (); } - savenentries = nentries = BigEndianValue(((INTEGER *) STARH(newcode))[1]); + savenentries = nentries = CW(((INTEGER *) STARH(newcode))[1]); saveptr = ptr = (short *) ((char *) (long) SYN68K_TO_US(a5) + taboff + Cx(CurJTOffset)); while (--nentries >= 0) { if (ptr[1] != CWC(JMPLINSTR)) { - offbytes = BigEndianValue(*ptr); - *ptr++ = BigEndianValue(segno); + offbytes = CW(*ptr); + *ptr++ = CW(segno); *ptr++ = CWC(JMPLINSTR); *(LONGINT *) ptr = - BigEndianValue((LONGINT) (long) ((char *) US_TO_SYN68K(STARH(newcode)) + offbytes + 4)); + CL((LONGINT) (long) ((char *) US_TO_SYN68K(STARH(newcode)) + offbytes + 4)); ptr += 2; } else ptr += 4; @@ -882,7 +881,7 @@ P1(PUBLIC pascal trap, void, LoadSeg, INTEGER volatile, segno) TRUE); } -#define SEGNOOFP(p) (BigEndianValue(((INTEGER *)p)[-1])) +#define SEGNOOFP(p) (CW(((INTEGER *)p)[-1])) namespace Executor { PRIVATE void unpatch(Ptr, Ptr); @@ -897,7 +896,7 @@ A2(PRIVATE, void, unpatch, Ptr, segstart, Ptr, p) firstpc = MR(*(Ptr *)(p + 2)); ip[1] = ip[-1]; /* the segment number */ - ip[-1] = BigEndianValue(firstpc - segstart - 4); + ip[-1] = CW(firstpc - segstart - 4); ip[0] = CWC(MOVESPINSTR); ip[2] = CWC(LOADSEGTRAP); } diff --git a/src/serial.cpp b/src/serial.cpp index ca506f43..84a701af 100644 --- a/src/serial.cpp +++ b/src/serial.cpp @@ -53,7 +53,6 @@ char ROMlib_rcsid_serial[] = #endif using namespace Executor; -using namespace ByteSwap; #if defined (__alpha) || defined (LINUX) #define TERMIO @@ -126,7 +125,7 @@ A1(PUBLIC, void, RAMSDClose, SPortSel, port) /* IMII-250 */ A2(PUBLIC, OSErr, SerReset, INTEGER, rn, INTEGER, config) /* IMII-250 */ { - config = BigEndianValue (config); + config = CW (config); return Control(rn, SERSET, (Ptr) &config); } @@ -138,7 +137,7 @@ A3(PUBLIC, OSErr, SerSetBuf, INTEGER, rn, Ptr, p, INTEGER, len) /* IMII-251 */ sersetbuf_t temp; temp.p = RM (p); - temp.i = BigEndianValue (len); + temp.i = CW (len); return Control(rn, SERSETBUF, (Ptr) &temp); } @@ -236,7 +235,7 @@ A1(PRIVATE, DCtlPtr, otherdctl, ParmBlkPtr, pbp) DCtlHandle h; h = 0; - switch (BigEndianValue(pbp->cntrlParam.ioCRefNum)) { + switch (CW(pbp->cntrlParam.ioCRefNum)) { case AINREFNUM: h = GetDCtlEntry(AOUTREFNUM); break; @@ -265,7 +264,7 @@ PRIVATE char *specialname(ParmBlkPtr pbp, const char **lockfilep, { char *retval; - switch (BigEndianValue(pbp->cntrlParam.ioCRefNum)) { + switch (CW(pbp->cntrlParam.ioCRefNum)) { case AINREFNUM: case AOUTREFNUM: #if defined (NEXTSTEP) @@ -311,9 +310,9 @@ void callcomp(ParmBlkPtr pbp, compfuncp comp, OSErr err) } #define DOCOMPLETION(pbp, err) \ - (pbp)->ioParam.ioResult = BigEndianValue(err); \ + (pbp)->ioParam.ioResult = CW(err); \ if (((pbp)->ioParam.ioTrap & asyncTrpBit) && (pbp)->ioParam.ioCompletion) \ - callcomp(pbp, (compfuncp) BigEndianValue((long)(pbp)->ioParam.ioCompletion), err); \ + callcomp(pbp, (compfuncp) CL((long)(pbp)->ioParam.ioCompletion), err); \ return err #else @@ -321,7 +320,7 @@ void callcomp(ParmBlkPtr pbp, compfuncp comp, OSErr err) #warning BINCOMPAT not defined #define DOCOMPLETION(pbp, err) \ - (pbp)->ioParam.ioResult = BigEndianValue(err); \ + (pbp)->ioParam.ioResult = CW(err); \ if ((pbp)->ioParam.ioTrap & asyncTrpBit) \ (*(compfuncp) (pbp)->ioParam.ioCompletion)(); \ return err @@ -403,14 +402,14 @@ A2(PUBLIC, OSErr, ROMlib_serialopen, ParmBlkPtr, pbp, /* INTERNAL */ err = ROMlib_maperrno(); #endif #else - HxX(h, fd) = (BigEndianValue(pbp->cntrlParam.ioCRefNum) == AINREFNUM || - BigEndianValue(pbp->cntrlParam.ioCRefNum) == AOUTREFNUM) ? 0 : 1; + HxX(h, fd) = (CW(pbp->cntrlParam.ioCRefNum) == AINREFNUM || + CW(pbp->cntrlParam.ioCRefNum) == AOUTREFNUM) ? 0 : 1; #endif dcp->dCtlFlags |= CWC(OPENBIT); - SerReset(BigEndianValue(pbp->cntrlParam.ioCRefNum), - (BigEndianValue(pbp->cntrlParam.ioCRefNum) == AINREFNUM || - BigEndianValue(pbp->cntrlParam.ioCRefNum) == AOUTREFNUM) ? - BigEndianValue(SPPortA) : BigEndianValue(SPPortB)); + SerReset(CW(pbp->cntrlParam.ioCRefNum), + (CW(pbp->cntrlParam.ioCRefNum) == AINREFNUM || + CW(pbp->cntrlParam.ioCRefNum) == AOUTREFNUM) ? + CW(SPPortA) : CW(SPPortB)); #if defined (LINUX) || defined (MACOSX_) } #endif @@ -432,42 +431,42 @@ A2(PUBLIC, OSErr, ROMlib_serialprime, ParmBlkPtr, pbp, /* INTERNAL */ size_t req_count; buf = (char *) MR (pbp->ioParam.ioBuffer); - req_count = BigEndianValue (pbp->ioParam.ioReqCount); + req_count = CL (pbp->ioParam.ioReqCount); err = noErr; if (!(dcp->dCtlFlags & CWC(OPENBIT))) err = notOpenErr; else { #if defined(SERIALDEBUG) - warning_trace_info ("serial prime code %d", (LONGINT) (BigEndianValue(pbp->ioParam.ioTrap) & 0xFF)); + warning_trace_info ("serial prime code %d", (LONGINT) (CW(pbp->ioParam.ioTrap) & 0xFF)); #endif h = (hiddenh) MR(dcp->dCtlStorage); - switch (BigEndianValue(pbp->ioParam.ioTrap) & 0xFF) { + switch (CW(pbp->ioParam.ioTrap) & 0xFF) { case aRdCmd: - if (BigEndianValue(pbp->cntrlParam.ioCRefNum) != AINREFNUM && - BigEndianValue(pbp->cntrlParam.ioCRefNum) != BINREFNUM) + if (CW(pbp->cntrlParam.ioCRefNum) != AINREFNUM && + CW(pbp->cntrlParam.ioCRefNum) != BINREFNUM) err = readErr; else { /* this may have to be changed since we aren't looking for parity and framing errors */ #if defined (LINUX) || defined (MACOSX_) - pbp->ioParam.ioActCount = BigEndianValue(read(HxX(h, fd), buf, req_count)); + pbp->ioParam.ioActCount = CL(read(HxX(h, fd), buf, req_count)); #elif defined (MSDOS) || defined (CYGWIN32) - pbp->ioParam.ioActCount = BigEndianValue(serial_bios_read(HxX(h, fd), buf, + pbp->ioParam.ioActCount = CL(serial_bios_read(HxX(h, fd), buf, req_count)); #else #warning not sure what to do here #endif #if defined(SERIALDEBUG) warning_trace_info ("serial prime read %d bytes, first is 0x%0x", - (LONGINT) BigEndianValue(pbp->ioParam.ioActCount), + (LONGINT) CL(pbp->ioParam.ioActCount), (LONGINT) (unsigned char) buf[0]); #endif } break; case aWrCmd: - if (BigEndianValue(pbp->cntrlParam.ioCRefNum) != AOUTREFNUM && - BigEndianValue(pbp->cntrlParam.ioCRefNum) != BOUTREFNUM) + if (CW(pbp->cntrlParam.ioCRefNum) != AOUTREFNUM && + CW(pbp->cntrlParam.ioCRefNum) != BOUTREFNUM) err = writErr; else { #if defined(SERIALDEBUG) @@ -476,10 +475,10 @@ A2(PUBLIC, OSErr, ROMlib_serialprime, ParmBlkPtr, pbp, /* INTERNAL */ (LONGINT) (unsigned char) buf[0]); #endif #if defined (LINUX) || defined (MACOSX_) - pbp->ioParam.ioActCount = BigEndianValue(write(HxX(h, fd), + pbp->ioParam.ioActCount = CL(write(HxX(h, fd), buf, req_count)); #elif defined (MSDOS) || defined (CYGWIN32) - pbp->ioParam.ioActCount = BigEndianValue( serial_bios_write(HxX(h, fd), + pbp->ioParam.ioActCount = CL( serial_bios_write(HxX(h, fd), buf, req_count)); #else #warning not sure what to do here @@ -872,16 +871,16 @@ A2(PUBLIC, OSErr, ROMlib_serialctl, ParmBlkPtr, pbp, /* INTERNAL */ else { #if defined(SERIALDEBUG) warning_trace_info ("serial control code = %d, param0 = 0x%x", - (LONGINT) BigEndianValue(pbp->cntrlParam.csCode), - (LONGINT) (unsigned short) BigEndianValue(pbp->cntrlParam.csParam[0])); + (LONGINT) CW(pbp->cntrlParam.csCode), + (LONGINT) (unsigned short) CW(pbp->cntrlParam.csParam[0])); #endif h = (hiddenh) MR(dcp->dCtlStorage); - switch (BigEndianValue(pbp->cntrlParam.csCode)) { + switch (CW(pbp->cntrlParam.csCode)) { case SERKILLIO: err = noErr; /* All I/O done synchronously */ break; case SERSET: - err = serset(HxX(h, fd), BigEndianValue(pbp->cntrlParam.csParam[0])); + err = serset(HxX(h, fd), CW(pbp->cntrlParam.csParam[0])); break; case SERSETBUF: err = noErr; /* ignored */ @@ -897,7 +896,7 @@ A2(PUBLIC, OSErr, ROMlib_serialctl, ParmBlkPtr, pbp, /* INTERNAL */ err = ctlbrk(HxX(h, fd), SER_STOP); break; case SERBAUDRATE: - err = setbaud(HxX(h, fd), BigEndianValue(pbp->cntrlParam.csParam[0])); + err = setbaud(HxX(h, fd), CW(pbp->cntrlParam.csParam[0])); break; case SERMISC: #if defined (MSDOS) || defined (CYGWIN32) @@ -971,10 +970,10 @@ A2(PUBLIC, OSErr, ROMlib_serialstatus, ParmBlkPtr, pbp, /* INTERNAL */ err = notOpenErr; else { #if defined(SERIALDEBUG) - warning_trace_info ("serial status csCode = %d", (LONGINT) BigEndianValue(pbp->cntrlParam.csCode)); + warning_trace_info ("serial status csCode = %d", (LONGINT) CW(pbp->cntrlParam.csCode)); #endif h = (hiddenh) MR(dcp->dCtlStorage); - switch (BigEndianValue(pbp->cntrlParam.csCode)) { + switch (CW(pbp->cntrlParam.csCode)) { case SERGETBUF: #if defined (LINUX) || defined (MACOSX_) if (ioctl(HxX(h, fd), FIONREAD, &n) < 0) @@ -986,7 +985,7 @@ A2(PUBLIC, OSErr, ROMlib_serialstatus, ParmBlkPtr, pbp, /* INTERNAL */ #if defined(SERIALDEBUG) warning_trace_info ("serial status getbuf = %d", (LONGINT) n); #endif - *(LONGINT *) pbp->cntrlParam.csParam = BigEndianValue(n); + *(LONGINT *) pbp->cntrlParam.csParam = CL(n); err = noErr; } break; diff --git a/src/sound.cpp b/src/sound.cpp index 67b43bf2..d626b460 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -20,7 +20,6 @@ char ROMlib_rcsid_sound[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; /* TRUE when we want to pretend this host has no sound support. */ bool Executor::sound_disabled_p; @@ -59,9 +58,9 @@ PUBLIC int Executor::ROMlib_PretendSound = soundpretend; static inline bool qfull_p (SndChannelPtr chanp) { - return ((BigEndianValue (chanp->qTail) == BigEndianValue (chanp->qHead) - 1 || + return ((CW (chanp->qTail) == CW (chanp->qHead) - 1 || (chanp->qHead == CWC (0) - && BigEndianValue (chanp->qTail) == BigEndianValue (chanp->qLength) - 1))); + && CW (chanp->qTail) == CW (chanp->qLength) - 1))); } static inline bool @@ -74,7 +73,7 @@ qempty_p (SndChannelPtr chanp) * get 2.0 out the door. */ return (chanp->qHead == chanp->qTail - || BigEndianValue (chanp->qLength) <= 0); + || CW (chanp->qLength) <= 0); } static inline void @@ -82,9 +81,9 @@ enq (SndChannelPtr chanp, SndCommand cmd) { unsigned tail; - tail = BigEndianValue (chanp->qTail); + tail = CW (chanp->qTail); chanp->queue[tail] = cmd; - chanp->qTail = BigEndianValue ((INTEGER)((tail + 1) % BigEndianValue (chanp->qLength))); + chanp->qTail = CW ((tail + 1) % CW (chanp->qLength)); } static inline SndCommand @@ -93,9 +92,9 @@ deq (SndChannelPtr chanp) SndCommand ret; unsigned head; - head = BigEndianValue (chanp->qHead); + head = CW (chanp->qHead); ret = chanp->queue[head]; - chanp->qHead = BigEndianValue ((INTEGER)((head + 1) % BigEndianValue (chanp->qLength))); + chanp->qHead = CW ((head + 1) % CW (chanp->qLength)); return ret; } @@ -276,12 +275,12 @@ PUBLIC int Executor::ROMlib_get_snd_cmds (Handle sndh, SndCommand **cmdsp) int retval; p = STARH (sndh); - format = BigEndianValue (*(INTEGER *)p); + format = CW (*(INTEGER *)p); switch (format) { case 1: p += 2; - num_formats = BigEndianValue (*(INTEGER *)p); + num_formats = CW (*(INTEGER *)p); switch (num_formats) { case 0: @@ -309,7 +308,7 @@ PUBLIC int Executor::ROMlib_get_snd_cmds (Handle sndh, SndCommand **cmdsp) /* Now p points to "Number of sound commands" field of resource */ - retval = BigEndianValue (*(INTEGER *)p); + retval = CW (*(INTEGER *)p); *cmdsp = (SndCommand *)(p+2); return retval; @@ -330,12 +329,12 @@ P3(PUBLIC, pascal trap OSErr, SndPlay, SndChannelPtr, chanp, Handle, sndh, resp = NULL; if (resp) - format = BigEndianValue (*(INTEGER *)resp); + format = CW (*(INTEGER *)resp); else format = 0; warning_sound_log ("chanp %p fmt %d num_fmts %d async %d", - chanp, format, resp ? BigEndianValue (*((INTEGER *)(resp+2))) : 0, + chanp, format, resp ? CW (*((INTEGER *)(resp+2))) : 0, async); warning_sound_log (" sndh %s", (HGetState(sndh) & LOCKBIT) @@ -375,7 +374,7 @@ P3(PUBLIC, pascal trap OSErr, SndPlay, SndChannelPtr, chanp, Handle, sndh, offset */ if (cmd.cmd & CWC (0x8000)) { - cmd.param2 = (LONGINT) RM ((resp + BigEndianValue (cmd.param2))); + cmd.param2 = (LONGINT) RM ((resp + CL (cmd.param2))); cmd.cmd &= CWC (~0x8000); } @@ -452,6 +451,11 @@ P4(PUBLIC pascal trap, OSErr, SndNewChannel, HIDDEN_SndChannelPtr *, chanpp, P4(PUBLIC, pascal trap OSErr, SndAddModifier, SndChannelPtr, chanp, ProcPtr, mod, INTEGER, id, LONGINT, init) { +#if defined(OLD_BROKEN_NEXTSTEP_SOUND) + Handle h; + SndCommand cmd; + ModifierStubPtr modp; +#endif /* defined(OLD_BROKEN_NEXTSTEP_SOUND) */ OSErr retval; warning_sound_log ("chanp %p", chanp); @@ -464,10 +468,53 @@ P4(PUBLIC, pascal trap OSErr, SndAddModifier, SndChannelPtr, chanp, case soundpretend: retval = noErr; break; +#if defined(OLD_BROKEN_NEXTSTEP_SOUND) + case soundon: + if ((unsigned short) chanp->qLength != (unsigned short) CWC(stdQLength)) + retval = badChannel; + else { + modp = (ModifierStubPtr) NewPtr(sizeof(ModifierStub)); + modp->nextStub = chanp->firstMod; + chanp->firstMod = CL(modp); + modp->flags = 0; + if (mod) { + modp->code = CL(mod); + modp->hState = 0; + } else { + h = GetResource(TICK("snth"), id); + if (STARH(h) != (Ptr) P_snth5) { /* ACK; phone handle stuff */ + LoadResource(h); + modp->flags = MOD_SYNTH_FLAG; + modp->hState = HGetState(h); + HLock(h); + } + modp->code = (ProcPtr) h->p; + } + modp->userInfo = 0; + modp->count = 0; + modp->every = 0; + if (modp->code) { + cmd.cmd = CWC(initCmd); + cmd.param1 = CWC(0); + cmd.param2 = CL(init); + retval = SndDoImmediate(chanp, &cmd); + } else + retval = resProblem; + } + break; +#endif } return retval; } +#if defined(OLD_BROKEN_NEXTSTEP_SOUND) +static void dumpcmd(SndCommand *cmdp) +{ + printf("#%x,1-%x,2-%x.", (LONGINT) CW(cmdp->cmd), (LONGINT) CW(cmdp->param1), (LONGINT) CL(cmdp->param2)); +} +#endif + + typedef pascal BOOLEAN (*snthfp)(SndChannelPtr, SndCommand *, ModifierStubPtr); BOOLEAN callasynth(SndChannelPtr chanp, SndCommand *cmdp, ModifierStubPtr mp) @@ -479,6 +526,29 @@ BOOLEAN callasynth(SndChannelPtr chanp, SndCommand *cmdp, ModifierStubPtr mp) return CToPascalCall((void*)MR(mp->code), CTOP_SectRect, chanp, cmdp, mp); } +#if defined(OLD_BROKEN_NEXTSTEP_SOUND) +PRIVATE void recsndcmd(SndChannelPtr chanp, SndCommand *cmdp, + ModifierStubPtr mp) +{ + INTEGER i; + BOOLEAN doanother; + + if (mp) { + i = 0; + do { + doanother = callasynth(chanp, cmdp, mp); + recsndcmd(chanp, cmdp, MR(mp->nextStub)); + if (doanother) { + cmdp->cmd = CWC(requestNextCmd); + cmdp->param1 = CW(++i); + cmdp->param2 = 0; + } + } while (doanother); + } +} +#endif /* defined(OLD_BROKEN_NEXTSTEP_SOUND) */ + + static inline boolean_t earlier_p (snd_time t1, snd_time t2) { @@ -496,7 +566,7 @@ earlier (snd_time t1, snd_time t2) static inline unsigned int snd_duration (SoundHeaderPtr hp) { - return BigEndianValue (hp->length); + return CL (hp->length); } #define CMD_DONE(c) (SND_CHAN_FLAGS_X (c) &= CWC (~CHAN_CMDINPROG_FLAG)) @@ -534,8 +604,8 @@ do_current_command (SndChannelPtr chanp, struct hunger_info info) warning_sound_log ("bufferCmd dur %d", (int) duration); - if (resample (sp, info.buf, BigEndianValue (hp->length), - info.bufsize, BigEndianValue (hp->sampleRate), + if (resample (sp, info.buf, CL (hp->length), + info.bufsize, CL (hp->sampleRate), SND_RATE << 16, &SND_CHAN_CURRENT_START (chanp), &SND_CHAN_PREV_SAMP (chanp), @@ -594,11 +664,11 @@ do_current_db (SndChannelPtr chanp, struct hunger_info info) f2d (SND_CHAN_CURRENT_START (chanp)), (int) SND_CHAN_TIME (chanp), (int) info.t3, - BigEndianValue (dbp->dbNumFrames), - BigEndianValue (dbhp->dbhSampleRate) / (double) (1 << 16)); + CL (dbp->dbNumFrames), + CL (dbhp->dbhSampleRate) / (double) (1 << 16)); #endif - if (resample (sp, info.buf, BigEndianValue (dbp->dbNumFrames), - info.bufsize, BigEndianValue (dbhp->dbhSampleRate), + if (resample (sp, info.buf, CL (dbp->dbNumFrames), + info.bufsize, CL (dbhp->dbhSampleRate), SND_RATE << 16, &SND_CHAN_CURRENT_START (chanp), &SND_CHAN_PREV_SAMP (chanp), @@ -617,13 +687,13 @@ do_current_db (SndChannelPtr chanp, struct hunger_info info) } #if 0 warning_sound_log ("dblback %p ch %p bp %p", - BigEndianValue (dbhp->dbhDoubleBack), + CL (dbhp->dbhDoubleBack), chanp, dbp); warning_sound_log (" frs %d flgs %d ui1 %x ui2 %x", - BigEndianValue (dbp->dbNumFrames), - BigEndianValue (dbp->dbFlags), - BigEndianValue (dbp->dbUserInfo[0]), - BigEndianValue (dbp->dbUserInfo[1])); + CL (dbp->dbNumFrames), + CL (dbp->dbFlags), + CL (dbp->dbUserInfo[0]), + CL (dbp->dbUserInfo[1])); #endif CToPascalCall ((void*)MR (dbhp->dbhDoubleBack), CTOP_SetCTitle, chanp, dbp); @@ -741,8 +811,8 @@ P3(PUBLIC, pascal trap OSErr, SndDoCommand, SndChannelPtr, chanp, warning_sound_log ("cmdp = NULL"); else warning_sound_log - ("cmd %d param1 0x%x param2 0x%x nowait %d", BigEndianValue (cmdp->cmd), - BigEndianValue (cmdp->param1), BigEndianValue (cmdp->param2), CW (nowait)); + ("cmd %d param1 0x%x param2 0x%x nowait %d", CW (cmdp->cmd), + CW (cmdp->param1), CL (cmdp->param2), CW (nowait)); #endif #if ERROR_SUPPORTED_P (ERROR_SOUND_LOG) @@ -756,7 +826,7 @@ P3(PUBLIC, pascal trap OSErr, SndDoCommand, SndChannelPtr, chanp, else warning_sound_log (" len %d rate 0x%x encode %d freq %d", - BigEndianValue (hp->length), BigEndianValue (hp->sampleRate), hp->encode, + CL (hp->length), CL (hp->sampleRate), hp->encode, hp->baseFrequency); } #endif @@ -823,7 +893,7 @@ P2 (PUBLIC, pascal trap OSErr, SndDoImmediate, SndChannelPtr, chanp, #endif { cmd = *cmdp; - switch (BigEndianValue (cmd.cmd)) + switch (CW (cmd.cmd)) { case flushCmd: warning_sound_log ("flushCmd"); @@ -854,7 +924,7 @@ P2 (PUBLIC, pascal trap OSErr, SndDoImmediate, SndChannelPtr, chanp, break; default: - warning_sound_log ("UNKNOWN CMD %d", BigEndianValue (cmd.cmd)); + warning_sound_log ("UNKNOWN CMD %d", CW (cmd.cmd)); retval = noErr; } } @@ -983,13 +1053,13 @@ P2(PUBLIC, pascal trap OSErr, SndDisposeChannel, SndChannelPtr, chanp, block = block_virtual_ints (); } restore_virtual_ints (block); - nextmp = BigEndianValue(chanp->firstMod); + nextmp = CL(chanp->firstMod); while ((mp = nextmp)) { - nextmp = BigEndianValue(mp->nextStub); + nextmp = CL(mp->nextStub); cmd.cmd = CWC(freeCmd); callasynth(chanp, &cmd, mp); if (mp->flags & MOD_SYNTH_FLAG) { - h = RecoverHandle((Ptr) BigEndianValue(mp->code)); + h = RecoverHandle((Ptr) CL(mp->code)); HSetState(h, mp->hState); } DisposPtr((Ptr) mp); @@ -1018,3 +1088,26 @@ P2(PUBLIC, pascal trap OSErr, SndDisposeChannel, SndChannelPtr, chanp, } return retval; } + +#if defined(OLD_BROKEN_NEXTSTEP_SOUND) +void ROMlib_soundcomplete( void *vp ) +{ + SndChannelPtr chanp; + virtual_int_state_t block; + + chanp = vp; + block = block_virtual_ints (); + if (chanp->flags & CWC(CHAN_IMMEDIATE_FLAG)) + chanp->flags &= CWC(~CHAN_IMMEDIATE_FLAG); + else { + chanp->qHead = CW(CW(chanp->qHead) + 1); + if ((unsigned short) chanp->qHead == (unsigned short) CWC(stdQLength)) + chanp->qHead = CWC(0); + if (chanp->qHead == chanp->qTail) + chanp->flags &= CWC(~CHAN_BUSY_FLAG); + else + recsndcmd(chanp, &chanp->queue[CW(chanp->qHead)], CL(chanp->firstMod)); + } + restore_virtual_ints (block); +} +#endif diff --git a/src/soundIMVI.cpp b/src/soundIMVI.cpp index 9b6485c6..03cd2ece 100644 --- a/src/soundIMVI.cpp +++ b/src/soundIMVI.cpp @@ -23,7 +23,6 @@ char ROMlib_rcsid_soundIMVI[] = #include "rsys/soundopts.h" using namespace Executor; -using namespace ByteSwap; P1(PUBLIC, pascal trap void, SndGetSysBeepState, INTEGER *, statep) { @@ -171,8 +170,8 @@ start_playing (SndChannelPtr chanp, SndDoubleBufferHeaderPtr paramp, task_inserted = TRUE; } duration_in_mills = (((long long) 1000 * (1 << 16) - * BigEndianValue (dbp->dbNumFrames)) - / BigEndianValue (paramp->dbhSampleRate)); + * CL (dbp->dbNumFrames)) + / CL (paramp->dbhSampleRate)); PrimeTime ((QElemPtr) &call_back_info.task, duration_in_mills); } else @@ -199,7 +198,7 @@ A0 (PUBLIC, void, C_sound_timer_handler) start_playing (call_back_info.chanp, call_back_info.headp, current_buffer ^ 1); dbp->dbFlags &= CLC (~dbBufferReady); - CToPascalCall (&pp, CTOP_SetCTitle, call_back_info.chanp, dbp); + CToPascalCall((void*)pp, CTOP_SetCTitle, call_back_info.chanp, dbp); } } @@ -223,10 +222,10 @@ P2(PUBLIC, pascal trap OSErr, SndPlayDoubleBuffer, SndChannelPtr, chanp, warning_sound_log ("paramp = NULL"); else warning_sound_log ("nc %d sz %d c %d p %d", - BigEndianValue (paramp->dbhNumChannels), - BigEndianValue (paramp->dbhSampleSize), - BigEndianValue (paramp->dbhCompressionID), - BigEndianValue (paramp->dbhPacketSize)); + CW (paramp->dbhNumChannels), + CW (paramp->dbhSampleSize), + CW (paramp->dbhCompressionID), + CW (paramp->dbhPacketSize)); SND_CHAN_DBHP (chanp) = paramp; SND_CHAN_CURRENT_DB (chanp) = 0; /* diff --git a/src/soundfake.cpp b/src/soundfake.cpp index 6ecef749..0df1d8eb 100644 --- a/src/soundfake.cpp +++ b/src/soundfake.cpp @@ -14,7 +14,6 @@ char ROMlib_rcsid_soundfake[] = #include "TimeMgr.h" using namespace Executor; -using namespace ByteSwap; /* This driver "goes through the motions" of playing a sound without * actually interacting with any sound hardware. The intent is to @@ -68,7 +67,7 @@ void SoundFake::NoteSoundInterrupt(void) /* Installs a time manager task to call back at the requested time. */ void SoundFake::set_up_tm_task(void) { - fake_sound_tm_task.tmAddr = (ProcPtr) BigEndianValue ((uint32) fake_sound_callback); + fake_sound_tm_task.tmAddr = (ProcPtr) CL ((uint32) fake_sound_callback); InsTime ((QElemPtr) &fake_sound_tm_task); PrimeTime ((QElemPtr) &fake_sound_tm_task, MSECS_FOR_BUFFER_TO_PLAY); } diff --git a/src/splash.cpp b/src/splash.cpp index be3da0b6..2af4178e 100644 --- a/src/splash.cpp +++ b/src/splash.cpp @@ -47,11 +47,11 @@ splash_screen_display (boolean_t button_p, char *basename) header = *(struct splash_screen_header *) ROMlib_splashp->chars; - bpp = BigEndianValue (header.bpp); - log2_bpp = BigEndianValue (header.log2_bpp); + bpp = CL (header.bpp); + log2_bpp = CL (header.log2_bpp); - memcpy (color_buf, ROMlib_splashp->chars + BigEndianValue (header.color_offset), - BigEndianValue (header.color_count) * sizeof *color_buf); + memcpy (color_buf, ROMlib_splashp->chars + CL (header.color_offset), + CL (header.color_count) * sizeof *color_buf); bg_pixel = ((bpp == vdriver_bpp) ? header.bg_pixel @@ -71,7 +71,7 @@ splash_screen_display (boolean_t button_p, char *basename) } if (vdriver_bpp == bpp) - vdriver_set_colors (0, BigEndianValue (header.color_count), (ColorSpec *) color_buf); + vdriver_set_colors (0, CL (header.color_count), (ColorSpec *) color_buf); splash_top = (vdriver_height - SPLASH_SCREEN_HEIGHT) / 2; splash_left = (vdriver_width - SPLASH_SCREEN_WIDTH) / 2; @@ -90,14 +90,14 @@ splash_screen_display (boolean_t button_p, char *basename) #define ROWS_PER_PASS 32 - p = (char *) ROMlib_splashp->chars + BigEndianValue (header.splash_bits_offset); + p = (char *) ROMlib_splashp->chars + CL (header.splash_bits_offset); splash_row_bytes = SPLASH_SCREEN_WIDTH >> (3 - log2_bpp); tmp_buf = alloca (vdriver_row_bytes * ROWS_PER_PASS); /* Set up phony bitmap for screen. */ screen_bitmap.baseAddr = (Ptr) RM (vdriver_fbuf); - screen_bitmap.rowBytes = BigEndianValue (vdriver_row_bytes); + screen_bitmap.rowBytes = CW (vdriver_row_bytes); SetRect (&screen_bitmap.bounds, 0, 0, vdriver_width, ROWS_PER_PASS); src_origin.h = src_origin.v = CWC (0); @@ -117,7 +117,7 @@ splash_screen_display (boolean_t button_p, char *basename) { /* Set up phony bitmap to clear screen. */ blank_bitmap.baseAddr = (Ptr) RM (tmp_buf); - blank_bitmap.rowBytes = BigEndianValue (vdriver_row_bytes); + blank_bitmap.rowBytes = CW (vdriver_row_bytes); SetRect (&blank_bitmap.bounds, 0, 0, vdriver_width, ROWS_PER_PASS); memset (tmp_buf, bg_pixel, vdriver_row_bytes * ROWS_PER_PASS); @@ -126,7 +126,7 @@ splash_screen_display (boolean_t button_p, char *basename) int num_rows; num_rows = MIN (ROWS_PER_PASS, vdriver_height - i); - (RGN_BBOX (row_rgn)).bottom = BigEndianValue (num_rows); + (RGN_BBOX (row_rgn)).bottom = CW (num_rows); srcblt_rgn (row_rgn, srcCopy, vdriver_log2_bpp, &blank_bitmap, &screen_bitmap, &src_origin, &dst_origin, ~0, 0); @@ -144,13 +144,13 @@ splash_screen_display (boolean_t button_p, char *basename) /* Set up phony bitmap for src row. */ src_row_bitmap.baseAddr = (Ptr) RM (tmp_buf); - src_row_bitmap.rowBytes = BigEndianValue (SPLASH_SCREEN_WIDTH + src_row_bitmap.rowBytes = CW (SPLASH_SCREEN_WIDTH >> (3 - vdriver_log2_bpp)); SetRect (&src_row_bitmap.bounds, 0, 0, SPLASH_SCREEN_WIDTH, ROWS_PER_PASS); RGN_BBOX (row_rgn) = src_row_bitmap.bounds; SWAPPED_OPW (screen_bitmap.bounds.left, -, splash_left); - screen_bitmap.bounds.top = BigEndianValue (-splash_top); + screen_bitmap.bounds.top = CW (-splash_top); screen_bitmap.baseAddr = (Ptr) RM (vdriver_fbuf); /* Actually read and display the splash screen bits. */ @@ -159,7 +159,7 @@ splash_screen_display (boolean_t button_p, char *basename) int num_rows; num_rows = MIN (ROWS_PER_PASS, SPLASH_SCREEN_HEIGHT - i); - (RGN_BBOX (row_rgn)).bottom = BigEndianValue (num_rows); + (RGN_BBOX (row_rgn)).bottom = CW (num_rows); memcpy (tmp_buf, p, splash_row_bytes * num_rows); p += splash_row_bytes * num_rows; diff --git a/src/srcblt.cpp b/src/srcblt.cpp index 24a03726..d59beda1 100644 --- a/src/srcblt.cpp +++ b/src/srcblt.cpp @@ -18,7 +18,6 @@ char ROMlib_rcsid_srcblt[] = #warning This seems unsafe... using namespace Executor; -using namespace ByteSwap; int srcblt_log2_bpp asm ("_srcblt_log2_bpp"); @@ -111,7 +110,7 @@ srcblt_rgn (RgnHandle rh, int mode, int log2_bpp, } else { - srcblt_src_row_bytes = BigEndianValue (src->rowBytes) & ROWBYTES_VALUE_BITS; + srcblt_src_row_bytes = CW (src->rowBytes) & ROWBYTES_VALUE_BITS; src_baseaddr = (char *) MR (src->baseAddr); #if defined (VGA_SCREEN_NEEDS_FAR_PTR) asm ("movw %%ds,%0" : "=m" (srcblt_src_selector)); @@ -124,20 +123,20 @@ srcblt_rgn (RgnHandle rh, int mode, int log2_bpp, #if defined (VGA_SCREEN_NEEDS_FAR_PTR) srcblt_dst_selector = vga_screen_selector; #endif - top = BigEndianValue (dst->bounds.top); - left = BigEndianValue (dst->bounds.left); + top = CW (dst->bounds.top); + left = CW (dst->bounds.left); /* Hide the cursor if necessary. */ old_vis_p |= (host_hide_cursor_if_intersects - (BigEndianValue (rp->rgnBBox.top) - top, - BigEndianValue (rp->rgnBBox.left) - left, - BigEndianValue (rp->rgnBBox.bottom) - top, - BigEndianValue (rp->rgnBBox.right) - left)); + (CW (rp->rgnBBox.top) - top, + CW (rp->rgnBBox.left) - left, + CW (rp->rgnBBox.bottom) - top, + CW (rp->rgnBBox.right) - left)); cursor_maybe_changed_p = TRUE; } else { - srcblt_dst_row_bytes = BigEndianValue (dst->rowBytes) & ROWBYTES_VALUE_BITS; + srcblt_dst_row_bytes = CW (dst->rowBytes) & ROWBYTES_VALUE_BITS; dst_baseaddr = (char *) MR (dst->baseAddr); #if defined (VGA_SCREEN_NEEDS_FAR_PTR) asm ("movw %%ds,%0" : "=m" (srcblt_dst_selector)); @@ -148,8 +147,8 @@ srcblt_rgn (RgnHandle rh, int mode, int log2_bpp, #endif /* VDRIVER_SUPPORTS_REAL_SCREEN_BLITS */ { /* Default to values for non-screen blit. */ - srcblt_src_row_bytes = BigEndianValue (src->rowBytes) & ROWBYTES_VALUE_BITS; - srcblt_dst_row_bytes = BigEndianValue (dst->rowBytes) & ROWBYTES_VALUE_BITS; + srcblt_src_row_bytes = CW (src->rowBytes) & ROWBYTES_VALUE_BITS; + srcblt_dst_row_bytes = CW (dst->rowBytes) & ROWBYTES_VALUE_BITS; src_baseaddr = (char *) MR (src->baseAddr); dst_baseaddr = (char *) MR (dst->baseAddr); #if defined (VGA_SCREEN_NEEDS_FAR_PTR) @@ -160,10 +159,10 @@ srcblt_rgn (RgnHandle rh, int mode, int log2_bpp, } /* Compute the offset to map dst y coords to src bitmap coords.*/ - src_y_offset = (BigEndianValue (src_origin->v) - BigEndianValue (src->bounds.top) - - BigEndianValue (dst_origin->v)); + src_y_offset = (CW (src_origin->v) - CW (src->bounds.top) + - CW (dst_origin->v)); src_baseaddr += src_y_offset * srcblt_src_row_bytes; - dst_baseaddr -= BigEndianValue (dst->bounds.top) * srcblt_dst_row_bytes; + dst_baseaddr -= CW (dst->bounds.top) * srcblt_dst_row_bytes; /* Handle the common case of flipped fg/bk colors and a copy xfer mode. */ if ((mode & 3) == (srcCopy & 3) /* either srcCopy or notSrcCopy */ @@ -174,10 +173,10 @@ srcblt_rgn (RgnHandle rh, int mode, int log2_bpp, srcblt_fg_color = ~0; } - srcblt_x_offset = -(BigEndianValue (dst->bounds.left) << log2_bpp); + srcblt_x_offset = -(CW (dst->bounds.left) << log2_bpp); - src_x_offset = (((BigEndianValue (src_origin->h) - BigEndianValue (src->bounds.left)) - - (BigEndianValue (dst_origin->h) - BigEndianValue (dst->bounds.left))) + src_x_offset = (((CW (src_origin->h) - CW (src->bounds.left)) + - (CW (dst_origin->h) - CW (dst->bounds.left))) << log2_bpp); src_baseaddr += (src_x_offset >> 3); left_shift = src_x_offset & 7; diff --git a/src/stdfile.cpp b/src/stdfile.cpp index 8d7b4a5c..0fef4a62 100644 --- a/src/stdfile.cpp +++ b/src/stdfile.cpp @@ -59,6 +59,7 @@ char ROMlib_rcsid_stdfile[] = #include "rsys/string.h" #include "rsys/dcache.h" #include "rsys/menu.h" +#include "rsys/stdfile.h" #include "rsys/executor.h" @@ -76,7 +77,6 @@ PUBLIC int Executor::nodrivesearch_p = FALSE; #include "rsys/system_error.h" using namespace Executor; -using namespace ByteSwap; typedef pascal BOOLEAN (*filtp)(DialogPtr dp, EventRecord *evp, INTEGER *ith); @@ -200,12 +200,12 @@ A1(PRIVATE, INTEGER, movealert, INTEGER, id) if (!(*h).p) LoadResource(h); rp = (Rect *) STARH(h); - dh = BigEndianValue(rp->right) - BigEndianValue(rp->left); - dv = BigEndianValue(rp->bottom) - BigEndianValue(rp->top); + dh = CW(rp->right) - CW(rp->left); + dv = CW(rp->bottom) - CW(rp->top); rp->left = CWC(150); rp->top = CWC(30); - rp->right = BigEndianValue(150 + dh); - rp->bottom = BigEndianValue(30 + dv); + rp->right = CW(150 + dh); + rp->bottom = CW(30 + dv); return(Alert(id, (ProcPtr)0)); } @@ -227,8 +227,8 @@ A1(PRIVATE, void, drawminiicon, INTEGER, icon) bm.bounds.right = bm.bounds.bottom = CWC(16); r.top = PORT_PEN_LOC (thePort).v; r.left = PORT_PEN_LOC (thePort).h; - r.bottom = BigEndianValue(BigEndianValue(r.top) + 16); - r.right = BigEndianValue(BigEndianValue(r.left) + 16); + r.bottom = CW(CW(r.top) + 16); + r.right = CW(CW(r.left) + 16); CopyBits(&bm, PORT_BITS_FOR_COPY (thePort), &bm.bounds, &r, srcCopy, NULL); HUnlock(h); @@ -252,9 +252,9 @@ A3(PRIVATE, void, drawinboxwithicon, StringPtr, str, Rect *, rp, INTEGER, icon) * ok. */ - MoveTo(BigEndianValue(rp->left) + 2, BigEndianValue(rp->top)); + MoveTo(CW(rp->left) + 2, CW(rp->top)); drawminiicon(icon); - MoveTo(BigEndianValue(rp->left) + 2 + 16 + 3 , BigEndianValue(rp->top) + BigEndianValue(rp->bottom)-1); /* see note above */ + MoveTo(CW(rp->left) + 2 + 16 + 3 , CW(rp->top) + CW(rp->bottom)-1); /* see note above */ r.left = rp->left; r.right = rp->right; r.top = rp->top; @@ -262,14 +262,14 @@ A3(PRIVATE, void, drawinboxwithicon, StringPtr, str, Rect *, rp, INTEGER, icon) ClipRect(&r); strlen = *str; MeasureText(strlen, (Ptr) (str + 1), (Ptr) strwidths); - lengthavail = BigEndianValue(rp->right) - (BigEndianValue(rp->left) + 2 + 16 + 3); - if (BigEndianValue(strwidths[strlen]) > lengthavail) { + lengthavail = CW(rp->right) - (CW(rp->left) + 2 + 16 + 3); + if (CW(strwidths[strlen]) > lengthavail) { width = StringWidth((StringPtr) ellipsis); /* 4 might be the space on the right of the ellipsis. */ /* TODO: figure out exactly what the number is. */ lengthavail -= (width + 4); widp = strwidths; - while (BigEndianValue(*++widp) < lengthavail) + while (CW(*++widp) < lengthavail) DrawChar(*++str); DrawString((StringPtr) ellipsis); } else @@ -288,8 +288,8 @@ A2(PRIVATE, void, safeflflip, fltype *, f, INTEGER, sel) if (sel >= fltop && sel < fltop + f->flnmlin) { r.left = f->flrect.left; r.right = f->flrect.right; - r.top = BigEndianValue(BigEndianValue(f->flrect.top) + (sel - fltop) * f->fllinht); - r.bottom = BigEndianValue(BigEndianValue(r.top) + f->fllinht); + r.top = CW(CW(f->flrect.top) + (sel - fltop) * f->fllinht); + r.bottom = CW(CW(r.top) + f->fllinht); if (EmptyRgn(MR(((WindowPeek)thePort)->updateRgn))) /* stuff to draw? */ InvertRect(&r); /* no: we can flip */ else @@ -309,8 +309,8 @@ A3(PRIVATE, void, flupdate, fltype *, f, INTEGER, st, INTEGER, n) Rect r; fltop = GetCtlValue(f->flsh); - r.top = BigEndianValue(BigEndianValue(f->flrect.top) + (st - fltop) * f->fllinht); - r.bottom = BigEndianValue(f->flascent); + r.top = CW(CW(f->flrect.top) + (st - fltop) * f->fllinht); + r.bottom = CW(f->flascent); r.left = f->flrect.left; r.right = f->flrect.right; @@ -320,16 +320,16 @@ A3(PRIVATE, void, flupdate, fltype *, f, INTEGER, st, INTEGER, n) drawinboxwithicon((StringPtr) (MR(*f->flstrs) + ip->floffs), &r, ip->flicns & ICONMASK); if (ip->flicns & GRAYBIT) { - r.bottom = BigEndianValue(BigEndianValue(r.top) + f->fllinht); + r.bottom = CW(CW(r.top) + f->fllinht); PenMode(notPatBic); PenPat(gray); PaintRect(&r); PenPat(black); PenMode(patCopy); - r.bottom = BigEndianValue(f->flascent); + r.bottom = CW(f->flascent); } ip++; - r.top = BigEndianValue(BigEndianValue(r.top) + (f->fllinht)); + r.top = CW(CW(r.top) + (f->fllinht)); } HUnlock((Handle) f->flstrs); if (sel >= st && sel < st + n) @@ -451,7 +451,7 @@ A2(PRIVATE, StringPtr, getdiskname, BOOLEAN *, ejectablep, pbr.volumeParam.ioNamePtr = RM(&retval[0]); pbr.volumeParam.ioVolIndex = 0; - pbr.volumeParam.ioVRefNum = BigEndianValue(-BigEndianValue(SFSaveDisk)); + pbr.volumeParam.ioVRefNum = CW(-CW(SFSaveDisk)); err = PBGetVInfo(&pbr, FALSE); cachedvrn = SFSaveDisk; if (err == noErr) @@ -487,7 +487,7 @@ A1(PRIVATE, void, drawjobberattop, DialogPeek, dp) GetPenState(&ps); PenNormal(); - if (BigEndianValue(CurDirStore) == 2) { + if (CL(CurDirStore) == 2) { #if 1 /* TODO: ask cliff about a better way to do this */ /* unused = */ getdiskname( &ejectable, NULL ); @@ -500,15 +500,15 @@ A1(PRIVATE, void, drawjobberattop, DialogPeek, dp) flp = WINDFL(dp); rp = &flp->flcurdirrect; savebottom = rp->bottom; - rp->bottom = BigEndianValue(flp->flascent); - rp->left = BigEndianValue(BigEndianValue(rp->left) + (2)); + rp->bottom = CW(flp->flascent); + rp->left = CW(CW(rp->left) + (2)); drawinboxwithicon(flp->flcurdirname, rp, icon); - rp->left = BigEndianValue(BigEndianValue(rp->left) - (2)); + rp->left = CW(CW(rp->left) - (2)); rp->bottom = savebottom; FrameRect(rp); - MoveTo(BigEndianValue(rp->left)+1, BigEndianValue(rp->bottom)); - LineTo(BigEndianValue(rp->right), BigEndianValue(rp->bottom)); - LineTo(BigEndianValue(rp->right), BigEndianValue(rp->top)+1); + MoveTo(CW(rp->left)+1, CW(rp->bottom)); + LineTo(CW(rp->right), CW(rp->bottom)); + LineTo(CW(rp->right), CW(rp->top)+1); SetPenState(&ps); } @@ -520,12 +520,12 @@ A1(PRIVATE, LONGINT, getdirid, StringPtr, fname) hpb.dirInfo.ioCompletion = 0; hpb.dirInfo.ioNamePtr = RM(fname); - hpb.dirInfo.ioVRefNum = BigEndianValue(-BigEndianValue(SFSaveDisk)); + hpb.dirInfo.ioVRefNum = CW(-CW(SFSaveDisk)); hpb.dirInfo.ioFDirIndex = CWC (0); hpb.dirInfo.ioDrDirID = CurDirStore; err = PBGetCatInfo(&hpb, FALSE); if (err == noErr) - retval = BigEndianValue (hpb.dirInfo.ioDrDirID); + retval = CL (hpb.dirInfo.ioDrDirID); else { warning_unexpected ("PBGetCatInfo return value err = %d\n", err); @@ -542,12 +542,12 @@ set_type_and_name (fltype *f, OSType type, Str255 name) switch (f->flavor) { case original_sf: - f->flreplyp.oreplyp->fType = BigEndianValue (type); + f->flreplyp.oreplyp->fType = CL (type); str31assign (f->flreplyp.oreplyp->fName, name); break; case new_sf: case new_custom_sf: - f->flreplyp.nreplyp->sfType = BigEndianValue (type); + f->flreplyp.nreplyp->sfType = CL (type); str31assign (f->flreplyp.nreplyp->sfFile.name, name); f->flreplyp.nreplyp->sfIsFolder = !!type; break; @@ -575,9 +575,9 @@ A2(PRIVATE, INTEGER, flwhich, fltype *, f, Point, p) if (!PtInRect(p, &f->flrect)) { bump = 0; - if (p.v < BigEndianValue(f->flrect.top)) + if (p.v < CW(f->flrect.top)) bump = -1; - else if (p.v >= BigEndianValue(f->flrect.bottom)) + else if (p.v >= CW(f->flrect.bottom)) bump = 1; if (bump) { from = GetCtlValue(f->flsh); @@ -586,7 +586,7 @@ A2(PRIVATE, INTEGER, flwhich, fltype *, f, Point, p) } /*-->*/ return(-1); } - retval = (p.v - BigEndianValue(f->flrect.top)) / f->fllinht + GetCtlValue(f->flsh); + retval = (p.v - CW(f->flrect.top)) / f->fllinht + GetCtlValue(f->flsh); if (retval >= f->flnmfil || MR(*f->flinfo)[retval].flicns & GRAYBIT) /*-->*/ retval = -1; return(retval); @@ -600,8 +600,8 @@ A3(PRIVATE, void, flmouse, fltype *, f, Point, p, ControlHandle, ch) evt.where = p; do { GlobalToLocal(&evt.where); - p.h = BigEndianValue(evt.where.h); - p.v = BigEndianValue(evt.where.v); + p.h = CW(evt.where.h); + p.v = CW(evt.where.v); if ((newsel = flwhich(f, p)) != f->flsel) { if (f->flsel != -1) { safeflflip(f, f->flsel); @@ -632,7 +632,7 @@ A4(static inline, BOOLEAN, ROMlib_CALLFILTERPROC, DialogPtr, dp, SetWRefCon (dp, TICK("stdf")); ROMlib_hook(stdfile_filtnumber); HOOKSAVEREGS(); - retval = CToPascalCall(&fp, CTOP_SectRect, dp, evtp, ith); + retval = CToPascalCall((void*)fp, CTOP_SectRect, dp, evtp, ith); HOOKRESTOREREGS(); SetWRefCon (dp, save_ref_con); return retval; @@ -656,7 +656,7 @@ ROMlib_CALL_NEW_FILTER_PROC (DialogPtr dp, EventRecord *evtp, INTEGER *ith, SetWRefCon (dp, TICK("stdf")); ROMlib_hook(stdfile_filtnumber); HOOKSAVEREGS(); - retval = Executor::CToPascalCall(&fp, CTOP_unused_stdfile, dp, evtp, ith, data); + retval = Executor::CToPascalCall((void*)fp, CTOP_unused_stdfile, dp, evtp, ith, data); HOOKRESTOREREGS(); SetWRefCon (dp, save_ref_con); return retval; @@ -672,7 +672,7 @@ A1(PRIVATE, void, getcurname, fltype *, f) hpb.dirInfo.ioCompletion = 0; hpb.dirInfo.ioNamePtr = RM(&f->flcurdirname[0]); f->flcurdirname[0] = 0; - hpb.dirInfo.ioVRefNum = BigEndianValue(-BigEndianValue(SFSaveDisk)); + hpb.dirInfo.ioVRefNum = CW(-CW(SFSaveDisk)); hpb.dirInfo.ioFDirIndex = CWC(-1); hpb.dirInfo.ioDrDirID = CurDirStore; err = PBGetCatInfo(&hpb, FALSE); @@ -684,16 +684,16 @@ A1(PRIVATE, void, getcurname, fltype *, f) r = &f->flrect; w = StringWidth(f->flcurdirname) + 2 + 16 + 3 + 2 + 2 + 4; #if 1 - if (w > BigEndianValue(r->right) - BigEndianValue(r->left) + 17) { + if (w > CW(r->right) - CW(r->left) + 17) { f->flcurdirrect.left = r->left; - f->flcurdirrect.right = BigEndianValue(BigEndianValue(r->right) + 17); + f->flcurdirrect.right = CW(CW(r->right) + 17); } else { - f->flcurdirrect.left = BigEndianValue((BigEndianValue(r->left) + BigEndianValue(r->right) + 17 - w) / 2 - 2); - f->flcurdirrect.right = BigEndianValue(BigEndianValue(f->flcurdirrect.left) + w); + f->flcurdirrect.left = CW((CW(r->left) + CW(r->right) + 17 - w) / 2 - 2); + f->flcurdirrect.right = CW(CW(f->flcurdirrect.left) + w); } #else /* 1 */ - f->flcurdirrect.left = (BigEndianValue(r->left) + BigEndianValue(r->right) + 17 - w) / 2 - 2; - f->flcurdirrect.right = BigEndianValue(BigEndianValue(f->flcurdirrect.left) + w); + f->flcurdirrect.left = (CW(r->left) + CW(r->right) + 17 - w) / 2 - 2; + f->flcurdirrect.right = CW(CW(f->flcurdirrect.left) + w); #endif /* 1 */ } @@ -755,7 +755,7 @@ A2(static inline, BOOLEAN, ROMlib_CALLFILEFILT, ParmBlkPtr, pbp, filefiltp, fp) ROMlib_hook(stdfile_filefiltnumber); HOOKSAVEREGS(); - retval = CToPascalCall(&fp, CTOP_SystemEvent, pbp); + retval = CToPascalCall((void*)fp, CTOP_SystemEvent, pbp); HOOKRESTOREREGS(); return retval; } @@ -768,7 +768,7 @@ ROMlib_CALL_CUSTOM_FILE_FILT (ParmBlkPtr pbp, UNIV Ptr data, ROMlib_hook(stdfile_filefiltnumber); HOOKSAVEREGS(); - retval = CToPascalCall(&fp, CTOP_GetAuxCtl, pbp, data); + retval = CToPascalCall((void*)fp, CTOP_GetAuxCtl, pbp, data); HOOKRESTOREREGS(); return retval; } @@ -819,11 +819,11 @@ A1(PRIVATE, void, flfill, fltype *, f) SetCursor(STARH((watchh = GetCursor(watchCursor)))); pb.hFileInfo.ioNamePtr = RM(&s[0]); - pb.hFileInfo.ioVRefNum = BigEndianValue(-BigEndianValue(SFSaveDisk)); + pb.hFileInfo.ioVRefNum = CW(-CW(SFSaveDisk)); err = noErr; errcount = 0; for (dirindex = 1; err != fnfErr && errcount != 3; dirindex++) { - pb.hFileInfo.ioFDirIndex = BigEndianValue(dirindex); + pb.hFileInfo.ioFDirIndex = CW(dirindex); pb.hFileInfo.ioDirID = CurDirStore; err = PBGetCatInfo(&pb, FALSE); if (err) { @@ -893,7 +893,7 @@ P2(PUBLIC, pascal void, ROMlib_filebox, DialogPeek, dp, INTEGER, which) h.p = NULL; GetDItem((DialogPtr) dp, which, &i, &h, &r); -/* h.p = BigEndianValue(h.p); we don't really use h */ +/* h.p = CL(h.p); we don't really use h */ switch (which) { case getNmList: case putNmList: @@ -908,7 +908,7 @@ P2(PUBLIC, pascal void, ROMlib_filebox, DialogPeek, dp, INTEGER, which) case getDiskName: /* case putDiskName: getDiskName and putDiskName are the same */ EraseRect(&r); - width = BigEndianValue(r.right) - BigEndianValue(r.left); + width = CW(r.right) - CW(r.left); diskname = getdiskname( &ejectable, NULL ); GetDItem((DialogPtr) dp, putEject, &i, &ejhand, &r2); ejhand.p = MR(ejhand.p); @@ -919,10 +919,10 @@ P2(PUBLIC, pascal void, ROMlib_filebox, DialogPeek, dp, INTEGER, which) strwidth = StringWidth(diskname) + 2 + 16 + 3; offset = (width - strwidth) / 2; if (offset < 3) - r.left = BigEndianValue(BigEndianValue(r.left) + (3)); + r.left = CW(CW(r.left) + (3)); else - r.left = BigEndianValue(BigEndianValue(r.left) + (offset)); - r.bottom = BigEndianValue(WINDFL(dp)->flascent); + r.left = CW(CW(r.left) + (offset)); + r.bottom = CW(WINDFL(dp)->flascent); drawinboxwithicon(diskname, &r, ejectable ? MICONFLOPPY : MICONDISK); break; } @@ -934,7 +934,7 @@ A2(PRIVATE, void, realcd, DialogPeek, dp, LONGINT, dir) { fltype *fp; - CurDirStore = BigEndianValue(dir); + CurDirStore = CL(dir); fp = WINDFL(dp); SetHandleSize((Handle) fp->flinfo, (Size) 0); SetHandleSize((Handle) fp->flstrs, (Size) 0); @@ -942,11 +942,11 @@ A2(PRIVATE, void, realcd, DialogPeek, dp, LONGINT, dir) fp->flsel = -1; set_type_and_name (fp, 0, (StringPtr) ""); flfill(fp); - fp->flcurdirrect.right = BigEndianValue(BigEndianValue(fp->flcurdirrect.right ) + 1); - fp->flcurdirrect.bottom = BigEndianValue(BigEndianValue(fp->flcurdirrect.bottom) + 1); + fp->flcurdirrect.right = CW(CW(fp->flcurdirrect.right ) + 1); + fp->flcurdirrect.bottom = CW(CW(fp->flcurdirrect.bottom) + 1); EraseRect(&fp->flcurdirrect); getcurname(fp); - fp->flcurdirrect.bottom = BigEndianValue(BigEndianValue(fp->flcurdirrect.bottom) - 1); + fp->flcurdirrect.bottom = CW(CW(fp->flcurdirrect.bottom) - 1); /* don't need to do right; getcurname does */ drawjobberattop(dp); C_ROMlib_filebox(dp, getDiskName); @@ -965,12 +965,12 @@ A1(PRIVATE, LONGINT, getparent, LONGINT, dirid) cb.dirInfo.ioCompletion = 0; cb.dirInfo.ioNamePtr = 0; - cb.dirInfo.ioVRefNum = BigEndianValue(-BigEndianValue(SFSaveDisk)); + cb.dirInfo.ioVRefNum = CW(-CW(SFSaveDisk)); cb.dirInfo.ioFDirIndex = CWC (-1); - cb.dirInfo.ioDrDirID = BigEndianValue(dirid); + cb.dirInfo.ioDrDirID = CL(dirid); err = PBGetCatInfo(&cb, FALSE); if (err == noErr) - retval = BigEndianValue(cb.dirInfo.ioDrParID); + retval = CL(cb.dirInfo.ioDrParID); else { warning_unexpected ("PBGetCatInfo return = %d\n", err); @@ -987,7 +987,7 @@ PRIVATE BOOLEAN findparent(INTEGER *vrefp, LONGINT *diridp) char *namecpy, *slashp; INTEGER namelen; - vcbp = ROMlib_vcbbyvrn(BigEndianValue(*vrefp)); + vcbp = ROMlib_vcbbyvrn(CW(*vrefp)); retval = FALSE; if (!vcbp->vcbCTRef) { namelen = strlen(((VCBExtra *) vcbp)->unixname); @@ -1003,7 +1003,7 @@ PRIVATE BOOLEAN findparent(INTEGER *vrefp, LONGINT *diridp) if (Ustat(namecpy, &sbuf) == 0 && (vcbp = ROMlib_vcbbybiggestunixname(namecpy))) { *vrefp = vcbp->vcbVRefNum; - *diridp = BigEndianValue((LONGINT) ST_INO (sbuf)); + *diridp = CL((LONGINT) ST_INO (sbuf)); retval = TRUE; } } @@ -1017,14 +1017,14 @@ A1(PRIVATE, BOOLEAN, moveuponedir, DialogPtr, dp) INTEGER vrn; BOOLEAN retval; - parent = getparent(BigEndianValue(CurDirStore)); - if (parent != BigEndianValue(CurDirStore) && parent != 1) { - CurDirStore = BigEndianValue(parent); + parent = getparent(CL(CurDirStore)); + if (parent != CL(CurDirStore) && parent != 1) { + CurDirStore = CL(parent); retval = TRUE; } else { - vrn = BigEndianValue(-BigEndianValue(SFSaveDisk)); + vrn = CW(-CW(SFSaveDisk)); retval = findparent(&vrn, &CurDirStore); - SFSaveDisk = BigEndianValue(-BigEndianValue(vrn)); + SFSaveDisk = CW(-CW(vrn)); } return retval; } @@ -1156,19 +1156,19 @@ P3(PUBLIC, pascal INTEGER, ROMlib_stdffilt, DialogPeek, dp, fl = WINDFL(dp); opentoken = getOpen; /* getOpen and putSave are both 1 */ retval = FALSE; - switch (BigEndianValue(evt->what)) { + switch (CW(evt->what)) { case keyDown: - *ith = BigEndianValue((BigEndianValue(evt->message) & 0xFF) + keydownbit); - switch (BigEndianValue(evt->message) & 0xFF) { + *ith = CW((CL(evt->message) & 0xFF) + keydownbit); + switch (CL(evt->message) & 0xFF) { case NUMPAD_ENTER: case '\r' : - GetDItem((DialogPtr) dp, BigEndianValue(dp->aDefItem), &i, (HIDDEN_Handle *) &h, &r); + GetDItem((DialogPtr) dp, CW(dp->aDefItem), &i, (HIDDEN_Handle *) &h, &r); h.p = MR(h.p); if (Hx(h.p, contrlVis) && U(Hx(h.p, contrlHilite)) != 255) { prefix[0] = 0; oldticks = -1000; - *ith = BigEndianValue(opentoken); + *ith = CW(opentoken); retval = -1; //#if !defined(MACOSX_) HiliteControl(h.p, inButton); @@ -1178,14 +1178,14 @@ P3(PUBLIC, pascal INTEGER, ROMlib_stdffilt, DialogPeek, dp, } break; case ASCIIUPARROW: - if (BigEndianValue(evt->modifiers) & cmdKey) + if (CW(evt->modifiers) & cmdKey) *ith = CWC(getDiskName); /* the same as putDiskName */ else keyarrow(fl, -1); retval = -1; break; case ASCIIDOWNARROW: - if ((BigEndianValue(evt->modifiers) & cmdKey) && fl->flsel != -1 && + if ((CW(evt->modifiers) & cmdKey) && fl->flsel != -1 && (MR(*fl->flinfo) + fl->flsel)->flicns == MICONCFOLDER) { prefix[0] = 0; oldticks = -1000; @@ -1201,7 +1201,7 @@ P3(PUBLIC, pascal INTEGER, ROMlib_stdffilt, DialogPeek, dp, case '.': if (evt->modifiers & CWC(cmdKey)) { - *ith = BigEndianValue(fl->fl_cancel_item); + *ith = CW(fl->fl_cancel_item); retval = -1; break; } @@ -1213,14 +1213,14 @@ P3(PUBLIC, pascal INTEGER, ROMlib_stdffilt, DialogPeek, dp, */ if (!fl->flgraynondirs && dp->editField == -1) { flep = MR(*fl->flinfo) + fl->flnmfil - 1; - if (BigEndianValue(evt->when) > lastkeydowntime + BigEndianValue(DoubleTime)) { + if (CL(evt->when) > lastkeydowntime + CL(DoubleTime)) { flp = MR(*fl->flinfo); prefix[0] = 0; oldticks = -1000; } else flp = MR(*fl->flinfo) + ((fl->flsel) == -1 ? 0 : fl->flsel); - lastkeydowntime = BigEndianValue(evt->when); - prefix[++prefix[0]] = BigEndianValue(evt->message) & 0xff; + lastkeydowntime = CL(evt->when); + prefix[++prefix[0]] = CL(evt->message) & 0xff; while (flp < flep && RelString((StringPtr) (MR(*fl->flstrs) + flp->floffs), prefix, FALSE, TRUE) < 0) @@ -1244,15 +1244,15 @@ P3(PUBLIC, pascal INTEGER, ROMlib_stdffilt, DialogPeek, dp, case mouseDown: p = evt->where; GlobalToLocal(&p); - p.h = BigEndianValue(p.h); - p.v = BigEndianValue(p.v); + p.h = CW(p.h); + p.v = CW(p.v); if (PtInRect(p, &fl->flrect)) { GetDItem((DialogPtr) dp, getOpen, &i, (HIDDEN_Handle *) &h, &r); h.p = MR(h.p); flmouse(fl, evt->where, h.p); ticks = TickCount(); if (fl->flsel != -1 && savesel == fl->flsel && - (ticks < oldticks + BigEndianValue(DoubleTime))) { + (ticks < oldticks + CL(DoubleTime))) { prefix[0] = 0; *ith = CWC(opentoken); oldticks = -1000; @@ -1309,14 +1309,14 @@ A3(PRIVATE, void, flinit, fltype *, f, Rect *, r, ControlHandle, sh) f->flsh = sh; f->flrect = *r; - f->fllinht = BigEndianValue(fi.ascent) + BigEndianValue(fi.descent) + BigEndianValue(fi.leading); + f->fllinht = CW(fi.ascent) + CW(fi.descent) + CW(fi.leading); - f->flcurdirrect.top = BigEndianValue(BigEndianValue(r->top) - f->fllinht - 5); - f->flcurdirrect.bottom = BigEndianValue(BigEndianValue(f->flcurdirrect.top) + f->fllinht); + f->flcurdirrect.top = CW(CW(r->top) - f->fllinht - 5); + f->flcurdirrect.bottom = CW(CW(f->flcurdirrect.top) + f->fllinht); getcurname(f); - f->flascent = BigEndianValue(fi.ascent); - f->flnmlin = (BigEndianValue(r->bottom) - BigEndianValue(r->top)) / f->fllinht; + f->flascent = CW(fi.ascent); + f->flnmlin = (CW(r->bottom) - CW(r->top)) / f->fllinht; f->flnmfil = 0; f->flsel = -1; savezone = TheZone; @@ -1330,8 +1330,8 @@ A3(PRIVATE, void, stdfflip, Rect *, rp, INTEGER, n, INTEGER, height) { INTEGER savetop = rp->top; - rp->top = BigEndianValue(BigEndianValue(rp->top) + (n * height + 1)); - rp->bottom = BigEndianValue(BigEndianValue(rp->top) + height - 2); + rp->top = CW(CW(rp->top) + (n * height + 1)); + rp->bottom = CW(CW(rp->top) + height - 2); InvertRect(rp); rp->top = savetop; } @@ -1370,7 +1370,7 @@ A1(PRIVATE, BOOLEAN, trackdirs, DialogPeek, dp) hpb.dirInfo.ioCompletion = 0; hpb.dirInfo.ioNamePtr = RM (&next->name[0]); next->name[0] = 0; - hpb.dirInfo.ioVRefNum = BigEndianValue (-BigEndianValue(SFSaveDisk)); + hpb.dirInfo.ioVRefNum = CW (-CW(SFSaveDisk)); hpb.dirInfo.ioFDirIndex = CWC (-1); hpb.dirInfo.ioDrDirID = CurDirStore; max_width = 0; @@ -1387,8 +1387,8 @@ A1(PRIVATE, BOOLEAN, trackdirs, DialogPeek, dp) warning_unexpected ("PBGetCatInfo returns err = %d\n", err); done = TRUE; } - id = next->dirid = BigEndianValue (hpb.dirInfo.ioDrDirID); - next->vrefnum = BigEndianValue (hpb.dirInfo.ioVRefNum); + id = next->dirid = CL (hpb.dirInfo.ioDrDirID); + next->vrefnum = CW (hpb.dirInfo.ioVRefNum); next->next = (struct link *) ALLOCA (sizeof (struct link)); gui_assert (next->next); str_width = StringWidth (next->name); @@ -1406,12 +1406,12 @@ A1(PRIVATE, BOOLEAN, trackdirs, DialogPeek, dp) } } while (!done); fl = WINDFL(dp); - therect.top = BigEndianValue (BigEndianValue (fl->flcurdirrect.top) - - BigEndianValue (PORT_BOUNDS (dp).top)); - therect.left = BigEndianValue (BigEndianValue (fl->flcurdirrect.left) - - BigEndianValue (PORT_BOUNDS (dp).left)); - therect.bottom = BigEndianValue (BigEndianValue (therect.top) + count * fl->fllinht + 1); - therect.right = BigEndianValue (BigEndianValue (therect.left) + 2 + 16 + 3 + max_width + 4 + 2 + 3); + therect.top = CW (CW (fl->flcurdirrect.top) + - CW (PORT_BOUNDS (dp).top)); + therect.left = CW (CW (fl->flcurdirrect.left) + - CW (PORT_BOUNDS (dp).left)); + therect.bottom = CW (CW (therect.top) + count * fl->fllinht + 1); + therect.right = CW (CW (therect.left) + 2 + 16 + 3 + max_width + 4 + 2 + 3); ClipRect(&therect); { @@ -1427,18 +1427,18 @@ A1(PRIVATE, BOOLEAN, trackdirs, DialogPeek, dp) bounds = &PIXMAP_BOUNDS (save_bits); bounds->top = CWC (0); bounds->left = CWC (0); - bounds->bottom = BigEndianValue (RECT_HEIGHT (&therect)); - bounds->right = BigEndianValue (RECT_WIDTH (&therect)); + bounds->bottom = CW (RECT_HEIGHT (&therect)); + bounds->right = CW (RECT_WIDTH (&therect)); PIXMAP_PIXEL_SIZE_X (save_bits) = save_bpp_x = PIXMAP_PIXEL_SIZE_X (port_pixmap); ROMlib_copy_ctab (PIXMAP_TABLE (port_pixmap), PIXMAP_TABLE (save_bits)); - row_bytes = ((BigEndianValue (bounds->right) * BigEndianValue (save_bpp_x) + 31) / 32) * 4; - PIXMAP_SET_ROWBYTES_X (save_bits, BigEndianValue (row_bytes)); + row_bytes = ((CW (bounds->right) * CW (save_bpp_x) + 31) / 32) * 4; + PIXMAP_SET_ROWBYTES_X (save_bits, CW (row_bytes)); /* Allocate potentially large temporary pixmap space. */ TEMP_ALLOC_ALLOCATE (save_bits_mem, temp_save_bits, - BigEndianValue (bounds->bottom) * row_bytes); + CW (bounds->bottom) * row_bytes); PIXMAP_BASEADDR_X (save_bits) = (Ptr)RM (save_bits_mem); WRAPPER_SET_PIXMAP_X (wrapper, RM (save_bits)); @@ -1452,8 +1452,8 @@ A1(PRIVATE, BOOLEAN, trackdirs, DialogPeek, dp) /* highlite the appropriate box, etc. */ fillinrect.top = therect.top; - fillinrect.left = BigEndianValue(BigEndianValue(therect.left) + 2); - fillinrect.bottom = BigEndianValue(fl->flascent); + fillinrect.left = CW(CW(therect.left) + 2); + fillinrect.bottom = CW(fl->flascent); fillinrect.right = therect.right; for (i = count, next = &first; --i >= 0; next = next->next) @@ -1468,31 +1468,31 @@ A1(PRIVATE, BOOLEAN, trackdirs, DialogPeek, dp) drawinboxwithicon(next->name, &fillinrect, i ? MICONCFOLDER : MICONDISK); */ - fillinrect.top = BigEndianValue(BigEndianValue(fillinrect.top) + (fl->fllinht)); + fillinrect.top = CW(CW(fillinrect.top) + (fl->fllinht)); } - therect.right = BigEndianValue(BigEndianValue(therect.right) - (1)); - therect.bottom = BigEndianValue(BigEndianValue(therect.bottom) - (1)); + therect.right = CW(CW(therect.right) - (1)); + therect.bottom = CW(CW(therect.bottom) - (1)); FrameRect(&therect); - MoveTo(BigEndianValue(therect.left)+1, BigEndianValue(therect.bottom)); - LineTo(BigEndianValue(therect.right), BigEndianValue(therect.bottom)); - LineTo(BigEndianValue(therect.right), BigEndianValue(therect.top)+1); - therect.right = BigEndianValue(BigEndianValue(therect.right) + (1)); + MoveTo(CW(therect.left)+1, CW(therect.bottom)); + LineTo(CW(therect.right), CW(therect.bottom)); + LineTo(CW(therect.right), CW(therect.top)+1); + therect.right = CW(CW(therect.right) + (1)); sel = 0; fillinrect.top = therect.top; - fillinrect.left = BigEndianValue (BigEndianValue (fillinrect.left) - 1); - fillinrect.right = BigEndianValue (BigEndianValue (fillinrect.right) - 2); + fillinrect.left = CW (CW (fillinrect.left) - 1); + fillinrect.right = CW (CW (fillinrect.right) - 2); stdfflip (&fillinrect, sel, fl->fllinht); done = FALSE; seen_up_already = FALSE; firstsel = -1; while (!done) { - evt.where.h = BigEndianValue (evt.where.h); - evt.where.v = BigEndianValue (evt.where.v); + evt.where.h = CW (evt.where.h); + evt.where.v = CW (evt.where.v); if (PtInRect (evt.where, &therect)) - newsel = (evt.where.v - BigEndianValue(therect.top)) / fl->fllinht; + newsel = (evt.where.v - CW(therect.top)) / fl->fllinht; else newsel = -1; if (newsel != sel) @@ -1527,7 +1527,7 @@ A1(PRIVATE, BOOLEAN, trackdirs, DialogPeek, dp) } } - therect.bottom = BigEndianValue (BigEndianValue (therect.bottom) + 1); + therect.bottom = CW (CW (therect.bottom) + 1); /* restore the rect and clean up after ourselves */ CopyBits(wrapper, PORT_BITS_FOR_COPY (thePort), @@ -1538,8 +1538,8 @@ A1(PRIVATE, BOOLEAN, trackdirs, DialogPeek, dp) { for (i = 0, next = &first; i != sel; ++i, next = next->next) ; - CurDirStore = BigEndianValue(next->dirid); - SFSaveDisk = BigEndianValue(-next->vrefnum); + CurDirStore = CL(next->dirid); + SFSaveDisk = CW(-next->vrefnum); return TRUE; } ALLOCAEND @@ -1560,7 +1560,7 @@ makeworking (fltype *f) WDPBRec wdpb; OSErr err; - wdpb.ioVRefNum = BigEndianValue(-BigEndianValue(SFSaveDisk)); + wdpb.ioVRefNum = CW(-CW(SFSaveDisk)); wdpb.ioWDDirID = CurDirStore; wdpb.ioWDProcID = TICKX("STDF"); wdpb.ioNamePtr = 0; @@ -1573,7 +1573,7 @@ makeworking (fltype *f) break; case new_sf: case new_custom_sf: - f->flreplyp.nreplyp->sfFile.vRefNum = BigEndianValue(-BigEndianValue(SFSaveDisk)); + f->flreplyp.nreplyp->sfFile.vRefNum = CW(-CW(SFSaveDisk)); f->flreplyp.nreplyp->sfFile.parID = CurDirStore; break; default: @@ -1598,14 +1598,14 @@ PRIVATE boolean_t single_tree_fs_p(HParmBlkPtr pb) #if defined(MSDOS) || defined (CYGWIN32) return FALSE; #else - HVCB *vcbp = ROMlib_vcbbyvrn(BigEndianValue(pb->volumeParam.ioVRefNum)); + HVCB *vcbp = ROMlib_vcbbyvrn(CW(pb->volumeParam.ioVRefNum)); return vcbp && !vcbp->vcbCTRef; #endif } #if defined(LINUX) -PUBLIC int linuxfloppy_open(int disk, LONGINT *bsizep, +PUBLIC int Executor::linuxfloppy_open(int disk, LONGINT *bsizep, drive_flags_t *flagsp, const char *dname) { int retval; @@ -1656,7 +1656,7 @@ PUBLIC int linuxfloppy_open(int disk, LONGINT *bsizep, return retval; } -PRIVATE int linuxfloppy_close(int disk) +int Executor::linuxfloppy_close(int disk) { return close(disk); } @@ -1772,7 +1772,7 @@ PUBLIC void Executor::futzwithdosdisks( void ) try_to_mount_disk( DRIVE_NAME_OF (i), fd|MARKER, &mess, blocksize, 16 * PHYSBSIZE, flags, 0); - mess = BigEndianValue(mess); + mess = CL(mess); if (mess) { if (mess >> 16 == 0) { DRIVE_LOADED(i) = TRUE; @@ -1814,14 +1814,14 @@ A2(PRIVATE, void, bumpsavedisk, DialogPtr, dp, BOOLEAN, always) /* beenhere = TRUE; */ } #endif - pb.volumeParam.ioVRefNum = BigEndianValue(-BigEndianValue(SFSaveDisk)); + pb.volumeParam.ioVRefNum = CW(-CW(SFSaveDisk)); pb.volumeParam.ioNamePtr = 0; pb.volumeParam.ioVolIndex = 0; err = PBHGetVInfo(&pb, FALSE); if (err != noErr) warning_unexpected ("PBHGetVInfo returns %d", err); - else if (!SFSaveDisk || ISWDNUM(-BigEndianValue(SFSaveDisk))) - SFSaveDisk = BigEndianValue(-BigEndianValue(pb.volumeParam.ioVRefNum)); + else if (!SFSaveDisk || ISWDNUM(-CW(SFSaveDisk))) + SFSaveDisk = CW(-CW(pb.volumeParam.ioVRefNum)); if (always || pb.ioParam.ioResult != noErr || ejected(&pb)) { current = pb.volumeParam.ioVRefNum; is_single_tree_fs = single_tree_fs_p(&pb); @@ -1829,7 +1829,7 @@ A2(PRIVATE, void, bumpsavedisk, DialogPtr, dp, BOOLEAN, always) seenus = FALSE; vref = 0; do { - pb.volumeParam.ioVolIndex = BigEndianValue(BigEndianValue(pb.volumeParam.ioVolIndex) + 1); + pb.volumeParam.ioVolIndex = CW(CW(pb.volumeParam.ioVolIndex) + 1); err = PBHGetVInfo(&pb, FALSE); if (err != noErr && !seenus) warning_unexpected ("PBHGetVInfo = %d\n", err); @@ -1839,14 +1839,14 @@ A2(PRIVATE, void, bumpsavedisk, DialogPtr, dp, BOOLEAN, always) else if (!ejected(&pb) && (!is_single_tree_fs || !single_tree_fs_p(&pb))) { if (!vref || seenus) - vref = BigEndianValue(pb.volumeParam.ioVRefNum); + vref = CW(pb.volumeParam.ioVRefNum); if (seenus) /*-->*/ break; } } } while (err == noErr); if (vref) { - SFSaveDisk = BigEndianValue(-vref); + SFSaveDisk = CW(-vref); CurDirStore = CLC(2); } } @@ -1894,10 +1894,10 @@ ROMlib_CALLDHOOK (fltype *fl, INTEGER ihit, DialogPtr dp, dialog_hook_u dhu) { case original_sf: case new_sf: - retval = CToPascalCall (&dhu.odh, CTOP_Alert, ihit, dp); + retval = CToPascalCall((void*)dhu.odh, CTOP_Alert, ihit, dp); break; case new_custom_sf: - retval = CToPascalCall (&dhu.cdh, CTOP_unused_stdfile_2, ihit, dp, + retval = CToPascalCall((void*)dhu.cdh, CTOP_unused_stdfile_2, ihit, dp, fl->mydata); break; default: @@ -1924,30 +1924,30 @@ A4(PRIVATE, void, transformsfpdialog, DialogPtr, dp, Point *, offset, extrasizeneeded = 110; SetRect(scrollrect, 16, 24, 231, 106); tep = STARH(MR(((DialogPeek)dp)->textH)); - tep->destRect.top = BigEndianValue(BigEndianValue(tep->destRect.top) + (extrasizeneeded)); - tep->destRect.bottom = BigEndianValue(BigEndianValue(tep->destRect.bottom) + (extrasizeneeded)); - tep->viewRect.top = BigEndianValue(BigEndianValue(tep->viewRect.top) + (extrasizeneeded)); - tep->viewRect.bottom = BigEndianValue(BigEndianValue(tep->viewRect.bottom) + (extrasizeneeded)); + tep->destRect.top = CW(CW(tep->destRect.top) + (extrasizeneeded)); + tep->destRect.bottom = CW(CW(tep->destRect.bottom) + (extrasizeneeded)); + tep->viewRect.top = CW(CW(tep->viewRect.top) + (extrasizeneeded)); + tep->viewRect.bottom = CW(CW(tep->viewRect.bottom) + (extrasizeneeded)); } - numitems = BigEndianValue(*(INTEGER *)STARH((MR(((DialogPeek)dp)->items)))) + 1; + numitems = CW(*(INTEGER *)STARH((MR(((DialogPeek)dp)->items)))) + 1; for (j = 1 ; j <= numitems ; j++) { GetDItem(dp, j, &i, &h, &r); - i = BigEndianValue(i); + i = CW(i); h.p = MR(h.p); - if (!getting || BigEndianValue(r.bottom) > BigEndianValue(scrollrect->top)) { - r.top = BigEndianValue(BigEndianValue(r.top) + (extrasizeneeded)); - r.bottom = BigEndianValue(BigEndianValue(r.bottom) + (extrasizeneeded)); + if (!getting || CW(r.bottom) > CW(scrollrect->top)) { + r.top = CW(CW(r.top) + (extrasizeneeded)); + r.bottom = CW(CW(r.bottom) + (extrasizeneeded)); if (i <= 7 && i >= 4) /* It's a control */ - MoveControl((ControlHandle) h.p, BigEndianValue(r.left), BigEndianValue(r.top)); + MoveControl((ControlHandle) h.p, CW(r.left), CW(r.top)); SetDItem(dp, j, i, h.p, &r); } } - windheight = BigEndianValue(dp->portRect.bottom) - BigEndianValue(dp->portRect.top) + extrasizeneeded; - SizeWindow( (WindowPtr) dp, BigEndianValue(dp->portRect.right) - BigEndianValue(dp->portRect.left), + windheight = CW(dp->portRect.bottom) - CW(dp->portRect.top) + extrasizeneeded; + SizeWindow( (WindowPtr) dp, CW(dp->portRect.right) - CW(dp->portRect.left), windheight, FALSE); if (getting) { - scrollrect->top = BigEndianValue(BigEndianValue(scrollrect->top) + (extrasizeneeded)); - scrollrect->bottom = BigEndianValue(BigEndianValue(scrollrect->bottom) + (extrasizeneeded)); + scrollrect->top = CW(CW(scrollrect->top) + (extrasizeneeded)); + scrollrect->bottom = CW(CW(scrollrect->bottom) + (extrasizeneeded)); } InvalRect(&dp->portRect); offset->v -= extrasizeneeded / 2; @@ -1983,7 +1983,7 @@ void adjustdrivebutton(DialogPtr dp) A1(PRIVATE, void, doeject, DialogPtr, dp) { - Eject((StringPtr) "", -BigEndianValue(SFSaveDisk)); + Eject((StringPtr) "", -CW(SFSaveDisk)); adjustdrivebutton(dp); bumpsavedisk(dp, TRUE); } @@ -1995,10 +1995,10 @@ A3(PRIVATE, OSType, gettypeX, StringPtr, name, INTEGER, vref, LONGINT, dirid) HParamBlockRec pbr; pbr.fileParam.ioNamePtr = RM (name); - pbr.fileParam.ioVRefNum = BigEndianValue (vref); + pbr.fileParam.ioVRefNum = CW (vref); pbr.fileParam.ioFVersNum = 0; pbr.fileParam.ioFDirIndex = CWC (0); - pbr.fileParam.ioDirID = BigEndianValue (dirid); + pbr.fileParam.ioDirID = CL (dirid); err = PBHGetFInfo (&pbr, FALSE); if (err == noErr) retval = pbr.fileParam.ioFlFndrInfo.fdType; @@ -2028,7 +2028,7 @@ unixcore (StringPtr namep, INTEGER *vrefnump, LONGINT *diridp) vcbp = ROMlib_vcbbyvrn(vrefnum); #else pbr.ioParam.ioNamePtr = (StringPtr)CLC(0); - pbr.ioParam.ioVRefNum = BigEndianValue(vrefnum); + pbr.ioParam.ioVRefNum = CW(vrefnum); vcbp = ROMlib_breakoutioname(&pbr, &templ, &tempcp, (BOOLEAN *) 0, TRUE); free (tempcp); #endif @@ -2052,7 +2052,7 @@ unixcore (StringPtr namep, INTEGER *vrefnump, LONGINT *diridp) vcbextrap = ROMlib_vcbbyunixname(newname); if (vcbextrap) { - *vrefnump = BigEndianValue(vcbextrap->vcb.vcbVRefNum); + *vrefnump = CW(vcbextrap->vcb.vcbVRefNum); if (*diridp == vcbextrap->u.ufs.ino) *diridp = 2; } @@ -2080,13 +2080,13 @@ P1(PUBLIC pascal trap, OSErr, unixmount, CInfoPBRec *, cbp) INTEGER vrefnum; LONGINT dirid; - vrefnum = BigEndianValue(cbp->hFileInfo.ioVRefNum); - dirid = BigEndianValue (cbp->hFileInfo.ioDirID); + vrefnum = CW(cbp->hFileInfo.ioVRefNum); + dirid = CL (cbp->hFileInfo.ioDirID); err = unixcore(MR(cbp->hFileInfo.ioNamePtr), &vrefnum, &dirid); if (err == noErr) { - cbp->hFileInfo.ioVRefNum = BigEndianValue (vrefnum); - cbp->hFileInfo.ioDirID = BigEndianValue (dirid); + cbp->hFileInfo.ioVRefNum = CW (vrefnum); + cbp->hFileInfo.ioDirID = CW (dirid); } } return err; @@ -2099,12 +2099,12 @@ PRIVATE void unixcd(fltype *f) LONGINT dirid; name = (StringPtr) (MR(*f->flstrs) + MR(*f->flinfo)[f->flsel].floffs); - vrefnum = -BigEndianValue(SFSaveDisk); - dirid = BigEndianValue (CurDirStore); + vrefnum = -CW(SFSaveDisk); + dirid = CL (CurDirStore); if (unixcore(name, &vrefnum, &dirid) == noErr) { - SFSaveDisk = BigEndianValue (-vrefnum); - CurDirStore = BigEndianValue (dirid); + SFSaveDisk = CW (-vrefnum); + CurDirStore = CL (dirid); } } @@ -2120,8 +2120,8 @@ get_starting_point (Point *pp) Rect main_gd_rect; main_gd_rect = PIXMAP_BOUNDS (GD_PMAP (MR (MainDevice))); - screen_width = BigEndianValue (main_gd_rect.right); - screen_height = BigEndianValue (main_gd_rect.bottom); + screen_width = CW (main_gd_rect.right); + screen_height = CW (main_gd_rect.bottom); pp->h = (screen_width - STANDARD_WIDTH) / 2; pp->v = (screen_height - STANDARD_HEIGHT) / 2; } @@ -2173,13 +2173,13 @@ destroy_new_folder_button (DialogPtr dp, ControlHandle ch) ? (fp)->flreplyp.oreplyp->vRefNum \ : (fp)->flreplyp.nreplyp->sfFile.vRefNum) -#define SF_VREFNUM(fp) (BigEndianValue (SF_VREFNUM_X (fp))) +#define SF_VREFNUM(fp) (CW (SF_VREFNUM_X (fp))) #define SF_DIRID_X(fp) ((fp)->flavor == original_sf \ ? 0 \ : (fp)->flreplyp.nreplyp->sfFile.parID) -#define SF_DIRID(fp) (BigEndianValue (SF_DIRID_X (fp))) +#define SF_DIRID(fp) (CL (SF_DIRID_X (fp))) PRIVATE void getditext (DialogPtr dp, INTEGER item, StringPtr text) @@ -2240,7 +2240,7 @@ new_folder_from_dp (DialogPtr dp, fltype *f) boolean_t retval; getditext (dp, 3, str); - hpb.ioParam.ioVRefNum = BigEndianValue (-BigEndianValue (SFSaveDisk)); + hpb.ioParam.ioVRefNum = CW (-CW (SFSaveDisk)); hpb.fileParam.ioDirID = CurDirStore; if (str[0] > 31) str[0] = 31; @@ -2339,7 +2339,7 @@ PUBLIC void spfcommon(Point p, StringPtr prompt, StringPtr name, #endif reply_valid = host_spfcommon (&reply, c_prompt, local_name, &fp, &filef, numt, tl, getorput, flavor, activeList, - &activateproc, yourdatap); + (void*)activateproc, yourdatap); free (c_prompt); if (reply_valid) rep_from_host_reply_block (&rep, &reply); @@ -2369,7 +2369,7 @@ PUBLIC void spfcommon(Point p, StringPtr prompt, StringPtr name, f.flavor = flavor; f.flreplyp = rep; - if (p.h < 2 || p.v < BigEndianValue(MBarHeight) + 7) + if (p.h < 2 || p.v < CW(MBarHeight) + 7) get_starting_point (&p); *SF_GOOD_XP(&f) = CBC (FALSE); @@ -2468,7 +2468,7 @@ PUBLIC void spfcommon(Point p, StringPtr prompt, StringPtr name, if (f.flavor == original_sf) { putname = putName; - transform = BigEndianValue(scrollrect.right) - BigEndianValue(scrollrect.left) == 1; + transform = CW(scrollrect.right) - CW(scrollrect.left) == 1; } else { @@ -2486,7 +2486,7 @@ PUBLIC void spfcommon(Point p, StringPtr prompt, StringPtr name, { GetDItem(dp, getScroll, &i, &h, &r); h.p = MR(h.p); - transform = BigEndianValue(r.right) - BigEndianValue(r.left) == 16; + transform = CW(r.right) - CW(r.left) == 16; GetDItem(dp, getDotted, &i, &h, &r); h.p = MR(h.p); SetDItem(dp, getDotted, userItem, (Handle) P_ROMlib_filebox, &r); @@ -2504,11 +2504,11 @@ PUBLIC void spfcommon(Point p, StringPtr prompt, StringPtr name, h.p = MR(h.p); SetDItem(dp, diskname, userItem, (Handle) P_ROMlib_filebox, &r); - r.left = BigEndianValue(BigEndianValue(scrollrect.left) + 1); - r.right = BigEndianValue(BigEndianValue(scrollrect.right) - 16); - r.top = BigEndianValue(BigEndianValue(scrollrect.top) + 1); - r.bottom = BigEndianValue(BigEndianValue(scrollrect.bottom) - 1); - scrollrect.left = BigEndianValue(BigEndianValue(scrollrect.right) - 16); + r.left = CW(CW(scrollrect.left) + 1); + r.right = CW(CW(scrollrect.right) - 16); + r.top = CW(CW(scrollrect.top) + 1); + r.bottom = CW(CW(scrollrect.bottom) - 1); + scrollrect.left = CW(CW(scrollrect.right) - 16); scrollh = NewControl((WindowPtr) dp, &scrollrect, (StringPtr) "", TRUE, 0, 0, 0, scrollBarProc, 0L); flinit(&f, &r, scrollh); @@ -2528,10 +2528,10 @@ PUBLIC void spfcommon(Point p, StringPtr prompt, StringPtr name, (SF_NAME (&f))[0] = 0; } SetWRefCon((WindowPtr) dp, (LONGINT)(long)US_TO_SYN68K(&f)); - if (BigEndianValue(dp->portRect.bottom) + p.v + 7 > BigEndianValue(screenBitsX.bounds.bottom)) - p.v = BigEndianValue(screenBitsX.bounds.bottom) - BigEndianValue(dp->portRect.bottom) - 7; - if (p.v < BigEndianValue(MBarHeight) + 7) - p.v = BigEndianValue(MBarHeight) + 7; + if (CW(dp->portRect.bottom) + p.v + 7 > CW(screenBitsX.bounds.bottom)) + p.v = CW(screenBitsX.bounds.bottom) - CW(dp->portRect.bottom) - 7; + if (p.v < CW(MBarHeight) + 7) + p.v = CW(MBarHeight) + 7; MoveWindow((WindowPtr) dp, p.h, p.v, FALSE); ihit = -1; @@ -2545,7 +2545,7 @@ PUBLIC void spfcommon(Point p, StringPtr prompt, StringPtr name, SelectWindow((WindowPtr) dp); while (!done) { ModalDialog((ProcPtr) P_ROMlib_stdffilt, &ihit); - ihit = BigEndianValue(ihit); + ihit = CW(ihit); if (getorput == put) GetIText(pnhand.p, SF_NAME (&f)); if (dh.odh) @@ -2640,18 +2640,18 @@ PUBLIC void spfcommon(Point p, StringPtr prompt, StringPtr name, (evt.message & CLC(0xFFFF0000)) == 0) { pbr.volumeParam.ioNamePtr = 0; pbr.volumeParam.ioVolIndex = 0; - pbr.volumeParam.ioVRefNum = BigEndianValue(BigEndianValue(evt.message) & 0xFFFF); + pbr.volumeParam.ioVRefNum = CW(CL(evt.message) & 0xFFFF); err = PBGetVInfo(&pbr, FALSE); gui_assert(err == noErr); if (err == noErr) { adjustdrivebutton(dp); - SFSaveDisk = BigEndianValue(-BigEndianValue(pbr.volumeParam.ioVRefNum)); + SFSaveDisk = CW(-CW(pbr.volumeParam.ioVRefNum)); CurDirStore = CLC(2); ihit = FAKEREDRAW; } } if (ihit == FAKEREDRAW) - realcd((DialogPeek) dp, BigEndianValue(CurDirStore)); + realcd((DialogPeek) dp, CL(CurDirStore)); } if (f.flavor != original_sf && dh.odh) ihit = ROMlib_CALLDHOOK(&f, -2, dp, dh); /* the mac does this */ diff --git a/src/stdmbdf.cpp b/src/stdmbdf.cpp index c9c011b2..59db13bf 100644 --- a/src/stdmbdf.cpp +++ b/src/stdmbdf.cpp @@ -31,7 +31,6 @@ namespace Executor { #include "apple.cmap" } using namespace Executor; -using namespace ByteSwap; enum { APPLE_CHAR = 0x14, INFINITY_CHAR = 0xB0 }; @@ -56,10 +55,10 @@ draw_menu_title (muelem *elt, menu_bar_color (&bar_color); menu_title_color (MI_ID (muhandle), &title_color); - dstr.top = BigEndianValue (hilite_p ? 1 : 0); - dstr.bottom = BigEndianValue (BigEndianValue (MBarHeight) - 1); + dstr.top = CW (hilite_p ? 1 : 0); + dstr.bottom = CW (CW (MBarHeight) - 1); dstr.left = elt->muleft; - dstr.right = last_menu_p ? BigEndianValue (muright) : elt[1].muleft; + dstr.right = last_menu_p ? CW (muright) : elt[1].muleft; RGBForeColor (hilite_p ? &bar_color : &title_color); RGBBackColor (hilite_p ? &title_color : &bar_color); @@ -69,7 +68,7 @@ draw_menu_title (muelem *elt, title = (char *) MI_DATA (muhandle); #if defined (COLOR_APPLE_MENU_ICON) - gd = BigEndianValue (MainDevice); + gd = CL (MainDevice); if (*title == 1 && title[1] == '\024' && PIXMAP_PIXEL_SIZE (GD_PMAP (gd)) > 2) @@ -77,7 +76,7 @@ draw_menu_title (muelem *elt, /* draw the color apple */ dstr = apple->bounds; OffsetRect (&dstr, - BigEndianValue (elt->muleft) + MENULEFT - 6, 1); + CW (elt->muleft) + MENULEFT - 6, 1); RGBForeColor (&ROMlib_black_rgb_color); RGBBackColor (&ROMlib_white_rgb_color); @@ -97,7 +96,7 @@ draw_menu_title (muelem *elt, RGBForeColor (&title_color); } PORT_TX_MODE_X (thePort) = srcCopy; - MoveTo (BigEndianValue (elt->muleft) + MENULEFT - 3, 14); + MoveTo (CW (elt->muleft) + MENULEFT - 3, 14); if (ROMlib_AppleChar && title[0] == 1 && title[1] == APPLE_CHAR) { title[1] = (char) ROMlib_AppleChar; @@ -150,10 +149,10 @@ realhilite (int16 offset, highstate h) Rect r; /* toggle the entire menu bar */ - mbar_height = BigEndianValue (MBarHeight); + mbar_height = CW (MBarHeight); r = PORT_RECT (MR (wmgr_port)); - r.bottom = BigEndianValue (mbar_height - 1); + r.bottom = CW (mbar_height - 1); if (h == HILITE) menu_title_color (0, &bar_color); @@ -164,15 +163,15 @@ realhilite (int16 offset, highstate h) EraseRect (&r); PenSize (1, 1); - MoveTo (BigEndianValue (r.left), mbar_height - 1); - LineTo (BigEndianValue (r.right) - 1, mbar_height - 1); + MoveTo (CW (r.left), mbar_height - 1); + LineTo (CW (r.right) - 1, mbar_height - 1); HLock (MR (MenuList)); menulistp = STARH (MENULIST); - mpend = menulistp->mulist + BigEndianValue (menulistp->muoff) / sizeof (muelem); + mpend = menulistp->mulist + CW (menulistp->muoff) / sizeof (muelem); for (mp = menulistp->mulist; mp != mpend; mp++) draw_menu_title (mp, mp == mpend - 1, - h == HILITE, BigEndianValue (menulistp->muright)); + h == HILITE, CW (menulistp->muright)); HUnlock (MR (MenuList)); } } @@ -187,7 +186,7 @@ mbdf_draw (int32 draw_p) Rect r; r = PORT_RECT (MR (wmgr_port)); - r.bottom = BigEndianValue (BigEndianValue (MBarHeight) - 1); + r.bottom = CW (CW (MBarHeight) - 1); ClipRect (&r); menu_bar_color (&bar_color); @@ -195,26 +194,26 @@ mbdf_draw (int32 draw_p) EraseRect (&r); PenSize (1, 1); - MoveTo (BigEndianValue (r.left), BigEndianValue (MBarHeight) - 1); - LineTo (BigEndianValue (r.right) - 1, BigEndianValue (MBarHeight) - 1); + MoveTo (CW (r.left), CW (MBarHeight) - 1); + LineTo (CW (r.right) - 1, CW (MBarHeight) - 1); if (draw_p == DRAWMENUBAR) { /* draw titles */ - r.bottom = BigEndianValue (BigEndianValue (r.bottom) - 1); + r.bottom = CW (CW (r.bottom) - 1); PORT_TX_FACE_X (MR (wmgr_port)) = (Style) CB (0); PORT_TX_FONT_X (MR (wmgr_port)) = SysFontFam; HLock (MR (MenuList)); menulistp = STARH (MENULIST); - mpend = menulistp->mulist + BigEndianValue (menulistp->muoff) / sizeof (muelem); + mpend = menulistp->mulist + CW (menulistp->muoff) / sizeof (muelem); for (mp = menulistp->mulist; mp != mpend; mp++) - draw_menu_title (mp, mp == mpend - 1, FALSE, BigEndianValue (menulistp->muright)); + draw_menu_title (mp, mp == mpend - 1, FALSE, CW (menulistp->muright)); HUnlock (MR (MenuList)); /* highlite title if necessary */ if (TheMenu) - realhilite (ROMlib_mentosix (BigEndianValue (TheMenu)), HILITE); + realhilite (ROMlib_mentosix (CW (TheMenu)), HILITE); /* set ClipRgn to full open */ ClipRect (&PORT_RECT (MR (wmgr_port))); @@ -246,9 +245,9 @@ A1(PRIVATE, LONGINT, hit, LONGINT, mousept) p.h = LoWord(mousept); p.v = HiWord(mousept); - if (p.v < BigEndianValue(MBarHeight)) { + if (p.v < CW(MBarHeight)) { mpend = HxX(MENULIST, mulist) + Hx(MENULIST, muoff) / sizeof(muelem); - for (mp = HxX(MENULIST, mulist); mp != mpend && BigEndianValue(mp->muleft) <= p.h; mp++) + for (mp = HxX(MENULIST, mulist); mp != mpend && CW(mp->muleft) <= p.h; mp++) ; if (mp == HxX(MENULIST, mulist) || p.h > Hx(MENULIST, muright)) /*-->*/ return NOTHITINMBAR; @@ -257,13 +256,13 @@ A1(PRIVATE, LONGINT, hit, LONGINT, mousept) } else { mbdfep = (mbdfentry *) STARH(MR (MBSaveLoc)); for (mbdfp = (mbdfentry *) - ((char *) mbdfep + BigEndianValue(((mbdfheader *)mbdfep)->lastMBSave)); + ((char *) mbdfep + CW(((mbdfheader *)mbdfep)->lastMBSave)); mbdfp != mbdfep && !PtInRect(p, &mbdfp->mbRectSave); mbdfp--) ; if (mbdfp == mbdfep) /*-->*/ return NOTHIT; else - /*-->*/ return BigEndianValue(mbdfp->mbMLOffset); + /*-->*/ return CW(mbdfp->mbMLOffset); } } @@ -291,18 +290,18 @@ A1(PRIVATE, void, calc, LONGINT, offset) HLock((Handle) mh); titsize = StringWidth(HxX(mh, menuData)) + SLOP; HUnlock((Handle) mh); - left = BigEndianValue(mp[-1].muleft) + titsize; + left = CW(mp[-1].muleft) + titsize; } - for (mep = (muelem *) ((char *)menulistp + BigEndianValue(menulistp->muoff)) + 1; + for (mep = (muelem *) ((char *)menulistp + CW(menulistp->muoff)) + 1; mp < mep ; mp++) { - mp->muleft = BigEndianValue(left); + mp->muleft = CW(left); mh = MR(mp->muhandle); HLock((Handle) mh); titsize = StringWidth(HxX(mh, menuData)) + SLOP; HUnlock((Handle) mh); left += titsize; } - menulistp->muright = BigEndianValue(left); + menulistp->muright = CW(left); HUnlock(MR (MenuList)); } @@ -345,7 +344,7 @@ A0(PRIVATE, void, height) FontInfo fi; GetFontInfo(&fi); - MBarHeight = BigEndianValue(BigEndianValue(fi.ascent) + BigEndianValue(fi.descent) + BigEndianValue(fi.leading) + 4); + MBarHeight = CW(CW(fi.ascent) + CW(fi.descent) + CW(fi.leading) + 4); } static void @@ -379,7 +378,7 @@ done:; \ int current_mb_save; current_mb_save = Hx (MBSAVELOC, lastMBSave) + sizeof (mbdfentry); - HxX (MBSAVELOC, lastMBSave) = BigEndianValue (current_mb_save); + HxX (MBSAVELOC, lastMBSave) = CW (current_mb_save); mep = (mbdfentry *) ((char *) STARH (MBSAVELOC) + current_mb_save); mep->mbRectSave = *rect; @@ -399,22 +398,22 @@ done:; \ FAIL; mep->mbMenuDir = CWC (MBRIGHTDIR); - mep->mbMLOffset = BigEndianValue (offset); + mep->mbMLOffset = CW (offset); mup = (muelem *) ((char *) STARH (MR (MenuList)) + offset); mep->mbMLHandle = mup->muhandle; mep->mbReserved = CLC (0); - save_rect.top = BigEndianValue (BigEndianValue (rect->top) - 1); - save_rect.left = BigEndianValue (BigEndianValue (rect->left) - 1); - save_rect.bottom = BigEndianValue (BigEndianValue (rect->bottom) + 2); - save_rect.right = BigEndianValue (BigEndianValue (rect->right) + 2); + save_rect.top = CW (CW (rect->top) - 1); + save_rect.left = CW (CW (rect->left) - 1); + save_rect.bottom = CW (CW (rect->bottom) + 2); + save_rect.right = CW (CW (rect->right) + 2); bounds = &PIXMAP_BOUNDS (save_pmh); *bounds = save_rect; /* long align the left boundary */ - bounds->left = BigEndianValue (BigEndianValue (save_rect.left) & ~31); - bounds->right = BigEndianValue (MIN (BigEndianValue (bounds->right), - BigEndianValue (PORT_BOUNDS(thePort).right))); + bounds->left = CW (CW (save_rect.left) & ~31); + bounds->right = CW (MIN (CW (bounds->right), + CW (PORT_BOUNDS(thePort).right))); height = RECT_HEIGHT (bounds); width = RECT_WIDTH (bounds); @@ -427,7 +426,7 @@ done:; \ pixmap_set_pixel_fields (STARH (save_pmh), gd_bpp); row_bytes = ((width * gd_bpp + 31) / 32) * 4; - PIXMAP_SET_ROWBYTES_X (save_pmh, BigEndianValue (row_bytes)); + PIXMAP_SET_ROWBYTES_X (save_pmh, CW (row_bytes)); p = NewPtr (height * row_bytes); if (MemErr != CWC (noErr)) @@ -464,14 +463,14 @@ done:; \ PenNormal (); RGBForeColor (&ROMlib_black_rgb_color); - save_rect.right = BigEndianValue (BigEndianValue (save_rect.right) - 1); - save_rect.bottom = BigEndianValue (BigEndianValue (save_rect.bottom) - 1); + save_rect.right = CW (CW (save_rect.right) - 1); + save_rect.bottom = CW (CW (save_rect.bottom) - 1); FrameRect (&save_rect); - MoveTo (BigEndianValue (save_rect.right), BigEndianValue (save_rect.top) + 3); - LineTo (BigEndianValue (save_rect.right), BigEndianValue (save_rect.bottom)); - MoveTo (BigEndianValue (save_rect.left) + 3, BigEndianValue (save_rect.bottom)); - LineTo (BigEndianValue (save_rect.right), BigEndianValue (save_rect.bottom)); + MoveTo (CW (save_rect.right), CW (save_rect.top) + 3); + LineTo (CW (save_rect.right), CW (save_rect.bottom)); + MoveTo (CW (save_rect.left) + 3, CW (save_rect.bottom)); + LineTo (CW (save_rect.right), CW (save_rect.bottom)); ClipRect (rect); } @@ -489,10 +488,10 @@ restore (void) mep = (mbdfentry *) ((char *) STARH (MBSAVELOC) + Hx (MBSAVELOC, lastMBSave)); save_rect = mep->mbRectSave; - save_rect.top = BigEndianValue (BigEndianValue (save_rect.top) - 1); - save_rect.left = BigEndianValue (BigEndianValue (save_rect.left) - 1); - save_rect.bottom = BigEndianValue (BigEndianValue (save_rect.bottom) + 2); - save_rect.right = BigEndianValue (BigEndianValue (save_rect.right) + 2); + save_rect.top = CW (CW (save_rect.top) - 1); + save_rect.left = CW (CW (save_rect.left) - 1); + save_rect.bottom = CW (CW (save_rect.bottom) + 2); + save_rect.right = CW (CW (save_rect.right) + 2); save_pmh = (PixMapHandle) MR (mep->mbBitsSave); @@ -521,7 +520,7 @@ restore (void) mep->mbBitsSave = NULL; HxX (MBSAVELOC, lastMBSave) - = BigEndianValue (Hx (MBSAVELOC, lastMBSave) - sizeof (mbdfentry)); + = CW (Hx (MBSAVELOC, lastMBSave) - sizeof (mbdfentry)); }); } @@ -540,20 +539,20 @@ A1(PRIVATE, Rect *, getrect, LONGINT, offset) CalcMenuSize(mh); if (hiword) { /* hierarchical */ /* note 7 and 5 below are guesses */ - r.top = BigEndianValue(MAX(Hx(MBSAVELOC, mbItemRect.top), BigEndianValue(MBarHeight)+7)); - r.left = BigEndianValue(Hx(MBSAVELOC, mbItemRect.right) - 5); - r.bottom = BigEndianValue(BigEndianValue(r.top) + Hx(mh, menuHeight)); - r.right = BigEndianValue(BigEndianValue(r.left) + Hx(mh, menuWidth)); + r.top = CW(MAX(Hx(MBSAVELOC, mbItemRect.top), CW(MBarHeight)+7)); + r.left = CW(Hx(MBSAVELOC, mbItemRect.right) - 5); + r.bottom = CW(CW(r.top) + Hx(mh, menuHeight)); + r.right = CW(CW(r.left) + Hx(mh, menuWidth)); } else { /* regular */ r.top = MBarHeight; r.left = mp->muleft; - r.bottom = BigEndianValue(BigEndianValue(r.top) + Hx(mh, menuHeight)); - r.right = BigEndianValue(BigEndianValue(r.left) + Hx(mh, menuWidth)); + r.bottom = CW(CW(r.top) + Hx(mh, menuHeight)); + r.right = CW(CW(r.left) + Hx(mh, menuWidth)); } - dh = BigEndianValue(screenBitsX.bounds.right) - 10 - BigEndianValue(r.right); + dh = CW(screenBitsX.bounds.right) - 10 - CW(r.right); if (dh > 0) dh = 0; - dv = BigEndianValue(screenBitsX.bounds.bottom) - 10 - BigEndianValue(r.bottom); + dv = CW(screenBitsX.bounds.bottom) - 10 - CW(r.bottom); if (dv > 0) dv = 0; OffsetRect(&r, dh, dv); @@ -566,8 +565,8 @@ A1(PRIVATE, mbdfentry *, offtomep, LONGINT, offset) mbdfep = (mbdfentry *) STARH(MR (MBSaveLoc)); for (mbdfp = (mbdfentry *) - ((char *) mbdfep + BigEndianValue(((mbdfheader *)mbdfep)->lastMBSave)); - mbdfp != mbdfep && BigEndianValue(mbdfp->mbMLOffset) != offset; mbdfp--) + ((char *) mbdfep + CW(((mbdfheader *)mbdfep)->lastMBSave)); + mbdfp != mbdfep && CW(mbdfp->mbMLOffset) != offset; mbdfp--) ; return mbdfp == mbdfep ? 0 : mbdfp; } @@ -594,7 +593,7 @@ A1(PRIVATE, RgnHandle, menurgn, RgnHandle, rgn) { Rect r; - if (BigEndianValue(MBarHeight) <= 0) + if (CW(MBarHeight) <= 0) height(); r = PORT_RECT (MR (wmgr_port)); r.bottom = MBarHeight; diff --git a/src/stdmdef.cpp b/src/stdmdef.cpp index 7d1ad03b..e0b04666 100644 --- a/src/stdmdef.cpp +++ b/src/stdmdef.cpp @@ -25,14 +25,13 @@ char ROMlib_rcsid_stdmdef[] = #include "rsys/custom.h" using namespace Executor; -using namespace ByteSwap; static Rect *current_menu_rect; #define TOP_ARROW_P() \ - (BigEndianValue (TopMenuItem) < BigEndianValue (current_menu_rect->top)) + (CW (TopMenuItem) < CW (current_menu_rect->top)) #define BOTTOM_ARROW_P() \ - (BigEndianValue (AtMenuBottom) > BigEndianValue (current_menu_rect->bottom)) + (CW (AtMenuBottom) > CW (current_menu_rect->bottom)) static int16 checksize, cloversize, lineheight, ascent; @@ -161,7 +160,7 @@ size_menu (MenuHandle mh, tablePtr tablep) width = height = actual_height = 0; /* the 32 is just a guess */ - max_height = BigEndianValue (screenBitsX.bounds.bottom) - 32; + max_height = CW (screenBitsX.bounds.bottom) - 32; for (tp = tablep->entry, ep = tp + tablep->count; tp != ep; tp++) { icon_info_t icon_info; @@ -185,8 +184,8 @@ size_menu (MenuHandle mh, tablePtr tablep) width = w; } TextFace(0); - HxX (mh, menuWidth) = BigEndianValue (width); - HxX (mh, menuHeight) = BigEndianValue (actual_height); + HxX (mh, menuWidth) = CW (width); + HxX (mh, menuHeight) = CW (actual_height); } static void @@ -214,13 +213,13 @@ draw_right_arrow (Rect *menu_rect, MenuHandle mh, int item, int invert_p) arrow_bitmap.rowBytes = CWC (1); SetRect (&arrow_bitmap.bounds, 0, 0, /* right, bottom */ 6, 11); - y = BigEndianValue (menu_rect->top) + 2; - x = BigEndianValue (menu_rect->right) - 14; + y = CW (menu_rect->top) + 2; + x = CW (menu_rect->right) - 14; - dst_rect.top = BigEndianValue (y); - dst_rect.left = BigEndianValue (x); - dst_rect.bottom = BigEndianValue (y + 11); - dst_rect.right = BigEndianValue (x + 6); + dst_rect.top = CW (y); + dst_rect.left = CW (x); + dst_rect.bottom = CW (y + 11); + dst_rect.right = CW (x + 6); CopyBits (&arrow_bitmap, PORT_BITS_FOR_COPY (thePort), &arrow_bitmap.bounds, &dst_rect, srcCopy, NULL); @@ -258,7 +257,7 @@ draw_arrow (Rect *menu_rect, MenuHandle mh, arrowtype arrdir) arrow_bitmap.rowBytes = CWC (2); SetRect (&arrow_bitmap.bounds, 0, 0, /* right, bottom */ 11, 6); - top_of_item = BigEndianValue (menu_rect->top); + top_of_item = CW (menu_rect->top); } else if (arrdir == downarrow) { @@ -266,7 +265,7 @@ draw_arrow (Rect *menu_rect, MenuHandle mh, arrowtype arrdir) arrow_bitmap.rowBytes = CWC (2); SetRect (&arrow_bitmap.bounds, 0, 0, /* right, bottom */ 11, 6); - top_of_item = BigEndianValue (menu_rect->bottom) - lineheight; + top_of_item = CW (menu_rect->bottom) - lineheight; } else gui_abort (); @@ -279,14 +278,14 @@ draw_arrow (Rect *menu_rect, MenuHandle mh, arrowtype arrdir) erase_rect.left = menu_rect->left; erase_rect.right = menu_rect->right; - erase_rect.top = BigEndianValue (top_of_item); - erase_rect.bottom = BigEndianValue (top_of_item + lineheight); + erase_rect.top = CW (top_of_item); + erase_rect.bottom = CW (top_of_item + lineheight); EraseRect (&erase_rect); - dst_rect.top = BigEndianValue (top_of_item + 5); - dst_rect.left = BigEndianValue (BigEndianValue (menu_rect->left) + checksize); - dst_rect.bottom = BigEndianValue (top_of_item + 5 + /* arrows are `6' tall */ 6); - dst_rect.right = BigEndianValue (BigEndianValue (menu_rect->left) + checksize + dst_rect.top = CW (top_of_item + 5); + dst_rect.left = CW (CW (menu_rect->left) + checksize); + dst_rect.bottom = CW (top_of_item + 5 + /* arrows are `6' tall */ 6); + dst_rect.right = CW (CW (menu_rect->left) + checksize + /* arrows are `11' wide */ 11); CopyBits (&arrow_bitmap, PORT_BITS_FOR_COPY (thePort), &arrow_bitmap.bounds, &dst_rect, srcCopy, NULL); @@ -307,15 +306,15 @@ A3(PRIVATE, void, erasearrow, Rect *, rp, tablePtr, tablep, BOOLEAN, upordown) Rect r; INTEGER x, y; - x = BigEndianValue(rp->left) + checksize; + x = CW(rp->left) + checksize; if (upordown == UP) - y = BigEndianValue(rp->top) + 5; + y = CW(rp->top) + 5; else - y = BigEndianValue(rp->bottom) - lineheight + 5; - r.top = BigEndianValue(y); - r.left = BigEndianValue(x); - r.bottom = BigEndianValue(y+6); - r.right = BigEndianValue(x+11); + y = CW(rp->bottom) - lineheight + 5; + r.top = CW(y); + r.left = CW(x); + r.bottom = CW(y+6); + r.right = CW(x+11); EraseRect(&r); } @@ -342,8 +341,8 @@ draw_item (Rect *rp, struct table::tableentry *tp, int32 bit, int item, MenuHand active_p = ! ((MI_ENABLE_FLAGS (mh) & bit) != bit || divider_p); - top = tp[0].top + BigEndianValue (TopMenuItem); - bottom = tp[1].top + BigEndianValue (TopMenuItem); + top = tp[0].top + CW (TopMenuItem); + bottom = tp[1].top + CW (TopMenuItem); v = top + ascent; @@ -392,8 +391,8 @@ draw_item (Rect *rp, struct table::tableentry *tp, int32 bit, int item, MenuHand } RGBBackColor (invert_p ? &title_color : &bk_color); - rtmp.top = BigEndianValue (top); - rtmp.bottom = BigEndianValue (bottom); + rtmp.top = CW (top); + rtmp.bottom = CW (bottom); rtmp.left = rp->left; rtmp.right = rp->right; @@ -404,7 +403,7 @@ draw_item (Rect *rp, struct table::tableentry *tp, int32 bit, int item, MenuHand && !draw_right_arrow_p) { RGBForeColor (invert_p ? &bk_color : &mark_color); - MoveTo (BigEndianValue (rp->left) + 2, v); + MoveTo (CW (rp->left) + 2, v); DrawChar(tp->options->mmarker); } @@ -414,10 +413,10 @@ draw_item (Rect *rp, struct table::tableentry *tp, int32 bit, int item, MenuHand /* draw the icon */ if (draw_icon_p) { - rtmp.top = BigEndianValue (top + ICON_PAD / 2); - rtmp.left = BigEndianValue (BigEndianValue (rp->left) + checksize + 2); - rtmp.bottom = BigEndianValue (BigEndianValue (rtmp.top) + (icon_info.height - ICON_PAD)); - rtmp.right = BigEndianValue (BigEndianValue (rtmp.left) + (icon_info.width - ICON_PAD)); + rtmp.top = CW (top + ICON_PAD / 2); + rtmp.left = CW (CW (rp->left) + checksize + 2); + rtmp.bottom = CW (CW (rtmp.top) + (icon_info.height - ICON_PAD)); + rtmp.right = CW (CW (rtmp.left) + (icon_info.width - ICON_PAD)); if (icon_info.color_icon_p) PlotCIcon (&rtmp, (CIconHandle) icon_info.icon); @@ -428,22 +427,22 @@ draw_item (Rect *rp, struct table::tableentry *tp, int32 bit, int item, MenuHand if (divider_p) { RGBForeColor (&title_color); - MoveTo (BigEndianValue (rp->left), v - 4); - LineTo (BigEndianValue (rp->right), v - 4); + MoveTo (CW (rp->left), v - 4); + LineTo (CW (rp->right), v - 4); } else { RGBForeColor (invert_p ? &bk_color : &title_color); - MoveTo (BigEndianValue (rp->left) + icon_info.width + checksize + 2, v); + MoveTo (CW (rp->left) + icon_info.width + checksize + 2, v); TextFace (tp->options->mstyle); DrawString (tp->name); TextFace (0); } rtmp.left = rp->left; rtmp.right = rp->right; - rtmp.top = BigEndianValue (top); - rtmp.bottom = BigEndianValue (bottom); + rtmp.top = CW (top); + rtmp.bottom = CW (bottom); if ((iskeyequiv(tp) || draw_right_arrow_p) && !divider_p) { @@ -458,7 +457,7 @@ draw_item (Rect *rp, struct table::tableentry *tp, int32 bit, int item, MenuHand RGBForeColor (invert_p ? &bk_color : &command_color); - new_left = BigEndianValue(rp->right) - (2 * cloversize + 1); + new_left = CW(rp->right) - (2 * cloversize + 1); MoveTo (new_left, v); DrawChar (commandMark); DrawChar (tp->options->mkeyeq); @@ -467,7 +466,7 @@ draw_item (Rect *rp, struct table::tableentry *tp, int32 bit, int item, MenuHand Rect r; r = rtmp; - r.left = BigEndianValue (new_left); + r.left = CW (new_left); PenMode(notPatBic); PenPat(gray); PaintRect(&r); @@ -498,13 +497,13 @@ draw_menu (MenuHandle mh, Rect *rp, tablePtr tablep) struct table::tableentry *tp, *ep; int16 topcutoff, bottomcutoff; - if (BigEndianValue (TopMenuItem) < BigEndianValue(rp->top)) - topcutoff = BigEndianValue(rp->top) - BigEndianValue (TopMenuItem) + lineheight; + if (CW (TopMenuItem) < CW(rp->top)) + topcutoff = CW(rp->top) - CW (TopMenuItem) + lineheight; else topcutoff = 0; - if (BigEndianValue (AtMenuBottom) > BigEndianValue (rp->bottom)) - bottomcutoff = BigEndianValue (rp->bottom) - BigEndianValue (TopMenuItem) - lineheight; + if (CW (AtMenuBottom) > CW (rp->bottom)) + bottomcutoff = CW (rp->bottom) - CW (TopMenuItem) - lineheight; else bottomcutoff = 32767; @@ -520,9 +519,9 @@ draw_menu (MenuHandle mh, Rect *rp, tablePtr tablep) bit = 1 << nitem; draw_item (rp, tp, bit, nitem, mh, FALSE); } - if (BigEndianValue(rp->top) > BigEndianValue (TopMenuItem)) + if (CW(rp->top) > CW (TopMenuItem)) draw_arrow (rp, mh, uparrow); - if (BigEndianValue (rp->bottom) < BigEndianValue(AtMenuBottom)) + if (CW (rp->bottom) < CW(AtMenuBottom)) draw_arrow (rp, mh, downarrow); HxX (MBSAVELOC, mbUglyScroll) = CWC (0); } @@ -535,8 +534,8 @@ fliprect (Rect *rp, int16 i, tablePtr tablep, Rect *flipr) tp = &tablep->entry[i-1]; flipr->left = rp->left; flipr->right = rp->right; - flipr->top = BigEndianValue(tp[0].top + BigEndianValue(TopMenuItem)); - flipr->bottom = BigEndianValue(tp[1].top + BigEndianValue(TopMenuItem)); + flipr->top = CW(tp[0].top + CW(TopMenuItem)); + flipr->bottom = CW(tp[1].top + CW(TopMenuItem)); } static void @@ -551,9 +550,9 @@ doupdown (MenuHandle mh, Rect *rp, tablePtr tablep, BOOLEAN upordown, if (*itemp) { - /* flip (rp, BigEndianValue (*itemp), tablep); */ - draw_item (rp, &tablep->entry[BigEndianValue (*itemp) - 1], 1 << BigEndianValue (*itemp), - BigEndianValue (*itemp), mh, FALSE); + /* flip (rp, CW (*itemp), tablep); */ + draw_item (rp, &tablep->entry[CW (*itemp) - 1], 1 << CW (*itemp), + CW (*itemp), mh, FALSE); *itemp = CWC (0); } if (HxX (MBSAVELOC, mbUglyScroll)) @@ -561,43 +560,43 @@ doupdown (MenuHandle mh, Rect *rp, tablePtr tablep, BOOLEAN upordown, /* don't sroll the scroll arrows */ scrollr = *rp; if (TOP_ARROW_P ()) - scrollr.top = BigEndianValue (BigEndianValue (scrollr.top) + lineheight); + scrollr.top = CW (CW (scrollr.top) + lineheight); if (BOTTOM_ARROW_P ()) - scrollr.bottom = BigEndianValue (BigEndianValue (scrollr.bottom) - lineheight); + scrollr.bottom = CW (CW (scrollr.bottom) - lineheight); updater = *rp; if (upordown == UP) { - offset = MIN (lineheight, BigEndianValue (rp->top) - BigEndianValue (TopMenuItem)); - TopMenuItem = BigEndianValue (BigEndianValue (TopMenuItem) + offset); - AtMenuBottom = BigEndianValue (BigEndianValue (AtMenuBottom) + offset); + offset = MIN (lineheight, CW (rp->top) - CW (TopMenuItem)); + TopMenuItem = CW (CW (TopMenuItem) + offset); + AtMenuBottom = CW (CW (AtMenuBottom) + offset); if (TOP_ARROW_P ()) { updater.top = scrollr.top; - updater.bottom = BigEndianValue (BigEndianValue (updater.top) + lineheight); + updater.bottom = CW (CW (updater.top) + lineheight); } else { updater.top = rp->top; - updater.bottom = BigEndianValue (BigEndianValue (updater.top) + 2 * lineheight); + updater.bottom = CW (CW (updater.top) + 2 * lineheight); erasearrow (rp, tablep, UP); } } else { - offset = MAX (-lineheight, BigEndianValue (rp->bottom) - BigEndianValue (AtMenuBottom)); - TopMenuItem = BigEndianValue (BigEndianValue (TopMenuItem) + offset); - AtMenuBottom = BigEndianValue (BigEndianValue (AtMenuBottom) + offset); + offset = MAX (-lineheight, CW (rp->bottom) - CW (AtMenuBottom)); + TopMenuItem = CW (CW (TopMenuItem) + offset); + AtMenuBottom = CW (CW (AtMenuBottom) + offset); if (BOTTOM_ARROW_P ()) { updater.bottom = scrollr.bottom; - updater.top = BigEndianValue (BigEndianValue (updater.bottom) - lineheight); + updater.top = CW (CW (updater.bottom) - lineheight); } else { updater.bottom = rp->bottom; - updater.top = BigEndianValue (BigEndianValue (updater.bottom) - 2 * lineheight); + updater.top = CW (CW (updater.bottom) - 2 * lineheight); erasearrow (rp, tablep, DOWN); } } @@ -606,9 +605,9 @@ doupdown (MenuHandle mh, Rect *rp, tablePtr tablep, BOOLEAN upordown, DisposeRgn (updatergn); ClipRect (&updater); for (tp = tablep->entry, ep = tp + tablep->count, bit = 1 << 1; - tp[0].top < BigEndianValue(updater.bottom) - BigEndianValue(TopMenuItem) && tp != ep; + tp[0].top < CW(updater.bottom) - CW(TopMenuItem) && tp != ep; tp++, bit <<= 1) - if (tp[1].top > BigEndianValue (updater.top) - BigEndianValue (TopMenuItem)) + if (tp[1].top > CW (updater.top) - CW (TopMenuItem)) draw_item (rp, tp, tp - tablep->entry + 1, bit, mh, FALSE); rtmp.top = rtmp.left = CWC(-32767); rtmp.bottom = rtmp.right = CWC(32767); @@ -618,12 +617,12 @@ doupdown (MenuHandle mh, Rect *rp, tablePtr tablep, BOOLEAN upordown, HxX(MBSAVELOC, mbUglyScroll) = CWC (1); if (upordown == DOWN) { - if (BigEndianValue(AtMenuBottom) >= BigEndianValue (rp->bottom)) + if (CW(AtMenuBottom) >= CW (rp->bottom)) draw_arrow (rp, mh, downarrow); } else { - if (BigEndianValue(TopMenuItem) <= BigEndianValue (rp->top)) + if (CW(TopMenuItem) <= CW (rp->top)) draw_arrow (rp, mh, uparrow); } } @@ -640,51 +639,51 @@ choose_menu (MenuHandle mh, Rect *rp, Point p, int16 *itemp, tablePtr tablep) valid_rect.left = rp->left; valid_rect.right = rp->right; - valid_rect.top = BigEndianValue (MAX (BigEndianValue (rp->top), BigEndianValue (TopMenuItem))); - valid_rect.bottom = BigEndianValue (MIN (BigEndianValue (rp->bottom), BigEndianValue (AtMenuBottom))); + valid_rect.top = CW (MAX (CW (rp->top), CW (TopMenuItem))); + valid_rect.bottom = CW (MIN (CW (rp->bottom), CW (AtMenuBottom))); clip_rect.left = rp->left; clip_rect.right = rp->right; - clip_rect.top = BigEndianValue (TOP_ARROW_P () ? BigEndianValue (rp->top) + lineheight - : BigEndianValue (rp->top)); - clip_rect.bottom = BigEndianValue (BOTTOM_ARROW_P () ? BigEndianValue (rp->bottom) - lineheight - : BigEndianValue (rp->bottom)); + clip_rect.top = CW (TOP_ARROW_P () ? CW (rp->top) + lineheight + : CW (rp->top)); + clip_rect.bottom = CW (BOTTOM_ARROW_P () ? CW (rp->bottom) - lineheight + : CW (rp->bottom)); ClipRect (&clip_rect); - if (BigEndianValue (*itemp) < 0) + if (CW (*itemp) < 0) *itemp = CWC (0); if (PtInRect (p, &valid_rect)) { if (BOTTOM_ARROW_P () - && p.v >= BigEndianValue(rp->bottom) - lineheight) + && p.v >= CW(rp->bottom) - lineheight) doupdown (mh, rp, tablep, DOWN, itemp); else if (TOP_ARROW_P () - && p.v < BigEndianValue(rp->top) + lineheight) + && p.v < CW(rp->top) + lineheight) doupdown (mh, rp, tablep, UP, itemp); else { int32 bit; for (tp = tablep->entry, ep = tp + tablep->count; - tp != ep && p.v >= tp->top + BigEndianValue (TopMenuItem); + tp != ep && p.v >= tp->top + CW (TopMenuItem); tp++) ; nitem = tp - tablep->entry; - MenuDisable = BigEndianValue ((menu_id<<16) | (uint16) nitem); + MenuDisable = CL ((menu_id<<16) | (uint16) nitem); bit = (1 << nitem) | 1; if ((MI_ENABLE_FLAGS (mh) & bit) != bit || (tp[-1].name[0] && tp[-1].name[1] == '-')) nitem = 0; - if (BigEndianValue (*itemp) != nitem) + if (CW (*itemp) != nitem) { if (*itemp) /* redraw this guy normally */ - draw_item (rp, &tablep->entry[BigEndianValue (*itemp) - 1], 1 << BigEndianValue (*itemp), - BigEndianValue (*itemp), mh, FALSE); + draw_item (rp, &tablep->entry[CW (*itemp) - 1], 1 << CW (*itemp), + CW (*itemp), mh, FALSE); if (nitem) draw_item (rp, &tablep->entry[nitem - 1], 1 << nitem, nitem, mh, TRUE); - *itemp = BigEndianValue (nitem); + *itemp = CW (nitem); } if (nitem) fliprect (rp, nitem, tablep, &HxX(MBSAVELOC, mbItemRect)); @@ -692,7 +691,7 @@ choose_menu (MenuHandle mh, Rect *rp, Point p, int16 *itemp, tablePtr tablep) } else if (*itemp) { - nitem = BigEndianValue (*itemp); + nitem = CW (*itemp); draw_item (rp, &tablep->entry[nitem - 1], 1 << nitem, nitem, mh, FALSE); *itemp = CWC (0); } @@ -709,22 +708,22 @@ A5 (PRIVATE, void, popuprect, MenuHandle, mh, Rect *, rp, Point, p, if (Hx(mh, menuWidth) == -1 || Hx(mh, menuHeight) == -1) CalcMenuSize(mh); - rp->top = BigEndianValue (p.v - tablep->entry[BigEndianValue (*itemp) - 1].top); - rp->left = BigEndianValue (p.h); - rp->right = BigEndianValue (BigEndianValue (rp->left) + Hx (mh, menuWidth)); + rp->top = CW (p.v - tablep->entry[CW (*itemp) - 1].top); + rp->left = CW (p.h); + rp->right = CW (CW (rp->left) + Hx (mh, menuWidth)); *itemp = rp->top; - for (tp = tablep->entry; BigEndianValue(rp->top) < BigEndianValue(MBarHeight); tp++) - rp->top = BigEndianValue(BigEndianValue(rp->top) + (tp[1].top - tp[0].top)); + for (tp = tablep->entry; CW(rp->top) < CW(MBarHeight); tp++) + rp->top = CW(CW(rp->top) + (tp[1].top - tp[0].top)); - rp->bottom = BigEndianValue(BigEndianValue(rp->top) + Hx(mh, menuHeight)); + rp->bottom = CW(CW(rp->top) + Hx(mh, menuHeight)); - vmax = BigEndianValue (screenBitsX.bounds.bottom) - 2; /* subtract 2 for frame */ - for (tp = tablep->entry + tablep->count - 1; BigEndianValue(rp->bottom) > vmax; --tp) - rp->bottom = BigEndianValue(BigEndianValue(rp->bottom) - (tp[1].top - tp[0].top)); - rp->top = BigEndianValue(BigEndianValue(rp->bottom) - Hx(mh, menuHeight)); - for (tp = tablep->entry; BigEndianValue(rp->top) < BigEndianValue(MBarHeight); tp++) - rp->top = BigEndianValue(BigEndianValue(rp->top) + (tp[1].top - tp[0].top)); + vmax = CW (screenBitsX.bounds.bottom) - 2; /* subtract 2 for frame */ + for (tp = tablep->entry + tablep->count - 1; CW(rp->bottom) > vmax; --tp) + rp->bottom = CW(CW(rp->bottom) - (tp[1].top - tp[0].top)); + rp->top = CW(CW(rp->bottom) - Hx(mh, menuHeight)); + for (tp = tablep->entry; CW(rp->top) < CW(MBarHeight); tp++) + rp->top = CW(CW(rp->top) + (tp[1].top - tp[0].top)); } @@ -754,8 +753,8 @@ P5(PUBLIC, pascal void, mdef0, INTEGER, mess, MenuHandle, mh, Rect *, rp, GetFontInfo(&fi); checksize = CharWidth(checkMark) + 1; /* used to use widMax - 1 here */ - lineheight = BigEndianValue(fi.ascent) + BigEndianValue(fi.descent) + BigEndianValue(fi.leading); - ascent = BigEndianValue(fi.ascent); + lineheight = CW(fi.ascent) + CW(fi.descent) + CW(fi.leading); + ascent = CW(fi.ascent); cloversize = CharWidth(commandMark); for (sp = (char *) STARH(mh) + SIZEOFMINFO + Hx(mh, menuData[0]), count = 0; @@ -782,7 +781,7 @@ P5(PUBLIC, pascal void, mdef0, INTEGER, mess, MenuHandle, mh, Rect *, rp, v += icon_info.height ? MAX (icon_info.height, lineheight) : lineheight; } tabp->top = v; - AtMenuBottom = BigEndianValue(BigEndianValue(TopMenuItem) + v); + AtMenuBottom = CW(CW(TopMenuItem) + v); switch (mess) { diff --git a/src/suffix_maps.c b/src/suffix_maps.c deleted file mode 100644 index ad7bae7b..00000000 --- a/src/suffix_maps.c +++ /dev/null @@ -1,251 +0,0 @@ -/* Copyright 2000 by Abacus Research and - * Development, Inc. All rights reserved. - */ - -#if !defined (OMIT_RCSID_STRINGS) -char ROMlib_rcsid_suffix_maps[] = - "$Id: suffix_maps.c 63 2004-12-24 18:19:43Z ctm $"; -#endif - -#include "rsys/common.h" - -#include "rsys/suffix_maps.h" -#include "rsys/file.h" - -#include - -/* - * This file contains the routines needed to create mappings from file - * suffixes to (Creator, Type) pairs. When a file is created with a suffix - * that is in the list, the normal % file won't be created. When the file's - * creator and type is queried, the creator and type from the list will be - * read. - */ - -typedef struct suffix_entry -{ - char *suffix; - uint32 creator; - uint32 type; - const char *application; - struct suffix_entry *next; -} -suffix_entry_t; - -PRIVATE suffix_entry_t *suffix_head; - -PRIVATE boolean_t -str_to_hex (const char *str, uint32 *valp) -{ - boolean_t retval; - int len; - - len = strlen (str); - retval = (str[0] == '0' && - (str[1] == 'x' || str[1] == 'X') && - len >= 3 && - len <= 10); - - if (retval) - { - uint32 val; - - val = 0; - for (str += 2; retval && *str; ++str) - if (isxdigit (*str)) - val = (val << 4) | ROMlib_fromhex (*str); - else - retval = FALSE; - *valp = val; - } - return retval; -} - -PUBLIC void -ROMlib_add_suffix_quad (const char *suffixp, const char *creator_hexp, - const char *type_hexp, const char *applicationp) -{ - uint32 creator; - uint32 type; - - if (str_to_hex (creator_hexp, &creator) && - str_to_hex (type_hexp, &type)) - { - suffix_entry_t *new; - - new = malloc (sizeof *new); - if (new) - { - new->suffix = strdup (suffixp); - if (!new->suffix) - free (new); - else - { - new->creator = creator; - new->type = type; - new->application = strdup (applicationp); - new->next = suffix_head; - suffix_head = new; - } - } - } -} - -PRIVATE suffix_entry_t ** -find_suffixpp (const char *suffix) -{ - suffix_entry_t **retval; - - retval = &suffix_head; - - while (*retval && strcasecmp ((*retval)->suffix, suffix) != 0) - retval = &(*retval)->next; - - return retval; -} - -/* - * Best match is (creator, 'APPL') - * next best is (creator, type) - * next best is (creator, X) - * worst is (X, type) - */ - -PUBLIC const char * -ROMlib_find_best_creator_type_match (uint32 creator, uint32 type) -{ - enum { no_match, type_match, creator_match, both_match, appl_match } match; - suffix_entry_t **pp; - const char *retval; - - retval = NULL; - for (match = no_match, pp = &suffix_head; - match != appl_match && *pp; - pp = &(*pp)->next) - { - if (*(*pp)->application) - { - if ((*pp)->creator == creator) - { - if ((*pp)->type == TICK("APPL")) - { - retval = (*pp)->application; - match = appl_match; - } - else if (match < both_match && (*pp)->type == type) - { - retval = (*pp)->application; - match = both_match; - } - else if (match < creator_match) - { - retval = (*pp)->application; - match = creator_match; - } - } - else if ((*pp)->type == type && match < type_match) - { - retval = (*pp)->application; - match = type_match; - } - } - } - - return retval; -} - -PRIVATE boolean_t -filename_suffix_match (const char *suffix, int len, const char *filename) -{ - boolean_t retval; - int suffix_len; - - suffix_len = strlen (suffix); - retval = (len >= suffix_len && - strncasecmp (suffix, filename + len - suffix_len, suffix_len) - == 0); - return retval; -} - -PRIVATE suffix_entry_t ** -find_filenamepp (int len, const char *filename) -{ - suffix_entry_t **retval; - - retval = &suffix_head; - - while (*retval && !filename_suffix_match ((*retval)->suffix, len, filename)) - retval = &(*retval)->next; - - return retval; -} - -PUBLIC boolean_t -ROMlib_creator_and_type_from_suffix (const char *suffix, uint32 *creatorp, - uint32 *typep) -{ - boolean_t retval; - suffix_entry_t **pp; - - pp = find_suffixpp (suffix); - if (!*pp) - retval = FALSE; - else - { - retval = TRUE; - if (creatorp) - *creatorp = (*pp)->creator; - if (typep) - *typep = (*pp)->type; - } - return retval; -} - -PUBLIC boolean_t -ROMlib_creator_and_type_from_filename (int len, const char *filename, - uint32 *creatorp, uint32 *typep) -{ - boolean_t retval; - suffix_entry_t **pp; - - pp = find_filenamepp (len, filename); - if (!*pp) - retval = FALSE; - else - { - retval = TRUE; - if (creatorp) - *creatorp = (*pp)->creator; - if (typep) - *typep = (*pp)->type; - } - return retval; -} - -PRIVATE void -release_entry (suffix_entry_t *to_release) -{ - free (to_release->suffix); - free (to_release); -} - -PUBLIC boolean_t -ROMlib_delete_suffix (const char *suffix) -{ - boolean_t retval; - suffix_entry_t **pp; - - pp = find_suffixpp (suffix); - if (!*pp) - retval = FALSE; - else - { - suffix_entry_t *to_release; - - retval = TRUE; - to_release = *pp; - *pp = (*pp)->next; - release_entry (to_release); - } - return retval; -} diff --git a/src/syserr.cpp b/src/syserr.cpp index cbaf6a55..f00f3435 100644 --- a/src/syserr.cpp +++ b/src/syserr.cpp @@ -34,7 +34,6 @@ char ROMlib_rcsid_syserr[] = #include "rsys/syserr.h" using namespace Executor; -using namespace ByteSwap; PRIVATE myalerttab_t myalerttab = { CWC(8), @@ -129,10 +128,10 @@ A1(PRIVATE, INTEGER *, findid, INTEGER, id) int i; INTEGER *ip; - for (i = BigEndianValue(*(INTEGER *) MR(DSAlertTab)), + for (i = CW(*(INTEGER *) MR(DSAlertTab)), ip = (INTEGER *) MR(DSAlertTab) + 1; - i > 0 && BigEndianValue(*ip) != id; - --i, ip = (INTEGER *) ((char *) ip + BigEndianValue(ip[1]) + 2 * sizeof(INTEGER))) + i > 0 && CW(*ip) != id; + --i, ip = (INTEGER *) ((char *) ip + CW(ip[1]) + 2 * sizeof(INTEGER))) ; return i > 0 ? ip : (INTEGER *) 0; } @@ -143,7 +142,7 @@ A3(PRIVATE, void, drawtextstring, INTEGER, id, INTEGER, offsetx, struct tdef *tp; if (id && (tp = (struct tdef *) findid(id))) { - MoveTo(BigEndianValue(tp->loc.h) + offsetx, BigEndianValue(tp->loc.v) + offsety); + MoveTo(CW(tp->loc.h) + offsetx, CW(tp->loc.v) + offsety); DrawText_c_string (tp->text); } } @@ -195,22 +194,22 @@ A4(PRIVATE, void, dobuttons, INTEGER, id, INTEGER, offsetx, */ C_OffsetRect (&bp->buts[i].butloc, offsetx, offsety); - if ((sp = (struct sdef *)findid(BigEndianValue(bp->buts[i].butstrid)))) { + if ((sp = (struct sdef *)findid(CW(bp->buts[i].butstrid)))) { if (demo_button_p && sp->text[0] == 'O' && sp->text[1] == 'K') textp = "Demo"; else textp = sp->text; tcnt = strlen(textp); twid = TextWidth((Ptr) textp, 0, tcnt); - MoveTo((BigEndianValue(bp->buts[i].butloc.left) + - BigEndianValue(bp->buts[i].butloc.right) - twid) / 2, - (BigEndianValue(bp->buts[i].butloc.top) + - BigEndianValue(bp->buts[i].butloc.bottom)) / 2 + 4); + MoveTo((CW(bp->buts[i].butloc.left) + + CW(bp->buts[i].butloc.right) - twid) / 2, + (CW(bp->buts[i].butloc.top) + + CW(bp->buts[i].butloc.bottom)) / 2 + 4); DrawText((Ptr) textp, 0, tcnt); } #if defined (BILLBUTTONS) - h = BigEndianValue(bp->buts[i].butloc.right) - BigEndianValue(bp->buts[i].butloc.left); - v = (BigEndianValue(bp->buts[i].butloc.bottom) - BigEndianValue(bp->buts[i].butloc.top))/2; + h = CW(bp->buts[i].butloc.right) - CW(bp->buts[i].butloc.left); + v = (CW(bp->buts[i].butloc.bottom) - CW(bp->buts[i].butloc.top))/2; if (h > v) h = v; if (!(ROMlib_options & ROMLIB_RECT_SCREEN_BIT)) @@ -228,16 +227,16 @@ A4(PRIVATE, void, dobuttons, INTEGER, id, INTEGER, offsetx, for (done = 0; !done;) { C_GetNextEvent(mDownMask|keyDownMask, &evt); if (evt.what == CWC(mouseDown) || evt.what == CWC(keyDown)) { - p.h = BigEndianValue(evt.where.h); - p.v = BigEndianValue(evt.where.v); - for (i = 0; !done && i < BigEndianValue(bp->nbut); i++) { + p.h = CW(evt.where.h); + p.v = CW(evt.where.v); + for (i = 0; !done && i < CW(bp->nbut); i++) { if (PtInRect(p, &bp->buts[i].butloc) || ((evt.what == CWC(keyDown)) && - (((BigEndianValue(evt.message) & charCodeMask) == '\r') || - ((BigEndianValue(evt.message) & charCodeMask) == NUMPAD_ENTER))) + (((CL(evt.message) & charCodeMask) == '\r') || + ((CL(evt.message) & charCodeMask) == NUMPAD_ENTER))) ) { if ((pp = (struct pdef *) - findid(BigEndianValue(bp->buts[i].butprocid)))) + findid(CW(bp->buts[i].butprocid)))) /* NOTE: we will have to do a better job here sometime */ (*(void (*)(void))MR(pp->proc))(); @@ -283,24 +282,24 @@ P1(PUBLIC pascal, void, SysError, short, errorcode) if (!DSAlertTab) { #if defined (CLIFF_CENTERING_ALGORITHM) - DSAlertTab = BigEndianValue((Ptr) &myalerttab); + DSAlertTab = CL((Ptr) &myalerttab); DSAlertRect.top = CWC(64); DSAlertRect.left = CWC(32); DSAlertRect.bottom = CWC(190); DSAlertRect.right = CWC(480); #else - INTEGER screen_width = BigEndianValue (main_gd_rect.right); - INTEGER screen_height = BigEndianValue (main_gd_rect.bottom); + INTEGER screen_width = CW (main_gd_rect.right); + INTEGER screen_height = CW (main_gd_rect.bottom); DSAlertTab = RM((Ptr) &myalerttab); - DSAlertRect.top = BigEndianValue((screen_height - 126) / 3); - DSAlertRect.left = BigEndianValue((screen_width - 448) / 2); - DSAlertRect.bottom = BigEndianValue(BigEndianValue(DSAlertRect.top) + 126); - DSAlertRect.right = BigEndianValue(BigEndianValue(DSAlertRect.left) + 448); + DSAlertRect.top = CW((screen_height - 126) / 3); + DSAlertRect.left = CW((screen_width - 448) / 2); + DSAlertRect.bottom = CW(CW(DSAlertRect.top) + 126); + DSAlertRect.right = CW(CW(DSAlertRect.left) + 448); #endif - offsetx = BigEndianValue (DSAlertRect.left) - 32; - offsety = BigEndianValue (DSAlertRect.top) - 64; + offsetx = CW (DSAlertRect.left) - 32; + offsety = CW (DSAlertRect.top) - 64; } else { offsetx = offsety = 0; @@ -311,7 +310,7 @@ P1(PUBLIC pascal, void, SysError, short, errorcode) /* NOT DONE YET... signal handlers sort of do that anyway */ /* 2. Store errorcode in DSErrCode */ - DSErrCode = BigEndianValue(errorcode); + DSErrCode = CW(errorcode); /* 3. If no Cx(DSAlertTab), bitch */ if (!DSAlertTab) { @@ -323,7 +322,7 @@ P1(PUBLIC pascal, void, SysError, short, errorcode) /* 4. Allocate and re-initialize QuickDraw */ #if defined (BINCOMPAT) a5 = (LONGINT) (long) US_TO_SYN68K (&tmpa5); - CurrentA5 = (Ptr) (long) BigEndianValue(a5); + CurrentA5 = (Ptr) (long) CL(a5); #endif /* BINCOMPAT */ InitGraf((Ptr) quickbytes + sizeof(quickbytes) - 4); ROMlib_initport(&alertport); @@ -346,13 +345,13 @@ P1(PUBLIC pascal, void, SysError, short, errorcode) r = DSAlertRect; FillRect(&r, white); #if defined (OLDSTYLEALERT) - r.right = BigEndianValue(BigEndianValue(r.right) - (2)); - r.bottom = BigEndianValue(BigEndianValue(r.bottom) - (2)); + r.right = CW(CW(r.right) - (2)); + r.bottom = CW(CW(r.bottom) - (2)); FrameRect(&r); PenSize(2, 2); - MoveTo(BigEndianValue(r.left)+2, BigEndianValue(r.bottom)); - LineTo(BigEndianValue(r.right), BigEndianValue(r.bottom)); - LineTo(BigEndianValue(r.right), BigEndianValue(r.top)+2); + MoveTo(CW(r.left)+2, CW(r.bottom)); + LineTo(CW(r.right), CW(r.bottom)); + LineTo(CW(r.right), CW(r.top)+2); PenSize(1, 1); #else /* OLDSTYLEALERT */ FrameRect(&r); @@ -370,18 +369,18 @@ P1(PUBLIC pascal, void, SysError, short, errorcode) ap = (struct adef *) ((INTEGER *) MR(DSAlertTab) + 1); /* 7. text strings */ - drawtextstring(BigEndianValue(ap->primetextid), offsetx, offsety); - drawtextstring(BigEndianValue(ap->secondtextid), offsetx, offsety); + drawtextstring(CW(ap->primetextid), offsetx, offsety); + drawtextstring(CW(ap->secondtextid), offsetx, offsety); /* 8. icon */ - drawicon(BigEndianValue(ap->iconid), offsetx, offsety); + drawicon(CW(ap->iconid), offsetx, offsety); /* 9. TODO: figure out what to do with the proc ... */ /* 10, 11, 12, 13. check for non-zero button id */ /* #warning We blow off ResumeProc until we can properly handle it */ if (ap->buttonid) - dobuttons(/* BigEndianValue(ResumeProc) ? Cx(ap->buttonid) + 1 : */ Cx(ap->buttonid), + dobuttons(/* CL(ResumeProc) ? Cx(ap->buttonid) + 1 : */ Cx(ap->buttonid), offsetx, offsety, false); TRAPEND(); diff --git a/src/system_error.cpp b/src/system_error.cpp index 0f42d91a..3683e8b1 100644 --- a/src/system_error.cpp +++ b/src/system_error.cpp @@ -26,7 +26,6 @@ char ROMlib_rcsid_system_error[] = #include "rsys/options.h" using namespace Executor; -using namespace ByteSwap; #define N_BUTTONS (3) @@ -85,7 +84,7 @@ event_loop (void) | keyDownMask | autoKeyMask), &evt); where = SWAP_POINT (evt.where); - switch (BigEndianValue (evt.what)) + switch (CW (evt.what)) { case mouseDown: { @@ -147,7 +146,7 @@ event_loop (void) { char ch; - ch = BigEndianValue (evt.message) & 0xFF; + ch = CL (evt.message) & 0xFF; if (ch == '\r' || ch == NUMPAD_ENTER) { int i; @@ -246,9 +245,9 @@ Executor::system_error (const char *_message, int _default_button, 0, strlen (message)); GetFontInfo (&font_info); - text_height = ( BigEndianValue (font_info.ascent) - + BigEndianValue (font_info.descent) - + BigEndianValue (font_info.leading)); + text_height = ( CW (font_info.ascent) + + CW (font_info.descent) + + CW (font_info.leading)); line_count /* must be at least one line of text, otherwise we'll get hit @@ -292,8 +291,8 @@ Executor::system_error (const char *_message, int _default_button, /* centered horizontally, with a third of the space above the window, and two-thirds below */ - top = BigEndianValue (gd_rect->top) + (gd_height - height) / 3; - left = BigEndianValue (gd_rect->left) + (gd_width - width) / 2; + top = CW (gd_rect->top) + (gd_height - height) / 3; + left = CW (gd_rect->left) + (gd_width - width) / 2; MoveWindow (msg_window, left, top, TRUE); } @@ -302,8 +301,8 @@ Executor::system_error (const char *_message, int _default_button, message_rect.top = CWC (10); message_rect.left = CWC (10); - message_rect.bottom = BigEndianValue (message_height + 10); - message_rect.right = BigEndianValue (message_width + 10); + message_rect.bottom = CW (message_height + 10); + message_rect.right = CW (message_width + 10); for (i = 0; i < N_BUTTONS; i ++) if (buttons[i].text != NULL) @@ -311,11 +310,11 @@ Executor::system_error (const char *_message, int _default_button, Rect ctl_rect; unsigned char buf[256]; - ctl_rect.top = BigEndianValue (height - 10 - 20); - ctl_rect.bottom = BigEndianValue (height - 10); + ctl_rect.top = CW (height - 10 - 20); + ctl_rect.bottom = CW (height - 10); - ctl_rect.right = BigEndianValue ( width - 10 - i * (max_button_width + 13)); - ctl_rect.left = BigEndianValue ( width - 10 - i * (max_button_width + 13) + ctl_rect.right = CW ( width - 10 - i * (max_button_width + 13)); + ctl_rect.left = CW ( width - 10 - i * (max_button_width + 13) - max_button_width); *buf = (unsigned char) strlen (buttons[i].text); diff --git a/src/teAccess.cpp b/src/teAccess.cpp index 6a6d3cb7..549712f6 100644 --- a/src/teAccess.cpp +++ b/src/teAccess.cpp @@ -21,7 +21,6 @@ char ROMlib_rcsid_teAccess[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; P3 (PUBLIC pascal trap, void, TESetText, Ptr, p, LONGINT, length, TEHandle, teh) { @@ -31,11 +30,11 @@ P3 (PUBLIC pascal trap, void, TESetText, Ptr, p, LONGINT, length, TEHandle, teh) #if 0 HASSIGN_3 (teh, - selStart, BigEndianValue (length), - selEnd, BigEndianValue (length), - teLength, BigEndianValue (length)); + selStart, CW (length), + selEnd, CW (length), + teLength, CW (length)); #else - HxX (teh, teLength) = BigEndianValue (length); + HxX (teh, teLength) = CW (length); #endif /* ### adjust recal* fields? */ if (TE_STYLIZED_P (teh)) @@ -54,7 +53,7 @@ P3 (PUBLIC pascal trap, void, TESetText, Ptr, p, LONGINT, length, TEHandle, teh) TE_STYLE_SIZE_FOR_N_RUNS (1)); HxX (te_style, runs[0].startChar) = CWC (0); HxX (te_style, runs[0].styleIndex) = CWC (0); - HxX (te_style, runs[1].startChar) = BigEndianValue (length + 1); + HxX (te_style, runs[1].startChar) = CW (length + 1); HxX (te_style, runs[1].styleIndex) = CWC (-1); style_table = TE_STYLE_STYLE_TABLE (te_style); SetHandleSize ((Handle) style_table, @@ -67,9 +66,9 @@ P3 (PUBLIC pascal trap, void, TESetText, Ptr, p, LONGINT, length, TEHandle, teh) stFace, PORT_TX_FACE (thePort), stSize, PORT_TX_SIZE_X (thePort), stColor, ROMlib_black_rgb_color, - stHeight, BigEndianValue (BigEndianValue (finfo.ascent) - + BigEndianValue (finfo.descent) - + BigEndianValue (finfo.leading)), + stHeight, CW (CW (finfo.ascent) + + CW (finfo.descent) + + CW (finfo.leading)), stAscent, finfo.ascent); } TECalText (teh); diff --git a/src/teDisplay.cpp b/src/teDisplay.cpp index c563df75..aeb96ef0 100644 --- a/src/teDisplay.cpp +++ b/src/teDisplay.cpp @@ -21,12 +21,11 @@ char ROMlib_rcsid_teDisplay[] = #include "rsys/region.h" using namespace Executor; -using namespace ByteSwap; P2 (PUBLIC pascal trap, void, TESetJust, INTEGER, j, TEHandle, teh) { TE_SLAM (teh); - HxX (teh, just) = BigEndianValue(j); + HxX (teh, just) = CW(j); TECalText (teh); TE_SLAM (teh); } diff --git a/src/teEdit.cpp b/src/teEdit.cpp index 9715a6db..304c3aa6 100644 --- a/src/teEdit.cpp +++ b/src/teEdit.cpp @@ -27,7 +27,6 @@ char ROMlib_rcsid_teEdit[] = #include "rsys/text.h" using namespace Executor; -using namespace ByteSwap; static void tedoinserttext (TEHandle te, int16 hlen, int16 len, @@ -46,9 +45,9 @@ tedoinserttext (TEHandle te, int16 hlen, int16 len, HASSIGN_3 (te, - selEnd, BigEndianValue (TE_SEL_END (te) + len), - selStart, BigEndianValue (TE_SEL_START (te) + len), - teLength, BigEndianValue (TE_LENGTH (te) + len)); + selEnd, CW (TE_SEL_END (te) + len), + selStart, CW (TE_SEL_START (te) + len), + teLength, CW (TE_LENGTH (te) + len)); } void @@ -107,13 +106,13 @@ Executor::ROMlib_teremovestyleinfo (TEStyleHandle te_style, current_run = &runs[current_run_index]; STYLE_RUN_START_CHAR_X (current_run) - = BigEndianValue (STYLE_RUN_START_CHAR (current_run) - shift); + = CW (STYLE_RUN_START_CHAR (current_run) - shift); } memmove (&runs[start_run_index], &runs[end_run_index], (n_runs - end_run_index + 1) * sizeof *runs); n_runs -= end_run_index - start_run_index; - TE_STYLE_N_RUNS_X (te_style) = BigEndianValue (n_runs); + TE_STYLE_N_RUNS_X (te_style) = CW (n_runs); SetHandleSize ((Handle) te_style, TE_STYLE_SIZE_FOR_N_RUNS (n_runs)); @@ -144,8 +143,8 @@ tereplaceselection (TEHandle teh, int16 start, int16 stop, int16 len, BlockMove (ptr, STARH (hText) + start, len); TE_SEL_END_X (teh) = TE_SEL_START_X (teh) - = BigEndianValue (TE_SEL_START (teh) + len); - TE_LENGTH_X (teh) = BigEndianValue (hlen + nchar); + = CW (TE_SEL_START (teh) + len); + TE_LENGTH_X (teh) = CW (hlen + nchar); TE_CARET_STATE_X (teh) = CWC (-1); /* will be highlit below */ } @@ -168,7 +167,7 @@ te_style_insert_runs (TEStyleHandle te_style, StyleRun *run = &runs[run_i]; STYLE_RUN_START_CHAR_X (run) - = BigEndianValue (STYLE_RUN_START_CHAR (run) + len); + = CW (STYLE_RUN_START_CHAR (run) + len); } for (run_i = 0; run_i < n_new_runs; run_i ++) @@ -200,10 +199,10 @@ te_style_insert_runs (TEStyleHandle te_style, new_style = ST_ELT (style_table, new_style_index); - ST_ELT_COUNT_X (new_style) = BigEndianValue (ST_ELT_COUNT (new_style) + 1); + ST_ELT_COUNT_X (new_style) = CW (ST_ELT_COUNT (new_style) + 1); release_style_index (te_style, style_index); - STYLE_RUN_STYLE_INDEX_X (run) = BigEndianValue (new_style_index); + STYLE_RUN_STYLE_INDEX_X (run) = CW (new_style_index); } } stabilize_style_info (te_style); @@ -273,14 +272,14 @@ Executor::ROMlib_teinsertstyleinfo (TEHandle te, FALSE); /* must swap here, the elt start char is a `int32' */ - STYLE_RUN_START_CHAR_X (new_run) = BigEndianValue (SCRAP_ELT_START_CHAR (scrap_elt)); - STYLE_RUN_STYLE_INDEX_X (new_run) = BigEndianValue (style_index); + STYLE_RUN_START_CHAR_X (new_run) = CW (SCRAP_ELT_START_CHAR (scrap_elt)); + STYLE_RUN_STYLE_INDEX_X (new_run) = CW (style_index); } { StyleRun *new_run; new_run = &new_runs[scrap_n_styles]; - STYLE_RUN_START_CHAR_X (new_run) = BigEndianValue (len); + STYLE_RUN_START_CHAR_X (new_run) = CW (len); STYLE_RUN_STYLE_INDEX_X (new_run) = CWC (-1); } @@ -319,7 +318,7 @@ Executor::ROMlib_tedoitall (TEHandle teh, Ptr ptr, /* INTERNAL */ && TE_LINE_HEIGHT (teh) == -1) { lht = TE_STYLE_LH_TABLE (te_style); - oldlh = BigEndianValue ((STARH(lht) + Hx(teh, nLines) - 1)->lhHeight); + oldlh = CW ((STARH(lht) + Hx(teh, nLines) - 1)->lhHeight); } else { @@ -367,21 +366,21 @@ Executor::ROMlib_tedoitall (TEHandle teh, Ptr ptr, /* INTERNAL */ if (start > hlen) { warning_unexpected ("start = %d, hlen = %d", start, hlen); - TE_SEL_START_X (teh) = BigEndianValue (hlen); + TE_SEL_START_X (teh) = CW (hlen); start = hlen; } if (stop > hlen) { warning_unexpected ("stop = %d, hlen = %d", stop, hlen); - TE_SEL_END_X (teh) = BigEndianValue (hlen); + TE_SEL_END_X (teh) = CW (hlen); stop = hlen; } if (start > stop) { warning_unexpected ("start = %d, stop = %d", start, stop); - TE_SEL_START_X (teh) = BigEndianValue (stop); + TE_SEL_START_X (teh) = CW (stop); start = stop; } @@ -405,14 +404,14 @@ Executor::ROMlib_tedoitall (TEHandle teh, Ptr ptr, /* INTERNAL */ { if (*ptr == '\010' || !ROMlib_forward_del_p) { - HxX(teh, selStart) = BigEndianValue(Hx(teh, selStart) - 1); + HxX(teh, selStart) = CW(Hx(teh, selStart) - 1); start = Hx(teh, selStart); } else { if (stop < hlen) { - HxX(teh, selEnd) = BigEndianValue(Hx(teh, selEnd) + 1); + HxX(teh, selEnd) = CW(Hx(teh, selEnd) + 1); stop = Hx(teh, selEnd); } } @@ -429,37 +428,37 @@ Executor::ROMlib_tedoitall (TEHandle teh, Ptr ptr, /* INTERNAL */ ROMlib_caltext (teh, start, nchar, &calstart, &calend); TE_CHAR_TO_POINT (teh, TE_LENGTH (teh), &newend); if (TE_STYLIZED_P (teh) && TE_LINE_HEIGHT (teh) == -1) - newlh = BigEndianValue ((STARH (lht) + TE_N_LINES (teh) - 1)->lhHeight); + newlh = CW ((STARH (lht) + TE_N_LINES (teh) - 1)->lhHeight); if (oldend.v > newend.v) { - eraser.top = BigEndianValue(newend.v); - eraser.left = BigEndianValue(newend.h); - eraser.bottom = BigEndianValue(newend.v + newlh); + eraser.top = CW(newend.v); + eraser.left = CW(newend.h); + eraser.bottom = CW(newend.v + newlh); eraser.right = HxX(teh, viewRect.right); SectRect(&HxX(teh, viewRect), &eraser, &eraser); EraseRect(&eraser); eraser.top = eraser.bottom; eraser.left = HxX(teh, viewRect.left); - if (eraser.top != BigEndianValue(oldend.v)) + if (eraser.top != CW(oldend.v)) { - eraser.bottom = BigEndianValue(oldend.v); + eraser.bottom = CW(oldend.v); eraser.right = HxX(teh, viewRect.right); SectRect(&HxX(teh, viewRect), &eraser, &eraser); EraseRect(&eraser); - eraser.top = BigEndianValue(oldend.v); + eraser.top = CW(oldend.v); } - eraser.bottom = BigEndianValue(oldend.v + oldlh); - eraser.right = BigEndianValue(oldend.h); + eraser.bottom = CW(oldend.v + oldlh); + eraser.right = CW(oldend.h); SectRect(&HxX(teh, viewRect), &eraser, &eraser); EraseRect(&eraser); } else if (oldend.v == newend.v && oldend.h > newend.h) { - eraser.top = BigEndianValue(oldend.v); - eraser.left = BigEndianValue(newend.h); - eraser.bottom = BigEndianValue(oldend.v + oldlh); - eraser.right = BigEndianValue(oldend.h); + eraser.top = CW(oldend.v); + eraser.left = CW(newend.h); + eraser.bottom = CW(oldend.v + oldlh); + eraser.right = CW(oldend.h); SectRect(&HxX(teh, viewRect), &eraser, &eraser); EraseRect(&eraser); } @@ -535,15 +534,15 @@ static void doarrow (TEHandle te, CHAR thec) pt.v -= offset; else pt.v += offset; - TEP_SEL_POINT (tep).h = BigEndianValue (pt.h); - TEP_SEL_POINT (tep).v = BigEndianValue (pt.v); + TEP_SEL_POINT (tep).h = CW (pt.h); + TEP_SEL_POINT (tep).v = CW (pt.v); sel_start = TEP_DO_TEXT (tep, 0, length, teFind); break; } } - TEP_SEL_START_X (tep) = BigEndianValue (sel_start); - TEP_SEL_END_X (tep) = BigEndianValue (sel_start); + TEP_SEL_START_X (tep) = CW (sel_start); + TEP_SEL_END_X (tep) = CW (sel_start); if (TEP_CARET_STATE (tep)) TEP_CARET_STATE_X (tep) = CWC (caret_vis); ROMlib_togglelite (te); @@ -655,9 +654,9 @@ P1 (PUBLIC pascal trap, void, TECopy, TEHandle, te) run_start = RUN_START_CHAR (current_run); SCRAP_ELT_START_CHAR_X (scrap_elt) = (run_start < start ? CLC (0) - : BigEndianValue (run_start - start)); + : CL (run_start - start)); } - SCRAP_N_STYLES_X (scrap) = BigEndianValue (n_scrap_styles); + SCRAP_N_STYLES_X (scrap) = CW (n_scrap_styles); LOCK_HANDLE_EXCURSION_1 (scrap, @@ -669,11 +668,11 @@ P1 (PUBLIC pascal trap, void, TECopy, TEHandle, te) HSetState ((Handle) te_style, te_style_flags); } - TEScrpLength = BigEndianValue (len); + TEScrpLength = CW (len); #if defined(X) || defined(MACOSX_) || defined(SDL) /* ### should this lock `TEScrpHandle'? */ - PutScrapX (TICK("TEXT"), BigEndianValue (TEScrpLength), - (char *) STARH (MR (TEScrpHandle)), BigEndianValue(ScrapCount)); + PutScrapX (TICK("TEXT"), CW (TEScrpLength), + (char *) STARH (MR (TEScrpHandle)), CW(ScrapCount)); #endif /* defined(X) */ HSetState (hText, hText_flags); @@ -692,12 +691,12 @@ P1(PUBLIC pascal trap, void, TEPaste, TEHandle, teh) s = GetScrapX (TICK("TEXT"), (char **) MR (TEScrpHandle)); if (s >= 0) - TEScrpLength = BigEndianValue (s); + TEScrpLength = CW (s); #endif /* defined(X) */ LOCK_HANDLE_EXCURSION_1 (MR (TEScrpHandle), { - ROMlib_tedoitall (teh, STARH (MR (TEScrpHandle)), BigEndianValue (TEScrpLength), + ROMlib_tedoitall (teh, STARH (MR (TEScrpHandle)), CW (TEScrpLength), FALSE, NULL); }); } diff --git a/src/teIMIV.cpp b/src/teIMIV.cpp index 34b14b7f..c6b2a861 100644 --- a/src/teIMIV.cpp +++ b/src/teIMIV.cpp @@ -19,7 +19,6 @@ char ROMlib_rcsid_teIMIV[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; P3 (PUBLIC pascal trap, void, TEPinScroll, int16, dh, /* IMIV-57 */ int16, dv, TEHandle, te) @@ -38,8 +37,8 @@ P3 (PUBLIC pascal trap, void, TEPinScroll, int16, dh, /* IMIV-57 */ if (dv > 0) { - int view_rect_top = BigEndianValue (view_rect -> top); - int dest_rect_top = BigEndianValue (dest_rect -> top); + int view_rect_top = CW (view_rect -> top); + int dest_rect_top = CW (dest_rect -> top); /* `destRect.top' must stay below `viewRect.bottom' */ @@ -49,7 +48,7 @@ P3 (PUBLIC pascal trap, void, TEPinScroll, int16, dh, /* IMIV-57 */ else { Point end_pt; - int view_rect_bottom = BigEndianValue (view_rect -> bottom); + int view_rect_bottom = CW (view_rect -> bottom); int dest_rect_bottom; { @@ -77,7 +76,7 @@ P3 (PUBLIC pascal trap, void, TEPinScroll, int16, dh, /* IMIV-57 */ if (dh > 0) { - maxshift = BigEndianValue (view_rect->left) - BigEndianValue (dest_rect->left); + maxshift = CW (view_rect->left) - CW (dest_rect->left); if (maxshift > 0) dh = MIN (maxshift, dh); else @@ -85,7 +84,7 @@ P3 (PUBLIC pascal trap, void, TEPinScroll, int16, dh, /* IMIV-57 */ } else { - maxshift = BigEndianValue (view_rect->left) - BigEndianValue (dest_rect->left); + maxshift = CW (view_rect->left) - CW (dest_rect->left); if (maxshift < 0) dh = MAX (maxshift, dh); else @@ -109,9 +108,9 @@ A1 (PUBLIC, void, ROMlib_teautoloop, TEHandle, teh) Point pt; GetMouse(&pt); - if (BigEndianValue(pt.v) < Hx(teh, viewRect.top)) + if (CW(pt.v) < Hx(teh, viewRect.top)) TEPinScroll(0, Hx(teh, lineHeight), teh); - else if (BigEndianValue(pt.v) > Hx(teh, viewRect.bottom)) + else if (CW(pt.v) > Hx(teh, viewRect.bottom)) TEPinScroll(0, -Hx(teh, lineHeight), teh); } diff --git a/src/teIMV.cpp b/src/teIMV.cpp index c4e3c9d2..669bbbf1 100644 --- a/src/teIMV.cpp +++ b/src/teIMV.cpp @@ -25,7 +25,6 @@ char ROMlib_rcsid_teIMV[] = #include "rsys/hook.h" using namespace Executor; -using namespace ByteSwap; void Executor::generic_elt_copy (generic_elt_t *dst, generic_elt_t *src) @@ -47,9 +46,9 @@ Executor::generic_elt_calc_height_ascent (generic_elt_t *elt) TextFont (GENERIC_ELT_FONT (elt)); TextFace (GENERIC_ELT_FACE (elt)); GetFontInfo (&font_info); - GENERIC_ELT_HEIGHT_X (elt) = BigEndianValue ( BigEndianValue (font_info.ascent) - + BigEndianValue (font_info.descent) - + BigEndianValue (font_info.leading)); + GENERIC_ELT_HEIGHT_X (elt) = CW ( CW (font_info.ascent) + + CW (font_info.descent) + + CW (font_info.leading)); GENERIC_ELT_ASCENT_X (elt) = font_info.ascent; TextSize (savesize); TextFace (saveface); @@ -86,7 +85,7 @@ Executor::adjust_attrs (TextStyle *orig_attrs, TextStyle *new_attrs, TS_FACE (dst_attrs) = TS_FACE (orig_attrs); if (mode & addSize) - TS_SIZE_X (dst_attrs) = BigEndianValue (TS_SIZE (new_attrs) + TS_SIZE (orig_attrs)); + TS_SIZE_X (dst_attrs) = CW (TS_SIZE (new_attrs) + TS_SIZE (orig_attrs)); else if (mode & doSize) TS_SIZE_X (dst_attrs) = TS_SIZE_X (new_attrs); else @@ -126,7 +125,7 @@ Executor::make_style_run_at (TEStyleHandle te_style, int16 sel) /* split the current style into two */ n_runs = TE_STYLE_N_RUNS (te_style) + 1; - TE_STYLE_N_RUNS_X (te_style) = BigEndianValue (n_runs); + TE_STYLE_N_RUNS_X (te_style) = CW (n_runs); SetHandleSize ((Handle) te_style, TE_STYLE_SIZE_FOR_N_RUNS (n_runs)); runs = TE_STYLE_RUNS (te_style); @@ -141,10 +140,10 @@ Executor::make_style_run_at (TEStyleHandle te_style, int16 sel) style_table = TE_STYLE_STYLE_TABLE (te_style); style = ST_ELT (style_table, style_index); - ST_ELT_COUNT_X (style) = BigEndianValue (ST_ELT_COUNT (style) + 1); + ST_ELT_COUNT_X (style) = CW (ST_ELT_COUNT (style) + 1); - STYLE_RUN_START_CHAR_X (&runs[run_index + 1]) = BigEndianValue (sel); - STYLE_RUN_STYLE_INDEX_X (&runs[run_index + 1]) = BigEndianValue (style_index); + STYLE_RUN_START_CHAR_X (&runs[run_index + 1]) = CW (sel); + STYLE_RUN_STYLE_INDEX_X (&runs[run_index + 1]) = CW (style_index); return run_index + 1; } @@ -186,7 +185,7 @@ Executor::get_style_index (TEStyleHandle te_style, TextStyle *attrs, int incr_co && TS_COLOR (attrs).blue == ST_ELT_COLOR (st_elt).blue)) { if (incr_count_p) - ST_ELT_COUNT_X (st_elt) = BigEndianValue (ST_ELT_COUNT (st_elt) + 1); + ST_ELT_COUNT_X (st_elt) = CW (ST_ELT_COUNT (st_elt) + 1); return st_i; } else if (!cache_filled_p) @@ -200,7 +199,7 @@ Executor::get_style_index (TEStyleHandle te_style, TextStyle *attrs, int incr_co /* a style not already in the style table was asked for. create it */ n_styles ++; - TE_STYLE_N_STYLES_X (te_style) = BigEndianValue (n_styles); + TE_STYLE_N_STYLES_X (te_style) = CW (n_styles); SetHandleSize ((Handle) style_table, STYLE_TABLE_SIZE_FOR_N_STYLES (n_styles)); st_elt = ST_ELT (style_table, n_styles - 1); @@ -234,7 +233,7 @@ Executor::release_style_index (TEStyleHandle te_style, int16 style_index) style_table = TE_STYLE_STYLE_TABLE (te_style); st_elt = ST_ELT (style_table, style_index); gui_assert (ST_ELT_COUNT (st_elt) > 0); - ST_ELT_COUNT_X (st_elt) = BigEndianValue (ST_ELT_COUNT (st_elt) - 1); + ST_ELT_COUNT_X (st_elt) = CW (ST_ELT_COUNT (st_elt) - 1); } /* `release_style_index ()' only decreases the reference count, so @@ -257,7 +256,7 @@ Executor::stabilize_style_info (TEStyleHandle te_style) index_map = (int16*)alloca (n_styles * sizeof *index_map); for (i = 0; i < n_styles; i ++) - index_map[i] = BigEndianValue (i); + index_map[i] = CW (i); for (i = 0; i < n_styles; i ++) { @@ -285,7 +284,7 @@ Executor::stabilize_style_info (TEStyleHandle te_style) index to the last style in the style table, and shrink the style table by 1 */ *ST_ELT (style_table, i) = *ST_ELT (style_table, n_styles - 1); - index_map[n_styles - 1] = BigEndianValue (i); + index_map[n_styles - 1] = CW (i); /* so that we can verify, when we change the run style indexes, that noone refers to this map index */ @@ -296,7 +295,7 @@ Executor::stabilize_style_info (TEStyleHandle te_style) } done: - TE_STYLE_N_STYLES_X (te_style) = BigEndianValue (n_styles); + TE_STYLE_N_STYLES_X (te_style) = CW (n_styles); SetHandleSize ((Handle) style_table, STYLE_TABLE_SIZE_FOR_N_STYLES (n_styles)); @@ -331,14 +330,14 @@ combine_run_with_next (TEStyleHandle te_style, int16 run_index) (n_runs - run_index - 1) * sizeof *runs); n_runs --; - TE_STYLE_N_RUNS_X (te_style) = BigEndianValue (n_runs); + TE_STYLE_N_RUNS_X (te_style) = CW (n_runs); SetHandleSize ((Handle) te_style, TE_STYLE_SIZE_FOR_N_RUNS (n_runs)); style_index = STYLE_RUN_STYLE_INDEX (&runs[run_index]); style_table = TE_STYLE_STYLE_TABLE (te_style); style = ST_ELT (style_table, style_index); - ST_ELT_COUNT_X (style) = BigEndianValue (ST_ELT_COUNT (style) - 1); + ST_ELT_COUNT_X (style) = CW (ST_ELT_COUNT (style) - 1); } void @@ -430,7 +429,7 @@ te_add_attrs_to_range (TEHandle te, new_style_index = get_style_index (te_style, &new_attrs, TRUE); release_style_index (te_style, orig_style_index); - STYLE_RUN_STYLE_INDEX_X (current_run) = BigEndianValue (new_style_index); + STYLE_RUN_STYLE_INDEX_X (current_run) = CW (new_style_index); } }); @@ -471,9 +470,9 @@ P2 (PUBLIC pascal trap, TEHandle, TEStylNew, Rect *, dst, Rect *, view) /* font info used to fill in the fisrt style element */ GetFontInfo (&font_info); - font_height = (BigEndianValue (font_info.ascent) - + BigEndianValue (font_info.descent) - + BigEndianValue (font_info.leading)); + font_height = (CW (font_info.ascent) + + CW (font_info.descent) + + CW (font_info.leading)); style_table = (STHandle) NewHandle (sizeof (STElement)); HASSIGN_7 (style_table, @@ -482,7 +481,7 @@ P2 (PUBLIC pascal trap, TEHandle, TEStylNew, Rect *, dst, Rect *, view) stFace, PORT_TX_FACE (thePort), stSize, PORT_TX_SIZE_X (thePort), stColor, ROMlib_black_rgb_color, - stHeight, BigEndianValue (font_height), + stHeight, CW (font_height), stAscent, font_info.ascent); TE_STYLE_STYLE_TABLE_X (te_style) = RM (style_table); @@ -512,7 +511,7 @@ P2 (PUBLIC pascal trap, TEHandle, TEStylNew, Rect *, dst, Rect *, view) stp->scrpColor.blue = 0; /* black ? */ stp->scrpStartChar = CLC(0); - stp->scrpHeight = BigEndianValue (font_height); + stp->scrpHeight = CW (font_height); stp->scrpAscent = font_info.ascent; SetStylHandle (te_style, teh); @@ -570,7 +569,7 @@ P1 (PUBLIC pascal trap, StScrpHandle, GetStylScrap, TEHandle, te) scrap_n_styles = MAX (end_run_index - start_run_index, 1); scrap = (StScrpHandle) NewHandle (SCRAP_SIZE_FOR_N_STYLES (scrap_n_styles)); - SCRAP_N_STYLES_X (scrap) = BigEndianValue (scrap_n_styles); + SCRAP_N_STYLES_X (scrap) = CW (scrap_n_styles); if (start == end) warning_unimplemented ("should check null scrap, first"); @@ -590,7 +589,7 @@ P1 (PUBLIC pascal trap, StScrpHandle, GetStylScrap, TEHandle, te) generic_elt_copy (SCRAP_ELT_TO_GENERIC_ELT (scrap_elt), ST_ELT_TO_GENERIC_ELT (style)); SCRAP_ELT_START_CHAR_X (scrap_elt) - = BigEndianValue (RUN_START_CHAR (current_run) - start); + = CL (RUN_START_CHAR (current_run) - start); } te_style_combine_runs (te_style); @@ -611,8 +610,8 @@ P2 (PUBLIC pascal trap, INTEGER, TEGetOffset, Point, pt, TEHandle, te) Point sp; sp = TE_SEL_POINT (te); - TE_SEL_POINT (te).h = BigEndianValue (pt.h); - TE_SEL_POINT (te).v = BigEndianValue (pt.v); + TE_SEL_POINT (te).h = CW (pt.h); + TE_SEL_POINT (te).v = CW (pt.v); retval = TE_DO_TEXT (te, 0, TE_LENGTH (te), teFind); TE_SEL_POINT (te) = sp; @@ -678,7 +677,7 @@ P3 (PUBLIC pascal trap, int32, TEGetHeight, l = STARH (MR (STARH (te_style)->lhTab)) + startLine; le = l + endLine - startLine; for ( ; l <= le ; l++) - retval += BigEndianValue (l->lhHeight); + retval += CW (l->lhHeight); } else retval = TE_LINE_HEIGHT (teh) * (endLine - startLine + 1); @@ -915,7 +914,7 @@ P5 (PUBLIC pascal trap, void, TEReplaceStyle, int16, mode, new_style_index = get_style_index (te_style, new_attrs, TRUE); release_style_index (te_style, orig_style_index); - RUN_STYLE_INDEX_X (run) = BigEndianValue (new_style_index); + RUN_STYLE_INDEX_X (run) = CW (new_style_index); } } HSetState ((Handle) te_style, te_style_flags); diff --git a/src/teInit.cpp b/src/teInit.cpp index d65de1f8..5c12e057 100644 --- a/src/teInit.cpp +++ b/src/teInit.cpp @@ -23,7 +23,6 @@ char ROMlib_rcsid_teInit[] = #include "rsys/tesave.h" using namespace Executor; -using namespace ByteSwap; P0 (PUBLIC pascal trap, void, TEInit) { @@ -61,9 +60,9 @@ P2 (PUBLIC pascal trap, TEHandle, TENew, Rect *, dst, Rect *, view) (teh, destRect, *dst, viewRect, *view, - lineHeight, BigEndianValue (BigEndianValue (finfo.ascent) - + BigEndianValue (finfo.descent) - + BigEndianValue (finfo.leading)), + lineHeight, CW (CW (finfo.ascent) + + CW (finfo.descent) + + CW (finfo.leading)), fontAscent, finfo.ascent, active, FALSE, caretState, CWC (caret_invis), diff --git a/src/teInsert.cpp b/src/teInsert.cpp index bae03fbf..c67ddf5f 100644 --- a/src/teInsert.cpp +++ b/src/teInsert.cpp @@ -28,7 +28,6 @@ char ROMlib_rcsid_teInsert[] = #include "rsys/text.h" using namespace Executor; -using namespace ByteSwap; int16 Executor::ROMlib_StyleTextWidth (TEPtr tep, @@ -181,13 +180,13 @@ Executor::te_char_to_point (const TEPtr tep, int16 sel, Point *p) gui_fatal ("unknown justification"); if (on_break_p) - left = (BigEndianValue (dest_rect->left) + left_offset); + left = (CW (dest_rect->left) + left_offset); else - left = (BigEndianValue (dest_rect->left) + left = (CW (dest_rect->left) + left_offset + TEP_TEXT_WIDTH (tep, Text, line_start, sel - line_start)); - for (top = BigEndianValue (dest_rect->top), lineno_i = 0; lineno_i < lineno; lineno_i ++) + for (top = CW (dest_rect->top), lineno_i = 0; lineno_i < lineno; lineno_i ++) /* ### hoist alot of the internal constants out of this loop */ top += TEP_HEIGHT_FOR_LINE (tep, lineno_i); if (on_break_p) @@ -333,14 +332,14 @@ P1 (PUBLIC pascal trap, void, TEIdle, TEHandle, teh) TESAVE (teh); TE_SLAM (teh); - if ((ticks = TickCount()) > Hx(teh, caretTime) + BigEndianValue(CaretTime) + if ((ticks = TickCount()) > Hx(teh, caretTime) + CL(CaretTime) && Hx(teh, active) && (sel = Hx(teh, selStart)) == Hx(teh, selEnd) && (state = Hx(teh, caretState))) { togglecaret(teh, sel, TRUE); - HxX(teh, caretState) = BigEndianValue (state ^ 0xFF00); - HxX(teh, caretTime) = BigEndianValue (ticks); + HxX(teh, caretState) = CW (state ^ 0xFF00); + HxX(teh, caretTime) = CL (ticks); } TE_SLAM (teh); TERESTORE (); @@ -401,13 +400,13 @@ te_draw (TEPtr tep, n_lines = TEP_N_LINES (tep); dest_rect = &TEP_DEST_RECT (tep); - dest_rect_left = BigEndianValue (dest_rect->left); - dest_rect_right = BigEndianValue (dest_rect->right); - dest_rect_top = BigEndianValue (dest_rect->top); - dest_rect_bottom = BigEndianValue (dest_rect->bottom); + dest_rect_left = CW (dest_rect->left); + dest_rect_right = CW (dest_rect->right); + dest_rect_top = CW (dest_rect->top); + dest_rect_bottom = CW (dest_rect->bottom); view_rect = &TEP_VIEW_RECT (tep); - view_rect_bottom = BigEndianValue (view_rect->bottom); + view_rect_bottom = CW (view_rect->bottom); { int16 height; @@ -430,8 +429,8 @@ te_draw (TEPtr tep, SectRect (view_rect, view_rect, clip_rect); #endif - clip_rect_top = BigEndianValue (clip_rect->top); - clip_rect_bottom = BigEndianValue (clip_rect->bottom); + clip_rect_top = CW (clip_rect->top); + clip_rect_bottom = CW (clip_rect->bottom); /* clip the lines to draw by the visible lines */ for (current_lineno = 0, height = dest_rect_top;; current_lineno ++) @@ -506,7 +505,7 @@ te_draw (TEPtr tep, runs = (StyleRun*)alloca (sizeof *runs * 2); RUN_START_CHAR_X (&runs[0]) = CWC (0); RUN_STYLE_INDEX_X (&runs[0]) = CWC (0); - RUN_START_CHAR_X (&runs[1]) = BigEndianValue (TEP_LENGTH (tep) + 1); + RUN_START_CHAR_X (&runs[1]) = CW (TEP_LENGTH (tep) + 1); RUN_STYLE_INDEX_X (&runs[1]) = CWC (-1); n_styles = 1; @@ -551,10 +550,10 @@ te_draw (TEPtr tep, DrawText (Text, current_posn, current_run_end - current_posn); #if 0 - gui_assert (BigEndianValue (orig_pn.h) + gui_assert (CW (orig_pn.h) + TextWidth (Text, current_posn, current_run_end - current_posn) - == BigEndianValue (PORT_PEN_LOC (thePort).h)); + == CW (PORT_PEN_LOC (thePort).h)); #endif current_run ++; style_update_port (&styles[RUN_STYLE_INDEX (current_run)]); @@ -638,8 +637,8 @@ te_hilite (TEPtr tep, line_starts = TEP_LINE_STARTS (tep); dest_rect = &TEP_DEST_RECT (tep); - dest_rect_left = BigEndianValue (dest_rect->left); - dest_rect_right = BigEndianValue (dest_rect->right); + dest_rect_left = CW (dest_rect->left); + dest_rect_right = CW (dest_rect->right); length = TEP_LENGTH (tep); /* highlight the first line */ @@ -714,15 +713,15 @@ te_find (TEPtr tep, int16 start, int16 end) Text = STARH (hText); dest_rect = &TEP_DEST_RECT (tep); - dest_rect_top = BigEndianValue (dest_rect->top); - dest_rect_left = BigEndianValue (dest_rect->left); + dest_rect_top = CW (dest_rect->top); + dest_rect_left = CW (dest_rect->left); length = TEP_LENGTH (tep); n_lines = TEP_N_LINES (tep); line_starts = TEP_LINE_STARTS (tep); - v = BigEndianValue (TEP_SEL_POINT (tep).v); - h = BigEndianValue (TEP_SEL_POINT (tep).h) - dest_rect_left; + v = CW (TEP_SEL_POINT (tep).v); + h = CW (TEP_SEL_POINT (tep).h) - dest_rect_left; if (! Text) { @@ -849,11 +848,11 @@ double_click_p (TEHandle te, int16 cl) ticks = TickCount (); if (cl == TE_CLICK_LOC (te) - && ticks <= TE_CLICK_TIME (te) + BigEndianValue (DoubleTime)) + && ticks <= TE_CLICK_TIME (te) + CL (DoubleTime)) return TRUE; - TE_CLICK_LOC_X (te) = BigEndianValue (cl); - TE_CLICK_TIME_X (te) = BigEndianValue (ticks); + TE_CLICK_LOC_X (te) = CW (cl); + TE_CLICK_TIME_X (te) = CL (ticks); return FALSE; } @@ -976,8 +975,8 @@ P3 (PUBLIC pascal trap, void, TEClick, Point, pt, BOOLEAN, extend, TEP_CLICK_STUFF_X (tep) = CWC (0); - TEP_SEL_POINT (tep).h = BigEndianValue (pt.h); - TEP_SEL_POINT (tep).v = BigEndianValue (pt.v); + TEP_SEL_POINT (tep).h = CW (pt.h); + TEP_SEL_POINT (tep).v = CW (pt.v); click_posn = TEP_DO_TEXT (tep, 0, length, teFind); state = TEP_CARET_STATE (tep); @@ -1110,9 +1109,9 @@ P3 (PUBLIC pascal trap, void, TEClick, Point, pt, BOOLEAN, extend, } \ }) - TEP_SEL_START_X (tep) = BigEndianValue (start); - TEP_SEL_END_X (tep) = BigEndianValue (end); - TEP_CARET_STATE_X (tep) = BigEndianValue (state); + TEP_SEL_START_X (tep) = CW (start); + TEP_SEL_END_X (tep) = CW (end); + TEP_CARET_STATE_X (tep) = CW (state); while (Button () && CALLCLIKOK (te)) { @@ -1186,9 +1185,9 @@ P3 (PUBLIC pascal trap, void, TEClick, Point, pt, BOOLEAN, extend, gui_fatal ("origin is neither start nor end"); } - TEP_SEL_START_X (tep) = BigEndianValue (start); - TEP_SEL_END_X (tep) = BigEndianValue (end); - TEP_CARET_STATE_X (tep) = BigEndianValue (state); + TEP_SEL_START_X (tep) = CW (start); + TEP_SEL_END_X (tep) = CW (end); + TEP_CARET_STATE_X (tep) = CW (state); } /* suck out the up event if it is there */ @@ -1222,8 +1221,8 @@ P3 (PUBLIC pascal trap, void, TESetSelect, int32, start, int32, stop, TE_DO_TEXT (teh, start, stop, teHilite); TERESTORE (); - TE_SEL_START_X (teh) = BigEndianValue (start); - TE_SEL_END_X (teh) = BigEndianValue (stop); + TE_SEL_START_X (teh) = CW (start); + TE_SEL_END_X (teh) = CW (stop); if (TE_ACTIVE (teh)) TE_CARET_STATE_X (teh) = (start != stop ? CWC (0) diff --git a/src/teMisc.cpp b/src/teMisc.cpp index 62a885b0..d2b04804 100644 --- a/src/teMisc.cpp +++ b/src/teMisc.cpp @@ -27,7 +27,6 @@ char ROMlib_rcsid_teMisc[] = #include "rsys/text.h" using namespace Executor; -using namespace ByteSwap; int16 nextbreak (TEHandle teh, int16 off, int16 len, int16 max_width); @@ -322,7 +321,7 @@ int16 Executor::te_char_to_lineno (TEPtr te, int16 sel) current = (high + low) / 2; while (low < high - && (current_elt = BigEndianValue (line_starts[current])) != sel) + && (current_elt = CW (line_starts[current])) != sel) { if (current_elt < sel) low = current + 1; @@ -330,7 +329,7 @@ int16 Executor::te_char_to_lineno (TEPtr te, int16 sel) high = current - 1; current = (high + low) / 2; } - if (BigEndianValue (line_starts[current]) > sel + if (CW (line_starts[current]) > sel || current == n_lines) retval = current - 1; else @@ -385,10 +384,10 @@ calclhtab (TEHandle teh) if (ST_ELT_ASCENT (current_style) > LH_ASCENT (lh)) LH_ASCENT_X (lh) = ST_ELT_ASCENT_X (current_style); - if (BigEndianValue (*linestarts) == TE_LENGTH (teh)) + if (CW (*linestarts) == TE_LENGTH (teh)) break; - if (STYLE_RUN_START_CHAR (current_run + 1) > BigEndianValue (linestarts[1])) + if (STYLE_RUN_START_CHAR (current_run + 1) > CW (linestarts[1])) { if (first_changed == -1 && ( LH_HEIGHT (lh) != orig_height @@ -398,7 +397,7 @@ calclhtab (TEHandle teh) lh ++; clear_lh_p = TRUE; } - else if (STYLE_RUN_START_CHAR (current_run + 1) < BigEndianValue (linestarts[1])) + else if (STYLE_RUN_START_CHAR (current_run + 1) < CW (linestarts[1])) current_run ++; else { @@ -479,7 +478,7 @@ Executor::ROMlib_caltext (TEHandle te, int line_start = LINE_START (line_starts, t); int new_line_start = line_start + n_added; - LINE_START_X (line_starts, t) = BigEndianValue (new_line_start); + LINE_START_X (line_starts, t) = CW (new_line_start); } /* starting from the first line, recompute all the end lines. we @@ -512,7 +511,7 @@ Executor::ROMlib_caltext (TEHandle te, been relocated */ line_starts = TE_LINE_STARTS (te); orig_current_line_break = LINE_START (line_starts, current_lineno + 1); - LINE_START_X (line_starts, current_lineno + 1) = BigEndianValue (current_line_break); + LINE_START_X (line_starts, current_lineno + 1) = CW (current_line_break); if (first_changed == -1 && orig_current_line_break != current_line_break) @@ -525,7 +524,7 @@ Executor::ROMlib_caltext (TEHandle te, else n_lines = current_lineno + 1; - TE_N_LINES_X (te) = BigEndianValue (n_lines); + TE_N_LINES_X (te) = CW (n_lines); te_set_line_starts_allocation (te, n_lines); line_starts = TE_LINE_STARTS (te); LINE_START_X (line_starts, n_lines + 1) = CWC (0); @@ -577,7 +576,7 @@ P1 (PUBLIC pascal trap, void, TECalText, TEHandle, te) /* don't do this check because people call this caltext when the TE has been frobbed and is in a wacky state */ /* TE_SLAM (te); */ - TE_LENGTH_X (te) = BigEndianValue (GetHandleSize (TE_HTEXT (te))); + TE_LENGTH_X (te) = CW (GetHandleSize (TE_HTEXT (te))); ROMlib_caltext (te, 0, 32767, NULL, NULL); TE_SLAM (te); } @@ -632,7 +631,7 @@ Executor::ROMlib_call_TEDoText (TEPtr tp, int16 first, int16 last, int16 what) EM_D3 = (LONGINT) first; EM_D4 = (LONGINT) last; EM_D7 = (LONGINT) what; - EM_A0 = (LONGINT) (long) BigEndianValue ((long) TEDoText); + EM_A0 = (LONGINT) (long) CL ((long) TEDoText); CALL_EMULATOR (EM_A0); myd0 = EM_D0; EM_D2 = saved2; diff --git a/src/teScrap.cpp b/src/teScrap.cpp index 22e95f2a..bf90f251 100644 --- a/src/teScrap.cpp +++ b/src/teScrap.cpp @@ -18,7 +18,6 @@ char ROMlib_rcsid_teScrap[] = #include "rsys/mman.h" using namespace Executor; -using namespace ByteSwap; A0(PUBLIC, OSErr, TEFromScrap) { @@ -31,7 +30,7 @@ A0(PUBLIC, OSErr, TEFromScrap) TEScrpLength = CWC (0); } else - TEScrpLength = BigEndianValue (m); + TEScrpLength = CW (m); return m < 0 ? m : noErr; } @@ -42,7 +41,7 @@ A0 (PUBLIC, OSErr, TEToScrap) LOCK_HANDLE_EXCURSION_1 (MR (TEScrpHandle), { - m = PutScrap (BigEndianValue (TEScrpLength), TICK ("TEXT"), + m = PutScrap (CW (TEScrpLength), TICK ("TEXT"), STARH (MR (TEScrpHandle))); }); return m < 0 ? m : 0; @@ -55,10 +54,10 @@ A0 (PUBLIC, Handle, TEScrapHandle) A0 (PUBLIC, int32, TEGetScrapLen) { - return BigEndianValue (TEScrpLength); + return CW (TEScrpLength); } A1 (PUBLIC, void, TESetScrapLen, int32, ln) { - TEScrpLength = BigEndianValue (ln); + TEScrpLength = CW (ln); } diff --git a/src/time.cpp b/src/time.cpp index ca79944b..5dd1168d 100644 --- a/src/time.cpp +++ b/src/time.cpp @@ -29,7 +29,6 @@ char ROMlib_rcsid_time[] = #endif using namespace Executor; -using namespace ByteSwap; #if defined (SYSV) LONGINT @@ -186,12 +185,12 @@ A3 (PRIVATE, LONGINT, catchalarm, LONGINT, volatile signo, qp; qp = (TMTask *) MR (qp->qLink)) { - tm_count = BigEndianValue (qp->tmCount); + tm_count = CL (qp->tmCount); if (tm_count > 0) { tm_count -= diff; - qp->tmCount = BigEndianValue (tm_count); + qp->tmCount = CL (tm_count); if (tm_count <= 0) { ProcPtr tm_addr; @@ -226,7 +225,7 @@ A3 (PRIVATE, LONGINT, catchalarm, LONGINT, volatile signo, qp; qp = (TMTask *) MR (qp->qLink)) { - tm_count = BigEndianValue (qp->tmCount); + tm_count = CL (qp->tmCount); if (tm_count > 0 && tm_count < min) min = tm_count; } @@ -337,7 +336,7 @@ A2 (PRIVATE, void, ROMlib_PrimeTime, QElemPtr, taskp, LONGINT, count) * way the extra time subtracted off during the catchalarm will * exactly match the extra time we added here. */ - ((TMTask *) taskp)->tmCount = BigEndianValue (count + now_msecs - last_interrupt_msecs); + ((TMTask *) taskp)->tmCount = CL (count + now_msecs - last_interrupt_msecs); if (count < msecs_until_next || msecs_until_next <= 0) { diff --git a/src/toolevent.cpp b/src/toolevent.cpp index 5fc0b869..a6eb4644 100644 --- a/src/toolevent.cpp +++ b/src/toolevent.cpp @@ -52,11 +52,11 @@ char ROMlib_rcsid_toolevent[] = #include "rsys/custom.h" #include "rsys/toolevent.h" #include "rsys/nextprint.h" +#include "rsys/scrap.h" #include using namespace Executor; -using namespace ByteSwap; /* #define EVENTTRACE */ @@ -145,7 +145,7 @@ A0(PRIVATE, void, ROMlib_togglealarm) src_alarm_bitmap.baseAddr = (*alarmh).p; else /* once again, we need to move the (Ptr) cast - inside the BigEndianValue () because it confuses gcc */ + inside the CL () because it confuses gcc */ src_alarm_bitmap.baseAddr = RM ((Ptr) hard_coded_alarm); /* save the screen to save_alarm_bitmap */ @@ -719,7 +719,7 @@ PRIVATE void mod_item_enableness( DialogPtr dp, INTEGER item, Rect r; GetDItem(dp, item, &type, &h, &r); - type = BigEndianValue(type); + type = CW(type); h.p = MR(h.p); if (((type & itemDisable) && enableness_wanted == enable) || (!(type & itemDisable) && enableness_wanted == disable)) @@ -837,7 +837,7 @@ PRIVATE void dopreferences( void ) do { ModalDialog((ProcPtr) 0, &ihit); - ihit = BigEndianValue(ihit); + ihit = CW(ihit); switch (ihit) { case PREFNORMALITEM: @@ -927,7 +927,7 @@ A3(PRIVATE, BOOLEAN, doevent, INTEGER, em, EventRecord *, evt, if (SPVolCtl & 0x80) { TRACE(3); GetDateTime(&now); - now = BigEndianValue(now); + now = CL(now); TRACE(4); if ((ULONGINT) now >= (ULONGINT) Cx(SPAlarm)) { TRACE(5); @@ -956,7 +956,7 @@ A3(PRIVATE, BOOLEAN, doevent, INTEGER, em, EventRecord *, evt, TRACE(12); GetOSEvent(0, evt); TRACE(13); - evt->what = BigEndianValue(activateEvt); + evt->what = CW(activateEvt); evt->message = (LONGINT) (long) CurDeactive; if (remflag) CurDeactive = (WindowPtr) 0; @@ -967,9 +967,9 @@ A3(PRIVATE, BOOLEAN, doevent, INTEGER, em, EventRecord *, evt, TRACE(14); GetOSEvent(0, evt); TRACE(15); - evt->what = BigEndianValue(activateEvt); + evt->what = CW(activateEvt); evt->message = (LONGINT) (long) CurActivate; - evt->modifiers |= BigEndianValue(activeFlag); + evt->modifiers |= CW(activeFlag); if (remflag) CurActivate = (WindowPtr) 0; retval = TRUE; @@ -1042,7 +1042,7 @@ A3(PRIVATE, BOOLEAN, doevent, INTEGER, em, EventRecord *, evt, #endif } if (!retval) - evt->what = BigEndianValue(nullEvent); + evt->what = CW(nullEvent); /*-->*/ goto done; } } else { @@ -1066,7 +1066,7 @@ A3(PRIVATE, BOOLEAN, doevent, INTEGER, em, EventRecord *, evt, nread = read(ns, device, sizeof(device)); ROMlib_updateworkspace(); ROMlib_openfloppy(device, &evt->message); - evt->what = BigEndianValue(diskEvt); + evt->what = CW(diskEvt); retval = TRUE; } else { gui_assert(errno == EWOULDBLOCK); @@ -1077,7 +1077,7 @@ A3(PRIVATE, BOOLEAN, doevent, INTEGER, em, EventRecord *, evt, ROMlib_openharddisk("/tmp/testvol\0\0", &evt->message); if (evt->message) { TRACE(27); - evt->what = BigEndianValue(diskEvt); + evt->what = CW(diskEvt); retval = TRUE; } } @@ -1148,8 +1148,8 @@ P4(PUBLIC pascal trap, BOOLEAN, WaitNextEvent, INTEGER, mask, static INTEGER saved_h, saved_v; /* TODO: see what PtInRgn does with 0 as a RgnHandle */ - p.h = BigEndianValue(evp->where.h); - p.v = BigEndianValue(evp->where.v); + p.h = CW(evp->where.h); + p.v = CW(evp->where.v); if (mousergn && !EmptyRgn(mousergn) && !PtInRgn(p, mousergn) && (p.h != saved_h || p.v != saved_v)) { evp->what = CWC(osEvt); @@ -1247,12 +1247,12 @@ P0 (PUBLIC pascal trap, LONGINT, TickCount) */ if (ROMlib_clock) - Ticks_UL.u = BigEndianValue (ticks); + Ticks_UL.u = CL (ticks); new_time = (UNIXTIMETOMACTIME (ROMlib_start_time.tv_sec) + (long) ((ROMlib_start_time.tv_usec / (1000000.0 / 60) + ticks) / 60)); - Time = BigEndianValue (new_time); + Time = CL (new_time); return ticks; } @@ -1282,7 +1282,7 @@ static int sane_debugging_on = 0; /* Leave this off and let the person doing the #endif /* SANE_DEBUGGING */ PUBLIC void -sendsuspendevent (void) +Executor::sendsuspendevent (void) { Point p; @@ -1304,15 +1304,15 @@ sendsuspendevent (void) !(size_info.size_flags & SZcanBackground) */ ) ) { - p.h = BigEndianValue(MouseLocation.h); - p.v = BigEndianValue(MouseLocation.v); + p.h = CW(MouseLocation.h); + p.v = CW(MouseLocation.v); ROMlib_PPostEvent(osEvt, SUSPENDRESUMEBITS|SUSPEND|CONVERTCLIPBOARD, (HIDDEN_EvQElPtr *) 0, TickCount(), p, ROMlib_mods); } } PUBLIC void -sendresumeevent (boolean_t cvtclip) +Executor::sendresumeevent (boolean_t cvtclip) { LONGINT what; Point p; @@ -1330,8 +1330,8 @@ sendresumeevent (boolean_t cvtclip) what = SUSPENDRESUMEBITS | RESUME; if (cvtclip) what |= CONVERTCLIPBOARD; - p.h = BigEndianValue(MouseLocation.h); - p.v = BigEndianValue(MouseLocation.v); + p.h = CW(MouseLocation.h); + p.v = CW(MouseLocation.v); ROMlib_PPostEvent(osEvt, what, (HIDDEN_EvQElPtr *) 0, TickCount(), p, ROMlib_mods); } @@ -1342,8 +1342,8 @@ sendcopy (void) { Point p; - p.h = BigEndianValue(MouseLocation.h); - p.v = BigEndianValue(MouseLocation.v); + p.h = CW(MouseLocation.h); + p.v = CW(MouseLocation.v); ROMlib_PPostEvent(keyDown, 0x0863, /* 0x63 == 'c' */ (HIDDEN_EvQElPtr *) 0, TickCount(), p, cmdKey|btnState); ROMlib_PPostEvent(keyUp, 0x0863, @@ -1355,8 +1355,8 @@ sendpaste (void) { Point p; - p.h = BigEndianValue(MouseLocation.h); - p.v = BigEndianValue(MouseLocation.v); + p.h = CW(MouseLocation.h); + p.v = CW(MouseLocation.v); ROMlib_PPostEvent(keyDown, 0x0976, /* 0x76 == 'v' */ (HIDDEN_EvQElPtr *) 0, TickCount(), p, cmdKey|btnState); ROMlib_PPostEvent(keyUp, 0x0976, @@ -1376,8 +1376,8 @@ post_helper (INTEGER code, uint8 raw, uint8 mapped, INTEGER mods) { Point p; - p.h = BigEndianValue(MouseLocation.h); - p.v = BigEndianValue(MouseLocation.v); + p.h = CW(MouseLocation.h); + p.v = CW(MouseLocation.v); ROMlib_PPostEvent(code, (raw << 8)|mapped, (HIDDEN_EvQElPtr *) 0, TickCount(), p, btnState|mods); diff --git a/src/toolutil.cpp b/src/toolutil.cpp index bc0f6924..7aae4026 100644 --- a/src/toolutil.cpp +++ b/src/toolutil.cpp @@ -31,7 +31,6 @@ char ROMlib_rcsid_toolutil[] = #include using namespace Executor; -using namespace ByteSwap; namespace Executor { PRIVATE Fixed minvert(Fixed); @@ -399,23 +398,23 @@ P3(PUBLIC pascal trap, void, LongMul, LONGINT, a, LONGINT, b, Int64Bit *, c) lb = b & 0xFFFF; halb = ha * lb; lahb = la * hb; - c->hiLong = BigEndianValue(ha * hb); - c->loLong = BigEndianValue(la * lb); - c->hiLong = BigEndianValue(BigEndianValue(c->hiLong) + (halb >> 16)); - c->hiLong = BigEndianValue(BigEndianValue(c->hiLong) + (lahb >> 16)); - carry = BigEndianValue(c->loLong) >> 31; - c->loLong = BigEndianValue(BigEndianValue(c->loLong) + (halb << 16)); + c->hiLong = CL(ha * hb); + c->loLong = CL(la * lb); + c->hiLong = CL(CL(c->hiLong) + (halb >> 16)); + c->hiLong = CL(CL(c->hiLong) + (lahb >> 16)); + carry = CL(c->loLong) >> 31; + c->loLong = CL(CL(c->loLong) + (halb << 16)); carry += (halb >> 15) & 1; - c->loLong = BigEndianValue(BigEndianValue(c->loLong) + (lahb << 16)); + c->loLong = CL(CL(c->loLong) + (lahb << 16)); carry += (lahb >> 15) & 1; carry >>= 1; - c->hiLong = BigEndianValue(BigEndianValue(c->hiLong) + (carry)); + c->hiLong = CL(CL(c->hiLong) + (carry)); if (sign == -1) { c->hiLong = ~c->hiLong; if (c->loLong) - c->loLong = BigEndianValue(~BigEndianValue(c->loLong) + 1); + c->loLong = CL(~CL(c->loLong) + 1); else - c->hiLong = BigEndianValue(BigEndianValue(c->hiLong) + 1); + c->hiLong = CL(CL(c->hiLong) + 1); } } diff --git a/src/vbl.cpp b/src/vbl.cpp index 1ce77c59..5aefc26f 100644 --- a/src/vbl.cpp +++ b/src/vbl.cpp @@ -27,7 +27,6 @@ char ROMlib_rcsid_vbl[] = #include "rsys/prefs.h" using namespace Executor; -using namespace ByteSwap; typedef enum { @@ -83,7 +82,7 @@ A0 (PUBLIC, void, C_ROMlib_vcatch) EM_A7 = (EM_A7 - 32) & ~3; /* Might as well long-align it. */ /* Save the old Ticks value & compute new value. */ - old_ticks = BigEndianValue (Ticks); + old_ticks = CL (Ticks); new_ticks = C_TickCount (); ticks_elapsed = new_ticks - old_ticks; @@ -108,12 +107,12 @@ A0 (PUBLIC, void, C_ROMlib_vcatch) /* Account for possible missed ticks by possibly subtracting * off more than one tick from the VBL count. */ - old_vbl_count = BigEndianValue (vp->vblCount); + old_vbl_count = CW (vp->vblCount); new_vbl_count = old_vbl_count - ticks_elapsed; if (old_vbl_count > 0 && new_vbl_count < 0) new_vbl_count = 0; /* Only compensate for zero crossings. */ - vp->vblCount = BigEndianValue (new_vbl_count); + vp->vblCount = CW (new_vbl_count); if (new_vbl_count == 0) { VBLQueue.qFlags |= CWC (VBUSY); @@ -124,7 +123,7 @@ A0 (PUBLIC, void, C_ROMlib_vcatch) */ EM_A0 = (LONGINT) (long) US_TO_SYN68K_CHECK0(vp); - EM_A1 = (LONGINT) BigEndianValue ((long) vp->vblAddr); + EM_A1 = (LONGINT) CL ((long) vp->vblAddr); CALL_EMULATOR ((syn68k_addr_t) EM_A1); @@ -186,7 +185,7 @@ A1 (PUBLIC trap, OSErrRET, VInstall, VBLTaskPtr, vtaskp) { static unsigned short m68k_rts = CWC (0x4E75); /* RTS */ - vtaskp->vblCount = BigEndianValue (BigEndianValue (vtaskp->vblCount) + BigEndianValue (vtaskp->vblPhase)); + vtaskp->vblCount = CW (CW (vtaskp->vblCount) + CW (vtaskp->vblPhase)); if (vtaskp->qType == CWC ((INTEGER) vType)) { if (!VBLQueue.qHead) diff --git a/src/version.cpp b/src/version.cpp index 1056d579..a1565d41 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -16,7 +16,6 @@ char ROMlib_rcsid_version[] = #include "MemoryMgr.h" using namespace Executor; -using namespace ByteSwap; /* A simple version number like "1.99q" */ const char ROMlib_executor_version[] = EXECUTOR_VERSION; @@ -94,7 +93,7 @@ ROMlib_set_system_version (uint32 version) enum { MINOR_MASK = 0xF, REV_MASK = 0xF }; system_version = version; - SysVersion = BigEndianValue (version); + SysVersion = CW (version); major = version >> 8; minor = (version >> 4) & MINOR_MASK; diff --git a/src/vgavdriver.cpp b/src/vgavdriver.cpp index 6878bf87..cdd3284a 100644 --- a/src/vgavdriver.cpp +++ b/src/vgavdriver.cpp @@ -2031,12 +2031,12 @@ host_set_cursor (char *cursor_data, mask_baseaddr = alloca (16 * row_bytes); target_pixmap.baseAddr = RM (mask_baseaddr); - target_pixmap.rowBytes = BigEndianValue (row_bytes); + target_pixmap.rowBytes = CW (row_bytes); target_pixmap.bounds = ROMlib_cursor_rect; target_pixmap.cmpCount = CWC (1); target_pixmap.pixelType = CWC (0); target_pixmap.pixelSize = target_pixmap.cmpSize - = BigEndianValue (1 << vdriver_log2_bpp); + = CW (1 << vdriver_log2_bpp); /* The target pixmap colortable is not used by `convert_pixmap ()' * target_pixmap.pmTable = ...; */ @@ -2061,12 +2061,12 @@ host_set_cursor (char *cursor_data, for (xmod = 0; xmod < 8; xmod++) for (y = 0; y < 16; y++) { - and = ~(BigEndianValue (m[y]) << (16 - xmod)); + and = ~(CW (m[y]) << (16 - xmod)); cursor_masks.bpp1[xmod][y][0].and_mask = and >> 24; cursor_masks.bpp1[xmod][y][1].and_mask = and >> 16; cursor_masks.bpp1[xmod][y][2].and_mask = and >> 8; - xor = BigEndianValue (d[y]) << (16 - xmod); + xor = CW (d[y]) << (16 - xmod); cursor_masks.bpp1[xmod][y][0].xor_mask = xor >> 24; cursor_masks.bpp1[xmod][y][1].xor_mask = xor >> 16; cursor_masks.bpp1[xmod][y][2].xor_mask = xor >> 8; @@ -2084,21 +2084,21 @@ host_set_cursor (char *cursor_data, for (xmod = 0; xmod < 4; xmod++) for (y = 0; y < 16; y++) { - and = ~(BigEndianValue (m[y]) >> (xmod * 2)); + and = ~(CL (m[y]) >> (xmod * 2)); cursor_masks.bpp2[xmod][y][0].and_mask = and >> 24; cursor_masks.bpp2[xmod][y][1].and_mask = and >> 16; cursor_masks.bpp2[xmod][y][2].and_mask = and >> 8; cursor_masks.bpp2[xmod][y][3].and_mask = and; cursor_masks.bpp2[xmod][y][4].and_mask = - ~(BigEndianValue (m[y]) << (8 - (xmod * 2))); + ~(CL (m[y]) << (8 - (xmod * 2))); - xor = BigEndianValue (d[y]) >> (xmod * 2); + xor = CL (d[y]) >> (xmod * 2); cursor_masks.bpp2[xmod][y][0].xor_mask = xor >> 24; cursor_masks.bpp2[xmod][y][1].xor_mask = xor >> 16; cursor_masks.bpp2[xmod][y][2].xor_mask = xor >> 8; cursor_masks.bpp2[xmod][y][3].xor_mask = xor; cursor_masks.bpp2[xmod][y][4].xor_mask = - BigEndianValue (d[y]) << (8 - (xmod * 2)); + CL (d[y]) << (8 - (xmod * 2)); } break; } diff --git a/src/windColor.cpp b/src/windColor.cpp index 13afaa6d..5f4507c1 100644 --- a/src/windColor.cpp +++ b/src/windColor.cpp @@ -20,7 +20,6 @@ char ROMlib_rcsid_windColor[] = #include "rsys/wind.h" using namespace Executor; -using namespace ByteSwap; /* return a pointer to the auxilary window record associated with `w' */ @@ -138,7 +137,7 @@ P2 (PUBLIC pascal trap, void, SetWinColor, /* FIXME: copy? */ HxX (aux_w, awCTable) = RM (new_w_ctab); HxX (aux_w, dialogCItem) = 0; - HxX (aux_w, awFlags) = /* BigEndianValue (proc_id & 0x0F) */ 0; + HxX (aux_w, awFlags) = /* CL (proc_id & 0x0F) */ 0; HxX (aux_w, awReserved) = 0; HxX (aux_w, awRefCon) = 0; } @@ -157,7 +156,7 @@ P2 (PUBLIC pascal trap, void, SetWinColor, /* pick the best color and store it into window's port's bkColor field */ - PORT_BK_COLOR_X (w) = BigEndianValue (Color2Index (color)); + PORT_BK_COLOR_X (w) = CL (Color2Index (color)); if (WINDOW_VISIBLE_X (w)) THEPORT_SAVE_EXCURSION @@ -168,8 +167,8 @@ P2 (PUBLIC pascal trap, void, SetWinColor, CopyRgn (WINDOW_CONT_REGION (w), t); OffsetRgn (t, - BigEndianValue (PORT_BOUNDS (w).left), - BigEndianValue (PORT_BOUNDS (w).top)); + CW (PORT_BOUNDS (w).left), + CW (PORT_BOUNDS (w).top)); EraseRgn (t); DisposeRgn (t); }); diff --git a/src/windDisplay.cpp b/src/windDisplay.cpp index da9ba767..afefab59 100644 --- a/src/windDisplay.cpp +++ b/src/windDisplay.cpp @@ -20,7 +20,6 @@ char ROMlib_rcsid_windDisplay[] = #include "rsys/glue.h" using namespace Executor; -using namespace ByteSwap; P2(PUBLIC pascal trap, void, SetWTitle, WindowPtr, w, StringPtr, t) { @@ -31,7 +30,7 @@ P2(PUBLIC pascal trap, void, SetWTitle, WindowPtr, w, StringPtr, t) THEPORT_SAVE_EXCURSION (MR (wmgr_port), { - WINDOW_TITLE_WIDTH_X (w) = BigEndianValue (StringWidth (t)); + WINDOW_TITLE_WIDTH_X (w) = CW (StringWidth (t)); if (WINDOW_VISIBLE_X (w)) { @@ -320,9 +319,9 @@ P2(PUBLIC pascal trap, void, SendBehind, WindowPtr, w, WindowPtr, behind) #if 0 newfront = (WindowPeek) FrontWindow (); if (oldfront != newfront) { - CurDeactive = BigEndianValue((WindowPtr) oldfront); + CurDeactive = CL((WindowPtr) oldfront); HiliteWindow((WindowPtr) oldfront, FALSE); - CurActivate = BigEndianValue((WindowPtr) newfront); + CurActivate = CL((WindowPtr) newfront); HiliteWindow((WindowPtr) newfront, TRUE); } #else /* 0 */ @@ -347,16 +346,16 @@ P1(PUBLIC pascal trap, void, DrawGrowIcon, WindowPtr, w) { SetClip (PORT_CLIP_REGION (w)); OffsetRgn (WINDOW_STRUCT_REGION (w), - BigEndianValue (PORT_BOUNDS (w).left), - BigEndianValue (PORT_BOUNDS (w).top)); + CW (PORT_BOUNDS (w).left), + CW (PORT_BOUNDS (w).top)); SectRgn (PORT_CLIP_REGION (thePort), WINDOW_STRUCT_REGION (w), PORT_CLIP_REGION (thePort)); OffsetRgn (WINDOW_STRUCT_REGION (w), - - BigEndianValue (PORT_BOUNDS (w).left), - - BigEndianValue (PORT_BOUNDS (w).top)); + - CW (PORT_BOUNDS (w).left), + - CW (PORT_BOUNDS (w).top)); OffsetRgn (PORT_CLIP_REGION (thePort), - - BigEndianValue (PORT_BOUNDS (w).left), - - BigEndianValue (PORT_BOUNDS (w).top)); + - CW (PORT_BOUNDS (w).left), + - CW (PORT_BOUNDS (w).top)); ClipAbove ((WindowPeek) w); WINDCALL(w, wDrawGIcon, 0); }); diff --git a/src/windDocdef.cpp b/src/windDocdef.cpp index e9e8b959..72734a12 100644 --- a/src/windDocdef.cpp +++ b/src/windDocdef.cpp @@ -20,7 +20,6 @@ char ROMlib_rcsid_windDocdef[] = #include "rsys/image.h" using namespace Executor; -using namespace ByteSwap; namespace Executor { #include "zoom.cmap" @@ -41,8 +40,8 @@ PUBLIC BOOLEAN ROMlib_window_zoomed(WindowPeek wp) boundsrp = &PORT_BOUNDS (wp); retval = (WINDOW_SPARE_FLAG_X (wp) - && BigEndianValue (portrp->top) - BigEndianValue (boundsrp->top) == BigEndianValue (staterp->top) - && BigEndianValue (portrp->left) - BigEndianValue (boundsrp->left) == BigEndianValue (staterp->left) + && CW (portrp->top) - CW (boundsrp->top) == CW (staterp->top) + && CW (portrp->left) - CW (boundsrp->left) == CW (staterp->left) && RECT_WIDTH(portrp) == RECT_WIDTH(staterp) && RECT_HEIGHT(portrp) == RECT_HEIGHT(staterp) ); return retval; @@ -161,7 +160,7 @@ Executor::validate_colors_for_window (GrafPtr w) { /* same content color */ for (i = 0; i <= w_ctab_size; i ++) - if (w_ctab_table[i].value == BigEndianValue (wContentColor)) + if (w_ctab_table[i].value == CW (wContentColor)) color_window_colors[wContentColor] = w_ctab_table[i].rgb; } @@ -173,7 +172,7 @@ Executor::validate_colors_for_window (GrafPtr w) int w_ctab_entry_index; w_ctab_entry = &w_ctab_table[i]; - w_ctab_entry_index = BigEndianValue (w_ctab_entry->value); + w_ctab_entry_index = CW (w_ctab_entry->value); if (w_ctab_entry_index < 0 || w_ctab_entry_index > 12) { #if !defined (CYGWIN32) /* just gets in the way of debugging under windows */ @@ -301,10 +300,10 @@ toggle_box_active (enum box_flag which_box, Point origin) pixel_image_t *box; /* compute the destination rectangle */ - dst_rect.top = BigEndianValue (origin.v); - dst_rect.left = BigEndianValue (origin.h); - dst_rect.bottom = BigEndianValue (origin.v + 13); - dst_rect.right = BigEndianValue (origin.h + 13); + dst_rect.top = CW (origin.v); + dst_rect.left = CW (origin.h); + dst_rect.bottom = CW (origin.v + 13); + dst_rect.right = CW (origin.h + 13); /* set box */ if (rounded_window_p) @@ -321,7 +320,7 @@ toggle_box_active (enum box_flag which_box, Point origin) { /* invert the set bits of the box */ PORT_FG_COLOR_X (thePort) - = BigEndianValue ((1 << PIXMAP_PIXEL_SIZE (CPORT_PIXMAP (thePort))) - 1); + = CL ((1 << PIXMAP_PIXEL_SIZE (CPORT_PIXMAP (thePort))) - 1); PORT_FG_COLOR_X (thePort) = CLC (0); } else @@ -350,7 +349,7 @@ toggle_box_active (enum box_flag which_box, Point origin) target_color = &ROMlib_white_rgb_color; PORT_FG_COLOR_X (thePort) - = BigEndianValue (Color2Index (target_color) ^ Color2Index (frame)); + = CL (Color2Index (target_color) ^ Color2Index (frame)); } image_copy (rounded_window_p ? ractive : active, @@ -363,8 +362,8 @@ toggle_zoom_box (GrafPtr w) { Point origin; - origin.h = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left) - 21; - origin.v = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top) - 16; + origin.h = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left) - 21; + origin.v = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top) - 16; toggle_box_active (zoom_box_flag, origin); } @@ -374,8 +373,8 @@ toggle_go_away_box (GrafPtr w) { Point origin; - origin.h = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left) + 8; - origin.v = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top) - 16; + origin.h = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left) + 8; + origin.v = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top) - 16; toggle_box_active (go_away_box_flag, origin); } @@ -435,10 +434,10 @@ draw_title (GrafPtr w, int title_start; int left_bound; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); /* #warning "clean up this port mess in draw_title ()" */ GetPort(&tp); @@ -554,10 +553,10 @@ draw_frame (GrafPtr w, int draw_zoom_p, boolean_t goaway_override) int left, top, right, bottom; Rect r; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); PenSize (1, 1); /* draw with the current foreground color */ @@ -574,7 +573,7 @@ draw_frame (GrafPtr w, int draw_zoom_p, boolean_t goaway_override) /* draw the frame; these are drawn in the frame_outline_color */ RGBForeColor (frame_outline); - r.bottom = BigEndianValue (bottom + 1); + r.bottom = CW (bottom + 1); FrameRect (&r); MoveTo (left, top - 1); LineTo (right, top - 1); @@ -612,10 +611,10 @@ draw_grow_lines (Rect *bounds) int left, top, right, bottom; Rect r; - left = BigEndianValue (bounds->left); - top = BigEndianValue (bounds->top); - right = BigEndianValue (bounds->right); - bottom = BigEndianValue (bounds->bottom); + left = CW (bounds->left); + top = CW (bounds->top); + right = CW (bounds->right); + bottom = CW (bounds->bottom); PenSize (1, 1); SetRect (&r, left - 1, top - 19, right + 1, bottom + 1); @@ -638,10 +637,10 @@ draw_dialog_box (GrafPtr w) Rect r; RGBColor middle_color; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); PenSize (1, 1); PenMode (patCopy); @@ -722,10 +721,10 @@ draw_plain_dialog_box (GrafPtr w) int left, top, right, bottom; Rect r; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); PenSize (1, 1); PenMode (patCopy); @@ -740,10 +739,10 @@ draw_alt_dialog_box (GrafPtr w) int left, top, right, bottom; Rect r; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); PenSize (1, 1); PenMode (patCopy); @@ -766,10 +765,10 @@ draw_grow_icon (GrafPtr w) { int left, top, right, bottom; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); PenPat (black); PenSize (1, 1); @@ -788,10 +787,10 @@ draw_grow_icon (GrafPtr w) { Rect rect; - rect.top = BigEndianValue (bottom - 14); - rect.left = BigEndianValue (right - 14); - rect.bottom = BigEndianValue (bottom); - rect.right = BigEndianValue (right); + rect.top = CW (bottom - 14); + rect.left = CW (right - 14); + rect.bottom = CW (bottom); + rect.right = CW (right); image_copy (grow, color_p, &rect, srcCopy); } @@ -803,10 +802,10 @@ erase_grow_icon (GrafPtr w) int left, top, right, bottom; Rect r; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); PenPat (black); PenSize (1, 1); @@ -826,10 +825,10 @@ hit_doc (WindowPeek w, LONGINT parm, int growable_p, Point p; int left, top, right, bottom; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); p.v = HiWord (parm); p.h = LoWord (parm); @@ -891,40 +890,40 @@ calc_doc (GrafPtr w) INTEGER *ip; int left, top, right, bottom; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); SetRectRgn (WINDOW_CONT_REGION (w), left, top, right, bottom); rh = WINDOW_STRUCT_REGION (w); ReallocHandle ((Handle) rh, (Size) 44); - HxX (rh, rgnBBox.left) = BigEndianValue (left - 1); - HxX (rh, rgnBBox.top) = BigEndianValue (top - 19); - HxX (rh, rgnBBox.right) = BigEndianValue (right + 2); - HxX (rh, rgnBBox.bottom) = BigEndianValue (bottom + 2); + HxX (rh, rgnBBox.left) = CW (left - 1); + HxX (rh, rgnBBox.top) = CW (top - 19); + HxX (rh, rgnBBox.right) = CW (right + 2); + HxX (rh, rgnBBox.bottom) = CW (bottom + 2); HxX (rh, rgnSize) = CWC (44); ip = (INTEGER *) STARH (rh) + 5; - *ip++ = BigEndianValue(top - 19); - *ip++ = BigEndianValue(left - 1); - *ip++ = BigEndianValue(right + 1); + *ip++ = CW(top - 19); + *ip++ = CW(left - 1); + *ip++ = CW(right + 1); *ip++ = CWC(32767); - *ip++ = BigEndianValue(top - 18); - *ip++ = BigEndianValue(right + 1); - *ip++ = BigEndianValue(right + 2); + *ip++ = CW(top - 18); + *ip++ = CW(right + 1); + *ip++ = CW(right + 2); *ip++ = CWC(32767); - *ip++ = BigEndianValue(bottom + 1); - *ip++ = BigEndianValue(left - 1); - *ip++ = BigEndianValue(left); + *ip++ = CW(bottom + 1); + *ip++ = CW(left - 1); + *ip++ = CW(left); *ip++ = CWC(32767); - *ip++ = BigEndianValue(bottom + 2); - *ip++ = BigEndianValue(left); - *ip++ = BigEndianValue(right + 2); + *ip++ = CW(bottom + 2); + *ip++ = CW(left); + *ip++ = CW(right + 2); *ip++ = CWC(32767); *ip++ = CWC(32767); @@ -937,41 +936,41 @@ calc_alt_dialog_box (GrafPtr w) INTEGER *ip; int left, top, right, bottom; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); SetRectRgn (WINDOW_CONT_REGION (w), left, top, right, bottom); rh = WINDOW_STRUCT_REGION (w); ReallocHandle ((Handle) rh, (Size) 44); - HxX (rh, rgnBBox.left) = BigEndianValue (left - 1); - HxX (rh, rgnBBox.top) = BigEndianValue (top - 1); - HxX (rh, rgnBBox.right) = BigEndianValue (right + 3); - HxX (rh, rgnBBox.bottom) = BigEndianValue (bottom + 3); + HxX (rh, rgnBBox.left) = CW (left - 1); + HxX (rh, rgnBBox.top) = CW (top - 1); + HxX (rh, rgnBBox.right) = CW (right + 3); + HxX (rh, rgnBBox.bottom) = CW (bottom + 3); HxX (rh, rgnSize) = CWC (44); ip = (INTEGER *) STARH (rh) + 5; - *ip++ = BigEndianValue(top - 1); - *ip++ = BigEndianValue(left - 1); - *ip++ = BigEndianValue(right + 1); + *ip++ = CW(top - 1); + *ip++ = CW(left - 1); + *ip++ = CW(right + 1); *ip++ = CWC(32767); - *ip++ = BigEndianValue(top + 1); - *ip++ = BigEndianValue(right + 1); - *ip++ = BigEndianValue(right + 3); + *ip++ = CW(top + 1); + *ip++ = CW(right + 1); + *ip++ = CW(right + 3); *ip++ = CWC(32767); - *ip++ = BigEndianValue(bottom + 1); - *ip++ = BigEndianValue(left - 1); - *ip++ = BigEndianValue(left + 1); + *ip++ = CW(bottom + 1); + *ip++ = CW(left - 1); + *ip++ = CW(left + 1); *ip++ = CWC(32767); - *ip++ = BigEndianValue(bottom + 3); - *ip++ = BigEndianValue(left + 1); - *ip++ = BigEndianValue(right + 3); + *ip++ = CW(bottom + 3); + *ip++ = CW(left + 1); + *ip++ = CW(right + 3); *ip++ = CWC(32767); *ip++ = CWC(32767); @@ -982,10 +981,10 @@ calc_dialog_box (GrafPtr w, INTEGER n) { int left, top, right, bottom; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); SetRectRgn (WINDOW_CONT_REGION (w), left, top, right, bottom); SetRectRgn (WINDOW_STRUCT_REGION (w), @@ -1111,12 +1110,12 @@ P4 (PUBLIC pascal, LONGINT, wdef0, wsp->stdState = GD_BOUNDS (MR (TheGDevice)); InsetRect (&wsp->stdState, 3, 3); - wsp->stdState.top = BigEndianValue (BigEndianValue (wsp->stdState.top) + 38); + wsp->stdState.top = CW (CW (wsp->stdState.top) + 38); wsp->userState = PORT_RECT (w); /* local to global */ - OffsetRect (&wsp->userState, -BigEndianValue (PORT_BOUNDS (w).left), - -BigEndianValue (PORT_BOUNDS (w).top)); + OffsetRect (&wsp->userState, -CW (PORT_BOUNDS (w).left), + -CW (PORT_BOUNDS (w).top)); WINDOW_SPARE_FLAG_X (w) = TRUE; } @@ -1145,8 +1144,8 @@ P4 (PUBLIC pascal, LONGINT, wdef0, temp_rgn); OffsetRgn (temp_rgn, - - BigEndianValue (PORT_BOUNDS (w).left), - - BigEndianValue (PORT_BOUNDS (w).top)); + - CW (PORT_BOUNDS (w).left), + - CW (PORT_BOUNDS (w).top)); CopyRgn (PORT_CLIP_REGION (thePort), save_clip); SectRgn (PORT_CLIP_REGION (thePort), temp_rgn, @@ -1208,10 +1207,10 @@ draw_rounded_doc (GrafPtr w) int draw_go_away_p; Rect r; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); SetRect (&r, left - 1, top - 19, right + 1, top); FillRect (&r, white); @@ -1240,10 +1239,10 @@ hit_rounded_doc (GrafPtr w, LONGINT param) Point p; int left, top, right, bottom; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); p.v = HiWord (param); p.h = LoWord (param); @@ -1288,10 +1287,10 @@ calc_rounded_doc (GrafPtr w, INTEGER curve_code) RgnHandle rh; Rect r; - left = BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left); - top = BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top); - right = BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left); - bottom = BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top); + left = CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left); + top = CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top); + right = CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left); + bottom = CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top); SetRectRgn (WINDOW_CONT_REGION (w), left, top, right, bottom); @@ -1300,10 +1299,10 @@ calc_rounded_doc (GrafPtr w, INTEGER curve_code) else curve = 16; - r.left = BigEndianValue(left - 1); - r.top = BigEndianValue(top - 19); - r.right = BigEndianValue(right + 1); - r.bottom = BigEndianValue(bottom + 1); + r.left = CW(left - 1); + r.top = CW(top - 19); + r.right = CW(right + 1); + r.bottom = CW(bottom + 1); OpenRgn (); FrameRoundRect (&r, curve, curve); CloseRgn (WINDOW_STRUCT_REGION (w)); diff --git a/src/windInit.cpp b/src/windInit.cpp index 3fa1aaa3..d3b5edaa 100644 --- a/src/windInit.cpp +++ b/src/windInit.cpp @@ -42,7 +42,6 @@ char ROMlib_rcsid_windInit[] = #include "rsys/launch.h" using namespace Executor; -using namespace ByteSwap; PUBLIC BOOLEAN Executor::ROMlib_dirtyvariant = FALSE; @@ -104,12 +103,12 @@ P0 (PUBLIC pascal trap, void, InitWindows) FrameRect (&GD_BOUNDS (MR (TheGDevice))); CloseRgn (MR (GrayRgn)); mrgn = NewRgn(); - SetRectRgn(mrgn, 0, 0, BigEndianValue (GD_BOUNDS (MR (TheGDevice)).right), - BigEndianValue(MBarHeight)); + SetRectRgn(mrgn, 0, 0, CW (GD_BOUNDS (MR (TheGDevice)).right), + CW(MBarHeight)); SectRgn(MR(GrayRgn), mrgn, mrgn); corners = NewRgn(); - SetRectRgn(corners, 0, 0, BigEndianValue (GD_BOUNDS (MR (TheGDevice)).right), - BigEndianValue (GD_BOUNDS (MR (TheGDevice)).bottom)); + SetRectRgn(corners, 0, 0, CW (GD_BOUNDS (MR (TheGDevice)).right), + CW (GD_BOUNDS (MR (TheGDevice)).bottom)); DiffRgn(corners, MR(GrayRgn), corners); PaintRgn(corners); CopyRgn (MR (GrayRgn), PORT_VIS_REGION (MR (wmgr_port))); @@ -117,8 +116,8 @@ P0 (PUBLIC pascal trap, void, InitWindows) PenPat(white); PaintRgn(mrgn); PenPat(black); - MoveTo(0, BigEndianValue(MBarHeight) - 1); - Line (BigEndianValue (GD_BOUNDS (MR (TheGDevice)).right), 0); + MoveTo(0, CW(MBarHeight) - 1); + Line (CW (GD_BOUNDS (MR (TheGDevice)).right), 0); if ((USE_DESKCPAT_VAR & USE_DESKCPAT_BIT) && PIXMAP_PIXEL_SIZE (GD_PMAP (MR (MainDevice))) > 2) FillCRgn(MR(GrayRgn), MR(DeskCPat)); @@ -424,7 +423,7 @@ ROMlib_new_window_common (WindowPeek w, HxX (t_aux_w, awOwner) = (WindowPtr) RM (w); HxX (t_aux_w, awCTable) = (CTabHandle) RM (GetResource (TICK("wctb"), 0)); HxX (t_aux_w, dialogCItem) = 0; - HxX (t_aux_w, awFlags) = BigEndianValue ((proc_id & 0xF) << 24); + HxX (t_aux_w, awFlags) = CL ((proc_id & 0xF) << 24); HxX (t_aux_w, awReserved) = 0; HxX (t_aux_w, awRefCon) = 0; AuxWinHead = RM (t_aux_w); @@ -440,19 +439,19 @@ ROMlib_new_window_common (WindowPeek w, OpenCPort ((CGrafPtr) w); else OpenPort ((GrafPtr) w); - OffsetRect (&PORT_BOUNDS (w), -BigEndianValue (bounds->left), -BigEndianValue (bounds->top)); + OffsetRect (&PORT_BOUNDS (w), -CW (bounds->left), -CW (bounds->top)); PORT_RECT (w) = *bounds; - OffsetRect (&PORT_RECT (w), -BigEndianValue (bounds->left), -BigEndianValue (bounds->top)); + OffsetRect (&PORT_RECT (w), -CW (bounds->left), -CW (bounds->top)); LOCK_HANDLE_EXCURSION_1 (WINDOW_TITLE (w), { - WINDOW_TITLE_WIDTH_X (w) = BigEndianValue (StringWidth (STARH (WINDOW_TITLE (w)))); + WINDOW_TITLE_WIDTH_X (w) = CW (StringWidth (STARH (WINDOW_TITLE (w)))); }); TextFont (applFont); WINDOW_CONTROL_LIST_X (w) = (ControlHandle)CWC (0); WINDOW_PIC_X (w) = (PicHandle)CWC (0); - WINDOW_REF_CON_X (w) = BigEndianValue (ref_con); + WINDOW_REF_CON_X (w) = CL (ref_con); WINDCALL ((WindowPtr) w, wNew, 0); if (WINDOW_VISIBLE_X (w)) { @@ -573,7 +572,7 @@ P3 (PUBLIC pascal trap, CWindowPtr, GetNewCWindow, Hx (win_res, _wvisible) != 0, Hx (win_res, _wprocid), behind, Hx (win_res, _wgoaway) != 0, - BigEndianValue (*(LONGINT *) ((char *) &HxX (win_res, _wrect) + 14))); + CL (*(LONGINT *) ((char *) &HxX (win_res, _wrect) + 14))); win_ctab_res = ROMlib_getrestid (TICK ("wctb"), window_id); @@ -611,7 +610,7 @@ P3(PUBLIC pascal trap, WindowPtr, GetNewWindow, INTEGER, wid, Ptr, wst, (StringPtr) ((char *) &HxX(wh, _wrect) + 18), Hx(wh, _wvisible) != 0, Hx(wh, _wprocid), (WindowPtr) behind, Hx(wh, _wgoaway) != 0, - BigEndianValue(*(LONGINT *)( (char *) &HxX(wh, _wrect) + 14))); + CL(*(LONGINT *)( (char *) &HxX(wh, _wrect) + 14))); return(tp); } diff --git a/src/windMisc.cpp b/src/windMisc.cpp index 84f4597d..a6477e2a 100644 --- a/src/windMisc.cpp +++ b/src/windMisc.cpp @@ -26,7 +26,6 @@ char ROMlib_rcsid_windMisc[] = #include "rsys/executor.h" using namespace Executor; -using namespace ByteSwap; PRIVATE boolean_t is_window_ptr (WindowPeek w) @@ -51,7 +50,7 @@ is_window_ptr (WindowPeek w) P2(PUBLIC pascal trap, void, SetWRefCon, WindowPtr, w, LONGINT, data) { if (is_window_ptr ((WindowPeek) w)) - WINDOW_REF_CON_X (w) = BigEndianValue(data); + WINDOW_REF_CON_X (w) = CL(data); } /* @@ -106,14 +105,14 @@ P1(PUBLIC pascal trap, PicHandle, GetWindowPic, WindowPtr, w) P2(PUBLIC pascal trap, LONGINT, PinRect, Rect *, r, Point, p) { - if (p.h < BigEndianValue(r->left)) - p.h = BigEndianValue(r->left); - else if (p.h >= BigEndianValue(r->right)) - p.h = BigEndianValue(r->right) - 1; - if (p.v < BigEndianValue(r->top)) - p.v = BigEndianValue(r->top); - else if (p.v >= BigEndianValue(r->bottom)) - p.v = BigEndianValue(r->bottom) - 1; + if (p.h < CW(r->left)) + p.h = CW(r->left); + else if (p.h >= CW(r->right)) + p.h = CW(r->right) - 1; + if (p.v < CW(r->top)) + p.v = CW(r->top); + else if (p.v >= CW(r->bottom)) + p.v = CW(r->bottom) - 1; return(((LONGINT)p.v << 16) | (unsigned short) p.h); } @@ -144,8 +143,8 @@ P6 (PUBLIC pascal trap, LONGINT, DragTheRgn, while (!GetOSEvent(mUpMask, &ev)) { GlobalToLocal (&ev.where); - ev.where.h = BigEndianValue (ev.where.h); - ev.where.v = BigEndianValue (ev.where.v); + ev.where.h = CW (ev.where.h); + ev.where.v = CW (ev.where.v); if (PtInRect(ev.where, slop)) { l = PinRect (limit, ev.where); @@ -248,7 +247,7 @@ P1(PUBLIC pascal trap, BOOLEAN, CheckUpdate, EventRecord *, ev) }); else { - ev->what = BigEndianValue(updateEvt); + ev->what = CW(updateEvt); ev->message = (long) RM(wp); return TRUE; } @@ -369,8 +368,8 @@ P1(PUBLIC pascal trap, void, CalcVis, WindowPeek, w) DiffRgn (PORT_VIS_REGION (w), WINDOW_STRUCT_REGION (wp), PORT_VIS_REGION (w)); OffsetRgn (PORT_VIS_REGION (w), - BigEndianValue (PORT_BOUNDS (w).left), - BigEndianValue (PORT_BOUNDS (w).top)); + CW (PORT_BOUNDS (w).left), + CW (PORT_BOUNDS (w).top)); } } @@ -461,7 +460,7 @@ Executor::CALLDRAGHOOK (void) savea2 = EM_A2; savea3 = EM_A3; EM_D0 = 0; - CALL_EMULATOR((syn68k_addr_t) BigEndianValue((long)DragHook)); + CALL_EMULATOR((syn68k_addr_t) CL((long)DragHook)); EM_D0 = saved0; EM_D1 = saved1; EM_D2 = saved2; @@ -488,7 +487,7 @@ Executor::WINDCALLDESKHOOK (void) savea2 = EM_A2; savea3 = EM_A3; EM_D0 = 0; - CALL_EMULATOR((syn68k_addr_t) BigEndianValue((long) DeskHook)); + CALL_EMULATOR((syn68k_addr_t) CL((long) DeskHook)); EM_D0 = saved0; EM_D1 = saved1; EM_D2 = saved2; diff --git a/src/windMouse.cpp b/src/windMouse.cpp index 41136d8e..de262033 100644 --- a/src/windMouse.cpp +++ b/src/windMouse.cpp @@ -21,7 +21,6 @@ char ROMlib_rcsid_windMouse[] = #include "rsys/menu.h" using namespace Executor; -using namespace ByteSwap; #if !defined (No_STEF_zoommods) /* WINDOW_ZOOMED returns TRUE if w is currently in stdState (big) */ @@ -85,8 +84,8 @@ A3(PRIVATE, BOOLEAN, xTrackBox, WindowPtr, wp, Point, pt, WINDCALL(wp, wDraw, part); while (!GetOSEvent(mUpMask, &ev)) { - ev.where.h = BigEndianValue(ev.where.h); - ev.where.v = BigEndianValue(ev.where.v); + ev.where.h = CW(ev.where.h); + ev.where.v = CW(ev.where.v); CALLDRAGHOOK(); if (pt.h != ev.where.h || pt.v != ev.where.v) { @@ -146,13 +145,13 @@ P3(PUBLIC pascal trap, void, ZoomWindow, WindowPtr, wp, /* IMIV-50 */ { u = &((WStateData *) STARH (WINDOW_DATA (wp)))->userState; u->top - = BigEndianValue (BigEndianValue (PORT_RECT (wp).top) - BigEndianValue (PORT_BOUNDS (wp).top)); + = CW (CW (PORT_RECT (wp).top) - CW (PORT_BOUNDS (wp).top)); u->left - = BigEndianValue (BigEndianValue (PORT_RECT (wp).left) - BigEndianValue (PORT_BOUNDS (wp).left)); + = CW (CW (PORT_RECT (wp).left) - CW (PORT_BOUNDS (wp).left)); u->bottom - = BigEndianValue (BigEndianValue (PORT_RECT (wp).bottom) - BigEndianValue(PORT_BOUNDS (wp).top)); + = CW (CW (PORT_RECT (wp).bottom) - CW(PORT_BOUNDS (wp).top)); u->right - = BigEndianValue (BigEndianValue (PORT_RECT (wp).right) - BigEndianValue (PORT_BOUNDS (wp).left)); + = CW (CW (PORT_RECT (wp).right) - CW (PORT_BOUNDS (wp).left)); } #endif behind = NewRgn(); @@ -164,11 +163,11 @@ P3(PUBLIC pascal trap, void, ZoomWindow, WindowPtr, wp, /* IMIV-50 */ PORT_RECT (wp) = MR (*(WStateData **) WINDOW_DATA (wp))->stdState; OffsetRect (&PORT_BOUNDS (wp), - -BigEndianValue(PORT_RECT (wp).left) - BigEndianValue(PORT_BOUNDS (wp).left), - -BigEndianValue(PORT_RECT (wp).top) - BigEndianValue(PORT_BOUNDS (wp).top)); + -CW(PORT_RECT (wp).left) - CW(PORT_BOUNDS (wp).left), + -CW(PORT_RECT (wp).top) - CW(PORT_BOUNDS (wp).top)); OffsetRect (&PORT_RECT (wp), - -BigEndianValue (PORT_RECT (wp).left), -BigEndianValue (PORT_RECT (wp).top)); + -CW (PORT_RECT (wp).left), -CW (PORT_RECT (wp).top)); WINDCALL(wp, wCalcRgns, 0); UnionRgn(behind, WINDOW_STRUCT_REGION (wp), behind); diff --git a/src/windSize.cpp b/src/windSize.cpp index 6cba253a..338e9305 100644 --- a/src/windSize.cpp +++ b/src/windSize.cpp @@ -22,7 +22,6 @@ char ROMlib_rcsid_windSize[] = #include "rsys/wind.h" using namespace Executor; -using namespace ByteSwap; /* * Note, the code below probably be rewritten to use XorRgn as much @@ -64,8 +63,8 @@ P4(PUBLIC pascal trap, void, MoveWindow, WindowPtr, wp, INTEGER, h, INTEGER, v, RgnHandle last_three_pixels; tmpr = GD_BOUNDS (MR (TheGDevice)); - tmpr.top = BigEndianValue (BigEndianValue (tmpr.bottom) - 1); - tmpr.left = BigEndianValue (BigEndianValue (tmpr.right) - 3); + tmpr.top = CW (CW (tmpr.bottom) - 1); + tmpr.left = CW (CW (tmpr.right) - 3); last_three_pixels = NewRgn (); RectRgn (last_three_pixels, &tmpr); DiffRgn (movepart, last_three_pixels, movepart); @@ -92,11 +91,11 @@ P4(PUBLIC pascal trap, void, MoveWindow, WindowPtr, wp, INTEGER, h, INTEGER, v, * Picture editting window come up in the wrong place. * (That could be due to other inconsistencies though, like the */ - h += BigEndianValue (PORT_BOUNDS (w).left) - BigEndianValue (PORT_RECT (w).left); - v += BigEndianValue (PORT_BOUNDS (w).top) - BigEndianValue (PORT_RECT (w).top); + h += CW (PORT_BOUNDS (w).left) - CW (PORT_RECT (w).left); + v += CW (PORT_BOUNDS (w).top) - CW (PORT_RECT (w).top); #else - h += BigEndianValue (PORT_BOUNDS (w).left); - v += BigEndianValue (PORT_BOUNDS (w).top); + h += CW (PORT_BOUNDS (w).left); + v += CW (PORT_BOUNDS (w).top); #endif if (WINDOW_VISIBLE_X (w)) { @@ -182,15 +181,15 @@ P3 (PUBLIC pascal trap, void, DragWindow, WindowPtr, wp, Point, p, Rect *, rp) rh = NewRgn (); CopyRgn (WINDOW_STRUCT_REGION (wp), rh); r = *rp; - if (BigEndianValue (r.top) < 24) + if (CW (r.top) < 24) r.top = CWC (24); l = DragGrayRgn (rh, p, &r, &r, noConstraint, (ProcPtr) 0); if ((uint32) l != 0x80008000) MoveWindow(wp, - (- BigEndianValue (PORT_BOUNDS (wp).left) - + LoWord (l) + BigEndianValue (PORT_RECT (wp).left)), - (- BigEndianValue (PORT_BOUNDS (wp).top) - + HiWord (l) + BigEndianValue (PORT_RECT (wp).top)), + (- CW (PORT_BOUNDS (wp).left) + + LoWord (l) + CW (PORT_RECT (wp).left)), + (- CW (PORT_BOUNDS (wp).top) + + HiWord (l) + CW (PORT_RECT (wp).top)), !cmddown); DisposeRgn (rh); @@ -228,31 +227,31 @@ P3(PUBLIC pascal trap, LONGINT, GrowWindow, WindowPtr, w, Point, startp, p.h = startp.h; p.v = startp.v; #if 0 - r.left = BigEndianValue (- BigEndianValue (PORT_BOUNDS (w).left)); - r.top = BigEndianValue (- BigEndianValue (PORT_BOUNDS (w).top)); - r.right = BigEndianValue (BigEndianValue (r.left) + RECT_WIDTH (&PORT_RECT (w))); - r.bottom = BigEndianValue (BigEndianValue (r.top) + RECT_HEIGHT (&PORT_RECT (w))); + r.left = CW (- CW (PORT_BOUNDS (w).left)); + r.top = CW (- CW (PORT_BOUNDS (w).top)); + r.right = CW (CW (r.left) + RECT_WIDTH (&PORT_RECT (w))); + r.bottom = CW (CW (r.top) + RECT_HEIGHT (&PORT_RECT (w))); #else - r.left = BigEndianValue (BigEndianValue (PORT_RECT (w).left) - BigEndianValue (PORT_BOUNDS (w).left)); - r.top = BigEndianValue (BigEndianValue (PORT_RECT (w).top) - BigEndianValue (PORT_BOUNDS (w).top)); - r.right = BigEndianValue (BigEndianValue (PORT_RECT (w).right) - BigEndianValue (PORT_BOUNDS (w).left)); - r.bottom = BigEndianValue (BigEndianValue (PORT_RECT (w).bottom) - BigEndianValue (PORT_BOUNDS (w).top)); + r.left = CW (CW (PORT_RECT (w).left) - CW (PORT_BOUNDS (w).left)); + r.top = CW (CW (PORT_RECT (w).top) - CW (PORT_BOUNDS (w).top)); + r.right = CW (CW (PORT_RECT (w).right) - CW (PORT_BOUNDS (w).left)); + r.bottom = CW (CW (PORT_RECT (w).bottom) - CW (PORT_BOUNDS (w).top)); #endif - pinr.left = BigEndianValue(BigEndianValue(r.left) + BigEndianValue(rp->left)); - if (BigEndianValue(pinr.left) <= BigEndianValue(r.left) && BigEndianValue(rp->left) > 0) + pinr.left = CW(CW(r.left) + CW(rp->left)); + if (CW(pinr.left) <= CW(r.left) && CW(rp->left) > 0) pinr.left = CWC(32767); - pinr.top = BigEndianValue(BigEndianValue(r.top) + BigEndianValue(rp->top)); - if (BigEndianValue(pinr.top) <= BigEndianValue(r.top) && BigEndianValue(rp->top) > 0) + pinr.top = CW(CW(r.top) + CW(rp->top)); + if (CW(pinr.top) <= CW(r.top) && CW(rp->top) > 0) pinr.top = CWC(32767); - pinr.right = BigEndianValue(BigEndianValue(r.left) + BigEndianValue(rp->right)); - if (BigEndianValue(pinr.right) <= BigEndianValue(r.left) && BigEndianValue(rp->right) > 0) + pinr.right = CW(CW(r.left) + CW(rp->right)); + if (CW(pinr.right) <= CW(r.left) && CW(rp->right) > 0) pinr.right = CWC(32767); - pinr.bottom = BigEndianValue(BigEndianValue(r.top) + BigEndianValue(rp->bottom)); - if (BigEndianValue(pinr.bottom) <= BigEndianValue(r.top) && BigEndianValue(rp->bottom) > 0) + pinr.bottom = CW(CW(r.top) + CW(rp->bottom)); + if (CW(pinr.bottom) <= CW(r.top) && CW(rp->bottom) > 0) pinr.bottom = CWC(32767); gp = thePort; @@ -263,16 +262,16 @@ P3(PUBLIC pascal trap, LONGINT, GrowWindow, WindowPtr, w, Point, startp, WINDCALL((WindowPtr) w, wGrow, (LONGINT) (long) &r); while (!GetOSEvent(mUpMask, &ev)) { - ev.where.h = BigEndianValue(ev.where.h); - ev.where.v = BigEndianValue(ev.where.v); + ev.where.h = CW(ev.where.h); + ev.where.v = CW(ev.where.v); l = PinRect (&pinr, ev.where); ev.where.v = HiWord(l); ev.where.h = LoWord(l); if (p.h != ev.where.h || p.v != ev.where.v) { WINDCALL((WindowPtr) w, wGrow, (LONGINT) (long) &r); - r.right = BigEndianValue(BigEndianValue(r.right) + (ev.where.h - p.h)); - r.bottom = BigEndianValue(BigEndianValue(r.bottom) + (ev.where.v - p.v)); + r.right = CW(CW(r.right) + (ev.where.h - p.h)); + r.bottom = CW(CW(r.bottom) + (ev.where.v - p.v)); WINDCALL((WindowPtr) w, wGrow, (LONGINT) (long) &r); p.h = ev.where.h; p.v = ev.where.v; @@ -283,8 +282,8 @@ P3(PUBLIC pascal trap, LONGINT, GrowWindow, WindowPtr, w, Point, startp, RESTORE_PORT (MR ((GrafPtr) WMgrPort)); RESTORE_PORT (gp); if (p.h != startp.h || p.v != startp.v) -/*-->*/ return(((LONGINT)(BigEndianValue(r.bottom) - BigEndianValue(r.top)) << 16)| - (unsigned short)(BigEndianValue(r.right) - BigEndianValue(r.left))); +/*-->*/ return(((LONGINT)(CW(r.bottom) - CW(r.top)) << 16)| + (unsigned short)(CW(r.right) - CW(r.left))); else return(0L); } @@ -299,8 +298,8 @@ P4 (PUBLIC pascal trap, void, SizeWindow, WindowPtr, w, if (WINDOW_VISIBLE_X (w)) SaveOld ((WindowPeek) w); - PORT_RECT (w).right = BigEndianValue (BigEndianValue (PORT_RECT (w).left) + width); - PORT_RECT (w).bottom = BigEndianValue (BigEndianValue (PORT_RECT (w).top) + height); + PORT_RECT (w).right = CW (CW (PORT_RECT (w).left) + width); + PORT_RECT (w).bottom = CW (CW (PORT_RECT (w).top) + height); THEPORT_SAVE_EXCURSION (MR (wmgr_port), diff --git a/src/windUpdate.cpp b/src/windUpdate.cpp index 74fda7bd..2cd06630 100644 --- a/src/windUpdate.cpp +++ b/src/windUpdate.cpp @@ -16,7 +16,6 @@ char ROMlib_rcsid_windUpdate[] = #include "rsys/wind.h" using namespace Executor; -using namespace ByteSwap; P1(PUBLIC pascal trap, void, InvalRect, Rect *, r) { @@ -28,8 +27,8 @@ P1(PUBLIC pascal trap, void, InvalRect, Rect *, r) r_copy = *r; /* Just in case NewRgn moves memory */ rh = NewRgn(); RectRgn(rh, &r_copy); - OffsetRgn(rh, -BigEndianValue (PORT_BOUNDS (thePort).left), - -BigEndianValue (PORT_BOUNDS (thePort).top)); + OffsetRgn(rh, -CW (PORT_BOUNDS (thePort).left), + -CW (PORT_BOUNDS (thePort).top)); UnionRgn(rh, WINDOW_UPDATE_REGION (thePort), WINDOW_UPDATE_REGION (thePort)); DisposeRgn(rh); @@ -43,8 +42,8 @@ P1 (PUBLIC pascal trap, void, InvalRgn, RgnHandle, r) int top, left; current_port = thePort; - top = BigEndianValue (PORT_BOUNDS (current_port).top); - left = BigEndianValue (PORT_BOUNDS (current_port).left); + top = CW (PORT_BOUNDS (current_port).top); + left = CW (PORT_BOUNDS (current_port).left); OffsetRgn (r, -left, -top); @@ -60,8 +59,8 @@ P1(PUBLIC pascal trap, void, ValidRect, Rect *, r) rh = NewRgn(); RectRgn(rh, r); - OffsetRgn(rh, -BigEndianValue (PORT_BOUNDS (thePort).left), - -BigEndianValue (PORT_BOUNDS (thePort).top)); + OffsetRgn(rh, -CW (PORT_BOUNDS (thePort).left), + -CW (PORT_BOUNDS (thePort).top)); DiffRgn (WINDOW_UPDATE_REGION (thePort), rh, WINDOW_UPDATE_REGION (thePort)); DisposeRgn(rh); @@ -69,12 +68,12 @@ P1(PUBLIC pascal trap, void, ValidRect, Rect *, r) P1(PUBLIC pascal trap, void, ValidRgn, RgnHandle, r) { - OffsetRgn(r, -BigEndianValue (PORT_BOUNDS (thePort).left), - -BigEndianValue (PORT_BOUNDS (thePort).top)); + OffsetRgn(r, -CW (PORT_BOUNDS (thePort).left), + -CW (PORT_BOUNDS (thePort).top)); DiffRgn (WINDOW_UPDATE_REGION (thePort), r, WINDOW_UPDATE_REGION (thePort)); - OffsetRgn (r, BigEndianValue (PORT_BOUNDS (thePort).left), - BigEndianValue (PORT_BOUNDS (thePort).top)); + OffsetRgn (r, CW (PORT_BOUNDS (thePort).left), + CW (PORT_BOUNDS (thePort).top)); } PUBLIC int Executor::ROMlib_emptyvis = 0; @@ -96,8 +95,8 @@ P1(PUBLIC pascal trap, void, BeginUpdate, WindowPtr, w) { CopyRgn (WINDOW_UPDATE_REGION (w), PORT_VIS_REGION (w)); OffsetRgn (PORT_VIS_REGION (w), - BigEndianValue (PORT_BOUNDS (w).left), - BigEndianValue (PORT_BOUNDS (w).top)); + CW (PORT_BOUNDS (w).left), + CW (PORT_BOUNDS (w).top)); SectRgn (PORT_VIS_REGION (w), MR (SaveVisRgn), PORT_VIS_REGION (w)); SetEmptyRgn (WINDOW_UPDATE_REGION (w)); ROMlib_emptyvis = EmptyRgn (PORT_VIS_REGION (w)); @@ -109,7 +108,7 @@ P1(PUBLIC pascal trap, void, EndUpdate, WindowPtr, w) CopyRgn(MR(SaveVisRgn), PORT_VIS_REGION (w)); CopyRgn (WINDOW_CONT_REGION (w), MR (SaveVisRgn)); OffsetRgn (MR (SaveVisRgn), - BigEndianValue (PORT_BOUNDS (w).left), - BigEndianValue (PORT_BOUNDS (w).top)); + CW (PORT_BOUNDS (w).left), + CW (PORT_BOUNDS (w).top)); ROMlib_emptyvis = 0; } diff --git a/src/xdata.cpp b/src/xdata.cpp index 9732876b..ce76769f 100644 --- a/src/xdata.cpp +++ b/src/xdata.cpp @@ -19,7 +19,6 @@ char ROMlib_rcsid_xdata[] = #include "rsys/vdriver.h" using namespace Executor; -using namespace ByteSwap; boolean_t Executor::update_xdata_if_needed (xdata_handle_t xh, PixPat *pixpat, @@ -30,7 +29,7 @@ Executor::update_xdata_if_needed (xdata_handle_t xh, PixPat *pixpat, x = STARH (xh); if (x->ctab_seed_x != CTAB_SEED_X (MR (dest->pmTable)) - || (1 << x->log2_bpp) != BigEndianValue (dest->pixelSize) + || (1 << x->log2_bpp) != CW (dest->pixelSize) || (x->log2_bpp >= 4 && x->rgb_spec != pixmap_rgb_spec (dest))) { if (x->raw_pat_bits_mem) @@ -114,10 +113,10 @@ raw_bits_for_pattern (const Pattern pattern, PixMap *target, conv_table->ctTable[0].value = CWC (0); conv_table->ctTable[1].value = CWC (~0); - target_depth = BigEndianValue (target->pixelSize); + target_depth = CW (target->pixelSize); dst_row_bytes = target_depth; /* old-style Patterns always 8 pixels wide. */ *row_bytes = dst_row_bytes; - dst_pixmap_tmpl.rowBytes = (BigEndianValue (dst_row_bytes) + dst_pixmap_tmpl.rowBytes = (CW (dst_row_bytes) | (target->rowBytes & ROWBYTES_FLAG_BITS_X) | PIXMAP_DEFAULT_ROWBYTES_X); pixmap_set_pixel_fields (&dst_pixmap_tmpl, target_depth); @@ -152,13 +151,13 @@ raw_bits_for_color_pattern (PixPatPtr pixpat, PixMap *target, src = STARH (patmap); bounds = &src->bounds; - target_depth = BigEndianValue (target->pixelSize); + target_depth = CW (target->pixelSize); row_bytes = ((RECT_WIDTH (bounds) * target_depth) + 7) / 8; *row_bytesp = row_bytes; dst = *target; dst.bounds = *bounds; - dst.rowBytes = (BigEndianValue (row_bytes) + dst.rowBytes = (CW (row_bytes) | (target->rowBytes & ROWBYTES_FLAG_BITS_X) | PIXMAP_DEFAULT_ROWBYTES_X); dst.baseAddr = (Ptr) RM (bits); @@ -189,7 +188,7 @@ raw_bits_for_rgb_pattern (PixPatPtr pixpat, PixMap *target, */ desired_color = CTAB_TABLE (PIXMAP_TABLE (MR (pixpat->patMap)))[4].rgb; - target_depth = BigEndianValue (target->pixelSize); + target_depth = CW (target->pixelSize); if (target_depth <= 8) { @@ -312,7 +311,7 @@ xdata_for_raw_data (PixMap *target, xdata_t *x, uint32 *raw_bits, memset (x, 0, sizeof *x); x->magic_cookie = XDATA_MAGIC_COOKIE; - x->log2_bpp = ROMlib_log2[BigEndianValue (target->pixelSize)]; + x->log2_bpp = ROMlib_log2[CW (target->pixelSize)]; x->ctab_seed_x = CTAB_SEED_X (MR (target->pmTable)); x->rgb_spec = pixmap_rgb_spec (target); diff --git a/src/xdblt.cpp b/src/xdblt.cpp index 8bdc772b..e8776f54 100644 --- a/src/xdblt.cpp +++ b/src/xdblt.cpp @@ -28,7 +28,6 @@ char ROMlib_rcsid_xdblt[] = #include "rsys/autorefresh.h" using namespace Executor; -using namespace ByteSwap; /* Holds the four-byte pattern value, for "short & narrow" patterns. */ uint32 xdblt_pattern_value asm ("_xdblt_pattern_value"); @@ -129,14 +128,14 @@ hide_cursor_if_necessary (RgnHandle rh, const PixMap *dst, boolean_t *old_vis) int top, left; RgnPtr rp; - top = BigEndianValue (dst->bounds.top); - left = BigEndianValue (dst->bounds.left); + top = CW (dst->bounds.top); + left = CW (dst->bounds.left); rp = STARH (rh); - *old_vis = host_hide_cursor_if_intersects (BigEndianValue (rp->rgnBBox.top) - top, - BigEndianValue (rp->rgnBBox.left) - left, - BigEndianValue (rp->rgnBBox.bottom) - top, - BigEndianValue (rp->rgnBBox.right) - left); + *old_vis = host_hide_cursor_if_intersects (CW (rp->rgnBBox.top) - top, + CW (rp->rgnBBox.left) - left, + CW (rp->rgnBBox.bottom) - top, + CW (rp->rgnBBox.right) - left); return TRUE; } @@ -173,13 +172,13 @@ setup_dst_bitmap (int log2_bpp, PixMap *dst_pixmap) #endif } - dst -= row_bytes * BigEndianValue (dst_pixmap->bounds.top); + dst -= row_bytes * CW (dst_pixmap->bounds.top); xdblt_dst_row_bytes = row_bytes; byte_slop = (unsigned long) dst & 3; xdblt_dst_baseaddr = (uint32 *) (dst - byte_slop); xdblt_x_offset = ((byte_slop << 3) - - (BigEndianValue (dst_pixmap->bounds.left) << log2_bpp)); + - (CW (dst_pixmap->bounds.left) << log2_bpp)); return xdblt_x_offset << 3; } @@ -242,17 +241,17 @@ Executor::xdblt_xdata_norgb_norotate (RgnHandle rh, int mode, { int top, left; - top = BigEndianValue (dst->bounds.top); - left = BigEndianValue (dst->bounds.left); + top = CW (dst->bounds.top); + left = CW (dst->bounds.left); accel_result = vdriver_accel_rect_fill - (BigEndianValue (r->rgnBBox.top) - top, BigEndianValue (r->rgnBBox.left) - left, - BigEndianValue (r->rgnBBox.bottom) - top, BigEndianValue (r->rgnBBox.right) - left, + (CW (r->rgnBBox.top) - top, CW (r->rgnBBox.left) - left, + CW (r->rgnBBox.bottom) - top, CW (r->rgnBBox.right) - left, xdblt_pattern_value & ROMlib_pixel_size_mask[x->log2_bpp]); if (accel_result != VDRIVER_ACCEL_NO_UPDATE) - note_executor_changed_screen (BigEndianValue (r->rgnBBox.top) - top, - BigEndianValue (r->rgnBBox.bottom) - top); + note_executor_changed_screen (CW (r->rgnBBox.top) - top, + CW (r->rgnBBox.bottom) - top); } else accel_result = VDRIVER_ACCEL_NO_UPDATE; @@ -680,17 +679,17 @@ do_short_narrow_pattern (RgnHandle rh, int mode, uint32 v, PixMap *dst, { int top, left; - top = BigEndianValue (dst->bounds.top); - left = BigEndianValue (dst->bounds.left); + top = CW (dst->bounds.top); + left = CW (dst->bounds.left); accel_result = vdriver_accel_rect_fill - (BigEndianValue (r->rgnBBox.top) - top, BigEndianValue (r->rgnBBox.left) - left, - BigEndianValue (r->rgnBBox.bottom) - top, BigEndianValue (r->rgnBBox.right) - left, + (CW (r->rgnBBox.top) - top, CW (r->rgnBBox.left) - left, + CW (r->rgnBBox.bottom) - top, CW (r->rgnBBox.right) - left, xdblt_pattern_value & ROMlib_pixel_size_mask[log2_bpp]); if (accel_result != VDRIVER_ACCEL_NO_UPDATE) - note_executor_changed_screen (BigEndianValue (r->rgnBBox.top) - top, - BigEndianValue (r->rgnBBox.bottom) - top); + note_executor_changed_screen (CW (r->rgnBBox.top) - top, + CW (r->rgnBBox.bottom) - top); } else accel_result = VDRIVER_ACCEL_NO_UPDATE; @@ -778,7 +777,7 @@ Executor::xdblt_pattern (RgnHandle rh, int mode, rgb_spec = pixmap_rgb_spec (dst); /* Tile fg and bk colors out to 32bpp. */ - log2_bpp = ROMlib_log2[BigEndianValue (dst->pixelSize)]; + log2_bpp = ROMlib_log2[CW (dst->pixelSize)]; mask = ROMlib_pixel_size_mask[log2_bpp]; tile = ROMlib_pixel_tile_scale[log2_bpp]; fg_color = (fg_color & mask) * tile;