| 1 |
/* RCSid $Id: rtio.h,v 3.17 2018/05/04 21:22:44 greg Exp $ */ |
| 2 |
/* |
| 3 |
* Radiance i/o and string routines |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef _RAD_RTIO_H_ |
| 7 |
#define _RAD_RTIO_H_ |
| 8 |
|
| 9 |
#include <stdio.h> |
| 10 |
#include <sys/types.h> |
| 11 |
#include <fcntl.h> |
| 12 |
#include <string.h> |
| 13 |
|
| 14 |
#ifdef getc_unlocked /* avoid horrendous overhead of flockfile */ |
| 15 |
#undef getc |
| 16 |
#undef getchar |
| 17 |
#undef putc |
| 18 |
#undef putchar |
| 19 |
#undef feof |
| 20 |
#undef ferror |
| 21 |
#define getc getc_unlocked |
| 22 |
#define getchar getchar_unlocked |
| 23 |
#define putc putc_unlocked |
| 24 |
#define putchar putchar_unlocked |
| 25 |
#define feof feof_unlocked |
| 26 |
#define ferror ferror_unlocked |
| 27 |
#endif |
| 28 |
|
| 29 |
#ifdef __cplusplus |
| 30 |
extern "C" { |
| 31 |
#endif |
| 32 |
/* defined in badarg.c */ |
| 33 |
extern int badarg(int ac, char **av, char *fl); |
| 34 |
/* defined in expandarg.c */ |
| 35 |
extern int envexpchr, filexpchr; |
| 36 |
extern int expandarg(int *acp, char ***avp, int n); |
| 37 |
/* defined in fdate.c */ |
| 38 |
extern time_t fdate(char *fname); |
| 39 |
extern int setfdate(char *fname, long ftim); |
| 40 |
/* defined in fgetline.c */ |
| 41 |
extern char *fgetline(char *s, int n, FILE *fp); |
| 42 |
/* defined in fgetval.c */ |
| 43 |
extern int fgetval(FILE *fp, int ty, void *vp); |
| 44 |
/* defined in fgetword.c */ |
| 45 |
extern char *fgetword(char *s, int n, FILE *fp); |
| 46 |
/* defined in fputword.c */ |
| 47 |
extern void fputword(char *s, FILE *fp); |
| 48 |
/* defined in fropen.c */ |
| 49 |
extern FILE *frlibopen(char *fname); |
| 50 |
/* defined in getlibpath.c */ |
| 51 |
extern char *getrlibpath(void); |
| 52 |
/* defined in gethomedir.c */ |
| 53 |
extern char *gethomedir(char *uname, char *path, int plen); |
| 54 |
/* defined in getpath.c */ |
| 55 |
extern char *getpath(char *fname, char *searchpath, int mode); |
| 56 |
/* defined in byteswap.c */ |
| 57 |
extern void swap16(char *wp, int n); |
| 58 |
extern void swap32(char *wp, int n); |
| 59 |
extern void swap64(char *wp, int n); |
| 60 |
/* defined in portio.c */ |
| 61 |
extern void putstr(char *s, FILE *fp); |
| 62 |
extern void putint(long i, int siz, FILE *fp); |
| 63 |
extern void putflt(double f, FILE *fp); |
| 64 |
extern int putbinary(const void *s, int elsiz, int nel, FILE *fp); |
| 65 |
extern char *getstr(char *s, FILE *fp); |
| 66 |
extern long getint(int siz, FILE *fp); |
| 67 |
extern double getflt(FILE *fp); |
| 68 |
extern int getbinary(void *s, int elsiz, int nel, FILE *fp); |
| 69 |
/* defined in rexpr.c */ |
| 70 |
extern int ecompile(char *sp, int iflg, int wflag); |
| 71 |
extern char *expsave(void); |
| 72 |
extern void expset(char *ep); |
| 73 |
extern char *eindex(char *sp); |
| 74 |
/* defined in savestr.c */ |
| 75 |
extern char *savestr(char *str); |
| 76 |
extern void freestr(char *s); |
| 77 |
extern int shash(char *s); |
| 78 |
/* defined in savqstr.c */ |
| 79 |
extern char *savqstr(char *s); |
| 80 |
extern void freeqstr(char *s); |
| 81 |
/* defined in wordfile.c */ |
| 82 |
extern int wordfile(char **words, int nargs, char *fname); |
| 83 |
extern int wordstring(char **avl, int nargs, char *str); |
| 84 |
/* defined in words.c */ |
| 85 |
extern char *atos(char *rs, int nb, char *s); |
| 86 |
extern char *nextword(char *cp, int nb, char *s); |
| 87 |
extern char *sskip(char *s); |
| 88 |
extern char *sskip2(char *s, int n); |
| 89 |
extern char *iskip(char *s); |
| 90 |
extern char *fskip(char *s); |
| 91 |
extern int isint(char *s); |
| 92 |
extern int isintd(char *s, char *ds); |
| 93 |
extern int isflt(char *s); |
| 94 |
extern int isfltd(char *s, char *ds); |
| 95 |
/* defined in lamp.c */ |
| 96 |
extern float * matchlamp(char *s); |
| 97 |
extern int loadlamps(char *file); |
| 98 |
extern void freelamps(void); |
| 99 |
|
| 100 |
#ifdef __GNUC__ /* defined in option strlcpy.c */ |
| 101 |
extern size_t strlcpy(char *dst, const char *src, size_t siz); |
| 102 |
extern size_t strlcat(char *dst, const char *src, size_t siz); |
| 103 |
#endif |
| 104 |
|
| 105 |
#ifdef __cplusplus |
| 106 |
} |
| 107 |
#endif |
| 108 |
#endif /* _RAD_RTIO_H_ */ |
| 109 |
|