Debugging any regular t and short names
SeanParent (Talk | contribs) |
SeanParent (Talk | contribs) |
||
| (One intermediate revision by one user not shown) | |||
| Line 42: | Line 42: | ||
ADOBE_SHORT_NAME_TYPE('M','y','C','l', my_space::my_class); | ADOBE_SHORT_NAME_TYPE('M','y','C','l', my_space::my_class); | ||
| + | </pre> | ||
| + | |||
| + | Once defined, a short name for a particular type can be referred to using the short_name type function: | ||
| + | |||
| + | <pre> | ||
| + | cout << adobe::short_name<double>::value; | ||
</pre> | </pre> | ||
| Line 93: | Line 99: | ||
| char || char | | char || char | ||
|- | |- | ||
| − | | signed char || | + | | signed char || schr |
|- | |- | ||
| uchar || uchr | | uchar || uchr | ||
|- | |- | ||
|} | |} | ||
Latest revision as of 22:13, 11 February 2009
Debugging the any_regular_t type can be problematic if you don't know what the data type of the value stored in it is. To make it simpler for to view an any_regular_t in the debugger, release 1.0.41 contains a four character short name for the type which is stored at the top of the vtable.
The structure of an any_regular_t is a pair of doubles, the first word of the first double contains a pointer to a vtable.
| double | double | |
|---|---|---|
| vtable* | pad (on 32 bit machines) | data or data* |
The first word of the vtable contains a version number on release builds (currently 1) and a short name (a four character constant) on debug builds.
| version or short name |
| ... proc pointers ... |
By convention, the four character codes are stored in little endian order (so as to be readable in the debugger when viewing memory) -
| 'd' | 'i' | 'c' | 't' | (remainder of word is zeros on 64 bit machine) |
Also by convention, ASL will only use lower case letters in their short names - clients are free to use upper case letters. Note that the short name facility is to aid debugging _only_. it is not intended as a unique name for every type.
You can define a name for your own type using the ADOBE_SHORT_NAME_TYPE() macro in the global scope defined in <adobe/typeinfo.hpp>. For example:
namespace my_space {
class my_class { };
} // namespace my_space
ADOBE_SHORT_NAME_TYPE('M','y','C','l', my_space::my_class);
Once defined, a short name for a particular type can be referred to using the short_name type function:
cout << adobe::short_name<double>::value;
The following is a list of the short names for the CEL types defined in ASL:
| type | name |
|---|---|
| double | dble |
| bool | bool |
| empty_t | emty |
| array_t | arry |
| dictionary_t | dict |
| string_t | strg |
| name_t | name |
In addition, the following short names are defined though these won't typically appear in an any_regular_t:
| type | name |
|---|---|
| string16_t | st16 |
| float | flot |
| int | int_ |
| short | shrt |
| long | long |
| unsigned int | uint |
| unsigned short | ushr |
| unsigned long | ulng |
| char | char |
| signed char | schr |
| uchar | uchr |