Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

133 lines
3.9 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: otter.h
  3. *
  4. * Primary data structures for the Otter recognizer.
  5. *
  6. * Created: 20-Jul-1995 09:42:38
  7. * Author: Patrick Haluptzok patrickh
  8. *
  9. * Copyright (c) 1994 Microsoft Corporation
  10. \**************************************************************************/
  11. #ifndef __INCLUDE_OTTER
  12. #define __INCLUDE_OTTER
  13. #ifdef __cplusplus
  14. extern "C"
  15. {
  16. #endif
  17. /************ Settings for different versions of Otter *****************\
  18. *
  19. * OTTER_FIB - Use the old otter database "fib.dat" with Fibonacci indices
  20. *
  21. \***********************************************************************/
  22. // #define OTTER_FIB
  23. #ifdef OTTER_FIB
  24. #define OTTER_NUM_SPACES 32 // Old (Fibonacci) number of spaces
  25. #else
  26. #define OTTER_NUM_SPACES 52
  27. #endif
  28. #define OTTER_CMEASMAX 50
  29. typedef struct tagOTTER_PROTO
  30. {
  31. XY size; // unscaled size in xy
  32. UINT index; // space index
  33. FLOAT rgmeas[OTTER_CMEASMAX]; // measurements
  34. } OTTER_PROTO;
  35. OTTER_PROTO *OtterFeaturize(GLYPH *);
  36. #define OTTER_SPLIT 0x01 // Constants for masking bDBType
  37. #define OTTER_FLIP 0x02
  38. typedef struct tagOTTER_DB_STATIC
  39. {
  40. WORD acProtoInSpace[OTTER_NUM_SPACES]; // Count of prototypes
  41. BYTE *apjDataInSpace[OTTER_NUM_SPACES]; // Pointers to features
  42. WORD *apwTokensInSpace[OTTER_NUM_SPACES]; // Tokens
  43. WORD *apwDensityInSpace[OTTER_NUM_SPACES]; // Densities
  44. BYTE bDBType; // Type of the database
  45. } OTTER_DB_STATIC;
  46. extern OTTER_DB_STATIC gStaticOtterDb; // Otter lib external variable!
  47. typedef struct tagOTTER_LOAD_INFO
  48. {
  49. void * pLoadInfo1;
  50. void * pLoadInfo2;
  51. void * pLoadInfo3;
  52. } OTTER_LOAD_INFO;
  53. //
  54. // Implemented in "otterfl.c", used a lot
  55. BOOL OtterLoadRes(HINSTANCE, int, int, LOCRUN_INFO * pLocRunInfo);
  56. BOOL OtterLoadFile(LOCRUN_INFO * pLocRunInfo, OTTER_LOAD_INFO * pLoadInfo, wchar_t * pathName);
  57. BOOL OtterUnLoadFile(OTTER_LOAD_INFO * pLoadInfo);
  58. //
  59. // Implemented in "omatch.c" and "omatch2.c", used a lot
  60. int OtterMatch(ALT_LIST *pAlt, int cAlt, GLYPH *pGlyph, CHARSET *pCS,LOCRUN_INFO * pLocRunInfo);
  61. int OtterMatch2(ALT_LIST *pAlt, int cAlt, GLYPH *pGlyph, CHARSET *pCS,LOCRUN_INFO * pLocRunInfo, int *pSpaceNum);
  62. //
  63. // Functions for Otter tools (some used in Otter itself)
  64. //
  65. // Implemented in "otter.c", used a lot
  66. int CountMeasures(int index); // I: Otter index (non-compact)
  67. //
  68. // Functions for tranforming one index into another
  69. int Index2CompIndex(int index);
  70. int CompIndex2Index(int iCompact);
  71. BOOL IsActiveCompSpace(int iCompSpace); // I: ID of Otter compact space
  72. #ifndef HWX_PRODUCT
  73. //
  74. // Implemented in "otter.c", used in "prune" only!
  75. int CountStrokes(int index); // I: Otter index (non-compact)
  76. //
  77. // Implemented in "otrain.c", used in "prune" only!
  78. int OtterTrain
  79. (
  80. double *pjTrainProto, // Pointer to the train clusters packed together.
  81. int *awTrainTokens, // Pointer to the token labels for the train clusters.
  82. int *awDensity, // Pointer to the density labels for the train clusters.
  83. int *aiValid, // Array that tells which clusters are valid to map to.
  84. int cTrainProto, // Count of train prototypes to look through.
  85. int cFeat, // Count of features per prototype.
  86. double *pjTestProto, // Pointer to the prototype we are trying to classify.
  87. int *awToken, // Array of WORD's we return our best matches into.
  88. double *aeProbMatch, // Array of Error associated with each guess.
  89. int cMaxReturn // Count of maximum number of guesses we should return.
  90. );
  91. //
  92. // Implemented in "io.c", used in "ink2mars" only!
  93. BOOL OtterWrite(FILE *, wchar_t *, int, OTTER_PROTO *, int, wchar_t, wchar_t);
  94. BOOL OtterRead(FILE *, OTTER_PROTO *); // Not used anywhere!!!
  95. #endif
  96. #ifdef __cplusplus
  97. };
  98. #endif
  99. #endif // __INCLUDE_OTTER