From fdae48118c13223e176a192699aad3cd2643d30e Mon Sep 17 00:00:00 2001 From: dkf Date: Sat, 5 Apr 2003 01:25:08 +0000 Subject: Build support for dicts on Unix and Windows, plus public API (structure declaration and stubs entries.) --- ChangeLog | 5 +++++ generic/tcl.decls | 45 ++++++++++++++++++++++++++++++++++++++++++++- generic/tcl.h | 15 ++++++++++++++- unix/Makefile.in | 12 ++++++++---- win/Makefile.in | 3 ++- win/makefile.bc | 1 + win/makefile.vc | 3 ++- 7 files changed, 76 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76f59d1..8fcd996 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2003-04-05 Donal K. Fellows + * unix/Makefile.in, win/Makefile.in, win/makefile.[bv]c: Build support. + * generic/tcl.decls: Added dict public API to stubs table. + * generic/tcl.h (Tcl_DictSearch): Added declaration of structure + to allow user code to iterate over dictionaries. + * doc/DictObj.3: New files containing dictionary * doc/dict.n: implementation, documentation and tests * generic/tclDictObj.c: as mandated by TIP #111. diff --git a/generic/tcl.decls b/generic/tcl.decls index 2dbc2c5..f77543f 100644 --- a/generic/tcl.decls +++ b/generic/tcl.decls @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tcl.decls,v 1.94 2002/08/31 06:09:45 das Exp $ +# RCS: @(#) $Id: tcl.decls,v 1.95 2003/04/05 01:25:10 dkf Exp $ library tcl @@ -1754,6 +1754,49 @@ declare 493 generic { Tcl_ChannelType *chanTypePtr) } +# DICTIONARIES - TIP#111 +declare 494 generic { + int Tcl_DictObjPut(Tcl_Interp *interp, Tcl_Obj *dictPtr, + Tcl_Obj *keyPtr, Tcl_Obj *valuePtr) +} +declare 495 generic { + int Tcl_DictObjGet(Tcl_Interp *interp, Tcl_Obj *dictPtr, Tcl_Obj *keyPtr, + Tcl_Obj **valuePtrPtr) +} +declare 496 generic { + int Tcl_DictObjRemove(Tcl_Interp *interp, Tcl_Obj *dictPtr, + Tcl_Obj *keyPtr) +} +declare 497 generic { + int Tcl_DictObjSize(Tcl_Interp *interp, Tcl_Obj *dictPtr, int *sizePtr) +} +declare 498 generic { + int Tcl_DictObjFirst(Tcl_Interp *interp, Tcl_Obj *dictPtr, + Tcl_DictSearch *searchPtr, + Tcl_Obj **keyPtrPtr, Tcl_Obj **valuePtrPtr, int *donePtr) +} +declare 499 generic { + void Tcl_DictObjNext(Tcl_DictSearch *searchPtr, + Tcl_Obj **keyPtrPtr, Tcl_Obj **valuePtrPtr, int *donePtr) +} +declare 500 generic { + void Tcl_DictObjDone(Tcl_DictSearch *searchPtr) +} +declare 501 generic { + int Tcl_DictObjPutKeyList(Tcl_Interp *interp, Tcl_Obj *dictPtr, + int keyc, Tcl_Obj *CONST *keyv, Tcl_Obj *valuePtr) +} +declare 502 generic { + int Tcl_DictObjRemoveKeyList(Tcl_Interp *interp, Tcl_Obj *dictPtr, + int keyc, Tcl_Obj *CONST *keyv) +} +declare 503 generic { + Tcl_Obj *Tcl_NewDictObj(void) +} +declare 504 generic { + Tcl_Obj *Tcl_DbNewDictObj(CONST char *file, int line) +} + ############################################################################## # Define the platform specific public Tcl interface. These functions are diff --git a/generic/tcl.h b/generic/tcl.h index a7443b2..c34f84a 100644 --- a/generic/tcl.h +++ b/generic/tcl.h @@ -13,7 +13,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tcl.h,v 1.155 2003/03/12 19:21:24 dgp Exp $ + * RCS: @(#) $Id: tcl.h,v 1.156 2003/04/05 01:25:10 dkf Exp $ */ #ifndef _TCL @@ -488,6 +488,7 @@ typedef struct Tcl_Trace_ *Tcl_Trace; typedef struct Tcl_Var_ *Tcl_Var; typedef struct Tcl_ChannelTypeVersion_ *Tcl_ChannelTypeVersion; typedef struct Tcl_LoadHandle_ *Tcl_LoadHandle; +typedef struct Tcl_Dict_ *Tcl_Dict; /* * Definition of the interface to procedures implementing threads. @@ -1334,6 +1335,18 @@ typedef struct Tcl_HashSearch { Tcl_InitHashTableEx(tablePtr, keyType, NULL) #endif /* TCL_PRESERVE_BINARY_COMPATABILITY */ +/* + * Structure definition for information used to keep track of searches + * through dictionaries. These fields should not be accessed by code + * outside tclDictObj.c + */ + +typedef struct { + Tcl_HashSearch search; + int epoch; + Tcl_Dict dictionaryPtr; +} Tcl_DictSearch; + /* * Flag values to pass to Tcl_DoOneEvent to disable searches diff --git a/unix/Makefile.in b/unix/Makefile.in index d995944..e134180 100644 --- a/unix/Makefile.in +++ b/unix/Makefile.in @@ -5,7 +5,7 @@ # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.122 2003/04/03 22:12:53 mdejong Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.123 2003/04/05 01:25:11 dkf Exp $ VERSION = @TCL_VERSION@ MAJOR_VERSION = @TCL_MAJOR_VERSION@ @@ -302,9 +302,9 @@ XTTEST_OBJS = xtTestInit.o tclTest.o tclTestObj.o tclTestProcBodyObj.o \ tclThreadTest.o tclUnixTest.o tclXtNotify.o tclXtTest.o GENERIC_OBJS = regcomp.o regexec.o regfree.o regerror.o tclAlloc.o \ - tclAsync.o tclBasic.o tclBinary.o \ - tclCkalloc.o tclClock.o tclCmdAH.o tclCmdIL.o tclCmdMZ.o \ - tclCompCmds.o tclCompExpr.o tclCompile.o tclDate.o tclEncoding.o \ + tclAsync.o tclBasic.o tclBinary.o tclCkalloc.o tclClock.o \ + tclCmdAH.o tclCmdIL.o tclCmdMZ.o tclCompCmds.o tclCompExpr.o \ + tclCompile.o tclDate.o tclDictObj.o tclEncoding.o \ tclEnv.o tclEvent.o tclExecute.o tclFCmd.o tclFileName.o tclGet.o \ tclHash.o tclHistory.o tclIndexObj.o tclInterp.o tclIO.o tclIOCmd.o \ tclIOGT.o tclIOSock.o tclIOUtil.o tclLink.o tclListObj.o \ @@ -353,6 +353,7 @@ GENERIC_SRCS = \ $(GENERIC_DIR)/tclCompExpr.c \ $(GENERIC_DIR)/tclCompile.c \ $(GENERIC_DIR)/tclDate.c \ + $(GENERIC_DIR)/tclDictObj.c \ $(GENERIC_DIR)/tclEncoding.c \ $(GENERIC_DIR)/tclEnv.c \ $(GENERIC_DIR)/tclEvent.c \ @@ -833,6 +834,9 @@ tclCompExpr.o: $(GENERIC_DIR)/tclCompExpr.c tclCompile.o: $(GENERIC_DIR)/tclCompile.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclCompile.c +tclDictObj.o: $(GENERIC_DIR)/tclDictObj.c + $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclDictObj.c + tclEncoding.o: $(GENERIC_DIR)/tclEncoding.c $(CC) -c $(CC_SWITCHES) $(GENERIC_DIR)/tclEncoding.c diff --git a/win/Makefile.in b/win/Makefile.in index 929defc..8a2e047 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -5,7 +5,7 @@ # "autoconf" program (constructs like "@foo@" will get replaced in the # actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.68 2003/01/28 11:03:53 mdejong Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.69 2003/04/05 01:25:11 dkf Exp $ VERSION = @TCL_VERSION@ @@ -218,6 +218,7 @@ GENERIC_OBJS = \ tclCompExpr.$(OBJEXT) \ tclCompile.$(OBJEXT) \ tclDate.$(OBJEXT) \ + tclDictObj.$(OBJEXT) \ tclEncoding.$(OBJEXT) \ tclEnv.$(OBJEXT) \ tclEvent.$(OBJEXT) \ diff --git a/win/makefile.bc b/win/makefile.bc index 69713cc..eb01228 100644 --- a/win/makefile.bc +++ b/win/makefile.bc @@ -190,6 +190,7 @@ TCLOBJS = \ $(TMPDIR)\tclCompExpr.obj \ $(TMPDIR)\tclCompile.obj \ $(TMPDIR)\tclDate.obj \ + $(TMPDIR)\tclDictObj.obj \ $(TMPDIR)\tclEncoding.obj \ $(TMPDIR)\tclEnv.obj \ $(TMPDIR)\tclEvent.obj \ diff --git a/win/makefile.vc b/win/makefile.vc index 386e637..771ebe8 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -12,7 +12,7 @@ # Copyright (c) 2001-2002 David Gravereaux. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.103 2003/03/23 03:06:31 kennykb Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.104 2003/04/05 01:25:11 dkf Exp $ #------------------------------------------------------------------------------ !if "$(MSVCDIR)" == "" @@ -236,6 +236,7 @@ TCLOBJS = \ $(TMP_DIR)\tclCompExpr.obj \ $(TMP_DIR)\tclCompile.obj \ $(TMP_DIR)\tclDate.obj \ + $(TMP_DIR)\tclDictObj.obj \ $(TMP_DIR)\tclEncoding.obj \ $(TMP_DIR)\tclEnv.obj \ $(TMP_DIR)\tclEvent.obj \ -- cgit v0.12