- Renamed nearly all files. Now, we try to use singular terms.

Exception: states.h is the plural form.
This commit is contained in:
ccremers 2004-07-24 19:07:29 +00:00
parent bf991aa993
commit 60b02eea0e
34 changed files with 58 additions and 212 deletions

View File

@ -1,5 +1,5 @@
#include <stdlib.h> #include <stdlib.h>
#include "termmaps.h" #include "termmap.h"
#include "system.h" #include "system.h"
#include "error.h" #include "error.h"

View File

@ -1,13 +1,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "tac.h" #include "tac.h"
#include "terms.h" #include "term.h"
#include "termlists.h" #include "termlist.h"
#include "memory.h" #include "memory.h"
#include "system.h" #include "system.h"
#include "knowledge.h" #include "knowledge.h"
#include "symbols.h" #include "symbol.h"
#include "substitutions.h" #include "substitution.h"
#include "compiler.h" #include "compiler.h"
/* /*

View File

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include "memory.h" #include "memory.h"
#include "constraints.h" #include "constraint.h"
#include "debug.h" #include "debug.h"
#include "system.h" #include "system.h"

View File

@ -1,6 +1,6 @@
#ifndef CONSTRAINTS #ifndef CONSTRAINTS
#define CONSTRAINTS #define CONSTRAINTS
#include "terms.h" #include "term.h"
#include "knowledge.h" #include "knowledge.h"
struct constraint struct constraint

View File

@ -6,7 +6,7 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "termlists.h" #include "termlist.h"
#include "knowledge.h" #include "knowledge.h"
#include "memory.h" #include "memory.h"
#include "system.h" #include "system.h"

View File

@ -1,8 +1,8 @@
#ifndef KNOWLEDGE #ifndef KNOWLEDGE
#define KNOWLEDGE #define KNOWLEDGE
#include "terms.h" #include "term.h"
#include "termlists.h" #include "termlist.h"
//! Knowledge structure. //! Knowledge structure.
/** /**

View File

@ -40,9 +40,9 @@
#include "debug.h" #include "debug.h"
#include "modelchecker.h" #include "modelchecker.h"
#include "memory.h" #include "memory.h"
#include "symbols.h" #include "symbol.h"
#include "pheading.h" #include "pheading.h"
#include "symbols.h" #include "symbol.h"
#include "parser.h" #include "parser.h"
#include "tac.h" #include "tac.h"
#include "compiler.h" #include "compiler.h"

View File

@ -8,7 +8,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "memory.h" #include "memory.h"
#include "substitutions.h" #include "substitution.h"
#include "system.h" #include "system.h"
#include "modelchecker.h" #include "modelchecker.h"
#include "match_basic.h" #include "match_basic.h"

View File

@ -12,7 +12,7 @@
#include "match_clp.h" #include "match_clp.h"
#include "system.h" #include "system.h"
#include "memory.h" #include "memory.h"
#include "constraints.h" #include "constraint.h"
#include "mgu.h" #include "mgu.h"
#include "memory.h" #include "memory.h"
#include "debug.h" #include "debug.h"

View File

@ -22,10 +22,10 @@
/* for displaying the sizes */ /* for displaying the sizes */
#include "terms.h" #include "term.h"
#include "termlists.h" #include "termlist.h"
#include "knowledge.h" #include "knowledge.h"
#include "substitutions.h" #include "substitution.h"
#include "system.h" #include "system.h"
//! Open memory code. //! Open memory code.

View File

@ -1,8 +1,8 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "terms.h" #include "term.h"
#include "termlists.h" #include "termlist.h"
#include "substitutions.h" #include "substitution.h"
#include "mgu.h" #include "mgu.h"
#include "memory.h" #include "memory.h"

View File

@ -1,9 +1,9 @@
#ifndef MGU #ifndef MGU
#define MGU #define MGU
#include "terms.h" #include "term.h"
#include "termlists.h" #include "termlist.h"
#include "substitutions.h" #include "substitution.h"
//! A special constant do denote failure. //! A special constant do denote failure.
/** /**

View File

@ -7,7 +7,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#include "substitutions.h" #include "substitution.h"
#include "knowledge.h" #include "knowledge.h"
#include "system.h" #include "system.h"
#include "debug.h" #include "debug.h"
@ -19,7 +19,7 @@
#include "output.h" #include "output.h"
#include "tracebuf.h" #include "tracebuf.h"
#include "attackminimize.h" #include "attackminimize.h"
#include "claims.h" #include "claim.h"
/* /*

View File

@ -5,9 +5,9 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "terms.h" #include "term.h"
#include "termlists.h" #include "termlist.h"
#include "symbols.h" #include "symbol.h"
#include "system.h" #include "system.h"
#include "tac.h" #include "tac.h"
#endif #endif

View File

@ -1,6 +1,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "terms.h" #include "term.h"
#include "system.h" #include "system.h"
#include "debug.h" #include "debug.h"
#include "output.h" #include "output.h"

View File

@ -5,16 +5,16 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#include "terms.h" #include "term.h"
#include "termlists.h" #include "termlist.h"
#include "knowledge.h" #include "knowledge.h"
#include "system.h" #include "system.h"
#include "memory.h" #include "memory.h"
#include "constraints.h" #include "constraint.h"
#include "debug.h" #include "debug.h"
#include "output.h" #include "output.h"
#include "tracebuf.h" #include "tracebuf.h"
#include "roles.h" #include "role.h"
extern int globalLatex; // from system.c extern int globalLatex; // from system.c

View File

@ -1,11 +1,11 @@
#ifndef ROLES #ifndef ROLES
#define ROLES #define ROLES
#include "terms.h" #include "term.h"
#include "termmaps.h" #include "termmap.h"
#include "termlists.h" #include "termlist.h"
#include "knowledge.h" #include "knowledge.h"
#include "constraints.h" #include "constraint.h"
#include "states.h" #include "states.h"
#define READ 1 #define READ 1

View File

@ -1,7 +1,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "terms.h" #include "term.h"
#include "substitutions.h" #include "substitution.h"
#include "memory.h" #include "memory.h"
/* substitutions in terms */ /* substitutions in terms */

View File

@ -1,7 +1,7 @@
#ifndef SUBSTITUTIONS #ifndef SUBSTITUTIONS
#define SUBSTITUTIONS #define SUBSTITUTIONS
#include "termlists.h" #include "termlist.h"
#include "knowledge.h" #include "knowledge.h"
#include "system.h" #include "system.h"

View File

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "symbols.h" #include "symbol.h"
#include "memory.h" #include "memory.h"
/* /*

View File

@ -5,16 +5,16 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#include "terms.h" #include "term.h"
#include "termlists.h" #include "termlist.h"
#include "knowledge.h" #include "knowledge.h"
#include "system.h" #include "system.h"
#include "memory.h" #include "memory.h"
#include "constraints.h" #include "constraint.h"
#include "debug.h" #include "debug.h"
#include "output.h" #include "output.h"
#include "tracebuf.h" #include "tracebuf.h"
#include "roles.h" #include "role.h"
/* from compiler.o */ /* from compiler.o */
extern Term TERM_Type; extern Term TERM_Type;

View File

@ -1,13 +1,13 @@
#ifndef SYSTEM #ifndef SYSTEM
#define SYSTEM #define SYSTEM
#include "terms.h" #include "term.h"
#include "termmaps.h" #include "termmap.h"
#include "termlists.h" #include "termlist.h"
#include "knowledge.h" #include "knowledge.h"
#include "constraints.h" #include "constraint.h"
#include "states.h" #include "states.h"
#include "roles.h" #include "role.h"
#define runPointerGet(sys,run) sys->runs[run].index #define runPointerGet(sys,run) sys->runs[run].index
#define runPointerSet(sys,run,newp) sys->runs[run].index = newp #define runPointerSet(sys,run,newp) sys->runs[run].index = newp

View File

@ -1,7 +1,7 @@
#ifndef TAC_H #ifndef TAC_H
#define TAC_H #define TAC_H
#include "symbols.h" #include "symbol.h"
/* /*
* TAC instructions * TAC instructions

View File

@ -10,11 +10,11 @@
* pointer comparison, which is what we want. However, for comparison of terms * pointer comparison, which is what we want. However, for comparison of terms
*/ */
#include <strings.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#include "terms.h" #include "term.h"
#include "debug.h" #include "debug.h"
#include "memory.h" #include "memory.h"
#include "ctype.h" #include "ctype.h"

View File

@ -1,7 +1,7 @@
#ifndef TERMS #ifndef TERMS
#define TERMS #define TERMS
#include "symbols.h" #include "symbol.h"
#define GLOBAL 1 #define GLOBAL 1
#define VARIABLE 2 #define VARIABLE 2

View File

@ -1,6 +1,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "termlists.h" #include "termlist.h"
#include "debug.h" #include "debug.h"
#include "memory.h" #include "memory.h"

View File

@ -1,7 +1,7 @@
#ifndef TERMLISTS #ifndef TERMLISTS
#define TERMLISTS #define TERMLISTS
#include "terms.h" #include "term.h"
//! The list container for the term type. //! The list container for the term type.
/** /**

View File

@ -1,123 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include "termmaps.h"
#include "debug.h"
#include "memory.h"
//! Open termmaps code.
void
termmapsInit (void)
{
return;
}
//! Close termmaps code.
void
termmapsDone (void)
{
return;
}
//! Allocate memory for a termmap node.
/**
*@return A pointer to uninitialised memory of the size of a termmap node.
*/
Termmap
makeTermmap (void)
{
/* inline candidate */
return (Termmap) memAlloc (sizeof (struct termmap));
}
//! Get function result
/**
*@return Yields f(x), or -1 when it is not present.
*/
int
termmapGet (Termmap f, const Term x)
{
while (f != NULL)
{
if (isTermEqual (x, f->term))
return f->result;
f = f->next;
}
return -1;
}
//! Add a value to a function.
/**
*@return Adds f(x)=y to an existing function f. If f is NULL, a function is created. If x is already in the domain, the value is replaced.
*/
Termmap
termmapSet (const Termmap f, const Term x, const int y)
{
Termmap fscan;
//! Determine whether term already occurs
fscan = f;
while (fscan != NULL)
{
if (isTermEqual (x, fscan->term))
{
//! Is the result correct already?
if (fscan->result != y)
fscan->result = y;
return f;
}
fscan = fscan->next;
}
//! Not occurred yet, make new node
fscan = makeTermmap ();
fscan->term = x;
fscan->result = y;
fscan->next = f;
return fscan;
}
//! Duplicate a function
Termmap
termmapDuplicate (const Termmap f)
{
if (f != NULL)
{
Termmap g;
g = makeTermmap ();
g->term = f->term;
g->result = f->result;
g->next = termmapDuplicate (f->next);
return g;
}
else
{
return NULL;
}
}
//! Delete a function
void
termmapDelete (const Termmap f)
{
if (f != NULL)
{
termmapDelete (f->next);
memFree (f, sizeof (struct termmap));
}
}
//! Print a function
void termmapPrint (Termmap f)
{
if (f != NULL)
{
printf ("\"");
termPrint (f->term);
printf ("\" -> %i", f->result);
if (f->next != NULL)
{
printf (", ");
termmapPrint (f->next);
}
}
}

View File

@ -1,31 +0,0 @@
#ifndef TERMMAPS
#define TERMMAPS
#include "terms.h"
//! The function container for the term to integer function type.
/**
*\sa term
*/
struct termmap
{
//! The term element for this node.
Term term;
//! Next node pointer or NULL for the last element of the function.
struct termmap *next;
//! Function result
int result;
};
//! Shorthand for termmap pointers.
typedef struct termmap *Termmap;
void termmapsInit (void);
void termmapsDone (void);
int termmapGet (Termmap f, const Term x);
Termmap termmapSet (const Termmap f, const Term x, const int y);
Termmap termmapDuplicate (const Termmap f);
void termmapDelete (const Termmap f);
void termmapPrint (Termmap f);
#endif

View File

@ -1,8 +1,8 @@
#ifndef TRACEBUF #ifndef TRACEBUF
#define TRACEBUF #define TRACEBUF
#include "terms.h" #include "term.h"
#include "termlists.h" #include "termlist.h"
#include "knowledge.h" #include "knowledge.h"
#include "system.h" #include "system.h"