macros

Clojure: Is it possible to make a macro to create the two elements in a single condp clause?

The condp clauses look like this: "plet" (make-adj 2 "ète") "iet" (make-adj 2 "ète") "nin" (make-adj 1 "gne") I want to add the condition to the make-adj function call without repeating the condition twice in one line. I'd like a macro that turns this: (test-make-adj "plet" 2 "ète") (test-make-adj "iet" 2 "ète") (...

how can I force C++ macro substitution at the time I choose in this case?

I couldn't think of a better way to word the title... #define X(c) c #define Y(c) X(c) #undef X int main(int argc,char*argv[]) { std::cout << Y(5) << std::endl; return 0; } This causes an error, because X() is not declared in this scope. Is there any way to make Y store a copy of X (aka, force the macro substitution to occur...

Declaring namespace as macro - C++

In standard library, I found that namespace std is declared as a macro. #define _STD_BEGIN namespace std { #define _STD_END } Is this a best practice when using namespaces? The macro is declared in Microsoft Visual Studio 9.0\VC\include\yvals.h. But I couldn't find the STL files including this. If it is not included, how it c...

Umbraco Menu macro disappears first on page load

Hey, Im using Umbraco 4 and have built a menu using a macro. I have one issue though when I click on a menu item the entire macro disappears immediately, some time before the rest of the page disappears so the new page can render. The new page renders the menu at the same time as the rest of the page though. Any ideas on why this could...

Question about clojure namespaces and macros

Suppose I've got a bunch of namespaces (apple, banana, orange). In these namespaces I use the eat macro, which calls (not "generates", calls) the peel function. The peel function is different for each fruit, but the macros are identical, and fairly big, so I'd like to create a fruit namespace that contains the eat macro. But when I call ...

Clojure macro to collect strings in constant.

I've got a Clojure file with a lot of string constants. I want to collect these strings in a collection by wrapping them in a macro. After several tries I succeeded, but my solution looks fairly hideous. (ns Memorable) (def MEMORY (atom [])) (defmacro memorize [s] (swap! MEMORY conj s) s) (prn (str (memorize "hello") " brave new " (mem...

what are the platform-name macros called? (e.g., __SVR4)

The pycups-1.9.48 library doesn't build on Mac OS 10.6 unless I remove this ifdef: #ifdef __SVR4 /* * A rudimentary emulation of getline() for systems that dont support it * natively. Since this is used for PPD file reading, it assumes (possibly * falsely) that BUFSIZ is big enough. */ ssize_t getline(char **line, size_t *linelen, ...

Can you do a RunCustomTool with EnvDTE as a pre-build event?

I am using T4MVC, and I can't use a pre-build event to run TextTransform.exe as it relies on EnvDTE, and must be run with Visual Studio as host. If I have run custom tool once, it works nicely because it marks itself dirty when its executed (AlwaysKeepTemplateDirty = true), but when you open the solution, it doesn't run on build, so I w...

Remove MS Word macro using VBScript

I want to remove all vba-modules from an MS Word template using VBScript. I wrote the following script. const wdDoNotSaveChanges = 0 WScript.Echo "starting Word..." Dim oApplication, doc Set oApplication = CreateObject("Word.Application") WScript.Echo "opening template..." oApplication.Documents.Open "path\to\test.dot" Set doc = oApp...

Application does not accept keystroke

I am trying to send keystrokes to the application VisualBoyAdvance using AppleScript, but I cannot get it to work. My code, so far, is this: tell application "VisualBoyAdvance" activate tell application "System Events" keystroke "k" end tell end tell When I tell VisualBoyAdvance directly, I get this error: erro...

Variadic Macros : how to solve "too many actual parameters for macro.."

Ive been working on getting some of my code originally built on the mac to run under Visual Studio 2008 Express and have run into a weird problem with the variadic macros i use for my assert code : The macro is defined as : #define SH_ASSERT( assertID, exp, description, ... ) shAssertBasic( int(exp), assertID, description, __LINE__, _...

C/C++ Macro: How to generate two separate sections of code with one macro (boost preprocessor library?)

Hello all, I'm looking for a method or a way to generate a list of typedefs and a list of object instantiations from a list of macro-invocations, defining the class types and the constructor parameters of these objects. It should look like the (not working) code below. The problem to solve is a way to generate to different lists out of...

What elisp or macro magic can make this text transformation?

I have a set of SQL statements formatted like so: INSERT INTO reports.workload (workload_id,event_time,event_type_id,agent_id) VALUES (-42000,'2010-02-23 07:30:38.941436',1,NULL); Right now, the VALUES tuple is aligned at the start with the column name tuple. However, what I want is to have the tuple's el...

C multi-line macros

Possible Duplicate: Whats the use of do while(0) when we define a macro? Why do people use do { statement1; statement2; statement3; etc; } while(0); instead of the shorter form {stmt1; stmt2; stmt3; etc; } in C multi-line macros? ...

SAS V9.1.3 - Error when combining %INC and CALL EXECUTE

Hi, I am getting a resolution error with some SAS v9.1.3 code. Here is some code I want to store in a .txt file (called problem2.txt) and bring into SAS with a %INC %macro email020; %if &email = 1 %then %do; %put THIS RESOLVED AT 1; %end; %else %if &email = 2 %the...

Invalid preprocessor token warning message

I have a bunch of generated functions from a supplier's tool are required to be defined by me. Since the inner functionality of each and every one of these functions are exactly the same, I figured I could use a macro to make my life easier. Here is the offending warning: pasting "<function_name>" and "(" does not give a valid preproce...

Syntax aware selection in XCode?

Since moving to XCode I am desperately missing a text macro I have used in many other editors which I use all the time. Basically what it does is that everytime you invoke it, it selects text in an expanding scope. Here is IntelliJ's definition of the functionality: Syntax aware selection Ctrl+W (select word) in the editor selects ...

VB (macro in excel) - compile error

i am try to create an uploader in excel using vb (macro) to store data in an access database. i believe in terms of the script everything is ok. its just that when i run the upload it gives me the error Compile error - User-Defined type not defined and once i click on OK it highlights the part where it finds the error which is: Private...

Using Macros to Define Constants for CUDA

I'm trying to reduce the number of instructions and constant memory reads for a CUDA kernel. As a result, I have realised that I can pull out the tile sizes from constant memory and turn them into macros. How do I define macros that evaluate to constants during preprocessing so that I can simply adjust three values and reduce the number...

Is it possible to se a macro in .viemurc for ViEmu?

I am using the ViEmu plugin for VS2008. I was wondering if there is a way to set a macro in the .viemurc file, so I don't have to redo it every time I start up VS. I know that it can be done in regular Vim via: :let @s="0ftwwy$bp" This will set a macro on register 's' for example. Doing the same in .viemurc so far just got me an er...