macros

Your most general C macro for printing variable values in different types

Please share with us your favorite, and most general, PRINT or DEBUG macro applicable to all (or almost all) variables in different types and to arrays in C. The macro can have any number of parameters (though 1-3 are preferred); if it increases descriptive power at all, C99 features can be assumed. #define PRINT(var, ...) \ ... L...

Variadic macros with 0 arguments in C99

I have some debugging code that looks like the following: #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) #define AT __FILE__ ":" TOSTRING(__LINE__) void __my_error(const char*loc, const char *fmt, ...); #define my_error(fmt, ...) __my_error(AT, fmt, ##__VA_ARGS__) The last macro is used so I can insert the location into the ...

Why does this LaTeX macro for displaying quantities with units break in figure captions?

I define the \quan macro to consistently typeset quantities (copied below) in my preamble, and it works fine…except in figure captions where pdflatex complains that I've got an undefined control sequence and crashes. How can I modify the macro to make it work in the caption environment? Thanks! \let\unitsep=\, % Inserted at spaces...

Excel: How can I speed up a Find & Replace process? Changing 32,000 links per workbook.

I'm comparing a lot of data for over 30 categories. Each category workbook is saved into 'MyFolder' with it's own distinctive name (the category). The data in the workbook is found on a sheet with the same name as the category: [Category.xls]CategoryYear_Final! It seemed best to create a standard template that references the data and wh...

C Unstringification with macros

Is there any way to unstringify strings provided as macro arguments? I need to be able to call functions who's names are in strings. Something like this: void hello() { printf("Hello, world!"); } call_func("hello"); How would I implement call_func. It would be in a module that would be #included and would be used to call functio...

Macro return value

Can macro return an object? #define macro1 {obj1} Since macro is text substitution, could I use macro like macro1.function1()? Thanks. ...

Pivot table conditional formatting (cell-coloring).

I want to color the cells of a pivot table in a way that it highlights the highest values in the row. The table I have is something like this: ________|_Field1_|_Field2_| ________|_X_______________|_X_Total_|_Y________________________|_Y_Total_| _Field3_|____A___|____B___| |____A___|____C___|____D___| | ____1___|____3___...

sql macro parameter

This is on Teradata specifically, but in general, is it possible for a macro to accept a list as a parameter? E.g., create macro myMacro ( incomingList ) AS ( select foo from tBar where animal in (:incomingList ); ); ...and then... exec myMacro( ('chicken','pig','cow') ); ...

Evaluate macro parameter once only

In the following code, whatever is passed as retval is evaluated as given for every use of that token. #define _CPFS_RETURN(commit, retval) do { \ util_cpfs_exit(commit); \ return retval; \ } while (false) #define CPFS_RETURN_BOOL(retval) do { \ _CPFS_RETURN(retval, retval); \ } while (false) For examp...

How to permanently allow macro for a trusted worksheet?

Hi I've created a worksheet which is shared amongst my colleagues with a real simply macro to show/hide rows but everytime either I or one of my colleagues opens it they get prompted to Allow marco - is there anyway for them to permantly allow this macro? ...

Multiple (define)s in a CL style macro [scheme]

I'm currently learning how to write CL style macros (define-macro) in Scheme. As a simple example, I wrote a struct macro that defines functions like make-thing, thing?, thing-field accessors and so on. Now I'd like to combine multiple defines in a single macro, but only the last one is actually used. Currently I'm using eval to define ...

How to reference cells in a Pivot Table using Field values?

Hi, I have a pivot table created from 3 fields where (for example): field1 values are: "1", "3", "5" field2 values are: "A", "B", "C" field3 values are: "X", "Y", "Z" So given a pivot table PT1 I want to reference a cell within the table in a similar way to PT1["1"]["B"]["Y"] and get a Range item returned. Is this possible? Thanks. ED...

Pre-build event fails

I set a prebuild event to: $(TargetDir)MyConsoleApp But when I run the application I get the following output: ------ Build started: Project: BlahBlahBlah, Configuration: Debug x86 ------ 'd:\users\user\documents\visual' is not recognized as an internal or external command, operable program or batch file. C:\Windows\Microsoft.NET...

Macro not working as expected in Notepad++

I just installed notepad++ and i am having some problems with macros in it. i have a simple text file below: hi i am here this is the third line i kept the cursor at the first line before "hi".Now i selected start recording macro in the menu.i typed 'hi' before 'hi'(the actual word in the line) like below and pressed [Home] key in t...

Excel macro: how do I change all row heights, BUT if cell.value = bold make the cell height bigger?

I'm working on a long list of data (Column B) that has been formatted using bold and indents. The bold cells contain the titles/category names and the indented cell values are the subcategories. The row heights are all over the place. It should have been 10.5 for everything, and the bold cells/rows 15. I can change everything to 10.5, b...

Macro in visual Studio 2010 that loads settings file

Hi there I'm just looking for a way (maybe a macro?) to load a settings file. Ideally I'd like to be able to run this as a shortcut from the desktop too. I googled it, but maybe I didn't hit the right keywords. ...

Excel Macro: how do I expand a ROW height to accomodate wrap text?

I'm slowly amending and expanding an If...ElseIf...Else statement (see post) to help me format a long list of categories and sub-categories (thanks marg & Lunatik). I've assigned fixed row heights to 90% of the range/lines. Now I'm stuck on those cells with lots of text that wraps over two lines in a cell. Two lines of text does not fit...

macro recording and replaying in eclipse 3.5

Hi, which tool would you recommend for macro recording and replaying ? Is there a language as well ? I frequently switch between Eclipse and Emacs(actually Xemacs) for editing tasks. It would be nice if I didn't have to do as frequently. That would happen if a macro language/recorder were available in eclipse. It's available in Netbean...

Complicated Excel VBA Macro with Loop

Hi all. I require help with a reasonably complicated VBA macro loop for a dataset I've been provided. The dataset exists as one long column one thousands of different entries. I've tried recording macros but I am at a loss at the best way to approach it. Any help would be greatly appreciated. In its simplest terms, I need to locate a ...

Is this Macro Abuse?

I was reverse engineering some code and came across this... /************************************************************************/ /* */ /* MACRO CHECK_FREAD */ /* ...