macros

Is there a way to do a #define inside of another #define?

I know that I am trying to shoot myself in the leg ;) However, it will allow me to make the rest (big amount) of code smaller and more readable. Is there any tricky way to create preprocessor macro inside of another preprocessor macro? Here is the example, what I am looking for. My real scenario is more complex // That's what I want ...

typedef,#define

Can anybody explain the difference between #define int* char and typedef int* char; ...

How to update range macro when cells in Excel are inserted/deleted.

I would like to ask if there is a way to update the range specified in a macro when I insert/delete cells.. For example, I have specified the range in a subroutine in my macro to be Worksheets("Query Screen").Range("M22:M25") = "0" Now, if I insert a new row between M22 and M25, what can I do to update the range in my macro automatic...

Generating labels in macro preprocessing in C

Hi, How to write a macro which calls goto END_ label? For ex: #define MY_MACRO() \ //How to define goto END_##function_name label?? my_function() { MY_MACRO(); END_my_function: return; } The MY_MACRO should simply replace with the line goto END_my_function; ...

Argument Preceded by a # Token in a Macro

#define LINK_ENTITY_TO_CLASS(mapClassName,DLLClassName) \ static CEntityFactory<DLLClassName> mapClassName( #mapClassName ); This is a macro from the Alien Swarm mod for Half-Life 2, meant to be compiled with MSVC. I've never seen an argument preceeded by a # in a macro before, and I'm not sure if this is a MSVC specific thing or ...

[javascript] EXTENDS challenge: preprocessor function macros and class-like oop

Background I've been using the C preprocessor to manage and "compile" semi-large javascript projects with multiple files and build targets. This gives full access to C preprocessor directives like #include, #define, #ifdef, etc. from within javascript. Here's a sample build script so you can test the example code: #!/bin/bash export OP...

Word 2007 VBA: Documents.Add results in template being locked

I have a simple macro that creates a new document based on a template that's stored on a network share; this macro is stored in each user's Word\STARTUP folder as the file "macros.dotm" and is executed by a button added to their toolbar. The problem I have is that the template file gets locked as soon as the macro code (see below) is e...

How to know what function called another

Hi, I wanna know if there is any way to know where the function currently in execution was called, this is, in what file and line. I'm using C language, and I'm looking for something similar to _FUNCTION_, _LINE_ or _FILE_ macros. Best regards, Sérgio ...

Vim Macro on Every Line of Visual Selection

I'd like to run a macro on every line in a selection, rather than totalling up the number of lines in my head. For instance, I might write a macro to transform: Last, First Into First Last and I'd like it to run on all these lines: Stewart, John Pumpkin, Freddy Mai, Stefan ... Any ideas Vim gurus? EDIT: This is just an example...

getting started with processing data with python

i have an excel spreadsheet of about 3 million cells. i asked the following question and i liked the answer about saving the spreadsheet as CSV and then processing it with python: http://stackoverflow.com/questions/3322939/solution-to-perform-lots-of-calculations-on-3-million-data-points-and-make-charts/3323168#3323168 is there a libr...

smallest learning curve language to work with CSV files

VBA is not cutting it for me anymore. i have lots of huge excel files to which i need to make lots of calculations and break them down into other excel/csv files. i need a language that i can pick up within the next couple of days to do what i need because it is kind of an emergency. i have been suggested python, but i would like to che...

objective-c macro for a variadic function

Hello, Here's an example of what i'm trying to achieve. I'm trying to create a macro, that would look like this: SOMEMACRO(obj, obj, obj, ..., obj); The macro would compile to: some_function(obj, obj, obj, ..., obj, SOMETHING_ELSE, SOMETHING_ELSE); Here's an example macro for a 1 parameter function: #define SOMEMACRO(x) some_func...

ANTLR, C-styled macro definitions

What is the easiest (or the best) way to implement macro definitions in ANTLR? What I want is a mechanism similar to the one that is present in C/C++ language: #define FUNCTION(a, b) a+b #define PI 3.1415 How and when should I perform replacement? ...

C99 Macro to build a quoted string literal after evaluation

I'm developing an embedded application in C99, and the project contains some integer constants defined like: #define LEVEL1 0x0000 #define LEVEL2 (LEVEL1 + 1) It has since become useful to keep track of these values for logging purposes, so I would like to use a macro to create a string literal from the evaluated versions of t...

Excel, Macro/VBA if="x" then select rows and paste to other sheet

Hi Guys, Im stuck attempting to develop a fairly basic accounting spreadsheet for a work project. Im not sure how to add attachements here, so I will try explain as best as I can. Every day I manually enter data into a sheet with several columns, a few examples of column headings I have are: "Tax Invoice No.", "Customer", "Description"...

Outlook macro to search mails for text strings

I'm looking to search my emails for particular bits of text (or sender name) to be able to do things to those mails afterwards (i.e. delete, move to folder, remove content, etc.) Being an Outlook macro newbie, where should I start? Any ideas/pointers on the above or useful reference web sites much appreciated. ...

Can I call a "function-like macro" in a header file from a CUDA __global__ function???

This is part of my header file ("aes_locl.h"): . . # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) # define GETU32(p) SWAP(*((u32 *)(p))) # define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } . . Now from .cu file I have declared a __ global__ function and included the header file like this : #include "...

Word 2007 vba - Styles arent applied via macro

Hi, this is so weird. I have a macro code that basically creates a few tables, then types in some text in some of then, and then places a few text placeholders. The problem appear when I try to apply styles to the text. At first I thought it was only the placeholders that aren't affected by the code. But it seems as though regular text, ...

Notepad++: Writing a run command using an installed plugin

Hey all, I am trying to find a way to take the syntax highlighted text from N++ and then open it within say MS Word. I have found the plugin NppExport which can save the highlighted text to a rtf file. But it seems N++'s macros are not able to really utilize it. Any suggestions to automate this process? Thanks! Basic steps are 1) call...

Trouble with this macro

Embarrassingly enough, I'm having some trouble designing this macro correctly. This is the macro as I have it written: (defmacro construct-vertices [xs ys] (cons 'draw-line-strip (map #(list vertex %1 %2) xs ys))) It needs to take in two collections or seqs, xs and ys, and I need it to give me… (draw-line-strip (vertex ...