logo资料库

Glib参考手册.pdf

第1页 / 共616页
第2页 / 共616页
第3页 / 共616页
第4页 / 共616页
第5页 / 共616页
第6页 / 共616页
第7页 / 共616页
第8页 / 共616页
资料共616页,剩余部分请下载后查看
GLib Overview
Compiling the GLib package
Cross-compiling the GLib package
Compiling GLib Applications
Running GLib Applications
Changes to GLib
Regular expression syntax
Mailing lists and bug reports
GLib Fundamentals
Version Information
Basic Types
Limits of Basic Types
Standard Macros
Type Conversion Macros
Byte Order Macros
Numerical Definitions
Miscellaneous Macros
Atomic Operations
GLib Core Application Support
The Main Event Loop
Threads
Thread Pools
Asynchronous Queues
Dynamic Loading of Modules
Memory Allocation
IO Channels
Error Reporting
Message Output and Debugging Functions
Message Logging
GLib Utilities
String Utility Functions
Character Set Conversion
Unicode Manipulation
Base64 Encoding
Data Checksums
Internationalization
Date and Time Functions
Random Numbers
Hook Functions
Miscellaneous Utility Functions
Lexical Scanner
Automatic String Completion
Timers
Spawning Processes
File Utilities
URI Functions
Shell-related Utilities
Commandline option parser
Glob-style pattern matching
Perl-compatible regular expressions
Simple XML Subset Parser
Key-value file parser
Bookmark file parser
Testing
Windows Compatibility Functions
GLib Data Types
Memory Slices
Memory Chunks
Doubly-Linked Lists
Singly-Linked Lists
Double-ended Queues
Sequences
Trash Stacks
Hash Tables
Strings
String Chunks
Arrays
Pointer Arrays
Byte Arrays
Balanced Binary Trees
N-ary Trees
Quarks
Keyed Data Lists
Datasets
Relations and Tuples
Caches
Memory Allocators
GLib Tools
glib-gettextize
gtester
gtester-report
Index
GLib Reference Manual May 17, 2009
GLib Reference Manual ii
Contents 1 GLib Overview 1.1 Compiling the GLib package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Cross-compiling the GLib package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Compiling GLib Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Running GLib Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Changes to GLib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.6 Regular expression syntax . 1.7 Mailing lists and bug reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 GLib Fundamentals . . . . . . . . Standard Macros . . 2.1 Version Information . . 2.2 Basic Types . . . . 2.3 Limits of Basic Types . 2.4 . . 2.5 Type Conversion Macros . . 2.6 Byte Order Macros . . 2.7 Numerical Definitions . . . . 2.8 Miscellaneous Macros 2.9 Atomic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 4 5 6 8 9 30 33 33 35 40 44 48 50 60 63 73 . . . . . . . . . . . . . . 3 GLib Core Application Support . . . . 77 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 . 3.1 The Main Event Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 . . 3.2 Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 3.3 Thread Pools . . . . . 136 3.4 Asynchronous Queues . 3.5 Dynamic Loading of Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 3.6 Memory Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 . 3.7 . 3.8 Error Reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 3.9 Message Output and Debugging Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 3.10 Message Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . IO Channels . . . . . . . . . . . . . . . . . . . . . 4 GLib Utilities . . . . . . . . . . . String Utility Functions . . . Internationalization . 189 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 4.2 Character Set Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 . . 4.3 Unicode Manipulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 . . . 4.4 Base64 Encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 . 4.5 Data Checksums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 . 4.6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 . 4.7 Date and Time Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276 . . 4.8 Random Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 4.9 Hook Functions . . . 4.10 Miscellaneous Utility Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291 4.11 Lexical Scanner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 4.12 Automatic String Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 . . 4.13 Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 4.14 Spawning Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 . . 4.15 File Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 4.16 URI Functions . . . 4.17 Shell-related Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346 4.18 Commandline option parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 4.19 Glob-style pattern matching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361 4.20 Perl-compatible regular expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 4.21 Simple XML Subset Parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
CONTENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 4.22 Key-value file parser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 4.23 Bookmark file parser . 4.24 Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 . 4.25 Windows Compatibility Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 GLib Data Types . . . . . . . . . . . . . . . . . . . . . . . . . Strings Sequences Singly-Linked Lists . . 5.1 Memory Slices . . 5.2 Memory Chunks . . 5.3 Doubly-Linked Lists . . 5.4 . . 5.5 Double-ended Queues . . . . 5.6 . . . . 5.7 Trash Stacks . . . 5.8 Hash Tables . . . . 5.9 . . . . 5.10 String Chunks . . . 5.11 Arrays . . 5.12 Pointer Arrays . . . 5.13 Byte Arrays . . . 5.14 Balanced Binary Trees . . . . 5.15 N-ary Trees . . . 5.16 Quarks . . . . . . . 5.17 Keyed Data Lists . 5.18 Datasets . . . . 5.19 Relations and Tuples . . 5.20 Caches . . . . . 5.21 Memory Allocators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 GLib Tools 6.1 glib-gettextize . 6.2 gtester . . . 6.3 gtester-report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 588 591 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592 Index 593 iv
List of Figures 3 GLib Core Application Support . States of a Main Context 3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 4 GLib Utilities 4.1 Conversion between File Name Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 v
List of Tables 1 GLib Overview 1.1 Metacharacters outside square brackets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Metacharacters inside square brackets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Non-printing characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.4 Non-printing characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.5 Generic characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.6 Generic character types . . 1.7 Property codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.9 Posix classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.10 Option settings . . . 1.11 Abbreviations for quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Simple assertions . . . . . . . . . . . . . . . . . 10 10 10 11 12 12 15 16 19 19 21 vii
分享到:
收藏