diff options
| author | herbelin | 2003-10-10 17:49:14 +0000 |
|---|---|---|
| committer | herbelin | 2003-10-10 17:49:14 +0000 |
| commit | 2adb1d2aff79adbec1660df191d076e1900944ce (patch) | |
| tree | febe20a6a64225e5266c182d75bd773cd8869eaa /lib/edit.ml | |
| parent | cc1b83979b9978fb2979ae8cda86daddaa62badb (diff) | |
Gestion en temps constant de la pile des Unfo
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@4560 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib/edit.ml')
| -rw-r--r-- | lib/edit.ml | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/edit.ml b/lib/edit.ml index 04a382a586..6ffc6c850d 100644 --- a/lib/edit.ml +++ b/lib/edit.ml @@ -59,9 +59,7 @@ let read e = | None -> None | Some d -> let (bs,c) = Hashtbl.find e.buf d in - (match Bstack.top bs with - | None -> anomaly "Edit.read" - | Some v -> Some(d,v,c)) + Some(d,Bstack.top bs,c) let mutate e f = match e.focus with @@ -82,16 +80,15 @@ let undo e n = | None -> invalid_arg "Edit.undo" | Some d -> let (bs,_) = Hashtbl.find e.buf d in - if Bstack.depth bs <= n then - errorlabstrm "Edit.undo" (str"Undo stack would be exhausted"); - repeat n (fun () -> let _ = Bstack.pop bs in ()) () + repeat n Bstack.pop bs; + if Bstack.depth bs = 1 then + errorlabstrm "Edit.undo" (str"Undo stack exhausted") let create e (d,b,c,udepth) = if Hashtbl.mem e.buf d then errorlabstrm "Edit.create" (str"Already editing something of that name"); - let bs = Bstack.create udepth in - Bstack.push bs b; + let bs = Bstack.create udepth b in Hashtbl.add e.buf d (bs,c) let delete e d = |
