1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
/*-----------------------------------------------------------------------
File : cle_kbdesc.c
Author: Stephan Schulz
Contents
Dealing with kb-descriptions.
Copyright 1998, 1999 by the author.
This code is released under the GNU General Public Licence and
the GNU Lesser General Public License.
See the file COPYING in the main E directory for details..
Run "eprover -h" for contact information.
Changes
<1> Tue Jul 27 16:07:14 MET DST 1999
New
-----------------------------------------------------------------------*/
#include "cle_kbdesc.h"
#include "e_version.h"
/*---------------------------------------------------------------------*/
/* Global Variables */
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
/* Forward Declarations */
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
/* Internal Functions */
/*---------------------------------------------------------------------*/
/*---------------------------------------------------------------------*/
/* Exported Functions */
/*---------------------------------------------------------------------*/
/*-----------------------------------------------------------------------
//
// Function: KBDescAlloc()
//
// Return an initialized KBDesc-Cell.
//
// Global Variables: -
//
// Side Effects : Memory operations
//
/----------------------------------------------------------------------*/
KBDesc_p KBDescAlloc(char* version, double neg_prop, long
neg_examples)
{
KBDesc_p handle = KBDescCellAlloc();
handle->version = SecureStrdup(version);
handle->neg_proportion = neg_prop;
handle->fail_neg_examples = neg_examples;
return handle;
}
/*-----------------------------------------------------------------------
//
// Function: KBDescFree()
//
// Free a KBDesc.
//
// Global Variables: -
//
// Side Effects : Memory operations
//
/----------------------------------------------------------------------*/
void KBDescFree(KBDesc_p desc)
{
FREE(desc->version);
KBDescCellFree(desc);
}
/*-----------------------------------------------------------------------
//
// Function: KBDescPrint()
//
// Print a kb-description.
//
// Global Variables: -
//
// Side Effects : -
//
/----------------------------------------------------------------------*/
void KBDescPrint(FILE* out, KBDesc_p desc)
{
fprintf(out,
"# E theorem prover knowledge base description\n"
"Version : \"%s\"\n"
"NegProp : %8f # "
"Negative example proportion (successful proof search)\n"
"FailExamples: %8ld # "
"Number of clauses from a failed proof search\n",
desc->version,
desc->neg_proportion,
desc->fail_neg_examples);
}
/*-----------------------------------------------------------------------
//
// Function: KBDescParse()
//
// Parse a KB0Description.
//
// Global Variables: -
//
// Side Effects : -
//
/----------------------------------------------------------------------*/
KBDesc_p KBDescParse(Scanner_p in)
{
KBDesc_p handle = KBDescCellAlloc();
AcceptInpId(in, "Version");
AcceptInpTok(in, Colon);
CheckInpTok(in, String);
handle->version = DStrCopy(AktToken(in)->literal);
if(strcmp(handle->version, KB_VERSION) > 0)
{
Error("Knowledge base is younger than your tool set. Please"
" update from" E_URL, USAGE_ERROR);
}
NextToken(in);
AcceptInpId(in, "NegProp");
AcceptInpTok(in, Colon);
handle->neg_proportion = ParseFloat(in);
AcceptInpId(in, "FailExamples");
AcceptInpTok(in, Colon);
handle->fail_neg_examples = AktToken(in)->numval;
AcceptInpTok(in, PosInt);
return handle;
}
/*-----------------------------------------------------------------------
//
// Function: KBFileName()
//
// Build a kb-file name in name and return a pointer to it.
//
// Global Variables:
//
// Side Effects :
//
/----------------------------------------------------------------------*/
char* KBFileName(DStr_p name, char *basename, char* file)
{
DStrReset(name);
DStrAppendStr(name, basename);
DStrAppendStr(name, "/");
DStrAppendStr(name, file);
return DStrView(name);
}
/*---------------------------------------------------------------------*/
/* End of File */
/*---------------------------------------------------------------------*/
|