1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-26 12:49:21 +00:00

Improved C stdlib a little

This commit is contained in:
Jesper Gravgaard 2019-07-18 13:04:55 +02:00
parent 5a0b1a5d57
commit b70b969fe6
5 changed files with 40 additions and 3 deletions

View File

@ -0,0 +1,34 @@
// Defines constants with the limits of fundamental integral types for the specific system and compiler implementation used.
//TODO: Convert all limits to macros
// Number of bits in a char object (byte)
const char CHAR_BIT = 8;
// Minimum value of char type
const char CHAR_MIN = 0;
// Maximum value of char type
const char CHAR_MAX = 255;
// Minimum value of signed char type
const signed char SCHAR_MIN = -128;
// Maximum value of signed char type
const signed char SCHAR_MAX = 127;
// Maximum value of unsigned char type
const unsigned char UCHAR_MAX = 255;
// Minimum value of unsigned short type
const unsigned short USHRT_MAX = 65535;
// Minimum value signed short type
const short SHRT_MIN = -32768;
// Maximum value of signed short type
const short SHRT_MAX = 32767;
// Minimum value of unsigned int type
const unsigned int UINT_MAX = 65535;
// Minimum value signed int type
const int INT_MIN = -32768;
// Maximum value of signed int type
const int INT_MAX = 32767;
// Maximum value of unsigned long type
const unsigned long ULONG_MAX = 4194304;
// Minimum value of signed long type
const long LONG_MIN = -2097152;
// Maximum value of signed long type
const long LONG_MAX = 2097151;

View File

@ -1,3 +1,4 @@
// C standard library stdint.h
// Defines a set of integral type aliases with specific width requirements, along with macros specifying their limits and macro functions to create values of these types.
// Unsigned integer type with a width of exactly 8 bits

View File

@ -1,3 +1,4 @@
// C standard library stdlib.h
// Implementation of functions found int C stdlib.h / stdlib.c
import "string"

View File

@ -1,4 +1,5 @@
// Standard C strings.h - functions to manipulate C strings and arrays.
// C standard library string.h
// Functions to manipulate C strings and arrays.
typedef word size_t ;

View File

@ -1,4 +1,5 @@
// Implementation of library functions found in C standard library time.h
// C standard library time.h
// Functions to get and manipulate date and time information.
import "c64"
@ -34,4 +35,3 @@ void clock_start(void) {
*CIA2_TIMER_B_CONTROL = CIA_TIMER_CONTROL_START | CIA_TIMER_CONTROL_CONTINUOUS | CIA_TIMER_CONTROL_B_COUNT_UNDERFLOW_A;
*CIA2_TIMER_A_CONTROL = CIA_TIMER_CONTROL_START | CIA_TIMER_CONTROL_CONTINUOUS | CIA_TIMER_CONTROL_A_COUNT_CYCLES;
}