Is it possible to use compiler directives in quotations? - delphi

Let's say I have this code
ShowMessage( {$I test.inc} );
If I create the file test.inc with content 'hello' and I execute the code I get a message saying hello and it's OK. But I don't want to write quotations in the included file and do something like this:
ShowMessage('{$I test.inc}');
and then write a simple hello in test.inc. That means that I'm looking to write compiler directives in the midst of string. Is it possible?

One dirty way to do this would be:
ShowMessage({$I Quote.inc}{$I test.inc}{$I Quote.inc});
I hope others have better solutions.

Related

How to deobfuscate this?

I obfuscated this script using some site
But i'm wondering how to deobfuscate it? can someone help me?
i tried using most decompilers and a lot of ways but none has worked
local howtoDEOBFUSCATEthis_Illll='2d2d341be85c64062f4287f90df25edffd08ec003b5d9491e1db542a356f64a488a1015c2a6b6d4596f2fa74fd602d30b0ecb05f4d768cd9b54d8463b39729eb1fe84630c0f8983f1a0087681fe4f2b322450ce07b
something like that for an example.
the whole script: https://pastebin.com/raw/fDGKYrH7
First reformat into a sane layout. a newline before every local and end will do a lot. Then indenting the functions that become visible is pretty easy.
After that use search replace to inline constants. For example: local howtoDEOBFUSCATEthis_IlIlIIlIlIlI=8480; means you can replace every howtoDEOBFUSCATEthis_IlIlIIlIlIlI with 8480. Though be careful about assignments to it. If there are any then it's better to rename the variable something sensible.
If an identifier has no match you can delete the statement.
Eventually you get to functions that are actually used.
Looking at the code it seems to be an interpreter implementation. I believe it's a lua interpreter
Which means that you'll need to verify that and decompile what the interpreter executes.

Clang-Tidy `NOLINT` for multiple lines?

I'm working on a C++ project that has some large sections of code that are autogenerated, and I don't want to be linted. Is there something akin to the //NOLINT comment that can be applied to multiple lines? Like the following:
// BEGINNOLINT
bad-code;
// ENDNOLINT
All I could find online was a suggestion that this should be implemented. Is there any way to avoid having to write // NOLINT on the end of every single line?
clang-tidy 14 introduced this feature:
// NOLINTBEGIN
...
// NOLINTEND
Note, if you want to disable a specific warning, the end-comment must match the begin-comment:
// NOLINTBEGIN(check-name)
...
// NOLINTEND(check-name)
Unfortunately there is no direct way to do this, clang-tidy only supports //NOLINT and //NOLINTNEXTLINE.
I don't know how much control you have about that code generation...you could generate it in one line, that could help you a lot as c++ doesn't care about whitespace.
A crude but effective solution is to use a text-manipulation tool like sed:
$ sed -i -re '/^\/\/BEGIN_NOLINT/,/^\/\/END_NOLINT/{s/$/\/\/NOLINT/}' *.cpp
This would add //NOLINT at the end of every line between //BEGIN_NOLINT and //END_NOLINT comments (which can be probably generated).
You can also run clang-tidy with parameter
-line-filter='[{"name":"test.cpp","lines":[[1,10],[12,100]]}]'
Line 11 will be skipped in this example. This is however difficult to maintain as you need to update the filter every time you add/remove lines in the file. Maybe it would be a good idea to generate code into separate files if possible.
Im sure that, when Im applying //NOLINTNEXTLINE on MACRO, so the entire MARCO is skiped. So try to implement //NOLINTNEXTLINE to your class or function

How to prevent LaTeX from hyphenating words containing a dash?

I would like to globally prevent LaTeX from hyphenating 'Objective-C'. I am aware of the \hyphenation command, but I don't see how I can make use of it. If I pass 'Objective-C' to this command, the dash will be treated as a hint to hyphenate the word there.
One solution I found is wrapping Objective-C into an mbox each time I use it. However, the document I am writing contains this name a lot, and wrapping it into an mbox each time is ugly (as is defining a command and using this over and over again in the source code).
Why is defining a new command ugly? It's how \LaTeX\ defines itself.
\def\ObjectiveC{\mbox{Objective-C}}
Use \nobreakdash. That's what LyX produces when I insert a nonbreakingdash and convert it to tex.
As suggested here, you could define a command like this:
\newcommand\dash{\nobreakdash-\hspace{0pt}}
and use it like this
Consider the $n$\dash dimensional manifold ...
Also, you could use the babel package and use "~ as a protected hyphen. I'm not sure if using babel is advisable when writing in english, though.

Erlang: using include from the console?

The include directive is usually used for a .hrl file at the top of an .erl file.
But, I would like to use include from the Erlang console directly.
I am trying to use some functions in a module. I have compiled the erl file from the console. But, the functions I want to use do not work without access to the hrl file.
Any suggestions?
"But, the functions I want to use do not work without access to the hrl file."
This can't be true, but from this I'll take a shot at guessing that you want access to records in the hrl file that you don't (normally) have in the shell.
If you do rr(MODULE) you will load all records defined in MODULE(including those defined in an include file included by MODULE).
Then you can do everything you need to from the shell.
(Another thing you may possibly want for testing is to add the line -compile(export_all) to your erl file. Ugly, but good sometimes for testing.)
Have you tried the compile:file option? You can pass a list of modules to be included thus:
compile:file("myfile.erl", [{i, "/path/1/"}, {i, "/path/2/"}])
It's worth nothing that jsonerl.hrl doesn't contain any functions. It contains macros. As far as I know, macros are a compile-time-only construct in Erlang.
The easiest way to make them available would be to create a .erl file yourself that actually declares functions that are implemented in terms of the macro. Maybe something like this:
-module(jsonerl_helpers).
-include("jsonerl.hrl").
record_to_struct_f(RecordName, Record) ->
?record_to_struct(RecordName, Record).
... which, after you compile, you could call as:
jsonerl_helpers:record_to_struct_f(RecordName, Record)
I don't know why the author chose to implement those as macros; it seems odd, but I'm sure he had his reasons.

'Exports' naming convention - how does it work?

What rules apply to the name that ends up in the exports section of an PE (Portable Executable)?
Roughly, I see names starting with an '_' underscore, a '?' question mark or an '#' at-sign. What do those mean, and what about the rest of the name?
Also - How can I reverse the naming convention into something more usable?
I think you are refering to "dll name mangling"
name mangling
It's used to make sure exports names are unique
You can specify a .def file which will make it easier to use afterwards
Simply put, a .def file is just a text file containing the following structure
LIBRARY "MyDll"
EXPORTS
exportFunction1
One other thing : Jcl contains yet another very usefull function to decode these symbols.
You can find it in JclPeImage; It's called PeUnmangleName - which is an extension of the UndecorateSymbolNameA/W WinAPI.
I should have looked a little longer before asking this - as I just found an answer to this:
It's called 'name mangling', and here's a link explaning a bit about it : http://en.wikipedia.org/wiki/Name_mangling
My apologies for bothering you; Cheers!

Resources