Ring

An introduction to The Ring Programming Language

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

Getting Started

 * 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

 * Variables
 * Dynamic Typing
 * Deep Copy
 * Weekly Typed

Operators

 * Operators
 * Arithmetic Operators
 * Relational Operators
 * Logical Operators
 * Bitwise Operators
 * Assignment Operators
 * Misc Operators
 * Operators Precedence

Control Structures

 * 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

 * Getting Input
 * Give Command
 * GetChar Function
 * Input Function

Functions

 * Functions
 * Define Functions
 * Call Functions
 * Declare parameters
 * Send Parameters
 * Main Function
 * Variables Scope
 * Program Structure
 * Return Value
 * Recursion

Lists

 * 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

 * 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

 * Date and Time
 * Clock Function
 * Time Function
 * Date Function
 * TimeList Function
 * AddDays Function
 * DiffDays Function

Check Data Type and Conversion

 * 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

 * Mathematical Functions
 * List of functions
 * Example
 * Random Function
 * Unsigned Function
 * Decimals Functions

Files

 * 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

 * 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

 * Eval and Debugging
 * Try/Catch/Done
 * Eval Function
 * Raise Function
 * Assert Function

Demo Programs

 * Demo Programs
 * Language Shell
 * Main Menu

ODBC Functions

 * 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

 * 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

 * 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)

 * 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

 * 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

 * Natural Language Programming
 * History
 * Example

Functional Programming

 * Functional Programming
 * Pure Functions
 * First-class Functions
 * Higher-order Functions
 * Anonymous and Nested Functions
 * Equality of functions

Reflection and Meta-programming

 * 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

 * 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

 * Embedding Ring Interpreter in C/C++ Programs
 * Ring State
 * Ring State Functions
 * Ring State Variables

Command Line Options

 * 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)

 * 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

 * 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

 * 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

 * 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