Commit Graph

74 Commits

Author SHA1 Message Date
Stephen Heumann
28888cf824 Exclude non-standard functions in <string.h> if __KeepNamespacePure__ is defined. 2021-02-17 15:36:38 -06:00
Stephen Heumann
31adb5f5d6 Update headers to support long long (and intmax_t typedef'd as long long).
This includes:
*Functions operating on long long in <stdlib.h>
*Limits of long long types in <limits.h>
*64-bit types and limits (plus intmax_t and its limits) in <stdint.h>
*New format codes, plus functions operating on intmax_t, in <inttypes.h>

The new stuff is generally conditionalized to only be included if __ORCAC_HAS_LONG_LONG__ is defined, or if the implementation claims to be C99 or later. This allows the headers to remain usable with older versions of ORCA/C, or with any hypothetical "strict C89" mode that might be implemented in the future.
2021-02-17 14:57:18 -06:00
Stephen Heumann
25697b1fba Add prototypes for vscanf, vfscanf, and vsscanf. 2021-02-09 23:24:20 -06:00
Stephen Heumann
acab97ae08 Add <stdbool.h> header.
Also, revise handling of boolean constants in <types.h> so that they do not conflict with the definitions in <stdbool.h>.
2021-01-25 22:04:26 -06:00
Stephen Heumann
8a69b3c905 Update headers and notes to include quick_exit and at_quick_exit. 2020-01-23 18:46:22 -06:00
Stephen Heumann
9be97ebf02 Add fscanf format specifiers for 8-bit types in <inttypes.h>.
These are now supported in ORCALib.
2020-01-22 12:14:39 -06:00
Stephen Heumann
bc1f6eb457 Add <stdnoreturn.h> header. 2020-01-19 12:44:20 -06:00
Stephen Heumann
d9ebdd10df Header updates for C11 alignment functionality.
This includes the new header <stdalign.h>, the new function aligned_alloc(), and the new typedef max_align_t.
2020-01-12 18:39:07 -06:00
Stephen Heumann
6f2eb301e5 Implement C11 _Static_assert mechanism.
This allows code to contain static assertions (checked at compile time).
2020-01-04 18:16:29 -06:00
Stephen Heumann
1af7505a00 Add prototypes for SANE housekeeping calls in <sane.h>.
There still aren't prototypes for the main SANE calls, since they aren't really designed to be called directly from C, and may take variable numbers of parameters depending on the operation.
2018-11-19 21:56:24 -06:00
Stephen Heumann
a359543769 Add EACCES as another name for EACCESS in <errno.h>.
The EACCES name is used in the ORCA/C manual, and also matches the name in POSIX and GNO. EACCESS is retained as an alias for compatibility.
2018-09-10 18:26:24 -05:00
Stephen Heumann
e8d89c9b39 Add prototype for _Exit() function from C99. 2018-09-10 17:41:53 -05:00
Stephen Heumann
dc0f7dc4e4 Correct most of the LDBL_* values in <float.h>.
These had been the values appropriate for double, not accounting for the fact that long double is now the 80-bit extended type.

The integer LDBL_* values have now all been updated to be correct, as has LDBL_EPSILON. LDBL_MAX and LDBL_MIN are still not correct, because ORCA/C internally processes floating-point constants in the double format, and so the correct values would get rounded to INF and 0, respectively.

Note that the SANE 80-bit extended format is almost like the x87 80-bit extended format used for long double on many modern systems, but not entirely. The difference is that SANE allows the biased exponent field of an extended value (either normalized or denormalized) to be 0, yielding an effective exponent of 0-16383 = -16383. x87 uses an effective exponent of -16382 in these cases (which it considers to be pseudo-denormalized or denormalized), yielding values that are twice as large as the SANE values. This difference causes LDBL_MIN_EXP to be different, and would also cause LDBL_MIN to be different if it could be represented correctly.
2018-09-08 22:39:30 -05:00
Stephen Heumann
463da80902 Small tweaks to <stdarg.h>.
*Use a typedef rather than a macro definition for va_list. (The C standards specify that va_list is a type, although this would make a practical difference only if someone #undef'd it.)

*Don't include a semicolon in va_start(), so it expands to an expression rather than a statement. This could make a difference in a construct like "if (...) va_start(...); else ...".
2018-08-28 18:58:27 -05:00
Stephen Heumann
cbdb773101 Add snprintf() and vsnprintf() prototypes in <stdio.h>. 2018-03-05 19:01:42 -06:00
Stephen Heumann
ef30698ac8 Update <ctype.h> header to include isblank(), as both a macro and function.
In order to work right, this needs either GNO's ORCALib (which already included isblank()) or a copy of ORCA's ORCALib with the corresponding patch applied.
2018-03-05 18:59:25 -06:00
Stephen Heumann
83df2fd9e1 Revert definition of FILE structure in <stdio.h> to match the implementation in ORCALib.
It had been changed to reflect changes in the ORCALib code that added a second putback buffer element, but those changes were problematic and have been reverted for now. (It's also not clear if ORCALib binaries with the larger putback buffer were ever distributed--at the least, they aren't on Opus ][ or in any of the ORCA/C 2.2.0 beta releases.)
2018-02-28 22:57:41 -06:00
Stephen Heumann
bfb929f4a7 Remove the setbuf macro in favor of just calling the library function.
The macro was slightly broken in that its 'buf' argument might be evaluated twice. This could be a problem if it was, e.g., a call to an allocation function.
2017-11-12 23:57:28 -06:00
Stephen Heumann
dedd50c81e Include prototypes for standard library functions that are also defined as macros.
This is needed to ensure correct behavior in cases where the macro is bypassed to access the library function, e.g. by enclosing the function name in parentheses or by taking its address.
2017-11-12 23:27:15 -06:00
Stephen Heumann
dddae89af0 Add prototypes for functions called by macros in <stdio.h>.
This avoids lint errors when using the setbuf() and rewind() macros.

This fixes #42 (libco01.c).
2017-10-28 22:58:26 -05:00
Stephen Heumann
f3431f8771 Fix types of CHAR_MAX and UCHAR_MAX in <limits.h>.
These should be of type int (not unsigned int), since that is what char and unsigned char now promote to.
2017-10-21 20:47:34 -05:00
Stephen Heumann
8be021eab1 Fix some tool call prototypes in tool headers.
Contrary to the previous comment in window.h, SetContentOrigin2 is in fact documented in TBR2, so a prototype for it was added.
2017-10-21 20:46:21 -05:00
Stephen Heumann
9d018cafe7 Add iso646.h, stdint.h, and inttypes.h headers.
These mostly comply with C99 and C11, with some exceptions noted in comments.
2017-10-21 20:40:41 -05:00
Stephen Heumann
3225a54d76 Move ORCACDefs directory to root level. 2017-10-21 20:21:37 -05:00