summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-05-19 14:50:45 (GMT)
committerGuido van Rossum <guido@python.org>1993-05-19 14:50:45 (GMT)
commit25831652fd4c03323066d4cafdc0551c396a993e (patch)
tree69588df0f98b3280402cad3ed95865d06fa21702 /Include
parent687dd13bfec51849c93db7c538ff41d4c8ecddcb (diff)
downloadcpython-25831652fd4c03323066d4cafdc0551c396a993e.zip
cpython-25831652fd4c03323066d4cafdc0551c396a993e.tar.gz
cpython-25831652fd4c03323066d4cafdc0551c396a993e.tar.bz2
Several changes in one:
(1) dictionaries/mappings now have attributes values() and items() as well as keys(); at the C level, use the new function mappinggetnext() to iterate over a dictionary. (2) "class C(): ..." is now illegal; you must write "class C: ...". (3) Class objects now know their own name (finally!); and minor improvements to the way how classes, functions and methods are represented as strings. (4) Added an "access" statement and semantics. (This is still experimental -- as long as you don't use the keyword 'access' nothing should be changed.)
Diffstat (limited to 'Include')
-rw-r--r--Include/allobjects.h1
-rw-r--r--Include/classobject.h2
-rw-r--r--Include/dictobject.h3
-rwxr-xr-xInclude/errors.h4
-rw-r--r--Include/funcobject.h7
-rw-r--r--Include/graminit.h56
-rw-r--r--Include/mappingobject.h23
-rw-r--r--Include/opcode.h1
-rw-r--r--Include/pyerrors.h4
9 files changed, 56 insertions, 45 deletions
diff --git a/Include/allobjects.h b/Include/allobjects.h
index d7a0333..859f0b3 100644
--- a/Include/allobjects.h
+++ b/Include/allobjects.h
@@ -36,6 +36,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "object.h"
#include "objimpl.h"
+#include "accessobject.h"
#include "intobject.h"
#include "longobject.h"
#include "floatobject.h"
diff --git a/Include/classobject.h b/Include/classobject.h
index 88b955a..b9bbc9b 100644
--- a/Include/classobject.h
+++ b/Include/classobject.h
@@ -37,7 +37,7 @@ extern typeobject Classtype, Instancetype, Instancemethodtype;
#define is_instancemethodobject(op) ((op)->ob_type == &Instancemethodtype)
extern object *newclassobject PROTO((object *, object *, object *));
-extern object *newinstanceobject PROTO((object *));
+extern object *newinstanceobject PROTO((object *, object *));
extern object *newinstancemethodobject PROTO((object *, object *));
extern object *instancemethodgetfunc PROTO((object *));
diff --git a/Include/dictobject.h b/Include/dictobject.h
index ce71570..1475f10 100644
--- a/Include/dictobject.h
+++ b/Include/dictobject.h
@@ -33,12 +33,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern object *dictlookup PROTO((object *dp, char *key));
extern int dictinsert PROTO((object *dp, char *key, object *item));
extern int dictremove PROTO((object *dp, char *key));
-extern char *getdictkey PROTO((object *dp, int i));
-#define getdictsize getmappingsize
#define getdictkeys getmappingkeys
-#define getdict2key getmappingkey
#define dict2lookup mappinglookup
#define dict2insert mappinginsert
#define dict2remove mappingremove
diff --git a/Include/errors.h b/Include/errors.h
index f2d7b1a..0e5ae9f 100755
--- a/Include/errors.h
+++ b/Include/errors.h
@@ -33,7 +33,9 @@ void err_clear PROTO((void));
/* Predefined exceptions */
+extern object *AccessError;
extern object *AttributeError;
+extern object *ConflictError;
extern object *EOFError;
extern object *IOError;
extern object *ImportError;
@@ -59,3 +61,5 @@ extern object *err_errno PROTO((object *));
extern void err_input PROTO((int));
extern void err_badcall PROTO((void));
+
+extern object *err_getexc PROTO((void));
diff --git a/Include/funcobject.h b/Include/funcobject.h
index d24600d..e4ed269 100644
--- a/Include/funcobject.h
+++ b/Include/funcobject.h
@@ -24,6 +24,13 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Function object interface */
+typedef struct {
+ OB_HEAD
+ object *func_code;
+ object *func_globals;
+ object *func_name;
+} funcobject;
+
extern typeobject Functype;
#define is_funcobject(op) ((op)->ob_type == &Functype)
diff --git a/Include/graminit.h b/Include/graminit.h
index 5aba47d..0ba02a6 100644
--- a/Include/graminit.h
+++ b/Include/graminit.h
@@ -21,31 +21,31 @@
#define raise_stmt 276
#define import_stmt 277
#define global_stmt 278
-#define compound_stmt 279
-#define if_stmt 280
-#define while_stmt 281
-#define for_stmt 282
-#define try_stmt 283
-#define except_clause 284
-#define suite 285
-#define test 286
-#define and_test 287
-#define not_test 288
-#define comparison 289
-#define comp_op 290
-#define expr 291
-#define xor_expr 292
-#define and_expr 293
-#define shift_expr 294
-#define arith_expr 295
-#define term 296
-#define factor 297
-#define atom 298
-#define trailer 299
-#define subscript 300
-#define exprlist 301
-#define testlist 302
-#define dictmaker 303
-#define classdef 304
-#define baselist 305
-#define arguments 306
+#define access_stmt 279
+#define accesstype 280
+#define compound_stmt 281
+#define if_stmt 282
+#define while_stmt 283
+#define for_stmt 284
+#define try_stmt 285
+#define except_clause 286
+#define suite 287
+#define test 288
+#define and_test 289
+#define not_test 290
+#define comparison 291
+#define comp_op 292
+#define expr 293
+#define xor_expr 294
+#define and_expr 295
+#define shift_expr 296
+#define arith_expr 297
+#define term 298
+#define factor 299
+#define atom 300
+#define trailer 301
+#define subscript 302
+#define exprlist 303
+#define testlist 304
+#define dictmaker 305
+#define classdef 306
diff --git a/Include/mappingobject.h b/Include/mappingobject.h
index 83c3380..fa7402d 100644
--- a/Include/mappingobject.h
+++ b/Include/mappingobject.h
@@ -22,22 +22,19 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
******************************************************************/
-/*
-Mapping object type -- mapping from object to object.
-These functions set errno for errors. Functions mappingremove() and
-mappinginsert() return nonzero for errors, getmappingsize() returns -1,
-the others NULL. A successful call to mappinginsert() calls INCREF()
-for the inserted item.
-*/
+/* Mapping object type -- mapping from hashable object to object */
extern typeobject Mappingtype;
#define is_mappingobject(op) ((op)->ob_type == &Mappingtype)
extern object *newmappingobject PROTO((void));
-extern object *mappinglookup PROTO((object *dp, object *key));
-extern int mappinginsert PROTO((object *dp, object *key, object *item));
-extern int mappingremove PROTO((object *dp, object *key));
-extern int getmappingsize PROTO((object *dp));
-extern object *getmappingkey PROTO((object *dp, int i));
-extern object *getmappingkeys PROTO((object *dp));
+extern object *mappinglookup PROTO((object *mp, object *key));
+extern int mappinginsert PROTO((object *mp, object *key, object *item));
+extern int mappingremove PROTO((object *mp, object *key));
+extern void mappingclear PROTO((object *mp));
+extern int mappinggetnext
+ PROTO((object *mp, int *pos, object **key, object **value));
+extern object *getmappingkeys PROTO((object *mp));
+extern object *getmappingvalues PROTO((object *mp));
+extern object *getmappingitems PROTO((object *mp));
diff --git a/Include/opcode.h b/Include/opcode.h
index 0f08760..5f5826f 100644
--- a/Include/opcode.h
+++ b/Include/opcode.h
@@ -100,6 +100,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define COMPARE_OP 106 /* Comparison operator */
#define IMPORT_NAME 107 /* Index in name list */
#define IMPORT_FROM 108 /* Index in name list */
+#define ACCESS_MODE 109 /* Name (mode is int on top of stack) */
#define JUMP_FORWARD 110 /* Number of bytes to skip */
#define JUMP_IF_FALSE 111 /* "" */
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
index f2d7b1a..0e5ae9f 100644
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -33,7 +33,9 @@ void err_clear PROTO((void));
/* Predefined exceptions */
+extern object *AccessError;
extern object *AttributeError;
+extern object *ConflictError;
extern object *EOFError;
extern object *IOError;
extern object *ImportError;
@@ -59,3 +61,5 @@ extern object *err_errno PROTO((object *));
extern void err_input PROTO((int));
extern void err_badcall PROTO((void));
+
+extern object *err_getexc PROTO((void));