Standard Libraries - Keithley 2601 Reference Manual

System sourcemeter 2600 series (smu)
Hide thumbs Also See for 2601:
Table of Contents

Advertisement

Series 2600 System SourceMeter® Instruments Reference Manual

Standard libraries

In addition to the standard programming constructs above, TSL includes standard libraries that
contain useful functions for string manipulation, mathematics, etc. TSL also includes instrument
control extension libraries. These libraries provide programming interfaces to the instrumentation
accessible by the TSP. These libraries are automatically loaded when the TSP starts and do not
need to be managed by the programmer.
Base library functions
print(x)
collectgarbage([limit])
gcinfo()
tonumber(x [,base])
tostring(x)
type(v)
NOTE: TSL does automatic memory management. That means that you do not have to worry about
allocating memory for new objects and freeing it when the objects are no longer needed. TSL manages
memory automatically by running a garbage collector from time to time to collect all dead objects (that is,
those objects that are no longer accessible from TSL). All objects in TSL are subject to automatic
management: tables, variables, functions, threads, and strings. TSL uses two numbers to control its
garbage-collection cycles. One number counts how many bytes of dynamic memory TSL is using; the
other is a threshold. When the number of bytes crosses the threshold, TSL runs the garbage collector,
which reclaims the memory of all dead objects. The byte counter is adjusted, and then the threshold is
reset to twice the new value of the byte counter.
2600S-901-01 Rev. C / January 2008
Prints the argument x to the active host interface, using the
function to convert x to a string.
tostring()
Sets the garbage-collection threshold to the given limit (in
Kbytes) and checks it against the byte counter. If the new
threshold is smaller than the byte counter, then TSL
immediately runs the garbage collector. If the limit parameter
is absent, it defaults to 0 (thus forcing a garbage-collection
cycle). See Note for more information.
Returns the number of Kbytes of dynamic memory that TSP
is using.
Returns x converted to a number. If x is already a number, or
a convertible string, then the number is returned; otherwise, it
returns nil.
An optional argument specifies the base to interpret the
numeral. The base may be any integer between 2 and 36,
inclusive. In bases above 10, the letter 'A' (in either upper or
lower case) represents 10, 'B' represents 11, and so forth,
with 'Z' representing 35. In base 10, the default, the number
may have a decimal part, as well as an optional exponent. In
other bases, only unsigned integers are accepted.
Receives an argument of any type and converts it to a string
in a reasonable format.
Returns the type of its only argument, coded as a string. The
possible results of this function are: nil, number, Boolean,
table, or function.
Return to
Section Topics
Section 2: TSP Programming
2-53

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

26362602261126122635

Table of Contents