(index ("java" 0) ("java-enable-cache" 1965) ("java-run" 2228) ("java-stop" 2865) ("java-send" 2953) ("java-import" 3088) ("java-ref" 3278) ("java-object?" 3623))
(def (sig (syntax "(java SYMBOL)" (id java))) (p "Returns the value represented by " (tt "SYMBOL") " which should designate a Java class, field, or method, using `Java Dot' notation:") (table (tr (td "Syntax") (td "Type of Member") (td "Example")) "\n" (tr (td "\".\" at the end") (td "constructor") (td (tt "((java Font.) NAME STYLE SIZE)"))) "\n" (tr (td "\".\" at the beginning") (td "instance member") (td (tt "((java .setFont) COMP FONT)"))) "\n" (tr (td "\".\" at beginning and \"$\" at the end") (td "instance field") (td (tt "(define (mycar x) ((java .first$) x))") "\n" (tt "(define (myset-car! x y) ((java .first$) x y))"))) "\n" (tr (td "\".\" only in the middle") (td "static member") (td (tt "((java Math.round) 123.456)"))) "\n" (tr (td "\".class\" suffix") (td "Java class") (td (tt "(java Font.class)"))) "\n" (tr (td "\"$\" at the end") (td "static field") (td (tt "(java Font.BOLD$)") "\n" (tt "(set! (java \"U.useJavaSyntax$\") #t)"))) "\n" (tr (td "\"$\" in the middle") (td "inner class") (td (tt "(java java.awt.geom.Point2D$Double.class)"))) "\n" (tr (td "\"$\" at the beginning") (td "packageless class") (td (tt "(java $ParseDemo.class)"))) "\n" (tr (td "\"#\" at the end") (td "allow private access") (td (tt "((java .name$#) ((java Symbol.#) \"abc\"))")))) (p "Notes:") (p "* Each evaluation of the " (tt "java") " macro sends an expression to the java process and receives a result expression. Since most of the results will stay constant throughout the lifetime of the session (as they refer to classes, fields and methods), they are cached and subsequent evaluation of the same " (tt "(java ...)") " expression will refer to the cached value instead. You can disable this caching (in case you are doing rather funky things) with the help of the " (tt "java-enable-cache") " form (see below).") (p "* Java objects which are returned from the Java-side can be safely used and are only garbage collected when no more references exist."))
(def (sig (syntax "(java-enable-cache FLAG)" (id java-enable-cache))) (p "Enables or disables caching of results returned by the " (tt "java") " macro. " (tt "FLAG") " should be either the symbol " (tt "on") " or " (tt "off") ". Caching is enabled by default."))
(def (sig (procedure "(java-run #!key java jar debug options classpath)" (id java-run))) (p "Starts the java-VM as a subprocess, with any additional arguments customizing the JVM invocation. " (tt "java") " specifies the jvm executable and defaults to " (tt "java") ". " (tt "jar") " gives the location of the jscheme jar file, " (tt "options") " and " (tt "classpath") " can be used to customize where the JVM should search for support classes and libraries, together with JVM specific options.") (p "Passing " (tt "#t") " for the " (tt "debug") " parameter will print information about the message flow between CHICKEN and jscheme."))
(def (sig (procedure "(java-stop)" (id java-stop))) (p "Terminates the java process."))
(def (sig (procedure "(java-send EXPR)" (id java-send))) (p "Send an expression to Java and returns whatever result is passed back."))
(def (sig (procedure "(java-import STRING ...)" (id java-import))) (p "Imports Java packages. " (tt "STRING") " should be a qualified package identifier, like " (tt "\"java.lang.*\"") "."))
(def (sig (procedure "(java-ref NAME)" (id java-ref))) (p "References or sets a static field. Setting static fields is supported through a " (link "http://srfi.schemers.org/srfi-17/srfi-17.html" "SRFI-17") " setter, as in the example above. Since the field-name is evaluated before being sent to the java-process, pass the field as a string."))
(def (sig (procedure "(java-object? X)" (id java-object?))) (p "Returns " (tt "#t") " if " (tt "X") " is a raw Java object (that can not be meaningfully converted into a Scheme value)."))
