Path: news.science.uva.nl!newsfeed1.news.nl.uu.net!newsfeed2.news.nl.uu.net!sun4nl!fu-berlin.de!uni-berlin.de!wit381007.student.utwente.NL!not-for-mail From: s.c.sprong@student.utwente.nl (S.C.Sprong) Newsgroups: alt.folklore.computers Subject: Re: Those who do not learn from history... Date: 27 Mar 2000 06:20:25 GMT Lines: 75 Message-ID: <8bmuj9$59ds6$1@fu-berlin.de> References: <89mnet$hq5$1@megami.org> <8alb1c$phv$5@bob.news.rcn.net> <8baa82$4p5dn$2@fu-berlin.de> <8bbfk3$mbq$1@hawkins.cba.uni.edu> <8bbrs4$4rd84$1@fu-berlin.de> <8bmcek$55h8d$2@fu-berlin.de> Reply-To: s.c.sprong@student.utwente.nl NNTP-Posting-Host: wit381007.student.utwente.nl (130.89.232.187) X-Trace: fu-berlin.de 954138025 5552006 130.89.232.187 (16 [21098]) Xref: news.science.uva.nl alt.folklore.computers:54939 Dave Boers wrote: >It is rumoured that S.C.Sprong had the courage to say: >> Porting by rewriting is an extremely non-trivial project, especially >> with those crappy write-only languages mentioned >I was actually thinking more along the lines of translating between more >or less compatible languages like Pascal, FORTRAN and C, for example (or >between different flavours of C, to make another example). In most cases, >there is even canned software available to do most (if not all) of the >porting for you. Even with these restrictions rewriting stays labour-intensive and demands knowledge of arcane details. Unless the program is special in some way, I'd say that in most cases one is better off to start from scratch and use the original source to avoid old mistakes (in favour of new ones...). Games and classics such as 'SHRDLU' and 'Paranoid Parry' are examples of special programs that I think should be kept up to date to inspire awe and offer instruction to all newbies. Source converters, if they work, are good for one-way translation, but the resulting generated code is not very maintainable. I haven't had much luck with those (The QBasic->C and Turbo Pascal->C converters I used were incomplete and couldn't handle all statements). I can rant all day about this topic, but I invite you to read the paper "The Realities of Language Conversions" by A. A. Terekhov and C. Verhoef, which gives a nice summary of the problem -- better than I could myself: A real-world example: "Advent", one of the earliest textadventures, is written in Fortran. The latest version 2.5 has been automatically converted to C by its author, and is 100 kilobytes of: [ excerpt from main.c ] L6000:if (DFLAG != 1) goto L6010; if (!INDEEP(LOC) || (PCT(95) && (!CNDBIT(LOC, 4) || PCT(85)))) goto L2000; DFLAG = 2; /* 6001 */ for (I = 1; I <= 2; I++) { J = 1 + RAN(5); L6001: if (PCT(50)) DLOC[J] = 0; } /* end loop */ That said, rewriting is not *that* impossible. Otherwise my own dabbling would remain fruitless. >Also, I was thinking about porting _well written_ code Ha! Let's just say that the real world gives you ample opportunity to read badly written code. >I don't even consider porting software to/from C++, since then you've >first got to solve the problem of reading and understanding the original >program and that's (for any moderately large or bigger project) a hell >of a problem in itself. You must *always* understand the original program, but if you're lucky you may skip things like screen handling, which you must redo anyway. >> Low level porting, even with provided documentation, is one of the >> blackest software arts >You're probably right. I never did any low level porting except some >small C and Pascal projects under DOS, but that doesn't count :-) On the contrary, it does count. However, blindly assuming that you mean Borland Turbo C and Turbo Pascal, it has not shown you all issues. For kicks, try to port that Pascal to Posix compliant ANSI C for a Unix environment. scsprong