From 8fc1d4c738de2d1e0cb48b1db11e55dc9baffe60 Mon Sep 17 00:00:00 2001 From: marcobaye Date: Thu, 25 Apr 2019 20:26:10 +0000 Subject: [PATCH] updated toacme: v0.15 new removes leading '+' signs when converting sources from "Professional Assembler". git-svn-id: https://svn.code.sf.net/p/acme-crossass/code-0/trunk@113 4df02467-bbd4-4a76-a152-e7ce94205b78 --- contrib/toacme/src/prof.c | 35 ++++++++++++++++++++++++++++++++--- contrib/toacme/src/version.c | 10 +++++----- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/contrib/toacme/src/prof.c b/contrib/toacme/src/prof.c index 258ebc5..2a24976 100644 --- a/contrib/toacme/src/prof.c +++ b/contrib/toacme/src/prof.c @@ -1,5 +1,5 @@ // ToACME - converts other source codes to ACME format. -// Copyright (C) 1999-2016 Marco Baye +// Copyright (C) 1999-2019 Marco Baye // Have a look at "main.c" for further info // // "Professional Ass by Oliver Stiller" stuff (NOT "Profi-Ass" by Data Becker!) @@ -40,6 +40,12 @@ #define REV_START ";-=#" #define REV_END "#=-" +enum linestate { + LINESTATE_REMOVEPLUS, // before label def + LINESTATE_DOUBLENEXTSPACE, // entered when removing '+' + LINESTATE_NOTHINGSPECIAL // afterward +}; + // main void prof_main(void) { @@ -49,6 +55,7 @@ void prof_main(void) byte, hibit, length2; + enum linestate linestate; IO_set_input_padding(0); IO_process_load_address(); @@ -57,7 +64,8 @@ void prof_main(void) if (length1 == EOF) break; if (length1 < 3) { - fprintf(stderr, "Error: Short line (%d bytes)\n", length1); + fprintf(stderr, "Error: Short line (%d bytes), stopping.\n", length1); + return; } // read amount of indentation and output tabs/spaces indent = IO_get_byte(); @@ -71,13 +79,34 @@ void prof_main(void) } // now convert line hibit = 0; + linestate = LINESTATE_REMOVEPLUS; for (ii = 0; ii < length1 - 3; ii++) { byte = IO_get_byte(); if ((byte & 128) != hibit) { hibit = byte & 128; IO_put_string(hibit ? REV_START : REV_END); } - IO_put_byte(SCR2ISO(byte & 127)); + byte = SCR2ISO(byte & 127); + // outside of comments, remove leading '+' + if (hibit == 0) { + if (byte == '+') { + if (linestate == LINESTATE_REMOVEPLUS) { + linestate = LINESTATE_DOUBLENEXTSPACE; + continue; // eat '+' + } + } else if (byte == ' ') { + if (linestate == LINESTATE_DOUBLENEXTSPACE) { + linestate = LINESTATE_NOTHINGSPECIAL; + IO_put_byte(' '); // add space to compensate for eaten '+' + } + } else { + // any other char -> do not remove any '+' + if (linestate == LINESTATE_REMOVEPLUS) { + linestate = LINESTATE_NOTHINGSPECIAL; + } + } + } + IO_put_byte(byte); } if (hibit) IO_put_string(REV_END); diff --git a/contrib/toacme/src/version.c b/contrib/toacme/src/version.c index 8fd2e9b..8620dde 100644 --- a/contrib/toacme/src/version.c +++ b/contrib/toacme/src/version.c @@ -1,15 +1,15 @@ // ToACME - converts other source codes to ACME format. -// Copyright (C) 1999-2015 Marco Baye +// Copyright (C) 1999-2019 Marco Baye // Have a look at "main.c" for further info // // Version -#define RELEASE_NUMBER "0.14" // change before release (FIXME) -#define CHANGE_DATE "19 Feb" // change before release -#define CHANGE_YEAR "2017" // change before release +#define RELEASE_NUMBER "0.15" // change before release (FIXME) +#define CHANGE_DATE "25 Apr" // change before release +#define CHANGE_YEAR "2019" // change before release #define HOME_PAGE "http://sourceforge.net/projects/acme-crossass/" // "http://home.pages.de/~mac_bacon/smorbrod/acme/" -#define FILE_TAG ";ACME 0.96.1" // check before release +#define FILE_TAG ";ACME 0.96.4" // check before release #include #include