Newest macros Questions

Q&A for professional and enthusiast programmers

is it possible with macros of rustc 1.17

I want to want write such code: enum Foo { A1 = 1, A17 = 17, A42 = 42 } static FOO_VALUES: [Foo; 3] = [Foo::A1, Foo::A17, Foo::A42]; impl Foo { fn to_num(self) -> i32 { match self { ...

Adding an ident to multiple repetition results in “local ambiguity: multiple parsing options”

I'm trying to build a macro that would be called with a list of function calls (test2()) or identifiers (test3): invoke!( ["str1", "str2"]: i32 => test1(), test2(), test3, test4; ["str3",...

Qt listing properties of Class

I have a class (CNode) CNode has this property Q_OBJECT Q_PROPERTY(QString name READ getName WRITE setName/* NOTIFY nameChanged*/) Everything compiles fine... Question is: How can I list all of ...

Clojure macro nesting. NullPointerException

I'm quite new to Clojure and, I think, programming in general but I ended up trying to write some kind of DSL for producing PDFs files (using PDFBox, a java library). I want the final syntax to look ...

in autohotkey not all send tabs are working

i was trying to make a .ahk to macro a gif making, uploading, and url coping but it often times ignores keystrokes like send, {tab down}{tab up} which compleatly breaks the macro ^q:: run ...

Visual Studio 2015 and VB Macros

I have VS2015 with installed VSMacros.vsix (Macros for Visual Studio) and also Vb61.VbTools.vsix (Visual Basic extension). When I open Macro Explorer I can record, and edit macros but they are written ...

Searching for string while recording a macro in VIM

I want to add a new field to objects in a list using vim. Each object is not the same number of lines. However, the last field is the same for each object. The new field is the same for each object, ...

How can I create a Wrapper to a a Macro with variable number of arguments?

I have a macro like LOG_I(_module, _message, ...) I need to create a wrapper to this macro #define WRAPPER_LOG(_module, _message, ...) LOG_I(_module, _message, ...) How can I achieve this ?

Use of macro before data type in C

I wanted to know what is the use of a macro before any data types. I found many instances in the production code. But I don't understand the use of it. For Example: #define OUT #define IN /* ...

Purpose of square brackets in macros? [duplicate]

I'm trying to understand what this code below is doing. #define MY_ERRMSG(_cmd, _accept, _errmsg) \ [ _cmd ] \ { \ ...

Concatenation macro in C++

I have the following definition in my C++ file: #define SIZE 32 And I want to generate following two lines: typedef uint32_t bui typedef uint64_t lui The first line can be generated by: #define ...

pass block instruction as macro's argument in C

I don't know if that is possible, I want to pass a block of instructions in macro like an argument.I will show you an example: #define ADD_MACRO(size, BLOCK){ for(int i=0; i<size; i++){\ ...

Void template arguments in macro definitions in codes belown in C++

The codes are as, // List all complex types. // - used in the list of scalar types below // - by default, a type is NOT complex // - only std::complex<T> is an exception from that rule ...

How do I store the $(TargetDir) in a variable

I'm trying to store the Target Directory in a variable, However when I'm doing path.Combine it just ignores my parameters. this._outputPath = "$(TargetDir)../../" block.Name = "/Contracts/TestDTO"; ...
+50

Evaluate all macros in a C++ header file

I have a requirement to build an automated system to parse a C++ .h file with a lot of #define statements in it and do something with the value that each #define works out to. The .h file has a lot of ...

C define Macro with same name in different header?

Is that possible to define macros with same name in different header files For example, in a header file a.h and b.h we both define macros with same identifier

Excel VBA or sheet required [on hold]

i need vba code which is as follows my excel is connected to web, getting live Price value in A1,live date time in B1 and a predefined datetime in C1. now i want to copy the value of A1 to D1 when ...

java interop and clojure macros

I am facing the following problem. I am trying to construct a function (macro) on top of the hapi-fhir api function (macro) on topo of hapi-fhir api (defmacro search-patient-resource "This macro ...

Is there a way to make macros show up in Visual Studio's Intellisense context menu?

Suppose that I have the following function prototype: #define WHATEVER void MyFunction(WHATEVER int &x); Such that I can use WHATEVER to label the parameters of the functions for documentation ...

Comparing C macros

I have addressing macros (it's on a microcontroller, so accessing physical address is OK) that break down to this (after a long sequence of conditional defines, attributes, etc): #define ADDR_A (*18) ...

How to resolve it when class method and macro have the same name?

I have encountered a problem when I was upgrading a class and need to import an external library. For example, I am editing a class called CFoo, which has a public method SendMessage(). It works fine ...

Detect if twig macro argument was passed or null

I need to know when an argument for a twig macro is defined vs when a null was passed as the value. If I use "is defined" then that accounts for both conditions, as twig seems to set all undefined ...

Quote function name in Elixir

I'm learning Elixir now and I'm really confused with quote and unquote. Here is how we create a function with a dynamic name using a macro: defmacro create_fun(n) do quote do: def unquote(:"times_#{...

Why my itunes take up so mush memory

enter image description hereMy computer only have 120G, but my itunes take up 30G. Oh, my god, I want to know why

Running stored macros from an autocall library

I am running into errors when trying to execute a stored macro from an AUTOCALL library. I have stored a macro within a folder using the following: libname myMacr 'C:\My Macros'; options mstored ...

Scala macro does not compile when code is crafted without reify

I've been working on complex compile-time reflection and have come across the need to craft Scala code manually, using the AST. While experimenting I noticed a weird compilation error which doesn't ...

Macro printing a value stored in a byte. Assembly masm

Assembly, masm Hey, I wrote macro which prints the 1 byte value stored in dane1 segment. I divide the value by 16, then i push reminder to stack until value==0. Then I pop reminders convert them to ...

How to create a macro that generates an array of constructors known dynamically by name in Haxe?

I'm targeting javascript. I have a macro that runs on Context.onGenerate() that saves a subset of fully qualified type names to a file. Then, another build macro (which would run on the next buid) ...

Elixir macro rewriting module methods and global __using__ macro

With elixir's __using__ macro and with the aid of __on_definition__ I can keep track of all methods in a module. What I would like to do is replace all methods in a module with some other ...

QT macro Q_SLOTS after the class access restriction

I am reading the rviz source code. I found the macro Q_SLOTS after the protected. I am not sure the meaning here. (I understand the access restriction to the class members 'proected' meaning). ...

C macro compilation error (AOSP: external/clearsilver/util/neo_err.h)

I have a compile error in C, involving a macro, which is driving me nuts. It's not my code, but rather part of a widely used library. I'll give you the back story, because I know I'll be asked ...

resolving and instantiating non imported packages with --run and --macro include

I also posted this question on haxelang here I've been using the --run command, and have been trying to include some packages when running it, using --macro include like this: haxe -lib nape --macro ...

nunjucks macro to change a class

What would be the correct way to use macros in nunjucks to change the class in an include? For example, I have an include for a banner image, the client would like a different image on each page so ...

Cartesian product match

I have two sets of incomplete types (i.e. struct names, missing generic parameters and lifetimes), and I need to have some code executed for each possible pair of combinations: // these are my types ...

How to Resolve Keyword Error with SAS Macro

I'm running this sql macro in SAS. %macro calc(table=,cut=,whereclause=); proc sql; &table select &cut as type format = $40. length = 40 ,dt ,count(prod_nbr) as stat ...

Specific C++ Macro

I would like a C++ Macro that will turn something that looks like this: safe_cast<Type>(object) into Assert(dynamic_cast<Type>(object)) Is this possible? I could do it using: ...

Foswiki user topic only visible for 1 user and admins

I have a problem with the Foswiki Access Control. I have a custom registration form, with additianal fields and form elements. It works, the users can register with it, and create their own user topic ...

Copy/paste Actions in Illustrator

I am automating a task in Illustrator by means of Actions. In particular, I copy/paste some artwork from a drawing to another. Anyway, I don't see a way to control where the pasted artwork will land ...

SAS: Execute SAS code using hotkey

I want to execute code which is independent of my current program via keyboard shortcuts within the Enhanced Editor in SAS 9.4 for Windows. I've achieved this with limited success being able to ...

Checking for C99 feature support in C [duplicate]

I'm checking if C uses (at least) C99 standard before including stdint.h library (introduced in C99), but __STDC_VERSION__ is not always defined, so i need a more portable method (if possible) Like: #...

Try to convert file into excel…[macro]

The txt file is converting to the Excel xls file by using Python. But some of the new line will not function when the text file is converted to the Excel xls file. eg: In the txt file, the data is ...

SAS looped macro variables resolving incorrectly

Good afternoon. I am writing a SAS program that will loop through several sets of time-series/ observations. For each set, there is one observation per month, with roughly 450 observations/months ...

When to use macros in Objective-C

According to definitions "A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by the contents of the macro". I used to use macros for those codes which ...

Opening Oracle SQL developer using VBA

Hi I am trying to open Oracle SQL Developer and connect to specific environment in my client machine using EXCEL MACRO. Problem is how long should the application wait before using SendKeys. For ...

How to define anonymous type List in scala?

class Galileo extends StaticAnnotation { def macroTransform(annottees: Any*) = macro Galileo.impl } object Galileo { var columns = List[List[Option[JValue]] => (String,String)]() def ...

RPM: invoking a macro with arguments from another macro with arguments

I would like to invoke an RPM macro taking an argument from another macro. In m4, this would be done trivially like this (just an example, not what I really want to do): define(`path', `/mnt/$1/lib') ...

Define a macro name based on another macro's value

I did this: #define SW P13 Now I want to a macro named PIN_ISR_P13 with subst. value real_isr() but based on SW's value. ie I want SW's value to 'drive' the names of these macros. P13 is itself ...

Is there any C function that returns constant variable name for a given input value? [duplicate]

For example lets say I defined a constant as below using #define macro in C #define MAXSIZE 10 Is there any function in C that I can invoke by passing 10 as input and retrieve that constant name "...

Malloc macro overloading that works also for compiler calls to malloc (C++)?

I have found online multiple mentions to the following trick to "overload" the calls to `malloc': void* myMalloc(const char* file, int line, size_t size) { return malloc(size); } #define malloc(X)...

Make a keyboard button press display the number corresponding to the number pressed

Easiest example, would be for the numpad buttons 0-9. If I press one of these buttons on my keyboard it would display the corresponding number in a list or somewhere on my screen. So I can cycle ...
Translating... 0%