Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!willett!ForthNet From: ForthNet@willett.UUCP (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Designer words Message-ID: <1445.UUL1.3#5129@willett.UUCP> Date: 2 Aug 90 01:18:46 GMT Organization: String, Scotch tape, and Paperclips. (in Pgh, PA) Lines: 39 Date: 07-30-90 (19:28) Number: 456 (Echo) To: ALL Refer#: NONE From: ZAFAR ESSAK Read: (N/A) Subj: COUNT DELIMITED CONVERT Status: PUBLIC MESSAGE In many situations I have found it useful to have an ascii to number conversion utility that accepts an address and length and returns a double number with a flag. The following is the routine I have used with F-PC. \ Count delimited number conversion : DCONVERT ( adr,len--d,-1 // d0,0) \ ascii integer to binary BL SKIP DUP IF TRUE -ROT 0 0 2SWAP BOUNDS DO I C@ BL = IF LEAVE THEN I C@ BASE @ DIGIT NOT IF DROP ROT DROP 0 -ROT LEAVE THEN SWAP BASE @ UM* DROP ROT BASE @ UM* D+ LOOP ROT ELSE NIP 0 0 THEN ; The word "DIGIT" has a stack effect of ( char,base--n,?) I would be interested in any comments. Maybe there's a better way to do it, or a more suitable name. How will something like this be handled in ANS Forth? Or will it remain up to the user to define. Zafar Essak. --- * Via Qwikmail 2.01 NET/Mail : British Columbia Forth Board - Burnaby BC - (604)434-5886 ----- This message came from GEnie via willett through a semi-automated process. Report problems to: uunet!willett!dwp or willett!dwp@hobbes.cert.sei.cmu.edu