(DEFINE-FILE-INFO READTABLE "XCL" PACKAGE "INTERLISP") (FILECREATED " 5-Oct-89 11:00:18" {ICE}LISP>LYRIC>DIALPHONE.\;6 10111 |changes| |to:| (FNS DIALPHONE) (VARS DIALPHONECOMS) |previous| |date:| "24-Jul-89 15:27:55" {ICE}LISP>LYRIC>DIALPHONE.\;5) (PRETTYCOMPRINT DIALPHONECOMS) (RPAQQ DIALPHONECOMS ((FNS DIALPHONE) (INITVARS (DIALHISTSIZE 10) (DIALITEMS) (DIALMENU) (DIALPREFIX "ATDT") (DIALSUFFIX (CHARACTER 13)) (LASTNUMBERDIALED) (PHONEBILLNUMBER)) (BITMAPS PHONEMAP))) (DEFINEQ (DIALPHONE (LAMBDA (NUMBER DMENU BUTTON) (* \; "Edited 5-Oct-89 10:52 by MJD") (* |;;| "Phone dialing program for Hayes-compatible modems on the RS-232 port. Creates a global var. DIALMENU (which it tries to attach to an AddressBook window), and uses global strings PHONEBILLNUMBER - your local extension, and LASTNUMBERDIALED. Prompts for a number from the user if NUMBER is not provided.") (NLSETQ (PROG ((ATOZ '(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)) MODEMLST MODEMSTR RS232STREAM DIALWINDOW) (|if| (AND (NOT NUMBER) (NOT DIALMENU)) |then| (* |;;|  "1st-time-only initializations (also skip this if the first call is programmatic):") (* |;;| "Note - no error checking:") (OR PHONEBILLNUMBER (SETQ PHONEBILLNUMBER (PROMPTFORWORD "What is your extension number?" NIL NIL PROMPTWINDOW))) (OR PHONEBILLNUMBER (SETQ PHONEBILLNUMBER "")) (SETQ DIALMENU (|create| MENU ITEMS _ (LIST (LIST (EVAL PHONEMAP) NIL "Dials a phone number.")) MENUOUTLINESIZE _ 2 MENUFONT _ (FONTCREATE 'HELVETICA 12 'BOLD) WHENSELECTEDFN _ 'DIALPHONE)) (SETQ DIALWINDOW (|for| W |in| (OPENWINDOWS) |when| (EQ (WINDOWPROP W 'TITLE) '|Address Book|) |do| (RETURN W))) (|if| (NOT DIALWINDOW) |then| (PRINTOUT T "I couldn't find an AddressBook window to attach the Dial menu. Click left in the window you want it attached to, or in the Background to make a free-standing menu." ) (UNTILMOUSESTATE LEFT) (SETQ DIALWINDOW (WHICHW))) (|if| DIALWINDOW |then| (ATTACHMENU DIALMENU DIALWINDOW 'TOP 'LEFT) |else| (ADDMENU DIALMENU)) (RETURN DIALWINDOW)) (* |;;| "The NLSETQ keeps this from breaking if the modem is already in use:") (SETQ RS232STREAM (OPENSTREAM '{RS232} 'OUTPUT)) (SETQ LASTNUMBERDIALED (|if| (NUMBERP (MKATOM NUMBER)) |then| (* |;;| "We were invoked programatically:") NUMBER |else| (* |;;| "Called from menu, so get a number to dial:") (|if| (EQ BUTTON 'LEFT) |then| (* |;;| "Wants to type it in:") (PROMPTFORWORD "Number please:" LASTNUMBERDIALED NIL PROMPTWINDOW) |else| (* |;;| "Wants to select from history list:") (MENU (|create| MENU ITEMS _ DIALITEMS TITLE _ "Number please:"))))) (|if| (NOT LASTNUMBERDIALED) |then| (* |;;| "Didn't give a number, so wrap it up right here:") (CLOSEF RS232STREAM) (SETQ LASTNUMBERDIALED "") (* \;  "So it won't print \"NIL\" next time.") (PRINTOUT PROMPTWINDOW "...aborted." T) (RETURN NIL)) (|push| DIALITEMS LASTNUMBERDIALED) (* \; "Add to history list.") (|if| (GREATERP (LENGTH DIALITEMS) DIALHISTSIZE) |then| (* \; "Dequeue as needed:") (CL:NBUTLAST DIALITEMS 1)) (SETQ MODEMSTR (CONCAT LASTNUMBERDIALED)) (* \;  "Make copy so it won't get smashed by RPLSTRING below.") (|if| (INTERSECTION (UNPACK MODEMSTR) (APPEND ATOZ (L-CASE ATOZ))) |then| (* |;;| "It's got letters! Turn them into numbers:") (SETQ MODEMLST (UNPACK MODEMSTR)) (|for| N |from| 2 |to| 9 |as| GROUP |in| '((A B C) (D E F) (G H I) (J K L) (M N O) (P R S) (T U V) (W X Y)) |do| (|for| LETTER |in| GROUP |do| (DSUBST N LETTER MODEMLST))) (SETQ MODEMSTR (CONCATLIST MODEMLST))) (SETQ MODEMSTR (|if| (ILEQ (NCHARS MODEMSTR) 5) |then| (* |;;| "Just another extension:") (CONCAT MODEMSTR ",") |else| (|if| (ILEQ (NCHARS MODEMSTR) 8) |then| (* |;;|  "It's a local call (7 digits +optional \"-\"), so dial 9 first:") (CONCAT "9" MODEMSTR) |else| (* |;;|  "Long distance, so dial 8 first and add local no. for billing:") (|if| (STRING-EQUAL (SUBSTRING MODEMSTR 1 2 ) "8*") |then| (* |;;| "It's an Intelnet number:") (CONCAT (RPLSTRING MODEMSTR 1 "8,") "," PHONEBILLNUMBER) |else| (* |;;| "It's outside:") (CONCAT "8," MODEMSTR "," PHONEBILLNUMBER))))) (* |;;| "Dial the number and hang up:") (PRIN1 (CONCAT DIALPREFIX MODEMSTR ";H0" DIALSUFFIX) RS232STREAM) (PRINTOUT PROMPTWINDOW "...dialing...") (FORCEOUTPUT RS232STREAM) (* \; "Ensure buffer is dumped.") (CLOSEF RS232STREAM) (* \; "Cleanup & exit.") (PRINTOUT PROMPTWINDOW "OK" T) (RETURN LASTNUMBERDIALED))))) ) (RPAQ? DIALHISTSIZE 10) (RPAQ? DIALITEMS ) (RPAQ? DIALMENU ) (RPAQ? DIALPREFIX "ATDT") (RPAQ? DIALSUFFIX (CHARACTER 13)) (RPAQ? LASTNUMBERDIALED ) (RPAQ? PHONEBILLNUMBER ) (RPAQQ PHONEMAP #*(64 32)@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@GOOOOL@@@@@@@@COOOOOOOOH@@@@@@OOL@@@@GON@@@@@CL@@@@@@@@GH@@@@G@@@@@@@@@AL@@@@NF@@@@@@@@HN@@@ALC@@F@@L@AHG@@@CHAH@IOOB@C@C@@@C@@LGIOOCLF@AH@@F@@BOIHCCND@AH@@F@@@HIHCBB@@AH@@F@C@GOOOOL@LAH@@F@NAOOOOOO@CAH@@FC@CL@@@@CK@OH@@GLCG@AIIHAMLAH@AN@NN@AIIH@NOCH@COCML@@@@@@GCO@@CCOCH@AIIH@CHN@@FALC@@AIIH@AH@@@G@@G@@@@@@@AL@@@F@@N@@AIIH@@N@@@EH@L@@AIIH@@F@@@CDAL@@@@@@@@G@@@BMAH@@AIIH@@C@@@AKAH@@AIIH@@C@@@@JOH@@@@@@@@C@@@@COH@@@@@@@@C@@@@BOOOOOOOOOOO@@@@@AOOOOOOOOOO@@@@@@GN@@@@@@OL@@@ ) (DECLARE\: DONTCOPY (FILEMAP (NIL (797 9336 (DIALPHONE 807 . 9334))))) STOP