/* xa65 - 65xx/65816 cross-assembler and utility suite * * Copyright (C) 1989-1997 André Fachat (a.fachat@physik.tu-chemnitz.de) * * Memory manager/malloc() stub module * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include "xah.h" /* structs */ static int ninc = 0; static char **nip = NULL; void reg_include(char *path) { char **nip2; if(path && *path) { nip2 = realloc(nip,sizeof(char*)*(ninc+1)); if(nip2) { nip = nip2; nip[ninc++] = path; } else { fprintf(stderr,"Warning: couldn' alloc mem (reg_include)\n"); } } } FILE *xfopen(const char *fn,const char *mode) { FILE *file; char c,*cp,n[MAXLINE],path[MAXLINE]; char xname[MAXLINE], n2[MAXLINE]; int i,l=(int)strlen(fn); if(l>=MAXLINE) { fprintf(stderr,"filename '%s' too long!\n",fn); return NULL; } // copy to xname by replacing windows backslashes with the proper DIRCHAR for(i=0;i