;                         MDBOCOMPILE.R documentationMDNM
; COMPILE.R is a freeware Xy 3+, NB 3 compatible Xy program preprocessor
; Copyright (c) 2009 Kari Eveli and Lexitec. All rights reserved.
; Please note: Do not compile this file using COMPILE.R, 
; use the supplied COMPILE.R program as is.
;
;                          MDBOHow COMPILE.R worksMDNM
; First make a documented Xy program file using the .T file specification
; you will find below
; When you have .T program file open in the current window, run compile.r. It
;    1) saves the .T  program file
;    2) prepares a runnable Xy program file .R with the same base filename 
;    3) reloads the .T program file open in the current window for editing
; Put a keyboard shortcut in your keyboard file for easy use, e.g.:
;    bc,r,u,n, ,c,:,\,n,b,\,C,O,M,P,I,L,E,.,R,xc
;
;                        MDBO*.T file specificationMDNM
; 1) End command line program call with 	, e.g.:
;    ca xxx.xxx	
; 2) Add a comment after the command line using ';'
;    ca xxx.xxx	; your comment
;    ; comment line that is removed by the preprocessor
; 3) Put keyboard function calls on separate lines. Lines with one or 
;    several keyboard function calls can be commented with ';'
;    ; TopOfFile
; 4) As the compile.r preprocessor removes linefeeds and empty lines
;    you have to use 	in commands; this means that
;    ca xxx.xxx
;    is not a valid command in the .T program file.
;    Note: you can separate sections of your program with linefeeds
;    in order to make the code more readable
; 5) Actual semicolons in .T programs are coded as '\;'
; 
; Contents of COMPILE.R: 
;     filename
sx03,va$fi
;     parser init.
sv12,.sv13,sv14,sv15,sv16,T
;     parse filename
xs03,12,13,14,15
;     IF ext not "T"
if(is15<>is16)
;     message & exit, a safety measure for inadvertent use
}PRNot a .T file, cannot compileex
ei; ENDIF
; 01 = cursor position in file
sx01,cp
A; DisplayOff
; save .T
SA
; TopOfFile
; Error Suppression ON
; eliminate sound feedback when using ci commands
es 1
; \; = $semicolon$
ci /\;/$semicolon$/
; remove comment lines from the semicolon to line end
ci \;0A\\
; restore coded semicolons
ci \$semicolon$\;\
; remove linefeeds and empty lines
ci \0A\\
; ERASE NO VERIFY *.R (= save *.t, backdel, R)
ernv sx02,va$fppv02+R
; Error Suppression OFF
es 0
; SAVE AS *.R (= save *.t, backdel, R)
save sx02,va$fppv02+R
; ABANDON
AB
?; DisplayON
; CALL
CA
; jump to cursor position
jmp pv01	
; Message
}PRProgram .T saved and .R preparedex
