Questions tagged [macros]

1

votes
0

answer
155

Views

C++ ignoring warnings in a block with macro

I am using gcc 6.2 and want to ignore warnings in a macro. My idea was to do as in the following demo code. typedef char aligned_char __attribute__((__aligned__)); // disable warning using #pragma at the beginning of the macro // and enable it back at the end #define DISABLE_WARNING() \ _Pragma...
MGH
1

votes
0

answer
409

Views

CATIA macro from python

I would like to use my macro (.CATScript) to open the catia interface and make the changes listed in the macro script to the .CATpart and give output as .stp file. Is it possible to use python to realise this function? There was an example in Run a Catia macro with a python script, but it didn't wo...
Simulationeng_sam
1

votes
0

answer
309

Views

Automatically scroll down browser and click button, on a loop (Chrome)

I've never used browser macros, before I dive deeper into some rabbit hole I'm wondering if there's an easy way in Chrome to write a script that will: scroll down to the bottom of a page, click a 'Load More' button, wait 10s and then scroll down to the bottom of the page, and click the Load More but...
Antoine
1

votes
0

answer
37

Views

Resolving Nested macro linking error

I am getting a linking error because a function is declared in a .h file but its definition is commented. Below is the linking error: --- Linking Error --- Error: L6218E: Undefined symbol clk_SetHMSSAPMFreqPlan (referred from VVDRV_clk_glue.o). Now, the file where the function is being called has...
user3565150
1

votes
1

answer
184

Views

How does the new (probably in 4.17) linux kernel max macro work?

This lwn article describes the new implementation of the max macro in the linux kernel: https://lwn.net/Articles/750306/#Comments The macro has been changed to evaluate to a constant expression if it is used with constant expressions. The problem was that -Wvla triggers if an array length is not a c...
not-a-user
1

votes
1

answer
139

Views

Creating mixed recursive macro to create a HTML templating DSL

I'm new to Rust and even more to the macro engine, I'm trying to come up with a way of creating a DSL that I'll use for HTML templating that looks like the following, h! { foo( 'bar', tag_with_parens(), tag_without_parens, 'some other expression', element(child), ), 'tags and strings can be sibling...
olanod
1

votes
0

answer
56

Views

Create a Msg box in Notepad++ Macros

I have a macro that finds 's and replaces few strings. Below is the code. What I want Notepad++ to do is to show a message box if it doesn't find the string '_last'. How to achieve this? PS: I have found a very old post where it says that an older version of notepad++ shows a pop-up window on each...
Gangula
1

votes
1

answer
21

Views

SAS distinct level

data test1; input var1$ var2$ ; datalines; 1 a 2 a 3 a 1 b 2 b 1 c ; run; How can I create a macro var that contains all levels of var2? For example: %Let new_var = a b c;
user1481397
1

votes
1

answer
90

Views

Using macros that define version numbers in the form 10.0.0

I compile one of my C codes with a Mathematica C header file. Mathematica uses a macro to tell you which version you are using. The format is #define WSMATHVERSION 10.0.0 I'm more familiar with this pattern of version numbering in macros, // BOOST_VERSION % 100 is the patch level // BOOST_VERSION...
innisfree
1

votes
1

answer
53

Views

scala.meta.Lit.type does not take parameters

When I run the following: import scala.meta._ class Test { val x = q'1' } I get scala.meta.Lit.type does not take parameters val x = q'1' scalameta_2.11:1.8.0 paradise_2.11.8:3.0.0-M7 I'm trying to get some basic macro examples working, specifically the 'Hello' example found here: https://www.beyon...
user2682459
1

votes
0

answer
29

Views

How can I record a drive's volume label at compile time?

At first, I thought I could just use the __FILE__ macro but it only gives me the drive letter and path of the current file, what I need is something that includes the volume label. I know I can get the volume label using the GetVolumeInformation function but I really need the volume label of a driv...
1

votes
0

answer
28

Views

Single Stepping with Google Sheets Debugger

I have watched a few videos and read as many web pages about how to debug my Google Sheets Macro. Oddly, I can't get this ridiculously simple macro to work. It just takes the values in column A and sorts them to send duplicate values to the end. When I try to debug the macro using step into, the ste...
Dennis Kane
1

votes
1

answer
82

Views

How to use Google app script to automatically border line below When Value Changes

I want to add a border line below the row whenever column C value changes. I haven’t touched macro for a long time, this is a script I put together but it doesn’t work as expected. Anyone know where the problem is? Thanks! function underline() { var spreadsheet = SpreadsheetApp.getActive(); var...
santoku
1

votes
0

answer
167

Views

Cython macro definition in structure

I'm using Cython to import a structure to python from C while there are some macro definitions which include functions. I just don't how to realize the structure in Cython. typedef struct _SparMat { int m, n; int *rvec; int *ridx; double *rval; int *cvec; int *cidx;...
Icy
1

votes
1

answer
32

Views

Does visual studio has compilation mode with multiple drop down boxes?

I’m working with VisualStudio on a C++ project. I have multiple solution configurations in my project. Each one has a different MACRO definition. ConfigurationA: define A ConfigurationB: define B ConfigurationC: define C Now I need a different orthogonal set of configurations with MACRO definitio...
bochaltura
1

votes
0

answer
30

Views

Scala 2.11 refined with scalatest MustMatchers and Await causes compiler error “trying to do lub/glb of typevar ?F[?T, ?B]”

I have been trying to use the refined with scalatest and am getting compiler errors at the 'typer' phase: trying to do lub/glb of typevar ?F[?T, ?B] This is my best attempt at a minimalist reproduction of the issue using a self-contained ammonite script: import $ivy.`eu.timepit::refined:0.9.0` impor...
rmin
1

votes
2

answer
743

Views

Add a variable (column) in data set (SAS)

I can't find the solution for this simple problem: I want to add a colum/variable in my data set. This variable will always have the same value, stored in the macro variable &value. And I am in a macro so I don't know if it change anything... This is the step before merging 2 data step. So far, here...
videorama17
1

votes
2

answer
165

Views

how to get method body tree in scala macros

I am trying to convert scala object to js object object SObject { def foo(in:String):String = s'scalajs-$in' } val o = ScalaObjectToJSObjectMacro(SObject) // js.Dynamical.literal(foo = (in:String) => s'scalajs-$in') in macro i am able to get all Methods of object(in.tpe.decls.toList) and then for...
invariant
1

votes
0

answer
191

Views

Passing an array to macros in Twig

I am trying to use twig macros to create re-usable snippets on html code that I insert back into my main template however I'm running into an issue when attempting to pass an array to my macro: Macro call: {{ wrapper.outputConclusionList(viewData['response']['Report']['ContactBullets']) }} Macro fun...
Alex R
1

votes
2

answer
68

Views

Saving significance of a regression

I am running several simple regressions and I wish to save the value of the significance (P > |t|) of a regression for a given coefficient in a local macro. For example, I know that: local consCoeff = _b[_cons] will save the coefficient for the constant, and that with _se[_cons] I can get the standa...
1

votes
1

answer
690

Views

Overwriting Google sheets (for form response) rows if duplicate entered

So, I've been trying to figure out how to stop the duplicate rows appearing in my google sheets response output from a google form. If found this link which sounds like it does exactly what I want (Form Google Script Prevent Duplicates), but cannot for the life of me work out how to edit the given a...
Smashing
1

votes
0

answer
204

Views

force pureconfig to generate ConfigReader for case classes

I have a implicit class that wraps around a typesafe Config class to parse information from it. This class uses pureconfig to parse the data out. I use this because I prefer config.as[String]('foo') instead of loadConfig[String](config, 'foo'). But since I use this HoconConfigUtil as an adapter all...
rogue-one
1

votes
1

answer
27

Views

Racket macro that generates a nested module error

While experimenting with racket's macros, I stumbled into a definition that wasn't at first obvious to me why it was rejected. The code is short and otherwise is probably useless, but is as follows: #lang racket (define-syntax (go stx) (syntax-case stx () [(_ id) #'(module mod racket (define it id))...
skilluminati
1

votes
1

answer
72

Views

merge `Tree` and `List[Tree]` in scala compile-time reflection

I have scala macro that creates the constructor for a class on the fly. So for example if we have a class case class PersonConfig(name: String, age: Int, isFemale: Boolean). I have the Tree structure for the classname and the arguments passed to the class as shown below @ val className = q'PersonCon...
rogue-one
1

votes
0

answer
87

Views

Why is boost PreProcessor and QT giving me a "undefined reference to vtable for XXX` error?

I'm trying to generate QT5 macros from Boost PP Tuples and sequences. This is my code (note I'm using C++14, and I'm using QT5.10.1): //CMakeLists.txt cmake_minimum_required(VERSION 3.10) project(helloqt) # AUTO MOC GEN DEPENDENCIES set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_CXX_STANDARD 14) set(C...
opa
1

votes
0

answer
59

Views

Reusing fields/properties in case classes

I have huge json objects, which I extract to case classes using liftweb.json library. Basically, many of them contain a lot of common fields, having only 1 or 2 specific ones. Any possible way to deal with the common fields without repeating them? (there are around 20, it is ugly and tedious). Maybe...
dmitry
1

votes
1

answer
70

Views

Google sheet moving cells

i have google sheet with 9108 rows that follow certain order , but i strugling with moving 2nd row next to first and 3rd next to other ( picture down below ), i cant just take all 9thousand rows and just split it to 3 thousand columns, i trying to find script solution like this : move every other r...
Exelus
1

votes
0

answer
67

Views

Deferred expression in Visual Studio macros

I tried examples from this page in Visual Studio 2017 (Windows Console Application). And this code doesn't work as expected: #include using namespace std; #define EMPTY() #define DEFER(id) id EMPTY() #define A() 123 int main() { cout
Anton Grigoryev
1

votes
1

answer
33

Views

Compile time conditional inclusion. Segmenting headers vs including whole implementations

I'm refactoring a codebase with a large number of long header files (for ease of use, and to simplify compilation, the headers contain both the interface and the implementation). The codebase avoids polymorphism like wildfire, and hence it resolves an internal storage type using macros like so: #if...
Alex Petrosyan
1

votes
1

answer
44

Views

How to prohibit call of specific functions when using a certain macro

I have a macro defined more or less like this: #define SOME_MACRO(Name) \ bool Function#Name() This macro is often used with certain functions. Let's call one of them foo(). It is used in several files like this: SOME_MACRO(Hello) { //do stuff here foo(); //do more stuff here } A new macro FOO_MACRO...
yushi
1

votes
0

answer
23

Views

How to calculate and SHOW value of #define macro VStudio

I know how to show expanded macro in C. However, I am interested in how to show a calculated value of a macro. Precompiler definitely calculates macro values in order to do #if(a>b) statement: #define STRINGIFY(s) XSTRINGIFY(s) #define XSTRINGIFY(s) #s #define ONE_BYTE_Tx_Time 11 #define NUM_OF_BYTE...
Igor K
1

votes
1

answer
212

Views

Is it possible for a macro to turn an identifier lowercase?

Is it possible to generate a symbol or identifier in a Rust macro from a string? Or to perform string-like operations on a identifier? I wanted to generate a method given a symbol, but need to downcase it to obtain the method name. get!(B); // should expand to fn b() -> B { // method body } It's eas...
Phil Lord
1

votes
1

answer
51

Views

In Google Sheets, why does my recorded macro also run two other scripts when invoked?

I have recorded a macro in Sheets, the purpose of which is to add a colour scale with conditional formatting. It works fine, but I get two popups saying 'Done' when it completes. I have traced these to two other app scripts I have used in the past. (Note: These are scripts , not recorded macros) Q....
Gary Miller
9

votes
2

answer
3.2k

Views

Is it possible to declare variables procedurally using Rust macros?

Basically, there are two parts to this question: Can you pass an unknown identifier to a macro in Rust? Can you combine strings to generate new variable names in a Rust macro? For example, something like: macro_rules! expand( ($x:ident) => ( let mut x_$x = 0; ) ) Calling expand!(hi) obvious fails be...
Doug
1

votes
1

answer
145

Views

If statement in Access macro not seeing table in same database

Access 2016 I feel like a high schooler who has forgotten how a period works in a sentence. I have a blank database. I create 1 table named TestTable. One column called Amplitude with one record 14. It says 'Microsoft Access cannot find the name TestTable you entered' Error 2482. I've googled and se...
ChadT
1

votes
3

answer
85

Views

def and resolve in the same clojure macro

I want to achieve to return a namespace resolved symbol in a macro that has recently defined the symbol itself: (ns my-namespace) (defmacro def&resolve [a b] `(do (def ~a 12) (def ~b ~(resolve a)))) (def&resolve foo bar) bar ;=> nil In the example bar returns nil. I however, want it to return my-nam...
Free Interpreter
1

votes
2

answer
197

Views

How do I use side mouse buttons with Pynput?

I am using the Python module Pynput to make a macro that will press one of my side buttons. Does anyone know what the side buttons are called in Pynput? For example: from pynput.mouse import Button, Controller mouse = Controller() mouse.press(Button.SIDEBUTTON) mouse.release(Button.SIDEBUTTON) What...
Kamepoh2
1

votes
1

answer
36

Views

How to extract a function with its args ? Lua Code

I was trying to write some Lua code to search list all occurrences of a macro I made in my .tex file and to put them at the end of my file. So I'd like to find all the occurrences of '\Citation{text1}{text2}{text2}' in a string and to return a list containing all the occurrences with the same forma...
Michel Migdal
1

votes
1

answer
39

Views

MS Access Table Named Macro – Identifier could not found?

I was trying to edit a database using MS access macro and an error pops up saying: The identifier '[OldPriceCodePass]' could not be found. Please see the snapshot of the codes. I am just a beginner in using Access and not a computer programmer. Please help...
Davis
1

votes
1

answer
61

Views

Iterate over a custom set in SAS

First of all, apologize for my poor english but that's because I'm not native. I'm a newbie in SAS programming too, and I need someone to help me with this problem struggling me. I have one dataset A containing a numeric field YM representing year and month (e.g., 200902) that I'm using to filter t...
Franyá

View additional questions