root/include/std/stdlib.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 #ifndef STDLIB_H
   2 #define STDLIB_H
   3 
   4 // CHDK stdlib
   5 
   6 // Note: used in modules and platform independent code. 
   7 // Do not add platform dependent stuff in here (#ifdef/#endif compile options or camera dependent values)
   8 
   9 //==========================================================
  10 
  11 extern int rand(void);
  12 extern void* srand(unsigned int seed);
  13 
  14 extern void qsort(void *__base, int __nelem, int __size, int (*__cmp)(const void *__e1, const void *__e2));
  15 
  16 extern long sprintf(char *s, const char *st, ...);
  17 
  18 extern long strtol(const char *nptr, char **endptr, int base);
  19 extern unsigned long strtoul(const char *nptr, char **endptr, int base);
  20 #define atoi(n) strtol((n),NULL,0)
  21 
  22 extern void *malloc(long size);
  23 extern void free(void *p);
  24 
  25 extern int open(const char *name, int flags, int mode );
  26 extern int close(int fd);
  27 extern int write(int fd, const void *buffer, long nbytes);
  28 extern int read(int fd, void *buffer, long nbytes);
  29 extern int lseek(int fd, long offset, int whence);
  30 extern int rename(const char *oldname, const char *newname);
  31 extern int chdir(char *pathname);
  32 extern int remove(const char *name);
  33 
  34 extern int abs( int v );
  35 
  36 //-------------------------------------------------------------------------------------
  37 
  38 // From sys/stat.h
  39 
  40 // CHDK 'stat' structure - does not match VxWorks or DryOS internal structs
  41 // Converted in stat function (generic/wrappers.c)
  42 // This is the minimal set of values now available from the firmware
  43 struct stat
  44 {
  45     unsigned long   st_attrib;
  46     unsigned long   st_size;
  47     unsigned long   st_ctime;
  48     unsigned long   st_mtime;
  49 };
  50 
  51 extern long mkdir(const char *dirname);
  52 extern int stat(const char *name, struct stat *pStat);
  53 
  54 //-------------------------------------------------------------------------------------
  55 
  56 // From fcntl.h
  57 
  58 #define O_RDONLY        0
  59 #define O_WRONLY        1
  60 #define O_RDWR          2
  61 #define O_APPEND        8   // DryOS only, wrapper code will removed this for VxWorks so file will be overwritten instead of appended
  62 
  63 // CHDK defined values - note does not match VxWorks values
  64 // Values are corrected in 'open' function to match OS requirements
  65 #define O_TRUNC         0x200
  66 #define O_CREAT         0x100
  67 
  68 //-------------------------------------------------------------------------------------
  69 
  70 // From VxWorks
  71 
  72 #define DOS_ATTR_RDONLY         0x01            /* read-only file */
  73 #define DOS_ATTR_HIDDEN         0x02            /* hidden file */
  74 #define DOS_ATTR_SYSTEM         0x04            /* system file */
  75 #define DOS_ATTR_VOL_LABEL      0x08            /* volume label (not a file) */
  76 #define DOS_ATTR_DIRECTORY      0x10            /* entry is a sub-directory */
  77 #define DOS_ATTR_ARCHIVE        0x20            /* file subject to archiving */
  78 
  79 //-------------------------------------------------------------------------------------
  80 
  81 // CHDK
  82 
  83 extern void msleep(long msec);
  84 
  85 extern unsigned char SetFileAttributes(const char* fn, unsigned char attr);
  86 
  87 extern long mkdir_if_not_exist(const char *dirname);
  88 
  89 extern void *umalloc(long size);
  90 extern void ufree(void *p);
  91 
  92 //---------------------------------------------------------------
  93 
  94 #endif

/* [<][>][^][v][top][bottom][index][help] */