svalue
__NAME__ svalue - internal type for storing Pike values __DESCRIPTION__ The 'struct svalue' contains one Pike 'value', variables, arrays and the evaluator are all svalues. An svalue consists of three elements: type, subtype and a union containing the actual value. The type is a short which tells you what type the svalue is. The value is one of the following: - ~~T_ARRAY~~: When type is T_ARRAY, the array is stored in the 'array' member of the union. So if sval is the pointer to the svalue, you would use sval->u.array to access the actual array. - ~~T_MAPPING~~: In this case, you use sval->u.mapping. - ~~T_MULTISET~~: sval->u.multiset - ~~T_OBJECT~~: sval->u.object - ~~T_FUNCTION~~: Functions are a bit more difficult, sval->u.object is the object the function is in, and sval->subtype is the number of the function in that object. - ~~T_PROGRAM~~: sval->u.program is the struct program you want. - ~~T_STRING~~: sval->u.string - ~~T_FLOAT~~: sval->u.float_number - ~~T_INT~~: sval->u.integer, a special case is that sval->subtype is used in some cases to represent the value 'undefined'. This is what zero_type detects. There are lots of functions operating on svalues, so you shouldn't have to do all that much stuff with them yourself. However, for now you do need to check the type and extract the proper member of the union yourself when writing your own C functions for Pike. __KEYWORDS__ internals Powered by PikeWiki2 |
|||
gotpike.org | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University |