Skip to content

Commit 1096c42

Browse files
committed
ti/vars.h: improve documentation.
1 parent bb562f7 commit 1096c42

File tree

1 file changed

+55
-22
lines changed

1 file changed

+55
-22
lines changed

src/ce/include/ti/vars.h

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,14 @@ extern "C" {
7979
#define OS_TYPE_STR (0x04)
8080
/** Unprotected program */
8181
#define OS_TYPE_PRGM (0x05)
82-
/** Protected (uneditable) program */
82+
/** Protected (uneditable) program, generally ASM program */
8383
#define OS_TYPE_PROT_PRGM (0x06)
84+
/** Picture */
85+
#define OS_TYPE_PIC (0x07)
86+
/** Graph DataBase */
87+
#define OS_TYPE_GDB (0x08)
88+
/** Smart Equation */
89+
#define OS_TYPE_SMARTEQU (0x0B)
8490
/** Complex variable */
8591
#define OS_TYPE_CPLX (0x0C)
8692
/** Complex variable list */
@@ -89,6 +95,27 @@ extern "C" {
8995
#define OS_TYPE_APPVAR (0x15)
9096
/** Temporary program, deleted on homescreen */
9197
#define OS_TYPE_TMP_PRGM (0x16)
98+
/** Var group */
99+
#define OS_TYPE_GROUP (0x17)
100+
/** Real Fraction */
101+
#define OS_TYPE_REALFRAC (0x18)
102+
/** Image */
103+
#define OS_TYPE_IMAGE (0x1A)
104+
105+
/** (83PCE-only) Exact Complex Fraction */
106+
#define OS_TYPE_EXACTCPLXFRAC (0x1B)
107+
/** (83PCE-only) Exact Real Radical */
108+
#define OS_TYPE_EXACTREALRAD (0x1C)
109+
/** (83PCE-only) Exact Complex Radical */
110+
#define OS_TYPE_EXACTCPLXRAD (0x1D)
111+
/** (83PCE-only) Exact Complex Pi */
112+
#define OS_TYPE_EXACTCPLXPI (0x1E)
113+
/** (83PCE-only) Exact Complex Pi Fraction */
114+
#define OS_TYPE_EXACTCPLXPIFRAC (0x1F)
115+
/** (83PCE-only) Exact Real Pi */
116+
#define OS_TYPE_EXACTREALPI (0x20)
117+
/** (83PCE-only) Exact Real Pi Fraction */
118+
#define OS_TYPE_EXACTREALPIFRAC (0x21)
92119

93120
/** Name of Ans variable */
94121
#define OS_VAR_ANS "\x72\0"
@@ -236,29 +263,30 @@ size_t os_MemChk(void **free);
236263
tiflags void os_ArcChk(void);
237264

238265
/**
266+
* Useful for starting the iteration in the first parameter of \c os_NextSymEntry
239267
* @return A pointer to symtable of the OS
240268
*/
241269
void *os_GetSymTablePtr(void);
242270

243271
/**
244272
* Iterates over the OS symbol table.
245273
* This table stores the name and pointers to the variables (such as AppVars and programs)
246-
* on the calculator. This function can be used to find all the variables on the calculator,
247-
* to search for a specific variable the function os_ChkFindSym should be used instead.
274+
* on the calculator. This function can be used to find all the variables (including system ones).
275+
* To search for a specific variable, the function \c os_ChkFindSym should be used instead.
248276
*
249277
* @param[in] entry Current iterative entry, pass the output of os_GetSymTablePtr to start the search.
250-
* @param[in] type Type of variable returned.
251-
* @param[in] nameLength Length of variable name. The name may not be null-terminated.
252-
* @param[in] name Variable name.
253-
* @param[in] data Returns a pointer to the variable's data, which may be in either RAM or flash.
254-
* @return next entry to pass to the \p entry argument on subsequent calls.
278+
* @param[out] type Type of variable returned.
279+
* @param[out] nameLength Length of variable name. The name may not be null-terminated.
280+
* @param[out] name Variable name.
281+
* @param[out] data Returns a pointer to the variable's data, which may be in either RAM or flash.
282+
* @return next entry (to pass to the \p entry argument on subsequent calls), or \c NULL at the end.
255283
*/
256284
void *os_NextSymEntry(void *entry, uint24_t *type, uint24_t *nameLength, char *name, void **data);
257285

258286
/**
259287
* Delete a var from RAM.
260288
*
261-
* @param[in] entry An entry as returned from os_NextSymEntry().
289+
* @param[in] entry An entry as used in (or returned from) \c os_NextSymEntry or \c os_ChkFindSym.
262290
* @return TIOS System Error Code or 0 on success.
263291
*/
264292
int os_DelSymEntry(void *entry);
@@ -276,9 +304,9 @@ int os_CreateString(const char *name, const string_t *data);
276304
* Gets a pointer to an TIOS Str's data, which may be in archive.
277305
*
278306
* @param[in] name Name of the Str to lookup.
279-
* @param[in] archived Set to 1 if the Str is archived, otherwise 0, may be NULL if you don't need it.
307+
* @param[out] archived Set to 1 if the Str is archived, otherwise 0, may be \c NULL if you don't need it.
280308
* @returns A pointer to the Str data
281-
* @note Returns NULL if the Str doesn't exist, otherwise a pointer to the size bytes.
309+
* @note Returns \c NULL if the Str doesn't exist, otherwise a pointer to the size bytes.
282310
*/
283311
string_t *os_GetStringData(const char *name, int *archived);
284312

@@ -295,9 +323,9 @@ int os_CreateEquation(const char *name, const equ_t *data);
295323
* Gets a pointer to an TIOS Equ's data, which may be in archive.
296324
*
297325
* @param[in] name Name of the Equ to lookup.
298-
* @param[in] archived Set to 1 if the Equ is archived, otherwise 0, may be NULL if you don't need it.
326+
* @param[out] archived Set to 1 if the Equ is archived, otherwise 0, may be \c NULL if you don't need it.
299327
* @returns A pointer to the Equ data.
300-
* @note Returns NULL if the Equ doesn't exist, otherwise a pointer to the size bytes.
328+
* @note Returns \c NULL if the Equ doesn't exist, otherwise a pointer to the size bytes.
301329
*/
302330
equ_t *os_GetEquationData(const char *name, int *archived);
303331

@@ -307,7 +335,7 @@ equ_t *os_GetEquationData(const char *name, int *archived);
307335
* @param[in] name Name of the AppVar to create.
308336
* @param[in] size Size of AppVar to create.
309337
* @returns A pointer to the AppVar data.
310-
* @note Returns NULL if creation failed for some reason, otherwise a pointer to the size bytes.
338+
* @note Returns \c NULL if creation failed for some reason, otherwise a pointer to the size bytes.
311339
* @note If successful, the AppVar contents will be uninitialized, aka filled with random bytes.
312340
*/
313341
var_t *os_CreateAppVar(const char *name, uint16_t size);
@@ -316,14 +344,16 @@ var_t *os_CreateAppVar(const char *name, uint16_t size);
316344
* Gets a pointer to a TIOS AppVar's data, which may be in archive.
317345
*
318346
* @param[in] name Name of the AppVar to lookup.
319-
* @param[in] archived Set to 1 if the AppVar is archived, otherwise 0, may be NULL if you don't need it.
347+
* @param[out] archived Set to 1 if the AppVar is archived, otherwise 0, may be \c NULL if you don't need it.
320348
* @returns A pointer to the AppVar data.
321-
* @note Returns NULL if the AppVar doesn't exist, otherwise a pointer to the size bytes.
349+
* @note Returns \c NULL if the AppVar doesn't exist, otherwise a pointer to the size bytes.
322350
*/
323351
var_t *os_GetAppVarData(const char *name, int *archived);
324352

325353
/**
326354
* Deletes an AppVar from RAM.
355+
* This may trigger an OS Error screen if there was an issue deleting it.
356+
* Use \c os_DelSymEntry instead if you want an error code returned.
327357
*
328358
* @param[in] name Name of the AppVar to delete.
329359
*/
@@ -334,8 +364,8 @@ void os_DelAppVar(const char *name);
334364
*
335365
* @param[in] type Type of symbol to find
336366
* @param[in] name Pointer to name of symbol to find
337-
* @param[out] entry Can be NULL if you don't care
338-
* @param[out] data Can be NULL if you don't care
367+
* @param[out] entry Can be \c NULL if you don't care
368+
* @param[out] data Can be \c NULL if you don't care
339369
* @return If file exists, returns 1 and sets entry and data, otherwise returns 0.
340370
*/
341371
int os_ChkFindSym(uint8_t type, const char *name, void **entry, void **data);
@@ -354,8 +384,8 @@ int os_GetVarSize(const char *name, size_t *size);
354384
* Gets the dimensions of a matrix.
355385
*
356386
* @param[in] name Name of the matrix to lookup.
357-
* @param[in] rows Pointer to store number of rows.
358-
* @param[in] cols Pointer to store number of columns.
387+
* @param[out] rows Pointer to store number of rows.
388+
* @param[out] cols Pointer to store number of columns.
359389
* @return TIOS System Error Code or 0 on success.
360390
*/
361391
int os_GetMatrixDims(const char *name, int *rows, int *cols);
@@ -447,9 +477,9 @@ int os_SetRealVar(const char *name, const real_t *value);
447477
/**
448478
* Gets the Ans variable
449479
*
450-
* @param[in] type This is set to the current variable type in ANS
480+
* @param[out] type This is set to the current variable type in ANS
451481
* @returns Pointer to the data
452-
* @note Returns NULL if Ans doesn't exist or type is NULL
482+
* @note Returns \c NULL if Ans doesn't exist or type is \c NULL
453483
*/
454484
void *os_GetAnsData(uint8_t *type);
455485

@@ -496,6 +526,8 @@ int os_RunPrgm(const char *prgm, void *data, size_t size, os_runprgm_callback_t
496526

497527
/**
498528
* Evalutes a tokenized expression.
529+
* Note that this doesn't allow "side effects" (for instance, you can't \c DelVar),
530+
* and is similar to what \c expr( does in TI-Basic.
499531
*
500532
* @param[in] data Tokenized expression to evaluate.
501533
* @param[in] len Length of tokenized data.
@@ -510,6 +542,7 @@ int os_Eval(const void *data, size_t len);
510542
* @param[in] name Name of variable to evaluate.
511543
* @returns TIOS System Error Code or 0 on success, with the result stored in
512544
* the Ans variable.
545+
* @see os_Eval
513546
*/
514547
int os_EvalVar(const char *name);
515548

0 commit comments

Comments
 (0)