Loading ...
Sorry, an error occurred while loading the content.

Convert Asm table to C

Expand Messages
  • Vance E. Neff
    Hello, I have been using Notetab Pro for quite a while, but have never attempted to use clips though I have always known that is a large part of Notetab s
    Message 1 of 5 , Jul 13, 2006
    • 0 Attachment
      Hello,

      I have been using Notetab Pro for quite a while, but have never
      attempted to use clips though I have always known that is a large part
      of Notetab's power.

      I need a clip that will convert an assembly language table that is
      currently selected to C.
      The original code looks like this:

      DB 001
      DB 3
      DB 0
      DW NOT_AVAILABLE_SCREEN
      if (ASCII_LPI)
      if (HHD_6000_TERMINAL)
      DB 003
      DB 3 ;1-4=DPERR#, 5=Y, 6=N, ANY OTHER = ESC
      DB 0
      DW SIGNON_ERROR_003_SCREEN
      endif
      else
      DB 027
      DB 3
      DB 0
      DW SIGNON_ERROR_027_SCREEN
      endif
      .
      .
      .

      And needs to be converted to this:

      001,
      3,
      0,
      NOT_AVAILABLE_SCREEN,

      #if (ASCII_LPI)
      #if (HHD_6000_TERMINAL)
      003,
      3, // 1-4=DPERR#, 5=Y, 6=N, ANY OTHER = ESC
      0,
      SIGNON_ERROR_003_SCREEN,
      #endif

      #else
      027,
      3,
      0,
      SIGNON_ERROR_027_SCREEN,
      #endif

      .
      .
      .

      Things to note:
      Each table entry is always 4 lines long, 3 'DB's followed by 1 'DW'.
      Each piece of data should immediately followed by a comma.
      any lines the begin with 'if', 'else', or 'endif' should be preceded
      with a pound symbol.
      And any additional stuff that is preceded by a semi colon (a comment)
      should be proceeded by 2 forward slashes and a space in place of the
      semicolon.
      And lastly, insert a blank line after the 4th line; or if possible,
      insert the blank line after any following 'endif' lines instead.

      Please include instructions on how to install the clip and run it.

      Thank you very much for your efforts on this!
      I finally get to learn how to do clips.

      Vance
    • Don - HtmlFixIt.com
      Vance, Is the only time you EVER see a ; to start a comment?
      Message 2 of 5 , Jul 13, 2006
      • 0 Attachment
        Vance,

        Is the only time you EVER see a ; to start a comment?

        > DB 3 ;1-4=DPERR#, 5=Y, 6=N, ANY OTHER = ESC


        > 3, // 1-4=DPERR#, 5=Y, 6=N, ANY OTHER = ESC

        > And any additional stuff that is preceded by a semi colon (a comment)
        > should be proceeded by 2 forward slashes and a space in place of the
        > semicolon.
      • Alec Burgess
        ... H= Convert Asm table ; Alec Burgess 23:25 7/13/2006 - using NTB 5.0 ^!replace (?i-sm)( r n)? s+(DB|DW)( s+ w+) $1$3, rwsa ^!replace
        Message 3 of 5 , Jul 13, 2006
        • 0 Attachment
          Vance:
          >>
          H="Convert Asm table"
          ; Alec Burgess 23:25 7/13/2006 - using NTB 5.0
          ^!replace "(?i-sm)(\r\n)?\s+(DB|DW)(\s+\w+)" >> "$1$3," rwsa
          ^!replace "^(if|else|endif)" >> "\#$1" rwsa
          ^!replace "(?i-sm);" >> "//\s" rwsa
          ^!replace ",(\r\n)#" >> ",$1$1#" rwsa
          ^!replace "\r\n#endif" >> "#endif\r\n" rwsa
          <<

          To install:
          1) F4 to display left side clipbook panel
          2) if you haven't already done this, right-click in the dropdown and
          create a new library (say) "Vance_clips" to avoid overwriting the
          standard clip libraries
          3) copy lines between ">>" and "<<" above to clipboard
          -- to avoid long-line wrapping by Yahoo (unlikely) all clip line
          start with H=, ; or ^!
          4) in Notetab clipbook panel (not in the dropdown which should now
          read "Vance_clips" and be empty) rightclick and select "Add from
          Clipboard"

          To run:
          Focused document s/b your original. so just double-click on [Convert Asm table]

          Note: to tinker with the clip, right-click on [Convert Asm table] and
          select [Edit clip]

          re: >>> And lastly, insert a blank line after the 4th line; or if possible,
          > insert the blank line after any following 'endif' lines instead.
          <<
          Rather than counting every four lines, spacing is done by (my
          assumption) that any line ending in , with next line starting with #
          requires a blank line hence:
          ^!replace ",(\r\n)#" >> ",$1$1#" rwsa

          This leaves blank lines BEFORE the #endif's move the blank line to AFTER:
          ^!replace "\r\n#endif" >> "#endif\r\n" rwsa

          To see how this works line by line, use [Edit clip] and insert:
          ^!setdebug ON
          after the comment line.

          when satisfied remove the setdebug line or comment it with a leading semicolon ;

          Note: the above clip depends on your having installed the NTB 5.0 beta.
          If you're using the current Notetab 4.95 this would be how it should be:
          >>
          H="Convert Asm table"
          ; Alec Burgess 23:25 7/13/2006 - using NTB 4.95
          ^!setdebug ON
          ^!replace "^\s+{(DB)|(DW)}{\s+[A-Z0-9_]+}" >> "\2," rwsa
          ^!replace "^{(if)|(else)|(endif)}" >> "\#\1" rwsa
          ^!replace ";" >> "//\s" rwsa
          ^!replace ",{\n}#" >> ",\1\1#" rwsa
          ^!replace "\n#endif" >> "#endif\n" rwsa
          <<

          Note: I've left Vance's original data and desired transformed data in
          case anyone else testing the new 5.0beta wants to practice :-)

          --
          Regards ... Alec

          On 7/13/06, Vance E. Neff <veneff@...> wrote:
          > Hello,
          >
          > I have been using Notetab Pro for quite a while, but have never
          > attempted to use clips though I have always known that is a large part
          > of Notetab's power.
          >
          > I need a clip that will convert an assembly language table that is
          > currently selected to C.
          > The original code looks like this:
          >
          > DB 001
          > DB 3
          > DB 0
          > DW NOT_AVAILABLE_SCREEN
          > if (ASCII_LPI)
          > if (HHD_6000_TERMINAL)
          > DB 003
          > DB 3 ;1-4=DPERR#, 5=Y, 6=N, ANY OTHER = ESC
          > DB 0
          > DW SIGNON_ERROR_003_SCREEN
          > endif
          > else
          > DB 027
          > DB 3
          > DB 0
          > DW SIGNON_ERROR_027_SCREEN
          > endif
          > .
          > .
          > .
          >
          > And needs to be converted to this:
          >
          > 001,
          > 3,
          > 0,
          > NOT_AVAILABLE_SCREEN,
          >
          > #if (ASCII_LPI)
          > #if (HHD_6000_TERMINAL)
          > 003,
          > 3, // 1-4=DPERR#, 5=Y, 6=N, ANY OTHER = ESC
          > 0,
          > SIGNON_ERROR_003_SCREEN,
          > #endif
          >
          > #else
          > 027,
          > 3,
          > 0,
          > SIGNON_ERROR_027_SCREEN,
          > #endif
          >
          > .
          > .
          > .
          >
          > Things to note:
          > Each table entry is always 4 lines long, 3 'DB's followed by 1 'DW'.
          > Each piece of data should immediately followed by a comma.
          > any lines the begin with 'if', 'else', or 'endif' should be preceded
          > with a pound symbol.
          > And any additional stuff that is preceded by a semi colon (a comment)
          > should be proceeded by 2 forward slashes and a space in place of the
          > semicolon.
          > And lastly, insert a blank line after the 4th line; or if possible,
          > insert the blank line after any following 'endif' lines instead.
          >
          > Please include instructions on how to install the clip and run it.
          >
          > Thank you very much for your efforts on this!
          > I finally get to learn how to do clips.
          --
          Regards ... Alec
        • Vance E. Neff
          Don, Yes Vance
          Message 4 of 5 , Jul 14, 2006
          • 0 Attachment
            Don,

            Yes

            Vance

            Don - HtmlFixIt.com wrote:

            >Vance,
            >
            >Is the only time you EVER see a ; to start a comment?
            >
            >
            >
            >> DB 3 ;1-4=DPERR#, 5=Y, 6=N, ANY OTHER = ESC
            >>
            >>
            >
            >
            >
            >
            >> 3, // 1-4=DPERR#, 5=Y, 6=N, ANY OTHER = ESC
            >>
            >>
            >
            >
            >
            >>And any additional stuff that is preceded by a semi colon (a comment)
            >>should be proceeded by 2 forward slashes and a space in place of the
            >>semicolon.
            >>
            >>
            >
            >
            >Fookes Software: http://www.fookes.us, http://www.fookes.com
            >Fookes Software Mailing Lists: http://www.fookes.us/maillist.htm
            >
            >Yahoo! Groups Links
            >
            >
            >
            >
            >
            >
            >
            >
            >
            >
            >
            >
          • Vance E. Neff
            Alec, Thank you very much. Your install and run instructions got me up and running (clips). I made a couple of modifications in order to correct one omision
            Message 5 of 5 , Jul 14, 2006
            • 0 Attachment
              Alec,

              Thank you very much.

              Your install and run instructions got me up and running (clips).

              I made a couple of modifications in order to correct one omision and a
              couple of problems that were not included in my example:
              I wanted a blank line after the 'DW' line if it was not followed by a
              'endif'.
              Turned out there could be other non numeric/alpha characters other than
              '_' in the data portion.
              I usually use tabs instead of spaces.
              And finally, I only wanted the selected text to be processed.

              Here is the updated version:

              ; Alec Burgess 23:25 7/13/2006 - using NTB 4.95 - mod. by Vance
              ;^!setdebug ON
              ^!replace "^[\s\t]+{(DB)}{[\s\t]+[^\s\t\n;]+}" >> "\2," rhsa
              ^!replace "^[\s\t]+{(DW)}{[\s\t]+[^\s\t\n;]+}" >> "\2,\n" rhsa
              ^!replace "^{(if)|(else)|(endif)}" >> "\#\1" rhsa
              ^!replace ";" >> "//\s" rhsa
              ^!replace "\n#endif" >> "#endif\n" rhsa

              Thank you very much for your help! Now you've set me up so that I can
              ask for some much more complicated requests.

              Vance

              Alec Burgess wrote:

              >Vance:
              >
              >
              >H="Convert Asm table"
              >; Alec Burgess 23:25 7/13/2006 - using NTB 5.0
              >^!replace "(?i-sm)(\r\n)?\s+(DB|DW)(\s+\w+)" >> "$1$3," rwsa
              >^!replace "^(if|else|endif)" >> "\#$1" rwsa
              >^!replace "(?i-sm);" >> "//\s" rwsa
              >^!replace ",(\r\n)#" >> ",$1$1#" rwsa
              >^!replace "\r\n#endif" >> "#endif\r\n" rwsa
              ><<
              >
              >To install:
              >1) F4 to display left side clipbook panel
              >2) if you haven't already done this, right-click in the dropdown and
              >create a new library (say) "Vance_clips" to avoid overwriting the
              >standard clip libraries
              >3) copy lines between ">>" and "<<" above to clipboard
              > -- to avoid long-line wrapping by Yahoo (unlikely) all clip line
              >start with H=, ; or ^!
              >4) in Notetab clipbook panel (not in the dropdown which should now
              >read "Vance_clips" and be empty) rightclick and select "Add from
              >Clipboard"
              >
              >To run:
              >Focused document s/b your original. so just double-click on [Convert Asm table]
              >
              >Note: to tinker with the clip, right-click on [Convert Asm table] and
              >select [Edit clip]
              >
              >re: >>> And lastly, insert a blank line after the 4th line; or if possible,
              >
              >
              >>insert the blank line after any following 'endif' lines instead.
              >>
              >>
              ><<
              >Rather than counting every four lines, spacing is done by (my
              >assumption) that any line ending in , with next line starting with #
              >requires a blank line hence:
              >^!replace ",(\r\n)#" >> ",$1$1#" rwsa
              >
              >This leaves blank lines BEFORE the #endif's move the blank line to AFTER:
              >^!replace "\r\n#endif" >> "#endif\r\n" rwsa
              >
              >To see how this works line by line, use [Edit clip] and insert:
              >^!setdebug ON
              >after the comment line.
              >
              >when satisfied remove the setdebug line or comment it with a leading semicolon ;
              >
              >Note: the above clip depends on your having installed the NTB 5.0 beta.
              >If you're using the current Notetab 4.95 this would be how it should be:
              >
              >
              >H="Convert Asm table"
              >; Alec Burgess 23:25 7/13/2006 - using NTB 4.95
              >^!setdebug ON
              >^!replace "^\s+{(DB)|(DW)}{\s+[A-Z0-9_]+}" >> "\2," rwsa
              >^!replace "^{(if)|(else)|(endif)}" >> "\#\1" rwsa
              >^!replace ";" >> "//\s" rwsa
              >^!replace ",{\n}#" >> ",\1\1#" rwsa
              >^!replace "\n#endif" >> "#endif\n" rwsa
              ><<
              >
              >Note: I've left Vance's original data and desired transformed data in
              >case anyone else testing the new 5.0beta wants to practice :-)
              >
              >
              >
            Your message has been successfully submitted and would be delivered to recipients shortly.