CFBitVector.pas 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. { CFBitVector.h
  2. Copyright (c) 1998-2009, Apple Inc. All rights reserved.
  3. }
  4. { Pascal Translation: Peter N Lewis, <[email protected]>, 2004 }
  5. { Pascal Translation Updated: Peter N Lewis, <[email protected]>, September 2005 }
  6. { Pascal Translation Updated: Jonas Maebe, <[email protected]>, October 2009 }
  7. {
  8. Modified for use with Free Pascal
  9. Version 308
  10. Please report any bugs to <[email protected]>
  11. }
  12. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  13. {$mode macpas}
  14. {$packenum 1}
  15. {$macro on}
  16. {$inline on}
  17. {$calling mwpascal}
  18. unit CFBitVector;
  19. interface
  20. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  21. {$setc GAP_INTERFACES_VERSION := $0308}
  22. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  23. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  24. {$endc}
  25. {$ifc defined CPUPOWERPC and defined CPUI386}
  26. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  27. {$endc}
  28. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  29. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  30. {$endc}
  31. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  32. {$setc __ppc__ := 1}
  33. {$elsec}
  34. {$setc __ppc__ := 0}
  35. {$endc}
  36. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  37. {$setc __ppc64__ := 1}
  38. {$elsec}
  39. {$setc __ppc64__ := 0}
  40. {$endc}
  41. {$ifc not defined __i386__ and defined CPUI386}
  42. {$setc __i386__ := 1}
  43. {$elsec}
  44. {$setc __i386__ := 0}
  45. {$endc}
  46. {$ifc not defined __x86_64__ and defined CPUX86_64}
  47. {$setc __x86_64__ := 1}
  48. {$elsec}
  49. {$setc __x86_64__ := 0}
  50. {$endc}
  51. {$ifc not defined __arm__ and defined CPUARM}
  52. {$setc __arm__ := 1}
  53. {$elsec}
  54. {$setc __arm__ := 0}
  55. {$endc}
  56. {$ifc defined cpu64}
  57. {$setc __LP64__ := 1}
  58. {$elsec}
  59. {$setc __LP64__ := 0}
  60. {$endc}
  61. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  62. {$error Conflicting definitions for __ppc__ and __i386__}
  63. {$endc}
  64. {$ifc defined __ppc__ and __ppc__}
  65. {$setc TARGET_CPU_PPC := TRUE}
  66. {$setc TARGET_CPU_PPC64 := FALSE}
  67. {$setc TARGET_CPU_X86 := FALSE}
  68. {$setc TARGET_CPU_X86_64 := FALSE}
  69. {$setc TARGET_CPU_ARM := FALSE}
  70. {$setc TARGET_OS_MAC := TRUE}
  71. {$setc TARGET_OS_IPHONE := FALSE}
  72. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  73. {$elifc defined __ppc64__ and __ppc64__}
  74. {$setc TARGET_CPU_PPC := FALSE}
  75. {$setc TARGET_CPU_PPC64 := TRUE}
  76. {$setc TARGET_CPU_X86 := FALSE}
  77. {$setc TARGET_CPU_X86_64 := FALSE}
  78. {$setc TARGET_CPU_ARM := FALSE}
  79. {$setc TARGET_OS_MAC := TRUE}
  80. {$setc TARGET_OS_IPHONE := FALSE}
  81. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  82. {$elifc defined __i386__ and __i386__}
  83. {$setc TARGET_CPU_PPC := FALSE}
  84. {$setc TARGET_CPU_PPC64 := FALSE}
  85. {$setc TARGET_CPU_X86 := TRUE}
  86. {$setc TARGET_CPU_X86_64 := FALSE}
  87. {$setc TARGET_CPU_ARM := FALSE}
  88. {$ifc defined(iphonesim)}
  89. {$setc TARGET_OS_MAC := FALSE}
  90. {$setc TARGET_OS_IPHONE := TRUE}
  91. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  92. {$elsec}
  93. {$setc TARGET_OS_MAC := TRUE}
  94. {$setc TARGET_OS_IPHONE := FALSE}
  95. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  96. {$endc}
  97. {$elifc defined __x86_64__ and __x86_64__}
  98. {$setc TARGET_CPU_PPC := FALSE}
  99. {$setc TARGET_CPU_PPC64 := FALSE}
  100. {$setc TARGET_CPU_X86 := FALSE}
  101. {$setc TARGET_CPU_X86_64 := TRUE}
  102. {$setc TARGET_CPU_ARM := FALSE}
  103. {$setc TARGET_OS_MAC := TRUE}
  104. {$setc TARGET_OS_IPHONE := FALSE}
  105. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  106. {$elifc defined __arm__ and __arm__}
  107. {$setc TARGET_CPU_PPC := FALSE}
  108. {$setc TARGET_CPU_PPC64 := FALSE}
  109. {$setc TARGET_CPU_X86 := FALSE}
  110. {$setc TARGET_CPU_X86_64 := FALSE}
  111. {$setc TARGET_CPU_ARM := TRUE}
  112. { will require compiler define when/if other Apple devices with ARM cpus ship }
  113. {$setc TARGET_OS_MAC := FALSE}
  114. {$setc TARGET_OS_IPHONE := TRUE}
  115. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  116. {$elsec}
  117. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ is defined.}
  118. {$endc}
  119. {$ifc defined __LP64__ and __LP64__ }
  120. {$setc TARGET_CPU_64 := TRUE}
  121. {$elsec}
  122. {$setc TARGET_CPU_64 := FALSE}
  123. {$endc}
  124. {$ifc defined FPC_BIG_ENDIAN}
  125. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  126. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  127. {$elifc defined FPC_LITTLE_ENDIAN}
  128. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  129. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  130. {$elsec}
  131. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  132. {$endc}
  133. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  134. {$setc CALL_NOT_IN_CARBON := FALSE}
  135. {$setc OLDROUTINENAMES := FALSE}
  136. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  137. {$setc OPAQUE_UPP_TYPES := TRUE}
  138. {$setc OTCARBONAPPLICATION := TRUE}
  139. {$setc OTKERNEL := FALSE}
  140. {$setc PM_USE_SESSION_APIS := TRUE}
  141. {$setc TARGET_API_MAC_CARBON := TRUE}
  142. {$setc TARGET_API_MAC_OS8 := FALSE}
  143. {$setc TARGET_API_MAC_OSX := TRUE}
  144. {$setc TARGET_CARBON := TRUE}
  145. {$setc TARGET_CPU_68K := FALSE}
  146. {$setc TARGET_CPU_MIPS := FALSE}
  147. {$setc TARGET_CPU_SPARC := FALSE}
  148. {$setc TARGET_OS_UNIX := FALSE}
  149. {$setc TARGET_OS_WIN32 := FALSE}
  150. {$setc TARGET_RT_MAC_68881 := FALSE}
  151. {$setc TARGET_RT_MAC_CFM := FALSE}
  152. {$setc TARGET_RT_MAC_MACHO := TRUE}
  153. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  154. {$setc TYPE_BOOL := FALSE}
  155. {$setc TYPE_EXTENDED := FALSE}
  156. {$setc TYPE_LONGLONG := TRUE}
  157. uses MacTypes,CFBase;
  158. {$endc} {not MACOSALLINCLUDE}
  159. {$ALIGN POWER}
  160. type
  161. CFBit = UInt32;
  162. type
  163. CFBitVectorRef = ^SInt32; { an opaque type }
  164. CFMutableBitVectorRef = ^SInt32; { an opaque type }
  165. function CFBitVectorGetTypeID: CFTypeID; external name '_CFBitVectorGetTypeID';
  166. function CFBitVectorCreate( allocator: CFAllocatorRef; bytes: UnivPtr; numBits: CFIndex ): CFBitVectorRef; external name '_CFBitVectorCreate';
  167. function CFBitVectorCreateCopy( allocator: CFAllocatorRef; bv: CFBitVectorRef ): CFBitVectorRef; external name '_CFBitVectorCreateCopy';
  168. function CFBitVectorCreateMutable( allocator: CFAllocatorRef; capacity: CFIndex ): CFMutableBitVectorRef; external name '_CFBitVectorCreateMutable';
  169. function CFBitVectorCreateMutableCopy( allocator: CFAllocatorRef; capacity: CFIndex; bv: CFBitVectorRef ): CFMutableBitVectorRef; external name '_CFBitVectorCreateMutableCopy';
  170. function CFBitVectorGetCount( bv: CFBitVectorRef ): CFIndex; external name '_CFBitVectorGetCount';
  171. function CFBitVectorGetCountOfBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): CFIndex; external name '_CFBitVectorGetCountOfBit';
  172. function CFBitVectorContainsBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): Boolean; external name '_CFBitVectorContainsBit';
  173. function CFBitVectorGetBitAtIndex( bv: CFBitVectorRef; idx: CFIndex ): CFBit; external name '_CFBitVectorGetBitAtIndex';
  174. procedure CFBitVectorGetBits( bv: CFBitVectorRef; range: CFRange; bytes: UnivPtr ); external name '_CFBitVectorGetBits';
  175. function CFBitVectorGetFirstIndexOfBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): CFIndex; external name '_CFBitVectorGetFirstIndexOfBit';
  176. function CFBitVectorGetLastIndexOfBit( bv: CFBitVectorRef; range: CFRange; value: CFBit ): CFIndex; external name '_CFBitVectorGetLastIndexOfBit';
  177. procedure CFBitVectorSetCount( bv: CFMutableBitVectorRef; count: CFIndex ); external name '_CFBitVectorSetCount';
  178. procedure CFBitVectorFlipBitAtIndex( bv: CFMutableBitVectorRef; idx: CFIndex ); external name '_CFBitVectorFlipBitAtIndex';
  179. procedure CFBitVectorFlipBits( bv: CFMutableBitVectorRef; range: CFRange ); external name '_CFBitVectorFlipBits';
  180. procedure CFBitVectorSetBitAtIndex( bv: CFMutableBitVectorRef; idx: CFIndex; value: CFBit ); external name '_CFBitVectorSetBitAtIndex';
  181. procedure CFBitVectorSetBits( bv: CFMutableBitVectorRef; range: CFRange; value: CFBit ); external name '_CFBitVectorSetBits';
  182. procedure CFBitVectorSetAllBits( bv: CFMutableBitVectorRef; value: CFBit ); external name '_CFBitVectorSetAllBits';
  183. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  184. end.
  185. {$endc} {not MACOSALLINCLUDE}