Mercurial > cpython-lru_cache-weakref
annotate Include/node.h @ 2800:ab3dca97ffbe legacy-trunk
new grammar for 3rd raise arg and keyword parameters
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 07 Jul 1995 22:26:23 +0000 |
| parents | 05360cd616ae |
| children | 65d2d8e67da3 |
| 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 /*********************************************************** |
| 2058 | 8 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam, |
| 9 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 | |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
41 extern node *PyNode_New Py_PROTO((int type)); |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
42 extern node *PyNode_AddChild Py_PROTO((node *n, int type, char *str, int lineno)); |
|
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
43 extern void PyNode_Free Py_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 |
|
2129
05360cd616ae
The great renaming, phase two: all header files have been updated to
Guido van Rossum <guido@python.org>
parents:
2058
diff
changeset
|
63 extern void PyNode_ListTree Py_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 */ |
