Author Topic: C BASIC  (Read 72569 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C BASIC
« Reply #75 on: November 02, 2013, 01:57:20 PM »
If the truth were to be known, C was created by a lazy BASIC programmer that can't type.  :)

Code: [Select]
for (i=0; limit i<count; step incr i)
The INCR for STEP is a nice addition. I'm still mulling over the limit vs. TO variation.
« Last Edit: November 02, 2013, 02:15:23 PM by John »

kryton9

  • Guest
Re: C BASIC
« Reply #76 on: November 02, 2013, 05:04:38 PM »
Wanted to Join in for a short bit of Fun.
Quote
#include <stdio.h>
#include <stdlib.h>

#define FOR(x,y) int i;for(i=x;i<=y;i++){
/* #define BEGIN { */
#define NEXT }
int main()
{
    FOR(1,5)
        printf("Hello world!\n");
    NEXT
    return 0;
}

kryton9

  • Guest
Re: C BASIC
« Reply #77 on: November 02, 2013, 05:18:37 PM »
Join Fun 2, then back to video making :)
Quote
#include <stdio.h>
#include <stdlib.h>

#define BEGIN {
#define FOR(x,y) int i;for(i=x;i<=y;i++){
#define FORS(x,y,z) for(i=x;i<=y;i+=z){
#define NEXT }
#define PRINT(a) printf((a));
#define END return 0;}

int main()
BEGIN
    FOR(1,3)
        PRINT("Join \n")
    NEXT
    FORS(1,10,2)
        PRINT("Fun!\n")
    NEXT
END

kryton9

  • Guest
Re: C BASIC
« Reply #78 on: November 02, 2013, 05:25:48 PM »
Last one I promise :)
Quote
#include <stdio.h>
#include <stdlib.h>

#define FOR(x,y) int i;for(i=x;i<=y;i++){
#define FORS(x,y,z) for(i=x;i<=y;i+=z){
#define NEXT }
#define PRINT(a) printf((a));
#define START int main(){
#define FINISH return 0;}
#define FINISH_ERROR return 1;}


START
    FOR(1,3)
        PRINT("Join \n")
    NEXT
    FORS(1,10,2)
        PRINT("Fun!\n")
    NEXT
FINISH

« Last Edit: November 02, 2013, 05:29:28 PM by kryton9 »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C BASIC
« Reply #79 on: November 02, 2013, 05:33:44 PM »
I'm glad you're having fun with this!

I knew I shouldn't have posted those function macros. (opening Pandora's box)  :o

I encourage as many creative variations as possible.

  • Brief - Charles
  • Full flavored traditional - John
  • C++ BASIC - Kent
« Last Edit: November 02, 2013, 06:55:26 PM by John »

kryton9

  • Guest
Re: C BASIC
« Reply #80 on: November 02, 2013, 06:24:38 PM »
I'm glad you're having fun with this!

I knew I shouldn't have posted those function macros. (opening Pandora's box)  :o

I encourage as many creative variations as possible.

  • Brief - Charles
  • Full flavored traditional - John
  • K BASIC - Kent (currently in too much candy mode)

I want to be a big Thorn in the Side of the C++ Standards Committee for not making things better. I had high hopes for C++11, but after
going through a new book on it. C is the way to go, but with a nice overlay as you guys have started.
With the help here I would love to see a light weight c++ alternative that uses ANSI C underneath so no conflicts or special compilers needed.

So no BASIC in my branch name... CppThorn or perhaps just Thorn or ThornC (The Humanistic Overlay Release of New C )
orC  Overlay Release C
« Last Edit: November 02, 2013, 06:37:27 PM by kryton9 »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C BASIC
« Reply #81 on: November 02, 2013, 06:37:49 PM »
A C++ BASIC is a GREAT idea. Mike (JRS forum member) posted a C++ example that was suppose to be a brain twister but when converted to C BASIC, Hello World could have been its brother.  :D

You have been a C++ / BASIC fan as long as I have know of you. (forums)
« Last Edit: November 02, 2013, 07:03:01 PM by John »

kryton9

  • Guest
Re: C BASIC
« Reply #82 on: November 02, 2013, 07:09:23 PM »
Will give it a shot with the guys here if we can pull it off. The pressure is off because Nimrod is out there and what Oxygen will eventually become, even more so than now.

Offline AIR

  • BASIC Developer
  • Posts: 932
  • Coder
Re: C BASIC
« Reply #83 on: November 02, 2013, 07:39:56 PM »
A C++ BASIC is a GREAT idea.

Koff....MBC....Koff....BC9....koff ;D ;D

Just sayin.....

A.

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C BASIC
« Reply #84 on: November 02, 2013, 07:47:41 PM »
I choked on the MBC/BCX globals.  :(

I'm sure MBC, BaCon and IUP will be valuable resources for the C BASIC project. Do you envision C++ being a lot more work?

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
Re: C BASIC
« Reply #85 on: November 02, 2013, 08:19:23 PM »
This may not be a good comparison but the happy ending to the effort is motivating.



Quote
Congrats Exophase and Lordus on surpassing 50.000 sales ( $7.95 a pop) on Google Play in little over a month! You guys deserve the success.

kryton9

  • Guest
Tease Shot for the Night
« Reply #86 on: November 03, 2013, 03:28:09 AM »
I will go to bed leaving you guys this tease screenshot. This is C?  Yes, it is :)  hehehehehe 6:30am you have to fogive me.

FOR     normal for default step of 1
FORS   normal for with step

FORR    for Reverse default step -1
FORRS    for Reverse with step

I didn't post the code, because I want to get it to a single for function to do all of the above. Too tired now to do it.
« Last Edit: November 03, 2013, 03:34:33 AM by kryton9 »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
C BASIC - #define definitions
« Reply #87 on: November 03, 2013, 06:34:32 PM »
Will each of you (Charles excluded) please post your current #define / macro lists? Charles has established the core C BASIC keyword syntax which will be known as the default for C BASIC. All other variations will be treated as sub-projects and maintained by their creators. It's time to share so please get your current lists posted. I will be posting my current QB45 (traditional BASIC) #define list shortly.

C BASIC - Charles's #include(s) and #define(s) as of 2013-11-3
Code: [Select]
  #include <stdarg.h>
  #include <stdlib.h>
  #include <stdio.h>

  #define function
  #define method
  #define gosub
  #define dim
  #define as
  #define to
  #define limit
  #define step
  #define then
  #define procedure void
  #define sub   void
  #define begin {
  #define end   }
  #define and   &&
  #define or    ||
  #define class typedef struct
  #define types typedef struct
  #define member ->
  #define addressof &
  #define has =
  #define incr ++
  #define decr --
  #define next ++
  #define prior --
  #define byref *
  #define ref   void*
  #define references = &
  #define FreeSpace free
« Last Edit: November 03, 2013, 06:40:09 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
C BASIC - QB / Traditional BASIC #define(s)
« Reply #88 on: November 03, 2013, 07:35:56 PM »
This is my current list with a focus of converting the Wetspot II once QB now C game to C BASIC. My end goal is Android (C4droid/SDL) and a migration path for the hundreds of DOS games (and their authors/advocates) searching for a new life. If this is a direction you might be interested in co-developing with me, I can use all the help I can get. I have already reached out to forums I feel would be receptive and has an large active community. The Dingoonity.org (22,307 members) has an secondary Android interest which I hope to embellish. Here is a couple links to threads I have going there.

Wetspot II - Thread started by the author of the C version of Wetspot II.

DOSBox - Started out as a FYI DOSBox for Android thread and has progressed into introducing C4droid and SDL.

Code: [Select]
  #define FUNCTION
  #define BEGIN_FUNCTION {
  #define END_FUNCTION }
  #define SUB void
  #define BEGIN_SUB {
  #define END_SUB }
  #define RETURN return
  #define CALL
  #define AND &&
  #define OR ||
  #define MOD %
  #define DIM
  #define AS
  #define LET
  #define INCR ++
  #define DECR --
  #define IF if
  #define BEGIN_IF {
  #define THEN {
  #define THEN_DO
  #define ELSE } else {
  #define END_IF }
  #define FOR for
  #define TO ;
  #define STEP ;
  #define BEGIN_FOR {
  #define NEXT }
  #define SELECT_CASE switch
  #define BEGIN_SELECT {
  #define CASE case
  #define _TO_ ...
  #define END_CASE break;
  #define CASE_ELSE default:
  #define END_SELECT }
  #define DO do {
  #define WHILE } while

//  Funtion MACRO Define's
  #define LTRIM(x) sm->Ltrim(&x, x)
  #define RTRIM(x) sm->Rtrim(&x, x)
  #define UCASE(x) sm->Ucase(&x, x)
  #define LCASE(x) sm->Lcase(&x, x)
« Last Edit: November 03, 2013, 08:35:12 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3597
    • ScriptBasic Open Source Project
C BASIC - PowerBASIC #define(s)
« Reply #89 on: November 03, 2013, 07:51:42 PM »
It would be great if someone would like to take ownership of doing a PowerBASIC version of  the C BASIC #define(s).