Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

142
vendor/core-foundation-sys/src/array.rs vendored Normal file
View File

@@ -0,0 +1,142 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFComparatorFunction, CFIndex, CFRange, CFTypeID};
use crate::string::CFStringRef;
pub type CFArrayRetainCallBack =
extern "C" fn(allocator: CFAllocatorRef, value: *const c_void) -> *const c_void;
pub type CFArrayReleaseCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void);
pub type CFArrayCopyDescriptionCallBack = extern "C" fn(value: *const c_void) -> CFStringRef;
pub type CFArrayEqualCallBack =
extern "C" fn(value1: *const c_void, value2: *const c_void) -> Boolean;
pub type CFArrayApplierFunction = extern "C" fn(value: *const c_void, context: *mut c_void);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct CFArrayCallBacks {
pub version: CFIndex,
pub retain: CFArrayRetainCallBack,
pub release: CFArrayReleaseCallBack,
pub copyDescription: CFArrayCopyDescriptionCallBack,
pub equal: CFArrayEqualCallBack,
}
#[repr(C)]
pub struct __CFArray(c_void);
pub type CFArrayRef = *const __CFArray;
pub type CFMutableArrayRef = *mut __CFArray;
extern "C" {
/*
* CFArray.h
*/
pub static kCFTypeArrayCallBacks: CFArrayCallBacks;
/* CFArray */
/* Creating an Array */
pub fn CFArrayCreate(
allocator: CFAllocatorRef,
values: *const *const c_void,
numValues: CFIndex,
callBacks: *const CFArrayCallBacks,
) -> CFArrayRef;
pub fn CFArrayCreateCopy(allocator: CFAllocatorRef, theArray: CFArrayRef) -> CFArrayRef;
/* Examining an Array */
pub fn CFArrayBSearchValues(
theArray: CFArrayRef,
range: CFRange,
value: *const c_void,
comparator: CFComparatorFunction,
context: *mut c_void,
) -> CFIndex;
pub fn CFArrayContainsValue(
theArray: CFArrayRef,
range: CFRange,
value: *const c_void,
) -> Boolean;
pub fn CFArrayGetCount(theArray: CFArrayRef) -> CFIndex;
pub fn CFArrayGetCountOfValue(
theArray: CFArrayRef,
range: CFRange,
value: *const c_void,
) -> CFIndex;
pub fn CFArrayGetFirstIndexOfValue(
theArray: CFArrayRef,
range: CFRange,
value: *const c_void,
) -> CFIndex;
pub fn CFArrayGetLastIndexOfValue(
theArray: CFArrayRef,
range: CFRange,
value: *const c_void,
) -> CFIndex;
pub fn CFArrayGetValues(theArray: CFArrayRef, range: CFRange, values: *mut *const c_void);
pub fn CFArrayGetValueAtIndex(theArray: CFArrayRef, idx: CFIndex) -> *const c_void;
/* Applying a Function to Elements */
pub fn CFArrayApplyFunction(
theArray: CFArrayRef,
range: CFRange,
applier: CFArrayApplierFunction,
context: *mut c_void,
);
/* Getting the CFArray Type ID */
pub fn CFArrayGetTypeID() -> CFTypeID;
/* CFMutableArray */
/* CFMutableArray Miscellaneous Functions */
pub fn CFArrayAppendArray(
theArray: CFMutableArrayRef,
otherArray: CFArrayRef,
otherRange: CFRange,
);
pub fn CFArrayAppendValue(theArray: CFMutableArrayRef, value: *const c_void);
pub fn CFArrayCreateMutable(
allocator: CFAllocatorRef,
capacity: CFIndex,
callBacks: *const CFArrayCallBacks,
) -> CFMutableArrayRef;
pub fn CFArrayCreateMutableCopy(
allocator: CFAllocatorRef,
capacity: CFIndex,
theArray: CFArrayRef,
) -> CFMutableArrayRef;
pub fn CFArrayExchangeValuesAtIndices(
theArray: CFMutableArrayRef,
idx1: CFIndex,
idx2: CFIndex,
);
pub fn CFArrayInsertValueAtIndex(
theArray: CFMutableArrayRef,
idx: CFIndex,
value: *const c_void,
);
pub fn CFArrayRemoveAllValues(theArray: CFMutableArrayRef);
pub fn CFArrayRemoveValueAtIndex(theArray: CFMutableArrayRef, idx: CFIndex);
pub fn CFArrayReplaceValues(
theArray: CFMutableArrayRef,
range: CFRange,
newValues: *mut *const c_void,
newCount: CFIndex,
);
pub fn CFArraySetValueAtIndex(theArray: CFMutableArrayRef, idx: CFIndex, value: *const c_void);
pub fn CFArraySortValues(
theArray: CFMutableArrayRef,
range: CFRange,
comparator: CFComparatorFunction,
context: *mut c_void,
);
}

View File

@@ -0,0 +1,120 @@
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, CFTypeRef};
use crate::dictionary::CFDictionaryRef;
use crate::string::CFMutableStringRef;
use crate::string::CFStringRef;
use std::os::raw::c_void;
#[repr(C)]
pub struct __CFAttributedString(c_void);
pub type CFAttributedStringRef = *const __CFAttributedString;
pub type CFMutableAttributedStringRef = *mut __CFAttributedString;
extern "C" {
/*
* CFAttributedString.h
*/
/* CFAttributedString */
/* Creating a CFAttributedString */
pub fn CFAttributedStringCreate(
allocator: CFAllocatorRef,
str: CFStringRef,
attributes: CFDictionaryRef,
) -> CFAttributedStringRef;
pub fn CFAttributedStringCreateCopy(
alloc: CFAllocatorRef,
aStr: CFAttributedStringRef,
) -> CFAttributedStringRef;
pub fn CFAttributedStringCreateWithSubstring(
alloc: CFAllocatorRef,
aStr: CFAttributedStringRef,
range: CFRange,
) -> CFAttributedStringRef;
pub fn CFAttributedStringGetLength(astr: CFAttributedStringRef) -> CFIndex;
pub fn CFAttributedStringGetString(aStr: CFAttributedStringRef) -> CFStringRef;
/* Accessing Attributes */
pub fn CFAttributedStringGetAttribute(
aStr: CFAttributedStringRef,
loc: CFIndex,
attrName: CFStringRef,
effectiveRange: *mut CFRange,
) -> CFTypeRef;
pub fn CFAttributedStringGetAttributes(
aStr: CFAttributedStringRef,
loc: CFIndex,
effectiveRange: *mut CFRange,
) -> CFDictionaryRef;
pub fn CFAttributedStringGetAttributeAndLongestEffectiveRange(
aStr: CFAttributedStringRef,
loc: CFIndex,
attrName: CFStringRef,
inRange: CFRange,
longestEffectiveRange: *mut CFRange,
) -> CFTypeRef;
pub fn CFAttributedStringGetAttributesAndLongestEffectiveRange(
aStr: CFAttributedStringRef,
loc: CFIndex,
inRange: CFRange,
longestEffectiveRange: *mut CFRange,
) -> CFDictionaryRef;
/* Getting Attributed String Properties */
pub fn CFAttributedStringGetTypeID() -> CFTypeID;
/* CFMutableAttributedString */
/* Creating a CFMutableAttributedString */
pub fn CFAttributedStringCreateMutable(
allocator: CFAllocatorRef,
max_length: CFIndex,
) -> CFMutableAttributedStringRef;
pub fn CFAttributedStringCreateMutableCopy(
allocator: CFAllocatorRef,
max_length: CFIndex,
astr: CFAttributedStringRef,
) -> CFMutableAttributedStringRef;
/* Modifying a CFMutableAttributedString */
pub fn CFAttributedStringBeginEditing(aStr: CFMutableAttributedStringRef);
pub fn CFAttributedStringEndEditing(aStr: CFMutableAttributedStringRef);
pub fn CFAttributedStringGetMutableString(
aStr: CFMutableAttributedStringRef,
) -> CFMutableStringRef;
pub fn CFAttributedStringRemoveAttribute(
aStr: CFMutableAttributedStringRef,
range: CFRange,
attrName: CFStringRef,
);
pub fn CFAttributedStringReplaceString(
aStr: CFMutableAttributedStringRef,
range: CFRange,
replacement: CFStringRef,
);
pub fn CFAttributedStringReplaceAttributedString(
aStr: CFMutableAttributedStringRef,
range: CFRange,
replacement: CFAttributedStringRef,
);
pub fn CFAttributedStringSetAttribute(
aStr: CFMutableAttributedStringRef,
range: CFRange,
attrName: CFStringRef,
value: CFTypeRef,
);
pub fn CFAttributedStringSetAttributes(
aStr: CFMutableAttributedStringRef,
range: CFRange,
replacement: CFDictionaryRef,
clearOtherAttributes: Boolean,
);
}

101
vendor/core-foundation-sys/src/bag.rs vendored Normal file
View File

@@ -0,0 +1,101 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID};
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFBag(c_void);
pub type CFBagRef = *const __CFBag;
pub type CFMutableBagRef = *mut __CFBag;
pub type CFBagRetainCallBack =
extern "C" fn(allocator: CFAllocatorRef, value: *const c_void) -> *const c_void;
pub type CFBagReleaseCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void);
pub type CFBagCopyDescriptionCallBack = extern "C" fn(value: *const c_void) -> CFStringRef;
pub type CFBagEqualCallBack =
extern "C" fn(value1: *const c_void, value2: *const c_void) -> Boolean;
pub type CFBagHashCallBack = extern "C" fn(value: *const c_void) -> CFHashCode;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFBagCallBacks {
pub version: CFIndex,
pub retain: CFBagRetainCallBack,
pub release: CFBagReleaseCallBack,
pub copyDescription: CFBagCopyDescriptionCallBack,
pub equal: CFBagEqualCallBack,
pub hash: CFBagHashCallBack,
}
pub type CFBagApplierFunction = extern "C" fn(value: *const c_void, context: *mut c_void);
extern "C" {
/*
* CFBag.h
*/
/* Predefined Callback Structures */
pub static kCFTypeBagCallBacks: CFBagCallBacks;
pub static kCFCopyStringBagCallBacks: CFBagCallBacks;
/* CFBag */
/* Creating a Bag */
pub fn CFBagCreate(
allocator: CFAllocatorRef,
values: *const *const c_void,
numValues: CFIndex,
callBacks: *const CFBagCallBacks,
) -> CFBagRef;
pub fn CFBagCreateCopy(allocator: CFAllocatorRef, theBag: CFBagRef) -> CFBagRef;
/* Examining a Bag */
pub fn CFBagContainsValue(theBag: CFBagRef, value: *const c_void) -> Boolean;
pub fn CFBagGetCount(theBag: CFBagRef) -> CFIndex;
pub fn CFBagGetCountOfValue(theBag: CFBagRef, value: *const c_void) -> CFIndex;
pub fn CFBagGetValue(theBag: CFBagRef, value: *const c_void) -> *const c_void;
pub fn CFBagGetValueIfPresent(
theBag: CFBagRef,
candidate: *const c_void,
value: *const *const c_void,
) -> Boolean;
pub fn CFBagGetValues(theBag: CFBagRef, values: *const *const c_void);
/* Applying a Function to the Contents of a Bag */
pub fn CFBagApplyFunction(
theBag: CFBagRef,
applier: CFBagApplierFunction,
context: *mut c_void,
);
/* Getting the CFBag Type ID */
pub fn CFBagGetTypeID() -> CFTypeID;
/* CFMutableBag */
/* Creating a Mutable Bag */
pub fn CFBagCreateMutable(
allocator: CFAllocatorRef,
capacity: CFIndex,
callBacks: *const CFBagCallBacks,
) -> CFMutableBagRef;
pub fn CFBagCreateMutableCopy(
allocator: CFAllocatorRef,
capacity: CFIndex,
theBag: CFBagRef,
) -> CFMutableBagRef;
/* Modifying a Mutable Bag */
pub fn CFBagAddValue(theBag: CFMutableBagRef, value: *const c_void);
pub fn CFBagRemoveAllValues(theBag: CFMutableBagRef);
pub fn CFBagRemoveValue(theBag: CFMutableBagRef, value: *const c_void);
pub fn CFBagReplaceValue(theBag: CFMutableBagRef, value: *const c_void);
pub fn CFBagSetValue(theBag: CFMutableBagRef, value: *const c_void);
}

197
vendor/core-foundation-sys/src/base.rs vendored Normal file
View File

@@ -0,0 +1,197 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::string::CFStringRef;
use std::cmp::Ordering;
use std::os::raw::{c_int, c_short, c_uchar, c_uint, c_ushort, c_void};
pub type Boolean = u8;
pub type mach_port_t = c_uint;
pub type CFAllocatorRef = *const c_void;
pub type CFNullRef = *const c_void;
pub type CFTypeRef = *const c_void;
pub type ConstStr255Param = *const c_uchar;
pub type StringPtr = *mut c_uchar;
pub type ConstStringPtr = *const c_uchar;
pub type OSStatus = i32;
pub type UInt8 = c_uchar;
pub type UInt16 = c_ushort;
pub type SInt16 = c_short;
pub type SInt32 = c_int;
pub type UInt32 = c_uint;
pub type CFTypeID = usize;
pub type CFOptionFlags = usize;
pub type CFHashCode = usize;
pub type CFIndex = isize;
pub type LangCode = SInt16;
pub type RegionCode = SInt16;
pub type UTF32Char = c_uint;
pub type UTF16Char = c_ushort;
pub type UTF8Char = c_uchar;
#[repr(isize)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CFComparisonResult {
LessThan = -1,
EqualTo = 0,
GreaterThan = 1,
}
pub type CFComparatorFunction = extern "C" fn(
val1: *const c_void,
val2: *const c_void,
context: *mut c_void,
) -> CFComparisonResult;
impl From<CFComparisonResult> for Ordering {
fn from(val: CFComparisonResult) -> Self {
match val {
CFComparisonResult::LessThan => Ordering::Less,
CFComparisonResult::EqualTo => Ordering::Equal,
CFComparisonResult::GreaterThan => Ordering::Greater,
}
}
}
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct CFRange {
pub location: CFIndex,
pub length: CFIndex,
}
// for back-compat
impl CFRange {
pub fn init(location: CFIndex, length: CFIndex) -> CFRange {
CFRange { location, length }
}
}
pub type CFAllocatorRetainCallBack = extern "C" fn(info: *mut c_void) -> *mut c_void;
pub type CFAllocatorReleaseCallBack = extern "C" fn(info: *mut c_void);
pub type CFAllocatorCopyDescriptionCallBack = extern "C" fn(info: *mut c_void) -> CFStringRef;
pub type CFAllocatorAllocateCallBack =
extern "C" fn(allocSize: CFIndex, hint: CFOptionFlags, info: *mut c_void) -> *mut c_void;
pub type CFAllocatorReallocateCallBack = extern "C" fn(
ptr: *mut c_void,
newsize: CFIndex,
hint: CFOptionFlags,
info: *mut c_void,
) -> *mut c_void;
pub type CFAllocatorDeallocateCallBack = extern "C" fn(ptr: *mut c_void, info: *mut c_void);
pub type CFAllocatorPreferredSizeCallBack =
extern "C" fn(size: CFIndex, hint: CFOptionFlags, info: *mut c_void) -> CFIndex;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct CFAllocatorContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: Option<CFAllocatorRetainCallBack>,
pub release: Option<CFAllocatorReleaseCallBack>,
pub copyDescription: Option<CFAllocatorCopyDescriptionCallBack>,
pub allocate: Option<CFAllocatorAllocateCallBack>,
pub reallocate: Option<CFAllocatorReallocateCallBack>,
pub deallocate: Option<CFAllocatorDeallocateCallBack>,
pub preferredSize: Option<CFAllocatorPreferredSizeCallBack>,
}
/// Trait for all types which are Core Foundation reference types.
pub trait TCFTypeRef {
fn as_void_ptr(&self) -> *const c_void;
unsafe fn from_void_ptr(ptr: *const c_void) -> Self;
}
impl<T> TCFTypeRef for *const T {
fn as_void_ptr(&self) -> *const c_void {
(*self) as *const c_void
}
unsafe fn from_void_ptr(ptr: *const c_void) -> Self {
ptr as *const T
}
}
impl<T> TCFTypeRef for *mut T {
fn as_void_ptr(&self) -> *const c_void {
(*self) as *const T as *const c_void
}
unsafe fn from_void_ptr(ptr: *const c_void) -> Self {
ptr as *const T as *mut T
}
}
/// Constant used by some functions to indicate failed searches.
pub static kCFNotFound: CFIndex = -1;
extern "C" {
/*
* CFBase.h
*/
/* CFAllocator Reference */
pub static kCFAllocatorDefault: CFAllocatorRef;
pub static kCFAllocatorSystemDefault: CFAllocatorRef;
pub static kCFAllocatorMalloc: CFAllocatorRef;
pub static kCFAllocatorMallocZone: CFAllocatorRef;
pub static kCFAllocatorNull: CFAllocatorRef;
pub static kCFAllocatorUseContext: CFAllocatorRef;
pub fn CFAllocatorCreate(
allocator: CFAllocatorRef,
context: *mut CFAllocatorContext,
) -> CFAllocatorRef;
pub fn CFAllocatorAllocate(
allocator: CFAllocatorRef,
size: CFIndex,
hint: CFOptionFlags,
) -> *mut c_void;
pub fn CFAllocatorDeallocate(allocator: CFAllocatorRef, ptr: *mut c_void);
pub fn CFAllocatorGetPreferredSizeForSize(
allocator: CFAllocatorRef,
size: CFIndex,
hint: CFOptionFlags,
) -> CFIndex;
pub fn CFAllocatorReallocate(
allocator: CFAllocatorRef,
ptr: *mut c_void,
newsize: CFIndex,
hint: CFOptionFlags,
) -> *mut c_void;
pub fn CFAllocatorGetDefault() -> CFAllocatorRef;
pub fn CFAllocatorSetDefault(allocator: CFAllocatorRef);
pub fn CFAllocatorGetContext(allocator: CFAllocatorRef, context: *mut CFAllocatorContext);
pub fn CFAllocatorGetTypeID() -> CFTypeID;
/* CFNull Reference */
pub static kCFNull: CFNullRef;
pub fn CFNullGetTypeID() -> CFTypeID;
/* CFType Reference */
pub fn CFCopyTypeIDDescription(type_id: CFTypeID) -> CFStringRef;
pub fn CFGetAllocator(cf: CFTypeRef) -> CFAllocatorRef;
pub fn CFCopyDescription(cf: CFTypeRef) -> CFStringRef;
pub fn CFEqual(cf1: CFTypeRef, cf2: CFTypeRef) -> Boolean;
pub fn CFGetRetainCount(cf: CFTypeRef) -> CFIndex;
pub fn CFGetTypeID(cf: CFTypeRef) -> CFTypeID;
pub fn CFHash(cf: CFTypeRef) -> CFHashCode;
//fn CFMakeCollectable
pub fn CFRelease(cf: CFTypeRef);
pub fn CFRetain(cf: CFTypeRef) -> CFTypeRef;
pub fn CFShow(obj: CFTypeRef);
/* Base Utilities Reference */
// N.B. Some things missing here.
}

View File

@@ -0,0 +1,83 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFTypeID};
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFBinaryHeap(c_void);
pub type CFBinaryHeapRef = *mut __CFBinaryHeap;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFBinaryHeapCompareContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: extern "C" fn(info: *const c_void) -> *const c_void,
pub release: extern "C" fn(info: *const c_void),
pub copyDescription: extern "C" fn(info: *const c_void) -> CFStringRef,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFBinaryHeapCallBacks {
pub version: CFIndex,
pub retain: extern "C" fn(allocator: CFAllocatorRef, ptr: *const c_void) -> *const c_void,
pub release: extern "C" fn(allocator: CFAllocatorRef, ptr: *const c_void),
pub copyDescription: extern "C" fn(ptr: *const c_void) -> CFStringRef,
pub compare: extern "C" fn(
ptr1: *const c_void,
ptr2: *const c_void,
context: *mut c_void,
) -> CFComparisonResult,
}
pub type CFBinaryHeapApplierFunction = extern "C" fn(val: *const c_void, context: *const c_void);
extern "C" {
/*
* CFBinaryHeap.h
*/
/* Predefined Callback Structures */
pub static kCFStringBinaryHeapCallBacks: CFBinaryHeapCallBacks;
/* CFBinaryHeap Miscellaneous Functions */
pub fn CFBinaryHeapAddValue(heap: CFBinaryHeapRef, value: *const c_void);
pub fn CFBinaryHeapApplyFunction(
heap: CFBinaryHeapRef,
applier: CFBinaryHeapApplierFunction,
context: *mut c_void,
);
pub fn CFBinaryHeapContainsValue(heap: CFBinaryHeapRef, value: *const c_void) -> Boolean;
pub fn CFBinaryHeapCreate(
allocator: CFAllocatorRef,
capacity: CFIndex,
callBacks: *const CFBinaryHeapCallBacks,
compareContext: *const CFBinaryHeapCompareContext,
) -> CFBinaryHeapRef;
pub fn CFBinaryHeapCreateCopy(
allocator: CFAllocatorRef,
capacity: CFIndex,
heap: CFBinaryHeapRef,
) -> CFBinaryHeapRef;
pub fn CFBinaryHeapGetCount(heap: CFBinaryHeapRef) -> CFIndex;
pub fn CFBinaryHeapGetCountOfValue(heap: CFBinaryHeapRef, value: *const c_void) -> CFIndex;
pub fn CFBinaryHeapGetMinimum(heap: CFBinaryHeapRef) -> *const c_void;
pub fn CFBinaryHeapGetMinimumIfPresent(
heap: CFBinaryHeapRef,
value: *const *const c_void,
) -> Boolean;
pub fn CFBinaryHeapGetTypeID() -> CFTypeID;
pub fn CFBinaryHeapGetValues(heap: CFBinaryHeapRef, values: *const *const c_void);
pub fn CFBinaryHeapRemoveAllValues(heap: CFBinaryHeapRef);
pub fn CFBinaryHeapRemoveMinimumValue(heap: CFBinaryHeapRef);
}

View File

@@ -0,0 +1,74 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, UInt32, UInt8};
#[repr(C)]
pub struct __CFBitVector(c_void);
pub type CFBitVectorRef = *const __CFBitVector;
pub type CFMutableBitVectorRef = *mut __CFBitVector;
pub type CFBit = UInt32;
extern "C" {
/*
* CFBitVector.h
*/
/* CFBitVector */
/* Creating a Bit Vector */
pub fn CFBitVectorCreate(
allocator: CFAllocatorRef,
bytes: *const UInt8,
numBits: CFIndex,
) -> CFBitVectorRef;
pub fn CFBitVectorCreateCopy(allocator: CFAllocatorRef, bv: CFBitVectorRef) -> CFBitVectorRef;
/* Getting Information About a Bit Vector */
pub fn CFBitVectorContainsBit(bv: CFBitVectorRef, range: CFRange, value: CFBit) -> Boolean;
pub fn CFBitVectorGetBitAtIndex(bv: CFBitVectorRef, idx: CFIndex) -> CFBit;
pub fn CFBitVectorGetBits(bv: CFBitVectorRef, range: CFRange, bytes: *mut UInt8);
pub fn CFBitVectorGetCount(bv: CFBitVectorRef) -> CFIndex;
pub fn CFBitVectorGetCountOfBit(bv: CFBitVectorRef, range: CFRange, value: CFBit) -> CFIndex;
pub fn CFBitVectorGetFirstIndexOfBit(
bv: CFBitVectorRef,
range: CFRange,
value: CFBit,
) -> CFIndex;
pub fn CFBitVectorGetLastIndexOfBit(
bv: CFBitVectorRef,
range: CFRange,
value: CFBit,
) -> CFIndex;
/* Getting the CFBitVector Type ID */
pub fn CFBitVectorGetTypeID() -> CFTypeID;
/* CFMutableBitVector */
/* Creating a CFMutableBitVector Object */
pub fn CFBitVectorCreateMutable(
allocator: CFAllocatorRef,
capacity: CFIndex,
) -> CFMutableBitVectorRef;
pub fn CFBitVectorCreateMutableCopy(
allocator: CFAllocatorRef,
capacity: CFIndex,
bv: CFBitVectorRef,
) -> CFMutableBitVectorRef;
/* Modifying a Bit Vector */
pub fn CFBitVectorFlipBitAtIndex(bv: CFMutableBitVectorRef, idx: CFIndex);
pub fn CFBitVectorFlipBits(bv: CFMutableBitVectorRef, range: CFRange);
pub fn CFBitVectorSetAllBits(bv: CFMutableBitVectorRef, value: CFBit);
pub fn CFBitVectorSetBitAtIndex(bv: CFMutableBitVectorRef, idx: CFIndex, value: CFBit);
pub fn CFBitVectorSetBits(bv: CFMutableBitVectorRef, range: CFRange, value: CFBit);
pub fn CFBitVectorSetCount(bv: CFMutableBitVectorRef, count: CFIndex);
}

234
vendor/core-foundation-sys/src/bundle.rs vendored Normal file
View File

@@ -0,0 +1,234 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::array::CFArrayRef;
#[cfg(target_os = "macos")]
use crate::base::SInt32;
use crate::base::{Boolean, CFAllocatorRef, CFTypeID, CFTypeRef, UInt32};
use crate::dictionary::CFDictionaryRef;
use crate::error::CFErrorRef;
use crate::string::CFStringRef;
use crate::url::CFURLRef;
use std::os::raw::{c_int, c_uint};
#[repr(C)]
pub struct __CFBundle(c_void);
pub type CFBundleRef = *mut __CFBundle;
pub type CFPlugInRef = *mut __CFBundle;
pub type CFBundleRefNum = c_int;
#[allow(unused)]
#[inline(always)]
pub unsafe fn CFCopyLocalizedString(key: CFStringRef, comment: CFStringRef) -> CFStringRef {
CFBundleCopyLocalizedString(CFBundleGetMainBundle(), key, key, std::ptr::null())
}
#[allow(unused)]
#[inline(always)]
pub unsafe fn CFCopyLocalizedStringFromTable(
key: CFStringRef,
tbl: CFStringRef,
comment: CFStringRef,
) -> CFStringRef {
CFBundleCopyLocalizedString(CFBundleGetMainBundle(), key, key, tbl)
}
#[allow(unused)]
#[inline(always)]
pub unsafe fn CFCopyLocalizedStringFromTableInBundle(
key: CFStringRef,
tbl: CFStringRef,
bundle: CFBundleRef,
comment: CFStringRef,
) -> CFStringRef {
CFBundleCopyLocalizedString(bundle, key, key, tbl)
}
#[allow(unused)]
#[inline(always)]
pub unsafe fn CFCopyLocalizedStringWithDefaultValue(
key: CFStringRef,
tbl: CFStringRef,
bundle: CFBundleRef,
value: CFStringRef,
comment: CFStringRef,
) -> CFStringRef {
CFBundleCopyLocalizedString(bundle, key, value, tbl)
}
pub static kCFBundleExecutableArchitectureI386: c_uint = 0x00000007;
pub static kCFBundleExecutableArchitecturePPC: c_uint = 0x00000012;
pub static kCFBundleExecutableArchitectureX86_64: c_uint = 0x01000007;
pub static kCFBundleExecutableArchitecturePPC64: c_uint = 0x01000012;
//pub static kCFBundleExecutableArchitectureARM64: c_uint = 0x0100000c; //macos(11.0)+
extern "C" {
/*
* CFBundle.h
*/
/* Information Property List Keys */
pub static kCFBundleInfoDictionaryVersionKey: CFStringRef;
pub static kCFBundleExecutableKey: CFStringRef;
pub static kCFBundleIdentifierKey: CFStringRef;
pub static kCFBundleVersionKey: CFStringRef;
pub static kCFBundleDevelopmentRegionKey: CFStringRef;
pub static kCFBundleNameKey: CFStringRef;
pub static kCFBundleLocalizationsKey: CFStringRef;
/* Creating and Accessing Bundles */
pub fn CFBundleCreate(allocator: CFAllocatorRef, bundleURL: CFURLRef) -> CFBundleRef;
pub fn CFBundleCreateBundlesFromDirectory(
allocator: CFAllocatorRef,
directoryURL: CFURLRef,
bundleType: CFStringRef,
) -> CFArrayRef;
pub fn CFBundleGetAllBundles() -> CFArrayRef;
pub fn CFBundleGetBundleWithIdentifier(bundleID: CFStringRef) -> CFBundleRef;
pub fn CFBundleGetMainBundle() -> CFBundleRef;
/* Loading and Unloading a Bundle */
pub fn CFBundleIsExecutableLoaded(bundle: CFBundleRef) -> Boolean;
pub fn CFBundlePreflightExecutable(bundle: CFBundleRef, error: *mut CFErrorRef) -> Boolean;
pub fn CFBundleLoadExecutable(bundle: CFBundleRef) -> Boolean;
pub fn CFBundleLoadExecutableAndReturnError(
bundle: CFBundleRef,
error: *mut CFErrorRef,
) -> Boolean;
pub fn CFBundleUnloadExecutable(bundle: CFBundleRef);
/* Finding Locations in a Bundle */
pub fn CFBundleCopyAuxiliaryExecutableURL(
bundle: CFBundleRef,
executableName: CFStringRef,
) -> CFURLRef;
pub fn CFBundleCopyBuiltInPlugInsURL(bundle: CFBundleRef) -> CFURLRef;
pub fn CFBundleCopyExecutableURL(bundle: CFBundleRef) -> CFURLRef;
pub fn CFBundleCopyPrivateFrameworksURL(bundle: CFBundleRef) -> CFURLRef;
pub fn CFBundleCopyResourcesDirectoryURL(bundle: CFBundleRef) -> CFURLRef;
pub fn CFBundleCopySharedFrameworksURL(bundle: CFBundleRef) -> CFURLRef;
pub fn CFBundleCopySharedSupportURL(bundle: CFBundleRef) -> CFURLRef;
pub fn CFBundleCopySupportFilesDirectoryURL(bundle: CFBundleRef) -> CFURLRef;
/* Locating Bundle Resources */
#[cfg(target_os = "macos")]
pub fn CFBundleCloseBundleResourceMap(bundle: CFBundleRef, refNum: CFBundleRefNum); // DEPRECATED macosx(10.0, 10.15)
pub fn CFBundleCopyResourceURL(
bundle: CFBundleRef,
resourceName: CFStringRef,
resourceType: CFStringRef,
subDirName: CFStringRef,
) -> CFURLRef;
pub fn CFBundleCopyResourceURLInDirectory(
bundleURL: CFURLRef,
resourceName: CFStringRef,
resourceType: CFStringRef,
subDirName: CFStringRef,
) -> CFURLRef;
pub fn CFBundleCopyResourceURLsOfType(
bundle: CFBundleRef,
resourceType: CFStringRef,
subDirName: CFStringRef,
) -> CFArrayRef;
pub fn CFBundleCopyResourceURLsOfTypeInDirectory(
bundleURL: CFURLRef,
resourceType: CFStringRef,
subDirName: CFStringRef,
) -> CFArrayRef;
pub fn CFBundleCopyResourceURLForLocalization(
bundle: CFBundleRef,
resourceName: CFStringRef,
resourceType: CFStringRef,
subDirName: CFStringRef,
localizationName: CFStringRef,
) -> CFURLRef;
pub fn CFBundleCopyResourceURLsOfTypeForLocalization(
bundle: CFBundleRef,
resourceType: CFStringRef,
subDirName: CFStringRef,
localizationName: CFStringRef,
) -> CFArrayRef;
#[cfg(target_os = "macos")]
pub fn CFBundleOpenBundleResourceFiles(
bundle: CFBundleRef,
refNum: *mut CFBundleRefNum,
localizedRefNum: *mut CFBundleRefNum,
) -> SInt32; // DEPRECATED macosx(10.0, 10.15)
#[cfg(target_os = "macos")]
pub fn CFBundleOpenBundleResourceMap(bundle: CFBundleRef) -> CFBundleRefNum; // DEPRECATED macosx(10.0, 10.15)
/* Managing Localizations */
pub fn CFBundleCopyBundleLocalizations(bundle: CFBundleRef) -> CFArrayRef;
pub fn CFBundleCopyLocalizedString(
bundle: CFBundleRef,
key: CFStringRef,
value: CFStringRef,
tableName: CFStringRef,
) -> CFStringRef;
pub fn CFBundleCopyLocalizationsForPreferences(
locArray: CFArrayRef,
prefArray: CFArrayRef,
) -> CFArrayRef;
pub fn CFBundleCopyLocalizationsForURL(url: CFURLRef) -> CFArrayRef;
pub fn CFBundleCopyPreferredLocalizationsFromArray(locArray: CFArrayRef) -> CFArrayRef;
/* Managing Executable Code */
pub fn CFBundleGetDataPointerForName(
bundle: CFBundleRef,
symbolName: CFStringRef,
) -> *mut c_void;
pub fn CFBundleGetDataPointersForNames(
bundle: CFBundleRef,
symbolNames: CFArrayRef,
stbl: *mut [c_void],
);
pub fn CFBundleGetFunctionPointerForName(
bundle: CFBundleRef,
function_name: CFStringRef,
) -> *const c_void;
pub fn CFBundleGetFunctionPointersForNames(
bundle: CFBundleRef,
functionNames: CFArrayRef,
ftbl: *mut [c_void],
);
pub fn CFBundleGetPlugIn(bundle: CFBundleRef) -> CFPlugInRef;
/* Getting Bundle Properties */
pub fn CFBundleCopyBundleURL(bundle: CFBundleRef) -> CFURLRef;
pub fn CFBundleGetDevelopmentRegion(bundle: CFBundleRef) -> CFStringRef;
pub fn CFBundleGetIdentifier(bundle: CFBundleRef) -> CFStringRef;
pub fn CFBundleGetInfoDictionary(bundle: CFBundleRef) -> CFDictionaryRef;
pub fn CFBundleGetLocalInfoDictionary(bundle: CFBundleRef) -> CFDictionaryRef;
pub fn CFBundleGetValueForInfoDictionaryKey(bundle: CFBundleRef, key: CFStringRef)
-> CFTypeRef;
pub fn CFBundleCopyInfoDictionaryInDirectory(bundleURL: CFURLRef) -> CFDictionaryRef;
pub fn CFBundleCopyInfoDictionaryForURL(url: CFURLRef) -> CFDictionaryRef;
pub fn CFBundleGetPackageInfo(
bundle: CFBundleRef,
packageType: *mut UInt32,
packageCreator: *mut UInt32,
);
pub fn CFBundleGetPackageInfoInDirectory(
url: CFURLRef,
packageType: *mut UInt32,
packageCreator: *mut UInt32,
) -> Boolean;
pub fn CFBundleCopyExecutableArchitectures(bundle: CFBundleRef) -> CFArrayRef;
pub fn CFBundleCopyExecutableArchitecturesForURL(url: CFURLRef) -> CFArrayRef;
pub fn CFBundleGetVersionNumber(bundle: CFBundleRef) -> UInt32;
/* macos(11.0)+
pub fn CFBundleIsExecutableLoadable(bundle: CFBundleRef) -> Boolean;
pub fn CFBundleIsExecutableLoadableForURL(url: CFURLRef) -> Boolean;
pub fn CFBundleIsArchitectureLoadable(arch: cpu_type_t) -> Boolean;
*/
/* Getting the CFBundle Type ID */
pub fn CFBundleGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,128 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::{c_char, c_void};
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID};
use crate::date::{CFAbsoluteTime, CFTimeInterval};
use crate::locale::{CFCalendarIdentifier, CFLocaleRef};
use crate::timezone::CFTimeZoneRef;
#[repr(C)]
pub struct __CFCalendar(c_void);
pub type CFCalendarRef = *mut __CFCalendar;
pub type CFCalendarUnit = CFOptionFlags;
pub const kCFCalendarUnitEra: CFCalendarUnit = 1 << 1;
pub const kCFCalendarUnitYear: CFCalendarUnit = 1 << 2;
pub const kCFCalendarUnitMonth: CFCalendarUnit = 1 << 3;
pub const kCFCalendarUnitDay: CFCalendarUnit = 1 << 4;
pub const kCFCalendarUnitHour: CFCalendarUnit = 1 << 5;
pub const kCFCalendarUnitMinute: CFCalendarUnit = 1 << 6;
pub const kCFCalendarUnitSecond: CFCalendarUnit = 1 << 7;
pub const kCFCalendarUnitWeek: CFCalendarUnit = 1 << 8; // deprecated since macos 10.10
pub const kCFCalendarUnitWeekday: CFCalendarUnit = 1 << 9;
pub const kCFCalendarUnitWeekdayOrdinal: CFCalendarUnit = 1 << 10;
pub const kCFCalendarUnitQuarter: CFCalendarUnit = 1 << 11;
pub const kCFCalendarUnitWeekOfMonth: CFCalendarUnit = 1 << 12;
pub const kCFCalendarUnitWeekOfYear: CFCalendarUnit = 1 << 13;
pub const kCFCalendarUnitYearForWeekOfYear: CFCalendarUnit = 1 << 14;
pub const kCFCalendarComponentsWrap: CFOptionFlags = 1 << 0;
extern "C" {
/*
* CFCalendar.h
*/
/* Creating a Calendar */
pub fn CFCalendarCopyCurrent() -> CFCalendarRef;
pub fn CFCalendarCreateWithIdentifier(
allocator: CFAllocatorRef,
identifier: CFCalendarIdentifier,
) -> CFCalendarRef;
/* Calendrical Calculations */
pub fn CFCalendarAddComponents(
identifier: CFCalendarIdentifier,
/* inout */ at: *mut CFAbsoluteTime,
options: CFOptionFlags,
componentDesc: *const char,
...
) -> Boolean;
pub fn CFCalendarComposeAbsoluteTime(
identifier: CFCalendarIdentifier,
/* out */ at: *mut CFAbsoluteTime,
componentDesc: *const c_char,
...
) -> Boolean;
pub fn CFCalendarDecomposeAbsoluteTime(
identifier: CFCalendarIdentifier,
at: CFAbsoluteTime,
componentDesc: *const c_char,
...
) -> Boolean;
pub fn CFCalendarGetComponentDifference(
identifier: CFCalendarIdentifier,
startingAT: CFAbsoluteTime,
resultAT: CFAbsoluteTime,
options: CFOptionFlags,
componentDesc: *const c_char,
...
) -> Boolean;
/* Getting Ranges of Units */
pub fn CFCalendarGetRangeOfUnit(
identifier: CFCalendarIdentifier,
smallerUnit: CFCalendarUnit,
biggerUnit: CFCalendarUnit,
at: CFAbsoluteTime,
) -> CFRange;
pub fn CFCalendarGetOrdinalityOfUnit(
identifier: CFCalendarIdentifier,
smallerUnit: CFCalendarUnit,
biggerUnit: CFCalendarUnit,
at: CFAbsoluteTime,
) -> CFIndex;
pub fn CFCalendarGetTimeRangeOfUnit(
identifier: CFCalendarIdentifier,
unit: CFCalendarUnit,
at: CFAbsoluteTime,
startp: *mut CFAbsoluteTime,
tip: *mut CFTimeInterval,
) -> Boolean;
pub fn CFCalendarGetMaximumRangeOfUnit(
identifier: CFCalendarIdentifier,
unit: CFCalendarUnit,
) -> CFRange;
pub fn CFCalendarGetMinimumRangeOfUnit(
identifier: CFCalendarIdentifier,
unit: CFCalendarUnit,
) -> CFRange;
/* Getting and Setting the Time Zone */
pub fn CFCalendarCopyTimeZone(identifier: CFCalendarIdentifier) -> CFTimeZoneRef;
pub fn CFCalendarSetTimeZone(identifier: CFCalendarIdentifier, tz: CFTimeZoneRef);
/* Getting the Identifier */
pub fn CFCalendarGetIdentifier(identifier: CFCalendarIdentifier) -> CFCalendarIdentifier;
/* Getting and Setting the Locale */
pub fn CFCalendarCopyLocale(identifier: CFCalendarIdentifier) -> CFLocaleRef;
pub fn CFCalendarSetLocale(identifier: CFCalendarIdentifier, locale: CFLocaleRef);
/* Getting and Setting Day Information */
pub fn CFCalendarGetFirstWeekday(identifier: CFCalendarIdentifier) -> CFIndex;
pub fn CFCalendarSetFirstWeekday(identifier: CFCalendarIdentifier, wkdy: CFIndex);
pub fn CFCalendarGetMinimumDaysInFirstWeek(identifier: CFCalendarIdentifier) -> CFIndex;
pub fn CFCalendarSetMinimumDaysInFirstWeek(identifier: CFCalendarIdentifier, mwd: CFIndex);
/* Getting the Type ID */
pub fn CFCalendarGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,124 @@
// Copyright 2019 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, UTF32Char};
use crate::data::CFDataRef;
use crate::string::{CFStringRef, UniChar};
use std::os::raw::c_void;
pub type CFCharacterSetPredefinedSet = CFIndex;
// Members of CFCharacterSetPredefinedSet enum
pub static kCFCharacterSetControl: CFCharacterSetPredefinedSet = 1;
pub static kCFCharacterSetWhitespace: CFCharacterSetPredefinedSet = 2;
pub static kCFCharacterSetWhitespaceAndNewline: CFCharacterSetPredefinedSet = 3;
pub static kCFCharacterSetDecimalDigit: CFCharacterSetPredefinedSet = 4;
pub static kCFCharacterSetLetter: CFCharacterSetPredefinedSet = 5;
pub static kCFCharacterSetLowercaseLetter: CFCharacterSetPredefinedSet = 6;
pub static kCFCharacterSetUppercaseLetter: CFCharacterSetPredefinedSet = 7;
pub static kCFCharacterSetNonBase: CFCharacterSetPredefinedSet = 8;
pub static kCFCharacterSetDecomposable: CFCharacterSetPredefinedSet = 9;
pub static kCFCharacterSetAlphaNumeric: CFCharacterSetPredefinedSet = 10;
pub static kCFCharacterSetPunctuation: CFCharacterSetPredefinedSet = 11;
pub static kCFCharacterSetIllegal: CFCharacterSetPredefinedSet = 12;
pub static kCFCharacterSetCapitalizedLetter: CFCharacterSetPredefinedSet = 13;
pub static kCFCharacterSetSymbol: CFCharacterSetPredefinedSet = 14;
pub static kCFCharacterSetNewline: CFCharacterSetPredefinedSet = 15;
#[repr(C)]
pub struct __CFCharacterSet(c_void);
pub type CFCharacterSetRef = *const __CFCharacterSet;
pub type CFMutableCharacterSetRef = *mut __CFCharacterSet;
extern "C" {
/*
* CFCharacterSet.h
*/
/* CFCharacterSet */
/* Creating Character Sets */
pub fn CFCharacterSetCreateCopy(
alloc: CFAllocatorRef,
theSet: CFCharacterSetRef,
) -> CFCharacterSetRef;
pub fn CFCharacterSetCreateInvertedSet(
alloc: CFAllocatorRef,
theSet: CFCharacterSetRef,
) -> CFCharacterSetRef;
pub fn CFCharacterSetCreateWithCharactersInRange(
alloc: CFAllocatorRef,
theRange: CFRange,
) -> CFCharacterSetRef;
pub fn CFCharacterSetCreateWithCharactersInString(
alloc: CFAllocatorRef,
theString: CFStringRef,
) -> CFCharacterSetRef;
pub fn CFCharacterSetCreateWithBitmapRepresentation(
alloc: CFAllocatorRef,
theData: CFDataRef,
) -> CFCharacterSetRef;
/* Getting Predefined Character Sets */
pub fn CFCharacterSetGetPredefined(
theSetIdentifier: CFCharacterSetPredefinedSet,
) -> CFCharacterSetRef;
/* Querying Character Sets */
pub fn CFCharacterSetCreateBitmapRepresentation(
alloc: CFAllocatorRef,
theSet: CFCharacterSetRef,
) -> CFDataRef;
pub fn CFCharacterSetHasMemberInPlane(theSet: CFCharacterSetRef, thePlane: CFIndex) -> Boolean;
pub fn CFCharacterSetIsCharacterMember(theSet: CFCharacterSetRef, theChar: UniChar) -> Boolean;
pub fn CFCharacterSetIsLongCharacterMember(
theSet: CFCharacterSetRef,
theChar: UTF32Char,
) -> Boolean;
pub fn CFCharacterSetIsSupersetOfSet(
theSet: CFCharacterSetRef,
theOtherset: CFCharacterSetRef,
) -> Boolean;
/* Getting the Character Set Type Identifier */
pub fn CFCharacterSetGetTypeID() -> CFTypeID;
/* CFMutableCharacterSet */
/* Creating a Mutable Character Set */
pub fn CFCharacterSetCreateMutable(alloc: CFAllocatorRef) -> CFMutableCharacterSetRef;
pub fn CFCharacterSetCreateMutableCopy(
alloc: CFAllocatorRef,
theSet: CFCharacterSetRef,
) -> CFMutableCharacterSetRef;
/* Adding Characters */
pub fn CFCharacterSetAddCharactersInRange(theSet: CFMutableCharacterSetRef, theRange: CFRange);
pub fn CFCharacterSetAddCharactersInString(
theSet: CFMutableCharacterSetRef,
theString: CFStringRef,
);
/* Removing Characters */
pub fn CFCharacterSetRemoveCharactersInRange(
theSet: CFMutableCharacterSetRef,
theRange: CFRange,
);
pub fn CFCharacterSetRemoveCharactersInString(
theSet: CFMutableCharacterSetRef,
theString: CFStringRef,
);
/* Logical Operations */
pub fn CFCharacterSetIntersect(
theSet: CFMutableCharacterSetRef,
theOtherSet: CFCharacterSetRef,
);
pub fn CFCharacterSetInvert(theSet: CFMutableCharacterSetRef);
pub fn CFCharacterSetUnion(theSet: CFMutableCharacterSetRef, theOtherSet: CFCharacterSetRef);
}

77
vendor/core-foundation-sys/src/data.rs vendored Normal file
View File

@@ -0,0 +1,77 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID};
use std::os::raw::c_void;
#[repr(C)]
pub struct __CFData(c_void);
pub type CFDataRef = *const __CFData;
pub type CFMutableDataRef = *mut __CFData;
pub type CFDataSearchFlags = CFOptionFlags;
// typedef CF_OPTIONS(CFOptionFlags, CFDataSearchFlags)
pub const kCFDataSearchBackwards: CFDataSearchFlags = 1usize << 0;
pub const kCFDataSearchAnchored: CFDataSearchFlags = 1usize << 1;
extern "C" {
/*
* CFData.h
*/
/* CFData */
/* Creating a CFData Object */
pub fn CFDataCreate(allocator: CFAllocatorRef, bytes: *const u8, length: CFIndex) -> CFDataRef;
pub fn CFDataCreateCopy(allocator: CFAllocatorRef, theData: CFDataRef) -> CFDataRef;
pub fn CFDataCreateWithBytesNoCopy(
allocator: CFAllocatorRef,
bytes: *const u8,
length: CFIndex,
bytesDeallocator: CFAllocatorRef,
) -> CFDataRef;
/* Examining a CFData Object */
pub fn CFDataGetBytePtr(theData: CFDataRef) -> *const u8;
pub fn CFDataGetBytes(theData: CFDataRef, range: CFRange, buffer: *mut u8);
pub fn CFDataGetLength(theData: CFDataRef) -> CFIndex;
pub fn CFDataFind(
theData: CFDataRef,
dataToFind: CFDataRef,
searchRange: CFRange,
compareOptions: CFDataSearchFlags,
) -> CFRange;
/* Getting the CFData Type ID */
pub fn CFDataGetTypeID() -> CFTypeID;
/* CFMutableData */
/* Creating a Mutable Data Object */
pub fn CFDataCreateMutable(allocator: CFAllocatorRef, capacity: CFIndex) -> CFMutableDataRef;
pub fn CFDataCreateMutableCopy(
allocator: CFAllocatorRef,
capacity: CFIndex,
theData: CFDataRef,
) -> CFMutableDataRef;
/* Accessing Data */
pub fn CFDataGetMutableBytePtr(theData: CFMutableDataRef) -> *mut u8;
/* Modifying a Mutable Data Object */
pub fn CFDataAppendBytes(theData: CFMutableDataRef, bytes: *const u8, length: CFIndex);
pub fn CFDataDeleteBytes(theData: CFMutableDataRef, range: CFRange);
pub fn CFDataReplaceBytes(
theData: CFMutableDataRef,
range: CFRange,
newBytes: *const u8,
newLength: CFIndex,
);
pub fn CFDataIncreaseLength(theData: CFMutableDataRef, extraLength: CFIndex);
pub fn CFDataSetLength(theData: CFMutableDataRef, length: CFIndex);
}

38
vendor/core-foundation-sys/src/date.rs vendored Normal file
View File

@@ -0,0 +1,38 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{CFAllocatorRef, CFComparisonResult, CFTypeID};
#[repr(C)]
pub struct __CFDate(c_void);
pub type CFDateRef = *const __CFDate;
pub type CFTimeInterval = f64;
pub type CFAbsoluteTime = CFTimeInterval;
extern "C" {
pub static kCFAbsoluteTimeIntervalSince1904: CFTimeInterval;
pub static kCFAbsoluteTimeIntervalSince1970: CFTimeInterval;
pub fn CFAbsoluteTimeGetCurrent() -> CFAbsoluteTime;
pub fn CFDateCreate(allocator: CFAllocatorRef, at: CFAbsoluteTime) -> CFDateRef;
pub fn CFDateGetAbsoluteTime(date: CFDateRef) -> CFAbsoluteTime;
pub fn CFDateGetTimeIntervalSinceDate(date: CFDateRef, other: CFDateRef) -> CFTimeInterval;
pub fn CFDateCompare(
date: CFDateRef,
other: CFDateRef,
context: *mut c_void,
) -> CFComparisonResult;
pub fn CFDateGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,147 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef};
use crate::date::{CFAbsoluteTime, CFDateRef};
use crate::locale::CFLocaleRef;
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFDateFormatter(c_void);
pub type CFDateFormatterRef = *mut __CFDateFormatter;
pub type CFDateFormatterKey = CFStringRef;
pub type CFDateFormatterStyle = CFIndex;
pub type CFISO8601DateFormatOptions = CFOptionFlags;
/* Date Formatter Styles */
pub const kCFDateFormatterNoStyle: CFDateFormatterStyle = 0;
pub const kCFDateFormatterShortStyle: CFDateFormatterStyle = 1;
pub const kCFDateFormatterMediumStyle: CFDateFormatterStyle = 2;
pub const kCFDateFormatterLongStyle: CFDateFormatterStyle = 3;
pub const kCFDateFormatterFullStyle: CFDateFormatterStyle = 4;
//pub const kCFISO8601DateFormatWithYear: CFISO8601DateFormatOptions = 1 << 0; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithMonth: CFISO8601DateFormatOptions = 1 << 1; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithWeekOfYear: CFISO8601DateFormatOptions = 1 << 2; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithDay: CFISO8601DateFormatOptions = 1 << 4; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithTime: CFISO8601DateFormatOptions = 1 << 5; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithTimeZone: CFISO8601DateFormatOptions = 1 << 6; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithSpaceBetweenDateAndTime: CFISO8601DateFormatOptions = 1 << 7; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithDashSeparatorInDate: CFISO8601DateFormatOptions = 1 << 8; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithColonSeparatorInTime: CFISO8601DateFormatOptions = 1 << 9; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithColonSeparatorInTimeZone: CFISO8601DateFormatOptions = 1 << 10; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithFractionalSeconds: CFISO8601DateFormatOptions = 1 << 11; // macosx(10.13)+
//pub const kCFISO8601DateFormatWithFullDate: CFISO8601DateFormatOptions = kCFISO8601DateFormatWithYear | kCFISO8601DateFormatWithMonth | kCFISO8601DateFormatWithDay | kCFISO8601DateFormatWithDashSeparatorInDate; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithFullTime: CFISO8601DateFormatOptions = kCFISO8601DateFormatWithTime | kCFISO8601DateFormatWithColonSeparatorInTime | kCFISO8601DateFormatWithTimeZone | kCFISO8601DateFormatWithColonSeparatorInTimeZone; // macosx(10.12)+
//pub const kCFISO8601DateFormatWithInternetDateTime: CFISO8601DateFormatOptions = kCFISO8601DateFormatWithFullDate | kCFISO8601DateFormatWithFullTime; // macosx(10.12)+
extern "C" {
/*
* CFDateFormatter.h
*/
/* Date Formatter Property Keys */
// The values for these keys are all CFType objects.
// The specific types for each key are specified above.
pub static kCFDateFormatterIsLenient: CFDateFormatterKey; // CFBoolean
pub static kCFDateFormatterTimeZone: CFDateFormatterKey; // CFTimeZone
pub static kCFDateFormatterCalendarName: CFDateFormatterKey; // CFString
pub static kCFDateFormatterDefaultFormat: CFDateFormatterKey; // CFString
pub static kCFDateFormatterTwoDigitStartDate: CFDateFormatterKey; // CFDate
pub static kCFDateFormatterDefaultDate: CFDateFormatterKey; // CFDate
pub static kCFDateFormatterCalendar: CFDateFormatterKey; // CFCalendar
pub static kCFDateFormatterEraSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterMonthSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterShortMonthSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterWeekdaySymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterShortWeekdaySymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterAMSymbol: CFDateFormatterKey; // CFString
pub static kCFDateFormatterPMSymbol: CFDateFormatterKey; // CFString
pub static kCFDateFormatterLongEraSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterVeryShortMonthSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterStandaloneMonthSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterShortStandaloneMonthSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterVeryShortStandaloneMonthSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterVeryShortWeekdaySymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterStandaloneWeekdaySymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterShortStandaloneWeekdaySymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterVeryShortStandaloneWeekdaySymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterQuarterSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterShortQuarterSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterStandaloneQuarterSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterShortStandaloneQuarterSymbols: CFDateFormatterKey; // CFArray of CFString
pub static kCFDateFormatterGregorianStartDate: CFDateFormatterKey; // CFDate
pub static kCFDateFormatterDoesRelativeDateFormattingKey: CFDateFormatterKey; // CFBoolean
/* Creating a Date Formatter */
pub fn CFDateFormatterCreate(
allocator: CFAllocatorRef,
locale: CFLocaleRef,
dateStyle: CFDateFormatterStyle,
timeStyle: CFDateFormatterStyle,
) -> CFDateFormatterRef;
/* Configuring a Date Formatter */
pub fn CFDateFormatterSetFormat(formatter: CFDateFormatterRef, formatString: CFStringRef);
pub fn CFDateFormatterSetProperty(
formatter: CFDateFormatterRef,
key: CFStringRef,
value: CFTypeRef,
);
/* Parsing Strings */
pub fn CFDateFormatterCreateDateFromString(
allocator: CFAllocatorRef,
formatter: CFDateFormatterRef,
string: CFStringRef,
rangep: *mut CFRange,
) -> CFDateRef;
pub fn CFDateFormatterGetAbsoluteTimeFromString(
formatter: CFDateFormatterRef,
string: CFStringRef,
rangep: *mut CFRange,
atp: *mut CFAbsoluteTime,
) -> Boolean;
/* Creating Strings From Data */
pub fn CFDateFormatterCreateStringWithAbsoluteTime(
allocator: CFAllocatorRef,
formatter: CFDateFormatterRef,
at: CFAbsoluteTime,
) -> CFStringRef;
pub fn CFDateFormatterCreateStringWithDate(
allocator: CFAllocatorRef,
formatter: CFDateFormatterRef,
date: CFDateRef,
) -> CFStringRef;
pub fn CFDateFormatterCreateDateFormatFromTemplate(
allocator: CFAllocatorRef,
tmplate: CFStringRef,
options: CFOptionFlags,
locale: CFLocaleRef,
) -> CFStringRef;
/* Getting Information About a Date Formatter */
pub fn CFDateFormatterCopyProperty(
formatter: CFDateFormatterRef,
key: CFDateFormatterKey,
) -> CFTypeRef;
pub fn CFDateFormatterGetDateStyle(formatter: CFDateFormatterRef) -> CFDateFormatterStyle;
pub fn CFDateFormatterGetFormat(formatter: CFDateFormatterRef) -> CFStringRef;
pub fn CFDateFormatterGetLocale(formatter: CFDateFormatterRef) -> CFLocaleRef;
pub fn CFDateFormatterGetTimeStyle(formatter: CFDateFormatterRef) -> CFDateFormatterStyle;
/* Getting the CFDateFormatter Type ID */
pub fn CFDateFormatterGetTypeID() -> CFTypeID;
//pub fn CFDateFormatterCreateISO8601Formatter(allocator: CFAllocatorRef, formatOptions: CFISO8601DateFormatOptions) -> CFDateFormatterRef; // macosx(10.12)+
}

View File

@@ -0,0 +1,139 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID};
use crate::string::CFStringRef;
pub type CFDictionaryApplierFunction =
extern "C" fn(key: *const c_void, value: *const c_void, context: *mut c_void);
pub type CFDictionaryRetainCallBack =
extern "C" fn(allocator: CFAllocatorRef, value: *const c_void) -> *const c_void;
pub type CFDictionaryReleaseCallBack =
extern "C" fn(allocator: CFAllocatorRef, value: *const c_void);
pub type CFDictionaryCopyDescriptionCallBack = extern "C" fn(value: *const c_void) -> CFStringRef;
pub type CFDictionaryEqualCallBack =
extern "C" fn(value1: *const c_void, value2: *const c_void) -> Boolean;
pub type CFDictionaryHashCallBack = extern "C" fn(value: *const c_void) -> CFHashCode;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CFDictionaryKeyCallBacks {
pub version: CFIndex,
pub retain: CFDictionaryRetainCallBack,
pub release: CFDictionaryReleaseCallBack,
pub copyDescription: CFDictionaryCopyDescriptionCallBack,
pub equal: CFDictionaryEqualCallBack,
pub hash: CFDictionaryHashCallBack,
}
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CFDictionaryValueCallBacks {
pub version: CFIndex,
pub retain: CFDictionaryRetainCallBack,
pub release: CFDictionaryReleaseCallBack,
pub copyDescription: CFDictionaryCopyDescriptionCallBack,
pub equal: CFDictionaryEqualCallBack,
}
#[repr(C)]
pub struct __CFDictionary(c_void);
pub type CFDictionaryRef = *const __CFDictionary;
pub type CFMutableDictionaryRef = *mut __CFDictionary;
extern "C" {
/*
* CFDictionary.h
*/
pub static kCFTypeDictionaryKeyCallBacks: CFDictionaryKeyCallBacks;
pub static kCFCopyStringDictionaryKeyCallBacks: CFDictionaryKeyCallBacks;
pub static kCFTypeDictionaryValueCallBacks: CFDictionaryValueCallBacks;
/* CFDictionary */
/* Creating a dictionary */
pub fn CFDictionaryCreate(
allocator: CFAllocatorRef,
keys: *const *const c_void,
values: *const *const c_void,
numValues: CFIndex,
keyCallBacks: *const CFDictionaryKeyCallBacks,
valueCallBacks: *const CFDictionaryValueCallBacks,
) -> CFDictionaryRef;
pub fn CFDictionaryCreateCopy(
allocator: CFAllocatorRef,
theDict: CFDictionaryRef,
) -> CFDictionaryRef;
/* Examining a dictionary */
pub fn CFDictionaryContainsKey(theDict: CFDictionaryRef, key: *const c_void) -> Boolean;
pub fn CFDictionaryContainsValue(theDict: CFDictionaryRef, value: *const c_void) -> Boolean;
pub fn CFDictionaryGetCount(theDict: CFDictionaryRef) -> CFIndex;
pub fn CFDictionaryGetCountOfKey(theDict: CFDictionaryRef, key: *const c_void) -> CFIndex;
pub fn CFDictionaryGetCountOfValue(heDict: CFDictionaryRef, value: *const c_void) -> CFIndex;
pub fn CFDictionaryGetKeysAndValues(
theDict: CFDictionaryRef,
keys: *mut *const c_void,
values: *mut *const c_void,
);
pub fn CFDictionaryGetValue(theDict: CFDictionaryRef, key: *const c_void) -> *const c_void;
pub fn CFDictionaryGetValueIfPresent(
theDict: CFDictionaryRef,
key: *const c_void,
value: *mut *const c_void,
) -> Boolean;
/* Applying a function to a dictionary */
pub fn CFDictionaryApplyFunction(
theDict: CFDictionaryRef,
applier: CFDictionaryApplierFunction,
context: *mut c_void,
);
/* Getting the CFDictionary type ID */
pub fn CFDictionaryGetTypeID() -> CFTypeID;
/* CFMutableDictionary */
/* Creating a Mutable Dictionary */
pub fn CFDictionaryCreateMutable(
allocator: CFAllocatorRef,
capacity: CFIndex,
keyCallbacks: *const CFDictionaryKeyCallBacks,
valueCallbacks: *const CFDictionaryValueCallBacks,
) -> CFMutableDictionaryRef;
pub fn CFDictionaryCreateMutableCopy(
allocator: CFAllocatorRef,
capacity: CFIndex,
theDict: CFDictionaryRef,
) -> CFMutableDictionaryRef;
/* Modifying a Dictionary */
pub fn CFDictionaryAddValue(
theDict: CFMutableDictionaryRef,
key: *const c_void,
value: *const c_void,
);
pub fn CFDictionaryRemoveAllValues(theDict: CFMutableDictionaryRef);
pub fn CFDictionaryRemoveValue(theDict: CFMutableDictionaryRef, key: *const c_void);
pub fn CFDictionaryReplaceValue(
theDict: CFMutableDictionaryRef,
key: *const c_void,
value: *const c_void,
);
pub fn CFDictionarySetValue(
theDict: CFMutableDictionaryRef,
key: *const c_void,
value: *const c_void,
);
}

62
vendor/core-foundation-sys/src/error.rs vendored Normal file
View File

@@ -0,0 +1,62 @@
// Copyright 2016 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{CFAllocatorRef, CFIndex, CFTypeID};
use crate::dictionary::CFDictionaryRef;
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFError(c_void);
pub type CFErrorRef = *mut __CFError;
pub type CFErrorDomain = CFStringRef;
extern "C" {
/*
* CFError.h
*/
/* Error domains */
pub static kCFErrorDomainPOSIX: CFStringRef;
pub static kCFErrorDomainOSStatus: CFStringRef;
pub static kCFErrorDomainMach: CFStringRef;
pub static kCFErrorDomainCocoa: CFStringRef;
/* Keys for the user info dictionary */
pub static kCFErrorLocalizedDescriptionKey: CFStringRef;
// pub static kCFErrorLocalizedFailureKey: CFStringRef; // macos(10.13)+
pub static kCFErrorLocalizedFailureReasonKey: CFStringRef;
pub static kCFErrorLocalizedRecoverySuggestionKey: CFStringRef;
pub static kCFErrorDescriptionKey: CFStringRef;
pub static kCFErrorUnderlyingErrorKey: CFStringRef;
pub static kCFErrorURLKey: CFStringRef;
pub static kCFErrorFilePathKey: CFStringRef;
/* Creating a CFError */
pub fn CFErrorCreate(
allocator: CFAllocatorRef,
domain: CFErrorDomain,
code: CFIndex,
userInfo: CFDictionaryRef,
) -> CFErrorRef;
//pub fn CFErrorCreateWithUserInfoKeysAndValues
/* Getting Information About an Error */
pub fn CFErrorGetDomain(err: CFErrorRef) -> CFStringRef;
pub fn CFErrorGetCode(err: CFErrorRef) -> CFIndex;
pub fn CFErrorCopyUserInfo(err: CFErrorRef) -> CFDictionaryRef;
pub fn CFErrorCopyDescription(err: CFErrorRef) -> CFStringRef;
pub fn CFErrorCopyFailureReason(err: CFErrorRef) -> CFStringRef;
pub fn CFErrorCopyRecoverySuggestion(err: CFErrorRef) -> CFStringRef;
/* Getting the CFError Type ID */
pub fn CFErrorGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,71 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
#[cfg(feature = "mac_os_10_8_features")]
use crate::base::CFOptionFlags;
use crate::base::{Boolean, CFAllocatorRef, CFTypeID};
use crate::uuid::CFUUIDRef;
#[repr(C)]
pub struct __CFFileSecurity(c_void);
pub type CFFileSecurityRef = *mut __CFFileSecurity;
#[cfg(feature = "mac_os_10_8_features")]
pub type CFFileSecurityClearOptions = CFOptionFlags;
#[cfg(feature = "mac_os_10_8_features")]
pub const kCFFileSecurityClearOwner: CFFileSecurityClearOptions = 1 << 0;
#[cfg(feature = "mac_os_10_8_features")]
pub const kCFFileSecurityClearGroup: CFFileSecurityClearOptions = 1 << 1;
#[cfg(feature = "mac_os_10_8_features")]
pub const kCFFileSecurityClearMode: CFFileSecurityClearOptions = 1 << 2;
#[cfg(feature = "mac_os_10_8_features")]
pub const kCFFileSecurityClearOwnerUUID: CFFileSecurityClearOptions = 1 << 3;
#[cfg(feature = "mac_os_10_8_features")]
pub const kCFFileSecurityClearGroupUUID: CFFileSecurityClearOptions = 1 << 4;
#[cfg(feature = "mac_os_10_8_features")]
pub const kCFFileSecurityClearAccessControlList: CFFileSecurityClearOptions = 1 << 5;
extern "C" {
/*
* CFFileSecurity.h
*/
pub fn CFFileSecurityGetTypeID() -> CFTypeID;
pub fn CFFileSecurityCreate(allocator: CFAllocatorRef) -> CFFileSecurityRef;
pub fn CFFileSecurityCreateCopy(
allocator: CFAllocatorRef,
fileSec: CFFileSecurityRef,
) -> CFFileSecurityRef;
pub fn CFFileSecurityCopyOwnerUUID(
fileSec: CFFileSecurityRef,
ownerUUID: *mut CFUUIDRef,
) -> Boolean;
pub fn CFFileSecuritySetOwnerUUID(fileSec: CFFileSecurityRef, ownerUUID: CFUUIDRef) -> Boolean;
pub fn CFFileSecurityCopyGroupUUID(
fileSec: CFFileSecurityRef,
groupUUID: *mut CFUUIDRef,
) -> Boolean;
pub fn CFFileSecuritySetGroupUUID(fileSec: CFFileSecurityRef, groupUUID: CFUUIDRef) -> Boolean;
//pub fn CFFileSecurityCopyAccessControlList(fileSec: CFFileSecurityRef, accessControlList: *mut acl_t) -> Boolean;
//pub fn CFFileSecuritySetAccessControlList(fileSec: CFFileSecurityRef, accessControlList: acl_t) -> Boolean;
//pub fn CFFileSecurityGetOwner(fileSec: CFFileSecurityRef, owner: *mut uid_t) -> Boolean;
//pub fn CFFileSecuritySetOwner(fileSec: CFFileSecurityRef, owner: uid_t) -> Boolean;
//pub fn CFFileSecurityGetGroup(fileSec: CFFileSecurityRef, group: *mut gid_t) -> Boolean;
//pub fn CFFileSecuritySetGroup(fileSec: CFFileSecurityRef, group: gid_t) -> Boolean;
//pub fn CFFileSecurityGetMode(fileSec: CFFileSecurityRef, mode: *mut mode_t) -> Boolean;
//pub fn CFFileSecuritySetMode(fileSec: CFFileSecurityRef, mode: mode_t) -> Boolean;
#[cfg(feature = "mac_os_10_8_features")]
#[cfg_attr(feature = "mac_os_10_7_support", linkage = "extern_weak")]
pub fn CFFileSecurityClearProperties(
fileSec: CFFileSecurityRef,
clearPropertyMask: CFFileSecurityClearOptions,
) -> Boolean;
}

View File

@@ -0,0 +1,80 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::{c_int, c_void};
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID};
use crate::runloop::CFRunLoopSourceRef;
use crate::string::CFStringRef;
pub type CFFileDescriptorNativeDescriptor = c_int;
#[repr(C)]
pub struct __CFFileDescriptor(c_void);
pub type CFFileDescriptorRef = *mut __CFFileDescriptor;
/* Callback Reason Types */
pub const kCFFileDescriptorReadCallBack: CFOptionFlags = 1 << 0;
pub const kCFFileDescriptorWriteCallBack: CFOptionFlags = 1 << 1;
pub type CFFileDescriptorCallBack =
extern "C" fn(f: CFFileDescriptorRef, callBackTypes: CFOptionFlags, info: *mut c_void);
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFFileDescriptorContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: Option<extern "C" fn(info: *const c_void) -> *const c_void>,
pub release: Option<extern "C" fn(info: *const c_void)>,
pub copyDescription: Option<extern "C" fn(info: *const c_void) -> CFStringRef>,
}
extern "C" {
/*
* CFFileDescriptor.h
*/
/* Creating a CFFileDescriptor */
pub fn CFFileDescriptorCreate(
allocator: CFAllocatorRef,
fd: CFFileDescriptorNativeDescriptor,
closeOnInvalidate: Boolean,
callout: CFFileDescriptorCallBack,
context: *const CFFileDescriptorContext,
) -> CFFileDescriptorRef;
/* Getting Information About a File Descriptor */
pub fn CFFileDescriptorGetNativeDescriptor(
f: CFFileDescriptorRef,
) -> CFFileDescriptorNativeDescriptor;
pub fn CFFileDescriptorIsValid(f: CFFileDescriptorRef) -> Boolean;
pub fn CFFileDescriptorGetContext(
f: CFFileDescriptorRef,
context: *mut CFFileDescriptorContext,
);
/* Invalidating a File Descriptor */
pub fn CFFileDescriptorInvalidate(f: CFFileDescriptorRef);
/* Managing Callbacks */
pub fn CFFileDescriptorEnableCallBacks(f: CFFileDescriptorRef, callBackTypes: CFOptionFlags);
pub fn CFFileDescriptorDisableCallBacks(f: CFFileDescriptorRef, callBackTypes: CFOptionFlags);
/* Creating a Run Loop Source */
pub fn CFFileDescriptorCreateRunLoopSource(
allocator: CFAllocatorRef,
f: CFFileDescriptorRef,
order: CFIndex,
) -> CFRunLoopSourceRef;
/* Getting the CFFileDescriptor Type ID */
pub fn CFFileDescriptorGetTypeID() -> CFTypeID;
}

80
vendor/core-foundation-sys/src/lib.rs vendored Normal file
View File

@@ -0,0 +1,80 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![allow(
non_snake_case,
non_camel_case_types,
non_upper_case_globals,
improper_ctypes
)]
#![cfg_attr(
all(feature = "mac_os_10_7_support", feature = "mac_os_10_8_features"),
feature(linkage)
)] // back-compat requires weak linkage
// Link to CoreFoundation on any Apple device.
//
// We don't use `target_vendor` since that is going to be deprecated:
// https://github.com/rust-lang/lang-team/issues/102
#[cfg_attr(
all(
any(
target_os = "macos",
target_os = "ios",
target_os = "tvos",
target_os = "watchos",
target_os = "visionos"
),
feature = "link"
),
link(name = "CoreFoundation", kind = "framework")
)]
extern "C" {}
pub mod array;
pub mod attributed_string;
pub mod bag;
pub mod base;
pub mod binary_heap;
pub mod bit_vector;
pub mod bundle;
pub mod calendar;
pub mod characterset;
pub mod data;
pub mod date;
pub mod date_formatter;
pub mod dictionary;
pub mod error;
pub mod file_security;
pub mod filedescriptor;
pub mod locale;
pub mod mach_port;
pub mod messageport;
pub mod notification_center;
pub mod number;
pub mod number_formatter;
pub mod plugin;
pub mod preferences;
pub mod propertylist;
pub mod runloop;
pub mod set;
pub mod socket;
pub mod stream;
pub mod string;
pub mod string_tokenizer;
pub mod timezone;
pub mod tree;
pub mod url;
pub mod url_enumerator;
#[cfg(target_os = "macos")]
pub mod user_notification;
pub mod uuid;
#[cfg(target_os = "macos")]
pub mod xml_node;
#[cfg(target_os = "macos")]
pub mod xml_parser;

146
vendor/core-foundation-sys/src/locale.rs vendored Normal file
View File

@@ -0,0 +1,146 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::array::CFArrayRef;
use crate::base::{CFAllocatorRef, CFIndex, CFTypeID, CFTypeRef, LangCode, RegionCode};
use crate::dictionary::CFDictionaryRef;
use crate::notification_center::CFNotificationName;
use crate::string::CFStringRef;
use std::os::raw::c_void;
#[repr(C)]
pub struct __CFLocale(c_void);
pub type CFLocaleRef = *const __CFLocale;
pub type CFLocaleIdentifier = CFStringRef;
pub type CFLocaleKey = CFStringRef;
pub type CFCalendarIdentifier = CFStringRef;
pub type CFLocaleLanguageDirection = CFIndex;
pub const kCFLocaleLanguageDirectionUnknown: CFLocaleLanguageDirection = 0;
pub const kCFLocaleLanguageDirectionLeftToRight: CFLocaleLanguageDirection = 1;
pub const kCFLocaleLanguageDirectionRightToLeft: CFLocaleLanguageDirection = 2;
pub const kCFLocaleLanguageDirectionTopToBottom: CFLocaleLanguageDirection = 3;
pub const kCFLocaleLanguageDirectionBottomToTop: CFLocaleLanguageDirection = 4;
extern "C" {
/*
* CFLocale.h
*/
/* Locale Change Notification */
pub static kCFLocaleCurrentLocaleDidChangeNotification: CFNotificationName;
/* Locale Property Keys */
pub static kCFLocaleIdentifier: CFLocaleKey;
pub static kCFLocaleLanguageCode: CFLocaleKey;
pub static kCFLocaleCountryCode: CFLocaleKey;
pub static kCFLocaleScriptCode: CFLocaleKey;
pub static kCFLocaleVariantCode: CFLocaleKey;
pub static kCFLocaleExemplarCharacterSet: CFLocaleKey;
pub static kCFLocaleCalendarIdentifier: CFLocaleKey;
pub static kCFLocaleCalendar: CFLocaleKey;
pub static kCFLocaleCollationIdentifier: CFLocaleKey;
pub static kCFLocaleUsesMetricSystem: CFLocaleKey;
pub static kCFLocaleMeasurementSystem: CFLocaleKey;
pub static kCFLocaleDecimalSeparator: CFLocaleKey;
pub static kCFLocaleGroupingSeparator: CFLocaleKey;
pub static kCFLocaleCurrencySymbol: CFLocaleKey;
pub static kCFLocaleCurrencyCode: CFLocaleKey;
pub static kCFLocaleCollatorIdentifier: CFLocaleKey;
pub static kCFLocaleQuotationBeginDelimiterKey: CFLocaleKey;
pub static kCFLocaleQuotationEndDelimiterKey: CFLocaleKey;
pub static kCFLocaleAlternateQuotationBeginDelimiterKey: CFLocaleKey;
pub static kCFLocaleAlternateQuotationEndDelimiterKey: CFLocaleKey;
/* Locale Calendar Identifiers */
pub static kCFGregorianCalendar: CFCalendarIdentifier;
pub static kCFBuddhistCalendar: CFCalendarIdentifier;
pub static kCFChineseCalendar: CFCalendarIdentifier;
pub static kCFHebrewCalendar: CFCalendarIdentifier;
pub static kCFIslamicCalendar: CFCalendarIdentifier;
pub static kCFIslamicCivilCalendar: CFCalendarIdentifier;
pub static kCFJapaneseCalendar: CFCalendarIdentifier;
pub static kCFRepublicOfChinaCalendar: CFCalendarIdentifier;
pub static kCFPersianCalendar: CFCalendarIdentifier;
pub static kCFIndianCalendar: CFCalendarIdentifier;
pub static kCFISO8601Calendar: CFCalendarIdentifier;
//pub static kCFIslamicTabularCalendar: CFCalendarIdentifier; // macos(10.10)+
//pub static kCFIslamicUmmAlQuraCalendar: CFCalendarIdentifier; // macos(10.10)+
/* Creating a Locale */
pub fn CFLocaleCopyCurrent() -> CFLocaleRef;
pub fn CFLocaleCreate(
allocator: CFAllocatorRef,
localeIdentifier: CFLocaleIdentifier,
) -> CFLocaleRef;
pub fn CFLocaleCreateCopy(allocator: CFAllocatorRef, locale: CFLocaleRef) -> CFLocaleRef;
pub fn CFLocaleGetSystem() -> CFLocaleRef;
/* Getting System Locale Information */
pub fn CFLocaleCopyAvailableLocaleIdentifiers() -> CFArrayRef;
/* Getting ISO Information */
pub fn CFLocaleCopyISOCountryCodes() -> CFArrayRef;
pub fn CFLocaleCopyISOLanguageCodes() -> CFArrayRef;
pub fn CFLocaleCopyISOCurrencyCodes() -> CFArrayRef;
pub fn CFLocaleCopyCommonISOCurrencyCodes() -> CFArrayRef;
/* Language Preferences */
pub fn CFLocaleCopyPreferredLanguages() -> CFArrayRef;
/* Getting Information About a Locale */
pub fn CFLocaleCopyDisplayNameForPropertyValue(
displayLocale: CFLocaleRef,
key: CFLocaleKey,
value: CFStringRef,
) -> CFStringRef;
pub fn CFLocaleGetValue(locale: CFLocaleRef, key: CFLocaleKey) -> CFTypeRef;
pub fn CFLocaleGetIdentifier(locale: CFLocaleRef) -> CFLocaleIdentifier;
/* Getting and Creating Locale Identifiers */
pub fn CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes(
allocator: CFAllocatorRef,
lcode: LangCode,
rcode: RegionCode,
) -> CFLocaleIdentifier;
pub fn CFLocaleCreateCanonicalLanguageIdentifierFromString(
allocator: CFAllocatorRef,
localeIdentifier: CFStringRef,
) -> CFLocaleIdentifier;
pub fn CFLocaleCreateCanonicalLocaleIdentifierFromString(
allocator: CFAllocatorRef,
localeIdentifier: CFStringRef,
) -> CFLocaleIdentifier;
pub fn CFLocaleCreateComponentsFromLocaleIdentifier(
allocator: CFAllocatorRef,
localeID: CFLocaleIdentifier,
) -> CFDictionaryRef;
pub fn CFLocaleCreateLocaleIdentifierFromComponents(
allocator: CFAllocatorRef,
dictionary: CFDictionaryRef,
) -> CFLocaleIdentifier;
pub fn CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode(
allocator: CFAllocatorRef,
lcid: u32,
) -> CFLocaleIdentifier;
pub fn CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier(
localeIdentifier: CFLocaleIdentifier,
) -> u32;
/* Getting Line and Character Direction for a Language */
pub fn CFLocaleGetLanguageCharacterDirection(
isoLangCode: CFStringRef,
) -> CFLocaleLanguageDirection;
pub fn CFLocaleGetLanguageLineDirection(isoLangCode: CFStringRef) -> CFLocaleLanguageDirection;
/* Getting the CFLocale Type ID */
pub fn CFLocaleGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,75 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::base::{mach_port_t, Boolean};
pub use crate::base::{CFAllocatorRef, CFIndex, CFTypeID};
use crate::runloop::CFRunLoopSourceRef;
use crate::string::CFStringRef;
use std::os::raw::c_void;
#[repr(C)]
pub struct __CFMachPort(c_void);
pub type CFMachPortRef = *mut __CFMachPort;
pub type CFMachPortCallBack =
extern "C" fn(port: CFMachPortRef, msg: *mut c_void, size: CFIndex, info: *mut c_void);
pub type CFMachPortInvalidationCallBack = extern "C" fn(port: CFMachPortRef, info: *mut c_void);
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CFMachPortContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: extern "C" fn(info: *const c_void) -> *const c_void,
pub release: extern "C" fn(info: *const c_void),
pub copyDescription: extern "C" fn(info: *const c_void) -> CFStringRef,
}
extern "C" {
/*
* CFMachPort.h
*/
/* Creating a CFMachPort Object */
pub fn CFMachPortCreate(
allocator: CFAllocatorRef,
callout: CFMachPortCallBack,
context: *mut CFMachPortContext,
shouldFreeInfo: *mut Boolean,
) -> CFMachPortRef;
pub fn CFMachPortCreateWithPort(
allocator: CFAllocatorRef,
portNum: mach_port_t,
callout: CFMachPortCallBack,
context: *mut CFMachPortContext,
shouldFreeInfo: *mut Boolean,
) -> CFMachPortRef;
/* Configuring a CFMachPort Object */
pub fn CFMachPortInvalidate(port: CFMachPortRef);
pub fn CFMachPortCreateRunLoopSource(
allocator: CFAllocatorRef,
port: CFMachPortRef,
order: CFIndex,
) -> CFRunLoopSourceRef;
pub fn CFMachPortSetInvalidationCallBack(
port: CFMachPortRef,
callout: CFMachPortInvalidationCallBack,
);
/* Examining a CFMachPort Object */
pub fn CFMachPortGetContext(port: CFMachPortRef, context: *mut CFMachPortContext);
pub fn CFMachPortGetInvalidationCallBack(port: CFMachPortRef)
-> CFMachPortInvalidationCallBack;
pub fn CFMachPortGetPort(port: CFMachPortRef) -> mach_port_t;
pub fn CFMachPortIsValid(port: CFMachPortRef) -> Boolean;
/* Getting the CFMachPort Type ID */
pub fn CFMachPortGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,106 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID, SInt32};
use crate::data::CFDataRef;
use crate::date::CFTimeInterval;
use crate::runloop::CFRunLoopSourceRef;
use crate::string::CFStringRef;
#[repr(C)]
#[derive(Copy, Clone, Debug)]
pub struct CFMessagePortContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: Option<unsafe extern "C" fn(info: *const c_void) -> *const c_void>,
pub release: Option<unsafe extern "C" fn(info: *const c_void)>,
pub copyDescription: Option<unsafe extern "C" fn(info: *const c_void) -> CFStringRef>,
}
pub type CFMessagePortCallBack = Option<
unsafe extern "C" fn(
local: CFMessagePortRef,
msgid: i32,
data: CFDataRef,
info: *mut c_void,
) -> CFDataRef,
>;
pub type CFMessagePortInvalidationCallBack =
Option<unsafe extern "C" fn(ms: CFMessagePortRef, info: *mut c_void)>;
/* CFMessagePortSendRequest Error Codes */
pub const kCFMessagePortSuccess: SInt32 = 0;
pub const kCFMessagePortSendTimeout: SInt32 = -1;
pub const kCFMessagePortReceiveTimeout: SInt32 = -2;
pub const kCFMessagePortIsInvalid: SInt32 = -3;
pub const kCFMessagePortTransportError: SInt32 = -4;
pub const kCFMessagePortBecameInvalidError: SInt32 = -5;
#[repr(C)]
pub struct __CFMessagePort(c_void);
pub type CFMessagePortRef = *mut __CFMessagePort;
extern "C" {
/*
* CFMessagePort.h
*/
/* Creating a CFMessagePort Object */
pub fn CFMessagePortCreateLocal(
allocator: CFAllocatorRef,
name: CFStringRef,
callout: CFMessagePortCallBack,
context: *const CFMessagePortContext,
shouldFreeInfo: *mut Boolean,
) -> CFMessagePortRef;
pub fn CFMessagePortCreateRemote(
allocator: CFAllocatorRef,
name: CFStringRef,
) -> CFMessagePortRef;
/* Configuring a CFMessagePort Object */
pub fn CFMessagePortCreateRunLoopSource(
allocator: CFAllocatorRef,
local: CFMessagePortRef,
order: CFIndex,
) -> CFRunLoopSourceRef;
pub fn CFMessagePortSetInvalidationCallBack(
ms: CFMessagePortRef,
callout: CFMessagePortInvalidationCallBack,
);
pub fn CFMessagePortSetName(ms: CFMessagePortRef, newName: CFStringRef) -> Boolean;
/* Using a Message Port */
pub fn CFMessagePortInvalidate(ms: CFMessagePortRef);
pub fn CFMessagePortSendRequest(
remote: CFMessagePortRef,
msgid: i32,
data: CFDataRef,
sendTimeout: CFTimeInterval,
rcvTimeout: CFTimeInterval,
replyMode: CFStringRef,
returnData: *mut CFDataRef,
) -> i32;
//pub fn CFMessagePortSetDispatchQueue(ms: CFMessagePortRef, queue: dispatch_queue_t);
/* Examining a Message Port */
pub fn CFMessagePortGetContext(ms: CFMessagePortRef, context: *mut CFMessagePortContext);
pub fn CFMessagePortGetInvalidationCallBack(
ms: CFMessagePortRef,
) -> CFMessagePortInvalidationCallBack;
pub fn CFMessagePortGetName(ms: CFMessagePortRef) -> CFStringRef;
pub fn CFMessagePortIsRemote(ms: CFMessagePortRef) -> Boolean;
pub fn CFMessagePortIsValid(ms: CFMessagePortRef) -> Boolean;
/* Getting the CFMessagePort Type ID */
pub fn CFMessagePortGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,89 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFIndex, CFOptionFlags, CFTypeID};
use crate::dictionary::CFDictionaryRef;
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFNotificationCenter(c_void);
pub type CFNotificationCenterRef = *mut __CFNotificationCenter;
pub type CFNotificationName = CFStringRef;
pub type CFNotificationCallback = extern "C" fn(
center: CFNotificationCenterRef,
observer: *mut c_void,
name: CFNotificationName,
object: *const c_void,
userInfo: CFDictionaryRef,
);
pub type CFNotificationSuspensionBehavior = CFIndex;
pub const CFNotificationSuspensionBehaviorDrop: CFNotificationSuspensionBehavior = 1;
pub const CFNotificationSuspensionBehaviorCoalesce: CFNotificationSuspensionBehavior = 2;
pub const CFNotificationSuspensionBehaviorHold: CFNotificationSuspensionBehavior = 3;
pub const CFNotificationSuspensionBehaviorDeliverImmediately: CFNotificationSuspensionBehavior = 4;
/* Notification Posting Options */
pub const kCFNotificationDeliverImmediately: CFOptionFlags = 1usize << 0;
pub const kCFNotificationPostToAllSessions: CFOptionFlags = 1usize << 1;
extern "C" {
/*
* CFNotificationCenter.h
*/
/* Accessing a Notification Center */
pub fn CFNotificationCenterGetDarwinNotifyCenter() -> CFNotificationCenterRef;
#[cfg(any(target_os = "macos", target_os = "windows"))]
pub fn CFNotificationCenterGetDistributedCenter() -> CFNotificationCenterRef;
pub fn CFNotificationCenterGetLocalCenter() -> CFNotificationCenterRef;
/* Posting a Notification */
pub fn CFNotificationCenterPostNotification(
center: CFNotificationCenterRef,
name: CFNotificationName,
object: *const c_void,
userInfo: CFDictionaryRef,
deliverImmediately: Boolean,
);
pub fn CFNotificationCenterPostNotificationWithOptions(
center: CFNotificationCenterRef,
name: CFNotificationName,
object: *const c_void,
userInfo: CFDictionaryRef,
options: CFOptionFlags,
);
/* Adding and Removing Observers */
pub fn CFNotificationCenterAddObserver(
center: CFNotificationCenterRef,
observer: *const c_void,
callBack: CFNotificationCallback,
name: CFStringRef,
object: *const c_void,
suspensionBehavior: CFNotificationSuspensionBehavior,
);
pub fn CFNotificationCenterRemoveEveryObserver(
center: CFNotificationCenterRef,
observer: *const c_void,
);
pub fn CFNotificationCenterRemoveObserver(
center: CFNotificationCenterRef,
observer: *const c_void,
name: CFNotificationName,
object: *const c_void,
);
/* Getting the CFNotificationCenter Type ID */
pub fn CFNotificationCenterGetTypeID() -> CFTypeID;
}

106
vendor/core-foundation-sys/src/number.rs vendored Normal file
View File

@@ -0,0 +1,106 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFTypeID};
#[repr(C)]
pub struct __CFBoolean(c_void);
pub type CFBooleanRef = *const __CFBoolean;
pub type CFNumberType = u32;
// members of enum CFNumberType
pub const kCFNumberSInt8Type: CFNumberType = 1;
pub const kCFNumberSInt16Type: CFNumberType = 2;
pub const kCFNumberSInt32Type: CFNumberType = 3;
pub const kCFNumberSInt64Type: CFNumberType = 4;
pub const kCFNumberFloat32Type: CFNumberType = 5;
pub const kCFNumberFloat64Type: CFNumberType = 6;
pub const kCFNumberCharType: CFNumberType = 7;
pub const kCFNumberShortType: CFNumberType = 8;
pub const kCFNumberIntType: CFNumberType = 9;
pub const kCFNumberLongType: CFNumberType = 10;
pub const kCFNumberLongLongType: CFNumberType = 11;
pub const kCFNumberFloatType: CFNumberType = 12;
pub const kCFNumberDoubleType: CFNumberType = 13;
pub const kCFNumberCFIndexType: CFNumberType = 14;
pub const kCFNumberNSIntegerType: CFNumberType = 15;
pub const kCFNumberCGFloatType: CFNumberType = 16;
pub const kCFNumberMaxType: CFNumberType = 16;
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum __CFNumber {}
pub type CFNumberRef = *const __CFNumber;
extern "C" {
/*
* CFNumber.h
*/
pub static kCFBooleanTrue: CFBooleanRef;
pub static kCFBooleanFalse: CFBooleanRef;
pub static kCFNumberPositiveInfinity: CFNumberRef;
pub static kCFNumberNegativeInfinity: CFNumberRef;
pub static kCFNumberNaN: CFNumberRef;
/* Creating a Number */
pub fn CFNumberCreate(
allocator: CFAllocatorRef,
theType: CFNumberType,
valuePtr: *const c_void,
) -> CFNumberRef;
/* Getting Information About Numbers */
pub fn CFNumberGetByteSize(number: CFNumberRef) -> CFIndex;
pub fn CFNumberGetType(number: CFNumberRef) -> CFNumberType;
pub fn CFNumberGetValue(
number: CFNumberRef,
theType: CFNumberType,
valuePtr: *mut c_void,
) -> bool;
pub fn CFNumberIsFloatType(number: CFNumberRef) -> Boolean;
/* Comparing Numbers */
pub fn CFNumberCompare(
date: CFNumberRef,
other: CFNumberRef,
context: *mut c_void,
) -> CFComparisonResult;
/* Getting the CFNumber Type ID */
pub fn CFNumberGetTypeID() -> CFTypeID;
pub fn CFBooleanGetValue(boolean: CFBooleanRef) -> bool;
pub fn CFBooleanGetTypeID() -> CFTypeID;
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn match_for_type_id_should_be_backwards_compatible() {
let type_id = kCFNumberFloat32Type;
// this is the old style of matching for static variables
match type_id {
vf64 if vf64 == kCFNumberFloat32Type => assert!(true),
_ => panic!("should not happen"),
};
// this is new new style of matching for consts
match type_id {
kCFNumberFloat32Type => assert!(true),
_ => panic!("should not happen"),
};
}
}

View File

@@ -0,0 +1,163 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::{c_double, c_void};
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef};
use crate::locale::CFLocaleRef;
use crate::number::{CFNumberRef, CFNumberType};
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFNumberFormatter(c_void);
pub type CFNumberFormatterRef = *mut __CFNumberFormatter;
pub type CFNumberFormatterKey = CFStringRef;
pub type CFNumberFormatterStyle = CFIndex;
pub type CFNumberFormatterOptionFlags = CFOptionFlags;
pub type CFNumberFormatterRoundingMode = CFIndex;
pub type CFNumberFormatterPadPosition = CFIndex;
/* Number Formatter Styles */
pub const kCFNumberFormatterNoStyle: CFNumberFormatterStyle = 0;
pub const kCFNumberFormatterDecimalStyle: CFNumberFormatterStyle = 1;
pub const kCFNumberFormatterCurrencyStyle: CFNumberFormatterStyle = 2;
pub const kCFNumberFormatterPercentStyle: CFNumberFormatterStyle = 3;
pub const kCFNumberFormatterScientificStyle: CFNumberFormatterStyle = 4;
pub const kCFNumberFormatterSpellOutStyle: CFNumberFormatterStyle = 5;
//pub const kCFNumberFormatterOrdinalStyle: CFNumberFormatterStyle = 6; // macos(10.11)+
//pub const kCFNumberFormatterCurrencyISOCodeStyle: CFNumberFormatterStyle = 8; // macos(10.11)+
//pub const kCFNumberFormatterCurrencyPluralStyle: CFNumberFormatterStyle = 9; // macos(10.11)+
//pub const kCFNumberFormatterCurrencyAccountingStyle: CFNumberFormatterStyle = 10; // macos(10.11)+
/* Number Format Options */
pub const kCFNumberFormatterParseIntegersOnly: CFNumberFormatterOptionFlags = 1;
/* CFNumberFormatterRoundingMode */
pub const kCFNumberFormatterRoundCeiling: CFNumberFormatterRoundingMode = 0;
pub const kCFNumberFormatterRoundFloor: CFNumberFormatterRoundingMode = 1;
pub const kCFNumberFormatterRoundDown: CFNumberFormatterRoundingMode = 2;
pub const kCFNumberFormatterRoundUp: CFNumberFormatterRoundingMode = 3;
pub const kCFNumberFormatterRoundHalfEven: CFNumberFormatterRoundingMode = 4;
pub const kCFNumberFormatterRoundHalfDown: CFNumberFormatterRoundingMode = 5;
pub const kCFNumberFormatterRoundHalfUp: CFNumberFormatterRoundingMode = 6;
/* Padding Positions */
pub const kCFNumberFormatterPadBeforePrefix: CFNumberFormatterPadPosition = 0;
pub const kCFNumberFormatterPadAfterPrefix: CFNumberFormatterPadPosition = 1;
pub const kCFNumberFormatterPadBeforeSuffix: CFNumberFormatterPadPosition = 2;
pub const kCFNumberFormatterPadAfterSuffix: CFNumberFormatterPadPosition = 3;
extern "C" {
/*
* CFNumberFormatter.h
*/
/* Number Formatter Property Keys */
// The values for these keys are all CFType objects.
// The specific types for each key are specified above.
pub static kCFNumberFormatterCurrencyCode: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterDecimalSeparator: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterCurrencyDecimalSeparator: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterAlwaysShowDecimalSeparator: CFNumberFormatterKey; // CFBoolean
pub static kCFNumberFormatterGroupingSeparator: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterUseGroupingSeparator: CFNumberFormatterKey; // CFBoolean
pub static kCFNumberFormatterPercentSymbol: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterZeroSymbol: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterNaNSymbol: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterInfinitySymbol: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterMinusSign: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterPlusSign: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterCurrencySymbol: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterExponentSymbol: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterMinIntegerDigits: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterMaxIntegerDigits: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterMinFractionDigits: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterMaxFractionDigits: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterGroupingSize: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterSecondaryGroupingSize: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterRoundingMode: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterRoundingIncrement: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterFormatWidth: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterPaddingPosition: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterPaddingCharacter: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterDefaultFormat: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterMultiplier: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterPositivePrefix: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterPositiveSuffix: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterNegativePrefix: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterNegativeSuffix: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterPerMillSymbol: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterInternationalCurrencySymbol: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterCurrencyGroupingSeparator: CFNumberFormatterKey; // CFString
pub static kCFNumberFormatterIsLenient: CFNumberFormatterKey; // CFBoolean
pub static kCFNumberFormatterUseSignificantDigits: CFNumberFormatterKey; // CFBoolean
pub static kCFNumberFormatterMinSignificantDigits: CFNumberFormatterKey; // CFNumber
pub static kCFNumberFormatterMaxSignificantDigits: CFNumberFormatterKey; // CFNumber
/* Creating a Number Formatter */
pub fn CFNumberFormatterCreate(
allocator: CFAllocatorRef,
locale: CFLocaleRef,
style: CFNumberFormatterStyle,
) -> CFNumberFormatterRef;
/* Configuring a Number Formatter */
pub fn CFNumberFormatterSetFormat(formatter: CFNumberFormatterRef, formatString: CFStringRef);
pub fn CFNumberFormatterSetProperty(
formatter: CFNumberFormatterRef,
key: CFNumberFormatterKey,
value: CFTypeRef,
);
/* Formatting Values */
pub fn CFNumberFormatterCreateNumberFromString(
allocator: CFAllocatorRef,
formatter: CFNumberFormatterRef,
string: CFStringRef,
rangep: *mut CFRange,
options: CFOptionFlags,
) -> CFNumberRef;
pub fn CFNumberFormatterCreateStringWithNumber(
allocator: CFAllocatorRef,
formatter: CFNumberFormatterRef,
number: CFNumberRef,
) -> CFStringRef;
pub fn CFNumberFormatterCreateStringWithValue(
allocator: CFAllocatorRef,
formatter: CFNumberFormatterRef,
numberType: CFNumberType,
valuePtr: *const c_void,
) -> CFStringRef;
pub fn CFNumberFormatterGetDecimalInfoForCurrencyCode(
currencyCode: CFStringRef,
defaultFractionDigits: *mut i32,
roundingIncrement: *mut c_double,
) -> Boolean;
pub fn CFNumberFormatterGetValueFromString(
formatter: CFNumberFormatterRef,
string: CFStringRef,
rangep: *mut CFRange,
numberType: CFNumberType,
valuePtr: *mut c_void,
) -> Boolean;
/* Examining a Number Formatter */
pub fn CFNumberFormatterCopyProperty(
formatter: CFNumberFormatterRef,
key: CFNumberFormatterKey,
) -> CFTypeRef;
pub fn CFNumberFormatterGetFormat(formatter: CFNumberFormatterRef) -> CFStringRef;
pub fn CFNumberFormatterGetLocale(formatter: CFNumberFormatterRef) -> CFLocaleRef;
pub fn CFNumberFormatterGetStyle(formatter: CFNumberFormatterRef) -> CFNumberFormatterStyle;
/* Getting the CFNumberFormatter Type ID */
pub fn CFNumberFormatterGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,99 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::array::CFArrayRef;
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID};
use crate::bundle::{CFBundleRef, CFPlugInRef};
use crate::string::CFStringRef;
use crate::url::CFURLRef;
use crate::uuid::CFUUIDRef;
#[repr(C)]
pub struct __CFPlugInInstance(c_void);
pub type CFPlugInInstanceRef = *mut __CFPlugInInstance;
pub type CFPlugInDynamicRegisterFunction = extern "C" fn(plugIn: CFPlugInRef);
pub type CFPlugInUnloadFunction = extern "C" fn(plugIn: CFPlugInRef);
pub type CFPlugInFactoryFunction =
extern "C" fn(allocator: CFAllocatorRef, typeUUID: CFUUIDRef) -> *mut c_void;
pub type CFPlugInInstanceGetInterfaceFunction = extern "C" fn(
instance: CFPlugInInstanceRef,
interfaceName: CFStringRef,
ftbl: *mut *mut c_void,
) -> Boolean;
pub type CFPlugInInstanceDeallocateInstanceDataFunction = extern "C" fn(instanceData: *mut c_void);
extern "C" {
/*
* CFPlugIn.h
*/
/* CFPlugIn */
/* Information Property List Keys */
pub static kCFPlugInDynamicRegistrationKey: CFStringRef;
pub static kCFPlugInDynamicRegisterFunctionKey: CFStringRef;
pub static kCFPlugInUnloadFunctionKey: CFStringRef;
pub static kCFPlugInFactoriesKey: CFStringRef;
pub static kCFPlugInTypesKey: CFStringRef;
/* Creating Plug-ins */
pub fn CFPlugInCreate(allocator: CFAllocatorRef, plugInURL: CFURLRef) -> CFPlugInRef;
pub fn CFPlugInInstanceCreate(
allocator: CFAllocatorRef,
factoryUUID: CFUUIDRef,
typeUUID: CFUUIDRef,
) -> *mut c_void;
/* Registration */
pub fn CFPlugInRegisterFactoryFunction(
factoryUUID: CFUUIDRef,
func: CFPlugInFactoryFunction,
) -> Boolean;
pub fn CFPlugInRegisterFactoryFunctionByName(
CfactoryUUID: CFUUIDRef,
plugIn: CFPlugInRef,
functionName: CFStringRef,
) -> Boolean;
pub fn CFPlugInRegisterPlugInType(factoryUUID: CFUUIDRef, typeUUID: CFUUIDRef) -> Boolean;
pub fn CFPlugInUnregisterFactory(factoryUUID: CFUUIDRef) -> Boolean;
pub fn CFPlugInUnregisterPlugInType(factoryUUID: CFUUIDRef, typeUUID: CFUUIDRef) -> Boolean;
/* CFPlugIn Miscellaneous Functions */
pub fn CFPlugInAddInstanceForFactory(factoryID: CFUUIDRef);
pub fn CFPlugInFindFactoriesForPlugInType(typeUUID: CFUUIDRef) -> CFArrayRef;
pub fn CFPlugInFindFactoriesForPlugInTypeInPlugIn(
typeUUID: CFUUIDRef,
plugIn: CFPlugInRef,
) -> CFArrayRef;
pub fn CFPlugInGetBundle(plugIn: CFPlugInRef) -> CFBundleRef;
pub fn CFPlugInGetTypeID() -> CFTypeID;
pub fn CFPlugInIsLoadOnDemand(plugIn: CFPlugInRef) -> Boolean;
pub fn CFPlugInRemoveInstanceForFactory(factoryID: CFUUIDRef);
pub fn CFPlugInSetLoadOnDemand(plugIn: CFPlugInRef, flag: Boolean);
/* CFPlugInInstance: deprecated */
pub fn CFPlugInInstanceCreateWithInstanceDataSize(
allocator: CFAllocatorRef,
instanceDataSize: CFIndex,
deallocateInstanceFunction: CFPlugInInstanceDeallocateInstanceDataFunction,
factoryName: CFStringRef,
getInterfaceFunction: CFPlugInInstanceGetInterfaceFunction,
) -> CFPlugInInstanceRef;
pub fn CFPlugInInstanceGetFactoryName(instance: CFPlugInInstanceRef) -> CFStringRef;
pub fn CFPlugInInstanceGetInstanceData(instance: CFPlugInInstanceRef) -> *mut c_void;
pub fn CFPlugInInstanceGetInterfaceFunctionTable(
instance: CFPlugInInstanceRef,
interfaceName: CFStringRef,
ftbl: *mut *mut c_void,
) -> Boolean;
pub fn CFPlugInInstanceGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,103 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::array::CFArrayRef;
use crate::base::{Boolean, CFIndex};
use crate::dictionary::CFDictionaryRef;
use crate::propertylist::CFPropertyListRef;
use crate::string::CFStringRef;
extern "C" {
/*
* CFPreferences.h
*/
/* Application, Host, and User Keys */
pub static kCFPreferencesAnyApplication: CFStringRef;
pub static kCFPreferencesCurrentApplication: CFStringRef;
pub static kCFPreferencesAnyHost: CFStringRef;
pub static kCFPreferencesCurrentHost: CFStringRef;
pub static kCFPreferencesAnyUser: CFStringRef;
pub static kCFPreferencesCurrentUser: CFStringRef;
/* Getting Preference Values */
pub fn CFPreferencesCopyAppValue(
key: CFStringRef,
applicationID: CFStringRef,
) -> CFPropertyListRef;
pub fn CFPreferencesCopyKeyList(
applicationID: CFStringRef,
userName: CFStringRef,
hostName: CFStringRef,
) -> CFArrayRef;
pub fn CFPreferencesCopyMultiple(
keysToFetch: CFArrayRef,
applicationID: CFStringRef,
userName: CFStringRef,
hostName: CFStringRef,
) -> CFDictionaryRef;
pub fn CFPreferencesCopyValue(
key: CFStringRef,
applicationID: CFStringRef,
userName: CFStringRef,
hostName: CFStringRef,
) -> CFPropertyListRef;
pub fn CFPreferencesGetAppBooleanValue(
key: CFStringRef,
applicationID: CFStringRef,
keyExistsAndHasValidFormat: *mut Boolean,
) -> Boolean;
pub fn CFPreferencesGetAppIntegerValue(
key: CFStringRef,
applicationID: CFStringRef,
keyExistsAndHasValidFormat: *mut Boolean,
) -> CFIndex;
/* Setting Preference Values */
pub fn CFPreferencesSetAppValue(
key: CFStringRef,
value: CFPropertyListRef,
applicationID: CFStringRef,
);
pub fn CFPreferencesSetMultiple(
keysToSet: CFDictionaryRef,
keysToRemove: CFArrayRef,
applicationID: CFStringRef,
userName: CFStringRef,
hostName: CFStringRef,
);
pub fn CFPreferencesSetValue(
key: CFStringRef,
value: CFPropertyListRef,
applicationID: CFStringRef,
userName: CFStringRef,
hostName: CFStringRef,
);
/* Synchronizing Preferences */
pub fn CFPreferencesAppSynchronize(applicationID: CFStringRef) -> Boolean;
pub fn CFPreferencesSynchronize(
applicationID: CFStringRef,
userName: CFStringRef,
hostName: CFStringRef,
) -> Boolean;
/* Adding and Removing Suite Preferences */
pub fn CFPreferencesAddSuitePreferencesToApp(applicationID: CFStringRef, suiteID: CFStringRef);
pub fn CFPreferencesRemoveSuitePreferencesFromApp(
applicationID: CFStringRef,
suiteID: CFStringRef,
);
/* Miscellaneous Functions */
pub fn CFPreferencesAppValueIsForced(key: CFStringRef, applicationID: CFStringRef) -> Boolean;
pub fn CFPreferencesCopyApplicationList(
userName: CFStringRef,
hostName: CFStringRef,
) -> CFArrayRef; // deprecated since macos 10.9
}

View File

@@ -0,0 +1,104 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeRef};
use crate::data::CFDataRef;
use crate::error::CFErrorRef;
use crate::stream::{CFReadStreamRef, CFWriteStreamRef};
use crate::string::CFStringRef;
pub type CFPropertyListRef = CFTypeRef;
pub type CFPropertyListFormat = CFIndex;
pub const kCFPropertyListOpenStepFormat: CFPropertyListFormat = 1;
pub const kCFPropertyListXMLFormat_v1_0: CFPropertyListFormat = 100;
pub const kCFPropertyListBinaryFormat_v1_0: CFPropertyListFormat = 200;
pub type CFPropertyListMutabilityOptions = CFOptionFlags;
pub const kCFPropertyListImmutable: CFPropertyListMutabilityOptions = 0;
pub const kCFPropertyListMutableContainers: CFPropertyListMutabilityOptions = 1;
pub const kCFPropertyListMutableContainersAndLeaves: CFPropertyListMutabilityOptions = 2;
/* Reading and Writing Error Codes */
pub const kCFPropertyListReadCorruptError: CFIndex = 3840;
pub const kCFPropertyListReadUnknownVersionError: CFIndex = 3841;
pub const kCFPropertyListReadStreamError: CFIndex = 3842;
pub const kCFPropertyListWriteStreamError: CFIndex = 3851;
extern "C" {
/*
* CFPropertyList.h
*/
/* Creating a Property List */
pub fn CFPropertyListCreateWithData(
allocator: CFAllocatorRef,
data: CFDataRef,
options: CFPropertyListMutabilityOptions,
format: *mut CFPropertyListFormat,
error: *mut CFErrorRef,
) -> CFPropertyListRef;
pub fn CFPropertyListCreateWithStream(
allocator: CFAllocatorRef,
stream: CFReadStreamRef,
streamLength: CFIndex,
options: CFOptionFlags,
format: *mut CFPropertyListFormat,
error: *mut CFErrorRef,
) -> CFPropertyListRef;
pub fn CFPropertyListCreateDeepCopy(
allocator: CFAllocatorRef,
propertyList: CFPropertyListRef,
mutabilityOption: CFOptionFlags,
) -> CFPropertyListRef;
pub fn CFPropertyListCreateFromXMLData(
allocator: CFAllocatorRef,
xmlData: CFDataRef,
mutabilityOption: CFOptionFlags,
errorString: *mut CFStringRef,
) -> CFPropertyListRef; // deprecated
pub fn CFPropertyListCreateFromStream(
allocator: CFAllocatorRef,
stream: CFReadStreamRef,
streamLength: CFIndex,
mutabilityOption: CFOptionFlags,
format: *mut CFPropertyListFormat,
errorString: *mut CFStringRef,
) -> CFPropertyListRef; // deprecated
/* Exporting a Property List */
pub fn CFPropertyListCreateData(
allocator: CFAllocatorRef,
propertyList: CFPropertyListRef,
format: CFPropertyListFormat,
options: CFOptionFlags,
error: *mut CFErrorRef,
) -> CFDataRef;
pub fn CFPropertyListWrite(
propertyList: CFPropertyListRef,
stream: CFWriteStreamRef,
format: CFPropertyListFormat,
options: CFOptionFlags,
error: *mut CFErrorRef,
) -> CFIndex;
pub fn CFPropertyListCreateXMLData(
allocator: CFAllocatorRef,
propertyList: CFPropertyListRef,
) -> CFDataRef; // deprecated
pub fn CFPropertyListWriteToStream(
propertyList: CFPropertyListRef,
stream: CFWriteStreamRef,
format: CFPropertyListFormat,
errorString: *mut CFStringRef,
) -> CFIndex;
/* Validating a Property List */
pub fn CFPropertyListIsValid(plist: CFPropertyListRef, format: CFPropertyListFormat)
-> Boolean;
}

View File

@@ -0,0 +1,256 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::array::CFArrayRef;
use crate::base::{
mach_port_t, Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFOptionFlags, CFTypeID,
};
use crate::date::{CFAbsoluteTime, CFTimeInterval};
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFRunLoop(c_void);
pub type CFRunLoopRef = *mut __CFRunLoop;
#[repr(C)]
pub struct __CFRunLoopSource(c_void);
pub type CFRunLoopSourceRef = *mut __CFRunLoopSource;
#[repr(C)]
pub struct __CFRunLoopObserver(c_void);
pub type CFRunLoopObserverRef = *mut __CFRunLoopObserver;
// Reasons for CFRunLoopRunInMode() to Return
pub const kCFRunLoopRunFinished: i32 = 1;
pub const kCFRunLoopRunStopped: i32 = 2;
pub const kCFRunLoopRunTimedOut: i32 = 3;
pub const kCFRunLoopRunHandledSource: i32 = 4;
// Run Loop Observer Activities
//typedef CF_OPTIONS(CFOptionFlags, CFRunLoopActivity) {
pub type CFRunLoopActivity = CFOptionFlags;
pub const kCFRunLoopEntry: CFOptionFlags = 1 << 0;
pub const kCFRunLoopBeforeTimers: CFOptionFlags = 1 << 1;
pub const kCFRunLoopBeforeSources: CFOptionFlags = 1 << 2;
pub const kCFRunLoopBeforeWaiting: CFOptionFlags = 1 << 5;
pub const kCFRunLoopAfterWaiting: CFOptionFlags = 1 << 6;
pub const kCFRunLoopExit: CFOptionFlags = 1 << 7;
pub const kCFRunLoopAllActivities: CFOptionFlags = 0x0FFFFFFF;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFRunLoopSourceContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: Option<extern "C" fn(info: *const c_void) -> *const c_void>,
pub release: Option<extern "C" fn(info: *const c_void)>,
pub copyDescription: Option<extern "C" fn(info: *const c_void) -> CFStringRef>,
pub equal: Option<extern "C" fn(info1: *const c_void, info2: *const c_void) -> Boolean>,
pub hash: Option<extern "C" fn(info: *const c_void) -> CFHashCode>,
pub schedule: Option<extern "C" fn(info: *const c_void, rl: CFRunLoopRef, mode: CFStringRef)>,
pub cancel: Option<extern "C" fn(info: *const c_void, rl: CFRunLoopRef, mode: CFStringRef)>,
pub perform: extern "C" fn(info: *const c_void),
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFRunLoopSourceContext1 {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: Option<extern "C" fn(info: *const c_void) -> *const c_void>,
pub release: Option<extern "C" fn(info: *const c_void)>,
pub copyDescription: Option<extern "C" fn(info: *const c_void) -> CFStringRef>,
pub equal: Option<extern "C" fn(info1: *const c_void, info2: *const c_void) -> Boolean>,
pub hash: Option<extern "C" fn(info: *const c_void) -> CFHashCode>,
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub getPort: extern "C" fn(info: *mut c_void) -> mach_port_t,
#[cfg(any(target_os = "macos", target_os = "ios"))]
pub perform: extern "C" fn(
msg: *mut c_void,
size: CFIndex,
allocator: CFAllocatorRef,
info: *mut c_void,
) -> *mut c_void,
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
pub getPort: extern "C" fn(info: *mut c_void) -> *mut c_void,
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
pub perform: extern "C" fn(info: *mut c_void) -> *mut c_void,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFRunLoopObserverContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: Option<extern "C" fn(info: *const c_void) -> *const c_void>,
pub release: Option<extern "C" fn(info: *const c_void)>,
pub copyDescription: Option<extern "C" fn(info: *const c_void) -> CFStringRef>,
}
pub type CFRunLoopObserverCallBack =
extern "C" fn(observer: CFRunLoopObserverRef, activity: CFRunLoopActivity, info: *mut c_void);
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct CFRunLoopTimerContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: Option<extern "C" fn(info: *const c_void) -> *const c_void>,
pub release: Option<extern "C" fn(info: *const c_void)>,
pub copyDescription: Option<extern "C" fn(info: *const c_void) -> CFStringRef>,
}
pub type CFRunLoopTimerCallBack = extern "C" fn(timer: CFRunLoopTimerRef, info: *mut c_void);
#[repr(C)]
pub struct __CFRunLoopTimer(c_void);
pub type CFRunLoopTimerRef = *mut __CFRunLoopTimer;
extern "C" {
/*
* CFRunLoop.h
*/
pub static kCFRunLoopDefaultMode: CFStringRef;
pub static kCFRunLoopCommonModes: CFStringRef;
/* CFRunLoop */
/* Getting a Run Loop */
pub fn CFRunLoopGetCurrent() -> CFRunLoopRef;
pub fn CFRunLoopGetMain() -> CFRunLoopRef;
/* Starting and Stopping a Run Loop */
pub fn CFRunLoopRun();
pub fn CFRunLoopRunInMode(
mode: CFStringRef,
seconds: CFTimeInterval,
returnAfterSourceHandled: Boolean,
) -> i32;
pub fn CFRunLoopWakeUp(rl: CFRunLoopRef);
pub fn CFRunLoopStop(rl: CFRunLoopRef);
pub fn CFRunLoopIsWaiting(rl: CFRunLoopRef) -> Boolean;
/* Managing Sources */
pub fn CFRunLoopAddSource(rl: CFRunLoopRef, source: CFRunLoopSourceRef, mode: CFStringRef);
pub fn CFRunLoopContainsSource(
rl: CFRunLoopRef,
source: CFRunLoopSourceRef,
mode: CFStringRef,
) -> Boolean;
pub fn CFRunLoopRemoveSource(rl: CFRunLoopRef, source: CFRunLoopSourceRef, mode: CFStringRef);
/* Managing Observers */
pub fn CFRunLoopAddObserver(
rl: CFRunLoopRef,
observer: CFRunLoopObserverRef,
mode: CFStringRef,
);
pub fn CFRunLoopContainsObserver(
rl: CFRunLoopRef,
observer: CFRunLoopObserverRef,
mode: CFStringRef,
) -> Boolean;
pub fn CFRunLoopRemoveObserver(
rl: CFRunLoopRef,
observer: CFRunLoopObserverRef,
mode: CFStringRef,
);
/* Managing Run Loop Modes */
pub fn CFRunLoopAddCommonMode(rl: CFRunLoopRef, mode: CFStringRef);
pub fn CFRunLoopCopyAllModes(rl: CFRunLoopRef) -> CFArrayRef;
pub fn CFRunLoopCopyCurrentMode(rl: CFRunLoopRef) -> CFStringRef;
/* Managing Timers */
pub fn CFRunLoopAddTimer(rl: CFRunLoopRef, timer: CFRunLoopTimerRef, mode: CFStringRef);
pub fn CFRunLoopGetNextTimerFireDate(rl: CFRunLoopRef, mode: CFStringRef) -> CFAbsoluteTime;
pub fn CFRunLoopRemoveTimer(rl: CFRunLoopRef, timer: CFRunLoopTimerRef, mode: CFStringRef);
pub fn CFRunLoopContainsTimer(
rl: CFRunLoopRef,
timer: CFRunLoopTimerRef,
mode: CFStringRef,
) -> Boolean;
/* Scheduling Blocks */
// fn CFRunLoopPerformBlock(rl: CFRunLoopRef, mode: CFTypeRef, block: void (^)(void));
/* Getting the CFRunLoop Type ID */
pub fn CFRunLoopGetTypeID() -> CFTypeID;
/* CFRunLoopSource */
/* CFRunLoopSource Miscellaneous Functions */
pub fn CFRunLoopSourceCreate(
allocator: CFAllocatorRef,
order: CFIndex,
context: *mut CFRunLoopSourceContext,
) -> CFRunLoopSourceRef;
pub fn CFRunLoopSourceGetContext(
source: CFRunLoopSourceRef,
context: *mut CFRunLoopSourceContext,
);
pub fn CFRunLoopSourceGetOrder(source: CFRunLoopSourceRef) -> CFIndex;
pub fn CFRunLoopSourceGetTypeID() -> CFTypeID;
pub fn CFRunLoopSourceInvalidate(source: CFRunLoopSourceRef);
pub fn CFRunLoopSourceIsValid(source: CFRunLoopSourceRef) -> Boolean;
pub fn CFRunLoopSourceSignal(source: CFRunLoopSourceRef);
/* CFRunLoopObserver */
/* CFRunLoopObserver Miscellaneous Functions */
// fn CFRunLoopObserverCreateWithHandler(allocator: CFAllocatorRef, activities: CFOptionFlags, repeats: Boolean, order: CFIndex, block: void (^) (CFRunLoopObserverRef observer, CFRunLoopActivity activity)) -> CFRunLoopObserverRef;
pub fn CFRunLoopObserverCreate(
allocator: CFAllocatorRef,
activities: CFOptionFlags,
repeats: Boolean,
order: CFIndex,
callout: CFRunLoopObserverCallBack,
context: *mut CFRunLoopObserverContext,
) -> CFRunLoopObserverRef;
pub fn CFRunLoopObserverDoesRepeat(observer: CFRunLoopObserverRef) -> Boolean;
pub fn CFRunLoopObserverGetActivities(observer: CFRunLoopObserverRef) -> CFOptionFlags;
pub fn CFRunLoopObserverGetContext(
observer: CFRunLoopObserverRef,
context: *mut CFRunLoopObserverContext,
);
pub fn CFRunLoopObserverGetOrder(observer: CFRunLoopObserverRef) -> CFIndex;
pub fn CFRunLoopObserverGetTypeID() -> CFTypeID;
pub fn CFRunLoopObserverInvalidate(observer: CFRunLoopObserverRef);
pub fn CFRunLoopObserverIsValid(observer: CFRunLoopObserverRef) -> Boolean;
/* CFRunLoopTimer */
/* CFRunLoopTimer Miscellaneous Functions */
// fn CFRunLoopTimerCreateWithHandler(allocator: CFAllocatorRef, fireDate: CFAbsoluteTime, interval: CFTimeInterval, flags: CFOptionFlags, order: CFIndex, block: void (^) (CFRunLoopTimerRef timer)) -> CFRunLoopTimerRef;
pub fn CFRunLoopTimerCreate(
allocator: CFAllocatorRef,
fireDate: CFAbsoluteTime,
interval: CFTimeInterval,
flags: CFOptionFlags,
order: CFIndex,
callout: CFRunLoopTimerCallBack,
context: *mut CFRunLoopTimerContext,
) -> CFRunLoopTimerRef;
pub fn CFRunLoopTimerDoesRepeat(timer: CFRunLoopTimerRef) -> Boolean;
pub fn CFRunLoopTimerGetContext(timer: CFRunLoopTimerRef, context: *mut CFRunLoopTimerContext);
pub fn CFRunLoopTimerGetInterval(timer: CFRunLoopTimerRef) -> CFTimeInterval;
pub fn CFRunLoopTimerGetNextFireDate(timer: CFRunLoopTimerRef) -> CFAbsoluteTime;
pub fn CFRunLoopTimerGetOrder(timer: CFRunLoopTimerRef) -> CFIndex;
pub fn CFRunLoopTimerGetTypeID() -> CFTypeID;
pub fn CFRunLoopTimerInvalidate(timer: CFRunLoopTimerRef);
pub fn CFRunLoopTimerIsValid(timer: CFRunLoopTimerRef) -> Boolean;
pub fn CFRunLoopTimerSetNextFireDate(timer: CFRunLoopTimerRef, fireDate: CFAbsoluteTime);
pub fn CFRunLoopTimerGetTolerance(timer: CFRunLoopTimerRef) -> CFTimeInterval; //macos(10.9)+
pub fn CFRunLoopTimerSetTolerance(timer: CFRunLoopTimerRef, tolerance: CFTimeInterval); //macos(10.9)+
}

98
vendor/core-foundation-sys/src/set.rs vendored Normal file
View File

@@ -0,0 +1,98 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFHashCode, CFIndex, CFTypeID};
use crate::string::CFStringRef;
pub type CFSetApplierFunction = extern "C" fn(value: *const c_void, context: *const c_void);
pub type CFSetRetainCallBack =
extern "C" fn(allocator: CFAllocatorRef, value: *const c_void) -> *const c_void;
pub type CFSetReleaseCallBack = extern "C" fn(allocator: CFAllocatorRef, value: *const c_void);
pub type CFSetCopyDescriptionCallBack = extern "C" fn(value: *const c_void) -> CFStringRef;
pub type CFSetEqualCallBack =
extern "C" fn(value1: *const c_void, value2: *const c_void) -> Boolean;
pub type CFSetHashCallBack = extern "C" fn(value: *const c_void) -> CFHashCode;
#[repr(C)]
#[derive(Clone, Copy)]
pub struct CFSetCallBacks {
pub version: CFIndex,
pub retain: CFSetRetainCallBack,
pub release: CFSetReleaseCallBack,
pub copyDescription: CFSetCopyDescriptionCallBack,
pub equal: CFSetEqualCallBack,
pub hash: CFSetHashCallBack,
}
#[repr(C)]
pub struct __CFSet(c_void);
pub type CFSetRef = *const __CFSet;
pub type CFMutableSetRef = *mut __CFSet;
extern "C" {
/*
* CFSet.h
*/
pub static kCFTypeSetCallBacks: CFSetCallBacks;
pub static kCFCopyStringSetCallBacks: CFSetCallBacks;
/* CFSet */
/* Creating Sets */
pub fn CFSetCreate(
allocator: CFAllocatorRef,
values: *const *const c_void,
numValues: CFIndex,
callBacks: *const CFSetCallBacks,
) -> CFSetRef;
pub fn CFSetCreateCopy(allocator: CFAllocatorRef, theSet: CFSetRef) -> CFSetRef;
/* Examining a Set */
pub fn CFSetContainsValue(theSet: CFSetRef, value: *const c_void) -> Boolean;
pub fn CFSetGetCount(theSet: CFSetRef) -> CFIndex;
pub fn CFSetGetCountOfValue(theSet: CFSetRef, value: *const c_void) -> CFIndex;
pub fn CFSetGetValue(theSet: CFSetRef, value: *const c_void) -> *const c_void;
pub fn CFSetGetValueIfPresent(
theSet: CFSetRef,
candidate: *const c_void,
value: *mut *const c_void,
) -> Boolean;
pub fn CFSetGetValues(theSet: CFSetRef, values: *mut *const c_void);
/* Applying a Function to Set Members */
pub fn CFSetApplyFunction(
theSet: CFSetRef,
applier: CFSetApplierFunction,
context: *const c_void,
);
/* Getting the CFSet Type ID */
pub fn CFSetGetTypeID() -> CFTypeID;
/* CFMutableSet */
/* CFMutableSet Miscellaneous Functions */
pub fn CFSetAddValue(theSet: CFMutableSetRef, value: *const c_void);
pub fn CFSetCreateMutable(
allocator: CFAllocatorRef,
capacity: CFIndex,
callBacks: *const CFSetCallBacks,
) -> CFMutableSetRef;
pub fn CFSetCreateMutableCopy(
allocator: CFAllocatorRef,
capacity: CFIndex,
theSet: CFSetRef,
) -> CFMutableSetRef;
pub fn CFSetRemoveAllValues(theSet: CFMutableSetRef);
pub fn CFSetRemoveValue(theSet: CFMutableSetRef, value: *const c_void);
pub fn CFSetReplaceValue(theSet: CFMutableSetRef, value: *const c_void);
pub fn CFSetSetValue(theSet: CFMutableSetRef, value: *const c_void);
}

188
vendor/core-foundation-sys/src/socket.rs vendored Normal file
View File

@@ -0,0 +1,188 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, SInt32, UInt16};
use crate::data::CFDataRef;
use crate::date::CFTimeInterval;
use crate::propertylist::CFPropertyListRef;
use crate::runloop::CFRunLoopSourceRef;
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFSocket(c_void);
pub type CFSocketRef = *mut __CFSocket;
pub type CFSocketError = CFIndex;
pub type CFSocketCallBackType = CFOptionFlags;
pub type CFSocketCallBack = extern "C" fn(
s: CFSocketRef,
_type: CFSocketCallBackType,
address: CFDataRef,
cdata: *const c_void,
info: *mut c_void,
);
#[cfg(not(target_os = "windows"))]
pub type CFSocketNativeHandle = std::os::raw::c_int;
#[cfg(target_os = "windows")]
pub type CFSocketNativeHandle = std::os::raw::c_ulong;
pub const kCFSocketSuccess: CFSocketError = 0;
pub const kCFSocketError: CFSocketError = -1;
pub const kCFSocketTimeout: CFSocketError = -2;
#[derive(Debug, Copy, Clone)]
#[repr(C)]
pub struct CFSocketSignature {
pub protocolFamily: SInt32,
pub socketType: SInt32,
pub protocol: SInt32,
pub address: CFDataRef,
}
#[derive(Debug, Copy, Clone)]
#[repr(C)]
pub struct CFSocketContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: extern "C" fn(info: *const c_void) -> *const c_void,
pub release: extern "C" fn(info: *const c_void),
pub copyDescription: extern "C" fn(info: *const c_void) -> CFStringRef,
}
pub const kCFSocketNoCallBack: CFSocketError = 0;
pub const kCFSocketReadCallBack: CFSocketError = 1;
pub const kCFSocketAcceptCallBack: CFSocketError = 2;
pub const kCFSocketDataCallBack: CFSocketError = 3;
pub const kCFSocketConnectCallBack: CFSocketError = 4;
pub const kCFSocketWriteCallBack: CFSocketError = 8;
pub const kCFSocketAutomaticallyReenableReadCallBack: CFOptionFlags = 1;
pub const kCFSocketAutomaticallyReenableAcceptCallBack: CFOptionFlags = 2;
pub const kCFSocketAutomaticallyReenableDataCallBack: CFOptionFlags = 3;
pub const kCFSocketAutomaticallyReenableWriteCallBack: CFOptionFlags = 8;
pub const kCFSocketLeaveErrors: CFOptionFlags = 64;
pub const kCFSocketCloseOnInvalidate: CFOptionFlags = 128;
extern "C" {
/*
* CFSocket.h
*/
/* CFSocket Name Server Keys: Not used */
pub static kCFSocketCommandKey: CFStringRef;
pub static kCFSocketNameKey: CFStringRef;
pub static kCFSocketValueKey: CFStringRef;
pub static kCFSocketResultKey: CFStringRef;
pub static kCFSocketErrorKey: CFStringRef;
pub static kCFSocketRegisterCommand: CFStringRef;
pub static kCFSocketRetrieveCommand: CFStringRef;
/* Creating Sockets */
pub fn CFSocketCreate(
allocator: CFAllocatorRef,
protocolFamily: SInt32,
socketType: SInt32,
protocol: SInt32,
callBackTypes: CFOptionFlags,
callout: CFSocketCallBack,
context: *const CFSocketContext,
) -> CFSocketRef;
pub fn CFSocketCreateConnectedToSocketSignature(
allocator: CFAllocatorRef,
signature: *const CFSocketSignature,
callBackTypes: CFOptionFlags,
callout: CFSocketCallBack,
context: *const CFSocketContext,
timeout: CFTimeInterval,
) -> CFSocketRef;
pub fn CFSocketCreateWithNative(
allocator: CFAllocatorRef,
sock: CFSocketNativeHandle,
callBackTypes: CFOptionFlags,
callout: CFSocketCallBack,
context: *const CFSocketContext,
) -> CFSocketRef;
pub fn CFSocketCreateWithSocketSignature(
allocator: CFAllocatorRef,
signature: *const CFSocketSignature,
callBackTypes: CFOptionFlags,
callout: CFSocketCallBack,
context: *const CFSocketContext,
) -> CFSocketRef;
/* Configuring Sockets */
pub fn CFSocketCopyAddress(s: CFSocketRef) -> CFDataRef;
pub fn CFSocketCopyPeerAddress(s: CFSocketRef) -> CFDataRef;
pub fn CFSocketDisableCallBacks(s: CFSocketRef, callBackTypes: CFOptionFlags);
pub fn CFSocketEnableCallBacks(s: CFSocketRef, callBackTypes: CFOptionFlags);
pub fn CFSocketGetContext(s: CFSocketRef, context: *mut CFSocketContext);
pub fn CFSocketGetNative(s: CFSocketRef) -> CFSocketNativeHandle;
pub fn CFSocketGetSocketFlags(s: CFSocketRef) -> CFOptionFlags;
pub fn CFSocketSetAddress(s: CFSocketRef, address: CFDataRef) -> CFSocketError;
pub fn CFSocketSetSocketFlags(s: CFSocketRef, flags: CFOptionFlags);
/* Using Sockets */
pub fn CFSocketConnectToAddress(
s: CFSocketRef,
address: CFDataRef,
timeout: CFTimeInterval,
) -> CFSocketError;
pub fn CFSocketCreateRunLoopSource(
allocator: CFAllocatorRef,
s: CFSocketRef,
order: CFIndex,
) -> CFRunLoopSourceRef;
pub fn CFSocketGetTypeID() -> CFTypeID;
pub fn CFSocketInvalidate(s: CFSocketRef);
pub fn CFSocketIsValid(s: CFSocketRef) -> Boolean;
pub fn CFSocketSendData(
s: CFSocketRef,
address: CFDataRef,
data: CFDataRef,
timeout: CFTimeInterval,
) -> CFSocketError;
/* Socket Name Server Utilities */
pub fn CFSocketCopyRegisteredSocketSignature(
nameServerSignature: *const CFSocketSignature,
timeout: CFTimeInterval,
name: CFStringRef,
signature: *mut CFSocketSignature,
nameServerAddress: *mut CFDataRef,
) -> CFSocketError;
pub fn CFSocketCopyRegisteredValue(
nameServerSignature: *const CFSocketSignature,
timeout: CFTimeInterval,
name: CFStringRef,
value: *mut CFPropertyListRef,
nameServerAddress: *mut CFDataRef,
) -> CFSocketError;
pub fn CFSocketGetDefaultNameRegistryPortNumber() -> UInt16;
pub fn CFSocketRegisterSocketSignature(
nameServerSignature: *const CFSocketSignature,
timeout: CFTimeInterval,
name: CFStringRef,
signature: *const CFSocketSignature,
) -> CFSocketError;
pub fn CFSocketRegisterValue(
nameServerSignature: *const CFSocketSignature,
timeout: CFTimeInterval,
name: CFStringRef,
value: CFPropertyListRef,
) -> CFSocketError;
pub fn CFSocketSetDefaultNameRegistryPortNumber(port: UInt16);
pub fn CFSocketUnregister(
nameServerSignature: *const CFSocketSignature,
timeout: CFTimeInterval,
name: CFStringRef,
) -> CFSocketError;
}

281
vendor/core-foundation-sys/src/stream.rs vendored Normal file
View File

@@ -0,0 +1,281 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::{c_int, c_void};
use crate::base::{
Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, CFTypeRef, SInt32, UInt32, UInt8,
};
use crate::error::CFErrorRef;
use crate::runloop::CFRunLoopRef;
use crate::socket::{CFSocketNativeHandle, CFSocketSignature};
use crate::string::CFStringRef;
use crate::url::CFURLRef;
#[repr(C)]
pub struct __CFReadStream(c_void);
#[repr(C)]
pub struct __CFWriteStream(c_void);
pub type CFReadStreamRef = *mut __CFReadStream;
pub type CFWriteStreamRef = *mut __CFWriteStream;
pub type CFStreamPropertyKey = CFStringRef;
pub type CFStreamStatus = CFIndex;
pub type CFStreamEventType = CFOptionFlags;
pub type CFStreamErrorDomain = CFIndex;
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct CFStreamError {
pub domain: CFIndex,
pub error: SInt32,
}
/* CFStreamStatus: Constants that describe the status of a stream */
pub const kCFStreamStatusNotOpen: CFStreamStatus = 0;
pub const kCFStreamStatusOpening: CFStreamStatus = 1;
pub const kCFStreamStatusOpen: CFStreamStatus = 2;
pub const kCFStreamStatusReading: CFStreamStatus = 3;
pub const kCFStreamStatusWriting: CFStreamStatus = 4;
pub const kCFStreamStatusAtEnd: CFStreamStatus = 5;
pub const kCFStreamStatusClosed: CFStreamStatus = 6;
pub const kCFStreamStatusError: CFStreamStatus = 7;
// deprecated
pub const kCFStreamErrorDomainCustom: CFStreamErrorDomain = -1;
pub const kCFStreamErrorDomainPOSIX: CFStreamErrorDomain = 1;
pub const kCFStreamErrorDomainMacOSStatus: CFStreamErrorDomain = 2;
/* CFStreamEventType: Defines constants for stream-related events */
pub const kCFStreamEventNone: CFStreamEventType = 0;
pub const kCFStreamEventOpenCompleted: CFStreamEventType = 1;
pub const kCFStreamEventHasBytesAvailable: CFStreamEventType = 2;
pub const kCFStreamEventCanAcceptBytes: CFStreamEventType = 4;
pub const kCFStreamEventErrorOccurred: CFStreamEventType = 8;
pub const kCFStreamEventEndEncountered: CFStreamEventType = 16;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFStreamClientContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: extern "C" fn(info: *const c_void) -> *const c_void,
pub release: extern "C" fn(info: *const c_void),
pub copyDescription: extern "C" fn(info: *const c_void) -> CFStringRef,
}
pub type CFReadStreamClientCallBack = extern "C" fn(
stream: CFReadStreamRef,
_type: CFStreamEventType,
clientCallBackInfo: *mut c_void,
);
pub type CFWriteStreamClientCallBack = extern "C" fn(
stream: CFWriteStreamRef,
_type: CFStreamEventType,
clientCallBackInfo: *mut c_void,
);
extern "C" {
/*
* CFStream.h
*/
/* Stream Properties */
pub static kCFStreamPropertyAppendToFile: CFStreamPropertyKey;
pub static kCFStreamPropertyDataWritten: CFStreamPropertyKey;
pub static kCFStreamPropertyFileCurrentOffset: CFStreamPropertyKey;
pub static kCFStreamPropertySocketNativeHandle: CFStreamPropertyKey;
pub static kCFStreamPropertySocketRemoteHostName: CFStreamPropertyKey;
pub static kCFStreamPropertySocketRemotePortNumber: CFStreamPropertyKey;
pub static kCFStreamPropertyShouldCloseNativeSocket: CFStringRef;
pub static kCFStreamPropertySocketSecurityLevel: CFStringRef;
/* CFStream Socket Security Level Constants */
pub static kCFStreamSocketSecurityLevelNone: CFStringRef;
pub static kCFStreamSocketSecurityLevelSSLv2: CFStringRef;
pub static kCFStreamSocketSecurityLevelSSLv3: CFStringRef;
pub static kCFStreamSocketSecurityLevelTLSv1: CFStringRef;
pub static kCFStreamSocketSecurityLevelNegotiatedSSL: CFStringRef;
/* CFStream SOCKS Proxy Key Constants */
pub static kCFStreamPropertySOCKSProxy: CFStringRef;
pub static kCFStreamPropertySOCKSProxyHost: CFStringRef;
pub static kCFStreamPropertySOCKSProxyPort: CFStringRef;
pub static kCFStreamPropertySOCKSVersion: CFStringRef;
pub static kCFStreamSocketSOCKSVersion4: CFStringRef;
pub static kCFStreamSocketSOCKSVersion5: CFStringRef;
pub static kCFStreamPropertySOCKSUser: CFStringRef;
pub static kCFStreamPropertySOCKSPassword: CFStringRef;
/* CFStream Error Domain Constants (CFHost) */
pub static kCFStreamErrorDomainSOCKS: c_int;
pub static kCFStreamErrorDomainSSL: c_int;
/* CFStream: Creating Streams */
pub fn CFStreamCreatePairWithPeerSocketSignature(
alloc: CFAllocatorRef,
signature: *const CFSocketSignature,
readStream: *mut CFReadStreamRef,
writeStream: *mut CFWriteStreamRef,
); // deprecated
pub fn CFStreamCreatePairWithSocketToHost(
alloc: CFAllocatorRef,
host: CFStringRef,
port: UInt32,
readStream: *mut CFReadStreamRef,
writeStream: *mut CFWriteStreamRef,
); // deprecated
pub fn CFStreamCreatePairWithSocket(
alloc: CFAllocatorRef,
sock: CFSocketNativeHandle,
readStream: *mut CFReadStreamRef,
writeStream: *mut CFWriteStreamRef,
); // deprecated
pub fn CFStreamCreateBoundPair(
alloc: CFAllocatorRef,
readStream: *mut CFReadStreamRef,
writeStream: *mut CFWriteStreamRef,
transferBufferSize: CFIndex,
);
//pub fn CFReadStreamSetDispatchQueue(stream: CFReadStreamRef, q: dispatch_queue_t); // macos(10.9)+
//pub fn CFWriteStreamSetDispatchQueue(stream: CFWriteStreamRef, q: dispatch_queue_t); // macos(10.9)+
//pub fn CFReadStreamCopyDispatchQueue(stream: CFReadStreamRef) -> dispatch_queue_t; // macos(10.9)+
//pub fn CFWriteStreamCopyDispatchQueue(stream: CFReadStreamRef) -> dispatch_queue_t; // macos(10.9)+
/* CFReadStream */
/* Creating a Read Stream */
pub fn CFReadStreamCreateWithBytesNoCopy(
alloc: CFAllocatorRef,
bytes: *const UInt8,
length: CFIndex,
bytesDeallocator: CFAllocatorRef,
) -> CFReadStreamRef;
pub fn CFReadStreamCreateWithFile(alloc: CFAllocatorRef, fileURL: CFURLRef) -> CFReadStreamRef;
/* Opening and Closing a Read Stream */
pub fn CFReadStreamClose(stream: CFReadStreamRef);
pub fn CFReadStreamOpen(stream: CFReadStreamRef) -> Boolean;
/* Reading from a Stream */
pub fn CFReadStreamRead(
stream: CFReadStreamRef,
buffer: *mut UInt8,
bufferLength: CFIndex,
) -> CFIndex;
/* Scheduling a Read Stream */
pub fn CFReadStreamScheduleWithRunLoop(
stream: CFReadStreamRef,
runLoop: CFRunLoopRef,
runLoopMode: CFStringRef,
);
pub fn CFReadStreamUnscheduleFromRunLoop(
stream: CFReadStreamRef,
runLoop: CFRunLoopRef,
runLoopMode: CFStringRef,
);
/* Examining Stream Properties */
pub fn CFReadStreamCopyProperty(
stream: CFReadStreamRef,
propertyName: CFStreamPropertyKey,
) -> CFTypeRef;
pub fn CFReadStreamGetBuffer(
stream: CFReadStreamRef,
maxBytesToRead: CFIndex,
numBytesRead: *mut CFIndex,
) -> *const UInt8;
pub fn CFReadStreamCopyError(stream: CFReadStreamRef) -> CFErrorRef;
pub fn CFReadStreamGetError(stream: CFReadStreamRef) -> CFStreamError; // deprecated
pub fn CFReadStreamGetStatus(stream: CFReadStreamRef) -> CFStreamStatus;
pub fn CFReadStreamHasBytesAvailable(stream: CFReadStreamRef) -> Boolean;
/* Setting Stream Properties */
pub fn CFReadStreamSetClient(
stream: CFReadStreamRef,
streamEvents: CFOptionFlags,
clientCB: CFReadStreamClientCallBack,
clientContext: *mut CFStreamClientContext,
) -> Boolean;
pub fn CFReadStreamSetProperty(
stream: CFReadStreamRef,
propertyName: CFStreamPropertyKey,
propertyValue: CFTypeRef,
) -> Boolean;
/* Getting the CFReadStream Type ID */
pub fn CFReadStreamGetTypeID() -> CFTypeID;
/* CFWriteStream */
/* Creating a Write Stream */
pub fn CFWriteStreamCreateWithAllocatedBuffers(
alloc: CFAllocatorRef,
bufferAllocator: CFAllocatorRef,
) -> CFWriteStreamRef;
pub fn CFWriteStreamCreateWithBuffer(
alloc: CFAllocatorRef,
buffer: *mut UInt8,
bufferCapacity: CFIndex,
) -> CFWriteStreamRef;
pub fn CFWriteStreamCreateWithFile(
alloc: CFAllocatorRef,
fileURL: CFURLRef,
) -> CFWriteStreamRef;
/* Opening and Closing a Stream */
pub fn CFWriteStreamClose(stream: CFWriteStreamRef);
pub fn CFWriteStreamOpen(stream: CFWriteStreamRef) -> Boolean;
/* Writing to a Stream */
pub fn CFWriteStreamWrite(
stream: CFWriteStreamRef,
buffer: *const UInt8,
bufferLength: CFIndex,
) -> CFIndex;
/* Scheduling a Write Stream */
pub fn CFWriteStreamScheduleWithRunLoop(
stream: CFWriteStreamRef,
runLoop: CFRunLoopRef,
runLoopMode: CFStringRef,
);
pub fn CFWriteStreamUnscheduleFromRunLoop(
stream: CFWriteStreamRef,
runLoop: CFRunLoopRef,
runLoopMode: CFStringRef,
);
/* Examining Stream Properties */
pub fn CFWriteStreamCanAcceptBytes(stream: CFWriteStreamRef) -> Boolean;
pub fn CFWriteStreamCopyProperty(
stream: CFWriteStreamRef,
propertyName: CFStreamPropertyKey,
) -> CFTypeRef;
pub fn CFWriteStreamCopyError(stream: CFWriteStreamRef) -> CFErrorRef;
pub fn CFWriteStreamGetError(stream: CFWriteStreamRef) -> CFStreamError; // deprecated
pub fn CFWriteStreamGetStatus(stream: CFWriteStreamRef) -> CFStreamStatus;
/* Setting Stream Properties */
pub fn CFWriteStreamSetClient(
stream: CFWriteStreamRef,
streamEvents: CFOptionFlags,
clientCB: CFWriteStreamClientCallBack,
clientContext: *mut CFStreamClientContext,
) -> Boolean;
pub fn CFWriteStreamSetProperty(
stream: CFWriteStreamRef,
propertyName: CFStreamPropertyKey,
propertyValue: CFTypeRef,
) -> Boolean;
/* Getting the CFWriteStream Type ID */
pub fn CFWriteStreamGetTypeID() -> CFTypeID;
}

546
vendor/core-foundation-sys/src/string.rs vendored Normal file
View File

@@ -0,0 +1,546 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::array::CFArrayRef;
use crate::base::{
Boolean, CFAllocatorRef, CFComparisonResult, CFIndex, CFOptionFlags, CFRange, CFTypeID,
ConstStr255Param, ConstStringPtr, SInt32, StringPtr, UInt32, UInt8, UTF32Char,
};
use crate::characterset::CFCharacterSetRef;
use crate::data::CFDataRef;
use crate::dictionary::CFDictionaryRef;
use crate::locale::CFLocaleRef;
use std::os::raw::{c_char, c_double, c_ulong, c_ushort, c_void};
pub type CFStringCompareFlags = CFOptionFlags;
pub const kCFCompareCaseInsensitive: CFStringCompareFlags = 1;
pub const kCFCompareBackwards: CFStringCompareFlags = 4;
pub const kCFCompareAnchored: CFStringCompareFlags = 8;
pub const kCFCompareNonliteral: CFStringCompareFlags = 16;
pub const kCFCompareLocalized: CFStringCompareFlags = 32;
pub const kCFCompareNumerically: CFStringCompareFlags = 64;
pub const kCFCompareDiacriticInsensitive: CFStringCompareFlags = 128;
pub const kCFCompareWidthInsensitive: CFStringCompareFlags = 256;
pub const kCFCompareForcedOrdering: CFStringCompareFlags = 512;
pub type CFStringEncoding = UInt32;
pub type UniChar = c_ushort;
// macOS built-in encodings.
pub const kCFStringEncodingMacRoman: CFStringEncoding = 0;
pub const kCFStringEncodingWindowsLatin1: CFStringEncoding = 0x0500;
pub const kCFStringEncodingISOLatin1: CFStringEncoding = 0x0201;
pub const kCFStringEncodingNextStepLatin: CFStringEncoding = 0x0B01;
pub const kCFStringEncodingASCII: CFStringEncoding = 0x0600;
pub const kCFStringEncodingUnicode: CFStringEncoding = 0x0100;
pub const kCFStringEncodingUTF8: CFStringEncoding = 0x08000100;
pub const kCFStringEncodingNonLossyASCII: CFStringEncoding = 0x0BFF;
pub const kCFStringEncodingUTF16: CFStringEncoding = 0x0100;
pub const kCFStringEncodingUTF16BE: CFStringEncoding = 0x10000100;
pub const kCFStringEncodingUTF16LE: CFStringEncoding = 0x14000100;
pub const kCFStringEncodingUTF32: CFStringEncoding = 0x0c000100;
pub const kCFStringEncodingUTF32BE: CFStringEncoding = 0x18000100;
pub const kCFStringEncodingUTF32LE: CFStringEncoding = 0x1c000100;
// CFStringEncodingExt.h
// External encodings, except those defined above.
pub const kCFStringEncodingMacJapanese: CFStringEncoding = 1;
pub const kCFStringEncodingMacChineseTrad: CFStringEncoding = 2;
pub const kCFStringEncodingMacKorean: CFStringEncoding = 3;
pub const kCFStringEncodingMacArabic: CFStringEncoding = 4;
pub const kCFStringEncodingMacHebrew: CFStringEncoding = 5;
pub const kCFStringEncodingMacGreek: CFStringEncoding = 6;
pub const kCFStringEncodingMacCyrillic: CFStringEncoding = 7;
pub const kCFStringEncodingMacDevanagari: CFStringEncoding = 9;
pub const kCFStringEncodingMacGurmukhi: CFStringEncoding = 10;
pub const kCFStringEncodingMacGujarati: CFStringEncoding = 11;
pub const kCFStringEncodingMacOriya: CFStringEncoding = 12;
pub const kCFStringEncodingMacBengali: CFStringEncoding = 13;
pub const kCFStringEncodingMacTamil: CFStringEncoding = 14;
pub const kCFStringEncodingMacTelugu: CFStringEncoding = 15;
pub const kCFStringEncodingMacKannada: CFStringEncoding = 16;
pub const kCFStringEncodingMacMalayalam: CFStringEncoding = 17;
pub const kCFStringEncodingMacSinhalese: CFStringEncoding = 18;
pub const kCFStringEncodingMacBurmese: CFStringEncoding = 19;
pub const kCFStringEncodingMacKhmer: CFStringEncoding = 20;
pub const kCFStringEncodingMacThai: CFStringEncoding = 21;
pub const kCFStringEncodingMacLaotian: CFStringEncoding = 22;
pub const kCFStringEncodingMacGeorgian: CFStringEncoding = 23;
pub const kCFStringEncodingMacArmenian: CFStringEncoding = 24;
pub const kCFStringEncodingMacChineseSimp: CFStringEncoding = 25;
pub const kCFStringEncodingMacTibetan: CFStringEncoding = 26;
pub const kCFStringEncodingMacMongolian: CFStringEncoding = 27;
pub const kCFStringEncodingMacEthiopic: CFStringEncoding = 28;
pub const kCFStringEncodingMacCentralEurRoman: CFStringEncoding = 29;
pub const kCFStringEncodingMacVietnamese: CFStringEncoding = 30;
pub const kCFStringEncodingMacExtArabic: CFStringEncoding = 31;
pub const kCFStringEncodingMacSymbol: CFStringEncoding = 33;
pub const kCFStringEncodingMacDingbats: CFStringEncoding = 34;
pub const kCFStringEncodingMacTurkish: CFStringEncoding = 35;
pub const kCFStringEncodingMacCroatian: CFStringEncoding = 36;
pub const kCFStringEncodingMacIcelandic: CFStringEncoding = 37;
pub const kCFStringEncodingMacRomanian: CFStringEncoding = 38;
pub const kCFStringEncodingMacCeltic: CFStringEncoding = 39;
pub const kCFStringEncodingMacGaelic: CFStringEncoding = 40;
pub const kCFStringEncodingMacFarsi: CFStringEncoding = 0x8C;
pub const kCFStringEncodingMacUkrainian: CFStringEncoding = 0x98;
pub const kCFStringEncodingMacInuit: CFStringEncoding = 0xEC;
pub const kCFStringEncodingMacVT100: CFStringEncoding = 0xFC;
pub const kCFStringEncodingMacHFS: CFStringEncoding = 0xFF;
pub const kCFStringEncodingISOLatin2: CFStringEncoding = 0x0202;
pub const kCFStringEncodingISOLatin3: CFStringEncoding = 0x0203;
pub const kCFStringEncodingISOLatin4: CFStringEncoding = 0x0204;
pub const kCFStringEncodingISOLatinCyrillic: CFStringEncoding = 0x0205;
pub const kCFStringEncodingISOLatinArabic: CFStringEncoding = 0x0206;
pub const kCFStringEncodingISOLatinGreek: CFStringEncoding = 0x0207;
pub const kCFStringEncodingISOLatinHebrew: CFStringEncoding = 0x0208;
pub const kCFStringEncodingISOLatin5: CFStringEncoding = 0x0209;
pub const kCFStringEncodingISOLatin6: CFStringEncoding = 0x020A;
pub const kCFStringEncodingISOLatinThai: CFStringEncoding = 0x020B;
pub const kCFStringEncodingISOLatin7: CFStringEncoding = 0x020D;
pub const kCFStringEncodingISOLatin8: CFStringEncoding = 0x020E;
pub const kCFStringEncodingISOLatin9: CFStringEncoding = 0x020F;
pub const kCFStringEncodingISOLatin10: CFStringEncoding = 0x0210;
pub const kCFStringEncodingDOSLatinUS: CFStringEncoding = 0x0400;
pub const kCFStringEncodingDOSGreek: CFStringEncoding = 0x0405;
pub const kCFStringEncodingDOSBalticRim: CFStringEncoding = 0x0406;
pub const kCFStringEncodingDOSLatin1: CFStringEncoding = 0x0410;
pub const kCFStringEncodingDOSGreek1: CFStringEncoding = 0x0411;
pub const kCFStringEncodingDOSLatin2: CFStringEncoding = 0x0412;
pub const kCFStringEncodingDOSCyrillic: CFStringEncoding = 0x0413;
pub const kCFStringEncodingDOSTurkish: CFStringEncoding = 0x0414;
pub const kCFStringEncodingDOSPortuguese: CFStringEncoding = 0x0415;
pub const kCFStringEncodingDOSIcelandic: CFStringEncoding = 0x0416;
pub const kCFStringEncodingDOSHebrew: CFStringEncoding = 0x0417;
pub const kCFStringEncodingDOSCanadianFrench: CFStringEncoding = 0x0418;
pub const kCFStringEncodingDOSArabic: CFStringEncoding = 0x0419;
pub const kCFStringEncodingDOSNordic: CFStringEncoding = 0x041A;
pub const kCFStringEncodingDOSRussian: CFStringEncoding = 0x041B;
pub const kCFStringEncodingDOSGreek2: CFStringEncoding = 0x041C;
pub const kCFStringEncodingDOSThai: CFStringEncoding = 0x041D;
pub const kCFStringEncodingDOSJapanese: CFStringEncoding = 0x0420;
pub const kCFStringEncodingDOSChineseSimplif: CFStringEncoding = 0x0421;
pub const kCFStringEncodingDOSKorean: CFStringEncoding = 0x0422;
pub const kCFStringEncodingDOSChineseTrad: CFStringEncoding = 0x0423;
pub const kCFStringEncodingWindowsLatin2: CFStringEncoding = 0x0501;
pub const kCFStringEncodingWindowsCyrillic: CFStringEncoding = 0x0502;
pub const kCFStringEncodingWindowsGreek: CFStringEncoding = 0x0503;
pub const kCFStringEncodingWindowsLatin5: CFStringEncoding = 0x0504;
pub const kCFStringEncodingWindowsHebrew: CFStringEncoding = 0x0505;
pub const kCFStringEncodingWindowsArabic: CFStringEncoding = 0x0506;
pub const kCFStringEncodingWindowsBalticRim: CFStringEncoding = 0x0507;
pub const kCFStringEncodingWindowsVietnamese: CFStringEncoding = 0x0508;
pub const kCFStringEncodingWindowsKoreanJohab: CFStringEncoding = 0x0510;
pub const kCFStringEncodingANSEL: CFStringEncoding = 0x0601;
pub const kCFStringEncodingJIS_X0201_76: CFStringEncoding = 0x0620;
pub const kCFStringEncodingJIS_X0208_83: CFStringEncoding = 0x0621;
pub const kCFStringEncodingJIS_X0208_90: CFStringEncoding = 0x0622;
pub const kCFStringEncodingJIS_X0212_90: CFStringEncoding = 0x0623;
pub const kCFStringEncodingJIS_C6226_78: CFStringEncoding = 0x0624;
pub const kCFStringEncodingShiftJIS_X0213: CFStringEncoding = 0x0628;
pub const kCFStringEncodingShiftJIS_X0213_MenKuTen: CFStringEncoding = 0x0629;
pub const kCFStringEncodingGB_2312_80: CFStringEncoding = 0x0630;
pub const kCFStringEncodingGBK_95: CFStringEncoding = 0x0631;
pub const kCFStringEncodingGB_18030_2000: CFStringEncoding = 0x0632;
pub const kCFStringEncodingKSC_5601_87: CFStringEncoding = 0x0640;
pub const kCFStringEncodingKSC_5601_92_Johab: CFStringEncoding = 0x0641;
pub const kCFStringEncodingCNS_11643_92_P1: CFStringEncoding = 0x0651;
pub const kCFStringEncodingCNS_11643_92_P2: CFStringEncoding = 0x0652;
pub const kCFStringEncodingCNS_11643_92_P3: CFStringEncoding = 0x0653;
pub const kCFStringEncodingISO_2022_JP: CFStringEncoding = 0x0820;
pub const kCFStringEncodingISO_2022_JP_2: CFStringEncoding = 0x0821;
pub const kCFStringEncodingISO_2022_JP_1: CFStringEncoding = 0x0822;
pub const kCFStringEncodingISO_2022_JP_3: CFStringEncoding = 0x0823;
pub const kCFStringEncodingISO_2022_CN: CFStringEncoding = 0x0830;
pub const kCFStringEncodingISO_2022_CN_EXT: CFStringEncoding = 0x0831;
pub const kCFStringEncodingISO_2022_KR: CFStringEncoding = 0x0840;
pub const kCFStringEncodingEUC_JP: CFStringEncoding = 0x0920;
pub const kCFStringEncodingEUC_CN: CFStringEncoding = 0x0930;
pub const kCFStringEncodingEUC_TW: CFStringEncoding = 0x0931;
pub const kCFStringEncodingEUC_KR: CFStringEncoding = 0x0940;
pub const kCFStringEncodingShiftJIS: CFStringEncoding = 0x0A01;
pub const kCFStringEncodingKOI8_R: CFStringEncoding = 0x0A02;
pub const kCFStringEncodingBig5: CFStringEncoding = 0x0A03;
pub const kCFStringEncodingMacRomanLatin1: CFStringEncoding = 0x0A04;
pub const kCFStringEncodingHZ_GB_2312: CFStringEncoding = 0x0A05;
pub const kCFStringEncodingBig5_HKSCS_1999: CFStringEncoding = 0x0A06;
pub const kCFStringEncodingVISCII: CFStringEncoding = 0x0A07;
pub const kCFStringEncodingKOI8_U: CFStringEncoding = 0x0A08;
pub const kCFStringEncodingBig5_E: CFStringEncoding = 0x0A09;
pub const kCFStringEncodingNextStepJapanese: CFStringEncoding = 0x0B02;
pub const kCFStringEncodingEBCDIC_US: CFStringEncoding = 0x0C01;
pub const kCFStringEncodingEBCDIC_CP037: CFStringEncoding = 0x0C02;
pub const kCFStringEncodingUTF7: CFStringEncoding = 0x04000100;
pub const kCFStringEncodingUTF7_IMAP: CFStringEncoding = 0x0A10;
pub const kCFStringEncodingShiftJIS_X0213_00: CFStringEncoding = 0x0628; /* Deprecated */
pub const kCFStringEncodingInvalidId: u32 = 0xffffffff;
pub type CFStringNormalizationForm = CFIndex;
pub const kCFStringNormalizationFormD: CFStringNormalizationForm = 0;
pub const kCFStringNormalizationFormKD: CFStringNormalizationForm = 1;
pub const kCFStringNormalizationFormC: CFStringNormalizationForm = 2;
pub const kCFStringNormalizationFormKC: CFStringNormalizationForm = 3;
#[repr(C)]
pub struct __CFString(c_void);
pub type CFStringRef = *const __CFString;
pub type CFMutableStringRef = *mut __CFString;
/* todo: The source code of the following functions is right in CFString.h */
/*
pub fn CFStringGetLongCharacterForSurrogatePair(surrogateHigh: UniChar, surrogateLow: UniChar) -> UTF32Char;
pub fn CFStringGetSurrogatePairForLongCharacter(character: UTF32Char, surrogates: *mut UniChar) -> Boolean;
pub fn CFStringIsSurrogateHighCharacter(character: UniChar) -> Boolean;
pub fn CFStringIsSurrogateLowCharacter(character: UniChar) -> Boolean;
pub fn CFStringInitInlineBuffer(str: CFStringRef, buf: *mut CFStringInlineBuffer, range: CFRange);
pub fn CFStringGetCharacterFromInlineBuffer(buf: *mut CFStringInlineBuffer, idx: CFIndex) -> UniChar;
*/
extern "C" {
/*
* CFString.h
*/
// N.B. organized according to "Functions by task" in docs
/* CFString */
/* Creating a CFString */
//fn CFSTR
pub fn CFStringCreateArrayBySeparatingStrings(
alloc: CFAllocatorRef,
theString: CFStringRef,
separatorString: CFStringRef,
) -> CFArrayRef;
pub fn CFStringCreateByCombiningStrings(
alloc: CFAllocatorRef,
theArray: CFArrayRef,
separatorString: CFStringRef,
) -> CFStringRef;
pub fn CFStringCreateCopy(alloc: CFAllocatorRef, theString: CFStringRef) -> CFStringRef;
pub fn CFStringCreateFromExternalRepresentation(
alloc: CFAllocatorRef,
data: CFDataRef,
encoding: CFStringEncoding,
) -> CFStringRef;
pub fn CFStringCreateWithBytes(
alloc: CFAllocatorRef,
bytes: *const UInt8,
numBytes: CFIndex,
encoding: CFStringEncoding,
isExternalRepresentation: Boolean,
) -> CFStringRef;
pub fn CFStringCreateWithBytesNoCopy(
alloc: CFAllocatorRef,
bytes: *const UInt8,
numBytes: CFIndex,
encoding: CFStringEncoding,
isExternalRepresentation: Boolean,
contentsDeallocator: CFAllocatorRef,
) -> CFStringRef;
pub fn CFStringCreateWithCharacters(
alloc: CFAllocatorRef,
chars: *const UniChar,
numChars: CFIndex,
) -> CFStringRef;
pub fn CFStringCreateWithCharactersNoCopy(
alloc: CFAllocatorRef,
chars: *const UniChar,
numChars: CFIndex,
contentsDeallocator: CFAllocatorRef,
) -> CFStringRef;
pub fn CFStringCreateWithCString(
alloc: CFAllocatorRef,
cStr: *const c_char,
encoding: CFStringEncoding,
) -> CFStringRef;
pub fn CFStringCreateWithCStringNoCopy(
alloc: CFAllocatorRef,
cStr: *const c_char,
encoding: CFStringEncoding,
contentsDeallocator: CFAllocatorRef,
) -> CFStringRef;
pub fn CFStringCreateWithFormat(
alloc: CFAllocatorRef,
formatOptions: CFDictionaryRef,
format: CFStringRef,
...
) -> CFStringRef;
//pub fn CFStringCreateWithFormatAndArguments(alloc: CFAllocatorRef, formatOptions: CFDictionaryRef, format: CFStringRef, arguments: va_list) -> CFStringRef;
pub fn CFStringCreateWithPascalString(
alloc: CFAllocatorRef,
pStr: ConstStr255Param,
encoding: CFStringEncoding,
) -> CFStringRef;
pub fn CFStringCreateWithPascalStringNoCopy(
alloc: CFAllocatorRef,
pStr: ConstStr255Param,
encoding: CFStringEncoding,
contentsDeallocator: CFAllocatorRef,
) -> CFStringRef;
pub fn CFStringCreateWithSubstring(
alloc: CFAllocatorRef,
str: CFStringRef,
range: CFRange,
) -> CFStringRef;
/* Searching Strings */
pub fn CFStringCreateArrayWithFindResults(
alloc: CFAllocatorRef,
theString: CFStringRef,
stringToFind: CFStringRef,
rangeToSearch: CFRange,
compareOptions: CFStringCompareFlags,
) -> CFArrayRef;
pub fn CFStringFind(
theString: CFStringRef,
stringToFind: CFStringRef,
compareOptions: CFStringCompareFlags,
) -> CFRange;
pub fn CFStringFindCharacterFromSet(
theString: CFStringRef,
theSet: CFCharacterSetRef,
rangeToSearch: CFRange,
searchOptions: CFStringCompareFlags,
result: *mut CFRange,
) -> Boolean;
pub fn CFStringFindWithOptions(
theString: CFStringRef,
stringToFind: CFStringRef,
rangeToSearch: CFRange,
searchOptions: CFStringCompareFlags,
result: *mut CFRange,
) -> Boolean;
pub fn CFStringFindWithOptionsAndLocale(
theString: CFStringRef,
stringToFind: CFStringRef,
rangeToSearch: CFRange,
searchOptions: CFStringCompareFlags,
locale: CFLocaleRef,
result: *mut CFRange,
) -> Boolean;
pub fn CFStringGetLineBounds(
theString: CFStringRef,
range: CFRange,
lineBeginIndex: *mut CFIndex,
lineEndIndex: *mut CFIndex,
contentsEndIndex: *mut CFIndex,
);
/* Comparing Strings */
pub fn CFStringCompare(
theString1: CFStringRef,
theString2: CFStringRef,
compareOptions: CFStringCompareFlags,
) -> CFComparisonResult;
pub fn CFStringCompareWithOptions(
theString1: CFStringRef,
theString2: CFStringRef,
rangeToCompare: CFRange,
compareOptions: CFStringCompareFlags,
) -> CFComparisonResult;
pub fn CFStringCompareWithOptionsAndLocale(
theString1: CFStringRef,
theString2: CFStringRef,
rangeToCompare: CFRange,
compareOptions: CFStringCompareFlags,
locale: CFLocaleRef,
) -> CFComparisonResult;
pub fn CFStringHasPrefix(theString: CFStringRef, prefix: CFStringRef) -> Boolean;
pub fn CFStringHasSuffix(theString: CFStringRef, suffix: CFStringRef) -> Boolean;
/* Accessing Characters */
pub fn CFStringCreateExternalRepresentation(
alloc: CFAllocatorRef,
theString: CFStringRef,
encoding: CFStringEncoding,
lossByte: UInt8,
) -> CFDataRef;
pub fn CFStringGetBytes(
theString: CFStringRef,
range: CFRange,
encoding: CFStringEncoding,
lossByte: UInt8,
isExternalRepresentation: Boolean,
buffer: *mut UInt8,
maxBufLen: CFIndex,
usedBufLen: *mut CFIndex,
) -> CFIndex;
pub fn CFStringGetCharacterAtIndex(theString: CFStringRef, idx: CFIndex) -> UniChar;
pub fn CFStringGetCharacters(theString: CFStringRef, range: CFRange, buffer: *mut UniChar);
pub fn CFStringGetCharactersPtr(theString: CFStringRef) -> *const UniChar;
pub fn CFStringGetCString(
theString: CFStringRef,
buffer: *mut c_char,
bufferSize: CFIndex,
encoding: CFStringEncoding,
) -> Boolean;
pub fn CFStringGetCStringPtr(
theString: CFStringRef,
encoding: CFStringEncoding,
) -> *const c_char;
pub fn CFStringGetLength(theString: CFStringRef) -> CFIndex;
pub fn CFStringGetPascalString(
theString: CFStringRef,
buffer: StringPtr,
bufferSize: CFIndex,
encoding: CFStringEncoding,
) -> Boolean;
pub fn CFStringGetPascalStringPtr(
theString: CFStringRef,
encoding: CFStringEncoding,
) -> ConstStringPtr;
pub fn CFStringGetRangeOfComposedCharactersAtIndex(
theString: CFStringRef,
theIndex: CFIndex,
) -> CFRange;
/* Working With Hyphenation */
pub fn CFStringGetHyphenationLocationBeforeIndex(
string: CFStringRef,
location: CFIndex,
limitRange: CFRange,
options: CFOptionFlags,
locale: CFLocaleRef,
character: *mut UTF32Char,
) -> CFIndex;
pub fn CFStringIsHyphenationAvailableForLocale(locale: CFLocaleRef) -> Boolean;
/* Working With Encodings */
pub fn CFStringConvertEncodingToIANACharSetName(encoding: CFStringEncoding) -> CFStringRef;
pub fn CFStringConvertEncodingToNSStringEncoding(encoding: CFStringEncoding) -> c_ulong;
pub fn CFStringConvertEncodingToWindowsCodepage(encoding: CFStringEncoding) -> UInt32;
pub fn CFStringConvertIANACharSetNameToEncoding(theString: CFStringRef) -> CFStringEncoding;
pub fn CFStringConvertNSStringEncodingToEncoding(encoding: c_ulong) -> CFStringEncoding;
pub fn CFStringConvertWindowsCodepageToEncoding(codepage: UInt32) -> CFStringEncoding;
pub fn CFStringGetFastestEncoding(theString: CFStringRef) -> CFStringEncoding;
pub fn CFStringGetListOfAvailableEncodings() -> *const CFStringEncoding;
pub fn CFStringGetMaximumSizeForEncoding(
length: CFIndex,
encoding: CFStringEncoding,
) -> CFIndex;
pub fn CFStringGetMostCompatibleMacStringEncoding(
encoding: CFStringEncoding,
) -> CFStringEncoding;
pub fn CFStringGetNameOfEncoding(encoding: CFStringEncoding) -> CFStringRef;
pub fn CFStringGetSmallestEncoding(theString: CFStringRef) -> CFStringEncoding;
pub fn CFStringGetSystemEncoding() -> CFStringEncoding;
pub fn CFStringIsEncodingAvailable(encoding: CFStringEncoding) -> Boolean;
/* Getting Numeric Values */
pub fn CFStringGetDoubleValue(str: CFStringRef) -> c_double;
pub fn CFStringGetIntValue(str: CFStringRef) -> SInt32;
/* Getting String Properties */
pub fn CFShowStr(str: CFStringRef);
pub fn CFStringGetTypeID() -> CFTypeID;
/* String File System Representations */
pub fn CFStringCreateWithFileSystemRepresentation(
alloc: CFAllocatorRef,
buffer: *const c_char,
) -> CFStringRef;
pub fn CFStringGetFileSystemRepresentation(
string: CFStringRef,
buffer: *mut c_char,
maxBufLen: CFIndex,
) -> Boolean;
pub fn CFStringGetMaximumSizeOfFileSystemRepresentation(string: CFStringRef) -> CFIndex;
/* Getting Paragraph Bounds */
pub fn CFStringGetParagraphBounds(
string: CFStringRef,
range: CFRange,
parBeginIndex: *mut CFIndex,
parEndIndex: *mut CFIndex,
contentsEndIndex: *mut CFIndex,
);
/* CFMutableString */
/* CFMutableString Miscellaneous Functions */
pub fn CFStringAppend(theString: CFMutableStringRef, appendedString: CFStringRef);
pub fn CFStringAppendCharacters(
theString: CFMutableStringRef,
chars: *const UniChar,
numChars: CFIndex,
);
pub fn CFStringAppendCString(
theString: CFMutableStringRef,
cStr: *const c_char,
encoding: CFStringEncoding,
);
pub fn CFStringAppendFormat(
theString: CFMutableStringRef,
formatOptions: CFDictionaryRef,
format: CFStringRef,
...
);
//pub fn CFStringAppendFormatAndArguments(theString: CFMutableStringRef, formatOptions: CFDictionaryRef, format: CFStringRef, arguments: va_list);
pub fn CFStringAppendPascalString(
theString: CFMutableStringRef,
pStr: ConstStr255Param,
encoding: CFStringEncoding,
);
pub fn CFStringCapitalize(theString: CFMutableStringRef, locale: CFLocaleRef);
pub fn CFStringCreateMutable(alloc: CFAllocatorRef, maxLength: CFIndex) -> CFMutableStringRef;
pub fn CFStringCreateMutableCopy(
alloc: CFAllocatorRef,
maxLength: CFIndex,
theString: CFStringRef,
) -> CFMutableStringRef;
pub fn CFStringCreateMutableWithExternalCharactersNoCopy(
alloc: CFAllocatorRef,
chars: *mut UniChar,
numChars: CFIndex,
capacity: CFIndex,
externalCharactersAllocator: CFAllocatorRef,
) -> CFMutableStringRef;
pub fn CFStringDelete(theString: CFMutableStringRef, range: CFRange);
pub fn CFStringFindAndReplace(
theString: CFMutableStringRef,
stringToFind: CFStringRef,
replacementString: CFStringRef,
rangeToSearch: CFRange,
compareOptions: CFStringCompareFlags,
) -> CFIndex;
pub fn CFStringFold(
theString: CFMutableStringRef,
theFlags: CFStringCompareFlags,
theLocale: CFLocaleRef,
);
pub fn CFStringInsert(str: CFMutableStringRef, idx: CFIndex, insertedStr: CFStringRef);
pub fn CFStringLowercase(theString: CFMutableStringRef, locale: CFLocaleRef);
pub fn CFStringNormalize(theString: CFMutableStringRef, theForm: CFStringNormalizationForm);
pub fn CFStringPad(
theString: CFMutableStringRef,
padString: CFStringRef,
length: CFIndex,
indexIntoPad: CFIndex,
);
pub fn CFStringReplace(theString: CFMutableStringRef, range: CFRange, replacement: CFStringRef);
pub fn CFStringReplaceAll(theString: CFMutableStringRef, replacement: CFStringRef);
pub fn CFStringSetExternalCharactersNoCopy(
theString: CFMutableStringRef,
chars: *mut UniChar,
length: CFIndex,
capacity: CFIndex,
);
pub fn CFStringTransform(
string: CFMutableStringRef,
range: *mut CFRange,
transform: CFStringRef,
reverse: Boolean,
) -> Boolean;
pub fn CFStringTrim(theString: CFMutableStringRef, trimString: CFStringRef);
pub fn CFStringTrimWhitespace(theString: CFMutableStringRef);
pub fn CFStringUppercase(theString: CFMutableStringRef, locale: CFLocaleRef);
}

View File

@@ -0,0 +1,91 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::array::CFMutableArrayRef;
use crate::base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef};
use crate::locale::CFLocaleRef;
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFStringTokenizer(c_void);
pub type CFStringTokenizerRef = *mut __CFStringTokenizer;
pub type CFStringTokenizerTokenType = CFOptionFlags;
pub const kCFStringTokenizerTokenNone: CFStringTokenizerTokenType = 0;
pub const kCFStringTokenizerTokenNormal: CFStringTokenizerTokenType = 1 << 0;
pub const kCFStringTokenizerTokenHasSubTokensMask: CFStringTokenizerTokenType = 1 << 1;
pub const kCFStringTokenizerTokenHasDerivedSubTokensMask: CFStringTokenizerTokenType = 1 << 2;
pub const kCFStringTokenizerTokenHasHasNumbersMask: CFStringTokenizerTokenType = 1 << 3;
pub const kCFStringTokenizerTokenHasNonLettersMask: CFStringTokenizerTokenType = 1 << 4;
pub const kCFStringTokenizerTokenIsCJWordMask: CFStringTokenizerTokenType = 1 << 5;
/* Tokenization Modifiers */
pub const kCFStringTokenizerUnitWord: CFOptionFlags = 0;
pub const kCFStringTokenizerUnitSentence: CFOptionFlags = 1;
pub const kCFStringTokenizerUnitParagraph: CFOptionFlags = 2;
pub const kCFStringTokenizerUnitLineBreak: CFOptionFlags = 3;
pub const kCFStringTokenizerUnitWordBoundary: CFOptionFlags = 4;
pub const kCFStringTokenizerAttributeLatinTranscription: CFOptionFlags = 1 << 16;
pub const kCFStringTokenizerAttributeLanguage: CFOptionFlags = 1 << 17;
extern "C" {
/*
* CFStringTokenizer.h
*/
/* Creating a Tokenizer */
pub fn CFStringTokenizerCreate(
alloc: CFAllocatorRef,
string: CFStringRef,
range: CFRange,
options: CFOptionFlags,
locale: CFLocaleRef,
) -> CFStringTokenizerRef;
/* Setting the String */
pub fn CFStringTokenizerSetString(
tokenizer: CFStringTokenizerRef,
string: CFStringRef,
range: CFRange,
);
/* Changing the Location */
pub fn CFStringTokenizerAdvanceToNextToken(
tokenizer: CFStringTokenizerRef,
) -> CFStringTokenizerTokenType;
pub fn CFStringTokenizerGoToTokenAtIndex(
tokenizer: CFStringTokenizerRef,
index: CFIndex,
) -> CFStringTokenizerTokenType;
/* Getting Information About the Current Token */
pub fn CFStringTokenizerCopyCurrentTokenAttribute(
tokenizer: CFStringTokenizerRef,
attribute: CFOptionFlags,
) -> CFTypeRef;
pub fn CFStringTokenizerGetCurrentTokenRange(tokenizer: CFStringTokenizerRef) -> CFRange;
pub fn CFStringTokenizerGetCurrentSubTokens(
tokenizer: CFStringTokenizerRef,
ranges: *mut CFRange,
maxRangeLength: CFIndex,
derivedSubTokens: CFMutableArrayRef,
) -> CFIndex;
/* Identifying a Language */
pub fn CFStringTokenizerCopyBestStringLanguage(
string: CFStringRef,
range: CFRange,
) -> CFStringRef;
/* Getting the CFStringTokenizer Type ID */
pub fn CFStringTokenizerGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,91 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::array::CFArrayRef;
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID};
use crate::data::CFDataRef;
use crate::date::{CFAbsoluteTime, CFTimeInterval};
use crate::dictionary::CFDictionaryRef;
use crate::locale::CFLocaleRef;
use crate::notification_center::CFNotificationName;
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFTimeZone(c_void);
pub type CFTimeZoneRef = *const __CFTimeZone;
pub type CFTimeZoneNameStyle = CFIndex;
/* Constants to specify styles for time zone names */
pub const kCFTimeZoneNameStyleStandard: CFTimeZoneNameStyle = 0;
pub const kCFTimeZoneNameStyleShortStandard: CFTimeZoneNameStyle = 1;
pub const kCFTimeZoneNameStyleDaylightSaving: CFTimeZoneNameStyle = 2;
pub const kCFTimeZoneNameStyleShortDaylightSaving: CFTimeZoneNameStyle = 3;
pub const kCFTimeZoneNameStyleGeneric: CFTimeZoneNameStyle = 4;
pub const kCFTimeZoneNameStyleShortGeneric: CFTimeZoneNameStyle = 5;
extern "C" {
/*
* CFTimeZone.h
*/
pub static kCFTimeZoneSystemTimeZoneDidChangeNotification: CFNotificationName;
/* Creating a Time Zone */
pub fn CFTimeZoneCreate(
allocator: CFAllocatorRef,
name: CFStringRef,
data: CFDataRef,
) -> CFTimeZoneRef;
pub fn CFTimeZoneCreateWithName(
allocator: CFAllocatorRef,
name: CFStringRef,
tryAbbrev: Boolean,
) -> CFTimeZoneRef;
pub fn CFTimeZoneCreateWithTimeIntervalFromGMT(
allocator: CFAllocatorRef,
interval: CFTimeInterval,
) -> CFTimeZoneRef;
/* System and Default Time Zones and Information */
pub fn CFTimeZoneCopyAbbreviationDictionary() -> CFDictionaryRef;
pub fn CFTimeZoneCopyAbbreviation(tz: CFTimeZoneRef, at: CFAbsoluteTime) -> CFStringRef;
pub fn CFTimeZoneCopyDefault() -> CFTimeZoneRef;
pub fn CFTimeZoneCopySystem() -> CFTimeZoneRef;
pub fn CFTimeZoneSetDefault(tz: CFTimeZoneRef);
pub fn CFTimeZoneCopyKnownNames() -> CFArrayRef;
pub fn CFTimeZoneResetSystem();
pub fn CFTimeZoneSetAbbreviationDictionary(dict: CFDictionaryRef);
/* Getting Information About Time Zones */
pub fn CFTimeZoneGetName(tz: CFTimeZoneRef) -> CFStringRef;
pub fn CFTimeZoneCopyLocalizedName(
tz: CFTimeZoneRef,
style: CFTimeZoneNameStyle,
locale: CFLocaleRef,
) -> CFStringRef;
pub fn CFTimeZoneGetSecondsFromGMT(tz: CFTimeZoneRef, time: CFAbsoluteTime) -> CFTimeInterval;
pub fn CFTimeZoneGetData(tz: CFTimeZoneRef) -> CFDataRef;
/* Getting Daylight Savings Time Information */
pub fn CFTimeZoneIsDaylightSavingTime(tz: CFTimeZoneRef, at: CFAbsoluteTime) -> Boolean;
pub fn CFTimeZoneGetDaylightSavingTimeOffset(
tz: CFTimeZoneRef,
at: CFAbsoluteTime,
) -> CFTimeInterval;
pub fn CFTimeZoneGetNextDaylightSavingTimeTransition(
tz: CFTimeZoneRef,
at: CFAbsoluteTime,
) -> CFAbsoluteTime;
/* Getting the CFTimeZone Type ID */
pub fn CFTimeZoneGetTypeID() -> CFTypeID;
}

74
vendor/core-foundation-sys/src/tree.rs vendored Normal file
View File

@@ -0,0 +1,74 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{CFAllocatorRef, CFComparatorFunction, CFIndex, CFTypeID};
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFTree(c_void);
pub type CFTreeRef = *mut __CFTree;
pub type CFTreeRetainCallBack = extern "C" fn(info: *const c_void) -> *const c_void;
pub type CFTreeReleaseCallBack = extern "C" fn(info: *const c_void);
pub type CFTreeCopyDescriptionCallBack = extern "C" fn(info: *const c_void) -> CFStringRef;
pub type CFTreeApplierFunction = extern "C" fn(value: *const c_void, context: *mut c_void);
#[repr(C)]
pub struct CFTreeContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: CFTreeRetainCallBack,
pub release: CFTreeReleaseCallBack,
pub copyDescription: CFTreeCopyDescriptionCallBack,
}
extern "C" {
/*
* CFTree.h
*/
/* Creating Trees */
pub fn CFTreeCreate(allocator: CFAllocatorRef, context: *const CFTreeContext) -> CFTreeRef;
/* Modifying a Tree */
pub fn CFTreeAppendChild(tree: CFTreeRef, newChild: CFTreeRef);
pub fn CFTreeInsertSibling(tree: CFTreeRef, newSibling: CFTreeRef);
pub fn CFTreeRemoveAllChildren(tree: CFTreeRef);
pub fn CFTreePrependChild(tree: CFTreeRef, newChild: CFTreeRef);
pub fn CFTreeRemove(tree: CFTreeRef);
pub fn CFTreeSetContext(tree: CFTreeRef, context: *const CFTreeContext);
/* Sorting a Tree */
pub fn CFTreeSortChildren(
tree: CFTreeRef,
comparator: CFComparatorFunction,
context: *mut c_void,
);
/* Examining a Tree */
pub fn CFTreeFindRoot(tree: CFTreeRef) -> CFTreeRef;
pub fn CFTreeGetChildAtIndex(tree: CFTreeRef, idx: CFIndex) -> CFTreeRef;
pub fn CFTreeGetChildCount(tree: CFTreeRef) -> CFIndex;
pub fn CFTreeGetChildren(tree: CFTreeRef, children: *mut CFTreeRef);
pub fn CFTreeGetContext(tree: CFTreeRef, context: *mut CFTreeContext);
pub fn CFTreeGetFirstChild(tree: CFTreeRef) -> CFTreeRef;
pub fn CFTreeGetNextSibling(tree: CFTreeRef) -> CFTreeRef;
pub fn CFTreeGetParent(tree: CFTreeRef) -> CFTreeRef;
/* Performing an Operation on Tree Elements */
pub fn CFTreeApplyFunctionToChildren(
tree: CFTreeRef,
applier: CFTreeApplierFunction,
context: *mut c_void,
);
/* Getting the Tree Type ID */
pub fn CFTreeGetTypeID() -> CFTypeID;
}

481
vendor/core-foundation-sys/src/url.rs vendored Normal file
View File

@@ -0,0 +1,481 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::array::CFArrayRef;
use crate::base::{
Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFRange, CFTypeID, CFTypeRef, SInt32,
};
use crate::data::CFDataRef;
use crate::dictionary::CFDictionaryRef;
use crate::error::CFErrorRef;
use crate::string::{CFStringEncoding, CFStringRef};
#[repr(C)]
pub struct __CFURL(c_void);
pub type CFURLRef = *const __CFURL;
pub type CFURLBookmarkCreationOptions = CFOptionFlags;
pub type CFURLBookmarkResolutionOptions = CFOptionFlags;
pub type CFURLBookmarkFileCreationOptions = CFOptionFlags;
pub type CFURLPathStyle = CFIndex;
/* typedef CF_ENUM(CFIndex, CFURLPathStyle) */
pub const kCFURLPOSIXPathStyle: CFURLPathStyle = 0;
pub const kCFURLHFSPathStyle: CFURLPathStyle = 1;
pub const kCFURLWindowsPathStyle: CFURLPathStyle = 2;
/* Bookmark Data Creation Options */
pub static kCFURLBookmarkCreationMinimalBookmarkMask: CFURLBookmarkCreationOptions =
(1u32 << 9) as usize;
pub static kCFURLBookmarkCreationSuitableForBookmarkFile: CFURLBookmarkCreationOptions =
(1u32 << 10) as usize;
#[cfg(target_os = "macos")]
pub static kCFURLBookmarkCreationWithSecurityScope: CFURLBookmarkCreationOptions =
(1u32 << 11) as usize;
#[cfg(target_os = "macos")]
pub static kCFURLBookmarkCreationSecurityScopeAllowOnlyReadAccess: CFURLBookmarkCreationOptions =
(1u32 << 12) as usize;
pub static kCFURLBookmarkCreationWithoutImplicitSecurityScope: CFURLBookmarkCreationOptions =
(1u32 << 29) as usize;
pub static kCFURLBookmarkCreationPreferFileIDResolutionMask: CFURLBookmarkCreationOptions =
(1u32 << 8) as usize; // deprecated
/* The types of components in a URL. */
pub type CFURLComponentType = CFIndex;
pub const kCFURLComponentScheme: CFIndex = 1;
pub const kCFURLComponentNetLocation: CFIndex = 2;
pub const kCFURLComponentPath: CFIndex = 3;
pub const kCFURLComponentResourceSpecifier: CFIndex = 4;
pub const kCFURLComponentUser: CFIndex = 5;
pub const kCFURLComponentPassword: CFIndex = 6;
pub const kCFURLComponentUserInfo: CFIndex = 7;
pub const kCFURLComponentHost: CFIndex = 8;
pub const kCFURLComponentPort: CFIndex = 9;
pub const kCFURLComponentParameterString: CFIndex = 10;
pub const kCFURLComponentQuery: CFIndex = 11;
pub const kCFURLComponentFragment: CFIndex = 12;
/* Bookmark Data Resolution Options */
pub const kCFURLBookmarkResolutionWithoutUIMask: CFURLBookmarkResolutionOptions =
(1u32 << 8) as usize;
pub const kCFURLBookmarkResolutionWithoutMountingMask: CFURLBookmarkResolutionOptions =
(1u32 << 9) as usize;
#[cfg(target_os = "macos")]
pub const kCFURLBookmarkResolutionWithSecurityScope: CFURLBookmarkResolutionOptions =
(1u32 << 10) as usize;
//pub const kCFURLBookmarkResolutionWithoutImplicitStartAccessing: CFURLBookmarkResolutionOptions = ( 1u32 << 15 ) as usize; // macos(11.2)+
pub const kCFBookmarkResolutionWithoutUIMask: CFURLBookmarkResolutionOptions = (1u32 << 8) as usize;
pub const kCFBookmarkResolutionWithoutMountingMask: CFURLBookmarkResolutionOptions =
(1u32 << 9) as usize;
extern "C" {
/*
* CFURL.h
*/
/* Common File System Resource Keys */
pub static kCFURLNameKey: CFStringRef;
pub static kCFURLLocalizedNameKey: CFStringRef;
pub static kCFURLIsRegularFileKey: CFStringRef;
pub static kCFURLIsDirectoryKey: CFStringRef;
pub static kCFURLIsSymbolicLinkKey: CFStringRef;
pub static kCFURLIsVolumeKey: CFStringRef;
pub static kCFURLIsPackageKey: CFStringRef;
pub static kCFURLIsApplicationKey: CFStringRef;
// pub static kCFURLApplicationIsScriptableKey: CFStringRef; //macos(10.11)+
pub static kCFURLIsSystemImmutableKey: CFStringRef;
pub static kCFURLIsUserImmutableKey: CFStringRef;
pub static kCFURLIsHiddenKey: CFStringRef;
pub static kCFURLHasHiddenExtensionKey: CFStringRef;
pub static kCFURLCreationDateKey: CFStringRef;
pub static kCFURLContentAccessDateKey: CFStringRef;
pub static kCFURLContentModificationDateKey: CFStringRef;
pub static kCFURLAttributeModificationDateKey: CFStringRef;
// pub static kCFURLFileIdentifierKey: CFStringRef; //macos(13.3)+
// pub static kCFURLFileContentIdentifierKey: CFStringRef; //macos(11.0)+
// pub static kCFURLMayShareFileContentKey: CFStringRef; //macos(11.0)+
// pub static kCFURLMayHaveExtendedAttributesKey: CFStringRef; //macos(11.0)+
// pub static kCFURLIsPurgeableKey: CFStringRef; //macos(11.0)+
// pub static kCFURLIsSparseKey: CFStringRef; //macos(11.0)+
pub static kCFURLLinkCountKey: CFStringRef;
pub static kCFURLParentDirectoryURLKey: CFStringRef;
pub static kCFURLVolumeURLKey: CFStringRef;
pub static kCFURLTypeIdentifierKey: CFStringRef; //deprecated
pub static kCFURLLocalizedTypeDescriptionKey: CFStringRef;
pub static kCFURLLabelNumberKey: CFStringRef;
pub static kCFURLLabelColorKey: CFStringRef; //deprecated
pub static kCFURLLocalizedLabelKey: CFStringRef;
pub static kCFURLEffectiveIconKey: CFStringRef; //deprecated
pub static kCFURLCustomIconKey: CFStringRef; //deprecated
pub static kCFURLFileResourceIdentifierKey: CFStringRef;
pub static kCFURLVolumeIdentifierKey: CFStringRef;
pub static kCFURLPreferredIOBlockSizeKey: CFStringRef;
pub static kCFURLIsReadableKey: CFStringRef;
pub static kCFURLIsWritableKey: CFStringRef;
pub static kCFURLIsExecutableKey: CFStringRef;
pub static kCFURLFileSecurityKey: CFStringRef;
#[cfg(feature = "mac_os_10_8_features")]
#[cfg_attr(feature = "mac_os_10_7_support", linkage = "extern_weak")]
pub static kCFURLIsExcludedFromBackupKey: CFStringRef;
// pub static kCFURLTagNamesKey: CFStringRef; //macos(10.9)+
#[cfg(feature = "mac_os_10_8_features")]
#[cfg_attr(feature = "mac_os_10_7_support", linkage = "extern_weak")]
pub static kCFURLPathKey: CFStringRef; // macos(10.8)+
pub static kCFURLCanonicalPathKey: CFStringRef; // macos(10.12)+
pub static kCFURLIsMountTriggerKey: CFStringRef;
// pub static kCFURLGenerationIdentifierKey: CFStringRef; // macos(10.10)+
// pub static kCFURLDocumentIdentifierKey: CFStringRef; // macos(10.10)+
// pub static kCFURLAddedToDirectoryDateKey: CFStringRef; // macos(10.10)+
// pub static kCFURLQuarantinePropertiesKey: CFStringRef; // macos(10.10)+
pub static kCFURLFileResourceTypeKey: CFStringRef;
/* File Resource Types. The file system object type values returned for the kCFURLFileResourceTypeKey */
pub static kCFURLFileResourceTypeNamedPipe: CFStringRef;
pub static kCFURLFileResourceTypeCharacterSpecial: CFStringRef;
pub static kCFURLFileResourceTypeDirectory: CFStringRef;
pub static kCFURLFileResourceTypeBlockSpecial: CFStringRef;
pub static kCFURLFileResourceTypeRegular: CFStringRef;
pub static kCFURLFileResourceTypeSymbolicLink: CFStringRef;
pub static kCFURLFileResourceTypeSocket: CFStringRef;
pub static kCFURLFileResourceTypeUnknown: CFStringRef;
/* File Property Keys */
pub static kCFURLFileSizeKey: CFStringRef;
pub static kCFURLFileAllocatedSizeKey: CFStringRef;
pub static kCFURLTotalFileSizeKey: CFStringRef;
pub static kCFURLTotalFileAllocatedSizeKey: CFStringRef;
pub static kCFURLIsAliasFileKey: CFStringRef;
// pub static kCFURLFileProtectionKey: CFStringRef; // ios(9.0)+
/* The protection level values returned for the kCFURLFileProtectionKey */
// pub static kCFURLFileProtectionNone: CFStringRef; // ios(9.0)+
// pub static kCFURLFileProtectionComplete: CFStringRef; // ios(9.0)+
// pub static kCFURLFileProtectionCompleteUnlessOpen: CFStringRef; // ios(9.0)+
// pub static kCFURLFileProtectionCompleteUntilFirstUserAuthentication: CFStringRef; // ios(9.0)+
/* Volume Property Keys */
pub static kCFURLVolumeLocalizedFormatDescriptionKey: CFStringRef;
pub static kCFURLVolumeTotalCapacityKey: CFStringRef;
pub static kCFURLVolumeAvailableCapacityKey: CFStringRef;
//pub static kCFURLVolumeAvailableCapacityForImportantUsageKey: CFStringRef; //macos(10.13)+
//pub static kCFURLVolumeAvailableCapacityForOpportunisticUsageKey: CFStringRef; //macos(10.13)+
pub static kCFURLVolumeResourceCountKey: CFStringRef;
pub static kCFURLVolumeSupportsPersistentIDsKey: CFStringRef;
pub static kCFURLVolumeSupportsSymbolicLinksKey: CFStringRef;
pub static kCFURLVolumeSupportsHardLinksKey: CFStringRef;
pub static kCFURLVolumeSupportsJournalingKey: CFStringRef;
pub static kCFURLVolumeIsJournalingKey: CFStringRef;
pub static kCFURLVolumeSupportsSparseFilesKey: CFStringRef;
pub static kCFURLVolumeSupportsZeroRunsKey: CFStringRef;
pub static kCFURLVolumeSupportsCaseSensitiveNamesKey: CFStringRef;
pub static kCFURLVolumeSupportsCasePreservedNamesKey: CFStringRef;
pub static kCFURLVolumeSupportsRootDirectoryDatesKey: CFStringRef;
pub static kCFURLVolumeSupportsVolumeSizesKey: CFStringRef;
pub static kCFURLVolumeSupportsRenamingKey: CFStringRef;
pub static kCFURLVolumeSupportsAdvisoryFileLockingKey: CFStringRef;
pub static kCFURLVolumeSupportsExtendedSecurityKey: CFStringRef;
pub static kCFURLVolumeIsBrowsableKey: CFStringRef;
pub static kCFURLVolumeMaximumFileSizeKey: CFStringRef;
pub static kCFURLVolumeIsEjectableKey: CFStringRef;
pub static kCFURLVolumeIsRemovableKey: CFStringRef;
pub static kCFURLVolumeIsInternalKey: CFStringRef;
pub static kCFURLVolumeIsAutomountedKey: CFStringRef;
pub static kCFURLVolumeIsLocalKey: CFStringRef;
pub static kCFURLVolumeIsReadOnlyKey: CFStringRef;
pub static kCFURLVolumeCreationDateKey: CFStringRef;
pub static kCFURLVolumeURLForRemountingKey: CFStringRef;
pub static kCFURLVolumeUUIDStringKey: CFStringRef;
pub static kCFURLVolumeNameKey: CFStringRef;
pub static kCFURLVolumeLocalizedNameKey: CFStringRef;
// pub static kCFURLVolumeIsEncryptedKey: CFStringRef; //macos(10.12)+
// pub static kCFURLVolumeIsRootFileSystemKey: CFStringRef; //macos(10.12)+
// pub static kCFURLVolumeSupportsCompressionKey: CFStringRef; //macos(10.12)+
// pub static kCFURLVolumeSupportsFileCloningKey: CFStringRef; //macos(10.12)+
// pub static kCFURLVolumeSupportsSwapRenamingKey: CFStringRef; //macos(10.12)+
// pub static kCFURLVolumeSupportsExclusiveRenamingKey: CFStringRef; //macos(10.12)+
// pub static kCFURLVolumeSupportsImmutableFilesKey: CFStringRef; //macos(10.13)+
// pub static kCFURLVolumeSupportsAccessPermissionsKey: CFStringRef; //macos(10.13)+
// pub static kCFURLVolumeSupportsFileProtectionKey: CFStringRef; //macos(11.0)+
// pub static kCFURLVolumeTypeNameKey: CFStringRef; //macos(13.3)+
// pub static kCFURLVolumeSubtypeKey: CFStringRef; //macos(13.3)+
// pub static kCFURLVolumeMountFromLocationKey: CFStringRef; //macos(13.3)+
/* iCloud Constants */
pub static kCFURLIsUbiquitousItemKey: CFStringRef;
pub static kCFURLUbiquitousItemHasUnresolvedConflictsKey: CFStringRef;
pub static kCFURLUbiquitousItemIsDownloadedKey: CFStringRef; // deprecated
pub static kCFURLUbiquitousItemIsDownloadingKey: CFStringRef;
pub static kCFURLUbiquitousItemIsUploadedKey: CFStringRef;
pub static kCFURLUbiquitousItemIsUploadingKey: CFStringRef;
pub static kCFURLUbiquitousItemPercentDownloadedKey: CFStringRef; // deprecated
pub static kCFURLUbiquitousItemPercentUploadedKey: CFStringRef; // deprecated
// pub static kCFURLUbiquitousItemDownloadingStatusKey: CFStringRef; // macos(10.9)+
// pub static kCFURLUbiquitousItemDownloadingErrorKey: CFStringRef; // macos(10.9)+
// pub static kCFURLUbiquitousItemUploadingErrorKey: CFStringRef; // macos(10.9)+
// pub static kCFURLUbiquitousItemIsExcludedFromSyncKey: CFStringRef; // macos(11.3)+
/* The values returned for kCFURLUbiquitousItemDownloadingStatusKey */
// pub static kCFURLUbiquitousItemDownloadingStatusNotDownloaded: CFStringRef; // macos(10.9)+
// pub static kCFURLUbiquitousItemDownloadingStatusDownloaded: CFStringRef; // macos(10.9)+
// pub static kCFURLUbiquitousItemDownloadingStatusCurrent: CFStringRef; // macos(10.9)+
/* CFError userInfo Dictionary Keys */
pub static kCFURLKeysOfUnsetValuesKey: CFStringRef;
/* Creating a CFURL */
pub fn CFURLCopyAbsoluteURL(anURL: CFURLRef) -> CFURLRef;
pub fn CFURLCreateAbsoluteURLWithBytes(
allocator: CFAllocatorRef,
relativeURLBytes: *const u8,
length: CFIndex,
encoding: CFStringEncoding,
baseURL: CFURLRef,
useCompatibilityMode: Boolean,
) -> CFURLRef;
pub fn CFURLCreateByResolvingBookmarkData(
allocator: CFAllocatorRef,
bookmark: CFDataRef,
options: CFURLBookmarkResolutionOptions,
relativeToURL: CFURLRef,
resourcePropertiesToInclude: CFArrayRef,
isStale: *mut Boolean,
error: *mut CFErrorRef,
) -> CFURLRef;
pub fn CFURLCreateCopyAppendingPathComponent(
allocator: CFAllocatorRef,
url: CFURLRef,
pathComponent: CFStringRef,
isDirectory: Boolean,
) -> CFURLRef;
pub fn CFURLCreateCopyAppendingPathExtension(
allocator: CFAllocatorRef,
url: CFURLRef,
extension: CFStringRef,
) -> CFURLRef;
pub fn CFURLCreateCopyDeletingLastPathComponent(
allocator: CFAllocatorRef,
url: CFURLRef,
) -> CFURLRef;
pub fn CFURLCreateCopyDeletingPathExtension(
allocator: CFAllocatorRef,
url: CFURLRef,
) -> CFURLRef;
pub fn CFURLCreateFilePathURL(
allocator: CFAllocatorRef,
url: CFURLRef,
error: *mut CFErrorRef,
) -> CFURLRef;
pub fn CFURLCreateFileReferenceURL(
allocator: CFAllocatorRef,
url: CFURLRef,
error: *mut CFErrorRef,
) -> CFURLRef;
pub fn CFURLCreateFromFileSystemRepresentation(
allocator: CFAllocatorRef,
buffer: *const u8,
bufLen: CFIndex,
isDirectory: Boolean,
) -> CFURLRef;
pub fn CFURLCreateFromFileSystemRepresentationRelativeToBase(
allocator: CFAllocatorRef,
buffer: *const u8,
bufLen: CFIndex,
isDirectory: Boolean,
baseURL: CFURLRef,
) -> CFURLRef;
//pub fn CFURLCreateFromFSRef(allocator: CFAllocatorRef, fsRef: *const FSRef) -> CFURLRef
pub fn CFURLCreateWithBytes(
allocator: CFAllocatorRef,
URLBytes: *const u8,
length: CFIndex,
encoding: CFStringEncoding,
baseURL: CFURLRef,
) -> CFURLRef;
pub fn CFURLCreateWithFileSystemPath(
allocator: CFAllocatorRef,
filePath: CFStringRef,
pathStyle: CFURLPathStyle,
isDirectory: Boolean,
) -> CFURLRef;
pub fn CFURLCreateWithFileSystemPathRelativeToBase(
allocator: CFAllocatorRef,
filePath: CFStringRef,
pathStyle: CFURLPathStyle,
isDirectory: Boolean,
baseURL: CFURLRef,
) -> CFURLRef;
pub fn CFURLCreateWithString(
allocator: CFAllocatorRef,
URLString: CFStringRef,
baseURL: CFURLRef,
) -> CFURLRef;
/* Accessing the Parts of a URL */
pub fn CFURLCanBeDecomposed(anURL: CFURLRef) -> Boolean;
pub fn CFURLCopyFileSystemPath(anURL: CFURLRef, pathStyle: CFURLPathStyle) -> CFStringRef;
pub fn CFURLCopyFragment(anURL: CFURLRef, charactersToLeaveEscaped: CFStringRef)
-> CFStringRef;
pub fn CFURLCopyHostName(anURL: CFURLRef) -> CFStringRef;
pub fn CFURLCopyLastPathComponent(anURL: CFURLRef) -> CFStringRef;
pub fn CFURLCopyNetLocation(anURL: CFURLRef) -> CFStringRef;
pub fn CFURLCopyParameterString(
anURL: CFURLRef,
charactersToLeaveEscaped: CFStringRef,
) -> CFStringRef; // deprecated
pub fn CFURLCopyPassword(anURL: CFURLRef) -> CFStringRef;
pub fn CFURLCopyPath(anURL: CFURLRef) -> CFStringRef;
pub fn CFURLCopyPathExtension(anURL: CFURLRef) -> CFStringRef;
pub fn CFURLCopyQueryString(
anURL: CFURLRef,
charactersToLeaveEscaped: CFStringRef,
) -> CFStringRef;
pub fn CFURLCopyResourceSpecifier(anURL: CFURLRef) -> CFStringRef;
pub fn CFURLCopyScheme(anURL: CFURLRef) -> CFStringRef;
pub fn CFURLCopyStrictPath(anURL: CFURLRef, isAbsolute: *mut Boolean) -> CFStringRef;
pub fn CFURLCopyUserName(anURL: CFURLRef) -> CFStringRef;
pub fn CFURLGetPortNumber(anURL: CFURLRef) -> SInt32;
pub fn CFURLHasDirectoryPath(anURL: CFURLRef) -> Boolean;
/* Converting URLs to Other Representations */
pub fn CFURLCreateData(
allocator: CFAllocatorRef,
url: CFURLRef,
encoding: CFStringEncoding,
escapeWhitespace: Boolean,
) -> CFDataRef;
pub fn CFURLCreateStringByAddingPercentEscapes(
allocator: CFAllocatorRef,
originalString: CFStringRef,
charactersToLeaveUnescaped: CFStringRef,
legalURLCharactersToBeEscaped: CFStringRef,
encoding: CFStringEncoding,
) -> CFStringRef; // API_DEPRECATED("Use [NSString stringByAddingPercentEncodingWithAllowedCharacters:] instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent (since each URL component or subcomponent has different rules for what characters are valid).", macos(10.0,10.11), ios(2.0,9.0), watchos(2.0,2.0), tvos(9.0,9.0));
pub fn CFURLCreateStringByReplacingPercentEscapes(
allocator: CFAllocatorRef,
originalString: CFStringRef,
charactersToLeaveEscaped: CFStringRef,
) -> CFStringRef;
pub fn CFURLCreateStringByReplacingPercentEscapesUsingEncoding(
allocator: CFAllocatorRef,
origString: CFStringRef,
charsToLeaveEscaped: CFStringRef,
encoding: CFStringEncoding,
) -> CFStringRef; // deprecated
pub fn CFURLGetFileSystemRepresentation(
anURL: CFURLRef,
resolveAgainstBase: Boolean,
buffer: *mut u8,
maxBufLen: CFIndex,
) -> Boolean;
//pub fn CFURLIsFileReferenceURL(url: CFURLRef) -> Boolean; // macos(10.9)+
//pub fn CFURLGetFSRef(url: CFURLRef, fsRef: *mut FSRef) -> Boolean;
pub fn CFURLGetString(anURL: CFURLRef) -> CFStringRef;
/* Getting URL Properties */
pub fn CFURLGetBaseURL(anURL: CFURLRef) -> CFURLRef;
pub fn CFURLGetBytes(anURL: CFURLRef, buffer: *mut u8, bufferLength: CFIndex) -> CFIndex;
pub fn CFURLGetByteRangeForComponent(
url: CFURLRef,
component: CFURLComponentType,
rangeIncludingSeparators: *mut CFRange,
) -> CFRange;
pub fn CFURLGetTypeID() -> CFTypeID;
pub fn CFURLResourceIsReachable(url: CFURLRef, error: *mut CFErrorRef) -> Boolean;
/* Getting and Setting File System Resource Properties */
pub fn CFURLClearResourcePropertyCache(url: CFURLRef);
pub fn CFURLClearResourcePropertyCacheForKey(url: CFURLRef, key: CFStringRef);
pub fn CFURLCopyResourcePropertiesForKeys(
url: CFURLRef,
keys: CFArrayRef,
error: *mut CFErrorRef,
) -> CFDictionaryRef;
//pub fn CFURLCopyResourcePropertyForKey(url: CFURLRef, key: CFStringRef, propertyValueTypeRefPtr: *mut c_void, error: *mut CFErrorRef) -> Boolean
pub fn CFURLCreateResourcePropertiesForKeysFromBookmarkData(
allocator: CFAllocatorRef,
resourcePropertiesToReturn: CFArrayRef,
bookmark: CFDataRef,
) -> CFDictionaryRef;
pub fn CFURLCreateResourcePropertyForKeyFromBookmarkData(
allocator: CFAllocatorRef,
resourcePropertyKey: CFStringRef,
bookmark: CFDataRef,
) -> CFTypeRef;
pub fn CFURLSetResourcePropertiesForKeys(
url: CFURLRef,
keyedPropertyValues: CFDictionaryRef,
error: *mut CFErrorRef,
) -> Boolean;
pub fn CFURLSetResourcePropertyForKey(
url: CFURLRef,
key: CFStringRef,
value: CFTypeRef,
error: *mut CFErrorRef,
) -> Boolean;
pub fn CFURLSetTemporaryResourcePropertyForKey(
url: CFURLRef,
key: CFStringRef,
propertyValue: CFTypeRef,
);
/* Working with Bookmark Data */
pub fn CFURLCreateBookmarkData(
allocator: CFAllocatorRef,
url: CFURLRef,
options: CFURLBookmarkCreationOptions,
resourcePropertiesToInclude: CFArrayRef,
relativeToURL: CFURLRef,
error: *mut CFErrorRef,
) -> CFDataRef;
#[cfg(target_os = "macos")]
pub fn CFURLCreateBookmarkDataFromAliasRecord(
allocator: CFAllocatorRef,
aliasRecordDataRef: CFDataRef,
) -> CFDataRef; // deprecated
pub fn CFURLCreateBookmarkDataFromFile(
allocator: CFAllocatorRef,
fileURL: CFURLRef,
errorRef: *mut CFErrorRef,
) -> CFDataRef;
pub fn CFURLWriteBookmarkDataToFile(
bookmarkRef: CFDataRef,
fileURL: CFURLRef,
options: CFURLBookmarkFileCreationOptions,
errorRef: *mut CFErrorRef,
) -> Boolean;
pub fn CFURLStartAccessingSecurityScopedResource(url: CFURLRef) -> Boolean;
pub fn CFURLStopAccessingSecurityScopedResource(url: CFURLRef);
}
#[test]
#[cfg(feature = "mac_os_10_8_features")]
fn can_see_excluded_from_backup_key() {
let _ = unsafe { kCFURLIsExcludedFromBackupKey };
}

View File

@@ -0,0 +1,62 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::array::CFArrayRef;
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID};
use crate::error::CFErrorRef;
use crate::url::CFURLRef;
#[repr(C)]
pub struct __CFURLEnumerator(c_void);
pub type CFURLEnumeratorRef = *mut __CFURLEnumerator;
pub type CFURLEnumeratorOptions = CFOptionFlags;
pub const kCFURLEnumeratorDefaultBehavior: CFURLEnumeratorOptions = 0;
pub const kCFURLEnumeratorDescendRecursively: CFURLEnumeratorOptions = 1 << 0;
pub const kCFURLEnumeratorSkipInvisibles: CFURLEnumeratorOptions = 1 << 1;
pub const kCFURLEnumeratorGenerateFileReferenceURLs: CFURLEnumeratorOptions = 1 << 2;
pub const kCFURLEnumeratorSkipPackageContents: CFURLEnumeratorOptions = 1 << 3;
pub const kCFURLEnumeratorIncludeDirectoriesPreOrder: CFURLEnumeratorOptions = 1 << 4;
pub const kCFURLEnumeratorIncludeDirectoriesPostOrder: CFURLEnumeratorOptions = 1 << 5;
//pub const kCFURLEnumeratorGenerateRelativePathURLs = 1UL << 6; // macos(10.15)+
pub type CFURLEnumeratorResult = CFIndex;
pub const kCFURLEnumeratorSuccess: CFURLEnumeratorOptions = 1;
pub const kCFURLEnumeratorEnd: CFURLEnumeratorOptions = 2;
pub const kCFURLEnumeratorError: CFURLEnumeratorOptions = 3;
pub const kCFURLEnumeratorDirectoryPostOrderSuccess: CFURLEnumeratorOptions = 4;
extern "C" {
/*
* CFURLEnumerator.h
*/
pub fn CFURLEnumeratorGetTypeID() -> CFTypeID;
pub fn CFURLEnumeratorCreateForDirectoryURL(
alloc: CFAllocatorRef,
directoryURL: CFURLRef,
option: CFURLEnumeratorOptions,
propertyKeys: CFArrayRef,
) -> CFURLEnumeratorRef;
pub fn CFURLEnumeratorCreateForMountedVolumes(
alloc: CFAllocatorRef,
option: CFURLEnumeratorOptions,
propertyKeys: CFArrayRef,
) -> CFURLEnumeratorRef;
pub fn CFURLEnumeratorGetNextURL(
enumerator: CFURLEnumeratorRef,
url: *mut CFURLRef,
error: *mut CFErrorRef,
) -> CFURLEnumeratorResult;
pub fn CFURLEnumeratorSkipDescendents(enumerator: CFURLEnumeratorRef);
pub fn CFURLEnumeratorGetDescendentLevel(enumerator: CFURLEnumeratorRef) -> CFIndex;
pub fn CFURLEnumeratorGetSourceDidChange(enumerator: CFURLEnumeratorRef) -> Boolean; // deprecated since macos 10.7
}

View File

@@ -0,0 +1,138 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID, SInt32};
use crate::date::CFTimeInterval;
use crate::dictionary::CFDictionaryRef;
use crate::runloop::CFRunLoopSourceRef;
use crate::string::CFStringRef;
use crate::url::CFURLRef;
#[repr(C)]
pub struct __CFUserNotification(c_void);
pub type CFUserNotificationCallBack =
extern "C" fn(userNotification: CFUserNotificationRef, responseFlags: CFOptionFlags);
pub type CFUserNotificationRef = *mut __CFUserNotification;
/* Alert Levels */
pub const kCFUserNotificationStopAlertLevel: CFOptionFlags = 0;
pub const kCFUserNotificationNoteAlertLevel: CFOptionFlags = 1;
pub const kCFUserNotificationCautionAlertLevel: CFOptionFlags = 2;
pub const kCFUserNotificationPlainAlertLevel: CFOptionFlags = 3;
/* Response Codes */
pub const kCFUserNotificationDefaultResponse: CFOptionFlags = 0;
pub const kCFUserNotificationAlternateResponse: CFOptionFlags = 1;
pub const kCFUserNotificationOtherResponse: CFOptionFlags = 2;
pub const kCFUserNotificationCancelResponse: CFOptionFlags = 3;
/* Button Flags */
pub const kCFUserNotificationNoDefaultButtonFlag: CFOptionFlags = 1usize << 5;
pub const kCFUserNotificationUseRadioButtonsFlag: CFOptionFlags = 1usize << 6;
#[inline(always)]
pub fn CFUserNotificationCheckBoxChecked(i: CFIndex) -> CFOptionFlags {
(1u32 << (8 + i)) as CFOptionFlags
}
#[inline(always)]
pub fn CFUserNotificationSecureTextField(i: CFIndex) -> CFOptionFlags {
(1u32 << (16 + i)) as CFOptionFlags
}
#[inline(always)]
pub fn CFUserNotificationPopUpSelection(n: CFIndex) -> CFOptionFlags {
(n << 24) as CFOptionFlags
}
extern "C" {
/*
* CFUserNotification.h
*/
/* Dialog Description Keys */
pub static kCFUserNotificationIconURLKey: CFStringRef;
pub static kCFUserNotificationSoundURLKey: CFStringRef;
pub static kCFUserNotificationLocalizationURLKey: CFStringRef;
pub static kCFUserNotificationAlertHeaderKey: CFStringRef;
pub static kCFUserNotificationAlertMessageKey: CFStringRef;
pub static kCFUserNotificationDefaultButtonTitleKey: CFStringRef;
pub static kCFUserNotificationAlternateButtonTitleKey: CFStringRef;
pub static kCFUserNotificationOtherButtonTitleKey: CFStringRef;
pub static kCFUserNotificationProgressIndicatorValueKey: CFStringRef;
pub static kCFUserNotificationPopUpTitlesKey: CFStringRef;
pub static kCFUserNotificationTextFieldTitlesKey: CFStringRef;
pub static kCFUserNotificationCheckBoxTitlesKey: CFStringRef;
pub static kCFUserNotificationTextFieldValuesKey: CFStringRef;
pub static kCFUserNotificationPopUpSelectionKey: CFStringRef;
pub static kCFUserNotificationAlertTopMostKey: CFStringRef;
pub static kCFUserNotificationKeyboardTypesKey: CFStringRef;
/* CFUserNotification Miscellaneous Functions */
pub fn CFUserNotificationCancel(userNotification: CFUserNotificationRef) -> SInt32;
pub fn CFUserNotificationCreate(
allocator: CFAllocatorRef,
timeout: CFTimeInterval,
flags: CFOptionFlags,
error: *mut SInt32,
dictionary: CFDictionaryRef,
) -> CFUserNotificationRef;
pub fn CFUserNotificationCreateRunLoopSource(
allocator: CFAllocatorRef,
userNotification: CFUserNotificationRef,
callout: CFUserNotificationCallBack,
order: CFIndex,
) -> CFRunLoopSourceRef;
pub fn CFUserNotificationDisplayAlert(
timeout: CFTimeInterval,
flags: CFOptionFlags,
iconURL: CFURLRef,
soundURL: CFURLRef,
localizationURL: CFURLRef,
alertHeader: CFStringRef,
alertMessage: CFStringRef,
defaultButtonTitle: CFStringRef,
alternateButtonTitle: CFStringRef,
otherButtonTitle: CFStringRef,
responseFlags: *mut CFOptionFlags,
) -> SInt32;
pub fn CFUserNotificationDisplayNotice(
timeout: CFTimeInterval,
flags: CFOptionFlags,
iconURL: CFURLRef,
soundURL: CFURLRef,
localizationURL: CFURLRef,
alertHeader: CFStringRef,
alertMessage: CFStringRef,
defaultButtonTitle: CFStringRef,
) -> SInt32;
pub fn CFUserNotificationGetTypeID() -> CFTypeID;
pub fn CFUserNotificationGetResponseDictionary(
userNotification: CFUserNotificationRef,
) -> CFDictionaryRef;
pub fn CFUserNotificationGetResponseValue(
userNotification: CFUserNotificationRef,
key: CFStringRef,
idx: CFIndex,
) -> CFStringRef;
pub fn CFUserNotificationReceiveResponse(
userNotification: CFUserNotificationRef,
timeout: CFTimeInterval,
responseFlags: *mut CFOptionFlags,
) -> SInt32;
pub fn CFUserNotificationUpdate(
userNotification: CFUserNotificationRef,
timeout: CFTimeInterval,
flags: CFOptionFlags,
dictionary: CFDictionaryRef,
) -> SInt32;
}

95
vendor/core-foundation-sys/src/uuid.rs vendored Normal file
View File

@@ -0,0 +1,95 @@
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{CFAllocatorRef, CFTypeID};
use crate::string::CFStringRef;
#[repr(C)]
pub struct __CFUUID(c_void);
pub type CFUUIDRef = *const __CFUUID;
#[repr(C)]
#[derive(Debug, Clone, Copy, PartialEq, Default)]
pub struct CFUUIDBytes {
pub byte0: u8,
pub byte1: u8,
pub byte2: u8,
pub byte3: u8,
pub byte4: u8,
pub byte5: u8,
pub byte6: u8,
pub byte7: u8,
pub byte8: u8,
pub byte9: u8,
pub byte10: u8,
pub byte11: u8,
pub byte12: u8,
pub byte13: u8,
pub byte14: u8,
pub byte15: u8,
}
extern "C" {
/*
* CFUUID.h
*/
/* Creating CFUUID Objects */
pub fn CFUUIDCreate(allocator: CFAllocatorRef) -> CFUUIDRef;
pub fn CFUUIDCreateFromString(alloc: CFAllocatorRef, uuidStr: CFStringRef) -> CFUUIDRef;
pub fn CFUUIDCreateFromUUIDBytes(allocator: CFAllocatorRef, bytes: CFUUIDBytes) -> CFUUIDRef;
pub fn CFUUIDCreateWithBytes(
alloc: CFAllocatorRef,
byte0: u8,
byte1: u8,
byte2: u8,
byte3: u8,
byte4: u8,
byte5: u8,
byte6: u8,
byte7: u8,
byte8: u8,
byte9: u8,
byte10: u8,
byte11: u8,
byte12: u8,
byte13: u8,
byte14: u8,
byte15: u8,
) -> CFUUIDRef;
/* Getting Information About CFUUID Objects */
pub fn CFUUIDCreateString(allocator: CFAllocatorRef, uid: CFUUIDRef) -> CFStringRef;
pub fn CFUUIDGetConstantUUIDWithBytes(
alloc: CFAllocatorRef,
byte0: u8,
byte1: u8,
byte2: u8,
byte3: u8,
byte4: u8,
byte5: u8,
byte6: u8,
byte7: u8,
byte8: u8,
byte9: u8,
byte10: u8,
byte11: u8,
byte12: u8,
byte13: u8,
byte14: u8,
byte15: u8,
) -> CFUUIDRef;
pub fn CFUUIDGetUUIDBytes(uuid: CFUUIDRef) -> CFUUIDBytes;
/* Getting the CFUUID Type Identifier */
pub fn CFUUIDGetTypeID() -> CFTypeID;
}

View File

@@ -0,0 +1,147 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::{c_char, c_void};
use crate::array::CFArrayRef;
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFTypeID};
use crate::dictionary::CFDictionaryRef;
use crate::string::{CFStringEncoding, CFStringRef};
use crate::tree::CFTreeRef;
use crate::url::CFURLRef;
#[repr(C)]
pub struct __CFXMLNode(c_void);
pub type CFXMLNodeRef = *mut __CFXMLNode;
pub type CFXMLTreeRef = CFTreeRef;
pub const kCFXMLNodeCurrentVersion: CFIndex = 1;
pub type CFXMLNodeTypeCode = CFIndex;
pub const kCFXMLNodeTypeDocument: CFXMLNodeTypeCode = 1;
pub const kCFXMLNodeTypeElement: CFXMLNodeTypeCode = 2;
pub const kCFXMLNodeTypeAttribute: CFXMLNodeTypeCode = 3;
pub const kCFXMLNodeTypeProcessingInstruction: CFXMLNodeTypeCode = 4;
pub const kCFXMLNodeTypeComment: CFXMLNodeTypeCode = 5;
pub const kCFXMLNodeTypeText: CFXMLNodeTypeCode = 6;
pub const kCFXMLNodeTypeCDATASection: CFXMLNodeTypeCode = 7;
pub const kCFXMLNodeTypeDocumentFragment: CFXMLNodeTypeCode = 8;
pub const kCFXMLNodeTypeEntity: CFXMLNodeTypeCode = 9;
pub const kCFXMLNodeTypeEntityReference: CFXMLNodeTypeCode = 10;
pub const kCFXMLNodeTypeDocumentType: CFXMLNodeTypeCode = 11;
pub const kCFXMLNodeTypeWhitespace: CFXMLNodeTypeCode = 12;
pub const kCFXMLNodeTypeNotation: CFXMLNodeTypeCode = 13;
pub const kCFXMLNodeTypeElementTypeDeclaration: CFXMLNodeTypeCode = 14;
pub const kCFXMLNodeTypeAttributeListDeclaration: CFXMLNodeTypeCode = 15;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLElementInfo {
pub attributes: CFDictionaryRef,
pub attributeOrder: CFArrayRef,
pub isEmpty: Boolean,
pub _reserved: [c_char; 3],
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLProcessingInstructionInfo {
pub dataString: CFStringRef,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLDocumentInfo {
pub sourceURL: CFURLRef,
pub encoding: CFStringEncoding,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLExternalID {
pub systemID: CFURLRef,
pub publicID: CFStringRef,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLDocumentTypeInfo {
pub externalID: CFXMLExternalID,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLNotationInfo {
pub externalID: CFXMLExternalID,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLElementTypeDeclarationInfo {
pub contentDescription: CFStringRef,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLAttributeDeclarationInfo {
pub attributeName: CFStringRef,
pub typeString: CFStringRef,
pub defaultString: CFStringRef,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLAttributeListDeclarationInfo {
pub numberOfAttributes: CFIndex,
pub attributes: *mut CFXMLAttributeDeclarationInfo,
}
pub type CFXMLEntityTypeCode = CFIndex;
pub const kCFXMLEntityTypeParameter: CFXMLEntityTypeCode = 0;
pub const kCFXMLEntityTypeParsedInternal: CFXMLEntityTypeCode = 1;
pub const kCFXMLEntityTypeParsedExternal: CFXMLEntityTypeCode = 2;
pub const kCFXMLEntityTypeUnparsed: CFXMLEntityTypeCode = 3;
pub const kCFXMLEntityTypeCharacter: CFXMLEntityTypeCode = 4;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLEntityInfo {
pub entityType: CFXMLEntityTypeCode,
pub replacementText: CFStringRef,
pub entityID: CFXMLExternalID,
pub notationName: CFStringRef,
}
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLEntityReferenceInfo {
pub entityType: CFXMLEntityTypeCode,
}
extern "C" {
/*
* CFXMLNode.h
*/
pub fn CFXMLNodeGetTypeID() -> CFTypeID;
pub fn CFXMLNodeCreate(
alloc: CFAllocatorRef,
xmlType: CFXMLNodeTypeCode,
dataString: CFStringRef,
additionalInfoPtr: *const c_void,
version: CFIndex,
) -> CFXMLNodeRef;
pub fn CFXMLNodeCreateCopy(alloc: CFAllocatorRef, origNode: CFXMLNodeRef) -> CFXMLNodeRef;
pub fn CFXMLNodeGetTypeCode(node: CFXMLNodeRef) -> CFXMLNodeTypeCode;
pub fn CFXMLNodeGetString(node: CFXMLNodeRef) -> CFStringRef;
pub fn CFXMLNodeGetInfoPtr(node: CFXMLNodeRef) -> *const c_void;
pub fn CFXMLNodeGetVersion(node: CFXMLNodeRef) -> CFIndex;
pub fn CFXMLTreeCreateWithNode(alloc: CFAllocatorRef, node: CFXMLNodeRef) -> CFXMLTreeRef;
pub fn CFXMLTreeGetNode(xmlTree: CFXMLTreeRef) -> CFXMLNodeRef;
}

View File

@@ -0,0 +1,174 @@
// Copyright 2023 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::os::raw::c_void;
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFOptionFlags, CFTypeID};
use crate::data::CFDataRef;
use crate::dictionary::CFDictionaryRef;
use crate::string::CFStringRef;
use crate::url::CFURLRef;
use crate::xml_node::{CFXMLExternalID, CFXMLNodeRef, CFXMLTreeRef};
#[repr(C)]
pub struct __CFXMLParser(c_void);
pub type CFXMLParserRef = *mut __CFXMLParser;
pub type CFXMLParserOptions = CFOptionFlags;
pub const kCFXMLParserValidateDocument: CFXMLParserOptions = 1 << 0;
pub const kCFXMLParserSkipMetaData: CFXMLParserOptions = 1 << 1;
pub const kCFXMLParserReplacePhysicalEntities: CFXMLParserOptions = 1 << 2;
pub const kCFXMLParserSkipWhitespace: CFXMLParserOptions = 1 << 3;
pub const kCFXMLParserResolveExternalEntities: CFXMLParserOptions = 1 << 4;
pub const kCFXMLParserAddImpliedAttributes: CFXMLParserOptions = 1 << 5;
pub const kCFXMLParserAllOptions: CFXMLParserOptions = 0x00FFFFFF;
pub const kCFXMLParserNoOptions: CFXMLParserOptions = 0;
pub type CFXMLParserStatusCode = CFIndex;
pub const kCFXMLStatusParseNotBegun: CFIndex = -2;
pub const kCFXMLStatusParseInProgress: CFIndex = -1;
pub const kCFXMLStatusParseSuccessful: CFIndex = 0;
pub const kCFXMLErrorUnexpectedEOF: CFIndex = 1;
pub const kCFXMLErrorUnknownEncoding: CFIndex = 2;
pub const kCFXMLErrorEncodingConversionFailure: CFIndex = 3;
pub const kCFXMLErrorMalformedProcessingInstruction: CFIndex = 4;
pub const kCFXMLErrorMalformedDTD: CFIndex = 5;
pub const kCFXMLErrorMalformedName: CFIndex = 6;
pub const kCFXMLErrorMalformedCDSect: CFIndex = 7;
pub const kCFXMLErrorMalformedCloseTag: CFIndex = 8;
pub const kCFXMLErrorMalformedStartTag: CFIndex = 9;
pub const kCFXMLErrorMalformedDocument: CFIndex = 10;
pub const kCFXMLErrorElementlessDocument: CFIndex = 11;
pub const kCFXMLErrorMalformedComment: CFIndex = 12;
pub const kCFXMLErrorMalformedCharacterReference: CFIndex = 13;
pub const kCFXMLErrorMalformedParsedCharacterData: CFIndex = 14;
pub const kCFXMLErrorNoData: CFIndex = 15;
pub type CFXMLParserCreateXMLStructureCallBack =
extern "C" fn(parser: CFXMLParserRef, nodeDesc: CFXMLNodeRef, info: *mut c_void) -> *mut c_void;
pub type CFXMLParserAddChildCallBack = extern "C" fn(
parser: CFXMLParserRef,
parent: *mut c_void,
child: *mut c_void,
info: *mut c_void,
);
pub type CFXMLParserEndXMLStructureCallBack =
extern "C" fn(parser: CFXMLParserRef, xmlType: *mut c_void, info: *mut c_void);
pub type CFXMLParserResolveExternalEntityCallBack = extern "C" fn(
parser: CFXMLParserRef,
extID: *mut CFXMLExternalID,
info: *mut c_void,
) -> CFDataRef;
pub type CFXMLParserHandleErrorCallBack = extern "C" fn(
parser: CFXMLParserRef,
error: CFXMLParserStatusCode,
info: *mut c_void,
) -> Boolean;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLParserCallBacks {
pub version: CFIndex,
pub createXMLStructure: CFXMLParserCreateXMLStructureCallBack,
pub addChild: CFXMLParserAddChildCallBack,
pub endXMLStructure: CFXMLParserEndXMLStructureCallBack,
pub resolveExternalEntity: CFXMLParserResolveExternalEntityCallBack,
pub handleError: CFXMLParserHandleErrorCallBack,
}
pub type CFXMLParserRetainCallBack = extern "C" fn(info: *const c_void) -> *const c_void;
pub type CFXMLParserReleaseCallBack = extern "C" fn(info: *const c_void);
pub type CFXMLParserCopyDescriptionCallBack = extern "C" fn(info: *const c_void) -> CFStringRef;
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct CFXMLParserContext {
pub version: CFIndex,
pub info: *mut c_void,
pub retain: CFXMLParserRetainCallBack,
pub release: CFXMLParserReleaseCallBack,
pub copyDescription: CFXMLParserCopyDescriptionCallBack,
}
extern "C" {
/*
* CFXMLParser.h
*/
pub static kCFXMLTreeErrorDescription: CFStringRef;
pub static kCFXMLTreeErrorLineNumber: CFStringRef;
pub static kCFXMLTreeErrorLocation: CFStringRef;
pub static kCFXMLTreeErrorStatusCode: CFStringRef;
pub fn CFXMLParserGetTypeID() -> CFTypeID;
pub fn CFXMLParserCreate(
allocator: CFAllocatorRef,
xmlData: CFDataRef,
dataSource: CFURLRef,
parseOptions: CFOptionFlags,
versionOfNodes: CFIndex,
callBacks: *mut CFXMLParserCallBacks,
context: *mut CFXMLParserContext,
) -> CFXMLParserRef;
pub fn CFXMLParserCreateWithDataFromURL(
allocator: CFAllocatorRef,
dataSource: CFURLRef,
parseOptions: CFOptionFlags,
versionOfNodes: CFIndex,
callBacks: *mut CFXMLParserCallBacks,
context: *mut CFXMLParserContext,
) -> CFXMLParserRef;
pub fn CFXMLParserGetContext(parser: CFXMLParserRef, context: *mut CFXMLParserContext);
pub fn CFXMLParserGetCallBacks(parser: CFXMLParserRef, callBacks: *mut CFXMLParserCallBacks);
pub fn CFXMLParserGetSourceURL(parser: CFXMLParserRef) -> CFURLRef;
pub fn CFXMLParserGetLocation(parser: CFXMLParserRef) -> CFIndex;
pub fn CFXMLParserGetLineNumber(parser: CFXMLParserRef) -> CFIndex;
pub fn CFXMLParserGetDocument(parser: CFXMLParserRef) -> *mut c_void;
pub fn CFXMLParserGetStatusCode(parser: CFXMLParserRef) -> CFXMLParserStatusCode;
pub fn CFXMLParserCopyErrorDescription(parser: CFXMLParserRef) -> CFStringRef;
pub fn CFXMLParserAbort(
parser: CFXMLParserRef,
errorCode: CFXMLParserStatusCode,
errorDescription: CFStringRef,
);
pub fn CFXMLParserParse(parser: CFXMLParserRef) -> Boolean;
pub fn CFXMLTreeCreateFromData(
allocator: CFAllocatorRef,
xmlData: CFDataRef,
dataSource: CFURLRef,
parseOptions: CFOptionFlags,
versionOfNodes: CFIndex,
) -> CFXMLTreeRef;
pub fn CFXMLTreeCreateFromDataWithError(
allocator: CFAllocatorRef,
xmlData: CFDataRef,
dataSource: CFURLRef,
parseOptions: CFOptionFlags,
versionOfNodes: CFIndex,
errorDict: *mut CFDictionaryRef,
) -> CFXMLTreeRef;
pub fn CFXMLTreeCreateWithDataFromURL(
allocator: CFAllocatorRef,
dataSource: CFURLRef,
parseOptions: CFOptionFlags,
versionOfNodes: CFIndex,
) -> CFXMLTreeRef;
pub fn CFXMLTreeCreateXMLData(allocator: CFAllocatorRef, xmlTree: CFXMLTreeRef) -> CFDataRef;
pub fn CFXMLCreateStringByEscapingEntities(
allocator: CFAllocatorRef,
string: CFStringRef,
entitiesDictionary: CFDictionaryRef,
) -> CFStringRef;
pub fn CFXMLCreateStringByUnescapingEntities(
allocator: CFAllocatorRef,
string: CFStringRef,
entitiesDictionary: CFDictionaryRef,
) -> CFStringRef;
}