Path: utzoo!utgpu!watserv1!watmath!att!att!bu.edu!rpi!zaphod.mps.ohio-state.edu!usc!jarthur!dfoster From: dfoster@jarthur.Claremont.EDU (Derek R. Foster) Newsgroups: comp.os.msdos.programmer Subject: Re: Porting UNIX apps. to MS-DOS Message-ID: <9475@jarthur.Claremont.EDU> Date: 1 Nov 90 04:57:36 GMT References: <1990Oct26.223541.26634@NCoast.ORG> <9449@jarthur.Claremont.EDU> <5497@uqcspe.cs.uq.oz.au> Organization: Harvey Mudd College, Claremont, CA 91711 Lines: 46 In article <5497@uqcspe.cs.uq.oz.au> rhys@batserver.cs.uq.oz.au writes: >dfoster@jarthur.Claremont.EDU (Derek R. Foster) writes: >>In article <1990Oct26.223541.26634@NCoast.ORG> catfood@NCoast.ORG (Mark W. Schumann) writes: >>>DLV101@psuvm.psu.edu (Dwaine VanBibber) writes: >>>>Does anyone have some general rules for porting C programs developed under >>>>UNIX to MS-DOS? [ ... etc ... ] > >>Although this is generally true in "nice" programs, there may be a somewhat >>kludgy workaround for this. >> [ ... code to swap stacks, and do other ugly things ... ] > >EEK!! This solution should be applied with "fingers crossed"! Yes, definitely! >[mention of using static buffers instead of automatic buffers when possible] > >This is not a "total" solution, but preferred to stack swaps wherever >possible. > >Rhys. > >P.S. Derek, you changed _SS, but forgot about _SP. Weird things could happen! Quite true. I didn't realize that I had forgotten to set _SP in my code. I might even venture to say that weird things WOULD happen. (especially since I set _SS to where _SP was supposed to go...I must have been half-asleep that night! As written, the stack tromps all over non-buffer memory!) But then I did say that the code I presented almost certainly wouldn't work :-) My code was mostly presented as a general sketch of what could be done, not how precisely to do it. I'd rather leave that part to someone who's done it before. Anyway, your method is certainly preferable to mine provided the savings is adequate. I certainly don't endorse stack swaps. I just think that as an emergency alternative to rewriting a large program, they have their place, ugly / nonportable though they are. I would avoid them whenever humanly possible, but it's a good idea to know that they are possible for those rare moments when a kludge is desperately needed. >+===============================+==============================+ >|| Rhys Weatherley | University of Queensland, || >|| rhys@batserver.cs.uq.oz.au | Australia. G'day!! || >+===============================+==============================+ Derek Riippa Foster