w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

sel1.c
Go to the documentation of this file.
1 /*====================================================================*
2  - Copyright (C) 2001 Leptonica. All rights reserved.
3  - This software is distributed in the hope that it will be
4  - useful, but with NO WARRANTY OF ANY KIND.
5  - No author or distributor accepts responsibility to anyone for the
6  - consequences of using this software, or for whether it serves any
7  - particular purpose or works at all, unless he or she says so in
8  - writing. Everyone is granted permission to copy, modify and
9  - redistribute this source code, for commercial or non-commercial
10  - purposes, with the following restrictions: (1) the origin of this
11  - source code must not be misrepresented; (2) modified versions must
12  - be plainly marked as such; and (3) this notice may not be removed
13  - or altered from any source or modified source distribution.
14  *====================================================================*/
15 
16 
17 
18 /*
19  * sel1.c
20  *
21  * Basic ops on Sels and Selas
22  *
23  * Create/destroy/copy:
24  * SELA *selaCreate()
25  * void selaDestroy()
26  * SEL *selCreate()
27  * void selDestroy()
28  * SEL *selCopy()
29  * SEL *selCreateBrick()
30  *
31  * Helper proc:
32  * l_int32 **create2dIntArray()
33  *
34  * Extension of sela:
35  * SELA *selaAddSel()
36  * l_int32 selaExtendArray()
37  *
38  * Accessors:
39  * l_int32 selaGetCount()
40  * SEL *selaGetSel()
41  * char *selGetName()
42  * l_int32 selaFindSelByName()
43  * l_int32 selGetElement()
44  * l_int32 selSetElement()
45  *
46  * Max extent vals for erosion and hmt:
47  * l_int32 selFindMaxTranslations()
48  *
49  * Write/read & visualization:
50  * l_int32 selaWrite()
51  * l_int32 selaWriteStream()
52  * l_int32 selWriteStream()
53  * l_int32 selaRead()
54  * l_int32 selaReadStream()
55  * l_int32 selReadStream()
56  *
57  *
58  * Usage note:
59  * Consistency, being the hobgoblin of small minds,
60  * is adhered to here in the dimensioning and accessing of sels.
61  * Everything is done in standard matrix (row, column) order.
62  * We have 2 functions that make sels:
63  * selCreate(), with input (h, w, [name])
64  * selCreateBrick(), with input (h, w, cy, cx, val)
65  * When we set specific elements in a sel, we likewise use
66  * (row, col) ordering:
67  * selSetElement(), with input (row, col, type)
68  */
69 
70 
71 
72 #include <stdio.h>
73 #include <stdlib.h>
74 #include <string.h>
75 #include "allheaders.h"
76 
77 static const l_int32 INITIAL_PTR_ARRAYSIZE = 50; /* n'import quoi */
78 static const l_int32 MANY_SELS = 1000;
79 static const l_int32 BUFSIZE = 256;
80 
81 
82 /*------------------------------------------------------------------------*
83  * Create / Destroy / Copy *
84  *------------------------------------------------------------------------*/
85 /*!
86  * selaCreate()
87  *
88  * Input: n (initial number of sel ptrs; use 0 for default)
89  * Return: sela, or null on error
90  */
91 SELA *
93 {
94 SELA *sela;
95 
96  PROCNAME("selaCreate");
97 
98  if (n <= 0)
100  if (n > MANY_SELS)
101  L_WARNING_INT("%d sels", procName, n);
102 
103  if ((sela = (SELA *)CALLOC(1, sizeof(SELA))) == NULL)
104  return (SELA *)ERROR_PTR("sela not made", procName, NULL);
105 
106  sela->nalloc = n;
107  sela->n = 0;
108 
109  /* make array of se ptrs */
110  if ((sela->sel = (SEL **)CALLOC(n, sizeof(SEL *))) == NULL)
111  return (SELA *)ERROR_PTR("sel ptrs not made", procName, NULL);
112 
113  return sela;
114 }
115 
116 
117 /*!
118  * selaDestroy()
119  *
120  * Input: &sela (<to be nulled>)
121  * Return: void
122  */
123 void
125 {
126 SELA *sela;
127 l_int32 i;
128 
129  if (!psela) return;
130  if ((sela = *psela) == NULL)
131  return;
132 
133  for (i = 0; i < sela->n; i++)
134  selDestroy(&sela->sel[i]);
135  FREE((void *)sela->sel);
136 
137  FREE((void *)sela);
138  *psela = NULL;
139  return;
140 }
141 
142 
143 /*!
144  * selCreate()
145  *
146  * Input: height, width
147  * name (<optional> sel name)
148  * Return: sel, or null on error
149  *
150  * Note: selCreate() initializes all values to 0.
151  * After this call, (cy,cx) and nonzero data values must be
152  * assigned. If a text name is not assigned here, it will
153  * be needed later when the sel is put into a sela.
154  */
155 SEL *
157  l_int32 width,
158  const char *name)
159 {
160 SEL *sel;
161 
162  PROCNAME("selCreate");
163 
164  if ((sel = (SEL *)CALLOC(1, sizeof(SEL))) == NULL)
165  return (SEL *)ERROR_PTR("sel not made", procName, NULL);
166  if (name)
167  sel->name = stringNew(name);
168  sel->sy = height;
169  sel->sx = width;
170  if ((sel->data = create2dIntArray(height, width)) == NULL)
171  return (SEL *)ERROR_PTR("data not allocated", procName, NULL);
172 
173  return sel;
174 }
175 
176 
177 /*!
178  * selDestroy()
179  *
180  * Input: &sel (<to be nulled>)
181  * Return: void
182  */
183 void
184 selDestroy(SEL **psel)
185 {
186 l_int32 i;
187 SEL *sel;
188 
189  PROCNAME("selDestroy");
190 
191  if (psel == NULL) {
192  L_WARNING("ptr address is NULL!", procName);
193  return;
194  }
195  if ((sel = *psel) == NULL)
196  return;
197 
198  for (i = 0; i < sel->sy; i++)
199  FREE((void *)sel->data[i]);
200  FREE((void *)sel->data);
201 
202  if (sel->name)
203  FREE((void *)sel->name);
204 
205  FREE((void *)sel);
206 
207  *psel = NULL;
208  return;
209 }
210 
211 
212 /*!
213  * selCopy()
214  *
215  * Input: sel
216  * Return: a copy of the sel, or null on error
217  */
218 SEL *
219 selCopy(SEL *sel)
220 {
221 l_int32 i, j;
222 SEL *csel;
223 
224  PROCNAME("selCopy");
225 
226  if (!sel)
227  return (SEL *)ERROR_PTR("sel not defined", procName, NULL);
228 
229  if ((csel = (SEL *)CALLOC(1, sizeof(SEL))) == NULL)
230  return (SEL *)ERROR_PTR("csel not made", procName, NULL);
231 
232  csel->sy = sel->sy;
233  csel->sx = sel->sx;
234  csel->cy = sel->cy;
235  csel->cx = sel->cx;
236 
237  if ((csel->data = create2dIntArray(sel->sy, sel->sx)) == NULL)
238  return (SEL *)ERROR_PTR("sel data not made", procName, NULL);
239 
240  for (i = 0; i < sel->sy; i++)
241  for (j = 0; j < sel->sx; j++)
242  csel->data[i][j] = sel->data[i][j];
243 
244  csel->name = stringNew(sel->name);
245 
246  return csel;
247 }
248 
249 
250 
251 /*!
252  * selCreateBrick()
253  *
254  * Input: height, width
255  * cy, cx (center, relative to UL corner at 0,0)
256  * type (SEL_HIT, SEL_MISS, or SEL_DONT_CARE)
257  * Return: sel, or null on error
258  *
259  * Action: a "brick" is a rectangular array of either hits,
260  * misses, or don't-cares.
261  */
262 SEL *
264  l_int32 w,
265  l_int32 cy,
266  l_int32 cx,
267  l_int32 type)
268 {
269 l_int32 i, j;
270 SEL *sel;
271 
272  PROCNAME("selCreateBrick");
273 
274  if (h <= 0 || w <= 0)
275  return (SEL *)ERROR_PTR("h and w must both be > 0", procName, NULL);
276  if (type != SEL_HIT && type != SEL_MISS && type != SEL_DONT_CARE)
277  return (SEL *)ERROR_PTR("invalid sel element type", procName, NULL);
278 
279  if ((sel = selCreate(h, w, NULL)) == NULL)
280  return (SEL *)ERROR_PTR("sel not made", procName, NULL);
281  sel->cy = cy;
282  sel->cx = cx;
283  for (i = 0; i < h; i++)
284  for (j = 0; j < w; j++)
285  sel->data[i][j] = type;
286 
287  return sel;
288 }
289 
290 
291 /*!
292  * create2dIntArray()
293  *
294  * Input: sy (rows == height)
295  * sx (columns == width)
296  * Return: doubly indexed array (i.e., an array of sy row pointers,
297  * each of which points to an array of sx ints)
298  *
299  * Note: the array[sy][sx] is indexed in standard
300  * "matrix notation" with the row index first.
301  */
302 l_int32 **
304  l_int32 sx)
305 {
306 l_int32 i;
307 l_int32 **array;
308 
309  PROCNAME("create2dIntArray");
310 
311  if ((array = (l_int32 **)CALLOC(sy, sizeof(l_int32 *))) == NULL)
312  return (l_int32 **)ERROR_PTR("ptr array not made", procName, NULL);
313 
314  for (i = 0; i < sy; i++) {
315  if ((array[i] = (l_int32 *)CALLOC(sx, sizeof(l_int32))) == NULL)
316  return (l_int32 **)ERROR_PTR("array not made", procName, NULL);
317  }
318 
319  return array;
320 }
321 
322 
323 
324 /*------------------------------------------------------------------------*
325  * Extension of sela *
326  *------------------------------------------------------------------------*/
327 /*!
328  * selaAddSel()
329  *
330  * Input: sela
331  * sel to be added
332  * selname (ignored if already defined in sel;
333  * req'd in sel when added to a sela)
334  * copyflag (for sel: 0 inserts, 1 copies)
335  * Return: 0 if OK; 1 on error
336  *
337  * Action: Adds sel to arrays, making a copy if flagged.
338  * Copies the name to the sel if necessary.
339  * Increments the sel count.
340  */
341 l_int32
343  SEL *sel,
344  const char *selname,
345  l_int32 copyflag)
346 {
347 l_int32 n;
348 SEL *csel;
349 
350  PROCNAME("selaAddSel");
351 
352  if (!sela)
353  return ERROR_INT("sela not defined", procName, 1);
354  if (!sel)
355  return ERROR_INT("sel not defined", procName, 1);
356  if (!sel->name && !selname)
357  return ERROR_INT("added sel must have name", procName, 1);
358 
359  if (copyflag == TRUE) {
360  if ((csel = selCopy(sel)) == NULL)
361  return ERROR_INT("csel not made", procName, 1);
362  }
363  else /* copyflag is false; insert directly */
364  csel = sel;
365 
366  if (csel->name == NULL)
367  csel->name = stringNew(selname);
368 
369  n = selaGetCount(sela);
370  if (n >= sela->nalloc)
371  selaExtendArray(sela);
372  sela->sel[n] = csel;
373  sela->n++;
374 
375  return 0;
376 }
377 
378 
379 /*!
380  * selaExtendArray()
381  *
382  * Input: sela
383  * Return: 0 if OK; 1 on error
384  *
385  * Action: doubles the ptr array; copies the old ptr addresses
386  * into the new array; updates ptr array size
387  */
388 l_int32
390 {
391  PROCNAME("selaExtendArray");
392 
393  if (!sela)
394  return ERROR_INT("sela not defined", procName, 1);
395 
396  if ((sela->sel = (SEL **)reallocNew((void **)&sela->sel,
397  sizeof(l_intptr_t) * sela->nalloc,
398  2 * sizeof(l_intptr_t) * sela->nalloc)) == NULL)
399  return ERROR_INT("new ptr array not returned", procName, 1);
400 
401  sela->nalloc = 2 * sela->nalloc;
402  return 0;
403 }
404 
405 
406 
407 /*----------------------------------------------------------------------*
408  * Accessors *
409  *----------------------------------------------------------------------*/
410 /*!
411  * selaGetCount()
412  *
413  * Input: sela
414  * Return: count, or 0 on error
415  */
416 l_int32
418 {
419  PROCNAME("selaGetCount");
420 
421  if (!sela)
422  return ERROR_INT("sela not defined", procName, 0);
423 
424  return sela->n;
425 }
426 
427 
428 /*!
429  * selaGetSel()
430  *
431  * Input: sela
432  * index of sel to be retrieved (not copied)
433  * Return: sel, or null on error
434  */
435 SEL *
437  l_int32 i)
438 {
439  PROCNAME("selaGetSel");
440 
441  if (!sela)
442  return (SEL *)ERROR_PTR("sela not defined", procName, NULL);
443 
444  if (i < 0 || i >= sela->n)
445  return (SEL *)ERROR_PTR("invalid index", procName, NULL);
446 
447  return sela->sel[i];
448 }
449 
450 
451 /*!
452  * selGetName()
453  *
454  * Input: sel
455  * Return: sel name (not copied), or null if no name or on error
456  */
457 char *
458 selGetName(SEL *sel)
459 {
460  PROCNAME("selGetName");
461 
462  if (!sel)
463  return (char *)ERROR_PTR("sel not defined", procName, NULL);
464 
465  return sel->name;
466 }
467 
468 
469 /*!
470  * selaFindSelByName()
471  *
472  * Input: sela
473  * sel name
474  * &index (<optional, return>)
475  * &sel (<optional, return> sel (not a copy))
476  * Return: 0 if OK; 1 on error
477  */
478 l_int32
480  const char *name,
481  l_int32 *pindex,
482  SEL **psel)
483 {
484 l_int32 i, n;
485 char *sname;
486 SEL *sel;
487 
488  PROCNAME("selaFindSelByName");
489 
490  if (pindex) *pindex = -1;
491  if (psel) *psel = NULL;
492 
493  if (!sela)
494  return ERROR_INT("sela not defined", procName, 1);
495 
496  n = selaGetCount(sela);
497  for (i = 0; i < n; i++)
498  {
499  if ((sel = selaGetSel(sela, i)) == NULL) {
500  L_WARNING("missing sel", procName);
501  continue;
502  }
503 
504  sname = selGetName(sel);
505  if (sname && (!strcmp(name, sname))) {
506  if (pindex)
507  *pindex = i;
508  if (psel)
509  *psel = sel;
510  return 0;
511  }
512  }
513 
514  return 1;
515 }
516 
517 
518 /*!
519  * selGetElement()
520  *
521  * Input: sel
522  * row
523  * col
524  * &type (<return> SEL_HIT, SEL_MISS, SEL_DONT_CARE)
525  * Return: 0 if OK; 1 on error
526  */
527 l_int32
528 selGetElement(SEL *sel,
529  l_int32 row,
530  l_int32 col,
531  l_int32 *ptype)
532 {
533  PROCNAME("selGetElement");
534 
535  if (!sel)
536  return ERROR_INT("sel not defined", procName, 1);
537  if (row < 0 || row >= sel->sy)
538  return ERROR_INT("sel row out of bounds", procName, 1);
539  if (col < 0 || col >= sel->sx)
540  return ERROR_INT("sel col out of bounds", procName, 1);
541 
542  *ptype = sel->data[row][col];
543  return 0;
544 }
545 
546 
547 /*!
548  * selSetElement()
549  *
550  * Input: sel
551  * row
552  * col
553  * type (SEL_HIT, SEL_MISS, SEL_DONT_CARE)
554  * Return: 0 if OK; 1 on error
555  */
556 l_int32
557 selSetElement(SEL *sel,
558  l_int32 row,
559  l_int32 col,
560  l_int32 type)
561 {
562  PROCNAME("selSetElement");
563 
564  if (!sel)
565  return ERROR_INT("sel not defined", procName, 1);
566  if (type != SEL_HIT && type != SEL_MISS && type != SEL_DONT_CARE)
567  return ERROR_INT("invalid sel element type", procName, 1);
568  if (row < 0 || row >= sel->sy)
569  return ERROR_INT("sel row out of bounds", procName, 1);
570  if (col < 0 || col >= sel->sx)
571  return ERROR_INT("sel col out of bounds", procName, 1);
572 
573  sel->data[row][col] = type;
574  return 0;
575 }
576 
577 
578 /*----------------------------------------------------------------------*
579  * Max translations for erosion and hmt *
580  *----------------------------------------------------------------------*/
581 /*!
582  * selFindMaxTranslations()
583  *
584  * Input: sel
585  * &xp, &yp, &xn, &yn (<return> max shifts)
586  * Return: 0 if OK; 1 on error
587  *
588  * Note: these are the maximum shifts for the erosion operation.
589  * For example, when j < cx, the shift of the image
590  * is +x to the cx. This is a positive xp shift.
591  */
592 l_int32
594  l_int32 *pxp,
595  l_int32 *pyp,
596  l_int32 *pxn,
597  l_int32 *pyn)
598 {
599 l_int32 i, j, maxxp, maxyp, maxxn, maxyn;
600 
601  PROCNAME("selaFindMaxTranslations");
602 
603  *pxp = *pyp = *pxn = *pyn = 0;
604 
605  if (!sel)
606  return ERROR_INT("sel not defined", procName, 1);
607 
608  maxxp = maxyp = maxxn = maxyn = 0;
609  for (i = 0; i < sel->sy; i++) {
610  for (j = 0; j < sel->sx; j++) {
611  if (sel->data[i][j] == 1) {
612  maxxp = L_MAX(maxxp, sel->cx - j);
613  maxyp = L_MAX(maxyp, sel->cy - i);
614  maxxn = L_MAX(maxxn, j - sel->cx);
615  maxyn = L_MAX(maxyn, i - sel->cy);
616  }
617  }
618  }
619 
620  *pxp = maxxp;
621  *pyp = maxyp;
622  *pxn = maxxn;
623  *pyn = maxyn;
624 
625  return 0;
626 }
627 
628 
629 
630 /*----------------------------------------------------------------------*
631  * I/O and visualizing Sela & Sel *
632  *----------------------------------------------------------------------*/
633 /*!
634  * selaWrite()
635  *
636  * Input: filename
637  * sela
638  * Return: 0 if OK, 1 on error
639  */
640 l_int32
641 selaWrite(const char *fname,
642  SELA *sela)
643 {
644 FILE *fp;
645 
646  PROCNAME("selaWrite");
647 
648  if (!fname)
649  return ERROR_INT("fname not defined", procName, 1);
650  if (!sela)
651  return ERROR_INT("sela not defined", procName, 1);
652 
653  if ((fp = fopen(fname, "wb")) == NULL)
654  return ERROR_INT("stream not opened", procName, 1);
655  selaWriteStream(fp, sela);
656  fclose(fp);
657 
658  return 0;
659 }
660 
661 
662 /*!
663  * selaWriteStream()
664  *
665  * Input: stream
666  * sela
667  * Return: 0 if OK, 1 on error
668  */
669 l_int32
671  SELA *sela)
672 {
673 l_int32 i, n;
674 SEL *sel;
675 
676  PROCNAME("selaWriteStream");
677 
678  if (!fp)
679  return ERROR_INT("stream not defined", procName, 1);
680  if (!sela)
681  return ERROR_INT("sela not defined", procName, 1);
682 
683  n = selaGetCount(sela);
684  fprintf(fp, "sel array: number of sels = %d\n\n", n);
685  for (i = 0; i < n; i++)
686  {
687  if ((sel = selaGetSel(sela, i)) == NULL)
688  continue;
689  selWriteStream(fp, sel);
690  }
691  return 0;
692 }
693 
694 
695 /*!
696  * selWriteStream()
697  *
698  * Input: stream
699  * sel
700  * Return: 0 if OK, 1 on error
701  */
702 l_int32
704  SEL *sel)
705 {
706 l_int32 i, j;
707 
708  PROCNAME("selWriteStream");
709 
710  if (!fp)
711  return ERROR_INT("stream not defined", procName, 1);
712  if (!sel)
713  return ERROR_INT("sel not defined", procName, 1);
714 
715  fprintf(fp, " ------ %s ------\n", selGetName(sel));
716  fprintf(fp, " sy = %d, sx = %d, cy = %d, cx = %d\n",
717  sel->sy, sel->sx, sel->cy, sel->cx);
718  for (i = 0; i < sel->sy; i++) {
719  fprintf(fp, " ");
720  for (j = 0; j < sel->sx; j++)
721  fprintf(fp, "%d", sel->data[i][j]);
722  fprintf(fp, "\n");
723  }
724  fprintf(fp, "\n");
725 
726  return 0;
727 }
728 
729 
730 /*!
731  * selaRead()
732  *
733  * Input: filename
734  * Return: sela, or null on error
735  */
736 SELA *
737 selaRead(const char *fname)
738 {
739 FILE *fp;
740 SELA *sela;
741 
742  PROCNAME("selaRead");
743 
744  if (!fname)
745  return (SELA *)ERROR_PTR("fname not defined", procName, NULL);
746 
747  if ((fp = fopen(fname, "rb")) == NULL)
748  return (SELA *)ERROR_PTR("stream not opened", procName, NULL);
749  if ((sela = selaReadStream(fp)) == NULL)
750  return (SELA *)ERROR_PTR("sela not returned", procName, NULL);
751  fclose(fp);
752 
753  return sela;
754 }
755 
756 
757 /*!
758  * selaReadStream()
759  *
760  * Input: stream
761  * Return: sela, or null on error
762  */
763 SELA *
765 {
766 l_int32 i, n;
767 SEL *sel;
768 SELA *sela;
769 
770  PROCNAME("selaReadStream");
771 
772  if (!fp)
773  return (SELA *)ERROR_PTR("stream not defined", procName, NULL);
774 
775  if (fscanf(fp, "sel array: number of sels = %d\n\n", &n) != 1)
776  return (SELA *)ERROR_PTR("not a sela", procName, NULL);
777 
778  if ((sela = selaCreate(n)) == NULL)
779  return (SELA *)ERROR_PTR("sela not made", procName, NULL);
780  sela->nalloc = n;
781 
782  for (i = 0; i < n; i++)
783  {
784  if ((sel = selReadStream(fp)) == NULL)
785  return (SELA *)ERROR_PTR("sel not made", procName, NULL);
786  selaAddSel(sela, sel, NULL, 0);
787  }
788 
789  return sela;
790 }
791 
792 
793 /*!
794  * selReadStream()
795  *
796  * Input: stream
797  * Return: sel, or null on error
798  */
799 SEL *
801 {
802 char *selname;
803 char linebuf[BUFSIZE];
804 l_int32 sy, sx, cy, cx, i, j;
805 SEL *sel;
806 
807  PROCNAME("selReadStream");
808 
809  if (!fp)
810  return (SEL *)ERROR_PTR("stream not defined", procName, NULL);
811 
812  fgets(linebuf, BUFSIZE, fp);
813  selname = stringNew(linebuf);
814  sscanf(linebuf, " ------ %s ------", selname);
815 
816  if (fscanf(fp, " sy = %d, sx = %d, cy = %d, cx = %d\n",
817  &sy, &sx, &cy, &cx) != 4)
818  return (SEL *)ERROR_PTR("dimensions not read", procName, NULL);
819 
820  if ((sel = selCreate(sy, sx, selname)) == NULL)
821  return (SEL *)ERROR_PTR("sel not made", procName, NULL);
822  sel->cy = cy;
823  sel->cx = cx;
824 
825  for (i = 0; i < sy; i++) {
826  fscanf(fp, " ");
827  for (j = 0; j < sx; j++)
828  fscanf(fp, "%1d", &sel->data[i][j]);
829  fscanf(fp, "\n");
830  }
831  fscanf(fp, "\n");
832 
833  FREE((void *)selname);
834  return sel;
835 }
836 
#define width(a)
Definition: aptex-macros.h:198
#define type(a)
Definition: aptex-macros.h:171
#define name
#define height(a)
Definition: aptex-macros.h:200
#define n
Definition: t4ht.c:1290
@ TRUE
Definition: dd.h:102
int w
Definition: dviconv.c:26
int h
Definition: dviconv.c:9
#define fopen
Definition: xxstdio.h:21
#define fgets
Definition: xxstdio.h:29
int strcmp()
Definition: coll.cpp:143
int sscanf()
#define PROCNAME(name)
Definition: environ.h:131
#define ERROR_PTR(a, b, c)
Definition: environ.h:132
#define L_WARNING(a, b)
Definition: environ.h:136
#define ERROR_INT(a, b, c)
Definition: environ.h:133
int l_int32
Definition: environ.h:32
#define L_WARNING_INT(a, b, c)
Definition: environ.h:137
intptr_t l_intptr_t
Definition: environ.h:21
int col
Definition: gsftopk.c:443
const unsigned char FREE
Definition: image.cpp:34
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p scientific i
Definition: afcover.h:80
int int cy
Definition: gdfx.h:13
int cx
Definition: gdfx.h:12
#define fclose
Definition: debug.h:100
#define fprintf
Definition: mendex.h:64
#define CALLOC(t, n)
Definition: hash.c:21
char * stringNew(const char *src)
Definition: utils.c:374
void * reallocNew(void **pindata, l_int32 oldsize, l_int32 newsize)
Definition: utils.c:720
#define L_MAX
Definition: manifests.h:80
@ SEL_HIT
Definition: morph.h:40
@ SEL_MISS
Definition: morph.h:41
@ SEL_DONT_CARE
Definition: morph.h:39
#define fp
char * fname
Definition: plain2.c:121
static int row
Definition: ps2pk.c:587
l_int32 selGetElement(SEL *sel, l_int32 row, l_int32 col, l_int32 *ptype)
Definition: sel1.c:528
l_int32 selFindMaxTranslations(SEL *sel, l_int32 *pxp, l_int32 *pyp, l_int32 *pxn, l_int32 *pyn)
Definition: sel1.c:593
l_int32 selWriteStream(FILE *fp, SEL *sel)
Definition: sel1.c:703
l_int32 selaWriteStream(FILE *fp, SELA *sela)
Definition: sel1.c:670
void selaDestroy(SELA **psela)
Definition: sel1.c:124
SEL * selCopy(SEL *sel)
Definition: sel1.c:219
SELA * selaCreate(l_int32 n)
Definition: sel1.c:92
void selDestroy(SEL **psel)
Definition: sel1.c:184
l_int32 ** create2dIntArray(l_int32 sy, l_int32 sx)
Definition: sel1.c:303
SEL * selReadStream(FILE *fp)
Definition: sel1.c:800
l_int32 selaWrite(const char *fname, SELA *sela)
Definition: sel1.c:641
char * selGetName(SEL *sel)
Definition: sel1.c:458
l_int32 selaAddSel(SELA *sela, SEL *sel, const char *selname, l_int32 copyflag)
Definition: sel1.c:342
l_int32 selSetElement(SEL *sel, l_int32 row, l_int32 col, l_int32 type)
Definition: sel1.c:557
static const l_int32 BUFSIZE
Definition: sel1.c:79
SEL * selaGetSel(SELA *sela, l_int32 i)
Definition: sel1.c:436
SEL * selCreate(l_int32 height, l_int32 width, const char *name)
Definition: sel1.c:156
static const l_int32 MANY_SELS
Definition: sel1.c:78
static const l_int32 INITIAL_PTR_ARRAYSIZE
Definition: sel1.c:77
l_int32 selaGetCount(SELA *sela)
Definition: sel1.c:417
SEL * selCreateBrick(l_int32 h, l_int32 w, l_int32 cy, l_int32 cx, l_int32 type)
Definition: sel1.c:263
SELA * selaReadStream(FILE *fp)
Definition: sel1.c:764
SELA * selaRead(const char *fname)
Definition: sel1.c:737
l_int32 selaExtendArray(SELA *sela)
Definition: sel1.c:389
l_int32 selaFindSelByName(SELA *sela, const char *name, l_int32 *pindex, SEL **psel)
Definition: sel1.c:479
char linebuf[12000]
Definition: spottopgm.c:21
l_int32 sx
Definition: morph.h:114
l_int32 cy
Definition: morph.h:115
l_int32 cx
Definition: morph.h:116
l_int32 ** data
Definition: morph.h:117
char * name
Definition: morph.h:118
l_int32 sy
Definition: morph.h:113
Definition: morph.h:124
struct Sel ** sel
Definition: morph.h:127
l_int32 nalloc
Definition: morph.h:126
l_int32 n
Definition: morph.h:125
#define FILE
Definition: t1stdio.h:34
int j
Definition: t4ht.c:1589