Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:36 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : CMM2: Bug with Mm.ErrMsg$

Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 08:57am 08 Oct 2021
Copy link to clipboard 
Print this post

I've been seeing this one for a while - and it's been p**sing me off in my unit-test framework - but I struggled to reproduce it until I had a poke around the source:

480MHz Colour Maximite 2 G2
MMBasic Version 5.07.01
Copyright 2011-2021 Geoff Graham
Copyright 2016-2021 Peter Mather

> list "error_test.bas"
On Error Skip 1
Error "foo"
Print "[ERRORMSG]" Mm.ErrMsg$ "[/ERRORMSG]

Print " ";
On Error Skip 1
Error "bar"
Print
Print "[ERRORMSG]" Mm.ErrMsg$ "[/ERRORMSG]

> run "error_test.bas"
[ERRORMSG]Error in line 2: foo[/ERRORMSG]

[ERRORMSG]
Error in line 7: bar[/ERRORMSG]


Basically the formatting of the Mm.ErrMsg$ string (whether it starts with a CRLF) depends on the horizontal position of the cursor when the message is generated .

I think the offending bytes are probably Src/MMBasic.c#2495:

if(CurrentLinePtr < ProgMemory +  PROG_FLASH_SIZE) {
   if(MMCharPos > 1)MMErrorString("\r\n"); // <================= HERE
   MMErrorString("Error in ");
   char *ename;


This should probably include a check on the value of OptionErrorSkip, or better yet the whole CRLF business should move to where uncaught errors are rendered instead of where there messages are constructed.

Also note lines 2468 and 2471 which also seem to be prefixing "\r\n" on error strings (though these do check OptionErrorSkip) ... not sure why has to be done/checked 3 times .

Peter I know it's a minor issue, but any chance of fixing it if the other bugs I've reported are going to require a 5.07.02 alpha/beta anyway ?

Best wishes,

Tom
Edited 2021-10-08 19:11 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 09:20am 08 Oct 2021
Copy link to clipboard 
Print this post

I think you are the only person who ever uses mm.errmsg$ but will fix in next beta.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 09:29am 08 Oct 2021
Copy link to clipboard 
Print this post

  matherp said  I think you are the only person who ever uses mm.errmsg$ but will fix in next beta.


Probably Peter. Thank you.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 09:29am 08 Oct 2021
Copy link to clipboard 
Print this post

It's nice if it works well though. After all, *I* might need it someday and I'd get all flustered and confused. Even more so than usual, that is. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025