Description on how GDexpi addin to Visual Studio works

Here is what you need to do to make GDexpi work with Visual Studio !

  1. First you need to register GDexpi.dll. You can register it by using regsvr32.exe. Type regsvr32 and the path + name to GDexpi.dll on execution line in run dialog that you start from the Start menu !
    EXAMPLE:
    If you have copied the GDexpi.dll to C:\Program Files\Gorep\GDexpi.dll location you need to write regsvr32 "C:\Program Files\Gorep\GDexpi.dll" at the run prompt.
  2. Now that you have registered the addin its time to tell Visual Studio that it exists !
    Select menutiem "Tools\Customize..." in Visual Studio. Go to "Add-ins and Macro Files" page. Press the "Browse..." button and select GDexpi.dll on your computer. Make sure that the checkbox is checked for the "GDexpi Developer Studio Add-in" !
  3. When you close the dialog you will get error message and you will be prompted to select a macro file that should be parsed. There are two files that comes with DGexpi.dll that you can select. macro.h and html.h. You can look at these files to se the layout and then create you own macro files that you can use. When you have selected one file and pressed OK-button the GDexpi addin is ready to work.
  4. The GDexpi will expand words that you have selected when you press the button that GDexpi will add to Visual Studio. You can also make a key combination for the command.
    EXAMPLE:
    If there is a macro that looks like this:
    #define test This is my first macro !!!
    Then you need to type "test" in a text file in Visual Studio. Select the word "test" and press the GDexpi command button.
    If you want to parse an new macro file you need to type "Gorep Development" and then select "Gorep Development" (" GD" will also work), press the GDexpi command button. And a dialog will prompt you for a new macro file.
    You can also se all macros that are available. You do this by typing "Gorep All" then select "Gorep All" and press the GDexpi command button. All macroname's will be printed to the textfile.
  5. The second command opens a dialog that shows all macros that have been read. it also have a text box where you can typ parameters. By using this dialog you can paste macros to the editor. There are som other commands on this dialog
    File Activates buttons for macro-file functionality
    Macro Activates buttons for macro functionality
    Paste Insterts the macro text for the selected macro
    Get selection Copies the selected text into the text field in dialog
    Reparse file Parses the macro file again
    Type macro Writes the macro to editor where cursor is placed
    Select file... Choose a file to parse macros from
    Edit... Shows a dialog with macro files that you can choose to edit in VS
    + Adds a file to drop down control that you later can select to edit in VS
    - Remove the selected file in drop down
    > Opens a menu
    Unselect itemUnselects item that are selected in listbox for the dialog
    Show macro Shows the selected macro in list box with parameters
    You can also open the macro dialog by typing "Gorep Show", select it and execute the expand macro.
    The dialog is resizable.

How do you create macros then...
The easiest way to create a macro is to just define a simple word.
#define MACRO This is a macro

The word "MACRO" will expand to "This is a macro". You can also have parameters to a macro.
#define MACRO( name ) This is a macro done by name

If you then type "MACRO( Per )" and expand that you will get "This is a macro done by Per". The parameter name will be replaced by the word that you have typed in macro. If you forgot the parantheses GDexpi will try to add it anyway. So if you write "MACRO Per" you will get the same result.

Let say that you will add more than one word for a parameter. Type "MACRO( "Per on the computer" )". If you select this and expand it you will get "This is a macro done by Per on the computer". As you can se if you place the parameter between "" you can uses spaces for the parameter.

There is also a functionlity that is called tokenpaste. If you are going to extend a word or change one part of it you kan use tokenpaste.
#define MACRO( phone ) 000-##phone goes to XXX.
Type "MACRO( 12345678 )" and expand it. You will then get "000-12345678 goes to XXX"



Description of the macro language
The rules for creating macros is similar to create macros in C
There are some keywords that is used to create a macro.

#define
This word marks that we are going to create a new macro.
EXAMPLE:
#define NEW_MACRO This is a new macro
We now have defined a macro that is called "NEW_MACRO" and the text macro is replace with is "This is a new macro".

#start
if the macro text is long or you need to wrap lines, you can use #start (ends with #end)
EXAMPLE:
#define NEW_MACRO
#start
The macro text for the macro
NEW_MACRO is between at start and a end
keyword.
#end
Here the macro text for NEW_MACRO is written between #start and #end key words.

#end
#end ends a macro block that start with #start.

If you have a macro and don't want to use the #start and #end marks you can wrap lines. This is done with the backslash character.
EXAMPLE:
#define NEW_MACRO This text is \
going to be replace \
when NEW_MACRO is selected.
Here the text for macro NEW_MACRO is broken to many rows. The character that brakes each line is the backslash character.
To write a backslach character in macro text you need to type two.
EXAMPLE:
#define NEW_MACRO A backslash \\ should be like two backslashes in macro text.

##
Token-paste is used when you have a parameter in a macro that is going to be merged with a word.
EXAMPLE:
#define NEW_MACRO( rest ) aaaaaa##restbbbbbb
If you write "NEW_MACRO( xxxx )" and expand it you will get "aaaaaaxxxxbbbbbb".

If a parameter is more than one word you need to put it between double quotation marks.
EXAMPLE:
#define NEW_MACRO( rest ) aaaaaa##restbbbbbb
If you write "NEW_MACRO( "xxxx yyyy")" and expand it you will get "aaaaaaxxxx yyyybbbbbb".

Parameters
A macro can have parameters. This is for making the macros more flexible.
EXAMPLE:
#define PARAM( one, two, three ) Parameters are one two three
If you then type PARAM( FIVE, SIX, SEVEN ) and expand that you will get "Parameters are FIVE SIX SEVEN".

When you type macros in editor and choose to expand them. There is some intelligence to parse the macro. If you have a macro that is like:
#define MACRO( one, two ) this number is one and this is two.
If you type and select the following text you will get the same result
MACRO( ONE, TWO )
MACRO ONE, TWO
MACRO ONE TWO
GDexpi will try to add parentheses and comma where it thinks it has been forgotten. If you don't have selected the text and press the GDexpi command it will selext the whole line and try to extract the macro for expansion.
If you don't know what parameters a macro can have the type the macro with a ? before. If for example a
macro i called "test" and i takes two parameters that are named one and two. The macro definition is
#define test( one, two ) ......
If you type "?test" and press the command button it will be expanded to "test(one,two)". Use this if you have
forgotten wich parameters the macro had.

Well ! There you have the GDexpi add-in for Visual Studio !
It is in beta statium so there may be som bugs. But functionality will be added and buggs will be corrected. Make sure you download new versions when they arrive !
Download new versions at:Gorep Development