Skip to content

Commit 4636eab

Browse files
committed
Various changes.
1 parent 1ae7260 commit 4636eab

9 files changed

+162
-24
lines changed

IOKit/hid/IOHIDService.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4444
extern "C" {
4545
#endif
4646

47-
typedef struct __IOHIDDisplay
47+
typedef struct __IOHIDService
4848
#if 0
4949
{
5050
CFRuntimeBase _base; // 0, 4

TextInput/KBString.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace KB {
6363
~String(); ///< Destructor.
6464

6565
/// Create a string with external/internal buffer.
66-
String(StringBufferType buffer_type, const char* str, uint16_t size, uint16_t length, uint16_t sort_key_length);
66+
String(StringBufferType buffer_type, const char* data_file, uint16_t size, uint16_t length, uint16_t sort_key_length);
6767

6868
/// Assignment operators.
6969
String& operator=(const char* str);

TextInput/KBWordTrie.hpp

+132-8
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace KB {
7474
static Hashmap<unsigned, String> g_cached_sort_keys_for_letter_forms;
7575

7676
unsigned m_single_primaries_to_letter[256];
77-
bool m_is_known_lead_primary[256];
77+
uint8_t m_is_known_lead_primary[256];
7878
Hashmap<String, unsigned> m_sort_keys_to_letter_forms;
7979
};
8080

@@ -88,7 +88,7 @@ namespace KB {
8888

8989
void set_custom_capitalization();
9090
void move_capitalization_to_bits();
91-
void parse_substitution_list(ReadOnlyDataFile& dat_file, unsigned offset, const String&, unsigned sort_key_length);
91+
void parse_substitution_list(ReadOnlyDataFile& dat_file, unsigned offset, const String& string, unsigned sort_key_length);
9292
String capitalized_string() const;
9393

9494
Word(); ///< Create an empty word.
@@ -99,7 +99,7 @@ namespace KB {
9999
/// <byte = h> [if h & 4, <byte = a if not flag & 512, a * 255 else>] [if h & 32, <byte = c>. If c & 1, cap_mask is set to 1]
100100
/// [if h & 1, <unsigned = cap_mask>] [if h & 64, <unsigned = d>] [if not flag & 2048 or h & 8 or c & 48, <unsigned short = SSSSSS.....KKKKK> ]
101101
/// [if h & 16, <null-terminated-string = string>, else if not h & 8, string = lettersForSortKey(sort_key), else parse_substitution_list(dat_file, "offset", ?, sort_key_length) ]
102-
Word(ReadOnlyDataFile& dat_file, unsigned x, const String& sort_key, const SortKeyByteConverter&, unsigned flag);
102+
Word(ReadOnlyDataFile& dat_file, unsigned offset, const String& sort_key, const SortKeyByteConverter&, unsigned compilation_flag);
103103

104104
const String& string() const { return m_string; }
105105
float probability() const { return word.probability; }
@@ -181,14 +181,66 @@ namespace KB {
181181
} freqNword;
182182
unsigned char patricia_key_bytes[4];
183183

184-
// void parse_trie_sibling_binary(const char* arg1, const char* arg2);
184+
private:
185+
const char* parse_trie_sibling_binary(const char* child, const char* data) // returns the address of the next sibling.
186+
#if 0
187+
{
188+
int cur_child_offset = child - data;
189+
190+
this->sortNchild.v2bytes.flags_byte = *child++;
191+
192+
for (unsigned i = 0; i <= this->sortNchild.v2fields.patricia_key_size_1; ++ i) {
193+
this->patricia_key_bytes[i] = *child++;
194+
}
195+
196+
switch (this->sortNchild.v2fields.has_child_offset_type) {
197+
case 1:
198+
this->sortNchild.v2fields.child_offset = cur_child_offset + (*child++);
199+
break;
200+
case 2:
201+
this->sortNchild.v2fields.child_offset = cur_child_offset + unsigned_short_at(child);
202+
child += 2;
203+
break;
204+
case 3:
205+
// note: no addition.
206+
this->sortNchild.v2fields.child_offset = (read 3 bytes from child);
207+
child += 3;
208+
break;
209+
}
210+
211+
if (has_freq bit is cleared) {
212+
this->freqNword.v2fields.compacted_freq = 0xff;
213+
} else {
214+
this->freqNword.v2fields.compacted_freq = 1 + *child++;
215+
}
216+
217+
if (has_unigram_list_offset bit is cleared) {
218+
if (has_word_termination_prob bit is set) {
219+
this->freqNword.fields.word_offset = 1 + **child++
220+
}
221+
} else {
222+
this->freqNword.fields.word_[offset,is_0freq] = (read 3 bytes from child);
223+
child += 3;
224+
}
225+
226+
if (more_sibling bit is set) {
227+
return child;
228+
} else
229+
return NULL;
230+
}
231+
#endif
232+
;
185233

186-
bool finishesWords() const {
234+
bool finishesWords() const
235+
#if 0
236+
{
187237
if (sortNchild.v2fields.child_offset != 0 || freqNword.fields.compacted_freq == 0 || freqNword.fields.word_is_0freq)
188238
return sortNchild.v2fields.has_word_termination_prob || sortNchild.v2fields.has_unigram_list_offset;
189239
else
190240
return true;
191241
}
242+
#endif
243+
;
192244
};
193245

194246
#pragma mark -
@@ -258,6 +310,78 @@ namespace KB {
258310
char l, m;
259311
};
260312

313+
class WordTrieNode {
314+
private:
315+
WordTrieNode(ReadOnlyDataFile* data_file, const char*, TrieSearchType type);
316+
WordTrieNode(ReadOnlyDataFile* data_file, unsigned int root_offset);
317+
WordTrieNode();
318+
319+
WordTrieNode advance(unsigned char input, TrieSearchType search_type) const;
320+
#if 0
321+
{
322+
const char* child_addr = this->trie_addr(this->sibling.child_offset);
323+
RefPtr<WordTrieNode> child_b = NULL;
324+
RefPtr<WordTrieNode> child_refptr = NULL;
325+
326+
// begin:
327+
for (; child_addr != NULL && r6 != 256; ++ r6, child_addr = next_child_addr ) {
328+
329+
PackedTrieSibling sibling;
330+
next_child_addr = sibling.parse_trie_sibling_binary(child_addr, data_file->m_data);
331+
332+
char first_pat_char = sibling.pat_key[0];
333+
bool matches;
334+
TrieSearchType child_search_type;
335+
336+
if (search_type == Exact) {
337+
matches = (first_pat_char == input);
338+
child_search_type = search_type;
339+
} else if (search_type == Fuzzy) {
340+
child_search_type = this->trie_search_type;
341+
if (this->trie_search_type != Fuzzy && first_pat_char == input)
342+
matches = true;
343+
else {
344+
matches = keyboard_sort_key_match(first_pat_char, input);
345+
child_search_type = Fuzzy;
346+
}
347+
} else {
348+
assert(false);
349+
}
350+
351+
if (match) {
352+
RefPtr<WordTrieNode> child_a = WordTrieNode::create(this->data_file, child_addr, child_search_type);
353+
if (child_b == NULL) {
354+
child_refptr = child_a;
355+
child_b = child_refptr;
356+
} else {
357+
child_refptr->m = child_a;
358+
child_refptr = child_a;
359+
}
360+
// deref child_a.
361+
}
362+
}
363+
if (child_b == NULL)
364+
child_b = new WordTrieNode;
365+
return child_b;
366+
// deref stuff.
367+
}
368+
#endif
369+
370+
static WordTrieNode* create(ReadOnlyDataFile* data_file, const char*, TrieSearchType type); ///< Just calls the constructor.
371+
static WordTrieNode* create(ReadOnlyDataFile* data_file, unsigned int offset); ///< Just calls the constructor.
372+
bool not_valid(void) const;
373+
const char* trie_addr(unsigned int child_offset) const; // returns : data_file->m_data + child_offset.
374+
375+
private:
376+
int one;
377+
char b;
378+
ReadOnlyDataFile* data_file;
379+
const char* data_ptr;
380+
int parse_result;
381+
TrieSearchType trie_search_type;
382+
PackedTrieSibling sibling;
383+
WTF::RefPtr<WordTrieNode> m;
384+
};
261385

262386
class WordTrie {
263387
public:
@@ -305,11 +429,11 @@ namespace KB {
305429

306430
float probability_sum_for_V2_words_at(unsigned) const;
307431

308-
void recurse_matching_words_for_node(Vector<Word>&, WordTrieNode*, unsigned, int, bool) const;
432+
void recurse_matching_words_for_node(Vector<Word>& res, WordTrieNode* node, unsigned offset, int the_int, bool perform_match) const;
309433
void fill_vector_with_trie_children_at(unsigned, Vector<DictionaryCursors>&) const;
310434
bool advance_static_cursor_to_next_patricia_node(DictionaryCursors& cursors, unsigned char tag, unsigned address) const;
311435

312-
Word word_at(unsigned, unsigned&, const String&) const;
436+
Word word_at(unsigned offset, unsigned& res_offset, const String& sort_key) const;
313437

314438

315439
private:
@@ -327,7 +451,7 @@ namespace KB {
327451
unsigned m_trie_root_offset; // 1ad4
328452
float m_root_usage_sum; // 1ad8
329453
SortKeyByteConverter m_sort_key_converter; // 1adc (sizeof = 524)
330-
}; // sizeof = 1ff0.
454+
}; // sizeof = 2000.
331455
}
332456

333457
#endif

UIKit/UIBookViewController.h

+13-4
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,17 @@
1212
#import <UIKit/UIViewController.h>
1313
#import <UIKit/UIGeometry.h>
1414

15-
@protocol UIBookViewControllerDelegate;
16-
@class UIView;
15+
@class UIView, UIBookViewController;
16+
17+
@protocol UIBookViewControllerDelegate
18+
@required
19+
// Returns the next page given the previous page (in the same side as the previous page).
20+
-(UIViewController*)bookViewController:(UIBookViewController*)bookViewController nextPage:(UIViewController*)oldPage;
21+
-(UIViewController*)bookViewController:(UIBookViewController*)bookViewController previousPage:(UIViewController*)oldPage;
22+
@optional
23+
-(void)bookViewController:(UIBookViewController*)bookViewController willBeginTurningPages:(int)pages animated:(BOOL)animated;
24+
-(void)bookViewController:(UIBookViewController*)bookViewController didEndTurningPages:(int)pages animated:(BOOL)animated;
25+
@end
1726

1827
@interface UIBookViewController : UIViewController {
1928
@private
@@ -30,8 +39,8 @@
3039
double _turnDuration;
3140
}
3241
@property(assign, nonatomic) id<UIBookViewControllerDelegate> delegate;
33-
@property(retain, nonatomic) UIViewController* oddPage;
34-
@property(retain, nonatomic) UIViewController* evenPage;
42+
@property(retain, nonatomic) UIViewController* oddPage; // = right page
43+
@property(retain, nonatomic) UIViewController* evenPage; // = left page
3544
@property(assign, nonatomic) float turnMargin;
3645
@property(assign, nonatomic) UIEdgeInsets contentInset;
3746
@property(assign, nonatomic) double turnDuration;

UIKit/UIKit-Structs.h

+2-3
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ typedef struct {
275275
int startContentOrientation;
276276
CGRect startContentBounds;
277277
CGRect endContentBounds;
278-
} XXStruct_Nw9VXC;
278+
} XXStruct_Nw9VXC, XXStruct_t5OlHA;
279279

280280
typedef struct {
281281
UIImage* background;
@@ -284,8 +284,7 @@ typedef struct {
284284
UIColor* textColor;
285285
UIColor* shadowColor;
286286
CGSize shadowOffset;
287-
} XXStruct_KYn_rD;
288-
typedef XXStruct_KYn_rD XXStruct_V3NSMA;
287+
} XXStruct_KYn_rD, XXStruct_V3NSMA;
289288

290289
typedef struct {
291290
UIFont* _field1;

UIKit/UIView2.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@
167167
-(void)_removeAllAnimations:(BOOL)animations;
168168
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
169169
+(BOOL)_isInAnimationBlock;
170-
+(void)_setAnimationAttributes:(id)attributes;
171-
+(void)_setAnimationFilter:(int)filter forView:(id)view;
172-
+(void)_setAnimationFilterValue:(float)value;
170+
+(void)_setAnimationAttributes:(id<CAMediaTiming>)attributes;
171+
+(void)_setAnimationFilter:(int)filter forView:(UIView*)view;
172+
+(void)_setAnimationFilterValue:(CGFloat)value;
173173
-(void)_clearAnimationFilters;
174174
#else
175175
+(BOOL)_pendingAnimations;

UIKit/UIViewAnimationState.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#import <Availability2.h>
99

1010
@class UIView, NSString;
11+
@protocol CAMediaTiming;
1112

1213
@interface UIViewAnimationState : NSObject {
1314
UIViewAnimationState* _nextState;
@@ -43,7 +44,7 @@
4344
+(void)pushViewAnimationState:(id)state context:(void*)context;
4445
+(void)popAnimationState;
4546
-(void)dealloc;
46-
-(void)setAnimationAttributes:(id)attributes;
47+
-(void)setAnimationAttributes:(id<CAMediaTiming>)attributes; // save the attributes of the animation state *into* the argument.
4748
-(void)animationDidStart:(id)animation;
4849
-(void)sendDelegateAnimationDidStop:(id)sendDelegateAnimation finished:(BOOL)finished;
4950
-(void)animationDidStop:(id)animation finished:(BOOL)finished;

UIKit/UIWindow2.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,15 @@
171171
-(void)window:(UIWindow*)window willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration;
172172
-(void)window:(UIWindow*)window didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
173173
-(BOOL)shouldWindowUseOnePartInterfaceRotationAnimation:(UIWindow*)window;
174-
-(void)getRotationContentSettings:(XXStruct_TF$i3B*)settings forWindow:(UIWindow*)window;
175174
-(UIView*)rotatingContentViewForWindow:(UIWindow*)window;
176175
-(UIView*)rotatingHeaderViewForWindow:(UIWindow*)window;
177176
-(UIView*)rotatingFooterViewForWindow:(UIWindow*)window;
177+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2
178+
-(id)clientsForRotationForWindow:(UIWindow*)window;
179+
-(void)getRotationContentSettings:(XXStruct_t5OlHA*)settings forWindow:(UIWindow*)window;
180+
#else
181+
-(void)getRotationContentSettings:(XXStruct_TF$i3B*)settings forWindow:(UIWindow*)window;
182+
#endif
178183
@end
179184

180185
@interface UIWindow (UITextEffectsWindowAdditions)

liblockdown.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ extern "C" {
6868
extern CFStringRef kLDErrorSessionInactive;
6969
extern CFStringRef kLDErrorSetProhibited;
7070
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_2_2
71-
extern CFStringRef kLDErrorCheckinConnectionFailed
71+
extern CFStringRef kLDErrorCheckinConnectionFailed;
7272
extern CFStringRef kLDErrorCheckinOutOfMemory;
7373
extern CFStringRef kLDErrorCheckinReceiveFailed;
7474
extern CFStringRef kLDErrorCheckinResponseFailed;
@@ -421,7 +421,7 @@ extern "C" {
421421
void* info;
422422
}*/* LockdownServiceRef;
423423

424-
typedef void(*LockdownServiceCallback)(LcokdownServiceRef service, CFSocketCallBackType cbType, void* info);
424+
typedef void(*LockdownServiceCallback)(LockdownServiceRef service, CFSocketCallBackType cbType, void* info);
425425

426426
CFTypeID LockdownServiceGetTypeID();
427427

0 commit comments

Comments
 (0)