Hi  Manuel,

some tests:

test from Jclass in directory examples of bigloo4.2c release :

;*---------------------------------------------------------------------*/
;*    main ...                                                         */
;*---------------------------------------------------------------------*/

(define-syntax display-msg-symb-nl 
  (syntax-rules ()
    ((_ msg symbl)   (begin
                       (display msg)
                       (display " ")
                       (display (symbol->string (quote symbl)))
                       (display " = ")
                       (display symbl)
                       (newline)))))


(define (main argv)
   (let loop ((num (if (null? (cdr argv))
                       10
                       (string->integer (cadr argv)))))
      (if (<fx num 0)
          (let ((pt (point-new)))
             (print "A interface method: " (intf-met pt))
             (print "A class method: " (point-met pt))
             (point-show pt)
             (newline)
             (print "Number of allocated points: " (point-statistics))
             (print "point-num: " point-num))
          (let ((pt (point-new/int num num)))
             (point-show pt)
             (print "  <-->  Point: " pt " x:" (point-x pt) " y:" (point-y pt))
             (newline)
             (loop (-fx num 1)))))

   (let ((k 3))
     (display-msg-symb-nl "main :: " k)))


result:

[mattei@moita Jclass]$ ./java-test
x= 10 y= 10  <-->  Point: Point@2ef1e4fa x:10 y:10

x= 9 y= 9  <-->  Point: Point@306a30c7 x:9 y:9

x= 8 y= 8  <-->  Point: Point@b81eda8 x:8 y:8

x= 7 y= 7  <-->  Point: Point@68de145 x:7 y:7

x= 6 y= 6  <-->  Point: Point@27fa135a x:6 y:6

x= 5 y= 5  <-->  Point: Point@46f7f36a x:5 y:5

x= 4 y= 4  <-->  Point: Point@421faab1 x:4 y:4

x= 3 y= 3  <-->  Point: Point@2b71fc7e x:3 y:3

x= 2 y= 2  <-->  Point: Point@5ce65a89 x:2 y:2

x= 1 y= 1  <-->  Point: Point@25f38edc x:1 y:1

x= 0 y= 0  <-->  Point: Point@1a86f2f1 x:0 y:0

A interface method: 1
A class method: 1
x= 1 y= 1
Number of allocated points: <callback: 11>
12
point-num: 12
main ::  k = 3

works well .

now in my code (run in  tomcat8) :

(begin
                     (eu.oca.DataBase-executeQueryStatic jstr) ;; equiv 
requetexiste
                     (display-nl  "BiglooCode.scm :: ResultatMesuresF :: 
(java.sql.ResultSet-next eu.oca.DataBase-resultSet)")
                     (java.sql.ResultSet-next eu.oca.DataBase-resultSet)
                     (display-nl  "BiglooCode.scm :: ResultatMesuresF :: 
(java.sql.ResultSet-last eu.oca.DataBase-resultSet)")

                     ;; this is for counting
                     (java.sql.ResultSet-last eu.oca.DataBase-resultSet)
                     (display-nl  "BiglooCode.scm :: ResultatMesuresF :: (set! 
objetexiste (java.sql.ResultSet-getRow eu.oca.DataBase-resultSet))")
                     (set! objetexiste (java.sql.ResultSet-getRow 
eu.oca.DataBase-resultSet))
                     (display-msg-symb-nl  "BiglooCode.scm :: ResultatMesuresF 
::" objetexiste ) ;; je sais pas pourquoi cette macro fais planter bigloo ici 
mais pas dans d'autres situations (symbol->string plante avec le front end java)


result in the tomcat8 logs:

catalina.out:

Sidonie : DataBase : executeQueryStatic : SELECT DISTINCTROW Coordonnées.Nom 
FROM Coordonnées WHERE Coordonnées.Nom Like 'COU 1027'
BiglooCode.scm :: ResultatMesuresF :: (java.sql.ResultSet-next 
eu.oca.DataBase-resultSet)
BiglooCode.scm :: ResultatMesuresF :: (java.sql.ResultSet-last 
eu.oca.DataBase-resultSet)
BiglooCode.scm :: ResultatMesuresF :: (set! objetexiste 
(java.sql.ResultSet-getRow eu.oca.DataBase-resultSet))
BiglooCode.scm :: ResultatMesuresF ::   


[root@moita logs]# cat localhost.2016-10-21.log
21-Oct-2016 16:01:55.852 SEVERE [http-nio-192.168.109.87-8080-exec-131] 
org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for 
servlet [eu.oca.ApplicationConfig] in context with path [/Sidonie] threw 
exception [java.lang.NullPointerException] with root cause
 java.lang.NullPointerException
        at eu.oca.bigloofunct.BiglooCode.ResultatMesuresF(BiglooCode.scm)
        at 
eu.oca.ResultatMesuresF.callBiglooResultatMesuresF(ResultatMesuresF.java:131)
        at eu.oca.ResultatMesuresF.postHandler(ResultatMesuresF.java:114)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
        at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:151)
        at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:171)
        at 
org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:195)
        at 
org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:104)
        at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:402)
        at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:349)
        at 
org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:106)
        at 
org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:259)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
        at 
org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:318)
        at 
org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:236)
        at 
org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1010)
        at 
org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:373)
        at 
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:382)
        at 
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:345)
        at 
org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:220)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at 
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
        at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
        at 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
        at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
        at 
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at 
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

i tried with a quote as you said it:

(define-syntax display-msg-symb-quote-nl 
  (syntax-rules ()
    ((_ msg symbl)   (begin
                       (display msg)
                       (display " ")
                       (display (symbol->string (quote symbl)))
                       (display " = ")
                       (display (quote symbl))
                       (newline)))))

same error

really strange because it works in one code with the java  front-end and not in 
another code,
this not a big problem as it is only a debug macro and the whole code works 
with this simple one:

(define-syntax display-var-nl 
  (syntax-rules ()
    ((_ msg var)   (begin (display msg) (display var) (newline)))))

the compilation process output those:

/home/mattei/bigloo4.2c/bin/bigloo -jvm -c -O +rm -shapem -jvm-purify 
BiglooCode.scm -o eu/oca/bigloofunct/BiglooCode.class

File "BiglooCode.scm", line 582, character 25177:
#                    (eu.oca.DataBase-val db)
#                    ^
*** WARNING:bigloo:cfa
Possible funcall type error -- int

File "BiglooCode.scm", line 585, character 25369:
#                    (eu.oca.DataBase-resultSet db)
#                    ^
*** WARNING:bigloo:cfa
Possible funcall type error -- java.sql.ResultSet

File "BiglooCode.scm", line 2678, character 120244:
#                    (eu.oca.DataBase-val db)
#                    ^
*** WARNING:bigloo:cfa
Possible funcall type error -- int

File "BiglooCode.scm", line 2681, character 120438:
#                    (eu.oca.DataBase-resultSet db)
#                    ^
*** WARNING:bigloo:cfa
Possible funcall type error -- java.sql.ResultSet

File "BiglooCode.scm", line 582, character 25177:
#                    (eu.oca.DataBase-val db)
#                    ^
*** WARNING:bigloo:ResultatMesuresF
Type error --  "procedure" expected, "int" provided

File "BiglooCode.scm", line 585, character 25369:
#                    (eu.oca.DataBase-resultSet db)
#                    ^
*** WARNING:bigloo:ResultatMesuresF
Type error --  "procedure" expected, "java.sql.ResultSet" provided

File "BiglooCode.scm", line 2678, character 120244:
#                    (eu.oca.DataBase-val db)
#                    ^
*** WARNING:bigloo:ResultatMesuresAF
Type error --  "procedure" expected, "int" provided

File "BiglooCode.scm", line 2681, character 120438:
#                    (eu.oca.DataBase-resultSet db)
#                    ^
*** WARNING:bigloo:ResultatMesuresAF
Type error --  "procedure" expected, "java.sql.ResultSet" provided
*** WARNING:bigloo:apply
Method too large. This may cause some troubles to Jvm jits (current size: 8744, 
limit size: 8000).
You should consider splitting this function in small pieces.
*** WARNING:bigloo:clinit
Method too large. This may cause some troubles to Jvm jits (current size: 
16039, limit size: 8000).
You should consider splitting this function in small pieces.
*** WARNING:bigloo:m_eu.oca.bigloofunct.BiglooCode_ResultatMesuresF
Method too large. This may cause some troubles to Jvm jits (current size: 
15711, limit size: 8000).
You should consider splitting this function in small pieces.
*** WARNING:bigloo:m_eu.oca.bigloofunct.BiglooCode_ResultatMesuresAF
Method too large. This may cause some troubles to Jvm jits (current size: 
15382, limit size: 8000).
You should consider splitting this function in small pieces.
echo JavaForBigloo.java:
JavaForBigloo.java:
(export 
CLASSPATH=.:/home/mattei/bigloo4.2c/lib/bigloo/4.2c/bigloo_s.zip:$CLASSPATH; \
           javac -O -d . -Xdiags:verbose JavaForBigloo.java)
/home/mattei/bigloo4.2c/bin/bigloo -jvm BiglooCode.class JavaForBigloo.class  
-o java-test
*** WARNING:bigloo:link
No Bigloo module found for -- JavaForBigloo.class
*** WARNING:bigloo:add-qualified-type!
qualified type redefinition:
  module/class=eu.oca.bigloofunct.BiglooCode
  old qualified type=BiglooCode
  new qualified type=eu.oca.bigloofunct.BiglooCode


i do not know how to use -expand option  (can not find the preprocessed file)


Damien

Le Thursday 20 October 2016 20:21:48 [email protected], vous avez écrit :
> Hi Damien,
> 
> > something i do not understand with bigloo and java front-end and that 
> > causes crash is when i use this macro:
> > 
> >  ;; macros or function to display a variable with a message and add a 
> > newline
> > (define-syntax display-msg-symb-nl 
> >   (syntax-rules ()
> >     ((_ msg symbl)   (begin
> >                    (display msg)
> >                    (display " ")
> >                    (display (symbol->string (quote symbl)))
> >                    (display " = ")
> >                    (display symbl)
> >                    (newline)))))
> > 
> > called like that:
> > (display-msg-symb-nl  "BiglooCode.scm :: ResultatMesuresF ::" objetexiste )
> > 
> > it seems symbol->string make the crash but i had no time to test it, so i 
> > let the problem and i use a simpler macro.
> > 
> > The macro works with others schemes implementation and perheaps with the C 
> > front-end.
> Hard to tell without a concrete example. Using the -expand option might help
> undestand what's wrong. In that particular case, the (display symbl) is
> incorrect as it misses a quote.
> 



-- 
[email protected], [email protected], UNS / OCA / CNRS

Reply via email to