EasyManuals Logo
Home>Texas Instruments>Calculator>TI-89

Texas Instruments TI-89 Developer's Guide

Texas Instruments TI-89
1398 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #137 background imageLoading...
Page #137 background image
95
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
10. Error Handling
This chapter describes the Advanced Mathematics Software (AMS)
implementation of error handling — how to throw errors, why you might want to
throw an error, how to catch errors, and how to clean up when an error occurs.
10.1. Throwing an Error
Your application or ASM program can signal exceptional conditions by throwing
an error. Calling
ER_throwVar
in your app diverts execution to an error handler,
typically the system error handler.
ER_throwVar
accepts one argument, an
integer in the range 0 to 0xEFF. System error numbers range from 0x000 to
0x7FF. Application-defined errors begin at OO_FIRST_APP_STRING (0x800).
Look in tiams.h for macros beginning with ER_ for predefined error numbers. An
error message is associated with each predefined error number.
Perhaps the condition most frequently needing special attention is the case when
HeapAlloc
cannot fulfill a request for memory.
HeapAlloc
returns H_NULL if it
cannot allocate the requested amount of memory. Your app should always test
the return value of
HeapAlloc
. Under most circumstances, if your app cannot
allocate the memory it needs, it should throw an error.
h = HeapAlloc(BUF_SIZE);
if (h == H_NULL)
ER_throwVar(ER_MEMORY); /* error number defined in tiams.h */
The system error handler catches this error and displays a dialog box indicating
there was a memory error.
Note:
Think of
ER_throwVar
as a long jump rather than a subroutine call. Execution does not
return from the
ER_throwVar
call.
Some AMS routines may throw an error instead of returning an error code.
HeapAllocThrow
, for example, tries to allocate memory but throws the
ER_MEMORY
error automatically if it fails.
Macro
ER_throw
works like
ER_throwVar
but accepts only integer constants.
The Sierra C™ compiler generates more compact code for the
ER_throw
macro.
10.2. Delayed Error Messages
You should not throw an error while processing events CM_START,
CM_ACTIVATE, CM_FOCUS, CM_UNFOCUS, CM_DEACTIVATE, CM_QUIT,
CM_WPAINT, CM_INSTALL, CM_UNINSTALL, CM_PACK, CM_UNPACK,

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals