Fixed a little bit-rot in clibrary.c

git-svn-id: http://picoc.googlecode.com/svn/trunk@455 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
zik.saleeba 2010-07-03 17:00:54 +00:00
parent 73a5d6a11b
commit ff7aadcc11
4 changed files with 14 additions and 4 deletions

View file

@ -59,14 +59,16 @@ void PrintType(struct ValueType *Typ, IOFILE *Stream)
* A more complete standard library for larger computers is in the library_XXX.c files.
*/
struct OutputStream CStdOut;
IOFILE *CStdOut;
IOFILE CStdOutBase;
static int TRUEValue = 1;
static int ZeroValue = 0;
void BasicIOInit()
{
CStdOut.Putch = &PlatformPutc;
CStdOutBase.Putch = &PlatformPutc;
CStdOut = &CStdOutBase;
}
/* initialise the C library */
@ -136,6 +138,12 @@ void PrintUnsigned(unsigned long Num, unsigned int Base, int FieldWidth, int Zer
PrintRepeatedChar(' ', FieldWidth - (sizeof(Result) - 1 - ResPos), Stream);
}
/* print an integer to a stream without using printf/sprintf */
void PrintSimpleInt(long Num, struct OutputStream *Stream)
{
PrintInt(Num, -1, FALSE, FALSE, Stream);
}
/* print an integer to a stream without using printf/sprintf */
void PrintInt(long Num, int FieldWidth, int ZeroPad, int LeftJustify, struct OutputStream *Stream)
{

View file

@ -18,6 +18,7 @@ struct IncludeLibrary *IncludeLibList = NULL;
/* initialise the built-in include libraries */
void IncludeInit()
{
#ifndef BUILTIN_MINI_STDLIB
IncludeRegister("ctype.h", NULL, &StdCtypeFunctions[0], NULL);
IncludeRegister("errno.h", &StdErrnoSetupFunc, NULL, NULL);
IncludeRegister("math.h", &MathSetupFunc, &MathFunctions[0], NULL);
@ -26,6 +27,7 @@ void IncludeInit()
IncludeRegister("stdlib.h", &StdlibSetupFunc, &StdlibFunctions[0], NULL);
IncludeRegister("string.h", &StringSetupFunc, &StringFunctions[0], NULL);
IncludeRegister("time.h", &StdTimeSetupFunc, &StdTimeFunctions[0], StdTimeDefs);
#endif
}
/* clean up space used by the include system */

View file

@ -15,7 +15,7 @@ void Initialise()
TypeInit();
IncludeInit();
#ifdef BUILTIN_MINI_STDLIB
LibraryInit(&GlobalTable, "c library", &CLibrary);
LibraryInit(&GlobalTable, "c library", &CLibrary[0]);
CLibraryInit();
#endif
PlatformLibraryInit();

View file

@ -385,7 +385,7 @@ void BasicIOInit();
void LibraryInit(struct Table *GlobalTable, const char *LibraryName, struct LibraryFunction *FuncList);
void CLibraryInit();
void PrintCh(char OutCh, IOFILE *Stream);
void PrintSimpleInt(long Num, FILE *Stream);
void PrintSimpleInt(long Num, IOFILE *Stream);
void PrintInt(long Num, int FieldWidth, int ZeroPad, int LeftJustify, IOFILE *Stream);
void PrintStr(const char *Str, IOFILE *Stream);
void PrintFP(double Num, IOFILE *Stream);