2007-06-11 13:01:04 +01:00
|
|
|
/*
|
|
|
|
* Scyther : An automatic verifier for security protocols.
|
|
|
|
* Copyright (C) 2007 Cas Cremers
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2004-04-23 11:58:43 +01:00
|
|
|
#ifndef TERMLISTS
|
|
|
|
#define TERMLISTS
|
|
|
|
|
2004-07-24 20:07:29 +01:00
|
|
|
#include "term.h"
|
2004-04-23 11:58:43 +01:00
|
|
|
|
2004-05-15 13:33:01 +01:00
|
|
|
//! The list container for the term type.
|
|
|
|
/**
|
|
|
|
* Implemented as a double linked list to allow for element deletion.
|
|
|
|
*\sa term
|
|
|
|
*/
|
2004-04-23 11:58:43 +01:00
|
|
|
struct termlist
|
|
|
|
{
|
2004-05-15 13:33:01 +01:00
|
|
|
//! The term element for this node.
|
2004-04-23 11:58:43 +01:00
|
|
|
Term term;
|
2004-05-15 13:33:01 +01:00
|
|
|
//! Next node pointer or NULL for the tail of the list.
|
2004-04-23 11:58:43 +01:00
|
|
|
struct termlist *next;
|
2004-05-15 13:33:01 +01:00
|
|
|
//! Previous node pointer or NULL for the head of the list.
|
2004-04-23 11:58:43 +01:00
|
|
|
struct termlist *prev;
|
|
|
|
};
|
|
|
|
|
2004-05-15 13:33:01 +01:00
|
|
|
//! Shorthand for termlist pointers.
|
2004-04-23 11:58:43 +01:00
|
|
|
typedef struct termlist *Termlist;
|
|
|
|
|
|
|
|
void termlistsInit (void);
|
|
|
|
void termlistsDone (void);
|
|
|
|
Termlist termlistDuplicate (Termlist tl);
|
|
|
|
Termlist termlistShallow (Termlist tl);
|
|
|
|
void termlistDelete (Termlist tl);
|
|
|
|
void termlistDestroy (Termlist tl);
|
|
|
|
void termlistPrint (Termlist tl);
|
2004-07-20 10:47:06 +01:00
|
|
|
__inline__ int inTermlist (Termlist tl, const Term term);
|
2004-08-27 14:10:46 +01:00
|
|
|
__inline__ Termlist termlistFind (Termlist tl, const Term term);
|
2004-04-23 11:58:43 +01:00
|
|
|
int isTermlistEqual (Termlist tl1, Termlist tl2);
|
|
|
|
Termlist termlistAdd (Termlist tl, Term term);
|
2005-11-12 21:13:00 +00:00
|
|
|
#define termlistPrepend(tl,t) termlistAdd(tl,t)
|
2004-04-23 11:58:43 +01:00
|
|
|
Termlist termlistAppend (const Termlist tl, const Term term);
|
2004-07-25 19:24:50 +01:00
|
|
|
Termlist termlistAddNew (const Termlist tl, const Term t);
|
2004-04-23 11:58:43 +01:00
|
|
|
Termlist termlistConcat (Termlist tl1, Termlist tl2);
|
2006-02-26 17:18:59 +00:00
|
|
|
Termlist termlistConcatStatic (Termlist tl1, Termlist tl2);
|
2004-04-23 11:58:43 +01:00
|
|
|
Termlist termlistDelTerm (Termlist tl);
|
|
|
|
Termlist termlistConjunct (Termlist tl1, Termlist tl2);
|
|
|
|
Termlist termlistConjunctType (Termlist tl1, Termlist tl2, int termtype);
|
|
|
|
Termlist termlistType (Termlist tl, int termtype);
|
|
|
|
Termlist termlistAddVariables (Termlist tl, Term t);
|
|
|
|
Termlist termlistAddRealVariables (Termlist tl, Term t);
|
|
|
|
Termlist termlistAddBasic (Termlist tl, Term t);
|
|
|
|
Termlist termlistAddBasics (Termlist tl, Termlist scan);
|
|
|
|
Termlist termlistMinusTerm (Termlist tl, Term t);
|
|
|
|
int termlistLength (Termlist tl);
|
|
|
|
Term inverseKey (Termlist inverses, Term key);
|
2004-12-08 16:25:27 +00:00
|
|
|
Term termLocal (const Term t, Termlist fromlist, Termlist tolist);
|
2004-04-23 11:58:43 +01:00
|
|
|
Termlist termlistLocal (Termlist tl, const Termlist fromlist,
|
2004-12-08 16:25:27 +00:00
|
|
|
const Termlist tolist);
|
2004-04-23 11:58:43 +01:00
|
|
|
int termlistContained (const Termlist tlbig, Termlist tlsmall);
|
|
|
|
Term termFunction (Termlist fromlist, Termlist tolist, Term tx);
|
|
|
|
Termlist termlistForward (Termlist tl);
|
2004-07-14 09:17:49 +01:00
|
|
|
int termlistOrder (Termlist tl1, Termlist tl2);
|
2004-08-12 10:28:50 +01:00
|
|
|
int termlist_iterate (Termlist tl, int (*func) ());
|
2004-08-26 13:36:01 +01:00
|
|
|
Term termlist_to_tuple (Termlist tl);
|
2005-10-07 15:02:46 +01:00
|
|
|
Termlist tuple_to_termlist (Term t);
|
2011-01-25 16:33:12 +00:00
|
|
|
Term termLeft (Term t);
|
2005-10-08 20:56:04 +01:00
|
|
|
Termlist termlistMinusTermlist (const Termlist tlbig, const Termlist tlsmall);
|
2004-04-23 11:58:43 +01:00
|
|
|
|
2006-03-15 21:30:19 +00:00
|
|
|
#define TERMLISTADD(l,t) l = termlistAdd (l,t)
|
|
|
|
#define TERMLISTAPPEND(l,t) l = termlistAppend (l,t)
|
|
|
|
|
2004-04-23 11:58:43 +01:00
|
|
|
#endif
|