HGetURL (see figure 5.9) reads all regions passed in the input iconic parameter with the index par_num, computes the union of all these regions, and returns the resulting region in region. The Hrlregion data referenced by region must have been allocated before with a suitable size (e.g., by using HAllocRLTmp, see section “Temporary Data”, which can be increased e.g., by using HIncrRL, see section “HIncrRL”). Therefore, this region data can be overwritten without side effects. On the other hand, the memory must be deallocated at the end of the supply procedure (e.g., by using HFreeRLTmp). Figure 5.12 shows an application of HGetURL. Note that the area calculated in the example may differ from the sum of the areas of all single regions, because the single regions may overlap.
Note that HGetURL automatically checks the result state of the
underlying procedure with the macro HCkP (see
section “HCkP”). Thus, you must not use HCkP on
HGetURL yourself.
If you do not want to have the result state checked with
HCkP, use HPGetURL instead.
HPGetURL and HGetURL only differ regarding HCkP.
Hrlregion *region; ... HCkP(HAllocRLTmp(proc_handle,®ion)); HGetURL(proc_handle,par_num,region); /* processing (in general this should be done calling an action proc.) */ area = 0; for (i=0; i<region->num; i++) area += region->rl[i].ce - region->rl[i].cb + 1; HCkP(HFreeRLTmp(proc_handle,region));
Figure 5.12: Application of HGetURL.