mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
Runtime routines implementing print<TYPE> for all basic types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1000 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
dd52255e9a
commit
1b20ca21c6
91
test/runtime.c
Normal file
91
test/runtime.c
Normal file
@ -0,0 +1,91 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
void
|
||||
printSByte(char c)
|
||||
{
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
void
|
||||
printUByte(unsigned char c)
|
||||
{
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
void
|
||||
printShort(short i)
|
||||
{
|
||||
printf("%d", i);
|
||||
}
|
||||
|
||||
void
|
||||
printUShort(unsigned short i)
|
||||
{
|
||||
printf("%d", i);
|
||||
}
|
||||
|
||||
void
|
||||
printInt(int i)
|
||||
{
|
||||
printf("%d", i);
|
||||
}
|
||||
|
||||
void
|
||||
printUInt(unsigned int i)
|
||||
{
|
||||
printf("%d", i);
|
||||
}
|
||||
|
||||
void
|
||||
printLong(int64_t l)
|
||||
{
|
||||
printf("%d", l);
|
||||
}
|
||||
|
||||
void
|
||||
printULong(uint64_t l)
|
||||
{
|
||||
printf("%d", l);
|
||||
}
|
||||
|
||||
void
|
||||
printString(const char* str)
|
||||
{
|
||||
printf("%s", str);
|
||||
}
|
||||
|
||||
void
|
||||
printFloat(float f)
|
||||
{
|
||||
printf("%g", f);
|
||||
}
|
||||
|
||||
void
|
||||
printDouble(double d)
|
||||
{
|
||||
printf("%g", d);
|
||||
}
|
||||
|
||||
#undef TEST_RUNTIME
|
||||
#ifdef TEST_RUNTIME
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
int i;
|
||||
printString("argc = ");
|
||||
printLong(argc);
|
||||
printString(" = (as float) ");
|
||||
printFloat(argc);
|
||||
printString(" = (as double) ");
|
||||
printDouble(argc);
|
||||
for (i=0; i < argc; i++)
|
||||
{
|
||||
printString("\nargv[");
|
||||
printLong(i);
|
||||
printString("] = ");
|
||||
printString(argv[i]);
|
||||
}
|
||||
printString("\n");
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user