Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions lib/bap_c/bap_c_abi.ml
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,12 @@ module Arg = struct
| Some (k,x) ->
Some ({self with args = Map.remove self.args k},x)

let popn n self = match Map.split self.args n with
| _,None,_ -> None
| lt,Some (k,x),rt ->
Some ({self with args = Map.add_exn rt k x}, Map.data lt)
let popn n self = match Map.min_elt self.args with
| None -> None
| Some (k,_) -> match Map.split self.args (k+n) with
| _,None,_ -> None
| lt,Some (k,x),rt ->
Some ({self with args = Map.add_exn rt k x}, Map.data lt)

let align n self = match Map.min_elt self.args with
| None -> None
Expand Down Expand Up @@ -448,6 +450,7 @@ module Arg = struct
Arg.return res
let pop s n = update s n File.pop
let popn ~n s a = update s a (File.popn n)
let align ~n s a = update s a (File.align n)
let deplet s n = update s n @@ fun s -> Some (File.deplet s,())
end

Expand Down Expand Up @@ -504,7 +507,7 @@ module Arg = struct

let align_even file =
let* s = Arg.get () in
Arena.popn ~n:2 s file >>| ignore
Arena.align ~n:2 s file >>| ignore

let deplet file =
let* s = Arg.get () in
Expand Down
2 changes: 1 addition & 1 deletion lib/bap_c/bap_c_abi.mli
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ end
function. The DSL describes the semantics of argument passing that
is then reified to the [args] structure. The [DSL] is a choice
monad that enables describing the argument passing grammar using
backtracing when the chosen strategy doesn't fit. The [reject ()]
backtracking when the chosen strategy doesn't fit. The [reject ()]
operator will reject the current computation up until the nearest
choice prompt, e.g., in the following example, computations [e1],
[e2], and [e3] are rejected and any side-effects that they might
Expand Down