[Python-checkins] python/dist/src/Include asdl.h,NONE,1.1.2.1 ast.h,NONE,1.1.2.1

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Sun, 07 Jul 2002 10:34:46 -0700


Update of /cvsroot/python/python/dist/src/Include
In directory usw-pr-cvs1:/tmp/cvs-serv28375/Include

Added Files:
      Tag: ast-branch
	asdl.h ast.h 
Log Message:
New files needed for AST

XXX Where to put asdl.py code? Perhaps new AST directory would be
better than Parser.


--- NEW FILE: asdl.h ---
#ifndef Py_ASDL_H
#define Py_ASDL_H

typedef PyObject * identifier;
typedef PyObject * string;
typedef PyObject * object;

#include <stdbool.h>

/* It would be nice if the code generated by asdl_c.py was completely
   independent of Python, but it is a goal the requires too much work
   at this stage.  So, for example, I'll represent identifiers as
   interned Python strings.
*/

/* A sequence should be typed so that its use can be typechecked. */

typedef struct {
    int size;
    int used;
    void **elements;
} asdl_seq;

asdl_seq *asdl_seq_new(int size);
void *asdl_seq_get(asdl_seq *seq, int offset);
int asdl_seq_append(asdl_seq *seq, void *elt);
void asdl_seq_free(asdl_seq *);

#define asdl_seq_LEN(S) ((S)->used)

#endif /* !Py_ASDL_H */

--- NEW FILE: ast.h ---
#ifndef Py_AST_H
#define Py_AST_H
#ifdef __cplusplus
extern "C" {
#endif

extern DL_IMPORT(mod_ty) PyAST_FromNode(node *);

#ifdef __cplusplus
}
#endif
#endif /* !Py_AST_H */