--- np2/common/_memory.c 2003/10/16 17:57:10 1.1 +++ np2/common/_memory.c 2003/11/14 07:37:28 1.2 @@ -1,12 +1,26 @@ #include "compiler.h" -#include "dosio.h" #define MEMTBLMAX 256 #define HDLTBLMAX 256 + #if defined(MEMTRACE) +#include "strres.h" +#include "dosio.h" + +#if defined(MACOS) +#define CRLITERAL "\r" +#define CRCONST str_cr +#elif defined(X11) || defined(SLZAURUS) +#define CRLITERAL "\n" +#define CRCONST str_lf +#else +#define CRLITERAL "\r\n" +#define CRCONST str_crlf +#endif + typedef struct { void *hdl; UINT size; @@ -21,13 +35,15 @@ typedef struct { static _MEMTBL memtbl[MEMTBLMAX]; static _HDLTBL hdltbl[HDLTBLMAX]; -static const char memstr[] = \ - "Handle Size Name\r\n" \ - "--------------------------------------------\r\n"; - -static const char hdlstr[] = \ - "Handle Name\r\n" \ - "-------------------------------------\r\n"; +static const char str_memhdr[] = \ + "Handle Size Name" CRLITERAL \ + "--------------------------------------------" CRLITERAL; + +static const char str_hdlhdr[] = \ + "Handle Name" CRLITERAL \ + "-------------------------------------" CRLITERAL; + +static const char str_memused[] = "memused: %d" CRLITERAL; void _meminit(void) { @@ -77,7 +93,7 @@ void _handle_append(void *hdl, const cha for (i=0; i>3] << (i & 7)) & 0x80) { SPRINTF(work, "%08lx %10u %s\r\n", @@ -134,12 +150,12 @@ void _memused(const char *filename) { file_write(fh, work, strlen(work)); } } - file_write(fh, "\r\n", 2); + file_write(fh, CRCONST, strlen(CRCONST)); } SPRINTF(work, "hdlused: %d\r\n", hdluses); file_write(fh, work, strlen(work)); if (hdluses) { - file_write(fh, hdlstr, strlen(hdlstr)); + file_write(fh, str_hdlhdr, strlen(str_hdlhdr)); for (i=0; i>3] << (i & 7)) & 0x80) { SPRINTF(work, "%08lx %s\r\n", @@ -147,7 +163,7 @@ void _memused(const char *filename) { file_write(fh, work, strlen(work)); } } - file_write(fh, "\r\n", 2); + file_write(fh, CRCONST, strlen(CRCONST)); } file_close(fh); }