ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/rtio.h
(Generate patch)

Comparing ray/src/common/rtio.h (file contents):
Revision 3.2 by schorsch, Mon Jun 30 14:59:11 2003 UTC vs.
Revision 3.34 by greg, Sat Jun 7 05:09:45 2025 UTC

# Line 5 | Line 5
5  
6   #ifndef _RAD_RTIO_H_
7   #define _RAD_RTIO_H_
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
8  
9   #include  <stdio.h>
10   #include  <sys/types.h>
11   #include  <fcntl.h>
12   #include  <string.h>
13 + #include  <time.h>
14  
15 < /* XXX include paths.h instead */
16 < #ifndef  F_OK                   /* mode bits for access(2) call */
17 < #define  R_OK           4               /* readable */
18 < #define  W_OK           2               /* writable */
19 < #define  X_OK           1               /* executable */
20 < #define  F_OK           0               /* exists */
15 > #ifdef getc_unlocked            /* avoid horrendous overhead of flockfile */
16 > #undef getc
17 > #undef getchar
18 > #undef putc
19 > #undef putchar
20 > #define getc    getc_unlocked
21 > #define getchar getchar_unlocked
22 > #define putc    putc_unlocked
23 > #define putchar putchar_unlocked
24 > #ifndef __cplusplus
25 > #undef feof
26 > #undef ferror
27 > #define feof    feof_unlocked
28 > #define ferror  ferror_unlocked
29   #endif
30 + #endif
31  
32 <                        /* <unistd.h> is missing on some systems */
33 < extern off_t    lseek(int, off_t, int);
32 > #ifdef __cplusplus
33 > extern "C" {
34 > #endif
35 >                                        /* identify header lines */
36 > #define  MAXFMTLEN      64
37 > #define  isheadid(s)    headidval(NULL,s)
38 > #define  isformat(s)    formatval(NULL,s)
39 > #define  isdate(s)      dateval(NULL,s)
40 > #define  isgmt(s)       gmtval(NULL,s)
41  
42 + #define  LATLONSTR      "LATLONG="
43 + #define  LLATLONSTR     8
44 + #define  islatlon(hl)           !strncmp(hl,LATLONSTR,LLATLONSTR)
45 + #define  latlonval(ll,hl)       (sscanf((hl)+LLATLONSTR, "%f %f", \
46 +                                                &(ll)[0],&(ll)[1]) == 2)
47 + #define  fputlatlon(lat,lon,fp) fprintf(fp,"%s %.6f %.6f\n",LATLONSTR,lat,lon)
48 +                                        /* defined in header.c */
49 + extern void     newheader(const char *t, FILE *fp);
50 + extern int      headidval(char *r, const char *s);
51 + extern int      dateval(time_t *t, const char *s);
52 + extern int      gmtval(time_t *t, const char *s);
53 + extern void     fputdate(time_t t, FILE *fp);
54 + extern void     fputnow(FILE *fp);
55 + extern int      formatval(char fmt[MAXFMTLEN], const char *s);
56 + extern void     fputformat(const char *s, FILE *fp);
57 + extern int      nativebigendian(void);
58 + extern int      isbigendian(const char *s);
59 + extern void     fputendian(FILE *fp);
60 + typedef int gethfunc(char *s, void *p); /* callback to process header lines */
61 + extern int      getheader(FILE *fp, gethfunc *f, void *p);
62 + extern int      globmatch(const char *pat, const char *str);
63 + extern int      checkheader(FILE *fin, char fmt[MAXFMTLEN], FILE *fout);
64 +                                        /* defined in fltdepth.c */
65 + extern int      open_float_depth(const char *fname, long expected_length);
66                                          /* defined in badarg.c */
67 < extern int      badarg(int ac, char **av, char *fl);
67 > extern int      badarg(int ac, char **av, const char *fl);
68                                          /* defined in expandarg.c */
69 + extern int      envexpchr, filexpchr;
70   extern int      expandarg(int *acp, char ***avp, int n);
71                                          /* defined in fdate.c */
72 < extern time_t   fdate(char *fname);
73 < extern int      setfdate(char *fname, long ftim);
72 > extern time_t   fdate(const char *fname);
73 > extern time_t   fddate(int fd);
74 > extern int      setfdate(const char *fname, long ftim);
75                                          /* defined in fgetline.c */
76   extern char     *fgetline(char *s, int n, FILE *fp);
77                                          /* defined in fgetval.c */
78 < extern int      fgetval(FILE *fp, int ty, char *vp);
78 > extern int      fgetval(FILE *fp, int ty, void *vp);
79                                          /* defined in fgetword.c */
80   extern char     *fgetword(char *s, int n, FILE *fp);
81                                          /* defined in fputword.c */
82   extern void     fputword(char *s, FILE *fp);
83 <                                        /* defined in fixargv0.c */
84 < /*extern char   *fixargv0(char *av0);*/ /* XXX include paths.h instead */
85 <                                        /* defined in fropen.c */
86 < extern FILE     *frlibopen(char *fname);
47 <                                        /* defined in getlibpath.c */
48 < extern char     *getrlibpath(void);
49 <                                        /* defined in getpath.c */
50 < extern char     *getpath(char *fname, char *searchpath, int mode);
83 >                                        /* defined in byteswap.c */
84 > extern void     swap16(char *wp, size_t n);
85 > extern void     swap32(char *wp, size_t n);
86 > extern void     swap64(char *wp, size_t n);
87                                          /* defined in portio.c */
88 < extern void     putstr(char *s, FILE *fp);
89 < extern void     putint(long i, int siz, FILE *fp);
90 < extern void     putflt(double f, FILE *fp);
88 > extern int      putstr(char *s, FILE *fp);
89 > extern int      putint(long i, int siz, FILE *fp);
90 > extern int      putflt(double f, FILE *fp);
91 > extern size_t   putbinary(const void *s, size_t elsiz, size_t nel, FILE *fp);
92   extern char     *getstr(char *s, FILE *fp);
93   extern long     getint(int siz, FILE *fp);
94   extern double   getflt(FILE *fp);
95 + extern size_t   getbinary(void *s, size_t elsiz, size_t nel, FILE *fp);
96                                          /* defined in rexpr.c */
97   extern int      ecompile(char *sp, int iflg, int wflag);
98   extern char     *expsave(void);
99   extern void     expset(char *ep);
100   extern char     *eindex(char *sp);
101                                          /* defined in savestr.c */
102 < extern char     *savestr(char *str);
102 > extern char     *savestr(const char *str);
103   extern void     freestr(char *s);
104 < extern int      shash(char *s);
104 > extern int      shash(const char *s);
105                                          /* defined in savqstr.c */
106 < extern char     *savqstr(char *s);
106 > extern char     *savqstr(const char *s);
107   extern void     freeqstr(char *s);
108                                          /* defined in wordfile.c */
109 < extern int      wordfile(char **words, char *fname);
110 < extern int      wordstring(char **avl, char *str);
109 > extern int      wordfile(char **words, int nargs, char *fname);
110 > extern int      wordstring(char **avl, int nargs, char *str);
111                                          /* defined in words.c */
112   extern char     *atos(char *rs, int nb, char *s);
113   extern char     *nextword(char *cp, int nb, char *s);
# Line 85 | Line 123 | extern int     isfltd(char *s, char *ds);
123   extern float *  matchlamp(char *s);
124   extern int      loadlamps(char *file);
125   extern void     freelamps(void);
126 +
127 + #ifndef strlcpy                         /* defined in option strlcpy.c */
128 + extern size_t   strlcpy(char *dst, const char *src, size_t siz);
129 + extern size_t   strlcat(char *dst, const char *src, size_t siz);
130 + #endif
131 + #ifndef strncasecmp                     /* defined in option strncasecmp.c */
132 + extern int      strncasecmp(const char *s1, const char *s2, size_t n);
133 + #endif
134 + #ifndef strnstr                         /* defined in option strnstr.c */
135 + extern char *   strnstr(const char *haystack,
136 +                                const char *needle, size_t len);
137 + #endif
138  
139   #ifdef __cplusplus
140   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines