summaryrefslogtreecommitdiffstats
path: root/generic/tclAbstractList.h
diff options
context:
space:
mode:
authorgriffin <briang42@easystreet.net>2022-08-19 18:08:39 (GMT)
committergriffin <briang42@easystreet.net>2022-08-19 18:08:39 (GMT)
commitf9e3b4dd740c0d808fef53f9eba4b44e67734c34 (patch)
treeb3d402586b3073876cd55494a2ab063aac23eaec /generic/tclAbstractList.h
parent8bf1d3fbf168db2b518b750ba6554b7e33796815 (diff)
downloadtcl-f9e3b4dd740c0d808fef53f9eba4b44e67734c34.zip
tcl-f9e3b4dd740c0d808fef53f9eba4b44e67734c34.tar.gz
tcl-f9e3b4dd740c0d808fef53f9eba4b44e67734c34.tar.bz2
Reimplement AbstrctList type structure to simplify. fix various bugs.
Diffstat (limited to 'generic/tclAbstractList.h')
-rw-r--r--generic/tclAbstractList.h30
1 files changed, 10 insertions, 20 deletions
diff --git a/generic/tclAbstractList.h b/generic/tclAbstractList.h
index dc45709..80ae269 100644
--- a/generic/tclAbstractList.h
+++ b/generic/tclAbstractList.h
@@ -1,7 +1,7 @@
/*
* tclAbstractList.h --
*
- * The AbstractList Obj Type -- a psuedo List
+ * The AbstractList Obj Type -- a psuedo List
*
* Copyright © 2022 by Brian Griffin. All rights reserved.
*
@@ -14,31 +14,21 @@
#include "tclInt.h"
-static inline AbstractList* AbstractListGetInternalRep(
- Tcl_Obj *objPtr) /* Object of type AbstractList */
-{
- const Tcl_ObjInternalRep *irPtr;
- irPtr = TclFetchInternalRep((objPtr), &tclAbstractListType);
- return irPtr ? (AbstractList *)(irPtr->twoPtrValue.ptr1) : NULL;
-}
-
-
static inline const char*
Tcl_AbstractListTypeName(
Tcl_Obj *objPtr) /* Should be of type AbstractList */
{
- AbstractList *abstractListRepPtr =
- AbstractListGetInternalRep(objPtr);
- return (abstractListRepPtr->typeName
- ? abstractListRepPtr->typeName
- : (objPtr->typePtr
- ? objPtr->typePtr->name
- : "pure string"));
+ Tcl_AbstractListType *typePtr;
+ typePtr = Tcl_AbstractListGetType(objPtr);
+ if (typePtr && typePtr->typeName) {
+ return typePtr->typeName;
+ } else {
+ return "abstractlist";
+ }
}
-
-Tcl_Obj* Tcl_NewAbstractListObj(Tcl_Interp *interp, const char* typeName, size_t requiredSize);
-int Tcl_AbstractListCheckedSetProc(Tcl_Obj *objPtr, Tcl_AbstractListProcType ptype, void** procPtr);
+Tcl_Obj *Tcl_NewAbstractListObj(Tcl_Interp *interp, const Tcl_AbstractListType *);
+int Tcl_AbstractListCheckedSetProc(Tcl_Obj *objPtr, Tcl_AbstractListProcType ptype, void **procPtr);
Tcl_WideInt Tcl_AbstractListObjLength(Tcl_Obj *abstractListPtr);
Tcl_Obj* Tcl_AbstractListObjIndex(Tcl_Obj *abstractListPtr, Tcl_WideInt index);
Tcl_Obj* Tcl_AbstractListObjRange(Tcl_Obj *abstractListPtr, Tcl_WideInt fromIdx, Tcl_WideInt toIdx);