[ Main Table Of Contents | Table Of Contents | Keyword Index ]

c::index(n) 1 doc "Tcl Data Structures"


c::index - TclGetForIndex emulation

Table Of Contents



Welcome to Struct, a set of packages providing various data structures to Tcl, and additional operations for existing Tcl structures.

This package provides a replication of Tcl 8.5's internal function TclGetForIndex handling all forms of list indices, i.e. all of

  1. INT

  2. end

  3. end-INT

  4. INT+INT

  5. INT-INT


int cindex_get ( Tcl_Interp* interp, Tcl_Obj* objPtr, int endValue, int* indexPtr )

This function replicates function TclGetForIndex.

The result is a Tcl status value (TCL_OK, TCL_ERROR).

It parses the data in objPtr, stores the resulting integer list index into the indexPtr and returns TCL_OK. It may change the Tcl_ObjType of objPtr.

In case of an error it returns TCL_ERROR, leaves an error message in the interp, and does not change indexPtr.

The endValue tells the function what value to use for end and related indices.


This package, written by Andreas Kupries, is BSD licensed.

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such at the Struct Tracker. Please also report any ideas for enhancements you may have for either package and/or documentation.


TclGetForIndex emulation, data structures


Data structures