Commits

Pjotr Kourzanov  committed 4399965

cleanups

  • Participants
  • Parent commits 7918ac0

Comments (0)

Files changed (1)

File src/sequel/beseq.nw

 
 <<libraries>>=
 (library ssax-sxml)
+(library glpk)
 
 @ Entry point to the tool.
 
 <<main>>=
 <<Miscellaneous>>
 <<process>>
-(define (main . args)
+(define (main args)
    (printf "starting ~a ~a~n" (car args) (cdr args))
    (let ([input (args-ref args 1 "test.gxf")])
       (with-input-from-file input
 					       `(@noname . (@unknown @void)))]
 				     [buf (cadr info)]
 				     [rate (cddr info)])
-				 (@ buf "+" (%(if [eq? edge-occs #f] 0
+				 (@ "&" buf "[" (%(if [eq? edge-occs #f] 0
 						  (let* ([adm (assq buf edge-occs)]
-							 [old-adm (tree-copy adm)]
-							 [new-adm (cons (modulo (+ (cadr adm)
-										   (if [is-const p] rate 0))
-										(cdddr adm))
-									(cons (modulo (+ (caddr adm)
-											 (if [is-not-const p] rate 0))
-										      (cdddr adm))
-									      (cdddr adm)))])
+							 [old-rp (cadr adm)]
+							 [old-wp (caddr adm)]
+							 [bufsize (cdddr adm)]
+							 [new-adm (cons (modulo (+ old-rp (if [is-const p] rate 0)) bufsize)
+								  (cons (modulo (+ old-wp (if [is-const p] 0 rate)) bufsize)
+									(cdddr adm)))])
 						     (set-cdr! adm new-adm)
 						     ;(out new-adm)
-						     (if [is-const p]
-							 (cadr old-adm)
-							 (caddr old-adm)))))))
+						     (if [is-const p] old-rp old-wp))))
+				    "]"))
 			      )))))
 	    ");")
     ))
 		,@(gxf:collapsed-ports in)
 		(meta (@ (id "passthrough"))
 		      (code (@ (context "iterative"))
-			    ,(lfold< @ "CDATA[\n" (let ([x (sxml:string->xml (gxf:collapse-code in))])
-								 `(,x))
+			    ,(lfold< @ "CDATA[\n" `(,(gxf:collapse-code in))
+				     ;(let ([x (sxml:string->xml (gxf:collapse-code in))]) `(,x))
 				     ))))))))
 
 @ Invoke the main with some default parameters (if inside custom interpreter such as \verb|limette|)
    
 <<Interpreted.scm>>=
-(main 'beseq "/tmp/test.gxf"))
+(main '(beseq "/tmp/test.gxf"))
 
 @ \section{Miscellaneous}\label{sec:misc}