Lines Matching full:ep

92 log_init(SCR *sp, EXF *ep)  in log_init()  argument
96 * ep MAY NOT BE THE SAME AS sp->ep, DON'T USE THE LATTER. in log_init()
102 ep->l_lp = NULL; in log_init()
103 ep->l_len = 0; in log_init()
104 ep->l_cursor.lno = 1; /* XXX Any valid recno. */ in log_init()
105 ep->l_cursor.cno = 0; in log_init()
106 ep->l_high = ep->l_cur = 1; in log_init()
108 ep->log = dbopen(NULL, O_CREAT | O_NONBLOCK | O_RDWR, in log_init()
110 if (ep->log == NULL) { in log_init()
112 F_SET(ep, F_NOLOG); in log_init()
126 log_end(SCR *sp, EXF *ep) in log_end() argument
130 * ep MAY NOT BE THE SAME AS sp->ep, DON'T USE THE LATTER. in log_end()
132 if (ep->log != NULL) { in log_end()
133 (void)(ep->log->close)(ep->log); in log_end()
134 ep->log = NULL; in log_end()
136 free(ep->l_lp); in log_end()
137 ep->l_lp = NULL; in log_end()
138 ep->l_len = 0; in log_end()
139 ep->l_cursor.lno = 1; /* XXX Any valid recno. */ in log_end()
140 ep->l_cursor.cno = 0; in log_end()
141 ep->l_high = ep->l_cur = 1; in log_end()
154 EXF *ep; in log_cursor() local
156 ep = sp->ep; in log_cursor()
157 if (F_ISSET(ep, F_NOLOG)) in log_cursor()
164 if (ep->l_cursor.lno == OOBLNO) { in log_cursor()
165 ep->l_cursor.lno = sp->lno; in log_cursor()
166 ep->l_cursor.cno = sp->cno; in log_cursor()
169 ep->l_cursor.lno = sp->lno; in log_cursor()
170 ep->l_cursor.cno = sp->cno; in log_cursor()
182 EXF *ep; in log_cursor1() local
184 ep = sp->ep; in log_cursor1()
186 BINC_RETC(sp, ep->l_lp, ep->l_len, sizeof(u_char) + sizeof(MARK)); in log_cursor1()
187 ep->l_lp[0] = type; in log_cursor1()
188 memmove(ep->l_lp + sizeof(u_char), &ep->l_cursor, sizeof(MARK)); in log_cursor1()
190 key.data = &ep->l_cur; in log_cursor1()
192 data.data = ep->l_lp; in log_cursor1()
194 if (ep->log->put(ep->log, &key, &data, 0) == -1) in log_cursor1()
198 TRACE(sp, "%lu: %s: %u/%u\n", ep->l_cur, in log_cursor1()
203 ep->l_high = ++ep->l_cur; in log_cursor1()
218 EXF *ep; in log_line() local
223 ep = sp->ep; in log_line()
224 if (F_ISSET(ep, F_NOLOG)) in log_line()
233 F_CLR(ep, F_UNDO); in log_line()
236 if (ep->l_cursor.lno != OOBLNO) { in log_line()
239 ep->l_cursor.lno = OOBLNO; in log_line()
261 ep->l_lp, ep->l_len, in log_line()
263 ep->l_lp[0] = action; in log_line()
264 memmove(ep->l_lp + sizeof(u_char), &lno, sizeof(recno_t)); in log_line()
265 memmove(ep->l_lp + CHAR_T_OFFSET, lp, len * sizeof(CHAR_T)); in log_line()
267 lcur = ep->l_cur; in log_line()
270 data.data = ep->l_lp; in log_line()
272 if (ep->log->put(ep->log, &key, &data, 0) == -1) in log_line()
279 ep->l_cur, lno, len); in log_line()
283 ep->l_cur, lno, len); in log_line()
287 ep->l_cur, lno, len); in log_line()
291 ep->l_cur, lno, len); in log_line()
295 ep->l_cur, lno, len); in log_line()
300 ep->l_high = ++ep->l_cur; in log_line()
318 EXF *ep; in log_mark() local
320 ep = sp->ep; in log_mark()
321 if (F_ISSET(ep, F_NOLOG)) in log_mark()
325 if (ep->l_cursor.lno != OOBLNO) { in log_mark()
328 ep->l_cursor.lno = OOBLNO; in log_mark()
331 BINC_RETC(sp, ep->l_lp, in log_mark()
332 ep->l_len, sizeof(u_char) + sizeof(LMARK)); in log_mark()
333 ep->l_lp[0] = LOG_MARK; in log_mark()
334 memmove(ep->l_lp + sizeof(u_char), lmp, sizeof(LMARK)); in log_mark()
336 key.data = &ep->l_cur; in log_mark()
338 data.data = ep->l_lp; in log_mark()
340 if (ep->log->put(ep->log, &key, &data, 0) == -1) in log_mark()
345 ep->l_cur, lmp->name, lmp->lno, lmp->cno); in log_mark()
348 ep->l_high = ++ep->l_cur; in log_mark()
362 EXF *ep; in log_backward() local
369 ep = sp->ep; in log_backward()
370 if (F_ISSET(ep, F_NOLOG)) { in log_backward()
376 if (ep->l_cur == 1) { in log_backward()
381 F_SET(ep, F_NOLOG); /* Turn off logging. */ in log_backward()
383 key.data = &ep->l_cur; /* Initialize db request. */ in log_backward()
386 --ep->l_cur; in log_backward()
387 if (ep->log->get(ep->log, &key, &data, 0)) in log_backward()
390 log_trace(sp, "log_backward", ep->l_cur, data.data); in log_backward()
396 F_CLR(ep, F_NOLOG); in log_backward()
444 err: F_CLR(ep, F_NOLOG); in log_backward()
464 EXF *ep; in log_setline() local
470 ep = sp->ep; in log_setline()
471 if (F_ISSET(ep, F_NOLOG)) { in log_setline()
477 if (ep->l_cur == 1) in log_setline()
480 F_SET(ep, F_NOLOG); /* Turn off logging. */ in log_setline()
482 key.data = &ep->l_cur; /* Initialize db request. */ in log_setline()
485 --ep->l_cur; in log_setline()
486 if (ep->log->get(ep->log, &key, &data, 0)) in log_setline()
489 log_trace(sp, "log_setline", ep->l_cur, data.data); in log_setline()
494 if (m.lno != sp->lno || ep->l_cur == 1) { in log_setline()
495 F_CLR(ep, F_NOLOG); in log_setline()
502 ++ep->l_cur; in log_setline()
503 F_CLR(ep, F_NOLOG); in log_setline()
534 err: F_CLR(ep, F_NOLOG); in log_setline()
548 EXF *ep; in log_forward() local
555 ep = sp->ep; in log_forward()
556 if (F_ISSET(ep, F_NOLOG)) { in log_forward()
562 if (ep->l_cur == ep->l_high) { in log_forward()
567 F_SET(ep, F_NOLOG); /* Turn off logging. */ in log_forward()
569 key.data = &ep->l_cur; /* Initialize db request. */ in log_forward()
572 ++ep->l_cur; in log_forward()
573 if (ep->log->get(ep->log, &key, &data, 0)) in log_forward()
576 log_trace(sp, "log_forward", ep->l_cur, data.data); in log_forward()
581 ++ep->l_cur; in log_forward()
583 F_CLR(ep, F_NOLOG); in log_forward()
631 err: F_CLR(ep, F_NOLOG); in log_forward()
642 EXF *ep; in log_err() local
645 ep = sp->ep; in log_err()
646 (void)ep->log->close(ep->log); in log_err()
647 if (!log_init(sp, ep)) in log_err()