From 33613a85afc4b1481367fbe92a17ee59c240250b Mon Sep 17 00:00:00 2001 From: Sven Eisenhauer Date: Fri, 10 Nov 2023 15:11:48 +0100 Subject: add new repo --- .../ARM202U/INCLUDE/ASSERT.H | 46 ++ .../Mikroprozessorsysteme2/ARM202U/INCLUDE/CTYPE.H | 95 ++++ .../Mikroprozessorsysteme2/ARM202U/INCLUDE/ERRNO.H | 49 ++ .../Mikroprozessorsysteme2/ARM202U/INCLUDE/FLOAT.H | 81 +++ .../ARM202U/INCLUDE/LIMITS.H | 49 ++ .../ARM202U/INCLUDE/LOCALE.H | 172 ++++++ .../Mikroprozessorsysteme2/ARM202U/INCLUDE/MATH.H | 182 ++++++ .../ARM202U/INCLUDE/SETJMP.H | 75 +++ .../ARM202U/INCLUDE/SIGNAL.H | 102 ++++ .../ARM202U/INCLUDE/STDARG.H | 100 ++++ .../ARM202U/INCLUDE/STDDEF.H | 57 ++ .../Mikroprozessorsysteme2/ARM202U/INCLUDE/STDIO.H | 623 +++++++++++++++++++++ .../ARM202U/INCLUDE/STDLIB.H | 539 ++++++++++++++++++ .../ARM202U/INCLUDE/STRING.H | 256 +++++++++ .../Mikroprozessorsysteme2/ARM202U/INCLUDE/TIME.H | 182 ++++++ .../ARM202U/INCLUDE/VARARGS.H | 26 + 16 files changed, 2634 insertions(+) create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/ASSERT.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/CTYPE.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/ERRNO.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/FLOAT.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/LIMITS.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/LOCALE.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/MATH.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/SETJMP.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/SIGNAL.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDARG.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDDEF.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDIO.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDLIB.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STRING.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/TIME.H create mode 100644 Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/VARARGS.H (limited to 'Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE') diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/ASSERT.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/ASSERT.H new file mode 100644 index 0000000..5a52ca3 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/ASSERT.H @@ -0,0 +1,46 @@ +#pragma force_top_level + +/* assert.h: ANSI 'C' (X3J11 Oct 88) library header section 4.2 */ +/* Copyright (C) Codemist Ltd., 1988-1993 */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991-1993 */ +/* version 0.04 */ + + +/* + * The assert macro puts diagnostics into programs. When it is executed, + * if its argument expression is false, it writes information about the + * call that failed (including the text of the argument, the name of the + * source file, and the source line number - the latter are respectively + * the values of the preprocessing macros __FILE__ and __LINE__) on the + * standard error stream. It then calls the abort function. + * If its argument expression is true, the assert macro returns no value. + */ + +/* + * Note that may be included more that once in a program with + * different setting of NDEBUG. Hence the slightly unusual first-time + * only flag. + */ + +#ifndef __assert_h +# define __assert_h +# ifdef __cplusplus + extern "C" void __assert(char *, char *, int); +# else + extern void __assert(char *, char *, int); +# endif +#else +# undef assert +#endif + +#ifdef NDEBUG +# define assert(ignore) ((void)0) +#else +# ifdef __STDC__ +# define assert(e) ((e) ? (void)0 : __assert(#e, __FILE__, __LINE__)) +# else +# define assert(e) ((e) ? (void)0 : __assert("e", __FILE__, __LINE__)) +# endif +#endif + +/* end of assert.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/CTYPE.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/CTYPE.H new file mode 100644 index 0000000..aa7ef55 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/CTYPE.H @@ -0,0 +1,95 @@ +#pragma force_top_level +#pragma include_only_once + +/* ctype.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.3 */ +/* Copyright (C) Codemist Ltd. 1988-1993. */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991-1993. */ +/* version 0.03 */ + +/* + * ctype.h declares several functions useful for testing and mapping + * characters. In all cases the argument is an int, the value of which shall + * be representable as an unsigned char or shall equal the value of the + * macro EOF. If the argument has any other value, the behaviour is undefined. + */ + +#ifndef __ctype_h +#define __ctype_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* N.B. - keep in step with */ + +#define __S 1 /* whitespace */ +#define __P 2 /* punctuation */ +#define __B 4 /* blank */ +#define __L 8 /* lower case letter */ +#define __U 16 /* upper case letter */ +#define __N 32 /* (decimal) digit */ +#define __C 64 /* control chars */ +#define __X 128 /* A-F and a-f */ +extern unsigned char __ctype[]; + +#define isalnum(c) (__ctype[c] & (__U+__L+__N)) +extern int (isalnum)(int c); + /* non-0 iff c is alphabetic or numeric */ + +#define isalpha(c) (__ctype[c] & (__U+__L)) +extern int (isalpha)(int c); + /* non-0 iff c is alphabetic */ + +#define iscntrl(c) (__ctype[c] & __C) +extern int (iscntrl)(int c); + /* non-0 iff c is a control character - in the ASCII locale */ + /* this means (c < ' ') || (c > '~') */ + +#define isdigit(c) (__ctype[c] & __N) +extern int (isdigit)(int c); + /* non-0 iff c is a decimal digit */ + +#define isgraph(c) (__ctype[c] & (__L+__U+__N+__P)) +extern int (isgraph)(int c); + /* non-0 iff c is any printing character other than ' ' */ + +#define islower(c) (__ctype[c] & __L) +extern int (islower)(int c); + /* non-0 iff c is a lower-case letter */ + +#define isprint(c) (__ctype[c] & (__L+__U+__N+__P+__B)) +extern int (isprint)(int c); + /* non-0 iff c is a printing character - in the ASCII locale */ + /* this means 0x20 (space) -> 0x7E (tilde) */ + +#define ispunct(c) (__ctype[c] & __P) +extern int (ispunct)(int c); + /* non-0 iff c is a non-space, non-alpha-numeric, printing character */ + +#define isspace(c) (__ctype[c] & __S) +extern int (isspace)(int c); + /* non-0 iff c is a white-space char: ' ', '\f', '\n', '\r', '\t', '\v'. */ + +#define isupper(c) (__ctype[c] & __U) +extern int (isupper)(int c); + /* non-0 iff c is an upper-case letter */ + +#define isxdigit(c) (__ctype[c] & (__N+__X)) +extern int (isxdigit)(int c); + /* non-0 iff c is a digit, in 'a'..'f', or in 'A'..'F' */ + +extern int tolower(int c); + /* if c is an upper-case letter then return the corresponding */ + /* lower-case letter, otherwise return c. */ + +extern int toupper(int c); + /* if c is an lower-case letter then return the corresponding */ + /* upper-case letter, otherwise return c. */ + +#ifdef __cplusplus +} +#endif + +#endif + +/* end of ctype.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/ERRNO.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/ERRNO.H new file mode 100644 index 0000000..1fdfbec --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/ERRNO.H @@ -0,0 +1,49 @@ +#pragma force_top_level +#pragma include_only_once + +/* errno.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.1.3 */ +/* Copyright (C) Codemist Ltd., 1988 */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991 */ +/* version 1 */ + +#ifndef __errno_h +#define __errno_h + +#ifndef errno +# define errno __errno +extern volatile int errno; + /* + * expands to a modifiable lvalue that has type volatile int, the value of + * which is set to a positive error code by several library functions. It is + * initialised to zero at program startup, but is never set to zero by any + * library function. The value of errno may be set to nonzero by a library + * function call whether or not there is an error, provided the use of errno + * is not documented in the description of the function in the Standard. + */ +#endif + +#define EDOM 1 + /* + * if a domain error occurs (an input argument is outside the domain over + * which the mathematical function is defined) the integer expression errno + * acquires the value of the macro EDOM and HUGE_VAL is returned. EDOM may + * be used by non-mathematical functions. + */ +#define ERANGE 2 + /* + * a range error occurs if the result of a function can not be represented + * as a double value. If the result overflows (the magnitude of the result + * is so large that it cannot be represented in an object of the specified + * type), the function returns the value of the macro HUGE_VAL, with the + * same sign as the correct value of the function; the integer expression + * errno acquires the value of the macro ERANGE. If the result underflows + * (the magnitude of the result is so small that it cannot be represented + * in an object of the specified type), the function returns zero; the + * integer expression errno acquires the value of the macro ERANGE. ERANGE + * may be used by non-mathematical functions. + */ +#define ESIGNUM 3 + +#endif + +/* end of errno.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/FLOAT.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/FLOAT.H new file mode 100644 index 0000000..b0168ab --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/FLOAT.H @@ -0,0 +1,81 @@ +#pragma force_top_level +#pragma include_only_once + +/* float.h: ANSI 'C' (X3J11 Oct 88) library header, section 2.2.4.2 */ +/* Copyright (C) Codemist Ltd, 1988 */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991 */ +/* version 0.01 */ + +#ifndef __float_h +#define __float_h + +/* IEEE version: the following values are taken from the above ANSI draft. */ +/* The ACORN FPE (v17) is known not to precisely implement IEEE arithmetic. */ + +#define FLT_RADIX 2 + /* radix of exponent representation */ +#define FLT_ROUNDS 1 + /* + * The rounding mode for floating-point addition is characterised by the + * value of FLT_ROUNDS: + * -1 : indeterminable. + * 0 : towards zero. + * 1 : to nearest. + * 2 : towards positive infinity. + * 3 : towards negative infinity. + * ? : any other is implementation-defined. + */ + +#define FLT_MANT_DIG 24 +#define DBL_MANT_DIG 53 +#define LDBL_MANT_DIG 53 + /* number of base-FLT_RADIX digits in the floating point mantissa */ + +/* The values that follow are not achieved under Acorn's FPE version 17 */ +/* but they should be correct in due course! */ + +#define FLT_DIG 6 +#define DBL_DIG 15 +#define LDBL_DIG 15 + /* number of decimal digits of precision */ + +#define FLT_MIN_EXP (-125) +#define DBL_MIN_EXP (-1021) +#define LDBL_MIN_EXP (-1021) + /* minimum negative integer such that FLT_RADIX raised to that power */ + /* minus 1 is a normalised floating-point number. */ + +#define FLT_MIN_10_EXP (-37) +#define DBL_MIN_10_EXP (-307) +#define LDBL_MIN_10_EXP (-307) + /* minimum negative integer such that 10 raised to that power is in the */ + /* range of normalised floating-point numbers. */ + +#define FLT_MAX_EXP 128 +#define DBL_MAX_EXP 1024 +#define LDBL_MAX_EXP 1024 + /* maximum integer such that FLT_RADIX raised to that power minus 1 is a */ +#define FLT_MAX_10_EXP 38 +#define DBL_MAX_10_EXP 308 +#define LDBL_MAX_10_EXP 308 + /* maximum integer such that 10 raised to that power is in the range of */ + /* representable finite floating-point numbers. */ + +#define FLT_MAX 3.40282347e+38F +#define DBL_MAX 1.79769313486231571e+308 +#define LDBL_MAX 1.79769313486231571e+308L + /* maximum representable finite floating-point number. */ + +#define FLT_EPSILON 1.19209290e-7F +#define DBL_EPSILON 2.2204460492503131e-16 +#define LDBL_EPSILON 2.2204460492503131e-16L + /* minimum positive floating point number x such that 1.0 + x != 1.0 */ + +#define FLT_MIN 1.17549435e-38F +#define DBL_MIN 2.22507385850720138e-308 +#define LDBL_MIN 2.22507385850720138e-308L + /* minimum normalised positive floating-point number. */ + +#endif + +/* end of float.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/LIMITS.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/LIMITS.H new file mode 100644 index 0000000..42853f0 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/LIMITS.H @@ -0,0 +1,49 @@ +#pragma force_top_level +#pragma include_only_once + +/* limits.h: ANSI 'C' (X3J11 Oct 88) library header, section 2.2.4.2 */ +/* Copyright (C) Codemist Ltd., 1988 */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991 */ +/* version 0.01 */ + +#ifndef __limits_h +#define __limits_h + +#define CHAR_BIT 8 + /* max number of bits for smallest object that is not a bit-field (byte) */ +#define SCHAR_MIN (-128) + /* mimimum value for an object of type signed char */ +#define SCHAR_MAX 127 + /* maximum value for an object of type signed char */ +#define UCHAR_MAX 255 + /* maximum value for an object of type unsigned char */ +#define CHAR_MIN 0 + /* minimum value for an object of type char */ +#define CHAR_MAX 255 + /* maximum value for an object of type char */ +#define MB_LEN_MAX 1 + /* maximum number of bytes in a multibyte character, */ + /* for any supported locale */ + +#define SHRT_MIN (-0x8000) + /* minimum value for an object of type short int */ +#define SHRT_MAX 0x7fff + /* maximum value for an object of type short int */ +#define USHRT_MAX 65535U + /* maximum value for an object of type unsigned short int */ +#define INT_MIN (~0x7fffffff) /* -2147483648 and 0x80000000 are unsigned */ + /* minimum value for an object of type int */ +#define INT_MAX 0x7fffffff + /* maximum value for an object of type int */ +#define UINT_MAX 0xffffffff + /* maximum value for an object of type unsigned int */ +#define LONG_MIN (~0x7fffffff) + /* minimum value for an object of type long int */ +#define LONG_MAX 0x7fffffff + /* maximum value for an object of type long int */ +#define ULONG_MAX 0xffffffffU + /* maximum value for an object of type unsigned long int */ + +#endif + +/* end of limits.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/LOCALE.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/LOCALE.H new file mode 100644 index 0000000..194187d --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/LOCALE.H @@ -0,0 +1,172 @@ +#pragma force_top_level +#pragma include_only_once + +/* locale.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.3 */ +/* Copyright (C) Codemist Ltd., 1988 */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991 */ +/* version 0.03 */ + +#ifndef __locale_h +#define __locale_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* Handles national characteristics eg. USA month day year UK day month year */ + +#define LC_COLLATE 1 + /* affects the behaviour of the strcoll function */ +#define LC_CTYPE 2 + /* affects the behaviour of the character handling functions */ + /* (isdigit, isspace and isxdigit are not affected) */ +#define LC_MONETARY 4 + /* affects the monetary formatting information returned by the */ + /* localeconv function. */ +#define LC_NUMERIC 8 + /* affects the decimal-point character for the formatted input/output */ + /* functions and the string conversion functions */ +#define LC_TIME 16 + /* affects the behaviour of the strftime function */ +#define LC_ALL 31 + /* program's entire locale */ + +extern char *setlocale(int /*category*/, const char * /*locale*/); + /* + * Selects the appropriate piece of the program's locale as specified by the + * category and locale arguments. The setlocale function may be used to + * change or query the program's entire current locale or portions thereof. + * The effect of the category argument for each value is described above. + * A value of "C" for locale specifies the minimal environment for C + * translation; a value of "" for locale specifies the implementation-defined + * native environment. At program startup the equivalent of + * setlocale(LC_ALL, "C") is executed. + * + * Return value: + * If a pointer to string is given for locale and the selection can be + * honoured, the string associated with the specified category for the new + * locale is returned. If the selction can not be honoured, a null pointer + * is returned and the program's locale is not changed. + * A null pointer for locale causes the string associated with the category + * for the program's current locale to be returned and the program's locale + * is not changed. This enquiry can fail by returning a null pointer only if + * the category is LC_ALL and the most recent successful locale-setting call + * used a category other than LC_ALL. + * The string returned is such that a subsequent call with that string and + * its associated category will restore that part of the program's locale. + * The string returned shall not be modified by the program, but may be + * overwritten by a subsequent call to setlocale. + */ + +struct lconv { + char *decimal_point; + /* The decimal point character used to format non-monetary quantities */ + char *thousands_sep; + /* The character used to separate groups of digits to the left of the */ + /* decimal point character in formatted non-monetary quantities. */ + char *grouping; + /* A string whose elements indicate the size of each group of digits */ + /* in formatted non-monetary quantities. See below for more details. */ + char *int_curr_symbol; + /* The international currency symbol applicable to the current locale.*/ + /* The first three characters contain the alphabetic international */ + /* currency symbol in accordance with those specified in ISO 4217 */ + /* Codes for the representation of Currency and Funds. The fourth */ + /* character (immediately preceding the null character) is the */ + /* character used to separate the international currency symbol from */ + /* the monetary quantity. */ + char *currency_symbol; + /* The local currency symbol applicable to the current locale. */ + char *mon_decimal_point; + /* The decimal-point used to format monetary quantities. */ + char *mon_thousands_sep; + /* The separator for groups of digits to the left of the decimal-point*/ + /* in formatted monetary quantities. */ + char *mon_grouping; + /* A string whose elements indicate the size of each group of digits */ + /* in formatted monetary quantities. See below for more details. */ + char *positive_sign; + /* The string used to indicate a nonnegative-valued formatted */ + /* monetary quantity. */ + char *negative_sign; + /* The string used to indicate a negative-valued formatted monetary */ + /* quantity. */ + char int_frac_digits; + /* The number of fractional digits (those to the right of the */ + /* decimal-point) to be displayed in an internationally formatted */ + /* monetary quantities. */ + char frac_digits; + /* The number of fractional digits (those to the right of the */ + /* decimal-point) to be displayed in a formatted monetary quantity. */ + char p_cs_precedes; + /* Set to 1 or 0 if the currency_symbol respectively precedes or */ + /* succeeds the value for a nonnegative formatted monetary quantity. */ + char p_sep_by_space; + /* Set to 1 or 0 if the currency_symbol respectively is or is not */ + /* separated by a space from the value for a nonnegative formatted */ + /* monetary quantity. */ + char n_cs_precedes; + /* Set to 1 or 0 if the currency_symbol respectively precedes or */ + /* succeeds the value for a negative formatted monetary quantity. */ + char n_sep_by_space; + /* Set to 1 or 0 if the currency_symbol respectively is or is not */ + /* separated by a space from the value for a negative formatted */ + /* monetary quantity. */ + char p_sign_posn; + /* Set to a value indicating the position of the positive_sign for a */ + /* nonnegative formatted monetary quantity. See below for more details*/ + char n_sign_posn; + /* Set to a value indicating the position of the negative_sign for a */ + /* negative formatted monetary quantity. See below for more details. */ + + /* + * The elements of grouping amd mon_grouping are interpreted according to + * the following: + * CHAR_MAX No further grouping is to be performed. + * 0 The previous element is to be repeatedly used for the + * remainder of the digits. + * other The value is the number of digits that compromise the current + * group. The next element is examined to determine the size of + * the next group of digits to the left of the current group. + * + * The value of p_sign_posn and n_sign_posn is interpreted according to + * the following: + * 0 Parentheses surround the quantity and currency_symbol. + * 1 The sign string preceeds the quantity and currency_symbol. + * 2 The sign string succeeds the quantity and currency_symbol. + * 3 The sign string immediately preceeds the currency_symbol. + * 4 The sign string immediately succeeds the currency_symbol. + */ +}; + +extern struct lconv *localeconv(void); + /* + * Sets the components of an object with type struct lconv with values + * appropriate for the formatting of numeric quantities (monetary and + * otherwise) according to the rules of the current locale. + * The members of the structure with type char * are strings, any of which + * (except decimal_point) can point to "", to indicate that the value is not + * available in the current locale or is of zero length. The members with + * type char are nonnegative numbers, any of which can be CHAR_MAX to + * indicate that the value is not available in the current locale. + * The members included are described above. + * + * Return value: + * A pointer to the filled in object. The structure pointed to by the return + * value shall not be modified by the program, but may be overwritten by a + * subsequent call to the localeconv function. In addition, calls to the + * setlocale function with categories LC_ALL, LC_MONETARY, or LC_NUMERIC may + * overwrite the contents of the structure. + */ + +#ifndef NULL +# define NULL 0 +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/* end of locale.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/MATH.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/MATH.H new file mode 100644 index 0000000..39fdc33 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/MATH.H @@ -0,0 +1,182 @@ +#pragma force_top_level +#pragma include_only_once + +/* math.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.5 */ +/* Copyright (C) Codemist Ltd., 1988 */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991 */ +/* version 0.03 */ + +#ifndef __math_h +#define __math_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef HUGE_VAL +# define HUGE_VAL __huge_val +extern const double HUGE_VAL; +#endif + +/* Be careful with no_side_effects. + Nothing taking a pointer argument can safely be declared to be so + (how can CSE know whether the thing pointed to has been updated, or + whether indeed the argument is not an output). + Nor may things which set errno - a side effect -. + */ + +extern double acos(double /*x*/); + /* computes the principal value of the arc cosine of x */ + /* a domain error occurs for arguments not in the range -1 to 1 */ + /* Returns: the arc cosine in the range 0 to Pi. */ +extern double asin(double /*x*/); + /* computes the principal value of the arc sine of x */ + /* a domain error occurs for arguments not in the range -1 to 1 */ + /* and -HUGE_VAL is returned. */ + /* Returns: the arc sine in the range -Pi/2 to Pi/2. */ + +#pragma no_side_effects + +extern double atan(double /*x*/); + /* computes the principal value of the arc tangent of x */ + /* Returns: the arc tangent in the range -Pi/2 to Pi/2. */ + +extern double __d_atan(double); + +#pragma side_effects + +extern double atan2(double /*y*/, double /*x*/); + /* computes the principal value of the arc tangent of y/x, using the */ + /* signs of both arguments to determine the quadrant of the return value */ + /* a domain error occurs if both args are zero, and -HUGE_VAL returned. */ + /* Returns: the arc tangent of y/x, in the range -Pi to Pi. */ + + +#pragma no_side_effects + +extern double cos(double /*x*/); + /* computes the cosine of x (measured in radians). A large magnitude */ + /* argument may yield a result with little or no significance */ + /* Returns: the cosine value. */ +extern double sin(double /*x*/); + /* computes the sine of x (measured in radians). A large magnitude */ + /* argument may yield a result with little or no significance */ + /* Returns: the sine value. */ + +extern double __d_sin(double); +extern double __d_cos(double); + +#pragma side_effects + +extern double tan(double /*x*/); + /* computes the tangent of x (measured in radians). A large magnitude */ + /* argument may yield a result with little or no significance */ + /* Returns: the tangent value. */ + /* if range error; returns HUGE_VAL. */ + +extern double cosh(double /*x*/); + /* computes the hyperbolic cosine of x. A range error occurs if the */ + /* magnitude of x is too large. */ + /* Returns: the hyperbolic cosine value. */ + /* if range error; returns HUGE_VAL. */ +extern double sinh(double /*x*/); + /* computes the hyperbolic sine of x. A range error occurs if the */ + /* magnitude of x is too large. */ + /* Returns: the hyperbolic sine value. */ + /* if range error; returns -HUGE_VAL or HUGE_VAL depending */ + /* on the sign of the argument */ + +#pragma no_side_effects + +extern double tanh(double /*x*/); + /* computes the hyperbolic tangent of x. */ + /* Returns: the hyperbolic tangent value. */ + +#pragma side_effects + +extern double exp(double /*x*/); + /* computes the exponential function of x. A range error occurs if the */ + /* magnitude of x is too large. */ + /* Returns: the exponential value. */ + /* if underflow range error; 0 is returned. */ + /* if overflow range error; HUGE_VAL is returned. */ + +extern double frexp(double /*value*/, int * /*exp*/); + /* breaks a floating-point number into a normalised fraction and an */ + /* integral power of 2. It stores the integer in the int object pointed */ + /* to by exp. */ + /* Returns: the value x, such that x is a double with magnitude in the */ + /* interval 0.5 to 1.0 or zero, and value equals x times 2 raised to the */ + /* power *exp. If value is zero, both parts of the result are zero. */ + +extern double ldexp(double /*x*/, int /*exp*/); + /* multiplies a floating-point number by an integral power of 2. */ + /* A range error may occur. */ + /* Returns: the value of x times 2 raised to the power of exp. */ + /* if range error; HUGE_VAL is returned. */ +extern double log(double /*x*/); + /* computes the natural logarithm of x. A domain error occurs if the */ + /* argument is negative, and -HUGE_VAL is returned. A range error occurs */ + /* if the argument is zero. */ + /* Returns: the natural logarithm. */ + /* if range error; -HUGE_VAL is returned. */ +extern double log10(double /*x*/); + /* computes the base-ten logarithm of x. A domain error occurs if the */ + /* argument is negative. A range error occurs if the argument is zero. */ + /* Returns: the base-ten logarithm. */ +extern double modf(double /*value*/, double * /*iptr*/); + /* breaks the argument value into integral and fraction parts, each of */ + /* which has the same sign as the argument. It stores the integral part */ + /* as a double in the object pointed to by iptr. */ + /* Returns: the signed fractional part of value. */ + +extern double pow(double /*x*/, double /*y*/); + /* computes x raised to the power of y. A domain error occurs if x is */ + /* zero and y is less than or equal to zero, or if x is negative and y */ + /* is not an integer, and -HUGE_VAL returned. A range error may occur. */ + /* Returns: the value of x raised to the power of y. */ + /* if underflow range error; 0 is returned. */ + /* if overflow range error; HUGE_VAL is returned. */ +extern double sqrt(double /*x*/); + /* computes the non-negative square root of x. A domain error occurs */ + /* if the argument is negative, and -HUGE_VAL returned. */ + /* Returns: the value of the square root. */ + +#pragma no_side_effects + +extern double ceil(double /*x*/); + /* computes the smallest integer not less than x. */ + /* Returns: the smallest integer not less than x, expressed as a double. */ +extern double fabs(double /*x*/); + /* computes the absolute value of the floating-point number x. */ + /* Returns: the absolute value of x. */ + +extern double __d_abs(double); /* inline expansion of fabs() */ + +extern double floor(double /*d*/); + /* computes the largest integer not greater than x. */ + /* Returns: the largest integer not greater than x, expressed as a double */ + +#pragma side_effects + +extern double fmod(double /*x*/, double /*y*/); + /* computes the floating-point remainder of x/y. */ + /* Returns: the value x - i * y, for some integer i such that, if y is */ + /* nonzero, the result has the same sign as x and magnitude */ + /* less than the magnitude of y. If y is zero, a domain error */ + /* occurs and -HUGE_VAL is returned. */ + +#ifndef __SOFTFP__ +# define atan(x) __d_atan(x) +# define sin(x) __d_sin(x) +# define cos(x) __d_cos(x) +# define fabs(x) __d_abs(x) +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +/* end of math.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/SETJMP.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/SETJMP.H new file mode 100644 index 0000000..9550ef3 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/SETJMP.H @@ -0,0 +1,75 @@ +#pragma force_top_level +#pragma include_only_once + +/* setjmp.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.6 */ +/* Copyright (C) Codemist Ltd., 1988 */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991 */ +/* version 0.04 */ + +/* + * setjmp.h declares two functions and one type, for bypassing the normal + * function call and return discipline (useful for dealing with unusual + * conditions encountered in a low-level function of a program). + */ + +#ifndef __setjmp_h +#define __setjmp_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __JMP_BUF_SIZE +typedef int jmp_buf[__JMP_BUF_SIZE]; +#else +typedef int jmp_buf[22]; /* size suitable for the ARM */ +#endif /* an array type suitable for holding the data */ + /* needed to restore a calling environment. */ + +/* setjmp is a macro so that it cannot be used other than directly called. */ +/* NB that ANSI declare that anyone who undefined the setjmp macro or uses */ +/* (or defines) the name setjmp without including this header will get */ +/* what they deserve. */ + +#ifdef __STDC__ +/* -pcc mode doesn't allow circular definitions... */ +#define setjmp(jmp_buf) (setjmp(jmp_buf)) +#endif + +extern int setjmp(jmp_buf /*env*/); + /* Saves its calling environment in its jmp_buf argument, for later use + * by the longjmp function. + * Returns: If the return is from a direct invocation, the setjmp function + * returns the value zero. If the return from a call to the longjmp + * function, the setjmp function returns a non zero value. + */ + +extern void longjmp(jmp_buf /*env*/, int /*val*/); + /* Restores the environment saved by the most recent call to setjmp in the + * same invocation of the program, with the corresponding jmp_buf argument. + * If there has been no such call, or if the function containing the call + * to setjmp has terminated execution (eg. with a return statement) in the + * interim, the behaviour is undefined. + * All accessible objects have values as of the time longjmp was called, + * except that the values of objects of automatic storage duration that do + * not have volatile type and have been changed between the setjmp and + * longjmp calls are indeterminate. + * As it bypasses the usual function call and return mechanism, the longjmp + * function shall execute correctly in contexts of interrupts, signals and + * any of their associated functions. However, if the longjmp function is + * invoked from a nested signal handler (that is, from a function invoked as + * a result of a signal raised during the handling of another signal), the + * behaviour is undefined. + * Returns: After longjmp is completed, program execution continues as if + * the corresponding call to setjmp had just returned the value + * specified by val. The longjmp function cannot cause setjmp to + * return the value 0; if val is 0, setjmp returns the value 1. + */ + +#ifdef __cplusplus +} +#endif + +#endif + +/* end of setjmp.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/SIGNAL.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/SIGNAL.H new file mode 100644 index 0000000..ca40aea --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/SIGNAL.H @@ -0,0 +1,102 @@ +#pragma force_top_level +#pragma include_only_once + +/* signal.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.7 */ +/* Copyright (C) Codemist Ltd., 1988-1993. */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991-1993. */ +/* version 0.03 */ + +/* + * signal.h declares a type and two functions and defines several macros, for + * handling various signals (conditions that may be reported during program + * execution). + */ + +#ifndef __signal_h +#define __signal_h + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int sig_atomic_t; + /* type which is the integral type of an object that can be modified as */ + /* an atomic entity, even in the presence of asynchronous interrupts. */ + +extern void __SIG_DFL(int); +extern void __SIG_ERR(int); +extern void __SIG_IGN(int); + /* + * Each of the following macros expand to a constant expression with a + * distinct value and has the same type as the second argument to, and the + * return value of the signal function, and whose value compares unequal to + * the address of any declarable function. + */ +#define SIG_DFL &__SIG_DFL +#define SIG_ERR &__SIG_ERR +#define SIG_IGN &__SIG_IGN + + /* + * Each of the following macros expand to a positive integral constant + * expression that is the signal number corresponding the the specified + * condition. + */ +#define SIGABRT 1 /* abort */ +#define SIGFPE 2 /* arithmetic exception */ +#define SIGILL 3 /* illegal instruction */ +#define SIGINT 4 /* attention request from user */ +#define SIGSEGV 5 /* bad memory access */ +#define SIGTERM 6 /* termination request */ +#define SIGSTAK 7 /* stack overflow */ + /* (these following macros are not part of the ANSI standard, + * but private to this implementation + */ +/* Signal numbers 8 and 9 are available for the user */ +#define SIGUSR1 8 +#define SIGUSR2 9 +#define SIGOSERROR 10 + +extern void (*signal (int /*sig*/, void (* /*func*/ )(int)))(int); + /* + * Chooses one of three ways in which receipt of the signal number sig is to + * be subsequently handled. If the value of func is SIG_DFL, default + * handling for that signal will occur. If the value of func is SIG_IGN, the + * signal will be ignored. Otherwise func shall point to a function to be + * called when that signal occurs. + * When a signal occurs, if func points to a function, first the equivalent + * of signal(sig, SIG_DFL); is executed. (If the value of sig is SIGILL, + * whether the reset to SIG_DFL occurs is implementation-defined (under + * RISCOS/Arthur/Brazil the reset does occur)). Next the equivalent of + * (*func)(sig); is executed. The function may terminate by calling the + * abort, exit or longjmp function. If func executes a return statement and + * the value of sig was SIGFPE or any other implementation-defined value + * corresponding to a computational exception, the behaviour is undefined. + * Otherwise, the program will resume execution at the point it was + * interrupted. + * If the signal occurs other than as a result of calling the abort or raise + * function, the behaviour is undefined if the signal handler calls any + * function in the standard library other than the signal function itself + * or refers to any object with static storage duration other than by + * assigning a value to a volatile static variable of type sig_atomic_t. + * At program startup, the equivalent of signal(sig, SIG_IGN); may be + * executed for some signals selected in an implementation-defined manner + * (under RISCOS/Arthur/Brazil this does not occur); the equivalent of + * signal(sig, SIG_DFL); is executed for all other signals defined by the + * implementation. + * Returns: If the request can be honoured, the signal function returns the + * value of func for most recent call to signal for the specified + * signal sig. Otherwise, a value of SIG_ERR is returned and the + * integer expression errno is set to indicate the error. + */ + +extern int raise(int /*sig*/); + /* sends the signal sig to the executing program. */ + /* Returns: zero if successful, non-zero if unsuccessful. */ + +#ifdef __cplusplus +} +#endif + +#endif + +/* end of signal.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDARG.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDARG.H new file mode 100644 index 0000000..ff486a3 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDARG.H @@ -0,0 +1,100 @@ +#pragma force_top_level +#pragma include_only_once + +/* stdarg.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.8 */ +/* Copyright (C) Codemist Ltd., 1988 */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991 */ +/* version 3 */ + +#ifndef __stdarg_h +#define __stdarg_h + +/* + * stdarg.h declares a type and defines three macros, for advancing through a + * list of arguments whose number and types are not known to the called + * function when it is translated. A function may be called with a variable + * number of arguments of differing types. Its parameter list contains one or + * more parameters. The rightmost parameter plays a special role in the access + * mechanism, and will be called parmN in this description. + */ + +/* N.B. is required to declare vfprintf() without defining */ +/* va_list. Clearly the type __va_list there must keep in step. */ +typedef char *va_list[1]; /* see */ + /* + * an array type suitable for holding information needed by the macro va_arg + * and the function va_end. The called function shall declare a variable + * (referred to as ap) having type va_list. The variable ap may be passed as + * an argument to another function. + * Note: va_list is an array type so that when an object of that type + * is passed as an argument it gets passed by reference. + */ + +/* Note that ___type is a syntactic item a bit like the type qualifiers */ +/* 'static', 'register', 'const' etc except that it has no effect! Its */ +/* purpose is to indicate when a type is being introduced and thus */ +/* help (a bit) when the user gets the args to va_arg the wrong way round */ +#define __alignof(type) \ + ((char *)&(((struct{char __member1; \ + ___type type __member2;}*) 0)->__member2) - \ + (char *)0) +#define __alignuptotype(ptr,type) \ + ((char *)((int)(ptr) + (__alignof(type)-1) & ~(__alignof(type)-1))) + + +#define va_start(ap,parmN) \ + (___assert((___typeof(parmN) & 0x481) == 0, \ + "Illegal type of 2nd argument to va_start"), \ + (void)(*(ap) = (char *)&(parmN) + sizeof(parmN))) + /* + * The va_start macro shall be executed before any access to the unnamed + * arguments. The parameter ap points to an object that has type va_list. + * The va_start macro initialises ap for subsequent use by va_arg and + * va_end. The parameter parmN is the identifier of the rightmost parameter + * in the variable parameter list in the function definition (the one just + * before the , ...). If the parameter parmN is declared with the register + * storage class the behaviour is undefined (Norcroft C gives diagnostic). + * parmN shall not be affected by default argument conversions (Norcroft + * C gives a diagnostic and would (July 1990) generate 'wrong' code). + * Returns: no value. + */ + +#define va_arg(ap,type) \ + (___assert((___typeof(___type type) & 0x481) == 0, \ + "Illegal type used with va_arg"), \ + *(___type type *)((*(ap)=__alignuptotype(*(ap),type)+sizeof(___type type))-\ + sizeof(___type type))) + /* + * The va_arg macro expands to an expression that has the type and value of + * the next argument in the call. The parameter ap shall be the same as the + * va_list ap initialised by va_start. Each invocation of va_arg modifies + * ap so that successive arguments are returned in turn. The parameter + * 'type' is a type name such that the type of a pointer to an object that + * has the specified type can be obtained simply by postfixing a * to + * 'type'. If 'type' disagrees with the type of the actual next argument + * (as promoted according to the default argument promotions), the behaviour + * is undefined. + * Returns: The first invocation of the va_arg macro after that of the + * va_start macro returns the value of the argument after that + * specified by parmN. Successive invocations return the values of + * the remaining arguments in succession. + * Note: care is taken in va_arg so that illegal things like va_arg(ap,char) + * which may seem natural but are illegal are caught. The special Norcroft + * C keywords ___assert and ___typeof are used to do this: these keywords + * are not intended for use by ordinary users. + */ + +#define va_end(ap) ((void)(*(ap) = (char *)-256)) + /* + * The va_end macro facilitates a normal return from the function whose + * variable argument list was referenced by the expansion of va_start that + * initialised the va_list ap. If the va_end macro is not invoked before + * the return, the behaviour is undefined. + * Returns: no value. + * Note: this macro is careful to avoid compiler warning messages and uses + * a -ve address to ensure address trap. + */ + +#endif + +/* end of stdarg.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDDEF.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDDEF.H new file mode 100644 index 0000000..3235cbb --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDDEF.H @@ -0,0 +1,57 @@ +#pragma force_top_level +#pragma include_only_once + +/* stddef.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.1.4 */ +/* Copyright (C) Codemist Ltd., 1988 */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991 */ +/* version 0.05 */ + +/* + * The following types and macros are defined in several headers referred to in + * the descriptions of the functions declared in that header. They are also + * defined in this header file. + */ + +#ifndef __stddef_h +#define __stddef_h + +typedef int ptrdiff_t; +#ifndef __STDC__ +# define ptrdiff_t int /* ANSI bans this -- delete unless pcc wants. */ + /* the signed integral type of the result of subtracting two pointers. */ +#endif + +#ifndef __size_t +# define __size_t 1 +typedef unsigned int size_t; /* others (e.g. ) define */ + /* the unsigned integral type of the result of the sizeof operator. */ +#endif + +#ifndef __wchar_t +# define __wchar_t 1 +typedef int wchar_t; /* also in */ + /* + * An integral type whose range of values can represent distinct codes for + * all members of the largest extended character set specified among the + * supported locales; the null character shall have the code value zero and + * each member of the basic character set shall have a code value when used + * as the lone character in an integer character constant. + */ +#endif + +#ifndef NULL /* this hack is so that can also define it */ +# define NULL 0 + /* null pointer constant. */ +#endif + +#define offsetof(type, member) \ + ((size_t)((char *)&(((___type type *)0)->member) - (char *)0)) + /* + * expands to an integral constant expression that has type size_t, the + * value of which is the offset in bytes, from the beginning of a structure + * designated by type, of the member designated by the identifier (if the + * specified member is a bit-field, the behaviour is undefined). + */ +#endif + +/* end of stddef.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDIO.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDIO.H new file mode 100644 index 0000000..cce1838 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDIO.H @@ -0,0 +1,623 @@ +#pragma force_top_level +#pragma include_only_once + +/* stdio.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.9 */ +/* Copyright (C) Codemist Ltd., 1988-1993 */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991-1993. */ +/* version 0.07 */ + +/* + * stdio.h declares two types, several macros, and many functions for + * performing input and output. For a discussion on Streams and Files + * refer to sections 4.9.2 and 4.9.3 in the above ANSI draft, or to a + * modern textbook on C. + */ + +#ifndef __stdio_h +#define __stdio_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __size_t +#define __size_t 1 +typedef unsigned int size_t; /* from */ +#endif + +/* ANSI forbids va_list to be defined here */ +typedef char *__va_list[1]; /* keep in step with */ + +#ifndef NULL +# define NULL 0 /* see */ +#endif + +typedef struct __fpos_t_struct +{ unsigned long __lo; /* add hi one day */ +} fpos_t; + /* + * fpos_t is an object capable of recording all information needed to + * specify uniquely every position within a file. + */ + +typedef struct __FILE FILE; + /* + * FILE is an object capable of recording all information needed to control + * a stream, such as its file position indicator, a pointer to its + * associated buffer, an error indicator that records whether a read/write + * error has occurred and an end-of-file indicator that records whether the + * end-of-file has been reached. + * Its structure is not made known to library clients. + */ + +#define _IOFBF 0x100 /* fully buffered IO */ +#define _IOLBF 0x200 /* line buffered IO */ +#define _IONBF 0x400 /* unbuffered IO */ + +#define BUFSIZ (4096) /* system buffer size (as used by setbuf) */ +#define EOF (-1) + /* + * negative integral constant, indicates end-of-file, that is, no more input + * from a stream. + */ +/* It is not clear to me what value FOPEN_MAX should have, so I will + err in the cautious direction - ANSI requires it to be at least 8 */ +#define FOPEN_MAX 8 /* check re arthur/unix/mvs */ + /* + * an integral constant expression that is the minimum number of files that + * this implementation guarantees can be open simultaneously. + */ +/* _SYS_OPEN defines a limit on the number of open files that is imposed + by this C library */ +#define _SYS_OPEN 16 +#define FILENAME_MAX 80 + /* + * an integral constant expression that is the size of an array of char + * large enough to hold the longest filename string + */ +#define L_tmpnam FILENAME_MAX + /* + * an integral constant expression that is the size of an array of char + * large enough to hold a temporary file name string generated by the + * tmpnam function. + */ + +#define SEEK_SET 0 /* start of stream (see fseek) */ +#define SEEK_CUR 1 /* current position in stream (see fseek) */ +#define SEEK_END 2 /* end of stream (see fseek) */ + +#define TMP_MAX 256 + /* + * an integral constant expression that is the minimum number of unique + * file names that shall be generated by the tmpnam function. + */ + +extern FILE __stdin, __stdout, __stderr; + +#define stdin (&__stdin) + /* pointer to a FILE object associated with standard input stream */ +#define stdout (&__stdout) + /* pointer to a FILE object associated with standard output stream */ +#define stderr (&__stderr) + /* pointer to a FILE object associated with standard error stream */ + +extern int remove(const char * /*filename*/); + /* + * causes the file whose name is the string pointed to by filename to be + * removed. Subsequent attempts to open the file will fail, unless it is + * created anew. If the file is open, the behaviour of the remove function + * is implementation-defined (under RISCOS/Arthur/Brazil the operation + * fails). + * Returns: zero if the operation succeeds, nonzero if it fails. + */ +extern int rename(const char * /*old*/, const char * /*new*/); + /* + * causes the file whose name is the string pointed to by old to be + * henceforth known by the name given by the string pointed to by new. The + * file named old is effectively removed. If a file named by the string + * pointed to by new exists prior to the call of the rename function, the + * behaviour is implementation-defined (under RISCOS/Arthur/Brazil, the + * operation fails). + * Returns: zero if the operation succeeds, nonzero if it fails, in which + * case if the file existed previously it is still known by its + * original name. + */ +extern FILE *tmpfile(void); + /* + * creates a temporary binary file that will be automatically removed when + * it is closed or at program termination. The file is opened for update. + * Returns: a pointer to the stream of the file that it created. If the file + * cannot be created, a null pointer is returned. + */ +extern char *tmpnam(char * /*s*/); + /* + * generates a string that is not the same as the name of an existing file. + * The tmpnam function generates a different string each time it is called, + * up to TMP_MAX times. If it is called more than TMP_MAX times, the + * behaviour is implementation-defined (under RISCOS/Arthur/Brazil the + * algorithm for the name generation works just as well after tmpnam has + * been called more than TMP_MAX times as before; a name clash is impossible + * in any single half year period). + * Returns: If the argument is a null pointer, the tmpnam function leaves + * its result in an internal static object and returns a pointer to + * that object. Subsequent calls to the tmpnam function may modify + * the same object. if the argument is not a null pointer, it is + * assumed to point to an array of at least L_tmpnam characters; + * the tmpnam function writes its result in that array and returns + * the argument as its value. + */ + +extern int fclose(FILE * /*stream*/); + /* + * causes the stream pointed to by stream to be flushed and the associated + * file to be closed. Any unwritten buffered data for the stream are + * delivered to the host environment to be written to the file; any unread + * buffered data are discarded. The stream is disassociated from the file. + * If the associated buffer was automatically allocated, it is deallocated. + * Returns: zero if the stream was succesfully closed, or nonzero if any + * errors were detected or if the stream was already closed. + */ +extern int fflush(FILE * /*stream*/); + /* + * If the stream points to an output or update stream in which the most + * recent operation was output, the fflush function causes any unwritten + * data for that stream to be delivered to the host environment to be + * written to the file. If the stream points to an input or update stream, + * the fflush function undoes the effect of any preceding ungetc operation + * on the stream. + * Returns: nonzero if a write error occurs. + */ +extern FILE *fopen(const char * /*filename*/, const char * /*mode*/); + /* + * opens the file whose name is the string pointed to by filename, and + * associates a stream with it. + * The argument mode points to a string beginning with one of the following + * sequences: + * "r" open text file for reading + * "w" create text file for writing, or truncate to zero length + * "a" append; open text file or create for writing at eof + * "rb" open binary file for reading + * "wb" create binary file for writing, or truncate to zero length + * "ab" append; open binary file or create for writing at eof + * "r+" open text file for update (reading and writing) + * "w+" create text file for update, or truncate to zero length + * "a+" append; open text file or create for update, writing at eof + * "r+b"/"rb+" open binary file for update (reading and writing) + * "w+b"/"wb+" create binary file for update, or truncate to zero length + * "a+b"/"ab+" append; open binary file or create for update, writing at eof + * + * Opening a file with read mode ('r' as the first character in the mode + * argument) fails if the file does not exist or cannot be read. + * Opening a file with append mode ('a' as the first character in the mode + * argument) causes all subsequent writes to be forced to the current end of + * file, regardless of intervening calls to the fseek function. In some + * implementations, opening a binary file with append mode ('b' as the + * second or third character in the mode argument) may initially position + * the file position indicator beyond the last data written, because of the + * NUL padding (but not under RISCOS/Arthur/Brazil). + * When a file is opened with update mode ('+' as the second or third + * character in the mode argument), both input and output may be performed + * on the associated stream. However, output may not be directly followed by + * input without an intervening call to the fflush fuction or to a file + * positioning function (fseek, fsetpos, or rewind), and input be not be + * directly followed by output without an intervening call to the fflush + * fuction or to a file positioning function, unless the input operation + * encounters end-of-file. Opening a file with update mode may open or + * create a binary stream in some implementations (but not under RISCOS/ + * Arthur/Brazil). When opened, a stream is fully buffered if and only if + * it does not refer to an interactive device. The error and end-of-file + * indicators for the stream are cleared. + * Returns: a pointer to the object controlling the stream. If the open + * operation fails, fopen returns a null pointer. + */ +extern FILE *freopen(const char * /*filename*/, const char * /*mode*/, + FILE * /*stream*/); + /* + * opens the file whose name is the string pointed to by filename and + * associates the stream pointed to by stream with it. The mode argument is + * used just as in the fopen function. + * The freopen function first attempts to close any file that is associated + * with the specified stream. Failure to close the file successfully is + * ignored. The error and end-of-file indicators for the stream are cleared. + * Returns: a null pointer if the operation fails. Otherwise, freopen + * returns the value of the stream. + */ +extern void setbuf(FILE * /*stream*/, char * /*buf*/); + /* + * Except that it returns no value, the setbuf function is equivalent to the + * setvbuf function invoked with the values _IOFBF for mode and BUFSIZ for + * size, or (if buf is a null pointer), with the value _IONBF for mode. + * Returns: no value. + */ +extern int setvbuf(FILE * /*stream*/, char * /*buf*/, + int /*mode*/, size_t /*size*/); + /* + * may be used after the stream pointed to by stream has been associated + * with an open file but before it is read or written. The argument mode + * determines how stream will be buffered, as follows: _IOFBF causes + * input/output to be fully buffered; _IOLBF causes output to be line + * buffered (the buffer will be flushed when a new-line character is + * written, when the buffer is full, or when input is requested); _IONBF + * causes input/output to be completely unbuffered. If buf is not the null + * pointer, the array it points to may be used instead of an automatically + * allocated buffer (the buffer must have a lifetime at least as great as + * the open stream, so the stream should be closed before a buffer that has + * automatic storage duration is deallocated upon block exit). The argument + * size specifies the size of the array. The contents of the array at any + * time are indeterminate. + * Returns: zero on success, or nonzero if an invalid value is given for + * mode or size, or if the request cannot be honoured. + */ + +#pragma -v1 /* hint to the compiler to check f/s/printf format */ +extern int fprintf(FILE * /*stream*/, const char * /*format*/, ...); + /* + * writes output to the stream pointed to by stream, under control of the + * string pointed to by format that specifies how subsequent arguments are + * converted for output. If there are insufficient arguments for the format, + * the behaviour is undefined. If the format is exhausted while arguments + * remain, the excess arguments are evaluated but otherwise ignored. The + * fprintf function returns when the end of the format string is reached. + * The format shall be a multibyte character sequence, beginning and ending + * in its initial shift state. The format is composed of zero or more + * directives: ordinary multibyte characters (not %), which are copied + * unchanged to the output stream; and conversion specifiers, each of which + * results in fetching zero or more subsequent arguments. Each conversion + * specification is introduced by the character %. For a description of the + * available conversion specifiers refer to section 4.9.6.1 in the ANSI + * draft mentioned at the start of this file or to any modern textbook on C. + * The minimum value for the maximum number of characters producable by any + * single conversion is at least 509. + * Returns: the number of characters transmitted, or a negative value if an + * output error occurred. + */ +extern int printf(const char * /*format*/, ...); + /* + * is equivalent to fprintf with the argument stdout interposed before the + * arguments to printf. + * Returns: the number of characters transmitted, or a negative value if an + * output error occurred. + */ +extern int sprintf(char * /*s*/, const char * /*format*/, ...); + /* + * is equivalent to fprintf, except that the argument s specifies an array + * into which the generated output is to be written, rather than to a + * stream. A null character is written at the end of the characters written; + * it is not counted as part of the returned sum. + * Returns: the number of characters written to the array, not counting the + * terminating null character. + */ +#pragma -v2 /* hint to the compiler to check f/s/scanf format */ +extern int fscanf(FILE * /*stream*/, const char * /*format*/, ...); + /* + * reads input from the stream pointed to by stream, under control of the + * string pointed to by format that specifies the admissible input sequences + * and how thay are to be converted for assignment, using subsequent + * arguments as pointers to the objects to receive the converted input. If + * there are insufficient arguments for the format, the behaviour is + * undefined. If the format is exhausted while arguments remain, the excess + * arguments are evaluated but otherwise ignored. + * The format is composed of zero or more directives: one or more + * white-space characters; an ordinary character (not %); or a conversion + * specification. Each conversion specification is introduced by the + * character %. For a description of the available conversion specifiers + * refer to section 4.9.6.2 in the ANSI draft mentioned at the start of this + * file, or to any modern textbook on C. + * If end-of-file is encountered during input, conversion is terminated. If + * end-of-file occurs before any characters matching the current directive + * have been read (other than leading white space, where permitted), + * execution of the current directive terminates with an input failure; + * otherwise, unless execution of the current directive is terminated with a + * matching failure, execution of the following directive (if any) is + * terminated with an input failure. + * If conversions terminates on a conflicting input character, the offending + * input character is left unread in the input strem. Trailing white space + * (including new-line characters) is left unread unless matched by a + * directive. The success of literal matches and suppressed asignments is + * not directly determinable other than via the %n directive. + * Returns: the value of the macro EOF if an input failure occurs before any + * conversion. Otherwise, the fscanf function returns the number of + * input items assigned, which can be fewer than provided for, or + * even zero, in the event of an early conflict between an input + * character and the format. + */ +extern int scanf(const char * /*format*/, ...); + /* + * is equivalent to fscanf with the argument stdin interposed before the + * arguments to scanf. + * Returns: the value of the macro EOF if an input failure occurs before any + * conversion. Otherwise, the scanf function returns the number of + * input items assigned, which can be fewer than provided for, or + * even zero, in the event of an early matching failure. + */ +extern int sscanf(const char * /*s*/, const char * /*format*/, ...); + /* + * is equivalent to fscanf except that the argument s specifies a string + * from which the input is to be obtained, rather than from a stream. + * Reaching the end of the string is equivalent to encountering end-of-file + * for the fscanf function. + * Returns: the value of the macro EOF if an input failure occurs before any + * conversion. Otherwise, the scanf function returns the number of + * input items assigned, which can be fewer than provided for, or + * even zero, in the event of an early matching failure. + */ +#pragma -v0 /* back to default */ +extern int vprintf(const char * /*format*/, __va_list /*arg*/); + /* + * is equivalent to printf, with the variable argument list replaced by arg, + * which has been initialised by the va_start macro (and possibly subsequent + * va_arg calls). The vprintf function does not invoke the va_end function. + * Returns: the number of characters transmitted, or a negative value if an + * output error occurred. + */ +extern int vfprintf(FILE * /*stream*/, + const char * /*format*/, __va_list /*arg*/); + /* + * is equivalent to fprintf, with the variable argument list replaced by + * arg, which has been initialised by the va_start macro (and possibly + * subsequent va_arg calls). The vfprintf function does not invoke the + * va_end function. + * Returns: the number of characters transmitted, or a negative value if an + * output error occurred. + */ +extern int vsprintf(char * /*s*/, const char * /*format*/, __va_list /*arg*/); + /* + * is equivalent to sprintf, with the variable argument list replaced by + * arg, which has been initialised by the va_start macro (and possibly + * subsequent va_arg calls). The vsprintf function does not invoke the + * va_end function. + * Returns: the number of characters written in the array, not counting the + * terminating null character. + */ + +extern int fgetc(FILE * /*stream*/); + /* + * obtains the next character (if present) as an unsigned char converted to + * an int, from the input stream pointed to by stream, and advances the + * associated file position indicator (if defined). + * Returns: the next character from the input stream pointed to by stream. + * If the stream is at end-of-file, the end-of-file indicator is + * set and fgetc returns EOF. If a read error occurs, the error + * indicator is set and fgetc returns EOF. + */ +extern char *fgets(char * /*s*/, int /*n*/, FILE * /*stream*/); + /* + * reads at most one less than the number of characters specified by n from + * the stream pointed to by stream into the array pointed to by s. No + * additional characters are read after a new-line character (which is + * retained) or after end-of-file. A null character is written immediately + * after the last character read into the array. + * Returns: s if successful. If end-of-file is encountered and no characters + * have been read into the array, the contents of the array remain + * unchanged and a null pointer is returned. If a read error occurs + * during the operation, the array contents are indeterminate and a + * null pointer is returned. + */ +extern int fputc(int /*c*/, FILE * /*stream*/); + /* + * writes the character specified by c (converted to an unsigned char) to + * the output stream pointed to by stream, at the position indicated by the + * asociated file position indicator (if defined), and advances the + * indicator appropriately. If the file position indicator is not defined, + * the character is appended to the output stream. + * Returns: the character written. If a write error occurs, the error + * indicator is set and fputc returns EOF. + */ +extern int fputs(const char * /*s*/, FILE * /*stream*/); + /* + * writes the string pointed to by s to the stream pointed to by stream. + * The terminating null character is not written. + * Returns: EOF if a write error occurs; otherwise it returns a nonnegative + * value. + */ +extern int getc(FILE * /*stream*/); + /* + * is equivalent to fgetc except that it may be implemented as an unsafe + * macro (stream may be evaluated more than once, so the argument should + * never be an expression with side-effects). + * Returns: the next character from the input stream pointed to by stream. + * If the stream is at end-of-file, the end-of-file indicator is + * set and getc returns EOF. If a read error occurs, the error + * indicator is set and getc returns EOF. + */ +#define getchar() getc(stdin) +extern int (getchar)(void); + /* + * is equivalent to getc with the argument stdin. + * Returns: the next character from the input stream pointed to by stdin. + * If the stream is at end-of-file, the end-of-file indicator is + * set and getchar returns EOF. If a read error occurs, the error + * indicator is set and getchar returns EOF. + */ +extern char *gets(char * /*s*/); + /* + * reads characters from the input stream pointed to by stdin into the array + * pointed to by s, until end-of-file is encountered or a new-line character + * is read. Any new-line character is discarded, and a null character is + * written immediately after the last character read into the array. + * Returns: s if successful. If end-of-file is encountered and no characters + * have been read into the array, the contents of the array remain + * unchanged and a null pointer is returned. If a read error occurs + * during the operation, the array contents are indeterminate and a + * null pointer is returned. + */ +extern int putc(int /*c*/, FILE * /*stream*/); + /* + * is equivalent to fputc except that it may be implemented as aan unsafe + * macro (stream may be evaluated more than once, so the argument should + * never be an expression with side-effects). + * Returns: the character written. If a write error occurs, the error + * indicator is set and putc returns EOF. + */ +#define putchar(ch) putc(ch, stdout) +extern int (putchar)(int /*c*/); + /* + * is equivalent to putc with the second argument stdout. + * Returns: the character written. If a write error occurs, the error + * indicator is set and putc returns EOF. + */ +extern int puts(const char * /*s*/); + /* + * writes the string pointed to by s to the stream pointed to by stdout, and + * appends a new-line character to the output. The terminating null + * character is not written. + * Returns: EOF if a write error occurs; otherwise it returns a nonnegative + * value. + */ +extern int ungetc(int /*c*/, FILE * /*stream*/); + /* + * pushes the character specified by c (converted to an unsigned char) back + * onto the input stream pointed to by stream. The character will be + * returned by the next read on that stream. An intervening call to the + * fflush function or to a file positioning function (fseek, fsetpos, + * rewind) discards any pushed-back characters. The external storage + * corresponding to the stream is unchanged. + * One character pushback is guaranteed. If the unget function is called too + * many times on the same stream without an intervening read or file + * positioning operation on that stream, the operation may fail. + * If the value of c equals that of the macro EOF, the operation fails and + * the input stream is unchanged. + * A successful call to the ungetc function clears the end-of-file + * indicator. The value of the file position indicator after reading or + * discarding all pushed-back characters shall be the same as it was before + * the characters were pushed back. For a text stream, the value of the file + * position indicator after a successful call to the ungetc function is + * unspecified until all pushed-back characters are read or discarded. For a + * binary stream, the file position indicator is decremented by each + * successful call to the ungetc function; if its value was zero before a + * call, it is indeterminate after the call. + * Returns: the character pushed back after conversion, or EOF if the + * operation fails. + */ + +extern size_t fread(void * /*ptr*/, + size_t /*size*/, size_t /*nmemb*/, FILE * /*stream*/); + /* + * reads into the array pointed to by ptr, up to nmemb members whose size is + * specified by size, from the stream pointed to by stream. The file + * position indicator (if defined) is advanced by the number of characters + * successfully read. If an error occurs, the resulting value of the file + * position indicator is indeterminate. If a partial member is read, its + * value is indeterminate. The ferror or feof function shall be used to + * distinguish between a read error and end-of-file. + * Returns: the number of members successfully read, which may be less than + * nmemb if a read error or end-of-file is encountered. If size or + * nmemb is zero, fread returns zero and the contents of the array + * and the state of the stream remain unchanged. + */ +extern size_t fwrite(const void * /*ptr*/, + size_t /*size*/, size_t /*nmemb*/, FILE * /*stream*/); + /* + * writes, from the array pointed to by ptr up to nmemb members whose size + * is specified by size, to the stream pointed to by stream. The file + * position indicator (if defined) is advanced by the number of characters + * successfully written. If an error occurs, the resulting value of the file + * position indicator is indeterminate. + * Returns: the number of members successfully written, which will be less + * than nmemb only if a write error is encountered. + */ + +extern int fgetpos(FILE * /*stream*/, fpos_t * /*pos*/); + /* + * stores the current value of the file position indicator for the stream + * pointed to by stream in the object pointed to by pos. The value stored + * contains unspecified information usable by the fsetpos function for + * repositioning the stream to its position at the time of the call to the + * fgetpos function. + * Returns: zero, if successful. Otherwise nonzero is returned and the + * integer expression errno is set to an implementation-defined + * nonzero value (under RISCOS/Arthur/Brazil fgetpos cannot fail). + */ +extern int fseek(FILE * /*stream*/, long int /*offset*/, int /*whence*/); + /* + * sets the file position indicator for the stream pointed to by stream. + * For a binary stream, the new position is at the signed number of + * characters specified by offset away from the point specified by whence. + * The specified point is the beginning of the file for SEEK_SET, the + * current position in the file for SEEK_CUR, or end-of-file for SEEK_END. + * A binary stream need not meaningfully support fseek calls with a whence + * value of SEEK_END. + * For a text stream, either offset shall be zero, or offset shall be a + * value returned by an earlier call to the ftell function on the same + * stream and whence shall be SEEK_SET. + * The fseek function clears the end-of-file indicator and undoes any + * effects of the ungetc function on the same stream. After an fseek call, + * the next operation on an update stream may be either input or output. + * Returns: nonzero only for a request that cannot be satisfied. + */ +extern int fsetpos(FILE * /*stream*/, const fpos_t * /*pos*/); + /* + * sets the file position indicator for the stream pointed to by stream + * according to the value of the object pointed to by pos, which shall be a + * value returned by an earlier call to the fgetpos function on the same + * stream. + * The fsetpos function clears the end-of-file indicator and undoes any + * effects of the ungetc function on the same stream. After an fsetpos call, + * the next operation on an update stream may be either input or output. + * Returns: zero, if successful. Otherwise nonzero is returned and the + * integer expression errno is set to an implementation-defined + * nonzero value (under RISCOS/Arthur/Brazil the value that of EDOM + * in math.h). + */ +extern long int ftell(FILE * /*stream*/); + /* + * obtains the current value of the file position indicator for the stream + * pointed to by stream. For a binary stream, the value is the number of + * characters from the beginning of the file. For a text stream, the file + * position indicator contains unspecified information, usable by the fseek + * function for returning the file position indicator to its position at the + * time of the ftell call; the difference between two such return values is + * not necessarily a meaningful measure of the number of characters written + * or read. + * Returns: if successful, the current value of the file position indicator. + * On failure, the ftell function returns -1L and sets the integer + * expression errno to an implementation-defined nonzero value + * (under RISCOS/Arthur/Brazil ftell cannot fail). + */ +extern void rewind(FILE * /*stream*/); + /* + * sets the file position indicator for the stream pointed to by stream to + * the beginning of the file. It is equivalent to + * (void)fseek(stream, 0L, SEEK_SET) + * except that the error indicator for the stream is also cleared. + * Returns: no value. + */ + +extern void clearerr(FILE * /*stream*/); + /* + * clears the end-of-file and error indicators for the stream pointed to by + * stream. These indicators are cleared only when the file is opened or by + * an explicit call to the clearerr function or to the rewind function. + * Returns: no value. + */ + +extern int feof(FILE * /*stream*/); + /* + * tests the end-of-file indicator for the stream pointed to by stream. + * Returns: nonzero iff the end-of-file indicator is set for stream. + */ +extern int ferror(FILE * /*stream*/); + /* + * tests the error indicator for the stream pointed to by stream. + * Returns: nonzero iff the error indicator is set for stream. + */ +extern void perror(const char * /*s*/); + /* + * maps the error number in the integer expression errno to an error + * message. It writes a sequence of characters to the standard error stream + * thus: first (if s is not a null pointer and the character pointed to by + * s is not the null character), the string pointed to by s followed by a + * colon and a space; then an appropriate error message string followed by + * a new-line character. The contents of the error message strings are the + * same as those returned by the strerror function with argument errno, + * which are implementation-defined. + * Returns: no value. + */ + +#ifdef __cplusplus +} +#endif + +#endif + +/* end of stdio.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDLIB.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDLIB.H new file mode 100644 index 0000000..bb44b79 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STDLIB.H @@ -0,0 +1,539 @@ +#pragma force_top_level +#pragma include_only_once + +/* stdlib.h: ANSI draft (X3J11 May 88) library header, section 4.10 */ +/* Copyright (C) Codemist Ltd., 1988-1993. */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991-1993. */ +/* version 0.03 */ + +/* + * stdlib.h declares four types, several general purpose functions, + * and defines several macros. + */ + +#ifndef __stdlib_h +#define __stdlib_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __size_t +# define __size_t 1 + typedef unsigned int size_t; /* from */ +#endif + +#ifndef __wchar_t + typedef int wchar_t; /* from */ +# define __wchar_t 1 +#endif + +#ifndef NULL +# define NULL 0 /* from */ +#endif + +typedef struct div_t { int quot, rem; } div_t; + /* type of the value returned by the div function. */ +typedef struct ldiv_t { long int quot, rem; } ldiv_t; + /* type of the value returned by the ldiv function. */ + +#ifdef __EXIT_FAILURE +# define EXIT_FAILURE __EXIT_FAILURE + /* + * an integral expression which may be used as an argument to the exit + * function to return unsuccessful termination status to the host + * environment. + */ +#else +# define EXIT_FAILURE 1 /* unixoid */ +#endif +#define EXIT_SUCCESS 0 + /* + * an integral expression which may be used as an argument to the exit + * function to return successful termination status to the host + * environment. + */ + +#define RAND_MAX 0x7fffffff + /* + * an integral constant expression, the value of which is the maximum value + * returned by the rand function. + */ +#define _ANSI_RAND_MAX 0x7fff /* for the so-called portable version rand() */ + /* + * an integral constant expression, the value of which is the maximum value + * returned by the _ANSI_rand function. + */ +#define MB_CUR_MAX 1 + /* + * a positive integer expression whose value is the maximum number of bytes + * in a multibyte character for the extended character set specified by the + * current locale (category LC_CTYPE), and whose value is never greater + * than MB_LEN_MAX. + */ + +extern double atof(const char * /*nptr*/); + /* + * converts the initial part of the string pointed to by nptr to double + * representation. + * Returns: the converted value. + */ +extern int atoi(const char * /*nptr*/); + /* + * converts the initial part of the string pointed to by nptr to int + * representation. + * Returns: the converted value. + */ +extern long int atol(const char * /*nptr*/); + /* + * converts the initial part of the string pointed to by nptr to long int + * representation. + * Returns: the converted value. + */ + +extern double strtod(const char * /*nptr*/, char ** /*endptr*/); + /* + * converts the initial part of the string pointed to by nptr to double + * representation. First it decomposes the input string into three parts: + * an initial, possibly empty, sequence of white-space characters (as + * specified by the isspace function), a subject sequence resembling a + * floating point constant; and a final string of one or more unrecognised + * characters, including the terminating null character of the input string. + * Then it attempts to convert the subject sequence to a floating point + * number, and returns the result. A pointer to the final string is stored + * in the object pointed to by endptr, provided that endptr is not a null + * pointer. + * Returns: the converted value if any. If no conversion could be performed, + * zero is returned. If the correct value is outside the range of + * representable values, plus or minus HUGE_VAL is returned + * (according to the sign of the value), and the value of the macro + * ERANGE is stored in errno. If the correct value would cause + * underflow, zero is returned and the value of the macro ERANGE is + * stored in errno. + */ +extern long int strtol(const char * /*nptr*/, char **/*endptr*/, int /*base*/); + /* + * converts the initial part of the string pointed to by nptr to long int + * representation. First it decomposes the input string into three parts: + * an initial, possibly empty, sequence of white-space characters (as + * specified by the isspace function), a subject sequence resembling an + * integer represented in some radix determined by the value of base, and a + * final string of one or more unrecognised characters, including the + * terminating null character of the input string. Then it attempts to + * convert the subject sequence to an integer, and returns the result. + * If the value of base is 0, the expected form of the subject sequence is + * that of an integer constant (described in ANSI Draft, section 3.1.3.2), + * optionally preceeded by a '+' or '-' sign, but not including an integer + * suffix. If the value of base is between 2 and 36, the expected form of + * the subject sequence is a sequence of letters and digits representing an + * integer with the radix specified by base, optionally preceeded by a plus + * or minus sign, but not including an integer suffix. The letters from a + * (or A) through z (or Z) are ascribed the values 10 to 35; only letters + * whose ascribed values are less than that of the base are permitted. If + * the value of base is 16, the characters 0x or 0X may optionally precede + * the sequence of letters and digits following the sign if present. + * A pointer to the final string is stored in the object + * pointed to by endptr, provided that endptr is not a null pointer. + * Returns: the converted value if any. If no conversion could be performed, + * zero is returned. If the correct value is outside the range of + * representable values, LONG_MAX or LONG_MIN is returned + * (according to the sign of the value), and the value of the + * macro ERANGE is stored in errno. + */ +extern unsigned long int strtoul(const char * /*nptr*/, + char ** /*endptr*/, int /*base*/); + /* + * converts the initial part of the string pointed to by nptr to unsigned + * long int representation. First it decomposes the input string into three + * parts: an initial, possibly empty, sequence of white-space characters (as + * determined by the isspace function), a subject sequence resembling an + * unsigned integer represented in some radix determined by the value of + * base, and a final string of one or more unrecognised characters, + * including the terminating null character of the input string. Then it + * attempts to convert the subject sequence to an unsigned integer, and + * returns the result. If the value of base is zero, the expected form of + * the subject sequence is that of an integer constant (described in ANSI + * Draft, section 3.1.3.2), optionally preceeded by a '+' or '-' sign, but + * not including an integer suffix. If the value of base is between 2 and + * 36, the expected form of the subject sequence is a sequence of letters + * and digits representing an integer with the radix specified by base, + * optionally preceeded by a '+' or '-' sign, but not including an integer + * suffix. The letters from a (or A) through z (or Z) stand for the values + * 10 to 35; only letters whose ascribed values are less than that of the + * base are permitted. If the value of base is 16, the characters 0x or 0X + * may optionally precede the sequence of letters and digits following the + * sign, if present. A pointer to the final string is stored in the object + * pointed to by endptr, provided that endptr is not a null pointer. + * Returns: the converted value if any. If no conversion could be performed, + * zero is returned. If the correct value is outside the range of + * representable values, ULONG_MAX is returned, and the value of + * the macro ERANGE is stored in errno. + */ + +extern int rand(void); + /* + * Computes a sequence of pseudo-random integers in the range 0 to RAND_MAX. + * Uses an additive generator (Mitchell & Moore) of the form: + * Xn = (X[n-24] + X[n-55]) MOD 2^31 + * This is described in section 3.2.2 of Knuth, vol 2. It's period is + * in excess of 2^55 and its randomness properties, though unproven, are + * conjectured to be good. Empirical testing since 1958 has shown no flaws. + * Returns: a pseudo-random integer. + */ +extern void srand(unsigned int /*seed*/); + /* + * uses its argument as a seed for a new sequence of pseudo-random numbers + * to be returned by subsequent calls to rand. If srand is then called with + * the same seed value, the sequence of pseudo-random numbers is repeated. + * If rand is called before any calls to srand have been made, the same + * sequence is generated as when srand is first called with a seed value + * of 1. + */ +extern int _ANSI_rand(void); + /* + * The ANSI-defined 16-bit random number generator which computes + * a sequence of pseudo-random integers in the range 0 to _ANSI_RAND_MAX. + * Its properties are poor, though it IS very portable. + * *** NOT AVAILABLE IN THE SHARED C LIBRARY *** + * Returns: a pseudo-random integer. + */ +extern void _ANSI_srand(unsigned int /*seed*/); + /* + * Uses its argument as a seed for a new sequence of pseudo-random numbers + * to be returned by subsequent calls to _ANSI_rand. If _ANSI_srand is then + * called with the same seed value, the sequence of pseudo-random numbers + * is repeated. If _ANSI_rand is called before any calls to _ANSI_srand have + * been made, the same sequence is generated as when _ANSI_srand is first + * called with a seed value of 1. + * *** NOT AVAILABLE IN THE SHARED C LIBRARY *** + */ + +extern void *calloc(size_t /*nmemb*/, size_t /*size*/); + /* + * allocates space for an array of nmemb objects, each of whose size is + * 'size'. The space is initialised to all bits zero. + * Returns: either a null pointer or a pointer to the allocated space. + */ +extern void free(void * /*ptr*/); + /* + * causes the space pointed to by ptr to be deallocated (i.e., made + * available for further allocation). If ptr is a null pointer, no action + * occurs. Otherwise, if ptr does not match a pointer earlier returned by + * calloc, malloc or realloc or if the space has been deallocated by a call + * to free or realloc, the behaviour is undefined. + */ +extern void *malloc(size_t /*size*/); + /* + * allocates space for an object whose size is specified by 'size' and whose + * value is indeterminate. + * Returns: either a null pointer or a pointer to the allocated space. + */ +extern void *realloc(void * /*ptr*/, size_t /*size*/); + /* + * changes the size of the object pointed to by ptr to the size specified by + * size. The contents of the object shall be unchanged up to the lesser of + * the new and old sizes. If the new size is larger, the value of the newly + * allocated portion of the object is indeterminate. If ptr is a null + * pointer, the realloc function behaves like a call to malloc for the + * specified size. Otherwise, if ptr does not match a pointer earlier + * returned by calloc, malloc or realloc, or if the space has been + * deallocated by a call to free or realloc, the behaviour is undefined. + * If the space cannot be allocated, the object pointed to by ptr is + * unchanged. If size is zero and ptr is not a null pointer, the object it + * points to is freed. + * Returns: either a null pointer or a pointer to the possibly moved + * allocated space. + */ + +extern void abort(void); + /* + * causes abnormal program termination to occur, unless the signal SIGABRT + * is being caught and the signal handler does not return. Whether open + * output streams are flushed or open streams are closed or temporary files + * removed is implementation-defined (under Arthur/Brazil all these occur). + * An implementation-defined form of the status 'unsuccessful termination' + * (1 under Arthur/Brazil) is returned to the host environment by means + * of a call to raise(SIGABRT). + */ +extern int atexit(void (* /*func*/)(void)); + /* + * registers the function pointed to by func, to be called without its + * arguments at normal program termination. It is possible to register at + * least 32 functions. + * Returns: zero if the registration succeeds, nonzero if it fails. + */ +extern void exit(int /*status*/); + /* + * causes normal program termination to occur. If more than one call to the + * exit function is executed by a program, the behaviour is undefined. + * First, all functions registered by the atexit function are called, in the + * reverse order of their registration. + * Next, all open output streams are flushed, all open streams are closed, + * and all files created by the tmpfile function are removed. + * Finally, control is returned to the host environment. If the value of + * status is zero or EXIT_SUCCESS, an implementation-defined form of the + * status 'successful termination' (0 under Arthur/Brazil) is returned. If + * the value of status is EXIT_FAILURE, an implementation-defined form of + * the status 'unsuccessful termination' (1 under Arthur/Brazil) is + * returned. Otherwise the status returned is implementation-defined (the + * value of status is returned under Arthur/Brazil). + */ + +extern char *getenv(const char * /*name*/); + /* + * searches the environment list, provided by the host environment, for a + * string that matches the string pointed to by name. The set of environment + * names and the method for altering the environment list are + * implementation-defined. + * Returns: a pointer to a string associated with the matched list member. + * The array pointed to shall not be modified by the program, but + * may be overwritten by a subsequent call to the getenv function. + * If the specified name cannot be found, a null pointer is + * returned. + */ +extern int system(const char * /*string*/); + /* + * passes the string pointed to by string to the host environment to be + * executed by a command processor in an implementation-defined manner. + * A null pointer may be used for string, to inquire whether a command + * processor exists. + * + * Under Arthur/Brazil care must be taken when executing a command, that the + * command does not overwrite the calling program. The string 'chain:' or + * 'call:' may immediately precede the actual command. The effect of 'call:' + * is the same as if 'call:' were not present, which is to attempt to return + * to the calling program. The effect of 'chain:' is to make no attempt to + * return to the calling program, but an attempt is made to call exit. + * + * Returns: If the argument is a null pointer, the system function returns + * non-zero only if a command processor is available. If the + * argument is not a null pointer, the system function returns an + * implementation-defined value (under Arthur/Brazil 0 is returned + * for success, -2 for failure to invoke the command and any other + * value is the return code from the executed command). + */ + +extern void *bsearch(const void *key, const void * /*base*/, + size_t /*nmemb*/, size_t /*size*/, + int (* /*compar*/)(const void *, const void *)); + /* + * searches an array of nmemb objects, the initial member of which is + * pointed to by base, for a member that matches the object pointed to by + * key. The size of each member of the array is specified by size. + * The contents of the array shall be in ascending sorted order according to + * a comparison function pointed to by compar, which is called with two + * arguments that point to the key object and to an array member, in that + * order. The function shall return an integer less than, equal to, or + * greater than zero if the key object is considered, respectively, to be + * less than, to match, or to be greater than the array member. + * Returns: a pointer to a matching member of the array, or a null pointer + * if no match is found. If two members compare as equal, which + * member is matched is unspecified. + */ +extern void qsort(void * /*base*/, size_t /*nmemb*/, size_t /*size*/, + int (* /*compar*/)(const void *, const void *)); + /* + * sorts an array of nmemb objects, the initial member of which is pointed + * to by base. The size of each object is specified by size. + * The contents of the array shall be in ascending order according to a + * comparison function pointed to by compar, which is called with two + * arguments that point to the objects being compared. The function shall + * return an integer less than, equal to, or greater than zero if the first + * argument is considered to be respectively less than, equal to, or greater + * than the second. If two members compare as equal, their order in the + * sorted array is unspecified. + */ + +extern int abs(int /*j*/); + /* + * computes the absolute value of an integer j. If the result cannot be + * represented, the behaviour is undefined. + * Returns: the absolute value. + */ +extern div_t div(int /*numer*/, int /*denom*/); + /* + * computes the quotient and remainder of the division of the numerator + * numer by the denominator denom. If the division is inexact, the resulting + * quotient is the integer of lesser magnitude that is the nearest to the + * algebraic quotient. If the result cannot be represented, the behaviour is + * undefined; otherwise, quot * demon + rem shall equal numer. + * Returns: a structure of type div_t, comprising both the quotient and the + * remainder. the structure shall contain the following members, + * in either order. + * int quot; int rem; + */ +extern long int labs(long int /*j*/); + /* + * computes the absolute value of an long integer j. If the result cannot be + * represented, the behaviour is undefined. + * Returns: the absolute value. + */ +extern ldiv_t ldiv(long int /*numer*/, long int /*denom*/); + /* + * computes the quotient and remainder of the division of the numerator + * numer by the denominator denom. If the division is inexact, the sign of + * the resulting quotient is that of the algebraic quotient, and the + * magnitude of the resulting quotient is the largest integer less than the + * magnitude of the algebraic quotient. If the result cannot be represented, + * the behaviour is undefined; otherwise, quot * demon + rem shall equal + * numer. + * Returns: a structure of type ldiv_t, comprising both the quotient and the + * remainder. the structure shall contain the following members, + * in either order. + * long int quot; long int rem; + */ + +/* + * ARM real-time divide functions for guaranteed performance + */ +typedef struct __sdiv32by16 { int quot, rem; } __sdiv32by16; + /* used int so that values return in separate regs, although 16-bit */ +typedef struct __sdiv64by32 { int rem, quot; } __sdiv64by32; + +__value_in_regs extern __sdiv32by16 __rt_sdiv32by16( + int /*numer*/, + short int /*denom*/); + /* + * Signed divide: (16-bit quot), (16-bit rem) = (32-bit) / (16-bit) + */ +__value_in_regs extern __sdiv64by32 __rt_sdiv64by32( + int /*numer_h*/, unsigned int /*numer_l*/, + int /*denom*/); + /* + * Signed divide: (32-bit quot), (32-bit rem) = (64-bit) / (32-bit) + */ + +/* + * ARM floating-point mask/status function (for both hardfp and softfp) + */ +extern unsigned int __fp_status(unsigned int /*mask*/, unsigned int /*flags*/); + /* + * mask and flags are bit-fields which correspond directly to the + * floating point status register in the FPE/FPA and fplib. + * __fp_status returns the current value of the status register, + * and also sets the writable bits of the word + * (the exception control and flag bytes) to: + * + * new = (old & ~mask) ^ flags; + */ +#define __fpsr_IXE 0x100000 +#define __fpsr_UFE 0x80000 +#define __fpsr_OFE 0x40000 +#define __fpsr_DZE 0x20000 +#define __fpsr_IOE 0x10000 + +#define __fpsr_IXC 0x10 +#define __fpsr_UFC 0x8 +#define __fpsr_OFC 0x4 +#define __fpsr_DZC 0x2 +#define __fpsr_IOC 0x1 + +/* + * Multibyte Character Functions. + * The behaviour of the multibyte character functions is affected by the + * LC_CTYPE category of the current locale. For a state-dependent encoding, + * each function is placed into its initial state by a call for which its + * character pointer argument, s, is a null pointer. Subsequent calls with s + * as other than a null pointer cause the internal state of the function to be + * altered as necessary. A call with s as a null pointer causes these functions + * to return a nonzero value if encodings have state dependency, and a zero + * otherwise. After the LC_CTYPE category is changed, the shift state of these + * functions is indeterminate. + */ +extern int mblen(const char * /*s*/, size_t /*n*/); + /* + * If s is not a null pointer, the mblen function determines the number of + * bytes compromising the multibyte character pointed to by s. Except that + * the shift state of the mbtowc function is not affected, it is equivalent + * to mbtowc((wchar_t *)0, s, n); + * Returns: If s is a null pointer, the mblen function returns a nonzero or + * zero value, if multibyte character encodings, resepectively, do + * or do not have state-dependent encodings. If s is not a null + * pointer, the mblen function either returns a 0 (if s points to a + * null character), or returns the number of bytes that compromise + * the multibyte character (if the next n of fewer bytes form a + * valid multibyte character), or returns -1 (they do not form a + * valid multibyte character). + */ +extern int mbtowc(wchar_t * /*pwc*/, const char * /*s*/, size_t /*n*/); + /* + * If s is not a null pointer, the mbtowc function determines the number of + * bytes that compromise the multibyte character pointed to by s. It then + * determines the code for value of type wchar_t that corresponds to that + * multibyte character. (The value of the code corresponding to the null + * character is zero). If the multibyte character is valid and pwc is not a + * null pointer, the mbtowc function stores the code in the object pointed + * to by pwc. At most n bytes of the array pointed to by s will be examined. + * Returns: If s is a null pointer, the mbtowc function returns a nonzero or + * zero value, if multibyte character encodings, resepectively, do + * or do not have state-dependent encodings. If s is not a null + * pointer, the mbtowc function either returns a 0 (if s points to + * a null character), or returns the number of bytes that + * compromise the converted multibyte character (if the next n of + * fewer bytes form a valid multibyte character), or returns -1 + * (they do not form a valid multibyte character). + */ +extern int wctomb(char * /*s*/, wchar_t /*wchar*/); + /* + * determines the number of bytes need to represent the multibyte character + * corresponding to the code whose value is wchar (including any change in + * shift state). It stores the multibyte character representation in the + * array object pointed to by s (if s is not a null pointer). At most + * MB_CUR_MAX characters are stored. If the value of wchar is zero, the + * wctomb function is left in the initial shift state). + * Returns: If s is a null pointer, the wctomb function returns a nonzero or + * zero value, if multibyte character encodings, resepectively, do + * or do not have state-dependent encodings. If s is not a null + * pointer, the wctomb function returns a -1 if the value of wchar + * does not correspond to a valid multibyte character, or returns + * the number of bytes that compromise the multibyte character + * corresponding to the value of wchar. + */ + +/* + * Multibyte String Functions. + * The behaviour of the multibyte string functions is affected by the LC_CTYPE + * category of the current locale. + */ +extern size_t mbstowcs(wchar_t * /*pwcs*/, const char * /*s*/, size_t /*n*/); + /* + * converts a sequence of multibyte character that begins in the initial + * shift state from the array pointed to by s into a sequence of + * corresponding codes and stores not more than n codes into the array + * pointed to by pwcs. No multibyte character that follow a null character + * (which is converted into a code with value zero) will be examined or + * converted. Each multibyte character is converted as if by a call to + * mbtowc function, except that the shift state of the mbtowc function is + * not affected. No more than n elements will be modified in the array + * pointed to by pwcs. If copying takes place between objects that overlap, + * the behaviour is undefined. + * Returns: If an invalid multibyte character is encountered, the mbstowcs + * function returns (size_t)-1. Otherwise, the mbstowcs function + * returns the number of array elements modified, not including + * a terminating zero code, if any. + */ +extern size_t wcstombs(char * /*s*/, const wchar_t * /*pwcs*/, size_t /*n*/); + /* + * converts a sequence of codes that correspond to multibyte characters + * from the array pointed to by pwcs into a sequence of multibyte + * characters that begins in the initial shift state and stores these + * multibyte characters into the array pointed to by s, stopping if a + * multibyte character would exceed the limit of n total bytes or if a + * null character is stored. Each code is converted as if by a call to the + * wctomb function, except that the shift state of the wctomb function is + * not affected. No more than n elements will be modified in the array + * pointed to by s. If copying takes place between objects that overlap, + * the behaviour is undefined. + * Returns: If a code is encountered that does not correspond to a valid + * multibyte character, the wcstombs function returns (size_t)-1. + * Otherwise, the wcstombs function returns the number of bytes + * modified, not including a terminating null character, if any. + */ + +#ifdef __cplusplus +} +#endif + +#endif + +/* end of stdlib.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STRING.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STRING.H new file mode 100644 index 0000000..e0c2807 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/STRING.H @@ -0,0 +1,256 @@ +#pragma force_top_level +#pragma include_only_once + +/* string.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.11 */ +/* Copyright (C) Codemist Ltd., 1988-1993. */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991-1993. */ +/* version 0.03 */ + +/* + * string.h declares one type and several functions, and defines one macro + * useful for manipulating character arrays and other objects treated as + * character arrays. Various methods are used for determining the lengths of + * the arrays, but in all cases a char * or void * argument points to the + * initial (lowest addresses) character of the array. If an array is written + * beyond the end of an object, the behaviour is undefined. + */ + +#ifndef __string_h +#define __string_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __size_t +#define __size_t 1 +typedef unsigned int size_t; /* from */ +#endif + +#ifndef NULL +# define NULL 0 +#endif + +extern void *memcpy(void * /*s1*/, const void * /*s2*/, size_t /*n*/); + /* + * copies n characters from the object pointed to by s2 into the object + * pointed to by s1. If copying takes place between objects that overlap, + * the behaviour is undefined. + * Returns: the value of s1. + */ +extern void *memmove(void * /*s1*/, const void * /*s2*/, size_t /*n*/); + /* + * copies n characters from the object pointed to by s2 into the object + * pointed to by s1. Copying takes place as if the n characters from the + * object pointed to by s2 are first copied into a temporary array of n + * characters that does not overlap the objects pointed to by s1 and s2, + * and then the n characters from the temporary array are copied into the + * object pointed to by s1. + * Returns: the value of s1. + */ +extern char *strcpy(char * /*s1*/, const char * /*s2*/); + /* + * copies the string pointed to by s2 (including the terminating nul + * character) into the array pointed to by s1. If copying takes place + * between objects that overlap, the behaviour is undefined. + * Returns: the value of s1. + */ +extern char *strncpy(char * /*s1*/, const char * /*s2*/, size_t /*n*/); + /* + * copies not more than n characters (characters that follow a null + * character are not copied) from the array pointed to by s2 into the array + * pointed to by s1. If copying takes place between objects that overlap, + * the behaviour is undefined. + * Returns: the value of s1. + */ + +extern char *strcat(char * /*s1*/, const char * /*s2*/); + /* + * appends a copy of the string pointed to by s2 (including the terminating + * null character) to the end of the string pointed to by s1. The initial + * character of s2 overwrites the null character at the end of s1. + * Returns: the value of s1. + */ +extern char *strncat(char * /*s1*/, const char * /*s2*/, size_t /*n*/); + /* + * appends not more than n characters (a null character and characters that + * follow it are not appended) from the array pointed to by s2 to the end of + * the string pointed to by s1. The initial character of s2 overwrites the + * null character at the end of s1. A terminating null character is always + * appended to the result. + * Returns: the value of s1. + */ + +/* + * The sign of a nonzero value returned by the comparison functions is + * determined by the sign of the difference between the values of the first + * pair of characters (both interpreted as unsigned char) that differ in the + * objects being compared. + */ + +extern int memcmp(const void * /*s1*/, const void * /*s2*/, size_t /*n*/); + /* + * compares the first n characters of the object pointed to by s1 to the + * first n characters of the object pointed to by s2. + * Returns: an integer greater than, equal to, or less than zero, according + * as the object pointed to by s1 is greater than, equal to, or + * less than the object pointed to by s2. + */ +extern int strcmp(const char * /*s1*/, const char * /*s2*/); + /* + * compares the string pointed to by s1 to the string pointed to by s2. + * Returns: an integer greater than, equal to, or less than zero, according + * as the string pointed to by s1 is greater than, equal to, or + * less than the string pointed to by s2. + */ +extern int strncmp(const char * /*s1*/, const char * /*s2*/, size_t /*n*/); + /* + * compares not more than n characters (characters that follow a null + * character are not compared) from the array pointed to by s1 to the array + * pointed to by s2. + * Returns: an integer greater than, equal to, or less than zero, according + * as the string pointed to by s1 is greater than, equal to, or + * less than the string pointed to by s2. + */ +extern int strcoll(const char * /*s1*/, const char * /*s2*/); + /* + * compares the string pointed to by s1 to the string pointed to by s2, both + * interpreted as appropriate to the LC_COLLATE category of the current + * locale. + * Returns: an integer greater than, equal to, or less than zero, according + * as the string pointed to by s1 is greater than, equal to, or + * less than the string pointed to by s2 when both are interpreted + * as appropriate to the current locale. + */ + +extern size_t strxfrm(char * /*s1*/, const char * /*s2*/, size_t /*n*/); + /* + * transforms the string pointed to by s2 and places the resulting string + * into the array pointed to by s1. The transformation function is such that + * if the strcmp function is applied to two transformed strings, it returns + * a value greater than, equal to or less than zero, corresponding to the + * result of the strcoll function applied to the same two original strings. + * No more than n characters are placed into the resulting array pointed to + * by s1, including the terminating null character. If n is zero, s1 is + * permitted to be a null pointer. If copying takes place between objects + * that overlap, the behaviour is undefined. + * Returns: The length of the transformed string is returned (not including + * the terminating null character). If the value returned is n or + * more, the contents of the array pointed to by s1 are + * indeterminate. + */ + + +extern void *memchr(const void * /*s*/, int /*c*/, size_t /*n*/); + /* + * locates the first occurence of c (converted to an unsigned char) in the + * initial n characters (each interpreted as unsigned char) of the object + * pointed to by s. + * Returns: a pointer to the located character, or a null pointer if the + * character does not occur in the object. + */ +extern char *strchr(const char * /*s*/, int /*c*/); + /* + * locates the first occurence of c (converted to an char) in the string + * pointed to by s (including the terminating null character). + * Returns: a pointer to the located character, or a null pointer if the + * character does not occur in the string. + */ +extern size_t strcspn(const char * /*s1*/, const char * /*s2*/); + /* + * computes the length of the initial segment of the string pointed to by s1 + * which consists entirely of characters not from the string pointed to by + * s2. The terminating null character is not considered part of s2. + * Returns: the length of the segment. + */ +extern char *strpbrk(const char * /*s1*/, const char * /*s2*/); + /* + * locates the first occurence in the string pointed to by s1 of any + * character from the string pointed to by s2. + * Returns: returns a pointer to the character, or a null pointer if no + * character form s2 occurs in s1. + */ +extern char *strrchr(const char * /*s*/, int /*c*/); + /* + * locates the last occurence of c (converted to a char) in the string + * pointed to by s. The terminating null character is considered part of + * the string. + * Returns: returns a pointer to the character, or a null pointer if c does + * not occur in the string. + */ +extern size_t strspn(const char * /*s1*/, const char * /*s2*/); + /* + * computes the length of the initial segment of the string pointed to by s1 + * which consists entirely of characters from the string pointed to by S2 + * Returns: the length of the segment. + */ +extern char *strstr(const char * /*s1*/, const char * /*s2*/); + /* + * locates the first occurence in the string pointed to by s1 of the + * sequence of characters (excluding the terminating null character) in the + * string pointed to by s2. + * Returns: a pointer to the located string, or a null pointer if the string + * is not found. + */ +extern char *strtok(char * /*s1*/, const char * /*s2*/); + /* + * A sequence of calls to the strtok function breaks the string pointed to + * by s1 into a sequence of tokens, each of which is delimited by a + * character from the string pointed to by s2. The first call in the + * sequence has s1 as its first argument, and is followed by calls with a + * null pointer as their first argument. The separator string pointed to by + * s2 may be different from call to call. + * The first call in the sequence searches for the first character that is + * not contained in the current separator string s2. If no such character + * is found, then there are no tokens in s1 and the strtok function returns + * a null pointer. If such a character is found, it is the start of the + * first token. + * The strtok function then searches from there for a character that is + * contained in the current separator string. If no such character is found, + * the current token extends to the end of the string pointed to by s1, and + * subsequent searches for a token will fail. If such a character is found, + * it is overwritten by a null character, which terminates the current + * token. The strtok function saves a pointer to the following character, + * from which the next search for a token will start. + * Each subsequent call, with a null pointer as the value for the first + * argument, starts searching from the saved pointer and behaves as + * described above. + * Returns: pointer to the first character of a token, or a null pointer if + * there is no token. + */ + +extern void *memset(void * /*s*/, int /*c*/, size_t /*n*/); + /* + * copies the value of c (converted to an unsigned char) into each of the + * first n charactes of the object pointed to by s. + * Returns: the value of s. + */ +extern char *strerror(int /*errnum*/); + /* + * maps the error number in errnum to an error message string. + * Returns: a pointer to the string, the contents of which are + * implementation-defined (under RISCOS/Arthur/Brazil the strings + * for the given ernums are as follows + * 0 "No error (errno = 0)" + * EDOM "EDOM - function argument out of range" + * ERANGE "ERANGE - function result not representable" + * ESIGNUM "ESIGNUM - illegal signal number to signal() or raise()" + * others "Error code (errno) %d has no associated message" + * ). The array pointed to shall not be + * modified by the program, but may be overwritten by a subsequent + * call to the strerror function. + */ +extern size_t strlen(const char * /*s*/); + /* + * computes the length of the string pointed to by s. + * Returns: the number of characters that precede the terminating null + * character. + */ + +#ifdef __cplusplus +} +#endif + +#endif + +/* end of string.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/TIME.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/TIME.H new file mode 100644 index 0000000..dbc403a --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/TIME.H @@ -0,0 +1,182 @@ +#pragma force_top_level +#pragma include_only_once + +/* time.h: ANSI 'C' (X3J11 Oct 88) library header, section 4.12 */ +/* Copyright (C) Codemist Ltd., 1988-1993. */ +/* Copyright (C) Advanced Risc Machines Ltd., 1991-1993. */ +/* version 0.03 */ + +/* + * time.h declares two macros, four types and several functions for + * manipulating time. Many functions deal with a calendar time that represents + * the current date (according to the Gregorian calendar) and time. Some + * functions deal with local time, which is the caledar time expressed for some + * specific time zone, and with Dalight Savings Time, which is a temporary + * change in the algorithm for determining local time. + */ + +#ifndef __time_h +#define __time_h + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef __size_t +#define __size_t 1 +typedef unsigned int size_t; /* from */ +#endif + +#ifndef NULL +# define NULL 0 +#endif + +#ifdef __CLK_TCK +# define CLK_TCK __CLK_TCK /* Pre-Dec 88 Draft; under threat */ +# define CLOCKS_PER_SEC __CLK_TCK /* Dec 1988 Draft */ +#else +# define CLK_TCK 100 /* for the BBC */ +# define CLOCKS_PER_SEC 100 /* for the BBC */ + /* the number per second of the value returned by the clock function. */ +#endif + +typedef unsigned int clock_t; /* cpu time type - in centisecs on bbc */ +typedef unsigned int time_t; /* date/time in unix secs past 1-Jan-70 */ + +struct tm { + int tm_sec; /* seconds after the minute, 0 to 60 + (0 - 60 allows for the occasional leap second) */ + int tm_min; /* minutes after the hour, 0 to 59 */ + int tm_hour; /* hours since midnight, 0 to 23 */ + int tm_mday; /* day of the month, 1 to 31 */ + int tm_mon; /* months since January, 0 to 11 */ + int tm_year; /* years since 1900 */ + int tm_wday; /* days since Sunday, 0 to 6 */ + int tm_yday; /* days since January 1, 0 to 365 */ + int tm_isdst; /* Daylight Savings Time flag */ +}; + /* struct tm holds the components of a calendar time, called the broken-down + * time. The value of tm_isdst is positive if Daylight Savings Time is in + * effect, zero if Daylight Savings Time is not in effect, and negative if + * the information is not available. + */ + +extern clock_t clock(void); + /* determines the processor time used. + * Returns: the implementation's best approximation to the processor time + * used by the program since program invocation. The time in + * seconds is the value returned divided by the value of the macro + * CLK_TCK. The value (clock_t)-1 is returned if the processor time + * used is not available. + */ +extern double difftime(time_t /*time1*/, time_t /*time0*/); + /* + * computes the difference between two calendar times: time1 - time0. + * Returns: the difference expressed in seconds as a double. + */ +extern time_t mktime(struct tm * /*timeptr*/); + /* + * converts the broken-down time, expressed as local time, in the structure + * pointed to by timeptr into a calendar time value with the same encoding + * as that of the values returned by the time function. The original values + * of the tm_wday and tm_yday components of the structure are ignored, and + * the original values of the other components are not restricted to the + * ranges indicated above. On successful completion, the values of the + * tm_wday and tm_yday structure components are set appropriately, and the + * other components are set to represent the specified calendar time, but + * with their values forced to the ranges indicated above; the final value + * of tm_mday is not set until tm_mon and tm_year are determined. + * Returns: the specified calendar time encoded as a value of type time_t. + * If the calendar time cannot be represented, the function returns + * the value (time_t)-1. + */ +extern time_t time(time_t * /*timer*/); + /* + * determines the current calendar time. The encoding of the value is + * unspecified. + * Returns: the implementations best approximation to the current calendar + * time. The value (time_t)-1 is returned if the calendar time is + * not available. If timer is not a null pointer, the return value + * is also assigned to the object it points to. + */ + +extern char *asctime(const struct tm * /*timeptr*/); + /* + * converts the broken-down time in the structure pointed to by timeptr into + * a string in the form Sun Sep 16 01:03:52 1973\n\0. + * Returns: a pointer to the string containing the date and time. + */ +extern char *ctime(const time_t * /*timer*/); + /* + * converts the calendar time pointed to by timer to local time in the form + * of a string. It is equivalent to asctime(localtime(timer)); + * Returns: the pointer returned by the asctime function with that + * broken-down time as argument. + */ +extern struct tm *gmtime(const time_t * /*timer*/); + /* + * converts the calendar time pointed to by timer into a broken-down time, + * expressed as Greenwich Mean Time (GMT). + * Returns: a pointer to that object or a null pointer if GMT not available. + */ +extern struct tm *localtime(const time_t * /*timer*/); + /* + * converts the calendar time pointed to by timer into a broken-down time, + * expressed a local time. + * Returns: a pointer to that object. + */ +extern size_t strftime(char * /*s*/, size_t /*maxsize*/, + const char * /*format*/, const struct tm * /*timeptr*/); + /* + * places characters into the array pointed to by s as controlled by the + * string pointed to by format. The format string consists of zero or more + * directives and ordinary characters. A directive consists of a % character + * followed by a character that determines the directive's behaviour. All + * ordinary characters (including the terminating null character) are copied + * unchanged into the array. No more than maxsize characters are placed into + * the array. Each directive is replaced by appropriate characters as + * described in the following list. The appropriate characters are + * determined by the LC_TIME category of the current locale and by the + * values contained in the structure pointed to by timeptr. + * %a is replaced by the locale's abbreviated weekday name. + * %A is replaced by the locale's full weekday name. + * %b is replaced by the locale's abbreviated month name. + * %B is replaced by the locale's full month name. + * %c is replaced by the locale's appropriate date and time representation. + * %d is replaced by the day of the month as a decimal number (01-31). + * %H is replaced by the hour (24-hour clock) as a decimal number (00-23). + * %I is replaced by the hour (12-hour clock) as a decimal number (01-12). + * %j is replaced by the day of the year as a decimal number (001-366). + * %m is replaced by the month as a decimal number (01-12). + * %M is replaced by the minute as a decimal number (00-59). + * %p is replaced by the locale's equivalent of either AM or PM designations + * associated with a 12-hour clock. + * %S is replaced by the second as a decimal number (00-61). + * %U is replaced by the week number of the year (Sunday as the first day of + * week 1) as a decimal number (00-53). + * %w is replaced by the weekday as a decimal number (0(Sunday) - 6). + * %W is replaced by the week number of the year (Monday as the first day of + * week 1) as a decimal number (00-53). + * %x is replaced by the locale's appropriate date representation. + * %X is replaced by the locale's appropriate time representation. + * %y is replaced by the year without century as a decimal number (00-99). + * %Y is replaced by the year with century as a decimal number. + * %Z is replaced by the timezone name or abbreviation, or by no characters + * if no time zone is determinable. + * %% is replaced by %. + * If a directive is not one of the above, the behaviour is undefined. + * Returns: If the total number of resulting characters including the + * terminating null character is not more than maxsize, the + * strftime function returns the number of characters placed into + * the array pointed to by s not including the terminating null + * character. otherwise, zero is returned and the contents of the + * array are indeterminate. + */ + +#ifdef __cplusplus +} +#endif + +#endif + +/* end of time.h */ diff --git a/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/VARARGS.H b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/VARARGS.H new file mode 100644 index 0000000..24bca37 --- /dev/null +++ b/Bachelor/Mikroprozessorsysteme2/ARM202U/INCLUDE/VARARGS.H @@ -0,0 +1,26 @@ +#pragma force_top_level +#pragma include_only_once + +/* varargs.h: PCC 'C' library header - support for variadic function + * Copyright (C) Advanced Risc Machines Ltd., 1995 + */ + +/* + * RCS $Revision: 1.1 $ + * Checkin $Date: 1995/03/07 15:10:45 $ + * Revising $Author: amerritt $ + */ + +/* Defines a set of macros for handling variable length argument list + * in PCC style C. These macros rely on the compiler being able to + * accept the ... denotation. + */ + +typedef char *va_list; +#define va_alist int __va_alist, ... +#define va_dcl +#define va_start(list) list = (char *)&__va_alist +#define va_arg(list,mode) ((mode *)(list += sizeof(mode)))[-1] +#define va_end(list) + +/* end of varargs.h */ -- cgit v1.2.3