comparison Python/Python-ast.c @ 35862:6867995a18a7 legacy-trunk

Prevent name pollution by making lots of internal functions static.
author Neal Norwitz <nnorwitz@gmail.com>
date Sun, 13 Nov 2005 18:41:28 +0000
parents c6dbf88e4b14
children 9f73dc0953d2
comparison
equal deleted inserted replaced
35861:3e634e41b6ec 35862:6867995a18a7
1 /* File automatically generated by ./Parser/asdl_c.py */ 1 /* File automatically generated by ./Parser/asdl_c.py */
2 2
3 #include "Python.h" 3 #include "Python.h"
4 #include "Python-ast.h" 4 #include "Python-ast.h"
5 5
6 static int marshal_write_mod(PyObject **, int *, mod_ty);
7 static int marshal_write_stmt(PyObject **, int *, stmt_ty);
8 static int marshal_write_expr(PyObject **, int *, expr_ty);
9 static int marshal_write_expr_context(PyObject **, int *, expr_context_ty);
10 static int marshal_write_slice(PyObject **, int *, slice_ty);
11 static int marshal_write_boolop(PyObject **, int *, boolop_ty);
12 static int marshal_write_operator(PyObject **, int *, operator_ty);
13 static int marshal_write_unaryop(PyObject **, int *, unaryop_ty);
14 static int marshal_write_cmpop(PyObject **, int *, cmpop_ty);
15 static int marshal_write_comprehension(PyObject **, int *, comprehension_ty);
16 static int marshal_write_excepthandler(PyObject **, int *, excepthandler_ty);
17 static int marshal_write_arguments(PyObject **, int *, arguments_ty);
18 static int marshal_write_keyword(PyObject **, int *, keyword_ty);
19 static int marshal_write_alias(PyObject **, int *, alias_ty);
6 mod_ty 20 mod_ty
7 Module(asdl_seq * body) 21 Module(asdl_seq * body)
8 { 22 {
9 mod_ty p; 23 mod_ty p;
10 p = (mod_ty)malloc(sizeof(*p)); 24 p = (mod_ty)malloc(sizeof(*p));
1517 } 1531 }
1518 1532
1519 free(o); 1533 free(o);
1520 } 1534 }
1521 1535
1522 int 1536 static int
1523 marshal_write_mod(PyObject **buf, int *off, mod_ty o) 1537 marshal_write_mod(PyObject **buf, int *off, mod_ty o)
1524 { 1538 {
1525 int i; 1539 int i;
1526 switch (o->kind) { 1540 switch (o->kind) {
1527 case Module_kind: 1541 case Module_kind:
1555 break; 1569 break;
1556 } 1570 }
1557 return 1; 1571 return 1;
1558 } 1572 }
1559 1573
1560 int 1574 static int
1561 marshal_write_stmt(PyObject **buf, int *off, stmt_ty o) 1575 marshal_write_stmt(PyObject **buf, int *off, stmt_ty o)
1562 { 1576 {
1563 int i; 1577 int i;
1564 switch (o->kind) { 1578 switch (o->kind) {
1565 case FunctionDef_kind: 1579 case FunctionDef_kind:
1816 break; 1830 break;
1817 } 1831 }
1818 return 1; 1832 return 1;
1819 } 1833 }
1820 1834
1821 int 1835 static int
1822 marshal_write_expr(PyObject **buf, int *off, expr_ty o) 1836 marshal_write_expr(PyObject **buf, int *off, expr_ty o)
1823 { 1837 {
1824 int i; 1838 int i;
1825 switch (o->kind) { 1839 switch (o->kind) {
1826 case BoolOp_kind: 1840 case BoolOp_kind:
1987 break; 2001 break;
1988 } 2002 }
1989 return 1; 2003 return 1;
1990 } 2004 }
1991 2005
1992 int 2006 static int
1993 marshal_write_expr_context(PyObject **buf, int *off, expr_context_ty o) 2007 marshal_write_expr_context(PyObject **buf, int *off, expr_context_ty o)
1994 { 2008 {
1995 switch (o) { 2009 switch (o) {
1996 case Load: 2010 case Load:
1997 marshal_write_int(buf, off, 1); 2011 marshal_write_int(buf, off, 1);
2013 break; 2027 break;
2014 } 2028 }
2015 return 1; 2029 return 1;
2016 } 2030 }
2017 2031
2018 int 2032 static int
2019 marshal_write_slice(PyObject **buf, int *off, slice_ty o) 2033 marshal_write_slice(PyObject **buf, int *off, slice_ty o)
2020 { 2034 {
2021 int i; 2035 int i;
2022 switch (o->kind) { 2036 switch (o->kind) {
2023 case Ellipsis_kind: 2037 case Ellipsis_kind:
2061 break; 2075 break;
2062 } 2076 }
2063 return 1; 2077 return 1;
2064 } 2078 }
2065 2079
2066 int 2080 static int
2067 marshal_write_boolop(PyObject **buf, int *off, boolop_ty o) 2081 marshal_write_boolop(PyObject **buf, int *off, boolop_ty o)
2068 { 2082 {
2069 switch (o) { 2083 switch (o) {
2070 case And: 2084 case And:
2071 marshal_write_int(buf, off, 1); 2085 marshal_write_int(buf, off, 1);
2075 break; 2089 break;
2076 } 2090 }
2077 return 1; 2091 return 1;
2078 } 2092 }
2079 2093
2080 int 2094 static int
2081 marshal_write_operator(PyObject **buf, int *off, operator_ty o) 2095 marshal_write_operator(PyObject **buf, int *off, operator_ty o)
2082 { 2096 {
2083 switch (o) { 2097 switch (o) {
2084 case Add: 2098 case Add:
2085 marshal_write_int(buf, off, 1); 2099 marshal_write_int(buf, off, 1);
2119 break; 2133 break;
2120 } 2134 }
2121 return 1; 2135 return 1;
2122 } 2136 }
2123 2137
2124 int 2138 static int
2125 marshal_write_unaryop(PyObject **buf, int *off, unaryop_ty o) 2139 marshal_write_unaryop(PyObject **buf, int *off, unaryop_ty o)
2126 { 2140 {
2127 switch (o) { 2141 switch (o) {
2128 case Invert: 2142 case Invert:
2129 marshal_write_int(buf, off, 1); 2143 marshal_write_int(buf, off, 1);
2139 break; 2153 break;
2140 } 2154 }
2141 return 1; 2155 return 1;
2142 } 2156 }
2143 2157
2144 int 2158 static int
2145 marshal_write_cmpop(PyObject **buf, int *off, cmpop_ty o) 2159 marshal_write_cmpop(PyObject **buf, int *off, cmpop_ty o)
2146 { 2160 {
2147 switch (o) { 2161 switch (o) {
2148 case Eq: 2162 case Eq:
2149 marshal_write_int(buf, off, 1); 2163 marshal_write_int(buf, off, 1);
2177 break; 2191 break;
2178 } 2192 }
2179 return 1; 2193 return 1;
2180 } 2194 }
2181 2195
2182 int 2196 static int
2183 marshal_write_comprehension(PyObject **buf, int *off, comprehension_ty o) 2197 marshal_write_comprehension(PyObject **buf, int *off, comprehension_ty o)
2184 { 2198 {
2185 int i; 2199 int i;
2186 marshal_write_expr(buf, off, o->target); 2200 marshal_write_expr(buf, off, o->target);
2187 marshal_write_expr(buf, off, o->iter); 2201 marshal_write_expr(buf, off, o->iter);
2191 marshal_write_expr(buf, off, (expr_ty)elt); 2205 marshal_write_expr(buf, off, (expr_ty)elt);
2192 } 2206 }
2193 return 1; 2207 return 1;
2194 } 2208 }
2195 2209
2196 int 2210 static int
2197 marshal_write_excepthandler(PyObject **buf, int *off, excepthandler_ty o) 2211 marshal_write_excepthandler(PyObject **buf, int *off, excepthandler_ty o)
2198 { 2212 {
2199 int i; 2213 int i;
2200 if (o->type) { 2214 if (o->type) {
2201 marshal_write_int(buf, off, 1); 2215 marshal_write_int(buf, off, 1);
2217 marshal_write_stmt(buf, off, (stmt_ty)elt); 2231 marshal_write_stmt(buf, off, (stmt_ty)elt);
2218 } 2232 }
2219 return 1; 2233 return 1;
2220 } 2234 }
2221 2235
2222 int 2236 static int
2223 marshal_write_arguments(PyObject **buf, int *off, arguments_ty o) 2237 marshal_write_arguments(PyObject **buf, int *off, arguments_ty o)
2224 { 2238 {
2225 int i; 2239 int i;
2226 marshal_write_int(buf, off, asdl_seq_LEN(o->args)); 2240 marshal_write_int(buf, off, asdl_seq_LEN(o->args));
2227 for (i = 0; i < asdl_seq_LEN(o->args); i++) { 2241 for (i = 0; i < asdl_seq_LEN(o->args); i++) {
2248 marshal_write_expr(buf, off, (expr_ty)elt); 2262 marshal_write_expr(buf, off, (expr_ty)elt);
2249 } 2263 }
2250 return 1; 2264 return 1;
2251 } 2265 }
2252 2266
2253 int 2267 static int
2254 marshal_write_keyword(PyObject **buf, int *off, keyword_ty o) 2268 marshal_write_keyword(PyObject **buf, int *off, keyword_ty o)
2255 { 2269 {
2256 marshal_write_identifier(buf, off, o->arg); 2270 marshal_write_identifier(buf, off, o->arg);
2257 marshal_write_expr(buf, off, o->value); 2271 marshal_write_expr(buf, off, o->value);
2258 return 1; 2272 return 1;
2259 } 2273 }
2260 2274
2261 int 2275 static int
2262 marshal_write_alias(PyObject **buf, int *off, alias_ty o) 2276 marshal_write_alias(PyObject **buf, int *off, alias_ty o)
2263 { 2277 {
2264 marshal_write_identifier(buf, off, o->name); 2278 marshal_write_identifier(buf, off, o->name);
2265 if (o->asname) { 2279 if (o->asname) {
2266 marshal_write_int(buf, off, 1); 2280 marshal_write_int(buf, off, 1);