Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!asuvax!cs.utexas.edu!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: ANS TC Magnet for Interpreter Message-ID: <270.UUL1.3#5129@willett.UUCP> Date: 16 Jan 90 00:56:41 GMT Organization: Latest Link in ForthNet Chain (Pittsburgh, PA) Lines: 46 Category 10, Topic 24 Message 7 Sun Jan 14, 1990 F.SERGEANT [Frank] at 22:44 CST re: temporary base changes I loved Wil Baden's words on the order of $XX and $XXXX for forcing the base for that one number to hex. His trick relied on setting WIDTH to 3 and 5 respectively for their definitions. That way, $12 $FF $7E etc would all match to $XX and $1234 $FFEE etc would match to $XXXX. I think this can be done in any Forth that has WIDTH, and without changing NUMBER or anything in the kernel. Pygmy does not have WIDTH. It saves the full name (up to 31 characters) and does not need to do set any other bits in the header. (This may save some time. It certainly makes browsing the dictionary with DUMP and DU more pleasant as the names are easily readable.) In version 1.2 of Pygmy I changed NUMBER to recognize the prefix $ as indicating HEX for that one number (and the prefix ' for indicating an ascii character. LOAD in all versions of Pygmy restores the base to decimal before returning, so you always know what base the screen starts off in. So often I want just one number to be in hex, usually to set or test a bit pattern, and would prefer the rest of the numbers in decimal. So, yes, I am using this and I like it. I hate the clutter of saying something like DECIMAL ....... HEX FC DECIMAL ........ and can now say just ........ $FC ............. I am enjoying this new convenience in new code that I write. Gee, saying something like H#1234 sure is ugly! I'm used to the dollar sign from many years of Motorola processor exposure, and also to an X from IBM 360/370 assembler work (eg X'1234'). Of the two I think the dollar sign is at least as pretty, and since it is simpler, it wins. For my double numbers I use D' 1234 as I haven't built any other mechanism into the kernel. This has been satisfactory so far. Sometimes I might want to express a bit pattern in binary. I don't, however. I just use hex. I think I wouldn't bother changing NUMBER to recognize either a forced octal or binary. If I had to use octal or binary and 2 BASE ! or 8 BASE ! wouldn't do, I suppose I would define something like B' or O' ( eg B' 01100011 or O' 137 ). -- Frank ----- This message came from GEnie via willett through a semi-automated process. Report problems to: 'uunet!willett!dwp' or 'willett!dwp@gateway.sei.cmu.edu'