home *** CD-ROM | disk | FTP | other *** search
/ 17 Bit Software 4: Phase Four / 17Bit_Phase_Four.iso / files / 2961a.dms / 2961a.adf / ReTokenise.AMOS / ReTokenise.amosSourceCode
Encoding:
AMOS Source Code  |  1992-10-04  |  2.9 KB  |  127 lines

  1. ' ---------------------------------------------------------------------  
  2. ' AMOS Professional Re-tokeniser 
  3. ' By Francois Lionet 
  4. ' (c) 1992 Europress Software Ltd. 
  5. ' ---------------------------------------------------------------------
  6. ' This small program is an example of the power of AMOSPro Accessories!  
  7. ' ---------------------------------------------------------------------
  8. Set Accessory 
  9.  
  10. INIT_SCREEN
  11.  
  12. ' Make sure we are an accessory
  13. If Prg Under<>1
  14.    R=Dialog Box(AL$,2,"This program only work as an accessory!")
  15.    MN_QUIT
  16. End If 
  17.  
  18. ' Some of the editor's command 
  19. EDASK_NLINES=5
  20. EDASK_FREE=10
  21. EDASK_LINE=1
  22. ED_DOWN=2
  23. ED_TTEXT=17
  24. ED_NEWLINE=71
  25. ED_UNFOLDALL=89
  26.  
  27. ' Question the user
  28. R=Dialog Box(AL$,2,"Re-tokenise the current program, please confirm.")
  29. If R=1 : MN_QUIT : End If 
  30.  
  31. ' Re tokenisation loop 
  32. ' ~~~~~~~~~~~~~~~~~~~~ 
  33. R=Dialog Box(AL$,0,"Tokenising every line. Press any key to abort.")
  34. Clear Key 
  35.  
  36. ' Open all procedures  
  37. Call Editor ED_UNFOLDALL
  38.  
  39. ' Ask number of lines
  40. Ask Editor EDASK_NLINES : NLINES=Param
  41.  
  42. ' Top of text
  43. Call Editor ED_TTEXT
  44.  
  45. For N=1 To NLINES
  46.    
  47.    If Inkey$<>"" : E$="Tokenisation aborted." : Exit : End If 
  48.    
  49.    Ask Editor EDASK_FREE : If Param<256 : E$="Buffer too small!" : Exit : End If 
  50.    
  51.    Ask Editor EDASK_LINE,N : LINE$=Param$
  52.    
  53.    If Left$(Upper$(LINE$),9)<>"PROCEDURE"
  54.       
  55.       Call Editor ED_NEWLINE,0,LINE$
  56.       If Param$<>""
  57.          E$=Param$ : Exit 
  58.       End If 
  59.       
  60.    End If 
  61.    
  62.    Call Editor ED_DOWN
  63.    
  64. Next 
  65.  
  66. If E$<>"" : R=Dialog Box(AL$,1,E$) : End If 
  67. MN_QUIT
  68.  
  69. Procedure INIT_SCREEN
  70.    
  71.    Global AL$
  72.    Restore ALT
  73.    Repeat 
  74.       Read A$ : AL$=AL$+A$
  75.    Until A$=""
  76.    
  77.    Resource Screen Open 0,640,40,0
  78.    Curs Off : Flash Off : Cls 0
  79.    Screen Display 0,,100,,
  80.    Wait Vbl 
  81.    
  82.    Paper 0 : Pen 1
  83.    Pop Proc
  84.    
  85.    ' QUICK RUN DIALOG BOXES 
  86.    ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  87.    ALT: Data " "
  88.    ' One button, CANCEL 
  89.    ' ~~~~~~~~~~~~~~~~~~ 
  90.    Data "SIze   SW,SH;"
  91.    Data "BAse   SWidth SX -2/,SHeight SY- 2/;"
  92.    Data "IF     0VA 0=;"
  93.    Data "["
  94.    Data "BOx    0,0,1,SX,SY;"
  95.    Data "POut   1VACX,16,1VA,0,7;"
  96.    Data "BU 0,0,0,SX,SY,0,0,0;[][SM;]"
  97.    Data "]"
  98.    Data "IF     0VA 1=;"
  99.    Data "["
  100.    Data "BOx    0,0,1,SX,SY;"
  101.    Data "POut   1VACX,8,1VA,0,7;"
  102.    Data "BU 1,SX112-,SY16-,96,16,0,0,1;[LI 0,0,41BP3*+,SX;PR 4MECXBP+,1,4ME,7;][BR0;BQ;]"
  103.    Data "KY 27,0;"
  104.    Data "BU 0,0,0,SX,SY,0,0,0;[][SM;]"
  105.    Data "RUn    0,3;"
  106.    Data "]"
  107.    Data "IF     0VA 2=;"
  108.    Data "["
  109.    Data "BOx    0,0,1,SX,SY;"
  110.    Data "POut   1VACX,8,1VA,0,7;"
  111.    Data "BU 1,16,SY16-,96,16,0,0,1;[LI 0,0,41BP3*+,SX;PR 4MECXBP+,1,4ME,7;][BR0;BQ;]"
  112.    Data "KY 13,0;"
  113.    Data "BU 2,SX112-,SY16-,96,16,0,0,1;[LI 0,0,41BP3*+,SX;PR 3MECXBP+,1,3ME,7;][BR0;BQ;]"
  114.    Data "KY 27,0;"
  115.    Data "BU 0,0,0,SX,SY,0,0,0;[][SM;]"
  116.    Data "RUn    0,3;"
  117.    Data "]"
  118.    Data "EXit;"
  119.    Data ""
  120.    
  121. End Proc
  122. Procedure MN_QUIT
  123.    Trap Dialog Close 
  124.    Trap Screen Close 0
  125.    Erase All : Close 
  126.    End 
  127. End Proc