Is "debug" a reserved name?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Is "debug" a reserved name?

Stein Rørvik
I am trying to write this in a macro:

var debug = false;
if (debug) setBatchMode(false); else setBatchMode(true);

but receive the error message "statement cannot begin with = in line 1"

So, is the word "debug" a reserved keyword?
There is no mention of it in https://imagej.nih.gov/ij/developer/macro/functions.html

if yes, what is its intended use?

Stein

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Is "debug" a reserved name?

CARL Philippe (LBP)
Dear Stein,
If you look within the following file:
https://imagej.nih.gov/ij/developer/source/ij/macro/Functions.java.html
(which is doing the interface between the macro language and the code in
java) you will see that "debug" is used within the source code.
My best regards,
Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 41 84


-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de Stein
Rørvik
Envoyé : jeudi 28 février 2019 13:24
À : [hidden email]
Objet : Is "debug" a reserved name?

I am trying to write this in a macro:

var debug = false;
if (debug) setBatchMode(false); else setBatchMode(true);

but receive the error message "statement cannot begin with = in line 1"

So, is the word "debug" a reserved keyword?
There is no mention of it in
https://imagej.nih.gov/ij/developer/macro/functions.html

if yes, what is its intended use?

Stein

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Is "debug" a reserved name?

Wayne Rasband-2
In reply to this post by Stein Rørvik
> On Feb 28, 2019, at 7:24 AM, Stein Rørvik <[hidden email]> wrote:
>
> I am trying to write this in a macro:
>
> var debug = false;
> if (debug) setBatchMode(false); else setBatchMode(true);
>
> but receive the error message "statement cannot begin with = in line 1"
>
> So, is the word "debug" a reserved keyword?

“debug” is a built in function that calls the macro debugger. The arguments are "break” (the default), "run", "trace", "fast-trace" and "dump”.

> There is no mention of it in https://imagej.nih.gov/ij/developer/macro/functions.html

I added a description of this function to the master list at

    http://wsr.imagej.net/developer/macro/functions.html
   
> if yes, what is its intended use?
>
> Stein

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Is "debug" a reserved name?

Stein Rørvik
Thanks for this documentation update;

calling the debugger from the macro language is potentially very useful as one can then start the debugger automatically when a certain condition is met; to inspect the symbol table and step forward from the given breakpoint.

I looked quickly at the source code to see if there were more functions missing from the documentation and found that this is not documented in functions.html
        restorePreviousTool

It is self-explanatory and works as expected.

I also see that these functions are declared as aliases of other functions:
        getResultsCount (same as nResults)
        putPixel (same as setPixel)
        write (same as print)
That could also be mentioned in functions.html

And there is one orphan function which does not seem to be implemented or used anywhere:
        invert

So trying to name a variable "invert" in a macro will also give an error message.
Perhaps it should be removed, as it currently has no purpose?

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
Sent: 28. februar 2019 15:59
To: [hidden email]
Subject: Re: Is "debug" a reserved name?

> On Feb 28, 2019, at 7:24 AM, Stein Rørvik <[hidden email]> wrote:
>
> I am trying to write this in a macro:
>
> var debug = false;
> if (debug) setBatchMode(false); else setBatchMode(true);
>
> but receive the error message "statement cannot begin with = in line 1"
>
> So, is the word "debug" a reserved keyword?

“debug” is a built in function that calls the macro debugger. The arguments are "break” (the default), "run", "trace", "fast-trace" and "dump”.

> There is no mention of it in https://imagej.nih.gov/ij/developer/macro/functions.html

I added a description of this function to the master list at

    http://wsr.imagej.net/developer/macro/functions.html
   
> if yes, what is its intended use?
>
> Stein

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html