You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
+/*
+ * Herbert 06/12/2000:
+ * - OS2 drive specs like WIN32
+ * - Includes for IBMs OS/2 compiler
+ */
+
# include <ctype.h>
# include <stdio.h>
# include <signal.h>
# include <string.h>
-# ifndef WIN32
+# if !(defined (WIN32) || defined (OS2) && defined (__IBMC__))
# include <unistd.h>
# endif
# include <sys/stat.h>
# include <fcntl.h>
-# ifdef WIN32
+# if defined (WIN32) || defined (OS2) && defined (__IBMC__)
# include <io.h>
# include <sys/utime.h> /* for __DATE__ and __TIME__ */
# include <time.h>
static void cppReader_scanBuffer (cppReader *p_pfile);
-# ifdef WIN32
+# if defined (WIN32) || defined (OS2) && defined (__IBMC__)
/*
** WIN32 (at least the VC++ include files) does not define mode_t.
return 1;
} else {
llassert (kt->func != NULL);
- (void) (*kt->func) (pfile, kt, pfile->token_buffer + after_ident, line_end);
+ (void) (kt->func) (pfile, kt, pfile->token_buffer + after_ident, line_end);
return 1;
}
}
{
endpat->next = tpat;
/*@-branchstate@*/
- } /*:=branchstate@*/
+ } /*@=branchstate@*/ /* evs 2000 was =branchstate */
endpat = tpat;
hn = cppReader_installMacro (mdef.symnam, mdef.symlen, mdef.defn, hashcode);
/*@-branchstate@*/
- } /*:=branchstate@*/
+ } /*@=branchstate@*/
return 0;
{
colp = &dummy;
/*@-branchstate@*/
- } /*:=branchstate@*/
+ } /*@=branchstate@*/
if (pbuf != NULL)
{
int ivalue,
/*@only@*/ /*@null@*/ char *value, int hash)
{
- cstring sname = cstring_fromCharsNew (name);
+ cstring sname = cstring_fromChars (name);
+ /* evs 2000 07 10 - removed a memory leak, detected by lclint */
llassert (usymtab_inGlobalScope ());
fileloc_createBuiltin ());
usymtab_addGlobalEntry (ue);
}
- else
- {
- cstring_free (sname);
- }
(void) cppReader_install (name, len, type, ivalue, value, hash);
}
int angle_brackets = 0; /* 0 for "...", 1 for <...> */
f= -1; /* JF we iz paranoid! */
-
pfile->parsing_include_directive++;
token = get_directive_token (pfile);
pfile->parsing_include_directive--;
and put it in front of the search list. */
dsp[0].next = search_start;
search_start = dsp;
+
#ifndef VMS
ep = strrchr (nam, CONNECTCHAR);
#else /* VMS */
n = ep - nam;
save = nam[n];
nam[n] = '\0';
- dsp[0].fname = cstring_fromChars (nam);
+
+ /*@-onlytrans@*/ /* This looks like a memory leak... */
+ dsp[0].fname = cstring_fromCharsNew (nam); /* evs 2000-07-20: was fromChars */
+ /*@=onlytrans@*/
nam[n] = save;
if (n + INCLUDE_LEN_FUDGE > pfile->max_include_len)
flen = fend - fbeg;
+ DPRINTF (("fbeg: %s", fbeg));
+
if (flen == 0)
{
cppReader_error (pfile,
/* If specified file name is absolute, just open it. */
if (osd_isConnectChar (*fbeg)
-# ifdef WIN32
+# if defined (WIN32) || defined (OS2)
|| (*(fbeg + 1) == ':')
# endif
)
fname = cstring_copy (searchptr->fname);
fname = cstring_appendChar (fname, CONNECTCHAR);
+ DPRINTF (("Here: %s", fname));
}
else
{
}
fname = cstring_concatLength (fname, fbeg, flen);
+
+ DPRINTF (("fname: %s", fname));
+
#ifdef VMS
/* Change this 1/2 Unix 1/2 VMS file specification into a
full VMS file specification */
cstring_free (fname);
return 0;
}
-
+
+ DPRINTF (("Trying: %s", fname));
+
f = open_include_file (pfile, fname, searchptr);
if (f == IMPORT_FOUND)
pfile->system_include_depth--;
}
/*@-branchstate@*/
- } /*:=branchstate@*/
+ } /*@=branchstate@*/
return 0;
}
sfree (temp);
/*@switchbreak@*/ break;
default: ;
+ /*@-branchstate@*/
}
+ /*@=branchstate@*/
break;
}
len *= 2;
alloc = drealloc (alloc, len + 1);
set = alloc + len / 2;
- }
+ /*@-branchstate@*/ }
*set++ = ch;
- }
+ } /*@=branchstate@*/
}
*set = '\0';
check (ungetc (ch, f) != EOF);
while (left > 0)
{
-# ifdef WIN32
+# if defined (WIN32) || defined (OS2) && defined (__IBMC__)
/*@-compdef@*/ /* ptr is an out parameter */
int nchars = _read (desc, ptr, (unsigned) left);
/*@=compdef@*/
sizeof (include_defaults_array));
sfree (nstore);
- }
+ /*@-branchstate@*/ } /*@=branchstate@*/
}
cppReader_appendIncludeChain (pfile, opts->before_system,
{
fname = cstring_fromChars (removePreDirs (cstring_toCharsSafe (fname)));
-# ifdef WIN32
+# if defined (WIN32) || defined (OS2)
cstring_replaceAll (fname, '\\', '/');
# endif