Author Topic: Cint BASIC  (Read 4151 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Cint BASIC
« on: November 05, 2013, 02:00:52 PM »
I have installed CINT on the All BASIC Cloud9 IDE site. It works with both C and C++ with the option of using pre-compiled shared object libraries. I think this can be a valuable asset in the development of C BASIC.

CINT project site

Current Version

Code: [Select]
/*
  Cint BASIC

  NOTE: keywords without assignments are OPTIONAL
*/

#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>

#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
#define PRINT printf

FUNCTION main()
BEGIN_FUNCTION
  DIM AS int x;
  FOR (x = 1 TO x < 6 STEP INCR x)
  BEGIN_FOR
    PRINT ("%i\n",x);
  NEXT
  IF (x == 6) THEN_DO PRINT ("x is now 6\n");
  IF (x > 5 AND x < 7) THEN
    PRINT ("My guess is 6\n");
  ELSE
    PRINT ("Wrong!\n");
  END_IF
  LET int y = 0;
  DO
    INCR y;
  WHILE (y < x);
  PRINT ("%i\n", y);
  x += y;
  SELECT_CASE (x)
  BEGIN_SELECT
    CASE 6:
      PRINT ("I remember 6\n");
      END_CASE
    CASE 12:
      PRINT ("Double it up\n");
      END_CASE
    CASE_ELSE
      PRINT ("Some other number\n");
  END_SELECT
END_FUNCTION

allbasic@c_basic:~/668428/usr/john/cintbasic $ cint -p cb.c
1
2
3
4
5
x is now 6
My guess is 6
6
Double it up
allbasic@c_basic:~/668428/usr/john/cintbasic $
« Last Edit: November 07, 2013, 12:56:37 AM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Cint BASIC - Pointers
« Reply #1 on: November 06, 2013, 12:54:59 PM »
I would like to propose a C BASIC standard that would help the Cint BASIC project.

CINT Limitations

Quote
Pointer declaration

When declaring pointer, space character is needed somewhere in the declaration. For example,

       int* p1;   // OK
       int *p2;   // OK  <<<--- My Preference
       int * p3;  // OK
       int*p3;    // Cint parsing limitation, space character needed

This is Cint limitation. For pointer to pointer, cint may not understand too many levels of redirection. If you have many levels of pointer redirection, it is recommended to have space character between type name and '*'.

       int ****p4; // OK
       int**** p5; // Cint parsing limitation
   

ClassString.c
Code: [Select]
sub CopyWidth(char*t, int tw, char*s, int sw,int count)
function int ByteLen(char*s)
function int WordLen(char*s)
function int WordFill(char*s, int le, short c)
function void* Transfer(void**r,void*s)
function StringObject StringTransfer(StringObject*r,StringObject s)
function char* CharTransfer(char**r, char*s)
method StringFree(StringObject*pthis)
method StringArrayObject StringArrayFree(StringArrayObject*pthis)
method StringObject StringRedim(StringObject*pthis, int nc,int wi,int cnt)
method StringArrayObject StringArrayRedim(StringArrayObject*pthis, int nc, int cnt)
method StringObject StringSet(StringObject*pthis, StringObject s)
method char* StringGetChars(StringObject*pthis, char**r, int wi)
method StringObject StringSetChars(StringObject*pthis, char*s, int le, int wi)
method StringObject StringGetMid(StringObject*pthis, StringObject s, int i, int le, int wi)
method StringObject StringSetMid(StringObject*pthis, int i, StringObject s)
method StringObject StringJoin(StringObject*pthis, int n, StringObject*jl)
method StringObject StringJoinN(StringObject*pthis, int n, ...)
method StringObject StringMerge(StringObject*pthis,StringArrayObject*plist, StringObject kw)
method StringArrayObject StringSplit(StringObject*pthis, StringArrayObject*plist, StringObject kw)
method StringObject StringRepeat(StringObject*pthis, StringObject s ,int n)
method StringObject StringLcase(StringObject*r, StringObject this)
method StringObject StringUcase(StringObject*r, StringObject this)
method StringObject StringLtrim(StringObject*r, StringObject this)
method StringObject StringRtrim(StringObject*r, StringObject this)
method StringObject StringTrim(StringObject*r, StringObject this)
method StringObject StringInsert(StringObject*pthis, StringObject s, int i)
method StringObject StringDelete(StringObject*pthis, int i, int le)
method StringObject StringChr(StringObject*r, int a, int wi)
method StringObject StringStr(StringObject*r, double d)
method int StringShow(StringObject*pthis)
method int StringAsc(StringObject*pthis, int i)
method int StringInstr(StringObject*pthis, int i, StringObject k)
method double StringVal(StringObject*pthis)
method StringObject StringReplace(StringObject*pthis, StringObject f , StringObject r)

Who knows, maybe the CERN folks will think Charles's Cint BASIC idea has merit and use it in their work. The idea behind CINT was to use C/C++ to manage/prototype  statistical data  models. Not having to make scientists low level C programmers was a goal with this effort.
« Last Edit: November 06, 2013, 08:32:49 PM by John »

kryton9

  • Guest
Re: Cint BASIC
« Reply #2 on: November 06, 2013, 03:00:56 PM »
I think what we should do about numeric types is what I see in some of the nice new libraries:
i8  signed 8 bit integer
ui8 unsigned 8 bit integer
...
i64
ui64

This way you know exactly what you are working with and it is nice short notation.
I forgot how they did floating point, right off of the top of my head.

Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Re: Cint BASIC
« Reply #3 on: November 06, 2013, 03:08:36 PM »
If you have any thoughts of 64 bit, make sure you use stdint.h.




Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Cint BASIC - virtual function
« Reply #4 on: November 06, 2013, 11:04:40 PM »
I was poking around the CINT examples and noticed a virtual function example. Since I thought I coined the name I thought I would dig a little deeper. Maybe Charles or AIR can explain what is meant by a virtual function.

Code: [Select]
/* -*- C++ -*- */
/*************************************************************************
 * Copyright(c) 1995~2005  Masaharu Goto (cint@pcroot.cern.ch)
 *
 * For the licensing terms see the file COPYING
 *
 ************************************************************************/
//
// virtual function test
//
#include <stdio.h>
#include <stdlib.h>

class A {
 public:
  int a;
  A(int i) { a=i; }
  virtual void print(void) { printf("a=%d\n",a); }
  virtual void Print(void) { printf("A=%d\n",a); }
};

class B {
 public:
  int b;
  B(int i) { b=i; }
  void print(void) { printf("b=%d\n",b); }
  void Print(void) { printf("B=%d\n",b); }
};

class C: public B, public A {
 public:
  int c;
  C(int i) : A(i+1) , B(i+2) { c=i; }
  void print(void) { printf("c=%d\n",c); }
  void Print(void) { printf("C=%d\n",c); }
};

class D: public C {
 public:
  int d;
  D(int i) : C(i+10) { d=i; }
  void print(void) { printf("d=%d\n",d); }
  void Print(void) { printf("D=%d\n",d); }
};

main()
{
  A aobj=A(1);
  B bobj=B(101);
  C cobj=C(201);
  D dobj=D(301);

  A *pa,*pc,*pd;
  B *PB,*pb;

  pa = &aobj;
  // fprintf(stderr,"Intentional error, pb below\n");
  pb = &bobj;
  PB = &bobj;
  pc = &cobj;
  pd = &dobj;

  pa->print();
  PB->print();
  pc->print();
  pd->print();
  pa->Print();
  PB->Print();
  pc->Print();
  pd->Print();
}

allbasic@c_basic:~/668428/sys/install/cint-5.18.00/demo/simple $ cint virtualfunc1.c
a=1
b=101
c=201
d=301
A=1
B=101
C=201
D=301
allbasic@c_basic:~/668428/sys/install/cint-5.18.00/demo/simple $

Inherit example
Code: [Select]
/* -*- C++ -*- */
/*************************************************************************
 * Copyright(c) 1995~2005  Masaharu Goto (cint@pcroot.cern.ch)
 *
 * For the licensing terms see the file COPYING
 *
 ************************************************************************/
//
// class inheritance test 1
//
// constructor, destructor
//
#include <iostream.h>

class string {
      private:
char *p;
      public:
string(char *set) {
cout << "construct string(" << set << ")\n";
p=(char*)malloc(strlen(set)+1);
strcpy(p,set);
}
int len() { return(strlen(p)); }
char *s() { return(p); }

~string() {
cout << "destruct ~string(" << p << ")\n";
free(p);
}
};

ostream& operator <<(ostream& ios,string& x)
{
ios << x.s() ;
return(ios);
}

class gender {
      private:
char *male;
string Gender;
      public:
gender(char *set) : Gender(set) {
cout << "construct gender(" << set << ")\n";
male=(char*)malloc(strlen(set)+1);
strcpy(male,set);
}
char *S() { return(male); }
~gender() {
cout << "destruct ~gender(" << male<< ")\n";
free(male);
}
};

class person : public gender {
      public:
string address;
string name;
int age;
person(void);
person(char *adr,char *nm,int ag,char *setgender);
};

person::person(void)
:address("SAITAMA"),name("MASAHARU"),gender("MALE")
{
age = 33;
cout << "construct person(" << age << ")\n";
}

person::person(char *adr,char *nm,int ag,char *setgender)
: address(adr) , name(nm) , gender(setgender)
{
cout << "construct person(" << ag << ")\n";
age = ag;
}


main()
{
person me=person("Saitama","Masa",32,"male");

cout << " address=" << me.address
     << " name=" << me.name
     << " age=" << me.age
     << " Gender=" << me.S()
     << "\n";

person *pme;
pme = new person;

cout << " address=" << pme->address
     << " name=" << pme->name
     << " age=" << pme->age
     << " Gender=" << pme->S()
     << "\n";

delete pme;
}

allbasic@c_basic:~/668428/sys/install/cint-5.18.00/demo/simple $ cint inherit1.c
construct string(male)
construct gender(male)
construct string(Saitama)
construct string(Masa)
construct person(32)
 address=Saitama name=Masa age=32 Gender=male
construct string(MALE)
construct gender(MALE)
construct string(SAITAMA)
construct string(MASAHARU)
construct person(33)
 address=SAITAMA name=MASAHARU age=33 Gender=MALE
destruct ~string(MASAHARU)
destruct ~string(SAITAMA)
destruct ~gender(MALE)
destruct ~string(MALE)
destruct ~string(Masa)
destruct ~string(Saitama)
destruct ~gender(male)
destruct ~string(male)
allbasic@c_basic:~/668428/sys/install/cint-5.18.00/demo/simple $

I keep trying but I'm not seeing how C++ and it's obscure syntax is somehow better for me.
« Last Edit: November 06, 2013, 11:26:56 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Cint BASIC
« Reply #5 on: November 07, 2013, 12:54:00 AM »
I will update the fist post in this thread with my latest copy of the Cint BASIC project code.

FYI The binary Windows version of CINT only works with C++ based programs. On a positive note, it runs in Wine.
« Last Edit: November 07, 2013, 01:19:22 AM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Windows ROOT
« Reply #6 on: November 08, 2013, 01:07:52 AM »
I install the Windows version of ROOT on my XP VirtualBox and using the Windows 7 SDK for the Windows compiler.

Code: [Select]
F:\C_BASIC>root
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.27/06 29 September 2010   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

ROOT 5.27/06 (trunk@35856, Sep 29 2010, 11:29:35 on win32)

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] {
end with '}', '@':abort > for(int i=1; i<6; i++) printf("%i\n",i);
end with '}', '@':abort > }
1
2
3
4
5
root [1] i
(int)6
root [2] .q
F:\C_BASIC>
« Last Edit: November 08, 2013, 01:12:16 AM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Windows ROOT - MinGW
« Reply #7 on: November 08, 2013, 02:20:08 AM »
I'm happy to announce that ROOT for Windows works with MinGW32-gcc.


Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Windows CINT
« Reply #8 on: November 08, 2013, 11:26:18 AM »
If all your looking for is a C interpreter / debugger  / front end compiler, cint for Windows works fine with the Windows 7 SDK. If your interested in following Charles and the C BASIC core project, this is the tool you want to use. ROOT and CLANG/CLING are C++ centric tools.

CINT info and download

Note: Set these environment variables before starting CINT.

set CINTSYSDIR=F:\cint
set PATH=%PATH%;%CINTSYSDIR%

Code: [Select]
F:\C_BASIC>cint --help

Note1: Cint is not aimed to be a 100%% ANSI/ISO compliant C/C++ language
 processor. It rather is a portable script language environment which
 is close enough to the standard C++.

Note2: Regulary check either of /tmp /usr/tmp /temp /windows/temp directory
 and remove temp-files which are accidentally left by cint.

Note3: Cint reads source file on-the-fly from the file system. Do not change
 the active source during cint run. Use -C option or C1 command otherwise.

Note4: In source code trace mode, cint sometimes displays extra-characters.
 This is harmless. Please ignore.

cint (C/C++ interpreter) debugger usage:
Dump:        n [file]  : create new readline dumpfile and start dump
             y [file]  : append readline dump to [file]
             z         : stop readline dump
             < [file]  : input redirection from [file](execute command dump)
             > [file]  : output redirection to [file]
             2> [file] : error redirection to [file]
             >& [file] : output&error redirection to [file]
             .         : switch command input mode
Help:        ?         : help
             help      : help
             /[keyword] : search keyword in help information
Shell:       ![shell]  : execute shell command
Source:      v <[line]>: view source code <around [line]>
             V [stack] : view source code in function call stack
             t         : show function call stack
             f [file]  : select file to debug
             T         : turn on/off trace mode for all source
             J [stat]  : Set warning level [0-5]
             A [1|0]   : allowing automatic variable on/off
             trace <classname> : turn on trace mode for class
             deltrace <classname> : turn off trace mode for class
             break [classname] : set break point at every [classname] memberfunc
             delbreak [classname] : turn off memberfunc break point
Evaluation:  p [expr]  : evaluate expression (no declaration/loop/condition)
Evaluation:  s [expr]  : step into expression (no declaration/loop/condition)
Evaluation:  S [expr]  : step over expression (no declaration/loop/condition)
             {[statements]} : evaluate statement (any kind)
             x [file]  : load [file] and evaluate {statements} in the file
             X [file]  : load [file] and execute function [file](wo extension)
             E <[file]>: open editor and evaluate {statements} in the file
Load/Unload: L [file]  : load [file]
             La [file] : reload all files loaded after [file]
             U [file]  : unload [file]
             C [1|0]   : copy source to $TMPDIR (on/off)
             reset     : reset interpreter environment
             undo      : undo previous declarations
             lang      : local language (EUC,SJIS,EUROPEAN,UNKNOWN)
Monitor:     g <[var]> : list global variable
             l <[var]> : list local variable
             proto <[scope]::>[func] : show function prototype
             class <[name]> : show class definition (one level)
             Class <[name]> : show class definition (all level)
             typedef <name> : show typedefs
             function  : show interpreted functions
             macro     : show macro functions
             template  : show templates
             include   : show include paths
             file      : show loaded files
             where     : show current file position
             security  : show security level
             refcount  : reference count control on/off
             garbage   : show garbage collection buffer
             Garbage   : Do garbage collection
             cover [file] : save trace coverage
             return [val] : return undefined symbol value
Run:         S         : step over function/loop
             s         : step into function/loop
             i         : ignore and step over
             c <[line]>: continue <to [line]>
             e         : step out from function
             f [file]  : select file to debug
             b [line]  : set break point
             db [line] : delete break point
             a [assert]: break only if assertion is true
             O [0~4]   : Set bytecode compiler mode
             debug     : bytecode status display on/off
             dasm      : disassembler
Quit:        q         : quit cint
             qqq       : quit cint - mandatory
             qqqqq     : exit process immediately
             qqqqqqq   : abort process
             save      : call emergency routine to save important data

F:\C_BASIC>cint -p cb.c
cb.c
1
2
3
4
5
x is now 6
My guess is 6
6
Double it up

F:\C_BASIC>

Note Output is from the cb.c C BASIC example in the first post of this thread.
« Last Edit: November 08, 2013, 11:36:30 AM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Re: Cint BASIC
« Reply #9 on: November 08, 2013, 07:11:12 PM »
All BASIC Cloud9 IDE users,

I have installed ROOT on the C9 site. This version is based on CINT not the new ROOT 6.0 CLING version. (which I would have had to build from scratch on C9   :o) Since ROOT also has a GUI side to it, you have to append the -b to disable GUI in the C9 IDE.

Code: [Select]
allbasic@c_basic:~/668428 $ root -b
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   5.24/00      29 June 2009   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

ROOT 5.24/00 (trunk@29257, Jun 30 2009, 09:23:51 on linuxx8664gcc)

CINT/ROOT C/C++ Interpreter version 5.17.00, Dec 21, 2008
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] {
end with '}', '@':abort > int x;
end with '}', '@':abort > for(x=1;x<6;x++) printf("%i\n",x);
end with '}', '@':abort > }
1
2
3
4
5
root [1] x
(int)6
root [2] .q
allbasic@c_basic:~/668428 $

Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
CINT API
« Reply #10 on: November 10, 2013, 01:39:36 AM »
The CERN CINT C/C++ interpreter also has an API that would allow ScriptBasic for example to call CINT and have it compile a script and make it available in memory to be called by ScriptBasic. A couple other nice features of the CINT engine are that I don't have to declare variables before assigning them. (like SB) The following is a list of system API calls that are already available to the calling program without having to include them in your C script.

CINT man page

makecint API

Code: [Select]
cint> /

cint : C/C++ interpreter  (mailing list 'cint@root.cern.ch')
   Copyright(c) : 1995~2010 Masaharu Goto (gotom@hanno.jp)
   revision     : 5.18.00, July 2, 2010 by M.Goto

/* List of sut----------------------------------------------------------------*/
   void abort();
   int abs(int n);
   double acos(double arg);
   double asin(double arg);
   char* asctime(struct tm* timestruct);
   double atan(double arg);
   double atan2(double num,double den);
   double atof(char *string);
   int atoi(char *string);
   long atol(char *string);
   void *calloc(size_t count,size_t size);
   double ceil(double z);
   void clearerr(FILE *fp);
   clock_t clock();
   double cos(double radian);
   double cosh(double value);
   char *ctime(time_t *timeptr);
   double difftime(time_t newtime,time_t oldtime);
   div_t div(int numerator,int denominator);
   double exp(double z);
   double fabs(double z);
   int fclose(FILE *fp);
   int feof(FILE *fp);
   int ferror(FILE *fp);
   int fflush(FILE *fp);
   int fgetc(FILE *fp);
   int fgetpos(FILE *fp,fpos_t *position);
   char *fgets(char *string,int n,FILE *fp);
   double floor(double z);
   double fmod(double number,double divisor);
   FILE *fopen(char *file,char *mode);
   int fputc(int character,FILE *fp);
   int fputs(char *string,FILE *fp);
   size_t fread(void *buffer,size_t size,size_t n,FILE *fp);
   void free(void *ptr);
   FILE *freopen(char *file,char *mode,FILE *fp);
   double frexp(double real,int *exp1);
   int fseek(FILE *fp,long offset,int whence);
   int fsetpos(FILE *fp,fpos_t *position);
   long ftell(FILE *fp);
   size_t fwrite(void *buffer,size_t size,size_t n,FILE *fp);
   int getc(FILE *fp);
   int getchar();
   char *getenv(char *variable);
   char *gets(char *buffer);
   struct tm* gmtime(time_t *caltime);
   int isalnum(int c);
   int isalpha(int c);
   int iscntrl(int c);
   int isdigit(int c);
   int isgraph(int c);
   int islower(int c);
   int isprint(int c);
   int ispunct(int c);
   int isspace(int c);
   int isupper(int c);
   int isxdigit(int c);
   long labs(long n);
   double ldexp(double number,int n);
   ldiv_t ldiv(long numerator,long denominator);
   struct lconv* localeconv();
   struct tm* localtime(time_t* timeptr);
   double log(double z);
   double log10(double z);
   void *malloc(size_t size);
   int mblen(char *address,size_t number);
   size_t mbstowcs(wchar_t *widechar,char *multibyte,size_t number);
   int mbtowc(wchar_t *charptr,char *address,size_t number);
   void *memchr(void *region,int character,size_t n);
   int memcmp(void *region1,void *region2,size_t count);
   void *memcpy(void *region1,void *region2,size_t n);
   void *memmove(void *region1,void *region2,size_t count);
   void *memset(void *buffer,int character,size_t n);
   time_t mktime(struct tm *timeptr);
   double modf(double real,double *ip);
   void perror(char *string);
   double pow(double z,double x);
   int putc(int character,FILE *fp);
   int putchar(int character);
   int puts(char *string);
   int raise(int signal);
   int rand();
   void *realloc(void *ptr,size_t size);
   int remove(char *filename);
   int rename(char *old,char *new);
   void rewind(FILE *fp);
   void setbuf(FILE *fp,char *buffer);
   char* setlocale(int position,char *locale);
   int setvbuf(FILE *fp,char *buffer,int mode,size_t size);
   double sin(double radian);
   double sinh(double value);
   double sqrt(double z);
   void srand(unsigned int seed);
   char *strcat(char *string1,char *string2);
   char *strchr(char *string,int character);
   int strcmp(char *string1,char *string2);
   int strcoll(char *string1,char *string2);
   char *strcpy(char *string1,char *string2);
   size_t strcspn(char *string1,char *string2);
   char *strerror(int error);
   size_t strftime(char *string,size_t maximum,char *format,struct tm*brokentime);
   size_t strlen(char *string);
   char *strncat(char *string1,char *string2,size_t n);
   int strncmp(char *string1,char *string2,size_t n);
   char *strncpy(char *string1,char *string2,size_t n);
   char *strpbrk(char *string1,char *string2);
   char *strrchr(char *string,int character);
   size_t strspn(char *string1,char *string2);
   char *strstr(char *string1,char *string2);
   double strtod(char *string,char **tailptr);
   char *strtok(char *string1,char *string2);
   long strtol(char *sprt,char **tailptr,int base);
   unsigned long strtoul(char *sprt,char **tailptr,int base);
   size_t strxfrm(char *string1,char *string2,size_t n);
   int system(char *program);
   double tan(double radian);
   double tanh(double value);
   time_t time(time_t *tp);
   FILE *tmpfile();
   char *tmpnam(char *name);
   int tolower(int c);
   int toupper(int c);
   int ungetc(int character,FILE *fp);
   size_t wcstombs(char *multibyte,wchar_t *widechar,size_t number);
   int wctomb(char *string,wchar_t widecharacter);
   int fprintf(FILE *fp,char *format,arglist,...);
   int printf(char *format,arglist,...);
   int sprintf(char *string,char *format,arglist,...);
   int fscanf(FILE *fp,char *format,arglist,...);
   int scanf(char *format,arglist,...);
   int sscanf(char *string,char *format,arglist,...);
   exit(int status);
   atexit(void(*function)(void));
   void qsort(void *array,size_t number,size_t size,int (*comparison)(void *arg1,void *arg2));
   void bsearch(void *item,void *array,size_t number,size_t size,int (*comparison)(void *arg1,void *arg2));
   char getopt(int argc,char **argv,char *options);
   char *G__input(char prompt[]);
   int G__pause();
   int G__tracemode(int on_off);
   int G__setbreakpoint(char* line,char* file);
   int G__stepmode(int on_off);
   [anytype] G__calc(const char *expression);
   [anytype] G__exec_text(const char *unnamedmacro);
   [anytype] G__exec_tempfile(const char *file);
   char* G__load_text(const char *namedmacro);
   int G__loadfile(const char *file);
   int G__unloadfile(const char *file);
   int G__reloadfile(const char *file);
   int G__loadsystemfile(const char* sysdllname);
   void G__add_ipath(const char *pathname);
   int G__split(char *line,char *string,int argc,char *argv[]);
   int G__readline(FILE *fp,char *line,char *argbuf,int *argn,char *arg[]);
   int G__cmparray(short array1[],short array2[],int num,short mask);
   G__setarray(short array[],int num,short mask,char *mode);
   G__graph(double xdata[],double ydata[],int ndata,char *title,int mode);
   char *G__search_next_member(char *name,int state);
   void *G__what_type(char *name,char *type,char *tagname,char *typename);
   int *G__storeobject(void *buf1,void *buf2);
   int *G__scanobject(void *buf);
   int *G__dumpobject(char *file,void *buf,int size);
   int *G__loadobject(char *file,void *buf,int size);
   int G__lock_variable(char *varname);
   int G__unlock_variable(char *varname);
   int G__IsInMacro();
   char* G__getmakeinfo(char* paramname);
   void G__set_atpause(void* p2f);
   void G__set_aterror(void (*p2f)());
   void G__set_ignoreinclude(int (*p2f)(char* fname,char* expandedfname));
   void G__set_smartload(int smartunload);
   int G__AddConsole();
   int G__FreeConsole();
   type_info G__typeid(char* typename);
   char* G__lasterror_filename();
   int G__lasterror_linenum();
   char* G__p2f2funcname(void* p2f);
   int G__isinterpretedp2f(void* p2f);
   int G__deleteglobal(void* ptr);
   int G__deletevariable(char* varname);
   int G__optimizemode(int optlevel);
   int G__getoptimizemode();
   void G__clearerror();
   int G__defined(const char* type_name);
List of classes
file            line
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdarg.h   14    struct va_list
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdlib.h   -1    struct lconv
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdlib.h   -1    struct tm
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdlib.h   -1    div_t  (typedef div_t)
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdlib.h   -1    ldiv_t  (typedef ldiv_t)
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdio.h   10    struct fpos_t
List of typedefs
(compiled)          typedef unsigned long size_t
(compiled)          typedef long ssize_t
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdlib.h   5 typedef div_t div_t
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdlib.h   5 typedef ldiv_t ldiv_t
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdlib.h  11 typedef unsigned int wchar_t
stdfunc.dll      -1 typedef unsigned long clock_t
stdfunc.dll      -1 typedef long time_t
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdio.h  10 typedef fpos_t fpos_t
Total string constant size = 0
#define EOF -1
#define NULL 0
#define G__SHAREDLIB 1
#define G__P2F 1
#define G__NEWSTDHEADER 1
#define __linux__ 1
#define G__LINUX 1
#define G__GNUC 4
#define G__GNUC_MINOR 7
#define G__GNUC_VER 4007
#define __GLIBC__ 2
#define G__GLIBC 2
#define __GLIBC_MINOR__ 12
#define G__GLIBC_MINOR 12
#define __x86_64__ 1
#define G__x86_64 1
#define __amd64 1
#define G__amd64 1
#define G__NATIVELONGLONG 1
#define G__CINTVERSION 50180000
#define G__STDSTRUCT 0
#define __GNUC__ 4
#define __GNUC_MINOR__ 7
#define G__STDFUNC 0
#define G__STDARG_H 0
command line: "-DG__LINUX=1" "-DG__GNUC=4" "-DG__GNUC_MINOR=7" "-DG__GNUC_VER=4007" "-DG__GLIBC=2" "-DG__GLIBC_MINOR=12" "-DG__x86_64=1" "-DG__amd64=1" "-D__attribute__(X)=" "-D__asm(X)=" "-DG__NATIVELONGLONG=1" "-DG__CINTVERSION=50180000"
  0 fp=0x00000065a3e0 lines=80   file="cb.c" cppfile="(tmpfile)"
  1 fp=0x00000065a3e0 lines=0    file="<command-line>" cppfile="(tmpfile)"
  2 fp=0x00000065a3e0 lines=0    file="/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdarg.h" cppfile="(tmpfile)"
  3 fp=0x00000065a3e0 lines=0    file="/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdlib.h" cppfile="(tmpfile)"
  4 fp=0x000000000000 lines=0    file="stdfunc.dll"
  5 fp=0x00000065a3e0 lines=0    file="/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdio.h" cppfile="(tmpfile)"
  6 fp=0x000000673e60 lines=27   file="stdarg.h"

filename       line:size busy function type and name 
stdfunc.dll      -1:-1   0 public: void abort(void);
stdfunc.dll      -1:-1   0 public: int abs(int n);
stdfunc.dll      -1:-1   0 public: double acos(double arg);
stdfunc.dll      -1:-1   0 public: double asin(double arg);
stdfunc.dll      -1:-1   0 public: char* asctime(tm* timestruct);
stdfunc.dll      -1:-1   0 public: double atan(double arg);
stdfunc.dll      -1:-1   0 public: double atan2(double num,double den);
stdfunc.dll      -1:-1   0 public: double atof(const char* string);
stdfunc.dll      -1:-1   0 public: int atoi(const char* string);
stdfunc.dll      -1:-1   0 public: long atol(const char* string);
stdfunc.dll      -1:-1   0 public: void* calloc(size_t count,size_t size);
stdfunc.dll      -1:-1   0 public: double ceil(double z);
stdfunc.dll      -1:-1   0 public: void clearerr(FILE* fp);
stdfunc.dll      -1:-1   0 public: clock_t clock(void);
stdfunc.dll      -1:-1   0 public: double cos(double radian);
stdfunc.dll      -1:-1   0 public: double cosh(double value);
stdfunc.dll      -1:-1   0 public: char* ctime(time_t* timeptr);
stdfunc.dll      -1:-1   0 public: double difftime(time_t newtime,time_t oldtime);
stdfunc.dll      -1:-1   0 public: div_t div(int numerator,int denominator);
stdfunc.dll      -1:-1   0 public: double exp(double z);
stdfunc.dll      -1:-1   0 public: double fabs(double z);
stdfunc.dll      -1:-1   0 public: int fclose(FILE* fp);
stdfunc.dll      -1:-1   0 public: int feof(FILE* fp);
stdfunc.dll      -1:-1   0 public: int ferror(FILE* fp);
stdfunc.dll      -1:-1   0 public: int fflush(FILE* fp);
stdfunc.dll      -1:-1   0 public: int fgetc(FILE* fp);
stdfunc.dll      -1:-1   0 public: char* fgets(char* string,int n,FILE* fp);
stdfunc.dll      -1:-1   0 public: double floor(double z);
stdfunc.dll      -1:-1   0 public: double fmod(double number,double divisor);
stdfunc.dll      -1:-1   0 public: FILE* fopen(const char* file,const char* mode);
stdfunc.dll      -1:-1   0 public: int fputc(int character,FILE* fp);
stdfunc.dll      -1:-1   0 public: int fputs(const char* string,FILE* fp);
stdfunc.dll      -1:-1   0 public: size_t fread(void* buffer,size_t size,size_t n,FILE* fp);
stdfunc.dll      -1:-1   0 public: void free(void* ptr);
stdfunc.dll      -1:-1   0 public: FILE* freopen(const char* file,const char* mode,FILE* fp);
stdfunc.dll      -1:-1   0 public: double frexp(double real,int* exp1);
stdfunc.dll      -1:-1   0 public: int fseek(FILE* fp,long offset,int whence);
stdfunc.dll      -1:-1   0 public: long ftell(FILE* fp);
stdfunc.dll      -1:-1   0 public: size_t fwrite(void* buffer,size_t size,size_t n,FILE* fp);
stdfunc.dll      -1:-1   0 public: int getc(FILE* fp);
stdfunc.dll      -1:-1   0 public: int getchar(void);
stdfunc.dll      -1:-1   0 public: char* getenv(const char* variable);
stdfunc.dll      -1:-1   0 public: char* gets(char* buffer);
stdfunc.dll      -1:-1   0 public: tm* gmtime(time_t* caltime);
stdfunc.dll      -1:-1   0 public: int isalnum(int c);
stdfunc.dll      -1:-1   0 public: int isalpha(int c);
stdfunc.dll      -1:-1   0 public: int iscntrl(int c);
stdfunc.dll      -1:-1   0 public: int isdigit(int c);
stdfunc.dll      -1:-1   0 public: int isgraph(int c);
stdfunc.dll      -1:-1   0 public: int islower(int c);
stdfunc.dll      -1:-1   0 public: int isprint(int c);
stdfunc.dll      -1:-1   0 public: int ispunct(int c);
stdfunc.dll      -1:-1   0 public: int isspace(int c);
stdfunc.dll      -1:-1   0 public: int isupper(int c);
stdfunc.dll      -1:-1   0 public: int isxdigit(int c);
stdfunc.dll      -1:-1   0 public: long labs(long n);
stdfunc.dll      -1:-1   0 public: double ldexp(double number,int n);
stdfunc.dll      -1:-1   0 public: ldiv_t ldiv(long numerator,long denominator);
stdfunc.dll      -1:-1   0 public: lconv* localeconv(void);
stdfunc.dll      -1:-1   0 public: tm* localtime(time_t* timeptr);
stdfunc.dll      -1:-1   0 public: double log(double z);
stdfunc.dll      -1:-1   0 public: double log10(double z);
stdfunc.dll      -1:-1   0 public: void* malloc(size_t size);
stdfunc.dll      -1:-1   0 public: int mblen(const char* address,size_t number);
stdfunc.dll      -1:-1   0 public: size_t mbstowcs(wchar_t* widechar,const char* multibyte,size_t number);
stdfunc.dll      -1:-1   0 public: int mbtowc(wchar_t* charptr,const char* address,size_t number);
stdfunc.dll      -1:-1   0 public: void* memchr(void* region,int character,size_t n);
stdfunc.dll      -1:-1   0 public: int memcmp(void* region1,void* region2,size_t count);
stdfunc.dll      -1:-1   0 public: void* memcpy(void* region1,void* region2,size_t n);
stdfunc.dll      -1:-1   0 public: void* memmove(void* region1,void* region2,size_t count);
stdfunc.dll      -1:-1   0 public: void* memset(void* buffer,int character,size_t n);
stdfunc.dll      -1:-1   0 public: time_t mktime(tm* timeptr);
stdfunc.dll      -1:-1   0 public: double modf(double real,double* ip);
stdfunc.dll      -1:-1   0 public: void perror(const char* string);
stdfunc.dll      -1:-1   0 public: double pow(double z,double x);
stdfunc.dll      -1:-1   0 public: int putc(int character,FILE* fp);
stdfunc.dll      -1:-1   0 public: int putchar(int character);
stdfunc.dll      -1:-1   0 public: int puts(const char* string);
stdfunc.dll      -1:-1   0 public: int raise(int signal);
stdfunc.dll      -1:-1   0 public: int rand(void);
stdfunc.dll      -1:-1   0 public: void* realloc(void* ptr,size_t size);
stdfunc.dll      -1:-1   0 public: int remove(const char* filename);
stdfunc.dll      -1:-1   0 public: int rename(const char* old,const char* new);
stdfunc.dll      -1:-1   0 public: void rewind(FILE* fp);
stdfunc.dll      -1:-1   0 public: void setbuf(FILE* fp,char* buffer);
stdfunc.dll      -1:-1   0 public: char* setlocale(int position,const char* locale);
stdfunc.dll      -1:-1   0 public: int setvbuf(FILE* fp,char* buffer,int mode,size_t size);
stdfunc.dll      -1:-1   0 public: double sin(double radian);
stdfunc.dll      -1:-1   0 public: double sinh(double value);
stdfunc.dll      -1:-1   0 public: double sqrt(double z);
stdfunc.dll      -1:-1   0 public: void srand(unsigned int seed);
stdfunc.dll      -1:-1   0 public: char* strcat(char* string1,const char* string2);
stdfunc.dll      -1:-1   0 public: char* strchr(const char* string,int character);
stdfunc.dll      -1:-1   0 public: int strcmp(const char* string1,const char* string2);
stdfunc.dll      -1:-1   0 public: int strcoll(const char* string1,const char* string2);
stdfunc.dll      -1:-1   0 public: char* strcpy(char* string1,const char* string2);
stdfunc.dll      -1:-1   0 public: size_t strcspn(const char* string1,const char* string2);
stdfunc.dll      -1:-1   0 public: char* strerror(int error);
stdfunc.dll      -1:-1   0 public: size_t strftime(char* string,size_t maximum,const char* format,tm* brokentime);
stdfunc.dll      -1:-1   0 public: size_t strlen(const char* string);
stdfunc.dll      -1:-1   0 public: char* strncat(char* string1,const char* string2,size_t n);
stdfunc.dll      -1:-1   0 public: int strncmp(const char* string1,const char* string2,size_t n);
stdfunc.dll      -1:-1   0 public: char* strncpy(char* string1,const char* string2,size_t n);
stdfunc.dll      -1:-1   0 public: char* strpbrk(const char* string1,const char* string2);
stdfunc.dll      -1:-1   0 public: char* strrchr(const char* string,int character);
stdfunc.dll      -1:-1   0 public: size_t strspn(const char* string1,const char* string2);
stdfunc.dll      -1:-1   0 public: char* strstr(const char* string1,const char* string2);
stdfunc.dll      -1:-1   0 public: double strtod(const char* string,char** tailptr);
stdfunc.dll      -1:-1   0 public: char* strtok(char* string1,const char* string2);
stdfunc.dll      -1:-1   0 public: long strtol(const char* sprt,char** tailptr,int base);
stdfunc.dll      -1:-1   0 public: unsigned long strtoul(const char* sprt,char** tailptr,int base);
stdfunc.dll      -1:-1   0 public: size_t strxfrm(char* string1,const char* string2,size_t n);
stdfunc.dll      -1:-1   0 public: int system(const char* program);
stdfunc.dll      -1:-1   0 public: double tan(double radian);
stdfunc.dll      -1:-1   0 public: double tanh(double value);
stdfunc.dll      -1:-1   0 public: time_t time(time_t* tp);
stdfunc.dll      -1:-1   0 public: FILE* tmpfile(void);
stdfunc.dll      -1:-1   0 public: char* tmpnam(char* name);
-- Press return for more -- (input [number] of lines, Cont,Step,More)
stdfunc.dll      -1:-1   0 public: int tolower(int c);
stdfunc.dll      -1:-1   0 public: int toupper(int c);
stdfunc.dll      -1:-1   0 public: int ungetc(int character,FILE* fp);
stdfunc.dll      -1:-1   0 public: size_t wcstombs(char* multibyte,wchar_t* widechar,size_t number);
stdfunc.dll      -1:-1   0 public: int wctomb(char* string,wchar_t widecharacter);
stdfunc.dll      -1:-1   0 public: void exit(int status);
cb.c             49:31   0 public: int main();
(compiled)          0x7f0d5fb7fbe0 FILE* stdout=0x300078d780
(compiled)          0x7f0d5fb7fbe8 FILE* stderr=0x300078d860
(compiled)          0x7f0d5fb7fbd8 FILE* stdin=0x300078d6a0
(compiled)          0x61e6e0   #define EOF=-1
(compiled)          0x61e830   #define NULL=0
(compiled)          0x61e980   #define G__SHAREDLIB=1
(compiled)          0x61ead0   #define G__P2F=1
(compiled)          0x61ec20   #define G__NEWSTDHEADER=1
(compiled)          0x61ed70   #define __linux__=1
(compiled)          0x61eec0   #define G__LINUX=1
(compiled)          0x61f010   #define G__GNUC=4
(compiled)          0x61f160   #define G__GNUC_MINOR=7
(compiled)          0x61f2b0   #define G__GNUC_VER=4007
(compiled)          0x61f400   #define __GLIBC__=2
(compiled)          0x61f550   #define G__GLIBC=2
(compiled)          0x61f6a0   #define __GLIBC_MINOR__=12
(compiled)          0x61f7f0   #define G__GLIBC_MINOR=12
(compiled)          0x61f940   #define __x86_64__=1
(compiled)          0x61fa90   #define G__x86_64=1
(compiled)          0x61fbe0   #define __amd64=1
(compiled)          0x61fd30   #define G__amd64=1
(compiled)          0x636530   #define G__NATIVELONGLONG=1
                  2 0x7f0d5fb7f2a8 int& G__cintv6=0
(compiled)          0x6434a0   const bool true=1
(compiled)          0x636680   const bool false=0
(compiled)          0x7f0d5fb817b0 FILE* G__dumpfile=0x0
(compiled)          0x636ad0   #define G__CINTVERSION=50180000
/var/lib/stickshift/52773a935973caea6b0000d0/app-root/data/share/cint/cint/include/stdlib.h   5 0x65d930   #define G__STDSTRUCT=0
stdfunc.dll      -1 0x65e9d0   #define __GNUC__=4
stdfunc.dll      -1 0x65eb20   #define __GNUC_MINOR__=7
stdfunc.dll      -1 0x65ec70   #define G__STDFUNC=0
stdarg.h         13 0x670c60   #define G__STDARG_H=0

More to come ...

« Last Edit: November 10, 2013, 12:25:23 PM by John »

kryton9

  • Guest
Re: Cint BASIC
« Reply #11 on: November 10, 2013, 01:59:58 AM »
Thanks for the updates John. It is an interesting project and heck if it meets CERNS needs, that says quite a lot.

Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Re: Cint BASIC
« Reply #12 on: November 10, 2013, 03:32:48 PM »
The more I work with (ROOT)CINT the more powerful and easy it seems to be. Here is a ROOT session where I'm using the C sqrt() function with having to enter just a minimal of code to get results.

Code: [Select]
allbasic@c_basic:~/668428 $ root -b -l
root [0] .p sqrt(12);
(const double)3.46410161513775439e+00
root [1] .q
allbasic@c_basic:~/668428 $

-b - Disables the GUI components of ROOT
-l - Disable the ROOT splash/info startup display

Using CINT

Code: [Select]
allbasic@c_basic:~/668428 $ cint

cint : C/C++ interpreter  (mailing list 'cint@root.cern.ch')
   Copyright(c) : 1995~2010 Masaharu Goto (gotom@hanno.jp)
   revision     : 5.18.00, July 2, 2010 by M.Goto

No main() function found in given source file. Interactive interface started.
'h':help, 'q':quit, '{statements;}' or 'p [expr]' to evaluate

cint> .
!!!Debugger Command mode switched as follows!!!
    > .[command]
    > [statement]
cint> .p sqrt(12);
(const double)3.46410161513775439e+00
cint> .q
  Bye... (try 'qqq' if still running)
allbasic@c_basic:~/668428 $
« Last Edit: November 10, 2013, 05:18:35 PM by John »

kryton9

  • Guest
Re: Cint BASIC
« Reply #13 on: November 10, 2013, 06:16:56 PM »
Quote
Disables the GUI components of ROOT
Can you get a screenshot of what the GUI looks like?

Offline John

  • Forum Support / SB Dev
  • Posts: 1644
    • ScriptBasic Open Source Project
Re: Cint BASIC
« Reply #14 on: November 10, 2013, 06:31:19 PM »