OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tcl/] [doc/] [IntObj.3] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1996-1997 Sun Microsystems, Inc.
3
'\"
4
'\" See the file "license.terms" for information on usage and redistribution
5
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6
'\"
7
'\" RCS: @(#) $Id: IntObj.3,v 1.1.1.1 2002-01-16 10:25:24 markom Exp $
8
'\"
9
.so man.macros
10
.TH Tcl_IntObj 3 8.0 Tcl "Tcl Library Procedures"
11
.BS
12
.SH NAME
13
Tcl_NewIntObj, Tcl_NewLongObj, Tcl_SetIntObj, Tcl_SetLongObj, Tcl_GetIntFromObj, Tcl_GetLongFromObj \- manipulate Tcl objects as integers
14
.SH SYNOPSIS
15
.nf
16
\fB#include \fR
17
.sp
18
Tcl_Obj *
19
\fBTcl_NewIntObj\fR(\fIintValue\fR)
20
.sp
21
Tcl_Obj *
22
\fBTcl_NewLongObj\fR(\fIlongValue\fR)
23
.sp
24
\fBTcl_SetIntObj\fR(\fIobjPtr, intValue\fR)
25
.sp
26
\fBTcl_SetLongObj\fR(\fIobjPtr, longValue\fR)
27
.sp
28
int
29
\fBTcl_GetIntFromObj\fR(\fIinterp, objPtr, intPtr\fR)
30
.sp
31
int
32
\fBTcl_GetLongFromObj\fR(\fIinterp, objPtr, longPtr\fR)
33
.SH ARGUMENTS
34
.AS Tcl_Interp *interp
35
.AP int intValue in
36
Integer value used to initialize or set an integer object.
37
.AP long longValue in
38
Long integer value used to initialize or set an integer object.
39
.AP Tcl_Obj *objPtr in/out
40
For \fBTcl_SetIntObj\fR and \fBTcl_SetLongObj\fR,
41
this points to the object to be converted to integer type.
42
For \fBTcl_GetIntFromObj\fR and \fBTcl_GetLongFromObj\fR,
43
this refers to the object
44
from which to get an integer or long integer value;
45
if \fIobjPtr\fR does not already point to an integer object,
46
an attempt will be made to convert it to one.
47
.AP Tcl_Interp *interp in/out
48
If an error occurs during conversion,
49
an error message is left in the interpreter's result object
50
unless \fIinterp\fR is NULL.
51
.AP int *intPtr out
52
Points to place to store the integer value
53
obtained by \fBTcl_GetIntFromObj\fR from \fIobjPtr\fR.
54
.AP long *longPtr out
55
Points to place to store the long integer value
56
obtained by \fBTcl_GetLongFromObj\fR from \fIobjPtr\fR.
57
.BE
58
 
59
.SH DESCRIPTION
60
.PP
61
These procedures are used to create, modify, and read
62
integer Tcl objects from C code.
63
\fBTcl_NewIntObj\fR, \fBTcl_NewLongObj\fR,
64
\fBTcl_SetIntObj\fR, and \fBTcl_SetLongObj\fR
65
create a new object of integer type
66
or modify an existing object to have integer type.
67
\fBTcl_NewIntObj\fR and \fBTcl_SetIntObj\fR set the object to have the
68
integer value given by \fIintValue\fR,
69
while \fBTcl_NewLongObj\fR and \fBTcl_SetLongObj\fR
70
set the object to have the
71
long integer value given by \fIlongValue\fR.
72
\fBTcl_NewIntObj\fR and \fBTcl_NewLongObj\fR
73
return a pointer to a newly created object with reference count zero.
74
These procedures set the object's type to be integer
75
and assign the integer value to the object's internal representation
76
\fIlongValue\fR member.
77
\fBTcl_SetIntObj\fR and \fBTcl_SetLongObj\fR
78
invalidate any old string representation and,
79
if the object is not already an integer object,
80
free any old internal representation.
81
.PP
82
\fBTcl_GetIntFromObj\fR and \fBTcl_GetLongFromObj\fR
83
attempt to return an integer value from the Tcl object \fIobjPtr\fR.
84
If the object is not already an integer object,
85
they will attempt to convert it to one.
86
If an error occurs during conversion, they return \fBTCL_ERROR\fR
87
and leave an error message in the interpreter's result object
88
unless \fIinterp\fR is NULL.
89
Also, if the long integer held in the object's internal representation
90
\fIlongValue\fR member can not be represented in a (non-long) integer,
91
\fBTcl_GetIntFromObj\fR returns \fBTCL_ERROR\fR
92
and leaves an error message in the interpreter's result object
93
unless \fIinterp\fR is NULL.
94
Otherwise, both procedures return \fBTCL_OK\fR and
95
store the integer or the long integer value
96
in the address given by \fIintPtr\fR and \fIlongPtr\fR respectively.
97
If the object is not already an integer object,
98
the conversion will free any old internal representation.
99
 
100
.SH "SEE ALSO"
101
Tcl_NewObj, Tcl_DecrRefCount, Tcl_IncrRefCount, Tcl_GetObjResult
102
 
103
.SH KEYWORDS
104
integer, integer object, integer type, internal representation, object, object type, string representation

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.