WriteListR (lines 207-423)
Back to List
Browsing verblibm.h
0207 [ WriteListR o depth stack_pointer classes_p sizes_p i j k k2 l m n q senc mr;
0208
0209 if (depth>0 && o==child(parent(o)))
0210 { SortOutList(o); o=child(parent(o)); }
0211 for (::)
0212 { if (o==0) rfalse;
0213 if (c_style & WORKFLAG_BIT ~= 0 && depth==0 && o hasnt workflag)
0214 { o = sibling(o); continue; }
0215 if (c_style & CONCEAL_BIT ~= 0
0216 && (o has concealed || o has scenery))
0217 { o=sibling(o); continue; }
0218 break;
0219 }
0220
0221 classes_p = match_classes + stack_pointer;
0222 sizes_p = match_list + stack_pointer;
0223
0224 for (i=o,j=0:i~=0 && (j+stack_pointer)<128:i=NextEntry(i,depth),j++)
0225 { classes_p->j=0;
0226 if (i.plural~=0) k++;
0227 }
0228
0229 if (c_style & ISARE_BIT ~= 0)
0230 { if (j==1 && o hasnt pluralname)
0231 print (string) IS__TX; else print (string) ARE__TX;
0232 if (c_style & NEWLINE_BIT ~= 0) print ":^"; else print (char) ' ';
0233 c_style = c_style - ISARE_BIT;
0234 }
0235
0236 stack_pointer = stack_pointer+j+1;
0237
0238 if (k<2) jump EconomyVersion; ! It takes two to plural
0239 n=1;
0240 for (i=o,k=0:k<j:i=NextEntry(i,depth),k++)
0241 if (classes_p->k==0)
0242 { classes_p->k=n; sizes_p->n=1;
0243 for (l=NextEntry(i,depth), m=k+1:l~=0 && m<j:
0244 l=NextEntry(l,depth), m++)
0245 if (classes_p->m==0 && i.plural~=0 && l.plural~=0)
0246 { if (ListEqual(i,l)==1)
0247 { sizes_p->n = sizes_p->n + 1;
0248 classes_p->m = n;
0249 }
0250 }
0251 n++;
0252 }
0253 n--;
0254
0255 for (i=1, j=o, k=0: i<=n: i++, senc++)
0256 { while (((classes_p->k) ~= i)
0257 && ((classes_p->k) ~= -i)) { k++; j=NextEntry(j,depth); }
0258 m=sizes_p->i;
0259 if (j==0) mr = 0;
0260 else
0261 { if (j.list_together~=0 or lt_value
0262 && ZRegion(j.list_together)==2 or 3
0263 && j.list_together==mr) senc--;
0264 mr=j.list_together;
0265 }
0266 }
0267 senc--;
0268
0269 for (i=1, j=o, k=0, mr=0: senc>=0: i++, senc--)
0270 { while (((classes_p->k) ~= i)
0271 && ((classes_p->k) ~= -i)) { k++; j=NextEntry(j,depth); }
0272 if (j.list_together~=0 or lt_value)
0273 { if (j.list_together==mr) { senc++; jump Omit_FL2; }
0274 k2=NextEntry(j,depth);
0275 if (k2==0 || k2.list_together~=j.list_together) jump Omit_WL2;
0276 k2=ZRegion(j.list_together);
0277 if (k2==2 or 3)
0278 { q=j; listing_size=1; l=k; m=i;
0279 while (m<n && q.list_together==j.list_together)
0280 { m++;
0281 while (((classes_p->l) ~= m)
0282 && ((classes_p->l) ~= -m))
0283 { l++; q=NextEntry(q,depth); }
0284 if (q.list_together==j.list_together) listing_size++;
0285 }
0286 ! print " [", listing_size, "] ";
0287 if (listing_size==1) jump Omit_WL2;
0288 if (c_style & INDENT_BIT ~= 0)
0289 Print__Spaces(2*(depth+wlf_indent));
0290 if (k2==3)
0291 { q=0; for (l=0:l<listing_size:l++) q=q+sizes_p->(l+i);
0292 EnglishNumber(q); print " ";
0293 print (string) j.list_together;
0294 if (c_style & ENGLISH_BIT ~= 0) print " (";
0295 if (c_style & INDENT_BIT ~= 0) print ":^";
0296 }
0297 q=c_style;
0298 if (k2~=3)
0299 { inventory_stage=1;
0300 parser_one=j; parser_two=depth+wlf_indent;
0301 if (RunRoutines(j,list_together)==1) jump Omit__Sublist2;
0302 }
0303
0304 @push lt_value; @push listing_together; @push listing_size;
0305 lt_value=j.list_together; listing_together=j; wlf_indent++;
0306 WriteListR(j,depth,stack_pointer); wlf_indent--;
0307 @pull listing_size; @pull listing_together; @pull lt_value;
0308
0309 if (k2==3)
0310 { if (q & ENGLISH_BIT ~= 0) print ")";
0311 }
0312 else
0313 { inventory_stage=2;
0314 parser_one=j; parser_two=depth+wlf_indent;
0315 RunRoutines(j,list_together);
0316 }
0317 .Omit__Sublist2;
0318 if (q & NEWLINE_BIT ~= 0 && c_style & NEWLINE_BIT == 0)
0319 new_line;
0320 c_style=q;
0321 mr=j.list_together;
0322 jump Omit_EL2;
0323 }
0324 }
0325
0326 .Omit_WL2;
0327 if (WriteBeforeEntry(j,depth,-senc)==1) jump Omit_FL2;
0328 if (sizes_p->i == 1)
0329 { if (c_style & NOARTICLE_BIT ~= 0) print (name) j;
0330 else
0331 { if (c_style & DEFART_BIT ~= 0) print (the) j; else print (a) j;
0332 }
0333 }
0334 else
0335 { if (c_style & DEFART_BIT ~= 0)
0336 PrefaceByArticle(j, 1, sizes_p->i);
0337 print (number) sizes_p->i, " ";
0338 PrintOrRun(j,plural,1);
0339 }
0340 WriteAfterEntry(j,depth,stack_pointer);
0341
0342 .Omit_EL2;
0343 if (c_style & ENGLISH_BIT ~= 0)
0344 { if (senc==1) print (string) AND__TX;
0345 if (senc>1) print ", ";
0346 }
0347 .Omit_FL2;
0348 }
0349 rtrue;
0350
0351 .EconomyVersion;
0352
0353 n=j;
0354
0355 for (i=1, j=o: i<=n: j=NextEntry(j,depth), i++, senc++)
0356 { if (j.list_together~=0 or lt_value
0357 && ZRegion(j.list_together)==2 or 3
0358 && j.list_together==mr) senc--;
0359 mr=j.list_together;
0360 }
0361
0362 for (i=1, j=o, mr=0: i<=senc: j=NextEntry(j,depth), i++)
0363 { if (j.list_together~=0 or lt_value)
0364 { if (j.list_together==mr) { i--; jump Omit_FL; }
0365 k=NextEntry(j,depth);
0366 if (k==0 || k.list_together~=j.list_together) jump Omit_WL;
0367 k=ZRegion(j.list_together);
0368 if (k==2 or 3)
0369 { if (c_style & INDENT_BIT ~= 0)
0370 Print__Spaces(2*(depth+wlf_indent));
0371 if (k==3)
0372 { q=j; l=0;
0373 do
0374 { q=NextEntry(q,depth); l++;
0375 } until (q==0 || q.list_together~=j.list_together);
0376 EnglishNumber(l); print " ";
0377 print (string) j.list_together;
0378 if (c_style & ENGLISH_BIT ~= 0) print " (";
0379 if (c_style & INDENT_BIT ~= 0) print ":^";
0380 }
0381 q=c_style;
0382 if (k~=3)
0383 { inventory_stage=1;
0384 parser_one=j; parser_two=depth+wlf_indent;
0385 if (RunRoutines(j,list_together)==1) jump Omit__Sublist;
0386 }
0387
0388 @push lt_value; @push listing_together; @push listing_size;
0389 lt_value=j.list_together; listing_together=j; wlf_indent++;
0390 WriteListR(j,depth,stack_pointer); wlf_indent--;
0391 @pull listing_size; @pull listing_together; @pull lt_value;
0392
0393 if (k==3)
0394 { if (q & ENGLISH_BIT ~= 0) print ")";
0395 }
0396 else
0397 { inventory_stage=2;
0398 parser_one=j; parser_two=depth+wlf_indent;
0399 RunRoutines(j,list_together);
0400 }
0401 .Omit__Sublist;
0402 if (q & NEWLINE_BIT ~= 0 && c_style & NEWLINE_BIT == 0) new_line;
0403 c_style=q;
0404 mr=j.list_together;
0405 jump Omit_EL;
0406 }
0407 }
0408 .Omit_WL;
0409 if (WriteBeforeEntry(j,depth,i-senc)==1) jump Omit_FL;
0410 if (c_style & NOARTICLE_BIT ~= 0) print (name) j;
0411 else
0412 { if (c_style & DEFART_BIT ~= 0) print (the) j; else print (a) j;
0413 }
0414 WriteAfterEntry(j,depth,stack_pointer);
0415
0416 .Omit_EL;
0417 if (c_style & ENGLISH_BIT ~= 0)
0418 { if (i==senc-1) print (string) AND__TX;
0419 if (i<senc-1) print ", ";
0420 }
0421 .Omit_FL;
0422 }
0423 ];
Last updated 27 February 2004.
This site is no longer supported; information may be out of date.
Maintained as a historical archive by the Interactive Fiction Technology Foundation.
Copyright 1993-2018 IFTF, CC-BY-SA unless otherwise noted.
This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.