Here are a few examples of getting started with Ring:16.1 Hello Worldprint "Hello World!"16.2 Run the programSave the code in a file called hello.ring and run it:ring hello.ring16.3 Create an ExecutableUse Ring2EXE to compile it to an executable: ring2exe hello.ring -o hello16.4 Multi-line StringYou can use triple quotes for multi-line strings:message = """Hello World!"""print message16.5 VariablesDeclare and assign variables:name = "John"age = 30print
1. Write a simple "Hello World" program that prints the message to the screen.
2. Save the code in a file (e.g. hello.ring) and run it from the command line using the ring command.
3. Use Ring2EXE to compile the program into an executable file that can be run without Ring.
4. Ring is not case-sensitive so keywords can be in any case style consistently.
5. Multi-line strings can be written using here-doc syntax for readability in larger programs.
Similar to Here are a few examples of getting started with Ring:16.1 Hello Worldprint "Hello World!"16.2 Run the programSave the code in a file called hello.ring and run it:ring hello.ring16.3 Create an ExecutableUse Ring2EXE to compile it to an executable: ring2exe hello.ring -o hello16.4 Multi-line StringYou can use triple quotes for multi-line strings:message = """Hello World!"""print message16.5 VariablesDeclare and assign variables:name = "John"age = 30print
Similar to Here are a few examples of getting started with Ring:16.1 Hello Worldprint "Hello World!"16.2 Run the programSave the code in a file called hello.ring and run it:ring hello.ring16.3 Create an ExecutableUse Ring2EXE to compile it to an executable: ring2exe hello.ring -o hello16.4 Multi-line StringYou can use triple quotes for multi-line strings:message = """Hello World!"""print message16.5 VariablesDeclare and assign variables:name = "John"age = 30print (20)
A Secure and Reliable Document Management System is Essential.docx
Here are a few examples of getting started with Ring:16.1 Hello Worldprint "Hello World!"16.2 Run the programSave the code in a file called hello.ring and run it:ring hello.ring16.3 Create an ExecutableUse Ring2EXE to compile it to an executable: ring2exe hello.ring -o hello16.4 Multi-line StringYou can use triple quotes for multi-line strings:message = """Hello World!"""print message16.5 VariablesDeclare and assign variables:name = "John"age = 30print
1. Ring Documentation, Release 1.10
Build RingInternet
cd ../extensions/ringinternet
./buildgcc.sh
Generate RingLibCurl Source Code and Build
cd ../extensions/ringcurl
./gencode.sh
./buildgcc.sh
Build RingPM
cd ../ringpm
sudo ./buildringpm.sh
Build RingODBC
cd ../extensions/ringodbc
./buildgcc.sh
Build RingMySQL
cd ../extensions/ringmysql
./buildgcc.sh
Build RingSQLite
cd ../extensions/ringsqlite
./buildgcc.sh
Build RingPostgreSQL
cd ../extensions/ringpostgresql
gencode.sh
buildgcc.sh
Build RingOpenSSL
cd ../extensions/ringopenssl
./buildgcc.sh
Build RingMurmurHash
cd ../extensions/ringmurmurhash
./buildgcc.sh
Generate RingAllegro Source Code and Build
cd ../extensions/ringallegro
./gencode.sh
./buildgcc.sh
Generate RingZip Source Code and Build
cd ../extensions/ringzip
./gencode.sh
./buildgcc.sh
Generate RingLibuv Source Code and Build
We will build Libuv first
14.2. Building using Ubuntu Linux 188
2. Ring Documentation, Release 1.10
cd ../extensions/ringlibuv/libuv
sudo apt-get install libtool m4 automake
sh autogen.sh
./configure
make
make check
sudo make install
Then we will build RingLibuv
cd ..
./gencode.sh
./buildgcc.sh
Generate RingFreeGLUT Source Code and Build
cd ../extensions/ringfreeglut
./gencode.sh
./buildgcc.sh
Generate RingOpenGL Source Code and Build
The ringopengl folder contains many sub folders for different OpenGL versions
Starting from OpenGL 1.1 to OpenGL 4.6
cd ../extensions/ringopengl/opengl21
gencode.sh
buildgcc.sh
Generate RingPostgreSQL Source Code and Build
cd ../extensions/ringpostgresql
./gencode.sh
./buildgcc.sh
Generate RingQt Source Code and Build
cd ../extensions/ringqt
./gencode.sh
./buildgcc.sh
To be able to call ring from any folder
cd ../../bin
sudo ./install.sh
Run Ring Notepad
cd applications/rnote
ring rnote.ring
14.3 Building using Fedora Linux
Get the source code
git clone http://github.com/ring-lang/ring.git
Install Libraries
14.3. Building using Fedora Linux 189
3. Ring Documentation, Release 1.10
cd ring/src
./installdepfedora.sh
Build Ring (Compiler/VM)
sudo ./buildgcc.sh
Build Ring2EXE
cd ../ring2exe
sudo ./buildring2exe.sh
Generate RingConsoleColors Source Code and Build
cd ../extensions/ringconsolecolors
./gencode.sh
./buildgcc.sh
Build RingInternet
cd ../extensions/ringinternet
./buildgcc.sh
Generate RingLibCurl Source Code and Build
cd ../extensions/ringcurl
./gencode.sh
./buildgcc.sh
Build RingPM
cd ../ringpm
sudo ./buildringpm.sh
Build RingODBC
cd ../extensions/ringodbc
./buildgcc.sh
Build RingMySQL
cd ../extensions/ringmysql
./buildgccfedora.sh
Build RingSQLite
cd ../extensions/ringsqlite
./buildgcc.sh
Build RingPostgreSQL
cd ../extensions/ringpostgresql
gencode.sh
buildgcc.sh
Build RingOpenSSL
cd ../extensions/ringopenssl
./buildgcc.sh
Build RingMurmurHash
14.3. Building using Fedora Linux 190
4. Ring Documentation, Release 1.10
cd ../extensions/ringmurmurhash
./buildgcc.sh
Generate RingAllegro Source Code and Build
cd ../extensions/ringallegro
./gencode.sh
./buildgcc.sh
Generate RingZip Source Code and Build
cd ../extensions/ringzip
./gencode.sh
./buildgcc.sh
Generate RingLibuv Source Code and Build
We will build Libuv first
cd ../extensions/ringlibuv/libuv
sudo dnf install libtool m4 autoconf automake
sh autogen.sh
./configure
make
make check
sudo make install
Then we will build RingLibuv
cd ..
./gencode.sh
./buildgcc.sh
Generate RingFreeGLUT Source Code and Build
cd ../extensions/ringfreeglut
./gencode.sh
./buildgcc.sh
Generate RingOpenGL Source Code and Build
The ringopengl folder contains many sub folders for different OpenGL versions
Starting from OpenGL 1.1 to OpenGL 4.6
cd ../extensions/ringopengl/opengl21
gencode.sh
buildgcc.sh
Generate RingPostgreSQL Source Code and Build
cd ../extensions/ringpostgresql
./gencode.sh
./buildgcc.sh
Generate RingQt Source Code and Build
cd ../extensions/ringqt
./gencode.sh
./buildgccfedora.sh
To be able to call ring from any folder
14.3. Building using Fedora Linux 191
5. Ring Documentation, Release 1.10
cd ../../bin
sudo ./install.sh
Run Ring Notepad
cd applications/rnote
ring rnote.ring
14.4 Building using MacOS X
Get the source code
git clone http://github.com/ring-lang/ring.git
Install homebrew (follow the directions on homebrew’s homepage). Install Libraries
cd ring/src
./installdepmac.sh
Build Ring (Compiler/VM)
./buildclang.sh
Build Ring2EXE
cd ../ring2exe
sudo ./buildring2exe.sh
Generate RingConsoleColors Source Code and Build
cd ../extensions/ringconsolecolors
./gencode.sh
./buildclang.sh
Build RingInternet
cd ../extensions/ringinternet
./buildclang.sh
Generate RingLibCurl Source Code and Build
cd ../extensions/ringcurl
./gencode.sh
./buildclang.sh
Build RingPM
cd ../ringpm
sudo ./buildringpm.sh
Build RingODBC
cd ../extensions/ringodbc
./buildclang.sh
Build RingMySQL
cd ../extensions/ringmysql
./buildclang.sh
14.4. Building using MacOS X 192
6. Ring Documentation, Release 1.10
Build RingSQLite
cd ../extensions/ringsqlite
./buildclang.sh
Build RingPostgreSQL
cd ../extensions/ringpostgresql
gencode.sh
buildclang.sh
Build RingOpenSSL
cd ../extensions/ringopenssl
./buildclang.sh
Build RingMurmurHash
cd ../extensions/ringmurmurhash
./buildclang.sh
Generate RingAllegro Source Code and Build
cd ../extensions/ringallegro
./gencode.sh
./buildclang.sh
Generate RingZip Source Code and Build
cd ../extensions/ringzip
./gencode.sh
./buildclang.sh
Generate RingLibuv Source Code and Build
cd ../extensions/ringlibuv
./gencode.sh
./buildclang.sh
Generate RingFreeGLUT Source Code and Build
cd ../extensions/ringfreeglut
./gencode.sh
./buildclang.sh
Generate RingOpenGL Source Code and Build
The ringopengl folder contains many sub folders for different OpenGL versions Starting from OpenGL 1.1 to OpenGL
4.6
cd ../extensions/ringopengl/opengl21
./gencode.sh
./buildclang.sh
Generate RingPostgreSQL Source Code and Build
cd ../extensions/ringpostgresql
./gencode.sh
./buildclang.sh
Generate RingQt Source Code and Build
14.4. Building using MacOS X 193
7. Ring Documentation, Release 1.10
cd ../extensions/ringqt
./gencodemac.sh
./buildclang.sh
To be able to call ring from any folder
cd ../../bin
sudo ./install.sh
Run Ring Notepad
cd applications/rnote
sudo ring rnote.ring
14.5 Building using CMake
Install libraries (MySQL Client, OpenSSL, LibCurl, Allegro 5 and Qt 5.5)
cmake .
make
14.5. Building using CMake 194
8. CHAPTER
FIFTEEN
HOW TO CONTRIBUTE?
Ring is a free-open source project, Everyone is welcome to contribute to Ring.
Project Home : https://github.com/ring-lang/ring
You can help in many parts in the project
• Documentation
• Testing
• Samples
• Applications
• Editors Support
• Libraries in Ring
• Extensions in C/C++
• Compiler and Virtual Machine (VM)
• Ideas and suggestions
15.1 Special thanks to contributors
Throughout the creation of this project, Ring relied heavily on contributions from experts along with college students.
Their input was invaluable, and we want to take a moment to thank them and recognize them for all of their hard work.
Ring Team: http://ring-lang.sf.net/team.html
15.2 Documentation
You can modify anything in the documentation, by updating the text files (*.txt) in this folder : https://github.com/ring-
lang/ring/tree/master/docs/source
The documentation is created using Sphinx : http://www.sphinx-doc.org/en/stable/
15.3 Testing
You can write new tests in this folder
https://github.com/ring-lang/ring/tree/master/tests/scripts
195
9. Ring Documentation, Release 1.10
15.4 Samples
You can add new samples to this folder
https://github.com/ring-lang/ring/tree/master/samples/other
15.5 Applications
You can add new applications to this folder
https://github.com/ring-lang/ring/tree/master/applications
15.6 Editors Support
You can help in supporting Ring in different code editors
Check the next folder
https://github.com/ring-lang/ring/tree/master/editor
15.7 Libraries in Ring
You can update and add libraries to this folder
https://github.com/ring-lang/ring/tree/master/ringlibs
15.8 Extensions in C/C++
You can add and update extensions in this folder
https://github.com/ring-lang/ring/tree/master/extensions
15.9 Compiler and Virtual Machine (VM)
• Source Code (C Language) : https://github.com/ring-lang/ring/tree/master/src
• Visual Source (PWCT) : https://github.com/ring-lang/ring/tree/master/visualsrc
15.10 Ideas and suggestions
You can share your ideas, suggestions and questions in this group
https://groups.google.com/forum/#!forum/ring-lang
15.4. Samples 196
10. CHAPTER
SIXTEEN
GETTING STARTED - FIRST STYLE
16.1 Hello World
The next program prints the Hello World message on the screen (std-out).
see "Hello World"
16.2 Run the program
to run the program, save the code in a file, for example : hello.ring then from the command line or terminal, run it
using Ring
ring hello.ring
16.3 Create Executable File
Using Ring2EXE we can create executable file for our application
ring2exe hello.ring -static
16.4 Not Case-Sensitive
Since the Ring language is not case-sensitive, the same program can be written in different styles
Tip: It’s better to select one style and use it in all of the program source code
SEE "Hello World"
See "Hello World"
16.5 Multi-Line literals
Using Ring we can write multi-line literal, see the next example
197