1/* BEGIN LICENSE BLOCK
2 * Version: CMPL 1.1
3 *
4 * The contents of this file are subject to the Cisco-style Mozilla Public
5 * License Version 1.1 (the "License"); you may not use this file except
6 * in compliance with the License.  You may obtain a copy of the License
7 * at www.eclipse-clp.org/license.
8 *
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
11 * the License for the specific language governing rights and limitations
12 * under the License.
13 *
14 * The Original Code is  The ECLiPSe Constraint Logic Programming System.
15 * The Initial Developer of the Original Code is  Cisco Systems, Inc.
16 * Portions created by the Initial Developer are
17 * Copyright (C) 1989-2006 Cisco Systems, Inc.  All Rights Reserved.
18 *
19 * Contributor(s): ECRC GmbH
20 *
21 * END LICENSE BLOCK */
22
23/*
24 * SEPIA INCLUDE FILE
25 *
26 * VERSION	$Id: module.h,v 1.1 2008/06/30 17:43:57 jschimpf Exp $
27 */
28
29/*
30 * IDENTIFICATION		module.h
31 *
32 * DESCRIPTION
33 *
34 *
35 * CONTENTS:
36 *
37 */
38
39#define IsModule(mdid)		(DidModule(mdid)? 1:0)
40#define IsLocked(mdid)		(DidModule(mdid) & IS_LOCKED)
41#define ModuleTag(mdid)		(TDICT | 0x100)
42#define IsModuleTag(mdid, tag) ((tag).kernel == ModuleTag(mdid))
43#define UnauthorizedAccess(mod, mod_tag) \
44	(IsLocked(mod) && !IsModuleTag(mod, mod_tag))
45
46#define ModuleItem(did) \
47   ((module_item *) (get_property(did, MODULE_PROP))->val.ptr)
48#define ModuleSyntax(did)	(ModuleItem(did)->syntax)
49
50/* This is obsolete!! */
51#define Check_Module(t,v)					\
52	Check_Atom_Or_Nil(v, t);				\
53	if (! IsModule(v.did))	{Bip_Error(MODULENAME);}
54
55#define Check_Module_Access(v, t)				\
56	if (IsLocked(v.did) && (! IsModuleTag(v.did, t)))	\
57		{Bip_Error(LOCKED);}
58
59#define Check_Module_And_Access(v, t)				\
60	Check_Atom_Or_Nil(v, t);				\
61	if (!IsModule(v.did)) {					\
62	    Bip_Error(MODULENAME)				\
63	} else if (IsLocked(v.did) && (! IsModuleTag(v.did, t))) {\
64		Bip_Error(LOCKED)				\
65	}
66
67
68/*
69 *	The module structure.
70 */
71
72#define UNLOCK_MODULE		1
73#define SOFT_LOCK_MODULE	2
74#define HARD_LOCK_MODULE	3
75
76#define IS_MODULE		3
77#define IS_LOCKED		2
78
79/*
80 *	The global and dynamic links.
81 */
82
83typedef struct proc_duet
84{
85        pri			*desc;
86        struct proc_duet	*next;
87} proc_duet;
88