Post Reply 
dm42decode - a command-line decoder tool
12-26-2023, 07:02 PM
Post: #10
RE: dm42decode - a command-line decoder tool
(12-26-2023 06:01 PM)Pierre Wrote:  See https://thomasokken.com/free42/download/...d/txt2raw/

From ABOUT.txt:
Code:
This directory contains some Free42-related materials that are no longer
supported, but may still be of interest:

(…)

txt2raw
Command-line program that converts HP-42S program listings to raw files.
Requires Perl.

Apart from the common name this is not related to the C program that I referenced:
(05-22-2022 12:27 PM)Thomas Klemm Wrote:  txt2raw.cc
This program uses core_paste to read the program from a txt-file and core_export_programs to write it to a raw-file.
Code:
#include <sstream>
#include <fstream>

#include "core_main.h"
#include "core_globals.h"

int main(int argc, char *argv[]) {
    std::ostringstream sstream;
    std::ifstream fs(argv[1]);
    sstream << fs.rdbuf();
    const std::string str(sstream.str());
    const char* prgm = str.c_str();

    core_init(0, 0, NULL, 0);
    flags.f.prgm_mode = true;
    core_paste(prgm);
    const int indexes[] = { 0 };
    core_export_programs(1, indexes, argv[2]);

    return 0;
}
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: dm42decode - a command-line decoder tool - Thomas Klemm - 12-26-2023 07:02 PM



User(s) browsing this thread: 3 Guest(s)