]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/TianoTools/Pccts/dlg/support.c
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Source / TianoTools / Pccts / dlg / support.c
diff --git a/Tools/Source/TianoTools/Pccts/dlg/support.c b/Tools/Source/TianoTools/Pccts/dlg/support.c
deleted file mode 100644 (file)
index 84fe99d..0000000
+++ /dev/null
@@ -1,240 +0,0 @@
-/*\r
- * SOFTWARE RIGHTS\r
- *\r
- * We reserve no LEGAL rights to the Purdue Compiler Construction Tool\r
- * Set (PCCTS) -- PCCTS is in the public domain.  An individual or\r
- * company may do whatever they wish with source code distributed with\r
- * PCCTS or the code generated by PCCTS, including the incorporation of\r
- * PCCTS, or its output, into commerical software.\r
- *\r
- * We encourage users to develop software with PCCTS.  However, we do ask\r
- * that credit is given to us for developing PCCTS.  By "credit",\r
- * we mean that if you incorporate our source code into one of your\r
- * programs (commercial product, research project, or otherwise) that you\r
- * acknowledge this fact somewhere in the documentation, research report,\r
- * etc...  If you like PCCTS and have developed a nice tool with the\r
- * output, please mention that you developed it using PCCTS.  In\r
- * addition, we ask that this header remain intact in our source code.\r
- * As long as these guidelines are kept, we expect to continue enhancing\r
- * this system and expect to make other tools available as they are\r
- * completed.\r
- *\r
- * DLG 1.33\r
- * Will Cohen\r
- * With mods by Terence Parr; AHPCRC, University of Minnesota\r
- * 1989-2001\r
- */\r
-\r
-#include <stdio.h>\r
-#include <string.h>\r
-#include "dlg.h"\r
-#ifdef MEMCHK\r
-#include "trax.h"\r
-#else\r
-#ifdef __STDC__\r
-#include <stdlib.h>\r
-#else\r
-#include <malloc.h>\r
-#endif /* __STDC__ */\r
-#endif\r
-\r
-int    err_found = 0;                  /* indicates whether problem found */\r
-\r
-#ifdef __USE_PROTOS\r
-void internal_error(char *s, char *file,int line)    /* MR9 23-Sep-97 */\r
-#else\r
-void internal_error(s,file,line)    /* MR9 23-Sep-97 */\r
-char *s,*file;\r
-int line;\r
-#endif\r
-{\r
-       fprintf(stderr,s,file,line);\r
-       exit(PCCTS_EXIT_FAILURE);\r
-}\r
-\r
-#ifdef __USE_PROTOS\r
-char *dlg_malloc(int bytes,char *file,int line)\r
-#else\r
-char *dlg_malloc(bytes,file,line)\r
-int bytes;\r
-char *file;\r
-int line;\r
-#endif\r
-{\r
-       char *t;\r
-\r
-       t = (char *) malloc(bytes);\r
-       if (!t){\r
-               /* error */\r
-               internal_error("%s(%d): unable to allocate memory\n",\r
-                       file,line);\r
-       }\r
-       return t;\r
-}\r
-\r
-\r
-#ifdef __USE_PROTOS\r
-char *dlg_calloc(int n,int bytes,char *file,int line)\r
-#else\r
-char *dlg_calloc(n,bytes,file,line)\r
-int n,bytes;\r
-char *file;\r
-int line;\r
-#endif\r
-{\r
-       char *t;\r
-\r
-       t = (char *) calloc(n,bytes);\r
-       if (!t){\r
-               /* error */\r
-               internal_error("%s(%d): unable to allocate memory\n",\r
-                       file,line);\r
-       }\r
-       return t;\r
-}\r
-\r
-\r
-#ifdef __USE_PROTOS\r
-FILE *read_stream(char *name)\r
-#else\r
-FILE *read_stream(name)\r
-char *name;\r
-#endif\r
-{\r
-       FILE *f;\r
-\r
-       if (name){\r
-               if (name[0] == '-') {\r
-                       fprintf(stderr, "dlg: invalid option: '%s'\n", name);\r
-                       f = NULL;\r
-               }else{\r
-                       f = fopen(name, "r");\r
-                       if (f == NULL){\r
-                               /* couldn't open file */\r
-                               fprintf(stderr,\r
-                                       "dlg: Warning: Can't read file %s.\n",\r
-                                       name);\r
-                       }\r
-               }\r
-       }else{\r
-               /* open stdin if nothing there */\r
-               f = stdin;\r
-       }\r
-       return f;\r
-}\r
-\r
-#ifdef __USE_PROTOS\r
-FILE *write_stream(char *name)\r
-#else\r
-FILE *write_stream(name)\r
-char *name;\r
-#endif\r
-{\r
-       FILE *f;\r
-\r
-       if (name){\r
-               if (name[0] == '-') {\r
-                       fprintf(stderr, "dlg: invalid option: '%s'\n", name);\r
-                       f = NULL;\r
-               }else{\r
-                       f = fopen(OutMetaName(name), "w");\r
-                       if (f == NULL){\r
-                               /* couldn't open file */\r
-                               fprintf(stderr,\r
-                                       "dlg: Warning: Can't write to file %s.\n",\r
-                                       name);\r
-                       }\r
-                       else\r
-#ifdef SPECIAL_FOPEN\r
-                special_fopen_actions(OutMetaName(name));      /* MR1 */\r
-#else\r
-               ;                                               /* MR1 */\r
-#endif\r
-               }\r
-       }else{\r
-               /* open stdout if nothing there */\r
-               f = stdout;\r
-       }\r
-       return f;\r
-}\r
-\r
-\r
-#ifdef __USE_PROTOS\r
-void fatal(char *message,int line_no)\r
-#else\r
-void fatal(message,line_no)\r
-char *message;\r
-int line_no;\r
-#endif\r
-{\r
-       fprintf(stderr,ErrHdr,\r
-               (file_str[0] ? file_str[0] : "stdin"), line_no);\r
-       fprintf(stderr, " Fatal: %s\n", message);\r
-       exit(PCCTS_EXIT_FAILURE);\r
-}\r
-\r
-#ifdef __USE_PROTOS\r
-void error(char *message,int line_no)\r
-#else\r
-void error(message,line_no)\r
-char *message;\r
-int line_no;\r
-#endif\r
-{\r
-       fprintf(stderr,ErrHdr,\r
-               (file_str[0] ? file_str[0] : "stdin"), line_no);\r
-       fprintf(stderr, " Error: %s\n", message);\r
-       err_found = 1;\r
-}\r
-\r
-#ifdef __USE_PROTOS\r
-void warning(char *message,int line_no)\r
-#else\r
-void warning(message,line_no)\r
-char *message;\r
-int line_no;\r
-#endif\r
-{\r
-       fprintf(stderr,ErrHdr,\r
-               (file_str[0] ? file_str[0] : "stdin"), line_no);\r
-       fprintf(stderr, " Warning: %s\n", message);\r
-}\r
-\r
-/* MR10: Jeff Vincent\r
-   MR10: Changed to remove directory information from n only if\r
-   MR10: if OutputDirectory was changed by user (-o option)\r
-*/\r
-\r
-#ifdef __USE_PROTOS\r
-char *OutMetaName(char *n)\r
-#else\r
-char *OutMetaName(n)\r
-char *n;\r
-#endif\r
-{      \r
-    static char *dir_sym = DirectorySymbol;\r
-    static char newname[MaxFileName+1];\r
-    char *p;\r
-\r
-       /* If OutputDirectory is same as TopDirectory (platform default) then leave n alone. */\r
-    if (strcmp(OutputDirectory, TopDirectory) == 0)\r
-               return n;\r
-\r
-       /* p will point to filename without path information */\r
-       if ((p = strrchr(n, *dir_sym)) != NULL)\r
-               p++;\r
-       else\r
-               p = n;\r
-\r
-       /* Copy new output directory into newname[] */\r
-       strcpy(newname, OutputDirectory);\r
-\r
-       /* if new output directory does not have trailing dir_sym, add it! */\r
-       if (newname[strlen(newname)-1] != *dir_sym)\r
-               strcat(newname, dir_sym);\r
-\r
-       /* contatenate FILE NAME ONLY to new output directory */\r
-       strcat(newname, p);\r
-\r
-       return newname;\r
-}\r