Browse Source

Documentation:
* fill in the prototypes of is_executable, push_mrow_aux, push_zero_partial_column;
* document init_list_indices and init_matrix_indices, move them to estack.h;
* create "List elements" and "Matrix elements" examples for showing the use of init_list_indices and init_matrix_indices.

git-svn-id: file:///var/svn/tigccpp/trunk@1351 9552661e-59e3-4036-b4f2-dbe53926924f

debrouxl 15 years ago
parent
commit
5028023d1f

+ 1 - 1
tigcc/doc/System/Include/basfunc.h/push_median.hsf

@@ -16,5 +16,5 @@ Executes TI-Basic 'median' function.
 
 
 [References]
-Out=basfunc.h/push_approx, basfunc.h/push_string, basop.h/push_sum, estack.h/check_estack_size, estack.h/compare_expressions, estack.h/delete_between, estack.h/is_matrix, estack.h/push_expression, estack.h/push_quantum, estack.h/push_quantum_pair, estack.h/top_estack, unknown.h/compare_numbers, unknown.h/divide_top, unknown.h/get_list_indices, unknown.h/get_matrix_indices, unknown.h/init_list_indices, unknown.h/Integer2Index, unknown.h/primary_tag_list
+Out=basfunc.h/push_approx, basfunc.h/push_string, basop.h/push_sum, estack.h/check_estack_size, estack.h/compare_expressions, estack.h/delete_between, estack.h/is_matrix, estack.h/push_expression, estack.h/push_quantum, estack.h/push_quantum_pair, estack.h/top_estack, unknown.h/compare_numbers, unknown.h/divide_top, unknown.h/get_list_indices, unknown.h/get_matrix_indices, estack.h/init_list_indices, unknown.h/Integer2Index, unknown.h/primary_tag_list
 Out_EV_eventLoop=1

+ 28 - 0
tigcc/doc/System/Include/estack.h/init_list_indices.hsf

@@ -0,0 +1,28 @@
+[Main]
+Name=init_list_indices
+Type=Function
+Subtype=ROM Call
+Header Files=estack.h
+Definition=ESI *init_list_indices (ESI *indices, CESI expr);
+MinAMS=1.01
+
+[ROM Call]
+Index=$2BA
+
+[Description]
+Computes and stores the indices of the elements of a list.
+
+[Explanation]
+init_list_indices stores the index of the first element to <I>indices</I>, then it
+repeatedly calls <A HREF="$$LINK(estack.h/next_expression_index)">next_expression_index</A> and
+stores the result to <I>indices</I> until <A HREF="$$LINK(estack.h/Tags)">END_TAG</A> is reached.
+<BR>
+<I>expr</I> is assumed to point to a <A HREF="$$LINK(estack.h/Tags)">LIST_TAG</A>.
+init_list_indices returns <I>indices</I>.
+<BR><BR>
+Here is an example (called "List elements") which displays the list elements as returned by
+init_list_indices: $$EXAMPLE(List elements.c)
+
+[References]
+In=unknown.h/get_list_indices, unknown.h/push_symbolic_qr_fact, basfunc.h/push_median
+Out=estack.h/next_expression_index

+ 28 - 0
tigcc/doc/System/Include/estack.h/init_matrix_indices.hsf

@@ -0,0 +1,28 @@
+[Main]
+Name=init_matrix_indices
+Type=Function
+Subtype=ROM Call
+Header Files=estack.h
+Definition=ESI *init_matrix_indices (ESI *indices, CESI expr);
+MinAMS=1.01
+
+[ROM Call]
+Index=$2BB
+
+[Description]
+Computes and stores the indices of the elements of a matrix.
+
+[Explanation]
+init_matrix_indices stores the index of the first element of the first row to <I>indices</I>, then
+it repeatedly calls <A HREF="$$LINK(estack.h/next_expression_index)">next_expression_index</A> and
+stores the result to <I>indices</I> until the <A HREF="$$LINK(estack.h/Tags)">END_TAG</A>
+for the whole matrix is reached.<BR>
+<I>expr</I> is assumed to point to a double <A HREF="$$LINK(estack.h/Tags)">LIST_TAG</A>.
+init_matrix_indices returns <I>indices</I>.
+<BR><BR>
+Here is an example (called "Matrix elements") which displays the matrix elements as returned by
+init_matrix_indices: $$EXAMPLE(Matrix elements.c)
+
+[References]
+Out=estack.h/next_expression_index
+In=unknown.h/get_matrix_indices, unknown.h/push_lu_fact, unknown.h/push_symbolic_qr_fact

File diff suppressed because it is too large
+ 0 - 0
tigcc/doc/System/Include/estack.h/next_expression_index.hsf


+ 1 - 1
tigcc/doc/System/Include/unknown.h/get_list_indices.hsf

@@ -17,4 +17,4 @@ Index=$2B8
 
 [References]
 In=basfunc.h/push_list_to_mat, basfunc.h/push_median, basfunc.h/push_mrowadd, basfunc.h/push_rowadd, basfunc.h/push_rowdim, basfunc.h/push_rowswap, basfunc.h/push_stddev, basfunc.h/push_variance
-Out=unknown.h/init_list_indices, args.h/RemainingArgCnt, estack.h/check_estack_size, estack.h/top_estack
+Out=estack.h/init_list_indices, args.h/RemainingArgCnt, estack.h/check_estack_size, estack.h/top_estack

+ 1 - 1
tigcc/doc/System/Include/unknown.h/get_matrix_indices.hsf

@@ -17,4 +17,4 @@ Index=$2B9
 
 [References]
 In=basfunc.h/push_cross_product, basfunc.h/push_diag, basfunc.h/push_matnorm, basfunc.h/push_median, basfunc.h/push_rownorm, basfunc.h/push_submat, basop.h/push_matrix_product, estack.h/push_transpose_aux, bascmd.h/cmd_lu_fact
-Out=unknown.h/init_matrix_indices, args.h/RemainingArgCnt, estack.h/check_estack_size, estack.h/top_estack
+Out=estack.h/init_matrix_indices, args.h/RemainingArgCnt, estack.h/check_estack_size, estack.h/top_estack

+ 0 - 20
tigcc/doc/System/Include/unknown.h/init_list_indices.hsf

@@ -1,20 +0,0 @@
-[Main]
-Name=init_list_indices
-Type=Function
-Subtype=ROM Call
-Header Files=unknown.h
-Definition=unknown_retval init_list_indices ();
-MinAMS=1.01
-
-[ROM Call]
-Index=$2BA
-
-[Description]
-
-
-[Explanation]
-
-
-[References]
-In=unknown.h/get_list_indices, unknown.h/push_symbolic_qr_fact, basfunc.h/push_median
-Out=estack.h/next_expression_index

+ 0 - 20
tigcc/doc/System/Include/unknown.h/init_matrix_indices.hsf

@@ -1,20 +0,0 @@
-[Main]
-Name=init_matrix_indices
-Type=Function
-Subtype=ROM Call
-Header Files=unknown.h
-Definition=unknown_retval init_matrix_indices ();
-MinAMS=1.01
-
-[ROM Call]
-Index=$2BB
-
-[Description]
-
-
-[Explanation]
-
-
-[References]
-Out=estack.h/next_expression_index
-In=unknown.h/get_matrix_indices, unknown.h/push_lu_fact, unknown.h/push_symbolic_qr_fact

+ 1 - 1
tigcc/doc/System/Include/unknown.h/is_executable.hsf

@@ -3,7 +3,7 @@ Name=is_executable
 Type=Function
 Subtype=ROM Call
 Header Files=unknown.h
-Definition=unknown_retval is_executable ();
+Definition=short is_executable (CESI);
 
 [ROM Call]
 Index=$25A

File diff suppressed because it is too large
+ 0 - 0
tigcc/doc/System/Include/unknown.h/push_lu_fact.hsf


+ 1 - 1
tigcc/doc/System/Include/unknown.h/push_mrow_aux.hsf

@@ -3,7 +3,7 @@ Name=push_mrow_aux
 Type=Function
 Subtype=ROM Call
 Header Files=unknown.h
-Definition=unknown_retval push_mrow_aux ();
+Definition=void push_mrow_aux (ESI, ESI, short, short);
 MinAMS=1.01
 
 [ROM Call]

File diff suppressed because it is too large
+ 0 - 0
tigcc/doc/System/Include/unknown.h/push_symbolic_qr_fact.hsf


+ 1 - 1
tigcc/doc/System/Include/unknown.h/push_zero_partial_column.hsf

@@ -3,7 +3,7 @@ Name=push_zero_partial_column
 Type=Function
 Subtype=ROM Call
 Header Files=unknown.h
-Definition=unknown_retval push_zero_partial_column ();
+Definition=void push_zero_partial_column (ESI, short, short);
 MinAMS=1.01
 
 [ROM Call]

+ 45 - 0
tigcc/examples/List elements.c

@@ -0,0 +1,45 @@
+// Shows how the init_list_indices function works.
+
+#define USE_TI89              // Compile for TI-89
+#define USE_TI92PLUS          // Compile for TI-92 Plus
+#define USE_V200              // Compile for V200
+
+#define MIN_AMS 101           // Compile for AMS 1.01 or higher
+#define SAVE_SCREEN           // Save/Restore LCD Contents
+
+#include <tigcclib.h>         // Include All Header Files
+
+// The {1, 0, -1} list.
+static const ESQ list_1_0_minus1[10] = {END_TAG, 0x01, 0x01, NEGINT_TAG, 0x00, POSINT_TAG, 0x01, 0x01, POSINT_TAG, LIST_TAG};
+
+// Main Function
+void _main(void)
+{
+  ESI elements[3];
+  HANDLE h;
+
+  TRY
+    ClrScr();
+    DrawStr (0, 0, "The elements of list", A_NORMAL);
+    DrawStr (0, 20, "are", A_NORMAL);
+    // Print whole expression.
+    h = Parse1DExpr (list_1_0_minus1 + 9, FALSE, 0);
+    DrawStr(0, 10, HeapDeref(h), A_NORMAL);
+    HeapFree(h);
+
+    // Get the individual constituents of the expression and print them.
+    init_list_indices(elements, list_1_0_minus1 + 9);
+    h = Parse1DExpr (elements[0], FALSE, 0);
+    DrawStr(0, 30, HeapDeref(h), A_NORMAL);
+    HeapFree(h);
+    h = Parse1DExpr (elements[1], FALSE, 0);
+    DrawStr(0, 40, HeapDeref(h), A_NORMAL);
+    HeapFree(h);
+    h = Parse1DExpr (elements[2], FALSE, 0);
+    DrawStr(0, 50, HeapDeref(h), A_NORMAL);
+    HeapFree(h);
+  ONERR
+    DrawStr (0, 70, "Error!", A_NORMAL);
+  ENDTRY
+  GKeyIn (NULL, 0);
+}

+ 59 - 0
tigcc/examples/List elements.tpr

@@ -0,0 +1,59 @@
+[Settings]
+Archive=0
+Pack=0
+Packed Variable=
+Project Name=listelem
+GCC Switches=-Os -Wall -W -Wwrite-strings -ffunction-sections -fdata-sections
+Assembler Switches=-g -t
+GNU Assembler Switches=
+Debug Info=0
+Standard Library=1
+Command Line=
+Post-Build Process=
+Use Data Variable=0
+Data Variable=
+Copy Data Variable=1
+Copy Data Variable if Archived=1
+Optimize NOPs=1
+Optimize Returns=1
+Optimize Branches=1
+Optimize Moves=1
+Optimize Tests=1
+Optimize Calculations=1
+Remove Unused Sections=1
+Binary Output=0
+Fargo=0
+Flash OS=0
+Cut Unused Ranges=1
+Reorder Sections=1
+Merge Constants=1
+Initialize BSS=1
+
+[Library Options]
+Use TI-89=0
+Use TI-92 Plus=0
+Use V200=0
+Optimize Calc Consts=0
+Use Kernel=0
+Use PreOS=0
+Minimum AMS Version Defined=0
+Minimum AMS Version=1.01
+Unofficial OS Support=0
+Reloc Format=AMS
+ROM Call Format=Direct
+BSS Ref Format=Kernel
+Data Ref Format=Kernel
+Use F-Line Jumps=0
+Use 4-Byte F-Line Jumps=0
+Use Internal F-Line Emulator=0
+Use Return Value=0
+Enable Error Return=0
+Save Screen=0
+Optimize ROM Calls=0
+
+[File Editing]
+Open File=
+
+[Included Files]
+C File 1=List elements.c
+

+ 48 - 0
tigcc/examples/Matrix elements.c

@@ -0,0 +1,48 @@
+// Shows how the init_matrix_indices function works.
+
+#define USE_TI89              // Compile for TI-89
+#define USE_TI92PLUS          // Compile for TI-92 Plus
+#define USE_V200              // Compile for V200
+
+#define MIN_AMS 101           // Compile for AMS 1.01 or higher
+#define SAVE_SCREEN           // Save/Restore LCD Contents
+
+#include <tigcclib.h>         // Include All Header Files
+
+// The [1, 0; 0, 1] matrix.
+static const ESQ matrix_identity_2[16] = {END_TAG, END_TAG, 0x01, 0x01, POSINT_TAG, 0x00, POSINT_TAG, LIST_TAG, END_TAG, 0x00, POSINT_TAG, 0x01, 0x01, POSINT_TAG, LIST_TAG, LIST_TAG};
+
+// Main Function
+void _main(void)
+{
+  ESI elements[4];
+  HANDLE h;
+
+  TRY
+    ClrScr();
+    DrawStr (0, 0, "The elements of matrix", A_NORMAL);
+    DrawStr (0, 20, "are", A_NORMAL);
+    // Print whole expression.
+    h = Parse1DExpr (matrix_identity_2 + 15, FALSE, 0);
+    DrawStr(0, 10, HeapDeref(h), A_NORMAL);
+    HeapFree(h);
+
+    // Get the individual constituents of the expression and print them.
+    init_matrix_indices(elements, matrix_identity_2 + 15);
+    h = Parse1DExpr (elements[0], FALSE, 0);
+    DrawStr(0, 30, HeapDeref(h), A_NORMAL);
+    HeapFree(h);
+    h = Parse1DExpr (elements[1], FALSE, 0);
+    DrawStr(0, 40, HeapDeref(h), A_NORMAL);
+    HeapFree(h);
+    h = Parse1DExpr (elements[2], FALSE, 0);
+    DrawStr(0, 50, HeapDeref(h), A_NORMAL);
+    HeapFree(h);
+    h = Parse1DExpr (elements[3], FALSE, 0);
+    DrawStr(0, 60, HeapDeref(h), A_NORMAL);
+    HeapFree(h);
+  ONERR
+    DrawStr (0, 70, "Error!", A_NORMAL);
+  ENDTRY
+  GKeyIn (NULL, 0);
+}

+ 59 - 0
tigcc/examples/Matrix elements.tpr

@@ -0,0 +1,59 @@
+[Settings]
+Archive=0
+Pack=0
+Packed Variable=
+Project Name=matelem
+GCC Switches=-Os -Wall -W -Wwrite-strings -ffunction-sections -fdata-sections
+Assembler Switches=-g -t
+GNU Assembler Switches=
+Debug Info=0
+Standard Library=1
+Command Line=
+Post-Build Process=
+Use Data Variable=0
+Data Variable=
+Copy Data Variable=1
+Copy Data Variable if Archived=1
+Optimize NOPs=1
+Optimize Returns=1
+Optimize Branches=1
+Optimize Moves=1
+Optimize Tests=1
+Optimize Calculations=1
+Remove Unused Sections=1
+Binary Output=0
+Fargo=0
+Flash OS=0
+Cut Unused Ranges=1
+Reorder Sections=1
+Merge Constants=1
+Initialize BSS=1
+
+[Library Options]
+Use TI-89=0
+Use TI-92 Plus=0
+Use V200=0
+Optimize Calc Consts=0
+Use Kernel=0
+Use PreOS=0
+Minimum AMS Version Defined=0
+Minimum AMS Version=1.01
+Unofficial OS Support=0
+Reloc Format=AMS
+ROM Call Format=Direct
+BSS Ref Format=Kernel
+Data Ref Format=Kernel
+Use F-Line Jumps=0
+Use 4-Byte F-Line Jumps=0
+Use Internal F-Line Emulator=0
+Use Return Value=0
+Enable Error Return=0
+Save Screen=0
+Optimize ROM Calls=0
+
+[File Editing]
+Open File=
+
+[Included Files]
+C File 1=Matrix elements.c
+

+ 2 - 0
tigcc/examples/build.sh

@@ -42,8 +42,10 @@ tprbuilder -q "Integrate.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Int
 tprbuilder -q "Interrupt Handler.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Interrupt Handler.tpr\""; fi
 tprbuilder -q "Key Yes or No.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Key Yes or No.tpr\""; fi
 tprbuilder -q "Launcher.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Launcher.tpr\""; fi
+tprbuilder -q "List elements.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"List elements.tpr\""; fi
 tprbuilder -q "List variables and folders.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"List variables and folders.tpr\""; fi
 tprbuilder -q "Masked Sprite.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Masked Sprite.tpr\""; fi
+tprbuilder -q "Matrix elements.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Matrix elements.tpr\""; fi
 tprbuilder -q "Memory Error.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Memory Error.tpr\""; fi
 tprbuilder -q "Menu Example 1.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Menu Example 1.tpr\""; fi
 tprbuilder -q "Menu Example 2.tpr"; if [ $? -ne 0 ]; then echo FAILED building "\"Menu Example 2.tpr\""; fi

Some files were not shown because too many files changed in this diff