GDexpi

The addin for visual studio is like the preprocessor in C++. The difference is that you can select which commands that are going to be replaced by the macro you have selected.

A typical scenario could be:

  • You are going to write a class member function.
  • The function without code in it should look like
    //***********************
    /*TYPE:
    PURPOSE:
    RETURN: */
    void CMyClass::Function(
        int iValue, //
        LPCTSTR pszText //
        )
    {
        // Place code here
    }
     
  • I think that this is (the format for the function certainly differs) is something that you type very often. But with the GDexpi addin you can create a macro with parameters and then select it for expansion. It is easy to write a macro in VB for VC and add it for the header. But if you are going to create a macro that writes the whole function it becomes more work for you. But with the GDexpi this is a very easy task.
  • We create the macro for the function in a file that later should be read by the GDexpi.
    #define[escape] function( ret, class, name, p1, p2, p3, p4, p5, p6, p7 )
    #start
    //*************************************************************************************************\n
    /*TYPE:  \n
    PURPOSE: \n
    RETURN:  */\n
    #if( ret )[ret ] #elseif(ret =! 123)[void ]class::name(\n
    #if( p1 ) [   p1, //\n]
    #if( p2 ) [   p2, //\n]
    #if( p3 ) [   p3, //\n]
    #if( p4 ) [   p4, //\n]
    #if( p5 ) [   p5, //\n]
    #if( p6 ) [   p6, //\n]
    #if( p7 ) [   p7, //\n]
       )\n
    {\n
    #if( ret = HRESULT )[   HRESULT hrReturn;\n   hrReturn = S_OK;\n]
    #elseif( ret =* p )[   ret p##ret;\n]
    #if( ret = HRESULT )[   return hrReturn;\n]
    #elseif( ret =* p )[   return NULL;]
    }\n
    #end
     

    The macro at first might look a little strange. For example there are more parameters than our function should have. But the reason for this is that the macro should be more general. A function could have more that two parameters as you know.....

    In the macro text there is also a "#if( p1 ) [ p1, //\n]". This a way of telling if the parameter for the value has got a value then the text between the brackets should be typed in tha macro. You can leave out parameters if you like.

  • Know we are going to use our macro in VC for creating the function. Type "function( void, CMyClass, Function, "int iValue", "LPCTSTR pszText" )" in a window in VC and select the text. Press command button (installed when you add GDexpi to Visual Studio) and the macro is expanded to the function header that you defied in macro text. Feature.....

    You don't have to write parantheses or commas. This will produce same result " function( void CMyClass Function "int iValue" "LPCTSTR pszText" " . Also if this is the only text on current row you don't have to select the text for making it possible for the GDexpi to parse macro.

Know you probably can figure out what the GDexpi is all about. Skip typing that is done often. Things like ASSERT ( ..... ), class bodies, HTML !!!! (very usefull), SQL queries and, iterating through lists and a lot more can be more fun to code if you don't have to type so much.

If you have forgotten the format of a macro then just type "?function" and select it. GDexpi will then type the whole macro for you, and your task is only to replace parameters with more suitably values.

Download GDexpi - 40 KB



Comments

  • The registering doesn't work?

    Posted by Legacy on 04/20/1999 12:00am

    Originally posted by: johan

    I've set the dll into my Addins dir.
    I've typed the whole thing to register the class
    in the run box above the start button.
    but I got the error "Loadlibrary(c:\Program) failed"
    "GetLastError returns 0x00000007e"


    What's going wrong?

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Java developers know that testing code changes can be a huge pain, and waiting for an application to redeploy after a code fix can take an eternity. Wouldn't it be great if you could see your code changes immediately, fine-tune, debug, explore and deploy code without waiting for ages? In this white paper, find out how that's possible with a Java plugin that drastically changes the way you develop, test and run Java applications. Discover the advantages of this plugin, and the changes you can expect to see …

  • Live Event Date: August 20, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT When you look at natural user interfaces as a developer, it isn't just fun and games. There are some very serious, real-world usage models of how things can help make the world a better place – things like Intel® RealSense™ technology. Check out this upcoming eSeminar and join the panel of experts, both from inside and outside of Intel, as they discuss how natural user interfaces will likely be getting adopted in a wide variety …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds