SlideShare une entreprise Scribd logo
1  sur  10
Télécharger pour lire hors ligne
34.19 Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
34.20 Number() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
34.21 String() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
34.22 Ascii() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
34.23 Char() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
34.24 Hex() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
34.25 Dec() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
34.26 Str2hex() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
34.27 Hex2str() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
35 Mathematical Functions 290
35.1 List of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
35.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
35.3 Random() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
35.4 SRandom() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
35.5 Unsigned() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
35.6 Decimals() Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
35.7 Using _ in numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
35.8 Using f after numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
36 Files 296
36.1 Read() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
36.2 Write() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
36.3 Dir() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
36.4 Rename() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
36.5 Remove() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
36.6 Fopen() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
36.7 Fclose() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
36.8 Fflush() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
36.9 Freopen() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
36.10 Tempfile() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
36.11 Tempname() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
36.12 Fseek() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
36.13 Ftell() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
36.14 Rewind() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
36.15 Fgetpos() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
36.16 Fsetpos() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
36.17 Clearerr() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
36.18 Feof() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
36.19 Ferror() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301
36.20 Perror() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
36.21 Fgetc() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
36.22 Fgets() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
36.23 Fputc() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
36.24 Fputs() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
36.25 Ungetc() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
36.26 Fread() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
36.27 Fwrite() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
36.28 Fexists() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
36.29 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
36.30 Numbers and Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
37 System Functions 306
37.1 System() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
ix
37.2 SysGet() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
37.3 IsMSDOS() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
37.4 IsWindows() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
37.5 IsWindows64() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
37.6 IsUnix() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
37.7 IsMacOSX() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
37.8 IsLinux() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
37.9 IsFreeBSD() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
37.10 IsAndroid() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
37.11 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
37.12 Windowsnl() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
37.13 Get Command Line Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
37.14 Get Active Source File Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
37.15 PrevFileName() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310
37.16 CurrentDir() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
37.17 ExeFileName() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
37.18 ChDir() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
37.19 ExeFolder() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
37.20 Version() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
37.21 Shutdown() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
38 Eval() and Debugging 313
38.1 Try/Catch/Done . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
38.2 Eval() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
38.3 Raise() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
38.4 Assert() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
39 Demo Programs 316
39.1 Language Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
39.2 Main Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
40 ODBC Functions 320
40.1 odbc_init() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
40.2 odbc_drivers() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
40.3 odbc_datasources() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
40.4 odbc_close() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
40.5 Print List of ODBC Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
40.6 Print List of ODBC Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
40.7 odbc_connect() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
40.8 odbc_disconnect() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
40.9 Open and Close Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
40.10 odbc_execute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
40.11 odbc_colcount() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
40.12 odbc_fetch() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
40.13 odbc_getdata() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
40.14 Execute Query and Print Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
40.15 odbc_tables() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
40.16 odbc_columns() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
40.17 odbc_autocommit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
40.18 odbc_commit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
40.19 odbc_rollback() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
40.20 Transactions and Using Commit and Rollback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
40.21 Save and Restore images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
41 MySQL Functions 329
x
41.1 MySQL_Info() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
41.2 MySQL_Init() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
41.3 MySQL_Error() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
41.4 MySQL_Connect() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
41.5 MySQL_Close() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
41.6 MySQL_Query() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
41.7 Create Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
41.8 Create Table and Insert Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
41.9 MySQL_Insert_ID() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
41.10 MySQL_Result() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
41.11 MySQL_Next_Result() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
41.12 Print Query Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
41.13 MySQL_Columns() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
41.14 MySQL_Result2() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
41.15 MySQL_Escape_String() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
41.16 Save Image inside the database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
41.17 Restore Image From The Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
41.18 MySQL_AutoCommit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
41.19 MySQL_Commit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
41.20 MySQL_Rollback() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
41.21 Transaction Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
42 SQLite Functions 338
42.1 sqlite_init() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
42.2 sqlite_open() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
42.3 sqlite_execute() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
42.4 sqlite_close() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
42.5 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
43 PostgreSQL Functions 341
43.1 Loading the library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
43.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
43.3 RingPostgreSQL Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
43.4 RingPostgreSQL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
44 Security and Internet Functions 348
44.1 MD5() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
44.2 SHA1() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
44.3 SHA256() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
44.4 SHA512() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
44.5 SHA384() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
44.6 SHA224() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
44.7 Encrypt() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
44.8 Decrypt() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
44.9 Encryption and Decryption Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
44.10 File Hash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
44.11 Randbytes() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
44.12 Download() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
44.13 SendEmail() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353
45 Object Oriented Programming (OOP) 354
45.1 Classes and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354
45.2 Access Objects Using Braces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
45.3 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357
45.4 Setter and Getter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
xi
45.5 Private Attributes and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
45.6 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
45.7 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362
45.8 Dynamic Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
45.9 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
45.10 Printing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
45.11 Find() and List of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
45.12 Sort() and List of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
45.13 Using Self.Attribute and Self.Method() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
45.14 Using This.Attribute and This.Method() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
45.15 Using This in the class region as Self . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
45.16 Default value for object attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
46 Functional Programming 370
46.1 Pure Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
46.2 First-class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
46.3 Higher-order Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
46.4 Anonymous and Nested Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
46.5 Equality of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373
47 Reflection and Meta-programming 375
47.1 locals() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
47.2 globals() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376
47.3 functions() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
47.4 cfunctions() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
47.5 islocal() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
47.6 isglobal() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
47.7 isfunction() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
47.8 iscfunction() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
47.9 packages() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379
47.10 ispackage() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
47.11 classes() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
47.12 isclass() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381
47.13 packageclasses() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
47.14 ispackageclass() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
47.15 classname() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
47.16 objectid() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
47.17 isobject() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
47.18 attributes() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
47.19 methods() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
47.20 isattribute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
47.21 isprivateattribute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
47.22 ismethod() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
47.23 isprivatemethod() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
47.24 addattribute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
47.25 addmethod() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
47.26 getattribute() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389
47.27 setattribute() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390
47.28 mergemethods() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
47.29 packagename() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
48 Stdlib Functions 393
48.1 Puts() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
48.2 Print() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
xii
48.3 Print2Str() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
48.4 GetString() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
48.5 GetNumber() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
48.6 AppPath() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
48.7 JustFilePath() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
48.8 JustFileName() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
48.9 Value() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
48.10 Times() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
48.11 Map() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
48.12 Filter() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
48.13 Split() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
48.14 SplitMany() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
48.15 NewList() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
48.16 Capitalized() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
48.17 IsSpecial() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
48.18 IsVowel() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
48.19 LineCount() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
48.20 Factorial() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
48.21 Fibonacci() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
48.22 IsPrime() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
48.23 Sign() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
48.24 List2File() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
48.25 File2List() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
48.26 StartsWith() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
48.27 EndsWith() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400
48.28 GCD() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
48.29 LCM() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
48.30 SumList() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
48.31 ProdList() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
48.32 EvenOrOdd() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
48.33 Factors() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
48.34 IsPalindrome() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
48.35 IsLeapYear() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
48.36 BinaryDigits() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
48.37 MatrixMulti() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
48.38 MatrixTrans() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
48.39 DayOfWeek() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404
48.40 Permutation() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
48.41 ReadLine() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
48.42 SubString() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405
48.43 ChangeString() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
48.44 Sleep() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
48.45 IsMainSourceFile() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
48.46 DirExists() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
48.47 MakeDir() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
48.48 Fsize() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
48.49 TrimAll() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
48.50 TrimLeft() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
48.51 TrimRight() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
48.52 EpochTime() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
48.53 SystemCmd() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
48.54 ListAllFiles() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408
48.55 SystemSilent() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
48.56 OSCreateOpenFolder() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
xiii
48.57 OSCopyFolder() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
48.58 OSDeleteFolder() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
48.59 OSCopyFile() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
48.60 OSDeleteFile() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
48.61 OSRenameFile() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
48.62 List2Code() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
48.63 Str2ASCIIList() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
48.64 ASCIIList2Str() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
49 Stdlib Classes 412
49.1 StdBase Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412
49.2 String Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413
49.3 List Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
49.4 Stack Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
49.5 Queue Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
49.6 HashTable Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418
49.7 Tree Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
49.8 Math Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420
49.9 DateTime Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
49.10 File Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
49.11 System Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
49.12 Debug Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
49.13 DataType Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
49.14 Conversion Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
49.15 ODBC Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430
49.16 MySQL Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431
49.17 SQLite Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432
49.18 PostgreSQL Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433
49.19 Security Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
49.20 Internet Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435
50 Declarative Programming using Nested Structures 436
50.1 Creating Objects inside Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436
50.2 Composition and Returning Objects and Lists by Reference . . . . . . . . . . . . . . . . . . . . . . 437
50.3 Executing code after the end of object access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
50.4 Declarative Programming on the top of Object-Oriented . . . . . . . . . . . . . . . . . . . . . . . . 439
50.5 More beautiful Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440
51 Natural Language Programming 442
51.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
51.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442
51.3 Change the Ring Keyword ‘And’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443
51.4 Change the Ring Operator ‘+’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444
51.5 Change the ‘=’ operator to ‘is’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
51.6 Using Eval() with our Natural Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446
51.7 BraceStart and BraceEnd Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
51.8 BraceExprEval Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
51.9 Real Natural Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448
51.10 BraceError() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449
51.11 Clean Natural Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450
52 Using the Natural Library 452
52.1 Natural Library - Demo Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
52.2 Defining Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
52.3 Natural Library - Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
xiv
52.4 Defining commands using classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
53 Web Development (CGI Library) 459
53.1 Configure the Apache web server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
53.2 Ring CGI Hello World Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
53.3 Hello World Program using the Web Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
53.4 Web Library Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
53.5 HTTP Get Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
53.6 HTTP POST Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
53.7 Upload Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
53.8 Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471
53.9 URL Encode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
53.10 Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474
53.11 HTML Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476
53.12 Hash Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
53.13 Random Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
53.14 HTML Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
53.15 HTML Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
53.16 Gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
53.17 Generating Pages using Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
53.18 HtmlPage Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
53.19 Using Bootstrap Library using Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489
53.20 Using Bootstrap Library using Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
53.21 CRUD Example using MVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493
53.22 Users registration and Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
53.23 Database, ModelBase & ControllerBase classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
53.24 WebLib API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
53.25 Application Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
53.26 Page Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
53.27 ScriptFunctions Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510
53.28 StyleFunctions Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
53.29 WebPage Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
53.30 HtmlPage Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
54 Deploying Web Applications in the Cloud 513
54.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
54.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
54.3 Ring source code files and permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
54.4 Hello World program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
54.5 Application Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
54.6 Deploying after updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
54.7 Local Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
55 Using RingLibCurl 517
55.1 Get Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
55.2 Post Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
55.3 Facebook Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517
55.4 Save Output to String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
55.5 Get Stock Data From Yahoo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
56 Using RingZip 521
56.1 Create Zip File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
56.2 Extract Zip File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
56.3 Print Files in Zip file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
56.4 Using RingZip Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
xv
56.5 Zip Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
56.6 ZipEntry Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523
57 Graphics and 2D Games programming using RingAllegro 524
57.1 Drawing, Animation and Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524
57.2 Using TrueType Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531
57.3 Playing Sound Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532
57.4 Scaling and Rotating Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533
57.5 Display Transparent Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534
57.6 Using Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
58 Using RingLibSDL 538
58.1 Create Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
58.2 Display Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
58.3 Switch between two images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
58.4 Draw Rectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
58.5 Display PNG Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
58.6 Use TTF Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
58.7 Display Transparent Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
58.8 Close Window Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
58.9 Mouse Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542
58.10 Play Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543
59 Using RingLibuv 545
59.1 First Application using RingLibuv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545
59.2 The Events Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
59.3 Server Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546
59.4 Client Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548
59.5 Server Example Using Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549
59.6 Client Example Using Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550
59.7 Threads Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551
59.8 Threads Example - Using Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
60 Demo Project - Game Engine for 2D Games 553
60.1 Project Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
60.2 Graphics Library bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553
60.3 Interface to graphics library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
60.4 Game Engine Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
60.5 Games Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554
60.6 Game Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
60.7 GameObject Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
60.8 Sprite Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556
60.9 Text Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556
60.10 Animate Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
60.11 Sound Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
60.12 Map Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
60.13 Using the Game Engine - Creating the Game Window . . . . . . . . . . . . . . . . . . . . . . . . . 558
60.14 Using the Game Engine - Drawing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
60.15 Using the Game Engine - Moving Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
60.16 Using the Game Engine - Playing Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561
60.17 Using the Game Engine - Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562
60.18 Using the Game Engine - Animation and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 563
60.19 Using the Game Engine - Sprite - Automatic Movement using Keyboard . . . . . . . . . . . . . . . 565
60.20 Using the Game Engine - Sprite - Keypress event . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
60.21 Using the Game Engine - Sprite - Mouse event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566
xvi
60.22 Using the Game Engine - Sprite - State event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567
60.23 Using the Game Engine - Animate - Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568
60.24 Using the Game Engine - Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570
60.25 Using the Game Engine - Map Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572
60.26 Using the Game Engine - Object and Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
60.27 Stars Fighter Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576
60.28 Flappy Bird 3000 Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584
60.29 Super Man 2016 Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
61 Building Games For Android 603
61.1 Download Requirements and Update the Android SDK . . . . . . . . . . . . . . . . . . . . . . . . . 603
61.2 Project Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603
61.3 Building the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604
62 Using RingOpenGL and RingFreeGLUT for 3D Graphics 606
62.1 Samples Source (Authors) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606
62.2 What is RingOpenGL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606
62.3 What is RingFreeGLUT? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
62.4 The First Window using RingFreeGLUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
62.5 Drawing using RingOpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
62.6 The First Triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
62.7 Window Resize Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
62.8 Triangle Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612
62.9 Keyboard Events and Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613
62.10 The Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616
62.11 Mouse Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623
62.12 Menu Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626
62.13 Using Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
62.14 Frames Per Second . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
62.15 Make a Cube using RingOpenGL and RingFreeGLUT . . . . . . . . . . . . . . . . . . . . . . . . . 650
63 Using RingOpenGL and RingAllegro for 3D Graphics 654
63.1 3D Cube and Texture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654
63.2 Many Cubes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658
63.3 TicTacToe 3D Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 664
63.4 More 3D Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673
64 The Gold Magic 800 Game 676
64.1 The Game Story . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676
64.2 How to play? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676
64.3 What will you learn? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676
64.4 Screen Shots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
64.5 Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678
65 Desktop and Mobile development using RingQt 680
65.1 The First GUI Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680
65.2 The Events Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
65.3 Using Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682
65.4 Using the QTextEdit Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683
65.5 Using the QListWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684
65.6 Using QTreeView and QFileSystemModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
65.7 Using QTreeWidget and QTreeWidgetItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688
65.8 Using QComboBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690
65.9 Creating Menubar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691
65.10 Context Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693
xvii
65.11 Creating Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694
65.12 Creating StatusBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
65.13 Using QDockWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696
65.14 Using QTabWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697
65.15 Using QTableWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699
65.16 Using QProgressBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700
65.17 Using QSpinBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
65.18 Using QSlider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702
65.19 Using QDateEdit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703
65.20 Using QDial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704
65.21 Using QWebView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
65.22 Using QCheckBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708
65.23 Using QRadioButton and QButtonGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709
65.24 Adding Hyperlink to QLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711
65.25 QVideoWidget and QMediaPlayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712
65.26 Using QFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714
65.27 Display Image using QLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715
65.28 Menubar and StyleSheet Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716
65.29 QLineEdit Events and QMessageBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
65.30 Other Widgets Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720
65.31 Using the QTimer Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722
65.32 Using QProgressBar and Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723
65.33 Display Scaled Image using QLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724
65.34 Using the QFileDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725
65.35 Drawing using QPainter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726
65.36 Printing using QPrinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728
65.37 Using QPrintPreviewDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
65.38 Creating More than one Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731
65.39 Playing Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732
65.40 Using the QColorDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733
65.41 Using qLCDNumber Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734
65.42 Movable Label Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735
65.43 QMessagebox Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736
65.44 Using QInputDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737
65.45 Dialog Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738
65.46 KeyPress and Mouse Move Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739
65.47 Moving Objects using the Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740
65.48 Inheritance from GUI Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744
65.49 Using QDesktopWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745
65.50 Rotate Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746
65.51 Change Focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748
65.52 Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
65.53 Simple Client and Server Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750
65.54 Dynamic Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752
65.55 Weight History Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753
65.56 Notepad Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
65.57 The Cards Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 772
65.58 Classes and their Methods to use the default events . . . . . . . . . . . . . . . . . . . . . . . . . . . 778
65.59 Methods to use Events with Events Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781
65.60 The Difference between Qt and RingQt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782
65.61 RingQt Classes and their Qt Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783
65.62 New Classes names - Index Start from 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783
65.63 Creating Reports using the WebLib and the GUILib . . . . . . . . . . . . . . . . . . . . . . . . . . 784
xviii

Contenu connexe

Tendances

The Ring programming language version 1.5.2 book - Part 2 of 181
The Ring programming language version 1.5.2 book - Part 2 of 181The Ring programming language version 1.5.2 book - Part 2 of 181
The Ring programming language version 1.5.2 book - Part 2 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.5.1 book - Part 2 of 180
The Ring programming language version 1.5.1 book - Part 2 of 180The Ring programming language version 1.5.1 book - Part 2 of 180
The Ring programming language version 1.5.1 book - Part 2 of 180Mahmoud Samir Fayed
 
Architectures logicielles et materielles
Architectures logicielles et materiellesArchitectures logicielles et materielles
Architectures logicielles et materiellesAdnane Farid
 
The Ring programming language version 1.7 book - Part 3 of 196
The Ring programming language version 1.7 book - Part 3 of 196The Ring programming language version 1.7 book - Part 3 of 196
The Ring programming language version 1.7 book - Part 3 of 196Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 3 of 202
The Ring programming language version 1.8 book - Part 3 of 202The Ring programming language version 1.8 book - Part 3 of 202
The Ring programming language version 1.8 book - Part 3 of 202Mahmoud Samir Fayed
 
Liste instruction
Liste instructionListe instruction
Liste instructionAli Fsahi
 
La base de données Oracle
La base de données OracleLa base de données Oracle
La base de données OracleBruno Delb
 
2009 these servant (1)
2009 these servant (1)2009 these servant (1)
2009 these servant (1)bessem ellili
 
Twido guide materiel base extreme
Twido guide materiel   base extremeTwido guide materiel   base extreme
Twido guide materiel base extremeJohanna Mesa Torres
 

Tendances (20)

The Ring programming language version 1.5.2 book - Part 2 of 181
The Ring programming language version 1.5.2 book - Part 2 of 181The Ring programming language version 1.5.2 book - Part 2 of 181
The Ring programming language version 1.5.2 book - Part 2 of 181
 
The Ring programming language version 1.5.1 book - Part 2 of 180
The Ring programming language version 1.5.1 book - Part 2 of 180The Ring programming language version 1.5.1 book - Part 2 of 180
The Ring programming language version 1.5.1 book - Part 2 of 180
 
Architectures logicielles et materielles
Architectures logicielles et materiellesArchitectures logicielles et materielles
Architectures logicielles et materielles
 
Cours matlab
Cours matlabCours matlab
Cours matlab
 
Bedhboperation r41 fr
Bedhboperation r41 frBedhboperation r41 fr
Bedhboperation r41 fr
 
The Ring programming language version 1.7 book - Part 3 of 196
The Ring programming language version 1.7 book - Part 3 of 196The Ring programming language version 1.7 book - Part 3 of 196
The Ring programming language version 1.7 book - Part 3 of 196
 
The Ring programming language version 1.8 book - Part 3 of 202
The Ring programming language version 1.8 book - Part 3 of 202The Ring programming language version 1.8 book - Part 3 of 202
The Ring programming language version 1.8 book - Part 3 of 202
 
Matlab for engineer
Matlab for engineer Matlab for engineer
Matlab for engineer
 
Report MyProof
Report MyProofReport MyProof
Report MyProof
 
Algo
AlgoAlgo
Algo
 
B1
B1B1
B1
 
Rapport final
Rapport finalRapport final
Rapport final
 
Liste instruction
Liste instructionListe instruction
Liste instruction
 
Theorie du signal
Theorie du signalTheorie du signal
Theorie du signal
 
Oracle 11g exploitation
Oracle 11g exploitationOracle 11g exploitation
Oracle 11g exploitation
 
La base de données Oracle
La base de données OracleLa base de données Oracle
La base de données Oracle
 
Cbdsys 2
Cbdsys 2Cbdsys 2
Cbdsys 2
 
2009 these servant (1)
2009 these servant (1)2009 these servant (1)
2009 these servant (1)
 
Unity
UnityUnity
Unity
 
Twido guide materiel base extreme
Twido guide materiel   base extremeTwido guide materiel   base extreme
Twido guide materiel base extreme
 

Similaire à The Ring programming language version 1.10 book - Part 2 of 212

Automatisme) www.cours-online.com
Automatisme) www.cours-online.comAutomatisme) www.cours-online.com
Automatisme) www.cours-online.commorin moli
 
Introduction aux systèmes automatisés
Introduction aux systèmes automatisésIntroduction aux systèmes automatisés
Introduction aux systèmes automatisésmorin moli
 
The Ring programming language version 1.8 book - Part 1 of 202
The Ring programming language version 1.8 book - Part 1 of 202The Ring programming language version 1.8 book - Part 1 of 202
The Ring programming language version 1.8 book - Part 1 of 202Mahmoud 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 212The Ring programming language version 1.10 book - Part 1 of 212
The Ring programming language version 1.10 book - Part 1 of 212Mahmoud Samir Fayed
 
The Ring programming language version 1.4 book - Part 1 of 30
The Ring programming language version 1.4 book - Part 1 of 30The Ring programming language version 1.4 book - Part 1 of 30
The Ring programming language version 1.4 book - Part 1 of 30Mahmoud Samir Fayed
 
courspython3.pdf
courspython3.pdfcourspython3.pdf
courspython3.pdfDendouga1
 
LatexPourLeProfDeMaths.pdf
LatexPourLeProfDeMaths.pdfLatexPourLeProfDeMaths.pdf
LatexPourLeProfDeMaths.pdfWafaa Ibrihich
 
The Ring programming language version 1.9 book - Part 1 of 210
The Ring programming language version 1.9 book - Part 1 of 210The Ring programming language version 1.9 book - Part 1 of 210
The Ring programming language version 1.9 book - Part 1 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.4.1 book - Part 1 of 31
The Ring programming language version 1.4.1 book - Part 1 of 31The Ring programming language version 1.4.1 book - Part 1 of 31
The Ring programming language version 1.4.1 book - Part 1 of 31Mahmoud Samir Fayed
 
The Ring programming language version 1.10 book - Part 3 of 212
The Ring programming language version 1.10 book - Part 3 of 212The Ring programming language version 1.10 book - Part 3 of 212
The Ring programming language version 1.10 book - Part 3 of 212Mahmoud 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 88The Ring programming language version 1.3 book - Part 1 of 88
The Ring programming language version 1.3 book - Part 1 of 88Mahmoud Samir Fayed
 
Manuel du module additionnel RF-LAMINATE pour RFEM
Manuel du module additionnel RF-LAMINATE pour RFEMManuel du module additionnel RF-LAMINATE pour RFEM
Manuel du module additionnel RF-LAMINATE pour RFEMGrégoire Dupont
 
Base-de-données.pdf
Base-de-données.pdfBase-de-données.pdf
Base-de-données.pdfdjallel2
 
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 184The Ring programming language version 1.5.3 book - Part 1 of 184
The Ring programming language version 1.5.3 book - Part 1 of 184Mahmoud Samir Fayed
 
Les bases fondamentales du langage transact sql
Les bases fondamentales du langage transact sqlLes bases fondamentales du langage transact sql
Les bases fondamentales du langage transact sqlZineb Meryem
 
The Ring programming language version 1.7 book - Part 1 of 196
The Ring programming language version 1.7 book - Part 1 of 196The Ring programming language version 1.7 book - Part 1 of 196
The Ring programming language version 1.7 book - Part 1 of 196Mahmoud Samir Fayed
 

Similaire à The Ring programming language version 1.10 book - Part 2 of 212 (20)

Automatisme) www.cours-online.com
Automatisme) www.cours-online.comAutomatisme) www.cours-online.com
Automatisme) www.cours-online.com
 
Introduction aux systèmes automatisés
Introduction aux systèmes automatisésIntroduction aux systèmes automatisés
Introduction aux systèmes automatisés
 
Introduction à MATLAB
Introduction à MATLABIntroduction à MATLAB
Introduction à MATLAB
 
The Ring programming language version 1.8 book - Part 1 of 202
The Ring programming language version 1.8 book - Part 1 of 202The 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.10 book - Part 1 of 212
The Ring programming language version 1.10 book - Part 1 of 212The Ring programming language version 1.10 book - Part 1 of 212
The Ring programming language version 1.10 book - Part 1 of 212
 
The Ring programming language version 1.4 book - Part 1 of 30
The Ring programming language version 1.4 book - Part 1 of 30The Ring programming language version 1.4 book - Part 1 of 30
The Ring programming language version 1.4 book - Part 1 of 30
 
courspython3.pdf
courspython3.pdfcourspython3.pdf
courspython3.pdf
 
LatexPourLeProfDeMaths.pdf
LatexPourLeProfDeMaths.pdfLatexPourLeProfDeMaths.pdf
LatexPourLeProfDeMaths.pdf
 
The Ring programming language version 1.9 book - Part 1 of 210
The Ring programming language version 1.9 book - Part 1 of 210The Ring programming language version 1.9 book - Part 1 of 210
The Ring programming language version 1.9 book - Part 1 of 210
 
The Ring programming language version 1.4.1 book - Part 1 of 31
The Ring programming language version 1.4.1 book - Part 1 of 31The Ring programming language version 1.4.1 book - Part 1 of 31
The Ring programming language version 1.4.1 book - Part 1 of 31
 
Deviens un Ninja avec Angular2
Deviens un Ninja avec Angular2Deviens un Ninja avec Angular2
Deviens un Ninja avec Angular2
 
The Ring programming language version 1.10 book - Part 3 of 212
The Ring programming language version 1.10 book - Part 3 of 212The Ring programming language version 1.10 book - Part 3 of 212
The Ring programming language version 1.10 book - Part 3 of 212
 
The Ring programming language version 1.3 book - Part 1 of 88
The Ring programming language version 1.3 book - Part 1 of 88The Ring programming language version 1.3 book - Part 1 of 88
The Ring programming language version 1.3 book - Part 1 of 88
 
Tp sgbd gsi
Tp sgbd gsiTp sgbd gsi
Tp sgbd gsi
 
Protection-dun-réseau-dentreprise-via-un-firewall.pdf
Protection-dun-réseau-dentreprise-via-un-firewall.pdfProtection-dun-réseau-dentreprise-via-un-firewall.pdf
Protection-dun-réseau-dentreprise-via-un-firewall.pdf
 
Manuel du module additionnel RF-LAMINATE pour RFEM
Manuel du module additionnel RF-LAMINATE pour RFEMManuel du module additionnel RF-LAMINATE pour RFEM
Manuel du module additionnel RF-LAMINATE pour RFEM
 
Base-de-données.pdf
Base-de-données.pdfBase-de-données.pdf
Base-de-données.pdf
 
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 184The 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
 
Les bases fondamentales du langage transact sql
Les bases fondamentales du langage transact sqlLes bases fondamentales du langage transact sql
Les bases fondamentales du langage transact sql
 
The Ring programming language version 1.7 book - Part 1 of 196
The Ring programming language version 1.7 book - Part 1 of 196The Ring programming language version 1.7 book - Part 1 of 196
The Ring programming language version 1.7 book - Part 1 of 196
 

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 212The Ring programming language version 1.10 book - Part 212 of 212
The Ring programming language version 1.10 book - Part 212 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 211 of 212
The Ring programming language version 1.10 book - Part 211 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 210 of 212
The Ring programming language version 1.10 book - Part 210 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 208 of 212
The Ring programming language version 1.10 book - Part 208 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 207 of 212
The Ring programming language version 1.10 book - Part 207 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 205 of 212
The Ring programming language version 1.10 book - Part 205 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 206 of 212
The Ring programming language version 1.10 book - Part 206 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 204 of 212
The Ring programming language version 1.10 book - Part 204 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 203 of 212
The Ring programming language version 1.10 book - Part 203 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 202 of 212
The Ring programming language version 1.10 book - Part 202 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 201 of 212
The Ring programming language version 1.10 book - Part 201 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 200 of 212
The Ring programming language version 1.10 book - Part 200 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 199 of 212
The Ring programming language version 1.10 book - Part 199 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 198 of 212
The Ring programming language version 1.10 book - Part 198 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 197 of 212
The Ring programming language version 1.10 book - Part 197 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 196 of 212
The Ring programming language version 1.10 book - Part 196 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 195 of 212
The Ring programming language version 1.10 book - Part 195 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 194 of 212
The Ring programming language version 1.10 book - Part 194 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 193 of 212
The Ring programming language version 1.10 book - Part 193 of 212Mahmoud 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 212The Ring programming language version 1.10 book - Part 192 of 212
The Ring programming language version 1.10 book - Part 192 of 212Mahmoud 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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 212The 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.10 book - Part 2 of 212

  • 1. 34.19 Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 34.20 Number() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 34.21 String() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287 34.22 Ascii() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 34.23 Char() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 34.24 Hex() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 34.25 Dec() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288 34.26 Str2hex() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 34.27 Hex2str() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 35 Mathematical Functions 290 35.1 List of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 35.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290 35.3 Random() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292 35.4 SRandom() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 35.5 Unsigned() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293 35.6 Decimals() Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 35.7 Using _ in numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294 35.8 Using f after numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 36 Files 296 36.1 Read() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 36.2 Write() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 36.3 Dir() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297 36.4 Rename() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 36.5 Remove() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 36.6 Fopen() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298 36.7 Fclose() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 36.8 Fflush() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 36.9 Freopen() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299 36.10 Tempfile() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 36.11 Tempname() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 36.12 Fseek() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 36.13 Ftell() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300 36.14 Rewind() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 36.15 Fgetpos() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 36.16 Fsetpos() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 36.17 Clearerr() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 36.18 Feof() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 36.19 Ferror() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301 36.20 Perror() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 36.21 Fgetc() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 36.22 Fgets() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 36.23 Fputc() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 36.24 Fputs() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 36.25 Ungetc() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302 36.26 Fread() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 36.27 Fwrite() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 36.28 Fexists() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 36.29 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303 36.30 Numbers and Bytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305 37 System Functions 306 37.1 System() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306 ix
  • 2. 37.2 SysGet() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 37.3 IsMSDOS() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 37.4 IsWindows() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 37.5 IsWindows64() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 37.6 IsUnix() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307 37.7 IsMacOSX() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 37.8 IsLinux() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 37.9 IsFreeBSD() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 37.10 IsAndroid() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 37.11 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308 37.12 Windowsnl() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 37.13 Get Command Line Arguments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309 37.14 Get Active Source File Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 37.15 PrevFileName() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 310 37.16 CurrentDir() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 37.17 ExeFileName() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 37.18 ChDir() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 37.19 ExeFolder() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 37.20 Version() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311 37.21 Shutdown() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312 38 Eval() and Debugging 313 38.1 Try/Catch/Done . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 38.2 Eval() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 38.3 Raise() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314 38.4 Assert() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315 39 Demo Programs 316 39.1 Language Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316 39.2 Main Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317 40 ODBC Functions 320 40.1 odbc_init() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320 40.2 odbc_drivers() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 40.3 odbc_datasources() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 40.4 odbc_close() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 40.5 Print List of ODBC Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 40.6 Print List of ODBC Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322 40.7 odbc_connect() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 40.8 odbc_disconnect() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 40.9 Open and Close Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 40.10 odbc_execute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 40.11 odbc_colcount() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323 40.12 odbc_fetch() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 40.13 odbc_getdata() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 40.14 Execute Query and Print Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 40.15 odbc_tables() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324 40.16 odbc_columns() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 40.17 odbc_autocommit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 40.18 odbc_commit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 40.19 odbc_rollback() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 40.20 Transactions and Using Commit and Rollback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326 40.21 Save and Restore images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327 41 MySQL Functions 329 x
  • 3. 41.1 MySQL_Info() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329 41.2 MySQL_Init() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 41.3 MySQL_Error() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 41.4 MySQL_Connect() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 41.5 MySQL_Close() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 41.6 MySQL_Query() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330 41.7 Create Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 41.8 Create Table and Insert Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331 41.9 MySQL_Insert_ID() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332 41.10 MySQL_Result() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 41.11 MySQL_Next_Result() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 41.12 Print Query Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 41.13 MySQL_Columns() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 41.14 MySQL_Result2() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 41.15 MySQL_Escape_String() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 41.16 Save Image inside the database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335 41.17 Restore Image From The Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 41.18 MySQL_AutoCommit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 41.19 MySQL_Commit() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 41.20 MySQL_Rollback() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 41.21 Transaction Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336 42 SQLite Functions 338 42.1 sqlite_init() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 42.2 sqlite_open() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 42.3 sqlite_execute() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 42.4 sqlite_close() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338 42.5 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 43 PostgreSQL Functions 341 43.1 Loading the library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 43.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341 43.3 RingPostgreSQL Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344 43.4 RingPostgreSQL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345 44 Security and Internet Functions 348 44.1 MD5() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348 44.2 SHA1() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 44.3 SHA256() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 44.4 SHA512() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349 44.5 SHA384() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 44.6 SHA224() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 44.7 Encrypt() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350 44.8 Decrypt() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 44.9 Encryption and Decryption Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351 44.10 File Hash . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 44.11 Randbytes() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 44.12 Download() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352 44.13 SendEmail() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 353 45 Object Oriented Programming (OOP) 354 45.1 Classes and Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354 45.2 Access Objects Using Braces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356 45.3 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357 45.4 Setter and Getter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 xi
  • 4. 45.5 Private Attributes and Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 45.6 Operator Overloading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 45.7 Inheritance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 45.8 Dynamic Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 45.9 Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 45.10 Printing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 45.11 Find() and List of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 45.12 Sort() and List of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365 45.13 Using Self.Attribute and Self.Method() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 45.14 Using This.Attribute and This.Method() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367 45.15 Using This in the class region as Self . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368 45.16 Default value for object attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369 46 Functional Programming 370 46.1 Pure Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370 46.2 First-class Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 46.3 Higher-order Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371 46.4 Anonymous and Nested Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372 46.5 Equality of functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 373 47 Reflection and Meta-programming 375 47.1 locals() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 47.2 globals() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 376 47.3 functions() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 47.4 cfunctions() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377 47.5 islocal() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 47.6 isglobal() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378 47.7 isfunction() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 47.8 iscfunction() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 47.9 packages() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 47.10 ispackage() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 47.11 classes() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 47.12 isclass() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 381 47.13 packageclasses() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 47.14 ispackageclass() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382 47.15 classname() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 47.16 objectid() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 47.17 isobject() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 47.18 attributes() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 47.19 methods() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 47.20 isattribute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 47.21 isprivateattribute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 47.22 ismethod() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 47.23 isprivatemethod() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386 47.24 addattribute() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 47.25 addmethod() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 47.26 getattribute() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 47.27 setattribute() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 390 47.28 mergemethods() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 47.29 packagename() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392 48 Stdlib Functions 393 48.1 Puts() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 48.2 Print() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393 xii
  • 5. 48.3 Print2Str() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 48.4 GetString() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 48.5 GetNumber() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 48.6 AppPath() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 48.7 JustFilePath() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394 48.8 JustFileName() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 48.9 Value() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 48.10 Times() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395 48.11 Map() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 48.12 Filter() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 48.13 Split() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396 48.14 SplitMany() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 48.15 NewList() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 48.16 Capitalized() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397 48.17 IsSpecial() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 48.18 IsVowel() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 48.19 LineCount() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 48.20 Factorial() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398 48.21 Fibonacci() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 48.22 IsPrime() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 48.23 Sign() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399 48.24 List2File() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 48.25 File2List() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 48.26 StartsWith() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 48.27 EndsWith() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 400 48.28 GCD() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 48.29 LCM() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 48.30 SumList() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401 48.31 ProdList() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402 48.32 EvenOrOdd() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402 48.33 Factors() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402 48.34 IsPalindrome() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 48.35 IsLeapYear() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 48.36 BinaryDigits() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403 48.37 MatrixMulti() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 48.38 MatrixTrans() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 48.39 DayOfWeek() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 404 48.40 Permutation() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 48.41 ReadLine() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 48.42 SubString() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 405 48.43 ChangeString() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406 48.44 Sleep() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406 48.45 IsMainSourceFile() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 406 48.46 DirExists() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 48.47 MakeDir() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 48.48 Fsize() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 48.49 TrimAll() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 48.50 TrimLeft() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 48.51 TrimRight() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 48.52 EpochTime() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 48.53 SystemCmd() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 48.54 ListAllFiles() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 408 48.55 SystemSilent() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 48.56 OSCreateOpenFolder() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 xiii
  • 6. 48.57 OSCopyFolder() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 48.58 OSDeleteFolder() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409 48.59 OSCopyFile() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 48.60 OSDeleteFile() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 48.61 OSRenameFile() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 48.62 List2Code() Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 48.63 Str2ASCIIList() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410 48.64 ASCIIList2Str() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411 49 Stdlib Classes 412 49.1 StdBase Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 412 49.2 String Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 413 49.3 List Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 49.4 Stack Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 49.5 Queue Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 49.6 HashTable Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 418 49.7 Tree Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419 49.8 Math Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 420 49.9 DateTime Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424 49.10 File Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425 49.11 System Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426 49.12 Debug Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427 49.13 DataType Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428 49.14 Conversion Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429 49.15 ODBC Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430 49.16 MySQL Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431 49.17 SQLite Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 432 49.18 PostgreSQL Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433 49.19 Security Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 49.20 Internet Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 435 50 Declarative Programming using Nested Structures 436 50.1 Creating Objects inside Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436 50.2 Composition and Returning Objects and Lists by Reference . . . . . . . . . . . . . . . . . . . . . . 437 50.3 Executing code after the end of object access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439 50.4 Declarative Programming on the top of Object-Oriented . . . . . . . . . . . . . . . . . . . . . . . . 439 50.5 More beautiful Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 440 51 Natural Language Programming 442 51.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 51.2 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 442 51.3 Change the Ring Keyword ‘And’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 443 51.4 Change the Ring Operator ‘+’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444 51.5 Change the ‘=’ operator to ‘is’ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445 51.6 Using Eval() with our Natural Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446 51.7 BraceStart and BraceEnd Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447 51.8 BraceExprEval Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 51.9 Real Natural Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 448 51.10 BraceError() Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 449 51.11 Clean Natural Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 450 52 Using the Natural Library 452 52.1 Natural Library - Demo Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452 52.2 Defining Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454 52.3 Natural Library - Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 xiv
  • 7. 52.4 Defining commands using classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457 53 Web Development (CGI Library) 459 53.1 Configure the Apache web server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459 53.2 Ring CGI Hello World Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 53.3 Hello World Program using the Web Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460 53.4 Web Library Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 53.5 HTTP Get Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461 53.6 HTTP POST Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466 53.7 Upload Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468 53.8 Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 471 53.9 URL Encode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473 53.10 Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 474 53.11 HTML Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476 53.12 Hash Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477 53.13 Random Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479 53.14 HTML Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480 53.15 HTML Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482 53.16 Gradient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483 53.17 Generating Pages using Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484 53.18 HtmlPage Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488 53.19 Using Bootstrap Library using Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 489 53.20 Using Bootstrap Library using Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490 53.21 CRUD Example using MVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 493 53.22 Users registration and Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495 53.23 Database, ModelBase & ControllerBase classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501 53.24 WebLib API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506 53.25 Application Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508 53.26 Page Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508 53.27 ScriptFunctions Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 510 53.28 StyleFunctions Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 53.29 WebPage Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511 53.30 HtmlPage Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512 54 Deploying Web Applications in the Cloud 513 54.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 54.2 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513 54.3 Ring source code files and permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514 54.4 Hello World program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 54.5 Application Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 54.6 Deploying after updates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515 54.7 Local Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516 55 Using RingLibCurl 517 55.1 Get Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 55.2 Post Request . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 55.3 Facebook Login . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 517 55.4 Save Output to String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518 55.5 Get Stock Data From Yahoo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519 56 Using RingZip 521 56.1 Create Zip File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 56.2 Extract Zip File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 56.3 Print Files in Zip file . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 56.4 Using RingZip Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521 xv
  • 8. 56.5 Zip Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 56.6 ZipEntry Class Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 523 57 Graphics and 2D Games programming using RingAllegro 524 57.1 Drawing, Animation and Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524 57.2 Using TrueType Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 531 57.3 Playing Sound Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 532 57.4 Scaling and Rotating Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 533 57.5 Display Transparent Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 534 57.6 Using Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535 58 Using RingLibSDL 538 58.1 Create Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538 58.2 Display Image . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538 58.3 Switch between two images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 58.4 Draw Rectangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539 58.5 Display PNG Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 58.6 Use TTF Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 58.7 Display Transparent Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540 58.8 Close Window Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541 58.9 Mouse Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 542 58.10 Play Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543 59 Using RingLibuv 545 59.1 First Application using RingLibuv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 545 59.2 The Events Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546 59.3 Server Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 546 59.4 Client Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 548 59.5 Server Example Using Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 549 59.6 Client Example Using Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 550 59.7 Threads Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551 59.8 Threads Example - Using Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552 60 Demo Project - Game Engine for 2D Games 553 60.1 Project Layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 60.2 Graphics Library bindings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 553 60.3 Interface to graphics library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 60.4 Game Engine Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 60.5 Games Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 554 60.6 Game Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555 60.7 GameObject Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555 60.8 Sprite Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 60.9 Text Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556 60.10 Animate Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 60.11 Sound Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 60.12 Map Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557 60.13 Using the Game Engine - Creating the Game Window . . . . . . . . . . . . . . . . . . . . . . . . . 558 60.14 Using the Game Engine - Drawing Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558 60.15 Using the Game Engine - Moving Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 559 60.16 Using the Game Engine - Playing Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 561 60.17 Using the Game Engine - Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 562 60.18 Using the Game Engine - Animation and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 563 60.19 Using the Game Engine - Sprite - Automatic Movement using Keyboard . . . . . . . . . . . . . . . 565 60.20 Using the Game Engine - Sprite - Keypress event . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 60.21 Using the Game Engine - Sprite - Mouse event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 566 xvi
  • 9. 60.22 Using the Game Engine - Sprite - State event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567 60.23 Using the Game Engine - Animate - Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 568 60.24 Using the Game Engine - Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 570 60.25 Using the Game Engine - Map Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 572 60.26 Using the Game Engine - Object and Drawing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573 60.27 Stars Fighter Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576 60.28 Flappy Bird 3000 Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 584 60.29 Super Man 2016 Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591 61 Building Games For Android 603 61.1 Download Requirements and Update the Android SDK . . . . . . . . . . . . . . . . . . . . . . . . . 603 61.2 Project Folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 603 61.3 Building the project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 604 62 Using RingOpenGL and RingFreeGLUT for 3D Graphics 606 62.1 Samples Source (Authors) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 62.2 What is RingOpenGL? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 606 62.3 What is RingFreeGLUT? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 62.4 The First Window using RingFreeGLUT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607 62.5 Drawing using RingOpenGL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608 62.6 The First Triangle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610 62.7 Window Resize Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611 62.8 Triangle Rotation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612 62.9 Keyboard Events and Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 613 62.10 The Camera . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 616 62.11 Mouse Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 623 62.12 Menu Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626 62.13 Using Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633 62.14 Frames Per Second . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641 62.15 Make a Cube using RingOpenGL and RingFreeGLUT . . . . . . . . . . . . . . . . . . . . . . . . . 650 63 Using RingOpenGL and RingAllegro for 3D Graphics 654 63.1 3D Cube and Texture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 654 63.2 Many Cubes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 658 63.3 TicTacToe 3D Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 664 63.4 More 3D Samples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 673 64 The Gold Magic 800 Game 676 64.1 The Game Story . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 64.2 How to play? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 64.3 What will you learn? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 676 64.4 Screen Shots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677 64.5 Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678 65 Desktop and Mobile development using RingQt 680 65.1 The First GUI Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680 65.2 The Events Loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 65.3 Using Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 682 65.4 Using the QTextEdit Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 683 65.5 Using the QListWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 684 65.6 Using QTreeView and QFileSystemModel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687 65.7 Using QTreeWidget and QTreeWidgetItem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 688 65.8 Using QComboBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 690 65.9 Creating Menubar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 691 65.10 Context Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693 xvii
  • 10. 65.11 Creating Toolbar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 694 65.12 Creating StatusBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695 65.13 Using QDockWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696 65.14 Using QTabWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 697 65.15 Using QTableWidget . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 699 65.16 Using QProgressBar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 700 65.17 Using QSpinBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701 65.18 Using QSlider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 702 65.19 Using QDateEdit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 703 65.20 Using QDial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 704 65.21 Using QWebView . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707 65.22 Using QCheckBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 708 65.23 Using QRadioButton and QButtonGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709 65.24 Adding Hyperlink to QLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 711 65.25 QVideoWidget and QMediaPlayer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 712 65.26 Using QFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714 65.27 Display Image using QLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 715 65.28 Menubar and StyleSheet Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 716 65.29 QLineEdit Events and QMessageBox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718 65.30 Other Widgets Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720 65.31 Using the QTimer Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 722 65.32 Using QProgressBar and Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 723 65.33 Display Scaled Image using QLabel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 724 65.34 Using the QFileDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725 65.35 Drawing using QPainter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 726 65.36 Printing using QPrinter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 728 65.37 Using QPrintPreviewDialog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729 65.38 Creating More than one Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 731 65.39 Playing Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732 65.40 Using the QColorDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 733 65.41 Using qLCDNumber Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 734 65.42 Movable Label Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735 65.43 QMessagebox Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 736 65.44 Using QInputDialog Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 737 65.45 Dialog Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 738 65.46 KeyPress and Mouse Move Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739 65.47 Moving Objects using the Mouse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 740 65.48 Inheritance from GUI Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 744 65.49 Using QDesktopWidget Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745 65.50 Rotate Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 746 65.51 Change Focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 748 65.52 Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749 65.53 Simple Client and Server Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750 65.54 Dynamic Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 752 65.55 Weight History Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 753 65.56 Notepad Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757 65.57 The Cards Game . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 772 65.58 Classes and their Methods to use the default events . . . . . . . . . . . . . . . . . . . . . . . . . . . 778 65.59 Methods to use Events with Events Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781 65.60 The Difference between Qt and RingQt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 782 65.61 RingQt Classes and their Qt Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783 65.62 New Classes names - Index Start from 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 783 65.63 Creating Reports using the WebLib and the GUILib . . . . . . . . . . . . . . . . . . . . . . . . . . 784 xviii