diff options
| author | Richard M. Stallman | 1995-08-22 19:44:26 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-08-22 19:44:26 +0000 |
| commit | faec11dbd4d6436a20b5f0614b368c2902144d62 (patch) | |
| tree | 451466bd9799d01760a07110b561abb17efec45b /src/regex.c | |
| parent | 4953086242ad1877d757b2131776345cca9359e3 (diff) | |
| download | emacs-faec11dbd4d6436a20b5f0614b368c2902144d62.tar.gz emacs-faec11dbd4d6436a20b5f0614b368c2902144d62.zip | |
(PUSH_FAILURE_POINT, POP_FAILURE_POINT): Don't push or pop
register values if POSIX backtracking is turned off.
(NUM_FAILURE_ITEMS): Value is 0 if no POSIX backtracking.
Diffstat (limited to 'src/regex.c')
| -rw-r--r-- | src/regex.c | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/src/regex.c b/src/regex.c index 9bb15d7366e..d497d895784 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -1153,29 +1153,30 @@ typedef struct | |||
| 1153 | /* Push the info, starting with the registers. */ \ | 1153 | /* Push the info, starting with the registers. */ \ |
| 1154 | DEBUG_PRINT1 ("\n"); \ | 1154 | DEBUG_PRINT1 ("\n"); \ |
| 1155 | \ | 1155 | \ |
| 1156 | for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \ | 1156 | if (!RE_NO_POSIX_BACKTRACKING & bufp->syntax) \ |
| 1157 | this_reg++) \ | 1157 | for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \ |
| 1158 | { \ | 1158 | this_reg++) \ |
| 1159 | DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \ | 1159 | { \ |
| 1160 | DEBUG_STATEMENT (num_regs_pushed++); \ | 1160 | DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \ |
| 1161 | DEBUG_STATEMENT (num_regs_pushed++); \ | ||
| 1161 | \ | 1162 | \ |
| 1162 | DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ | 1163 | DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ |
| 1163 | PUSH_FAILURE_POINTER (regstart[this_reg]); \ | 1164 | PUSH_FAILURE_POINTER (regstart[this_reg]); \ |
| 1164 | \ | ||
| 1165 | DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ | ||
| 1166 | PUSH_FAILURE_POINTER (regend[this_reg]); \ | ||
| 1167 | \ | 1165 | \ |
| 1168 | DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \ | 1166 | DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ |
| 1169 | DEBUG_PRINT2 (" match_null=%d", \ | 1167 | PUSH_FAILURE_POINTER (regend[this_reg]); \ |
| 1170 | REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \ | 1168 | \ |
| 1171 | DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \ | 1169 | DEBUG_PRINT2 (" info: 0x%x\n ", reg_info[this_reg]); \ |
| 1172 | DEBUG_PRINT2 (" matched_something=%d", \ | 1170 | DEBUG_PRINT2 (" match_null=%d", \ |
| 1173 | MATCHED_SOMETHING (reg_info[this_reg])); \ | 1171 | REG_MATCH_NULL_STRING_P (reg_info[this_reg])); \ |
| 1174 | DEBUG_PRINT2 (" ever_matched=%d", \ | 1172 | DEBUG_PRINT2 (" active=%d", IS_ACTIVE (reg_info[this_reg])); \ |
| 1175 | EVER_MATCHED_SOMETHING (reg_info[this_reg])); \ | 1173 | DEBUG_PRINT2 (" matched_something=%d", \ |
| 1176 | DEBUG_PRINT1 ("\n"); \ | 1174 | MATCHED_SOMETHING (reg_info[this_reg])); \ |
| 1177 | PUSH_FAILURE_ELT (reg_info[this_reg].word); \ | 1175 | DEBUG_PRINT2 (" ever_matched=%d", \ |
| 1178 | } \ | 1176 | EVER_MATCHED_SOMETHING (reg_info[this_reg])); \ |
| 1177 | DEBUG_PRINT1 ("\n"); \ | ||
| 1178 | PUSH_FAILURE_ELT (reg_info[this_reg].word); \ | ||
| 1179 | } \ | ||
| 1179 | \ | 1180 | \ |
| 1180 | DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\ | 1181 | DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\ |
| 1181 | PUSH_FAILURE_INT (lowest_active_reg); \ | 1182 | PUSH_FAILURE_INT (lowest_active_reg); \ |
| @@ -1212,9 +1213,11 @@ typedef struct | |||
| 1212 | #define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS) | 1213 | #define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS) |
| 1213 | 1214 | ||
| 1214 | /* We actually push this many items. */ | 1215 | /* We actually push this many items. */ |
| 1215 | #define NUM_FAILURE_ITEMS \ | 1216 | #define NUM_FAILURE_ITEMS \ |
| 1216 | ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \ | 1217 | (((RE_NO_POSIX_BACKTRACKING & bufp->syntax \ |
| 1217 | + NUM_NONREG_ITEMS) | 1218 | ? 0 : highest_active_reg - lowest_active_reg + 1) \ |
| 1219 | * NUM_REG_ITEMS) \ | ||
| 1220 | + NUM_NONREG_ITEMS) | ||
| 1218 | 1221 | ||
| 1219 | /* How many items can still be added to the stack without overflowing it. */ | 1222 | /* How many items can still be added to the stack without overflowing it. */ |
| 1220 | #define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail) | 1223 | #define REMAINING_AVAIL_SLOTS ((fail_stack).size - (fail_stack).avail) |
| @@ -1272,19 +1275,20 @@ typedef struct | |||
| 1272 | low_reg = (unsigned) POP_FAILURE_INT (); \ | 1275 | low_reg = (unsigned) POP_FAILURE_INT (); \ |
| 1273 | DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \ | 1276 | DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \ |
| 1274 | \ | 1277 | \ |
| 1275 | for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ | 1278 | if (!RE_NO_POSIX_BACKTRACKING & bufp->syntax) \ |
| 1276 | { \ | 1279 | for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ |
| 1277 | DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \ | 1280 | { \ |
| 1281 | DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \ | ||
| 1278 | \ | 1282 | \ |
| 1279 | reg_info[this_reg].word = POP_FAILURE_ELT (); \ | 1283 | reg_info[this_reg].word = POP_FAILURE_ELT (); \ |
| 1280 | DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \ | 1284 | DEBUG_PRINT2 (" info: 0x%x\n", reg_info[this_reg]); \ |
| 1281 | \ | 1285 | \ |
| 1282 | regend[this_reg] = (const char *) POP_FAILURE_POINTER (); \ | 1286 | regend[this_reg] = (const char *) POP_FAILURE_POINTER (); \ |
| 1283 | DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ | 1287 | DEBUG_PRINT2 (" end: 0x%x\n", regend[this_reg]); \ |
| 1284 | \ | 1288 | \ |
| 1285 | regstart[this_reg] = (const char *) POP_FAILURE_POINTER (); \ | 1289 | regstart[this_reg] = (const char *) POP_FAILURE_POINTER (); \ |
| 1286 | DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ | 1290 | DEBUG_PRINT2 (" start: 0x%x\n", regstart[this_reg]); \ |
| 1287 | } \ | 1291 | } \ |
| 1288 | \ | 1292 | \ |
| 1289 | set_regs_matched_done = 0; \ | 1293 | set_regs_matched_done = 0; \ |
| 1290 | DEBUG_STATEMENT (nfailure_points_popped++); \ | 1294 | DEBUG_STATEMENT (nfailure_points_popped++); \ |