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):
20 *
21 * END LICENSE BLOCK */
22
23/*
24 * SEPIA INCLUDE FILE
25 *
26 * VERSION	$Id: property.h,v 1.1 2008/06/30 17:43:58 jschimpf Exp $
27 */
28
29/*************************************************************
30 *
31 *                 property.h
32 *
33 *************************************************************/
34
35#define VISIBLE_PROP		0
36#define LOCAL_PROP		1
37#define GLOBAL_PROP		2
38
39#define PROPERTY_ERROR		0
40
41#define EVENT_PROP		1
42#define HTABLE_PROP		2
43#define GLOBVAR_PROP		3
44#define ARRAY_PROP		4
45#define IDB_PROP		5
46#define MODULE_PROP		6
47#define SYSCALL_PROP		7
48#define STREAM_PROP		8
49#define PREFIX_PROP		9
50#define INFIX_PROP		10
51#define POSTFIX_PROP		11
52#define TRANS_PROP		12  /* must be consecutive, write macros odd */
53#define WRITE_TRANS_PROP	13  /* some values used in kernel.pl !!!     */
54#define GOAL_TRANS_PROP		14
55#define WRITE_GOAL_TRANS_PROP	15
56#define CLAUSE_TRANS_PROP	16
57#define WRITE_CLAUSE_TRANS_PROP	17
58#define SHELF_PROP		18
59
60/* Create and set a global variable local to sepia_kernel		*/
61#define	Set_Kernel_Var(var_name, vvalue, tvalue)			\
62    {									\
63	value kv; value v_type; value v_vis;				\
64	v_type.did = d_.prolog;						\
65	v_vis.did = d_.local0;					\
66	kv.did = d_.kernel_sepia;					\
67	(void) p_make_array_(var_name, tdict, v_type, tdict,		\
68			     v_vis, tdict, kv, tdict);			\
69	(void) p_setval_body(var_name, tdict, vvalue, tvalue, kv, tdict);\
70    }
71
72#define	Get_Kernel_Var(var_did, pointer)				\
73	{								\
74	    type kt;							\
75	    int	res;							\
76	    kt.kernel = ModuleTag(d_.kernel_sepia);			\
77	    pointer = get_modular_property(var_did, GLOBVAR_PROP,	\
78					   d_.kernel_sepia, kt,		\
79					   VISIBLE_PROP, &res);		\
80	}
81
82#define TransfTermIn(tr)	((tr) + 4)
83#define TransfTermOut(tr)	((tr) + 5)
84
85#define GetPointerToRecord(functor, mod, mod_tag, perr)			\
86    get_modular_property(functor, IDB_PROP, mod, mod_tag, VISIBLE_PROP, perr)
87
88#define GlobalPrologRefIndexTag	TGRS
89#define IsGlobalPrologRefIndex(p) SameTypeC((p)->tag, GlobalPrologRefIndexTag)
90
91#define GlobalPrologRefTag   TGRL
92#define IsGlobalPrologRef(p) SameTypeC((p)->tag, GlobalPrologRefTag)
93
94
95Extern pword *	get_property ARGS((dident, int));
96Extern pword *	set_property ARGS((dident, int));
97Extern pword *	get_modular_property ARGS((dident, int, dident, type, int, int*));
98Extern pword *	set_modular_property ARGS((dident, int, dident, type, int, int*));
99Extern int	erase_property ARGS((dident, int));
100Extern int	erase_modular_property ARGS((dident, int, dident, type, int));
101Extern void	erase_module_props ARGS((property*));
102Extern void	erase_records ARGS((pword*));
103Extern void	mark_dids_from_properties ARGS((property*));
104
105Extern void	get_heapterm ARGS((pword*, pword*));
106Extern int	create_heapterm ARGS((pword*, value, type));
107Extern void	free_heapterm ARGS((pword*));
108Extern void	move_heapterm ARGS((pword*, pword*));
109Extern void	make_heapterm_persistent ARGS((pword*));
110Extern void	mark_dids_from_heapterm ARGS((pword*));
111Extern void	set_string ARGS((pword*, char*));
112Extern void	set_string_n ARGS((pword*, char*, int));
113
114Extern uword *	get_elt_address ARGS((value, type, uword*, dident, type, int*));
115Extern word	get_first_elt ARGS((pword*, pword*, uword*, uword*, dident, type));
116Extern pword *	init_kernel_var ARGS((int flags, dident vdid, value v, type t));
117
118