Appligent Labs

ASFixed Numbers in XCode | Appligent Labs

Written by Mark Gavin | Feb 5, 2010 5:00:00 AM

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:

Displaying ASFixed numbers in hexadecimal can sometimes help:

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

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

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>