Newsgroups: comp.os.msdos.djgpp Subject: Porting the zgv program using djgpp Distribution: world From: vischne AT ibm DOT net-nospam (root) Organization: The Light MIME-Version: 1.0 Content-Type: Text/Plain; charset=US-ASCII NNTP-Posting-Host: 32.100.34.213 Message-ID: <343e6b21.0@news3.ibm.net> Date: 10 Oct 97 17:51:29 GMT Lines: 26 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Linux has an image-file viewer with an outstanding interface. It's called zgv, and the source code is available. I checked it out. It uses svgalib, which has been ported to djgpp, and it uses a few calls to the Linux system that are localized in zgv.c and don't seem to do very much under Dos or Windows32/95/nt. I got rid of the Linux calls using an `#ifdef __DJGPP' here and there, and then I discovered that zgv reads the keyboard using the `read()' library function. And, it assumes that it gets back vt100 escape sequences for the function and arrow keys. So, that got changed to getkey() with a translation table for the DJGPP equivalents of the internal zgv keys (and a line of code that says that, when getkey() returns '\r', translate that to '\n'). Also, as is customary with other Dos apps, zgv's use of `fopen(name, "rb")' for image files doesn't return what you expect under Unix, so I changed the code to indicate success whatever. Now, I have zgv.exe running in a full-screen, DPMI-enabled, Dos window under Windows 95. It accepts keyboard input, but can't find the mouse, something that also happens under Linux. And, it reads bitmap files, but not gif or jpeg. I get perfect displays of Linux zgv thumbnail files, and all the keys for manipulating intensity, contrast, and size work perfectly. Only, the messagebox about waiting for jpeg decodes never exits. By the way, zgv.exe (2.8) under Dos looks exactly like zgv.exe under Linux. Now, if the jpeg handling gets cleared up.