Author Topic: Why do you care that much about BASIC part in the name of a language?  (Read 3746 times)

John

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #135 on: 01. September 2016, 18:35:04 »
The plan was to mask C string functions with BASIC like syntax. Once again, I'm not interested in creating another BASIC. This is all about helping BASIC programmers becoming familiar with C.

Mike Lobanovsky

  • Full Member
  • ***
  • Posts: 160
    • View Profile
    • Freestyle BASIC Script Language
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #136 on: 01. September 2016, 18:38:43 »
Aye aye, Cap! :)
Mike
____________________________________________________________________________________________
(3.6GHz i5-3470, 16GB RAM / 2 x nVidia GTX 650Ti SLI-bridged, 2GB VRAM / x64 Win 7, x86 elementaryOS Luna)

John

  • Sr. Member
  • ****
  • Posts: 326
    • View Profile
Re: Why do you care that much about BASIC part in the name of a language?
« Reply #137 on: 01. September 2016, 22:36:11 »
As an example, here is the beginning of the JS (JavaScript) extension module using C BASIC masking.

Code: [Select]
/*  V7 JavaScript Engine Extension Module */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <time.h>
#include <unistd.h>
#include "../../basext.h"
#include "../../scriba.h"
#include "cbasic.h"
#include "v7.h"


/****************************
 Extension Module Functions
****************************/

besVERSION_NEGOTIATE
  RETURN_FUNCTION((int)INTERFACE_VERSION);
besEND

besSUB_START
  DIM AS long PTR p;
  besMODULEPOINTER = besALLOC(sizeof(long));
  IF (besMODULEPOINTER EQ NULL) THEN_DO RETURN_FUNCTION(0);
  p = (long PTR)besMODULEPOINTER;
  RETURN_FUNCTION(0);
besEND

besSUB_FINISH
  DIM AS long PTR p;
  p = (long PTR)besMODULEPOINTER;
  IF (p EQ NULL) THEN_DO RETURN_FUNCTION(0);
  RETURN_FUNCTION(0);
besEND


/*******
 V7 API
*******/

besFUNCTION(js_create)
  struct v7 *v7 = v7_create();
  besRETURN_LONG(v7);
besEND

besFUNCTION(js_destroy)
  DIM AS unsigned long v7;
  besARGUMENTS("i")
    AT v7
  besARGEND
  v7_destroy(v7);
  besRETURNVALUE = NULL;
besEND
 
besFUNCTION(js_exec)
  DIM AS unsigned long v7;
  DIM AS const char *js_code;
  DIM AS v7_val_t result;
  enum v7_err rcode = V7_OK;
  besARGUMENTS("iz")
    AT v7, AT js_code
  besARGEND
  rcode = v7_exec(v7, js_code, result);
  besRETURN_LONG(rcode);
besEND

js.bas include
Code: [Select]
MODULE JS

declare sub     ::CREATE         alias "js_create"         lib "js"
declare sub     ::DESTROY        alias "js_destroy"        lib "js"
declare sub     ::EXEC           alias "js_exec"           lib "js"

END MODULE