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

688RE: [jasspa] Digest Number 164

Expand Messages
  • Dan Perry
    Oct 11, 2002
    • 0 Attachment
      I Just wanted to share a macro that I wrote. I work with a lot of enums in C/C++ and I hate when my fellow developers don't align all the equal signs("=") in the enumeration. So I wrote this little macro to do it for me. To use it, adjust the first = to the proper column and run the macro. It stops if it attempts to delete characters other then spaces. Please let me know what you think and any way to improve it. Like possibly aligning tables or more then one character on each line...


      define-macro align-enums
      set-variable .TheChar @wc
      set-variable .TheColumn $window-acol


      !if &or &xsequal @wl "^[ \t]*$" &xsequal @wl "^[ \t]*//.*$"
      !goto nextline

      !if ¬ &xsequal @wl &cat &cat ".*" .TheChar ".*"
      !goto finish

      !while ¬ &sin @wc .TheChar

      !if &equal .TheColumn $window-acol
      !goto nextline

      !if &less $window-acol .TheColumn
      !while &less $window-acol .TheColumn
      !goto nextline

      !if &great $window-acol .TheColumn
      !while &great $window-acol .TheColumn
      !if ¬ &seq @wc " "
      1 forward-delete-char
      !goto nextline

      ml-write "Finished"

    • Show all 2 messages in this topic