This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: packaging classes in kawa
- From: Damien Mattei <damien dot mattei at unice dot fr>
- To: Per Bothner <per at bothner dot com>
- Cc: kawa at sourceware dot org
- Date: Fri, 25 Sep 2015 17:49:27 +0200
- Subject: Re: packaging classes in kawa
- Authentication-results: sourceware.org; auth=none
- References: <1443119328 dot 2480 dot 4 dot camel at german-HP-245-G2-Notebook-PC> <56044CD1 dot 2050802 at bothner dot com> <56050E2E dot 4010902 at unice dot fr> <56050F58 dot 4040507 at unice dot fr> <CAE4XeMCHZVDNEMeHXbBHvsgtUXTTzqknZxuTyWp0og8BWuC_mQ at mail dot gmail dot com> <560547CB dot 4040000 at unice dot fr> <560564EB dot 9040008 at bothner dot com>
i do not understand well...
i have a netbeans project for testing all those stuff:
in java file i have :
package eu.oca;
import gnu.expr.RunnableModule;
import gnu.lists.LList;
import gnu.lists.Pair;
import eu.oca.scheme.Vector2D;
...
/**
* Retrieves representation of an instance of eu.oca.serviceResource
* @return an instance of java.lang.String
*/
@GET
@Produces("text/html")
public String getHtml(
@DefaultValue("toto") @QueryParam("name") String nom
) {
Vector2D vec = new Vector2D( 1, 2);
Object[] lst = {2, 3};
double res=vec.norm();
//Object result = vec.plus.applyN(lst);
LList glst = new LList();
//glst = glst.list2(2,3); // works also
glst = LList.list2(2,3);
Object result0 = vec.plus(glst);
int r = (int) result0;
Pair pair = new Pair(2, LList.Empty);
Pair pair2 = new Pair(3, pair);
LList glst2 = new LList();
glst2 = pair2;
Object result = vec.plus(glst2);
Object result1 = vec.carre(glst);
CreateHTML html = new CreateHTML();
//TODO return proper representation object
return html.getHtml()+"<h1>REST in peace " + nom + " with "+
glst + " r = "+ r +" glst2 : "+glst2+" result : "+result+" result1
:"+result1+" !</h1>";
//throw new UnsupportedOperationException();
}
and a kawa scheme file:
(module-name "eu.oca.scheme.Vector2D")
(define-simple-class Vector2D ()
...
i made a jar file of eu.oca.scheme.Vector2D put it in library in the
project with add jar/folder in the IDE
all compile now very well and run on a tomcat server
this is of course only for testing... i can call kawa scheme function
from a java netbeans project, that was what i wanted.
well ok your right i imported the class, but for netbeans i was forced
to put the kawa generated classes in a package ,i can not import in the
project a simple class with no source code .
Le 25/09/2015 17:14, Per Bothner a Ãcrit :
>
>
> On 09/25/2015 06:10 AM, Damien Mattei wrote:
>> great !
>>
>> so the scheme modules map to java packages...
>
> No, Scheme modules map to Java *classes*.
>
> This is the "module class" itself. They may be additional
> classes (ones defined by define-class/define-simple-class,
> and "frame" classes used for closures). This are all in the same
> package.
> The frame classes are member classes or inner classes.
> A define-class is (by default) a member class of the module class;
> a define-simple-class is (by default) a sibling class (unless it has
> same name as the module class, in which case they are combined).