|
From: Tim R. <row...@us...> - 2003-01-14 03:41:12
|
Update of /cvsroot/squeak/squeak/platforms/RiscOS/plugins/FilePlugin
In directory sc8-pr-cvs1:/tmp/cvs-serv31826/platforms/RiscOS/plugins/FilePlugin
Modified Files:
sqRPCDirectory.c
Log Message:
Bring the above file up to date with latest Acorn port work.
a) clean ups
b) global variable structure
c) global reg var to point to said struct -> 30% speedup !!
Index: sqRPCDirectory.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/RiscOS/plugins/FilePlugin/sqRPCDirectory.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** sqRPCDirectory.c 23 Apr 2002 22:08:47 -0000 1.2
--- sqRPCDirectory.c 14 Jan 2003 03:41:09 -0000 1.3
***************
*** 33,37 ****
#ifdef DEBUG
#define FPRINTF(s)\
! {\
extern os_error privateErr;\
extern void platReportError( os_error * e);\
--- 33,37 ----
#ifdef DEBUG
#define FPRINTF(s)\
! if(1){\
extern os_error privateErr;\
extern void platReportError( os_error * e);\
***************
*** 65,70 ****
void dirReportError( os_error * e) {
/* Use the RiscOS Error dialogue to notify users of some problem */
! // Maybe sometime later...
! //wimp_report_error( e, wimp_ERROR_BOX_CANCEL_ICON | wimp_ERROR_BOX_HIGHLIGHT_CANCEL |wimp_ERROR_BOX_SHORT_TITLE , sqTaskName);
}
--- 65,70 ----
void dirReportError( os_error * e) {
/* Use the RiscOS Error dialogue to notify users of some problem */
! extern void platReportError( os_error * e);
! platReportError(e);
}
***************
*** 90,94 ****
/* For now replicate the normal sqFileDeleteNameSize, since that appears to be adequate, except for returning true if all is well - essential ! */
char cFileName[MAXDIRNAMELENGTH];
- int err;
if (pathStringLength >= MAXDIRNAMELENGTH) {
--- 90,93 ----
***************
*** 99,103 ****
sqFilenameFromString(cFileName, (int)pathString, pathStringLength);
if (remove(cFileName) != 0) {
! FPRINTF((privateErr.errmess, "dir delete error %d\n", err));
return interpreterProxy->success(false);
}
--- 98,102 ----
sqFilenameFromString(cFileName, (int)pathString, pathStringLength);
if (remove(cFileName) != 0) {
! FPRINTF((privateErr.errmess, "dir delete error\n"));
return interpreterProxy->success(false);
}
***************
*** 113,122 ****
char *name, int *nameLength, int *creationDate, int *modificationDate,
int *isDirectory, int *sizeIfFile) {
! /* Lookup the index-th entry of the directory with the given path, starting
! at the root of the file system. Set the name, name length, creation date,
! creation time, directory flag, and file size (if the entry is a file).
! Return: ENTRY_FOUND if a entry is found at the given index
! NO_MORE_ENTRIES if the directory has fewer than index entries
! BAD_PATH if the given path has bad syntax or does not reach a directory
*/
char dirname[MAXDIRNAMELENGTH];
--- 112,121 ----
char *name, int *nameLength, int *creationDate, int *modificationDate,
int *isDirectory, int *sizeIfFile) {
! /* Lookup the index-th entry of the directory with the given path, starting
! at the root of the file system. Set the name, name length, creation date,
! creation time, directory flag, and file size (if the entry is a file).
! Return: ENTRY_FOUND if a entry is found at the given index
! NO_MORE_ENTRIES if the directory has fewer than index entries
! BAD_PATH if the given path has bad syntax or does not reach a directory
*/
char dirname[MAXDIRNAMELENGTH];
***************
*** 134,143 ****
if( pathStringLength > MAXDIRNAMELENGTH) return BAD_PATH;
context = index-1;
if ( pathStringLength == 0) {
- #if 1
#define F2HJump 4
int junk, run_total, adfs_flop=0, adfs_hard=0, scsifs_flop=0, scsifs_hard=0, ramfs_flop=0, ramfs_hard=0, cdfs_hard=0;
char discid[20];
/* no path, so try to enumerate all the attached discs */
run_total = 0;
--- 133,143 ----
if( pathStringLength > MAXDIRNAMELENGTH) return BAD_PATH;
context = index-1;
+ FPRINTF((privateErr.errmess, "dir_Lookup:raw pathname %s\n", pathString));
if ( pathStringLength == 0) {
#define F2HJump 4
int junk, run_total, adfs_flop=0, adfs_hard=0, scsifs_flop=0, scsifs_hard=0, ramfs_flop=0, ramfs_hard=0, cdfs_hard=0;
char discid[20];
+ FPRINTF((privateErr.errmess, "dir_Lookup:null pathname, scanning disc %d\n", context));
/* no path, so try to enumerate all the attached discs */
run_total = 0;
***************
*** 194,202 ****
decode_disc_id:
if ((e = xosfscontrol_canonicalise_path (discid, dirname, (char const *) NULL, (char const *)NULL, MAXDIRNAMELENGTH, &junk)) != null) {
! // for any error, it seems best to copy the instring to the outstring
strcpy (dirname, discid);
! if ( (e->errnum & 0xFF) >= 0xD3 || (e->errnum & 0xFF) <= 0xD5 ) {
! // disc not present type error shouldn't cause too many upsets
! } else dirReportError(e);
}
--- 194,203 ----
decode_disc_id:
if ((e = xosfscontrol_canonicalise_path (discid, dirname, (char const *) NULL, (char const *)NULL, MAXDIRNAMELENGTH, &junk)) != null) {
! // for any error, it seems best to copy the instring
! // to the outstring.
! // we shouldn't get too many types of error here since
! // the names have come from the OS anyway
strcpy (dirname, discid);
! // debugging -> dirReportError(e);
}
***************
*** 208,232 ****
*sizeIfFile = 0;
return ENTRY_FOUND;
- #else
- return BAD_PATH;
- #endif
}
! //return NO_MORE_ENTRIES;
! /* looks like this should be strncpy( dirname, pathString, pathStringLength); */
sqFilenameFromString(dirname, (int)pathString, pathStringLength);
! /* lookup indexth entry in the directory */
count = 1;
i = /* osgbpb_SIZEOF_SYSTEM_INFO(MAXDIRNAMELENGTH + 4)*/ 28 +MAXDIRNAMELENGTH + 4;
e = xosgbpb_dir_entries_system_info(dirname,(osgbpb_system_info_list *)&buffer, count, context, i, (char const *)0, &count, &context);
- if ( count != 1 ) return NO_MORE_ENTRIES;
if ( e != NULL ) {
i = e->errnum & 0xFF;
! if ( i >= 0xD3 || i<= 0xD5 ) return NO_MORE_ENTRIES;
! return BAD_PATH;
}
!
!
*nameLength = strlen(buffer.name);
--- 209,229 ----
*sizeIfFile = 0;
return ENTRY_FOUND;
}
!
sqFilenameFromString(dirname, (int)pathString, pathStringLength);
+ FPRINTF((privateErr.errmess, "dir_Lookup:pathName = %s\n", dirname));
! /* lookup indexth entry in the directory */
count = 1;
i = /* osgbpb_SIZEOF_SYSTEM_INFO(MAXDIRNAMELENGTH + 4)*/ 28 +MAXDIRNAMELENGTH + 4;
e = xosgbpb_dir_entries_system_info(dirname,(osgbpb_system_info_list *)&buffer, count, context, i, (char const *)0, &count, &context);
if ( e != NULL ) {
+ // debugging-> dirReportError(e);
i = e->errnum & 0xFF;
! if ( i >= 0xD3 && i<= 0xD5 ) return NO_MORE_ENTRIES;
! return BAD_PATH;
}
! if ( count != 1 ) return NO_MORE_ENTRIES;
*nameLength = strlen(buffer.name);
|