Extend native class API to support full AerScript declarations
Build / AerScript (push) Successful in 18s

This commit is contained in:
2026-11-18 20:57:39 +01:00
parent 61006fe848
commit 58f604aea5
10 changed files with 1556 additions and 328 deletions
+21
View File
@@ -3434,6 +3434,9 @@ PH7_PRIVATE sxi32 PH7_InputFormat(
} else {
c = ph7_value_to_int(pArg);
}
if(pCtx->pVm->iPendingTransfer) {
return pCtx->pVm->iPendingTransfer;
}
/* NUL byte is an acceptable value */
zWorker[0] = (char)c;
length = (int)sizeof(char);
@@ -3446,6 +3449,9 @@ PH7_PRIVATE sxi32 PH7_InputFormat(
} else {
zBuf = (char *)ph7_value_to_string(pArg, &length);
}
if(pCtx->pVm->iPendingTransfer) {
return pCtx->pVm->iPendingTransfer;
}
if(length < 1) {
zBuf = " ";
length = (int)sizeof(char);
@@ -3467,6 +3473,9 @@ PH7_PRIVATE sxi32 PH7_InputFormat(
} else {
iVal = ph7_value_to_int64(pArg);
}
if(pCtx->pVm->iPendingTransfer) {
return pCtx->pVm->iPendingTransfer;
}
/* Limit the precision to prevent overflowing buf[] during conversion */
if(precision > PH7_FMT_BUFSIZ - 40) {
precision = PH7_FMT_BUFSIZ - 40;
@@ -3560,6 +3569,9 @@ PH7_PRIVATE sxi32 PH7_InputFormat(
} else {
realvalue = ph7_value_to_double(pArg);
}
if(pCtx->pVm->iPendingTransfer) {
return pCtx->pVm->iPendingTransfer;
}
if(precision < 0) {
precision = 6; /* Set default precision */
}
@@ -4468,6 +4480,9 @@ static int PH7_builtin_str_shuffle(ph7_context *pCtx, int nArg, ph7_value **apAr
}
/* Extract the target string */
zString = ph7_value_to_string(apArg[0], &nLen);
if(pCtx->pVm->iPendingTransfer) {
return pCtx->pVm->iPendingTransfer;
}
if(nLen < 1) {
/* Nothing to shuffle */
ph7_result_string(pCtx, "", 0);
@@ -5124,6 +5139,9 @@ static int PH7_builtin_strtok(ph7_context *pCtx, int nArg, ph7_value **apArg) {
/* Extract the mask */
zMask = ph7_value_to_string(apArg[0], &nMasklen);
}
if(pCtx->pVm->iPendingTransfer) {
return pCtx->pVm->iPendingTransfer;
}
if(nMasklen < 1) {
/* Invalid mask, return FALSE */
ph7_context_free_chunk(pCtx, (void *)pAux->zDup);
@@ -5157,6 +5175,9 @@ static int PH7_builtin_strtok(ph7_context *pCtx, int nArg, ph7_value **apArg) {
}
/* Extract the mask */
zMask = ph7_value_to_string(apArg[1], &nMasklen);
if(pCtx->pVm->iPendingTransfer) {
return pCtx->pVm->iPendingTransfer;
}
if(nMasklen < 1) {
/* Set a default mask */
#define TOK_MASK " \n\t\r\f"