hello and happy new year,

i have this funny error when running bigloo with java front end:

BiglooCode.scm :: ResultatMesuresF :: identificateur = Nom
BiglooCode.scm :: ResultatMesuresF :: objet = cocorico

File "BiglooCode.scm", line 247, character 6239:
#  (if-t (string=? identificateur "")
#  ^
*** ERROR:ResultatMesuresF
Type "bstring" expected, "bstring" provided -- Nom

bigloo.bexception
        at bigloo.foreign.jumpexit(foreign.java:4941)
        at bigloo.runtime.Llib.bexit.unwind-stack-until!(bexit.scm)
        at bigloo.runtime.Llib.error.default-exception-handler(error.scm)
        at bigloo.runtime.Llib.error.raise(error.scm)
        at bigloo.runtime.Llib.error.the_failure(error.scm)
        at bigloo.foreign.fail(foreign.java:5042)
        at eu.oca.bigloofunct.BiglooCode.ResultatMesuresF(BiglooCode.scm)
        at eu.oca.bigloofunct.BiglooCode.start(BiglooCode.scm)
        at eu.oca.bigloofunct.BiglooCode.bigloo_main(BiglooCode.scm)
        at eu.oca.bigloofunct.BiglooCode.main(BiglooCode.scm)


compiler is complaining about Type "bstring" expected, "bstring"
provided ....

here is part of  the code:
(module eu.oca.bigloofunct.BiglooCode

        (java
        
         ;;(class %jobject "java.lang.Object")
         ;;(class %jstring::%jobject "java.lang.String")
        
         (array int* ::int)
         (array byte* ::byte)
         (array byte** ::byte*)
        
         ;;(array string* ::string)
         ;;(array jstring* ::%jstring)
        
         (class eu.oca.bigloofunct.JavaForBigloo
                (method static hello::int (::int*) "hello")
                (method static displayByteArrayString::void (::byte**)
"displayByteArrayString")
                "eu.oca.bigloofunct.JavaForBigloo")

         ) ;; end java
       
        (export (callback::int ::int))
        ;(export (affichen::nil ::bstring))
        (export (affichen::nil ::byte*))
        (export (affiche::nil ::byte*))
       
        (export (squareJavaArray::int* ::int*))
        (export (displayArrayByteStar::nil  ::byte**))
        (export (displayReverseArrayByteStar::nil  ::byte**))
        (export (reverseArrayByteStar::byte**  ::byte**))

        (export (ResultatMesuresF::byte* ::byte* ::byte*))

        (main start))


(define (start argv)
 
  (let* (
      
        (identificateur "Nom")
        (objet "cocorico")
        (bstr_identificateur (make-byte* (string-length identificateur)))
        (bstr_objet (make-byte* (string-length objet))))


    (set! bstr_identificateur identificateur)
    (set! bstr_objet objet)

(ResultatMesuresF bstr_identificateur bstr_objet)
    (newline)


    )
 
  )


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

(define-syntax if-t
  (syntax-rules ()
    ((_ tst ev)  (if tst ev '()))
    ((_ tst ev ...)  (if tst (begin ev ...) '()))
))


(define (ResultatMesuresF identificateur objet)
 
  (display-var-nl "BiglooCode.scm :: ResultatMesuresF :: identificateur
= " identificateur)
  (display-var-nl "BiglooCode.scm :: ResultatMesuresF :: objet = " objet)

 
  (if-t (string=? identificateur "")
  ;;(if-t (equal? identificateur "")
use of equal? instead of string=? solve the problem but
i'm asking what are the difference between a scheme string as "example"
and  a bstring  , i know how to convert java String to byte [] which is
as bstring ,
i cast scheme string to bstring by set!-ing  the var and use
string-append to do the reverse (get a bstring from a standart "scheme
string")
are there other methods to do those conversions or a simpler way to do
the job?

regards,

damien

Reply via email to