support.c revision 4fd606d1f5abe38e1f42c38de1d2e895166bd0f4
/*
* SOFTWARE RIGHTS
*
* We reserve no LEGAL rights to the Purdue Compiler Construction Tool
* Set (PCCTS) -- PCCTS is in the public domain. An individual or
* company may do whatever they wish with source code distributed with
* PCCTS or the code generated by PCCTS, including the incorporation of
* PCCTS, or its output, into commerical software.
*
* We encourage users to develop software with PCCTS. However, we do ask
* that credit is given to us for developing PCCTS. By "credit",
* we mean that if you incorporate our source code into one of your
* programs (commercial product, research project, or otherwise) that you
* acknowledge this fact somewhere in the documentation, research report,
* etc... If you like PCCTS and have developed a nice tool with the
* output, please mention that you developed it using PCCTS. In
* addition, we ask that this header remain intact in our source code.
* As long as these guidelines are kept, we expect to continue enhancing
* this system and expect to make other tools available as they are
* completed.
*
* DLG 1.33
* Will Cohen
* With mods by Terence Parr; AHPCRC, University of Minnesota
* 1989-2001
*/
#include <stdio.h>
#include <string.h>
#include "dlg.h"
#ifdef MEMCHK
#include "trax.h"
#else
#ifdef __STDC__
#include <stdlib.h>
#else
#include <malloc.h>
#endif /* __STDC__ */
#endif
int err_found = 0; /* indicates whether problem found */
#ifdef __USE_PROTOS
#else
char *s,*file;
int line;
#endif
{
}
#ifdef __USE_PROTOS
#else
int bytes;
char *file;
int line;
#endif
{
char *t;
if (!t){
/* error */
internal_error("%s(%d): unable to allocate memory\n",
}
return t;
}
#ifdef __USE_PROTOS
#else
int n,bytes;
char *file;
int line;
#endif
{
char *t;
if (!t){
/* error */
internal_error("%s(%d): unable to allocate memory\n",
}
return t;
}
#ifdef __USE_PROTOS
#else
char *name;
#endif
{
FILE *f;
if (name){
if (name[0] == '-') {
f = NULL;
}else{
if (f == NULL){
/* couldn't open file */
"dlg: Warning: Can't read file %s.\n",
name);
}
}
}else{
/* open stdin if nothing there */
f = stdin;
}
return f;
}
#ifdef __USE_PROTOS
#else
char *name;
#endif
{
FILE *f;
if (name){
if (name[0] == '-') {
f = NULL;
}else{
if (f == NULL){
/* couldn't open file */
"dlg: Warning: Can't write to file %s.\n",
name);
}
else
#ifdef SPECIAL_FOPEN
#else
; /* MR1 */
#endif
}
}else{
/* open stdout if nothing there */
f = stdout;
}
return f;
}
#ifdef __USE_PROTOS
#else
char *message;
int line_no;
#endif
{
}
#ifdef __USE_PROTOS
#else
char *message;
int line_no;
#endif
{
err_found = 1;
}
#ifdef __USE_PROTOS
#else
char *message;
int line_no;
#endif
{
}
/* MR10: Jeff Vincent
MR10: Changed to remove directory information from n only if
MR10: if OutputDirectory was changed by user (-o option)
*/
#ifdef __USE_PROTOS
char *OutMetaName(char *n)
#else
char *OutMetaName(n)
char *n;
#endif
{
static char *dir_sym = DirectorySymbol;
char *p;
/* If OutputDirectory is same as TopDirectory (platform default) then leave n alone. */
return n;
/* p will point to filename without path information */
p++;
else
p = n;
/* Copy new output directory into newname[] */
/* if new output directory does not have trailing dir_sym, add it! */
/* contatenate FILE NAME ONLY to new output directory */
return newname;
}