(Comp.sources.hp48) Item: 139 by akcs.joehorn@hpcvbbs.cv.hp.com [Joseph K. Horn] and mheiskan@hut.fi [Mika Heiskanen] Subj: Fixit v3.2, repairs bad downloads Date: 14 Jul 1992 PURPOSE: ------- Converts a badly uploaded string into the original object. THEORY: ------ A lot of folks upload HP 48 objects poorly, such that when you download them, you just get strings full of garbage that look something like this: "HPHP48-E#c&r$a%p@!*!..." [looks familiar, eh?] That's because they uploaded it using XMODEM, or managed to screw it up some other way. The following FIXIT program takes such a string and extracts the actual HP 48 object that they originally intended to upload (if at all possible). Such object extraction can be done by hand, but it's too dangerous. FIXIT minimizes the danger of Memory Clear. It checks whether the extracted object is a valid one, and if not, drops it from the stack before the HP 48 attempts to display it. All of the many bad downloads I've archived over the years are fixed by FIXIT, whereas about half of them cause a Memory Clear when extracted manually. No guarantees, however. Use at your own risk. The actual extraction is done by a "Code object" written by Mika Heiskanen. The User RPL "shell" around this code object is what minimizes the danger of Memory Clear; it was written by Joe Horn. INSTRUCTIONS: ------------ BACKUP YOUR MEMORY, just in case the string contains a logic bomb. Place the bad download on the stack (see "HPHP48-...") and run FIXIT. Possible results: (1) No error: the object was extracted successfully and is on level 1. (2) "Bad Argument Type" error: you didn't have a string on level 1. (3) "Bad Argument Value" error: the string wasn't of the proper form; it must be an "HPHP48-..." downloaded string. (4) "Invalid Definition" error: the object was mangled in transmission so badly that its end was lost; the object cannot be extracted. (5) "Undefined Result" error: there is no HP 48 object in the string. (6) "Recover Memory? YES/NO": the string contained a bomb, and FIXIT detonated it. Press YES to sift through the shrapnel and rubble in a feeble attempt to resurrect the dead. Press NO to bury them. EXAMPLES: -------- To do the following examples, download the FIXIT directory to your HP 48 and get into it. (1) Press HI. See "HPHP48-E%$@#%@...", a badly uploaded download. Before pressing FIXIT to fix it, try doing what we all used to do: press EDIT to see if we can recognize anything (usually a futile attempt). We see: "HPHP48-E%@$#%$@... << Melancholy Baby >>" But looks can be deceiving; press ON to exit the editor, and then press FIXIT to extract the intended upload: << Happy Camper >> (2) Press WTAV; see another garbage download. But EDIT refuses; the string contains nulls. Press FIXIT; see successfully extracted directory. (3) Press BAD1. Notice that it looks exactly like WTAV. (Press WTAV, compare, then DROP). But its ending is all messed up; manually extracting WTAV from BAD1 can cause Memory Clear. Press FIXIT and see "Error: Invalid Definition" indicating that the object inside BAD1 is so mangled that its end cannot be located. (4) Press BAD2. Looks like WTAV again. But its body is messed up; manually extracting it would create an External object that could cause Memory Clear if evaluated. Press FIXIT and see "Error: Undefined Result" indicating that there is nothing recognizable inside BAD2.