File DISAMPUB.H:
ULONG eucdis^J    (^J    LONG deltaxL,                  /* x difference = x0 - x1             */^J    LONG deltayL                      /* y difference = y0 - y1             */^J    );^J^JBOOL cmp4^J    (^J    ZO_DATA       *zo_dataP,^J    TINY *dpt^J    );^J^JBOOL rat2^J    (^J    ZO_DATA      *zo_dataP,^J    TINY *input_dpt^J    );^J^JBOOL rat3^J    (^J    ZO_DATA        *zo_dataP,^J    TINY *input_dpt^J    );^J^JBOOL  ixing^J    (^J    STROKE *ps,^J    COUNT p3,^J    COUNT p4,^J    COUNT sx,^J    COUNT sy,^J    COUNT x1,^J    COUNT x2,^J    COUNT y1,^J    COUNT y2^J    );^J^JBOOL xing12^J    (^J    ZO_DATA        *zo_dataP,^J    TINY *dpt^J    );^J^JBOOL ccdthr^J    (^J    ZO_DATA    *zo_dataP,^J    TINY *dpt^J    );^J^JBOOL dist^J    (^J    ZO_DATA      *zo_dataP,^J    TINY *input_dpt^J    );^J^JINT  ifin2^J    (^J    STROKE *ps,^J    COUNT p1,^J    COUNT p2,^J    COUNT type^J    );^J^JBOOL fin2^J    (^J    ZO_DATA    *zo_dataP,^J    TINY *input_dpt^J    );^J^JBOOL find^J    (^J    ZO_DATA        *zo_dataP,^J    TINY *input_dpt^J    );^J^JBOOL hocvrc^J    (^J    ZO_DATA      *zo_dataP,^J    TINY *dpt^J    );^J^JBOOL hrivrtp^J    (^J    ZO_DATA   *zo_dataP,^J    TINY *dpt^J    );^J^JBOOL leng12^J    (^J    ZO_DATA    *zo_dataP,^J    TINY *input_dpt^J    );^J^JBOOL angl^J    (^J    ZO_DATA        *zo_dataP,^J    TINY *dpt^J    );^J^JBOOL avac^J    (^J    ZO_DATA      *zo_dataP,^J    TINY *dpt^J    );^J^JBOOL avag^J    (^J    ZO_DATA      *zo_dataP,^J    TINY *dpt^J    );^J^JBOOL avan^J    (^J    ZO_DATA      *zo_dataP,^J    TINY *dpt^J    );^J^JBOOL pls3(^J    ZO_DATA    *zo_dataP,^J    TINY *dpt^J    );^J^JBOOL rtlt^J    (^J    ZO_DATA      *zo_dataP,^J    TINY *dpt^J    );^J^JINT pindex^J    (^J    ZO_DATA     *zo_dataP,^J    STROKE *ps,^J    COUNT  pt^J    );^J^JVOID p2index^J    (^J    ZO_DATA  *zo_dataP,^J    STROKE *ps,^J    COUNT  pt1,^J    COUNT  pt2,^J    COUNT *ibegP,^J    COUNT *iendP^J    );^J^JBOOL hrivrt^J    (^J    ZO_DATA   *zo_dataP,^J    TINY *dP^J    );^J^JBOOL cccw^J    (^J    ZO_DATA       *zo_dataP,^J    TINY *dpt^J    );^J^J/* CIC_ATAN2_MACRO                 CIC Proprietary^J *-----------------------------------------------------------------------------^J * Macro to calculate the angle between two points, (xo, yo) and (x1, y1).^J * That is, calculation of arctan(x1 - xo, y1 - yo).^J *^J * NOTE:  Must include the following in the calling program^J *^J *       1. IMPORT COUNT angle_table[];^J *^J * inputs:        dx = (x1 - xo)    --    the x difference value^J *              dy = (x1 - xo)    --    the y difference value^J *^J * output:  angle             --    the calculated angle [arctan(dx, dy)]^J *^J * j. s. ostrem          Nov 23, 1992        Macro version of cic_atan2 (taken^J *                                   from ~ostrem/lib/jsolib/cic_atan2.c)^J *-----------------------------------------------------------------------------^J */^J^J#define CIC_ATAN2_MACRO(dx, dy, angle) \^J    { \^J    LONG absdxL; \^J    LONG absdyL; \^J    IMPORT COUNT angle_table[]; \^J    absdxL = (LONG) abs(dx); \^J    absdyL = (LONG) abs(dy); \^J    if (absdxL >= absdyL) \^J       { \^J   if (absdxL != 0L) \^J       angle = angle_table[((absdyL << 7) + (absdxL >> 1)) / absdxL]; \^J  else \^J            angle = 0; \^J      } \^J    else \^J       angle = 900 - angle_table[((absdxL << 7) + (absdyL >> 1)) / absdyL]; \^J    if (dx < 0) \^J        angle = 1800 - angle; \^J    if (dy < 0) \^J        angle = -angle; \^J    }^J/*-------------------------- end of CIC_ATAN2_MACRO -------------------------*/^J^J^J/* DIST_512_4_MACRO                       CIC Proprietary^J *-----------------------------------------------------------------------------^J * Macro to calculate the distance (x512) between two points.  It is assumed^J * that the arguments dxL, dyL, distL, are LONG integers.  After the macro^J * is called, distL contains an approximation to the true euclidean distance.^J * The calculation has a MAXIMUM error of 4% (except for very small input^J * values), based on the following formulae:^J *^J * If (x0, y0) and (x1, y1) are the two points to calculate the distance^J * between, then define^J *^J *               dx  =  x0 - x1^J *              dy  =  y0 - y1^J *^J * Note that both dx and dy can be positive or negative, so calculate^J *^J *               abs_dx  =  |x0 - x1|^J *                abs_dy  =  |y0 - y1|^J *^J * The calculation is based on an approximation to the hypotenuse C^J * of a right triangle with sides A = max(abs_dx, abs_dy) and^J * B = min(abs_dx, abs_dy)^J *^J * If A >= 2B, the function returns:^J *^J *              512 * (A + B/4) = 128 * (4A  + B)^J *                              = ((A << 2) + B) << 7^J *^J * If A < 2B, the function returns:^J *^J *              512 * (7A/8 + B/2)  =  64 * (7A + 4B)^J *                                  =  ((A << 3) - A + (B << 2)) << 6^J *^J *^J * NOTE: For efficiency there is no checking done to determine if the^J *   calculated distance will be too large to fit in an LONG^J *     integer (i.e., there is no OVERFLOW protection).  Hence it is the^J *   programmer's responsibility to check for this condition before^J *      calling the program if it is possible, given the problem, for^J *       the overflow to occur.  See below for definitions of the size^J *       of LONG and UNSIGNED LONG integers.^J *^J * NOTE: a LONG integer is in the range  -(2 to the power of 31) to^J *        (2 to the power of 31 - 1), or from slightly less than minus 2^J *       to slightly more than plus 2 billion.^J * NOTE: an UNSIGNED LONG integer is a POSITIVE integer in the range 0 to^J *   (2 to the power of 32), or 0 to something more than 4 billion^J *^J *^J * inputs:      dxL = (x1 - xo)   --    the x difference value^J *              dyL = (x1 - xo)   --    the y difference value^J *^J * output:  distL             --    the calculated Euclidean Distance (x512)^J *^J * j. s. ostrem       Nov 24, 1992        Macro version of  dist_512_4.c^J *-----------------------------------------------------------------------------^J */^J^J#define DIST_512_4_MACRO(dxL, dyL, distL) \^J    { \^J    if (dxL < 0) \^J      dxL = -dxL; \^J    if (dyL < 0) \^J     dyL = -dyL; \^J    if (dxL <= dyL) \^J  { \^J   distL = dxL; \^J        dxL   = dyL; \^J        dyL   = distL; \^J      } \^J    if (dxL > (dyL << 1)) \^J      distL = ((dxL << 2) + dyL) << 7; \^J    else \^J        distL = ((dxL << 3) - dxL + (dyL << 2)) << 6; \^J    }^J/*-------------------------- end of DIST_512_4_MACRO ------------------------*/^J^J^J#endif     /* ifndef DISAMPUB_H */
File HMMMACRO.H:
 *                                      from ~ostrem/lib/jsolib/eucdis.c, a^J *                                      better version of rawdis)^J * D. Hwang     14-Oct-93       Implement Dan Illowsky's new fast C version.^J *-----------------------------------------------------------------------------^J */^J#define RAWDIS_MACRO(i, j, ax, ay, disL) \^J    { \^J    COUNT dx, dy, temp, scaleFactor; \^J    IMPORT COUNT sqrttb[]; \^J    IMPORT COUNT distIndexTbl[]; \^J    dx = ax[i] - ax[j]; \^J    dy = ay[i] - ay[j]; \^J    if (dx < 0) \^J        dx = -dx; \^J    if (dy < 0) \^J        dy = -dy; \^J    if ((dx == 0) || (dy == 0)) \^J        disL = ((ULONG)dx + (ULONG)dy) << 9; \^J    else \^J        { \^J        if (dx > dy) \^J            { \^J            temp = dx; \^J            dx   = dy; \^J            dy   = temp; \^J            } \^J        if (dy <= 25) \^J            disL = (LONG) sqrttb[dx + distIndexTbl[dy]]; \^J        else \^J            { \^J            scaleFactor = (dy + 24) / 25; \^J            dx  = (dx + (scaleFactor >> 1)) / scaleFactor; \^J            dy  = (dy + (scaleFactor >> 1)) / scaleFactor; \^J            if (dx == 0) \^J                disL = ((LONG)scaleFactor) * (((LONG)dy) << 9); \^J            else \^J                disL = scaleFactor * ((LONG) sqrttb[dx + distIndexTbl[dy]]); \^J            } \^J        } \^J    }^J^J#endif
File PROTO.H:
CIC_LONG eucdis^J    (^J    CIC_LONG dxL,^J    CIC_LONG dyL^J    );^J^JCIC_VOID preprocess^J    (^J    STKDATA      *stkP                    /* Character data.    */^J    );^J^JCIC_UINT8 reclow^J    (^J    LOWREC     *recP,                   /* Recognition structure.            */^J    CHDATA     *chP ,                   /* Do recognition on this Character. */^J    CIC_INT    *two_stk_modIP               /* Model index for 2-stk char        */^J    );^J^JCIC_VOID find_box^J    (^J    DATABOX        *boxP,                  /* Data structure for one box.*/^J    CIC_INT16         *xWP,                   /* input  array of x-coordinate valus*/^J    CIC_INT16  *yWP,                   /* input  array of y-coordinate valus*/^J    CIC_INT16  lenW                    /* Length of the data array.         */^J    );^J                                       /* and shift origin to (minx, miny).*/^JCIC_BOOL8 find_crossB^J    (^J    CIC_INT16     *xWP,^J    CIC_INT16    *yWP,^J    CIC_INT      *begIP,^J    CIC_INT    *endIP,^J    CIC_INT    dtI,               /* step size for searching next maxW/minW. */^J    CIC_INT   *crossIP            /* Pointer to index array of cross points.*/^J    );^J^JCIC_INT16  seg_curvatureW^J    (^J    STKDATA     *stkP,                  /* Raw data of input stroke.    */^J    CIC_INT16   begW,^J    CIC_INT16   lenW^J    );^J^JCIC_VOID reverse_stroke^J    (^J    STKDATA    *stkP                   /* Stroke data.    */^J    );^J^JCIC_VOID rec_disamb^J    (^J    LOWREC      *recP,             /* Recognition structure.       */^J    STKDATA     *stkP               /* Input stroke data.           */^J    );^J^JCIC_VOID check_eight^J    (^J    STKDATA     *stkP,               /* Input stroke data.           */^J    CIC_INT *recogIP^J    );^J  ^JZO_CHAR shape_to_result^J    (^J    CIC_UINT8     shapeUC,                /* Returned shape from core     */                      ^J    ZO_CHAR   mode                    /* Current mode                 */^J    );^J^JZO_CHAR get_accented_char^J    (^J    ZO_CHAR     baseUW,                         /* Base character       */^J    ZO_CHAR markUW                          /* Accent mark          */^J    );^J    ^J#endif          /* closes the ifndef PROTO_H at the top of the file */ ^J/*---------------------------------------------------------------------------*/
File ZOHMMPUB.H:
ULONG eucdis^J    (^J    LONG deltaxL,                  /* x difference = x0 - x1             */^J    LONG deltayL                      /* y difference = y0 - y1             */^J    );^J    ^JCOUNT cic_atan2^J    (^J    COUNT x, ^J    COUNT y^J    );   ^J^JCOUNT ang32L^J    (^J    LONG dxL,                                   /* X difference */^J    LONG dyL                                    /* Y difference */^J    );^J^JVOID hmm_spa_samp^J    (^J    COUNT  numin,               /* Number of input in raw data               */^J    COUNT  xarray[],            /* Input array of x-coordinate values        */^J    COUNT  yarray[],            /* Input array of y-coordinate values        */^J    COUNT  numout,              /* Number of output points                   */^J    LONG   lxL[],               /* Spatially sampled x values                */^J    LONG   lyL[],               /* Spatially sampled y values                */^J    LONG   cumlenL[]            /* saves accumated length along stroke       */^J    );^J^JBOOL dcheck^J    (^J    ZO_DATA      *zo_dataP,      /* Overall global data                       */^J    COUNT ndis,                 /* No. of bytes of disamb. for this block    */^J    TINY  *dpt,                 /* Pointer to start of disamb. logic block   */^J    BOOL  btype                 /* YES if this is an OR block, NO if AND     */^J    );^J^JBOOL plsjso^J    (^J    COUNT  x[],                         /* X values of character             */^J    COUNT  y[],                         /* X values of character             */^J    COUNT  beg,                         /* starting index                    */^J    COUNT  end,                         /* ending   index                    */^J    COUNT  maxpts,                      /* maximum dimensioned length of X,Y */^J    COUNT  lowccw,                      /* lower thres counterclockwise angle*/^J    COUNT  upccw,                       /* upper thres counterclockwise angle*/^J    COUNT  lowcw,                       /* lower thres for clockwise angle   */^J    COUNT  upcw,                        /* upper thres for clockwise angle   */^J    COUNT  lghseg,                      /* length of PLS arm                 */^J    COUNT *indexP,                      /* index of largest angle            */^J    COUNT *angleP                       /* value of largest angle (x10)      */^J    );^J^JBOOL len3^J    (    ^J    STROKE * sP,^J    COUNT  i1,     /* Beginning point of first segment                  */^J    COUNT  i2,     /* End point of first segment                        */^J    COUNT  j1,     /* Beginning point of second segment                 */^J    COUNT  j2,     /* End point of second segment                       */^J    COUNT parm          /* Fraction (in eighths) for comparison              */^J    );^J^JBOOL kangl^J    (^J    STROKE *s1P,                      /* pointer to  first stroke            */^J    STROKE *s2P,                      /* pointer to second stroke            */^J    COUNT ibeg1,                      /* beginning point for  first stroke   */^J    COUNT iend1,                      /*    ending point for  first stroke   */^J    COUNT ibeg2,                      /* beginning point for second stroke   */^J    COUNT iend2,                      /*    ending point for second stroke   */^J    COUNT parm1,                      /* lower input threshold divided by 5  */^J    COUNT parm2                       /* upper input threshold divided by 5  */^J    );^J^JBOOL resamp^J    (^J    COUNT ix[],         /* array of original x values                        */^J    COUNT iy[],         /* array of original y values                        */^J    COUNT ibeg,         /* first point of original sample for resampling     */^J    COUNT iend,         /* last point of original sample for resampling      */^J    COUNT *ixn,         /* array of resampled x values                       */^J    COUNT *iyn,         /* array of resampled y values                       */^J    COUNT numout        /* number of points in the output arrays             */^J    );^J^JBOOL resamp2^J    (^J    COUNT *ix,          /* array of original x values                        */^J    COUNT *iy,          /* array of original y values                        */^J    COUNT ibeg,         /* first point of original sample for resampling     */^J    COUNT iend,         /* last point of original sample for resampling      */^J    COUNT *ixn,         /* array of resampled x values                       */^J    COUNT *iyn          /* array of resampled y values                       */^J    );^J^JARGINT hookdt^J    (^J    STROKE *instkP,^J                                /* Pointer to input stroke (to be resampled) */^J    STROKE *outstkP,^J                                /* Pointer to buffer for copy of input stroke*/^J    COUNT *endptP,              /* Point index of detected end hook          */^J    COUNT *begptP               /* Point index of detected beginning hook    */^J    );^J^JLONG rawdis^J    (^J    COUNT i,^J    COUNT j,^J    COUNT ax[],^J    COUNT ay[]^J    );^J
