~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
/*
 *  Ascend Instance Tree TmpNum functions.
 *  by Tom Epperly & Kirk Abbott
 *  8/16/89
 *  Version: $Revision: 1.6 $
 *  Version control file: $RCSfile: tmpnum.h,v $
 *  Date last modified: $Date: 1997/12/20 17:51:52 $
 *  Last modified by: $Author: ballan $
 *
 *  This file is part of the Ascend Language Interpreter.
 *
 *  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/>.
 */

/** @file
 *  Ascend Instance Tree TmpNum functions.
 *
 *  About tmp numbers. These are a scratch long for use of transient
 *  clients, including the compiler itself. The tmp num should not be
 *  expected to remain the same above the scope of the function in
 *  which it is set. In particular, all clients are free to stomp on
 *  it at will so don't count on it holding a value you set unless you
 *  know that none of your subroutines will mess with it before you
 *  need it.
 *
 *  Note that NULL instances have a tmpnum of LONG_MAX, if anyone
 *  is dumb enough to ask. This will generally cause fallout
 *  elsewhere.
 */

#ifndef ASC_TMPNUM_H
#define ASC_TMPNUM_H

#include <ascend/general/platform.h>
#include "instance_enum.h"

/**	@addtogroup compiler_inst Compiler Instance Hierarchy
	@{
*/

extern unsigned long GetTmpNum(CONST struct Instance *i);
/**<
 *  Return the tmp number, or LONG_MAX if i is NULL,
 *  or 0 if i is subatomic, or exits if i enum is wierd.
 */

extern void SetTmpNum(struct Instance *i, unsigned long int n);
/**<
 *  Sets the tmp number, or whines if i bad.
 */

extern unsigned long IncrementTmpNum(struct Instance *i);
/**<
 *  Add 1 to and return the tmp number.
 *  Returns LONG_MAX if i is NULL.
 *  or 0 if i is subatomic, or exits if i enum is wierd.
 *  The numeric wisdom of the incrementing is not checked.
 */

extern unsigned long DecrementTmpNum(struct Instance *i);
/**<
 *  Subtract 1 from and return the tmp number.
 *  Returns LONG_MAX if i is NULL
 *  or 0 if i is subatomic, or exits if i enum is wierd.
 *  Tmpnum is not decremented if it is already 0.
 */

extern void ZeroTmpNums(struct Instance *i, int order);
/**<
 *  Does a VisitInstanceTree to set all i->tmp_num = 0;
 *  The visit order really is irrelevant though.
 */

/* @} */

#endif /* ASC_TMPNUM_H */