#ifndef _KTYPES_H
#define _KTYPES_H

/* ----------------------------------------------------- */

// KBOX is built around 64-bit chunks of memory
//    called klunks!
// all data is represented as a klunk
//    int64 is a 64-bit twos-complement representation
//    flt64 is a 64-bit IEEE floating point representation
//    chr64 is a 56-bit waste of space,
//         storing the 8-bit character in lowest byte
//    str64 is a 64-bit figment of the imagination!
//         like C it is a pointer to array of char
//              terminated by '\0'

#define LITERAL_SIZE 256

typedef unsigned long long int	klunk;

typedef long long int	int64;	// 64-bit signed integer
typedef double		flt64;	// 64-bit signed real
typedef char		chr64;	// 64-bit ASCII character
typedef char*		str64;	// 64-bit pointer

/* ----------------------------------------------------- */

// display the 64-bit contents of the klunk

void	show_int	(klunk);	// int64 value
void	show_flt	(klunk);	// flt64 value
void	show_chr	(klunk);	// chr64 value
void	show_str	(klunk);	// str64 value

void	show_hex	(klunk);	// raw hex value

/* ----------------------------------------------------- */

// conversion algorithms between data representations

int64	klunk2int	(klunk);	// klunk -> int64
flt64	klunk2flt	(klunk);	// klunk -> flt64
chr64	klunk2chr	(klunk);	// klunk -> chr64
str64	klunk2str	(klunk);	// klunk -> str64

klunk	int2klunk	(int64);	// int64 -> klunk
klunk	flt2klunk	(flt64);	// flt64 -> klunk
klunk	chr2klunk	(chr64);	// chr64 -> klunk
klunk	str2klunk	(str64);	// str64 -> klunk

klunk	literal2klunk	(str64);	// literal -> data

/* ----------------------------------------------------- */

#endif
