- Timestamp:
- Feb 1, 2015 8:53:48 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/kmk_cc_exec.c
r2771 r2772 746 746 * Emits a kKmkCcExpInstr_Return. 747 747 * 748 * @returns 0 on success, non-zero on failure.749 748 * @param ppBlockTail Pointer to the allocator tail pointer. 750 749 */ 751 static intkmk_cc_exp_emit_return(PKMKCCBLOCK *ppBlockTail)750 static void kmk_cc_exp_emit_return(PKMKCCBLOCK *ppBlockTail) 752 751 { 753 752 PKMKCCEXPCORE pCore = kmk_cc_block_alloc_exp(ppBlockTail, sizeof(*pCore)); 754 753 pCore->enmOpCode = kKmkCcExpInstr_Return; 755 return 0;756 754 } 757 755 … … 912 910 * @param cMaxArgs Maximum number of arguments the function takes. 913 911 */ 914 static intkmk_cc_exp_emit_plain_function(PKMKCCBLOCK *ppBlockTail, const char *pszFunction,915 const char *pchArgs, uint32_t cchArgs, uint32_t cArgs, char chOpen, char chClose,916 make_function_ptr_t pfnFunction, unsigned char cMaxArgs)912 static void kmk_cc_exp_emit_plain_function(PKMKCCBLOCK *ppBlockTail, const char *pszFunction, 913 const char *pchArgs, uint32_t cchArgs, uint32_t cArgs, char chOpen, char chClose, 914 make_function_ptr_t pfnFunction, unsigned char cMaxArgs) 917 915 { 918 916 uint32_t iArg; … … 977 975 kmk_cc_block_realign(ppBlockTail); 978 976 pInstr->Core.pNext = (PKMKCCEXPCORE)kmk_cc_block_get_next_ptr(*ppBlockTail); 979 return 0;980 977 } 981 978 … … 1011 1008 * kKmkCcExpInstr_SearchAndReplacePlainVariable instruction. 1012 1009 * 1013 * @returns 0 on success, non-zero on failure.1014 1010 * @param ppBlockTail Pointer to the allocator tail pointer. 1015 1011 * @param pchName The name of the variable. (Does not need to be … … 1018 1014 * nothing will be emitted. 1019 1015 */ 1020 static intkmk_cc_exp_emit_plain_variable_maybe_sr(PKMKCCBLOCK *ppBlockTail, const char *pchName, uint32_t cchName)1016 static void kmk_cc_exp_emit_plain_variable_maybe_sr(PKMKCCBLOCK *ppBlockTail, const char *pchName, uint32_t cchName) 1021 1017 { 1022 1018 if (cchName > 0) … … 1100 1096 } 1101 1097 } 1102 return 0;1103 1098 } 1104 1099 … … 1107 1102 * Emits a kKmkCcExpInstr_CopyString. 1108 1103 * 1109 * @returns 0 on success, non-zero on failure.1110 1104 * @param ppBlockTail Pointer to the allocator tail pointer. 1111 1105 * @param pchStr The string to emit (ASSUMED presistent thru-out … … 1114 1108 * will be emitted. 1115 1109 */ 1116 static intkmk_cc_exp_emit_copy_string(PKMKCCBLOCK *ppBlockTail, const char *pchStr, uint32_t cchStr)1110 static void kmk_cc_exp_emit_copy_string(PKMKCCBLOCK *ppBlockTail, const char *pchStr, uint32_t cchStr) 1117 1111 { 1118 1112 if (cchStr > 0) … … 1123 1117 pInstr->pachSrc = pchStr; 1124 1118 } 1125 return 0;1126 1119 } 1127 1120 … … 1161 1154 * (kmk_cc_exp_emit_copy_string ignore zero length strings). 1162 1155 */ 1163 rc = kmk_cc_exp_emit_copy_string(ppBlockTail, pchStr, offDollar + cDollars / 2); 1164 if (rc != 0) 1165 return rc; 1156 kmk_cc_exp_emit_copy_string(ppBlockTail, pchStr, offDollar + cDollars / 2); 1166 1157 pchStr += offDollar + cDollars; 1167 1158 cchStr -= offDollar + cDollars; … … 1292 1283 } 1293 1284 if (!fExpandArgs || cDollars == 0) 1294 rc =kmk_cc_exp_emit_plain_function(ppBlockTail, pszFunction, pchStr, cchName,1295 1285 kmk_cc_exp_emit_plain_function(ppBlockTail, pszFunction, pchStr, cchName, 1286 cArgs, chOpen, chClose, pfnFunction, cMaxArgs); 1296 1287 else 1288 { 1297 1289 rc = kmk_cc_exp_emit_dyn_function(ppBlockTail, pszFunction, pchStr, cchName, 1298 1290 cArgs, chOpen, chClose, pfnFunction, cMaxArgs); 1291 if (rc != 0) 1292 return rc; 1293 } 1299 1294 } 1300 1295 else … … 1358 1353 } 1359 1354 if (cDollars == 0) 1360 rc =kmk_cc_exp_emit_plain_variable_maybe_sr(ppBlockTail, pchStr, cchName);1355 kmk_cc_exp_emit_plain_variable_maybe_sr(ppBlockTail, pchStr, cchName); 1361 1356 else 1357 { 1362 1358 rc = kmk_cc_exp_emit_dyn_variable(ppBlockTail, pchStr, cchName); 1359 if (rc != 0) 1360 return rc; 1361 } 1363 1362 } 1364 1363 pchStr += cchName + 1; … … 1368 1367 { 1369 1368 /* Single character variable name. */ 1370 rc =kmk_cc_exp_emit_plain_variable_maybe_sr(ppBlockTail, pchStr, 1);1369 kmk_cc_exp_emit_plain_variable_maybe_sr(ppBlockTail, pchStr, 1); 1371 1370 pchStr++; 1372 1371 cchStr--; 1373 1372 } 1374 if (rc != 0)1375 return rc;1376 1373 } 1377 1374 else … … 1387 1384 * Nothing more to expand, the remainder is a simple string copy. 1388 1385 */ 1389 rc = kmk_cc_exp_emit_copy_string(ppBlockTail, pchStr, cchStr); 1390 if (rc != 0) 1391 return rc; 1386 kmk_cc_exp_emit_copy_string(ppBlockTail, pchStr, cchStr); 1392 1387 break; 1393 1388 } … … 1397 1392 * Emit final instruction. 1398 1393 */ 1399 return kmk_cc_exp_emit_return(ppBlockTail); 1394 kmk_cc_exp_emit_return(ppBlockTail); 1395 return 0; 1400 1396 } 1401 1397
Note:
See TracChangeset
for help on using the changeset viewer.