Diff for /np2/common/_memory.c between versions 1.1.1.1 and 1.3

version 1.1.1.1, 2003/10/16 17:57:10 version 1.3, 2005/02/07 14:46:08
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 #include        "dosio.h"  
   
   
 #define MEMTBLMAX       256  #define MEMTBLMAX       256
 #define HDLTBLMAX       256  #define HDLTBLMAX       256
   
   
 #if defined(MEMTRACE)  #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 {  typedef struct {
         void    *hdl;          void    *hdl;
         UINT    size;          UINT    size;
Line 21  typedef struct { Line 35  typedef struct {
 static _MEMTBL  memtbl[MEMTBLMAX];  static _MEMTBL  memtbl[MEMTBLMAX];
 static _HDLTBL  hdltbl[HDLTBLMAX];  static _HDLTBL  hdltbl[HDLTBLMAX];
   
 static const char memstr[] =                                                                            \  static const char str_memhdr[] =                                                                                        \
                                 "Handle   Size       Name\r\n"                                          \                                  "Handle   Size       Name" CRLITERAL                                            \
                                 "--------------------------------------------\r\n";                                  "--------------------------------------------" CRLITERAL;
   
 static const char hdlstr[] =                                                                            \  static const char str_hdlhdr[] =                                                                                        \
                                 "Handle   Name\r\n"                                                                     \                                  "Handle   Name" CRLITERAL                                                                       \
                                 "-------------------------------------\r\n";                                  "-------------------------------------" CRLITERAL;
   
   static const char str_memused[] = "memused: %d" CRLITERAL;
   
 void _meminit(void) {  void _meminit(void) {
   
Line 77  void _handle_append(void *hdl, const cha Line 93  void _handle_append(void *hdl, const cha
                 for (i=0; i<HDLTBLMAX; i++) {                  for (i=0; i<HDLTBLMAX; i++) {
                         if (hdltbl[i].hdl == NULL) {                          if (hdltbl[i].hdl == NULL) {
                                 hdltbl[i].hdl = hdl;                                  hdltbl[i].hdl = hdl;
                                 milstr_ncpy(hdltbl[i].name, name, sizeof(hdltbl[0].name)));                                  milstr_ncpy(hdltbl[i].name, name, sizeof(hdltbl[0].name));
                                 break;                                  break;
                         }                          }
                 }                  }
Line 126  void _memused(const char *filename) { Line 142  void _memused(const char *filename) {
                 SPRINTF(work, "memused: %d\r\n", memuses);                  SPRINTF(work, "memused: %d\r\n", memuses);
                 file_write(fh, work, strlen(work));                  file_write(fh, work, strlen(work));
                 if (memuses) {                  if (memuses) {
                         file_write(fh, memstr, strlen(memstr));                          file_write(fh, str_memhdr, strlen(str_memhdr));
                         for (i=0; i<MEMTBLMAX; i++) {                          for (i=0; i<MEMTBLMAX; i++) {
                                 if ((memusebit[i>>3] << (i & 7)) & 0x80) {                                  if ((memusebit[i>>3] << (i & 7)) & 0x80) {
                                         SPRINTF(work, "%08lx %10u %s\r\n",                                          SPRINTF(work, "%08lx %10u %s\r\n",
Line 134  void _memused(const char *filename) { Line 150  void _memused(const char *filename) {
                                         file_write(fh, work, strlen(work));                                          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);                  SPRINTF(work, "hdlused: %d\r\n", hdluses);
                 file_write(fh, work, strlen(work));                  file_write(fh, work, strlen(work));
                 if (hdluses) {                  if (hdluses) {
                         file_write(fh, hdlstr, strlen(hdlstr));                          file_write(fh, str_hdlhdr, strlen(str_hdlhdr));
                         for (i=0; i<HDLTBLMAX; i++) {                          for (i=0; i<HDLTBLMAX; i++) {
                                 if ((hdlusebit[i>>3] << (i & 7)) & 0x80) {                                  if ((hdlusebit[i>>3] << (i & 7)) & 0x80) {
                                         SPRINTF(work, "%08lx %s\r\n",                                          SPRINTF(work, "%08lx %s\r\n",
Line 147  void _memused(const char *filename) { Line 163  void _memused(const char *filename) {
                                         file_write(fh, work, strlen(work));                                          file_write(fh, work, strlen(work));
                                 }                                  }
                         }                          }
                         file_write(fh, "\r\n", 2);                          file_write(fh, CRCONST, strlen(CRCONST));
                 }                  }
                 file_close(fh);                  file_close(fh);
         }          }
Line 160  typedef struct { Line 176  typedef struct {
         UINT    size;          UINT    size;
 } _MEMTBL;  } _MEMTBL;
   
                 UINT    usedmemory;  
                 BOOL    chgmemory;                  BOOL    chgmemory;
                   UINT    usedmemory;
   
 static  _MEMTBL memtbl[MEMTBLMAX];  static  _MEMTBL memtbl[MEMTBLMAX];
   
 void _meminit(void) {  void _meminit(void) {

Removed from v.1.1.1.1  
changed lines
  Added in v.1.3


RetroPC.NET-CVS <cvs@retropc.net>