Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
CAAtom: Difference between revisions - iPhone Development Wiki

CAAtom: Difference between revisions

From iPhone Development Wiki
(Created page with 'CAAtom refers to a string for identification in {{fwlink|QuartzCore}}. As of 3.1, there are over 300 internal atoms. == CAAtomGetString == {{function signature | signature=N…')
 
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[CAAtom]] refers to a string for identification in {{fwlink|QuartzCore}}. As of 3.1, there are over 300 internal atoms.
[[CAAtom]] refers to a string for identification in {{fwlink|QuartzCore}}. As of 3.1, there are over 300 internal atoms.


== CAAtomGetString ==
== Converting atoms to and from strings ==
{{function signature
{{function signature
| signature=NSString* CAAtomGetString(unsigned atomicValue);
| signature=NSString* CAAtomGetString(uint32_t atomicValue);
| firmware=2.0 –
| firmware=2.0 –
}}
}}
{{function signature
|signature=uint32_t CAInternAtom(NSString* atommicString);
|firmware=2.0 –
}}


There is only 1 exported C function for CAAtom, <tt>CAAtomGetString()</tt>, which converts an integer to its corresponding string value. Most internal code in QuartzCore are identified using atoms. For example, a portion of disassembled code may read:
There are only two exported C functions for CAAtom, <tt>CAAtomGetString()</tt> and <tt>CAInternAtom()</tt>, which convert a CAAtom between an integer and its corresponding string value. Most internal code in QuartzCore is identified using atoms. For example, a portion of disassembled code may read:
  -[CAGradientLayer setLocations:]:
  -[CAGradientLayer setLocations:]:
  ;
  ;
Line 15: Line 19:
  +0000c 0008d9d8            bl                CALayer_setter_kCAValueCopiedPointer
  +0000c 0008d9d8            bl                CALayer_setter_kCAValueCopiedPointer
  +00010 0008d9dc            ldmia            sp!,{r7,pc}                      ; return
  +00010 0008d9dc            ldmia            sp!,{r7,pc}                      ; return
here, the magic number 0xAD is in fact an atom, which is unsurprisingly the value "locations":
Here, the magic number 0xAD is in fact an atom, which is unsurprisingly the value "locations":
<source lang="javascript">
<source lang="javascript">
cy# CAAtomGetString(0xad)
cy# CAAtomGetString(0xad)
Line 21: Line 25:
</source>
</source>


The CAAtom of 0 always returns <tt>&lt;nil&gt;</tt>, and that of an undefined atom is <tt>&lt;unknown&gt;</tt>. Custom atom values are always larger than the built-in ones.
== External links ==
* [https://github.com/kennytm/Miscellaneous/blob/master/dump_stuff.py dump_stuff.py] script to dump internal CAAtom's from the QuartzCore binary.


{{occlass|library=QuartzCore.framework|navbox=1}}
{{occlass|library=QuartzCore.framework|navbox=1}}

Latest revision as of 04:47, 25 October 2014

CAAtom refers to a string for identification in QuartzCore. As of 3.1, there are over 300 internal atoms.

Converting atoms to and from strings

Signature NSString* CAAtomGetString(uint32_t atomicValue);
Available in 2.0 –
Signature uint32_t CAInternAtom(NSString* atommicString);
Available in 2.0 –

There are only two exported C functions for CAAtom, CAAtomGetString() and CAInternAtom(), which convert a CAAtom between an integer and its corresponding string value. Most internal code in QuartzCore is identified using atoms. For example, a portion of disassembled code may read:

-[CAGradientLayer setLocations:]:
;
+00000 0008d9cc             stmdb             sp!,{r7,lr}
+00004 0008d9d0             add               r7,sp,#0x0
+00008 0008d9d4             mov               r1,#0xad
+0000c 0008d9d8             bl                CALayer_setter_kCAValueCopiedPointer
+00010 0008d9dc             ldmia             sp!,{r7,pc}                       ; return

Here, the magic number 0xAD is in fact an atom, which is unsurprisingly the value "locations":

cy# CAAtomGetString(0xad)
"locations"

The CAAtom of 0 always returns <nil>, and that of an undefined atom is <unknown>. Custom atom values are always larger than the built-in ones.

External links

  • dump_stuff.py script to dump internal CAAtom's from the QuartzCore binary.