Texas Instruments TI89 Developer Guide - Page 117
Optimizing Code Space, 1 File Format, AP_EventHandler, appWRect
UPC - 033317198566
View all Texas Instruments TI89 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 117 highlights
Chapter 8: Integrating a Flash Application 75 8.6. F-Lines can also be used to convert long calls or jumps to relative jumps or calls which reduces the app's relocation table and hence the app's size. See section 7.1 File Format for a description of the relocation table. Optimizing Code Space One of the optimizations involves reducing the apps relocation table. All references to an app's global variables made by an app require a relocation entry to be stored with the app. If there are multiple references to a particular global variable in an app, the global references can be replaced with local pointers as shown in the example below. static WINDOW appW; static WIN_RECT appWRect; void AP_EventHandler(pFrame self, PEvent e) { WINDOW *winPtr = &appW; switch (e->command) { case CM_START: appWRect = *(e->info.startInfo.startRect); if (WinOpen( winPtr, &appWRect, WF_TTY | WF_DUP_SCR)) WinClr( winPtr ); else EV_quit(); break; case CM_ACTIVATE: EV_defaultHandler(e); WinBeginPaint( winPtr ); WinActivate( winPtr ); WinStr( winPtr, "Just activated\n" ); break; . . . } } In the preceding example, since there were several references to the global variable appW the pointer winPtr was initialized to the address of appW at the entry point to the AP_EventHandler routine and used instead of &appW. Since there was only one additional reference to appWRect an additional pointer to access that global was not created. TI-89 / TI-92 Plus Developer Guide Not for Distribution Beta Version January 26, 2001