From e301b400bac34fd669da150951943f7a9f469da3 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Fri, 31 Mar 2023 17:26:02 -0400 Subject: [PATCH] More readme additions and another debug line out fix. --- .github/workflows/main.yml | 2 ++ Readme.md | 6 ++++-- project/refactor.cpp | 27 +++++++++++++-------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8dcd402..ad8302d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,10 +16,12 @@ on: inputs: type: description: 'Meson buildtype (release, debug, etc.)' + default: release required: false test: description: 'Run tests (test)' + default: test required: false jobs: diff --git a/Readme.md b/Readme.md index 4209101..82c9d80 100644 --- a/Readme.md +++ b/Readme.md @@ -12,7 +12,7 @@ Refactor c/c++ files (and problably others) with ease. ## Syntax -* `not` Omit word or namespace. +* `not` Omit an a signature. (Modifies include, word, namespace, etc) * `include` Preprocessor include `` related identifiers. * `word` Fixed sized identifier. * `namespace` Variable sized identifiers, mainly intended to redefine c-namespace of an identifier. @@ -68,7 +68,7 @@ If the `test` parameter is provided to the build scripts, the project and thirdp With the refactors applied a meson configuraiton is setup (`meson.build` in test) and run to build. So long as it compiles, the feature set of the current version should work fine. -* There is an extra file `stb_image` that is currently be parsed but its unused. +* There is an extra file `stb_image` that is parsed but unused during compilation. * Planned for use in the namespace addition todo. ## TODO: @@ -87,3 +87,5 @@ meet the signature of words or namespaces are refactored. * This can honestly be done also with placing words on specific lines.. * Provide a GUI build. * Provide as a single-header library. +* Better tests: + * Automatically pull the zpl repo, refactor and format the library, and package the single header before using it in testing. diff --git a/project/refactor.cpp b/project/refactor.cpp index be82dbe..8d64293 100644 --- a/project/refactor.cpp +++ b/project/refactor.cpp @@ -224,14 +224,19 @@ void refactor() uw Line; }; - #define move_forward( Amount_ ) \ - if ( left - Amount_ <= 0 ) \ - goto End_Search; \ - \ - line += src[0] == '\n'; \ - left -= Amount_; \ - col = (col + Amount_) * src[0] != '\n'; \ - src += Amount_ \ + #define move_forward( Amount_ ) \ + do { \ + if ( left - Amount_ <= 0 ) \ + goto End_Search; \ + \ + const sw end = Amount_ - 1; \ + \ + line += src[end] == '\n'; \ + left -= Amount_; \ + col = (col + Amount_) * src[end] != '\n'; \ + src += Amount_; \ + } \ + while (0) \ #define restore( Snapshot_ ) \ src = Snapshot_.Src; \ @@ -589,12 +594,6 @@ void refactor() } Skip: - if ( src[0] == '\n' ) - { - line++; - col = 0; - } - move_forward( 1 ); } while ( left );