1. Trying to understand preprocessor
- Posted by moskito_x Feb 08, 2013
- 1506 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
2. Re: Trying to understand preprocessor
- Posted by jimcbrown (admin) Feb 09, 2013
- 1404 views
README file |
---|
To run this example, at the command prompt type: |
eui etmltest.ex |
Sounds like an error in the docs, it should have a name afterwards.
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>
That worked correctly. Why did you think otherwise? (etml is an "Euphoria-like" superset of HTML that, after running through the preprocessor, is converted to plain HTML.)
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'
You need to name it thedate.eui - or else use the hook as -p dex:datesub.ex
Using -p eui: with the .ex extension sounds like another error in the docs.
3. Trying to understand preprocessor
- Posted by moskito_x Feb 09, 2013
- 1402 views
Thanks for response.
That does not explain why "eui thedate.dex" does not work?
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'
Magic:
After I entered once:
eui eui:datesub.ex thedate.eui
all other attempts now run. No error appears: Can't open 'D:\euphoria-405\demo\preproc\thedate.dex'
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. D:\euphoria-405\demo\preproc>eui thedate.dex 2013-02-09 D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.dex 2013-02-09 D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.ex The date this was run is @DATE@ D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.dex 2013-02-09
In eu.cfg: after I delete the line "-p dex:datesub.ex:-f %m/%d/%Y"
D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.dex @DATE@ D:\euphoria-405\demo\preproc>eui -p ex:datesub.ex thedate.ex The date this was run is 2013-02-09 D:\euphoria-405\demo\preproc>
MAGIC : What happened here?
Thanks moskito x
4. Re: Trying to understand preprocessor
- Posted by jimcbrown (admin) Feb 09, 2013
- 1381 views
That does not explain why "eui thedate.dex" does not work? 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'
Are you sure the file was really there?
Weird. You left off the -p there, btw.
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. D:\euphoria-405\demo\preproc>eui thedate.dex 2013-02-09 D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.dex 2013-02-09
Those worked.
D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.ex The date this was run is @DATE@
That wasn't suppose to work, as "-p eui" and ".ex" don't match.
D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.dex 2013-02-09
That otherwise wasn't suppose to work either - but it did thanks to your eu.cfg
In eu.cfg: after I delete the line "-p dex:datesub.ex:-f %m/%d/%Y"
MAGIC : What happened here?
Thanks moskito x
D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.dex @DATE@
That wasn't suppose to work - "-p eui" and ".dex" don't match.
D:\euphoria-405\demo\preproc>eui -p ex:datesub.ex thedate.ex The date this was run is 2013-02-09 D:\euphoria-405\demo\preproc>
That worked, because "-p ex" and ".ex" match.
5. Re: Trying to understand preprocessor
- Posted by moskito_x Feb 09, 2013
- 1394 views
That does not explain why "eui thedate.dex" does not work? 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'
Are you sure the file was really there?
After such an Error, that's the first thing i'm looking for
Sorry typo: so was correct command: eui -p eui:datesub.ex thedate.eui
D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.ex The date this was run is @DATE@
That wasn't suppose to work, as "-p eui" and ".ex" don't match.
I know that. I only want to show the complete test.
I catch the magic.
If I delete all "thedate.pp.* (cached files) I got the same error again.
The first command before the delete.
The second and third command after I delete all thedate.pp.xxx
Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.dex 2013-02-09 D:\euphoria-405\demo\preproc>eui -p eui:datesub.ex thedate.dex Can't open 'D:\euphoria-405\demo\preproc\thedate.dex' D:\euphoria-405\demo\preproc>eui thedate.dex Can't open 'D:\euphoria-405\demo\preproc\thedate.dex'
Test:
First command: It runs fine, and create a thedate.pp.dex
Second command: Now thedate.pp.dex exist and so eui thedate.dex runs fine.
D:\euphoria-405\demo\preproc>eui -p dex:datesub.ex thedate.dex 2013-02-09 D:\euphoria-405\demo\preproc>eui thedate.dex 2013-02-09
why is that?
That's because the command eui -p eui:datesub.ex thedate.dex
the eui: did not match the extension .dex
and now eui searches in eu.cfg for a match pre-processor line like -p dex:datesub.ex:-f %m/%d/%Y
and then created thedate.pp.dex-f the wrong file.
Solution
change in D:\euphoria-405\demo\preproc\eu.cfg the line
-p dex:datesub.ex:-f %m/%d/%Yto
-p dex:datesub.ex: %m/%d/%Y
moskito x
6. Re: Trying to understand preprocessor
- Posted by jimcbrown (admin) Feb 09, 2013
- 1433 views
That's because the command eui -p eui:datesub.ex thedate.dex
the eui: did not match the extension .dex
and now eui searches in eu.cfg for a match pre-processor line like -p dex:datesub.ex:-f %m/%d/%Y
and then created thedate.pp.dex-f the wrong file.
Solution
change in D:\euphoria-405\demo\preproc\eu.cfg the line
-p dex:datesub.ex:-f %m/%d/%Yto
-p dex:datesub.ex: %m/%d/%Y
moskito x
Hmm. Changing that line in the manner you described should not have been necessary.
I wonder what would happen if you did this
-p dex:datesub.ex: -f %m/%d/%Y
7. Re: Trying to understand preprocessor
- Posted by moskito_x Feb 09, 2013
- 1436 views
Hmm. Changing that line in the manner you described should not have been necessary.
I wonder what would happen if you did this
-p dex:datesub.ex: -f %m/%d/%Y
when I put a blank space in front of -f :
-p dex:datesub.ex: -f %m/%d/%Y
This gives the same correct result.