use 0x0f as magic code begin

This commit is contained in:
lyon 2022-10-27 13:03:25 +08:00
parent 79361f493b
commit 0dc51e23c3
4 changed files with 4 additions and 13 deletions

View File

@ -33,7 +33,7 @@
#include "dataStack.h"
#include "dataStrs.h"
const char magic_code_pyo[] = {0x7f, 'p', 'y', 'o'};
const char magic_code_pyo[] = {0x0f, 'p', 'y', 'o'};
static uint8_t* arg_getBytecode(Arg* self) {
uint8_t* bytecode_file = arg_getBytes(self);

View File

@ -1063,19 +1063,10 @@ void _do_pikaScriptShell(PikaObj* self, ShellConfig* cfg) {
}
/* run xx.py.o */
if (inputChar[0] == 'p' && inputChar[1] == 0x7f) {
char yo[2] = {0};
if (inputChar[0] == 'p' && inputChar[1] == 0x0f) {
for (int i = 0; i < 2; i++) {
/* eat 'yo' */
yo[i] = cfg->fn_getchar();
}
if (!(yo[0] == 'y' && yo[1] == 'o')) {
/* not the magic code, abort */
_do_obj_runChar(self, 0x7f, cfg);
_do_obj_runChar(self, 'p', cfg);
_do_obj_runChar(self, yo[0], cfg);
_do_obj_runChar(self, yo[1], cfg);
continue;
cfg->fn_getchar();
}
uint32_t size = 0;
for (int i = 0; i < 4; i++) {

View File

@ -2,4 +2,4 @@
#define PIKA_VERSION_MINOR 11
#define PIKA_VERSION_MICRO 5
#define PIKA_EDIT_TIME "2022/10/26 20:19:57"
#define PIKA_EDIT_TIME "2022/10/27 13:03:23"