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 --- .../CEdev/examples/fileio_rename/autotester.json | 66 ++++----- .../CEdev/examples/fileio_rename/makefile | 30 ++-- .../CEdev/examples/fileio_rename/readme.md | 16 +-- .../CEdev/examples/fileio_rename/src/main.c | 154 ++++++++++----------- 4 files changed, 133 insertions(+), 133 deletions(-) (limited to 'frontends/calculator/CEdev/examples/fileio_rename') diff --git a/frontends/calculator/CEdev/examples/fileio_rename/autotester.json b/frontends/calculator/CEdev/examples/fileio_rename/autotester.json index 5b454c9..abe87c4 100644 --- a/frontends/calculator/CEdev/examples/fileio_rename/autotester.json +++ b/frontends/calculator/CEdev/examples/fileio_rename/autotester.json @@ -1,33 +1,33 @@ -{ - "rom": "84pce_515.rom", - "transfer_files": [ - "bin/DEMO.8xp" - ], - "target": { - "name": "DEMO", - "isASM": true - }, - "sequence": [ - "action|launch", - "delay|1000", - "hash|1", - "key|enter", - "delay|200", - "hashWait|2" - ], - "hashes": { - "1": { - "description": "Assert that the rename was succesful", - "start": "vram_start", - "size": "vram_16_size", - "expected_CRCs": [ "94538693" ] - }, - "2": { - "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|1000", + "hash|1", + "key|enter", + "delay|200", + "hashWait|2" + ], + "hashes": { + "1": { + "description": "Assert that the rename was succesful", + "start": "vram_start", + "size": "vram_16_size", + "expected_CRCs": [ "94538693" ] + }, + "2": { + "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_rename/makefile b/frontends/calculator/CEdev/examples/fileio_rename/makefile index 1f1b36b..d3deba8 100644 --- a/frontends/calculator/CEdev/examples/fileio_rename/makefile +++ b/frontends/calculator/CEdev/examples/fileio_rename/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_rename/readme.md b/frontends/calculator/CEdev/examples/fileio_rename/readme.md index 9584b02..518c9ff 100644 --- a/frontends/calculator/CEdev/examples/fileio_rename/readme.md +++ b/frontends/calculator/CEdev/examples/fileio_rename/readme.md @@ -1,8 +1,8 @@ -### FileIO Rename Demo - -This example demonstrates how to rename previously created files - ---- - -This demo is a part of the C SDK Toolchain for use on the CE. - +### FileIO Rename Demo + +This example demonstrates how to rename previously created files + +--- + +This demo is a part of the C SDK Toolchain for use on the CE. + diff --git a/frontends/calculator/CEdev/examples/fileio_rename/src/main.c b/frontends/calculator/CEdev/examples/fileio_rename/src/main.c index 6f046bb..49793a9 100644 --- a/frontends/calculator/CEdev/examples/fileio_rename/src/main.c +++ b/frontends/calculator/CEdev/examples/fileio_rename/src/main.c @@ -1,77 +1,77 @@ -#include -#include -#include -#include - -#include -#include -#include - -#include - -/* Function prototypes */ -void printText(int8_t xpos, int8_t ypos, const char *text); - -/* Main Function */ -void main(void) { - /* Declare some variables */ - const char *oldName = "OldFile"; - const char *newName = "NewFile"; - char nameBuffer[10]; - ti_var_t file; - bool err = true; - - /* Clear the homescreen */ - os_ClrHome(); - - /* Close any previously open files */ - ti_CloseAll(); - - /* Delete both the new and old files if they already exist */ - ti_Delete(oldName); - ti_Delete(newName); - - do { - /* Create a file with the old name */ - file = ti_Open(oldName, "w"); - if (!file) break; - - ti_GetName(nameBuffer, file); - printText(0, 0, "Old Name: "); - printText(10, 0, nameBuffer); - - /* Close the old file */ - ti_CloseAll(); - - /* Rename the old file to the new file name */ - ti_Rename(oldName, newName); - - /* Ensure the new name of the file is correct */ - file = ti_Open(newName, "r"); - if (!file) break; - - ti_GetName(nameBuffer, file); - printText(0, 1, "New Name: "); - printText(10, 1, nameBuffer); - - err = false; - } while (0); - - /* Close all open files */ - ti_CloseAll(); - - /* If an error occured, inform the user */ - if (err == true) { - printText(0, 2, "An error occured"); - } - - /* Wait for a keypress */ - while (!os_GetCSC()); -} - -/* Draw text on the homescreen at the given X/Y location */ -void printText(int8_t xpos, int8_t ypos, const char *text) { - os_SetCursorPos(ypos, xpos); - os_PutStrFull(text); -} - +#include +#include +#include +#include + +#include +#include +#include + +#include + +/* Function prototypes */ +void printText(int8_t xpos, int8_t ypos, const char *text); + +/* Main Function */ +void main(void) { + /* Declare some variables */ + const char *oldName = "OldFile"; + const char *newName = "NewFile"; + char nameBuffer[10]; + ti_var_t file; + bool err = true; + + /* Clear the homescreen */ + os_ClrHome(); + + /* Close any previously open files */ + ti_CloseAll(); + + /* Delete both the new and old files if they already exist */ + ti_Delete(oldName); + ti_Delete(newName); + + do { + /* Create a file with the old name */ + file = ti_Open(oldName, "w"); + if (!file) break; + + ti_GetName(nameBuffer, file); + printText(0, 0, "Old Name: "); + printText(10, 0, nameBuffer); + + /* Close the old file */ + ti_CloseAll(); + + /* Rename the old file to the new file name */ + ti_Rename(oldName, newName); + + /* Ensure the new name of the file is correct */ + file = ti_Open(newName, "r"); + if (!file) break; + + ti_GetName(nameBuffer, file); + printText(0, 1, "New Name: "); + printText(10, 1, nameBuffer); + + err = false; + } while (0); + + /* Close all open files */ + ti_CloseAll(); + + /* If an error occured, inform the user */ + if (err == true) { + printText(0, 2, "An error occured"); + } + + /* Wait for a keypress */ + while (!os_GetCSC()); +} + +/* Draw text on the homescreen at the given X/Y location */ +void printText(int8_t xpos, int8_t ypos, const char *text) { + os_SetCursorPos(ypos, xpos); + os_PutStrFull(text); +} + -- cgit v1.2.3-101-g0448