Skip to content

Commit

Permalink
add primitive 'set-code-text-command'
Browse files Browse the repository at this point in the history
  • Loading branch information
gfngfn committed Feb 15, 2020
1 parent 460839d commit 030b8e0
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/frontend/bytecomp/vminstdef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ code: |
let mcmd = get_math_command_func reducef valuecmd in
Context(ctx, { ctxsub with math_command = mcmd; })
---
inst: PrimitiveSetCodeTextCommand
is-pdf-mode-primitive: yes
needs-reducef: yes
name: "set-code-text-command"
type: |
~% (tICMD tS @-> tCTX @-> tCTX)
params:
- valuecmd
- (ctx, ctxsub) : context
code: |
let ctcmd = get_code_text_command_func reducef valuecmd in
Context(ctx, { ctxsub with code_text_command = ctcmd; })
---
inst: BackendMathVariantCharDirect
is-pdf-mode-primitive: yes
Expand Down
2 changes: 2 additions & 0 deletions src/frontend/evalUtil.ml
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,8 @@ let get_math_command_func _ valuemcmd =

let make_math_command_func (MathCommand(valuemcmd)) = valuemcmd

let get_code_text_command_func _ valuectcmd =
CodeTextCommand(valuectcmd)

let make_list (type a) (makef : a -> syntactic_value) (lst : a list) : syntactic_value =
List(lst |> List.map makef)
Expand Down
17 changes: 17 additions & 0 deletions tools/gencode/vminst.ml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@ let ctx = HorzBox.({ ctx with math_char_class = mccls; }) in let (_, uchlst) = M
~code:{|
let mcmd = get_math_command_func reducef valuecmd in
Context(ctx, { ctxsub with math_command = mcmd; })
|}
; inst "PrimitiveSetCodeTextCommand"
~name:"set-code-text-command"
~type_:{|
~% (tICMD tS @-> tCTX @-> tCTX)
|}
~fields:[
]
~params:[
param "valuecmd";
param "(ctx, ctxsub)" ~type_:"context";
]
~is_pdf_mode_primitive:true
~needs_reducef:true
~code:{|
let ctcmd = get_code_text_command_func reducef valuecmd in
Context(ctx, { ctxsub with code_text_command = ctcmd; })
|}
; inst "BackendMathVariantCharDirect"
~name:"math-variant-char"
Expand Down

0 comments on commit 030b8e0

Please sign in to comment.