PDA

View Full Version : Possible to suppress "not unique" message in MaxForthv3.5?


drknapp
05-27-08, 03:35 PM
I'm revisiting serial protocols with the NMIT-0021 and keep snagging on the "somewordname not unique" message. One of the problems with a line based protocol is that this message drops an extra end-of-line into the mix so that the host resumes sending and sometimes overruns the interpreter.

I know the message is my friend, but it also warns me when I want to chain a function like INIT which builds an initialization sequence by defining small functions like : INIT ( - ) ( initialize some function ) INIT ; which do something and then call the prior INIT function to finish the job.

I believe I saw a way to turn this message off, somewhere, a long time ago, but it escapes me where it was and I don't find it in the forums.

Any help appreciated.

RMDumse
05-27-08, 03:41 PM
Look into WARNING. This user variable can be three values, -1 0 or 1. It does different things based on what's set there. However, it works on all errors and warnings. I don't think you really want to mess with that.

Here's another suggestion. Put a blank line after the definition of the word you are about to reuse. This will give the warning and the source a change to resync.

: INIT


( blank line or two, then continue here

Each time the new line is sent, the sychronization looks for a line feed, so it gives the message a chance to pass, and still sync on the line feeds that follow without loosing any source code.

drknapp
05-28-08, 09:47 AM
Yes, leaving blank lines after the colon definition of a word already defined does the job. That has been the solution of choice for me for a long time. The line discipline does get back in sync after the "not unique" message and its end-of-line. It would be nice and slightly faster to not get out of sync, however.

For the record, here are the results of trying various settings of the WARNING user variable.

COLD
Max-FORTH V3.5E
WARNING @ . 0 OK <- default value
: INIT ; OK
: INIT ;
INIT NOT UNIQUE OK <- doesn't suppress "not unique" message
1 0 DO
DO ? MSG# 17 <- doesn't suppress systax error message

-1 WARNING ! OK <- WARNING= -1
: INIT ;
INIT NOT UNIQUE OK <- doesn't suppress "not unique" message
1 0 DO <- suppresses syntax error message
.S <- and interpreter stays alive
EMPTY OK

1 WARNING ! OK <- WARNING = 1
: INIT ;
INIT NOT UNIQUE OK <- doesn't suppress "not unique" message
1 0 DO
DO ? <- gives the question mark part of the message, but hangs the interpreter so a reset is required

Thanks for your help in examining a not-too-important issue!

RMDumse
05-28-08, 09:55 AM
Oh, that's right. "Not Unique" actually is a very unique warning. I don't think there is a way to suppress it. The only way I can think of would be to intercept the serial link and dump all replies, which would hinder the CR LF download response, too, so not a useful idea.

The WARNING response is documented in the manuals, but I don't remember of have access as I am replying from the ranch. To make it work, UABORT has to be set up to process the captured errors. Normally you are vectored to QUIT which restarts the outer interpreter.