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

Re: [SPAM:]Re: [Clip] Convert Asm table to C

Expand Messages
  • 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 1 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.