★ wanayoo — archive 1999 https://github.com/adriweb/tivars_lib_cppNouvelle recherche | Portail wanayoo
Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

tivars_lib_cpp Build Status

A C++ "library" to interact with TI-Z80/eZ80 (82/83/84 series) calculators files (programs, lists, matrices...).
JavaScript bindings (for use with emscripten) are provided for convenience.

How to use

In C++

Right now, the best documentation is the tests file itself, which uses the main API methods.
Basically, though, there are loading/saving/conversion (data->string, string->data) methods you just have to call.

Example 1: Here's how to read the source of TI-Basic program from an .8xp file and print it:

auto myPrgm = TIVarFile::loadFromFile("the/path/to/myProgram.8xp");
auto basicSource = myPrgm.getReadableContent(); // You can pass options like { {"reindent", true} }...
std::cout << basicSource << std::endl;

Example 2: Here's how to create a TI-Basic program (output: .8xp file) from a string:

auto newPrgm = TIVarFile::createNew(TIVarType::createFromName("Program"));  // Create an empty "container" first
newPrgm.setVarName("TEST");                                           // (also an optional parameter above)
newPrgm.setContentFromString("ClrHome:Disp \"Hello World!\"");        // Set the var's content from a string
newPrgm.saveVarToFile("path/to/output/directory/", "myNewPrgrm");     // The extension is added automatically

Several optional parameters for the functions are available. For instance, French is a supported input/output language for the program vartype, which is choosable with a boolean in an options array to pass.

Note: The code throws exceptions for you to catch in case of trouble.

In JavaScript (via Emscripten)

Bindings are done for the necessary classes, so it should be pretty obvious.
You can find code that use this project as a JS lib here: https://github.com/TI-Planet/zText (look at generator.js)

Vartype handlers implementation: current status

Vartype data->string string->data
Real ✓ ✓
Real List ✓ ✓
Matrix ✓ ✓
Equation ✓ ✓
String ✓ ✓
Program ✓ ✓
Protected Program ✓ ✓
Complex ✓ ✓
Complex List ✓ ✓
Application Variable ✓ ✓
Python AppVar ✓ ✓
Exact Complex Fraction ✓ ✗
Exact Real Radical ✓ ✗
Exact Complex Radical ✓ ✗
Exact Complex Pi ✓ ✗
Exact Complex Pi Fraction ✓ ✗
Exact Real Pi ✓ ✗
Exact Real Pi Fraction ✓ ✗

Note that some of the special varnames restrictions (for strings, matrices, list...) aren't implemented yet.

To this date, there are no plans to support other types (except maybe some fancy things with the image/picture vartypes...).
Pull Requests are welcome, though :)

About

A C++ library to interact with TI-z80 (82/83/84 series) calculators files (programs, lists, matrices, etc.)

Topics

Resources

License

Releases

No releases published

Languages

You can’t perform that action at this time.