Trying to understand preprocessor
- Posted by moskito_x Feb 08, 2013
- 1508 views
Here is the D:\euphoria-405\demo\preproc\eu.cfg
-p etml:etml.ex -p le,lex:literate.ex -p dex:datesub.ex:-f %m/%d/%Y
in the cmd window.
Example: etmltest.ex
README file |
---|
To run this example, at the command prompt type: |
eui etmltest.ex |
let's do it:
D:\euphoria-405\demo\preproc>eui etmltest.ex usage: eui etmltest.ex <name>
Output: Error / Info |
---|
usage: eui etmltest.ex <name> |
With <name> hello.etml
D:\euphoria-405\demo\preproc>eui etmltest.ex hello.etml <html> <head><title>Hello, hello.etml</title></head> <body> <h1>Say Hello</h1> <p>Hello, hello.etml!</p> <p>Hello, hello.etml!</p> <p>Hello, hello.etml!</p> <p>Hello, hello.etml!</p> <p>Hello, hello.etml!</p> <p>Hello, hello.etml!</p> <p>Hello, hello.etml!</p> <p>Hello, hello.etml!</p> <p>Hello, hello.etml!</p> <p>Hello, hello.etml!</p> </body> </html>
Example: datesub.ex
file thedate.ex
-- thedate.ex puts(1, "The date this was run is @DATE@\n")
D:/euphoria-405/docs/html/preproc.html |
---|
Now, let's run it, but first without a pre-processor hook defined. |
eui thedate.ex |
D:\euphoria-405\demo\preproc>eui thedate.ex The date this was run is @DATE@
D:/euphoria-405/docs/html/preproc.html |
---|
Not very helpful? Ok, let's tell Euphoria how to use the pre-processor that we just created and then see what happens. |
C:\MyProjects\datesub> eui -p eui:datesub.ex thedate.ex The date this was run is 2009-08-05 19:36:22 |
Now see what really happens.
D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.ex The date this was run is @DATE@
surprised ? I also
Others attempts
file thedate.dex
puts(1, "@DATE@\n")
Let's try thedate.dex (with a pre-processor hook defined).
D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.dex Can't open 'D:\euphoria-405\demo\preproc\thedate.dex'
Except the error message, a file has been created "D:\euphoria-405\demo\preproc\thedate.pp.dex-f"
file D:\euphoria-405\demo\preproc\thedate.pp.dex-f
puts(1, "2013-02-09\n")
Let's try thedate.dex (without a pre-processor hook defined). It's in the eu.cfg "-p dex:datesub.ex:-f %m/%d/%Y"
D:\euphoria-405\demo\preproc>eui thedate.dex Can't open 'D:\euphoria-405\demo\preproc\thedate.dex'
Except the error message, the file has been overwritten "D:\euphoria-405\demo\preproc\thedate.pp.dex-f"
How can I get it to run, so that the output is as described ??
D:/euphoria-405/docs/html/preproc.html |
---|
Not very helpful? Ok, let's tell Euphoria how to use the pre-processor that we just created and then see what happens. |
C:\MyProjects\datesub> eui -p eui:datesub.ex thedate.ex The date this was run is 2009-08-05 19:36:22 |
thanks for reading, moskito x