home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include "Kernel/h/emTypes.h"
- #include "Kernel/h/kmdTypes.h"
-
- void UnixStreamPutChar(f, c)
- FILE *f;
- char c;
- {
- #ifdef xsimul
- fprintf(f, "%c", c);
- #else
- printf("%c", c);
- #endif
- }
-
- void UnixStreamPutInt(f, d, w)
- FILE *f;
- int d, w;
- {
- #ifdef xsimul
- if (w < 0) fprintf(f, "%0*d", -w, d);
- else fprintf(f, "%*d", w, d);
- #else
- if (w < 0) printf("%0*d", -w, d);
- else printf("%*d", w, d);
- #endif
- }
-
- void UnixStreamPutReal(f, d)
- FILE *f;
- int d;
- {
- #ifdef xsimul
- fprintf(f, "%g", * (float *) &d);
- #else
- printf("%g", * (float *) &d);
- #endif
- }
-
- void UnixStreamPutString(f, s)
- FILE *f;
- StringPtr s;
- {
- #ifdef xsimul
- fprintf(f, "%.*s", s->sizeInBytes, (char *)&s->data[0]);
- #else
- printf("%.*s", s->sizeInBytes, &s->data[0]);
- #endif
- }
-
- void UnixStreamFlush(f)
- FILE *f;
- {
- #ifdef xsimul
- (void) fflush(f);
- #endif
- }
-
- void UnixStreamInit()
- {
- DebugMsg(5, "Unix Stream Init\n");
- KMDSetProcedure(UnixStreamFlush);
- KMDSetProcedure(UnixStreamPutString);
- KMDSetProcedure(UnixStreamPutReal);
- KMDSetProcedure(UnixStreamPutInt);
- KMDSetProcedure(UnixStreamPutChar);
- }
-