ASFixed Numbers in XCode

Feb 5, 2010 12:00:00 AM | Acrobat SDK ASFixed Numbers in XCode

The XCode debugger will not display ASFixed numbers correctly by default. To properly format them, add a Custom Data Formatter in the form of an XML file.

by Mark Gavin

The XCode debugger will not display ASFixed numbers correctly by default.  You need to add a Custom Data Formatter which contains the instructions to the XCode debugger on how to properly format an ASFixed number for display.  These instructions are in the form of an XML file named CustomDataViews.plist; located in the following path:

(~/Library/Application Support/Apple/Developer Tools/CustomDataViews/CustomDataViews.plist)

Following is a screenshot of how the ASFixed number “100” is normally displayed in XCode:

ASFixedNormal

Displaying ASFixed numbers in hexadecimal can sometimes help:

ASFixedHex

But using a Custom Data Formatter will take the ASFixed numbers; reformat them and place them in the debuggers Summary column:

ASFixedFormatted

The following image is a screenshot of what you will see when you open the file using the Apple Property List Editor:

CustomDataViews

Following is the contents of the CustomDataViews.plist file:

<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
 <key>ASFixed</key>
 <dict>
 <key>SummaryString</key>
 <string>{((float)($VAR) / ((ASFixed) 0x00010000)))}</string>
 </dict>
 <key>AVSDKDependentInteger</key>
 <dict>
 <key>SummaryString</key>
 <string>{(long)($VAR)}</string>
 </dict>
 <key>File Version</key>
 <string>1</string>
 </dict>
 </plist>

Written By: Mark Gavin