find_.pp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. {$MACRO ON}
  2. (******************************************************************************
  3. *
  4. * Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
  5. * All rights reserved.
  6. *
  7. * File: Find.h
  8. *
  9. * Release: Palm OS SDK 4.0 (63220)
  10. *
  11. * Description:
  12. * This file defines field structures and routines.
  13. *
  14. * History:
  15. * August 29, 1994 Created by Art Lamb
  16. *
  17. *****************************************************************************)
  18. {$IFNDEF FPC_DOTTEDUNITS}
  19. unit find_;
  20. {$ENDIF FPC_DOTTEDUNITS}
  21. interface
  22. {$IFDEF FPC_DOTTEDUNITS}
  23. uses PalmApi.Palmos, PalmApi.Coretraps, PalmApi.Rect;
  24. {$ELSE FPC_DOTTEDUNITS}
  25. uses palmos, coretraps, rect;
  26. {$ENDIF FPC_DOTTEDUNITS}
  27. const
  28. maxFinds = 9;
  29. maxFindStrLen = 16;
  30. type
  31. FindMatchType = record
  32. appCardNo: UInt16; // card number of the application
  33. appDbID: LocalID; // LocalID of the application
  34. foundInCaller: Boolean; // true if found in app that called Find
  35. reserved: UInt8;
  36. dbCardNo: UInt16; // card number of the database record was found in
  37. dbID: LocalID; // LocalID of the database record was found in
  38. recordNum: UInt16; // index of record that contain a match
  39. matchPos: UInt16; // postion in record of the match.
  40. matchFieldNum: UInt16; // field number
  41. matchCustom: UInt32; // app specific data
  42. end;
  43. FindMatchPtr = ^FindMatchType;
  44. FindParamsType = record
  45. // These fields are used by the applications.
  46. dbAccesMode: UInt16; // read mode and maybe show secret
  47. recordNum: UInt16; // index of last record that contained a match
  48. more: Boolean; // true of more matches to display
  49. strAsTyped: array [0..maxFindStrLen] of AnsiChar; // search string as entered
  50. strToFind: array [0..maxFindStrLen] of AnsiChar; // search string is lower case
  51. reserved1: UInt8;
  52. // The lineNumber field can be modified by the app. The continuation field can
  53. // be tested by the app. All other fields are private to the Find routine and
  54. // should NOT be accessed by applications.
  55. {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FINDPARAMS} // These fields will not be available in the next OS release!
  56. numMatches: UInt16; // # of matches
  57. lineNumber: UInt16; // next line in the results tabel
  58. continuation: Boolean; // true if contining search of same app
  59. searchedCaller: Boolean; // true after we've searched app that initiated the find
  60. callerAppDbID: LocalID; // dbID of app that initiated search
  61. callerAppCardNo: UInt16; // cardNo of app that initiated search
  62. appDbID: LocalID; // dbID of app that we're currently searching
  63. appCardNo: UInt16; // card number of app that we're currently searching
  64. newSearch: Boolean; // true for first search
  65. reserved2: UInt8;
  66. searchState: DmSearchStateType; // search state
  67. match: array [0..maxFinds-1] of FindMatchType;
  68. {$else}
  69. noAccessAllowed1: UInt16; // # of matches
  70. lineNumber: UInt16; // next line in the results tabel
  71. continuation: Boolean; // true if contining search of same app
  72. noAccessAllowed2: Boolean; // padding
  73. {$endif}
  74. end;
  75. FindParamsPtr = ^FindParamsType;
  76. // Param Block passsed with the sysAppLaunchCmdGoto Command
  77. GoToParamsType = record
  78. searchStrLen: Int16; // length of search string.
  79. dbCardNo: UInt16; // card number of the database
  80. dbID: LocalID; // LocalID of the database
  81. recordNum: UInt16; // index of record that contain a match
  82. matchPos: UInt16; // postion in record of the match.
  83. matchFieldNum: UInt16; // field number string was found int
  84. matchCustom: UInt32; // application specific info
  85. end;
  86. GoToParamsPtr = ^GoToParamsType;
  87. //----------------------------------------------------------
  88. // Find Functions
  89. //----------------------------------------------------------
  90. procedure Find(goToP: GoToParamsPtr); syscall sysTrapFind;
  91. function FindStrInStr(strToSearch, strToFind: PAnsiChar; var posP: UInt16): Boolean; syscall sysTrapFindStrInStr;
  92. function FindSaveMatch(findParams: FindParamsPtr; recordNum, pos, fieldNum: UInt16;
  93. appCustom: UInt32; cardNo: UInt16; dbID: LocalID): Boolean; syscall sysTrapFindSaveMatch;
  94. procedure FindGetLineBounds(const findParams: FindParamsPtr; r: RectanglePtr); syscall sysTrapFindGetLineBounds;
  95. function FindDrawHeader(findParams: FindParamsPtr; title: PAnsiChar): Boolean; syscall sysTrapFindDrawHeader;
  96. implementation
  97. end.