Dear all,
I have what i can describe as a major problem, my GUI has developed a fault (or i have introduced one!) and it is proving impossible to find. I have narrowed the fault to between two saved copies of my program, which are nearly identical. The problem i have is that I need to find the differences between them so i can eliminate the problem, but at 40,000+ lines of code this is extremely slow. Does anyone know of a way of comparing the two sets of code automatically?
Regards Ric
Nearly identical copies
-
- Posts: 208
- Joined: Tue 17 Apr 2018, 21:03
Nearly identical copies
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
-
- Posts: 327
- Joined: Wed 04 Apr 2018, 06:36
Re: Nearly identical copies
The obvious solution, surely, is to write a program that will do that for you! Treat both programs as files and compare them byte by byte.
Obviously you will want to make your program a bit more complicated than that - you will want to know how far into the file you have gone before there is a difference (PTR#) and possibly you'll want to print out the offending lines.
Good luck.
Code: Select all
F%=OPENINprog1$
G%=OPENINprog2$
REPEAT
c%=BGET#F%
d%=BGET#G%
UNTILc%<>d%
CLOSE#F%
CLOSE#G%
Good luck.
- hellomike
- Posts: 192
- Joined: Sat 09 Jun 2018, 09:47
- Location: Amsterdam
Re: Nearly identical copies
If the 'code' you are referring to is BB4W code, then of course you use the 'Differences' tool from the BB4W Utilities menu for this........
-
- Posts: 327
- Joined: Wed 04 Apr 2018, 06:36
Re: Nearly identical copies
Richard has written with the same suggestion:
=========
Why isn't the "obvious" solution to use the 'Differences' utility supplied with BB4W or the 'Compare' facility in BBCSDL? Why do you propose re-inventing the wheel?
http://www.bbcbasic.co.uk/bbcwin/manual ... tml#addins
=========
He is, of course, correct and my only excuse is that I've never used it and don't know how it works. This forum is a wonderful opportunity for me to demonstrate my ignorance!
Of course, the reason I wrote my own utility was that I wanted to compare two text files - I don't think one could do that with the BB4W utility - and so adapting it to compare two other files was the solution which immediately sprang to my mind. Apologies to anyone I may have led astray.
=========
Why isn't the "obvious" solution to use the 'Differences' utility supplied with BB4W or the 'Compare' facility in BBCSDL? Why do you propose re-inventing the wheel?
http://www.bbcbasic.co.uk/bbcwin/manual ... tml#addins
=========
He is, of course, correct and my only excuse is that I've never used it and don't know how it works. This forum is a wonderful opportunity for me to demonstrate my ignorance!
Of course, the reason I wrote my own utility was that I wanted to compare two text files - I don't think one could do that with the BB4W utility - and so adapting it to compare two other files was the solution which immediately sprang to my mind. Apologies to anyone I may have led astray.
- hellomike
- Posts: 192
- Joined: Sat 09 Jun 2018, 09:47
- Location: Amsterdam
Re: Nearly identical copies
There you go.
It appears strange to me that after 40000+ lines of code, one is unaware of BB4W capabilities.
It appears strange to me that after 40000+ lines of code, one is unaware of BB4W capabilities.

-
- Posts: 327
- Joined: Wed 04 Apr 2018, 06:36
Re: Nearly identical copies
I've been using BB4W for years and, as this thread demonstrates, I also have not exhausted all its capabilities. To my doubt that the "Differences" utility could handle text files Richard made this reply:
=========
Why not? If the text file can be loaded into BB4W (so that implies things like lines not exceeding 250 characters in length and numbers at the beginning of lines possibly being mis-handled) there's no way the Differences Utility can 'know' it's not a BASIC program.
I trust you are aware that both BB4W and BBCSDL can handle programs in two different formats: tokenised (.BBC) format and plain-text (.BAS) format. The term 'plain text' should tell you that an ordinary text file can be loaded, with the above caveats.
There are better ways of comparing text files, such as Microsoft's 'windiff' utility, but that doesn't mean that you can't use the BB4W utility at a pinch.
=========
One lives and learns!
=========
Why not? If the text file can be loaded into BB4W (so that implies things like lines not exceeding 250 characters in length and numbers at the beginning of lines possibly being mis-handled) there's no way the Differences Utility can 'know' it's not a BASIC program.
I trust you are aware that both BB4W and BBCSDL can handle programs in two different formats: tokenised (.BBC) format and plain-text (.BAS) format. The term 'plain text' should tell you that an ordinary text file can be loaded, with the above caveats.
There are better ways of comparing text files, such as Microsoft's 'windiff' utility, but that doesn't mean that you can't use the BB4W utility at a pinch.
=========
One lives and learns!
Re: Nearly identical copies
I've removed a post that should not have been posted publicly (it was intended as a private communication).
If you saw it, please do your best to forget it!
Best wishes,
D
If you saw it, please do your best to forget it!
Best wishes,
D
-
- Posts: 208
- Joined: Tue 17 Apr 2018, 21:03
Re: Nearly identical copies
Thank you to all who replied, it would be fair to say that i have not thoroughly exhausted all the possible functions of bb4w and probably never will, Richards solution worked wonders and i have solved the problem.
Kind regards
Ric
ps DDRM, if the post that has been deleted is inflammatory towards me then i feel i should be able to read it, if not then thanks
Kind regards
Ric
ps DDRM, if the post that has been deleted is inflammatory towards me then i feel i should be able to read it, if not then thanks
Kind Regards Ric.
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023