# SPDX-FileCopyrightText: 2021 RizinOrg <info@rizin.re>
# SPDX-License-Identifier: LGPL-3.0-only
---
name: cmd_interpret
commands:
  - name: .
    cname: interpret
    summary: >
      Repeat last executed command backward / Interpret the output of the
      command as rizin commands
    args:
      - name: cmd
        type: RZ_CMD_ARG_TYPE_CMD
        optional: true
        no_space: true
  - name: ". "
    cname: interpret_script
    summary: Interpret script
    args:
      - name: file.rz
        type: RZ_CMD_ARG_TYPE_FILE
        no_space: true
  - name: ...
    cname: repeat_forward
    summary: Repeat last executed command forward (same as \\n)
    args: []
  - name: ..
    cname: interpret_output
    summary: Run the output of the execution of a script as rizin commands
    args:
      - name: file
        type: RZ_CMD_ARG_TYPE_FILE
  - name: .-
    cname: interpret_editor_2
    summary: Open cfg.editor and interpret tmp file
    args: []
  - name: .*
    cname: interpret_pipe
    summary: >
      Same as #!pipe open cfg.editor and interpret tmp file
    args:
      - name: file
        type: RZ_CMD_ARG_TYPE_FILE
  - name: .(
    cname: interpret_macro
    summary: Call macro
    args:
      - name: macro-name
        type: RZ_CMD_ARG_TYPE_MACRO
        no_space: true
      - name: macro-arg
        type: RZ_CMD_ARG_TYPE_RAW
        flags: RZ_CMD_ARG_FLAG_ARRAY
        optional: true
      - name: )
        type: RZ_CMD_ARG_TYPE_FAKE
  - name: ..(
    cname: interpret_macro_multiple
    summary: Call macro multiple times
    description: >
      Call a macro multiple times with arguments taken n at a time, where n is
      the number of macro arguments
    args_str: "<macro-name> [<set1-arg1> <set1-arg2> ...] [<set2-arg1> <set2-arg2> ...] ...)"
    args:
      - name: macro-name
        type: RZ_CMD_ARG_TYPE_MACRO
        no_space: true
      - name: macro-arg-set
        type: RZ_CMD_ARG_TYPE_RAW
        flags: RZ_CMD_ARG_FLAG_ARRAY
        optional: true
      - name: )
        type: RZ_CMD_ARG_TYPE_FAKE
    details:
      - name: Example
        entries:
          - text: (
            arg_str: "wv2 word addr; wv2 $0 @ $1)"
            comment: Define wv2 macro with word($0) and addr($1) args
          - text: ..(
            arg_str: "wv2 128 0x804800 256 0x804900)"
            comment: Write 2 words at 2 different addresses
