doxygen alias to struct, class, etc - doxygen

I want to create some alias that that internally creates \struct command that refers to some specific struct and adds some additional commands:
ALIASES += "thing{2}=\struct \2 \n \n \xrefitem thingList\"\" \"List of Things\" \2 this thing belongs to that \ref \1"
the alias is invoked in some normal doxy-comment:
/**
*
* \thing{SomeThing, SomeThingStruct}
*
* \brief ..sdfsdf
*/
typedef struct sSomeTag SomeThingStruct;
It mainly does that it should and also the xrefitem list is generated correctly, but i get the error:
warning: the name `\_linebr' supplied as the argument of the \class, \struct, \union, or \include command is not an input file
because it interprets the \n in the alias as second argument to the \struct keyword
How can i define my alias that it does not produce this warning?

See documentation about ALIASES in the doxygen documentation.
A few points directly from the documentation:
ALIASES This tag can be used to specify a number of aliases that act
as commands in the documentation. An alias has the form: name=value
For example adding "sideeffect=#par Side Effects:\n" will allow you to
put the command \sideeffect (or #sideeffect) in the documentation,
which will result in a user-defined paragraph with heading "Side
Effects:". You can put \n's in the value part of an alias to insert
newlines (in the resulting output). You can put ^^ in the value part
of an alias to insert a newline as if a physical newline was in the
original file.
We see here the usage of the equal sign (=) (corrected in the mean time, had been forgotten during copying)
the use of upper case <-> lowercase (you should now have a message: warning: Found unknown command\thing'` (corrected in the mean time)
usage of \n might be ^^
SO the alias should read:
ALIASES += thing{2}="\struct \2 ^^ ^^ \xrefitem thingList\"\" \"List of Things\" \2 this thing belongs to that \ref \1"

Related

How to set an env var containing a special character in powershell? [duplicate]

Exploring the difference between help and get-help I did:
cd Function:
get-content help
all the input-parameter are defined like: [string]${Name}
$=initiate a variable, {} a hashtable??
Thanks for your help.
For the official documentation, see the conceptual about_Variables help topic (invoke it with help about_Variables), and in particular its "Variable Names that Include Special Characters" section.
Enclosing the name of a variable in {...} - e.g. ${foo} - unambiguously delimits the variable name (foo).
While you can use this notation with any variable reference, doing so is required in the following scenarios:
If the name contains unusual characters, such as - or . (see the linked help topic for the exact set of permissible characters); e.g.:
${foo-bar}
${foo.bar}
If the variable reference is embedded in an expandable string ("..."), you may need to tell PowerShell where the variable name ends, if the immediately following characters would otherwise be interpreted as part of the variable name; e.g.:
"${foo}: bar" - without the {...}, PowerShell would interpret $foo: as an (incomplete) variable name, which fails, because foo is then interpreted as the name of a PS drive in the context of namespace variable notation.
Note: An alternative in this case is to `-escape the : character: "$foo`: bar"
"A ${foo}l and his money ..." - without the {...}, PowerShell would look for variable $fool instead.
While in your example (${Name}) enclosing in {...} is not necessary, the reason that it is used is that the code was automatically generated as a proxy function that wraps the Get-Help cmdlet, and this generation mechanism methodically encloses all variables in {...}.

db2 remove all non-alphanumeric, including non-printable, and special characters

This may sound like a duplicate, but existing solutions does not work.
I need to remove all non-alphanumerics from a varchar field. I'm using the following but it doesn't work in all cases (it works with diamond questionmark characters):
select TRANSLATE(FIELDNAME, '?',
TRANSLATE(FIELDNAME , '', 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'))
from TABLENAME
What it's doing is the inner translate parse all non-alphanumeric characters, then the outer translate replace them all with a '?'. This seems to work for replacement character�. However, it throws The second, third or fourth argument of the TRANSLATE scalar function is incorrect. which is expected according to IBM:
The TRANSLATE scalar function does not allow replacement of a character by another character which is encoded using a different number of bytes. The second and third arguments of the TRANSLATE scalar function must end with correctly formed characters.
Is there anyway to get around this?
Edit: #Paul Vernon's solution seems to be working:
· 6005308 ??6005308
–6009908 ?6009908
–6011177 ?6011177
��6011183�� ??6011183??
Try regexp_replace(c,'[^\w\d]','') or regexp_replace(c,'[^a-zA-Z\d]','')
E.g.
select regexp_replace(c,'[^a-zA-Z\d]','') from table(values('AB_- C$£abc�$123£')) t(c)
which returns
1
---------
ABCabc123
BTW Note that the allowed regular expression patterns are listed on this page Regular expression control characters
Outside of a set, the following must be preceded with a backslash to be treated as a literal
* ? + [ ( ) { } ^ $ | \ . /
Inside a set, the follow must be preceded with a backslash to be treated as a literal
Characters that must be quoted to be treated as literals are [ ] \
Characters that might need to be quoted, depending on the context are - &

Prevent powershell script arguments with asterisk from expanding into separate file names when passed to Java program [duplicate]

I wrote a program in Java that accepts input via command line arguments.
I get an input of two numbers and an operator from the command line.
To multiply two numbers, I have to give input as e.g. 5 3 *, but it's not working as written.
Why is it not accepting * from the command line?
That's because * is a shell wildcard: it has a special meaning to the shell, which expands it before passing it on to the command (in this case, java).
Since you need a literal *, you need to escape it from the shell. The exact way of escaping varies depending on your shell, but you can try:
java ProgramName 5 3 "*"
Or:
java ProgramName 5 3 \*
By the way, if you want to know what the shell does with the *, try printing the content of String[] args to your main method. You'll find that it will contain names of the files in your directory.
This can be handy if you need to pass some filenames as command line arguments.
See also
Wikipedia: glob
For example, if a directory contains two files, a.log and b.log then the command cat *.log will be expanded by the shell to cat a.log b.log
Wikipedia: Escape character
In Bourne shell (sh), the asterisk (*) and question mark (?) characters are wildcard characters expanded via globbing. Without a preceding escape character, an * will expand to the names of all files in the working directory that don't start with a period if and only if there are such files, otherwise * remains unexpanded. So to refer to a file literally called "*", the shell must be told not to interpret it in this way, by preceding it with a backslash (\).
Under MS WINDOWS not quite true: "java.exe" silently expands command line arguments with the wildcards
*
?
[abc]
, but only in the last component, so
a/*/*
does not work as you may expect.
It also ignores the entries "." and "..", but does honor other file names starting with ".".
To avoid misunderstandings: If I look at the command line of the running JAVA process with PROCEXP, I see the unexpanded args!
I found no way to work around this. In other words: As long as you have at least one file or directory in the current directory, "java Calc 3 * 7" will NOT work!
This is VERY ugly, and seems to always having been there in all JRE versions up to and including Java 8.
Does anybody have an idea how to disable Java's nasty command line expansion?
* has special meaning in shell interpreters. How to get a * literally is depending on what shell interpreter you are using. For Bash, you should put single quotes around the *, i.e. '*', instead of double quotes like "*".
Try surrounding the * with quotes like "*". The star is a reserved symbol on the command line.
Use single quotes:
java FooBar 5 3 '*'
This works with most of the popular shells (including bash and ksh).
Expanding on #Arno Unkrig's answer:
On Windows, some JVMs definitely do expand the "*" character, and it is not the shell expanding the path. You can confirm this by writing a small Java program that prints out the arguments:
public class TestArgs {
public static void main(String[] args) {
for (int i = 0; i < args.length; i++) {
System.out.println("Arg " + i + ": " + args[i]);
}
}
}
The good news is, there is a workaround! You can use #filename as an argument to JVM like this:
java #args.txt where args.txt is a text file that contains the arguments for each line. Example content:
TestArgs
*
This is equivalent to calling java with two arguments TestArgs and *. Most importantly, * is not expanded when it is included using the #filename method. I was able to find the details from this page.

Is there a noop command in Doxygen?

I have a aliased command that I'm using to generate an xrefitem page in my doxygen configuration.
ALIASES += "satisfy{2}=\xrefitem satisfy \"Satisfies\" \"Bottom up traceability\" requirement \1 in section: \ref \2"
If I want a second configuration that does not generate this page, and take out that alias I'm going to get a warning:
Warning: Found unknown command `\satisfy'
Is there a different alias I could enter that makes an essentially noop command?
I tried:
ALIASES += "satisfy{2}= \ref \2 Satisfies requirement \1
And:
ALIASES += "satisfy{2}= Satisfies requirement
But this resulted in the output just echoing the arguments.
{1114,intro1}
Any suggestions? Looking at the documentation for ALIASES, I'm not even sure how the original alias parameters work, the \1, \2 syntax isn't documented there.
Just to be clear I'm understanding the question. You have in your code text like
\satisfy Foo Bah. In the configuration without the xrefitem, you are still parsing the text but don't have the alias defined?
I believe you can have overloaded aliases, so does defining the following (with no parameters) help?
ALIASES += satisfy="Satisfies"
...but I'm unsure what you want to happen with the parameters in the non-cross-referenced case.
Alternatively, as written, I think you may have a typo (location of ") in the syntax of your later ALIAS definitions. I'd have expected:
ALIASES += satisfy{2}="\ref \2 Satisfies requirement \1"
Another alternative might be to define a NOOP with another alias:
ALIASES += noop{1}="\cond \1 \endcond"
or simply
ALIASES += satisfy{2}="\cond \2 \1 \endcond"
I just had the syntax wrong. Note the missing close quotes in the samples in my question.
Noop:
ALIASES += "satisfy{2}="
If you want plain text output:
ALIASES += "satisfy{2}=\2 satisfies \1"

SPSS Macro: compute by variable name

I don't think SPSS macros can return values, so instead of assigning a value like VIXL3 = !getLastAvail target=VIX level=3 I figured I need to do something like this:
/* computes last available entry of target at given level */
define !compLastAvail(name !Tokens(1) /target !Tokens(1) /level !Tokens(1))
compute tmpid= $casenum.
dataset copy tmpset1.
select if not miss(!target).
compute !name= lag(!target, !level).
match files /file= * /file= tmpset1 /by tmpid.
exec.
delete variables tmpid.
dataset close tmpset1.
!enddefine.
/* compute last values */
!compLastAvail name="VIXCL3" target=VIXC level=3.
The compute !name = ...is where the problem is.
How should this be done properly? The above returns:
>Error # 4285 in column 9. Text: VIXCL3
>Incorrect variable name: either the name is more than 64 characters, or it is
>not defined by a previous command.
>Execution of this command stops.
When you pass tokens to the macro, they get interpreted literally. So when you specify
!compLastAvail name="VIXCL3"
It gets passed to the corresponding compute statement as "VIXCL3", instead of just a variable name without quotation marks (e.g. VIXCL3).
Two other general pieces of advice;
If you do the command set mprint on before you execute your macro, you will see how your tokens are passed to the macro. In this instance, if you had taken that step, you would have seen that the offending compute statement and error message.
Sometimes you do what to use quotation marks in tokens, and when that is the case the string commands !QUOTE and !UNQUOTE come in handy.