Author Topic: SB π  (Read 8264 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: SB π
« Reply #255 on: July 06, 2019, 05:43:31 PM »
I thought I included it. Sorry.

Here is the the link for the tutorial in C that works fine without error.
https://www.tecgraf.puc-rio.br/iup/en/tutorial/tutorial3.html

Code: Script BASIC
  1. MODULE IUP
  2.  
  3. ' System
  4. DECLARE SUB ::Open ALIAS "PuiOpen" LIB "pui"
  5. DECLARE SUB ::Close ALIAS "PuiClose" LIB "pui"
  6. DECLARE SUB ::Version ALIAS "PuiVersion" LIB "pui"
  7. DECLARE SUB ::Load ALIAS "PuiLoad" LIB "pui"
  8. DECLARE SUB ::Loadbuffer ALIAS "PuiLoadbuffer" LIB "pui"
  9. DECLARE SUB ::SetLanguage ALIAS "PuiSetLanguage" LIB "pui"
  10. DECLARE SUB ::GetLanguage ALIAS "PuiGetLanguage" LIB "pui"
  11. ' Attribute
  12. DECLARE SUB ::StoreAttribute ALIAS "PuiStoreAttribute" LIB "pui"
  13. DECLARE SUB ::StoreAttributeId ALIAS "PuiStoreAttributeId" LIB "pui"
  14. DECLARE SUB ::SetAttribute ALIAS "PuiSetAttribute" LIB "pui"
  15. DECLARE SUB ::SetAttributeId ALIAS "PuiSetAttributeId" LIB "pui"
  16. DECLARE SUB ::SetfAttribute ALIAS "PuiSetfAttribute" LIB "pui"
  17. DECLARE SUB ::SetfAttributeId ALIAS "PuiSetfAttributeId" LIB "pui"
  18. DECLARE SUB ::SetfAttributeId2 ALIAS "PuiSetfAttributeId2" LIB "pui"
  19. DECLARE SUB ::SetAttributes ALIAS "PuiSetAttributes" LIB "pui"
  20. DECLARE SUB ::ResetAttribute ALIAS "PuiResetAttribute" LIB "pui"
  21. DECLARE SUB ::SetAtt ALIAS "PuiSetAtt" LIB "pui"
  22. DECLARE SUB ::SetAttributeHandle ALIAS "PuiSetAttributeHandle" LIB "pui"
  23. DECLARE SUB ::GetAttributeHandle ALIAS "PuiGetAttributeHandle" LIB "pui"
  24. DECLARE SUB ::GetAttribute ALIAS "PuiGetAttribute" LIB "pui"
  25. DECLARE SUB ::GetAttributeId ALIAS "PuiGetAttributeId" LIB "pui"
  26. DECLARE SUB ::GetAllAttributes ALIAS "PuiGetAllAttributes" LIB "pui"
  27. DECLARE SUB ::GetAttributes ALIAS "PuiGetAttributes" LIB "pui"
  28. DECLARE SUB ::GetFloat ALIAS "PuiGetFloat" LIB "pui"
  29. DECLARE SUB ::GetFloatId ALIAS "PuiGetFloatId" LIB "pui"
  30. DECLARE SUB ::GetFloatId2 ALIAS "PuiGetFloatId2" LIB "pui"
  31. DECLARE SUB ::GetInt ALIAS "PuiGetInt" LIB "pui"
  32. DECLARE SUB ::GetInt2 ALIAS "PuiGetInt2" LIB "pui"
  33. DECLARE SUB ::GetIntInt ALIAS "PuiGetIntInt" LIB "pui"
  34. DECLARE SUB ::GetIntId ALIAS "PuiGetIntId" LIB "pui"
  35. DECLARE SUB ::GetIntId2 ALIAS "PuiGetIntId2" LIB "pui"
  36. DECLARE SUB ::StoreGlobal ALIAS "PuiStoreGlobal" LIB "pui"
  37. DECLARE SUB ::SetGlobal ALIAS "PuiSetGlobal" LIB "pui"
  38. DECLARE SUB ::GetGlobal ALIAS "PuiGetGlobal" LIB "pui"
  39. ' Events
  40. DECLARE SUB __GetEvent ALIAS "GetEvent" LIB "pui"
  41. DECLARE SUB __MainLoop ALIAS "PuiMainLoop" LIB "pui"
  42. DECLARE SUB ::MainLoopLevel ALIAS "PuiMainLoopLevel" LIB "pui"
  43. DECLARE SUB __LoopStep ALIAS "PuiLoopStep" LIB "pui"
  44. DECLARE SUB __LoopStepWait ALIAS "PuiLoopStepWait" LIB "pui"
  45. DECLARE SUB __ExitLoop ALIAS "PuiExitLoop" LIB "pui"
  46. DECLARE SUB ::Flush ALIAS "PuiFlush" LIB "pui"
  47. DECLARE SUB ::GetCallback ALIAS "PuiGetCallback" LIB "pui"
  48. DECLARE SUB __SetCallback ALIAS "PuiSetCallback" LIB "pui"
  49. DECLARE SUB ::SetCallbacks ALIAS "PuiSetCallbacks" LIB "pui"
  50. DECLARE SUB ::GetActionName ALIAS "PuiGetActionName" LIB "pui"
  51. DECLARE SUB ::SetFunction ALIAS "PuiSetFunction" LIB "pui"
  52. DECLARE SUB ::RecordInput ALIAS "PuiRecordInput" LIB "pui"
  53. DECLARE SUB ::PlayInput ALIAS "PuiPlayInput" LIB "pui"
  54. ' Layout
  55. DECLARE SUB ::Create ALIAS "PuiCreate" LIB "pui"
  56. DECLARE SUB ::Destroy ALIAS "PuiDestroy" LIB "pui"
  57. DECLARE SUB ::Map ALIAS "PuiMap" LIB "pui"
  58. DECLARE SUB ::Unmap ALIAS "PuiUnmap" LIB "pui"
  59. DECLARE SUB ::GetAllClasses ALIAS "PuiGetAllClasses" LIB "pui"
  60. DECLARE SUB ::GetClassName ALIAS "PuiGetClassName" LIB "pui"
  61. DECLARE SUB ::GetClassType ALIAS "PuiGetClassType" LIB "pui"
  62. DECLARE SUB ::ClassMatch ALIAS "PuiClassMatch" LIB "pui"
  63. DECLARE SUB ::GetClassAttributes ALIAS "PuiGetClassAttributes" LIB "pui"
  64. DECLARE SUB ::GetClassCallbacks ALIAS "PuiGetClassCallbacks" LIB "pui"
  65. DECLARE SUB ::SaveClassAttributes ALIAS "PuiSaveClassAttributes" LIB "pui"
  66. DECLARE SUB ::CopyClassAttributes ALIAS "PuiCopyClassAttributes" LIB "pui"
  67. DECLARE SUB ::SetClassDefaultAttribute ALIAS "PuiSetClassDefaultAttribute" LIB "pui"
  68. DECLARE SUB ::Fill ALIAS "PuiFill" LIB "pui"
  69. DECLARE SUB ::Hbox ALIAS "PuiHbox" LIB "pui"
  70. DECLARE SUB ::Vbox ALIAS "PuiVbox" LIB "pui"
  71. DECLARE SUB ::Zbox ALIAS "PuiZbox" LIB "pui"
  72. DECLARE SUB ::Radio ALIAS "PuiRadio" LIB "pui"
  73. DECLARE SUB ::Normalizer ALIAS "PuiNormalizer" LIB "pui"
  74. DECLARE SUB ::Cbox ALIAS "PuiCbox" LIB "pui"
  75. DECLARE SUB ::Sbox ALIAS "PuiSbox" LIB "pui"
  76. DECLARE SUB ::Split ALIAS "PuiSplit" LIB "pui"
  77. DECLARE SUB ::Append ALIAS "PuiAppend" LIB "pui"
  78. DECLARE SUB ::Detach ALIAS "PuiDetach" LIB "pui"
  79. DECLARE SUB ::Insert ALIAS "PuiInsert" LIB "pui"
  80. DECLARE SUB ::Reparent ALIAS "PuiReparent" LIB "pui"
  81. DECLARE SUB ::GetParent ALIAS "PuiGetParent" LIB "pui"
  82. DECLARE SUB ::GetChild ALIAS "PuiGetChild" LIB "pui"
  83. DECLARE SUB ::GetChildPos ALIAS "PuiGetChildPos" LIB "pui"
  84. DECLARE SUB ::GetChildCount ALIAS "PuiGetChildCount" LIB "pui"
  85. DECLARE SUB ::GetNextChild ALIAS "PuiGetNextChild" LIB "pui"
  86. DECLARE SUB ::GetBrother ALIAS "PuiGetBrother" LIB "pui"
  87. DECLARE SUB ::GetDialog ALIAS "PuiGetDialog" LIB "pui"
  88. DECLARE SUB ::GetDialogChild ALIAS "PuiGetDialogChild" LIB "pui"
  89. DECLARE SUB ::Refresh ALIAS "PuiRefresh" LIB "pui"
  90. DECLARE SUB ::RefreshChildren ALIAS "PuiRefreshChildren" LIB "pui"
  91. DECLARE SUB ::Update ALIAS "PuiUpdate" LIB "pui"
  92. DECLARE SUB ::UpdateChildren ALIAS "PuiUpdateChildren" LIB "pui"
  93. DECLARE SUB ::Redraw ALIAS "PuiRedraw" LIB "pui"
  94. DECLARE SUB ::ConvertXYToPos ALIAS "PuiConvertXYToPos" LIB "pui"
  95. ' Dialog
  96. DECLARE SUB ::Dialog ALIAS "PuiDialog" LIB "pui"
  97. DECLARE SUB ::Popup ALIAS "PuiPopup" LIB "pui"
  98. DECLARE SUB ::Show ALIAS "PuiShow" LIB "pui"
  99. DECLARE SUB ::ShowXY ALIAS "PuiShowXY" LIB "pui"
  100. DECLARE SUB ::Hide ALIAS "PuiHide" LIB "pui"
  101. DECLARE SUB ::FileDlg ALIAS "PuiFileDlg" LIB "pui"
  102. DECLARE SUB ::MessageDlg ALIAS "PuiMessageDlg" LIB "pui"
  103. DECLARE SUB ::ColorDlg ALIAS "PuiColorDlg" LIB "pui"
  104. DECLARE SUB ::FontDlg ALIAS "PuiFontDlg" LIB "pui"
  105. DECLARE SUB ::Alarm ALIAS "PuiAlarm" LIB "pui"
  106. DECLARE SUB ::GetFile ALIAS "PuiGetFile" LIB "pui"
  107. DECLARE SUB ::GetColor ALIAS "PuiGetColor" LIB "pui"
  108. DECLARE SUB ::GetParam ALIAS "PuiGetParam" LIB "pui"
  109. DECLARE SUB ::GetText ALIAS "PuiGetText" LIB "pui"
  110. DECLARE SUB ::ListDialog ALIAS "PuiListDialog" LIB "pui"
  111. DECLARE SUB ::Message ALIAS "PuiMessage" LIB "pui"
  112. DECLARE SUB ::LayoutDialog ALIAS "PuiLayoutDialog" LIB "pui"
  113. DECLARE SUB ::ElementPropertiesDialog ALIAS "PuiElementPropertiesDialog" LIB "pui"
  114. ' Controls
  115. DECLARE SUB ::Button ALIAS "PuiButton" LIB "pui"
  116. DECLARE SUB ::Canvas ALIAS "PuiCanvas" LIB "pui"
  117. DECLARE SUB ::Frame ALIAS "PuiFrame" LIB "pui"
  118. DECLARE SUB ::Label ALIAS "PuiLabel" LIB "pui"
  119. DECLARE SUB ::List ALIAS "PuiList" LIB "pui"
  120. DECLARE SUB ::MultiLine ALIAS "PuiMultiLine" LIB "pui"
  121. DECLARE SUB ::ProgressBar ALIAS "PuiProgressBar" LIB "pui"
  122. DECLARE SUB ::Spin ALIAS "PuiSpin" LIB "pui"
  123. DECLARE SUB ::Tabs ALIAS "PuiTabs" LIB "pui"
  124. DECLARE SUB ::Tabsv ALIAS "PuiTabsv" LIB "pui"
  125. DECLARE SUB ::Text ALIAS "PuiText" LIB "pui"
  126. DECLARE SUB ::Toggle ALIAS "PuiToggle" LIB "pui"
  127. DECLARE SUB ::Tree ALIAS "PuiTree" LIB "pui"
  128. DECLARE SUB ::Val ALIAS "PuiVal" LIB "pui"
  129. DECLARE SUB ::Cells ALIAS "PuiCells" LIB "pui"
  130. DECLARE SUB ::Colorbar ALIAS "PuiColorbar" LIB "pui"
  131. DECLARE SUB ::ColorBrowser ALIAS "PuiColorBrowser" LIB "pui"
  132. DECLARE SUB ::Dial ALIAS "PuiDial" LIB "pui"
  133. DECLARE SUB ::Matrix ALIAS "PuiMatrix" LIB "pui"
  134. DECLARE SUB ::GLCanvas ALIAS "PuiGLCanvas" LIB "pui"
  135. DECLARE SUB ::PPlot ALIAS "PuiPPlot" LIB "pui"
  136. DECLARE SUB ::WebBrowser ALIAS "PuiWebBrowser" LIB "pui"
  137. ' Resources
  138. DECLARE SUB ::Image ALIAS "PuiImage" LIB "pui"
  139. DECLARE SUB ::ImageRGB ALIAS "PuiImageRGB" LIB "pui"
  140. DECLARE SUB ::ImageRGBA ALIAS "PuiImageRGBA" LIB "pui"
  141. DECLARE SUB ::ImageLibOpen ALIAS "PuiImageLibOpen" LIB "pui"
  142. DECLARE SUB ::LoadImage ALIAS "PuiLoadImage" LIB "pui"
  143. DECLARE SUB ::SaveImage ALIAS "PuiSaveImage" LIB "pui"
  144. DECLARE SUB ::NextField ALIAS "PuiNextField" LIB "pui"
  145. DECLARE SUB ::PreviousField ALIAS "PuiPreviousField" LIB "pui"
  146. DECLARE SUB ::GetFocus ALIAS "PuiGetFocus" LIB "pui"
  147. DECLARE SUB ::SetFocus ALIAS "PuiSetFocus" LIB "pui"
  148. DECLARE SUB ::Item ALIAS "PuiItem" LIB "pui"
  149. DECLARE SUB ::Menu ALIAS "PuiMenu" LIB "pui"
  150. DECLARE SUB ::Menuv ALIAS "PuiMenuv" LIB "pui"
  151. DECLARE SUB ::Separator ALIAS "PuiSeparator" LIB "pui"
  152. DECLARE SUB ::Submenu ALIAS "PuiSubmenu" LIB "pui"
  153. DECLARE SUB ::SetHandle ALIAS "PuiSetHandle" LIB "pui"
  154. DECLARE SUB ::GetHandle ALIAS "PuiGetHandle" LIB "pui"
  155. DECLARE SUB ::GetName ALIAS "PuiGetName" LIB "pui"
  156. DECLARE SUB ::GetAllNames ALIAS "PuiGetAllNames" LIB "pui"
  157. DECLARE SUB ::GetAllDialogs ALIAS "PuiGetAllDialogs" LIB "pui"
  158. DECLARE SUB ::Clipboard ALIAS "PuiClipboard" LIB "pui"
  159. DECLARE SUB ::Timer ALIAS "PuiTimer" LIB "pui"
  160. DECLARE SUB ::User ALIAS "PuiUser" LIB "pui"
  161. DECLARE SUB ::Help ALIAS "PuiHelp" LIB "pui"
  162. ' DECLARE SUB ::GetListText ALIAS "PuiGetListText" LIB "pui"
  163. ' DECLARE SUB ::ClearList ALIAS "PuiClearList" LIB "pui"
  164.  
  165. ' Helper Functions
  166. DECLARE SUB ::GetListText ALIAS "PuiGetListText" LIB "pui"
  167. DECLARE SUB ::GetBtnPressed ALIAS "PuiGetBtnPressed" LIB "pui"
  168. DECLARE SUB ::GetBtnState ALIAS "PuiGetBtnState" LIB "pui"
  169. DECLARE SUB ::ClearList ALIAS "PuiClearList" LIB "pui"
  170. DECLARE SUB ::Info ALIAS "PuiInfo" LIB "pui"
  171.  
  172.  
  173. SUB MainLoop
  174. ExitLoop = 0
  175. REPEAT
  176.   __LoopStepWait()
  177.   this_event = __GetEvent()
  178.   IF this_event <> undef THEN
  179.     IF this_event = event{this_event}[0] THEN
  180.       ICALL(event{this_event}[1])
  181.     END IF
  182.   END IF
  183. UNTIL ExitLoop
  184. END SUB
  185.  
  186.  
  187. FUNCTION SetCallback(ih, aname, faddr)
  188.   event{ih}[0] = ih
  189.   event{ih}[1] = faddr
  190.   event{ih}[2] = aname
  191.   SetCallback = __SetCallback(ih, aname)
  192. END FUNCTION
  193.  
  194. END MODULE
  195.  
« Last Edit: July 06, 2019, 05:51:52 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: SB π
« Reply #256 on: July 06, 2019, 06:24:50 PM »
Segfaults.
Have you run this on x86/x64 Linux?  None of my RasPi's have a Desktop GUI, I do everything in a terminal on those.
« Last Edit: July 06, 2019, 06:45:09 PM by AIR »

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: SB π
« Reply #257 on: July 06, 2019, 06:47:23 PM »
I have an IUP / SB setup on Ubuntu 18.04 laptop. I will give the RPi code a try there.

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: SB π
« Reply #258 on: July 06, 2019, 07:20:42 PM »
Here is what iup_edit.sb looks like on my laptop. I get the same errors as the RPi.

I could be running an older version of IUP on my laptop. It could even be Gtk2.  :-[


jrs@jrs-laptop:~/sb/examples/iup$ scriba iup_edit.sb

(scriba:6769): Gtk-WARNING **: 19:16:49.950: Unknown type PangoFontFamily specified in treemodel model

(scriba:6769): Gtk-WARNING **: 19:16:49.950: Unknown type PangoFontFace specified in treemodel model

(scriba:6769): Gtk-WARNING **: 19:16:49.950: ../../../../gtk/gtkliststore.c:516: Invalid type (null)

(scriba:6769): Gtk-WARNING **: 19:16:49.950: ../../../../gtk/gtkliststore.c:516: Invalid type (null)

(scriba:6769): GLib-GObject-CRITICAL **: 19:16:49.957: g_value_type_transformable: assertion 'G_TYPE_IS_VALUE (src_type)' failed

(scriba:6769): GLib-GObject-CRITICAL **: 19:16:49.957: g_value_type_transformable: assertion 'G_TYPE_IS_VALUE (src_type)' failed

(scriba:6769): GLib-GObject-WARNING **: 19:16:49.986: ../../../../gobject/gtype.c:4265: type id '0' is invalid

(scriba:6769): GLib-GObject-WARNING **: 19:16:49.986: can't peek value table for type '<invalid>' which is not currently referenced
Segmentation fault (core dumped)
jrs@jrs-laptop:~/sb/examples/iup$

« Last Edit: July 06, 2019, 07:45:17 PM by John »

Offline AIR

  • BASIC Developer
  • Posts: 685
Re: SB π
« Reply #259 on: July 06, 2019, 08:26:31 PM »
Okay, try this

In dynlolib.c, change

 pLib = (void *)dlopen(r,RTLD_LAZY);

to

 pLib = (void *)dlopen(r,RTLD_LAZY|RTLD_GLOBAL);

make clean and ./setup

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: SB π
« Reply #260 on: July 06, 2019, 09:24:40 PM »
I recompiled after the change and copied the pui.so to my runtime modules directory. The same problem still persists. (RPi 3B)

After replacing scriba as well it works. You're the man!

Can you push that to the sandbox?

« Last Edit: July 06, 2019, 09:38:08 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 2747
    • ScriptBasic Open Source Project
Re: SB π
« Reply #261 on: July 19, 2019, 01:23:51 PM »
Good News[

Peter Verhas has joined us on the RPi forum.

What is your thoughts about changing the name of setup to something like mksb?
« Last Edit: July 19, 2019, 07:40:00 PM by John »