Solved: Problem rebuilding Ray's lz77 utility with PureC

C and PASCAL (or any other high-level languages) in here please

Moderators: exxos, simonsunnyboy, Mug UK, Zorro 2, Moderator Team

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2251
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Solved: Problem rebuilding Ray's lz77 utility with PureC

Postby lp » Fri Jun 30, 2017 4:33 pm

I contacted Ray, but he could not remember exactly how he compiled the file lz77.s (v1.3) in the archive. He thought he used an old gcc with the -02 option. However, it appears to be compiled PureC with a modified startup module after looking it over in a dis-assembler. It builds without any warnings or errors, but when I compress the same test file the resulting file sizes don't match the output of his original utility. Any PureC experts here have some ideas?

http://s390174849.online.de/ray.tscc.de/code.htm#lz77

It also dumps Warning: use TCFLTLIB to get float support for printf to the console when running. Can't figure out why.
Last edited by lp on Sat Jul 01, 2017 12:46 am, edited 3 times in total.

User avatar
shoggoth
Nature
Nature
Posts: 853
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: Problem rebuilding Ray's lz77 utility with PureC

Postby shoggoth » Fri Jun 30, 2017 8:17 pm

lp wrote:I contacted Ray, but he could not remember exactly how he compiled the file lz77.s (v1.3) in the archive. He thought he used an old gcc with the -02 option. However, it appears to be compiled PureC with a modified startup module after looking it over in a dis-assembler. It builds without any warnings or errors, but when I compress the same test file the resulting file sizes don't match the output of his original utility. Any PureC experts here have some ideas?

http://s390174849.online.de/ray.tscc.de/code.htm#lz77

It also dumps Warning: use TCFLTLIB to get float support for printf to the console when running. Can't figure out why.


Different integer size?

(use stdint.h, everyone!)
Ain't no space like PeP-space.

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2251
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Problem rebuilding Ray's lz77 utility with PureC

Postby lp » Fri Jun 30, 2017 8:53 pm

Not sure how stdint.h should help me since I'm using the correct compiler (PureC).

User avatar
shoggoth
Nature
Nature
Posts: 853
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: Problem rebuilding Ray's lz77 utility with PureC

Postby shoggoth » Fri Jun 30, 2017 9:25 pm

lp wrote:Not sure how stdint.h should help me since I'm using the correct compiler (PureC).


My bad. I was sure I built it w. GCC and it worked right away (hence my suspicion about integer size...).
Ain't no space like PeP-space.

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2251
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Problem rebuilding Ray's lz77 utility with PureC

Postby lp » Fri Jun 30, 2017 9:36 pm

Ray's binary contains symbols and if I enable symbols in PureC they are the same when compared to my build. It just don't work right. lol Did you do actual compression tests to insure your build generates the same output as his?

There is one odd thing. The title message in the binary he supplied doesn't match the code in the source file. Possibly he included an older source lising by mistake.

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2251
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Problem rebuilding Ray's lz77 utility with PureC

Postby lp » Fri Jun 30, 2017 10:19 pm

I just tried the gcc cross-tools and adding the include you suggested. The binary ends up about 90kb larger and the same issue. Compression results do not match Rays' build, but matches my PureC build. Somehow his build manages to compress 3kb smaller. I think I can safely say he didn't actually include the correct source file in the archive or he altered the dictionary size or some other compression aspect.

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2251
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Problem rebuilding Ray's lz77 utility with PureC

Postby lp » Sat Jul 01, 2017 12:07 am

The readme states gwen found the final bug that led to v1.3. I finally found the correct combination of PureC options to produce a binary match, at least until I reached the encoder. Ray sent me a link to v1.2 in his reply so I ran a diff on the sources. One line of code in the encoder was changed. On a whim I pasted the v1.2 line into the v1.3 source and tada, now my compression tests are identical. The question remains, which one is the bug fixed version, the source listing (compresses less) or the binary (compresses more). lol

One problem remains, why this line dumps the odd floating point warning. The source compiles fine and doesn't complain about anything.
printf("ok.\nAchieved ratio: %.2f%%\n", (float)codesize*100 / textsize);

Something I need to include? I have these libraries in the project file, there is no TCFLTLIB included with PureC as far as I can tell.
;libs
PCSTDLIB.LIB ;standard library
PCFLTLIB.LIB
Last edited by lp on Sat Jul 01, 2017 1:16 am, edited 1 time in total.

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2251
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Problem rebuilding Ray's lz77 utility with PureC

Postby lp » Sat Jul 01, 2017 12:46 am

Switched the library order in the project file. Problem solved. :P
;libs
PCFLTLIB.LIB
PCSTDLIB.LIB ;standard library

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 11976
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Solved: Problem rebuilding Ray's lz77 utility with PureC

Postby wongck » Sun Jul 02, 2017 1:50 am

libraries gotchas are always difficult to see at first.
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list

User avatar
lp
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2251
Joined: Wed Nov 12, 2003 11:09 pm
Location: GFA Headquarters
Contact:

Re: Solved: Problem rebuilding Ray's lz77 utility with PureC

Postby lp » Sun Jul 02, 2017 2:36 am

Combine that with GFA user trying to use 'C'. :lol:

User avatar
wongck
Ultimate Atarian
Ultimate Atarian
Posts: 11976
Joined: Sat May 03, 2008 2:09 pm
Location: Far East
Contact:

Re: Solved: Problem rebuilding Ray's lz77 utility with PureC

Postby wongck » Sun Jul 02, 2017 8:41 am

but the programming logic is the same, just keywords and sentences construct may be different.
well, one single typo in C can generate 100 errors and warnings.
My Stuff: FB/Falcon CT63+CTPCI_ATI_RTL8139 14+512MB 30GB HDD CF HxC_SD/ TT030 68882 4+32MB 520MB Nova/ 520STFM 4MB Tos206 SCSI
Shared SCSI Bus:ScsiLink ethernet, 9GB HDD,SD-reader @ http://phsw.atari.org
My Atari stuff for sale - click here for list


Social Media

     

Return to “C / PASCAL etc.”

Who is online

Users browsing this forum: No registered users and 1 guest