src/Tools/qed.cc
author wenzelm
Tue, 20 May 1997 19:29:50 +0200
changeset 3257 4e3724e0659f
parent 902 cc80f53b28c6
permissions -rw-r--r--
README generation;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     1
// Little utility to convert result() -> qed ... in Isabelle's files
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
     2
// Written in 1995 by Carsten Clasohm (clasohm@informatik.tu-muenchen.de)
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     3
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     4
#define LIN_LEN   1000		// maximal length of lines in sourcefile
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     5
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     6
#include <iostream.h>
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     7
#include <fstream.h>
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     8
#include <string.h>
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
     9
#include <assert.h>
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    10
#include <stdio.h>
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    11
#include <unistd.h>
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    12
#include <ctype.h>
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    13
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    14
// Null terminated list of theorem names that must not be included in the
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    15
// theorem database
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    16
char * excludeName[] = {"temp", "tmp", 0};
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    17
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    18
int ExcludeThm(char *name)
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    19
{
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    20
    for (int i = 0; excludeName[i]; i++)
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    21
	if (strcmp(name, excludeName[i]) == 0)
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    22
	    return 1;
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    23
    return 0;
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    24
}
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    25
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    26
main(int argc, char *argv[])
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    27
{
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    28
    char l[LIN_LEN];
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    29
    int lines = 0;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    30
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    31
    // Open input and output files
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    32
    ifstream in(argv[1]);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    33
    ofstream out(argv[2]);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    34
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    35
    if (in.bad() || out.bad())
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    36
    {
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    37
        cerr << "qed version 1.00, Written in 1994 by Carsten Clasohm"
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    38
                "(clasohm@informatik.tu-muenchen.de)\n\n";
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    39
	cerr << "Usage: qed <infile> <outfile>\n";
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    40
	exit(1);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    41
    }
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    42
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    43
#ifdef DEBUG
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    44
    cerr << "Processing file " << argv[1] << '\n';
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    45
#endif
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    46
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    47
    // Process each line separatly
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    48
    in.getline(l, LIN_LEN);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    49
    while (!in.eof())
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    50
    {
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    51
	char *rPos;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    52
	char *valPos;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    53
	char *eqPos;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    54
	char *tmp;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    55
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    56
	if ((rPos = strstr(l, "result()")) && (!isalnum(*(rPos-1)))
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    57
	    && (valPos = strstr(l, "val ")) && (eqPos = strstr(l, "=")))
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    58
	{                            // does line contain "result()" and "val"?
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    59
	    char name[LIN_LEN];
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    60
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    61
	    assert(eqPos-(valPos+4) > 0);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    62
	    strncpy(name, valPos+4, eqPos-(valPos+4));
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    63
	    name[eqPos-(valPos+4)] = 0;
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    64
	    if (!isalnum(name[eqPos-(valPos+4)-1]))
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    65
	        name[eqPos-(valPos+4)-1] = 0;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    66
#ifdef DEBUG
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    67
	    cerr << "Found result: \"" << name << "\"\n";
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    68
#endif
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    69
	    char prefix[LIN_LEN];
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    70
	    char arg[LIN_LEN];
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    71
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    72
	    if (ExcludeThm(name))
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    73
		out << l << '\n';
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    74
	    else if ((rPos - eqPos < 5) && (rPos == strstr(l, "result();")))
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    75
	    {                                              // replace by "qed"?
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    76
		strncpy(prefix, l, valPos-l);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    77
		prefix[valPos-l] = 0;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    78
		out << prefix << "qed \"" << name << "\";" << '\n';
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    79
	    }
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    80
	    else				         // replace by bind_thm
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    81
	    {                                           
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    82
		int d = (*(eqPos+1) == ' ') ? 2 : 1;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    83
		strcpy(arg, eqPos+d);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    84
		arg[strlen(arg)-1] = 0;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    85
		strcpy(prefix, l);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    86
		prefix[valPos-l] = 0;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    87
		out << prefix << "bind_thm(\"" << name << "\", "
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    88
		    << arg << ");\n";
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    89
	    }
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    90
	}
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    91
	else if ((rPos = strstr(l, "prove_goal")) 
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    92
		 && (!isalnum(*(rPos-1))) 
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
    93
		 && (!isalnum(*(rPos+10)) || (*(rPos+10) == 'w'))
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    94
		 && (valPos = strstr(l, "val ")) 
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    95
		 && (eqPos = strstr(l, "="))
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    96
                 && (rPos - eqPos < 5))
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    97
	{                                    // replace prove_goal by qed_goal?
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    98
	    char name[LIN_LEN];
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
    99
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   100
	    assert(eqPos-(valPos+4) > 0);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   101
	    strncpy(name, valPos+4, eqPos-(valPos+4));
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   102
	    name[eqPos-(valPos+4)] = 0;
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   103
	    if (!isalnum(name[eqPos-(valPos+4)-1]))
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   104
	        name[eqPos-(valPos+4)-1] = 0;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   105
#ifdef DEBUG
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   106
	    cerr << "Found prove_goal: \"" << name << "\"\n";
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   107
#endif
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   108
	    if (ExcludeThm(name))
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   109
		out << l << '\n';
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   110
	    else
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   111
	    {
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   112
	        char prefix[LIN_LEN];
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   113
	        char arg[LIN_LEN];
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   114
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   115
	        strncpy(prefix, l, valPos-l);
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   116
	        prefix[valPos-l] = 0;
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   117
	        out << prefix << "qed_goal"
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   118
                    << ((*(rPos+10) == 'w') ? "w " : " ")
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   119
		    << '\"' << name << '\"' << strchr(rPos, ' ') << '\n';
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   120
	    }
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   121
	}
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   122
	else if ((rPos = strstr(l, "standard"))
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   123
		 && (!isalnum(*(rPos-1))) 
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   124
		 && (!isalnum(*(rPos+8))) 
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   125
		 && (valPos = strstr(l, "val ")) 
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   126
		 && (eqPos = strstr(l, "="))
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   127
                 && (rPos - eqPos < 5)
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   128
                 && (l[strlen(l)-1] == ';'))
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   129
	{                                                   // insert bind_thm?
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   130
	    char name[LIN_LEN];
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   131
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   132
	    assert(eqPos-(valPos+4) > 0);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   133
	    strncpy(name, valPos+4, eqPos-(valPos+4));
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   134
	    name[eqPos-(valPos+4)] = 0;
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   135
	    if (!isalnum(name[eqPos-(valPos+4)-1]))
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   136
	        name[eqPos-(valPos+4)-1] = 0;
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   137
#ifdef DEBUG
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   138
	    cerr << "Found standard: \"" << name << "\"\n";
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   139
#endif
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   140
	    if (ExcludeThm(name))
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   141
		out << l << '\n';
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   142
	    else
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   143
	    {
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   144
	        char prefix[LIN_LEN];
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   145
	        char arg[LIN_LEN];
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   146
902
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   147
	        strncpy(prefix, l, valPos-l);
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   148
	        prefix[valPos-l] = 0;
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   149
	        strcpy(l+strlen(l)-1, ");");    // insert ")" before line's ';'
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   150
	        out << prefix << "bind_thm (\"" << name << "\","
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   151
	            << strchr(rPos, ' ') << '\n';
cc80f53b28c6 added ExcludeThm; cleaned up Makefile; fixed isalpha bug (replaced by isalnum)
clasohm
parents: 813
diff changeset
   152
            }
813
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   153
	}
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   154
	else                                           // output line unchanged
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   155
	    out << l << '\n';
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   156
	in.getline(l, LIN_LEN);
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   157
    }
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   158
    in.close();
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   159
    out.close();
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   160
#ifdef DEBUG
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   161
    cerr << "Done\n";
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   162
#endif
4a266c3d4cc0 qed is a utility that makes ML files store the defined theories in Isabelle's
clasohm
parents:
diff changeset
   163
}