home *** CD-ROM | disk | FTP | other *** search
/ Computerworld Gratis 30 Hours of Connection / Image(2).iso / infovia / win31 / genlearn.st_ / genlearn.st
Text File  |  1995-08-10  |  32KB  |  1,270 lines

  1. :(mm,#!,())
  2. :(o,,(
  3. <**>
  4. <* GENLEARN.STP - WDial teach Mode Script *>
  5. <**>
  6. ))
  7.  
  8.  
  9. :(s,teach.)                     :(o,,<* My home          *>)
  10. :(s,teach.Version,(3.20))       :(o,,<* Genlearn version *>)
  11.  
  12. :(mm,#!,(       :(o,,<* Intercept TRAC responses *>)
  13. ))
  14.  
  15. :(o,,(
  16. <**>
  17. <* Messages to the user *>
  18. <**>
  19. ))
  20. :(s,teach.IPMSS,
  21. (One or more IP Addresses have been received from the Service Provider.  These are usually assigned on a per session basis.
  22.  
  23. The next prompt will ask which IP Address to use for this session (the first one, the second one...).  Dialer will then know to always pick the IP Address in that position in the future.
  24.  
  25. If you have already configured an IP Address from your Service Provider you may want to choose 'None'.
  26.  
  27. Please contact your Service Provider if you are unsure which IP Address to choose.))
  28.  
  29. :(s,teach.IPPRMPT,
  30. (Please select an IP address, or None))
  31.  
  32. :(s,teach.EXMSS,
  33. (Because this is the first time you are connecting to this service, the Dialer will prompt you for information that the Internet service needs.
  34.  
  35. If you need help understanding what the Dialer is prompting you for, contact your Internet service provider.))
  36.  
  37. :(s,teach.ABMSS,
  38. (Teach mode ABORTED. No script will be created.))
  39.  
  40. :(s,teach.MSGNOMODEM,
  41. (Your modem is not responding. )
  42. (Please be sure it is turned on and connected to your )
  43. (computer correctly. Would you like to try again?))
  44.  
  45. :(s,teach.MSGMODEMERR,(Modem Error, Connection Failed))
  46. :(s,teach.MSGBUSY,(The number you dialed is Busy. Would you like to try again?))
  47. :(s,teach.MSGNOCARRIER,(Unable to connect to remote modem. Would you like to try again?))
  48. :(s,teach.MSGNODIALTONE,(No Dialtone. Would you like to try again?))
  49. :(s,teach.MSGNOANSWER,(No Answer. Would you like to try again?))
  50. :(s,teach.MSGTIMEOUT,(TIMEOUT. Would you like to try again?))
  51. :(s,teach.MSGNOPHYSICAL,(Physical layer not opened. Connection Failed!))
  52. :(s,teach.MSGNOLCP,(Link control not established. Connection Failed!))
  53. :(s,teach.MSGNOIPCP,(Network control not established. Connection Failed!))
  54. :(s,teach.MSGNOCF,(Fatal Error; cannot create file '<1p>'!))
  55. :(s,teach.MSGNOGENLEARN,(Fatal Error; cannot open GENLEARN.SCR!))
  56. :(s,teach.MSGHANGUP,(The other side hung up. Connection Failed!))
  57. :(s,teach.MSGNOHANGUP,(The provider never hung up. Connection Failed!))
  58. :(s,teach.MSGNOCALLBACK,(The provider never called back. Connection Failed!))
  59. :(s,teach.MSGNOCONNECT,(Unable to connect to remote modem. Connection Failed!))
  60.  
  61. :(o,,(
  62. <**>
  63. <* Build key value db *>
  64. <**>
  65. ))
  66. :(mm,teach.loadkeys,(
  67.     :(d,<0>)
  68.     :(s,teach.keys.)
  69.  
  70.     <* Control Keys *>
  71.     :(<0>2,(Carriage Return),(<Enter>),(:(bxo,0d)))
  72.     :(<0>2,(Escape),(<ESC>),(:(tca,27)))
  73.     :(<0>2,(NUL),(<NUL>),(:(tca,0)))
  74.     :(<0>2,(BEL),(<BEL>),(:(tca,7)))
  75.     :(<0>2,(BS),(<BS>),(:(tca,8)))
  76.     :(<0>2,(Line Feed),(<LF>),(:(tca,10)))
  77.     :(<0>2,(Form Feed),(<FF>),(:(tca,12)))
  78.     :(<0>2,(DEL),(<DEL>),(:(tca,127)))
  79.     :(<0>2,(Space),(<Space>),(:(tca,32)))
  80.     :(<0>2,(XON),(<XON>),(:(tca,17)))
  81.     :(<0>2,(XOFF),(<XOFF>),(:(tca,19)))
  82.     <* Control Characters *>
  83.     :(pc,(
  84.         :(<0>2,(Ctl-):(tca,:(aa,:(pn),64)),(<Ctl-):(tca,:(aa,:(pn),
  85.             64))(>),(:(tca,:(pn))))
  86.     ),26,1)
  87.  
  88.  
  89.     :(d,<0>2)
  90. ))
  91.  
  92. :(o,,(
  93. <**>
  94. <* Key value builder part Deuce *>
  95. <**>
  96. ))
  97. :(mm,teach.loadkeys2,(
  98.     :(s,teach.keys.num,:(aa,0:(r,teach.keys.num),1))
  99.     :(s,teach.keys.k:(r,teach.keys.num),(<1>))
  100.     :(s,teach.keys.v:(r,teach.keys.num),(<2>))
  101.     :(s,teach.keys.a:(r,teach.keys.num),<3>)
  102. ))
  103. :(teach.loadkeys)   :(o,,<* Fill key database and chuck loader *>)
  104.  
  105. :(o,,(
  106. <**>
  107. <* Convert Mnemonics To ASCII *>
  108. <* Process send-key string     *>
  109. <**>
  110. ))
  111. :(mm,teach.convkeys,(
  112.     :(s,<0>temp,:(r,<1p>))
  113.  
  114.     <* Convert Mnemonics to ASCII *>
  115.     :(pc,(
  116.         <* Replace key with ASCII values *>
  117.         :(tra,<0>temp,:(r,teach.keys.v:(pn)),
  118.             <* Handle multi value keys *>
  119.             :(s,<0>x,:(pn))
  120.             :(tps,teach.keys.a:(r,<0>x),0)
  121.             :(pc,(
  122.                 :(tca,40)(char,):(tcn,:(tn,teach.keys.a
  123.                     :(r,<0>x),1)):(tca,41)
  124.             ),:(tl,teach.keys.a:(r,<0>x)))
  125.             (`)
  126.         )
  127.     ),:(r,teach.keys.num),1)
  128.  
  129.     :(r,<0>temp)                        <* Return Result *>
  130.     :(d,<0>temp,<0>x)             <* Clean up *>
  131. ))
  132.  
  133.  
  134. :(o,,(
  135. <**>
  136. <* Build db of default prompts and suggested responses *>
  137. <**>
  138. ))
  139. :(mm,teach.loadprompts,(
  140.     :(d,<0>)
  141.  
  142.     :(s,teach.prompts.)
  143.     :(<0>2,(login:),2,y)
  144.     :(<0>2,(username:),2,y)
  145.     :(<0>2,(userid:),2,y)
  146.     :(<0>2,(id:),2,y)
  147.     :(<0>2,(password:),3,y)
  148.     :(<0>2,(who),2)
  149.     :(<0>2,(id),2)
  150.     :(<0>2,(user),2)
  151.     :(<0>2,(login),2)
  152.     :(<0>2,(name),2)
  153.     :(<0>2,(secret),3)
  154.     :(<0>2,(security),3)
  155.     :(<0>2,(key),3)
  156.     :(<0>2,(call back),7)
  157.     :(<0>2,(callback),7)
  158.     :(<0>2,(dialback),7)
  159.     :(<0>2,(dial back),7)
  160.  
  161.     <* Start of PPP LCP Negotiation? *>
  162.     :(ei,:(wdial_frametype),PPP,(
  163.         :(<0>2,:(bxo,7D207D),0,y,y)
  164.     ))
  165.  
  166.     :(s,teach.prompts.msg0,(I am done with this teaching session))
  167.     :(s,teach.prompts.msg1,(Abort this teaching session))
  168.     :(s,teach.prompts.msg2,(Use my username here))
  169.     :(s,teach.prompts.msg3,(Use my password here))
  170.     :(s,teach.prompts.msg4,(Send a carriage return here))
  171.     :(s,teach.prompts.msg5,(Send specific keys here))
  172.     :(s,teach.prompts.msg6,(Ignore this prompt))
  173.     :(s,teach.prompts.msg7,(Wait for callback))
  174.     :(s,teach.prompts.nummsg,8)
  175.  
  176.     <* Dump loader part 2 *>
  177.     :(d,<0>2)
  178.  
  179. ))
  180.  
  181. :(o,,(
  182. <**>
  183. <* Loadprompts Part Deuce-The workhorse *>
  184. <**>
  185. ))
  186. :(mm,teach.loadprompts2,(
  187.     :(s,teach.prompts.num,:(aa,0:(r,teach.prompts.num),1))
  188.     :(s,teach.prompts.p:(r,teach.prompts.num),(<1>))
  189.     :(s,teach.prompts.d:(r,teach.prompts.num),(<2>))
  190.     :(ei,<3>,,,(
  191.         :(s,teach.prompts.e:(r,teach.prompts.num))
  192.     ))
  193.     :(ei,<4>,,,(
  194.         :(s,teach.prompts.X:(r,teach.prompts.num))
  195.     ))
  196. ))
  197. :(ri,teach.loadprompts) :(o,,<* Build prompt db & discard loader *>)
  198.  
  199. :(o,,(
  200. <**>
  201. <* Parse out the important part out a prompt *>
  202. <* From the last CR                          *>
  203. <**>
  204. ))
  205. :(mm,teach.getprompt,(
  206.     :(wdial_status,(Waiting for prompt...))
  207.     :(s,<0>data,:(teach.iwts2)) <* Get data from strm *>
  208.     :(s,<0>data,:(r,<0>data):(bxo,0d0a))
  209.  
  210.     :(tps,<0>data,0)
  211.     :(tra,<0>data,:(bxo,0d),:(bxo,0a))    <* convert CRs to LFs *>
  212.     :(tps,<0>data,0)
  213.     :(s,<0>retval) <* Start with no return value *>
  214.  
  215.     :(pcd,(
  216.         <* Find next LF delimitted prompt OR exit *>
  217.         :(s,<0>temp2,:(ts,<0>data,,:(bxo,0a),(:(px))))
  218.  
  219.         :(ei,:(r,<0>temp2),,,(
  220.             <* A prompt, save it if not NULL *>
  221.             :(s,<0>retval,:(r,<0>temp2))
  222.         ))
  223.     ),-1)
  224.  
  225.     <* Reverse Prompt *>
  226.     :(d,<0>revp)
  227.     :(tps,<0>retval,0)
  228.     :(pc,(
  229.         :(s,<0>revp,:(tn,<0>retval,1):(r,<0>revp))
  230.     ),:(tl,<0>retval))
  231.  
  232.     <* Reverse again this time cropping more *>
  233.     :(tps,<0>revp,0)
  234.     :(d,<0>retval)
  235.     :(d,<0>pflag)
  236.     :(d,<0>xflag)
  237.     :(pc,(
  238.         :(s,<0>tchar,:(tn,<0>revp,1))
  239.         :(pc,(
  240.             :(mhi,<0>pflag,,(
  241.                 :(agi,33,:(tcn,:(r,<0>tchar)),(
  242.                     :(px)
  243.                 ))
  244.             ))
  245.             :(s,<0>pflag)
  246.             :(agi,33,:(tcn,:(r,<0>tchar)),(
  247.                 :(s,<0>xflag)
  248.                 :(px)
  249.             ))
  250.             :(s,<0>retval,:(r,<0>tchar):(r,<0>retval))
  251.         ),1)
  252.         :(mhi,<0>xflag,(:(px)))
  253.     ),:(tl,<0>revp))
  254.  
  255.     <* Return cropped prompt *>
  256.     :(r,<0>retval)
  257.     :(wdial_status,(Prompt received.))
  258.  
  259.     <* Clean up *>
  260.     :(d,<0>xflag,<0>revp,<0>pflag,<0>tchar,<0>retval,<0>temp2,<0>data)
  261. ))
  262.  
  263. :(mm,teach.rd,(
  264.     :(s,<0>temp,:(iwt2,1))
  265.     :(ei,:(wdial_frametype),SLIP,(
  266.         :(ei,,:(r,<0>temp),,(
  267.             :(ri,slang.ip.scan,:(r,<0>temp))
  268.         ))
  269.     ))
  270.     :(r,<0>temp)
  271.     :(d,<0>temp)
  272. ))
  273.  
  274. :(mm,teach.iwt2,(
  275.     :(s,<0>timer,:(xcm))
  276.     :(d,<0>retval)
  277.  
  278.     :(pc,(
  279.         <* Use iwt2 cuz i2 is broken *>
  280.  
  281.         <* Added hook for IP Address parsing *>
  282.         :(s,<0>retval,:(r,<0>retval):(teach.rd))
  283.  
  284.         :(<0>2,<0>retval,(<2p>))
  285.         :(<0>2,<0>retval,(<3p>))
  286.         :(<0>2,<0>retval,(<4p>))
  287.         :(<0>2,<0>retval,(<5p>))
  288.         :(<0>2,<0>retval,(<6p>))
  289.         :(<0>2,<0>retval,(<7p>))
  290.         :(<0>2,<0>retval,(<8p>))
  291.         :(<0>2,<0>retval,(<9p>))
  292.         :(<0>2,<0>retval,(<10p>))
  293.         :(<0>2,<0>retval,(<11p>))
  294.         :(<0>2,<0>retval,(<12p>))
  295.         :(<0>2,<0>retval,(<13p>))
  296.         :(<0>2,<0>retval,(<14p>))
  297.         :(<0>2,<0>retval,(<15p>))
  298.         :(<0>2,<0>retval,(<16p>))
  299.  
  300.         :(agi,:(as,:(xcm),:(r,<0>timer)),0<1>,(
  301.             :(s,<0>retval)
  302.             :(px)
  303.         ))
  304.     ),-1)
  305.     :(r,<0>retval)
  306.  
  307.     <* Clean Up *>
  308.     :(d,<0>retval,<0>timer)
  309. ))
  310. :(o,,<* Part Two *>)
  311.  
  312. :(mm,teach.iwt22,(
  313.     :(ei,<2>,,,(
  314.         :(ttci,<1>,<2>,(
  315.             :(px)
  316.         ))
  317.     ))
  318. ))
  319. `
  320. :(o,,(
  321. <**>
  322. <* Suck in until recognized prompt or 5 second pause in stream *>
  323. <**>
  324. ))
  325. :(mm,teach.iwts2,(
  326.     :(s,<0>timer,:(xcm))        <* Reset timer *>
  327.     :(s,<0>itimer,:(xcm))     <* Total Timer *>
  328.     :(d,teach.sugres)             <* Reset suggested response *>
  329.     :(d,<0>retval)                    <* Clear return value *>
  330.     :(d,<0>pfound)                    <* Prompt found flag *>
  331.     :(d,<0>probprompt)            <* Clear probable prompt flag *>
  332.     :(d,teach.defprompt)        <* Definite Prompt *>
  333.  
  334.     <* Loop until we find a prompt *>
  335.     :(pcd,(
  336.         :(mhi,teach.defprompt,(:(px)))    <* Exit immediatelly *>
  337.  
  338.         :(s,<0>tmp,:(teach.rd))     <* Get data from stream *>
  339.  
  340.         :(agi,:(as,:(xcm),:(r,<0>itimer)),20000,(
  341.             <* Maximum Prompt Timer Exceeded, *>
  342.             <* Prevent Endless Loop.                    *>
  343.  
  344.             :(s,teach.sugres,0)         <* Done *>
  345.             :(px)
  346.         ))
  347.  
  348.         :(ei,:(r,<0>tmp),,(
  349.             <* Check For 5 Second Pause (Approx.)             *>
  350.             <* 2 Seconds If Probable Prompt Flag Set        *>
  351.             :(agi,:(as,:(xcm),:(r,<0>timer)),:(mh,<0>probprompt,
  352.                 2000,5000),(
  353.                 :(px)
  354.             ))
  355.         ),(
  356.             <* Concatanate Return Value, and Update Timer *>
  357.             :(s,<0>retval,:(r,<0>retval):(r,<0>tmp))
  358.             :(s,<0>timer,:(xcm))
  359.             :(d,<0>probprompt)            <* Clear Prob. Prompt Flag *>
  360.  
  361.             <* Remove excess spewage from <0>retval *>
  362.             :(s,<0>rtemp,:(r,<0>retval))
  363.             :(tra,<0>rtemp,:(tca,10),:(tca,13))
  364.             :(d,<0>cr)
  365.             :(agi,:(tl,<0>rtemp),0,(
  366.                 :(tps,<0>rtemp,:(as,:(tl,<0>rtemp),1))
  367.                 :(ei,:(tn,<0>rtemp,1),:(tca,13),(
  368.                     :(s,<0>cr)
  369.                 ))
  370.             ))
  371.             :(mhi,<0>cr,,(:(s,<0>rtemp,:(r,<0>rtemp):(tca,13))))
  372.             :(tps,<0>rtemp,0)
  373.             :(d,<0>lps)
  374.             :(pc,(
  375.                 :(s,<0>lp,:(ts,<0>rtemp,,:(tca,13),(:(px))))
  376.                 :(ei,:(r,<0>lp),,,(
  377.                     :(s,<0>lps,:(r,<0>lp))
  378.                 ))
  379.             ),-1)
  380.             :(s,<0>retval,:(r,<0>lps):(mh,<0>cr,:(tca,13)))
  381.             :(d,<0>rtemp,<0>lps,<0>cr,<0>lp)
  382.  
  383.             <* Look for certain prompt *>
  384.             :(pc,(
  385.                 <* Search for matching prompt *>
  386.                 <* Only if I am certain is prompt ext *>
  387.                 :(mhi,teach.prompts.e:(pn),(
  388.                     :(ttci,<0>retval,:(r,teach.
  389.                         prompts.p:(pn)),(
  390.  
  391.                         <* Set sug response *>
  392.                         :(s,teach.sugres,:(r,
  393.                             teach.prompts.d
  394.                             :(pn)))
  395.  
  396.                         :(mhi,teach.prompts.X:(pn),(
  397.                             :(s,teach.defprompt,
  398.                                 :(r,teach.
  399.                                 prompts.d
  400.                                 :(pn)))
  401.                             :(px)
  402.                         ))
  403.  
  404.                         <* I think I have found a *>
  405.                         <* Prompt, set flag *>
  406.                         :(s,<0>probprompt)
  407.                         :(px)
  408.                     ))
  409.                 ))
  410.             ),:(r,teach.prompts.num),1) <* Looking *>
  411.  
  412.             :(mhi,teach.sugres,(:(px))) <* Exit loop *>
  413.         ))
  414.     ),-1) <* Prompt found *>
  415.  
  416.     <* Search for suggested response *>
  417.     :(mhi,teach.sugres,,(
  418.         <* Look only if no certain prompt *>
  419.         :(pc,(
  420.             :(ttci,<0>retval,:(r,teach.prompts.p:(pn)),(
  421.                 <* Found suggestion *>
  422.                 :(s,teach.sugres,:(r,teach.prompts.d
  423.                     :(pn)))
  424.                 :(px)
  425.             ))
  426.         ),0:(r,teach.prompts.num),1)
  427.     ))
  428.  
  429.     <* Return prompt *>
  430.     :(r,<0>retval)
  431.  
  432.     <* Clean up *>
  433.     :(d,<0>timer,<0>tmp,<0>retval,<0>itimer)
  434. ))
  435.  
  436. :(o,,(
  437. <**>
  438. <* Initialize The Modem *>
  439. <**>
  440. ))
  441.  
  442. :(mm,teach.modeminit,(
  443.     :(wdial_status,(Initializing the modem...))
  444.  
  445.     :(s,<0>tmp,:(wdial_modem,init))
  446.     :(pc,(
  447.         :(pc,(
  448.             :(ei,:(tn,<0>tmp,1,(:(px))),~,(
  449.                 :(iwm,1000)
  450.             ),(
  451.                 :(tps,<0>tmp,:(as,:(tpr,<0>tmp),1))
  452.                 :(px)
  453.             ))
  454.         ),-1)
  455.         :(iz2)
  456.         :(s,<0>init,:(ts,<0>tmp,,|,(:(px))):(bxo,0d))<* init string    *>
  457.         :(o2,:(r,<0>init))
  458.         :(s,<0>resp,:(iwt2,10000,OK,ERROR))
  459.         :(pc,(
  460.             :(ttci,<0>resp,OK,(
  461.                 :(px)
  462.             ))
  463.             :(ttci,<0>resp,ERROR,(
  464.                 :(wdial_status,(Modem Error))
  465.                 :(g)
  466.             ))
  467.             :(wdial_messagei,:(r,teach.MSGNOMODEM),YESNO,Q,1,(
  468.                 :(tps,<0>tmp,0)
  469.                 :(ibdf)
  470.                 :(iwm,1000)
  471.                 :(ibdo)
  472.                 :(iwm,1000)
  473.             ),(
  474.                 :(wdial_status,(No response from modem))
  475.                 :(g)
  476.             ))
  477.         ))
  478.     ),-1)
  479.  
  480.     <* Clean up *>
  481.     :(iwm,2000)
  482.     :(d,<0>resp)
  483.     :(d,<0>tmp)
  484.  
  485.     :(wdial_status,(Initializing the modem...)(Done))
  486. ))
  487.  
  488. :(o,,(
  489. <**>
  490. <* Dial The Service *>
  491. <**>
  492. ))
  493.  
  494. :(mm,teach.connect,(
  495.     :(teach.modeminit)                                            <* Init the modem *>
  496.     :(s,<0>pnum,:(wdial_phone,number))
  497.     :(ei,:(r,<0>pnum),,(
  498.         :(s,<0>pnum,:(wdial_prompt,(Please enter the phone number to dial:)))
  499.     ))
  500.     :(tra,<0>pnum,:(tca,40))                                <* Rip out stupid parens *>
  501.     :(tra,<0>pnum,:(tca,41))
  502.     :(tra,<0>pnum,(-))                                            <* Rip out dashes *>
  503.  
  504.  
  505.     :(s,<0>dmsg,(NONE))
  506.     :(pc,(
  507.         :(wdial_status,(Last Error:):(r,<0>dmsg):(bxo,0a)(Dialing...))
  508.         :(d,<0>again)                                     <* Clear again flag *>
  509.         :(iz2)
  510.  
  511.         <* Dial *>
  512.         :(o2,
  513.             :(wdial_modem,dial)                         <* Modem Dial String *>
  514.             :(ei,,:(wdial_phone,prefix),,(    <* Dial Prefix? *>
  515.                 :(wdial_phone,prefix)
  516.                 :(pc,(:(wdial_modem,pause)),2)
  517.             ))
  518.             :(r,<0>pnum)                                        <* Phone Number *>
  519.             :(ei,,:(wdial_phone,ext),,(         <* Phone Extension? *>
  520.                 :(pc,(:(wdial_modem,pause)),2)
  521.                 :(wdial_phone,ext)
  522.             ))
  523.             :(bxo,0d)                                             <* Carriage Return *>
  524.         )
  525.  
  526.         <* Wait for response *>
  527.         :(wdial_status,
  528.             (Last Error:):(r,<0>dmsg):(bxo,0a)(Dialing...):(bxo,0a)(Timeout in %d seconds),
  529.             :(aq,:(wdial_phone,timeout),1000))
  530.         :(s,<0>resp,:(teach.iwt2,:(wdial_phone,timeout),(CONNECT),
  531.             (BUSY),(ERROR),((NO CARRIER)),((NO DIALTONE)),((NO ANSWER))))
  532.         :(pc,(
  533.             :(ttci,<0>resp,CONNECT,(
  534.                 :(px)
  535.             ))
  536.             :(ttci,<0>resp,ERROR,(
  537.                 :(wdial_status,(Modem Error))
  538.                 :(wdial_message,:(r,teach.MSGMODEMERR),OK,e)
  539.                 :(px)
  540.             ))
  541.             :(ttci,<0>resp,BUSY,(
  542.                 :(wdial_status,(BUSY))
  543.                 :(s,<0>tmp,:(wdial_message,:(r,teach.MSGBUSY),YESNO,q,1,y,n))
  544.                 :(ei,:(r,<0>tmp),y,(
  545.                     <* Reset status message, and loop again *>
  546.                     :(s,<0>dmsg,(BUSY))
  547.                     :(s,<0>again)
  548.                 ))
  549.                 :(px)
  550.             ))
  551.             :(ttci,<0>resp,(NO CARRIER),(
  552.                 :(wdial_status,(NO CARRIER))
  553.                 :(s,<0>tmp,:(wdial_message,:(r,teach.MSGNOCARRIER),YESNO,q,1,y,n))
  554.                 :(ei,:(r,<0>tmp),y,(
  555.                     <* Reset status message, and loop again *>
  556.                     :(s,<0>dmsg,(NO CARRIER))
  557.                     :(s,<0>again)
  558.                 ))
  559.                 :(px)
  560.             ))
  561.             :(ttci,<0>resp,(NO DIALTONE),(
  562.                 :(wdial_status,(NO DIALTONE))
  563.                 :(s,<0>tmp,:(wdial_message,:(r,teach.MSGNODIALTONE),YESNO,q,1,y,n))
  564.                 :(ei,:(r,<0>tmp),y,(
  565.                     <* Reset status message, and loop again *>
  566.                     :(s,<0>dmsg,(NO DIALTONE))
  567.                     :(s,<0>again)
  568.                 ))
  569.                 :(px)
  570.             ))
  571.             :(ttci,<0>resp,(NO ANSWER),(
  572.                 :(wdial_status,(NO ANSWER))
  573.                 :(s,<0>tmp,:(wdial_message,:(r,teach.MSGNOANSWER),YESNO,q,1,y,n))
  574.                 :(ei,:(r,<0>tmp),y,(
  575.                     <* Reset status message, and loop again *>
  576.                     :(s,<0>dmsg,(NO ANSWER))
  577.                     :(s,<0>again)
  578.                 ))
  579.                 :(px)
  580.             ))
  581.             :(o2,:(bxo,0d))
  582.             :(wdial_status,(TIMEOUT))
  583.             <* Unknown Result / TIMEOUT *>
  584.             :(s,<0>tmp,:(wdial_message,:(r,teach.MSGTIMEOUT),YESNO,q,1,y,n))
  585.             :(iwm,5000)
  586.             :(iz2)
  587.             :(ei,:(r,<0>tmp),y,(
  588.                     <* Reset status message, and loop again *>
  589.                     :(s,<0>dmsg,(TIMEOUT))
  590.                     :(s,<0>again)
  591.             ))
  592.         ))
  593.  
  594.         :(mhi,<0>again,,(
  595.             <* Don't loop again *>
  596.             :(px)
  597.         ))
  598.     ),-1)
  599.  
  600.     <* Clean Up *>
  601.     :(d,<0>resp,<0>pnum,<0>dmsg)
  602.  
  603.     :(wdial_polli,physical,open,1000,(
  604.         :(wdial_status,(Physical connection established))
  605.     ),(
  606.         :(wdial_message,:(r,teach.MSGNOPHYSICAL),OK,E)
  607.         :(teach.exit)
  608.     ))
  609. ))
  610. `
  611. :(o,,(
  612. <**>
  613. <* The heart and sole of genlearn *>
  614. <**>
  615. ))
  616.  
  617. :(mm,teach.genlearn,(
  618.     :(s,teach.script)             <* Start with a blank script *>
  619.     :(teach.start_scr)            <* General script filler *>
  620.  
  621.     <* First time message *>
  622.     :(ei,:(wdial_frametype),PPP_NOPROMPT,,(
  623.         :(wdial_message,:(r,teach.EXMSS),OK,I)
  624.     ))
  625.  
  626.     :(teach.connect)                <* Connect to service/DIAL *>
  627.  
  628.     <**>
  629.     <* If no login sequence, no need to learn anything *>
  630.     <**>
  631.     :(ei,:(wdial_frametype),PPP_NOPROMPT,(
  632.         <* Go to packet mode *>
  633.         :(wdial_status,(Changing to packet mode))
  634.         :(wdial_changemode,packet)
  635.  
  636.         :(teach.write_scr)
  637.  
  638.         <* Write a vanilla script file *>
  639.         :(teach.genlearn0,<1p>)
  640.  
  641.         <* Wait for LCP and IPCP *>
  642.         :(teach.wait_PPP)
  643.  
  644.         :(wdial_status,(Connected))
  645.         :(g) <* End the script *>
  646.     ))
  647.  
  648.     <* Loop until user says to stop/abort or until end prompt recvd *>
  649.     :(pcd,(
  650.         <* Get a prompt *>
  651.         :(s,<0>temp,:(teach.getprompt))
  652.  
  653.         :(mhi,teach.defprompt,(
  654.             <* Don't prompt user, I am sure how to respond *>
  655.             :(s,<0>rnum,:(r,teach.defprompt))
  656.             :(wdial_status,(Automatically replying to prompt))
  657.  
  658.             :(d,teach.defprompt)
  659.         ),(
  660.             <* Build a wdial_prompt command, yech! *>
  661.             :(s,<0>prompt,(:):(tca,40)(wdial_prompt,):(tca,40)
  662.                 (How do you respond to "):(tca,41)
  663.                 (:(r,<0>temp)):(tca,40)("?):(tca,41)(,,)
  664.                 :(mh,teach.sugres,(:(r,teach.prompts.msg
  665.                     :(r,teach.sugres))))
  666.                 :(pc,(
  667.                     (,):(tca,40)
  668.                     :(r,teach.prompts.msg:(pn)):(tca,41)
  669.                 ),:(r,teach.prompts.nummsg),0)
  670.                 :(tca,41))
  671.  
  672.             <* Ask the user what to do with the prompt *>
  673.             <* Copy Suggested Prompt *>
  674.  
  675.  
  676.             :(wdial_status,(Waiting for user input))
  677.             <* Prompt User *>
  678.             :(s,<0>temp2,:(ri,<0>prompt))
  679.  
  680.             <* Reset response number *>
  681.             :(s,<0>rnum,-1)
  682.  
  683.             <* See if this is a canned response *>
  684.             :(pcd,(
  685.                 :(ei,:(r,<0>temp2),:(r,teach.prompts.
  686.                     msg:(pn)),(
  687.                     :(s,<0>rnum,:(pn))
  688.                     :(px)
  689.                 ))
  690.             ),:(r,teach.prompts.nummsg),0) <* Canned? *>
  691.         ))
  692.  
  693.         <* Check if a ctl respe (done,abort,ignore)*>
  694.         :(s,<0>noprompt,:(e,:(r,<0>rnum),0,y):(e,:(r,<0>rnum),1,y)
  695.             :(e,:(r,<0>rnum),6,y):(e,:(r,<0>rnum),7,y)
  696.             :(ei,:(r,<0>temp),,(:(teach.write_scr,(:(tca,40)(pause,2000):(tca,41))))y)
  697.         )
  698.  
  699.         <* Wait for prompt *>
  700.         :(ei,:(r,<0>noprompt),,(
  701.             <* Bld scrpt, chck agst prmpt *>
  702.             :(teach.write_scr,((<)(* Waiting For Prompt ")
  703.                 :(r,<0>temp)(" *)(>)))
  704.             :(teach.write_scr,(:(tca,40)(define,input_data,)
  705.                 :(tca,40)(receive,5000,{):(r,<0>temp)(})
  706.                 :(tca,41):(tca,41)))
  707.             :(teach.write_scr,(:(tca,40)(did_they_hang_up?):(tca,41)))
  708.             :(teach.write_scr,(:(tca,40)(has,input_data,{)
  709.                 :(r,<0>temp)(},{)))
  710.             :(teach.write_scr,(:(tca,9)(<)
  711.                 (* Found prompt *)(>)))
  712.             :(teach.write_scr_nocrlf,(:(tca,9)))
  713.         ))
  714.  
  715.         :(ei,:(r,<0>rnum),-1,(
  716.             <* Not canned, original work! *>
  717.  
  718.             :(s,<0>temp3,:(r,<0>temp2))
  719.  
  720.             <* Protect parens and gt-lt symbols *>
  721.             :(tra,<0>temp2,:(tca,40),(}):(tca,40)(char,40)
  722.                 :(tca,41)({))
  723.             :(tra,<0>temp2,:(tca,41),(}):(tca,40)(char,41)
  724.                 :(tca,41)({))
  725.             :(tra,<0>temp2,(<),(}):(tca,41)(char,60):(tca,41)({))
  726.             :(tra,<0>temp2,(>),(}):(tca,41)(char,62):(tca,41)({))
  727.             :(s,<0>temp2,({):(r,<0>temp2)(}))
  728.  
  729.             <* Write to script *>
  730.             :(teach.write_scr,(:(tca,40)(send,):(r,<0>temp2)
  731.                 :(tca,40)(cr):(tca,41):(tca,41)))
  732.  
  733.             <* Send to stream *>
  734.             :(o2,:(r,<0>temp3):(bxo,0d))
  735.             :(d,<0>temp3)
  736.  
  737.         ),(
  738.             <* Boring canned response *>
  739.             :(ri,<0>:(r,<0>rnum),<1p>,:(e,:(r,<0>noprompt),,(:(tca,9))))
  740.         ))
  741.  
  742.         <* Else case for prompt *>
  743.         :(ei,:(r,<0>noprompt),,(
  744.             :(teach.write_scr,(:(tca,9)))
  745.             :(teach.write_scr,((},{)))
  746.             :(teach.write_scr,(:(tca,9)(<)
  747.                 (* Unknown prompt, get help from user *)(>)))
  748.             :(teach.write_scr,(:(tca,9)))
  749.             :(teach.write_scr,(:(tca,9):(tca,40)(response_not_recognized):(tca,41)))
  750.             :(teach.write_scr,((}):(tca,41)))
  751.             :(teach.write_scr)
  752.         ))
  753.     ),-1) <* Loop til user says uncle *>
  754.  
  755.     <* Clean up *>
  756.     :(d,<0>temp,<0>temp2,<0>rnum,teach.sug)
  757.  
  758.     <* To packet mode *>
  759.     :(wdial_status,(Changing to packet mode))
  760.     :(wdial_changemode,packet)
  761.  
  762.     :(ei,:(wdial_frametype),PPP,(
  763.         :(teach.wait_PPP)
  764.     ))
  765.  
  766.     :(wdial_status,(Connected))
  767.     :(g) <* End the script *>
  768. ))
  769.  
  770. :(o,,(
  771. <**>
  772. <* Wait for PPP LCP and IPCP layers to open *>
  773. <**>
  774. ))
  775.  
  776. :(mm,teach.wait_PPP,(
  777.     :(wdial_status,(Waiting for Link Control...):(bxo,0a)
  778.         (Timeout in %d seconds),:(aq,
  779.         :(wdial_phone,timeout),1000))
  780.     :(s,<0>time,:(aa,:(xcm),:(wdial_phone,timeout)))
  781.     :(pc,(
  782.         :(teach.checkcarrier)
  783.         :(wdial_polli,lcp,open,1000,(
  784.             :(px)
  785.         ))
  786.         :(agi,:(xcm),:(r,<0>time),(
  787.             :(wdial_changemode,raw)
  788.             :(teach.hangup)
  789.             :(wdial_status,(Not connected))
  790.             :(wdial_message,:(r,teach.MSGNOLCP),OK,e)
  791.             :(teach.exit)
  792.         ))
  793.     ),-1)
  794.  
  795.     :(wdial_status,(Waiting for Network Control...):(bxo,0a)
  796.         (Timeout in %d seconds),:(aq,
  797.         :(wdial_phone,timeout),1000))
  798.     :(s,<0>time,:(aa,:(xcm),:(wdial_phone,timeout)))
  799.     :(pc,(
  800.         :(teach.checkcarrier)
  801.         :(wdial_polli,ipcp,open,1000,(
  802.             :(px)
  803.         ))
  804.         :(agi,:(xcm),:(r,<0>time),(
  805.             :(wdial_changemode,raw)
  806.             :(teach.hangup)
  807.             :(wdial_status,(Not connected))
  808.             :(wdial_message,:(r,teach.MSGNOIPCP),OK,e)
  809.             :(teach.exit)
  810.         ))
  811.         
  812.     ),-1)
  813. ))
  814.  
  815. :(mm,teach.setip,(
  816. (loop, {
  817.     (define, ipaddr, (get_ipaddress, <1> ))
  818.     (==, (value, ipaddr),, {
  819.         (receive, 2000)
  820.     },{
  821.         (ipaddress,(value,ipaddr))
  822.         (break)
  823.     })
  824. }, (phone, timeout))
  825. ))
  826.  
  827. :(mm,teach.genlearn0,(
  828.     <* User says Done *>
  829.     :(ei,:(ag,:(ri,slang.p.num_ipaddresses),0,y,n):(e,:(wdial_frametype),SLIP,y,n),
  830.         yy,(
  831.         :(wdial_message,:(r,teach.IPMSS),OK,I)
  832.         :(s,myip,:(wdial_prompt,
  833.             :(r,teach.IPPRMPT),<* no default *>,
  834.             :(pci,((,):(ri,slang.p.get_ipaddress,:(pn))),:(ri,slang.p.num_ipaddresses)),
  835.             None
  836.         ))
  837.         :(ei,:(ri,myip),None,,(
  838.             :(pc,(
  839.                 :(ei,:(ri,slang.p.get_ipaddress,:(pn)),:(r,myip),(
  840.                     :(s,#,:(pn))
  841.                 ))
  842.             ),:(ri,slang.p.num_ipaddresses))
  843.             :(teach.write_scr)
  844.             :(teach.write_scr,(:(r,teach.setip,:(r,#))))
  845.             :(wdial_ipaddress,:(r,myip))
  846.         ))
  847.     ))
  848.  
  849.     :(wdial_status,(Writing script file))
  850.     :(fc5)
  851.     :(fg5,<1p>,(
  852.         :(wdial_message,:(r,teach.MSGNOCF),OK,S)
  853.         :(teach.exit)
  854.     ))
  855.     :(fw5,:(r,teach.script))
  856.  
  857.     <* Always end the script cleanly when done *>
  858.     :(fw5,:(bxo,0d0a0d0a))
  859.     :(fw5,(<)(***  END Learned Script  ***)(>):(bxo,0d0a))
  860.     :(fw5,(<)(*--------------------------*)(>):(bxo,0d0a))
  861.     :(fw5,:(bxo,0d0a))
  862.     :(fw5,(<)(***************************)(>):(bxo,0d0a))
  863.     :(fw5,(<)(* Change Into Packet Mode *)(>):(bxo,0d0a))
  864.     :(fw5,(<)(***************************)(>):(bxo,0d0a))
  865.     :(fw5,:(tca,40)(topacket):(tca,41):(bxo,0d0a))
  866.     :(fw5,:(bxo,0d0a))
  867.     :(fw5,(<)(************************)(>):(bxo,0d0a))
  868.     :(fw5,(<)(* Terminate The Script *)(>):(bxo,0d0a))
  869.     :(fw5,(<)(************************)(>):(bxo,0d0a))
  870.     :(fw5,:(tca,40)(status,{Connected}):(tca,41)
  871.         :(bxo,0d0a))
  872.     :(fw5,:(tca,40)(exit):(tca,41):(bxo,0d0a))
  873.  
  874.     :(fc5)
  875.     :(wdial_status,(Script file written))
  876.  
  877.     :(d,teach.script)
  878.     :(px)
  879. ))
  880.  
  881. :(mm,teach.genlearn1,(
  882.     <* User says Abort, Do not write any scripts *>
  883.     :(wdial_status,(Teach mode ABORTED...Hanging up))
  884.     :(d,teach.script)
  885.     :(teach.hangup)
  886.     :(wdial_message,:(r,teach.ABMSS),OK,E)
  887.     :(teach.exit)
  888. ))
  889.  
  890. :(o,,(
  891. <**>
  892. <* Return user's username, ask for it if necessary *>
  893. <**>
  894. ))
  895. :(mm,teach.username,(
  896.     :(ei,:(wdial_username),,(
  897.         :(wdial_username,:(wdial_prompt,(Please enter your username:)))
  898.     ))
  899.     :(wdial_username)
  900. ))
  901.  
  902. :(o,,(
  903. <**>
  904. <* Return user's password, ask for it if necessary *>
  905. <**>
  906. ))
  907. :(mm,teach.passcode,(
  908.     :(ei,:(wdial_passcode),,(
  909.         :(wdial_passcode,:(wdial_prompt,(Please enter your password:),(*)))
  910.     ))
  911.     :(wdial_passcode)
  912. ))
  913.  
  914. :(mm,teach.genlearn2,(
  915.     <* Username *>
  916.  
  917.     <* Suck username from WDial *>
  918.  
  919.     :(teach.write_scr)
  920.     :(teach.write_scr,(<2>(<)(* Send username *)(>)))
  921.     :(teach.write_scr,(<2>:(tca,40)(send,):(tca,40)(uname):(tca,41)
  922.         :(tca,40)(cr):(tca,41):(tca,41)))
  923.     :(o2,:(teach.username):(bxo,0d))
  924. ))
  925.  
  926. :(mm,teach.genlearn3,(
  927.     <* Password *>
  928.  
  929.     <* Suck password from WDial *>
  930.  
  931.     :(teach.write_scr)
  932.     :(teach.write_scr,(<2>(<)(* Send password *)(>)))
  933.     :(teach.write_scr,(<2>:(tca,40)(send,):(tca,40)(pword):(tca,41)
  934.         :(tca,40)(cr):(tca,41):(tca,41)))
  935.     :(o2,:(teach.passcode):(bxo,0d))
  936. ))
  937.  
  938. :(mm,teach.genlearn4,(
  939.     <* Send a carriage return *>
  940.  
  941.     :(teach.write_scr)
  942.     :(teach.write_scr,(<2>(<)(* Send a CR *)(>)))
  943.     :(teach.write_scr,(<2>:(tca,40)(send,):(tca,40)(cr):(tca,41)
  944.         :(tca,41)))
  945.     :(o2,:(bxo,0d))
  946. ))
  947. `
  948. :(mm,teach.genlearn5,(
  949.     <**>
  950.     <* Send specific keys *>
  951.     <**>
  952.  
  953.     :(d,<0>sendkeys)
  954.     :(d,<0>exitflag)
  955.     :(s,<0>numk,0)
  956.     :(s,<0>kpos.)
  957.  
  958.     :(pcd,(
  959.         <* Prepare to build the prompt *>
  960.         :(s,<0>px,:(r,<0>sendkeys))
  961.  
  962.         <* Protect the innocent TRAC delimiters *>
  963.         :(tra,<0>px,:(tca,40),:(tca,41)(:(tca,40)):(tca,40))
  964.         :(tra,<0>px,:(tca,41),:(tca,41)(:(tca,41)):(tca,40))
  965.         :(tra,<0>px,:(tca,60)(*),:(tca,41)(:(tca,60)):(tca,40)
  966.             (*))
  967.         :(tra,<0>px,(*):(tca,62),(*):(tca,41)(:(tca,62))
  968.             :(tca,40))
  969.         :(tra,<0>px,:(tca,44),:(tca,41)(:(tca,44)):(tca,40))
  970.         :(s,<0>px,:(tca,40):(r,<0>px):(tca,41))
  971.  
  972.         <* Really build a prompt *>
  973.         :(s,<0>prompt,:(teach.open)(wdial_prompt,)
  974.             :(ei,:(r,<0>px),:(tca,40):(tca,41),,(
  975.                 :(tca,40)(Response so far: )("):(ri,<0>px)("):(tca,41)(...)
  976.             ))
  977.             :(tca,40)(Send which key?):(tca,41)(,,)((I am done),)
  978.             ((Delete last key),(I am done),)
  979.             ((Abort without sending keys))
  980.                 :(pc,(
  981.                     (,):(tca,40):(r,teach.keys.k:(pn)):(tca,41)
  982.                 ),:(r,teach.keys.num),1)
  983.             :(tca,41))
  984.  
  985.         :(d,<0>px)            <* Throw away temp *>
  986.  
  987.         :(s,<0>pres,:(ri,<0>prompt))        <* Prompt the user *>
  988.  
  989.         :(pc,(
  990.             :(ei,:(r,<0>pres),(Delete last key),(
  991.                 <* Delete Last key *>
  992.                 :(agi,:(r,<0>numk),0,(
  993.                     :(tps,<0>sendkeys,:(r,<0>kpos.
  994.                         :(r,<0>numk)))
  995.                     :(s,<0>sendkeys,:(tpb,<0>sendkeys))
  996.                     :(d,<0>kpos.:(r,<0>numk))
  997.                     :(s,<0>numk,:(as,:(r,<0>numk),1))
  998.                 ))
  999.                 :(px)
  1000.             ))
  1001.             :(ei,:(r,<0>pres),(I am done),(
  1002.                 <* Finish up *>
  1003.                 :(s,<0>exitflag)
  1004.                 :(px)
  1005.             ))
  1006.             :(ei,:(r,<0>pres),(Abort without sending keys),(
  1007.                 <* Abort *>
  1008.                 :(d,<0>sendkeys)
  1009.                 :(s,<0>exitflag)
  1010.                 :(px)
  1011.             ))
  1012.  
  1013.             <* Store Last Position *>
  1014.             :(s,<0>numk,:(aa,0:(r,<0>numk),1))
  1015.             :(s,<0>kpos.:(r,<0>numk),:(tl,<0>sendkeys))
  1016.  
  1017.             <* Get String to send *>
  1018.             :(s,<0>keyv,:(r,<0>pres))             <* Default case *>
  1019.             :(pcd,(
  1020.                 :(ei,:(r,<0>pres),:(r,teach.keys.k:(pn)),(
  1021.                     :(s,<0>keyv,:(r,teach.keys.v:(pn)))
  1022.                     :(px)
  1023.                 ))
  1024.             ),:(r,teach.keys.num),1)
  1025.  
  1026.             :(0,:(r,<0>keyv))
  1027.  
  1028.             <* Add key to list *>
  1029.             :(s,<0>sendkeys,:(r,<0>sendkeys):(r,<0>keyv))
  1030.         ))
  1031.         :(mhi,<0>exitflag,(:(px)))
  1032.     ),-1)
  1033.  
  1034.     :(agi,:(tl,<0>sendkeys),0,(
  1035.         :(s,<0>temp,:(teach.convkeys,<0>sendkeys))            <* SLANG *>
  1036.       :(pc,(
  1037.             :(s,<0>temp1,:(ts,<0>temp,,(`),(:(px))))
  1038.             :(tra,<0>temp1,`,,)
  1039.             :(tra,<0>temp1,( ),({ }))
  1040.             :(tra,<0>temp1,(:),:(tca,40)(char,58):(tca,41))
  1041.             :(tra,<0>temp1,(<)(*),({<}{*}))
  1042.             :(tra,<0>temp1,(*)(>),({*}),({>}))
  1043.         
  1044.             :(s,<0>temp2,:(r,<0>temp1))
  1045.             :(tra,<0>temp2,:(tca,40)(char),(:):(tca,40)(tca)) <* TRAC *>
  1046.             :(tra,<0>temp2,({),:(tca,40))
  1047.             :(tra,<0>temp2,(}),:(tca,41))
  1048.         
  1049.             :(teach.write_scr)
  1050.             :(teach.write_scr,(<2>(<)(* Send specific keys *)(>)))
  1051.             :(teach.write_scr,(<2>:(tca,40)(pause,1000):(tca,41)))
  1052.             :(teach.write_scr,(<2>:(tca,40)(send,):(r,<0>temp1)
  1053.                 :(tca,41)))
  1054.         
  1055.             :(iwm,1000)
  1056.             :(o2,:(ri,<0>temp2))        <* Send to stream *>
  1057.         ),-1)
  1058.         :(d,<0>temp,<0>temp1,<0>temp2)     <* Clean up *>
  1059.     ))
  1060.  
  1061.     :(d,<0>prompt,<0>keynum,<0>keyval,<0>pres,<0>keyv,<0>sendkeys,
  1062.         <0>exitflag,<0>numk,<0>kpos.)
  1063. ))
  1064. :(mm,teach.genlearn6,(
  1065.     <* Ignore this prompt *>
  1066. ))
  1067. :(mm,teach.genlearn7,(
  1068.     <* Wait for callback *>
  1069.     :(teach.callback)
  1070.  
  1071.     <* Write stuff to script file *>
  1072.     :(teach.write_scr,((<)(* Wait for Callback *)(>)))
  1073.     :(teach.write_scr,(:(tca,40)(callback):(tca,41)))
  1074.     :(teach.write_scr)
  1075. ))
  1076.  
  1077. :(mm,teach.start_scr,(
  1078.     <* Script file header *>
  1079.     :(<0>w,((<)(*)
  1080. (*********************************************************************)(>)))
  1081.     :(<0>w,((<)(*)
  1082. ( This script was automatically generated by WDial teach mode ver. )
  1083.     :(r,teach.Version)(.    *)(>)))
  1084.     :(<0>w,((<)(*)
  1085. ( Created: ):(xcf)(                                  *)(>)))
  1086.     :(<0>w,((<)(*)
  1087. (*********************************************************************)(>)))
  1088.     :(<0>w)
  1089.  
  1090.     <* Read common TRAC code from GENLEARN.SCR *>
  1091.     :(fc5)
  1092.     :(fo5,(genlearn.scr),(
  1093.         :(wdial_message,:(r,teach.MSGNOGENLEARN),OK,S)
  1094.         :(teach.exit)
  1095.     ))
  1096.     :(pcd,(
  1097.         :(s,<0>temp,:(fr5,,1000,(:(px))))
  1098.  
  1099.         :(teach.write_scr_nocrlf,(:(r,<0>temp)))
  1100.     ),-1)
  1101.     :(fc5)
  1102.  
  1103.     :(teach.write_scr,(:(bxo,0d0a)))
  1104.     :(teach.write_scr,((<)(*** BEGIN Learned Script ***)(>)))
  1105.     :(teach.write_scr,((<)(*--------------------------*)(>):(bxo,0d0a)))
  1106.  
  1107.     :(teach.write_scr,((<)(***********************)(>)))
  1108.     :(teach.write_scr,((<)(* Check SLANG Version *)(>)))
  1109.     :(teach.write_scr,((<)(***********************)(>)))
  1110.     :(teach.write_scr,(:(tca,40)(checkver):(tca,41):(bxo,0d0a)))
  1111.  
  1112.     :(teach.write_scr,((<)(****************)(>)))
  1113.     :(teach.write_scr,((<)(* Connect/Dial *)(>)))
  1114.     :(teach.write_scr,((<)(****************)(>)))
  1115.     :(teach.write_scr,(:(tca,40)(connect):(tca,41):(bxo,0d0a)))
  1116.  
  1117.  
  1118.     :(teach.write_scr)
  1119.     :(d,<0>temp)
  1120. ))
  1121.  
  1122. :(o,,(
  1123. <**>
  1124. <* Teach write script shortcut macros *>
  1125. <**>
  1126. ))
  1127.  
  1128. :(mm,teach.open,((:):(tca,40)))
  1129. :(mm,teach.close,(:(tca,41)))
  1130. :(mm,teach.start_scrw,(
  1131.     :(teach.write_scr,(<1>))
  1132. ))
  1133. :(mm,teach.write_scr,(
  1134.     :(s,teach.script,:(r,teach.script)<1>:(bxo,0d0a))
  1135. ))
  1136. :(mm,teach.write_scr_nocrlf,(
  1137.     :(s,teach.script,:(r,teach.script)<1>)
  1138. ))
  1139.  
  1140. :(o,,(
  1141. <**>
  1142. <* Le Bootstrap, called by WDial after reading in script file *>
  1143. <* <1> should contain the name of the script file to generate *>
  1144. <**>
  1145. ))
  1146. :(mm,##,(
  1147.     <* Make sure filename has a .SCR extension if none specified    *>
  1148.     <* (This is temporary until WDial automatically appends .SCR) *>
  1149.     <*------------------------------------------------------------*>
  1150.     :(s,<0>filename,(<1p>))
  1151.     :(ttc,<0>filename,(.),,(
  1152.         :(s,<0>filename,:(r,<0>filename)(.scr))
  1153.     ))
  1154.     <* Read in SLANG so we can reuse IP address parser *>
  1155.     :(mf,,slang.lng)
  1156.     
  1157.     <* Start learn mode *>
  1158.     :(teach.genlearn,:(r,<0>filename))
  1159.  
  1160.     <* Clean up, I should never get here but it looks good *>
  1161.     :(d,<0>filename)
  1162. ))
  1163.  
  1164.  
  1165. :(o,,(
  1166. <**>
  1167. <* Check to make sure we're still connected *>
  1168. ))
  1169. :(mm,teach.checkcarrier,(
  1170.     :(wdial_polli,physical,open,,,(
  1171.         :(wdial_status,(Not connected))
  1172.         :(wdial_message,:(r,teach.MSGHANGUP),OK,E)
  1173.         :(teach.exit)
  1174.     ))
  1175. ))
  1176.  
  1177. :(o,,(
  1178. <**>
  1179. <* Wait for a callback from a defender system *>
  1180. <**>
  1181. ))
  1182. :(mm,teach.callback,(
  1183.     <* Case *>
  1184.     :(pc,(
  1185.         :(wdial_status,(Waiting for provider to hangup...):(bxo,0a)
  1186.             (Timeout in %d seconds),:(aq,:(wdial_phone,timeout)
  1187.             ,1000))
  1188.         :(wdial_polli,physical,closed,:(wdial_phone,timeout),,(
  1189.             :(teach.hangup)
  1190.             :(wdial_status,(Not connected))
  1191.             :(wdial_message,:(r,teach.MSGNOHANGUP),OK,E)
  1192.             :(teach.exit)
  1193.         ))
  1194.  
  1195.         <* Tell the customer what I am doing *>
  1196.         :(wdial_status,(Waiting for callback...):(bxo,0a)
  1197.             (Timeout in %d seconds),2400)
  1198.         :(s,<0>tmp,:(teach.iwt2,240000,RING))
  1199.         :(ttci,<0>tmp,RING,,(
  1200.             <* Wait for RING *>
  1201.             :(wdial_status,(Not connected))
  1202.             :(wdial_message,:(r,teach.MSGNOCALLBACK),OK,E)
  1203.             :(teach.exit)
  1204.         ))
  1205.  
  1206.         :(wdial_status,(Answering phone))
  1207.         :(o2,ATA:(bxo,0d))            <* Tell modem to answer *>
  1208.  
  1209.         :(s,<0>tmp,:(teach.iwt2,:(wdial_phone,timeout),CONNECT))
  1210.         :(ttci,<0>tmp,CONNECT,,(
  1211.             <* Modem did not CONNECT *>
  1212.             :(wdial_status,(Not connected))
  1213.             :(wdial_message,:(r,teach.MSGNOCONNECT),OK,E)
  1214.             :(teach.exit)
  1215.         ))
  1216.  
  1217.         <* Ready to send more stuff *>
  1218.         :(wdial_polli,physical,open,1000,(
  1219.             :(wdial_status,(Physical connection established))
  1220.         ),(
  1221.             :(wdial_status,(Not connected))
  1222.             :(wdial_message,:(r,teach.MSGNOPHYSICAL),OK,E)
  1223.             :(teach.exit)
  1224.         ))
  1225.         :(px)
  1226.  
  1227.     )) <* Case *>
  1228.  
  1229.     <* Clean up *>
  1230.     :(d,<0>tmp)
  1231. ))
  1232.  
  1233. :(o,,(
  1234. <**>
  1235. <* Hang up modem   *>
  1236. <**>
  1237. ))
  1238. :(mm,teach.hangup,(
  1239.     :(ibdf)
  1240.     :(wdial_polli,physical,close,2000,,(
  1241.         :(iz2)
  1242.         :(pcd,(
  1243.             :(o2,(+++))
  1244.             :(s,tmp,:(iwt2,2000,OK))
  1245.             :(ttci,tmp,OK,(
  1246.                 :(px)
  1247.             ))
  1248.         ),3)
  1249.         :(pcd,(
  1250.             :(o2,ATH:(bxo,0d))
  1251.             :(s,tmp2,:(iwt2,2000,OK))
  1252.             :(ttci,tmp2,OK,(
  1253.                 :(px)
  1254.             ))
  1255.         ),3)
  1256.     ))
  1257. ))
  1258.  
  1259. :(o,,(
  1260. <**>
  1261. <* Exit gracefully *>
  1262. <**>
  1263. ))
  1264. :(mm,teach.exit,(
  1265.     :(wdial_status,(Not connected))
  1266.     :(g)
  1267. ))
  1268.  
  1269.  
  1270.