OSDN Git Service

【修正内容】
[ring-lang-081/ring.git] / docs / en / target / whatisnew12.txt
1 .. index:: 
2         single: What is new in Ring 1.12?; Introduction
3
4 =========================
5 What is new in Ring 1.12?
6 =========================
7
8 In this chapter we will learn about the changes and new features in Ring 1.12 release.
9
10 .. index:: 
11         pair: What is new in Ring 1.12?; List of changes and new features
12
13 List of changes and new features
14 ================================
15
16 Ring 1.12 comes with the next features!
17
18 * Go Game
19 * ASCII Table application
20 * BMI Calculator application
21 * Calendar application
22 * Julian Day Calendar application
23 * Tutorial: Number to Words
24 * Load Again Command
25 * ring_state_filetokens() function
26 * Embedded Ring Object File 
27 * Better RingRayLib
28 * More Improvements
29
30 .. index:: 
31         pair: What is new in Ring 1.12?; Go Game
32
33 Go Game
34 =======
35
36 An implementation for the Go Game
37
38 .. image:: go.png
39         :alt: Go Game
40
41 .. index:: 
42         pair: What is new in Ring 1.12?; ASCII Table application
43
44 ASCII Table application
45 =======================
46
47 Simple application for displaying the ASCII table 
48
49 .. image:: asciitable.png
50         :alt: ASCII Table
51
52 .. index:: 
53         pair: What is new in Ring 1.12?; BMI Calculator application
54
55 BMI Calculator application
56 ==========================
57
58 Simple application for calculating the BMI 
59
60 .. image:: BMI.png
61         :alt: BMI
62
63 .. index:: 
64         pair: What is new in Ring 1.12?; Calendar application
65
66 Calendar application
67 ====================
68
69 The Calendar for Year 2020
70
71 .. image:: calendar.png
72         :alt: calendar
73
74 .. index:: 
75         pair: What is new in Ring 1.12?; Julian Day Calendar application
76
77 Julian Day Calendar application
78 ===============================
79
80 The Julian Day Calendar application
81
82 .. image:: juliancalendar.png
83         :alt: juliandaycalendar
84
85
86 .. index:: 
87         pair: What is new in Ring 1.12?; Tutorial: Number to Words
88
89 Tutorial: Number to Words
90 =========================
91
92 Folder : ring/samples/other/number2words
93
94 .. image:: number2words.png
95         :alt: Number2Words
96
97 .. index:: 
98         pair: What is new in Ring 1.12?; Load Again Command
99
100 Load Again Command
101 ==================
102
103 Ring 1.12 comes with the Load Again command
104
105 Using this command we can load the Ring source file which contains constants more than one time.
106
107 This is useful when using Ring source files for translations through global constants.
108
109 Example:
110
111 The next function is part from a project which support Arabic and English languages
112
113 The files english.ring and arabic.ring contains constants for translation
114
115 One of these files is loaded in the start of the program
116
117 Loading the same file again using the (Load) command is not possible
118
119 Because the (Load) command load the same source file only for the first time and ignore next times.
120
121 So we have to use the (Load Again) command.
122
123 Where we can use these files again during the runtime as in the next code
124
125 .. code-block:: ring
126
127         func setLang nLanguage
128                 if C_ENV_DEFAULT_LANG = nLanguage
129                         return
130                 ok
131                 C_ENV_DEFAULT_LANG = nLanguage
132                 # Change the language
133                         switch nLanguage 
134                                 on C_TRANSLATION_ENGLISH
135                                         load again "translation/english.ring"
136                                 on C_TRANSLATION_ARABIC 
137                                         load again "translation/arabic.ring"
138                         off
139
140 .. index:: 
141         pair: What is new in Ring 1.12?; ring_state_filetokens() function
142
143 ring_state_filetokens() function
144 ================================
145
146 Using the ring_state_filetokens() function we can get all the tokens in the ring source code file.
147
148 .. code-block:: ring
149
150         C_FILENAME      = "test_tokens.ring"
151         C_WIDTH         = 12
152
153         # write the file
154                 write(C_FILENAME,'
155                                 see "Hello, World!"
156                                 ? 3*2+3
157                                 Name = "Ring"
158                                 ? Name
159         ')
160
161         # Token Type
162                 C_KEYWORD       = 0
163                 C_OPERATOR      = 1
164                 C_LITERAL       = 2
165                 C_NUMBER        = 3
166                 C_IDENTIFIER    = 4
167                 C_ENDLINE       = 5
168
169         # Keywords List
170         aKEYWORDS = ["IF","TO","OR","AND","NOT","FOR","NEW","FUNC", 
171         "FROM","NEXT","LOAD","ELSE","SEE","WHILE","OK","CLASS","RETURN","BUT", 
172         "END","GIVE","BYE","EXIT","TRY","CATCH","DONE","SWITCH","ON","OTHER","OFF", 
173         "IN","LOOP","PACKAGE","IMPORT","PRIVATE","STEP","DO","AGAIN","CALL","ELSEIF", 
174         "PUT","GET","CASE","DEF","ENDFUNC","ENDCLASS","ENDPACKAGE", 
175         "CHANGERINGKEYWORD","CHANGERINGOPERATOR","LOADSYNTAX"]
176
177         pState = ring_state_new()
178         aList = ring_state_filetokens(pState,C_FILENAME)
179         PrintTokens(aList)
180         ring_state_delete(pState)
181
182         func PrintTokens aList
183                 for aToken in aList
184                         switch aToken[1]
185                         on C_KEYWORD 
186                                 ? Width("Keyword",C_WIDTH) + ": "  + aKeywords[0+aToken[2]]
187                         on C_OPERATOR 
188                                 ? Width("Operator",C_WIDTH)  + ": " + aToken[2]
189                         on C_LITERAL 
190                                 ? Width("Literal",C_WIDTH)  + ": " + aToken[2]
191                         on C_NUMBER 
192                                 ? Width("Number",C_WIDTH)  + ": " + aToken[2]
193                         on C_IDENTIFIER 
194                                 ? Width("Identifier",C_WIDTH)  + ": " + aToken[2]
195                         on C_ENDLINE 
196                                 ? "EndLine"
197                         other
198                                 
199                         off
200                 next
201
202         func Width cText,nWidth
203                 return cText+copy(" ",nWidth-len(cText))
204
205 Output:
206
207 .. code-block:: none
208
209         EndLine
210         Keyword     : SEE
211         Literal     : Hello, World!
212         EndLine
213         Operator    : ?
214         Number      : 3
215         Operator    : *
216         Number      : 2
217         Operator    : +
218         Number      : 3
219         EndLine
220         Identifier  : name
221         Operator    : =
222         Literal     : Ring
223         EndLine
224         Operator    : ?
225         Identifier  : name
226         EndLine
227
228 .. index:: 
229         pair: What is new in Ring 1.12?; Generate Embedded Object File
230
231 Generate Embedded Ring Object File
232 ==================================
233
234 We can generate embedded object file (C source code) from the source code file (*.ring) 
235 using -geo option
236
237 Command:
238
239 .. code-block:: ring
240
241         ring test.ring -geo
242
243 This command will generate at least three files
244
245 .. code-block:: ring
246
247         test.c
248         ringappcode.c
249         ringappcode.h
250
251 More files could be generated based on the project size
252
253 The generated files will pass the byte code to Ring VM to be executed
254
255 .. index:: 
256         pair: What is new in Ring 1.12?; Better RingRayLib
257
258 Better RingRayLib
259 =================
260
261 More Samples are added to RingRayLib
262
263         * Sound Loading Playing 
264         * Texture Source 
265         * Music Playing Streaming 
266         * Rectangle scaling 
267         * Colors Palette
268         * Following Eyes
269         * Collision Area
270         * Bezier Lines
271         * Images Generation
272         * Fiften Puzzle Game
273         * Cubic Map
274
275 Screen Shot:
276         
277 .. image:: raylib_cubicmap.png
278         :alt: RayLib Example    
279
280 .. index:: 
281         pair: What is new in Ring 1.12?; More Improvements
282
283 More Improvements
284 =================
285
286 * New Samples 
287         * ring/samples/other/Hex2UTF8.ring
288         * ring/samples/other/CalmoSoftPrimesTable.ring
289         * ring/samples/other/CalmoSoftTicTacToeGame.ring
290         * ring/samples/other/CalmoSoftSimpleGoGame.ring
291         * ring/samples/other/arabicmysql.ring 
292         * ring/samples/other/CalmoSoftExtraCube.ring
293         * ring/samples/other/DynamicCode/anonfunc.ring
294         * ring/samples/other/DynamicCode/deletethisfile.ring
295         * ring/samples/other/DynamicCode/modifythisfile.ring
296         * ring/samples/other/changesyntax/ArabicDemo.ring
297         * ring/samples/other/changesyntax/EnglishDemo.ring
298         * ring/samples/other/changesyntax/ChangeKeywordsArabic.ring
299         * ring/samples/other/changesyntax/ChangeKeywordsEnglish.ring
300         * ring/samples/other/changesyntax/pascal.ring
301         * ring/samples/other/hijridate.ring
302
303 * Ring Notepad - Project Files - set minimum width based on desktop screen width
304 * Ring Notepad - Output Window - Move the Cursor to the end of text
305 * Ring Notepad - Output Window - Correct displaying for line breaks 
306 * Form Designer - Better Style - Controls colors and size
307 * VideoMusicPlayer is updated to work as expected after RingQt update
308 * FlappyBird3000 - Fast response on Android 
309 * Snake Game : Change the default window size (800x600)
310 * Maze Game : Change the default window size (800x600) 
311 * Maze Game : Move the camera with the player
312 * Maze Game : Restarting the game will hide the (You Win) message
313 * Game Engine : display error message when we can't create the game window
314 * Ring Tests : Added File build.sh for building on Linux and macOS
315 * RingQt : Updated to Qt 5.12.6
316 * RingQt : Added QQMLEngine class
317 * RingQt : Added files for building RingQt without Bluetooth support 
318 * RingQt : The size of the events code is changed from 100 characters to 200 characters
319 * RingQt : Correct links for Qt documentation in RingQt classes chapter
320 * RingQt for Android : Better code for executing the Ring Object File (*.ringo)
321 * Ring2EXE configuration files are updated for RingQt to correctly distribute RingQt apps
322 * Code Generator : Convert function names to lower case when generating the functions for structures
323 * OSCopyFolder() function is updated to copy the files in sub folders too
324 * fgetpos() function is updated to work as expected
325 * IsFunction() function is updated to be not case sensitive
326 * Space() function is updated to clear the output string with spaces
327 * Ring Compiler : Added file buildclang.bat for building on Windows using Clang compiler
328 * Ring VM - Internal hash function is updated
329 * Ring VM - Better Code for setting pVM->aSetProperty when creating new objects
330 * Ring VM - Better Code for state managment