2 single: What is new in Ring 1.4?; Introduction
4 ========================
5 What is new in Ring 1.4?
6 ========================
8 In this chapter we will learn about the changes and new features in Ring 1.4 release.
11 pair: What is new in Ring 1.4?; List of changes and new features
13 List of changes and new features
14 ================================
16 Ring 1.4 comes with many new features
18 * Change: Basic Extensions are separated from RingVM
20 * New Style is added to Ring Notepad
22 * Convert between Numbers and Bytes
29 pair: What is new in Ring 1.4?; Change: Basic Extensions are separated from RingVM
31 Change: Basic Extensions are separated from RingVM
32 ==================================================
34 In Ring 1.4 the next libraries are separated from RingVM
42 To use these libraries, Use the Load command.
57 # use SQLite Functions
61 load "openssllib.ring"
62 # use OpenSSL Functions ( Hash and Security functions)
66 load "internetlib.ring"
67 # use Internet Functions ( Download() and SendEmail() )
69 If you will use all of these libraries, You can just use stdlib.ring
70 And the stdlib.ring will load odbclib.ring, mysqllib.ring, sqlitelib.ring,
71 opensslib.ring and internetlib.ring files.
78 pair: What is new in Ring 1.4?; The Natural Library
83 Ring 1.4 comes with the Natural Library to quickly define a language that contains
86 We will write the natural code in a Text file, for example program.txt
92 Welcome to the Ring programming language!
93 What you are reading now is not comments, I swear!
95 After many years of programming I decided to think different about
96 programming and solve the problems in a better way.
98 We are writing commands or code and the Ring language is reading
99 it to understand us! Sure, What you are seeing now is
100 just ***part of the code - Not the Complete Program***
101 You have to write little things before and after this
102 part to be able to run it!
104 It is the natural part of our code where we can write in English,
105 Arabic or any Natural Language Then we will tell the computer
106 through the Ring language what must happens! in a way that we can scale
107 for large frameworks and programs.
109 Just imagine what will happens to the world of programming once
110 we create many powerful frameworks using the Ring language that
111 uses this way (Natural Programming).
113 For example When we say Hello to the Machine, It can reply! and when we
114 say count from 1 to 5 it will understand us, Also if
115 we said count from 5 to 1 it will
116 understand us too! You can see the Output window!
118 This Goal is not new, but the Ring language comes
119 with an innovative solution to this problem.
153 To execute the natural code, We have start.ring
155 In start.ring we define the language and the commands.
162 load "naturallib.ring"
164 New NaturalLanguage {
165 SetLanguageName(:MyLanguage)
166 SetCommandsPath(CurrentDir()+"/../command")
167 SetPackageName("MyLanguage.Natural")
170 RunFile("program.txt")
174 We defined a language called MyLanguage, We have folder for the language commands.
176 Each command will define a class that belong to the MyLanguage.Natural package.
178 We will define two commands, Hello and Count.
180 So we must have two files for defining the commands in the CurrentDir()+"/../command" folder
186 DefineNaturalCommand.SyntaxIsKeyword([
187 :Package = "MyLanguage.Natural",
190 See "Hello, Sir!" + nl + nl
198 DefineNaturalCommand.SyntaxIsKeywordNumberNumber([
199 :Package = "MyLanguage.Natural",
202 if not isattribute(self,:count_times) {
203 AddAttribute(self,:count_times)
206 if Expr(1) > Expr(2) {
212 see nl+"The Numbers!" + nl
215 see nl + "I will count Again!" +nl
217 for x = Expr(1) to Expr(2) step nStep {
220 CommandReturn(fabs(Expr(1)-Expr(2))+1)
227 pair: What is new in Ring 1.4?; New Style to Ring Notepad
229 New Style is added to Ring Notepad
230 ==================================
232 In Ring Notepad - From View - Styles - Select the (Modern) Style
236 .. image:: rnotemodernstyle.png
237 :alt: Using Ring Notepad - Modern Style
240 pair: What is new in Ring 1.4?; RingREPL
245 In the application folder, You will find RingREPL (Read-Eval-Print-Loop)
247 Also you can run it from Ring Notepad (Menubar - Tools)
251 .. image:: ringrepl.png
255 pair: What is new in Ring 1.4?; Convert between Numbers and Bytes
257 Convert between Numbers and Bytes
258 =================================
260 Ring 1.4 comes with the next functions to convert between Numbers and Bytes.
273 see "Test Int2Bytes() and Bytes2Int() - Value : 77" + nl
275 see "Int Size : " + len(r) + nl
277 see Bytes2Int(r) + nl
278 see "Test Float2Bytes() and Bytes2Float() - Value 77.12" + nl
279 r = Float2Bytes(77.12)
280 see "Float Size : " + len(r) + nl
282 see Bytes2Float(r) + nl
283 see "Test Double2Bytes() and Bytes2Double() - Value 9999977.12345" + nl
284 r = Double2Bytes(9999977.12345)
285 see "Double Size : " + len(r) + nl
288 see Bytes2Double(r) + nl
292 pair: What is new in Ring 1.4?; Better StdLib
297 The StdLib is updated to include the next functions
301 The print() function is updated to accept local variables.
308 print("Enter your name : ") ;
310 print( "Hello : #{Name} ") ;
315 pair: What is new in Ring 1.4?; Better WebLib
320 The web library is updated
322 * Provide better error message
324 (1) Error (WebLib-1) : REQUEST_METHOD is empty ! - Run this script from the browser
326 (2) Error (DataLib-1) : Can't connect to the database server!
328 * Better Template() function - can accept NULL instead of object as the second paramter.
332 html(template("main.rhtml",NULL))
334 * The Form Class is updated to support the "target" attribute.
340 Title = "The Ring Programming Language"
341 html(template("main.rhtml",NULL))
343 classname = :container
348 backgroundcolor = "white"
354 Target = "codeoutput"
355 input { type="hidden" name="page" value=1 }
358 style = stylewidth("100%") +
369 <textarea name = "cCode"
371 style="width : 100%; ">
372 See "Hello, World!" + nl
377 Input { type = "submit"
378 classname="btn btn-primary btn-block"
382 style = stylewidth("100%") +
393 <iframe name="codeoutput"
395 style="background-color:white;">
405 html(template("footer.rhtml",NULL))
410 pair: What is new in Ring 1.4?; Better RingQt
415 The next functions are added to RingQt
417 * SetDialogIcon(cIconFile)
418 * MsgInfo(cTitle,cMessage)
419 * ConfirmMsg(cTitle,cMessage)
420 * InputBox(cTitle,cMessage)
421 * InputBoxInt(cTitle,cMessage)
422 * InputBoxNum(cTitle,cMessage)
423 * InputBoxPass(cTitle,cMessage)
425 The next classes are added to RingQt
432 pair: What is new in Ring 1.4?; Qt Class Convertor
437 Ring 1.4 comes with a simple tool that help in porting Qt classes to RingQt.
439 You will find it in ring/samples/tools/QtClassConverter
441 Online : https://github.com/ring-lang/ring/tree/master/samples/tools/QtClassConverter
445 .. image:: qtclassconvertor.png
446 :alt: Qt Class convertor to RingQt
449 pair: What is new in Ring 1.4?; What is new in Ring 1.4.1?
452 What is new in Ring 1.4.1?
453 ==========================
455 Ring 1.4.1 comes with the next changes
457 * Better Scripts for Building from Source Code
458 * Better Colors for the Modern Style in Ring Notepad
461 * New Sample : Sixteen Puzzle
463 The scripts are updated for building from source code.
465 Tested using Windows, Ubuntu Linux, Linux Mint and MacOS X.
469 .. image:: linuxmint.png
470 :alt: Using Ring - Linux Mint
472 In Ring Notepad - the (Modern) Style colors are updated
476 .. image:: rnotemodernstyle2.png
477 :alt: Using Ring Notepad - Modern Style
479 The StdLib is updated to include the next functions
486 The next functions are updated to display the dialogs on the top of other windows.
488 * SetDialogIcon(cIconFile)
489 * MsgInfo(cTitle,cMessage)
490 * ConfirmMsg(cTitle,cMessage)
491 * InputBox(cTitle,cMessage)
492 * InputBoxInt(cTitle,cMessage)
493 * InputBoxNum(cTitle,cMessage)
494 * InputBoxPass(cTitle,cMessage)
496 The Sixteen Puzzle is added to the Applications folder.
500 .. image:: sixteenpuzzle.jpg