Ring
Version 1.0
The Ring is an Innovative and practical general-purpose multi-paradigm scripting language that can be embedded in C/C++ projects, extended using C/C++ code and/or used as standalone language. The supported programming paradigms are Imperative, Procedural, Object-Oriented, Functional, Meta programming, Declarative programming using nested structures, and Natural programming. The language is portable (Windows, Linux, Mac OS X, Android, etc.) and can be used to create Console, GUI, Web, Games and Mobile applications. The language is designed to be Simple, Small, Flexible and Fast. Its Dynamic Language (Dynamic Typing and Weakly Typed) that compile the source code to byte code then execute it by the Ring Virtual Machine, which is integrated with the Ring Compiler in one program. The first version of the language (around 100,000 lines of C/C++/Ring code) is released on January 25th, 2016
Basic
[edit | edit source]Getting Started
[edit | edit source]- Introduction to Ring
- Motivation
- History
- Features
- Hello World
- Run the program
- Not Case-Sensitive
- Multi-Line literals
- Getting Input
- No Explicit End For Statements
- Writing Comments
Variables
[edit | edit source]Operators
[edit | edit source]- Operators
- Arithmetic Operators
- Relational Operators
- Logical Operators
- Bitwise Operators
- Assignment Operators
- Misc Operators
- Operators Precedence
Control Structures
[edit | edit source]- Control Structures
- Branching
- Looping
- Using The Step option with For in
- Using For in to modify lists
- Do Again Loop
- Exit Command
- Exit from two loops
- Exit/Loop inside sub functions
- Short-circuit evaluation
- Comments about evaluation
Getting Input
[edit | edit source]Functions
[edit | edit source]- Functions
- Define Functions
- Call Functions
- Declare parameters
- Send Parameters
- Main Function
- Variables Scope
- Program Structure
- Return Value
- Recursion
Lists
[edit | edit source]- Lists
- Create Lists
- Add Items
- Get List Size
- Delete Item From List
- Get List Item
- Set List Item
- Search
- Sort
- Reverse
- Insert Items
- Nested Lists
- Copy Lists
- First-class lists
- Using Lists during definition
- Access List Items by String Index
- Passing Parameters Using List
Strings
[edit | edit source]- Strings
- String Literals
- Get String Length
- Convert Letters Case
- Access String Letters
- Left() Function
- Right() Function
- Trim() Function
- Copy() Function
- Lines() Function
- Substr() Function
- Find substring
- Get substring from position to end
- Get Number of Characters From Position
- Transform Substring To Another Substring
- strcmp() Function
- str2list() and list2str() Functions
Date and Time
[edit | edit source]- Date and Time
- Clock() Function
- Time() Function
- Date() Function
- TimeList() Function
- AddDays() Function
- DiffDays() Function
Check Data Type and Conversion
[edit | edit source]- Check Data Type and Conversion
- Check Data Type
- IsString() Function
- IsNumber() Function
- IsList() Function
- Type() Function
- IsNULL() Function
- Check Character
- IsAlNum() Function
- IsAlpha() Function
- IsCntrl() Function
- IsDigit() Function
- IsGraph() Function
- IsLower() Function
- IsPrint() Function
- IsPunct() Function
- IsSpace() Function
- IsUpper() Function
- IsXdigit() Function
- Conversion
- Number() Function
- String() Function
- Ascii() Function
- Char() Function
- Hex() Function
- Dec() Function
- Str2hex() Function
- Hex2str() Function
Mathematical Functions
[edit | edit source]- Mathematical Functions
- List of functions
- Example
- Random() Function
- Unsigned() Function
- Decimals() Functions
Files
[edit | edit source]- Files
- Read() Function
- Write() Function
- Dir() Function
- Rename() Function
- Remove() Function
- Fopen() Function
- Fclose() Function
- Fflush() Function
- Freopen() Function
- Tempfile() Function
- Tempname() Function
- Fseek() Function
- Ftell() Function
- Rewind() Function
- Fgetpos() Function
- Fsetpos() Function
- Clearerr() Function
- Feof() Function
- Ferror() Function
- Perror() Function
- Fgetc() Function
- Fgets() Function
- Fputc() Function
- Fputs() Function
- Ungetc() Function
- Fread() Function
- Fwrite() Function
- Fexists() Function
- Example
System Functions
[edit | edit source]- System Functions
- System() Function
- Get() Function
- IsMSDOS()
- IsWindows()
- IsWindows64()
- IsUnix()
- IsMacOSX()
- IsLinux()
- IsFreeBSD()
- IsAndroid()
- Example
- Windowsnl()
- Get Command Line Arguments
- Get Active Source File Name
Eval() and Debugging
[edit | edit source]Demo Programs
[edit | edit source]ODBC Functions
[edit | edit source]- ODBC Functions
- odbc_init() Function
- odbc_drivers() Function
- odbc_datasources() Function
- odbc_close() Function
- Print List of ODBC Drivers
- Print List of ODBC Data Sources
- odbc_connect() Function
- odbc_disconnect() Function
- Open and Close Connection
- odbc_execute() Function
- odbc_colcount() Function
- odbc_fetch() Function
- odbc_getdata() Function
- Execute Query and Print Result
- odbc_tables() Function
- odbc_columns() Function
- odbc_autocommit() Function
- odbc_commit() Function
- odbc_rollback() Function
- Transactions and Using Commit and Rollback
- Save and Restore images
MySQL Functions
[edit | edit source]- MySQL Functions
- MySQL_Info() Function
- MySQL_Init() Function
- MySQL_Error() Function
- MySQL_Connect() Function
- MySQL_Close() Function
- MySQL_Query() Function
- Create Database
- Create Table and Insert Data
- MySQL_Insert_ID() Function
- MySQL_Result() Function
- MySQL_Next_Result() Function
- Print Query Result
- MySQL_Columns() Function
- MySQL_Result2() Function
- MySQL_Escape_String() Function
- Save Image inside the database
- Restore Image From The Database
- MySQL_AutoCommit() Function
- MySQL_Commit() Function
- MySQL_Rollback() Function
- Transaction Example
Security and Internet Functions
[edit | edit source]- Security and Internet Functions
- MD5() Function
- SHA1() Function
- SHA256() Function
- SHA512() Function
- SHA384() Function
- SHA224() Function
- Encrypt() Function
- Decrypt() Function
- Encryption and Decryption Example
- File Hash
- Randbytes() Function
- Download() Function
- SendEmail() Function
Object Oriented Programming (OOP)
[edit | edit source]- Object Oriented Programming (OOP)
- Classes and Objects
- Access Objects Using Braces
- Composition
- Setter and Getter
- Operator Overloading
- Inheritance
- Dynamic Attributes
- Packages
- Printing Objects
Declarative Programming using Nested Structures
[edit | edit source]- Declarative Programming using Nested Structures
- Creating Objects inside Lists
- Composition and Returning Objects and Lists by Reference
- Executing code after the end of object access
- Declarative Programming on the top of Object-Oriented
- More beautiful Code
Natural Language Programming
[edit | edit source]Functional Programming
[edit | edit source]- Functional Programming
- Pure Functions
- First-class Functions
- Higher-order Functions
- Anonymous and Nested Functions
- Equality of functions
Reflection and Meta-programming
[edit | edit source]- Reflection and Meta-programming
- locals() Function
- globals() Function
- functions() Function
- cfunctions() Function
- islocal() Function
- isglobal() Function
- isfunction() Function
- iscfunction() Function
- packages() Function
- ispackage() Function
- classes() Function
- isclass() Function
- packageclasses() Function
- ispackageclass() Function
- classname() Function
- objectid() Function
- attributes() Function
- isattribute() Function
- isprivateattribute() Function
- ismethod() Function
- isprivatemethod() Function
- addattribute() Function
- addmethod() Function
- getattribute() function
- setattribute() function
- mergemethods() Function
Extension using the C/C++ languages
[edit | edit source]- Extension using the C/C++ languages
- ring_ext.h
- ring_ext.c
- Module Organization
- Function Structure
- Check Parameters Count
- Display Error Message
- Check Parameters Type
- Get Parameters Values
- Return Value
- Function Prototype
- Sin() Function Implementation
- Fopen() and Fclose() Functions Implementation
- Ring API - List Functions
- Ring API - String Functions
- MySQL_Columns() Function Implementation
- Dynamic/Shared Libraries (DLL/So) and LoadLib() function
Embedding Ring Interpreter in C/C++ Programs
[edit | edit source]Command Line Options
[edit | edit source]- Command Line Options
- Printing Tokens
- Printing Rules
- Printing Intermediate Code
- Printing Final Intermediate Code
- CGI Support
- No Run
- Printing Instruction Operation Code
- Performance
Web Development (CGI Library)
[edit | edit source]- Web Development (CGI Library)
- Ring CGI Hello World Program
- Hello World Program using the Web Library
- Web Library Features
- HTTP Get Example
- HTTP POST Example
- Upload Files
- Cookies
- URL Encode
- Templates
- HTML Special Characters
- Hash Functions
- Random Image
- HTML Lists
- HTML Tables
- Gradient
- Generating Pages using Objects
- Using Bootstrap Library using Functions
- Using Bootstrap Library using Objects
- CRUD Example using MVC
- Users registration and Login
- Database, ModelBase & ControllerBase classes
- WebLib API
- Application Class
- Page Class
- ScriptFunctions Class
- StyleFunctions Class
Code Generator for wrapping C/C++ Libraries
[edit | edit source]- Code Generator for wrapping C/C++ Libraries
- Using the tool
- Configuration file
- Using the function prototype
- Adding code to the generated code
- Prefix for Functions Names
- Generate function to wrap structures
- Register New Functions
- Writing comments in the configuration file
- Executing code during code generation
- Configuration file for the Allegro Library
- Threads Support
- Code Generator Rules for Wrapping C++ Classes
- Using configuration file that wrap C++ Library
- Configuration file for the Qt Framework
Graphics and 2D Games programming using RingAllegro
[edit | edit source]- Graphics and 2D Games programming using RingAllegro
- Drawing, Animation and Input
- Using TrueType Fonts
- Playing Sound Files
- Scaling and Rotating Images
- Display Transparent Image
- Using Threads
Desktop and Mobile development using RingQt
[edit | edit source]- Desktop and Mobile development using RingQt
- The First GUI Application
- Using Layout
- Using the QTextEdit Class
- Using the QListWidget Class
- Using QTreeView and QFileSystemModel
- Using QTreeWidget and QTreeWidgetItem
- Using QComboBox Class
- Creating Menubar
- Creating Toolbar
- Creating StatusBar
- Using QDockWidget
- Using QTabWidget
- Using QTableView
- Using QProgressBar
- Using QSpinBox
- Using QSlider
- Using QDateEdit
- Using QDial
- Using QWebView
- Using QCheckBox
- Using QRadioButton and QButtonGroup
- Adding Hyperlink to QLabel
- QVideoWidget and QMediaPlayer
- Using QFrame
- Display Image using QLabel
- Menubar and StyleSheet Example
- QLineEdit Events and QMessageBox
- Other Widgets Events
- Using the QTimer Class
- Using the QFileDialog Class
- Drawing using QPainter
- Printing using QPrinter
- Creating More than one Window
- Playing Sound
- Using qLCDNumber Class
- Movable Label Example
- QMessagebox Example
- Using QInputDialog Class
- KeyPress and Mouse Move Events
- Moving Objects using the Mouse
- Inheritance from GUI Classes
- Using QDesktopWidget Class
- Simple Client and Server Example
- Notepad Application
- The Cards Game