- Timestamp:
- 04/24/11 04:52:52 (2 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
include/lolevel.h (modified) (3 diffs)
-
include/stdlib.h (modified) (1 diff)
-
platform/generic/wrappers.c (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/lolevel.h
r1023 r1153 72 72 extern int _Open (const char *name, int flags, int mode ); 73 73 extern int _Close (int fd); 74 extern int _Write (int fd, void *buffer, long nbytes);74 extern int _Write (int fd, const void *buffer, long nbytes); 75 75 extern int _Read (int fd, void *buffer, long nbytes); 76 76 extern int _Lseek (int fd, long offset, int whence); … … 221 221 222 222 /* time */ 223 extern int _utime(c har *file, void *newTimes);223 extern int _utime(const char *file, void *newTimes); 224 224 extern unsigned long _time(unsigned long *timer); 225 225 extern void *_localtime(const unsigned long *_tod); … … 241 241 extern int _closedir(void *d); 242 242 extern void _rewinddir(void *d); 243 extern int _stat(c har *name, void *pStat);243 extern int _stat(const char *name, void *pStat); 244 244 extern unsigned long _GetDrive_ClusterSize(int drive); 245 245 extern unsigned long _GetDrive_TotalClusters(int drive); -
trunk/include/stdlib.h
r1152 r1153 232 232 typedef struct { 233 233 DIR_dryos *dh; 234 union { 235 struct dirent de; 234 236 #ifdef CAM_DRYOS_2_3_R39 235 char de_buf[64]; 236 #else 237 char de_buf[40]; 238 #endif 237 char de_buf[64]; 238 #else 239 char de_buf[40]; 240 #endif 241 }; 239 242 } DIR; 240 243 #endif -
trunk/platform/generic/wrappers.c
r1152 r1153 5 5 #include "math.h" 6 6 #include "levent.h" 7 #include "stdlib.h" 7 8 8 9 //---------------------------------------------------------------------------- … … 95 96 96 97 #ifndef CAM_DRYOS 97 voidtask_lock()98 { 99 _taskLock();100 } 101 102 voidtask_unlock()103 { 104 _taskUnlock();98 long task_lock() 99 { 100 return _taskLock(); 101 } 102 103 long task_unlock() 104 { 105 return _taskUnlock(); 105 106 } 106 107 … … 338 339 } 339 340 340 int write (int fd, void *buffer, long nbytes)341 int write (int fd, const void *buffer, long nbytes) 341 342 { 342 343 return _Write(fd, buffer, nbytes); … … 365 366 // directory wrappers 366 367 #ifndef CAM_DRYOS 367 void*opendir(const char* name) {368 DIR *opendir(const char* name) { 368 369 return _opendir(name); 369 370 } 370 void* readdir(void*d) {371 struct dirent* readdir(DIR *d) { 371 372 return _readdir(d); 372 373 } 373 int closedir( void*d) {374 int closedir(DIR *d) { 374 375 return _closedir(d); 375 376 } 376 377 377 void rewinddir( void*d) {378 void rewinddir(DIR *d) { 378 379 return _rewinddir(d); 379 380 } 380 381 #else // dryos 381 // TODO duplicated in stdlib.h!382 // structure returned by dryos383 // actual size may vary depending on version384 typedef struct {385 int fh;386 int unk[4];387 } DIR_dryos;388 389 // struct returned by our wrappers around opendir390 typedef struct {391 DIR_dryos *dh;392 #ifdef CAM_DRYOS_2_3_R39393 char de_buf[64];394 #else395 char de_buf[40];396 #endif397 } DIR;398 399 382 DIR *opendir(const char* name) { 400 383 DIR *d; … … 406 389 if(!d) { 407 390 _closedir(dh); 408 return (void *)0;391 return NULL; 409 392 } 410 393 d->dh = dh; … … 412 395 } 413 396 414 void* readdir(DIR *d) {397 struct dirent * readdir(DIR *d) { 415 398 _ReadFastDir(d->dh, d->de_buf); 416 return d->de_buf[0]? d->de_buf : (void*)0;399 return d->de_buf[0]? &d->de : NULL; 417 400 } 418 401 … … 435 418 #endif // dryos dir functions 436 419 437 int stat(c har *name, void*pStat) {420 int stat(const char *name, struct stat *pStat) { 438 421 return _stat(name, pStat); 439 422 } 440 423 441 longfopen(const char *filename, const char *mode) {424 FILE *fopen(const char *filename, const char *mode) { 442 425 #ifdef CAM_DRYOS 443 426 if(!filename || filename[0]!='A') { 444 return 0;427 return NULL; 445 428 } 446 429 #endif 447 return _Fopen_Fut(filename,mode);448 } 449 450 long fclose( longf) {430 return (FILE *)_Fopen_Fut(filename,mode); 431 } 432 433 long fclose(FILE *f) { 451 434 return _Fclose_Fut((long)f); 452 435 } 453 436 454 long fread(void *buf, long elsize, long count, longf) {437 long fread(void *buf, long elsize, long count, FILE *f) { 455 438 return _Fread_Fut(buf,elsize,count,(long)f); 456 439 } 457 440 458 long fwrite(const void *buf, long elsize, long count, longf) {441 long fwrite(const void *buf, long elsize, long count, FILE *f) { 459 442 return _Fwrite_Fut(buf,elsize,count,(long)f); 460 443 } 461 444 462 long fseek( longfile, long offset, long whence) {445 long fseek(FILE *file, long offset, long whence) { 463 446 return _Fseek_Fut((long)file,offset,whence); 464 447 } 465 448 466 long feof( longfile) {449 long feof(FILE * file) { 467 450 return _Feof_Fut((long)file); 468 451 } 469 452 470 long fflush( longfile) {453 long fflush(FILE * file) { 471 454 return _Fflush_Fut((long)file); 472 455 } 473 456 474 char *fgets(char *buf, int n, longf) {457 char *fgets(char *buf, int n, FILE *f) { 475 458 return _Fgets_Fut(buf,n,(int)f); 476 459 } 477 460 478 longrename(const char *oldname, const char *newname) {461 int rename(const char *oldname, const char *newname) { 479 462 return _RenameFile_Fut(oldname, newname); 480 463 } … … 605 588 } 606 589 607 int utime(c har *file, void*newTimes) {590 int utime(const char *file, struct utimbuf *newTimes) { 608 591 #if !CAM_DRYOS 609 592 return _utime(file, newTimes); … … 629 612 } 630 613 631 void*localtime(const unsigned long *_tod) {614 struct tm *localtime(const unsigned long *_tod) { 632 615 #if !CAM_DRYOS 633 616 return _localtime(_tod); … … 639 622 } 640 623 641 long strftime(char *s, unsigned long maxsize, const char *format, /*const struct tm*/ void*timp) {624 long strftime(char *s, unsigned long maxsize, const char *format, const struct tm *timp) { 642 625 return _strftime(s,maxsize,format,timp); 643 626 } 644 627 645 /*time_t*/ long mktime(/*struct tm*/ void*timp) {628 time_t mktime(struct tm *timp) { 646 629 #if !CAM_DRYOS 647 630 return _mktime(timp);
Note: See TracChangeset
for help on using the changeset viewer.