t as long as it returns -1 with `errno' set to EINTR. */ # define TEMP_FAILURE_RETRY(expression) \ (__extension__ \ ({ long int __result; \ do __result = (long int) (expression); \ while (__result == -1L && errno == EINTR); \ __result; })) #endif #if (defined __USE_POSIX199309 || defined __USE_UNIX98) \ && defined __UCLIBC_HAS_REALTIME__ /* Synchronize at least the data part of a file with the underlying media. */ extern int fdatasync (int __fildes) __THROW; #endif /* Use POSIX199309 */ /* XPG4.2 specifies that prototypes for the encryption functions must be defined here. */ #ifdef __USE_XOPEN # if defined __UCLIBC_HAS_CRYPT__ /* Encrypt at most 8 characters from KEY using salt to perturb DES. */ extern char *crypt (__const char *__key, __const char *__salt) __THROW __nonnull ((1, 2)); /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt block in place. */ extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1)); # endif /* __UCLIBC_HAS_CRYPT__ */ /* Swab pairs bytes in the first N bytes of the area pointed to by FROM and copy the result to TO. The value of TO must not be in the range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM is without partner. */ extern void swab (__const void *__restrict __from, void *__restrict __to, ssize_t __n) __THROW __nonnull ((1, 2)); #endif /* The Single Unix specification demands this prototype to be here. It is also found in . */ #ifdef __USE_XOPEN /* Return the name of the controlling terminal. */ extern char *ctermid (char *__s) __THROW; #endif /* Define some macros helping to catch buffer overflows. */ #if __USE_FORTIFY_LEVEL > 0 && !defined __cplusplus # include #endif __END_DECLS #endif /* unistd.h */ /* High precision, low overhead timing functions. Generic version. Copyright (C) 1998, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1998. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _HP_TIMING_H #define _HP_TIMING_H 1 /* There are no generic definitions for the times. We could write something using the `gettimeofday' system call where available but the overhead of the system call might be too high. In case a platform supports timers in the hardware the following macros and types must be defined: - HP_TIMING_AVAIL: test for availability. - HP_TIMING_INLINE: this macro is non-zero if the functionality is not implemented using function calls but instead uses some inlined code which might simply consist of a few assembler instructions. We have to know this since we might want to use the macros here in places where we cannot make function calls. - hp_timing_t: This is the type for variables used to store the time values. - HP_TIMING_ZERO: clear `hp_timing_t' object. - HP_TIMING_NOW: place timestamp for current time in variable given as parameter. - HP_TIMING_DIFF_INIT: do whatever is necessary to be able to use the HP_TIMING_DIFF macro. - HP_TIMING_DIFF: compute difference between two times and store it in a third. Source and destination might overlap. - HP_TIMING_ACCUM: add time difference to another variable. This might be a bit more complicated to implement for some platforms as the operation should be thread-safe and 64bit arithmetic on 32bit platforms is not. - HP_TIMING_ACCUM_NT: this is the variant for situations where we know there are no threads involved. - HP_TIMING_PRINT: write decimal representation of the timing value into the given string. This operation need not be inline even though HP_TIMING_INLINE is specified. */ /* Provide dummy definitions. */ #define HP_TIMING_AVAIL (0) #define HP_TIMING_INLINE (0) typedef int hp_timing_t; #define HP_TIMING_ZERO(Var) #define HP_TIMING_NOW(var) #define HP_TIMING_DIFF_INIT() #define HP_TIMING_DIFF(Diff, Start, End) #define HP_TIMING_ACCUM(Sum, Diff) #define HP_TIMING_ACCUM_NT(Sum, Diff) #define HP_TIMING_PRINT(Buf, Len, Val) /* Since this implementation is not available we tell the user about it. */ #define HP_TIMING_NONAVAIL 1 #endif /* hp-timing.h */ /* obstack.h - object stack macros Copyright (C) 1988-1994,1996-1999,2003,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Summary: All the apparent functions defined here are macros. The idea is that you would use these pre-tested macros to solve a very specific set of problems, and they would run fast. Caution: no side-effects in arguments please!! They may be evaluated MANY times!! These macros operate a stack of objects. Each object starts life small, and may grow to maturity. (Consider building a word syllable by syllable.) An object can move while it is growing. Once it has been "finished" it never changes address again. So the "top of the stack" is typically an immature growing object, while the rest of the stack is of mature, fixed size and fixed address objects. These routines grab large chunks of memory, using a function you supply, called `obstack_chunk_alloc'. On occasion, they free chunks, by calling `obstack_chunk_free'. You must define them and declare them before using any obstack macros. Each independent stack is represented by a `struct obstack'. Each of the obstack macros expects a pointer to such a structure as the first argument. One motivation for this package is the problem of growing char strings in symbol tables. Unless you are "fascist pig with a read-only mind" --Gosper's immortal quote from HAKMEM item 154, out of context--you would not like to put any arbitrary upper limit on the length of your symbols. In practice this often means you will build many short symbols and a few long symbols. At the time you are reading a symbol you don't know how long it is. One traditional method is to read a symbol into a buffer, realloc()ating the buffer every time you try to read a symbol that is longer than the buffer. This is beaut, but you still will want to copy the symbol from the buffer to a more permanent symbol-table entry say about half the time. With obstacks, you can work differently. Use one obstack for all symbol names. As you read a symbol, grow the name in the obstack gradually. When the name is complete, finalize it. Then, if the symbol exists already, free the newly read name. The way we do this is to take a large chunk, allocating memory from low addresses. When you want to build a symbol in the chunk you just add chars above the current "high water mark" in the chunk. When you have finished adding chars, because you got to the end of the symbol, you know how long the chars are, and you can create a new object. Mostly the chars will not burst over the highest address of the chunk, because you would typically expect a chunk to be (say) 100 times as long as an average object. In case that isn't clear, when we have enough chars to make up the object, THEY ARE ALREADY CONTIGUOUS IN THE CHUNK (guaranteed) so we just point to it where it lies. No moving of chars is needed and this is the second win: potentially long strings need never be explicitly shuffled. Once an object is formed, it does not change its address during its lifetime. When the chars burst over a chunk boundary, we allocate a larger chunk, and then copy the partly formed object from the end of the old chunk to the beginning of the new larger chunk. We then carry on accreting characters to the end of the object as we normally would. A special macro is provided to add a single char at a time to a growing object. This allows the use of register variables, which break the ordinary 'growth' macro. Summary: We allocate large chunks. We carve out one object at a time from the current chunk. Once carved, an object never moves. We are free to append data of any size to the currently growing object. Exactly one object is growing in an obstack at any one time. You can run one obstack per control block. You may have as many control blocks as you dare. Because of the way we do it, you can `unwind' an obstack back to a previous state. (You may remove objects much as you would with a stack.) */ /* Don't do the contents of this file more than once. */ #ifndef _OBSTACK_H #define _OBSTACK_H 1 #ifdef __cplusplus extern "C" { #endif /* We need the type of a pointer subtraction. If __PTRDIFF_TYPE__ is defined, as with GNU C, use that; that way we don't pollute the namespace with 's symbols. Otherwise, include and use ptrdiff_t. */ #ifdef __PTRDIFF_TYPE__ # define PTR_INT_TYPE __PTRDIFF_TYPE__ #else # include # define PTR_INT_TYPE ptrdiff_t #endif /* If B is the base of an object addressed by P, return the result of aligning P to the next multiple of A + 1. B and P must be of type char *. A + 1 must be a power of 2. */ #define __BPTR_ALIGN(B, P, A) ((B) + (((P) - (B) + (A)) & ~(A))) /* Similiar to _BPTR_ALIGN (B, P, A), except optimize the common case where pointers can be converted to integers, aligned as integers, and converted back again. If PTR_INT_TYPE is narrower than a pointer (e.g., the AS/400), play it safe and compute the alignment relative to B. Otherwise, use the faster strategy of computing the alignment relative to 0. */ #define __PTR_ALIGN(B, P, A) \ __BPTR_ALIGN (sizeof (PTR_INT_TYPE) < sizeof (void *) ? (B) : (char *) 0, \ P, A) #include struct _obstack_chunk /* Lives at front of each chunk. */ { char *limit; /* 1 past end of this chunk */ struct _obstack_chunk *prev; /* address of prior chunk or NULL */ char contents[4]; /* objects begin here */ }; struct obstack /* control current object in current chunk */ { long chunk_size; /* preferred size to allocate chunks in */ struct _obstack_chunk *chunk; /* address of current struct obstack_chunk */ char *object_base; /* address of object we are building */ char *next_free; /* where to add next char to current object */ char *chunk_limit; /* address of char after current chunk */ union { PTR_INT_TYPE tempint; void *tempptr; } temp; /* Temporary for some macros. */ int alignment_mask; /* Mask of alignment for each object. */ /* These prototypes vary based on `use_extra_arg', and we use casts to the prototypeless function type in all assignments, but having prototypes here quiets -Wstrict-prototypes. */ struct _obstack_chunk *(*chunkfun) (void *, long); void (*freefun) (void *, struct _obstack_chunk *); void *extra_arg; /* first arg for chunk alloc/dealloc funcs */ unsigned use_extra_arg:1; /* chunk alloc/dealloc funcs take extra arg */ unsigned maybe_empty_object:1;/* There is a possibility that the current chunk contains a zero-length object. This prevents freeing the chunk if we allocate a bigger chunk to replace it. */ unsigned alloc_failed:1; /* No longer used, as we now call the failed handler on error, but retained for binary compatibility. */ }; /* Declare the external functions we use; they are in obstack.c. */ extern void _obstack_newchunk (struct obstack *, int); extern int _obstack_begin (struct obstack *, int, int, void *(*) (long), void (*) (void *)); extern int _obstack_begin_1 (struct obstack *, int, int, void *(*) (void *, long), void (*) (void *, void *), void *); extern int _obstack_memory_used (struct obstack *); void obstack_free (struct obstack *obstack, void *block); /* Error handler called when `obstack_chunk_alloc' failed to allocate more memory. This can be set to a user defined function which should either abort gracefully or use longjump - but shouldn't return. The default action is to print a message and abort. */ extern void (*obstack_alloc_failed_handler) (void); /* Exit value used when `print_and_abort' is used. */ extern int obstack_exit_failure; /* Pointer to beginning of object being allocated or to be allocated next. Note that this might not be the final address of the object because a new chunk might be needed to hold the final size. */ #define obstack_base(h) ((void *) (h)->object_base) /* Size for allocating ordinary chunks. */ #define obstack_chunk_size(h) ((h)->chunk_size) /* Pointer to next byte not yet allocated in current chunk. */ #define obstack_next_free(h) ((h)->next_free) /* Mask specifying low bits that should be clear in address of an object. */ #define obstack_alignment_mask(h) ((h)->alignment_mask) /* To prevent prototype warnings provide complete argument list. */ #define obstack_init(h) \ _obstack_begin ((h), 0, 0, \ (void *(*) (long)) obstack_chunk_alloc, \ (void (*) (void *)) obstack_chunk_free) #define obstack_begin(h, size) \ _obstack_begin ((h), (size), 0, \ (void *(*) (long)) obstack_chunk_alloc, \ (void (*) (void *)) obstack_chunk_free) #define obstack_specify_allocation(h, size, alignment, chunkfun, freefun) \ _obstack_begin ((h), (size), (alignment), \ (void *(*) (long)) (chunkfun), \ (void (*) (void *)) (freefun)) #define obstack_specify_allocation_with_arg(h, size, alignment, chunkfun, freefun, arg) \ _obstack_begin_1 ((h), (size), (alignment), \ (void *(*) (void *, long)) (chunkfun), \ (void (*) (void *, void *)) (freefun), (arg)) #define obstack_chunkfun(h, newchunkfun) \ ((h) -> chunkfun = (struct _obstack_chunk *(*)(void *, long)) (newchunkfun)) #define obstack_freefun(h, newfreefun) \ ((h) -> freefun = (void (*)(void *, struct _obstack_chunk *)) (newfreefun)) #define obstack_1grow_fast(h,achar) (*((h)->next_free)++ = (achar)) #define obstack_blank_fast(h,n) ((h)->next_free += (n)) #define obstack_memory_used(h) _obstack_memory_used (h) #if defined __GNUC__ && defined __STDC__ && __STDC__ /* NextStep 2.0 cc is really gcc 1.93 but it defines __GNUC__ = 2 and does not implement __extension__. But that compiler doesn't define __GNUC_MINOR__. */ # if __GNUC__ < 2 || (defined __NeXT__ && __NeXT__ && !__GNUC_MINOR__) # define __extension__ # endif /* For GNU C, if not -traditional, we can define these macros to compute all args only once without using a global variable. Also, we can avoid using the `temp' slot, to make faster code. */ # define obstack_object_size(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (unsigned) (__o->next_free - __o->object_base); }) # define obstack_room(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (unsigned) (__o->chunk_limit - __o->next_free); }) # define obstack_make_room(OBSTACK,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ (void) 0; }) # define obstack_empty_p(OBSTACK) \ __extension__ \ ({ struct obstack const *__o = (OBSTACK); \ (__o->chunk->prev == 0 \ && __o->next_free == __PTR_ALIGN ((char *) __o->chunk, \ __o->chunk->contents, \ __o->alignment_mask)); }) # define obstack_grow(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->next_free + __len > __o->chunk_limit) \ _obstack_newchunk (__o, __len); \ memcpy (__o->next_free, where, __len); \ __o->next_free += __len; \ (void) 0; }) # define obstack_grow0(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); ¶¶¶¶¶¶¶¶ \ int __len = (length); \ if (__o->next_free + __len + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, __len + 1); \ memcpy (__o->next_free, where, __len); \ __o->next_free += __len; \ *(__o->next_free)++ = 0; \ (void) 0; }) # define obstack_1grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + 1 > __o->chunk_limit) \ _obstack_newchunk (__o, 1); \ obstack_1grow_fast (__o, datum); \ (void) 0; }) /* These assume that the obstack alignment is good enough for pointers or ints, and that the data added so far to the current object shares that much alignment. */ # define obstack_ptr_grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + sizeof (void *) > __o->chunk_limit) \ _obstack_newchunk (__o, sizeof (void *)); \ obstack_ptr_grow_fast (__o, datum); }) \ # define obstack_int_grow(OBSTACK,datum) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ if (__o->next_free + sizeof (int) > __o->chunk_limit) \ _obstack_newchunk (__o, sizeof (int)); \ obstack_int_grow_fast (__o, datum); }) # define obstack_ptr_grow_fast(OBSTACK,aptr) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ *(const void **) __o1->next_free = (aptr); \ __o1->next_free += sizeof (const void *); \ (void) 0; }) # define obstack_int_grow_fast(OBSTACK,aint) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ *(int *) __o1->next_free = (aint); \ __o1->next_free += sizeof (int); \ (void) 0; }) # define obstack_blank(OBSTACK,length) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ int __len = (length); \ if (__o->chunk_limit - __o->next_free < __len) \ _obstack_newchunk (__o, __len); \ obstack_blank_fast (__o, __len); \ (void) 0; }) # define obstack_alloc(OBSTACK,length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_blank (__h, (length)); \ obstack_finish (__h); }) # define obstack_copy(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_grow (__h, (where), (length)); \ obstack_finish (__h); }) # define obstack_copy0(OBSTACK,where,length) \ __extension__ \ ({ struct obstack *__h = (OBSTACK); \ obstack_grow0 (__h, (where), (length)); \ obstack_finish (__h); }) /* The local variable is named __o1 to avoid a name conflict when obstack_blank is called. */ # define obstack_finish(OBSTACK) \ __extension__ \ ({ struct obstack *__o1 = (OBSTACK); \ void *__value = (void *) __o1->object_base; \ if (__o1->next_free == __value) \ __o1->maybe_empty_object = 1; \ __o1->next_free \ = __PTR_ALIGN (__o1->object_base, __o1->next_free, \ __o1->alignment_mask); \ if (__o1->next_free - (char *)__o1->chunk \ > __o1->chunk_limit - (char *)__o1->chunk) \ __o1->next_free = __o1->chunk_limit; \ __o1->object_base = __o1->next_free; \ __value; }) # define obstack_free(OBSTACK, OBJ) \ __extension__ \ ({ struct obstack *__o = (OBSTACK); \ void *__obj = (OBJ); \ if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) \ __o->next_free = __o->object_base = (char *)__obj; \ else (obstack_free) (__o, __obj); }) #else /* not __GNUC__ or not __STDC__ */ # define obstack_object_size(h) \ (unsigned) ((h)->next_free - (h)->object_base) # define obstack_room(h) \ (unsigned) ((h)->chunk_limit - (h)->next_free) # define obstack_empty_p(h) \ ((h)->chunk->prev == 0 \ && (h)->next_free == __PTR_ALIGN ((char *) (h)->chunk, \ (h)->chunk->contents, \ (h)->alignment_mask)) /* Note that the call to _obstack_newchunk is enclosed in (..., 0) so that we can avoid having void expressions in the arms of the conditional expression. Casting the third operand to void was tried before, but some compilers won't accept it. */ # define obstack_make_room(h,length) \ ( (h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0)) # define obstack_grow(h,where,length) \ ( (h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ memcpy ((h)->next_free, where, (h)->temp.tempint), \ (h)->next_free += (h)->temp.tempint) # define obstack_grow0(h,where,length) \ ( (h)->temp.tempint = (length), \ (((h)->next_free + (h)->temp.tempint + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), (h)->temp.tempint + 1), 0) : 0), \ memcpy ((h)->next_free, where, (h)->temp.tempint), \ (h)->next_free += (h)->temp.tempint, \ *((h)->next_free)++ = 0) # define obstack_1grow(h,datum) \ ( (((h)->next_free + 1 > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), 1), 0) : 0), \ obstack_1grow_fast (h, datum)) # define obstack_ptr_grow(h,datum) \ ( (((h)->next_free + sizeof (char *) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (char *)), 0) : 0), \ obstack_ptr_grow_fast (h, datum)) # define obstack_int_grow(h,datum) \ ( (((h)->next_free + sizeof (int) > (h)->chunk_limit) \ ? (_obstack_newchunk ((h), sizeof (int)), 0) : 0), \ obstack_int_grow_fast (h, datum)) # define obstack_ptr_grow_fast(h,aptr) \ (((const void **) ((h)->next_free += sizeof (void *)))[-1] = (aptr)) # define obstack_int_grow_fast(h,aint) \ (((int *) ((h)->next_free += sizeof (int)))[-1] = (aint)) # define obstack_blank(h,length) \ ( (h)->temp.tempint = (length), \ (((h)->chunk_limit - (h)->next_free < (h)->temp.tempint) \ ? (_obstack_newchunk ((h), (h)->temp.tempint), 0) : 0), \ obstack_blank_fast (h, (h)->temp.tempint)) # define obstack_alloc(h,length) \ (obstack_blank ((h), (length)), obstack_finish ((h))) # define obstack_copy(h,where,length) \ (obstack_grow ((h), (where), (length)), obstack_finish ((h))) # define obstack_copy0(h,where,length) \ (obstack_grow0 ((h), (where), (length)), obstack_finish ((h))) # define obstack_finish(h) \ ( ((h)->next_free == (h)->object_base \ ? (((h)->maybe_empty_object = 1), 0) \ : 0), \ (h)->temp.tempptr = (h)->object_base, \ (h)->next_free \ = __PTR_ALIGN ((h)->object_base, (h)->next_free, \ (h)->alignment_mask), \ (((h)->next_free - (char *) (h)->chunk \ > (h)->chunk_limit - (char *) (h)->chunk) \ ? ((h)->next_free = (h)->chunk_limit) : 0), \ (h)->object_base = (h)->next_free, \ (h)->temp.tempptr) # define obstack_free(h,obj) \ ( (h)->temp.tempint = (char *) (obj) - (char *) (h)->chunk, \ ((((h)->temp.tempint > 0 \ && (h)->temp.tempint < (h)->chunk_limit - (char *) (h)->chunk)) \ ? (int) ((h)->next_free = (h)->object_base \ = (h)->temp.tempint + (char *) (h)->chunk) \ : (((obstack_free) ((h), (h)->temp.tempint + (char *) (h)->chunk), 0), 0))) #endif /* not __GNUC__ or not __STDC__ */ #ifdef __cplusplus } /* C++ */ #endif #endif /* obstack.h */ /* Copyright (C) 1991-1993,1995-1999,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* March 11, 2001 Manuel Novoa III * * Modified as appropriate for my new stdio lib. */ #ifndef _PRINTF_H #define _PRINTF_H 1 #include __BEGIN_DECLS #define __need_FILE #include #define __need_size_t #define __need_wchar_t #include /* WARNING -- This is definitely nonportable... but it seems to work * with gcc, which is currently the only "supported" compiler. * The library code uses bitmasks for space-efficiency (you can't * set/test multiple bitfields in one operation). Unfortunatly, we * need to support bitfields since that's what glibc made visible to users. * So, we take * advantage of how gcc lays out bitfields to create an appropriate * mapping. Inside uclibc (i.e. if _LIBC is defined) we access the * bitfields using bitmasks in a single flag variable. * * WARNING -- This may very well fail if built with -fpack-struct!!! * * TODO -- Add a validation test. * TODO -- Add an option to build in a shim translation function if * the bitfield<->bitmask mapping fails. */ #include struct printf_info { int prec; /* Precision. */ int width; /* Width. */ #ifdef __UCLIBC_HAS_WCHAR__ wchar_t spec; /* Format letter. */ #else int spec; #endif #if __BYTE_ORDER == __LITTLE_ENDIAN unsigned int space:1; /* Space flag. */ unsigned int showsign:1; /* + flag. */ unsigned int extra:1; /* For special use. */ unsigned int left:1; /* - flag. */ unsigned int alt:1; /* # flag. */ unsigned int group:1; /* ' flag. */ unsigned int i18n:1; /* I flag. */ unsigned int wide:1; /* Nonzero for wide character streams. */ unsigned int is_char:1; /* hh flag. */ unsigned int is_short:1; /* h flag. */ unsigned int is_long:1; /* l flag. */ unsigned int is_long_double:1;/* L flag. */ unsigned int __padding:20; /* non-gnu: match _flags width of 32 bits */ #elif __BYTE_ORDER == __BIG_ENDIAN unsigned int __padding:20; /* non-gnu: match _flags width of 32 bits */ unsigned int is_long_double:1;/* L flag. */ unsigned int is_long:1; /* l flag. */ unsigned int is_short:1; /* h flag. */ unsigned int is_char:1; /* hh flag. */ unsigned int wide:1; /* Nonzero for wide character streams. */ unsigned int i18n:1; /* I flag. */ unsigned int group:1; /* ' flag. */ unsigned int alt:1; /* # flag. */ unsigned int left:1; /* - flag. */ unsigned int extra:1; /* For special use. */ unsigned int showsign:1; /* + flag. */ unsigned int space:1; /* Space flag. */ #else #error unsupported byte order! #endif #ifdef __UCLIBC_HAS_WCHAR__ wchar_t pad; /* Padding character. */ #else int pad; #endif }; /* Type of a printf specifier-handler function. STREAM is the FILE on which to write output. INFO gives information about the format specification. ARGS is a vector of pointers to the argument data; the number of pointers will be the number returned by the associated arginfo function for the same INFO. The function should return the number of characters written, or -1 for errors. */ #ifdef __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__ typedef int (*printf_function) (FILE *__stream, __const struct printf_info *__info, __const void *__const *__args); /* Type of a printf specifier-arginfo function. INFO gives information about the format specification. N, ARGTYPES, and return value are as for parse_printf_format. */ typedef int printf_arginfo_function (__const struct printf_info *__info, size_t __n, int *__argtypes); /* Register FUNC to be called to format SPEC specifiers; ARGINFO must be specified to determine how many arguments a SPEC conversion requires and what their types are. */ extern int register_printf_function (int __spec, printf_function __func, printf_arginfo_function __arginfo); #endif /* Parse FMT, and fill in N elements of ARGTYPES with the types needed for the conversions FMT specifies. Returns the number of arguments required by FMT. The ARGINFO function registered with a user-defined format is passed a `struct printf_info' describing the format spec being parsed. A width or precision of INT_MIN means a `*' was used to indicate that the width/precision will come from an arg. The function should fill in the array it is passed with the types of the arguments it wants, and return the number of arguments it wants. */ extern size_t parse_printf_format (__const char *__restrict __fmt, size_t __n, int *__restrict __argtypes) __THROW; /* Codes returned by `parse_printf_format' for basic types. These values cover all the standard format specifications. Users can add new values after PA_LAST for their own types. */ /* WARNING -- The above is not entirely true, even for glibc. * As far as the library code is concerned, such args are treated * as 'your type' pointers if qualified by PA_FLAG_PTR. If they * aren't qualified as pointers, I _think_ glibc just ignores them * and carries on. I think it should be treated as an error. */ enum { /* C type: */ PA_INT, /* int */ PA_CHAR, /* int, cast to char */ PA_WCHAR, /* wide char */ PA_STRING, /* const char *, a '\0'-terminated string */ PA_WSTRING, /* const wchar_t *, wide character string */ PA_POINTER, /* void * */ PA_FLOAT, /* float */ PA_DOUBLE, /* double */ __PA_NOARG, /* non-glibc -- signals non-arg width or prec */ PA_LAST }; /* Flag bits that can be set in a type returned by `parse_printf_format'. */ /* WARNING -- These differ in value from what glibc uses. */ #define PA_FLAG_MASK (0xff00) #define __PA_FLAG_CHAR (0x0100) /* non-gnu -- to deal with hh */ #define PA_FLAG_SHORT (0x0200) #define PA_FLAG_LONG (0x0400) #define PA_FLAG_LONG_LONG (0x0800) #define PA_FLAG_LONG_DOUBLE PA_FLAG_LONG_LONG #define PA_FLAG_PTR (0x1000) /* TODO -- make dynamic??? */ #define __PA_INTMASK (0x0f00) /* non-gnu -- all int flags */ #if 0 /* Function which can be registered as `printf'-handlers. */ /* Print floating point value using using abbreviations for the orders of magnitude used for numbers ('k' for kilo, 'm' for mega etc). If the format specifier is a uppercase character powers of 1000 are used. Otherwise powers of 1024. */ extern int printf_size (FILE *__restrict __fp, __const struct printf_info *__info, __const void *__const *__restrict __args) __THROW; /* This is the appropriate argument information function for `printf_size'. */ extern int printf_size_info (__const struct printf_info *__restrict __info, size_t __n, int *__restrict __argtypes) __THROW; #endif __END_DECLS #endif /* printf.h */ /**************************************************************************** * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * * "Software"), to deal in the Software without restriction, including * * without limitation the rights to use, copy, modify, merge, publish, * * distribute, distribute with modifications, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included * * in all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * * Except as contained in this notice, the name(s) of the above copyright * * holders shall not be used in advertising or otherwise to promote the * * sale, use or other dealings in this Software without prior written * * authorization. * ****************************************************************************/ /**************************************************************************** * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ /* $Id: menu.h,v 1.18 2003/11/08 20:48:24 tom Exp $ */ #ifndef ETI_MENU #define ETI_MENU #ifdef AMIGA #define TEXT TEXT_ncurses #endif #include #include #ifdef __cplusplus extern "C" { #endif typedef int Menu_Options; typedef int Item_Options; /* Menu options: */ #define O_ONEVALUE (0x01) #define O_SHOWDESC (0x02) #define O_ROWMAJOR (0x04) #define O_IGNORECASE (0x08) #define O_SHOWMATCH (0x10) #define O_NONCYCLIC (0x20) /* Item options: */ #define O_SELECTABLE (0x01) typedef struct { const char* str; unsigned short length; } TEXT; typedef struct tagITEM { TEXT name; /* name of menu item */ TEXT description; /* description of item, optional in display */ struct tagMENU *imenu; /* Pointer to parent menu */ void *userptr; /* Pointer to user defined per item data */ Item_Options opt; /* Item options */ short index; /* Item number if connected to a menu */ short y; /* y and x location of item in menu */ short x; bool value; /* Selection value */ struct tagITEM *left; /* neighbor items */ struct tagITEM *right; struct tagITEM *up; struct tagITEM *down; } ITEM; typedef void (*Menu_Hook)(struct tagMENU *); typedef struct tagMENU { short height; /* Nr. of chars high */ short width; /* Nr. of chars wide */ short rows; /* Nr. of items high */ short cols; /* Nr. of items wide */ short frows; /* Nr. of formatted items high */ short fcols; /* Nr. of formatted items wide */ short arows; /* Nr. of items high (actual) */ short namelen; /* Max. name length */ short desclen; /* Max. description length */ short marklen; /* Length of mark, if any */ short itemlen; /* Length of one item */ short spc_desc; /* Spacing for descriptor */ short spc_cols; /* Spacing for columns */ short spc_rows; /* Spacing for rows */ char *pattern; /* Buffer to store match chars */ short pindex; /* Index into pattern buffer */ WINDOW *win; /* Window containing menu */ WINDOW *sub; /* Subwindow for menu display */ WINDOW *userwin; /* User's window */ WINDOW *usersub; /* User's subwindow */ ITEM **items; /* array of items */ short nitems; /* Nr. of items in menu */ ITEM *curitem; /* Current item */ short toprow; /* Top row of menu */ chtype fore; /* Selection attribute */ chtype back; /* Nonselection attribute */ chtype grey; /* Inactive attribute */ unsigned char pad; /* Pad character */ Menu_Hook menuinit; /* User hooks */ Menu_Hook menuterm; Menu_Hook iteminit; Menu_Hook itemterm; void *userptr; /* Pointer to menus user data */ char *mark; /* Pointer to marker string */ Menu_Options opt; /* Menu options */ unsigned short status; /* Internal state of menu */ } MENU; /* Define keys */ #define REQ_LEFT_ITEM (KEY_MAX + 1) #define REQ_RIGHT_ITEM (KEY_MAX + 2) #define REQ_UP_ITEM (KEY_MAX + 3) #define REQ_DOWN_ITEM (KEY_MAX + 4) #define REQ_SCR_ULINE (KEY_MAX + 5) #define REQ_SCR_DLINE (KEY_MAX + 6) #define REQ_SCR_DPAGE (KEY_MAX + 7) #define REQ_SCR_UPAGE (KEY_MAX + 8) #define REQ_FIRST_ITEM (KEY_MAX + 9) #define REQ_LAST_ITEM (KEY_MAX + 10) #define REQ_NEXT_ITEM (KEY_MAX + 11) #define REQ_PREV_ITEM (KEY_MAX + 12) #define REQ_TOGGLE_ITEM (KEY_MAX + 13) #define REQ_CLEAR_PATTERN (KEY_MAX + 14) #define REQ_BACK_PATTERN (KEY_MAX + 15) #define REQ_NEXT_MATCH (KEY_MAX + 16) #define REQ_PREV_MATCH (KEY_MAX + 17) #define MIN_MENU_COMMAND (KEY_MAX + 1) #define MAX_MENU_COMMAND (KEY_MAX + 17) /* * Some AT&T code expects MAX_COMMAND to be out-of-band not * just for menu commands but for forms ones as well. */ #if defined(MAX_COMMAND) # if (MAX_MENU_COMMAND > MAX_COMMAND) # error Something is wrong -- MAX_MENU_COMMAND is greater than MAX_COMMAND # elif (MAX_COMMAND != (KEY_MAX + 128)) # error Something is wrong -- MAX_COMMAND is already inconsistently defined. # endif #else # define MAX_COMMAND (KEY_MAX + 128) #endif /* --------- prototypes for libmenu functions ----------------------------- */ extern NCURSES_EXPORT(ITEM **) menu_items (const MENU *); extern NCURSES_EXPORT(ITEM *) current_item (const MENU *); extern NCURSES_EXPORT(ITEM *) new_item (const char *,const char *); extern NCURSES_EXPORT(MENU *) new_menu (ITEM **); extern NCURSES_EXPORT(Item_Options) item_opts (const ITEM *); extern NCURSES_EXPORT(Menu_Options) menu_opts (const MENU *); extern NCURSES_EXPORT(Menu_Hook) item_init (const MENU *); extern NCURSES_EXPORT(Menu_Hook) item_term (const MENU *); extern NCURSES_EXPORT(Menu_Hook) menu_init (const MENU *); extern NCURSES_EXPORT(Menu_Hook) menu_term (const MENU *); extern NCURSES_EXPORT(WINDOW *) menu_sub (const MENU *); extern NCURSES_EXPORT(WINDOW *) menu_win (const MENU *); extern NCURSES_EXPORT(const char *) item_description (const ITEM *); extern NCURSES_EXPORT(const char *) item_name (const ITEM *); extern NCURSES_EXPORT(const char *) menu_mark (const MENU *); extern NCURSES_EXPORT(const char *) menu_request_name (int); extern NCURSES_EXPORT(char *) menu_pattern (const MENU *); extern NCURSES_EXPORT(void *) menu_userptr (const MENU *); extern NCURSES_EXPORT(void *) item_userptr (const ITEM *); extern NCURSES_EXPORT(chtype) menu_back (const MENU *); extern NCURSES_EXPORT(chtype) menu_fore (const MENU *); extern NCURSES_EXPORT(chtype) menu_grey (const MENU *); extern NCURSES_EXPORT(int) free_item (ITEM *); extern NCURSES_EXPORT(int) free_menu (MENU *); extern NCURSES_EXPORT(int) item_count (const MENU *); extern NCURSES_EXPORT(int) item_index (const ITEM *); extern NCURSES_EXPORT(int) item_opts_off (ITEM *,Item_Options); extern NCURSES_EXPORT(int) item_opts_on (ITEM *,Item_Options); extern NCURSES_EXPORT(int) menu_driver (MENU *,int); extern NCURSES_EXPORT(int) menu_opts_off (MENU *,Menu_Options); extern NCURSES_EXPORT(int) menu_opts_on (MENU *,Menu_Options); extern NCURSES_EXPORT(int) menu_pad (const MENU *); extern NCURSES_EXPORT(int) pos_menu_cursor (const MENU *); extern NCURSES_EXPORT(int) post_menu (MENU *); extern NCURSES_EXPORT(int) scale_menu (const MENU *,int *,int *); extern NCURSES_EXPORT(int) set_current_item (MENU *menu,ITEM *item); extern NCURSES_EXPORT(int) set_item_init (MENU *,void(*)(MENU *)); extern NCURSES_EXPORT(int) set_item_opts (ITEM *,Item_Options); extern NCURSES_EXPORT(int) set_item_term (MENU *,void(*)(MENU *)); extern NCURSES_EXPORT(int) set_item_userptr (ITEM *, void *); extern NCURSES_EXPORT(int) set_item_value (ITEM *,bool); extern NCURSES_EXPORT(int) set_menu_back (MENU *,chtype); extern NCURSES_EXPORT(int) set_menu_fore (MENU *,chtype); extern NCURSES_EXPORT(int) set_menu_format (MENU *,int,int); extern NCURSES_EXPORT(int) set_menu_grey (MENU *,chtype); extern NCURSES_EXPORT(int) set_menu_init (MENU *,void(*)(MENU *)); extern NCURSES_EXPORT(int) set_menu_items (MENU *,ITEM **); extern NCURSES_EXPORT(int) set_menu_mark (MENU *, const char *); extern NCURSES_EXPORT(int) set_menu_opts (MENU *,Menu_Options); extern NCURSES_EXPORT(int) set_menu_pad (MENU *,int); extern NCURSES_EXPORT(int) set_menu_pattern (MENU *,const char *); extern NCURSES_EXPORT(int) set_menu_sub (MENU *,WINDOW *); extern NCURSES_EXPORT(int) set_menu_term (MENU *,void(*)(MENU *)); extern NCURSES_EXPORT(int) set_menu_userptr (MENU *,void *); extern NCURSES_EXPORT(int) set_menu_win (MENU *,WINDOW *); extern NCURSES_EXPORT(int) set_top_row (MENU *,int); extern NCURSES_EXPORT(int) top_row (const MENU *); extern NCURSES_EXPORT(int) unpost_menu (MENU *); extern NCURSES_EXPORT(int) menu_request_by_name (const char *); extern NCURSES_EXPORT(int) set_menu_spacing (MENU *,int,int,int); extern NCURSES_EXPORT(int) menu_spacing (const MENU *,int *,int *,int *); extern NCURSES_EXPORT(bool) item_value (const ITEM *); extern NCURSES_EXPORT(bool) item_visible (const ITEM *); extern NCURSES_EXPORT(void) menu_format (const MENU *,int *,int *); #ifdef __cplusplus } #endif #endif /* ETI_MENU */ /* Symbol concatenation utilities. Copyright (C) 1998, 2000, 2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SYM_CAT_H #define SYM_CAT_H #if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE) #define CONCAT2(a,b) a##b #define CONCAT3(a,b,c) a##b##c #define CONCAT4(a,b,c,d) a##b##c##d #define CONCAT5(a,b,c,d,e) a##b##c##d##e #define CONCAT6(a,b,c,d,e,f) a##b##c##d##e##f #define STRINGX(s) #s #else /* Note one should never pass extra whitespace to the CONCATn macros, e.g. CONCAT2(foo, bar) because traditonal C will keep the space between the two labels instead of concatenating them. Instead, make sure to write CONCAT2(foo,bar). */ #define CONCAT2(a,b) a/**/b #define CONCAT3(a,b,c) a/**/b/**/c #define CONCAT4(a,b,c,d) a/**/b/**/c/**/d #define CONCAT5(a,b,c,d,e) a/**/b/**/c/**/d/**/e #define CONCAT6(a,b,c,d,e,f) a/**/b/**/c/**/d/**/e/**/f #define STRINGX(s) "s" #endif #define XCONCAT2(a,b) CONCAT2(a,b) #define XCONCAT3(a,b,c) CONCAT3(a,b,c) #define XCONCAT4(a,b,c,d) CONCAT4(a,b,c,d) #define XCONCAT5(a,b,c,d,e) CONCAT5(a,b,c,d,e) #define XCONCAT6(a,b,c,d,e,f) CONCAT6(a,b,c,d,e,f) /* Note the layer of indirection here is typically used to allow stringification of the expansion of macros. I.e. "#define foo bar", "XSTRING(foo)", to yield "bar". Be aware that this only works for __STDC__, not for traditional C which will still resolve to "foo". */ #define XSTRING(s) STRINGX(s) #endif /* SYM_CAT_H */ /* Copyright (C) 1991,92,96,97,99,2000,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _STRINGS_H #define _STRINGS_H 1 /* We don't need and should not read this file if was already read. The one exception being that if __USE_BSD isn't defined, then these aren't defined in string.h, so we need to define them here. */ /* keep this file in sync w/ string.h, the glibc version is out of date */ #if !defined _STRING_H || !defined __USE_BSD # include # define __need_size_t # include __BEGIN_DECLS # ifdef __UCLIBC_SUSV3_LEGACY__ /* Copy N bytes of SRC to DEST (like memmove, but args reversed). */ extern void bcopy (__const void *__src, void *__dest, size_t __n) __THROW __nonnull ((1, 2)); /* Set N bytes of S to 0. */ extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); /* Compare N bytes of S1 and S2 (same as memcmp). */ extern int bcmp (__const void *__s1, __const void *__s2, size_t __n) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Find the first occurrence of C in S (same as strchr). */ extern char *index (__const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); /* Find the last occurrence of C in S (same as strrchr). */ extern char *rindex (__const char *__s, int __c) __THROW __attribute_pure__ __nonnull ((1)); # else # ifdef __UCLIBC_SUSV3_LEGACY_MACROS__ /* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3. * They are replaced as proposed by SuSv3. Don't sync this part * with glibc and keep it in sync with string.h. */ # define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0) # define bzero(s,n) (memset((s), '\0', (n)), (void) 0) # define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n)) # define index(s,c) strchr((s), (c)) # define rindex(s,c) strrchr((s), (c)) # endif # endif /* Return the position of the first bit set in I, or 0 if none are set. The least-significant bit is position 1, the most-significant 32. */ extern int ffs (int __i) __THROW __attribute__ ((__const__)); /* The following two functions are non-standard but necessary for non-32 bit platforms. */ #if 0 /*def __USE_GNU*/ extern int ffsl (long int __l) __THROW __attribute__ ((__const__)); # ifdef __GNUC__ __extension__ extern int ffsll (long long int __ll) __THROW __attribute__ ((__const__)); # endif # endif /* Compare S1 and S2, ignoring case. */ extern int strcasecmp (__const char *__s1, __const char *__s2) __THROW __attribute_pure__ __nonnull ((1, 2)); /* Compare no more than N chars of S1 and S2, ignoring case. */ extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n) __THROW __attribute_pure__ __nonnull ((1, 2)); __END_DECLS #endif /* string.h */ #endif /* strings.h */ /* Copyright (C) 1991,92,93,94,96,97,98,99, 2003 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ /* * POSIX Standard: 7.1-2 General Terminal Interface */ #ifndef _TERMIOS_H #define _TERMIOS_H 1 #include #ifdef __USE_UNIX98 /* We need `pid_t'. */ # include # ifndef __pid_t_defined typedef __pid_t pid_t; # define __pid_t_defined # endif #endif __BEGIN_DECLS /* Get the system-dependent definitions of `struct termios', `tcflag_t', `cc_t', `speed_t', and all the macros specifying the flag bits. */ #include #ifdef __USE_BSD /* Compare a character C to a value VAL from the `c_cc' array in a `struct termios'. If VAL is _POSIX_VDISABLE, no character can match it. */ # define CCEQ(val, c) ((c) == (val) && (val) != _POSIX_VDISABLE) #endif /* Return the output baud rate stored in *TERMIOS_P. */ extern speed_t cfgetospeed (__const struct termios *__termios_p) __THROW; /* Return the input baud rate stored in *TERMIOS_P. */ extern speed_t cfgetispeed (__const struct termios *__termios_p) __THROW; /* Set the output baud rate stored in *TERMIOS_P to SPEED. */ extern int cfsetospeed (struct termios *__termios_p, speed_t __speed) __THROW; /* Set the input baud rate stored in *TERMIOS_P to SPEED. */ extern int cfsetispeed (struct termios *__termios_p, speed_t __speed) __THROW; #ifdef __USE_BSD /* Set both the input and output baud rates in *TERMIOS_OP to SPEED. */ extern int cfsetspeed (struct termios *__termios_p, speed_t __speed) __THROW; #endif /* Put the state of FD into *TERMIOS_P. */ extern int tcgetattr (int __fd, struct termios *__termios_p) __THROW; /* Set the state of FD to *TERMIOS_P. Values for OPTIONAL_ACTIONS (TCSA*) are in . */ extern int tcsetattr (int __fd, int __optional_actions, __const struct termios *__termios_p) __THROW; #ifdef __USE_BSD /* Set *TERMIOS_P to indicate raw mode. */ extern void cfmakeraw (struct termios *__termios_p) __THROW; #endif /* Send zero bits on FD. */ extern int tcsendbreak (int __fd, int __duration) __THROW; /* Wait for pending output to be written on FD. This function is a cancellation point and therefore not marked with __THROW. */ extern int tcdrain (int __fd); /* Flush pending data on FD. Values for QUEUE_SELECTOR (TC{I,O,IO}FLUSH) are in . */ extern int tcflush (int __fd, int __queue_selector) __THROW; /* Suspend or restart transmission on FD. Values for ACTION (TC[IO]{OFF,ON}) are in . */ extern int tcflow (int __fd, int __action) __THROW; #ifdef __USE_UNIX98 /* Get process group ID for session leader for controlling terminal FD. */ extern __pid_t tcgetsid (int __fd) __THROW; #endif #ifdef __USE_BSD # include #endif __END_DECLS #endif /* termios.h */ /* Access to locale-dependent parameters. Copyright (C) 1995-2002,2003,2004,2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #ifndef _LANGINFO_H #define _LANGINFO_H 1 /* Get the type definition. */ #include #include /* Define the __LC_* category names. */ __BEGIN_DECLS /* Construct an `nl_item' value for `nl_langinfo' from a locale category (LC_*) and an item index within the category. Some code may depend on the item values within a category increasing monotonically with the indices. */ #if 0 #define _NL_ITEM(category, index) (((category) << 16) | (index)) /* Extract the category and item index from a constructed `nl_item' value. */ #define _NL_ITEM_CATEGORY(item) ((int) (item) >> 16) #define _NL_ITEM_INDEX(item) ((int) (item) & 0xffff) #else #define _NL_ITEM(category, index) \ (((category) << __NL_ITEM_CATEGORY_SHIFT) | (index)) /* Extract the category and item index from a constructed `nl_item' value. */ #define _NL_ITEM_CATEGORY(item) ((int) (item) >> __NL_ITEM_CATEGORY_SHIFT) #define _NL_ITEM_INDEX(item) ((int) (item) & __NL_ITEM_INDEX_MASK) #endif /* Enumeration of locale items that can be queried with `nl_langinfo'. */ enum { /* LC_TIME category: date and time formatting. */ /* Abbreviated days of the week. */ ABDAY_1 = _NL_ITEM (__LC_TIME, 0), /* Sun */ #define ABDAY_1 ABDAY_1 ABDAY_2, #define ABDAY_2 ABDAY_2 ABDAY_3, #define ABDAY_3 ABDAY_3 ABDAY_4, #define ABDAY_4 ABDAY_4 ABDAY_5, #define ABDAY_5 ABDAY_5 ABDAY_6, #define ABDAY_6 ABDAY_6 ABDAY_7, #define ABDAY_7 ABDAY_7 /* Long-named days of the week. */ DAY_1, /* Sunday */ #define DAY_1 DAY_1 DAY_2, /* Monday */ #define DAY_2 DAY_2 DAY_3, /* Tuesday */ #define DAY_3 DAY_3 DAY_4, /* Wednesday */ #define DAY_4 DAY_4 DAY_5, /* Thursday */ #define DAY_5 DAY_5 DAY_6, /* Friday */ #define DAY_6 DAY_6 DAY_7, /* Saturday */ #define DAY_7 DAY_7 /* Abbreviated month names. */ ABMON_1, /* Jan */ #define ABMON_1 ABMON_1 ABMON_2, #define ABMON_2 ABMON_2 ABMON_3, #define ABMON_3 ABMON_3 ABMON_4, #define ABMON_4 ABMON_4 ABMON_5, #define ABMON_5 ABMON_5 ABMON_6, #define ABMON_6 ABMON_6 ABMON_7, #define ABMON_7 ABMON_7 ABMON_8, #define ABMON_8 ABMON_8 ABMON_9, #define ABMON_9 ABMON_9 ABMON_10, #define ABMON_10 ABMON_10 ABMON_11, #define ABMON_11 ABMON_11 ABMON_12, #define ABMON_12 ABMON_12 /* Long month names. */ MON_1, /* January */ #define MON_1 MON_1 MON_2, #define MON_2 MON_2 MON_3, #define MON_3 MON_3 MON_4, #define MON_4 MON_4 MON_5, #define MON_5 MON_5 MON_6, #define MON_6 MON_6 MON_7, #define MON_7 MON_7 MON_8, #define MON_8 MON_8 MON_9, #define MON_9 MON_9 MON_10, #define MON_10 MON_10 MON_11, #define MON_11 MON_11 MON_12, #define MON_12 MON_12 AM_STR, /* Ante meridian string. */ #define AM_STR AM_STR PM_STR, /* Post meridian string. */ #define PM_STR PM_STR D_T_FMT, /* Date and time format for strftime. */ #define D_T_FMT D_T_FMT D_FMT, /* Date format for strftime. */ #define D_FMT D_FMT T_FMT, /* Time format for strftime. */ #define T_FMT T_FMT T_FMT_AMPM, /* 12-hour time format for strftime. */ #define T_FMT_AMPM T_FMT_AMPM ERA, /* Alternate era. */ #define ERA ERA __ERA_YEAR, /* Year in alternate era format. */ #ifdef __USE_GNU # define ERA_YEAR __ERA_YEAR #endif ERA_D_FMT, /* Date in alternate era format. */ #define ERA_D_FMT ERA_D_FMT ALT_DIGITS, /* Alternate symbols for digits. */ #define ALT_DIGITS ALT_DIGITS ERA_D_T_FMT, /* Date and time in alternate era format. */ #define ERA_D_T_FMT ERA_D_T_FMT ERA_T_FMT, /* Time in alternate era format. */ #define ERA_T_FMT ERA_T_FMT #if 0 _NL_TIME_ERA_NUM_ENTRIES, /* Number entries in the era arrays. */ _NL_TIME_ERA_ENTRIES, /* Structure with era entries in usable form.*/ _NL_WABDAY_1, /* Sun */ _NL_WABDAY_2, _NL_WABDAY_3, _NL_WABDAY_4, _NL_WABDAY_5, _NL_WABDAY_6, _NL_WABDAY_7, /* Long-named days of the week. */ _NL_WDAY_1, /* Sunday */ _NL_WDAY_2, /* Monday */ _NL_WDAY_3, /* Tuesday */ _NL_WDAY_4, /* Wednesday */ _NL_WDAY_5, /* Thursday */ _NL_WDAY_6, /* Friday */ _NL_WDAY_7, /* Saturday */ /* Abbreviated month names. */ _NL_WABMON_1, /* Jan */ _NL_WABMON_2, _NL_WABMON_3, _NL_WABMON_4, _NL_WABMON_5, _NL_WABMON_6, _NL_WABMON_7, _NL_WABMON_8, _NL_WABMON_9, _NL_WABMON_10, _NL_WABMON_11, _NL_WABMON_12, /* Long month names. */ _NL_WMON_1, /* January */ _NL_WMON_2, _NL_WMON_3, _NL_WMON_4, _NL_WMON_5, _NL_WMON_6, _NL_WMON_7, _NL_WMON_8, _NL_WMON_9, _NL_WMON_10, _NL_WMON_11, _NL_WMON_12, _NL_WAM_STR, /* Ante meridian string. */ _NL_WPM_STR, /* Post meridian string. */ _NL_WD_T_FMT, /* Date and time format for strftime. */ _NL_WD_FMT, /* Date format for strftime. */ _NL_WT_FMT, /* Time format for strftime. */ _NL_WT_FMT_AMPM, /* 12-hour time format for strftime. */ _NL_WERA_YEAR, /* Year in alternate era format. */ _NL_WERA_D_FMT, /* Date in alternate era format. */ _NL_WALT_DIGITS, /* Alternate symbols for digits. */ _NL_WERA_D_T_FMT, /* Date and time in alternate era format. */ _NL_WERA_T_FMT, /*