2 single: Ring 1.5 の変更履歴; はじめに
4 =======================
6 =======================
8 Ring 1.5 公開版の新機能と変更点を学びます。
11 pair: Ring 1.5 の変更履歴; 新機能と変更リスト
18 * Video-Music-Player アプリケーション
19 * Windows StartUp Manager アプリケーション
31 * トレースライブラリとインタラクティブデバッガ
37 pair: Ring 1.5 の変更履歴; Video-Music-Player アプリケーション
39 Video-Music-Player アプリケーション
40 ===================================
42 Video-Music-Player アプリケーションを Applications フォルダへ追加しました。
46 .. image:: videomusicplayer.jpg
47 :alt: Video Music Player
50 pair: Ring 1.5 の変更履歴; Windows StartUp Manager アプリケーション
52 Windows StartUp Manager アプリケーション
53 ========================================
55 Windows StartUp Manager アプリケーション
57 URL : https://github.com/ring-lang/WinStartupManager
61 .. image:: winstartupman.jpg
62 :alt: Windows Startup Manager
65 pair: Ring 1.5 の変更履歴; Calculator アプリケーション
68 ===========================
70 Calculator アプリケーションを Applications フォルダへ追加しました。
74 .. image:: calcapp.jpg
75 :alt: Calculator アプリケーション
79 pair: Ring 1.5 の変更履歴; Ring ノートパッドの改善
82 =======================
84 ① Ring ノートパッドは新しいスタイル、およびメインファイルツールバーを搭載するために更新しました。
86 メインファイルツールバーの考えは、プロジェクトに複数のソースコードのファイルがある場合に
87 プロジェクトのメインファイルを決定することです。
89 この機能を使うとプロジェクトでほかのファイルを開いているときに、
90 プロジェクトを実行するためにメインファイルを切り替えることなくプロジェクト (メインファイル) を実行できます。
92 この機能を使うには、プロジェクトのメインファイルを開きます。
94 現在のソースコードファイルをメインファイルとして設定するには Ctrl+Shift+M を押してください。
96 プロジェクトで別のソースコードファイルを開いて修正します。
98 プロジェクト (メインファイル) を実行したいときは Ctrl+Shift+F5 (GUI) または Ctrl+Shift+D (コンソール) を押してください。
102 .. image:: rnote15shot1.png
106 .. image:: rnote15shot2.png
110 .. image:: rnote15shot3.png
113 ② 改行の正確な表示、および “Clear” ボタンを実装するために実行結果ウィンドウを更新しました。
117 .. image:: rnote15output.png
120 ③ バックグラウンド処理で関数、クラスのリストを準備している間に、
121 大規模ファイルをすばやく開いて切り替えることができるようにするために Ring ノートパッドを更新しました。
125 .. image:: rnote15events.png
126 :alt: Ring ノートパッド - 大規模ファイル
130 pair: Ring 1.5 の変更履歴; StdLib の改善
141 ① 新しい関数 Print2Str() を StdLib へ追加しました。
150 mystring = print2str("Hello, #{world} \nIn Year \n#{2000+17} \n")
162 ② 新しい関数 ListAllFiles() を StdLib へ追加しました。
164 この関数を使うとフォルダにあるファイルのグループ、およびそのサブフォルダを手軽に処理できます。
171 aList = ListAllFiles("c:/ring/ringlibs","ring") # *.ring のみ
180 see listallfiles("b:/ring/ringlibs/weblib","") # 全ファイル
183 ③ 新しい関数 SystemCmd() を StdLib へ追加しました。
185 この関数は System() 関数と同じくシステムコマンドを実行できますが、
192 cYou = SystemCmd("whoami")
193 See "SystemCmd: whoami ====="+ nl + cYou +nl
199 SystemCmd: whoami =====
200 desktop-umberto\umberto
203 pair: Ring 1.5 の変更履歴; WebLib の改善
208 HTMLPage クラスを搭載するために WebLib を更新しました。
210 このクラスは標準出力を経由せずに HTML ドキュメントを作成します。
212 ウェブアプリケーションだけで WebLib を使うときの代用になります。
214 また、コンソール、 GUI、モバイル用のアプリケーションでも使えます。
227 mypage = new HtmlPage {
228 h1 { text("Customers Report") }
231 style = stylewidth("100%") + stylegradient(4)
234 TD { WIDTH="10%" text("Customers Count : " ) }
241 style = stylewidth("100%") + stylegradient(26)
244 style = stylewidth("100%") + stylegradient(24)
245 TD { text("Name " ) }
247 TD { text("Country" ) }
249 TD { text("Company" ) }
256 TD { text("Egypt" ) }
257 TD { text("Sales" ) }
258 TD { text("Future" ) }
265 write("report.html",mypage.output())
267 このクラスにより WebLib と GUILib で手軽にレポートを作成できます。
281 open_window(:CustomersReportController)
285 class CustomersReportController
287 oView = new CustomersReportView
293 mypage = new HtmlPage {
294 h1 { text("Customers Report") }
297 style = stylewidth("100%") + stylegradient(4)
301 text("Customers Count : " ) }
307 style = stylewidth("100%") + stylegradient(26)
310 style = stylewidth("100%") +
312 TD { text("Name " ) }
314 TD { text("Country" ) }
316 TD { text("Company" ) }
323 TD { text("Egypt" ) }
324 TD { text("Sales" ) }
325 TD { text("Future" ) }
330 write("report.html",mypage.output())
333 printer1 = new qPrinter(0) {
335 setoutputfilename("report.pdf")
341 system ("report.pdf")
343 class CustomersReportView
346 setwindowtitle("Report Window")
347 setgeometry(100,100,500,500)
348 web = new webview(win) {
349 setgeometry(100,100,1000,500)
350 loadpage(new qurl("file:///"+
351 currentdir()+"/report.html"))
353 new pushbutton(win) {
354 setGeometry(100,20,100,30)
356 setclickevent(Method(:PrintEvent))
363 .. image:: ring15reportshot.png
368 pair: Ring 1.5 の変更履歴; RingQt の改善
373 新しいクラスを RingQt へ追加しました:
380 * QBluetoothDeviceDiscoveryAgent
381 * QBluetoothDeviceInfo
383 * QBluetoothLocalDevice
385 * QBluetoothServiceDiscoveryAgent
386 * QBluetoothServiceInfo
388 * QBluetoothTransferManager
389 * QBluetoothTransferReply
390 * QBluetoothTransferRequest
397 ### ウェブサイト - vpic.nhtsa.dot.gov - へ VIN (Vehicle Id Number : 車両識別番号) を提出します。
398 ### 返された XML データを解析します。
405 curl = curl_easy_init()
407 # request = "3G1JC5248YS251015?format=xml" ### VIN - シボレー
408 request = "3GYFK62847G247323?format=xml" ### VIN - キャデラック
410 call_type = "decodevinvalues/"
411 url = "https://vpic.nhtsa.dot.gov/api/vehicles/"
412 url_request = url + call_type + request
414 See "URL Request: "+ url_request +nl
416 curl_easy_setopt(curl, curlopt_url, url_request)
417 response = curl_easy_perform_silent(curl);
419 See nl +"Response Raw: "+ response +nl +nl
421 curl_easy_cleanup(curl)
423 xml = new qxmlstreamreader()
424 xml.adddata_2(response)
427 while not xml.atend()
429 see xml.errorstring() see nl
434 if not x.length() = 0
435 see "Length: " see x.length() +" --- "
436 see "Value: " see x.tostring() see nl
444 ###------------------------------------------
448 # ==>Value: Results returned successfully
449 # ==>Value: VIN(s): 3G1JC5248YS251015
450 # ==>Value: 3G1JC5248YS251015
451 # ==>Value: Sedan/Saloon
454 # ==>Value: 134.25223700841
458 # ==>Value: CHEVROLET
459 # ==>Value: GENERAL MOTORS LLC
462 # ==>Value: Ramos Arzipe
463 # ==>Value: PASSENGER CAR
466 # ==>Value: 1st Row (Driver & Passenger)
467 # ==>Value: Sequential Fuel Injection (SFI)
471 # ==>Value: Body Type: Sedan, 4-6 Window, Notchback (GM codes: 19, 69)
472 # ==>Value: Name Plate: Chevrolet, Pontiac
473 # ==>Value: 0 - VIN decoded clean. Check Digit (9th position) is correct
477 ###-----------------------------------------
480 pair: Ring 1.5 の変更履歴; オブジェクトライブラリの改善
483 ============================
485 オブジェクトライブラリに Open_WindowInPackages() 関数を追加しました。
487 Open_WindowInPackages() 関数は Open_Window() と同じですが、
488 ウィンドウを開く前にインポートを行うパッケージの
495 Open_WindowInPackages(cClassName,aPackagesList)
499 この用例はフォームデザイナーのソースコードから引用したものです。
500 open_windowInPackages() 関数でウィンドウフラグのウィンドウを開きます。
502 クラス名 “WindowFlagsController” とパッケージ名を決定します。
504 ウィンドウフラグのウィンドウでは FormDesigner および System.GUI パッケージを使用しています。
508 open_windowInPackages(:WindowFlagsController,[
515 pair: Ring 1.5 の変更履歴; RingFreeGLUT 拡張機能
518 =====================
520 Ring 1.5 には FreeGLUT ライブラリへ対応するために RingFreeGLUT 拡張機能があります。
527 このサンプルは C チュートリアルを元にしています。
528 出典元 : http://www.lighthouse3d.com/tutorials/glut-tutorial/
532 load "opengl21lib.ring"
538 // 実際のベクトルはカメラ方向を表しています。
545 // キーを押していない時の変数は 0 です。
577 font = GLUT_BITMAP_TIMES_ROMAN_24
579 C_INT_GLUT_BITMAP_8_BY_13 = 7
580 C_INT_GLUT_BITMAP_9_BY_15 = 8
581 C_INT_GLUT_BITMAP_TIMES_ROMAN_10 = 9
582 C_INT_GLUT_BITMAP_TIMES_ROMAN_24 = 10
583 C_INT_GLUT_BITMAP_HELVETICA_10 = 11
584 C_INT_GLUT_BITMAP_HELVETICA_12 = 12
585 C_INT_GLUT_BITMAP_HELVETICA_18 = 13
591 // 一秒あたりのフレーム数を計算するための変数
599 h = glutEventHeight()
601 // ウィンドウの大きさが小さすぎる場合に、ゼロ除算エラーになるのを防ぎます。
602 // (幅 0 のウィンドウは作成できません)
610 glMatrixMode(GL_PROJECTION)
615 // ウィンドウ全体のビューポートを設定します。
616 glViewport(0, 0, w, h)
619 gluPerspective(45.0, ratio, 0.1, 100.0)
622 glMatrixMode(GL_MODELVIEW)
626 glScalef(scale, scale, scale)
627 glColor3f(1.0, 1.0, 1.0)
630 glTranslatef(0.0 ,0.75, 0.0)
631 glutSolidSphere(0.75,20,20)
634 glTranslatef(0.0, 1.0, 0.0)
635 glutSolidSphere(0.25,20,20)
639 glColor3f(0.0,0.0,0.0)
640 glTranslatef(0.05, 0.10, 0.18)
641 glutSolidSphere(0.05,10,10)
642 glTranslatef(-0.1, 0.0, 0.0)
643 glutSolidSphere(0.05,10,10)
647 glColor3f(red, green, blue)
648 glRotatef(0.0,1.0, 0.0, 0.0)
649 glutSolidCone(0.08,0.5,10,2)
651 glColor3f(1.0, 1.0, 1.0)
653 func renderBitmapString x,y,z,font,string
654 glRasterPos3f(x, y,z)
656 glutBitmapCharacter(font,ascii(c))
659 func renderStrokeFontString x,y,z,font,string
662 glScalef(0.002, 0.002, 0.002)
664 glutStrokeCharacter(font, Ascii(c));
669 func restorePerspectiveProjection
671 glMatrixMode(GL_PROJECTION)
676 glMatrixMode(GL_MODELVIEW)
679 func setOrthographicProjection
682 glMatrixMode(GL_PROJECTION)
692 gluOrtho2D(0, w, h, 0)
694 // modelview モードへ復帰切り替え
695 glMatrixMode(GL_MODELVIEW)
699 func computePos deltaMove
701 x += deltaMove * lx * 0.1
702 z += deltaMove * lz * 0.1
708 computePos(deltaMove)
712 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
718 gluLookAt( x, 1.0, z,
724 glColor3f(0.9, 0.9, 0.9)
726 glVertex3f(-100.0, 0.0, -100.0)
727 glVertex3f(-100.0, 0.0, 100.0)
728 glVertex3f( 100.0, 0.0, 100.0)
729 glVertex3f( 100.0, 0.0, -100.0)
736 glTranslatef(i*10.0, 0.0, j * 10.0)
738 number = (i+3)*3+(j+3)
739 renderBitmapString(0.0, 0.5, 0.0,font ,""+number)
744 // 一秒あたりのフレーム数を計算するためのコード
747 time=glutGet(GLUT_ELAPSED_TIME)
748 if time - timebase > 1000
749 s = "RingFreeGLUT - FPS: " + (frame*1000.0/(time-timebase))
754 // ビットマップフォントで文字列 (fps) を表示するためのコード
755 setOrthographicProjection()
759 renderBitmapString(5,30,0,GLUT_BITMAP_HELVETICA_18,s)
762 restorePerspectiveProjection()
767 // -----------------------------------
769 // -----------------------------------
771 func processNormalKeys
778 glutDestroyMenu(mainMenu)
779 glutDestroyMenu(fillMenu)
780 glutDestroyMenu(colorMenu)
781 glutDestroyMenu(fontMenu)
812 // -----------------------------------
814 // -----------------------------------
820 // これは左ボタンを押したときのみ true になります。
824 deltaAngle = (xx - xOrigin) * 0.001
827 lx = sin(angle + deltaAngle)
828 lz = -cos(angle + deltaAngle)
834 button = glutEventButton()
835 state = glutEventState()
839 // これは左ボタンを押したときのみ true になります。
840 if button = GLUT_LEFT_BUTTON
852 // -----------------------------------
854 // -----------------------------------
856 func processMenuStatus
858 status = glutEventStatus()
860 if status = GLUT_MENU_IN_USE
870 // 動作は全てサブメニューから行います。
875 option = glutEventValue()
880 glPolygonMode(GL_FRONT, GL_FILL)
882 glPolygonMode(GL_FRONT, GL_LINE)
888 option = glutEventValue()
891 on C_INT_GLUT_BITMAP_8_BY_13
892 font = GLUT_BITMAP_8_BY_13
893 on C_INT_GLUT_BITMAP_9_BY_15
894 font = GLUT_BITMAP_9_BY_15
895 on C_INT_GLUT_BITMAP_TIMES_ROMAN_10
896 font = GLUT_BITMAP_TIMES_ROMAN_10
897 on C_INT_GLUT_BITMAP_TIMES_ROMAN_24
898 font = GLUT_BITMAP_TIMES_ROMAN_24
899 on C_INT_GLUT_BITMAP_HELVETICA_10
900 font = GLUT_BITMAP_HELVETICA_10
901 on C_INT_GLUT_BITMAP_HELVETICA_12
902 font = GLUT_BITMAP_HELVETICA_12
903 on C_INT_GLUT_BITMAP_HELVETICA_18
904 font = GLUT_BITMAP_HELVETICA_18
907 func processColorMenu
909 option = glutEventValue()
931 func createPopupMenus
933 fontMenu = glutCreateMenu(:processFontMenu)
935 glutAddMenuEntry("BITMAP_8_BY_13 ",C_INT_GLUT_BITMAP_8_BY_13 )
936 glutAddMenuEntry("BITMAP_9_BY_15",C_INT_GLUT_BITMAP_9_BY_15 )
937 glutAddMenuEntry("BITMAP_TIMES_ROMAN_10 ",C_INT_GLUT_BITMAP_TIMES_ROMAN_10 )
938 glutAddMenuEntry("BITMAP_TIMES_ROMAN_24",C_INT_GLUT_BITMAP_TIMES_ROMAN_24 )
939 glutAddMenuEntry("BITMAP_HELVETICA_10 ",C_INT_GLUT_BITMAP_HELVETICA_10 )
940 glutAddMenuEntry("BITMAP_HELVETICA_12",C_INT_GLUT_BITMAP_HELVETICA_12 )
941 glutAddMenuEntry("BITMAP_HELVETICA_18",C_INT_GLUT_BITMAP_HELVETICA_18 )
943 fillMenu = glutCreateMenu(:processFillMenu)
945 glutAddMenuEntry("Fill",C_FILL)
946 glutAddMenuEntry("Line",C_LINE)
948 colorMenu = glutCreateMenu(:processColorMenu)
949 glutAddMenuEntry("Red",C_RED);
950 glutAddMenuEntry("Blue",C_BLUE);
951 glutAddMenuEntry("Green",C_GREEN);
952 glutAddMenuEntry("Orange",C_ORANGE);
954 mainMenu = glutCreateMenu(:processMainMenu)
956 glutAddSubMenu("Polygon Mode", fillMenu)
957 glutAddSubMenu("Color", colorMenu)
958 glutAddSubMenu("Font",fontMenu)
960 glutAttachMenu(GLUT_RIGHT_BUTTON)
962 // これでアクティブなメニューであるかどうか検知できるようにします。
963 glutMenuStatusFunc(:processMenuStatus)
966 // -----------------------------------
968 // -----------------------------------
972 // GLUT の初期化とウィンドウの作成
974 glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA)
975 glutInitWindowPosition(100,100)
976 glutInitWindowSize(320,320)
977 glutCreateWindow("RingFreeGLUT - Test - 9 SnowMan")
980 glutDisplayFunc(:renderScene)
981 glutReshapeFunc(:changeSize)
982 glutIdleFunc(:renderScene)
984 glutIgnoreKeyRepeat(1)
985 glutKeyboardFunc(:processNormalKeys)
986 glutSpecialFunc(:pressKey)
987 glutSpecialUpFunc(:releaseKey)
989 // ここには二つの新しい関数があります。
990 glutMouseFunc(:mouseButton)
991 glutMotionFunc(:mouseMove)
994 glEnable(GL_DEPTH_TEST)
995 glEnable(GL_CULL_FACE)
1000 // GLUT のイベント処理サイクルへ入ります。
1006 .. image:: ring15freeglut.png
1010 .. image:: ring15freeglut2.png
1014 pair: Ring 1.5 の変更履歴; RingOpenGL 拡張機能
1019 Ring 1.5 の RingOpenGL は下記のバージョンに対応しています。
1041 .. code-block:: ring
1044 このサンプルは C チュートリアルを元にしています。
1046 http://www.wikihow.com/Make-a-Cube-in-OpenGL
1049 load "freeglut.ring"
1050 load "opengl21lib.ring"
1052 // ----------------------------------------------------------
1054 // ----------------------------------------------------------
1058 // ----------------------------------------------------------
1059 // display() コールバック関数
1060 // ----------------------------------------------------------
1064 glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT)
1069 // rotate_x および rotate_y のユーザによる変更をリセットします。
1070 glRotatef( rotate_x, 1.0, 0.0, 0.0 )
1071 glRotatef( rotate_y, 0.0, 1.0, 0.0 )
1076 glColor3f( 1.0, 0.0, 0.0 ) glVertex3f( 0.5, -0.5, -0.5 ) # P1 は赤
1077 glColor3f( 0.0, 1.0, 0.0 ) glVertex3f( 0.5, 0.5, -0.5 ) # P2 は緑
1078 glColor3f( 0.0, 0.0, 1.0 ) glVertex3f( -0.5, 0.5, -0.5 ) # P3 は青
1079 glColor3f( 1.0, 0.0, 1.0 ) glVertex3f( -0.5, -0.5, -0.5 ) # P4 は紫
1085 glColor3f( 1.0, 1.0, 1.0 )
1086 glVertex3f( 0.5, -0.5, 0.5 )
1087 glVertex3f( 0.5, 0.5, 0.5 )
1088 glVertex3f( -0.5, 0.5, 0.5 )
1089 glVertex3f( -0.5, -0.5, 0.5 )
1094 glColor3f( 1.0, 0.0, 1.0 )
1095 glVertex3f( 0.5, -0.5, -0.5 )
1096 glVertex3f( 0.5, 0.5, -0.5 )
1097 glVertex3f( 0.5, 0.5, 0.5 )
1098 glVertex3f( 0.5, -0.5, 0.5 )
1103 glColor3f( 0.0, 1.0, 0.0 )
1104 glVertex3f( -0.5, -0.5, 0.5 )
1105 glVertex3f( -0.5, 0.5, 0.5 )
1106 glVertex3f( -0.5, 0.5, -0.5 )
1107 glVertex3f( -0.5, -0.5, -0.5 )
1112 glColor3f( 0.0, 0.0, 1.0 )
1113 glVertex3f( 0.5, 0.5, 0.5 )
1114 glVertex3f( 0.5, 0.5, -0.5 )
1115 glVertex3f( -0.5, 0.5, -0.5 )
1116 glVertex3f( -0.5, 0.5, 0.5 )
1121 glColor3f( 1.0, 0.0, 0.0 )
1122 glVertex3f( 0.5, -0.5, -0.5 )
1123 glVertex3f( 0.5, -0.5, 0.5 )
1124 glVertex3f( -0.5, -0.5, 0.5 )
1125 glVertex3f( -0.5, -0.5, -0.5 )
1132 // ----------------------------------------------------------
1133 // specialKeys() コールバック関数
1134 // ----------------------------------------------------------
1137 key = glutEventKey()
1139 // 右矢印 - 回転を五度増分します。
1145 // 左矢印 - 回転を五度減分します。
1162 // ----------------------------------------------------------
1164 // ----------------------------------------------------------
1167 // GLUT の初期化とユーザ仮引数の処理
1170 // トゥルーカラーのウィンドウのためにZ-バッファによるダブルバッファを要求します。
1171 glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
1174 glutCreateWindow("Awesome Cube")
1176 // Z-バッファの深度テストを有効にします。
1177 glEnable(GL_DEPTH_TEST)
1180 glutDisplayFunc(:display)
1181 glutSpecialFunc(:specialKeys)
1183 // GLUT へイベントの制御を渡します。
1191 .. image:: ring15opengl.png
1195 pair: Ring 1.5 の変更履歴; 拡張機能用のコード生成器の改善
1198 ==============================
1200 \<constant> 型へ対応しました。
1201 また、数値以外にも定数を扱うことができます。例えば: 文字列とポインタです。
1203 ポインタのときはポインタ型を決定できます。
1204 この機能は <constant> ~ </constant> の前に使えます。
1206 .. code-block:: ring
1208 $nDefaultConstantType = C_CONSTANT_TYPE_POINTER
1209 $cDefaultConstantPointerType = "void *"
1211 この用例は RingFreeGLUT 拡張機能からの引用です。
1213 .. code-block:: ring
1216 $nDefaultConstantType = C_CONSTANT_TYPE_POINTER
1217 $cDefaultConstantPointerType = "void"
1221 GLUT_STROKE_MONO_ROMAN
1224 GLUT_BITMAP_TIMES_ROMAN_10
1225 GLUT_BITMAP_TIMES_ROMAN_24
1226 GLUT_BITMAP_HELVETICA_10
1227 GLUT_BITMAP_HELVETICA_12
1228 GLUT_BITMAP_HELVETICA_18
1232 pair: Ring 1.5 の変更履歴; 拡張機能用のドキュメント生成器の改善
1235 ====================================
1237 生成した定数のリストをドキュメントへ出力できるようになりました。
1239 以前の公開版では関数プロトタイプのみありましたが、
1243 pair: Ring 1.5 の変更履歴; Ring VM - トレース関数
1246 ======================
1248 Ring 1.5 では Ring VM に次の関数追加しました。
1250 * RingVM_SetTrace(cCode)
1251 * RingVM_TraceData() --> aDataList
1252 * RingVM_TraceEvent() --> nTraceEvent
1253 * RingVM_TraceFunc() --> cCode
1254 * RingVM_ScopesCount() --> nScopes
1255 * RingVM_EvalInScope(nScope,cCode)
1256 * RingVM_PassError()
1257 * RingVM_HideErrorMsg(lStatus)
1258 * RingVM_CallFunc(cFuncName)
1262 .. code-block:: ring
1264 load "tracelib.ring"
1266 ringvm_settrace("mytrace()")
1268 see "Hello, world!" + nl
1270 see "How are you?" +nl
1272 new myclass { mymethod() }
1275 see "Message from mytest" + nl
1278 see "====== The Trace function is Active ======" + nl +
1279 "Trace Function Name : " + ringvm_TraceFunc() + nl +
1281 switch ringvm_TraceEvent()
1282 on TRACEEVENT_NEWLINE see "New Line"
1283 on TRACEEVENT_NEWFUNC see "New Function"
1284 on TRACEEVENT_RETURN see "Return"
1285 on TRACEEVENT_ERROR see "Error"
1286 on TRACEEVENT_BEFORECFUNC see "Before C Function"
1287 on TRACEEVENT_AFTERCFUNC see "After C Function"
1290 "Line Number : " + ringvm_tracedata()[TRACEDATA_LINENUMBER] + nl +
1291 "File Name : " + ringvm_tracedata()[TRACEDATA_FILENAME] + nl +
1292 "Function Name : " + ringvm_tracedata()[TRACEDATA_FUNCNAME] + nl +
1293 "Method or Function : "
1294 if ringvm_tracedata()[TRACEDATA_METHODORFUNC] =
1295 TRACEDATA_METHODORFUNC_METHOD
1298 if ringvm_tracedata()[TRACEDATA_FUNCNAME] = NULL
1304 see nl + Copy("=",42) + nl
1308 see "Message from mymethod" + nl
1312 .. code-block:: none
1314 ====== The Trace function is Active ======
1315 Trace Function Name : mytrace()
1316 Trace Event : After C Function
1318 File Name : test1.ring
1319 Function Name : ringvm_settrace
1320 Method or Function : Function
1321 ==========================================
1322 ====== The Trace function is Active ======
1323 Trace Function Name : mytrace()
1324 Trace Event : New Line
1326 File Name : test1.ring
1328 Method or Function : Command
1329 ==========================================
1331 ====== The Trace function is Active ======
1332 Trace Function Name : mytrace()
1333 Trace Event : New Line
1335 File Name : test1.ring
1337 Method or Function : Command
1338 ==========================================
1340 ====== The Trace function is Active ======
1341 Trace Function Name : mytrace()
1342 Trace Event : New Line
1344 File Name : test1.ring
1346 Method or Function : Command
1347 ==========================================
1349 ====== The Trace function is Active ======
1350 Trace Function Name : mytrace()
1351 Trace Event : New Line
1353 File Name : test1.ring
1355 Method or Function : Command
1356 ==========================================
1357 ====== The Trace function is Active ======
1358 Trace Function Name : mytrace()
1359 Trace Event : New Function
1361 File Name : test1.ring
1362 Function Name : mytest
1363 Method or Function : Function
1364 ==========================================
1365 ====== The Trace function is Active ======
1366 Trace Function Name : mytrace()
1367 Trace Event : New Line
1369 File Name : test1.ring
1370 Function Name : mytest
1371 Method or Function : Function
1372 ==========================================
1374 ====== The Trace function is Active ======
1375 Trace Function Name : mytrace()
1376 Trace Event : New Line
1378 File Name : test1.ring
1379 Function Name : mytest
1380 Method or Function : Function
1381 ==========================================
1382 ====== The Trace function is Active ======
1383 Trace Function Name : mytrace()
1384 Trace Event : Return
1386 File Name : test1.ring
1388 Method or Function : Command
1389 ==========================================
1390 ====== The Trace function is Active ======
1391 Trace Function Name : mytrace()
1392 Trace Event : New Line
1394 File Name : test1.ring
1396 Method or Function : Command
1397 ==========================================
1398 ====== The Trace function is Active ======
1399 Trace Function Name : mytrace()
1400 Trace Event : New Line
1402 File Name : test1.ring
1404 Method or Function : Command
1405 ==========================================
1406 ====== The Trace function is Active ======
1407 Trace Function Name : mytrace()
1408 Trace Event : Before C Function
1410 File Name : test1.ring
1411 Function Name : ismethod
1412 Method or Function : Function
1413 ==========================================
1414 ====== The Trace function is Active ======
1415 Trace Function Name : mytrace()
1416 Trace Event : After C Function
1418 File Name : test1.ring
1419 Function Name : ismethod
1420 Method or Function : Function
1421 ==========================================
1422 ====== The Trace function is Active ======
1423 Trace Function Name : mytrace()
1424 Trace Event : New Function
1426 File Name : test1.ring
1427 Function Name : mymethod
1428 Method or Function : Method
1429 ==========================================
1430 ====== The Trace function is Active ======
1431 Trace Function Name : mytrace()
1432 Trace Event : New Line
1434 File Name : test1.ring
1435 Function Name : mymethod
1436 Method or Function : Method
1437 ==========================================
1438 Message from mymethod
1439 ====== The Trace function is Active ======
1440 Trace Function Name : mytrace()
1441 Trace Event : Return
1443 File Name : test1.ring
1445 Method or Function : Command
1446 ==========================================
1447 ====== The Trace function is Active ======
1448 Trace Function Name : mytrace()
1449 Trace Event : Before C Function
1451 File Name : test1.ring
1452 Function Name : ismethod
1453 Method or Function : Function
1454 ==========================================
1455 ====== The Trace function is Active ======
1456 Trace Function Name : mytrace()
1457 Trace Event : After C Function
1459 File Name : test1.ring
1460 Function Name : ismethod
1461 Method or Function : Function
1462 ==========================================
1463 ====== The Trace function is Active ======
1464 Trace Function Name : mytrace()
1465 Trace Event : Before C Function
1467 File Name : test1.ring
1468 Function Name : ismethod
1469 Method or Function : Function
1470 ==========================================
1471 ====== The Trace function is Active ======
1472 Trace Function Name : mytrace()
1473 Trace Event : After C Function
1475 File Name : test1.ring
1476 Function Name : ismethod
1477 Method or Function : Function
1478 ==========================================
1479 ====== The Trace function is Active ======
1480 Trace Function Name : mytrace()
1481 Trace Event : New Line
1483 File Name : test1.ring
1485 Method or Function : Command
1486 ==========================================
1491 pair: Ring 1.5 の変更履歴; トレースライブラリとインタラクティブデバッガ
1493 トレースライブラリとインタラクティブデバッガ
1494 ============================================
1496 Ring 1.5 にはトレースライブラリとインタラクティブデバッガがあります。
1498 このライブラリはイベントのトレース、プログラムを一行ずつ実行、
1499 エラー発生またはブレークポイントに到達したときインタラクティブデバッガを開くことができます。
1503 この用例はブレークポイントをインタラクティブデバッガで開きます!
1505 .. code-block:: ring
1507 load "tracelib.ring"
1516 see "After breakpoint!" +nl
1518 see "End of program!" + nl
1523 ブレークポイントに関してはインタラクティブデバッガがあります!
1525 .. image:: debugshot1.png
1530 .. image:: debugshot2.png
1535 .. image:: debugshot3.png
1538 実行結果ウィンドウでもインタラクティブデバッガを実行できます。
1540 .. image:: debugshot4.png
1544 pair: Ring 1.5 の変更履歴; シンタックスの柔軟性を向上
1547 ==========================
1549 クラス、パッケージ、関数で括弧 { } を使うには
1553 .. code-block:: ring
1569 print("Hello, World!\n")
1574 クラス、パッケージ、関数の後に‘end’キーワードを使うには
1578 .. code-block:: ring
1594 クラス、パッケージ、関数の後に‘endpackage’/’endclass’/’endfunc’キーワードを使うには
1598 .. code-block:: ring
1602 new myclass { myfunc() }
1614 pair: Ring 1.5 の変更履歴; 型ヒントライブラリ
1619 Ring 1.5 から型ヒントライブラリがあります。
1621 このライブラリにより、ソースコードへ型情報を追加できます。
1631 .. code-block:: ring
1633 load "typehints.ring"
1636 see sayHello("Mahmoud");
1638 int func sum(int x,int y) {
1642 string func sayHello(string name) {
1643 return "Hello " + name ;
1646 ライブラリは非常に強力であり、自動的にユーザ型 (クラス) へ対応します!
1650 .. code-block:: ring
1652 load "typehints.ring"
1656 test() { main([:one,:two,:three]) }
1658 myclass func test() {
1659 see "Testing User Types!" + nl
1664 public class myclass {
1665 public static void func main(list args) {
1672 また、コードの内側で型を使用することもできます (関数プロトタイプだけに限定されません)。
1676 .. code-block:: ring
1678 load "typehints.ring"
1681 string msg = sayHello("Mahmoud")
1683 see "Sum = " + sum + nl + msg + nl
1686 int func sum(int x,int y) {
1690 string func sayHello(string name) {
1691 return "Hello " + name ;
1696 * 関数プロトタイプ : 型を使うには、引数の前後を ‘(‘ と ‘)’ で必ず囲んでください。
1697 * 関数のコード : 型を使うには、必ず変数の値を設定してください (代入)。
1700 .. note:: Ring は動的言語であり、コンパイラによる型検査は行われません。
1703 pair: Ring 1.5 の変更履歴; 品質の改善
1708 日々の実務プロジェクトで Ring を利用した成果により
1710 Ring 1.5 では、安定性と生産性が向上しました!
1712 明確な目標と実用性で求められるものを機能を追加していきます。
1717 pair: Ring 1.5 の変更履歴; Ring 1.5.1 の変更履歴
1720 =========================
1723 * StdLib - Factorial() 関数の更新
1724 * Ring 仮想計算機 - クラス範囲でスタックの消去処理に関するコードの改善。
1725 * サンプル : 3D Cube (OpenGL) + GameLib (RingAllegro) によるテクスチャ画像
1729 .. code-block:: ring
1732 load "opengl21lib.ring"
1741 class GraphicsApp from GraphicsAppBase
1753 bitmap = al_load_bitmap("ring.bmp")
1754 texture = al_get_opengl_texture(bitmap)
1756 func destroyResources
1758 al_destroy_bitmap(bitmap)
1765 glViewport(0, 0, w, h)
1766 glMatrixMode(GL_PROJECTION)
1769 gluPerspective(45,ratio,1,100)
1770 glMatrixMode(GL_MODELVIEW)
1773 glEnable(GL_TEXTURE_2D)
1774 glShadeModel(GL_SMOOTH)
1775 glClearColor(0.0, 0.0, 0.0, 0.5)
1777 glEnable(GL_DEPTH_TEST)
1778 glEnable(GL_CULL_FACE)
1779 glDepthFunc(GL_LEQUAL)
1780 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST)
1782 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
1784 glTranslatef(0.0,0.0,-5.0);
1786 glRotatef(xrot,1.0,0.0,0.0);
1787 glRotatef(yrot,0.0,1.0,0.0);
1788 glRotatef(zrot,0.0,0.0,1.0);
1790 glBindTexture(GL_TEXTURE_2D, texture)
1794 glTexCoord2f(0.0, 0.0) glVertex3f(-1.0, -1.0, 1.0)
1795 glTexCoord2f(1.0, 0.0) glVertex3f( 1.0, -1.0, 1.0)
1796 glTexCoord2f(1.0, 1.0) glVertex3f( 1.0, 1.0, 1.0)
1797 glTexCoord2f(0.0, 1.0) glVertex3f(-1.0, 1.0, 1.0)
1799 glTexCoord2f(1.0, 0.0) glVertex3f(-1.0, -1.0, -1.0)
1800 glTexCoord2f(1.0, 1.0) glVertex3f(-1.0, 1.0, -1.0)
1801 glTexCoord2f(0.0, 1.0) glVertex3f( 1.0, 1.0, -1.0)
1802 glTexCoord2f(0.0, 0.0) glVertex3f( 1.0, -1.0, -1.0)
1804 glTexCoord2f(0.0, 1.0) glVertex3f(-1.0, 1.0, -1.0)
1805 glTexCoord2f(0.0, 0.0) glVertex3f(-1.0, 1.0, 1.0)
1806 glTexCoord2f(1.0, 0.0) glVertex3f( 1.0, 1.0, 1.0)
1807 glTexCoord2f(1.0, 1.0) glVertex3f( 1.0, 1.0, -1.0)
1809 glTexCoord2f(1.0, 1.0) glVertex3f(-1.0, -1.0, -1.0)
1810 glTexCoord2f(0.0, 1.0) glVertex3f( 1.0, -1.0, -1.0)
1811 glTexCoord2f(0.0, 0.0) glVertex3f( 1.0, -1.0, 1.0)
1812 glTexCoord2f(1.0, 0.0) glVertex3f(-1.0, -1.0, 1.0)
1814 glTexCoord2f(1.0, 0.0) glVertex3f( 1.0, -1.0, -1.0)
1815 glTexCoord2f(1.0, 1.0) glVertex3f( 1.0, 1.0, -1.0)
1816 glTexCoord2f(0.0, 1.0) glVertex3f( 1.0, 1.0, 1.0)
1817 glTexCoord2f(0.0, 0.0) glVertex3f( 1.0, -1.0, 1.0)
1819 glTexCoord2f(0.0, 0.0) glVertex3f(-1.0, -1.0, -1.0)
1820 glTexCoord2f(1.0, 0.0) glVertex3f(-1.0, -1.0, 1.0)
1821 glTexCoord2f(1.0, 1.0) glVertex3f(-1.0, 1.0, 1.0)
1822 glTexCoord2f(0.0, 1.0) glVertex3f(-1.0, 1.0, -1.0)
1830 class GraphicsAppBase
1832 display event_queue ev timeout
1845 Key = [false,false,false,false]
1847 TITLE = "Graphics Application"
1859 al_init_image_addon()
1860 al_set_new_display_flags(ALLEGRO_OPENGL)
1861 display = al_create_display(SCREEN_W,SCREEN_H)
1862 al_set_Window_title(display,TITLE)
1863 al_clear_to_color(al_map_rgb(0,0,0))
1864 event_queue = al_create_event_queue()
1865 al_register_event_source(event_queue,
1866 al_get_display_event_source(display))
1867 ev = al_new_allegro_event()
1868 timeout = al_new_allegro_timeout()
1869 al_init_timeout(timeout, 0.06)
1870 timer = al_create_timer(1.0 / FPS)
1871 al_register_event_source(event_queue,
1872 al_get_timer_event_source(timer))
1873 al_start_timer(timer)
1875 al_register_event_source(event_queue,
1876 al_get_mouse_event_source())
1877 al_install_keyboard()
1878 al_register_event_source(event_queue,
1879 al_get_keyboard_event_source())
1884 al_wait_for_event_until(event_queue, ev, timeout)
1885 switch al_get_allegro_event_type(ev)
1886 on ALLEGRO_EVENT_DISPLAY_CLOSE
1888 on ALLEGRO_EVENT_TIMER
1890 on ALLEGRO_EVENT_MOUSE_AXES
1891 mouse_x = al_get_allegro_event_mouse_x(ev)
1892 mouse_y = al_get_allegro_event_mouse_y(ev)
1893 on ALLEGRO_EVENT_MOUSE_ENTER_DISPLAY
1894 mouse_x = al_get_allegro_event_mouse_x(ev)
1895 mouse_y = al_get_allegro_event_mouse_y(ev)
1896 on ALLEGRO_EVENT_MOUSE_BUTTON_UP
1898 on ALLEGRO_EVENT_KEY_DOWN
1899 switch al_get_allegro_event_keyboard_keycode(ev)
1903 key[KEY_DOWN] = true
1905 key[KEY_LEFT] = true
1906 on ALLEGRO_KEY_RIGHT
1907 key[KEY_RIGHT] = true
1909 on ALLEGRO_EVENT_KEY_UP
1910 switch al_get_allegro_event_keyboard_keycode(ev)
1914 key[KEY_DOWN] = false
1916 key[KEY_LEFT] = false
1917 on ALLEGRO_KEY_RIGHT
1918 key[KEY_RIGHT] = false
1919 on ALLEGRO_KEY_ESCAPE
1923 if redraw and al_is_event_queue_empty(event_queue)
1934 al_destroy_timer(timer)
1935 al_destroy_allegro_event(ev)
1936 al_destroy_allegro_timeout(timeout)
1937 al_destroy_event_queue(event_queue)
1938 al_destroy_display(display)
1944 func destroyResources
1948 .. image:: ringcube3d.png
1953 pair: Ring 1.5 の変更履歴; Ring 1.5.2 の変更履歴
1956 =========================
1959 * 取扱説明書 - “アプリケーション開発期間の短縮” の章を更新しました。
1960 * Ring ノートパッド - 全てのプラットフォームで実行結果ウィンドウへプログラムの実行結果を表示するようになりました。
1961 * フォームデザイナー - Help メニュー - コンソールウィンドウを表示せずに CHM/PDF ファイルを開けるようになりました。
1962 * フォームデザイナー - マウスをすばやく動かしたときに Resize/Move イベントの応答性を改善
1963 * フォームデザイナー - 「新規、開く、名前を付けて保存」で Controller クラスを Ring ノートパッドで開くようにしました。
1964 * フォームデザイナー - ファイルメニューへ “フォームを閉じる” オプションを追加。
1965 * Ring ノートパッド - 実行に、現在のファイル (開いているフォームも) 自動的に保存するようになりました。
1966 * GetQuotesHistory アプリケーション - macOS および Qt 5.2 で動作するために更新
1967 * Calculator アプリケーション - 様々な機能を搭載するために更新しました!
1968 * Ring VM - 環境エラーの分類 (この章をご確認ください : 言語リファレンス)
1969 * RingQt - イベント実行の高速化のために QAllEvents へ新しいメソッドを追加
1970 * RingQt - スタイル「フュージョン : 黒」 - 無効なコントロールに最適な配色
1971 * スクリプト - Fedora Linux での Ring ビルド用 (この章をご確認ください : ソースコードからのビルド方法)
1976 .. image:: fedora.png
1977 :alt: Ring (Fedora 1 で実行)
1981 pair: Ring 1.5 の変更履歴; Ring 1.5.3 の変更履歴
1984 =========================
1986 * フォームデザイナー : 再びフォームを開くことを可能にするために、アクションが閉じられると Ring ノートパッドへ通知するようになりました。
1987 * フォームデザイナー : Ring ノートパッドで Controller クラスを開くときにアクションを保存するようになりました。
1988 * フォームデザイナー : CTRL キーで複数のコントロールを選択時に現在のコントロールを保持するようになりました。
1989 * フォームデザイナー : Ring ノートパッドでの使用時に素敵な背景色に対応しました (スタイル - モダン : 黒)
1990 * RingOpenSSL : OpenSSL 1.1 など新しいバージョンへ対応するために更新しました。
1991 * ビルドスクリプト : Fedora 26 (64bit) での動作に対応するために更新
1992 * OpenGL : 新しいサンプル - 複数の立方体 (samples/3D/manycubes)
1997 .. image:: manycubes.png
2000 * RingQt : QDateTime クラスの追加
2001 * RingQt : QMenu および QCursor クラスへ新しいメソッドを追加
2005 .. code-block:: ring
2010 win = new qwidget() {
2011 setwindowtitle("Context Menu")
2013 myfilter = new qAllEvents(win) {
2014 setContextmenuEvent("mymenu()")
2016 installeventfilter(myfilter)
2026 oAction = new qAction(win) {
2028 SetCLickevent("See :New")
2031 oAction = new qAction(win) {
2033 SetCLickevent("See :Open")
2036 oAction = new qAction(win) {
2038 SetCLickevent("See :Save")
2041 oAction = new qAction(win) {
2043 SetCLickevent("See :Close")
2046 oCursor = new qCursor()
2051 コンパイラ : 数値内で _ の使用に対応
2055 .. code-block:: ring
2063 .. code-block:: ring
2068 コンパイラ : 数値の後に f の使用に対応
2072 .. code-block:: ring
2079 .. code-block:: ring
2083 Google API Shortener アプリケーション
2087 .. image:: urlappshot1.png
2088 :alt: URLShortener - スクリーンショット 1
2094 .. image:: tictactoe3d.png
2095 :alt: TicTacToe 3D ゲーム
2099 pair: Ring 1.5 の変更履歴; Ring 1.5.4 の変更履歴
2102 =========================
2105 * CalmoSoft Fifteen Puzzle ゲーム 3D
2106 * Ring ノートパッド - 新しいスタイル
2107 * Ring ノートパッド - ツールバーのスタイルを改善
2108 * Ring ノートパッド - View モード
2109 * Ring ノートパッド - QPlainTextEdit - スクロールバーの背景色の設定を行わないようにしました。
2110 * Ring ノートパッド - スタイル - フュージョン (白) - コメントに銀色を使用
2111 * Ring ノートパッド - Tab と Shift-Tab - 複数行インデント
2112 * フォームデザイナー - ツールバーのスタイルを改善
2113 * フォームデザイナー - ウィンドウフラグとメニュバーデザイナー用の素敵な背景色
2114 * フォームデザイナー - コントロールのデフォルト背景色
2115 * RingQt - QWidget クラスへgrab() および windowHandle() メソッドを追加
2116 * RingQt - QPixmap クラスへ新しいメソッドを追加
2122 * 拡張機能用のコード生成器 - Nonew オプション - 親クラスへの対応
2123 * Ring VM - 内部実装 - 文字列とリストオブジェクトをステートへ渡せるようになりました。
2124 * Ring VM - ガベージコレクター - 小規模オブジェクトをメモリへプールできるようになりました。
2125 * Ring VM - ステートの保存と復元に関するコードの改善