1 { CFCalendar.h 2 Copyright (c) 2004-2013, Apple Inc. All rights reserved. 3 } 4 { 5 Modified for use with Free Pascal 6 Version 308 7 Please report any bugs to <gpc@microbizz.nl> 8 } 9 10 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE} 11 {$mode macpas} 12 {$modeswitch cblocks} 13 {$packenum 1} 14 {$macro on} 15 {$inline on} 16 {$calling mwpascal} 17 18 unit CFCalendar; 19 interface 20 {$setc UNIVERSAL_INTERFACES_VERSION := $0400} 21 {$setc GAP_INTERFACES_VERSION := $0308} 22 23 {$ifc not defined USE_CFSTR_CONSTANT_MACROS} 24 {$setc USE_CFSTR_CONSTANT_MACROS := TRUE} 25 {$endc} 26 27 {$ifc defined CPUPOWERPC and defined CPUI386} 28 {$error Conflicting initial definitions for CPUPOWERPC and CPUI386} 29 {$endc} 30 {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN} 31 {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN} 32 {$endc} 33 34 {$ifc not defined __ppc__ and defined CPUPOWERPC32} 35 {$setc __ppc__ := 1} 36 {$elsec} 37 {$setc __ppc__ := 0} 38 {$endc} 39 {$ifc not defined __ppc64__ and defined CPUPOWERPC64} 40 {$setc __ppc64__ := 1} 41 {$elsec} 42 {$setc __ppc64__ := 0} 43 {$endc} 44 {$ifc not defined __i386__ and defined CPUI386} 45 {$setc __i386__ := 1} 46 {$elsec} 47 {$setc __i386__ := 0} 48 {$endc} 49 {$ifc not defined __x86_64__ and defined CPUX86_64} 50 {$setc __x86_64__ := 1} 51 {$elsec} 52 {$setc __x86_64__ := 0} 53 {$endc} 54 {$ifc not defined __arm__ and defined CPUARM} 55 {$setc __arm__ := 1} 56 {$elsec} 57 {$setc __arm__ := 0} 58 {$endc} 59 {$ifc not defined __arm64__ and defined CPUAARCH64} 60 {$setc __arm64__ := 1} 61 {$elsec} 62 {$setc __arm64__ := 0} 63 {$endc} 64 65 {$ifc defined cpu64} 66 {$setc __LP64__ := 1} 67 {$elsec} 68 {$setc __LP64__ := 0} 69 {$endc} 70 71 72 {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__} 73 {$error Conflicting definitions for __ppc__ and __i386__} 74 {$endc} 75 76 {$ifc defined __ppc__ and __ppc__} 77 {$setc TARGET_CPU_PPC := TRUE} 78 {$setc TARGET_CPU_PPC64 := FALSE} 79 {$setc TARGET_CPU_X86 := FALSE} 80 {$setc TARGET_CPU_X86_64 := FALSE} 81 {$setc TARGET_CPU_ARM := FALSE} 82 {$setc TARGET_CPU_ARM64 := FALSE} 83 {$setc TARGET_OS_MAC := TRUE} 84 {$setc TARGET_OS_IPHONE := FALSE} 85 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 86 {$setc TARGET_OS_EMBEDDED := FALSE} 87 {$elifc defined __ppc64__ and __ppc64__} 88 {$setc TARGET_CPU_PPC := FALSE} 89 {$setc TARGET_CPU_PPC64 := TRUE} 90 {$setc TARGET_CPU_X86 := FALSE} 91 {$setc TARGET_CPU_X86_64 := FALSE} 92 {$setc TARGET_CPU_ARM := FALSE} 93 {$setc TARGET_CPU_ARM64 := FALSE} 94 {$setc TARGET_OS_MAC := TRUE} 95 {$setc TARGET_OS_IPHONE := FALSE} 96 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 97 {$setc TARGET_OS_EMBEDDED := FALSE} 98 {$elifc defined __i386__ and __i386__} 99 {$setc TARGET_CPU_PPC := FALSE} 100 {$setc TARGET_CPU_PPC64 := FALSE} 101 {$setc TARGET_CPU_X86 := TRUE} 102 {$setc TARGET_CPU_X86_64 := FALSE} 103 {$setc TARGET_CPU_ARM := FALSE} 104 {$setc TARGET_CPU_ARM64 := FALSE} 105 {$ifc defined iphonesim} 106 {$setc TARGET_OS_MAC := FALSE} 107 {$setc TARGET_OS_IPHONE := TRUE} 108 {$setc TARGET_IPHONE_SIMULATOR := TRUE} 109 {$elsec} 110 {$setc TARGET_OS_MAC := TRUE} 111 {$setc TARGET_OS_IPHONE := FALSE} 112 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 113 {$endc} 114 {$setc TARGET_OS_EMBEDDED := FALSE} 115 {$elifc defined __x86_64__ and __x86_64__} 116 {$setc TARGET_CPU_PPC := FALSE} 117 {$setc TARGET_CPU_PPC64 := FALSE} 118 {$setc TARGET_CPU_X86 := FALSE} 119 {$setc TARGET_CPU_X86_64 := TRUE} 120 {$setc TARGET_CPU_ARM := FALSE} 121 {$setc TARGET_CPU_ARM64 := FALSE} 122 {$ifc defined iphonesim} 123 {$setc TARGET_OS_MAC := FALSE} 124 {$setc TARGET_OS_IPHONE := TRUE} 125 {$setc TARGET_IPHONE_SIMULATOR := TRUE} 126 {$elsec} 127 {$setc TARGET_OS_MAC := TRUE} 128 {$setc TARGET_OS_IPHONE := FALSE} 129 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 130 {$endc} 131 {$setc TARGET_OS_EMBEDDED := FALSE} 132 {$elifc defined __arm__ and __arm__} 133 {$setc TARGET_CPU_PPC := FALSE} 134 {$setc TARGET_CPU_PPC64 := FALSE} 135 {$setc TARGET_CPU_X86 := FALSE} 136 {$setc TARGET_CPU_X86_64 := FALSE} 137 {$setc TARGET_CPU_ARM := TRUE} 138 {$setc TARGET_CPU_ARM64 := FALSE} 139 {$setc TARGET_OS_MAC := FALSE} 140 {$setc TARGET_OS_IPHONE := TRUE} 141 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 142 {$setc TARGET_OS_EMBEDDED := TRUE} 143 {$elifc defined __arm64__ and __arm64__} 144 {$setc TARGET_CPU_PPC := FALSE} 145 {$setc TARGET_CPU_PPC64 := FALSE} 146 {$setc TARGET_CPU_X86 := FALSE} 147 {$setc TARGET_CPU_X86_64 := FALSE} 148 {$setc TARGET_CPU_ARM := FALSE} 149 {$setc TARGET_CPU_ARM64 := TRUE} 150 {$ifc defined ios} 151 {$setc TARGET_OS_MAC := FALSE} 152 {$setc TARGET_OS_IPHONE := TRUE} 153 {$setc TARGET_OS_EMBEDDED := TRUE} 154 {$elsec} 155 {$setc TARGET_OS_MAC := TRUE} 156 {$setc TARGET_OS_IPHONE := FALSE} 157 {$setc TARGET_OS_EMBEDDED := FALSE} 158 {$endc} 159 {$setc TARGET_IPHONE_SIMULATOR := FALSE} 160 {$elsec} 161 {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.} 162 {$endc} 163 164 {$ifc defined __LP64__ and __LP64__ } 165 {$setc TARGET_CPU_64 := TRUE} 166 {$elsec} 167 {$setc TARGET_CPU_64 := FALSE} 168 {$endc} 169 170 {$ifc defined FPC_BIG_ENDIAN} 171 {$setc TARGET_RT_BIG_ENDIAN := TRUE} 172 {$setc TARGET_RT_LITTLE_ENDIAN := FALSE} 173 {$elifc defined FPC_LITTLE_ENDIAN} 174 {$setc TARGET_RT_BIG_ENDIAN := FALSE} 175 {$setc TARGET_RT_LITTLE_ENDIAN := TRUE} 176 {$elsec} 177 {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.} 178 {$endc} 179 {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE} 180 {$setc CALL_NOT_IN_CARBON := FALSE} 181 {$setc OLDROUTINENAMES := FALSE} 182 {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE} 183 {$setc OPAQUE_UPP_TYPES := TRUE} 184 {$setc OTCARBONAPPLICATION := TRUE} 185 {$setc OTKERNEL := FALSE} 186 {$setc PM_USE_SESSION_APIS := TRUE} 187 {$setc TARGET_API_MAC_CARBON := TRUE} 188 {$setc TARGET_API_MAC_OS8 := FALSE} 189 {$setc TARGET_API_MAC_OSX := TRUE} 190 {$setc TARGET_CARBON := TRUE} 191 {$setc TARGET_CPU_68K := FALSE} 192 {$setc TARGET_CPU_MIPS := FALSE} 193 {$setc TARGET_CPU_SPARC := FALSE} 194 {$setc TARGET_OS_UNIX := FALSE} 195 {$setc TARGET_OS_WIN32 := FALSE} 196 {$setc TARGET_RT_MAC_68881 := FALSE} 197 {$setc TARGET_RT_MAC_CFM := FALSE} 198 {$setc TARGET_RT_MAC_MACHO := TRUE} 199 {$setc TYPED_FUNCTION_POINTERS := TRUE} 200 {$setc TYPE_BOOL := FALSE} 201 {$setc TYPE_EXTENDED := FALSE} 202 {$setc TYPE_LONGLONG := TRUE} 203 uses MacTypes,CFBase,CFLocale,CFDate,CFTimeZone; 204 {$endc} {not MACOSALLINCLUDE} 205 206 {$ALIGN POWER} 207 208 209 {#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4} 210 211 212 type 213 CFCalendarRef = ^__CFCalendar; { an opaque type } 214 __CFCalendar = record end; 215 CFCalendarGetTypeIDnull216function CFCalendarGetTypeID: CFTypeID; external name '_CFCalendarGetTypeID'; 217 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 218 CFCalendarCopyCurrentnull219function CFCalendarCopyCurrent: CFCalendarRef; external name '_CFCalendarCopyCurrent'; 220 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 221 CFCalendarCreateWithIdentifiernull222function CFCalendarCreateWithIdentifier( allocator: CFAllocatorRef; identifier: CFStringRef ): CFCalendarRef; external name '_CFCalendarCreateWithIdentifier'; 223 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 224 // Create a calendar. The identifiers are the kCF*Calendar 225 // constants in CFLocale.h. 226 CFCalendarGetIdentifiernull227function CFCalendarGetIdentifier( calendar: CFCalendarRef ): CFStringRef; external name '_CFCalendarGetIdentifier'; 228 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 229 // Returns the calendar's identifier. 230 231 function CFCalendarCopyLocale( calendar: CFCalendarRef ): CFLocaleRef; external name '_CFCalendarCopyLocale'; 232 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 233 234 procedure CFCalendarSetLocale( calendar: CFCalendarRef; locale: CFLocaleRef ); external name '_CFCalendarSetLocale'; 235 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 236 237 function CFCalendarCopyTimeZone( calendar: CFCalendarRef ): CFTimeZoneRef; external name '_CFCalendarCopyTimeZone'; 238 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 239 240 procedure CFCalendarSetTimeZone( calendar: CFCalendarRef; tz: CFTimeZoneRef ); external name '_CFCalendarSetTimeZone'; 241 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 242 243 function CFCalendarGetFirstWeekday( calendar: CFCalendarRef ): CFIndex; external name '_CFCalendarGetFirstWeekday'; 244 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 245 246 procedure CFCalendarSetFirstWeekday( calendar: CFCalendarRef; wkdy: CFIndex ); external name '_CFCalendarSetFirstWeekday'; 247 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 248 249 function CFCalendarGetMinimumDaysInFirstWeek( calendar: CFCalendarRef ): CFIndex; external name '_CFCalendarGetMinimumDaysInFirstWeek'; 250 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 251 252 procedure CFCalendarSetMinimumDaysInFirstWeek( calendar: CFCalendarRef; mwd: CFIndex ); external name '_CFCalendarSetMinimumDaysInFirstWeek'; 253 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 254 255 256 type 257 CFCalendarUnit = UNSIGNEDLONG; 258 const 259 kCFCalendarUnitEra = 1 shl 1; 260 kCFCalendarUnitYear = 1 shl 2; 261 kCFCalendarUnitMonth = 1 shl 3; 262 kCFCalendarUnitDay = 1 shl 4; 263 kCFCalendarUnitHour = 1 shl 5; 264 kCFCalendarUnitMinute = 1 shl 6; 265 kCFCalendarUnitSecond = 1 shl 7; 266 kCFCalendarUnitWeek = 1 shl 8; 267 kCFCalendarUnitWeekday = 1 shl 9; 268 kCFCalendarUnitWeekdayOrdinal = 1 shl 10; 269 kCFCalendarUnitQuarter = 1 shl 11; { CF_AVAILABLE_STARTING(10_6, 4_0); } 270 kCFCalendarUnitWeekOfMonth = 1 shl 12; { CF_AVAILABLE_STARTING(10_7, 5_0) } 271 kCFCalendarUnitWeekOfYear = 1 shl 13; { CF_AVAILABLE_STARTING(10_7, 5_0) } 272 kCFCalendarUnitYearForWeekOfYear = 1 shl 14; { CF_AVAILABLE_STARTING(10_7, 5_0) } 273 274 function CFCalendarGetMinimumRangeOfUnit( calendar: CFCalendarRef; unt: CFCalendarUnit ): CFRange; external name '_CFCalendarGetMinimumRangeOfUnit'; 275 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 276 277 function CFCalendarGetMaximumRangeOfUnit( calendar: CFCalendarRef; unt: CFCalendarUnit ): CFRange; external name '_CFCalendarGetMaximumRangeOfUnit'; 278 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 279 280 function CFCalendarGetRangeOfUnit( calendar: CFCalendarRef; smallerUnit: CFCalendarUnit; biggerUnit: CFCalendarUnit; at: CFAbsoluteTime ): CFRange; external name '_CFCalendarGetRangeOfUnit'; 281 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 282 283 function CFCalendarGetOrdinalityOfUnit( calendar: CFCalendarRef; smallerUnit: CFCalendarUnit; biggerUnit: CFCalendarUnit; at: CFAbsoluteTime ): CFIndex; external name '_CFCalendarGetOrdinalityOfUnit'; 284 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 285 286 function CFCalendarGetTimeRangeOfUnit( calendar: CFCalendarRef; unt: CFCalendarUnit; at: CFAbsoluteTime; var startp: CFAbsoluteTime; var tip: CFTimeInterval ): Boolean; external name '_CFCalendarGetTimeRangeOfUnit'; 287 (* AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER *) 288 289 function CFCalendarComposeAbsoluteTime( calendar: CFCalendarRef; var at: { out } CFAbsoluteTime; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarComposeAbsoluteTime'; 290 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 291 292 function CFCalendarDecomposeAbsoluteTime( calendar: CFCalendarRef; at: CFAbsoluteTime; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarDecomposeAbsoluteTime'; 293 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 294 295 296 const 297 kCFCalendarComponentsWrap = 1 shl 0; // option for adding 298 299 function CFCalendarAddComponents( calendar: CFCalendarRef; var at: { inout } CFAbsoluteTime; options: CFOptionFlags; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarAddComponents'; 300 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 301 302 function CFCalendarGetComponentDifference( calendar: CFCalendarRef; startingAT: CFAbsoluteTime; resultAT: CFAbsoluteTime; options: CFOptionFlags; componentDesc: ConstCStringPtr; ... ): Boolean; external name '_CFCalendarGetComponentDifference'; 303 (* AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER *) 304 305 306 307 {#endif} 308 309 {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE} 310 311 end. 312 {$endc} {not MACOSALLINCLUDE} 313