Emitting JS or PHP without an entry point?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Emitting JS or PHP without an entry point?

edA-qa mort-ora-y
How can I emit JS or PHP code without having a main entry point?

I ideally just want to point to a class hierarchy and tell it to emit
the same hierarchy into PHP or JS.  I don't the resulting code to have
any main-entry point.

How can this be done?

--
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

BigTPoker uses haXe and DHLIB
        http://BigTPoker.com/?source=haxe-list

The dis-Emi-A haXe Library
        http://wiki.disemia.com/HaXe
       
A full set of tools, classes, and support facilities aimed at
simplifying and expediting game creation in Flash 9.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.


--
haXe - an open source web programming language
http://haxe.org

signature.asc (260 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Emitting JS or PHP without an entry point?

Fabien ANTOINE

Maybe if you don't set the -main argument when compiling your project and only list your classes?

i.e.: haxe -js my.js MyClass1 MyClass2...

edA-qa mort-ora-y a écrit :
How can I emit JS or PHP code without having a main entry point?

I ideally just want to point to a class hierarchy and tell it to emit
the same hierarchy into PHP or JS.  I don't the resulting code to have
any main-entry point.

How can this be done?

  


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Emitting JS or PHP without an entry point?

Franco Ponticelli


On Mon, Sep 21, 2009 at 10:36 AM, Fabien Antoine <[hidden email]> wrote:

Maybe if you don't set the -main argument when compiling your project and only list your classes?

i.e.: haxe -js my.js MyClass1 MyClass2...

Yes, this is the correct solution for all the platforms. If you have many independent classes you want to import, you can create a module (ei: ImportAll.hx) that imports them all and compile referring to just that module.

Franco.

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Emitting JS or PHP without an entry point?

edA-qa mort-ora-y
In reply to this post by Fabien ANTOINE
Fabien Antoine wrote:
> Maybe if you don't set the /-main/ argument when compiling your project
> and only list your classes?
> i.e.: haxe -js my.js MyClass1 MyClass2...

Okay, then I come back to a question which may also be relevant for
other platforms.

How can I cause it not to emit all the bootstrapping code? I wish to be
able to combine multiple distinct JS files on the final web-page, but
each of the ones emit by haXe includes all the setup overhead.

Secondly, is there some way I can limit what is emitted. It appears now
to emit all used classes, not just the functions used. This bloating my
resulting JS file.  That is, I'd like that the class I specify on the
command-line have all functions emitted, but then only the *used*
functions in the rest of the code are emitted.

Is this possible?

--
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

BigTPoker uses haXe and DHLIB
        http://BigTPoker.com/?source=haxe-list

The dis-Emi-A haXe Library
        http://wiki.disemia.com/HaXe
       
A full set of tools, classes, and support facilities aimed at
simplifying and expediting game creation in Flash 9.

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.


--
haXe - an open source web programming language
http://haxe.org

signature.asc (260 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Emitting JS or PHP without an entry point?

Fabien ANTOINE
edA-qa mort-ora-y a écrit :
Okay, then I come back to a question which may also be relevant for
other platforms.

How can I cause it not to emit all the bootstrapping code? I wish to be
able to combine multiple distinct JS files on the final web-page, but
each of the ones emit by haXe includes all the setup overhead.

Secondly, is there some way I can limit what is emitted. It appears now
to emit all used classes, not just the functions used. This bloating my
resulting JS file.  That is, I'd like that the class I specify on the
command-line have all functions emitted, but then only the *used*
functions in the rest of the code are emitted.

Is this possible?
  

Yes it is, but it's a little restrictive.

You can use the -exclude ExcludedClass argument to exclude all the class you don't want to generate.
You have to pass as many "-exclude" as class to exclude.

Fabien


--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Emitting JS or PHP without an entry point?

Franco Ponticelli

You can use the -exclude ExcludedClass argument to exclude all the class you don't want to generate.
You have to pass as many "-exclude" as class to exclude.

-exclude accepts a file name containing a class per line

Franco

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Emitting JS or PHP without an entry point?

Fabien ANTOINE
Franco Ponticelli a écrit :
>
>     You can use the /-exclude ExcludedClass /argument to exclude all
>     the class you don't want to generate.
>     You have to pass as many "-exclude" as class to exclude.
>
>
> -exclude accepts a file name containing a class per line
>
> Franco
Sorry, I was not comfortable with this option. I apologize...

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Emitting JS or PHP without an entry point?

Franco Ponticelli

Sorry, I was not comfortable with this option. I apologize...


No apologies needed .... I do haxe --help all the time ;)

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: Emitting JS or PHP without an entry point?

Martijn Loots
On Mon, 21 Sep 2009, Franco Ponticelli wrote:

>> Sorry, I was not comfortable with this option. I apologize...
>>
>
> No apologies needed .... I do haxe --help all the time ;)
>
Just typing "haxe -h" will do too.. :)

--
-Martijn    @..@    ( Martijn Loots       -  Hengelo  [NL] )
-          (`--')   ( martijn<@>cosix.com -  www.cosix.com )
-         ( >__< )  ----------------------------------------
-         ^^^  ^^^  (   Netwerken, Security, Open Source   )

--
haXe - an open source web programming language
http://haxe.org