home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 67 / af067a.adf / ACCESS.DMS / ACCESS.adf / ReTokenise.AMOS / ReTokenise.amosSourceCode
AMOS Source Code  |  1993-03-10  |  3KB  |  118 lines

  1. ' ---------------------------------------------------------------------  
  2. ' AMOS Professional Re-tokeniser V1.1
  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. ' Question the user
  19. R=Dialog Box(AL$,2,"Re-tokenise the current program, please confirm.")
  20. If R=1 : MN_QUIT : End If 
  21.  
  22. ' Re tokenisation loop 
  23. ' ~~~~~~~~~~~~~~~~~~~~ 
  24. R=Dialog Box(AL$,0,"Tokenising every line. Press any key to abort.")
  25. Clear Key 
  26.  
  27. ' Open all procedures  
  28. Call Editor Equ("AEd_UnfoldAll")
  29.  
  30. ' Ask number of lines
  31. Ask Editor Equ("AEdAsk_NumberOfLines") : NLINES=Param
  32.  
  33. ' Top of text
  34. Call Editor Equ("AEd_TopOfText")
  35.  
  36. For N=1 To NLINES
  37.    
  38.    If Inkey$<>"" : E$="Tokenisation aborted." : Exit : End If 
  39.    
  40.    Ask Editor Equ("AEdAsk_Free") : If Param<256 : E$="Buffer too small!" : Exit : End If 
  41.    
  42.    Ask Editor Equ("AEdAsk_CurrentLine"),N : LINE$=Param$
  43.    
  44.    If Left$(Upper$(LINE$),9)<>"PROCEDURE"
  45.       
  46.       Call Editor Equ("AEd_NewLine"),0,LINE$
  47.       If Param$<>""
  48.          E$=Param$ : Exit 
  49.       End If 
  50.       
  51.    End If 
  52.    
  53.    Call Editor Equ("AEd_Down")
  54.    
  55. Next 
  56.  
  57. If E$<>"" : R=Dialog Box(AL$,1,E$) : End If 
  58. MN_QUIT
  59.  
  60. Procedure INIT_SCREEN
  61.    
  62.    Global AL$
  63.    Restore ALT
  64.    Repeat 
  65.       Read A$ : AL$=AL$+A$
  66.    Until A$=""
  67.    
  68.    Resource Screen Open 0,640,40,0
  69.    Curs Off : Flash Off : Cls 0
  70.    Screen Display 0,,100,,
  71.    Wait Vbl 
  72.    
  73.    Paper 0 : Pen 1
  74.    Pop Proc
  75.    
  76.    ' QUICK RUN DIALOG BOXES 
  77.    ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  78.    ALT: Data " "
  79.    ' One button, CANCEL 
  80.    ' ~~~~~~~~~~~~~~~~~~ 
  81.    Data "SIze   SW,SH;"
  82.    Data "BAse   SWidth SX -2/,SHeight SY- 2/;"
  83.    Data "IF     0VA 0=;"
  84.    Data "["
  85.    Data "BOx    0,0,1,SX,SY;"
  86.    Data "POut   1VACX,16,1VA,0,7;"
  87.    Data "BU 0,0,0,SX,SY,0,0,0;[][SM;]"
  88.    Data "]"
  89.    Data "IF     0VA 1=;"
  90.    Data "["
  91.    Data "BOx    0,0,1,SX,SY;"
  92.    Data "POut   1VACX,8,1VA,0,7;"
  93.    Data "BU 1,SX112-,SY16-,96,16,0,0,1;[LI 0,0,41BP3*+,SX;PR 4MECXBP+,1,4ME,7;][BR0;BQ;]"
  94.    Data "KY 27,0;"
  95.    Data "BU 0,0,0,SX,SY,0,0,0;[][SM;]"
  96.    Data "RUn    0,3;"
  97.    Data "]"
  98.    Data "IF     0VA 2=;"
  99.    Data "["
  100.    Data "BOx    0,0,1,SX,SY;"
  101.    Data "POut   1VACX,8,1VA,0,7;"
  102.    Data "BU 1,16,SY16-,96,16,0,0,1;[LI 0,0,41BP3*+,SX;PR 4MECXBP+,1,4ME,7;][BR0;BQ;]"
  103.    Data "KY 13,0;"
  104.    Data "BU 2,SX112-,SY16-,96,16,0,0,1;[LI 0,0,41BP3*+,SX;PR 3MECXBP+,1,3ME,7;][BR0;BQ;]"
  105.    Data "KY 27,0;"
  106.    Data "BU 0,0,0,SX,SY,0,0,0;[][SM;]"
  107.    Data "RUn    0,3;"
  108.    Data "]"
  109.    Data "EXit;"
  110.    Data ""
  111.    
  112. End Proc
  113. Procedure MN_QUIT
  114.    Trap Dialog Close 
  115.    Trap Screen Close 0
  116.    Erase All : Close 
  117.    End 
  118. End Proc