This document provides examples of using multiple source code files in a Ring project and summarizing the output of the StrCmp() string comparison function. It also demonstrates how to create an array of buttons in a GUI application and shows how to create a modal window.
The Ring programming language version 1.6 book - Part 183 of 189Mahmoud Samir Fayed
Here are the key steps to connect to a dBASE or Harbour database using ODBC in Ring:
1. Install the appropriate ODBC driver for the database you want to connect to (e.g. Microsoft dBase Driver for dBASE files, Visual FoxPro ODBC driver for Visual FoxPro databases).
2. Initialize an ODBC connection handle using odbc_init().
3. Connect to the database using odbc_connect(), passing the connection string with the driver name and data source. For example:
odbc_connect(pODBC, "Driver={Microsoft dBase Driver (*.dbf)};datasource=c:\path\to\database.dbf")
4
The Ring programming language version 1.5.2 book - Part 175 of 181Mahmoud Samir Fayed
This document discusses how to work with multiple source code files in a Ring project. It provides an example project structure with three source code files across two folders. It shows how to load and call functions defined in the external files from the main source file. Running the Ring compiler from the project folder compiles and links all the files together.
The Ring programming language version 1.5.4 book - Part 179 of 185Mahmoud Samir Fayed
This document discusses how to create modal and non-modal windows in a GUI application using Ring and Qt. It shows an example of opening a modal window from a button click that prevents interaction with the main window until the modal window is closed. It also demonstrates closing the initial window and opening a new main window. Key aspects covered are using setWindowModality(), setParent(), and window flags to control modality, as well as closing and showing windows at different points.
The Ring programming language version 1.5.3 book - Part 188 of 194Mahmoud Samir Fayed
This document provides instructions and examples for connecting to and querying a SQLite database using ODBC from Ring. It shows how to initialize ODBC, connect to a SQLite database file, execute SQL statements to create a table, insert data, and select data. The examples also demonstrate how to retrieve column counts and field data from the result set. Finally, it notes that Ring has native SQLite support so ODBC is not required, and that databases like dBase files can also be accessed using a similar ODBC approach.
The Ring programming language version 1.7 book - Part 91 of 196Mahmoud Samir Fayed
This document provides information about using Ring to create GUI applications with Qt. It discusses how to:
- Create a basic application with a main window using the qApp and qWidget classes.
- Add buttons, set click events, and call methods when buttons are clicked.
- Create arrays of buttons and position them on the window.
- Close one window and open another.
- Create modal windows that block interaction with other windows.
- Disable window resizing and maximize buttons.
The key points are that RingQt provides classes like qApp and qWidget to create GUI applications, qPushButton to add buttons, and setClickEvent() to call methods when buttons are clicked
The Ring programming language version 1.3 book - Part 83 of 88Mahmoud Samir Fayed
This document provides examples and explanations for common questions about using Ring programming language. It demonstrates how to summarize uninitialized variables, print lists containing objects, insert items into lists, print new lines and characters, create GUI applications using Qt, work with modal windows, and connect to SQLite and other databases using ODBC. Various functions, classes and concepts in Ring like Try/Catch, NULL, ISNULL(), lists, Qt classes and ODBC are explained through code examples.
The Ring programming language version 1.8 book - Part 94 of 202Mahmoud Samir Fayed
This document provides code examples for common GUI tasks in Ring using the Qt library:
1. It shows how to close a window and display another by connecting a button's click event to call the close() method on the first window and show() on the second.
2. It demonstrates how to create a modal window in Ring/Qt by setting the window modality to true and parent to the main window.
3. Methods like setWindowFlags() and removing the maximize flag can disable resizing and maximize buttons on a window.
The document discusses arrays in C++. It defines an array as a collection of similar data types that share a common name and whose elements can be distinguished using indexes. It provides the syntax for declaring arrays and examples. It also describes different methods for initializing arrays and provides sample questions and solutions demonstrating how to read from, modify, and sort arrays in C++.
The Ring programming language version 1.6 book - Part 183 of 189Mahmoud Samir Fayed
Here are the key steps to connect to a dBASE or Harbour database using ODBC in Ring:
1. Install the appropriate ODBC driver for the database you want to connect to (e.g. Microsoft dBase Driver for dBASE files, Visual FoxPro ODBC driver for Visual FoxPro databases).
2. Initialize an ODBC connection handle using odbc_init().
3. Connect to the database using odbc_connect(), passing the connection string with the driver name and data source. For example:
odbc_connect(pODBC, "Driver={Microsoft dBase Driver (*.dbf)};datasource=c:\path\to\database.dbf")
4
The Ring programming language version 1.5.2 book - Part 175 of 181Mahmoud Samir Fayed
This document discusses how to work with multiple source code files in a Ring project. It provides an example project structure with three source code files across two folders. It shows how to load and call functions defined in the external files from the main source file. Running the Ring compiler from the project folder compiles and links all the files together.
The Ring programming language version 1.5.4 book - Part 179 of 185Mahmoud Samir Fayed
This document discusses how to create modal and non-modal windows in a GUI application using Ring and Qt. It shows an example of opening a modal window from a button click that prevents interaction with the main window until the modal window is closed. It also demonstrates closing the initial window and opening a new main window. Key aspects covered are using setWindowModality(), setParent(), and window flags to control modality, as well as closing and showing windows at different points.
The Ring programming language version 1.5.3 book - Part 188 of 194Mahmoud Samir Fayed
This document provides instructions and examples for connecting to and querying a SQLite database using ODBC from Ring. It shows how to initialize ODBC, connect to a SQLite database file, execute SQL statements to create a table, insert data, and select data. The examples also demonstrate how to retrieve column counts and field data from the result set. Finally, it notes that Ring has native SQLite support so ODBC is not required, and that databases like dBase files can also be accessed using a similar ODBC approach.
The Ring programming language version 1.7 book - Part 91 of 196Mahmoud Samir Fayed
This document provides information about using Ring to create GUI applications with Qt. It discusses how to:
- Create a basic application with a main window using the qApp and qWidget classes.
- Add buttons, set click events, and call methods when buttons are clicked.
- Create arrays of buttons and position them on the window.
- Close one window and open another.
- Create modal windows that block interaction with other windows.
- Disable window resizing and maximize buttons.
The key points are that RingQt provides classes like qApp and qWidget to create GUI applications, qPushButton to add buttons, and setClickEvent() to call methods when buttons are clicked
The Ring programming language version 1.3 book - Part 83 of 88Mahmoud Samir Fayed
This document provides examples and explanations for common questions about using Ring programming language. It demonstrates how to summarize uninitialized variables, print lists containing objects, insert items into lists, print new lines and characters, create GUI applications using Qt, work with modal windows, and connect to SQLite and other databases using ODBC. Various functions, classes and concepts in Ring like Try/Catch, NULL, ISNULL(), lists, Qt classes and ODBC are explained through code examples.
The Ring programming language version 1.8 book - Part 94 of 202Mahmoud Samir Fayed
This document provides code examples for common GUI tasks in Ring using the Qt library:
1. It shows how to close a window and display another by connecting a button's click event to call the close() method on the first window and show() on the second.
2. It demonstrates how to create a modal window in Ring/Qt by setting the window modality to true and parent to the main window.
3. Methods like setWindowFlags() and removing the maximize flag can disable resizing and maximize buttons on a window.
The document discusses arrays in C++. It defines an array as a collection of similar data types that share a common name and whose elements can be distinguished using indexes. It provides the syntax for declaring arrays and examples. It also describes different methods for initializing arrays and provides sample questions and solutions demonstrating how to read from, modify, and sort arrays in C++.
The Ring programming language version 1.2 book - Part 10 of 84Mahmoud Samir Fayed
The document discusses various control structures in Ring including if/elseif/else statements, switch statements, while loops, for loops, and for in loops. Examples are provided to demonstrate the syntax and usage of each control structure. Try/catch blocks are also mentioned for handling exceptions.
The Ring programming language version 1.2 book - Part 11 of 84Mahmoud Samir Fayed
The document provides documentation on Ring programming language features including for loops, exceptions handling, getting user input, functions, program structure, and lists. It contains examples and explanations of Ring syntax for these features. For loops can iterate over a range or list with optional step values. Functions can accept parameters, return values, and be called recursively. Lists can be created and manipulated using standard list functions and operators. The document is a reference for Ring language elements.
The Ring programming language version 1.2 book - Part 9 of 84Mahmoud Samir Fayed
The document provides information about control structures in Ring programming language including branching statements like if and switch, and looping statements like while, for, and for in loops. If statements allow executing code conditionally based on an expression. Switch statements allow executing different code blocks based on the value of an expression. While and for loops allow repetitive execution of code. The for in loop iterates over elements in a list or string.
The Ring programming language version 1.2 book - Part 12 of 84Mahmoud Samir Fayed
This document describes string manipulation functions in Ring including:
- Getting the length of a string with len()
- Converting case with upper() and lower()
- Accessing characters with indexing and for loops
- Extracting substrings with left() and right()
- Trimming spaces with trim()
- Copying strings with copy()
- Counting lines with lines()
This document discusses arrays and functions in C++. It explains that arrays allow storing multiple values in a single variable to avoid declaring many individual variables. Arrays can store values of different data types like integers, floats, characters. Functions are blocks of code that perform a specific task and can optionally return a value. Functions make code reusable and avoid repetition. The document provides examples of one-dimensional and two-dimensional arrays, and functions with and without parameters. It also assigns practice problems of writing functions to calculate the summation of numbers from 1 to 1000, find the factorial of a given number, and calculate a number to the power of a given exponent.
The Ring programming language version 1.5 book - Part 6 of 31Mahmoud Samir Fayed
The document provides documentation on Ring programming language functions for checking data types, objects, classes, and packages. It describes functions such as isglobal(), isfunction(), packages(), classname(), objectid(), isobject(), attributes(), methods(), addattribute(), and packagename(). Each function is explained with its syntax and examples showing how to use the function to check types, retrieve object and class information, modify objects, and more.
The Ring programming language version 1.3 book - Part 22 of 88Mahmoud Samir Fayed
The document provides an overview of functional programming concepts in Ring, including pure functions, first-class functions, higher-order functions, and anonymous functions. It defines pure functions as functions that do not change state by copying function parameters rather than modifying original values. It also explains that in Ring, functions are first-class citizens that can be passed as parameters, returned as values, or stored in variables, and demonstrates how to call a function stored in a variable.
Scala, Haskell and LISP are examples of programming languages using the functional programming paradigm. Join us in this TechTalk to know why functional programming is so important, how to implement some of its core concepts in your existing programming languages, and how functional programming inspired Google's Map Reduce, Twitter's Algebird, and many other technologies.
By Mohammad Ghabboun - Senior Software Engineer, SOUQ.com
The Ring programming language version 1.7 book - Part 34 of 196Mahmoud Samir Fayed
The document provides an overview of object-oriented programming concepts in Ring including creating and accessing objects, classes, inheritance, operator overloading, private attributes and methods, dynamic attributes, packages, printing objects, finding and sorting lists of objects. It includes syntax examples and explanations for defining classes and methods, creating objects, accessing object attributes and methods using dot notation and braces, inheritance, private vs public members, and more. Various approaches for implementing common OOP patterns in Ring are demonstrated through multiple examples.
The Ring programming language version 1.3 book - Part 25 of 88Mahmoud Samir Fayed
This chapter summarizes various functions available in the Ring standard library (stdlib) for input/output, file handling, string manipulation, and mathematical operations. Some of the functions described include puts() and print() for output, getstring() and getnumber() for input, apppath() and justfilepath() for file paths, split() and splitmany() for string splitting, newlist() for multidimensional lists, capitalized() for capitalization, and mathematical functions like factorial(), fibonacci(), gcd(), and isprime() for prime checking. Many examples are provided to demonstrate the usage of these stdlib functions.
The Ring programming language version 1.5.3 book - Part 31 of 184Mahmoud Samir Fayed
This document provides a summary of key Ring programming language concepts related to functional programming, including pure functions, first-class functions, higher-order functions, anonymous functions, and testing equality of functions. It includes examples of defining pure functions that avoid side effects by copying rather than mutating passed arguments, passing functions as parameters and returning functions from other functions, using anonymous functions, and applying functions to lists via map-style functions.
The Ring programming language version 1.5.4 book - Part 33 of 185Mahmoud Samir Fayed
The document describes various functions in Ring for working with classes and objects. Some key functions covered include ispackageclass() to check if a class is in a package, classname() to get an object's class name, objectid() to get an object's ID, isobject() to check if a variable is an object, attributes() and methods() to get an object's attributes and methods, and addattribute() and addmethod() to add attributes and methods to objects.
The Ring programming language version 1.4.1 book - Part 5 of 31Mahmoud Samir Fayed
This document discusses control structures in Ring programming language. It covers if/elseif/else statements, switch statements, while loops, for loops, and for-in loops. Specific examples are provided to demonstrate the syntax and usage of each control structure. Exceptions are also introduced in the third style of control structures.
The document contains questions about Python operators, data types, control flow statements like if/else and loops like for/while loops. It also includes questions about string operations, file handling and input/output functions in Python.
The document provides an overview of Scala concepts for Java programmers, including object-oriented features, pattern matching, functional programming constructs like immutability and higher-order functions, actors and futures for concurrency, and implicits. Key concepts covered include case classes, lazy evaluation, parallel collections, currying, partial functions, and implicit parameters.
This document discusses random functions in Python. It explains how to import the random module and describes several functions:
- random() generates random float numbers between 0 and 1
- randrange() returns random integers within a given range
- randint() returns random integers within a range similar to randrange()
Examples are provided to demonstrate how to use these functions to generate random numbers between certain values or in lists.
The document contains C++ code examples for performing common matrix operations using 2D arrays, including summing and subtracting matrices, finding the transpose of a matrix, multiplying 2x2 matrices, and calculating the inverse of a 2x2 matrix. It prompts the user for matrix inputs, performs the selected operation on the matrices, and outputs the results.
The Ring programming language version 1.4 book - Part 5 of 30Mahmoud Samir Fayed
The document discusses functions in Ring programming language. It covers defining functions, calling functions, declaring parameters, sending parameters, main function, variable scope, return values, and recursion. Some key points:
- Functions are defined using the func keyword followed by the function name and optional parameters. No ending keyword is needed.
- Functions can be called before they are defined.
- Parameters are declared after the function name as a comma separated list of identifiers.
- Parameters are sent to functions by listing them inside parentheses when calling.
- The optional main function is executed after other statements if defined.
Simple IO Monad in 'Functional Programming in Scala'Philip Schwarz
The document defines an IO monad for representing computations with side effects in Scala. The IO trait defines map and flatMap methods to allow sequencing of effectful computations. Functions like ReadLine and PrintLine are defined to interact with the console. A temperature conversion program is implemented using the IO monad, separating the pure computation from executing side effects.
The Ring programming language version 1.4 book - Part 9 of 30Mahmoud Samir Fayed
This document provides documentation on Ring programming language classes, functions, and objects. It includes sections on getting class and method names, checking types, accessing and modifying object attributes and methods, and sharing methods between classes without inheritance. Various functions are described like classes(), isclass(), attributes(), methods(), addattribute(), and setattribute(). Examples are provided to illustrate the usage of each function.
The Ring programming language version 1.10 book - Part 101 of 212Mahmoud Samir Fayed
This document provides documentation on using Ring, an open source programming language. It includes examples of loading Ring code files and libraries, calling functions between files, and running a Ring program. The document also answers questions about Ring concepts like using NULL values, printing objects in lists, and creating GUI applications with buttons and windows.
The Ring programming language version 1.2 book - Part 79 of 84Mahmoud Samir Fayed
The document discusses extending Ring by adding new classes and functions. It can be done by writing C/C++ code and compiling it into a DLL that can be loaded from Ring using LoadLib(). Functions defined in the DLL can then be called from Ring. Alternatively, RingQt classes can be extended by defining new classes that inherit from existing Qt classes. A code generator written in Ring is also presented that can automatically generate wrapper code to interface with external C/C++ libraries from Ring.
The Ring programming language version 1.2 book - Part 10 of 84Mahmoud Samir Fayed
The document discusses various control structures in Ring including if/elseif/else statements, switch statements, while loops, for loops, and for in loops. Examples are provided to demonstrate the syntax and usage of each control structure. Try/catch blocks are also mentioned for handling exceptions.
The Ring programming language version 1.2 book - Part 11 of 84Mahmoud Samir Fayed
The document provides documentation on Ring programming language features including for loops, exceptions handling, getting user input, functions, program structure, and lists. It contains examples and explanations of Ring syntax for these features. For loops can iterate over a range or list with optional step values. Functions can accept parameters, return values, and be called recursively. Lists can be created and manipulated using standard list functions and operators. The document is a reference for Ring language elements.
The Ring programming language version 1.2 book - Part 9 of 84Mahmoud Samir Fayed
The document provides information about control structures in Ring programming language including branching statements like if and switch, and looping statements like while, for, and for in loops. If statements allow executing code conditionally based on an expression. Switch statements allow executing different code blocks based on the value of an expression. While and for loops allow repetitive execution of code. The for in loop iterates over elements in a list or string.
The Ring programming language version 1.2 book - Part 12 of 84Mahmoud Samir Fayed
This document describes string manipulation functions in Ring including:
- Getting the length of a string with len()
- Converting case with upper() and lower()
- Accessing characters with indexing and for loops
- Extracting substrings with left() and right()
- Trimming spaces with trim()
- Copying strings with copy()
- Counting lines with lines()
This document discusses arrays and functions in C++. It explains that arrays allow storing multiple values in a single variable to avoid declaring many individual variables. Arrays can store values of different data types like integers, floats, characters. Functions are blocks of code that perform a specific task and can optionally return a value. Functions make code reusable and avoid repetition. The document provides examples of one-dimensional and two-dimensional arrays, and functions with and without parameters. It also assigns practice problems of writing functions to calculate the summation of numbers from 1 to 1000, find the factorial of a given number, and calculate a number to the power of a given exponent.
The Ring programming language version 1.5 book - Part 6 of 31Mahmoud Samir Fayed
The document provides documentation on Ring programming language functions for checking data types, objects, classes, and packages. It describes functions such as isglobal(), isfunction(), packages(), classname(), objectid(), isobject(), attributes(), methods(), addattribute(), and packagename(). Each function is explained with its syntax and examples showing how to use the function to check types, retrieve object and class information, modify objects, and more.
The Ring programming language version 1.3 book - Part 22 of 88Mahmoud Samir Fayed
The document provides an overview of functional programming concepts in Ring, including pure functions, first-class functions, higher-order functions, and anonymous functions. It defines pure functions as functions that do not change state by copying function parameters rather than modifying original values. It also explains that in Ring, functions are first-class citizens that can be passed as parameters, returned as values, or stored in variables, and demonstrates how to call a function stored in a variable.
Scala, Haskell and LISP are examples of programming languages using the functional programming paradigm. Join us in this TechTalk to know why functional programming is so important, how to implement some of its core concepts in your existing programming languages, and how functional programming inspired Google's Map Reduce, Twitter's Algebird, and many other technologies.
By Mohammad Ghabboun - Senior Software Engineer, SOUQ.com
The Ring programming language version 1.7 book - Part 34 of 196Mahmoud Samir Fayed
The document provides an overview of object-oriented programming concepts in Ring including creating and accessing objects, classes, inheritance, operator overloading, private attributes and methods, dynamic attributes, packages, printing objects, finding and sorting lists of objects. It includes syntax examples and explanations for defining classes and methods, creating objects, accessing object attributes and methods using dot notation and braces, inheritance, private vs public members, and more. Various approaches for implementing common OOP patterns in Ring are demonstrated through multiple examples.
The Ring programming language version 1.3 book - Part 25 of 88Mahmoud Samir Fayed
This chapter summarizes various functions available in the Ring standard library (stdlib) for input/output, file handling, string manipulation, and mathematical operations. Some of the functions described include puts() and print() for output, getstring() and getnumber() for input, apppath() and justfilepath() for file paths, split() and splitmany() for string splitting, newlist() for multidimensional lists, capitalized() for capitalization, and mathematical functions like factorial(), fibonacci(), gcd(), and isprime() for prime checking. Many examples are provided to demonstrate the usage of these stdlib functions.
The Ring programming language version 1.5.3 book - Part 31 of 184Mahmoud Samir Fayed
This document provides a summary of key Ring programming language concepts related to functional programming, including pure functions, first-class functions, higher-order functions, anonymous functions, and testing equality of functions. It includes examples of defining pure functions that avoid side effects by copying rather than mutating passed arguments, passing functions as parameters and returning functions from other functions, using anonymous functions, and applying functions to lists via map-style functions.
The Ring programming language version 1.5.4 book - Part 33 of 185Mahmoud Samir Fayed
The document describes various functions in Ring for working with classes and objects. Some key functions covered include ispackageclass() to check if a class is in a package, classname() to get an object's class name, objectid() to get an object's ID, isobject() to check if a variable is an object, attributes() and methods() to get an object's attributes and methods, and addattribute() and addmethod() to add attributes and methods to objects.
The Ring programming language version 1.4.1 book - Part 5 of 31Mahmoud Samir Fayed
This document discusses control structures in Ring programming language. It covers if/elseif/else statements, switch statements, while loops, for loops, and for-in loops. Specific examples are provided to demonstrate the syntax and usage of each control structure. Exceptions are also introduced in the third style of control structures.
The document contains questions about Python operators, data types, control flow statements like if/else and loops like for/while loops. It also includes questions about string operations, file handling and input/output functions in Python.
The document provides an overview of Scala concepts for Java programmers, including object-oriented features, pattern matching, functional programming constructs like immutability and higher-order functions, actors and futures for concurrency, and implicits. Key concepts covered include case classes, lazy evaluation, parallel collections, currying, partial functions, and implicit parameters.
This document discusses random functions in Python. It explains how to import the random module and describes several functions:
- random() generates random float numbers between 0 and 1
- randrange() returns random integers within a given range
- randint() returns random integers within a range similar to randrange()
Examples are provided to demonstrate how to use these functions to generate random numbers between certain values or in lists.
The document contains C++ code examples for performing common matrix operations using 2D arrays, including summing and subtracting matrices, finding the transpose of a matrix, multiplying 2x2 matrices, and calculating the inverse of a 2x2 matrix. It prompts the user for matrix inputs, performs the selected operation on the matrices, and outputs the results.
The Ring programming language version 1.4 book - Part 5 of 30Mahmoud Samir Fayed
The document discusses functions in Ring programming language. It covers defining functions, calling functions, declaring parameters, sending parameters, main function, variable scope, return values, and recursion. Some key points:
- Functions are defined using the func keyword followed by the function name and optional parameters. No ending keyword is needed.
- Functions can be called before they are defined.
- Parameters are declared after the function name as a comma separated list of identifiers.
- Parameters are sent to functions by listing them inside parentheses when calling.
- The optional main function is executed after other statements if defined.
Simple IO Monad in 'Functional Programming in Scala'Philip Schwarz
The document defines an IO monad for representing computations with side effects in Scala. The IO trait defines map and flatMap methods to allow sequencing of effectful computations. Functions like ReadLine and PrintLine are defined to interact with the console. A temperature conversion program is implemented using the IO monad, separating the pure computation from executing side effects.
The Ring programming language version 1.4 book - Part 9 of 30Mahmoud Samir Fayed
This document provides documentation on Ring programming language classes, functions, and objects. It includes sections on getting class and method names, checking types, accessing and modifying object attributes and methods, and sharing methods between classes without inheritance. Various functions are described like classes(), isclass(), attributes(), methods(), addattribute(), and setattribute(). Examples are provided to illustrate the usage of each function.
The Ring programming language version 1.10 book - Part 101 of 212Mahmoud Samir Fayed
This document provides documentation on using Ring, an open source programming language. It includes examples of loading Ring code files and libraries, calling functions between files, and running a Ring program. The document also answers questions about Ring concepts like using NULL values, printing objects in lists, and creating GUI applications with buttons and windows.
The Ring programming language version 1.2 book - Part 79 of 84Mahmoud Samir Fayed
The document discusses extending Ring by adding new classes and functions. It can be done by writing C/C++ code and compiling it into a DLL that can be loaded from Ring using LoadLib(). Functions defined in the DLL can then be called from Ring. Alternatively, RingQt classes can be extended by defining new classes that inherit from existing Qt classes. A code generator written in Ring is also presented that can automatically generate wrapper code to interface with external C/C++ libraries from Ring.
The Ring programming language version 1.6 book - Part 32 of 189Mahmoud Samir Fayed
The document discusses various hashing and encryption functions in Ring such as md5(), sha1(), sha256(), etc. It provides the syntax and examples of using these functions to hash strings and files. It also covers generating random bytes, downloading content from URLs, sending emails, and other cryptographic topics.
The Ring programming language version 1.10 book - Part 43 of 212Mahmoud Samir Fayed
The document provides examples of using various functions in Ring's standard library (stdlib) for input/output, string manipulation, lists, and more. Key functions discussed include puts(), print(), print2Str(), getString(), getNumber(), appPath(), justFilePath(), justFileName(), value(), times(), map(), filter(), split(), splitMany(), newList(), and capitalized(). Examples are given to demonstrate how each function works and what it returns. The document serves as a reference for the main functions available in Ring's standard library.
The Ring programming language version 1.7 book - Part 37 of 196Mahmoud Samir Fayed
The document provides examples of using various functions in Ring to add, get, and modify methods and attributes of objects. It demonstrates how to add methods to classes using addmethod(), get attribute values using getattribute(), set attribute values using setattribute(), share methods between classes using mergemethods(), and get the package name of the latest import using packagename(). Examples are given for each function to illustrate their usage.
The Ring programming language version 1.5.1 book - Part 175 of 180 Mahmoud Samir Fayed
Ring can connect to databases using ODBC. This allows it to connect to SQLite databases natively as well as other database types like dBase and Visual FoxPro. When using events in GUI programming, setClickEvent takes a string of code rather than directly calling methods to allow for different programming paradigms. Functions must be defined before they are called to avoid errors.
The Ring programming language version 1.9 book - Part 38 of 210Mahmoud Samir Fayed
The document discusses object-oriented programming concepts in Ring including classes, objects, composition, setter and getter methods, private attributes and methods, operator overloading, and inheritance. It provides examples of defining classes and creating objects that demonstrate accessing object attributes and methods using braces, passing parameters to initialization methods, and overloading operators like + to work with custom classes. The examples show how to define classes with attributes and methods to encapsulate data and behavior into reusable objects.
The Ring programming language version 1.8 book - Part 32 of 202Mahmoud Samir Fayed
This document summarizes Ring programming language functions for working with ODBC databases:
- odbc_init() creates an ODBC handle
- odbc_drivers() and odbc_datasources() return lists of available ODBC drivers and data sources
- odbc_close() frees resources associated with an ODBC handle
- Other functions like odbc_connect(), odbc_execute(), odbc_fetch() allow executing SQL queries and retrieving results
- Transaction functions like odbc_commit() and odbc_rollback() manage transactions
An example shows how to print the list of ODBC drivers available after initializing a handle.
The Ring programming language version 1.6 book - Part 184 of 189Mahmoud Samir Fayed
This section provides an overview of the Ring programming language, including lists of its 49 keywords, 198 functions, common compiler errors, and the structure and instructions of its virtual machine (VM). The keywords include common ones like class, func, if, and while. The many functions cover strings, files, math, objects, and the VM. Compiler errors relate to missing elements like ok or end in control structures. The VM executes Ring code through its instructions and uses scopes and pointers to manage memory.
The Ring programming language version 1.2 book - Part 20 of 84Mahmoud Samir Fayed
This document provides documentation on object-oriented programming concepts in Ring including:
- Defining classes with attributes and methods
- Accessing object attributes using dot notation and braces
- Composition of objects as attributes of other objects
- Defining setter and getter methods
- Private and public attributes and methods
- Operator overloading for classes
- Inheritance between classes
- Dynamic attributes defined at runtime
- Packages to organize classes
- Printing and finding objects in lists
- Sorting lists of objects
It includes examples of implementing each concept and the output of running the example code.
The Ring programming language version 1.3 book - Part 13 of 88Mahmoud Samir Fayed
This document provides information about functions in the Ring programming language. It discusses how to define functions, call functions, declare parameters, send parameters to functions, use the main function, handle variable scope, return values from functions, and create recursive functions. It also covers using multiple source code files in a project by loading files, and the typical sections that may be included in a source code file.
The Ring programming language version 1.5.2 book - Part 30 of 181Mahmoud Samir Fayed
This document summarizes object-oriented programming concepts in Ring including classes, objects, attributes, methods, inheritance, composition, and more. It provides examples of how to define classes with attributes and methods, create objects, access object attributes and call methods using dot notation and braces. It also covers more advanced topics like private/public members, operator overloading, packages, sorting/searching lists of objects, and dynamic attributes.
The Ring programming language version 1.10 book - Part 35 of 212Mahmoud Samir Fayed
This document provides examples and documentation for various functions in Ring related to operating system detection, file handling, error handling, debugging, and demo programs. It describes functions such as IsMacOSX(), IsLinux(), Try/Catch blocks, Eval() for runtime code execution, Raise() for raising exceptions, Assert() for testing conditions, and includes examples of a simple language shell and main menu demo program.
The Ring programming language version 1.10 book - Part 22 of 212Mahmoud Samir Fayed
This document describes how to build Ring from source code on Microsoft Windows. It outlines the steps to clone the Ring source code repository, generate code for Ring extensions, and build the Ring compiler, virtual machine, Ring2EXE tool, and various Ring extensions like RingConsoleColors, RingInternet, RingCurl, RingPM, RingODBC, RingMySQL, RingSQLite, RingPostgreSQL, RingOpenSSL, RingMurmurHash, RingAllegro, RingZip, RingLibuv, RingFreeGLUT, and RingOpenGL using batch scripts. The process involves changing directories, running gencode.bat to generate source code for some extensions, and running buildvc.bat scripts to compile the code using Visual
The Ring programming language version 1.7 book - Part 30 of 196Mahmoud Samir Fayed
The document describes various functions in Ring for getting information about the operating system and environment. It includes functions like IsMacOSX(), IsLinux(), IsFreeBSD(), IsAndroid() to check the operating system, as well as functions like CurrentDir(), ExeFileName(), ChDir(), ExeFolder() for getting directory and path information. It also describes functions like Eval(), Raise(), Assert() for debugging and error handling, and provides examples of their usage.
The Ring programming language version 1.5.2 book - Part 26 of 181Mahmoud Samir Fayed
This document provides examples and documentation for various Ring programming language functions related to input/output, file handling, debugging, and creating demo programs. It describes functions for getting command line arguments, the active source file name, changing directories, and more. It also covers try/catch error handling, the eval() function for executing code as a string, and assert() for validating conditions. Finally, it presents two demo programs - an interactive shell and a menu-driven program - to demonstrate basic Ring concepts.
The Ring programming language version 1.10 book - Part 28 of 212Mahmoud Samir Fayed
This document provides documentation on control structures and functions in Ring programming language. It covers the following topics:
1. Branching structures like if/else statements and switch statements. Looping structures like while, for, and for-in loops. Exceptions handling using try/catch.
2. Defining and calling functions. Declaring function parameters. Sending parameters to functions. Main function and variable scope. Returning values from functions. Recursive functions.
3. Getting input using the Give command, GetChar() function, and Input() function.
The Ring programming language version 1.6 book - Part 29 of 189Mahmoud Samir Fayed
This document provides information on ODBC functions in Ring programming language. It describes functions such as odbc_init() to create an ODBC handle, odbc_drivers() to get a list of ODBC drivers, odbc_datasources() to get data sources, odbc_close() to free resources, and others like odbc_connect(), odbc_execute(), odbc_fetch() for connecting, executing queries and fetching results. An example shows how to print the list of ODBC drivers installed using odbc_drivers() function.
The Ring programming language version 1.5.3 book - Part 24 of 184Mahmoud Samir Fayed
The chapter discusses mathematical functions in Ring including trigonometric functions like sin, cos, and tan, logarithmic functions like log and log10, exponential functions like exp, and other functions like sqrt, ceil, floor, and random. Examples are provided to demonstrate how to use functions like sin, cos, tan, log, sqrt, and others in Ring.
The Ring programming language version 1.9 book - Part 99 of 210Mahmoud Samir Fayed
Ring allows extending the language through C/C++ code and libraries. This includes extending RingQt by adding more classes. The documentation explains how to call C functions and use C++ classes from Ring. A code generator can automatically create Ring wrappers for C/C++ libraries by parsing function/class definitions. This simplifies integrating external libraries. For example, RingQt was extended by generating wrappers for the Qt classes using such a generator.
Similar to The Ring programming language version 1.4 book - Part 29 of 30 (20)
The Ring programming language version 1.10 book - Part 212 of 212Mahmoud Samir Fayed
This document summarizes new features and changes in different versions of the Ring programming language and library. It discusses various topics including using different syntax styles and code editors, developing graphical desktop and mobile applications using RingQt, and using Ring for 3D graphics and games development. The document also provides overviews of the core Ring libraries and language features.
The Ring programming language version 1.10 book - Part 211 of 212Mahmoud Samir Fayed
This document provides documentation for the Ring programming language and various Ring extensions and libraries. It includes sections on Ring mode for Emacs editor, the Ring Notepad IDE, the Ring Package Manager (RingPM), embedding Ring code in C/C++ programs, and references for the functions and classes of various Ring extensions for areas like 2D/3D graphics, networking, multimedia and more.
The Ring programming language version 1.10 book - Part 210 of 212Mahmoud Samir Fayed
This document contains summaries of various Ring classes, functions and concepts:
- It describes Ring classes like the Map, Math, MySQL, and PostgreSQL classes.
- It lists and briefly explains Ring standard library functions such as map(), random(), newlist(), and print().
- It covers Ring concepts and features like object oriented programming, operators, files and I/O, GUI programming, and web development.
The Ring programming language version 1.10 book - Part 208 of 212Mahmoud Samir Fayed
This document provides a summary of functions in the Ring documentation for Release 1.10. It lists functions for drawing quadrics, normals, orientation, and textures. It also lists functions for scaling images, drawing spheres, starting and ending contours and polygons for tessellation, setting tessellation normals and properties, adding tessellation vertices, and unprojecting coordinates. The document also provides resources for the Ring language like the website, source code repository, contact information, and lists Arabic language resources.
The Ring programming language version 1.10 book - Part 207 of 212Mahmoud Samir Fayed
This document contains listings of over 100 OpenGL functions related to lighting, materials, textures, and rendering. The functions listed specify parameters for lights, materials, texture coordinates, and rendering operations like clearing buffers and drawing primitives.
The Ring programming language version 1.10 book - Part 205 of 212Mahmoud Samir Fayed
This document lists numerous OpenGL constants and enumerations related to textures, blending, shaders, buffers, and other graphics features. It includes constants for texture types and formats, shader variable types, buffer bindings and usages, and more. The listing contains over 200 individual constants and enumerations without descriptions.
The Ring programming language version 1.10 book - Part 206 of 212Mahmoud Samir Fayed
The document lists OpenGL functions and constants added in version 1.10 of the OpenGL specification. It includes over 100 functions and constants for features such as unsigned integer textures, texture buffers, geometry shaders, transform feedback, and more robust context handling.
The Ring programming language version 1.10 book - Part 203 of 212Mahmoud Samir Fayed
The document contains a list of functions and constants related to OpenGL graphics functionality. It includes functions for vertex specification, texture mapping, tessellation, nurbs modeling, quadric surfaces, and more. It also includes constants for OpenGL states, modes, and error codes.
The Ring programming language version 1.10 book - Part 202 of 212Mahmoud Samir Fayed
The document lists over 100 OpenGL functions for querying and retrieving information about OpenGL objects, state, and errors. Some of the functions listed include glGetError() to retrieve OpenGL error codes, glGetUniformLocation() to retrieve the location of a uniform variable in a program, and glGetString() to retrieve version and extension information.
The Ring programming language version 1.10 book - Part 201 of 212Mahmoud Samir Fayed
The document lists various OpenGL constants and functions related to OpenGL graphics functionality. It includes constants for texture and color formats, clipping planes, buffer objects, shader operations, and more. It also lists over 100 OpenGL function declarations for operations like drawing, clearing, texture handling, blending, and shader manipulation.
The Ring programming language version 1.10 book - Part 200 of 212Mahmoud Samir Fayed
This document lists numerous OpenGL constants related to graphics hardware capabilities, state variables, and functions. It includes constants for vertex arrays, texture mapping, blending, multisampling, shader types, and more. The constants are used to query and set the state and capabilities of the OpenGL graphics processing context.
The Ring programming language version 1.10 book - Part 199 of 212Mahmoud Samir Fayed
The document lists over 200 OpenGL constants related to graphics rendering features such as fog, depth testing, blending, textures, and more. It provides the names of constants for configuring various graphics pipeline states and settings in OpenGL.
The Ring programming language version 1.10 book - Part 198 of 212Mahmoud Samir Fayed
The document contains listings of over 100 OpenGL and GLU function declarations related to texture coordinates, uniforms, vertex specification, and tessellation. It provides the function name, return type if any, and parameters for each function for specifying texture coordinates, uniforms, vertices and performing tessellation in OpenGL and GLU.
The Ring programming language version 1.10 book - Part 197 of 212Mahmoud Samir Fayed
The document contains documentation for over 100 OpenGL functions related to rendering, textures, shaders, and more. It lists each function name and its parameters. The functions allow specifying colors, textures, shader programs, and various rendering states and operations in OpenGL.
The Ring programming language version 1.10 book - Part 196 of 212Mahmoud Samir Fayed
This document lists OpenGL constants and functions related to graphics rendering. It includes constants for buffer types, shader data types, texture types, and more. It also lists function prototypes for common OpenGL operations like drawing, clearing, binding textures and buffers, and setting shader uniforms.
The Ring programming language version 1.10 book - Part 195 of 212Mahmoud Samir Fayed
The document lists over 200 OpenGL constants related to textures, vertex arrays, blending, and buffer objects. It provides reference documentation for OpenGL version 1.10 including constants for texture formats and parameters, vertex attribute types, blending functions, and buffer usage flags.
The Ring programming language version 1.10 book - Part 194 of 212Mahmoud Samir Fayed
The document lists various constants used in OpenGL such as GL_FOG_BIT, GL_DEPTH_BUFFER_BIT, GL_ACCUM, and others related to OpenGL rendering, blending, textures, lighting, and more. It provides definitions for OpenGL enums and related values.
The Ring programming language version 1.10 book - Part 193 of 212Mahmoud Samir Fayed
This document lists over 100 OpenGL functions for specifying textures, lighting, shaders, and other graphics operations. The functions include glMultiTexCoord2iv() for specifying texture coordinates, glNormal3f() for specifying normals, and glUniform1f() for specifying shader uniforms.
The Ring programming language version 1.10 book - Part 192 of 212Mahmoud Samir Fayed
This document lists OpenGL functions and constants that were added or changed in OpenGL version 1.10. It includes over 150 new OpenGL constants for features such as geometry shaders, transform feedback, cube map arrays, and more. It also lists over 80 OpenGL functions, providing their parameters and types.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Best 20 SEO Techniques To Improve Website Visibility In SERPPixlogix Infotech
Boost your website's visibility with proven SEO techniques! Our latest blog dives into essential strategies to enhance your online presence, increase traffic, and rank higher on search engines. From keyword optimization to quality content creation, learn how to make your site stand out in the crowded digital landscape. Discover actionable tips and expert insights to elevate your SEO game.
GraphRAG for Life Science to increase LLM accuracyTomaz Bratanic
GraphRAG for life science domain, where you retriever information from biomedical knowledge graphs using LLMs to increase the accuracy and performance of generated answers
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceIndexBug
Imagine a world where machines not only perform tasks but also learn, adapt, and make decisions. This is the promise of Artificial Intelligence (AI), a technology that's not just enhancing our lives but revolutionizing entire industries.
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-und-domino-lizenzkostenreduzierung-in-der-welt-von-dlau/
DLAU und die Lizenzen nach dem CCB- und CCX-Modell sind für viele in der HCL-Community seit letztem Jahr ein heißes Thema. Als Notes- oder Domino-Kunde haben Sie vielleicht mit unerwartet hohen Benutzerzahlen und Lizenzgebühren zu kämpfen. Sie fragen sich vielleicht, wie diese neue Art der Lizenzierung funktioniert und welchen Nutzen sie Ihnen bringt. Vor allem wollen Sie sicherlich Ihr Budget einhalten und Kosten sparen, wo immer möglich. Das verstehen wir und wir möchten Ihnen dabei helfen!
Wir erklären Ihnen, wie Sie häufige Konfigurationsprobleme lösen können, die dazu führen können, dass mehr Benutzer gezählt werden als nötig, und wie Sie überflüssige oder ungenutzte Konten identifizieren und entfernen können, um Geld zu sparen. Es gibt auch einige Ansätze, die zu unnötigen Ausgaben führen können, z. B. wenn ein Personendokument anstelle eines Mail-Ins für geteilte Mailboxen verwendet wird. Wir zeigen Ihnen solche Fälle und deren Lösungen. Und natürlich erklären wir Ihnen das neue Lizenzmodell.
Nehmen Sie an diesem Webinar teil, bei dem HCL-Ambassador Marc Thomas und Gastredner Franz Walder Ihnen diese neue Welt näherbringen. Es vermittelt Ihnen die Tools und das Know-how, um den Überblick zu bewahren. Sie werden in der Lage sein, Ihre Kosten durch eine optimierte Domino-Konfiguration zu reduzieren und auch in Zukunft gering zu halten.
Diese Themen werden behandelt
- Reduzierung der Lizenzkosten durch Auffinden und Beheben von Fehlkonfigurationen und überflüssigen Konten
- Wie funktionieren CCB- und CCX-Lizenzen wirklich?
- Verstehen des DLAU-Tools und wie man es am besten nutzt
- Tipps für häufige Problembereiche, wie z. B. Team-Postfächer, Funktions-/Testbenutzer usw.
- Praxisbeispiele und Best Practices zum sofortigen Umsetzen
Building Production Ready Search Pipelines with Spark and MilvusZilliz
Spark is the widely used ETL tool for processing, indexing and ingesting data to serving stack for search. Milvus is the production-ready open-source vector database. In this talk we will show how to use Spark to process unstructured data to extract vector representations, and push the vectors to Milvus vector database for search serving.
Infrastructure Challenges in Scaling RAG with Custom AI modelsZilliz
Building Retrieval-Augmented Generation (RAG) systems with open-source and custom AI models is a complex task. This talk explores the challenges in productionizing RAG systems, including retrieval performance, response synthesis, and evaluation. We’ll discuss how to leverage open-source models like text embeddings, language models, and custom fine-tuned models to enhance RAG performance. Additionally, we’ll cover how BentoML can help orchestrate and scale these AI components efficiently, ensuring seamless deployment and management of RAG systems in the cloud.
Unlocking Productivity: Leveraging the Potential of Copilot in Microsoft 365, a presentation by Christoforos Vlachos, Senior Solutions Manager – Modern Workplace, Uni Systems
UiPath Test Automation using UiPath Test Suite series, part 6DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 6. In this session, we will cover Test Automation with generative AI and Open AI.
UiPath Test Automation with generative AI and Open AI webinar offers an in-depth exploration of leveraging cutting-edge technologies for test automation within the UiPath platform. Attendees will delve into the integration of generative AI, a test automation solution, with Open AI advanced natural language processing capabilities.
Throughout the session, participants will discover how this synergy empowers testers to automate repetitive tasks, enhance testing accuracy, and expedite the software testing life cycle. Topics covered include the seamless integration process, practical use cases, and the benefits of harnessing AI-driven automation for UiPath testing initiatives. By attending this webinar, testers, and automation professionals can gain valuable insights into harnessing the power of AI to optimize their test automation workflows within the UiPath ecosystem, ultimately driving efficiency and quality in software development processes.
What will you get from this session?
1. Insights into integrating generative AI.
2. Understanding how this integration enhances test automation within the UiPath platform
3. Practical demonstrations
4. Exploration of real-world use cases illustrating the benefits of AI-driven test automation for UiPath
Topics covered:
What is generative AI
Test Automation with generative AI and Open AI.
UiPath integration with generative AI
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/building-and-scaling-ai-applications-with-the-nx-ai-manager-a-presentation-from-network-optix/
Robin van Emden, Senior Director of Data Science at Network Optix, presents the “Building and Scaling AI Applications with the Nx AI Manager,” tutorial at the May 2024 Embedded Vision Summit.
In this presentation, van Emden covers the basics of scaling edge AI solutions using the Nx tool kit. He emphasizes the process of developing AI models and deploying them globally. He also showcases the conversion of AI models and the creation of effective edge AI pipelines, with a focus on pre-processing, model conversion, selecting the appropriate inference engine for the target hardware and post-processing.
van Emden shows how Nx can simplify the developer’s life and facilitate a rapid transition from concept to production-ready applications.He provides valuable insights into developing scalable and efficient edge AI solutions, with a strong focus on practical implementation.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc
How does your privacy program stack up against your peers? What challenges are privacy teams tackling and prioritizing in 2024?
In the fifth annual Global Privacy Benchmarks Survey, we asked over 1,800 global privacy professionals and business executives to share their perspectives on the current state of privacy inside and outside of their organizations. This year’s report focused on emerging areas of importance for privacy and compliance professionals, including considerations and implications of Artificial Intelligence (AI) technologies, building brand trust, and different approaches for achieving higher privacy competence scores.
See how organizational priorities and strategic approaches to data security and privacy are evolving around the globe.
This webinar will review:
- The top 10 privacy insights from the fifth annual Global Privacy Benchmarks Survey
- The top challenges for privacy leaders, practitioners, and organizations in 2024
- Key themes to consider in developing and maintaining your privacy program
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
The Ring programming language version 1.4 book - Part 29 of 30
1. Ring Documentation, Release 1.4
string + string ---> new string
string + number ---> new string
number + number ---> new number
number + string ---> new number
list + item —> nothing new will be created but the item will be added to the same list
Exception
number + nl ?> New String
This exception is added to easily print numbers then new line.
No need for this with printing lists because after printing the last item we already get a new line.
70.30 Could you explain the output of the StrCmp() function?
At first remember that you can check strings using ‘=’ operator directly.
see strcmp("hello","hello") + nl +
strcmp("abc","bcd") + nl +
strcmp("bcd","abc") + nl
if the two strings are the same then it returns 0
abc and bcd aren’t the same. in the second line it returns -1 and in the third line it returns 1
In the second line we compare between “abc” and “bcd”
Not equal because the first letter in “abc” = “a” and the first letter in “bcd” = “b”
So we have “a” != “b” and “a” < “b”
So we get output = -1
In the third line we have “bcd” and “abc”
the first letter in “bcd” is “b” and the first letter in “abc” is “a”
So we have “b” != “a” and “b” > “a”
So we get output = 1
Note: ASCII(“a”) = 97 and ASCII(“b”) = 98 So “a” < “b” because 97 < 98
70.31 How to use many source code files in the project?
Example:
I have the next folder
C:LRing
Contains the next files
C:LRingt1.ring
C:LRingmylib.ring
C:LRinglibsmylib2.ring
70.30. Could you explain the output of the StrCmp() function? 818
2. Ring Documentation, Release 1.4
The file t1.ring contains the next code
load "mylib.ring"
load "libsmylib2.ring"
myfunc()
test()
The file mylib.ring contains the next code
func myfunc
see "message from myfunc"+nl
The file libsmylib2.ring contains the next code
func test
see "message from test" + nl
from the folder C:LRing
If Ring is not added to the path you can add it or use the next command
set path=%path%;c:ringbin;
Where c:ring is the Ring folder
Now run
Ring t1.ring
Output
message from myfunc
message from test
70.32 Why this example use the GetChar() twice?
The GetChar() function accept one character from the keyboard buffer
In this example
While True
See "
Main Menu
(1) Say Hello
(2) Exit
"
Option = GetChar()
GetChar() GetChar() # End of line
# the previous two lines can be replaced with the next line
# Give Option
if Option = 1
see "Enter your name : " give cName
see "Hello " + cName
else
bye
ok
End
70.32. Why this example use the GetChar() twice? 819
3. Ring Documentation, Release 1.4
We uses GetChar() Three times
The first time we get the user option
Option = GetChar()
But in the second and the third times (We accept the new line characters from the buffer)
GetChar() GetChar() # End of line
Example : when the user select the option number 1 then press ENTER
We have Three Characters
• The first character is : Number 1
• The second character is : CHAR(13)
• The third character is : CHAR(10)
Because Windows uses CHAR(13) and CHAR(10) for each new line ( i.e. CR+LF )
70.33 How to use NULL and ISNULL() function?
when we try to use uninitialized variable in the Ring programming language, we get a clear runtime error message
Example
See x
Output
Line 1 Error (R24) : Using uninitialized variable : x
in file testsseeuninit.ring
The same happens when you try to access uninitialized attributes
Example
o1 = new point
see o1
see o1.x
class point x y z
Output
x: NULL
y: NULL
z: NULL
Line 3 Error (R24) : Using uninitialized variable : x
in file testsseeuninit2.ring
if you want to check for the error, just use Try/Catch/End
Try
see x
Catch
See "Sorry, We can't use x!" + nl
Done
Output
70.33. How to use NULL and ISNULL() function? 820
4. Ring Documentation, Release 1.4
Sorry, We can't use x!
Now we will talk about NULL and ISNULL()
Since we get error message when we deal with uninitialized variables
We can check these errors using Try/Catch/Done, So we uses NULL and ISNULL() for dealing with Strings.
NULL is a variable contains an empty string
ISNULL() is a function that returns true (1) if the input is an empty string or just a string contains “NULL”
This because we need to test these values (empty strings) and strings contains “NULL” that sometimes come from
external resource like DBMS.
Example
See IsNull(5) + nl + # print 0
IsNull("hello") + nl + # print 0
IsNull([1,3,5]) + nl + # print 0
IsNull("") + nl + # print 1
IsNull("NULL") # print 1
70.34 How to print lists that contains objects?
In this example we will see how we can print a list contains objects.
aList = [[1,2,3] , new point(1,2,3), new point(1,2,3)]
see "print the list" + nl
see alist
see "print the item (object)" + nl
see alist[2]
class point x y z
func init p1,p2,p3 x=p1 y=p2 z=p3
Output
print the list
1
2
3
x: 1.000000
y: 2.000000
z: 3.000000
x: 1.000000
y: 2.000000
z: 3.000000
print the item (object)
x: 1.000000
y: 2.000000
z: 3.000000
70.35 How to insert an item to the first position in the list?
To insert an item we can use the insert(aList,nIndex,Value) function.
70.34. How to print lists that contains objects? 821
5. Ring Documentation, Release 1.4
aList = 1:5
insert(aList,0,0)
See aList # print numbers from 0 to 5
70.36 How to print new lines and other characters?
To print new line we can use the nl variable.
See "Hello" + nl
or we can use multi-line literal as in the next example
See "Hello
"
if we want to print other characters we can use the char(nASCII) function
See char(109) + nl + # print m
char(77) # print M
70.37 Why we don’t use () after the qApp class name?
When we use RingQt to create GUI application, we uses () after the class name when we create new objects for
example.
new qWidget() { setWindowTitle("Hello World") resize(400,400) show() }
but before doing that we create an object from the qApp class and we don’t use () after that
Load "guilib.ring"
app = new qApp
{
win=new qWidget()
{
setwindowtitle(:test)
show()
}
exec()
}
Using () after the class name means calling the init() method in the class and passing parameters to this method.
If we used () while no init() method in the class we get the expected error message.
The class qApp don’t have this method while the other classes have it because they need it to create an object using
a function that return a pointer to that object and this pointer will be stored in an attribute called pObject, for more
information see ring_qt.ring file which contains the classes.
70.38 Why the window title bar is going outside the screen?
When we write the next code
70.36. How to print new lines and other characters? 822
6. Ring Documentation, Release 1.4
Load "guilib.ring"
app = new qApp
{
win=new qWidget()
{
setwindowtitle(:test)
setGeometry(0,0,200,200)
show()
}
exec()
}
I would expect that the window will run at the point (0,0) with (200,200) size but the actual result is that the window
title bar is going outside the screen.
This is related to the behavior of Qt framework.
The next code will avoid the problem
load "guilib.ring"
new qApp {
new qWidget() {
move(0,0)
resize(200,200)
show()
}
exec()
}
70.39 How to create an array of buttons in GUI applications?
Check the next example:
Load "guilib.ring"
App1 = new qApp {
win1 = new qWidget() {
move(0,0)
resize(500,500)
new qPushButton(win1)
{
settext("OK")
setclickevent("click()")
}
btn1 = new qPushButton(win1)
{
setgeometry(100,100,100,30)
settext("Button1")
}
btn2 = new qPushButton(win1)
{
setgeometry(200,100,100,30)
settext("Button2")
}
70.39. How to create an array of buttons in GUI applications? 823
7. Ring Documentation, Release 1.4
button = [btn1, btn2]
show()
}
exec()
}
func click
button[1] { settext ("Button3") }
button[2] { settext ("Button4") }
70.40 How to Close a window then displaying another one?
This example demonstrates how to close a window and show another one
Load "guilib.ring"
app=new qApp
{
frmBefore=new Qwidget()
{
setWindowTitle("before!")
resize(300,320)
move(200,200)
button=new qPushButton(frmBefore)
{
setText("Close")
setClickEvent("frmBefore.close() frmMain.show()")
}
show()
}
frmMain=new Qwidget()
{
setWindowTitle("After!")
resize(300,320)
move(200,200)
}
exec()
}
70.41 How to create a Modal Window?
This example demonstrates how to create a modal window
load "guilib.ring"
app=new qApp
{
70.40. How to Close a window then displaying another one? 824
8. Ring Documentation, Release 1.4
frmStart=new Qwidget()
{
setWindowTitle("The First Window")
resize(300,320)
move(200,200)
button=new qPushButton(frmStart)
{
setText("Show Modal Window")
resize(200,30)
setClickEvent("frmModal.show()")
}
new qPushButton(frmStart)
{
setText("Close Window")
move(0,50)
resize(200,30)
setClickEvent("frmStart.Close()")
}
show()
}
frmModal =new Qwidget()
{
setWindowTitle("Modal Window")
resize(300,320)
move(200,200)
setparent(frmStart)
setwindowmodality(true)
setwindowflags(Qt_Dialog)
}
exec()
}
Related Documents
• http://doc.qt.io/qt-5/qtwidgets-widgets-windowflags-example.html
• http://doc.qt.io/qt-5/qt.html#WindowType-enum
• http://doc.qt.io/qt-5/qwindow.html#setParent
• http://doc.qt.io/qt-5/qt.html#WindowModality-enum
70.42 How can I disable maximize button and resize window?
Use the method setWindowFlags()
Load "guilib.ring"
app1 = new qapp {
win1 = new qwidget() {
setwindowtitle("First")
setgeometry(100,100,500,500)
70.42. How can I disable maximize button and resize window? 825
9. Ring Documentation, Release 1.4
new qpushbutton(win1) {
setgeometry(100,100,100,30)
settext("close")
setclickevent("app1.quit()")
}
new qpushbutton(win1) {
setgeometry(250,100,100,30)
settext("Second")
setclickevent("second()")
}
showmaximized()
}
exec()
}
func second
win2 = new qwidget() {
setwindowtitle("Second")
setgeometry(100,100,500,500)
setwindowflags(Qt_dialog)
show()
}
70.43 How to use SQLite using ODBC?
In Ring 1.1 and later versions we have native support for SQLite, so you don’t need to use it through ODBC.
Also we can access SQLite through RingQt.
The answer to your question
pODBC = odbc_init()
odbc_connect(pODBC,"DRIVER=SQLite3 ODBC Driver;Database=mydb.db;LongNames=0;"+
"Timeout=1000;NoTXN=0;SyncPragma=NORMAL;StepAPI=0;")
odbc_execute(pODBC,"create table 'tel' ('ID','NAME','PHONE');")
odbc_execute(pODBC,"insert into 'tel' values ('1','Mahmoud','123456');")
odbc_execute(pODBC,"insert into 'tel' values ('2','Ahmed','123456');")
odbc_execute(pODBC,"insert into 'tel' values ('3','Ibrahim','123456');")
odbc_execute(pODBC,"select * from tel") + nl
nMax = odbc_colcount(pODBC)
See "Columns Count : " + nMax + nl
while odbc_fetch(pODBC)
See nl
for x = 1 to nMax
see odbc_getdata(pODBC,x)
if x != nMax see " - " ok
next
end
odbc_disconnect(pODBC)
odbc_close(pODBC)
Output:
Columns Count : 3
70.43. How to use SQLite using ODBC? 826
10. Ring Documentation, Release 1.4
1 - Mahmoud - 123456
2 - Ahmed - 123456
3 - Ibrahim - 123456
The program will create the file : mydb.db
Note : when I print the odbc drivers I see the long list that includes
SQLite3 ODBC Driver - UsageCount=1
SQLite ODBC Driver - UsageCount=1
SQLite ODBC (UTF-8) Driver - UsageCount=1
And I’m using “SQLite3 ODBC Driver”.
70.44 Can I connect to dbase/harbour database?
You can connect to any database using ODBC
To connect to xbase files (*.DBF)
See "Using DBF Files using ODBC" + nl
pODBC = odbc_init()
See "Connect to database" + nl
odbc_connect(pODBC,"Driver={Microsoft dBase Driver (*.dbf)};"+
"datasource=dBase Files;DriverID=277")
See "Select data" + nl
odbc_execute(pODBC,"select * from tel.dbf")
nMax = odbc_colcount(pODBC)
See "Columns Count : " + nMax + nl
while odbc_fetch(pODBC)
See "Row data:" + nl
for x = 1 to nMax
see odbc_getdata(pODBC,x) + " - "
next
end
See "Close database..." + nl
odbc_disconnect(pODBC)
odbc_close(pODBC)
Output
Using DBF Files using ODBC
Connect to database
Select data
Columns Count : 3
Row data:
Ahmad - Egypt - 234567 - Row data:
Fady - Egypt - 345678 - Row data:
Shady - Egypt - 456789 - Row data:
Mahmoud - Egypt - 123456 - Close database...
Also you can connect to a Visual FoxPro database (requires installing Visual FoxPro driver)
See "ODBC test 6" + nl
pODBC = odbc_init()
See "Connect to database" + nl
odbc_connect(pODBC,"Driver={Microsoft Visual FoxPro Driver};"+
"SourceType=DBC;SourceDB=C:PWCT19ssbuildPWCTDATACH1Datamydata.dbc;")
70.44. Can I connect to dbase/harbour database? 827
11. Ring Documentation, Release 1.4
See "Select data" + nl
see odbc_execute(pODBC,"select * from t38") + nl
nMax = odbc_colcount(pODBC)
See "Columns Count : " + nMax + nl
while odbc_fetch(pODBC)
See "Row data:" + nl
for x = 1 to nMax
see odbc_getdata(pODBC,x) + " - "
next
end
See "Close database..." + nl
odbc_disconnect(pODBC)
odbc_close(pODBC)
70.45 Why setClickEvent() doesn’t see the object methods directly?
setClickEvent(cCode) take a string contains code. The code will be executed when the event happens.
Ring support Many Programming Paradigms like Procedural, OOP, Functional and others.
But when you support many paradigms at the language level you can’t know which paradigm will be used so you have
two options
1. Provide General Solutions that works with many programming paradigms.
2. Provide Many Specific solutions where each one match a specific paradigm.
setClickEvent() and others belong to (General Solutions that works with many programming paradigms).
You just pass a string of code that will be executed without any care about classes and objects.
This code could be anything like calling a function, calling a method and setting variable value.
Some other languages force you to use OOP and call methods for events. Also some other languages uses anonymous
functions that may get parameters like the current object.
Now we have the general solution (not restricted with any paradigm), In the future we may add specific solutions that
match specific paradigms (OOP, Functional, Declarative and Natural).
70.46 Why I get Calling Function without definition Error?
Each program follow the next order
1 - Loading Files 2 - Global Variables and Statements 3 - Functions 4 - Packages, Classes and Methods
So what does that mean ?
1. **** No Functions comes After Classes ****
2. **** No command is required to end functions/methods/classes/packages ****
Look at this example
See "Hello"
test()
func test
see "message from the test function!" + nl
class test
70.45. Why setClickEvent() doesn’t see the object methods directly? 828
12. Ring Documentation, Release 1.4
In the previous example we have a function called test() so we can call it directly using test()
In the next example, test() will become a method
See"Hello"
test() # runtime error message
class test
func test # Test() now is a method (not a function)
see "message from the test method!" + nl
The errors comes when you define a method then try calling it directly as a function.
The previous program must be
See"Hello"
new test { test() } # now will call the method
class test
func test # Test() now is a method (not a function)
see "message from the test method!" + nl
70.47 Can Ring work on Windows XP?
Ring can work on Windows XP and load extensions without problems.
Just be sure that the extension can work on Windows XP and your compiler version support that (modern compilers
requires some flags to support XP)
Check this topic https://blogs.msdn.microsoft.com/vcblog/2012/10/08/windows-xp-targeting-with-c-in-visual-studio-
2012/
For example, We added
/link /SUBSYSTEM:CONSOLE,"5.01"
To the batch file to support Windows XP
See : https://github.com/ring-lang/ring/blob/master/src/buildvccomplete.bat
70.48 How to extend RingQt and add more classes?
You have many options
In general you can extend Ring using C or C++ code
Ring from Ring code you can call C Functions or use C++ Classes & Methods
This chapter in the documentation explains this part in the language http://ring-
lang.sourceforge.net/doc/extension.html
For example the next code in .c file can be compiled to a DLL file using the Ring library (.lib)
#include "ring.h"
RING_FUNC(ring_ringlib_dlfunc)
{
printf("Message from dlfunc");
}
70.47. Can Ring work on Windows XP? 829
13. Ring Documentation, Release 1.4
RING_API void ringlib_init(RingState *pRingState)
{
ring_vm_funcregister("dlfunc",ring_ringlib_dlfunc);
}
Then from Ring you can load the DLL file using LoadLib() function then call the C function that called dlfunc() as
any Ring function.
See "Dynamic DLL" + NL
LoadLib("ringlib.dll")
dlfunc()
Output
Dynamic DLL
Message from dlfunc
When you read the documentation you will know about how to get parameters like (strings, numbers, lists and objects)
And how to return a value (any type) from you function.
From experience, when we support a C library or C++ Library
We discovered that a lot of functions share a lot of code
To save our time, and to quickly generate wrappers for C/C++ Libraries to be used in Ring
We have this code generator
https://github.com/ring-lang/ring/blob/master/extensions/codegen/parsec.ring
The code generator is just a Ring program < 1200 lines of Ring code
The generator take as input a configuration file contains the C/C++ library information
like Functions Prototype, Classes and Methods, Constants, Enum, Structures and members , etc.
Then the generator will generate
*.C File for C libraries (to be able to use the library functions)
*.CPP File for C++ libraries (to be able to use C++ classes and methods)
*.Ring File (to be able to use C++ classes as Ring classes)
*.RH file (Constants)
To understand how the generator work check this extension for the Allegro game programming library
https://github.com/ring-lang/ring/tree/master/extensions/ringallegro
At first we have the configuration file
https://github.com/ring-lang/ring/blob/master/extensions/ringallegro/allegro.cf
To write this file, i just used the Allegro documentation + the Ring code generator rules
Then after executing the generator using this batch file
https://github.com/ring-lang/ring/blob/master/extensions/ringallegro/gencode.bat
or using this script
https://github.com/ring-lang/ring/blob/master/extensions/ringallegro/gencode.sh
I get the generated source code file
https://github.com/ring-lang/ring/blob/master/extensions/ringallegro/ring_allegro.c
70.48. How to extend RingQt and add more classes? 830
14. Ring Documentation, Release 1.4
The generated source code file (ring_allegro.c) is around 12,000 Lines of code (12 KLOC)
While the configuration file is less than 1 KLOC
To build the library (create the DLL files)
https://github.com/ring-lang/ring/blob/master/extensions/ringallegro/buildvc.bat
Also you can check this extension for the LibSDL Library
https://github.com/ring-lang/ring/tree/master/extensions/ringsdl
After this know you should know about
1 - Writing the configuration file
2 - Using the Code Generator
3 - Building your library/extension
4 - Using your library/extension from Ring code
Let us move now to you question about Qt
We have RingQt which is just an extension to ring (ringqt.dll)
You don’t need to modify Ring.
1. You just need to modify RingQt
2. Or extend Ring with another extension based on Qt (but the same Qt version)
For the first option see the RingQt extension
https://github.com/ring-lang/ring/tree/master/extensions/ringqt
Configuration file
https://github.com/ring-lang/ring/blob/master/extensions/ringqt/qt.cf
To generate the source code
https://github.com/ring-lang/ring/blob/master/extensions/ringqt/gencode.bat
https://github.com/ring-lang/ring/blob/master/extensions/ringqt/gencode.sh
https://github.com/ring-lang/ring/blob/master/extensions/ringqt/gencodeandroid.bat
To build the DLL/so/Dylib files
https://github.com/ring-lang/ring/blob/master/extensions/ringqt/buildmingw32.bat
https://github.com/ring-lang/ring/blob/master/extensions/ringqt/buildgcc.sh
https://github.com/ring-lang/ring/blob/master/extensions/ringqt/buildclang.sh
Study RingQt
Learn about the options that you have
1. wrapping a Qt class directly
2. Creating a new class then wrapping your new class
For the second option (in the previous two points or in the two points before that)
You will create new classes in C++ code
Then you merge these classes to RingQt or provide special DLL for them (your decision)
If your work is general (will help others) just put it to RingQt.
70.48. How to extend RingQt and add more classes? 831
15. Ring Documentation, Release 1.4
if your work is special (to specific application) just put it in another extension.
70.49 How to add Combobox and other elements to the cells of a
QTableWidget?
Check the next code
Load "guilib.ring"
New qApp
{
win1 = new qMainWindow() {
setGeometry(100,100,1100,370)
setwindowtitle("Using QTableWidget")
Table1 = new qTableWidget(win1) {
setrowcount(10) setcolumncount(10)
setGeometry(0,0,800,400)
setselectionbehavior(QAbstractItemView_SelectRows)
for x = 1 to 10
for y = 1 to 10
item1 = new qtablewidgetitem("R"+X+"C"+Y)
setitem(x-1,y-1, item1)
next
next
cmb = new QComboBox(Table1) {
alist = ["one","two","three","four","five"]
for x in aList additem(x,0) next
}
setCellWidget(5, 5, cmb)
}
setcentralwidget(table1)
show()
}
exec()
}
70.50 How to perform some manipulations on selected cells in
QTableWidget?
Check the next sample
Load "guilib.ring"
New qApp {
win1 = new qMainWindow() {
setGeometry(100,100,800,600)
setwindowtitle("Using QTableWidget")
Table1 = new qTableWidget(win1) {
setrowcount(10) setcolumncount(10)
setGeometry(10,10,400,400)
70.49. How to add Combobox and other elements to the cells of a QTableWidget? 832
16. Ring Documentation, Release 1.4
for x = 1 to 10
for y = 1 to 10
item1 = new qtablewidgetitem("10")
setitem(x-1,y-1,item1)
next
next
}
btn1 = new qPushButton(win1) {
setText("Increase")
setGeometry(510,10,100,30)
setClickEvent("pClick()")
}
show()
}
exec()
}
func pClick
for nRow = 0 to Table1.rowcount() - 1
for nCol = 0 to Table1.columncount() - 1
Table1.item(nRow,nCol) {
if isSelected()
setText( "" + ( 10 + text()) )
ok
}
next
next
70.50. How to perform some manipulations on selected cells in QTableWidget? 833
17. CHAPTER
SEVENTYONE
LANGUAGE REFERENCE
In this chapter we will learn about
• Language keywords
• Language Functions
• Compiler Errors
• Runtime Errors
• Language Grammar
• Virtual Machine (VM) Instructions
71.1 Language Keywords
Keywords Count : 46
• again
• and
• but
• bye
• call
• case
• catch
• changeringkeyword
• changeringoperator
• class
• def
• do
• done
• else
• elseif
• end
• exit
834
18. Ring Documentation, Release 1.4
• for
• from
• func
• get
• give
• if
• import
• in
• load
• loadsyntax
• loop
• new
• next
• not
• off
• ok
• on
• or
• other
• package
• private
• put
• return
• see
• step
• switch
• to
• try
• while
71.2 Language Functions
Functions Count : 233
acos() add() addattribute() adddays() addmethod() ascii()
asin() assert()
atan() atan2() attributes() binarysearch() callgc() ceil()
cfunctions() char()
chdir() classes() classname() clearerr() clock() clockspersecond()
71.2. Language Functions 835
20. Ring Documentation, Release 1.4
• Error (C4) : Unclosed control strucutre, ‘end’ is missing
• Error (C5) : Unclosed control strucutre, next is missing
• Error (C6) : Error in function name
• Error (C7) : Error in list items
• Error (C8) : Parentheses ‘)’ is missing
• Error (C9) : Brackets ‘]’ is missing
• Error (C10) : Error in parent class name
• Error (C11) : Error in expression operator
• Error (C12) :No class definition
• Error (C13) : Error in variable name
• Error (C14) : Try/Catch miss the Catch keyword!
• Error (C15) : Try/Catch miss the Done keyword!
• Error (C16) : Error in Switch statement expression!
• Error (C17) : Switch statement without OFF
• Error (C18) : Missing closing brace for the block opened!
• Error (C19) : Numeric Overflow!
• Error (C20) : Error in package name
• Error (C21) : Unclosed control strucutre, ‘again’ is missing
• Error (C22) : Function redefinition, function is already defined!
• Error (C23) : Using ‘(‘ after number!
• Error (C24) : The parent class name is identical to the subclass name
• Error (C25) : Trying to access the self reference after the object name”
71.4 Runtime Errors
• Error (R1) : Cann’t divide by zero !
• Error (R2) : Array Access (Index out of range) !
• Error (R3) : Calling Function without definition !
• Error (R4) : Stack Overflow !
• Error (R5) : Can’t access the list item, Object is not list !
• Error (R6) : Variable is required
• Error (R7) : Can’t assign to a string letter more than one character
• Error (R8) : Variable is not a string
• Error (R9) : Using exit command outside loops
• Error (R10) : Using exit command with number outside the range
• Error (R11) : error in class name, class not found!
71.4. Runtime Errors 837
21. Ring Documentation, Release 1.4
• Error (R12) : error in property name, property not found!
• Error (R13) : Object is required
• Error (R14) : Calling Method without definition !
• Error (R15) : error in parent class name, class not found!
• Error (R16) : Using braces to access unknown object !
• Error (R17) : error, using ‘Super’ without parent class!
• Error (R18) : Numeric Overflow!
• Error (R19) : Calling function with less number of parameters!
• Error (R20) : Calling function with extra number of parameters!
• Error (R21) : Using operator with values of incorrect type
• Error (R22) : Using loop command outside loops
• Error (R23) : Using loop command with number outside the range
• Error (R24) : Using uninitialized variable
• Error (R25) : Error in package name, Package not found!
• Error (R26) : Calling private method from outside the class
• Error (R27) : Using private attribute from outside the class
• Error (R28) : Using bad data type as step value
• Error (R29) : Using bad data type in for loop
• Error (R30) : parent class name is identical to child class name
• Error (R31) : Trying to destory the object using the self reference
• Error (R32) : The CALL command expect a variable contains string!
• Error (R33) : Bad decimals number (correct range >= 0 and <=14) !
• Error (R34) : Variable is required for the assignment operation
• Error (R35) : Can’t create/open the file!
• Error (R36) : The column number is not correct! It’s greater than the number of columns in the list
71.5 Language Grammar
Program —> {statement}
Statement —> ‘package’ <Identifier> { ‘.’ <Identifier> }
Statement —> ‘class’ <Identifier> [ ‘from’|’:’|’<’ <Identifier> ]
Statement —> ‘func’|’def’ <Identifier> [ParaList]
Statement —> ‘import’ <Identifier> { ‘.’ <Identifier> }
Statement —> ‘private’
Statement —> ‘load’ <Literal>
Statement —> ‘loadsyntax’ <Literal>
71.5. Language Grammar 838
23. Ring Documentation, Release 1.4
Factor —> <List>
Factor —> ‘new’ <Identifier>
Factor —> <AnonymousFunction>
Factor —> ‘call’ <identifier> { ‘.’ <Identifier> } ‘(‘ <Parameters> ‘)’
List —> ‘[’ [ <Expr> { ‘,’ <Expr> } ] ‘]’
Mixer —> { ‘.’ <Identifier> }
Mixer —> ‘[’ <Expr> ‘]’
Mixer —> ‘(‘ [ <Expr> [ { ‘,’ <Expr> }] ] ‘)’
Mixer —> ‘{‘ {Statement} ‘}’
AnonymousFunction —> ‘func’|’def’| [<ParaList>] ‘{‘ {Statement} ‘}’
71.6 Virtual Machine (VM) Instructions
Definitions :-
• VM : Virtual Machine
• Stack : VM Stack
• IR : Instruction Register
• PC : Program Counter
• VP : Variable Pointer
• Stack[nSize] : Last Item in the Stack (Last In - First Out)
• VV : Variable Value (We have a Pointer to a variable, And we access this variable value)
(Stack and Variables)
71.6. Virtual Machine (VM) Instructions 840
24. Ring Documentation, Release 1.4
Operation Description
• ICO_PUSHC
Add string from the IR to the stack
• ICO_PUSHN
Add number from the IR to the stack
• ICO_PUSHV
Replace VP in the stack[nSize] with the variable value
• ICO_LOADADDRESS
Read variable name from the IR, push VP to the stack
• ICO_ASSIGNMENT
Stack[nSize-1] VV = Stack[nSize] VV , POP
Stack[nSize]
• ICO_INC
Increment Number in Stack[nSize] by 1
• ICO_LOADAPUSHV
The same as ICO_LOADADDRESS then ICO_PUSHV
• ICO_NEWLINE
Store new line number (debug info)
• ICO_FREESTACK
Remove all items from the stack , nSize = 0
• ICO_FILENAME
Store the source code file name (debug info)
• ICO_FREELOADASCOPE
Free the Scope List of the current Expression
(Jump)
Operation Description
• ICO_JUMP
Set PC to new value from the IR
• ICO_JUMPZERO
If Stack[nSize] is a number = 0 then Set PC to new value
from the IR
• ICO_JUMPFOR
End of for loop
• ICO_JUMPONE
If Stack[nSize] is a number = 1 then Set PC to new value
from the IR
• ICO_JUMPZERO2
As ICO_JUMPZERO but add 1 to the stack (required
for many ‘AND’ conditions)
• ICO_JUMPONE2
As ICO_JUMPONE but add 1 to the stack (required for
many ‘OR’ conditions)
(Compare)
71.6. Virtual Machine (VM) Instructions 841
25. Ring Documentation, Release 1.4
Operation Description
• ICO_LESSEQUAL
If stack[nSize-1] <= stack[nSize] , POP stack[nSize], set
Stack[nSize-1] = 1 else set Stack[nSize-1] = 0
• ICO_EQUAL
If stack[nSize-1] = stack[nSize] , POP stack[nSize], set
Stack[nSize-1] = 1 else set Stack[nSize-1] = 0
• ICO_LESS
If stack[nSize-1] < stack[nSize] , POP stack[nSize], set
Stack[nSize-1] = 1 else set Stack[nSize-1] = 0
• ICO_GREATER
If stack[nSize-1] > stack[nSize] , POP stack[nSize], set
Stack[nSize-1] = 1 else set Stack[nSize-1] = 0
• ICO_GREATEREQUAL
If stack[nSize-1] >= stack[nSize] , POP stack[nSize], set
Stack[nSize-1] = 1 else set Stack[nSize-1] = 0
• ICO_NOTEQUAL
If stack[nSize-1] != stack[nSize] , POP stack[nSize], set
Stack[nSize-1] = 1 else set Stack[nSize-1] = 0
(Math)
Operation Description
• ICO_SUM
Stack[nSize-1] = Stack[nSize-1] + Stack[nSize] , POP
stack[nSize]
• ICO_SUB
Stack[nSize-1] = Stack[nSize-1] - Stack[nSize] , POP
stack[nSize]
• ICO_MUL
Stack[nSize-1] = Stack[nSize-1] * Stack[nSize] , POP
stack[nSize]
• ICO_DIV
Stack[nSize-1] = Stack[nSize-1] / Stack[nSize] , POP
stack[nSize]
• ICO_MOD
Stack[nSize-1] = Stack[nSize-1] % Stack[nSize] , POP
stack[nSize]
• ICO_NEG
Stack[nSize] = - Stack[nSize-1]
• ICO_PLUSPLUS
Stack[nSize] = Stack[nSize] + 1
• ICO_MINUSMINUS
Stack[nSize] = Stack[nSize] - 1
(Logic)
Operation Description
• ICO_AND
Stack[nSize-1] = Stack[nSize-1] && Stack[nSize] ,
POP stack[nSize]
• ICO_OR
Stack[nSize-1] = Stack[nSize-1] || Stack[nSize] , POP
stack[nSize]
• ICO_NOT
Stack[nSize] = ! Stack[nSize]
(Lists)
71.6. Virtual Machine (VM) Instructions 842
26. Ring Documentation, Release 1.4
Operation Description
• ICO_LISTSTART
Start New List in Temp. Memory
• ICO_LISTITEM
Add List Item
• ICO_LISTEND
End List
• ICO_LOADINDEXADDRESS
Stack[nSize-1] = Stack[nSize-1] VV [ Stack[nSize] ] ,
POP stack[nSize]
(Functions)
Operation Description
• ICO_LOADFUNC
Find function
• ICO_CALL
Call function
• ICO_RETURN
Return from function
• ICO_RETNULL
Return NULl from function
• ICO_RETFROMEVAL
Return after eval()
• ICO_RETITEMREF
Return the list item reference - not the value
• ICO_NEWFUNC
Start new function
• ICO_BLOCKFLAG
Flag to determine where to jump later (after
ICO_RETURN)
• ICO_FUNCEXE
Start executing function
• ICO_ENDFUNCEXE
End function execution
• ICO_ANONYMOUS
Anonymous function
(User Interface)
Operation Description
• ICO_PRINT
Print value to the standard output
• ICO_GIVE
Get input from the keyboard
(End Program/Loop)
71.6. Virtual Machine (VM) Instructions 843
27. Ring Documentation, Release 1.4
Operation Description
• ICO_BYE
End execution of VM
• ICO_EXITMARK
Place to exit to from a loop
• ICO_POPEXITMARK
Remove exit mark
• ICO_EXIT
Break from one loop or more
• ICO_LOOP
Continue to next loop
(For Better Performance)
Operation Description
• ICO_PUSHP
Push pointer to the stack
• ICO_INCP
Increment variable value using pointer
• ICO_PUSHPV
Push value of variable using variable pointer
• ICO_INCJUMP
Increment then jump
• ICO_INCPJUMP
Increment using pointer then jump
• ICO_JUMPVARLENUM
Jump if variable value is <= numeric value
• ICO_JUMPVARPLENUM
Jump if variable value (using pointer) <= numeric value
• ICO_LOADFUNCP
Push function pointer
• ICO_PUSHPLOCAL
Push pointer to local variable
• ICO_INCLPJUMP
Increment value using pointer to local variable then
jump
• ICO_JUMPVARLPLENUM
Jump if the variable value (using pointer) <= numeric
value
• ICO_INCPJUMPSTEP1
Increment value using variable pointer then jump (for
loop step = 1)
• ICO_JUMPVARPLENUMSTEP1
Increment value using variable pointer then jump (for
loop step = 1)
(Try-Catch-Done)
71.6. Virtual Machine (VM) Instructions 844
28. Ring Documentation, Release 1.4
Operation Description
• ICO_TRY
Start try region
• ICO_DONE
End try region
(Duplicate and Range)
Operation Description
• ICO_DUPLICATE
Duplicate stack value
• ICO_RANGE
Create list from value to value
(OOP)
Operation Description
• ICO_NEWOBJ
Create new object, get class name from the IR, push ob-
ject pointer to the stack.
• ICO_SETSCOPE
Called after creating new object, set the active scope to
be the object scope.
• ICO_LOADSUBADDRESS
Get object attribute, push the pointer to the stack.
• ICO_LOADMETHOD
Find object method
• ICO_AFTERCALLMETHOD
Used after calling a method - normal case
• ICO_AFTERCALLMETHOD2
Used after calling a method - second case
• ICO_NEWCLASS
Start new class region
• ICO_BRACESTART
Open brace
• ICO_BRACEEND
End brace
• ICO_IMPORT
Import package
• ICO_PRIVATE
start private attributes region
• ICO_SETPROPERTY
set attribute value - check for setter.
• ICO_CALLCLASSINIT
call call init() method.
(Other)
71.6. Virtual Machine (VM) Instructions 845
29. Ring Documentation, Release 1.4
Operation Description
• ICO_SETREFERENCE
Copy by reference
• ICO_KILLREFERENCE
Remove reference
• ICO_ASSIGNMENTPOINTER
Determine the left side variable
• ICO_BEFOREEQUAL
Determine operators like += , -= , ... etc
(Bitwise Operators)
Operation Description
• ICO_BITAND
Stack[nSize-1] = Stack[nSize-1] & Stack[nSize] , POP
stack[nSize]
• ICO_BITOR
Stack[nSize-1] = Stack[nSize-1] | Stack[nSize] , POP
stack[nSize]
• ICO_BITXOR
Stack[nSize-1] = Stack[nSize-1] ^ Stack[nSize] , POP
stack[nSize]
• ICO_BITNOT
Stack[nSize] = ! Stack[nSize]
• ICO_BITSHL
Stack[nSize-1] = Stack[nSize-1] << Stack[nSize] , POP
stack[nSize]
• ICO_BITSHR
Stack[nSize-1] = Stack[nSize-1] >> Stack[nSize] , POP
stack[nSize]
(For Step)
Operation Description
• ICO_STEPNUMBER
Determine step number in for loop
• ICO_POPSTEP
POP step number from steps stack
• ICO_LOADAFIRST
Load the first address of variable name
71.6. Virtual Machine (VM) Instructions 846
30. CHAPTER
SEVENTYTWO
RESOURCES
In this section you will find resources about the language
72.1 Ring Language Website
For news about the language check the website
http://ring-lang.net
http://ring-lang.sf.net
72.2 Ring Group
For questions use the Ring Group (English)
https://groups.google.com/forum/#!forum/ring-lang
72.3 Contact the Authors
Name : Eng. Mahmoud Samir Fayed
Country : Egypt
Email : msfclipper@yahoo.com
Facebook : https://facebook.com/mahmoudfayed1986
LinkedIn : https://sa.linkedin.com/in/mahmoudfayed1986
Name : Dr. Atif M. Alamri
Country : Saudi Arabia
Email : atif@ksu.edu.sa
LinkedIn : https://sa.linkedin.com/in/dr-atif-alamri-8b341747
Ring Team : http://ring-lang.sourceforge.net/team.html
847