~jdpipe/ascend/trunk-old

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
 *  Ascend Instance Tree Type Implementation Macros
 *  by Ben Allan
 *  9/16/96
 *  Version: $Revision: 1.6 $
 *  Version control file: $RCSfile: instmacro.c,v $
 *  Date last modified: $Date: 1997/07/18 12:30:43 $
 *  Last modified by: $Author: mthomas $
 *
 *  This file is part of the Ascend Language Interpreter.
 *
 *  Copyright 1996 Bejamin Allan
 *  based on instance.c
 *  Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
 *
 *  The Ascend Language Interpreter 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.
 *
 *  The Ascend Language Interpreter is distributed in 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, see <http://www.gnu.org/licenses/>.
 */
#include <stdarg.h>
#include <ascend/general/platform.h>

#include <ascend/general/panic.h>
#include <ascend/general/ascMalloc.h>
#include <ascend/general/panic.h>
#include "instance_enum.h"


#include "functype.h"
#include "expr_types.h"
#include "instance_types.h"
#include "instmacro.h"

/* temporary global variables used for debugging only */
#ifndef NDEBUG
/* fundies */
struct RealInstance *g_r_inst;
struct IntegerInstance *g_i_inst;
struct BooleanInstance *g_b_inst;
struct SetInstance *g_s_inst;
struct SymbolInstance *g_sym_inst;
/* constants */
struct RealConstantInstance *g_rc_inst;
struct IntegerConstantInstance *g_ic_inst;
struct BooleanConstantInstance *g_bc_inst;
struct SetConstantInstance *g_sc_inst;
struct SymbolConstantInstance *g_symc_inst;
/* atoms */
struct RealAtomInstance *g_ra_inst;
struct IntegerAtomInstance *g_ia_inst;
struct BooleanAtomInstance *g_ba_inst;
struct SetAtomInstance *g_sa_inst;
struct SymbolAtomInstance *g_syma_inst;
/* other */
struct ModelInstance *g_mod_inst;
struct RelationInstance *g_rel_inst;
struct LogRelInstance *g_lrel_inst;
struct WhenInstance *g_when_inst;
#endif

int NotAtomF(struct Instance *i)
{
  AssertMemory(i);
  switch(i->t) {
  case MODEL_INST:
  case ARRAY_INT_INST:
  case ARRAY_ENUM_INST:
    return 1;
  case REL_INST:
  case LREL_INST:
  case WHEN_INST:
  case REAL_ATOM_INST:
  case BOOLEAN_ATOM_INST:
  case INTEGER_ATOM_INST:
  case SET_ATOM_INST:
  case SYMBOL_ATOM_INST:
  case REAL_CONSTANT_INST:
  case INTEGER_CONSTANT_INST:
  case BOOLEAN_CONSTANT_INST:
  case SYMBOL_CONSTANT_INST:
  case REAL_INST:
  case INTEGER_INST:
  case BOOLEAN_INST:
  case SET_INST:
  case SYMBOL_INST:
  case DUMMY_INST: /* well, it's fair to say the dummy is not anything */
    return 0;
  default:
    ASC_PANIC("VisitTree: Illegal instance type.\n");

  }
}