Author Topic: OxygenBasic and BCX - powerful teamwork?  (Read 7721 times)

0 Members and 2 Guests are viewing this topic.

Arnold

  • Guest
OxygenBasic and BCX - powerful teamwork?
« on: October 05, 2015, 08:18:05 AM »
Hi Charles,

I have not lost interest in Oxygenbasic, quite the contrary. And it is good to know that at least Peter is seriously working with it.

Since some weeks I got attracted again by BCX, the Basic to C translator which has already been used for many applications in the past. When I noticed that it is possible to extract a runtime library from BCX by using bc -l, I interrupted my exploration of Iup for the moment. And I tried to start a BCX library for OxygenBasic. It is only a starting point of a Oxygen-BCX library which uses only a fraction of the many functions of BCX, but I am surprised how much there is already possible.

I am not exactly sure about the status ot the BCX Runtime library. There is a GNU General Public License for BCX and a BCX LICENSE EXCEPTION for the BCX libraries. BCX is developed for windows and therefore much more compact than e.g. GTK or IUP, which are cross-platform. The BCX Helpfile is a really helpful documentation of the BCX Gui functions, moreover there are many examples which can be used to test the code. And if some of the BCX and C experts are willing to share their experience such a library could be realized very fast. The big advantage would be that the BCX Gui will be translated and executed at once with Oxygenbasic. BCX could be a very powerful companion for OxygenBasic.

This is an example for using BCX and Oxygenbasic (as a first attempt). Unfortunately something does not work correctly, which I will describe in my next message

Roland


Code: OxygenBasic
  1. $ filename "ezedit.exe"
  2.  
  3. '#include "$/inc/RTL32.inc"
  4. '#include "$/inc/RTL64.inc"
  5.  
  6. #include "../bcx/bcxgui.inc"
  7.  
  8.  
  9. GUI "EZEdit"
  10.  
  11. DIM Form1 AS CONTROL
  12. dim Button1 as control
  13. DIM Edit1 AS CONTROL
  14. const Edit1_ID = 101
  15. const Button1_ID = 102
  16.  
  17. SUB FORMLOAD
  18.  
  19.     Form1 = BCX_FORM ( "BCX_FORM and Edit Box", 0, 0, 310, 250 )
  20.     Button1 = BCX_Button ("Ok", Form1, Button1_ID, 130, 200, 50, 20)
  21.     BCX_Set_Form_Color(Form1, qbcolor(9))
  22.     Edit1 = BCX_EDIT ( "Insert text here...", Form1, Edit1_ID, 0, 0, 200, 100)
  23.     BCX_SET_FONT (Edit1, "Courier New", 12, 0, true)
  24.  
  25.     Center(Edit1, Form1)
  26.     Center(Form1)
  27.    
  28.     SHOW (Form1) ' Show it!
  29. END SUB
  30.  
  31. BEGIN_EVENTS
  32.  
  33.     SELECT CASE CBMSG
  34.  
  35.         CASE WM_COMMAND
  36.           IF CBCTL = Button1_ID THEN
  37.             string buffer = nuls * 256
  38.                         SendMessage(Edit1,
  39.                         WM_GETTEXT,
  40.                         len(buffer),
  41.                         buffer);
  42.                         MessageBox(NULL,
  43.                     buffer,
  44.                         "Information",
  45.                         MB_ICONINFORMATION);
  46.           END IF
  47.          
  48.         CASE WM_SIZE
  49.             'Why do I need this?
  50.            UpdateWindow(Edit1)
  51.             UpdateWindow(Button1)
  52.          
  53.         CASE WM_CLOSE
  54.             DestroyWindow (Form1)
  55.  
  56.         CASE WM_DESTROY
  57.             PostQuitMessage(0)
  58.             EXIT FUNCTION
  59.            
  60.     END SELECT
  61.    
  62. END_EVENTS
  63.  
  64.  

[attachment deleted by admin]

Arnold

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #1 on: October 05, 2015, 08:25:19 AM »
I reduced the code of the previous example that it will work without a bcxgui library:

Code: OxygenBasic
  1. $ filename "ezedit_bcx.exe"
  2.  
  3. '#include "$/inc/RTL32.inc"
  4. '#include "$/inc/RTL64.inc"
  5.  
  6. #include "$/inc/MinWin.inc"
  7. #include "$/inc/console.inc"
  8. 'cr=chr(13,10)
  9.  
  10. type MSG_
  11.   sys   hwnd
  12.   int   message
  13.   sys   wParam
  14.   sys   lParam
  15.   dword time
  16.   POINT pt
  17. end type
  18.  
  19. type SIZE
  20.   long cx
  21.   long cy
  22. end type
  23.  
  24. #define COLOR_BTNFACE  15
  25.  
  26. #define ICC_LISTVIEW_CLASSES  0x00000001
  27. #define ICC_TREEVIEW_CLASSES  0x00000002
  28. #define ICC_BAR_CLASSES  0x00000004
  29. #define ICC_TAB_CLASSES  0x00000008
  30. #define ICC_UPDOWN_CLASS  0x00000010
  31. #define ICC_PROGRESS_CLASS  0x00000020
  32. '#define ICC_HOTKEY_CLASS  0x00000040
  33. '#define ICC_ANIMATE_CLASS  0x00000080
  34. '#define ICC_WIN95_CLASSES  0x000000FF
  35. #define ICC_DATE_CLASSES  0x00000100
  36. #define ICC_USEREX_CLASSES  0x00000200
  37.  
  38.  
  39. #define WM_GETFONT  0x0031
  40. #define DEFAULT_GUI_FONT  17
  41.  
  42.  
  43. '=========
  44.  'MAIN CODE
  45. '=========
  46.  
  47. dim cmdline as asciiz ptr, hInst as sys
  48. &cmdline=GetCommandLine
  49. hInst=GetModuleHandle(0)
  50.  
  51.  
  52. function RGB(int r,g,b) as int
  53.    return r + g*256 + b*65536
  54. end function
  55.  
  56. function MAKELPARAM (long a, dword b)
  57.  return a | (b << 16)
  58. end function
  59.  
  60. function MAKEWPARAM (long a, dword b)
  61.  return a | (b << 16)
  62. end function
  63.  
  64. ! GetActiveWindow lib "user32.dll" () as sys
  65. ! GetClassInfoEx lib "user32.dll" alias "GetClassInfoExA" (sys hinst, char* lpszClass, WNDCLASSEX *lpwcx) as bool
  66. ! IsWindow lib "user32.dll" (sys hWnd) as bool
  67. ! IsDialogMessage lib "user32.dll" alias "IsDialogMessageA" (sys hDlg, sys lpMsg) as bool
  68. ! GetTextExtentPoint32 lib "gdi32.dll" alias "GetTextExtentPoint32A" (sys hdc, char* lpString, int cbString,  SIZE *lpSize) as bool
  69. ! MapDialogRect lib "user32.dll" (sys hDlg, RECT *lpRect) as bool
  70. ! RedrawWindow lib "user32.dll" (sys hWnd, sys lprcUpdate, sys hrgnUpdate, uint flags) as bool
  71.  
  72.  
  73.  
  74. // *********************************************************************
  75. // Created with BCX32 - BASIC To C/C++ Translator (V) BCX 7.2.4 (2015/08/21)
  76. //                 BCX (c) 1999 - 2015 by Kevin Diggins
  77. // *********************************************************************
  78. // ***************************************************
  79.  
  80. // *************************************************
  81. //        User's GLOBAL ENUM blocks
  82. // *************************************************
  83.  
  84. // *************************************************
  85. //            System Defined Constants
  86. // *************************************************
  87.  
  88. #define cSizeOfDefaultString 2048
  89.  
  90. // *************************************************
  91. //            User Defined Constants
  92. // *************************************************
  93.  
  94. #define Edit1_ID 101
  95. #define Button1_ID 102
  96.  
  97. // *************************************************
  98. //               Standard Prototypes
  99. // *************************************************
  100.  
  101.  
  102.  
  103. // *************************************************
  104. //            User Global Variables
  105. // *************************************************
  106.  
  107. static sys     BcxFont;
  108. static float   BCX_ScaleX;
  109. static float   BCX_ScaleY;
  110. static sys     BCX_hInstance;
  111. static sys     BCX_hwndMDIClient;
  112. static WNDCLASSEX BCX_WndClass;
  113. static BOOL    BCX_GUI_Init;
  114. static string  BCX_ClassName = nuls * cSizeOfDefaultString
  115.  
  116. static sys    Form1;
  117. static sys    Button1;
  118. static sys    Edit1;
  119. static string buffer = nuls * cSizeOfDefaultString
  120.  
  121.  
  122. // *************************************************
  123. //               Standard Macros
  124. // *************************************************
  125.  
  126.  
  127. ' #define Show(Window)RedrawWindow(Window,0,0,0);ShowWindow(Window,SW_SHOW);
  128.  
  129. macro Show(Window)
  130.    RedrawWindow(Window, 0, 0, 0)
  131.    ShowWindow(Window, SW_SHOW)
  132. end macro
  133.  
  134.  
  135. // *************************************************
  136. //               User Prototypes
  137. // *************************************************
  138.  
  139.  
  140.  
  141. // *************************************************
  142. //                 Runtime Functions
  143. // *************************************************
  144.  
  145. function BCX_Form(optional string Caption, optional int X=0,optional int Y=0,optional int W=250,optional int H=150,optional int Style=-1, optional int Exstyle=0) as sys
  146.   int xf,yf,wf,hf
  147.    
  148.   if Style=-1 then
  149.        Style= WS_MINIMIZEBOX | WS_SIZEBOX | WS_CAPTION |
  150.               WS_MAXIMIZEBOX | WS_POPUP   | WS_SYSMENU
  151.   end if
  152.   xf=X*BCX_ScaleX : yf=Y*BCX_ScaleY : wf=(4+W)*BCX_ScaleX : hf=(12+H)*BCX_ScaleY
  153.   sys A = CreateWindowEx(Exstyle, BCX_ClassName,  Caption, Style,
  154.                          xf, yf, wf, hf,
  155.                          NULL, NULL,BCX_hInstance,NULL)
  156.                        
  157.   if A = NULL then
  158.         MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION or MB_OK)
  159.         ExitProcess(1)
  160.   end if
  161.  
  162. ''  sys fnt                          
  163. ''  if BcxFont=0 then fnt=GetStockObject(DEFAULT_GUI_FONT) else fnt = BcxFont end if                        
  164. ''  SendMessage(A, WM_SETFONT, fnt, 0)
  165.  SendMessage(A, WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT), 0)
  166.   return A
  167. end function
  168.  
  169. function GetTextSize(string text, optional sys hWnd=0, optional sys fnt=0) as sys 'SIZE*
  170.  sys  hdc=GetDC(hWnd)
  171.   if fnt=0 then fnt=SendMessage(hWnd,WM_GETFONT,0,0)
  172.   sys sobj=SelectObject(hdc,fnt)
  173.   static SIZE sz
  174.   le=len(text)
  175.   GetTextExtentPoint32(hdc, text, le, sz)
  176.   SelectObject(hdc,sobj)
  177.   ReleaseDC(hWnd,hdc)
  178.   return (&sz)
  179. end function
  180.  
  181.  
  182. function BCX_Button(string Text,sys hwnd,int id,int X, Y,optional int W=0,optional int H=0,optional int Style=0,optional int Exstyle=-1) as sys
  183.   int xc,yc,wc,hc
  184.  
  185.   if Style=0 then
  186.       Style=WS_CHILD | WS_VISIBLE | BS_MULTILINE | BS_PUSHBUTTON | WS_TABSTOP
  187.   end if  
  188.   if Exstyle=-1 then
  189.     Exstyle=WS_EX_STATICEDGE
  190.   end if
  191.   xc=X*BCX_ScaleX : yc=Y*BCX_ScaleY : wc=W*BCX_ScaleX : hc=H*BCX_ScaleY  
  192.   sys A = CreateWindowEx(Exstyle,"button", Text,Style,
  193.                           xc,yc,wc,hc,
  194.                           hwnd,id,BCX_hInstance,NULL)
  195.   if A = NULL then
  196.         MessageBox(NULL, "Button Creation Failed!", "Error!", MB_ICONEXCLAMATION or MB_OK)
  197.         ExitProcess(1)
  198.   end if                      
  199.  
  200. ''  SendMessage(A,(UINT)WM_SETFONT, DefaultFont(hwnd), MAKELPARAM(FALSE,0))
  201.  SendMessage(A,(UINT)WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(FALSE,0))
  202.  
  203.   if W=0 then
  204.       psiz = GetTextSize(Text,A)
  205.       SIZE siz at psiz
  206.       xc=X*BCX_ScaleX : yc=Y*BCX_ScaleY: wc=siz.cx+24: hc=siz.cy+12
  207.       MoveWindow(A, xc, yc, wc, hc, TRUE)
  208.   end if
  209.  
  210.   return A
  211. end function
  212.  
  213.  
  214. function BCX_Edit(string Text,sys hWnd,int id,int X,int Y,int W,int H,optional int Style=0,optional int Exstyle=-1) as sys
  215.   int xc,yc,wc,hc
  216.   sys  A
  217.   if Style=0 then
  218.       Style = WS_CHILD | WS_VISIBLE | ES_WANTRETURN |
  219.               WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL
  220.   end if  
  221.   if Exstyle=-1 then Exstyle = WS_EX_CLIENTEDGE
  222.  
  223.   xc=X*BCX_ScaleX : yc=Y*BCX_ScaleY : wc=W*BCX_ScaleX : hc=H*BCX_ScaleY    
  224.   A = CreateWindowEx(Exstyle,"edit",Text, Style,
  225.       xc,yc,wc,hc,      
  226.       hWnd,id,BCX_hInstance,NULL)
  227.   if A = NULL then
  228.         MessageBox(NULL, "Edit Creation Failed!", "Error!", MB_ICONEXCLAMATION or MB_OK)
  229.         ExitProcess(1)
  230.   end if  
  231.  
  232. ''  SendMessage(A,WM_SETFONT,DefaultFont(hwnd),0)
  233.  SendMessage(A,(UINT)WM_SETFONT, GetStockObject(DEFAULT_GUI_FONT), MAKELPARAM(FALSE,0))
  234.   return A
  235. end function
  236.  
  237.  
  238. void BCX_InitGUI (void)
  239. {
  240.   INITCOMMONCONTROLSEXt  iccex;
  241.   if(BCX_GUI_Init)
  242.     {
  243.       return;
  244.     }
  245.   RECT  rc={0,0,4,8};
  246.   MapDialogRect(NULL, rc);
  247.   BCX_ScaleX=rc.right/2;
  248.   BCX_ScaleY=rc.bottom/4;
  249.   BCX_hInstance=GetModuleHandle(NULL);
  250.   BCX_hwndMDIClient=NULL;
  251.   BCX_WndClass.cbSize=sizeof(BCX_WndClass);
  252.   BCX_WndClass.style=CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
  253.   BCX_WndClass.cbClsExtra=0;
  254.   BCX_WndClass.cbWndExtra=0;
  255.   BCX_WndClass.hIcon= LoadIcon(NULL,IDI_WINLOGO);;
  256.   BCX_WndClass.hCursor=LoadCursor(NULL,IDC_ARROW);
  257.   BCX_WndClass.hbrBackground=(COLOR_BTNFACE+1);
  258.   BCX_WndClass.lpszMenuName=NULL;
  259.   BCX_WndClass.hIconSm=NULL;
  260.   iccex.dwSize=sizeof(INITCOMMONCONTROLSEXt);
  261.   iccex.dwICC=ICC_LISTVIEW_CLASSES | ICC_TREEVIEW_CLASSES | ICC_BAR_CLASSES | ICC_TAB_CLASSES | ICC_UPDOWN_CLASS | ICC_PROGRESS_CLASS | ICC_USEREX_CLASSES | ICC_DATE_CLASSES;
  262.   InitCommonControlsEx( iccex);
  263.   BCX_GUI_Init=TRUE;
  264. }
  265.  
  266.  
  267. sub BCX_SetMetric (string metric)
  268.  
  269.   if not BCX_GUI_Init then BCX_InitGUI()
  270.    
  271.   if ucase(metric) = "PIXELS" then
  272.    
  273.       BCX_ScaleX=1
  274.       BCX_ScaleY=1
  275.    
  276.   else
  277.    
  278.       RECT  rc={0,0,4,8}
  279.       MapDialogRect(NULL, rc)
  280.       BCX_ScaleX=rc.right/2
  281.       BCX_ScaleY=rc.bottom/4
  282.   end if
  283. end sub
  284.  
  285.  
  286. sub BCX_RegWnd (string classname, sys *Form_WndProc)
  287.  
  288.   if classname="" then
  289.       MessageBox (GetActiveWindow(),"Empty String For BCX_ClassName NOT Allowed","Empty ClassName",0)
  290.       ExitProcess(1)
  291.   end if
  292.  
  293.   if GetClassInfoEx( BCX_hInstance, strptr classname, BCX_WndClass) <> 0 then
  294.       if not Form_WndProc then      
  295.           UnregisterClass(classname,BCX_hInstance)
  296.       end if
  297.       return
  298.   end if
  299.  
  300.   if not BCX_GUI_Init then
  301.       BCX_InitGUI()
  302.   end if
  303.  
  304.   if BCX_ScaleX=0 && BCX_ScaleY = 0 then
  305.       BCX_SetMetric("Pixels")
  306.   end if
  307.  
  308.   BCX_ClassName = classname
  309.   BCX_WndClass.lpfnWndProc=@Form_WndProc
  310.   BCX_WndClass.hInstance=BCX_hInstance
  311.   BCX_WndClass.lpszClassName=strptr(classname)
  312.   if not RegisterClassEx(&BCX_WndClass) then
  313.         MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION or MB_OK)
  314.     ExitProcess(1)
  315.   end if
  316. end sub
  317.  
  318.  
  319. // ************************************
  320. //       User Subs and Functions
  321. // ************************************
  322.  
  323. void FormLoad (void)
  324. {
  325.   Form1= BCX_Form("BCX_FORM and Edit Box", 0, 0, 210, 150);
  326.   Button1= BCX_Button("Ok", Form1, Button1_ID, 60, 110, 60, 20 );
  327.   Edit1= BCX_Edit("Insert text here...", Form1, Edit1_ID, 0, 0, 200, 100);
  328.   Show(Form1);
  329. }
  330.  
  331.  
  332. sys WndProc (HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam) callback
  333. {
  334.   if(Msg==WM_COMMAND )
  335.     {
  336.       if(LOWORD(wParam)==Button1_ID )
  337.         {
  338.           SendMessage(Edit1,(UINT)WM_GETTEXT, len(buffer), buffer);
  339.           MessageBox (GetActiveWindow(),buffer,"Information",0 );
  340.         }
  341.       goto L1000;
  342.     }
  343.   if(Msg==WM_CLOSE )
  344.     {
  345.       DestroyWindow(Form1);
  346.       return 0;
  347.     }
  348.   if(Msg==WM_DESTROY )
  349.     {
  350.       PostQuitMessage(0);
  351.       return 0;
  352.     }
  353. L1000:; // SelectState[PusherSelectState].CaseFlag 2
  354.   if(Msg==WM_DESTROY)
  355.     {
  356.        PostQuitMessage(0);
  357.        return 0;
  358.     }
  359.  return DefWindowProc(hWnd,Msg,wParam,lParam); // endevents
  360. }
  361.  
  362.  
  363. // **********************************
  364.  
  365. int WinMain(sys hInst, hPrev,asciiz *CmdLine,int CmdShow)
  366. {
  367.  MSG_      Msg;
  368.  BCX_ClassName ="EZEdit";
  369.  BCX_SetMetric("");
  370.  BCX_InitGUI();
  371.  BCX_hInstance       =  hInst;
  372.  BCX_WndClass.hIcon  =  LoadIcon(NULL,IDI_WINLOGO);
  373.  BCX_RegWnd( BCX_ClassName, @WndProc );
  374.  
  375.  
  376.  // ******************************************
  377.                   FormLoad();
  378.  // ******************************************
  379.  
  380.  while(GetMessage(&Msg,NULL,0,0))
  381.    {
  382.     sys hActiveWindow = GetActiveWindow();
  383.     if(not IsWindow(hActiveWindow) || not IsDialogMessage(hActiveWindow,&Msg))
  384.       {
  385.         TranslateMessage(&Msg);
  386.         DispatchMessage(&Msg);
  387.       }
  388.     }
  389.  return Msg.wParam;
  390. }
  391.  
  392. WinMain(hInst, 0, cmdline, SW_NORMAL )
  393.  
  394.  

If I enter text in the Edit control I get 4 charactes at once with a stroke. The corresponding Ezedit_bcx.c file which I compiled with Pelles C works as expected, so I do not know what I have overlooke? Maybe I can get some help? If I created the Edit and Button controls during WM_CREATE everthing would work ok, but BCX does not need WM_CREATE neither.

Roland

[attachment deleted by admin]

Aurel

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #2 on: October 05, 2015, 10:53:51 AM »
Hi Arnold ..Roland
I simply cannot help you because i am not sure which oxygen.dll to use
with my own programs...  ::)
first you must add here bcx_include file
adding any string to edit control require strptr in Oxygen basic

..do you try this simple program maybe with my small include file awinh.inc ?
..ok i will try with latest oxygen.dll version   

Mike Lobanovsky

  • Guest
Re: OxygenBasic and BCX - powerful teamwork? BEWARE!
« Reply #3 on: October 05, 2015, 01:26:59 PM »
Hi Roland,

I'm sorry for not being helpful, code-wise, in my remarks to this thread. Matter is, there are some license considerations that should be taken into account before going any further along the lines of this thread.

The problem is the BCX source code inclusive of its runtime library is covered by the restrictive GNU GPL, which means it may not be used verbatim in any projects that aren't governed by the same license. Similarly, the BCX runtime library may not be used in non-GNU GPL projects even if it is compiled in a standalone dynamic link library (LGPL would allow the latter while pure GPL does not). The BCX runtime library exception only permits the resultant translations obtained via BCX as a whole to be deployed at the end user's licensing option -- no more, no less.

On the other hand, Charles positions OxygenBasic as a public domain project, which means its sources and binaries are completely free for any use, closed or open, commercial or free, and the end user is free to choose any license, or absence thereof, for their resultant O2 applications.

The GNU GPL and Public Domain are incompatible on the GPL side of the link. The situation wouldn't be so bad, however, if only BCX were at least MIT or BSD licensed, which it actually isn't.

From that perspective, what you're doing here in your reply #1 is illegal.

Aurel

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #4 on: October 05, 2015, 01:49:17 PM »
ok i need some time to get what is what and where in my OXYGEN FOLDERS  ;D

BCX have a really great way for making GUI applications but is not so simple .

simplex... way  :)
Code: [Select]
$ Filename "skeleton.exe" ' Oxygen Basic
Include "RTL32.inc"
Include "awinh.inc"
INT win,x=0,y=0,w=400,h=300,wstyle = WS_MINMAXSIZE
win=SetWindow("Skeleton GUI App...",x,y,w,h,0,wstyle)
Wait()  'message loop
Function WndProc (sys hwnd,wmsg,wparam,lparam) as sys callback
Select hwnd
Case win
Select wmsg
Case WM_CLOSE
CloseWindow(win)
EndProgram
End Select
End Select
Return Default
End FUNCTION

In zip you can find program for testing and you can see what is in awinh inc file..

FOR BCX GUI functions and include files i think that we must ask James  ;)


[attachment deleted by admin]

Mike Lobanovsky

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #5 on: October 05, 2015, 02:09:25 PM »
FOR BCX GUI functions and include files i think that we must ask James  ;)

Both James' bc9 and UbxWx as well as Armando's MBC are strictly GNU GPL as they simply may not bear any other license because all of them are effectively BCX forks targeted for C++ and/or non-Windows platforms.

I repeat, OxygenBasic is Public Domain as confirmed by Charles in this thread. The differences between those licenses are common knowledge and are covered on the web very well. No need for winks here, Aurel, because Google will be your best friend in what regards my input.
« Last Edit: October 05, 2015, 05:07:19 PM by Mike Lobanovsky »

Arnold

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #6 on: October 05, 2015, 05:52:22 PM »
Hi Mike,

Quote
From that perspective, what you're doing here in your reply #1 is illegal.

I do not think that anything is wrong with my reply #1. The C-code was created with bc.exe and compiled with Pelles C. The .o2bas code was my humble attempt to adapt the C-code to Oxygen. There are no hidden or secret routines in this case. The only difference is that the executable created with Pelles C works ok, and that the Oxygenbasic file does not work completely ok due to my incompetence. But I think this problem can be solved.

Of course I am not sure about an BCX-Oxygen library. (otherwise I would have uploaded my temporary results). I do not intend to deny the origin of the BCX routines. They are short and yet effective, they do not prevent a programmer from adding own ideas, and there is no need to reinvent the wheel.

And if it should not be allowed to use BCX Runtime together with Oxygenbasic I will do this nevertheless, at home, on the q.t.

Roland


Mike Lobanovsky

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #7 on: October 05, 2015, 06:28:53 PM »
I do not intend to deny the origin of the BCX routines.
I'm afraid this won't be sufficient to acquit you in court. :) As per GNU GPL, there's a hellofalot more minor requirements your project is supposed to meet to be able to use verbatim BCX BASIC sources in it, while the main requirement would be that your project (called "derivative work") also comply with the GNU GPL in full. Which will inevitably and immediately render it unusable for me and many more devs like me who deny the GPL's restrictive nature in principle.

Quote
... there is no need to reinvent the wheel.
That would be as lame an excuse as the one above.

Quote
And if it should not be allowed to use BCX Runtime together with Oxygenbasic ...
It isn't. IANAL (a.k.a "I am not a lawer") but it should be obvious even for such ordinary folks like us.

Quote
... I will do this nevertheless, at home, on the q.t.
I am not sure what "q.t." means but I guess that would be the only legal way to fiddle with it making sure to abstain from exposing the fruit of your work to public at large.

Please take my heads-up as a friendly caution. Been there, seen that. :)

Regards,

Charles Pegge

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #8 on: October 06, 2015, 03:31:34 AM »
I would ask the license holder of BCX, whther they would be willing to change to a more relaxed licence. The constraints may be unintentional. given the diminished population of basic programmers.

Is James Fuller the license holder ?

Mike Lobanovsky

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #9 on: October 06, 2015, 05:11:56 AM »
Hi Charles,

Nice to see you around again. :)

Much to my regret, I'm afraid this wouldn't be as easy as that. There must be an express and unanimous consent by all the contributors to the BCX code to be able to change its GNU GPL license legally for something less stringent than that. Kevin Diggins is only the BCX project overall copyright holder while, according to the GNU GPL terms and conditions, every contributor remains a unique copyright holder of individual portions of code he authored directly.

The process can take eons to complete given the immense number of devs that have contributed their bits and pieces over the decades that the BCX project exists.

Here's how similar MIT relicensing goes on currently about the formerly GNU LGPL Tiny C Compiler (TCC) written originally by Fabrice Bellard, that I'm watching very closely because the 32-bit MS Windows-only no-ATT-asm part of it forms the core engine of my FBSL v3.5 Dynamic C jitter:
-- latest diff at TCC git repo dated July 31, 2015;
-- RELICENSING doc to legalize the contributors' consent.
« Last Edit: October 06, 2015, 05:47:24 AM by Mike Lobanovsky »

Arnold

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #10 on: October 06, 2015, 05:45:31 AM »
Ok, I found my bug. If I replace this code:

Code: OxygenBasic
  1.  while(GetMessage(&Msg,NULL,0,0))
  2.    {
  3.     sys hActiveWindow = GetActiveWindow();
  4.     if(not IsWindow(hActiveWindow) || not IsDialogMessage(hActiveWindow,&Msg))
  5.       {
  6.         TranslateMessage(&Msg);
  7.         DispatchMessage(&Msg);
  8.       }
  9.     }
  10.  return Msg.wParam;
  11.  

with this piece of code:

Code: OxygenBasic
  1.     sys bRet
  2.    
  3.     do while (bRet := GetMessage(&Msg, NULL, 0, 0)) != 0
  4.       if bRet = -1 then
  5.         'show an error message
  6.        print "Error in Message Loop"
  7.         end        
  8.       else
  9.         TranslateMessage(&Msg)
  10.         DispatchMessage(&Msg)
  11.       end if
  12.     wend
  13.    
  14.         return Msg.wParam
  15.  

everything works like expected. I have to check what IsWindow and IsDialogMessage are good for and how I can use them.

BTW: it is still amazing how OxygenBasic can manage all these possible syntax variations. I can even use MSG Msg instead of MSG_ Msg.

Roland

jcfuller

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #11 on: October 06, 2015, 06:11:50 AM »
I am waiting on confirmation from Kevin but this is my interpretation:
Arnold's approach would be governed by the GPL.
But we have the BCX LICENSE EXCEPTION for app's created with the translators.
Quote
As a special exception, the BCX license gives permission for additional uses
of the text contained in its release of BCX. The exception is that, if you use
BCX to create source code that will link the BCX libraries with other files to
produce an executable, this does not by itself cause the resulting executable
to be covered by the GNU GPL.  Your use of that executable is in no way
restricted on account of using BCX to produce source code that will link the
BCX library code into it.

This exception does not invalidate any other reasons why the executable file
might be covered by the GNU General Public License.  This exception applies
only to the code released with this BCX explicit exception. If you add or copy
code from other sources, as the General Public License permits, the above
exception does not apply to the code that you add in this way.

To avoid misleading anyone as to the status of such modified files, you must
delete this exception notice from them.  If you write modifications of your
own for BCX, it is your choice whether to permit this exception to apply to
your modifications.

James

Mike Lobanovsky

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #12 on: October 06, 2015, 06:59:15 AM »
Hi James,

Thanks for chiming in.

... this is my interpretation:
Arnold's approach would be governed by the GPL.
That's exactly what I'm trying to convey.

Quote
But we have the BCX LICENSE EXCEPTION for app's created with the translators.
What Roland is effectively trying to do in the first place is not creating an app but rather translate the BCX library to C first and then change the translation (in fact, translate it again) so that it would use OxygenBasic syntax and vocabulary to do essentially the same things that the BCX original does.

This means that his work is a modification (translation is modification as per GNU GPL) of initial BCX BASIC GNU GPL sources and as such must be covered by a similar GNU GPL license with all its implications, and the GNU GPL expressly forbids the use of such a library in a non-GPL project.

Arnold

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #13 on: October 06, 2015, 07:55:48 AM »
Hi,

yes I would like to use part of the BCX Runtime library, which can be extracted by using BC -l and which contain a lot of useful functions. There is also the (undocumented) possibility to create a runtime dll, which is not quite complete, but it is possible to create a dll with Pelles C after some modifications.

My tests so far using OxygenBasic's powerful ability to apply macros show that it should be possible to create applications similar to BCX syntax with only minimal modifications. (see my very first example). The step to translate a program into C syntax would not be necessary at last.

But of course it depends what is allowed. My purpose at least is not to claim any rights, only to learn a little bit more about things for which I had not the time the last years.

Roland

jcfuller

  • Guest
Re: OxygenBasic and BCX - powerful teamwork?
« Reply #14 on: October 06, 2015, 09:55:30 AM »
I was wrong.
Roland, there appears to be no problem using the code you want.
Just received this from MR. BCX:
Quote
Not only can the direct translations be used royalty free, parts of the translator itself can be freely reused, so long as a directly competing "BCX-like" product which is a pretty broad definition.

James