1. Trying to understand preprocessor

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

new topic     » topic index » view message » categorize

2. Re: Trying to understand preprocessor

moskito_x said...
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.

moskito_x said...

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.)

moskito_x said...

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.

new topic     » goto parent     » topic index » view message » categorize

3. Trying to understand preprocessor

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

new topic     » goto parent     » topic index » view message » categorize

4. Re: Trying to understand preprocessor

moskito_x said...

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?

moskito_x said...

Magic:

After I entered once:

eui eui:datesub.ex thedate.eui 

all other attempts now run.

Weird. You left off the -p there, btw.

moskito_x said...

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.

moskito_x said...

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.

moskito_x said...

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

moskito_x said...

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.

moskito_x said...

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.

new topic     » goto parent     » topic index » view message » categorize

5. Re: Trying to understand preprocessor

jimcbrown said...
moskito_x said...

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

jimcbrown said...
moskito_x said...

Magic:

After I entered once:

eui eui:datesub.ex thedate.eui 

all other attempts now run.

Weird. You left off the -p there, btw.

Sorry typo: so was correct command: eui -p eui:datesub.ex thedate.eui

jimcbrown said...
moskito_x said...

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/%Y 
to
-p dex:datesub.ex: %m/%d/%Y 

moskito x

new topic     » goto parent     » topic index » view message » categorize

6. Re: Trying to understand preprocessor

moskito_x said...

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/%Y 
to
-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 

new topic     » goto parent     » topic index » view message » categorize

7. Re: Trying to understand preprocessor

jimcbrown said...

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.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu