macros

Is WSA compiler in BOO safe to use?

In our program we use boo as macro system about 2 years. All works like a charm, but python syntax is weird for newcomers. As I know boo has white space agnostic (WSA) compiler with ruby like syntax: instead of def Hello(): print 'Hello' you can write: def Hello(): #notice colon!!! print 'Hello' end here is ideal :) def Hello() ...

Copy data from multiple rows only if data exists.

I have a spreadsheet named "Data Sheet" that collects data from other worksheets via formulas and works perfectly. I need a macro that will copy the data from multiple rows so I can paste into a seperate workbook. I have 30 rows of data ranging from A3:EI3 to A32:EI32. This data is collected from 1 to 30 other sheets if they are made vis...

#define NULL NULL

#ifndef NULL #define NULL NULL #endif This code compiles in gcc with no warnings/errors. Can someone explain what the preprocessor is doing here? ...

Macro and function with same name

I have the following code #define myfunc(a,b) myfunc(do_a(a), do_b(b)) void myfunc(int a, int b) { do_blah(a,b); } int main() { int x = 6, y = 7; myfunc(x,y); return 0; } I want the pre-processor to expand function myfunc only at calling. Required code after pre-processing looks like this: void myfunc(int a, int b) {...

Call Excel COM Addins functions using macro

How can I call a function defined in a COM Addin using excel macro ? Basically I have created a Excel COM Addin which does some bunch of stuff. Now I want to invoke this via excel macros. Is it possible to do it ? Or Is it possible to install COM Addin using a macro ? ...

xcode macros objective c not working

In xcode if I type in if then hit escape it gives me an option to autocomplete to an if block macro. I just saw that there is a list of objective c macros like this for example a is supposed to be alloc init call. However when I type in a then hit escape it says no completions found. What am I doing wrong here? ...

C Idioms and little known facts

Okay, I've seen many posts here about odd idioms and common practices in C that might not be initially intuitive. Perhaps a few examples are in order Elements in an array: #define ELEMENTS(x) (sizeof (x) / sizeof (*(x))) Odd array indexing: a[5] = 5[a] Single line if/else/while/for safe #defines #define FOO(X) do { f(X); g(X); } ...

how to undefine a define at commandline using gcc

How do I at compiletime undefine a compiler macro using gcc. I tried some compile args to gcc like -D but I cant get to see the "not defined" message. Thanks #include <iostream> #define MYDEF int main(){ #ifdef MYDEF std::cout<<"defined\n"; #else std::cout<<"not defined\n"; #endif } ...

Copying Cells from different sheets to one Main Sheet

Hi I have a template which is used in every worksheet opened, it conttains items #'s and description of each product so for example if i am adding Milk the new sheet with be default sheet the template will contain the data of the milk including item # product name etc... so problem is now i have so many products i want to mak...

When to use :abbr vs. :map in vi/vim.

The abbreviation and map commands both appear to give the user redundant functionality. :imap teh the seems to get the same job done as :iabbr teh the. I tend to make all my settings in :map commands of various types- everything from typo fixes to script-like one-liners. Is there a real difference between maps and abbreviations? Which ...

C preprocessor: removing quotes from an argument

I'm abusing the C preprocessor for my build system to produce a "readme" plain-text file and a web page from the same source file. The construction is something like this: The actual definitions are in data.h: #define WEBSITE "http://example.com" Note that the // in the URL must be quoted, or else it will be treated as the start of a...

Is it possible to have identically named source files in one visual studio c++ project?

I'm working on a static library project for a c++ course I'm taking. The teacher insists that we define only one function per source file, grouping files/functions belonging to the same class in subdirectories for each class. This results in a structure like: MyClass \MyClass.cc (constructor) \functionForMyClass.cc \anotherF...

Visual Studio macro: Find files that aren't included in the project?

I'd like to write a macro to crawl through the files in my project directory and find files that aren't included in the project. In playing around with the DTE object, I see that the Project object has ProjectItems; if a ProjectItem represents a directory, then it has its own ProjectItems collection. This gives me all files that are in...

What are some good tools for making macros in Windows?

Hi, I have identified a possibility to have an extremely repetitive task mimic'd by a macro. It repeats exactly the same key strokes down a list until the list is no more. It requires button clicks (possibly replaced by a series of tabs to get to the "okay" button) and getting data from an Excel sheet to another 3rd party program. Can ...

Programmatically accessing an application through its UI

Earlier I asked a question about command-line parameters to automate processing of a file in InfoPath. I'll probably get the Tumbleweed badge for that one. Instead of attempting a batch solution through the command line, can someone suggest a good resource for developing a solution that will open an application and then perform actions...

Simple Macro Output/Console Logging in Visual Studio 2005?

I'm trying to log output to the Output window from one of my macros in Visual Studio. I thought that Debug.Print would do the trick like it does in Visual Basic.NET and VBA, but it doesn't do that. I found this, and tried this, it is not simple, nor does it work in Visual Studio 2005 (see bellow): Private Function GetMacroOutputPane...

Explanation required for BITCOUNT macro

Can someone explain how this works? #define BX_(x) ((x) - (((x)>>1)&0x77777777) \ - (((x)>>2)&0x33333333) \ - (((x)>>3)&0x11111111)) #define BITCOUNT(x) (((BX_(x)+(BX_(x)>>4)) & 0x0F0F0F0F) % 255) Clarification: Ideally, the...

MSBuild.exe not accepting either /p:DefineConstants nor /p:PreprocessorDefinitions

I've been through quite a number of articles on stack overflow that answered the question "How do I pass preprocessor definitions to the compiler from the MSBuild command line," and they all responded with some variation of: MSBuild.exe /p:DefineConstants=THING_TO_BE_DEFINED I have tried every variation that I could come up with: MSB...

How to setup Xcodes "debug/release target settings"?

Hi I have found a set of great macros here Objective C Macros I put the: #if DEBUG==1 #define .... macros in my header file. Now I simply can't figure out where to set DEBUG=1 or DEBUG=0 in Xcode so that it will define the macro when debugging and not when releasing. Hope someone can help me find the missing drop down menu:) Thank...

Get functions in VS using macros

How to get all the functions you have in a code file in Visual Studio using VS macros? I`m using Visual Studio 2008. Also I need to get whether function is private protected or public. For now I know I can just parse the code and check it on my own, but I want to make it in a proper way and think vs macros environment should allow know...