Commit Graph

43 Commits

Author SHA1 Message Date
Stephen Heumann
cc8e003860 Add <uchar.h> header. 2021-10-02 22:39:52 -05:00
Stephen Heumann
bf2c1f2266 Add EILSEQ errno value.
This is required by C95 and later; it may be set by character/string conversion functions. Note that the value of 12 conflicts with GNO's existing definition of EPERM. This should not cause much trouble, but GNO could potentially define its own different value for EILSEQ, with the GNO version of ORCALib adjusted accordingly.
2021-10-02 14:38:15 -05:00
Stephen Heumann
8ab065411f Add header declarations for strcoll, strxfrm, and mblen. 2021-09-30 18:41:17 -05:00
Stephen Heumann
02790c11e3 Add <locale.h> header.
The definitions here are aligned with the new implementation of the <locale.h> functions in ORCALib.
2021-09-30 18:40:39 -05:00
Stephen Heumann
38dc91892b Add header declaration and documentation for strftime. 2021-09-26 21:29:47 -05:00
Stephen Heumann
438942692a Make va_arg(ap,double) work correctly.
This was not working because floating-point arguments are really passed in the extended format, but based on the wording in the C standard a type of "double" should still work for arguments passed with that type.

This fixes #29. (The bug report was valid only with respect to double, not float or long double.)
2021-09-03 21:25:20 -05:00
Stephen Heumann
08dbe1eea3 Include the function name in assertion failure messages.
This is required by C99 and later, enabled by the availability of __func__.

This requires an updated assertion-printing function in ORCALib. Unfortunately, GNO has the assertion-printing function in its libc rather than in ORCALib, because it calls the GNO implementation of stdio. Therefore, we continue to use the old form under GNO for now, to maintain compatibility with its existing libc.
2021-08-24 18:35:01 -05:00
Stephen Heumann
aa5b239824 Make CLOCKS_PER_SEC and CLK_TCK work in 50Hz video mode.
Previously, they were hard-coded as 60, but the clock tick frequency actually depends on the video mode. They now call a new library function that can detect the video mode and return the proper value.

This also makes CLOCKS_PER_SEC have the type clock_t, as C99 and later require.
2021-08-23 21:58:19 -05:00
Stephen Heumann
e4515e580a Omit all non-standard stuff from <ctype.h> if __KeepNamespacePure__ is defined.
This affects the toint function and the _tolower and _toupper macros. Several other non-standard functions and macros were already being omitted.
2021-08-22 17:35:16 -05:00
Stephen Heumann
bb51e77193 Make MB_CUR_MAX have type size_t, as C99 and later require. 2021-08-22 17:35:16 -05:00
Stephen Heumann
dae27757d3 As of C11, errno must be a macro, so make it one. 2021-03-11 21:16:41 -06:00
Stephen Heumann
8fd091e119 Implement the signbit() macro.
This uses a new helper function.
2021-03-09 00:24:08 -06:00
Stephen Heumann
a3006e46b1 Add more floating-point classification macros. 2021-03-09 00:08:04 -06:00
Stephen Heumann
17a7fc5487 Add fpclassify() macro and some other stuff from C99 to <math.h>.
fpclassify() is a type-generic macro that is implemented via new internal library routines.
2021-03-08 23:42:44 -06:00
Stephen Heumann
cad042b95b Add new <float.h> macros from C99 and C11. 2021-03-08 19:16:28 -06:00
Stephen Heumann
0ba8e4adb0 Update the limit values in <float.h>.
The correct values for LDBL_MAX and LDBL_MIN can now be provided, because we support long double constants. The other values are also updated to have more precision, so that they evaluate to bit-correct values in the long double format.
2021-03-08 18:32:33 -06:00
Stephen Heumann
92048171ef Update definition of FLT_ROUNDS to reflect the dynamic rounding mode. 2021-03-06 16:40:35 -06:00
Stephen Heumann
2630b51b74 Add the <fenv.h> header. 2021-03-06 16:31:52 -06:00
Stephen Heumann
5268f37261 Merge branch 'master' into longlong 2021-02-17 15:38:06 -06:00
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