macros

Why do the c libraries and language define _name and then typedef or pound define _name name?

你。 提交于 2020-06-26 04:14:21
问题 It seems that the C libraries and language has a lot of useless type names. For example, C has a built in type _Bool and there is a macro in stdbool.h , #define bool _Bool . Why didn't C just have bool built in instead of _Bool ? I found more examples in stdio.h and stdlib.h . Like this: # define WEXITSTATUS(status) __WEXITSTATUS (status) # define WTERMSIG(status) __WTERMSIG (status) # define WSTOPSIG(status) __WSTOPSIG (status) # define WIFEXITED(status) __WIFEXITED (status) # define

Why do the c libraries and language define _name and then typedef or pound define _name name?

时光总嘲笑我的痴心妄想 提交于 2020-06-26 04:14:14
问题 It seems that the C libraries and language has a lot of useless type names. For example, C has a built in type _Bool and there is a macro in stdbool.h , #define bool _Bool . Why didn't C just have bool built in instead of _Bool ? I found more examples in stdio.h and stdlib.h . Like this: # define WEXITSTATUS(status) __WEXITSTATUS (status) # define WTERMSIG(status) __WTERMSIG (status) # define WSTOPSIG(status) __WSTOPSIG (status) # define WIFEXITED(status) __WIFEXITED (status) # define

How to run python macros in LibreOffice?

ぃ、小莉子 提交于 2020-06-24 07:14:17
问题 When I go to Tools -> Macros -> Organize Macros -> Python I get this dialog: It is not possible to create new Python macros. Apparently LibreOffice has no Python editor so I have to write the macros elsewhere and then just execute them. But I do not know where to put the Python scripts. I tried a system-wide search for files with "HeloWorld" in their name and I got no results. I tried to put a test.py file into: /home/martin/.config/libreoffice/4/user/Scripts and reload the application, but

How to run python macros in LibreOffice?

北城以北 提交于 2020-06-24 07:14:10
问题 When I go to Tools -> Macros -> Organize Macros -> Python I get this dialog: It is not possible to create new Python macros. Apparently LibreOffice has no Python editor so I have to write the macros elsewhere and then just execute them. But I do not know where to put the Python scripts. I tried a system-wide search for files with "HeloWorld" in their name and I got no results. I tried to put a test.py file into: /home/martin/.config/libreoffice/4/user/Scripts and reload the application, but

VBA Excel - Unable to open existing Word Document file

岁酱吖の 提交于 2020-06-18 05:32:54
问题 I have a simple macro that opens a Word Document using Excel. I made sure the Word Object Library is properly referenced but when running this macro it freezes after Documents.Open is called (based on me seeing where it fails in the debugger). I don't know if it is a OLE Automation Error but the macro freezes and I have to force close Excel. Public Const Dir = "C:/Temp/" Public Const File = "temp.docx" Public Sub OpenFile() Dim f As String: f = Dir & File Dim oWord As Object, oDoc As Object

Writing variable to a file using macro

时光怂恿深爱的人放手 提交于 2020-06-18 04:17:43
问题 I need to write data from a macro to a text file. I am using the below code: VAR_ABC = "Deployment1.txt" Dim FlName As String filesize = FreeFile() Open FlName For Output As #filesize Write #filesize, "Hello World!" Write #filesize, "" & VAR_ABC; Close #filesize I have below questions: The output in my file contains double quotes i.e. "Hello World" "Deployment1.sh" How to get rid of these double quotes in my text file? Is there a way to write multiple lines in a better way(with new line

Use of # in a macro [duplicate]

让人想犯罪 __ 提交于 2020-06-10 02:57:26
问题 This question already has answers here : C preprocessor: stringize macro and identity macro (2 answers) What does #x inside a C macro mean? (3 answers) How to concatenate twice with the C preprocessor and expand a macro as in “arg ## _ ## MACRO”? (2 answers) Closed 3 years ago . Please explain the code #include <stdio.h> #define A(a,b) a##b #define B(a) #a #define C(a) B(a) main() { printf("%s\n",C(A(1,2))); printf("%s\n",B(A(1,2))); } Output 12 A(1,2) I don't understand, how the first printf

Common Lisp locally shadow function with same name

和自甴很熟 提交于 2020-05-29 09:41:53
问题 I've had this question more than once before. Generic Question Is it possible to transparently locally shadow a function f with a wrapper of it with the same name f ? I.e., how to locally have (f wrapped-args...) expand to (f args...)? Flet seems to let us do so, but has limitations, namely, the resulting wrapper is not setf-able. Is it possible to do so without resorting to flet? Ideally there would be a macro that lets us write the "wrapped" f calls and it expands the code to the original

How do I create a Rust macro with optional parameters using repetitions?

帅比萌擦擦* 提交于 2020-05-26 11:22:58
问题 I'm currently looking into Rust macros and I can not find any detailed documentation on repetitions. I would like to create macros with optional parameters. This would be my idea: macro_rules! single_opt { ($mand_1, $mand_2, $($opt:expr)* ) =>{ match $opt { Some(x) => println!("1. {} 2. {}, 3. {}", $mand_1, $mand_2, x); None => single_opt!($mand_1, $mand_2, "Default"); } } } fn main() { single_opt!(4,4); } This example seems to be outdated, since I can not compile it. The Rust book mentions

How do I create a Rust macro with optional parameters using repetitions?

丶灬走出姿态 提交于 2020-05-26 11:22:20
问题 I'm currently looking into Rust macros and I can not find any detailed documentation on repetitions. I would like to create macros with optional parameters. This would be my idea: macro_rules! single_opt { ($mand_1, $mand_2, $($opt:expr)* ) =>{ match $opt { Some(x) => println!("1. {} 2. {}, 3. {}", $mand_1, $mand_2, x); None => single_opt!($mand_1, $mand_2, "Default"); } } } fn main() { single_opt!(4,4); } This example seems to be outdated, since I can not compile it. The Rust book mentions