Newest macros Questions

Q&A for professional and enthusiast programmers

Java automation?

I changed my job, previously I was able to create only macros/applications in vba (.exe files were disable on all accounts). Now I have no restrictions, but software has changed too. We are working on ...

macro_rules! macro takes string literal “…”, expands to both “…” and b“…”

I would like to write a macro_rules! macro whose arguments are one ident and a list of string literals. The expansion of the macro needs to contain both the string literals, and the corresponding ...

Transferring data between Google Docs Sheet and LibreOffice Writer document

I'm working on a case of weird data flow. Suffice to say that entry point is data from google forms gathered in google docs spreadsheet. Then the data is updated manually (it has to be done manually ...

Using get-setf-expansion [migrated]

In a previous post at Simplifying complex setf expressions, @sds suggested using the get-setf-expansion macro for implementing place modification, as discussed in On Lisp (p171ff) by Paul Graham . In ...

scope of expressions and variables in Julia macro in modules

For some reason, I had to put quote...end block in the macro and ex is generated programmatically. This code works. macro addsum_out() quote ex = :(x+y) sum(eval(ex)) end end x = [1 1 1] ...

Macro that knows void * allocation type

Let have this code as example: typedef struct { int value; char another; } foo; typedef struct { float yet_another; long really_another; } bar; typedef struct { char* name; ...

Simulate a real hardware mouse click c#

Is there a way to really send a hardware mouse click command? I have a game that I want to make a macro where in I won't have to click all the time while being AFK (This is to prevent disconnection) ...

Is it required to install MS excel on server to run Macros from a web application?

I have an Excel which has some macros. I need to execute those Macro from a MVC web application. Do I need to install MS Excel on server ?

How to pass a macro containing multiple items into a macro?

Given this simple macro that expands multiple items, how could this take a macro as an argument? macro_rules! print_structs { ($($t:ty)*) => ($( println!("{:?}", TypeId::of::<$t>(...

Write 2D array in Google sheets

I am trying to write data to google sheet using an array which is mixture of data and arrays. Sample Array: [Data1, Data2,[Data3, Data4]] If I try the following code, only the 1st element of the ...

How to do arbitary text replacement in gnu assembler

a:.int 0 movl $0,a(%rip) Is there a way to do something like #define b a(%rip) such that every instance of b will be replaced by a(%rip), so that movl $0,a(%rip) could be abbreviated as movl $0,b? I'...

Why does using the following macro function in C result in 1 instead of 2?

I have this simple C code with a Macro: #include <stdio.h> #define MAX(x, y) x>y ? 1 : 0 int main() { int i = 9; printf("%d\n", MAX(10, i) + 1); return 0; } Now as I ...

Multi-line macro defining another set of macros

In my project I have very many files and I want to manage debug with C++ macros. For every file, I want to use its own switch for enable or disable debug and adjust debug level. So basically there is ...

Accessing Build Configuration(preprocessor macros) of Main Project Framework Project

I am working on a framework project where I need to make some decision based upon the build settings configuration from main project(the project which is going to use my framework.) Currently I have ...

Is there way to tell whether macroexpansion will or will not see lexical context?

When performing row-wise operations in a table (implemented as, say, list of lists), it is convenient to refer to cells by their respective column names. I decided to write a shortcut, so that I don't ...

Is there a byte equivalent of the 'stringify' macro?

Rust has a stringify! macro to get an expression as a string. Is there a way to get the equivalent functionality that outputs bytes instead? As if the expression were written as a byte string literal,...

How to make a Excel file execute at a click of a button

I have a folder named X. In that folder I am adding 2 files: VIZ. 1. Core data(Which contains raw data in Excel) - this file will be changing dynamically as report is fetched has different data ...

Macro statements used in a header file, but defined outside of it

I'm writing some libraries for a microcontroller, and I've organized these libraries in sections with respect to their function. For example, I have adc.h to configure analog input measurements, uart....

Assigning a value to a new variable in a Crystal macro

I would like to create a new variable in a macro. My code can be reduce to: macro test() %p = "a = 3" %p end test() puts(a) but i then get an error undefined local variable or method 'a' I ...

What do this lines mean?

I'm running a prova.c file on my terminal. I ran GCC with the command line: gcc -Wall -std=c99 -E prova.c prova.c: int main(int argc, char* argv[]) { int a=1; int b=2; ...

How to recursively take the last argument of a macro?

Using a simple recursive macro like the example below, its common to take the first argument, then glob the rest. macro_rules! count_tts { () => {0usize}; ($_head:tt $($tail:tt)*) => {...

Why define a macro with the same name and content in C?

I am looking into if_link.h in the Linux kernel headers and it contains this enum: enum { IFLA_UNSPEC, IFLA_ADDRESS, IFLA_BROADCAST, IFLA_IFNAME, IFLA_MTU, ...

Calling a C macro with other macros as arguments

I am having issues while trying to pass a macro constant as an argument to a macro function. Consider the following code - #define ERROR 10 #define MAIN "Main:" #define LOG(lvl,mod,fmt,...) \ ...

2 similar C programs with macro producing different output

The following code prints nothing: #include<stdio.h> #define TOTAL_SIZE ( (sizeof(array))/(sizeof(array[0])) ) int main() { int array[]={1,2,3}, d; for(d=-1; d<=TOTAL_SIZE-2; ++d) ...

How to set a Macro to run automatically in Netbeans?

I have the follow macro to select the entire word under caret select-word caret-begin-word selection-end-word here I sit to trigger when ctrl+d is pressed. it works. Is there a way to trigger the ...

What is the best way of combining &key and &rest in a lisp macro's lambda list?

I implemented Heap's algorithm using a macro. It's working OK, but I would like to tweak it so it will generate anaphoric or non-anaphoric code on demand. In other words, I would like to have the ...

Function composition in Scheme

I'm trying to modify the function below to compose two functions in Scheme. (define (compose F1 F2) (eval F1 (interaction-environment)) ) rather than (define (compose f g) (λ (x) (f (g x)))) ...

(C) macro that contains 2 args in macro doesn't compile, but it works well in function. I want to know why. Thanks

Yesterday I tried to optimize my code using macro, but it doesn't compile in some sentences. For simplification, I writed codes below to describe what I want to work out: #define MACRO(x, y) ((x) + (...

How does this macro work?

In this Python implementation for microcontrollers, they use C-macro like follows: MP_ROM_QSTR(MP_QSTR_mem16) with: #define MP_ROM_QSTR(q) MP_OBJ_NEW_QSTR(q) and: #define MP_OBJ_NEW_QSTR(qst) ((...

CATIA Macro Scripting - Expand Single Tree Node

Is it possible to expand a single node in the tree all levels, using macro code. I see that you can expand all nodes, but I don't want to do that. Also, I see you can expand selected, but I don't want ...

Assign zero value to random type use macros in C?

In a macro below, returnValue could be any type. typeof(FuncReturnType) returnValue = Func(); \ typeof(FuncReturnType) expectReturnValue = (zero value) returnValue could be int, double pointer, ...

At a language level, what exactly is `ccall`?

I'm new to Julia, and I'm trying to understand, at the language level, what ccall is. At the syntax level, it looks like a normal function, but it clearly doesn't behave the same way in how it takes ...

Mac OS webview random crash

I am allowing the users of my app to login via facebook on mac app. I have loaded the facebook login page on webview, asked users permission, getting the AccessToken/UserDetails from facebook - all ...

Could not find proxy for … in Macro

I have been chasing the following issue for quite a while and am hoping someone with more experience on this than myself can help me resolve it. In my test-case the exact error is as follows: java....

Nested macro iteration with C preprocessor

With the C preprocessor you can have some kind of high-order macros. Something like this: #define ABC(f) f(a) f(b) f(c) #define XY(f) f(x) f(y) #define CODE(x) foo_ ## x ABC(CODE) #undef CODE #...

C++ macro overloading by number of arguments in Visual Studio

Some strange problem with macro overload in Visual Studio. #define ENUM_INTERNAL(A, ...) A, ENUM_INTERNAL(__VA_ARGS__) #define ENUM_INTERNAL(A) A, COUNT #define ENUM(name, ...) struct name { enum en ...

What is proper way to write crossplatform macros in Clojure(Script)?

I wrote some wrapper macros around one JavaScript lib (PRNG). Then I wanted to make functionality provided by this macros crossplatform. (i.e. I want to have different implementation of this macros ...

How to run VBS function with parameters from Java and assign result to variable

I have this excel macro: Function Calculate_Something(StartDate As Date, EndDate As Date) As Double //some math is here, not important Calculate_Something = Result End Function And I want to pass ...

Macro undefined when test module is moved to a separate file

I am writing a test for a macro I want to export. The test works as long as I keep my tests in a single file, but as soon as I put the tests module in a separate file, I get an error. export/src/lib....

Using argument number in macro expansion?

When expanding arguments to a macro, is there a way to include the argument number within the macro Here is a complete example showing how this might be used to assign an index to a struct using a ...

Add text on multiple lines in UI Expand Macro in Confluence

I use UI Expand Macro in Confluence. I can create a button having a single line as title: but I can't create a button having multiple lines as title: Is this possible? How? I tried the following ...

Visual Studio Build Command Macros for determining the version of Visual Studio

Is there a Visual Studio build command macros for determining the version of Visual Studio? I want a post-build event that runs something in C:\Program Files (x86)\Common Files\microsoft shared\...

Macro :To filter test cases with no attachments in test lab

How to filter test cases in test lab for which no attachments are present using macro? I could not find the code for this. There are thousands of test scripts in a folder and it would be helpful if ...

Netty Asynchronous DefaultPromise

I'm writing a Scala program that uses Netty for asynchronous HTTP within a compile-time Macro. The functionality works fine, but a few seconds after it's finished running it dumps this out: https://...

How do I create a spam macro that only spams for a specific number of key presses?

E.G. I press 'Q' once, and the macro would repeat the press 10 more times over the next second even after i'd let go. Notes on what each part of the code does would be helpful too! Tried to work this ...

Macro to discard a requires clause

In a recent paper by Bjarne Stroustrup (P0557R0), one can find the following statement: If you need to be able to compile with compilers the support concepts and compilers that do not, some ...

How to find the location of a macro's use between crates?

When a macro causes a panic (directly or indirectly) between crates, the line of code from which the macro is used isn't included in the back-trace. This makes it impossible to know which use of the ...

Negative arity exception in recursive macro

I'm trying a coding challenge that requires you to create code that compiles infinitely. My first thought was a macro that expands to itself forever. I wrote up: (defmacro a [] (a)) (a) This ...

how does redundant if-else help to optimize?

I am reading the source code of Python's numpy library, and found the following snippets. It seems to perform element-wise operations on vectors (numpy.ndarray). For example, numpy.multiply([1,2,3],[4,...

Macro constants concatenation using ##

I'm writing some libraries for a microcontroller, and for that purpose, I use macro-like functions. For example, a macro-like function to enable an I2C module is defined as: #define I2C_MODULE_ENABLE(...
Translating... 0%