Update of /cvsroot/squeak/squeak/platforms/RiscOS/plugins/FilePlugin
In directory sc8-pr-cvs1:/tmp/cvs-serv6982/RiscOS/plugins/FilePlugin
Modified Files:
sqRPCDirectory.c
Log Message:
Modified Files:
RiscOS/plugins/FileCopyPlugin/sqRPCFileCopy.c comment change
RiscOS/plugins/FilePlugin/sqRPCDirectory.c timezone/stamp calculation fixes
RiscOS/plugins/SocketPlugin/sqRPCNetPlugin.c comment change
RiscOS/plugins/SoundPlugin/sqRPCSound.c RiscOS/vm/fperrors.s remove dead code, 32bit fix
RiscOS/vm/osExports.c RiscOS/vm/sqArgument.c new window label argument
RiscOS/vm/sqPlatformSpecific.h RiscOS/vm/sqRPCClipboard.c clipboard works!
RiscOS/vm/sqRPCEvents.c RiscOS/vm/sqRPCExternalPrims.c comment change
RiscOS/vm/sqRPCFormPrint.c RiscOS/vm/sqRPCSyscall.c comment change
RiscOS/vm/sqRPCWindows.c RiscOS/vm/dsc/block,fff add timezone related call
Added Files:
RiscOS/vm/sqRPCVersion.c use as a kind of vm compiletime timestamp
Index: sqRPCDirectory.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/RiscOS/plugins/FilePlugin/sqRPCDirectory.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** sqRPCDirectory.c 14 Jan 2003 03:41:09 -0000 1.3
--- sqRPCDirectory.c 9 May 2003 01:07:16 -0000 1.4
***************
*** 2,10 ****
/* A Squeak VM for Acorn RiscOS machines by Tim Rowledge */
/* ti...@su... & http://sumeru.stanford.edu/tim */
! /* Known to work on RiscOS 3.7 for StrongARM RPCs, other machines */
! /* not yet tested. */
! /* sqRPCDirec.c */
! /* Directory reading etc */
/**************************************************************************/
#include "oslib/os.h"
#include "oslib/osbyte.h"
--- 2,15 ----
/* A Squeak VM for Acorn RiscOS machines by Tim Rowledge */
/* ti...@su... & http://sumeru.stanford.edu/tim */
! /* Known to work on RiscOS >3.7 for StrongARM RPCs and Iyonix, */
! /* other machines not yet tested. */
! /* sqRPCDirectory.c */
! /* hook up to RiscOS directory listing etc */
/**************************************************************************/
+
+ /* To recompile this reliably you will need */
+ /* OSLib - http://ro-oslib.sourceforge.net/ */
+ /* Castle/AcornC/C++, the Acorn TCPIPLib */
+ /* and a little luck */
#include "oslib/os.h"
#include "oslib/osbyte.h"
***************
*** 16,19 ****
--- 21,25 ----
#include "oslib/ramfs.h"
#include "oslib/cdfs.h"
+ #include "oslib/territory.h"
#include "sq.h"
#include <kernel.h>
***************
*** 48,64 ****
extern void sqStringFromFilename( int sqString, char*fileName, int sqSize);
/*** Functions ***/
- int convertToSqueakTime(os_date_and_time fileTime);
int convertToSqueakTime(os_date_and_time fileTime) {
! /* Squeak epoch is Jan 1, 1901, one year later than RiscOS one @ 1/1/1900. fileTime is stored as 5 bytes of the centiseconds since then ! Arithmetic on 5byte numbers is simpler to do in float.... */
! float theTime;
! theTime = 0.0;
! theTime = theTime + (int)*(fileTime++)*0.01;
! theTime = theTime + (int)*(fileTime++)*2.560;
! theTime = theTime + (int)*(fileTime++)*655.360;
! theTime = theTime + (int)*(fileTime++)*167772.160;
! theTime = theTime + (int)*(fileTime++)*42949672.960;
! theTime = theTime - (365.0 * 24 * 60 * 60);
! return (int)(unsigned long)theTime ;
}
--- 54,85 ----
extern void sqStringFromFilename( int sqString, char*fileName, int sqSize);
/*** Functions ***/
int convertToSqueakTime(os_date_and_time fileTime) {
! /* Squeak epoch is Jan 1, 1901, one year later than the RiscOS
! * one @ 1/1/1900. fileTime is stored as 5 bytes of the centiseconds
! * since then. Use territory call to get timezone & DST offset */
! unsigned int high, low, tc;
! char tzname[50];
! int tzoffset;
! low = *(unsigned int*)fileTime;
! high = *(unsigned int*)(fileTime+4);
!
! high = high & 0xff; /* clear all but bottom byte */
!
! /* Firstly, subtract 365 * 24 *60 * 60 * 100 = 3153600000 = 0xBBF81E00
! * centiseconds from the RISC OS time */
! tc = 0xBBF81E00;
! /* now use the territory to find the timezone/dst offset */
! xterritory_read_current_time_zone((char**)&tzname, &tzoffset);
! if (low < tc) /* check for a carry */
! high--;
! low -= tc;
!
! /* Remove the centiseconds from the time.
! * 0x1000000000 / 100 = 42949672.96 */
! low = (low / 100) + (high * 42949673U);
! low -= (high / 25); /* compensate for that 0.04 error. */
!
! return (int)low + (tzoffset/100);
}
|