macros

How can I remove the duplication between these C macros?

I have the following couple of C pre-processor macros for creating test functions: // Defines a test function in the active suite #define test(name)\ void test_##name();\ SuiteAppender test_##name##_appender(TestSuite::active(), test_##name);\ void test_##name() which is used like this: test(TestName) { // Test code h...

How Can I Automate Tasks in XCode?

I'm building an app in Obj-C / XCode and I'm running into some repetitive tasks. For example if I want to add an image resource to my project I just go through the same identical steps... only difference is the path to the resource. How can I automate these tasks? Is there some sort of XCode macro-recorder like in Photoshop and Exce...

"undeclared identifier" error in simple macro expansion

I have a very simple macro that I use for shorthand when declaring exceptions. When in debug mode it adds the current file and line number. I'm in the process of modifying my code to support unicode, and suddenly I'm getting "undeclared identifier" errors whenever my macro is used. I'm probably missing something really simple, as the ...

Functional programming in C with macro "Higher Order Function" generators

Pay attention carefully because this is a hell of a question ;-) I want to use template functions for generic collection actions (like search, foreach, etc.) in C while maintaining compiler static type checking. It is fairly straightforward while you're using simple callbacks like in this example: #define MAKE_FOREACH(TYPE)\ void forea...

How can I get a counter variable in Vim without python or ruby?

I do NOT have python/ruby enabled. My Question: I frequently have to write things like the following: %macro(200701);x gzip /home/test/200701.txt;run; %macro(200702);x gzip /home/test/200702.txt;run; %macro(200703);x gzip /home/test/200703.txt;run; %macro(200704);x gzip /home/test/200704.txt;run; %macro(200705);x gzip /home/test/200705....

ODBC connect with propritary driver/Excel Trust settings

I have a spreadsheet in Excel that connects to an internal DB using the odbc driver for the software (Action Request System). That works fine. Now I'm trying to move the Excel file to a SharePoint site so that our team can review the data and make notes in the same spreadsheet. So, first I tried just moving the Excel file to the server,...

How do I create an Outlook macro that changes email signature based on recipient domains?

I'd like to use an Outlook macro to change my email signature depending on which domain I'm emailing. So if I'm only emailing internally (my companies domain) then I use a short signature, but if at least one recipient is external then I use a long signature. Is that possible? I'm guessing I need to intercept some sort of "Send" event ...

Using System.Windows.Forms in a Visual Studio Macro

I have started writing a Macro in Visual Studio 2005 like this: Public Sub myMacro() Dim myListBox As New System.Windows.Forms.ListBox() For Each x As String In xs myListBox.Items.Add(x) Next But I'm completely at a loss as to how to display the ListBox, I'd like behaviour similar to this InputBox example: Dim s...

Outlook macro to jump to (open) IMAP Inbox

I am using Outlook to sync mail with GMail via IMAP. Unfortunately, Outlook's default shortcut to go to the Inbox (Shift+Ctrl+I) opens the original Inbox, not the new default IMAP Inbox (which I have specified as the new Outlook default e-mail account). I'd like to create a macro that I can bind to another keystroke, which will open th...

Are there any standard input/ouput macros for read/write system calls in C?

All my searches returned nothing and I find it odd that there aren't any macros to use as file descriptors for read/write system calls for standard input and output instead of a 0 (stdout) and a 1 (stdin). Am I missing them or they really don't exist? ...

Office 2002 - VBA Application Migration to Office 2007

Looking for Migration from Office 2002 - VBA Word Doc Application to Office 2007. Issues :- Though Office 2007 Supports VBA Application - VB Macro Code, Menu Bars are not appearing. Indeed, VBA Macro Menus display under "Add-ins". On a study, I realized Office 2007 Supports XML - Ribbon. Is there any ideal approach to migrate VBA Macro...

Change filename extension in basic (for OpenOffice macro)

I am trying to change a filename extension in a macro for OpenOffice. My files are named like "file.odt" and I need to transform this string to "file.pdf". I use a macro that I have found on the Web but I have never written any line of basic code in my life ... However, the code is buggy and only works for 3 chars extensions (like ".do...

How to use preprocessor to compute and store hashes at compile time?

I have a native C++ program that uses "event queues" to execute functions on different threads. I allocate an "event" class on the heap, and put it on one of my threads' queues for execution. It all works great, but it's very difficult to trace back the origin of these "events". I would like each "event" to store some information pertai...

How to access items by "group" in an Outlook VB macro?

By "group" I mean the collapsible classifications that you get when you enable View->Arrange By->Show in Groups. This divides e.g. messages in a folder into Today, Yesterday, Last Week, Two Weeks Ago, and so on. What I'd like to be able to do is iterate over the messages that are currently classified within a given group. Is this poss...

What's the use of do while(0) when we define a macro?

I'm reading the linux kernel and I found many macros like this: #define INIT_LIST_HEAD(ptr) do { \ (ptr)->next = (ptr); (ptr)->prev = (ptr); \ } while (0) Why do they use this rather than define it simply in a {}? ...

Make Macro to input data into Excel spreadsheet

I am using Excel 2003 and I need to create a macro the asks the user for 5 inputs: Date, Project#, Fault, Problem, and Solution. I have never used macros before so I have no idea how to code this. Once the data is entered by the user I want it to go under the appropriate columns. After this is done the macro will not prompt the user for ...

Create a SQL Table from Excel VBA

The problem is that I cannot get the table name that was entered into the variable, "tblName", to be used instead I get a correctly named database with a table named "tblName". Is there some way to pick up the name in "tblName" or some way to change the name once it is created with a name th user enters? Private Sub CreateDatabaseFrom...

Need advice on creating macro to format SQL scripts in Visual Studio

Hello all, I am in the process of trying to create a macro that will, through a combination of code and Regular Expressions, clean-up and apply consistant formatting to our library of SQL Scripts. My macro consists of 2 parts. The first section loops through a collection of SQL key words (select, from, where, etc..) and uses the Find o...

Macro use depending on integer

I have to use a macro multiple times inside a function and the macro that needs to be used depends on a number I pass into the function. e.g. function(int number) { switch(number) { case 0: doStuff(MACRO0); break; case 1: doStuff(MACRO1); break; } } The problem is: I have a lot stuff to do per switch s...

Where can I find visual studio macro examples?

When I look up anything about macros for Visual studio 2005, everyone is referencing the samples that ship with it. However, Visual studio was installed for me (IT department) and I do not have these sample macros. Is there another place I can find(or download) them? ...