| 1 | if (parmindex) { |
|---|
| 2 | // |
|---|
| 3 | char *ihtba=NULL; |
|---|
| 4 | int ihtxen=0 |
|---|
| 5 | int level=0; |
|---|
| 6 | char *ihtp; |
|---|
| 7 | char *ihtptr[20]; |
|---|
| 8 | int ihtlen[20]; |
|---|
| 9 | // |
|---|
| 10 | // a b c d |
|---|
| 11 | if (!xbuffet) { |
|---|
| 12 | #if CICPP |
|---|
| 13 | try { xbuffet = (char *) new char [nbytes]; } |
|---|
| 14 | catch (BAD_ALLOC) { xbuffet = (char *)ALLONULL; } |
|---|
| 15 | #else /* CICPP */ |
|---|
| 16 | xbuffet=(char *)ALLOC((ALLOPARM)nbytes); |
|---|
| 17 | #endif /* CICPP */ |
|---|
| 18 | if (xbuffet == (char *)ALLONULL) fatal("fldupdat/procx/Gsplit/marx/ALLOC"); |
|---|
| 19 | } |
|---|
| 20 | *(ihtp=xbuffet)='\0'; |
|---|
| 21 | if (hasattr) for (p=a+1; p!=b; p++) if (*p == ' ') if (strncmp(p,indattr,indsize)==0) { //.level=" |
|---|
| 22 | for (p+=indsize; isdigit(*p); p++ ) level=level*10+((int)(*p)-(int)'0'); break; |
|---|
| 23 | } |
|---|
| 24 | if (level>0 && level<20) { |
|---|
| 25 | //header |
|---|
| 26 | char *a1,*b1=NULL,*c1=NULL; |
|---|
| 27 | char *a2,*b2=NULL,*c2=NULL; |
|---|
| 28 | *c='\0'; a1=strstr(ba,oarea1); if (a1) if (a1[oxn1]==' ' || a1[oxn1]=='>') b1=strchr(a1,'>'); *c='<'; // <header ..> |
|---|
| 29 | if (b1) { c1=strstr(b1+1,carea1); // </header> |
|---|
| 30 | if (c1) { |
|---|
| 31 | int n; |
|---|
| 32 | //copy to headers |
|---|
| 33 | *c1='\0'; n=strlen(b1+1); *c1='<'; |
|---|
| 34 | if (n>ihtleft) n=ihtleft; if (level>1) *ihtp++=' '; memcpy(ihtp,b1+1,n); ihtptr[level-1]=ihtp; ihtp+=n; ihtlen[level-1]=n; *ihtp='\0'; |
|---|
| 35 | ihtptr[level]=NULL; ihtlen[level]=0; |
|---|
| 36 | //text |
|---|
| 37 | *c='\0'; a2=strstr(ba,oarea2); if (a2) if (a2[oxn2]==' ' || a2[oxn2]=='>') b2=strchr(a2,'>'); *c='<'; // <text ..> |
|---|
| 38 | if (b2) { c2=strstr(b2+2,carea2); // </text> |
|---|
| 39 | if (c2) { |
|---|
| 40 | int n; |
|---|
| 41 | //copy to headtxt |
|---|
| 42 | *c2='\0'; n=strlen(b2+1); *c2='<'; |
|---|
| 43 | if (n>ihtleft) n=ihtleft; *ihtp++=' '; memcpy(ihtp,b2+1,n); ihtptr[level]=ihtp; ihtp+=n; ihtlen[level]=n; *ihtp='\0'; |
|---|
| 44 | //text ptr: ers. ers. ers. txt.I/ ers. ers. ers. txt.II/ ers. ers. ers. txtIII/ |
|---|
| 45 | ihtba=headers[0]; |
|---|
| 46 | ihtxen=n+1+m; |
|---|
| 47 | }//c2 |
|---|
| 48 | }//c1 |
|---|
| 49 | }//level |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | if (max >= 20 && len > max) { |
|---|
| 53 | int m2=max/3*2,m3=max-m2-3; |
|---|
| 54 | char *q=bp+m2,*p=bp+len-m3; |
|---|
| 55 | char *z=bp+max-1; |
|---|
| 56 | int left=max; |
|---|
| 57 | int lmin=(xleft)?m2:0; |
|---|
| 58 | while (left-- > lmin) |
|---|
| 59 | if (*z--==' ') |
|---|
| 60 | if (*z=='.' || *z==';') |
|---|
| 61 | break; |
|---|
| 62 | if (left >= lmin) { |
|---|
| 63 | len=left+3; |
|---|
| 64 | memcpy(bp+left," ..",3); |
|---|
| 65 | } else { |
|---|
| 66 | len=m2+3+m3; |
|---|
| 67 | memcpy(q,"...",3); q+=3; |
|---|
| 68 | while (m3--) *q++= *p++; |
|---|
| 69 | } |
|---|
| 70 | } |
|---|