Sisyphus repositório
Última atualização: 1 outubro 2023 | SRPMs: 18631 | Visitas: 37769048
en ru br
ALT Linux repositórios
S:5.4.3-alt1
5.0: 4.10-alt3
4.1: 3.9-alt8.M41.4
4.0: 3.1-alt6
3.0: 2.0-alt0.10.1

Group :: Sistema/Configurações/Rede
RPM: alterator

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: alterator-5.4.1-call-cc-via-shift.patch
Download


diff --git a/alterator/interfaces/guile/algo.scm b/alterator/interfaces/guile/algo.scm
index f2bd440..a773183 100644
--- a/alterator/interfaces/guile/algo.scm
+++ b/alterator/interfaces/guile/algo.scm
@@ -2,8 +2,10 @@
   :use-module (srfi srfi-1)
   :use-module (srfi srfi-11)
   :use-module (srfi srfi-2)
-  :re-export (->bool)
-  :export (
+  :use-module (ice-9 control)
+  :export (->bool
+           call-with-current-continuation
+           call/cc
            ;;public
            cond-car
            cond-cadr
@@ -150,3 +152,13 @@
 (define (dynamic-require library sym)
   (let ((module (resolve-module library)))
     (and module (module-ref module sym #f))))
+
+;; Implement call/cc in terms of shift
+(define (call-with-current-continuation p)
+  (let ((st (current-dynamic-state)))
+    (shift k
+      (with-dynamic-state st
+        (lambda ()
+          (p k))))))
+
+(define call/cc call-with-current-continuation)
diff --git a/alterator/interfaces/guile/telegraph.scm b/alterator/interfaces/guile/telegraph.scm
index 72af7f8..23f5d34 100644
--- a/alterator/interfaces/guile/telegraph.scm
+++ b/alterator/interfaces/guile/telegraph.scm
@@ -1,6 +1,7 @@
 (define-module (alterator telegraph)
   :use-module (alterator algo)
   :use-module (alterator exit-handler)
+  :use-module (ice-9 control)
   :export (telegraph telegraph-start))
 
 (define *modules* #f)
@@ -16,6 +17,8 @@
 (define (telegraph-run cmd modules)
   (if (null? modules)
       cmd
-      ((car modules)
+      ((lambda (cmd next)
+         (reset
+          ((car modules) cmd next)))
        cmd
        (lambda(cmd) (telegraph-run cmd (cdr modules))))))
diff --git a/alterator/interfaces/guile/exit-handler.scm b/alterator/interfaces/guile/exit-handler.scm
index 38a3ca0..022eced 100644
--- a/alterator/interfaces/guile/exit-handler.scm
+++ b/alterator/interfaces/guile/exit-handler.scm
@@ -1,4 +1,5 @@
 (define-module (alterator exit-handler)
+  :use-module (ice-9 control)
   :export (with-exit-handler
            at-exit))
 
@@ -14,7 +15,8 @@
   (with-throw-handler
     #t
     (lambda()
-      (proc)
+      (reset
+       (proc))
       (run-at-exit))
     (lambda args
       (run-at-exit)
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009