Check-in [9d1225715d]

Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Explain the flags TCL_TYPE_?
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 9d1225715d3504468caeb8c60ba6ec09395f0b3b90c3e1c7a1a5a1e06feee2c1
User & Date: jan.nijtmans 2018-10-23 20:07:35
Context
2018-10-24
12:50
New TIP on small change to tcltest for use in CI environments check-in: 10c01a7f93 user: dkf tags: trunk
2018-10-23
20:07
Explain the flags TCL_TYPE_? check-in: 9d1225715d user: jan.nijtmans tags: trunk
19:32
Add more use-cases and explanation check-in: 779eca90d4 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tip/481.md.

49
50
51
52
53
54
55
56
57









58
59
60
61
62
63
64
65
66
67
68
new functions don't need to be used in code, the original function can be used pointing to
a size_t length variable as well.

 > int **Tcl\_GetValue**\(Tcl\_Interp \*interp, Tcl\_Obj \*_objPtr_, void \*_valuePtr_, int _flags_\)

This functions is able to function the same as Tcl\_GetIntFromObj, Tcl\_GetLongFromObj,
Tcl\_GetWideFromObj and Tcl\_GetDoubleFromObj. The flags argument determines the actual
conversion done.










 > int **Tcl\_GetUIntFromObj**\(Tcl\_Interp \*interp, Tcl\_Obj \*_objPtr_, void \*_valuePtr_\)

This is a wrapper macro around **Tcl\_GetValue**, handling unsigned integer values only.

For Tcl 9.0, the function **Tcl\_GetIntFromObj** is modified to return 1 when the Tcl\_Obj
value is in the range -2147483648 .. 2147483647.

# Implementation

See the _tip-481_ branch in Tcl's fossil repository
<https://core.tcl.tk/tcl/timeline?r=tip-481> .






|

>
>
>
>
>
>
>
>
>











49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
new functions don't need to be used in code, the original function can be used pointing to
a size_t length variable as well.

 > int **Tcl\_GetValue**\(Tcl\_Interp \*interp, Tcl\_Obj \*_objPtr_, void \*_valuePtr_, int _flags_\)

This functions is able to function the same as Tcl\_GetIntFromObj, Tcl\_GetLongFromObj,
Tcl\_GetWideFromObj and Tcl\_GetDoubleFromObj. The flags argument determines the actual
conversion done. The following flags are possible.

 > **TCL\_TYPE\_I**(int \| long \| Tcl_WideInt) :  valuePtr points at an integer of given size
 
 > **TCL\_TYPE\_U**(int \| long \| Tcl_WideInt) :  valuePtr points at an unsigned integer of given size
 
 > **TCL\_TYPE\_D**(float \| double) : valuePtr points at a float or double

Those 3 macro's use the sizeof() macro on the type to provide the requested size to Tcl\_GetValue(). Actually,
you can use any integer type, so e.g. size\_t or intmax\_t work as well.
  
 > int **Tcl\_GetUIntFromObj**\(Tcl\_Interp \*interp, Tcl\_Obj \*_objPtr_, void \*_valuePtr_\)

This is a wrapper macro around **Tcl\_GetValue**, handling unsigned integer values only.

For Tcl 9.0, the function **Tcl\_GetIntFromObj** is modified to return 1 when the Tcl\_Obj
value is in the range -2147483648 .. 2147483647.

# Implementation

See the _tip-481_ branch in Tcl's fossil repository
<https://core.tcl.tk/tcl/timeline?r=tip-481> .