Soumettre la recherche
Mettre en ligne
The Ring programming language version 1.4.1 book - Part 1 of 31
•
0 j'aime
•
20 vues
Mahmoud Samir Fayed
Suivre
The Ring programming language version 1.4.1 book - Part 1 of 31
Lire moins
Lire la suite
Technologie
Signaler
Partager
Signaler
Partager
1 sur 30
Télécharger maintenant
Télécharger pour lire hors ligne
Recommandé
The Ring programming language version 1.4 book - Part 1 of 30
The Ring programming language version 1.4 book - Part 1 of 30
Mahmoud Samir Fayed
The Ring programming language version 1.3 book - Part 1 of 88
The Ring programming language version 1.3 book - Part 1 of 88
Mahmoud Samir Fayed
The Ring programming language version 1.5.1 book - Part 1 of 180
The Ring programming language version 1.5.1 book - Part 1 of 180
Mahmoud Samir Fayed
The Ring programming language version 1.5.2 book - Part 1 of 181
The Ring programming language version 1.5.2 book - Part 1 of 181
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 1 of 212
The Ring programming language version 1.10 book - Part 1 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.9 book - Part 1 of 210
The Ring programming language version 1.9 book - Part 1 of 210
Mahmoud Samir Fayed
The Ring programming language version 1.5.4 book - Part 1 of 185
The Ring programming language version 1.5.4 book - Part 1 of 185
Mahmoud Samir Fayed
The Ring programming language version 1.5.3 book - Part 1 of 184
The Ring programming language version 1.5.3 book - Part 1 of 184
Mahmoud Samir Fayed
Recommandé
The Ring programming language version 1.4 book - Part 1 of 30
The Ring programming language version 1.4 book - Part 1 of 30
Mahmoud Samir Fayed
The Ring programming language version 1.3 book - Part 1 of 88
The Ring programming language version 1.3 book - Part 1 of 88
Mahmoud Samir Fayed
The Ring programming language version 1.5.1 book - Part 1 of 180
The Ring programming language version 1.5.1 book - Part 1 of 180
Mahmoud Samir Fayed
The Ring programming language version 1.5.2 book - Part 1 of 181
The Ring programming language version 1.5.2 book - Part 1 of 181
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 1 of 212
The Ring programming language version 1.10 book - Part 1 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.9 book - Part 1 of 210
The Ring programming language version 1.9 book - Part 1 of 210
Mahmoud Samir Fayed
The Ring programming language version 1.5.4 book - Part 1 of 185
The Ring programming language version 1.5.4 book - Part 1 of 185
Mahmoud Samir Fayed
The Ring programming language version 1.5.3 book - Part 1 of 184
The Ring programming language version 1.5.3 book - Part 1 of 184
Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 1 of 202
The Ring programming language version 1.8 book - Part 1 of 202
Mahmoud Samir Fayed
The Ring programming language version 1.2 book - Part 1 of 84
The Ring programming language version 1.2 book - Part 1 of 84
Mahmoud Samir Fayed
The Ring programming language version 1.6 book - Part 1 of 189
The Ring programming language version 1.6 book - Part 1 of 189
Mahmoud Samir Fayed
The Ring programming language version 1.7 book - Part 1 of 196
The Ring programming language version 1.7 book - Part 1 of 196
Mahmoud Samir Fayed
initiation-au-langage-c-et-exercices-corriges
initiation-au-langage-c-et-exercices-corriges
jojo sekkat
Deviens un Ninja avec Angular2
Deviens un Ninja avec Angular2
Gantner Technologies
La base de données Oracle
La base de données Oracle
Bruno Delb
Oracle 11g exploitation
Oracle 11g exploitation
Dieudonné M'sago
The Ring programming language version 1.9 book - Part 3 of 210
The Ring programming language version 1.9 book - Part 3 of 210
Mahmoud Samir Fayed
Object detection and recognition in digital images
Object detection and recognition in digital images
Sakher BELOUADAH
Tp sgbd gsi
Tp sgbd gsi
saqrjareh
Guide latex.
Guide latex.
AbdullahOmar64
Cbdsys 2
Cbdsys 2
Syrine Chebili
Lavorare con java 6
Lavorare con java 6
Pi Libri
The Ring programming language version 1.10 book - Part 3 of 212
The Ring programming language version 1.10 book - Part 3 of 212
Mahmoud Samir Fayed
Analyse numérique
Analyse numérique
imane lahjouji
Support formation vidéo : Excel 2016 - Maîtrisez les bases
Support formation vidéo : Excel 2016 - Maîtrisez les bases
SmartnSkilled
Eripm wd bgt0000 nbk
Eripm wd bgt0000 nbk
Sprl Eripm
Administration Base de données Oracle
Administration Base de données Oracle
Andrianaivo Lovatiana
Programmation en-java-api
Programmation en-java-api
Aissam エサム Afifi アフフ
Base-de-données.pdf
Base-de-données.pdf
djallel2
courspython3.pdf
courspython3.pdf
Dendouga1
Contenu connexe
Tendances
The Ring programming language version 1.8 book - Part 1 of 202
The Ring programming language version 1.8 book - Part 1 of 202
Mahmoud Samir Fayed
The Ring programming language version 1.2 book - Part 1 of 84
The Ring programming language version 1.2 book - Part 1 of 84
Mahmoud Samir Fayed
The Ring programming language version 1.6 book - Part 1 of 189
The Ring programming language version 1.6 book - Part 1 of 189
Mahmoud Samir Fayed
The Ring programming language version 1.7 book - Part 1 of 196
The Ring programming language version 1.7 book - Part 1 of 196
Mahmoud Samir Fayed
initiation-au-langage-c-et-exercices-corriges
initiation-au-langage-c-et-exercices-corriges
jojo sekkat
Deviens un Ninja avec Angular2
Deviens un Ninja avec Angular2
Gantner Technologies
La base de données Oracle
La base de données Oracle
Bruno Delb
Oracle 11g exploitation
Oracle 11g exploitation
Dieudonné M'sago
The Ring programming language version 1.9 book - Part 3 of 210
The Ring programming language version 1.9 book - Part 3 of 210
Mahmoud Samir Fayed
Object detection and recognition in digital images
Object detection and recognition in digital images
Sakher BELOUADAH
Tp sgbd gsi
Tp sgbd gsi
saqrjareh
Guide latex.
Guide latex.
AbdullahOmar64
Cbdsys 2
Cbdsys 2
Syrine Chebili
Lavorare con java 6
Lavorare con java 6
Pi Libri
The Ring programming language version 1.10 book - Part 3 of 212
The Ring programming language version 1.10 book - Part 3 of 212
Mahmoud Samir Fayed
Analyse numérique
Analyse numérique
imane lahjouji
Support formation vidéo : Excel 2016 - Maîtrisez les bases
Support formation vidéo : Excel 2016 - Maîtrisez les bases
SmartnSkilled
Eripm wd bgt0000 nbk
Eripm wd bgt0000 nbk
Sprl Eripm
Administration Base de données Oracle
Administration Base de données Oracle
Andrianaivo Lovatiana
Programmation en-java-api
Programmation en-java-api
Aissam エサム Afifi アフフ
Tendances
(20)
The Ring programming language version 1.8 book - Part 1 of 202
The Ring programming language version 1.8 book - Part 1 of 202
The Ring programming language version 1.2 book - Part 1 of 84
The Ring programming language version 1.2 book - Part 1 of 84
The Ring programming language version 1.6 book - Part 1 of 189
The Ring programming language version 1.6 book - Part 1 of 189
The Ring programming language version 1.7 book - Part 1 of 196
The Ring programming language version 1.7 book - Part 1 of 196
initiation-au-langage-c-et-exercices-corriges
initiation-au-langage-c-et-exercices-corriges
Deviens un Ninja avec Angular2
Deviens un Ninja avec Angular2
La base de données Oracle
La base de données Oracle
Oracle 11g exploitation
Oracle 11g exploitation
The Ring programming language version 1.9 book - Part 3 of 210
The Ring programming language version 1.9 book - Part 3 of 210
Object detection and recognition in digital images
Object detection and recognition in digital images
Tp sgbd gsi
Tp sgbd gsi
Guide latex.
Guide latex.
Cbdsys 2
Cbdsys 2
Lavorare con java 6
Lavorare con java 6
The Ring programming language version 1.10 book - Part 3 of 212
The Ring programming language version 1.10 book - Part 3 of 212
Analyse numérique
Analyse numérique
Support formation vidéo : Excel 2016 - Maîtrisez les bases
Support formation vidéo : Excel 2016 - Maîtrisez les bases
Eripm wd bgt0000 nbk
Eripm wd bgt0000 nbk
Administration Base de données Oracle
Administration Base de données Oracle
Programmation en-java-api
Programmation en-java-api
Similaire à The Ring programming language version 1.4.1 book - Part 1 of 31
Base-de-données.pdf
Base-de-données.pdf
djallel2
courspython3.pdf
courspython3.pdf
Dendouga1
cours_python.pdf
cours_python.pdf
Wafaa Ibrihich
Manuel du module additionnel RF-LAMINATE pour RFEM
Manuel du module additionnel RF-LAMINATE pour RFEM
Grégoire Dupont
The Ring programming language version 1.8 book - Part 3 of 202
The Ring programming language version 1.8 book - Part 3 of 202
Mahmoud Samir Fayed
Rapport de projet_de_fin_d__tudes__pfe__safwen (8)
Rapport de projet_de_fin_d__tudes__pfe__safwen (8)
safwenbenfredj
Algo
Algo
mickel iron
Poly
Poly
ali choukri
Rapport Projet De Fin D'étude de Conception et développement d’une applicatio...
Rapport Projet De Fin D'étude de Conception et développement d’une applicatio...
mouafekmazia
Deep Learning : Application à la reconnaissance d’objets de classes multiples...
Deep Learning : Application à la reconnaissance d’objets de classes multiples...
Haytam EL YOUSSFI
The Ring programming language version 1.7 book - Part 3 of 196
The Ring programming language version 1.7 book - Part 3 of 196
Mahmoud Samir Fayed
Ibm spectrum archive enterprise edition
Ibm spectrum archive enterprise edition
Luciano Saia
rapport_stage_TBLB.pdf
rapport_stage_TBLB.pdf
fatimazahrakherazi
LatexPourLeProfDeMaths.pdf
LatexPourLeProfDeMaths.pdf
Wafaa Ibrihich
Apache Web Server Index
Apache Web Server Index
webhostingguy
Cours matlab
Cours matlab
mohamednacim
9783642290435 t1
9783642290435 t1
nenena1976
Mémoire fin d'étude gestion des interventions
Mémoire fin d'étude gestion des interventions
Mohamed Arar
Similaire à The Ring programming language version 1.4.1 book - Part 1 of 31
(18)
Base-de-données.pdf
Base-de-données.pdf
courspython3.pdf
courspython3.pdf
cours_python.pdf
cours_python.pdf
Manuel du module additionnel RF-LAMINATE pour RFEM
Manuel du module additionnel RF-LAMINATE pour RFEM
The Ring programming language version 1.8 book - Part 3 of 202
The Ring programming language version 1.8 book - Part 3 of 202
Rapport de projet_de_fin_d__tudes__pfe__safwen (8)
Rapport de projet_de_fin_d__tudes__pfe__safwen (8)
Algo
Algo
Poly
Poly
Rapport Projet De Fin D'étude de Conception et développement d’une applicatio...
Rapport Projet De Fin D'étude de Conception et développement d’une applicatio...
Deep Learning : Application à la reconnaissance d’objets de classes multiples...
Deep Learning : Application à la reconnaissance d’objets de classes multiples...
The Ring programming language version 1.7 book - Part 3 of 196
The Ring programming language version 1.7 book - Part 3 of 196
Ibm spectrum archive enterprise edition
Ibm spectrum archive enterprise edition
rapport_stage_TBLB.pdf
rapport_stage_TBLB.pdf
LatexPourLeProfDeMaths.pdf
LatexPourLeProfDeMaths.pdf
Apache Web Server Index
Apache Web Server Index
Cours matlab
Cours matlab
9783642290435 t1
9783642290435 t1
Mémoire fin d'étude gestion des interventions
Mémoire fin d'étude gestion des interventions
Plus de Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212
Mahmoud Samir Fayed
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212
Mahmoud Samir Fayed
Plus de Mahmoud Samir Fayed
(20)
The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.4.1 book - Part 1 of 31
1.
2.
Ring Documentation Release 1.4.1 Eng.
Mahmoud Fayed and Dr. Atif Alamri July 11, 2017
3.
CONTENTS 1 Applications developed
in little hours 1 1.1 Quotes about Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 FetchStockData Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 1.3 Fifteen Puzzle Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.4 TicTacToe Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 1.5 Squares Puzzle Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.6 Analog Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.7 Werdy Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.8 Fifteen Puzzle Game 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.9 Samples in this book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 2 Introduction 11 2.1 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2.2 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.3 Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 2.4 License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 3 Language Design 16 3.1 Why Ring? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.2 Designed for a Clear Goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.3 Simple . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3.4 Trying to be natural . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.5 Encourage Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.6 Transparent Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.7 Visual Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.8 Compact Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.9 Define Natural Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.10 Define Declarative Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 3.11 Smart Garbage Collector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 4 What is new in Ring 1.4.1? 25 4.1 List of changes and new features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.2 Better Scripts for Building from Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 4.3 Better Colors for the Modern Style in Ring Notepad . . . . . . . . . . . . . . . . . . . . . . . . . . 26 4.4 Better StdLib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.5 Better RingQt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 4.6 New Sample : Sixteen Puzzle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 5 What is new in Ring 1.4? 29 5.1 List of changes and new features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 5.2 Change: Basic Extensions are separated from RingVM . . . . . . . . . . . . . . . . . . . . . . . . . 29 i
4.
5.3 The Natural
Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 5.4 New Style is added to Ring Notepad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 5.5 RingREPL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.6 Convert between Numbers and Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 5.7 Better StdLib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.8 Better WebLib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 5.9 Better RingQt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 5.10 Qt Class Convertor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 6 What is new in Ring 1.3? 38 6.1 List of changes and new features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 6.2 Better RingQt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 6.3 Better Ring Notepad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 6.4 Ring mode for Emacs Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 6.5 Better StdLib . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 6.6 Better Loop|Exit Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 6.7 New Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 6.8 Return Self by Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 6.9 Using ‘<’ and ‘:’ operators as ‘from’ keyword . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 6.10 Embedding Ring in Ring without sharing the State . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 6.11 RingZip Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 6.12 Form Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 7 What is new in Ring 1.2? 51 7.1 List of changes and new features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 7.2 New Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 7.3 Better Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 7.4 Better Ring Notepad . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52 7.5 Better RingQt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 7.6 Objects Library for RingQt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 7.7 RingLibCurl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 7.8 Better Call Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 7.9 Using NULL instead of NULLPointer() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 7.10 Display Warnings Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 7.11 Better Quality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 8 What is new in Ring 1.1? 57 8.1 List of changes and new features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 8.2 Better Natural Language Programming Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 8.3 Generate/Execute Ring Object Files (*.ringo) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 8.4 Syntax Flexibility and different styles for I/O and Control Structures . . . . . . . . . . . . . . . . . . 58 8.5 New Functions and Changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 8.6 StdLib functions and classes written in Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 8.7 RingLibSDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 8.8 Demo Project - Game Engine for 2D Games . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 8.9 RingSQLite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 8.10 Better Code Generator for Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 8.11 Using Self.Attribute in the Class Region to define new attributes . . . . . . . . . . . . . . . . . . . . 65 8.12 Using This.Attribute in nested Braces inside the Class Methods . . . . . . . . . . . . . . . . . . . . 65 8.13 Better Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 9 Building From Source Code 67 9.1 Building using Microsoft Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 9.2 Building using Ubuntu Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68 9.3 Building using MacOS X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70 ii
5.
9.4 Building using
CMake . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 10 How to contribute? 72 10.1 Special thanks to contributors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 10.2 Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 10.3 Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 10.4 Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.5 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.6 Editors Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.7 Libraries in Ring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.8 Extensions in C/C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.9 Compiler and Virtual Machine (VM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 10.10 Ideas and suggestions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 11 Getting Started - First Style 74 11.1 Hello World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 11.2 Run the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 11.3 Not Case-Sensitive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 11.4 Multi-Line literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 11.5 Getting Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 11.6 No Explicit End For Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 11.7 Writing Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 12 Getting Started - Second Style 76 12.1 Hello World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 12.2 Run the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 12.3 Not Case-Sensitive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 12.4 Multi-Line literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 12.5 Getting Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 12.6 No Explicit End For Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 12.7 Writing Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 13 Getting Started - Third Style 78 13.1 Hello World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 13.2 Run the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 13.3 Not Case-Sensitive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 13.4 Multi-Line literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 13.5 Getting Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 13.6 No Explicit End For Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 13.7 Writing Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 14 Using Ring Notepad 80 14.1 Ring Notepad - Main Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 14.2 Creating and running your first Console Application . . . . . . . . . . . . . . . . . . . . . . . . . . 81 14.3 Creating and running your first GUI/Mobile Application . . . . . . . . . . . . . . . . . . . . . . . . 83 14.4 Creating and running your first Web Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84 14.5 Creating and running your first Desktop/Mobile Game . . . . . . . . . . . . . . . . . . . . . . . . . 85 15 Using Other Code Editors 87 15.1 Using Notepad++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 15.2 Using Geany . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 15.3 Using Atom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 15.4 Using Sublime Text 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 15.5 Using Visual Studio IDE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 15.6 Using Emacs Editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 iii
6.
16 Variables 93 16.1
Dynamic Typing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 16.2 Deep Copy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 16.3 Weakly Typed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 17 Operators 95 17.1 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 17.2 Relational Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 17.3 Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 17.4 Bitwise Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 17.5 Assignment Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 17.6 Misc Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 17.7 Operators Precedence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 18 Control Structures - First Style 98 18.1 Branching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 18.2 Looping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 18.3 Using The Step option with For in . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 18.4 Using For in to modify lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 18.5 Do Again Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 18.6 Exit Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 18.7 Exit from two loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 18.8 Exit/Loop inside sub functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 18.9 Short-circuit evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 18.10 Comments about evaluation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 19 Control Structures - Second Style 105 19.1 Branching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 19.2 Looping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 19.3 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 20 Control Structures - Third Style 108 20.1 Branching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 20.2 Looping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 20.3 Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 21 Getting Input 113 21.1 Give Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 21.2 GetChar() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 21.3 Input() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 22 Functions 115 22.1 Define Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 22.2 Call Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 22.3 Declare parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 22.4 Send Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 22.5 Main Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 22.6 Variables Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 22.7 Return Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 22.8 Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 23 Program Structure 119 23.1 Source Code File Sections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 23.2 Using Many Source Code Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 iv
7.
24 Lists 120 24.1
Create Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 24.2 Add Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 24.3 Get List Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 24.4 Delete Item From List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 24.5 Get List Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 24.6 Set List Item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 24.7 Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 24.8 Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 24.9 Reverse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 24.10 Insert Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 24.11 Nested Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 24.12 Copy Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 24.13 First-class lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 24.14 Using Lists during definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 24.15 Passing Lists to Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 24.16 Access List Items by String Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 24.17 Passing Parameters Using List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 24.18 Swap Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127 25 Strings 128 25.1 String Literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 25.2 Get String Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 25.3 Convert Letters Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 25.4 Access String Letters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 25.5 Left() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 25.6 Right() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 25.7 Trim() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 25.8 Copy() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 25.9 Lines() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 25.10 Substr() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 25.11 Find substring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 25.12 Get substring from position to end . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 25.13 Get Number of Characters From Position . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 25.14 Transform Substring To Another Substring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 25.15 strcmp() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 25.16 str2list() and list2str() Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 26 Date and Time 134 26.1 Clock() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 26.2 ClocksPerSecond() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 26.3 Time() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134 26.4 Date() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 26.5 TimeList() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135 26.6 AddDays() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 26.7 DiffDays() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136 26.8 EpochTime() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137 27 Check Data Type and Conversion 138 27.1 Check Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 27.2 IsString() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 27.3 IsNumber() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138 27.4 IsList() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 27.5 Type() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 v
8.
27.6 IsNULL() Function
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 27.7 Check Character . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 27.8 IsAlNum() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 27.9 IsAlpha() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 27.10 IsCntrl() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 27.11 IsDigit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 27.12 IsGraph() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 27.13 IsLower() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 27.14 IsPrint() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 27.15 IsPunct() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 27.16 IsSpace() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 27.17 IsUpper() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 27.18 IsXdigit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 27.19 Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 27.20 Number() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 27.21 String() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 27.22 Ascii() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 27.23 Char() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 27.24 Hex() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 27.25 Dec() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 27.26 Str2hex() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 27.27 Hex2str() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 28 Mathematical Functions 146 28.1 List of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 28.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 28.3 Random() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 28.4 Unsigned() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 28.5 Decimals() Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 29 Files 151 29.1 Read() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 29.2 Write() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 29.3 Dir() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 29.4 Rename() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 29.5 Remove() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 29.6 Fopen() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 29.7 Fclose() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 29.8 Fflush() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 29.9 Freopen() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 29.10 Tempfile() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 29.11 Tempname() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 29.12 Fseek() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 29.13 Ftell() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 29.14 Rewind() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 29.15 Fgetpos() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 29.16 Fsetpos() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 29.17 Clearerr() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 29.18 Feof() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 29.19 Ferror() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 29.20 Perror() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 29.21 Fgetc() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 29.22 Fgets() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 29.23 Fputc() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 vi
9.
29.24 Fputs() Function
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 29.25 Ungetc() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 29.26 Fread() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 29.27 Fwrite() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 29.28 Fexists() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 29.29 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 29.30 Numbers and Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 30 System Functions 161 30.1 System() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 30.2 SysGet() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 30.3 IsMSDOS() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 30.4 IsWindows() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 30.5 IsWindows64() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 30.6 IsUnix() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 30.7 IsMacOSX() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162 30.8 IsLinux() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 30.9 IsFreeBSD() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 30.10 IsAndroid() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 30.11 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 30.12 Windowsnl() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 30.13 Get Command Line Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 30.14 Get Active Source File Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 30.15 PrevFileName() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 30.16 CurrentDir() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 30.17 ExeFileName() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 30.18 ChDir() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 30.19 ExeFolder() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 30.20 Version() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 31 Eval() and Debugging 167 31.1 Try/Catch/Done . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 31.2 Eval() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 31.3 Raise() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 31.4 Assert() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 32 Demo Programs 170 32.1 Language Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 32.2 Main Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 33 ODBC Functions 174 33.1 odbc_init() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 33.2 odbc_drivers() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 33.3 odbc_datasources() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 33.4 odbc_close() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 33.5 Print List of ODBC Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 33.6 Print List of ODBC Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 33.7 odbc_connect() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 33.8 odbc_disconnect() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 33.9 Open and Close Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 33.10 odbc_execute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 33.11 odbc_colcount() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 33.12 odbc_fetch() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 33.13 odbc_getdata() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 33.14 Execute Query and Print Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 vii
10.
33.15 odbc_tables() Function
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 33.16 odbc_columns() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 33.17 odbc_autocommit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 33.18 odbc_commit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 33.19 odbc_rollback() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 33.20 Transactions and Using Commit and Rollback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 33.21 Save and Restore images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 34 MySQL Functions 183 34.1 MySQL_Info() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 34.2 MySQL_Init() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 34.3 MySQL_Error() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 34.4 MySQL_Connect() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 34.5 MySQL_Close() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 34.6 MySQL_Query() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184 34.7 Create Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 34.8 Create Table and Insert Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 34.9 MySQL_Insert_ID() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 34.10 MySQL_Result() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 34.11 MySQL_Next_Result() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 34.12 Print Query Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 34.13 MySQL_Columns() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 34.14 MySQL_Result2() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188 34.15 MySQL_Escape_String() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 34.16 Save Image inside the database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 34.17 Restore Image From The Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 34.18 MySQL_AutoCommit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 34.19 MySQL_Commit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 34.20 MySQL_Rollback() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 34.21 Transaction Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 35 SQLite Functions 192 35.1 sqlite_init() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 35.2 sqlite_open() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 35.3 sqlite_execute() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 35.4 sqlite_close() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192 35.5 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 36 Security and Internet Functions 195 36.1 MD5() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 36.2 SHA1() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 36.3 SHA256() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 36.4 SHA512() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 36.5 SHA384() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 36.6 SHA224() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 36.7 Encrypt() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 36.8 Decrypt() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 36.9 Encryption and Decryption Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 36.10 File Hash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 36.11 Randbytes() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 36.12 Download() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 36.13 SendEmail() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 37 Object Oriented Programming (OOP) 200 37.1 Classes and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 viii
11.
37.2 Access Objects
Using Braces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202 37.3 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203 37.4 Setter and Getter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 37.5 Private Attributes and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 37.6 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205 37.7 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206 37.8 Dynamic Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 37.9 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 37.10 Printing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 37.11 Find() and List of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208 37.12 Sort() and list of objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209 37.13 Using Self.Attribute and Self.Method() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 37.14 Using This.Attribute and This.Method() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212 38 Functional Programming 213 38.1 Pure Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213 38.2 First-class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 38.3 Higher-order Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 38.4 Anonymous and Nested Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 38.5 Equality of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216 39 Reflection and Meta-programming 218 39.1 locals() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 39.2 globals() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 39.3 functions() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 39.4 cfunctions() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 39.5 islocal() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 39.6 isglobal() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220 39.7 isfunction() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 39.8 iscfunction() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221 39.9 packages() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 39.10 ispackage() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222 39.11 classes() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 39.12 isclass() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 39.13 packageclasses() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 39.14 ispackageclass() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 39.15 classname() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 39.16 objectid() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 39.17 isobject() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 39.18 attributes() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 39.19 methods() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 39.20 isattribute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 39.21 isprivateattribute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 39.22 ismethod() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 39.23 isprivatemethod() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 39.24 addattribute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 39.25 addmethod() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 39.26 getattribute() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231 39.27 setattribute() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 39.28 mergemethods() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 39.29 packagename() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 40 Stdlib Functions 235 40.1 puts() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 ix
12.
40.2 print() function
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 40.3 getstring() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235 40.4 getnumber() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 40.5 apppath() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 40.6 justfilepath() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 40.7 justfilename() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236 40.8 value() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 40.9 times() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 40.10 map() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 40.11 filter() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 40.12 split() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 40.13 splitmany() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 40.14 newlist() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 40.15 capitalized() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 40.16 isspecial() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 40.17 isvowel() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 40.18 linecount() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 40.19 factorial() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 40.20 fibonacci() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 40.21 isprime() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 40.22 sign() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 40.23 list2file() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 40.24 file2list() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241 40.25 startswith() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 40.26 endswith() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 40.27 gcd() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 40.28 lcm() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 40.29 sumlist() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 40.30 prodlist() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 40.31 evenorodd() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 40.32 factors() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 40.33 palindrome() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 40.34 isleapyear() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 40.35 binarydigits() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 40.36 matrixmulti() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 40.37 matrixtrans() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 40.38 dayofweek() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 40.39 permutation() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 40.40 readline() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 40.41 substring() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 40.42 changestring() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 40.43 sleep() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 40.44 ismainsourcefile() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 40.45 direxists() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 40.46 makedir() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 40.47 fsize() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 40.48 trimall() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 40.49 trimleft() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 40.50 trimright() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 40.51 epochtime() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 41 Stdlib Classes 251 41.1 StdBase Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 41.2 String Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 x
13.
41.3 List Class
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 41.4 Stack Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 41.5 Queue Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 41.6 HashTable Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 41.7 Tree Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 41.8 Math Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 41.9 DateTime Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 41.10 File Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 41.11 System Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 41.12 Debug Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 41.13 DataType Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 41.14 Conversion Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 41.15 ODBC Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 41.16 MySQL Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 41.17 SQLite Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 41.18 Security Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 41.19 Internet Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273 42 Declarative Programming using Nested Structures 274 42.1 Creating Objects inside Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 42.2 Composition and Returning Objects and Lists by Reference . . . . . . . . . . . . . . . . . . . . . . 275 42.3 Executing code after the end of object access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277 42.4 Declarative Programming on the top of Object-Oriented . . . . . . . . . . . . . . . . . . . . . . . . 277 42.5 More beautiful Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278 43 Natural Language Programming 280 43.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 43.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280 43.3 Change the Ring Keyword ‘And’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281 43.4 Change the Ring Operator ‘+’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282 43.5 Change the ‘=’ operator to ‘is’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 43.6 Using Eval() with our Natural Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284 43.7 BraceStart and BraceEnd Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285 43.8 BraceExprEval Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 43.9 Real Natural Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286 43.10 BraceError() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 43.11 Clean Natural Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 44 Using the Natural Library 290 44.1 Natural Library - Demo Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 44.2 Defining Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 44.3 Natural Library - Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 44.4 Defining commands using classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 45 Web Development (CGI Library) 297 45.1 Configure the Apache web server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 45.2 Ring CGI Hello World Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 45.3 Hello World Program using the Web Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 45.4 Web Library Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 45.5 HTTP Get Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 45.6 HTTP POST Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304 45.7 Upload Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 45.8 Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 45.9 URL Encode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 45.10 Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 xi
14.
45.11 HTML Special
Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 45.12 Hash Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 45.13 Random Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 45.14 HTML Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318 45.15 HTML Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 45.16 Gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 45.17 Generating Pages using Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 45.18 Using Bootstrap Library using Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 45.19 Using Bootstrap Library using Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 45.20 CRUD Example using MVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 45.21 Users registration and Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 45.22 Database, ModelBase & ControllerBase classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 45.23 WebLib API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 343 45.24 Application Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 45.25 Page Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 45.26 ScriptFunctions Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347 45.27 StyleFunctions Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 46 Using RingLibCurl 349 46.1 Get Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 46.2 Post Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 46.3 Facebook Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 46.4 Save Output to String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 47 Using RingZip 353 47.1 Create Zip File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 47.2 Extract Zip File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 47.3 Print Files in Zip file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 47.4 Using RingZip Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 47.5 Zip Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 47.6 ZipEntry Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355 48 Graphics and 2D Games programming using RingAllegro 356 48.1 Drawing, Animation and Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 48.2 Using TrueType Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 48.3 Playing Sound Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 48.4 Scaling and Rotating Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 48.5 Display Transparent Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 48.6 Using Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366 49 Using RingLibSDL 369 49.1 Create Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 49.2 Display Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 49.3 Switch between two images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 49.4 Draw Rectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 49.5 Display PNG Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 49.6 Use TTF Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 49.7 Display Transparent Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 49.8 Close Window Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 49.9 Mouse Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 49.10 Play Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374 50 Demo Project - Game Engine for 2D Games 376 50.1 Project Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 50.2 Graphics Library bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 xii
15.
50.3 Interface to
graphics library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 50.4 Game Engine Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 50.5 Games Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 50.6 Game Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 50.7 GameObject Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 50.8 Sprite Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 50.9 Text Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 50.10 Animate Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 50.11 Sound Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 50.12 Map Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 50.13 Using the Game Engine - Creating the Game Window . . . . . . . . . . . . . . . . . . . . . . . . . 381 50.14 Using the Game Engine - Drawing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 50.15 Using the Game Engine - Moving Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 50.16 Using the Game Engine - Playing Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 50.17 Using the Game Engine - Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 50.18 Using the Game Engine - Animation and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 50.19 Using the Game Engine - Sprite - Automatic Movement using Keyboard . . . . . . . . . . . . . . . 388 50.20 Using the Game Engine - Sprite - Keypress event . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 50.21 Using the Game Engine - Sprite - Mouse event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 50.22 Using the Game Engine - Sprite - State event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 50.23 Using the Game Engine - Animate - Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 50.24 Using the Game Engine - Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 50.25 Using the Game Engine - Map Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 50.26 Using the Game Engine - Object and Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 50.27 Stars Fighter Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 50.28 Flappy Bird 3000 Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 50.29 Super Man 2016 Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414 51 Building Games For Android 426 51.1 Download Requirements and Update the Android SDK . . . . . . . . . . . . . . . . . . . . . . . . . 426 51.2 Project Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 51.3 Building the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 52 Desktop and Mobile development using RingQt 429 52.1 The First GUI Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 52.2 Using Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 52.3 Using the QTextEdit Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 52.4 Using the QListWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 52.5 Using QTreeView and QFileSystemModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 52.6 Using QTreeWidget and QTreeWidgetItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 437 52.7 Using QComboBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 438 52.8 Creating Menubar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 52.9 Creating Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 52.10 Creating StatusBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 52.11 Using QDockWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444 52.12 Using QTabWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 52.13 Using QTableWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 52.14 Using QProgressBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 52.15 Using QSpinBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 52.16 Using QSlider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 52.17 Using QDateEdit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 451 52.18 Using QDial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 52.19 Using QWebView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 52.20 Using QCheckBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 xiii
16.
52.21 Using QRadioButton
and QButtonGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 52.22 Adding Hyperlink to QLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 52.23 QVideoWidget and QMediaPlayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 52.24 Using QFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462 52.25 Display Image using QLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463 52.26 Menubar and StyleSheet Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464 52.27 QLineEdit Events and QMessageBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 52.28 Other Widgets Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468 52.29 Using the QTimer Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470 52.30 Using QProgressBar and Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 52.31 Display Scaled Image using QLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472 52.32 Using the QFileDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 52.33 Drawing using QPainter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 52.34 Printing using QPrinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476 52.35 Creating More than one Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 52.36 Playing Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478 52.37 Using the QColorDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478 52.38 Using qLCDNumber Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 52.39 Movable Label Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 52.40 QMessagebox Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481 52.41 Using QInputDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 52.42 Dialog Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 52.43 KeyPress and Mouse Move Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485 52.44 Moving Objects using the Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486 52.45 Inheritance from GUI Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 52.46 Using QDesktopWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491 52.47 Rotate Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 492 52.48 Change Focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494 52.49 Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 52.50 Simple Client and Server Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 496 52.51 Dynamic Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 498 52.52 Weight History Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499 52.53 Notepad Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 503 52.54 The Cards Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 52.55 Classes and their Methods to use the default events . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 52.56 Methods to use Events with Events Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527 52.57 The Difference between Qt and RingQt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 528 52.58 RingQt Classes and their Qt Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 52.59 New Classes names - Index Start from 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529 53 Building RingQt Applications for Mobile 530 53.1 Download Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 53.2 Update the Android SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 53.3 Install Qt for Android . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530 53.4 Comments about developing for Android using RingQt . . . . . . . . . . . . . . . . . . . . . . . . . 531 54 Objects Library for RingQt Application 533 54.1 Library Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 54.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 54.3 Open_WindowAndLink() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536 54.4 Objects Library Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537 55 Using the Form Designer 538 55.1 The Designer Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 xiv
17.
55.2 The Toolbox
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 55.3 The Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 55.4 Running Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 55.5 Events Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 55.6 Keyboard Shortcuts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 55.7 Menubar Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 55.8 Window Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 544 55.9 Entering Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 55.10 Using Layouts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 55.11 More Samples and Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 56 Scope Rules for Variables and Attributes 546 56.1 Three Scopes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546 56.2 Defining Variables and Variables Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546 56.3 How Ring find the variable? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 56.4 Using Object.Attribute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 56.5 The Self Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 547 56.6 How Ring Define Variables and Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548 56.7 Conflict between Global Variables and Class Attributes . . . . . . . . . . . . . . . . . . . . . . . . . 548 56.8 Conflict between Class Attributes and Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . 549 56.9 Using Braces to access objects inside Class Methods . . . . . . . . . . . . . . . . . . . . . . . . . . 550 56.10 Accessing the class attributes from braces inside class methods . . . . . . . . . . . . . . . . . . . . 553 56.11 Creating a Class for each Window in GUI applications . . . . . . . . . . . . . . . . . . . . . . . . . 554 56.12 Conflict between self inside braces and self in the class region . . . . . . . . . . . . . . . . . . . . . 555 56.13 Using braces to escape from the current object scope . . . . . . . . . . . . . . . . . . . . . . . . . . 558 56.14 Summary of Scope Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559 57 Scope Rules for Functions and Methods 561 57.1 How Ring find the Functions and Methods? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561 57.2 Example about Sharing Names between Functions and Methods . . . . . . . . . . . . . . . . . . . . 562 57.3 Calling a function sharing the name with a method in the current class . . . . . . . . . . . . . . . . . 563 58 Syntax Flexibility 565 58.1 Change Language Keywords . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565 58.2 Change Language Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 58.3 Load Syntax Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567 58.4 Using “()” around the function parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 58.5 Using Semi-colon after and between statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 58.6 Using $ and @ in the start of the variable name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569 58.7 Using the ‘elseif’ keyword as ‘but’ in if statement . . . . . . . . . . . . . . . . . . . . . . . . . . . 569 58.8 Using the ‘else’ keyword as ‘other’ in switch statement . . . . . . . . . . . . . . . . . . . . . . . . . 570 58.9 Using the ‘end’ keyword in different control structures . . . . . . . . . . . . . . . . . . . . . . . . . 570 58.10 Using braces to start and end different control structures . . . . . . . . . . . . . . . . . . . . . . . . 571 58.11 Using ‘put’ and ‘get’ as ‘see’ and ‘give’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572 58.12 Using ‘case’ as ‘on’ in switch statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572 58.13 Using ‘def’ as ‘func’ in functions/methods definition . . . . . . . . . . . . . . . . . . . . . . . . . . 573 59 Distributing Ring Applications 574 59.1 Distributing Applications for Microsoft Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574 59.2 Protecting the Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 574 59.3 Creating Windows Installer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575 59.4 Using C/C++ Compiler and Linker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575 59.5 Distributing Applications and Games for Mobile . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575 60 Command Line Options 576 xv
18.
60.1 Printing Tokens
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576 60.2 Printing Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 578 60.3 Printing Intermediate Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582 60.4 Printing Final Intermediate Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585 60.5 CGI Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 60.6 No Run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 60.7 Printing Instruction Operation Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 60.8 Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589 60.9 Generate Object File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590 61 Low Level Functions 591 61.1 callgc() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 61.2 varptr() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592 61.3 space() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592 61.4 nullpointer() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593 61.5 object2pointer() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593 61.6 pointer2object() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593 61.7 ptrcmp() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594 61.8 ringvm_cfunctionslist() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 594 61.9 ringvm_functionslist() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595 61.10 ringvm_classeslist() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595 61.11 ringvm_packageslist() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 596 61.12 ringvm_memorylist() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597 61.13 ringvm_calllist() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599 61.14 ringvm_fileslist() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 600 62 Introduction 601 62.1 Embedding Ring in Ring without sharing the State . . . . . . . . . . . . . . . . . . . . . . . . . . . 601 62.2 Serial Execution of Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 602 63 Extension using the C/C++ languages 603 63.1 ring_ext.h . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 63.2 ring_ext.c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 63.3 Module Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 63.4 Function Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 63.5 Check Parameters Count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 605 63.6 Display Error Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 63.7 Check Parameters Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 63.8 Get Parameters Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 63.9 Return Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 63.10 Function Prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 63.11 Sin() Function Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 63.12 Fopen() and Fclose() Functions Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 63.13 Ring API - List Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608 63.14 Ring API - String Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610 63.15 MySQL_Columns() Function Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610 63.16 Dynamic/Shared Libraries (DLL/So) and LoadLib() function . . . . . . . . . . . . . . . . . . . . . 611 64 Embedding Ring Language in C/C++ Programs 613 64.1 Ring State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 64.2 Ring State Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 64.3 Ring State Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614 65 Code Generator for wrapping C/C++ Libraries 616 65.1 Using the tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616 xvi
19.
65.2 Configuration file
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616 65.3 Using the function prototype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616 65.4 Adding code to the generated code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618 65.5 Prefix for Functions Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618 65.6 Generate function to wrap structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618 65.7 Determine Structure Members Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619 65.8 Defining Contants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619 65.9 Register New Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 619 65.10 Writing comments in the configuration file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620 65.11 Executing code during code generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620 65.12 Enum and Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 620 65.13 Filtering using Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621 65.14 Configuration file for the Allegro Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621 65.15 Threads Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 622 65.16 Code Generator Rules for Wrapping C++ Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 65.17 Using configuration file that wrap C++ Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 65.18 Configuration file for the Qt Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624 65.19 Configuration Files Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634 66 RingLibCurl Functions Reference 635 67 RingLibZip Functions Reference 637 68 RingAllegro Functions Reference 638 69 RingLibSDL Functions Reference 657 70 RingQt Classes Reference 673 70.1 QApp Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 70.2 QDesktopServices Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 70.3 QTest Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 70.4 QObject Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674 70.5 QWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674 70.6 QLabel Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 70.7 QPushButton Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 70.8 QBitmap Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 70.9 QPixmap Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 681 70.10 QPixmap2 Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 70.11 QIcon Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 70.12 QSize Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 70.13 QLineEdit Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 70.14 QVBoxLayout Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684 70.15 QHBoxLayout Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685 70.16 QTextEdit Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 685 70.17 QListWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687 70.18 QTreeView Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689 70.19 QDir Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 70.20 QFileSystemModel Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 70.21 QTreeWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 692 70.22 QTreeWidgetItem Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 70.23 QComboBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696 70.24 QMenuBar Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698 70.25 QMenu Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 698 70.26 QToolBar Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 70.27 QMainWindow Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700 xvii
20.
70.28 QStatusBar Class
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 70.29 QDockWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 70.30 QTabWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703 70.31 QTableWidgetItem Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704 70.32 QFrame Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705 70.33 QFrame2 Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 70.34 QFrame3 Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 70.35 QAbstractScrollArea Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 70.36 QAbstractItemView Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 706 70.37 QTableView Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708 70.38 QTableWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710 70.39 QProgressBar Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712 70.40 QSpinBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713 70.41 QAbstractSlider Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713 70.42 QSlider Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714 70.43 QDateEdit Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715 70.44 QDateTimeEdit Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715 70.45 QAbstractSpinBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 70.46 QDial Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 717 70.47 QWebView Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 70.48 QUrl Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719 70.49 QCheckBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720 70.50 QAbstractButton Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720 70.51 QRadioButton Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721 70.52 QButtonGroup Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722 70.53 QMediaPlayer Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722 70.54 QMediaPlaylist Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 70.55 QVideoWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 70.56 QAction Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 70.57 QEvent Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726 70.58 QMessageBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726 70.59 QTimer Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727 70.60 QFileDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 70.61 QPainter Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 70.62 QPainter2 Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 70.63 QPicture Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 70.64 QPen Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 70.65 QColor Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 70.66 QPrinter Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 70.67 QFont Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 70.68 QBrush Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738 70.69 QByteArray Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739 70.70 QIODevice Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741 70.71 QAbstractSocket Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 741 70.72 QNetworkProxy Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743 70.73 QTcpSocket Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744 70.74 QTcpServer Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744 70.75 QHostAddress Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745 70.76 QHostInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746 70.77 QFileInfo Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746 70.78 QDirModel Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 747 70.79 QFontDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 70.80 QDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749 70.81 QTextCursor Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749 xviii
Télécharger maintenant