local.h

00001 /*
00002  * Copyright (c) 1990 The Regents of the University of California.
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms are permitted
00006  * provided that the above copyright notice and this paragraph are
00007  * duplicated in all such forms and that any documentation,
00008  * advertising materials, and other materials related to such
00009  * distribution and use acknowledge that the software was developed
00010  * by the University of California, Berkeley.  The name of the
00011  * University may not be used to endorse or promote products derived
00012  * from this software without specific prior written permission.
00013  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00014  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00015  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00016  *
00017  *      %W% (UofMD/Berkeley) %G%
00018  */
00019 
00020 /*
00021  * Information local to this implementation of stdio,
00022  * in particular, macros and private variables.
00023  */
00024 
00025 #include <_ansi.h>
00026 #include <stdarg.h>
00027 #include <reent.h>
00028 #include <unistd.h>
00029 
00030 extern int    _EXFUN(__svfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list));
00031 extern FILE  *_EXFUN(__sfp,(struct _reent *));
00032 extern int    _EXFUN(__sflags,(struct _reent *,_CONST char*, int*));
00033 extern int    _EXFUN(__srefill,(FILE *));
00034 extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(void *, char *, int));
00035 extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(void *, char const *, int));
00036 extern _fpos_t _EXFUN(__sseek,(void *, _fpos_t, int));
00037 extern int    _EXFUN(__sclose,(void *));
00038 extern int    _EXFUN(__stextmode,(int));
00039 extern void   _EXFUN(__sinit,(struct _reent *));
00040 extern void   _EXFUN(_cleanup_r,(struct _reent *));
00041 extern void   _EXFUN(__smakebuf,(FILE *));
00042 extern int    _EXFUN(_fwalk,(struct _reent *, int (*)(FILE *)));
00043 struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n));
00044 extern int   _EXFUN(__srefill,(FILE *fp));
00045 
00046 /* Called by the main entry point fns to ensure stdio has been initialized.  */
00047 
00048 #define CHECK_INIT(fp) \
00049   do                                    \
00050     {                                   \
00051       if (!_REENT->__sdidinit)          \
00052         __sinit (_REENT);               \
00053     }                                   \
00054   while (0)
00055 
00056 /* Return true iff the given FILE cannot be written now.  */
00057 
00058 #define cantwrite(fp) \
00059   ((((fp)->_flags & __SWR) == 0 || (fp)->_bf._base == NULL) && \
00060    __swsetup(fp))
00061 
00062 /* Test whether the given stdio file has an active ungetc buffer;
00063    release such a buffer, without restoring ordinary unread data.  */
00064 
00065 #define HASUB(fp) ((fp)->_ub._base != NULL)
00066 #define FREEUB(fp) { \
00067         if ((fp)->_ub._base != (fp)->_ubuf) \
00068                 _free_r(_REENT, (char *)(fp)->_ub._base); \
00069         (fp)->_ub._base = NULL; \
00070 }
00071 
00072 /* Test for an fgetline() buffer.  */
00073 
00074 #define HASLB(fp) ((fp)->_lb._base != NULL)
00075 #define FREELB(fp) { _free_r(_REENT,(char *)(fp)->_lb._base); (fp)->_lb._base = NULL; }
00076 
00077 /* WARNING: _dcvt is defined in the stdlib directory, not here!  */
00078 
00079 char *_EXFUN(_dcvt,(struct _reent *, char *, double, int, int, char, int));
00080 char *_EXFUN(_sicvt,(char *, short, char));
00081 char *_EXFUN(_icvt,(char *, int, char));
00082 char *_EXFUN(_licvt,(char *, long, char));
00083 #ifdef __GNUC__
00084 char *_EXFUN(_llicvt,(char *, long long, char));
00085 #endif
00086 
00087 #define CVT_BUF_SIZE 128
00088 
00089 #define NDYNAMIC 4      /* add four more whenever necessary */

Generated on Mon Apr 11 14:23:40 2011 for Contiki 2.5 by  doxygen 1.6.1