* Parse the given message. */
| 785 | * Parse the given message. |
| 786 | */ |
| 787 | Binary *parseMessage(Binary *B, Message &msg) |
| 788 | { |
| 789 | if (msg.method != METHOD_BINARY && B == nullptr) |
| 790 | error("failed to parse message stream; got \"%s\" message (id=%u) " |
| 791 | "before \"binary\" message", getMethodString(msg.method), msg.id); |
| 792 | |
| 793 | switch (msg.method) |
| 794 | { |
| 795 | case METHOD_BINARY: |
| 796 | if (B != nullptr) |
| 797 | error("failed to parse message stream; got duplicate " |
| 798 | "\"binary\" message (id=%u)", msg.id); |
| 799 | return parseBinary(msg); |
| 800 | case METHOD_INSTRUCTION: |
| 801 | parseInstruction(B, msg); |
| 802 | return B; |
| 803 | case METHOD_PATCH: |
| 804 | parsePatch(B, msg); |
| 805 | return B; |
| 806 | case METHOD_EMIT: |
| 807 | parseEmit(B, msg); |
| 808 | return B; |
| 809 | case METHOD_RESERVE: |
| 810 | parseReserve(B, msg); |
| 811 | return B; |
| 812 | case METHOD_TRAMPOLINE: |
| 813 | parseTrampoline(B, msg); |
| 814 | return B; |
| 815 | case METHOD_OPTIONS: |
| 816 | parseOptions(B, msg); |
| 817 | return B; |
| 818 | default: |
| 819 | error("failed to parse message stream; got unknown message " |
| 820 | "method (id=%u)", msg.id); |
| 821 | } |
| 822 | } |
| 823 |
no test coverage detected