Mercurial > cpython-lru_cache-weakref
annotate Include/node.h @ 1944:8e8fddcbdfd2 legacy-trunk
Hopefully the last edits for 1.1
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 06 Oct 1994 16:15:09 +0000 |
| parents | 2d5b36a438ab |
| children | 508036dbba3b |
| rev | line source |
|---|---|
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
1 #ifndef Py_NODE_H |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
2 #define Py_NODE_H |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
3 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
4 extern "C" { |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
5 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
6 |
| 145 | 7 /*********************************************************** |
|
1746
1940892d2fe3
Merge alpha100 branch back to main trunk
Guido van Rossum <guido@python.org>
parents:
1391
diff
changeset
|
8 Copyright 1991, 1992, 1993, 1994 by Stichting Mathematisch Centrum, |
|
1257
1cabc2b6c970
* Changed all copyright messages to include 1993.
Guido van Rossum <guido@python.org>
parents:
790
diff
changeset
|
9 Amsterdam, The Netherlands. |
| 145 | 10 |
| 11 All Rights Reserved | |
| 12 | |
| 13 Permission to use, copy, modify, and distribute this software and its | |
| 14 documentation for any purpose and without fee is hereby granted, | |
| 15 provided that the above copyright notice appear in all copies and that | |
| 16 both that copyright notice and this permission notice appear in | |
| 17 supporting documentation, and that the names of Stichting Mathematisch | |
| 18 Centrum or CWI not be used in advertising or publicity pertaining to | |
| 19 distribution of the software without specific, written prior permission. | |
| 20 | |
| 21 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO | |
| 22 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
| 23 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE | |
| 24 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 25 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
| 26 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | |
| 27 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 28 | |
| 29 ******************************************************************/ | |
| 30 | |
| 6 | 31 /* Parse tree node interface */ |
| 32 | |
| 33 typedef struct _node { | |
|
1812
2d5b36a438ab
Include/node.h: make some fields short to save space during
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
34 short n_type; |
| 6 | 35 char *n_str; |
|
1812
2d5b36a438ab
Include/node.h: make some fields short to save space during
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
36 short n_lineno; |
|
2d5b36a438ab
Include/node.h: make some fields short to save space during
Guido van Rossum <guido@python.org>
parents:
1746
diff
changeset
|
37 short n_nchildren; |
| 6 | 38 struct _node *n_child; |
| 39 } node; | |
| 40 | |
| 86 | 41 extern node *newtree PROTO((int type)); |
| 42 extern node *addchild PROTO((node *n, int type, char *str, int lineno)); | |
| 43 extern void freetree PROTO((node *n)); | |
| 6 | 44 |
| 45 /* Node access functions */ | |
| 46 #define NCH(n) ((n)->n_nchildren) | |
| 47 #define CHILD(n, i) (&(n)->n_child[i]) | |
| 48 #define TYPE(n) ((n)->n_type) | |
| 49 #define STR(n) ((n)->n_str) | |
| 50 | |
| 51 /* Assert that the type of a node is what we expect */ | |
| 52 #ifndef DEBUG | |
| 53 #define REQ(n, type) { /*pass*/ ; } | |
| 54 #else | |
| 55 #define REQ(n, type) \ | |
| 56 { if (TYPE(n) != (type)) { \ | |
| 57 fprintf(stderr, "FATAL: node type %d, required %d\n", \ | |
| 58 TYPE(n), type); \ | |
| 59 abort(); \ | |
| 60 } } | |
| 61 #endif | |
| 86 | 62 |
| 63 extern void listtree PROTO((node *)); | |
|
1329
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
64 |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
65 #ifdef __cplusplus |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
66 } |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
67 #endif |
|
519c25039c6a
* Added support for X11 modules.
Guido van Rossum <guido@python.org>
parents:
1257
diff
changeset
|
68 #endif /* !Py_NODE_H */ |
