Author Topic: Lookup Constants  (Read 1759 times)

SJA

  • Community Member
  • Posts: 17
  • Hero Points: 0
Lookup Constants
« on: October 22, 2011, 08:59:55 pm »
Many programming languages have pre-processor variables, also known as pre-processor constants, or constants, or substitution variables.  Often identified by the "#define" keyword, they tell the compiler to replace any occurrence of the variable with whatever text (including spaces) follows it.  For example:

#define sunday 1
#define monday 2
#define true 1
#define beginning_of_time "01/01/1900"

My macro is a function called lookup_constants.  It could be bound (binded?) to a key.  In the language I use, pre-processor constants are enclosed in curly brackets, so I bound the left curly bracket to this function.  The function reads the current edit buffer and collects all pre-processor constants.  It sorts them and presents them in a Slick-Edit form (dialog box).  There is a search field that lets the user filter the results.  When the user double-clicks on one of the choices, the macro encloses it in curly brackets and inserts it into the edit buffer.

I have attached the Slick-C macro file and a PNG screen shot of the form.

lclevesy

  • Guest
Re: Lookup Constants
« Reply #1 on: October 24, 2011, 02:05:09 pm »
Thank you for your submission. It is in the running for the iPad!

The winner will be announced via our Facebook page https://www.facebook.com/slickedit, Twitter page http://www.twitter.com/slickedit, and on this forum under the main SlickEdit October Macros Challenge Rules & How to Enter post http://community.slickedit.com/index.php/topic,7327.0.html on November 7, 2011.

lclevesy

  • Guest
Re: Lookup Constants
« Reply #2 on: November 01, 2011, 03:14:19 pm »
We'll be announcing the winner of the iPad 2 on November 7th. Until then, your submission has earned a SlickEdit t-shirt! Email your size and address to marketing@slickedit.com to receive one.