Author Topic: libbbc.dll - C BASIC  (Read 10384 times)

0 Members and 1 Guest are viewing this topic.

Kuron

  • Guest
Re: libbbc.dll - C BASIC
« Reply #15 on: February 12, 2014, 02:13:54 PM »
The project site for C BASIC is HERE. It has a git based file repository, wiki and incident tracking feature. It's open to the public and allows for making requests and commenting on direction.

Like I said, there is NOT a community site and it can't grow without one.  I can understand wanting to keep it under wraps though, as it is still in the very early stages.  However, don't get upset that people are actually interested in the project and want to explore it.

JRS

  • Guest
Re: libbbc.dll - C BASIC
« Reply #16 on: February 12, 2014, 03:43:34 PM »
The All Basic Developer forum has a mailing list and IRC/chat feature for non-developer interaction. The Bitbucket site also allows anyone to post comments and issues. Most BASIC projects and forums have less than a dozen active members. I think you would be hard pressed to find another BASIC project more active than O2 & SB. It sounds like FB is trying to stay relevant with a C emitter translator that generates 64 bit code. ASM BASIC compilers don't have the draw they once did. With the speed of PCs and the industry upside down, portability is more of a concern.

 I added BBC_MOUSE based on vovchik's BaCon routine to the libbbc5 library. (current source on Bitbucket)

Code: [Select]
#include <stdio.h>
#include <math.h>
#include <SDL.h>
#include "libbbc5.h"
#include "cbasic.h"

MAIN
BEGIN_FUNCTION
  DIM AS int m, i;
  BBC_OPEN();
  DEF_FOR (i = 1 TO i <= 3 STEP INCR i)
  BEGIN_FOR
    m = BBC_MOUSE(2);
    PRINT ("Button: = %i\n", m);
    m = BBC_MOUSE(0);
    PRINT ("X: = %i\n", m);
    m = BBC_MOUSE(1);
    PRINT ("Y: = %i\n", m);
  NEXT
  BBC_WAITKEY();
  BBC_CLOSE();
  RETURN_FUNCTION(0);
END_FUNCTION  

jrs@laptop:~/libbbc$ ./mouse
Button: = 1
X: = 426
Y: = 8
Button: = 2
X: = 461
Y: = 164
Button: = 3
X: = 173
Y: = 362
jrs@laptop:~/libbbc$
« Last Edit: February 12, 2014, 04:05:46 PM by John »

Kuron

  • Guest
Re: libbbc.dll - C BASIC
« Reply #17 on: February 12, 2014, 07:58:54 PM »
Quote
The All Basic Developer forum has a mailing list
Mailing lists died back in the 20th century.

Quote
and IRC/chat feature for non-developer interaction.
Which I had to ask you to go into the one time, as nobody ever uses it.

Quote
I think you would be hard pressed to find another BASIC project more active than O2 & SB.
Yes, O2 is active, which is why CBASIC needs to move here where people using it and exploring it can actually discuss it, instead of the Chris Boss/Bob Zale tactics being used to keep it suppressed and intentionally keep everybody out.

Quote
ASM BASIC compilers don't have the draw they once did.
BASIC itself is dead.  PureBasic is the last actively developed and supported commercial BASIC.

Quote
It sounds like FB is trying to stay relevant with a C emitter translator that generates 64 bit code.
They brought out the C emitter years ago, but it never went anywhere.  But, it seems they are finally trying for 64-bit, which is a must-have.  At least FB actually has a usable forum. ;D

JRS

  • Guest
Re: libbbc.dll - C BASIC
« Reply #18 on: February 12, 2014, 08:24:33 PM »
Out of the 40+ members we have here only a handful post and even less contribute. The All BASIC Developer forum with it's 10 BASIC developers is all I have time for along with managing the ScriptBasic project. I think that C BASIC needs more of an effort by others as I seem to be the only one forging a direction with it. It's not ready for hobbyist or causal interest users and needs BASIC developers and advocates to actively participate in its maturity. Feel free to roll up your sleeves and make something happen. My plate is full.

Emil_halim

  • Guest
Re: libbbc.dll - C BASIC
« Reply #19 on: February 13, 2014, 08:31:36 AM »
Hi all,

Here is my approach , it is far form basic keywords , but it is more readable than c.

header add to cbasic.h
=================
Quote
#define ExportThis  __declspec(dllexport)
#define ImportThis  __declspec(dllimport)
#define DLL_MAIN ExportThis BOOL _stdcall DllMain(HINSTANCE hThisInstance,DWORD fdwReason, LPVOID lpvReserved) { return 1;}

#define int WINAPI WinMain (HINSTANCE hThisInstance,HINSTANCE hPrevInstance,LPSTR lpszArgument,int nCmdShow)
#define Currnt_Ver hThisInstance
#define Last_Ver hPrevInstance
#define Show_Win(x) ShowWindow(x, nCmdShow)
#define Events_BLock LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
#define EventsAddrBlock WindowProcedure
#define SELECT_Event switch (message)
#define If_Event case
#define Do_That :
#define Unknown_Event default:
#define End_Event break;
#define Call_def_Event DefWindowProc (hwnd, message, wParam, lParam);
#define AddrOf &


Example c
=========
Code: [Select]

#include <windows.h>
#include "cbasic.h"


Events_BLock
  begin
    SELECT_Event                            /* handle the messages */
      begin
        If_Event WM_DESTROY Do_That
               PostQuitMessage(0);          /* send a WM_QUIT to the message queue */
               End_Event
        Unknown_Event                       /* for messages that we don't deal with */
               return Call_def_Event
      end
    return 0;
  end


/*  Make the class name into a global variable  */
char szClassName[] = "CodeBlocksWindowsApp";

WinMain
 begin
    DIM AS HWND hwnd;               /* This is the handle for our window */
    DIM AS MSG messages;            /* Here messages to the application are saved */
    DIM AS WNDCLASSEX wincl;        /* Data structure for the windowclass */

    /* The Window structure */
    wincl.hInstance = Currnt_Ver;
    wincl.lpszClassName = szClassName;
    wincl.lpfnWndProc = EventsAddrBlock;      /* This function is called by windows */
    wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    wincl.cbSize = sizeof (WNDCLASSEX);

    /* Use default icon and mouse-pointer */
    wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    wincl.lpszMenuName = NULL;                 /* No menu */
    wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    wincl.cbWndExtra = 0;                      /* structure or the window instance */
    /* Use Windows's default colour as the background of the window */
    wincl.hbrBackground = CAST(COLOR_BACKGROUND,HBRUSH);

    /* Register the window class, and if it fails quit the program */
    if (!RegisterClassEx (AddrOf wincl))
        return 0;

    /* The class is registered, let's create the program*/
    hwnd = CreateWindowEx (
           0,                   /* Extended possibilites for variation */
           szClassName,         /* Classname */
           "Code::Blocks Template Windows App",       /* Title Text */
           WS_OVERLAPPEDWINDOW, /* default window */
           CW_USEDEFAULT,       /* Windows decides the position */
           CW_USEDEFAULT,       /* where the window ends up on the screen */
           544,                 /* The programs width */
           375,                 /* and height in pixels */
           HWND_DESKTOP,        /* The window is a child-window to desktop */
           NULL,                /* No menu */
           hThisInstance,       /* Program Instance handler */
           NULL                 /* No Window Creation data */
           );

    /* Make the window visible on the screen */
    Show_Win((hwnd);

    /* Run the message loop. It will run until GetMessage() returns 0 */
    while (GetMessage (AddrOf messages, NULL, 0, 0))
      begin
        /* Translate virtual-key messages into character messages */
        TranslateMessage(AddrOf messages);
        /* Send message to WindowProcedure */
        DispatchMessage(AddrOf messages);
      end

    /* The program return-value is 0 - The value that PostQuitMessage() gave */
    return messages.wParam;
 end

thanks.

JRS

  • Guest
Re: libbbc.dll - C BASIC
« Reply #20 on: February 13, 2014, 08:43:18 AM »
If C++ is your platform, have a look at JADE which is Armando's (AIR) C++ version of C BASIC.

Thanks for the post and hope you expand on it more.


Kuron

  • Guest
Re: libbbc.dll - C BASIC
« Reply #21 on: February 13, 2014, 06:11:02 PM »
The All BASIC Developer forum with it's 10 BASIC developers is all I have time for along with managing the ScriptBasic project. I think that C BASIC needs more of an effort by others as I seem to be the only one forging a direction with it... needs BASIC developers and advocates to actively participate in its maturity. Feel free to roll up your sleeves and make something happen. My plate is full.
No worries.  Since it is not open to more developers, I will fork it and any addons will be applied to the fork.

JRS

  • Guest
Re: libbbc.dll - C BASIC
« Reply #22 on: February 13, 2014, 08:03:10 PM »
Quote
Since it is not open to more developers, I will fork it and any addons will be applied to the fork.

Brice,

I have invited you in the past to join the All BASIC Developer forum and co-develop C BASIC. At the time you said you had a BASIC of your own that you were working on. The offer still stands.

John