find_.pp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. unit find_;
  19. interface
  20. uses palmos, coretraps, rect;
  21. const
  22. maxFinds = 9;
  23. maxFindStrLen = 16;
  24. type
  25. FindMatchType = record
  26. appCardNo: UInt16; // card number of the application
  27. appDbID: LocalID; // LocalID of the application
  28. foundInCaller: Boolean; // true if found in app that called Find
  29. reserved: UInt8;
  30. dbCardNo: UInt16; // card number of the database record was found in
  31. dbID: LocalID; // LocalID of the database record was found in
  32. recordNum: UInt16; // index of record that contain a match
  33. matchPos: UInt16; // postion in record of the match.
  34. matchFieldNum: UInt16; // field number
  35. matchCustom: UInt32; // app specific data
  36. end;
  37. FindMatchPtr = ^FindMatchType;
  38. FindParamsType = record
  39. // These fields are used by the applications.
  40. dbAccesMode: UInt16; // read mode and maybe show secret
  41. recordNum: UInt16; // index of last record that contained a match
  42. more: Boolean; // true of more matches to display
  43. strAsTyped: array [0..maxFindStrLen] of Char; // search string as entered
  44. strToFind: array [0..maxFindStrLen] of Char; // search string is lower case
  45. reserved1: UInt8;
  46. // The lineNumber field can be modified by the app. The continuation field can
  47. // be tested by the app. All other fields are private to the Find routine and
  48. // should NOT be accessed by applications.
  49. {$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_FINDPARAMS} // These fields will not be available in the next OS release!
  50. numMatches: UInt16; // # of matches
  51. lineNumber: UInt16; // next line in the results tabel
  52. continuation: Boolean; // true if contining search of same app
  53. searchedCaller: Boolean; // true after we've searched app that initiated the find
  54. callerAppDbID: LocalID; // dbID of app that initiated search
  55. callerAppCardNo: UInt16; // cardNo of app that initiated search
  56. appDbID: LocalID; // dbID of app that we're currently searching
  57. appCardNo: UInt16; // card number of app that we're currently searching
  58. newSearch: Boolean; // true for first search
  59. reserved2: UInt8;
  60. searchState: DmSearchStateType; // search state
  61. match: array [0..maxFinds-1] of FindMatchType;
  62. {$else}
  63. noAccessAllowed1: UInt16; // # of matches
  64. lineNumber: UInt16; // next line in the results tabel
  65. continuation: Boolean; // true if contining search of same app
  66. noAccessAllowed2: Boolean; // padding
  67. {$endif}
  68. end;
  69. FindParamsPtr = ^FindParamsType;
  70. // Param Block passsed with the sysAppLaunchCmdGoto Command
  71. GoToParamsType = record
  72. searchStrLen: Int16; // length of search string.
  73. dbCardNo: UInt16; // card number of the database
  74. dbID: LocalID; // LocalID of the database
  75. recordNum: UInt16; // index of record that contain a match
  76. matchPos: UInt16; // postion in record of the match.
  77. matchFieldNum: UInt16; // field number string was found int
  78. matchCustom: UInt32; // application specific info
  79. end;
  80. GoToParamsPtr = ^GoToParamsType;
  81. //----------------------------------------------------------
  82. // Find Functions
  83. //----------------------------------------------------------
  84. procedure Find(goToP: GoToParamsPtr); syscall sysTrapFind;
  85. function FindStrInStr(strToSearch, strToFind: PChar; var posP: UInt16): Boolean; syscall sysTrapFindStrInStr;
  86. function FindSaveMatch(findParams: FindParamsPtr; recordNum, pos, fieldNum: UInt16;
  87. appCustom: UInt32; cardNo: UInt16; dbID: LocalID): Boolean; syscall sysTrapFindSaveMatch;
  88. procedure FindGetLineBounds(const findParams: FindParamsPtr; r: RectanglePtr); syscall sysTrapFindGetLineBounds;
  89. function FindDrawHeader(findParams: FindParamsPtr; title: PChar): Boolean; syscall sysTrapFindDrawHeader;
  90. implementation
  91. end.