From: Jimmy on
I'm debugging someone else code, there are a lot of "Goto" and "From" globals. By looking at the code, I realized that some "From" had some typos or inexisting corresponding "Goto"... I fixed the few I saw but I'd like to be 100% sure that there is no more missing.

It would be possible to have a macro who searches for every "From" block, and then search for its corresponding "Goto" using the name... But quickly I have no efficient idea, as you might notice I'm kinda dummy in MATLAB.

I don't see why the builder doesn't return an error when there is that situation.

Thanks for your ideas!
Jimmy
From: per isakson on
"Jimmy " <jimmy.chretien.1(a)ens.etsmtl.ca> wrote in message <i3s6gj$k32$1(a)fred.mathworks.com>...
> I'm debugging someone else code, there are a lot of "Goto" and "From" globals. By looking at the code, I realized that some "From" had some typos or inexisting corresponding "Goto"... I fixed the few I saw but I'd like to be 100% sure that there is no more missing.
>
> It would be possible to have a macro who searches for every "From" block, and then search for its corresponding "Goto" using the name... But quickly I have no efficient idea, as you might notice I'm kinda dummy in MATLAB.
>
> I don't see why the builder doesn't return an error when there is that situation.
>
> Thanks for your ideas!
> Jimmy

1. Search for "grep" and "mgrep" in the File Exchange. ( http://en.wikipedia.org/wiki/Grep )
2. The Matlab editor does NOT support macros and does NOT support regular expressions. Howerver, <Find Files> in the Edit-menu should still be useful. <Find Files> has not been around that long.
3. Use any editor that supports macros and regular expressions.

/ per



From: checker i on
"Jimmy " <jimmy.chretien.1(a)ens.etsmtl.ca> wrote in message <i3s6gj$k32$1(a)fred.mathworks.com>...
> I'm debugging someone else code, there are a lot of "Goto" and "From" globals. By looking at the code, I realized that some "From" had some typos or inexisting corresponding "Goto"... I fixed the few I saw but I'd like to be 100% sure that there is no more missing.
>
> It would be possible to have a macro who searches for every "From" block, and then search for its corresponding "Goto" using the name... But quickly I have no efficient idea, as you might notice I'm kinda dummy in MATLAB.
>
> I don't see why the builder doesn't return an error when there is that situation.
>
> Thanks for your ideas!
> Jimmy

Here is a link to the submission I found on the file exchange, that rewires all the corresponding GOTO's and FROM's in the model.

http://www.mathworks.com/matlabcentral/fileexchange/28274-rewire-fromgoto-blocks
From: Rune Allnor on
On 10 Aug, 20:41, "Jimmy " <jimmy.chretie...(a)ens.etsmtl.ca> wrote:
> I'm debugging someone else code, there are a lot of "Goto" and "From" globals. By looking  at the code, I realized that some "From" had some typos or inexisting corresponding "Goto"... I fixed the few I saw but I'd like to be 100% sure that there is no more missing.
>
> It would be possible to have a macro who searches for every "From" block, and then search for its corresponding "Goto" using the name... But quickly I have no efficient idea, as you might notice I'm kinda dummy in MATLAB.
>
> I don't see why the builder doesn't return an error when there is that situation.

Because it's an impossible situation to debug. A 'goto' call is
allowed to jump anywhere. There is no way the compiler (BTW, what
language are you talking about?) can prevent a 'goto' call external
to the destination's compilation unit to jump to a destination, even
if the destination is protected by a 'from': Just insert the raw
memory address in the goto call.

The problem of untangling such messes was resolved at least 40 years
ago, when procedural languages were developed. I suspect you are
messing with legacy (fortran?) code. If so, trow the code away
and re-implement using a modern language. Seriously. It will be
less painful, it will be quicker, and the resulting code has an
actual chance of becoming not only readable, but also maintainable.

Rune
From: Steve Amphlett on
Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <a0c91616-23c0-45ac-9971-4b54abf6fab9(a)f6g2000yqa.googlegroups.com>...
> On 10 Aug, 20:41, "Jimmy " <jimmy.chretie...(a)ens.etsmtl.ca> wrote:
> > I'm debugging someone else code, there are a lot of "Goto" and "From" globals. By looking  at the code, I realized that some "From" had some typos or inexisting corresponding "Goto"... I fixed the few I saw but I'd like to be 100% sure that there is no more missing.
> >
> > It would be possible to have a macro who searches for every "From" block, and then search for its corresponding "Goto" using the name... But quickly I have no efficient idea, as you might notice I'm kinda dummy in MATLAB.
> >
> > I don't see why the builder doesn't return an error when there is that situation.
>
> Because it's an impossible situation to debug. A 'goto' call is
> allowed to jump anywhere. There is no way the compiler (BTW, what
> language are you talking about?) can prevent a 'goto' call external
> to the destination's compilation unit to jump to a destination, even
> if the destination is protected by a 'from': Just insert the raw
> memory address in the goto call.
>
> The problem of untangling such messes was resolved at least 40 years
> ago, when procedural languages were developed. I suspect you are
> messing with legacy (fortran?) code. If so, trow the code away
> and re-implement using a modern language. Seriously. It will be
> less painful, it will be quicker, and the resulting code has an
> actual chance of becoming not only readable, but also maintainable.
>
> Rune

The OP makes no mention of the language they are using. But those who access CSSM via TMW's web site will see a "Simulink" tag applied to the thread. So the discussion is most likely about Simulink blocks, not programming.