mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-17 18:12:01 +01:00
swapping of EventType and DateTimeType now generated
This commit is contained in:
parent
eccdbd145f
commit
cf9a93a59b
3 changed files with 40 additions and 128 deletions
|
@ -91,7 +91,7 @@ my %typeInfo = (
|
|||
"Coord" => { "size" => 2, "a0" => 0 }, # ???
|
||||
"Coord*" => { "size" => 4, "a0" => 0, "autoSwap" => 2 },
|
||||
"DateFormatType" => { "size" => 1, "a0" => 0 }, # enum
|
||||
"DateTimeType*" => { "size" => 4, "a0" => 0 },
|
||||
"DateTimeType*" => { "size" => 4, "a0" => 0, "autoSwap" => -1 },
|
||||
"DmOpenRef" => { "size" => 4, "a0" => 1 },
|
||||
"DmResID" => { "size" => 2, "a0" => 0 },
|
||||
"DmResType" => { "size" => 4, "a0" => 0 },
|
||||
|
@ -99,7 +99,7 @@ my %typeInfo = (
|
|||
"Err" => { "size" => 2, "a0" => 0 },
|
||||
"Err*" => { "size" => 4, "a0" => 1 },
|
||||
"EventPtr" => { "size" => 4, "a0" => 1 },
|
||||
"EventType*" => { "size" => 4, "a0" => 1 },
|
||||
"EventType*" => { "size" => 4, "a0" => 1, "autoSwap" => -1 },
|
||||
"ExgDBWriteProcPtr" => { "size" => 4, "a0" => 1 },
|
||||
"ExgSocketType*" => { "size" => 4, "a0" => 1, "autoSwap" => -1 },
|
||||
"FieldAttrPtr" => { "size" => 4, "a0" => 1 },
|
||||
|
@ -464,6 +464,18 @@ sub print_func_impl($$$$$$) {
|
|||
return $result;
|
||||
} # print_func_impl
|
||||
|
||||
# create a signature for each function. We'll see how many match up.
|
||||
sub funcId($$) {
|
||||
my ( $retType, $parms ) = @_;
|
||||
my $id = "${retType}_";
|
||||
|
||||
foreach my $param ( @$parms ) {
|
||||
$id .= $$param{"type"};
|
||||
}
|
||||
|
||||
return $id;
|
||||
} # funcId
|
||||
|
||||
|
||||
###########################################################################
|
||||
# Main
|
||||
|
@ -540,6 +552,8 @@ EOF
|
|||
$$ref{'sel'},
|
||||
$$ref{'trapType'});
|
||||
print $outRef $funcstr;
|
||||
|
||||
# print STDERR "funcID: ", funcId( $type, $$ref{'params'} ), "\n";
|
||||
}
|
||||
|
||||
if ( $dot_c ne "-" ) {
|
||||
|
|
|
@ -214,41 +214,13 @@ StrVPrintF( Char* s, const Char* formatStr, _Palm_va_list arg )
|
|||
return result;
|
||||
} /* StrVPrintF */
|
||||
|
||||
/* from file DateTime.h */
|
||||
void
|
||||
TimSecondsToDateTime( UInt32 seconds, DateTimeType* dateTimeP )
|
||||
{
|
||||
FUNC_HEADER(TimSecondsToDateTime);
|
||||
{
|
||||
DateTimeType dateTime;
|
||||
PNOState* sp = GET_CALLBACK_STATE();
|
||||
STACK_START(unsigned char, stack, 8);
|
||||
ADD_TO_STACK4(stack, seconds, 0);
|
||||
ADD_TO_STACK4(stack, &dateTime, 4);
|
||||
STACK_END(stack);
|
||||
|
||||
(*sp->call68KFuncP)( sp->emulStateP,
|
||||
PceNativeTrapNo(sysTrapTimSecondsToDateTime),
|
||||
stack, 8 );
|
||||
|
||||
dateTimeP->second = Byte_Swap16( dateTime.second );
|
||||
dateTimeP->minute = Byte_Swap16( dateTime.minute );
|
||||
dateTimeP->hour = Byte_Swap16( dateTime.hour );
|
||||
dateTimeP->day = Byte_Swap16( dateTime.day );
|
||||
dateTimeP->month = Byte_Swap16( dateTime.month );
|
||||
dateTimeP->year = Byte_Swap16( dateTime.year );
|
||||
dateTimeP->weekDay = Byte_Swap16( dateTime.weekDay );
|
||||
}
|
||||
FUNC_TAIL(TimSecondsToDateTime);
|
||||
} /* TimSecondsToDateTime */
|
||||
|
||||
/* Events. Need to translate back and forth since the ARM struct looks
|
||||
* different from the 68K version yet we have to be able to come up with a 68K
|
||||
* version for the OS at various times. May also need to translate inside
|
||||
* event handlers since the OS will pass the 68K struct to us there.
|
||||
*/
|
||||
#define EVT_DATASIZE_68K 16 /* sez sizeof(event.data) in 68K code */
|
||||
static void
|
||||
void
|
||||
evt68k2evtARM( EventType* event, const unsigned char* evt68k )
|
||||
{
|
||||
event->eType = read_unaligned16( evt68k );
|
||||
|
@ -329,7 +301,7 @@ evt68k2evtARM( EventType* event, const unsigned char* evt68k )
|
|||
}
|
||||
} /* evt68k2evtARM */
|
||||
|
||||
static void
|
||||
void
|
||||
evtArm2evt68K( unsigned char* evt68k, const EventType* event )
|
||||
{
|
||||
write_unaligned16( evt68k, event->eType );
|
||||
|
@ -416,27 +388,6 @@ evtArm2evt68K( unsigned char* evt68k, const EventType* event )
|
|||
|
||||
} /* evtArm2evt68K */
|
||||
|
||||
/* from file Event.h */
|
||||
void
|
||||
EvtGetEvent( EventType* event, Int32 timeout )
|
||||
{
|
||||
FUNC_HEADER(EvtGetEvent);
|
||||
{
|
||||
EventType evt68k;
|
||||
PNOState* sp = GET_CALLBACK_STATE();
|
||||
STACK_START(unsigned char, stack, 8);
|
||||
ADD_TO_STACK4(stack, &evt68k, 0);
|
||||
ADD_TO_STACK4(stack, timeout, 4);
|
||||
STACK_END(stack);
|
||||
(*sp->call68KFuncP)( sp->emulStateP,
|
||||
PceNativeTrapNo(sysTrapEvtGetEvent),
|
||||
stack, 8 );
|
||||
|
||||
evt68k2evtARM( event, (unsigned char*)&evt68k );
|
||||
}
|
||||
FUNC_TAIL(EvtGetEvent);
|
||||
} /* EvtGetEvent */
|
||||
|
||||
/* from file SystemMgr.h */
|
||||
Boolean
|
||||
SysHandleEvent( EventPtr eventP )
|
||||
|
@ -460,54 +411,6 @@ SysHandleEvent( EventPtr eventP )
|
|||
return result;
|
||||
} /* SysHandleEvent */
|
||||
|
||||
/* from file Form.h */
|
||||
Boolean
|
||||
FrmDispatchEvent( EventType* eventP )
|
||||
{
|
||||
Boolean result;
|
||||
EventType event68k;
|
||||
FUNC_HEADER(FrmDispatchEvent);
|
||||
evtArm2evt68K( (unsigned char*)&event68k, eventP );
|
||||
{
|
||||
PNOState* sp = GET_CALLBACK_STATE();
|
||||
STACK_START(unsigned char, stack, 4);
|
||||
ADD_TO_STACK4(stack, &event68k, 0);
|
||||
STACK_END(stack);
|
||||
result = (Boolean)(*sp->call68KFuncP)( sp->emulStateP,
|
||||
PceNativeTrapNo(sysTrapFrmDispatchEvent),
|
||||
stack, 4 );
|
||||
}
|
||||
FUNC_TAIL(FrmDispatchEvent);
|
||||
return result;
|
||||
} /* FrmDispatchEvent */
|
||||
|
||||
/* from file Menu.h */
|
||||
Boolean
|
||||
MenuHandleEvent( MenuBarType* menuP, EventType* event, UInt16* error )
|
||||
{
|
||||
Boolean result;
|
||||
EventType event68k;
|
||||
FUNC_HEADER(MenuHandleEvent);
|
||||
|
||||
evtArm2evt68K( (unsigned char*)&event68k, event );
|
||||
SWAP2_NON_NULL_IN(error);
|
||||
{
|
||||
PNOState* sp = GET_CALLBACK_STATE();
|
||||
STACK_START(unsigned char, stack, 12);
|
||||
ADD_TO_STACK4(stack, menuP, 0);
|
||||
ADD_TO_STACK4(stack, &event68k, 4);
|
||||
ADD_TO_STACK4(stack, error, 8);
|
||||
STACK_END(stack);
|
||||
result = (Boolean)(*sp->call68KFuncP)(
|
||||
sp->emulStateP,
|
||||
PceNativeTrapNo(sysTrapMenuHandleEvent),
|
||||
stack, 12 );
|
||||
SWAP2_NON_NULL_OUT(error);
|
||||
}
|
||||
FUNC_TAIL(MenuHandleEvent);
|
||||
return result;
|
||||
} /* MenuHandleEvent */
|
||||
|
||||
unsigned long
|
||||
handlerEntryPoint( const void* emulStateP,
|
||||
void* userData68KP,
|
||||
|
@ -595,27 +498,6 @@ FrmSetEventHandler( FormType* formP, FormEventHandlerType* handler )
|
|||
FUNC_TAIL(FrmSetEventHandler);
|
||||
} /* FrmSetEventHandler */
|
||||
|
||||
/* from file Event.h */
|
||||
void
|
||||
EvtAddEventToQueue( const EventType* event )
|
||||
{
|
||||
FUNC_HEADER(EvtAddEventToQueue);
|
||||
|
||||
EventType evt68k;
|
||||
evtArm2evt68K( (unsigned char*)&evt68k, event );
|
||||
|
||||
{
|
||||
PNOState* sp = GET_CALLBACK_STATE();
|
||||
STACK_START(unsigned char, stack, 4);
|
||||
ADD_TO_STACK4(stack, &evt68k, 0);
|
||||
STACK_END(stack);
|
||||
(*sp->call68KFuncP)( sp->emulStateP,
|
||||
PceNativeTrapNo(sysTrapEvtAddEventToQueue),
|
||||
stack, 4 );
|
||||
}
|
||||
FUNC_TAIL(EvtAddEventToQueue);
|
||||
} /* EvtAddEventToQueue */
|
||||
|
||||
void
|
||||
flipRect( RectangleType* rout, const RectangleType* rin )
|
||||
{
|
||||
|
@ -964,3 +846,15 @@ LstSetDrawFunction( ListType* listP, ListDrawDataFuncPtr func )
|
|||
FUNC_TAIL(LstSetDrawFunction);
|
||||
EMIT_NAME("LstSetDrawFunction","'L','s','t','S','e','t','D','r','a','w','F','u','n','c','t','i','o','n'");
|
||||
} /* LstSetDrawFunction */
|
||||
|
||||
void
|
||||
flipDateTimeToArm( DateTimeType* out, const unsigned char* in )
|
||||
{
|
||||
out->second = read_unaligned16( &in[0] );
|
||||
out->minute = Byte_Swap16( &in[2] );
|
||||
out->hour = Byte_Swap16( &in[4] );
|
||||
out->day = Byte_Swap16( &in[6] );
|
||||
out->month = Byte_Swap16( &in[8] );
|
||||
out->year = Byte_Swap16( &in[10] );
|
||||
out->weekDay = Byte_Swap16( &in[12] );
|
||||
}
|
||||
|
|
|
@ -33,15 +33,9 @@
|
|||
|
||||
extern Int16 StrPrintF( Char* s, const Char* formatStr, ... );
|
||||
extern Int16 StrVPrintF( Char* s, const Char* formatStr, _Palm_va_list arg );
|
||||
extern void TimSecondsToDateTime( UInt32 seconds, DateTimeType* dateTimeP );
|
||||
extern Boolean SysHandleEvent( EventPtr eventP );
|
||||
extern void EvtGetEvent( EventType* event, Int32 timeout );
|
||||
extern Boolean FrmDispatchEvent( EventType* eventP );
|
||||
extern Boolean MenuHandleEvent( MenuBarType* menuP, EventType* event,
|
||||
UInt16* error );
|
||||
extern void FrmSetEventHandler( FormType* formP,
|
||||
FormEventHandlerType* handler );
|
||||
extern void EvtAddEventToQueue( const EventType* event );
|
||||
extern void LstSetListChoices( ListType* listP, Char** itemsText,
|
||||
Int16 numItems );
|
||||
extern Err SysNotifyRegister( UInt16 cardNo, LocalID dbID,
|
||||
|
@ -76,6 +70,11 @@ extern void LstSetDrawFunction( ListType* listP, ListDrawDataFuncPtr func );
|
|||
|
||||
#define SET_SEL_REG(trap, sp) ((unsigned long*)((sp)->emulStateP))[3] = (trap)
|
||||
|
||||
void evt68k2evtARM( EventType* event, const unsigned char* evt68k );
|
||||
#define SWAP_EVENTTYPE_68K_TO_ARM( dp, sp ) evt68k2evtARM( (dp), (sp) )
|
||||
void evtArm2evt68K( unsigned char* evt68k, const EventType* event );
|
||||
#define SWAP_EVENTTYPE_ARM_TO_68K( dp, sp ) evtArm2evt68K( (dp), (sp) )
|
||||
|
||||
void flipRect( RectangleType* rout, const RectangleType* rin );
|
||||
#define SWAP_RECTANGLETYPE_ARM_TO_68K( dp, sp ) flipRect( (dp), (sp) )
|
||||
#define SWAP_RECTANGLETYPE_68K_TO_ARM SWAP_RECTANGLETYPE_ARM_TO_68K
|
||||
|
@ -94,6 +93,11 @@ void flipFileInfoFromArm( unsigned char* fiout, const FileInfoType* fiin );
|
|||
void flipFileInfoToArm( FileInfoType* fout, const unsigned char* fin );
|
||||
#define SWAP_FILEINFOTYPE_68K_TO_ARM( dp, sp ) flipFileInfoToArm( (dp), (sp) )
|
||||
|
||||
|
||||
#define SWAP_DATETIMETYPE_ARM_TO_68K( dp, sp ) /* nothing for now */
|
||||
void flipDateTimeToArm( DateTimeType* out, const unsigned char* in );
|
||||
#define SWAP_DATETIMETYPE_68K_TO_ARM( dp, sp ) flipDateTimeToArm( (dp), (sp) )
|
||||
|
||||
PNOState* getStorageLoc();
|
||||
#define GET_CALLBACK_STATE() getStorageLoc()
|
||||
|
||||
|
|
Loading…
Reference in a new issue