Programacion pawn
embedded scripting language
The Language
August 2007 ITB CompuPhase
ii
“Java” is a trademark of Sun Microsystems, Inc. “Microsoft” and “Microsoft Windows” are registered trademarks of Microsoft Corporation. “Linux” is a registered trademark of Linus Torvalds. “CompuPhase” is a registered trademark of ITB CompuPhase. “Unicode” is a registered trademark of Unicode, Inc.Copyright c 1997–2007, ITB CompuPhase Eerste Industriestraat 19–21, 1401VL Bussum The Netherlands (Pays Bas) telephone: (+31)-(0)35 6939 261 e-mail: info@compuphase.com, www: http://www.compuphase.com
The documentation is licensed under the Creative Commons Attribution-ShareAlike 2.5 License. A summary of this license is in appendix D. For more information on this licence, visithttp://creativecommons.org/licenses/by-sa/2.5/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. The information in this manual and the associated software are provided “as is”. There are no guarantees, explicit or implied, that the software and the manual are accurate. Requests for corrections and additions to the manual and the software can be directed to ITB CompuPhase atthe above address. Typeset with TEX in the “Computer Modern” and “Palatino” typefaces at a base size of 11 points.
iii
Table of contents
Foreword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 A tutorial introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Data anddeclarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 The preprocessor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 General syntax . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Operators and expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 Directives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . 118 Proposed function library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Pitfalls: differences from C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 Assorted tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137Appendices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 A: Error and warning messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 B: The compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 C: Rationale . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 D: License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
iv
Table of contents
1
Foreword
pawn is asimple, typeless, 32-bit “scripting” language with a C-like syntax. Execution speed, stability, simplicity and a small footprint were essential design criteria for both the language and the interpreter/abstract machine that a pawn program runs on. An application or tool cannot do or be everything for all users. This not only justifies the diversity of editors, compilers, operating systems and many...
Regístrate para leer el documento completo.