11.03.2015 Views

Unicon Book

Unicon Book

Unicon Book

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ii<br />

CONTENTS<br />

3 String Processing 41<br />

3.1 String Indexes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41<br />

3.2 Character Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42<br />

3.3 Character Escapes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43<br />

3.4 String Scanning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43<br />

3.4.1 File Completion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />

3.4.2 Backtracking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46<br />

3.4.3 Concordance Example . . . . . . . . . . . . . . . . . . . . . . . . . . 47<br />

3.5 Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48<br />

3.6 Grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49<br />

3.6.1 Parsing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50<br />

3.6.2 Doing It Better . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50<br />

4 Advanced Language Features 53<br />

4.1 Limiting or Negating an Expression . . . . . . . . . . . . . . . . . . . . . . . 53<br />

4.2 List Structures and Parameter Lists . . . . . . . . . . . . . . . . . . . . . . . 54<br />

4.3 Co-expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55<br />

4.4 User-Defined Control Structures . . . . . . . . . . . . . . . . . . . . . . . . . 56<br />

4.5 Parallel Evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57<br />

4.6 Coroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58<br />

4.7 Permutations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59<br />

4.8 Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61<br />

5 The System Interface 65<br />

5.1 The Role of the System Interface . . . . . . . . . . . . . . . . . . . . . . . . 65<br />

5.2 Files and Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66<br />

5.2.1 Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67<br />

5.2.2 Obtaining file information . . . . . . . . . . . . . . . . . . . . . . . . 67<br />

5.2.3 Controlling file ownership and access . . . . . . . . . . . . . . . . . . 68<br />

5.2.4 File locks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69<br />

5.3 Programs and Process Control . . . . . . . . . . . . . . . . . . . . . . . . . . 69<br />

5.3.1 Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70<br />

5.3.2 Launching programs . . . . . . . . . . . . . . . . . . . . . . . . . . . 71<br />

5.3.3 Using file redirection and pipes . . . . . . . . . . . . . . . . . . . . . 71<br />

5.3.4 Process information . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72<br />

5.3.5 The select() system call . . . . . . . . . . . . . . . . . . . . . . . . . 72<br />

5.3.6 Non-blocking input and the ready() function . . . . . . . . . . . . . . 73<br />

5.4 Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73<br />

5.4.1 TCP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73<br />

5.4.2 Determining IP numbers . . . . . . . . . . . . . . . . . . . . . . . . . 75<br />

5.4.3 Non-blocking network opens . . . . . . . . . . . . . . . . . . . . . . . 76

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!