Programming, using and understanding

Pike

by Fredrik Hübinette


Table of contents

Preface
Table of contents
Introduction
Overview
The history of Pike
A comparison with other languages
What is Pike
How to read this manual
1 Getting started
1.1 Your first Pike program
1.2 Improving hello_world.pike
1.3 Further improvements
1.4 Control structures
1.5 Functions
1.6 True and false
1.7 Data Types
2 A more elaborate example
2.1 Taking care of input
2.1.1 add_record()
2.1.2 main()
2.2 Communicating with files
2.2.1 save()
2.2.2 load()
2.2.3 main() revisited
2.3 Completing the program
2.3.1 delete()
2.3.2 search()
2.3.3 main() again
2.4 Then what?
2.5 Simple exercises
3 Control Structures
3.1 Conditions
3.1.1 if
3.1.2 switch
3.2 Loops
3.2.1 while
3.2.2 for
3.2.3 do-while
3.2.4 foreach
3.3 Breaking out of loops
3.3.1 break
3.3.2 continue
3.3.3 return
3.4 Exercises
4 Data types
4.1 Basic types
4.1.1 int
4.1.2 float
4.1.3 string
4.2 Pointer types
4.2.1 array
4.2.2 mapping
4.2.3 multiset
4.2.4 program
4.2.5 object
4.2.6 function
4.3 Sharing data
4.4 Writing data types
5 Operators
5.1 Arithmetic operators
5.2 Comparison operators
5.3 Logical operators
5.4 Bitwise/set operators
5.5 Indexing
5.6 The assignment operators
5.7 The rest of the operators
5.8 Operator precedence
5.9 Operator functions
6 Object orientation
6.1 Terminology
6.2 The approach
6.3 How does this help?
6.4 Pike and object orientation
6.5 Inherit
6.6 Multiple inherit
6.7 Pike inherit compared to other languages
6.8 Modifiers
6.9 Operator overloading
6.10 Simple exercises
7 Miscellaneous functions
7.1 sscanf
7.2 catch & throw
7.3 gauge
7.4 typeof
8 Modules
8.1 How to use modules
8.2 Where do modules come from?
8.3 The . operator
8.4 How to write a module
8.5 Simple exercises
9 File I/O
9.1 File management - Stdio.File
9.2 Buffered file management - Stdio.FILE
9.3 Standard streams - Stdio.stdin, stdout and stderr
9.4 Listening to sockets - Stdio.Port
9.5 UDP socket and message management - Stdio.UDP
9.6 Terminal management - Stdio.Terminfo
9.6.1 Stdio.Terminfo.Termcap
9.6.2 Stdio.Terminfo.Terminfo
9.7 Simple input-by-prompt - Stdio.Readline
9.8 Other Stdio functions
9.9 A simple example
9.10 A more complex example - a simple WWW server
10 Threads
10.1 Starting a thread
10.2 Threads reference section
10.3 Threads example
11 Modules for specific data types
11.1 String
11.2 Array
12 Image
12.1 Image.Image
12.2 Image.Colortable
12.3 Image.Layer
12.4 Image.Font
12.5 Image.colortable
12.6 Image.Poly
12.7 Image.Color
12.7.1 Image.Color.Color
12.8 Image.X
12.9 Image.ANY
12.10 Image.AVS
12.11 Image.BMP
12.12 Image.GD
12.13 Image.GIF
12.14 Image.HRZ
12.15 Image.ILBM
12.16 Image.PCX
12.17 Image.PNG
12.18 Image.PNM
12.19 Image.PSD
12.20 Image.TGA
12.21 Image.XBM
12.22 Image.XCF
12.23 Image.XWD
12.24 Image.JPEG
12.25 Image.TIFF
12.26 Image.TTF
12.26.1 Image.TTF.Face
12.26.2 Image.TTF.FaceInstance
12.27 Image.XFace
13 Protocols
13.1 Protocols.HTTP
13.1.1 Protocols.HTTP.Query
13.2 Protocols.LysKOM
13.2.1 Protocols.LysKOM.Session
13.2.2 Protocols.LysKOM.Connection
13.2.3 Protocols.LysKOM.Request
13.2.3.1 Protocols.LysKOM.Request._Request
13.3 Protocols.DNS
13.3.1 Protocols.DNS.client
14 Other modules
14.1 System
14.2 Process
14.3 Regexp
14.4 Gmp
14.5 Gdbm
14.6 Getopt
14.7 Gz
14.8 Yp
14.9 ADT.Table
14.10 Yabu transaction database
14.10.1 The database
14.10.2 Tables
14.10.3 Transactions
14.11 MIME
14.11.1 Global functions
14.11.2 The MIME.Message class
14.11.2.1 Public fields
14.11.2.2 Public methods
14.12 Simulate
14.13 Mysql.mysql
14.14 The Pike Crypto Toolkit
14.14.1 Introduction
14.14.2 Block ciphers
14.14.3 Stream Ciphers
14.14.4 Hash Functions
14.14.5 Public key algorithms
14.14.6 Combining block cryptos
14.15 Locale.Gettext
14.16 Calendar
14.16.1 Calendar.time_unit
14.16.2 Calendar.Gregorian
14.16.2.1 Calendar.Gregorian.
14.16.2.2 Calendar.Gregorian.Year
14.16.2.3 Calendar.Gregorian.Stardate
14.16.2.3.1 Calendar.Gregorian.Stardate.TNGDate
14.17 Parser
14.18 Math
14.18.1 Math.Matrix
14.19 Calendar.time_unit
14.20 Calendar.Gregorian
14.20.1 Calendar.Gregorian.
14.20.2 Calendar.Gregorian.Year
14.20.3 Calendar.Gregorian.Stardate
14.20.3.1 Calendar.Gregorian.Stardate.TNGDate
14.21 Crypto.randomness
14.21.1 Crypto.randomness.pike_random
14.21.2 Crypto.randomness.arcfour_random
14.22 Geographical.Position
14.23 Geographical.Countries
14.24 Parser.SGML
14.25 Protocols.HTTP
14.25.1 Protocols.HTTP.Query
14.26 Protocols.LysKOM
14.26.1 Protocols.LysKOM.Session
14.26.2 Protocols.LysKOM.Connection
14.26.3 Protocols.LysKOM.Request
14.26.3.1 Protocols.LysKOM.Request._Request
14.27 Protocols.DNS
14.27.1 Protocols.DNS.client
15 The preprocessor
16 Builtin functions
17 Pike internals - how to extend Pike
17.1 The master object
17.2 Data types from the inside
17.2.1 Basic data types
17.2.2 struct svalue
17.2.3 struct pike_string
17.2.4 struct array
17.2.5 struct mapping
17.2.6 struct object
17.2.7 struct program
17.3 The interpreter
Appendix A Terms and jargon
Appendix B Register program
Appendix C Reserved words
Appendix D BNF for Pike
Appendix E How to install Pike
Appendix F How to convert from old versions of Pike
Appendix G Image.Layer modes
Appendix H Image.Color colors
Index