int main() { Prn(Fnc(20.2,3)); }
void Print(struct casti *_c) { char *k, *s; int vb, ve, hb, he, comment; struct casti *c; static struct strbuf q; Rst(&q); //nepekne: spoliehame sa, ze vsetko je z jednej knihy if (!_c) return; k = check_book(_c->k); if (!k) return; init_search(k); hb=vb=-1; he=ve=-1; for (c=_c; c!=NULL; c=c->n) { if (c->h!=-1) { hb = c->h; vb=-1; } if (c->v!=-1) vb = c->v; ve = vb; he = hb; if (c->range && c->n) { c=c->n; if (c->h!=-1) he = c->h; if (c->v!=-1) ve = c->v; } if (hb==-1) { hb = vb; vb = -1; } if (he==-1) { he = ve; ve = -1; } // zapiseme do kontextu if (first.h==-1) { first.h=hb; first.k=k; } if (hb!=kontext_last_hb || he!=kontext_last_he) { if (hb!=he) Prn(&kontext, ";%s%d-%d", k, hb,he); else Prn(&kontext, ";%s%d", k, hb); kontext_last_hb = hb; kontext_last_he = he; } add_search(hb,vb,he,ve); vb = ve; hb = he; } last.h = kontext_last_he; last.k = k; do_search(); while (get_result(&comment, &s)) { if (!comment) printf("%s\n", s); else printf("<span class=\"komentar\">(%s)</span>\n", s); } free_search(); // do not free k - it might be used in first/last }