To: vim_dev@googlegroups.com Subject: Patch 7.3.1036 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.3.1036 Problem: Can't build on HP-UX. Solution: Give the union a name. (John Marriott) Files: src/regexp_nfa.c *** ../vim-7.3.1035/src/regexp_nfa.c 2013-05-28 22:30:22.000000000 +0200 --- src/regexp_nfa.c 2013-05-28 22:35:55.000000000 +0200 *************** *** 2493,2512 **** { int in_use; /* number of subexpr with useful info */ ! /* When REG_MULTI is TRUE multilist is used, otherwise linelist. */ union { struct multipos { lpos_T start; lpos_T end; ! } multilist[NSUBEXP]; struct linepos { char_u *start; char_u *end; ! } linelist[NSUBEXP]; ! }; } regsub_T; /* nfa_thread_T contains execution information of a NFA state */ --- 2493,2512 ---- { int in_use; /* number of subexpr with useful info */ ! /* When REG_MULTI is TRUE list.multi is used, otherwise list.line. */ union { struct multipos { lpos_T start; lpos_T end; ! } multi[NSUBEXP]; struct linepos { char_u *start; char_u *end; ! } line[NSUBEXP]; ! } list; } regsub_T; /* nfa_thread_T contains execution information of a NFA state */ *************** *** 2536,2550 **** if (REG_MULTI) fprintf(log_fd, "\n *** group %d, start: c=%d, l=%d, end: c=%d, l=%d", j, ! sub->multilist[j].start.col, ! (int)sub->multilist[j].start.lnum, ! sub->multilist[j].end.col, ! (int)sub->multilist[j].end.lnum); else fprintf(log_fd, "\n *** group %d, start: \"%s\", end: \"%s\"", j, ! (char *)sub->linelist[j].start, ! (char *)sub->linelist[j].end); fprintf(log_fd, "\n"); } #endif --- 2536,2550 ---- if (REG_MULTI) fprintf(log_fd, "\n *** group %d, start: c=%d, l=%d, end: c=%d, l=%d", j, ! sub->list.multi[j].start.col, ! (int)sub->list.multi[j].start.lnum, ! sub->list.multi[j].end.col, ! (int)sub->list.multi[j].end.lnum); else fprintf(log_fd, "\n *** group %d, start: \"%s\", end: \"%s\"", j, ! (char *)sub->list.line[j].start, ! (char *)sub->list.line[j].end); fprintf(log_fd, "\n"); } #endif *************** *** 2626,2637 **** { /* Copy the match start and end positions. */ if (REG_MULTI) ! mch_memmove(&lastthread->sub.multilist[0], ! &sub->multilist[0], sizeof(struct multipos) * sub->in_use); else ! mch_memmove(&lastthread->sub.linelist[0], ! &sub->linelist[0], sizeof(struct linepos) * sub->in_use); } } --- 2626,2637 ---- { /* Copy the match start and end positions. */ if (REG_MULTI) ! mch_memmove(&lastthread->sub.list.multi[0], ! &sub->list.multi[0], sizeof(struct multipos) * sub->in_use); else ! mch_memmove(&lastthread->sub.list.line[0], ! &sub->list.line[0], sizeof(struct linepos) * sub->in_use); } } *************** *** 2705,2711 **** { if (subidx < sub->in_use) { ! save_lpos = sub->multilist[subidx].start; save_in_use = -1; } else --- 2705,2711 ---- { if (subidx < sub->in_use) { ! save_lpos = sub->list.multi[subidx].start; save_in_use = -1; } else *************** *** 2713,2732 **** save_in_use = sub->in_use; for (i = sub->in_use; i < subidx; ++i) { ! sub->multilist[i].start.lnum = -1; ! sub->multilist[i].end.lnum = -1; } sub->in_use = subidx + 1; } if (off == -1) { ! sub->multilist[subidx].start.lnum = reglnum + 1; ! sub->multilist[subidx].start.col = 0; } else { ! sub->multilist[subidx].start.lnum = reglnum; ! sub->multilist[subidx].start.col = (colnr_T)(reginput - regline + off); } } --- 2713,2732 ---- save_in_use = sub->in_use; for (i = sub->in_use; i < subidx; ++i) { ! sub->list.multi[i].start.lnum = -1; ! sub->list.multi[i].end.lnum = -1; } sub->in_use = subidx + 1; } if (off == -1) { ! sub->list.multi[subidx].start.lnum = reglnum + 1; ! sub->list.multi[subidx].start.col = 0; } else { ! sub->list.multi[subidx].start.lnum = reglnum; ! sub->list.multi[subidx].start.col = (colnr_T)(reginput - regline + off); } } *************** *** 2734,2740 **** { if (subidx < sub->in_use) { ! save_ptr = sub->linelist[subidx].start; save_in_use = -1; } else --- 2734,2740 ---- { if (subidx < sub->in_use) { ! save_ptr = sub->list.line[subidx].start; save_in_use = -1; } else *************** *** 2742,2753 **** save_in_use = sub->in_use; for (i = sub->in_use; i < subidx; ++i) { ! sub->linelist[i].start = NULL; ! sub->linelist[i].end = NULL; } sub->in_use = subidx + 1; } ! sub->linelist[subidx].start = reginput + off; } addstate(l, state->out, sub, off); --- 2742,2753 ---- save_in_use = sub->in_use; for (i = sub->in_use; i < subidx; ++i) { ! sub->list.line[i].start = NULL; ! sub->list.line[i].end = NULL; } sub->in_use = subidx + 1; } ! sub->list.line[subidx].start = reginput + off; } addstate(l, state->out, sub, off); *************** *** 2755,2763 **** if (save_in_use == -1) { if (REG_MULTI) ! sub->multilist[subidx].start = save_lpos; else ! sub->linelist[subidx].start = save_ptr; } else sub->in_use = save_in_use; --- 2755,2763 ---- if (save_in_use == -1) { if (REG_MULTI) ! sub->list.multi[subidx].start = save_lpos; else ! sub->list.line[subidx].start = save_ptr; } else sub->in_use = save_in_use; *************** *** 2793,2823 **** sub->in_use = subidx + 1; if (REG_MULTI) { ! save_lpos = sub->multilist[subidx].end; if (off == -1) { ! sub->multilist[subidx].end.lnum = reglnum + 1; ! sub->multilist[subidx].end.col = 0; } else { ! sub->multilist[subidx].end.lnum = reglnum; ! sub->multilist[subidx].end.col = (colnr_T)(reginput - regline + off); } } else { ! save_ptr = sub->linelist[subidx].end; ! sub->linelist[subidx].end = reginput + off; } addstate(l, state->out, sub, off); if (REG_MULTI) ! sub->multilist[subidx].end = save_lpos; else ! sub->linelist[subidx].end = save_ptr; sub->in_use = save_in_use; break; } --- 2793,2823 ---- sub->in_use = subidx + 1; if (REG_MULTI) { ! save_lpos = sub->list.multi[subidx].end; if (off == -1) { ! sub->list.multi[subidx].end.lnum = reglnum + 1; ! sub->list.multi[subidx].end.col = 0; } else { ! sub->list.multi[subidx].end.lnum = reglnum; ! sub->list.multi[subidx].end.col = (colnr_T)(reginput - regline + off); } } else { ! save_ptr = sub->list.line[subidx].end; ! sub->list.line[subidx].end = reginput + off; } addstate(l, state->out, sub, off); if (REG_MULTI) ! sub->list.multi[subidx].end = save_lpos; else ! sub->list.line[subidx].end = save_ptr; sub->in_use = save_in_use; break; } *************** *** 2975,2987 **** if (REG_MULTI) { ! if (sub->multilist[subidx].start.lnum < 0 ! || sub->multilist[subidx].end.lnum < 0) goto retempty; /* TODO: line breaks */ ! len = sub->multilist[subidx].end.col ! - sub->multilist[subidx].start.col; ! if (cstrncmp(regline + sub->multilist[subidx].start.col, reginput, &len) == 0) { *bytelen = len; --- 2975,2987 ---- if (REG_MULTI) { ! if (sub->list.multi[subidx].start.lnum < 0 ! || sub->list.multi[subidx].end.lnum < 0) goto retempty; /* TODO: line breaks */ ! len = sub->list.multi[subidx].end.col ! - sub->list.multi[subidx].start.col; ! if (cstrncmp(regline + sub->list.multi[subidx].start.col, reginput, &len) == 0) { *bytelen = len; *************** *** 2990,3000 **** } else { ! if (sub->linelist[subidx].start == NULL ! || sub->linelist[subidx].end == NULL) goto retempty; ! len = (int)(sub->linelist[subidx].end - sub->linelist[subidx].start); ! if (cstrncmp(sub->linelist[subidx].start, reginput, &len) == 0) { *bytelen = len; return TRUE; --- 2990,3000 ---- } else { ! if (sub->list.line[subidx].start == NULL ! || sub->list.line[subidx].end == NULL) goto retempty; ! len = (int)(sub->list.line[subidx].end - sub->list.line[subidx].start); ! if (cstrncmp(sub->list.line[subidx].start, reginput, &len) == 0) { *bytelen = len; return TRUE; *************** *** 3260,3274 **** if (REG_MULTI) for (j = 0; j < submatch->in_use; j++) { ! submatch->multilist[j].start = ! t->sub.multilist[j].start; ! submatch->multilist[j].end = t->sub.multilist[j].end; } else for (j = 0; j < submatch->in_use; j++) { ! submatch->linelist[j].start = t->sub.linelist[j].start; ! submatch->linelist[j].end = t->sub.linelist[j].end; } #ifdef ENABLE_LOG log_subexpr(&t->sub); --- 3260,3275 ---- if (REG_MULTI) for (j = 0; j < submatch->in_use; j++) { ! submatch->list.multi[j].start = ! t->sub.list.multi[j].start; ! submatch->list.multi[j].end = t->sub.list.multi[j].end; } else for (j = 0; j < submatch->in_use; j++) { ! submatch->list.line[j].start = ! t->sub.list.line[j].start; ! submatch->list.line[j].end = t->sub.list.line[j].end; } #ifdef ENABLE_LOG log_subexpr(&t->sub); *************** *** 3355,3368 **** if (REG_MULTI) for (j = 1; j < m->in_use; j++) { ! t->sub.multilist[j].start = m->multilist[j].start; ! t->sub.multilist[j].end = m->multilist[j].end; } else for (j = 1; j < m->in_use; j++) { ! t->sub.linelist[j].start = m->linelist[j].start; ! t->sub.linelist[j].end = m->linelist[j].end; } t->sub.in_use = m->in_use; --- 3356,3369 ---- if (REG_MULTI) for (j = 1; j < m->in_use; j++) { ! t->sub.list.multi[j].start = m->list.multi[j].start; ! t->sub.list.multi[j].end = m->list.multi[j].end; } else for (j = 1; j < m->in_use; j++) { ! t->sub.list.line[j].start = m->list.line[j].start; ! t->sub.list.line[j].end = m->list.line[j].end; } t->sub.in_use = m->in_use; *************** *** 3907,3919 **** if (REG_MULTI) { /* Use 0xff to set lnum to -1 */ ! vim_memset(sub.multilist, 0xff, sizeof(struct multipos) * nfa_nsubexpr); ! vim_memset(m.multilist, 0xff, sizeof(struct multipos) * nfa_nsubexpr); } else { ! vim_memset(sub.linelist, 0, sizeof(struct linepos) * nfa_nsubexpr); ! vim_memset(m.linelist, 0, sizeof(struct linepos) * nfa_nsubexpr); } sub.in_use = 0; m.in_use = 0; --- 3908,3920 ---- if (REG_MULTI) { /* Use 0xff to set lnum to -1 */ ! vim_memset(sub.list.multi, 0xff, sizeof(struct multipos) * nfa_nsubexpr); ! vim_memset(m.list.multi, 0xff, sizeof(struct multipos) * nfa_nsubexpr); } else { ! vim_memset(sub.list.line, 0, sizeof(struct linepos) * nfa_nsubexpr); ! vim_memset(m.list.line, 0, sizeof(struct linepos) * nfa_nsubexpr); } sub.in_use = 0; m.in_use = 0; *************** *** 3926,3933 **** { for (i = 0; i < sub.in_use; i++) { ! reg_startpos[i] = sub.multilist[i].start; ! reg_endpos[i] = sub.multilist[i].end; } if (reg_startpos[0].lnum < 0) --- 3927,3934 ---- { for (i = 0; i < sub.in_use; i++) { ! reg_startpos[i] = sub.list.multi[i].start; ! reg_endpos[i] = sub.list.multi[i].end; } if (reg_startpos[0].lnum < 0) *************** *** 3949,3956 **** { for (i = 0; i < sub.in_use; i++) { ! reg_startp[i] = sub.linelist[i].start; ! reg_endp[i] = sub.linelist[i].end; } if (reg_startp[0] == NULL) --- 3950,3957 ---- { for (i = 0; i < sub.in_use; i++) { ! reg_startp[i] = sub.list.line[i].start; ! reg_endp[i] = sub.list.line[i].end; } if (reg_startp[0] == NULL) *** ../vim-7.3.1035/src/version.c 2013-05-28 22:31:43.000000000 +0200 --- src/version.c 2013-05-28 22:37:01.000000000 +0200 *************** *** 730,731 **** --- 730,733 ---- { /* Add new patch number below this line */ + /**/ + 1036, /**/ -- hundred-and-one symptoms of being an internet addict: 9. All your daydreaming is preoccupied with getting a faster connection to the net: 28.8...ISDN...cable modem...T1...T3. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///