From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9008 invoked by alias); 15 May 2017 16:50:09 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 8988 invoked by uid 89); 15 May 2017 16:50:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=HCc:D*fr, toto, H*F:D*eu X-HELO: smtps-n.oca.eu Received: from smtps-n.oca.eu (HELO smtps-n.oca.eu) (192.54.174.167) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 May 2017 16:50:06 +0000 Received: from moita.oca.eu (natoca100-13.unice.fr [134.59.100.13]) by smtps-n.oca.eu (Postfix) with ESMTPSA id A940880518; Mon, 15 May 2017 18:50:07 +0200 (CEST) Date: Mon, 15 May 2017 16:50:00 -0000 From: Damien MATTEI To: Per Bothner Cc: Damien MATTEI , Kawa mailing list Subject: Re: xml literals Message-ID: <20170515165006.GA1743@moita.oca.eu> References: <201705151611.09622.Damien.Mattei@unice.fr> <35f398c9-6053-3103-fc90-4029f8a7f749@bothner.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="UlVJffcvxoiEqYs2" Content-Disposition: inline In-Reply-To: <35f398c9-6053-3103-fc90-4029f8a7f749@bothner.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2017-q2/txt/msg00063.txt.bz2 --UlVJffcvxoiEqYs2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1467 i will try to send you the whole file in attachment, not easy i'm using mutt and i'm a newbie with this command line mail program, i will comment all the include file, i have tested you will get a lot of warnings but should compile anyway, if you just uncomment the (html:td "toto") in file it should display the output error. i try to send it in attachment in another mail... On Mon, May 15, 2017 at 09:06:20AM -0700, Per Bothner wrote: > On 05/15/2017 07:11 AM, Damien MATTEI wrote: > >hello Per, > >i try to use XML literals in code and i have errors i do not have in REPL: > >compiling this: > >(set! html-literal-table-data-code > > (html:td result)) > > > >where result is a string ,or even a simple code: > > > >(html:td "foo") > >i got this error in my code: > >java -cp /usr/local/share/java/kawa-2.1.jar:/home/mattei/NetBeansProjects/Sidonie/build/web/WEB-INF/classes kawa.repl -C DBtoWebObserversKawa.scm > >(compiling DBtoWebObserversKawa.scm to eu.oca.kawafunct.DBtoWebObserversKawa) > >Exception in thread "main" java.lang.Error: gnu.kawa.xml.MakeElement does not implement Externalizable > > at gnu.expr.LitTable.error(LitTable.java:103) > > at gnu.expr.LitTable.writeObject(LitTable.java:271) > > I'm not seeing this. > > Kawa-2.1 is awfully old - however the old kawa-2.1.jar does work for me. > > Perhaps you could post a complete self-contained program? > -- > --Per Bothner > per@bothner.com http://per.bothner.com/ --UlVJffcvxoiEqYs2 Content-Type: application/vnd.lotus-screencam Content-Disposition: attachment; filename="DBtoWebObserversKawa.scm" Content-Transfer-Encoding: quoted-printable Content-length: 14640 ;; Kawa Scheme code for java virtual machine and tomcat web server=0A= =0A= ;; author: Damien Mattei=0A= =0A= ;; compilation method:=0A= =0A= ;; java -cp /usr/local/share/java/kawa-2.1.jar:/home/mattei/NetBeansProject= s/Sidonie/build/web/WEB-INF/classes kawa.repl -C DBtoWebObserversKawa.scm= =0A= ;;=20=0A= ;; to add more tail-calls optimisations:=0A= ;; java -cp /usr/local/share/java/kawa-2.1.jar:/home/mattei/NetBeansProject= s/Sidonie/build/web/WEB-INF/classes kawa.repl --full-tailcalls -C DBtoWebOb= serversKawa.scm=20=0A= ;; jar cf ~/Dropbox/KawaFunctProg.jar eu=0A= =0A= =0A= =0A= (module-name "eu.oca.kawafunct.DBtoWebObserversKawa")=0A= =0A= (require 'regex)=0A= =0A= ;(include-relative "../git/LOGIKI/lib/first-and-rest.scm")=0A= ;(include-relative "../git/LOGIKI/lib/syntactic-sugar.scm") ;; YES in kawa= you can include files from other schemes...=0A= ;(include-relative "../git/LOGIKI/lib/display.scm")=0A= ;(include-relative "../git/LOGIKI/lib/case.scm") ;; for CASE with STRINGS= =0A= ;(include-relative "../git/LOGIKI/lib/list.scm") ;; for remove-last used b= y map.scm=0A= ;(include-relative "../git/LOGIKI/lib/set.scm") ;; for map-nil*=0A= ;(include-relative "../git/LOGIKI/lib/map.scm") ;; for map-nil*=0A= =0A= =0A= =0A= =0A= (define-simple-class DBtoWebObserversKawa ()=0A= =0A= =20=0A= (Nom ::java.lang.String init-keyword: Nom:)=0A= (res ::java.lang.String init-keyword: res:)=0A= =20=20=0A= ((*init*=0A= (nomParam ::java.lang.String)=0A= )=0A= =20=20=20=0A= (set! Nom nomParam)=0A= =20=20=20=0A= #;(work))=0A= =0A= =20=20=0A= ;; Need a default constructor as well.=0A= ((*init*) #!void)=0A= =0A= =20=20=0A= ((work) ::java.lang.String ;; do the job:=0A= =0A= (eu.oca.DataBase:searchDriverStatic)=0A= (display "DBtoWebObserversKawa : work : eu.oca.DataBase:searchDriverStat= ic PASSED")=0A= (newline)=0A= =20=20=20=0A= (eu.oca.DataBase:connectStatic)=0A= (display "DBtoWebObserversKawa : work : eu.oca.DataBase:connectStatic PA= SSED")=0A= (newline)=0A= =0A= (eu.oca.DataBase:createStatementStatic) ;; i put the statement here if i= t's true it can be reused for multiple SQL queries=0A= (display "DBtoWebObserversKawa : work : eu.oca.DataBase:createStatementS= tatic PASSED")=0A= (newline)=0A= =0A= =20=20=20=0A= (let* ((marequete "SELECT * FROM Obs ORDER BY Auteur")=0A= =09=20=20=0A= (rs ::java.sql.ResultSet #!null)=0A= (total '())=0A= (result '())=0A= ;; first we fetch the data "outremer" and parse the file to get the obse= rvers code=0A= (wds-url "http://ad.usno.navy.mil/wds/Webtextfiles/wdsnewref.txt")=0A= ;; (define wds-url "http://ad.usno.navy.mil/wds/Webtextfiles/wdsnewref.t= xt")=0A= (wds-data-str &<{&[wds-url]}) ;; could take a few seconds to GET file=0A= ;; (define wds-data-str &<{&[wds-url]})=0A= ;;(str1 (substring wds-data-str 0 30))=0A= (len-wds-data-str (string-length wds-data-str))=0A= =09=20=20=0A= ;; get and split using positions of the minus ----- lines=0A= (pos-minus=20=20=0A= (regex-match-positions=0A= "---------------------------------------------------------------------= --------------------------------------------------------"=20=0A= wds-data-str))=0A= =09=20=20=0A= (pos-minus-end (cdr (car pos-minus)))=0A= =09=20=20=0A= (wds-data-str-minus-1 (substring=0A= wds-data-str=0A= pos-minus-end=0A= (- (string-length wds-data-str) 1)))=0A= =09=20=20=0A= (pos-minus2=20=20=0A= (regex-match-positions=0A= "---------------------------------------------------------------------= --------------------------------------------------------"=20=0A= wds-data-str-minus-1))=0A= =09=20=20=0A= (pos-minus2-end (cdr (car pos-minus2)))=0A= =09=20=20=0A= (wds-data-str-minus-2 (substring=0A= wds-data-str-minus-1=0A= pos-minus2-end=0A= (- (string-length wds-data-str-minus-1) 1)))=0A= =09=20=20=0A= ;; get and split using positions of the equals =3D=3D=3D=3D=3D=3D line= =0A= (pos-equals=0A= (regex-match-positions=0A= "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D"=0A= wds-data-str-minus-2))=0A= =0A= (pos-equals-begin (car (car pos-equals)))=0A= =0A= (wds-data-str-equals (substring=0A= wds-data-str-minus-2=0A= 0=0A= (- pos-equals-begin 1)))=0A= =0A= ;;(wds-data-str-split (regex-split (string #\return) wds-data-str))=20= =0A= (wds-data-str-split (regex-split (string #\linefeed) wds-data-str-equals= ))=0A= ;; (define wds-data-str-split (regex-split (string #\linefeed) wds-data-= str))=0A= =0A= ;; remove null string=0A= (rgx (begin=20=0A= (display-nl "DBtoWebObserversKawa : work : creating regex.")=0A= (regex "^[a-zA-Z]")))=0A= =0A= (tst-space-string=0A= (lambda (s)=0A= (if (regex-match rgx s)=0A= s=0A= '())))=0A= =0A= (wds-data-str-no-spaces=20=0A= (begin=0A= (display-nl "DBtoWebObserversKawa : work : running map-nil-iter-opt= im-tail-calls-call....")=0A= ( map-nil-iter-optim-tail-calls-call tst-space-string wds-data-str-sp= lit )))=0A= =0A= (html-literal-table-rows '()) ;; rows list of the table of observers=0A= (html-literal-table-data-observer '()) ;; table data : observer=0A= (html-literal-table-data-code '()) ;; table data : code=0A= =09=20=20=0A= ) ;; end of LET=0A= =0A= =0A= (display-nl "DBtoWebObserversKawa : work : after let* declarations.")= =0A= ;;(display-msg-var-nl "DBtoWebObserversKawa : work : str1 =3D " str1)= =0A= (display-msg-var-nl "DBtoWebObserversKawa : work : length wds-data-st= r =3D " len-wds-data-str)=0A= (display-msg-var-nl "DBtoWebObserversKawa : work : (car wds-data-str-= split) =3D " (car wds-data-str-split))=0A= (display-msg-var-nl "DBtoWebObserversKawa : work : (substring wds-dat= a-str-minus-1 0 50) =3D " (substring wds-data-str-minus-1 0 50))=0A= (display-msg-var-nl "DBtoWebObserversKawa : work : (substring wds-dat= a-str-minus-2 0 50) =3D " (substring wds-data-str-minus-2 0 50))=0A= (display-msg-var-nl "DBtoWebObserversKawa : work : (substring wds-dat= a-str-equals 0 50) =3D " (substring wds-data-str-equals 0 50))=0A= (display-msg-var-nl "DBtoWebObserversKawa : work : (cadr wds-data-str= -split) =3D " (cadr wds-data-str-split))=0A= (display-msg-var-nl "DBtoWebObserversKawa : work : (car wds-data-str-= no-spaces) =3D " (car wds-data-str-no-spaces))=0A= =0A= =20=20=20=20=20=20=20=0A= =20=20=20=20=20=0A= ;; partie HTML=0A= =20=20=20=20=20=0A= =20=20=20=20=0A= =0A= (set! res=20=0A= (gnu.lists.FString:toString=0A= (string-append=0A= ""=0A= " "=0A= " "=0A= =09=20=20=20=20=20=0A= #;""=0A= ;;""=0A= =0A= =0A= " Observateurs - Codes"=0A= " "=0A= " "=0A= "

Codes = utilis=C3=A9s pour les Observateurs : classement par ordre alphab=C3=A9tiqu= e des codes"=0A= "

 "=0A= " "= =0A= " "=0A= " "=0A= " "=0A= " "=0A= " "=0A= " ")))=0A= ;;" "=0A= ;; unclosed table (verifier version anglaise)=0A= ;;" "=0A= "
"=0A= " Tout savoir..."=0A= "
"=0A= " Classement par nom= s"=0A= "
")))=0A= =09=20=20=20=20=20=20=0A= =20=20=20=20=20=0A= =20=20=20=20=20=0A= =20=20=20=20=20=0A= ;; converting from SQL server to MySQL (MariaDB)=0A= (set! marequete (sql-server->mysql-server-syntax marequete))=0A= =0A= (display-msg-var-nl "DBtoWebObserversKawa : work : Voila la valeur SQ= L de la requ=C3=A8te : marequete =3D " marequete)=0A= =20=20=20=20=20=0A= (eu.oca.DataBase:executeQueryStatic=20=0A= marequete=0A= "Observateurs")=0A= =0A= (set! rs eu.oca.DataBase:resultSetObservateurs)=0A= =20=20=20=20=20=0A= (rs:first)=0A= =0A= (set! total 0)=0A= =0A= (set! res=0A= (gnu.lists.FString:toString=0A= (string-append=0A= res=20=0A= "

SIDONIe - Statistica= l Results

"=0A= "
"=0A= "
"=0A= " "=0A= " "=0A= " "=0A= " "=0A= "
" "
<= /font>
"=0A= "
"=0A= "
"=0A= "

"=0A= "

"=0A= ""=0A= ""=0A= " "=0A= " "=0A= " "=0A= " "=0A= " "=0A= " "=0A= " "=0A= " "=0A= "")))=0A= =0A= =20=20=20=20=20=0A= (rs:beforeFirst)=0A= =20=20=20=20=20=0A= (when (rs:next) ;; test SQL empty result set=0A= =09=20=20=20=0A= ;; DO WHILE LOOP=0A= =09=09=0A= (while (not (rs:isAfterLast))=0A= =09=09=20=20=20=20=20=20=20=0A= (set! total (+ total 1))=0A= =09=09=20=20=0A= (append-string-to-result "")=0A= =09=09=20=20=20=20=20=20=20=0A= =09=09=20=20=20=20=20=20=20=0A= ;; 0 : code=0A= (set! result (rs:getString 1))=0A= =09=09=20=20=0A= (if (or (rs:wasNull) (string-null? result))=0A= =09=09=20=20=20=20=20=20=0A= (display-nl "DBtoWebObserversKawa : work : result (code) : string = or result set is null")=0A= =09=09=20=20=20=20=20=20=09=09=09=20=20=20=0A= (begin=0A= ;;(append-string-to-result "")))=0A= =09=09=20=20=0A= =09=09=20=20=0A= ;; 1 : auteur (Observer)=0A= (set! result (rs:getString 2))=0A= =09=09=20=20=0A= (if (rs:wasNull)=0A= (set! result "NuLL"))=0A= =09=09=20=20=0A= (append-string-to-result "")=0A= =09=09=20=20=0A= (rs:next)=20=0A= =09=09=20=20=0A= ) ;; end WHILE (Do While ... Loop)=20=0A= =09=20=20=20=0A= ) ;; end when (test empty SQL result set)=0A= =0A= =0A= (display-msg-var-nl "DBtoWebObserversKawa : work : total =3D " total)= =0A= =0A= =0A= (append-string-to-result=20=0A= (string-append=0A= "
NameAlpha 2000"=0A= " Delta 2000BD #ADS #HIP #mag 1mag 2Spectral type
")=0A= ;;(set! html-literal-table-data-code=0A= ;; (html:td result))=0A= ;;(html:td "toto")=0A= (display-msg-var-nl "DBtoWebObserversKawa : work : result (code) =3D " = result)=0A= ;;(append-string-to-result (string-upcase result))=0A= #;(append-string-to-result "")=0A= (display-msg-var-nl "DBtoWebObserversKawa : work : result (Observer) = =3D " result)=0A= (append-string-to-result result)=0A= (append-string-to-result "
=0A=

=0A=

=0A= =0A= =0A= =0A= =0A= =0A=
Number of selected obje= cts
" (number->string total) "
"))=0A= =0A= =09=20=20=0A= =0A= =0A= =20=20=20=20=0A= =0A= ;; we are in jersey/ path of the URL=0A= (append-string-to-result=0A= (string-append=0A= "

"=0A= " Tout savoir...=
"=0A= " "=0A= ""))=0A= =0A= =0A= ) ;; end let*=0A= =20=20=20=0A= (eu.oca.DataBase:closeStatic)=0A= (display "DBtoWebObserversKawa : work : eu.oca.DataBase:closeStatic PASS= ED")=0A= (newline)=0A= =0A= ;; (eu.oca.DataBase:deregisterDriverStatic)=0A= ;; (display "ResultatGeneralFKawa : work : eu.oca.DataBase:deregisterDri= verStatic PASSED")=0A= ;; (newline)=0A= =0A= =20=20=20=0A= ;;(display-msg-var-nl "DBtoWebObserversKawa : work : res =3D " res)=0A= =20=20=20=0A= res) ;; return a String=0A= =20=20=0A= =0A= =0A= =0A= =0A= =0A= =0A= =20=20=0A= ;; other Class definition functions=0A= =0A= =0A= =20=20=0A= ((sql-server->mysql-server-syntax query) ;; replace [ and ] by `=0A= (regex-replace* (regex "\\]") (regex-replace* (regex "\\[") query "`") "= `"))=0A= =0A= =20=20=0A= ((append-string-to-result str) ;; append a string to result=0A= (set! res=0A= (gnu.lists.FString:toString=0A= (string-append res str))))=0A= =0A= =20=20=0A= ((string-null? str)=0A= (string=3D? str ""))=0A= =0A= =20=20=0A= ((fix x)=0A= (display-nl "DBtoWebObserversKawa.scm :: entering fix")=0A= (let ((r (inexact->exact (truncate x))))=0A= (display "ResultatGeneralFKawa.scm :: fix :: r =3D")=0A= (display r)=0A= (newline)=0A= r))=0A= =0A= =20=20=0A= ) ;; end of class=0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= =0A= --UlVJffcvxoiEqYs2--