From 55bfff7cf6541caac172b43186cf14405185b14d Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Sat, 13 Apr 2019 12:40:52 -0400 Subject: fix curses on linux --- .../examples/fileio_os_vars/autotester.badjson | 130 ++++++------- .../CEdev/examples/fileio_os_vars/makefile | 30 +-- .../CEdev/examples/fileio_os_vars/readme.md | 20 +- .../CEdev/examples/fileio_os_vars/src/main.c | 202 ++++++++++----------- 4 files changed, 191 insertions(+), 191 deletions(-) (limited to 'frontends/calculator/CEdev/examples/fileio_os_vars') diff --git a/frontends/calculator/CEdev/examples/fileio_os_vars/autotester.badjson b/frontends/calculator/CEdev/examples/fileio_os_vars/autotester.badjson index dbf9e3d..8b713fa 100644 --- a/frontends/calculator/CEdev/examples/fileio_os_vars/autotester.badjson +++ b/frontends/calculator/CEdev/examples/fileio_os_vars/autotester.badjson @@ -1,65 +1,65 @@ -{ - "rom": "84pce_515.rom", - "transfer_files": [ - "bin/DEMO.8xp" - ], - "target": { - "name": "DEMO", - "isASM": true - }, - "sequence": [ - "action|launch", - "delay|500", - "hash|1", - "hash|2", - "hash|3", - "hash|4", - "hash|5", - "key|enter", - "delay|200", - "hash|6" - ], - -******* Broken JSON TODO : -******* implement autotester var handling feature ******* - - "hashes": { - "1": { - "description": "Variable B is complex 1.5+2.5i", - "start": "var_complex_B", - "size": "var_size", - "expected_CRCs": [ "" ] - }, - "2": { - "description": "Variable A is real 1.5", - "start": "var_real_A", - "size": "var_size", - "expected_CRCs": [ "" ] - }, - "3": { - "description": "Variable Y1 is equation 2+2", - "start": "var", - "size": "var_equation_Y1", - "expected_CRCs": [ "" ] - }, - "4": { - "description": "Variable L1 is list {1.5,2.5,3.5}", - "start": "var", - "size": "var_list_L1", - "expected_CRCs": [ "" ] - }, - "5": { - "description": "Variable Ans is matrix [[2.5,2.5]]", - "start": "var_Ans", - "size": "var_size", - "expected_CRCs": [ "" ] - }, - "6": { - "description": "Back to the home screen (exit check)", - "start": "vram_start", - "size": "vram_16_size", - "expected_CRCs": [ "FFAF89BA", "101734A5", "9DA19F44" ] - } - } -} - +{ + "rom": "84pce_515.rom", + "transfer_files": [ + "bin/DEMO.8xp" + ], + "target": { + "name": "DEMO", + "isASM": true + }, + "sequence": [ + "action|launch", + "delay|500", + "hash|1", + "hash|2", + "hash|3", + "hash|4", + "hash|5", + "key|enter", + "delay|200", + "hash|6" + ], + +******* Broken JSON TODO : +******* implement autotester var handling feature ******* + + "hashes": { + "1": { + "description": "Variable B is complex 1.5+2.5i", + "start": "var_complex_B", + "size": "var_size", + "expected_CRCs": [ "" ] + }, + "2": { + "description": "Variable A is real 1.5", + "start": "var_real_A", + "size": "var_size", + "expected_CRCs": [ "" ] + }, + "3": { + "description": "Variable Y1 is equation 2+2", + "start": "var", + "size": "var_equation_Y1", + "expected_CRCs": [ "" ] + }, + "4": { + "description": "Variable L1 is list {1.5,2.5,3.5}", + "start": "var", + "size": "var_list_L1", + "expected_CRCs": [ "" ] + }, + "5": { + "description": "Variable Ans is matrix [[2.5,2.5]]", + "start": "var_Ans", + "size": "var_size", + "expected_CRCs": [ "" ] + }, + "6": { + "description": "Back to the home screen (exit check)", + "start": "vram_start", + "size": "vram_16_size", + "expected_CRCs": [ "FFAF89BA", "101734A5", "9DA19F44" ] + } + } +} + diff --git a/frontends/calculator/CEdev/examples/fileio_os_vars/makefile b/frontends/calculator/CEdev/examples/fileio_os_vars/makefile index 1f1b36b..d3deba8 100644 --- a/frontends/calculator/CEdev/examples/fileio_os_vars/makefile +++ b/frontends/calculator/CEdev/examples/fileio_os_vars/makefile @@ -1,15 +1,15 @@ -# ---------------------------- -# Set NAME to the program name -# Set ICON to the png icon file name -# Set DESCRIPTION to display within a compatible shell -# Set COMPRESSED to "YES" to create a compressed program -# ---------------------------- - -NAME ?= DEMO -COMPRESSED ?= NO -ICON ?= iconc.png -DESCRIPTION ?= "C SDK Demo" - -# ---------------------------- - -include $(CEDEV)/include/.makefile +# ---------------------------- +# Set NAME to the program name +# Set ICON to the png icon file name +# Set DESCRIPTION to display within a compatible shell +# Set COMPRESSED to "YES" to create a compressed program +# ---------------------------- + +NAME ?= DEMO +COMPRESSED ?= NO +ICON ?= iconc.png +DESCRIPTION ?= "C SDK Demo" + +# ---------------------------- + +include $(CEDEV)/include/.makefile diff --git a/frontends/calculator/CEdev/examples/fileio_os_vars/readme.md b/frontends/calculator/CEdev/examples/fileio_os_vars/readme.md index d628217..2f780d2 100644 --- a/frontends/calculator/CEdev/examples/fileio_os_vars/readme.md +++ b/frontends/calculator/CEdev/examples/fileio_os_vars/readme.md @@ -1,10 +1,10 @@ -### FileIO OS Variables Demo - -This demo shows how to use the different OS variable accessing functions. - -![Screenshot](screenshot.png) - ---- - -This demo is a part of the C SDK Toolchain for use on the CE. - +### FileIO OS Variables Demo + +This demo shows how to use the different OS variable accessing functions. + +![Screenshot](screenshot.png) + +--- + +This demo is a part of the C SDK Toolchain for use on the CE. + diff --git a/frontends/calculator/CEdev/examples/fileio_os_vars/src/main.c b/frontends/calculator/CEdev/examples/fileio_os_vars/src/main.c index 657f9d9..dd429d5 100644 --- a/frontends/calculator/CEdev/examples/fileio_os_vars/src/main.c +++ b/frontends/calculator/CEdev/examples/fileio_os_vars/src/main.c @@ -1,101 +1,101 @@ -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -/* Some function prototypes. Maybe in the future these functions will become a library */ -cplx_t Int24sToCplx(int real, int imag); -cplx_t FloatsToCplx(float real, float imag); -cplx_t RealsToCplx(real_t real, real_t imag); -cplx_t StrsToCplx(char *real, char **real_end, char *imag, char **imag_end); - -/* Main Function */ -void main(void) { - /* Declare some variables */ - equ_t *my_equ; - list_t *my_list; - matrix_t *my_matrix; - real_t my_real; - cplx_t my_cplx; - real_t real_1_5 = os_FloatToReal(1.5); - real_t real_2_5 = os_FloatToReal(2.5); - real_t real_3_5 = os_FloatToReal(3.5); - - /* Store the value '1.5+2.5i' into the variable B */ - my_cplx = FloatsToCplx(1.5, 2.5); - ti_SetVar(TI_CPLX_TYPE, ti_B, &my_cplx); - - /* Store the value '1.5' into the variable A */ - my_real = real_1_5; - ti_SetVar(TI_REAL_TYPE, ti_A, &my_real); - - /* Store the equation "2+2" into the Y1 variable */ - my_equ = ti_MallocEqu(3); // Same as ti_AllocEqu(3, malloc) - my_equ->data[0] = '2'; - my_equ->data[1] = tAdd; - my_equ->data[2] = '2'; - ti_SetVar(TI_EQU_TYPE, ti_Y1, my_equ); - free(my_equ); - - /* Store the list {1.5,2.5,3.5} to L1 */ - my_list = ti_MallocList(3); // Same as ti_AllocList(3, malloc) - my_list->items[0] = real_1_5; - my_list->items[1] = real_2_5; - my_list->items[2] = real_3_5; - ti_SetVar(TI_REAL_LIST_TYPE, ti_L1, my_list); - free(my_list); - - /* Store the matrix [[2.5,2.5]] to Ans */ - my_matrix = ti_MallocMatrix(1,2); // Same as ti_AllocMatrix(1, 2, malloc) - matrix_element(my_matrix, 0, 0) = real_2_5; - matrix_element(my_matrix, 0, 1) = real_2_5; - ti_SetVar(TI_MATRIX_TYPE, ti_Ans, my_matrix); - free(my_matrix); -} - -/* Stores some ints to a complex variable type */ -cplx_t Int24sToCplx(int real, int imag) { - cplx_t res; - res.real = os_Int24ToReal(real); - res.real.sign |= TI_CPLX_TYPE; - res.imag = os_Int24ToReal(imag); - res.imag.sign |= TI_CPLX_TYPE; - return res; -} - -/* Stores some floats to a complex variable type */ -cplx_t FloatsToCplx(float real, float imag) { - cplx_t res; - res.real = os_FloatToReal(real); - res.real.sign |= TI_CPLX_TYPE; - res.imag = os_FloatToReal(imag); - res.imag.sign |= TI_CPLX_TYPE; - return res; -} - -/* Converts a pair of reals to a complex number */ -cplx_t RealsToCplx(real_t real, real_t imag) { - cplx_t res; - res.real = real; - res.real.sign |= TI_CPLX_TYPE; - res.imag = imag; - res.imag.sign |= TI_CPLX_TYPE; - return res; -} - -/* Converts strings to a complex variable type */ -cplx_t StrsToCplx(char *real, char **real_end, char *imag, char **imag_end) { - cplx_t res; - res.real = os_StrToReal(real, real_end); - res.real.sign |= TI_CPLX_TYPE; - res.imag = os_StrToReal(imag, imag_end); - res.imag.sign |= TI_CPLX_TYPE; - return res; -} +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +/* Some function prototypes. Maybe in the future these functions will become a library */ +cplx_t Int24sToCplx(int real, int imag); +cplx_t FloatsToCplx(float real, float imag); +cplx_t RealsToCplx(real_t real, real_t imag); +cplx_t StrsToCplx(char *real, char **real_end, char *imag, char **imag_end); + +/* Main Function */ +void main(void) { + /* Declare some variables */ + equ_t *my_equ; + list_t *my_list; + matrix_t *my_matrix; + real_t my_real; + cplx_t my_cplx; + real_t real_1_5 = os_FloatToReal(1.5); + real_t real_2_5 = os_FloatToReal(2.5); + real_t real_3_5 = os_FloatToReal(3.5); + + /* Store the value '1.5+2.5i' into the variable B */ + my_cplx = FloatsToCplx(1.5, 2.5); + ti_SetVar(TI_CPLX_TYPE, ti_B, &my_cplx); + + /* Store the value '1.5' into the variable A */ + my_real = real_1_5; + ti_SetVar(TI_REAL_TYPE, ti_A, &my_real); + + /* Store the equation "2+2" into the Y1 variable */ + my_equ = ti_MallocEqu(3); // Same as ti_AllocEqu(3, malloc) + my_equ->data[0] = '2'; + my_equ->data[1] = tAdd; + my_equ->data[2] = '2'; + ti_SetVar(TI_EQU_TYPE, ti_Y1, my_equ); + free(my_equ); + + /* Store the list {1.5,2.5,3.5} to L1 */ + my_list = ti_MallocList(3); // Same as ti_AllocList(3, malloc) + my_list->items[0] = real_1_5; + my_list->items[1] = real_2_5; + my_list->items[2] = real_3_5; + ti_SetVar(TI_REAL_LIST_TYPE, ti_L1, my_list); + free(my_list); + + /* Store the matrix [[2.5,2.5]] to Ans */ + my_matrix = ti_MallocMatrix(1,2); // Same as ti_AllocMatrix(1, 2, malloc) + matrix_element(my_matrix, 0, 0) = real_2_5; + matrix_element(my_matrix, 0, 1) = real_2_5; + ti_SetVar(TI_MATRIX_TYPE, ti_Ans, my_matrix); + free(my_matrix); +} + +/* Stores some ints to a complex variable type */ +cplx_t Int24sToCplx(int real, int imag) { + cplx_t res; + res.real = os_Int24ToReal(real); + res.real.sign |= TI_CPLX_TYPE; + res.imag = os_Int24ToReal(imag); + res.imag.sign |= TI_CPLX_TYPE; + return res; +} + +/* Stores some floats to a complex variable type */ +cplx_t FloatsToCplx(float real, float imag) { + cplx_t res; + res.real = os_FloatToReal(real); + res.real.sign |= TI_CPLX_TYPE; + res.imag = os_FloatToReal(imag); + res.imag.sign |= TI_CPLX_TYPE; + return res; +} + +/* Converts a pair of reals to a complex number */ +cplx_t RealsToCplx(real_t real, real_t imag) { + cplx_t res; + res.real = real; + res.real.sign |= TI_CPLX_TYPE; + res.imag = imag; + res.imag.sign |= TI_CPLX_TYPE; + return res; +} + +/* Converts strings to a complex variable type */ +cplx_t StrsToCplx(char *real, char **real_end, char *imag, char **imag_end) { + cplx_t res; + res.real = os_StrToReal(real, real_end); + res.real.sign |= TI_CPLX_TYPE; + res.imag = os_StrToReal(imag, imag_end); + res.imag.sign |= TI_CPLX_TYPE; + return res; +} -- cgit v1.2.3-101-g0448