- Moved special terms into their own (very) special file.
This commit is contained in:
parent
db18b203a9
commit
b6e9841c0f
@ -32,16 +32,7 @@
|
|||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "type.h"
|
#include "type.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
|
#include "specialterm.h"
|
||||||
extern Term CLAIM_Secret;
|
|
||||||
extern Term CLAIM_Nisynch;
|
|
||||||
extern Term CLAIM_Niagree;
|
|
||||||
extern Term CLAIM_Empty;
|
|
||||||
|
|
||||||
extern Term TERM_Agent;
|
|
||||||
extern Term TERM_Hidden;
|
|
||||||
extern Term TERM_Function;
|
|
||||||
extern Term TERM_Nonce;
|
|
||||||
|
|
||||||
extern int *graph;
|
extern int *graph;
|
||||||
extern int nodes;
|
extern int nodes;
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "substitution.h"
|
#include "substitution.h"
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
|
#include "specialterm.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Simple sys pointer as a global. Yields cleaner code although it's against programming standards.
|
Simple sys pointer as a global. Yields cleaner code although it's against programming standards.
|
||||||
@ -34,8 +35,6 @@ extern int protocolCount;
|
|||||||
void tacProcess (Tac tc);
|
void tacProcess (Tac tc);
|
||||||
void levelInit (void);
|
void levelInit (void);
|
||||||
void levelDone (void);
|
void levelDone (void);
|
||||||
Term symbolDeclare (Symbol s, int isVar);
|
|
||||||
void levelTacDeclaration (Tac tc, int isVar);
|
|
||||||
Term levelFind (Symbol s, int i);
|
Term levelFind (Symbol s, int i);
|
||||||
Term symbolFind (Symbol s);
|
Term symbolFind (Symbol s);
|
||||||
Term tacTerm (Tac tc);
|
Term tacTerm (Tac tc);
|
||||||
@ -43,29 +42,6 @@ Termlist tacTermlist (Tac tc);
|
|||||||
Term levelDeclare (Symbol s, int isVar, int level);
|
Term levelDeclare (Symbol s, int isVar, int level);
|
||||||
void compute_role_variables (const System sys, Protocol p, Role r);
|
void compute_role_variables (const System sys, Protocol p, Role r);
|
||||||
|
|
||||||
#define levelDeclareVar(s) levelTacDeclaration(s,1)
|
|
||||||
#define levelDeclareConst(s) levelTacDeclaration(s,0)
|
|
||||||
#define levelVar(s) symbolDeclare(s,1)
|
|
||||||
#define levelConst(s) symbolDeclare(s,0)
|
|
||||||
|
|
||||||
/* externally used:
|
|
||||||
* TERM_Function in termlists.c for inversekeys
|
|
||||||
* TERM_Type in system.c for type determination.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Term TERM_Agent;
|
|
||||||
Term TERM_Function;
|
|
||||||
Term TERM_Hidden;
|
|
||||||
Term TERM_Type;
|
|
||||||
Term TERM_Nonce;
|
|
||||||
Term TERM_Ticket;
|
|
||||||
|
|
||||||
Term TERM_Claim;
|
|
||||||
Term CLAIM_Secret;
|
|
||||||
Term CLAIM_Nisynch;
|
|
||||||
Term CLAIM_Niagree;
|
|
||||||
Term CLAIM_Empty;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global stuff
|
* Global stuff
|
||||||
*/
|
*/
|
||||||
@ -92,24 +68,8 @@ compilerInit (const System mysys)
|
|||||||
level = -1;
|
level = -1;
|
||||||
levelInit ();
|
levelInit ();
|
||||||
|
|
||||||
/* Init system constants */
|
/* create special terms */
|
||||||
#define langhide(x,y) x = levelConst(symbolSysConst(" _" y "_ "))
|
specialTermInit (sys);
|
||||||
#define langtype(x,y) x->stype = termlistAdd(x->stype,y);
|
|
||||||
#define langcons(x,y,z) x = levelConst(symbolSysConst(y)); langtype(x,z)
|
|
||||||
|
|
||||||
langhide (TERM_Type, "Type");
|
|
||||||
langhide (TERM_Hidden, "Hidden");
|
|
||||||
langhide (TERM_Claim, "Claim");
|
|
||||||
|
|
||||||
langcons (TERM_Agent, "Agent", TERM_Type);
|
|
||||||
langcons (TERM_Function, "Function", TERM_Type);
|
|
||||||
langcons (TERM_Nonce, "Nonce", TERM_Type);
|
|
||||||
langcons (TERM_Ticket, "Ticket", TERM_Type);
|
|
||||||
|
|
||||||
langcons (CLAIM_Secret, "Secret", TERM_Claim);
|
|
||||||
langcons (CLAIM_Nisynch, "Nisynch", TERM_Claim);
|
|
||||||
langcons (CLAIM_Niagree, "Niagree", TERM_Claim);
|
|
||||||
langcons (CLAIM_Empty, "Empty", TERM_Claim);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Make a global constant
|
//! Make a global constant
|
||||||
|
@ -15,4 +15,12 @@ Term makeGlobalConstant (const char *s);
|
|||||||
Term makeGlobalVariable (const char *s);
|
Term makeGlobalVariable (const char *s);
|
||||||
void compute_role_variables (const System sys, Protocol p, Role r);
|
void compute_role_variables (const System sys, Protocol p, Role r);
|
||||||
|
|
||||||
|
Term symbolDeclare (Symbol s, int isVar);
|
||||||
|
void levelTacDeclaration (Tac tc, int isVar);
|
||||||
|
|
||||||
|
#define levelDeclareVar(s) levelTacDeclaration(s,1)
|
||||||
|
#define levelDeclareConst(s) levelTacDeclaration(s,0)
|
||||||
|
#define levelVar(s) symbolDeclare(s,1)
|
||||||
|
#define levelConst(s) symbolDeclare(s,0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "varbuf.h"
|
#include "varbuf.h"
|
||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "latex.h"
|
#include "latex.h"
|
||||||
|
#include "specialterm.h"
|
||||||
|
|
||||||
//! Multiplication factor for distance between events in an MSC diagram.
|
//! Multiplication factor for distance between events in an MSC diagram.
|
||||||
#define EVENTSPACE 1
|
#define EVENTSPACE 1
|
||||||
@ -22,7 +23,6 @@
|
|||||||
extern const char *progname;
|
extern const char *progname;
|
||||||
extern const char *releasetag;
|
extern const char *releasetag;
|
||||||
extern int globalLatex;
|
extern int globalLatex;
|
||||||
extern Term TERM_Function;
|
|
||||||
|
|
||||||
/*! Additional information for an events. */
|
/*! Additional information for an events. */
|
||||||
struct traceinfo
|
struct traceinfo
|
||||||
|
@ -58,6 +58,7 @@ enum exittypes
|
|||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "binding.h"
|
#include "binding.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
#include "specialterm.h"
|
||||||
|
|
||||||
#include "argtable2.h"
|
#include "argtable2.h"
|
||||||
|
|
||||||
@ -65,7 +66,6 @@ enum exittypes
|
|||||||
System sys;
|
System sys;
|
||||||
|
|
||||||
extern struct tacnode *spdltac;
|
extern struct tacnode *spdltac;
|
||||||
extern Term TERM_Claim;
|
|
||||||
extern int mgu_match;
|
extern int mgu_match;
|
||||||
|
|
||||||
void scanner_cleanup (void);
|
void scanner_cleanup (void);
|
||||||
|
@ -59,13 +59,12 @@ enum exittypes
|
|||||||
#include "output.h"
|
#include "output.h"
|
||||||
#include "binding.h"
|
#include "binding.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
|
#include "specialterm.h"
|
||||||
|
|
||||||
// The global system state
|
// The global system state
|
||||||
System sys;
|
System sys;
|
||||||
|
|
||||||
extern struct tacnode *spdltac;
|
extern struct tacnode *spdltac;
|
||||||
extern Term TERM_Claim;
|
|
||||||
extern Term CLAIM_Empty;
|
|
||||||
extern int mgu_match;
|
extern int mgu_match;
|
||||||
|
|
||||||
void scanner_cleanup (void);
|
void scanner_cleanup (void);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "mgu.h"
|
#include "mgu.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "type.h"
|
#include "type.h"
|
||||||
|
#include "specialterm.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Most General Unifier
|
Most General Unifier
|
||||||
@ -24,8 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
static int mgu_match = 0;
|
static int mgu_match = 0;
|
||||||
|
|
||||||
extern Term TERM_Hidden;
|
|
||||||
|
|
||||||
//! Set mgu mode (basically switches.match)
|
//! Set mgu mode (basically switches.match)
|
||||||
void
|
void
|
||||||
setMguMode (const int match)
|
setMguMode (const int match)
|
||||||
|
@ -21,17 +21,13 @@
|
|||||||
#include "attackminimize.h"
|
#include "attackminimize.h"
|
||||||
#include "claim.h"
|
#include "claim.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
|
#include "specialterm.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
A model checker. Really.
|
A model checker. Really.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern Term CLAIM_Secret;
|
|
||||||
extern Term CLAIM_Nisynch;
|
|
||||||
extern Term CLAIM_Niagree;
|
|
||||||
extern Term CLAIM_Empty;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Some forward declarations.
|
Some forward declarations.
|
||||||
*/
|
*/
|
||||||
|
51
src/specialterm.c
Normal file
51
src/specialterm.c
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "term.h"
|
||||||
|
#include "compiler.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some macros
|
||||||
|
*/
|
||||||
|
#define langhide(x,y) x = levelConst(symbolSysConst(" _" y "_ "))
|
||||||
|
#define langtype(x,y) x->stype = termlistAdd(x->stype,y);
|
||||||
|
#define langcons(x,y,z) x = levelConst(symbolSysConst(y)); langtype(x,z)
|
||||||
|
|
||||||
|
/* externally used:
|
||||||
|
*/
|
||||||
|
|
||||||
|
Term TERM_Agent;
|
||||||
|
Term TERM_Function;
|
||||||
|
Term TERM_Hidden;
|
||||||
|
Term TERM_Type;
|
||||||
|
Term TERM_Nonce;
|
||||||
|
Term TERM_Ticket;
|
||||||
|
|
||||||
|
Term TERM_Claim;
|
||||||
|
Term CLAIM_Secret;
|
||||||
|
Term CLAIM_Nisynch;
|
||||||
|
Term CLAIM_Niagree;
|
||||||
|
Term CLAIM_Empty;
|
||||||
|
|
||||||
|
//! Init special terms
|
||||||
|
/**
|
||||||
|
* This is called by compilerInit
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
specialTermInit (const System sys)
|
||||||
|
{
|
||||||
|
/* Init system constants */
|
||||||
|
|
||||||
|
langhide (TERM_Type, "Type");
|
||||||
|
langhide (TERM_Hidden, "Hidden");
|
||||||
|
langhide (TERM_Claim, "Claim");
|
||||||
|
|
||||||
|
langcons (TERM_Agent, "Agent", TERM_Type);
|
||||||
|
langcons (TERM_Function, "Function", TERM_Type);
|
||||||
|
langcons (TERM_Nonce, "Nonce", TERM_Type);
|
||||||
|
langcons (TERM_Ticket, "Ticket", TERM_Type);
|
||||||
|
|
||||||
|
langcons (CLAIM_Secret, "Secret", TERM_Claim);
|
||||||
|
langcons (CLAIM_Nisynch, "Nisynch", TERM_Claim);
|
||||||
|
langcons (CLAIM_Niagree, "Niagree", TERM_Claim);
|
||||||
|
langcons (CLAIM_Empty, "Empty", TERM_Claim);
|
||||||
|
}
|
21
src/specialterm.h
Normal file
21
src/specialterm.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#ifndef SPECIALTERM
|
||||||
|
#define SPECIALTERM
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some declarations in spercialterm.c
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern Term TERM_Agent;
|
||||||
|
extern Term TERM_Function;
|
||||||
|
extern Term TERM_Hidden;
|
||||||
|
extern Term TERM_Type;
|
||||||
|
extern Term TERM_Nonce;
|
||||||
|
extern Term TERM_Ticket;
|
||||||
|
|
||||||
|
extern Term TERM_Claim;
|
||||||
|
extern Term CLAIM_Secret;
|
||||||
|
extern Term CLAIM_Nisynch;
|
||||||
|
extern Term CLAIM_Niagree;
|
||||||
|
extern Term CLAIM_Empty;
|
||||||
|
|
||||||
|
#endif
|
@ -11,12 +11,12 @@
|
|||||||
#include "version.h"
|
#include "version.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
|
#include "specialterm.h"
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
struct switchdata switches;
|
struct switchdata switches;
|
||||||
|
|
||||||
extern struct tacnode *spdltac;
|
extern struct tacnode *spdltac;
|
||||||
extern Term TERM_Claim;
|
|
||||||
|
|
||||||
const char *progname = "scyther";
|
const char *progname = "scyther";
|
||||||
const char *releasetag = SVNVERSION;
|
const char *releasetag = SVNVERSION;
|
||||||
|
@ -18,10 +18,7 @@
|
|||||||
#include "mgu.h"
|
#include "mgu.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
#include "binding.h"
|
#include "binding.h"
|
||||||
|
#include "specialterm.h"
|
||||||
/* from compiler.o */
|
|
||||||
extern Term TERM_Type;
|
|
||||||
extern Term TERM_Agent;
|
|
||||||
|
|
||||||
//! Global flag that signals LaTeX output.
|
//! Global flag that signals LaTeX output.
|
||||||
/**
|
/**
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
#include "ctype.h"
|
#include "ctype.h"
|
||||||
|
#include "specialterm.h"
|
||||||
|
|
||||||
/* public flag */
|
/* public flag */
|
||||||
int rolelocal_variable;
|
int rolelocal_variable;
|
||||||
|
|
||||||
/* external definitions */
|
/* external definitions */
|
||||||
|
|
||||||
extern Term TERM_Function;
|
|
||||||
extern int inTermlist (); // suppresses a warning, but at what cost?
|
extern int inTermlist (); // suppresses a warning, but at what cost?
|
||||||
extern int globalLatex;
|
extern int globalLatex;
|
||||||
|
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "termlist.h"
|
#include "termlist.h"
|
||||||
|
#include "specialterm.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
/* system constants.
|
|
||||||
* declared in compiler.c
|
|
||||||
*/
|
|
||||||
|
|
||||||
extern Term TERM_Function;
|
|
||||||
extern Term TERM_Hidden;
|
|
||||||
|
|
||||||
//! Open termlists code.
|
//! Open termlists code.
|
||||||
void
|
void
|
||||||
termlistsInit (void)
|
termlistsInit (void)
|
||||||
|
11
src/type.c
11
src/type.c
@ -11,16 +11,7 @@
|
|||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
|
#include "specialterm.h"
|
||||||
/*
|
|
||||||
* Special term definitions from compiler.c
|
|
||||||
*/
|
|
||||||
extern Term TERM_Agent;
|
|
||||||
extern Term TERM_Function;
|
|
||||||
extern Term TERM_Hidden;
|
|
||||||
extern Term TERM_Type;
|
|
||||||
extern Term TERM_Nonce;
|
|
||||||
extern Term TERM_Ticket;
|
|
||||||
|
|
||||||
extern Protocol INTRUDER;
|
extern Protocol INTRUDER;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
#include "binding.h"
|
#include "binding.h"
|
||||||
#include "arachne.h" // for get_semitrace_length
|
#include "arachne.h" // for get_semitrace_length
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
|
#include "specialterm.h"
|
||||||
|
|
||||||
#include "xmlout.h"
|
#include "xmlout.h"
|
||||||
|
|
||||||
@ -25,7 +26,6 @@
|
|||||||
* Externally defined
|
* Externally defined
|
||||||
*/
|
*/
|
||||||
extern Protocol INTRUDER; // from arachne.c
|
extern Protocol INTRUDER; // from arachne.c
|
||||||
extern Term TERM_Function; // from termlist.c
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global/static stuff.
|
* Global/static stuff.
|
||||||
|
Loading…
Reference in New Issue
Block a user