just as a followup .. this is the solution I got from hoek when I reposted
it on the irc

(defn emit-giws-xml [c]
  (let [package (.getPackage c)
        methods (map #(hash-map :name (.getName %)
                                :returnType (str (.getName (.getReturnType %)))

                                :params (map (fn [p] {:name (.getName %)})
                                             (.getParameterTypes %)))
                     (.getMethods c))]
    methods
    ))

(clojure.pprint/pprint (emit-giws-xml Object))

http://gist.github.com/569861


On Wed, Sep 8, 2010 at 11:01 AM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:

> Hello everybody,
>  I recently came across giws
>
> http://www.scilab.org/products/other/giws
>
> a tool to call java code from c/c++ all it really needs to generate all the
> jni-wrappers is a simple xml file which indicates the class name and the
> member functions .. some thing as simple as ...
>
> <package name="example2">
>   <object name="MyObjectWithArray">
>         <method name="getMyString" returnType="String[]">
>         </method>
>         <method name="getMyInts" returnType="int[]">
>         </method>
>         <method name="doNothingPleaseButDisplay" returnType="void">
>           <param type="int[]" name="plop" />
>           <param type="short[]" name="plop2" />
>         </method>
>         <method name="setMyStrings" returnType="void">
>           <param type="String[]" name="plop" />
>         </method>
>         <method name="dealingWithBooleans" returnType="boolean[]">
>           <param type="boolean[]" name="plop" />
>         </method>
>   </object>
> </package>
>
> given clojure's power of macros .. it should be possible to automate the
> creation of this xml for every clojure-structure and function by redefining
> the *defstruct* and *defn * and other similar macros .. I would like to
> give it a shot .. I am kind of new to all these things .. so would like to
> hear what the clojure community has to say about this...
>
> Thanks in advance,
> Sunil.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to