Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /sml/trunk/src/runtime/config/gen-common.c
ViewVC logotype

View of /sml/trunk/src/runtime/config/gen-common.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (download) (as text) (annotate)
Sat Oct 4 23:33:09 1997 UTC (22 years, 6 months ago) by monnier
File size: 1112 byte(s)
Initial revision
/* gen-common.c
 *
 * COPYRIGHT (c) 1994 by AT&T Bell Laboratories.
 *
 * Common code for generating header files.
 */

#include <stdio.h>
#include "gen.h"

/* OpenFile:
 *
 * Open a generated file, and generate its header comment.
 */
FILE *OpenFile (char *fname, char *flag)
{
    FILE	*f;

    if ((f = fopen(fname, "w")) == NULL) {
	fprintf (stderr, "unable to open file \"%s\"\n", fname);
	exit (1);
    }

    fprintf (f, "/* %s\n", fname);
    fprintf (f, " *\n");
    fprintf (f, " * COPYRIGHT (c) 1995 by AT&T Bell Laboratories.\n");
    fprintf (f, " *\n");
    fprintf (f, " * NOTE: this file is generated --- do not edit!!!\n");
    fprintf (f, " */\n");
    fprintf (f, "\n");
    if (flag != (char *)0) {
	fprintf (f, "#ifndef %s\n", flag);
	fprintf (f, "#define %s\n", flag);
	fprintf (f, "\n");
    }

    return f;

} /* end of OpenFile */


/* CloseFile:
 *
 * Generate the file trailer, and close the generated file.
 */
void CloseFile (FILE *f, char *flag)
{
    if (flag != (char *)0) {
	fprintf (f, "\n");
	fprintf (f, "#endif /* !%s */\n", flag);
    }

    fclose (f);

} /* CloseFile */

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0