Author Topic: MY-BASIC  (Read 81871 times)

wangrenxin

  • Guest
Re: MY-BASIC
« Reply #60 on: April 24, 2015, 12:31:40 AM »
No luck with your change to fix the Windows mb_setstr() function. Here is my change to the function per your suggestion.

Code: C
  1. besFUNCTION(mbas_setstr)
  2.   DIM AS mb_value_t mbval;
  3.   DIM AS const char PTR usrval;
  4.   DIM AS const char PTR varname;
  5.   besARGUMENTS("zz")
  6.     AT varname, AT usrval
  7.   besARGEND
  8.   mbval.type = MB_DT_STRING;
  9.   usrval = mb_memdup(usrval, strlen(usrval) + 1);
  10.   mbval.value.string = usrval;
  11.   besRETURN_LONG(mb_debug_set(bas, varname, mbval));
  12. besEND
  13.  


C:\sb22\mybasic>scriba mbvarset.sb
Got Here
Assertion failed: 0 && "Memory already released", file my_basic.c, line 3889

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

C:\sb22\mybasic>


Have you updated to latest revision including a change:
Code: C
  1. int mb_run(struct mb_interpreter_t* s) {
  2.         /* Run loaded and parsed script */
  3.         int result = MB_FUNC_OK;
  4.         _ls_node_t* ast = 0;
  5.         _running_context_t* running = 0;
  6.  
  7.         running = s->running_context;
  8.  
  9.         if(s->parsing_context)                <- added this line!!!
  10.                 safe_free(s->parsing_context);
  11.         ...
  12.  

Offline John

  • Forum Support / SB Dev
  • Posts: 3006
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #61 on: April 24, 2015, 12:54:30 AM »
I have no clue why the varname isn't being passed.  :o

Code: C
  1. besFUNCTION(mbas_setint)
  2.   DIM AS mb_value_t mbval;
  3.   DIM AS int usrval;
  4.   DIM AS const char PTR varname;
  5.   besARGUMENTS("zi")
  6.     AT varname, AT usrval
  7.   besARGEND
  8.   mbval.type = MB_DT_INT;
  9.   printf("|%s|\n", varname);
  10.   printf("0x%08x, 0x%08x\n", bas, varname);
  11.   mbval.value.integer = usrval;
  12.   besRETURN_LONG(mb_debug_set(bas, varname, mbval));
  13. besEND
  14.  


jrs@laptop:~/sb/sb22/mybasic$ scriba mbvars.sb
|(null)|
0x00820808, 0x00000000
scriba: my_basic.c:3977: mb_debug_set: Assertion `s && n' failed.
Aborted (core dumped)
jrs@laptop:~/sb/sb22/mybasic$


I'll redownload your code but I have to figure out why the varname isn't being passed in the m_setxxx but works fine with the mb_getxxx routines. I can't see anything obvious.


wangrenxin

  • Guest
Re: MY-BASIC
« Reply #62 on: April 24, 2015, 01:16:47 AM »
Seems like something wrong in besARGUMENTS. It's defined in your attachment as:
Code: C
  1. #define besARGUMENTS(X) int iError; iError = pSt->basext_GetArgsF(pSt,pParameters,(X),
  2. #define besARGEND ); if( iError )return iError;
  3.  
So there might be some clue in basext_GetArgsF if you step into it to see where does the char* become NULL.

Offline John

  • Forum Support / SB Dev
  • Posts: 3006
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #63 on: April 24, 2015, 01:22:34 AM »
I'm passing varname the same way in mb_getxxx and it works fine.


Offline John

  • Forum Support / SB Dev
  • Posts: 3006
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #64 on: April 24, 2015, 01:40:19 AM »
There seems to be a bug in SB using the "zi" combo. If I reverse them it works.  >:(

wangrenxin

  • Guest
Re: MY-BASIC
« Reply #65 on: April 24, 2015, 01:48:51 AM »
There seems to be a bug in SB using the "zi" combo. If I reverse them it works.  >:(

Unusual indeed.

Offline John

  • Forum Support / SB Dev
  • Posts: 3006
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #66 on: April 24, 2015, 02:06:33 AM »
This method (macro) also has a 5 argument limit. I'll go back to the old way which has a few more steps but rock solid.

Offline John

  • Forum Support / SB Dev
  • Posts: 3006
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #67 on: April 24, 2015, 11:53:34 AM »
Success!

Linux 64 (mb.so) and Window 32 (mb.dll) versions of the MY-BASIC Script BASIC extension module is attached.

interface.c
Code: C
  1. // MY-BASIC - Script BASIC extension module
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <stdarg.h>
  7. #include <ctype.h>
  8. #include <math.h>
  9. #include <time.h>
  10. #include "../../basext.h"
  11. #include "cbasic.h"
  12.  
  13. #include "my_basic.h"
  14.  
  15.  
  16. /****************************
  17.  Extension Module Functions
  18. ****************************/
  19.  
  20. besVERSION_NEGOTIATE
  21.   RETURN_FUNCTION((int)INTERFACE_VERSION);
  22. besEND
  23.  
  24. besSUB_START
  25.   DIM AS long PTR p;
  26.   besMODULEPOINTER = besALLOC(sizeof(long));
  27.   IF (besMODULEPOINTER EQ NULL) THEN_DO RETURN_FUNCTION(0);
  28.   p = (long PTR)besMODULEPOINTER;
  29.   RETURN_FUNCTION(0);
  30. besEND
  31.  
  32. besSUB_FINISH
  33.   DIM AS long PTR p;
  34.   p = (long PTR)besMODULEPOINTER;
  35.   IF (p EQ NULL) THEN_DO RETURN_FUNCTION(0);
  36.   RETURN_FUNCTION(0);
  37. besEND
  38.  
  39.  
  40. /********************
  41.  MY-BASIC Functions
  42. ********************/
  43.  
  44. static struct mb_interpreter_t* bas = 0;
  45.  
  46. static int watch(struct mb_interpreter_t* s, void** l) {
  47.   int result = MB_FUNC_OK;
  48.   int_t arg = 0;
  49.   mb_assert(s && l);
  50.   mb_check(mb_attempt_open_bracket(s, l));
  51.   mb_check(mb_pop_int(s, l, &arg)); // That's it!
  52.   mb_check(mb_attempt_close_bracket(s, l));
  53.   // arg is what you want.
  54.   return result;
  55. }
  56.  
  57. besFUNCTION(mbas_init)
  58.   besRETURN_LONG(mb_init());
  59. besEND
  60.  
  61. besFUNCTION(mbas_dispose)
  62.   besRETURN_LONG(mb_dispose());
  63. besEND
  64.  
  65. besFUNCTION(mbas_open)
  66.   besRETURN_LONG(mb_open(AT bas));
  67. besEND
  68.  
  69. besFUNCTION(mbas_close)
  70.   besRETURN_LONG(mb_close(AT bas));
  71. besEND
  72.  
  73. besFUNCTION(mbas_load_str)
  74.   DIM AS const char PTR pgm;
  75.   besARGUMENTS("z")
  76.     AT pgm
  77.   besARGEND
  78.   besRETURN_LONG(mb_load_string(bas, pgm));
  79. besEND
  80.  
  81. besFUNCTION(mbas_load_file)
  82.   DIM AS const char PTR pgm;
  83.   besARGUMENTS("z")
  84.     AT pgm
  85.   besARGEND
  86.   besRETURN_LONG(mb_load_file(bas, pgm));
  87. besEND
  88.  
  89. besFUNCTION(mbas_run)
  90.   besRETURN_LONG(mb_run(bas));
  91. besEND
  92.  
  93. besFUNCTION(mbas_reset)
  94.   besRETURN_LONG(mb_reset(bas, false));
  95. besEND
  96.  
  97. besFUNCTION(mbas_getint)
  98.   DIM AS mb_value_t mbval;
  99.   DIM AS const char PTR varname;
  100.   besARGUMENTS("z")
  101.     AT varname
  102.   besARGEND
  103.   mbval.type = MB_DT_INT;
  104.   mb_debug_get(bas, varname, &mbval);
  105.   besRETURN_LONG(mbval.value.integer);
  106. besEND
  107.  
  108. besFUNCTION(mbas_getdbl)
  109.   DIM AS mb_value_t mbval;
  110.   DIM AS const char PTR varname;
  111.   besARGUMENTS("z")
  112.     AT varname
  113.   besARGEND
  114.   mbval.type = MB_DT_REAL;
  115.   mb_debug_get(bas, varname, &mbval);
  116.   besRETURN_DOUBLE(mbval.value.float_point);
  117. besEND
  118.  
  119. besFUNCTION(mbas_getstr)
  120.   DIM AS mb_value_t mbval;
  121.   DIM AS const char PTR varname;
  122.   besARGUMENTS("z")
  123.     AT varname
  124.   besARGEND
  125.   mbval.type = MB_DT_STRING;
  126.   mb_debug_get(bas, varname, &mbval);
  127.   besRETURN_STRING(mbval.value.string);
  128. besEND
  129.  
  130. besFUNCTION(mbas_setint)
  131.   DIM AS VARIABLE Argument;
  132.   DIM AS mb_value_t mbval;
  133.   DIM AS int usrval, i, rtnval;
  134.   DIM AS const char PTR varname;
  135.   IF (besARGNR < 2) THEN_DO RETURN_FUNCTION(EX_ERROR_TOO_FEW_ARGUMENTS);
  136.   DEF_FOR (i = 1 TO i <= 2 STEP INCR i)
  137.   BEGIN_FOR
  138.     Argument = besARGUMENT(i);
  139.     besDEREFERENCE(Argument);
  140.     IF (i EQ 1) THEN_DO varname = STRINGVALUE(Argument);
  141.     IF (i EQ 2) THEN_DO usrval = LONGVALUE(Argument);
  142.   NEXT
  143.   mbval.type = MB_DT_INT;
  144.   mbval.value.integer = usrval;
  145.   rtnval = mb_debug_set(bas, varname, mbval);
  146.   besRETURN_LONG(rtnval);
  147. besEND
  148.  
  149. besFUNCTION(mbas_setdbl)
  150.   DIM AS VARIABLE Argument;
  151.   DIM AS mb_value_t mbval;
  152.   DIM AS int i, rtnval;
  153.   DIM AS double usrval;
  154.   DIM AS const char PTR varname;
  155.   IF (besARGNR < 2) THEN_DO RETURN_FUNCTION(EX_ERROR_TOO_FEW_ARGUMENTS);
  156.   DEF_FOR (i = 1 TO i <= 2 STEP INCR i)
  157.   BEGIN_FOR
  158.     Argument = besARGUMENT(i);
  159.     besDEREFERENCE(Argument);
  160.     IF (i EQ 1) THEN_DO varname = STRINGVALUE(Argument);
  161.     IF (i EQ 2) THEN_DO usrval = DOUBLEVALUE(Argument);
  162.   NEXT
  163.   mbval.type = MB_DT_REAL;
  164.   mbval.value.float_point = usrval;
  165.   rtnval = mb_debug_set(bas, varname, mbval);
  166.   besRETURN_LONG(rtnval);
  167. besEND
  168.  
  169. besFUNCTION(mbas_setstr)
  170.   DIM AS VARIABLE Argument;
  171.   DIM AS mb_value_t mbval;
  172.   DIM AS int i, rtnval;
  173.   DIM AS const char PTR varname;
  174.   DIM AS const char PTR usrval;
  175.   IF (besARGNR < 2) THEN_DO RETURN_FUNCTION(EX_ERROR_TOO_FEW_ARGUMENTS);
  176.   DEF_FOR (i = 1 TO i <= 2 STEP INCR i)
  177.   BEGIN_FOR
  178.     Argument = besARGUMENT(i);
  179.     besDEREFERENCE(Argument);
  180.     IF (i EQ 1) THEN_DO varname = STRINGVALUE(Argument);
  181.     IF (i EQ 2) THEN_DO usrval = STRINGVALUE(Argument);
  182.   NEXT
  183.   mbval.type = MB_DT_STRING;
  184.   usrval = mb_memdup(usrval, strlen(usrval) + 1);
  185.   mbval.value.string = usrval;
  186.   besRETURN_LONG(mb_debug_set(bas, varname, mbval));
  187. besEND
  188.  

mbvars.sb
Code: Script BASIC
  1. DECLARE SUB mb_init ALIAS "mbas_init" LIB "mb"
  2. DECLARE SUB mb_dispose ALIAS "mbas_dispose" LIB "mb"
  3. DECLARE SUB mb_open ALIAS "mbas_open" LIB "mb"
  4. DECLARE SUB mb_close ALIAS "mbas_close" LIB "mb"
  5. DECLARE SUB mb_load_str ALIAS "mbas_load_str" LIB "mb"
  6. DECLARE SUB mb_load_file ALIAS "mbas_load_file" LIB "mb"
  7. DECLARE SUB mb_run ALIAS "mbas_run" LIB "mb"
  8. DECLARE SUB mb_getint ALIAS "mbas_getint" LIB "mb"
  9. DECLARE SUB mb_getdbl ALIAS "mbas_getdbl" LIB "mb"
  10. DECLARE SUB mb_getstr ALIAS "mbas_getstr" LIB "mb"
  11. DECLARE SUB mb_setint ALIAS "mbas_setint" LIB "mb"
  12. DECLARE SUB mb_setdbl ALIAS "mbas_setdbl" LIB "mb"
  13. DECLARE SUB mb_setstr ALIAS "mbas_setstr" LIB "mb"
  14. DECLARE SUB mb_reset ALIAS "mbas_reset" LIB "mb"
  15.  
  16. mb_init
  17. mb_open
  18. mb_load_file "setvars.bas"
  19. mb_run
  20. mb_setint "A", 123
  21. mb_setdbl "B", 1.23
  22. mb_setstr "C$", "One,Two,Three"
  23. PRINT mb_getint("A"),"\n"
  24. PRINT FORMAT("%g\n", mb_getdbl("B"))
  25. PRINT mb_getstr("C$"),"\n"
  26. mb_close
  27. mb_dispose
  28.  

setvars.bas
Code: [Select]
a = 0
b = 0.0
c$ = ""

Output - Linux 64 bit

jrs@laptop:~/sb/sb22/mybasic$ time scriba mbvars.sb
123
1.23
One,Two,Three

real   0m0.006s
user   0m0.005s
sys   0m0.005s
jrs@laptop:~/sb/sb22/mybasic$


Output - Windows 32 bit

C:\sb22\mybasic>scriba mbvars.sb
123
1.23
One,Two,Three

C:\sb22\mybasic>

« Last Edit: April 24, 2015, 02:53:16 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3006
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #68 on: April 24, 2015, 03:04:58 PM »
Tony,

Can you export a function like LIST but the return value would be a multi-line string version of the the program? If we had this ability, one could retrieve the current program into a SB string, mb_reset the MY-BASIC workspace and mb_load_str an edited version of the script.

Code: C
  1. static void _list_program(const char* sn, const char* cn) {
  2.         long lsn = 0;
  3.         long lcn = 0;
  4.         mb_assert(sn && cn);
  5.         lsn = atoi(sn);
  6.         lcn = atoi(cn);
  7.         if(lsn == 0 && lcn == 0) {
  8.                 long i = 0;
  9.                 for(i = 0; i < c->count; ++i) {
  10.                         printf("%d]%s\n", i + 1, c->lines[i]);
  11.                 }
  12.         } else {
  13.                 long i = 0;
  14.                 long e = 0;
  15.                 if(lsn < 1 || lsn > c->count) {
  16.                         printf("Line number %ld out of bound.\n", lsn);
  17.  
  18.                         return;
  19.                 }
  20.                 if(lcn < 0) {
  21.                         printf("Invalid line count %ld.\n", lcn);
  22.  
  23.                         return;
  24.                 }
  25.                 --lsn;
  26.                 e = lcn ? lsn + lcn : c->count;
  27.                 for(i = lsn; i < e; ++i) {
  28.                         if(i >= c->count)
  29.                                 break;
  30.  
  31.                         printf("%d]%s\n", i + 1, c->lines[i]);
  32.                 }
  33.         }
  34. }
  35.  

wangrenxin

  • Guest
Re: MY-BASIC
« Reply #69 on: April 24, 2015, 10:54:26 PM »
Can you export a function like LIST but the return value would be a multi-line string version of the the program? If we had this ability, one could retrieve the current program into a SB string, mb_reset the MY-BASIC workspace and mb_load_str an edited version of the script.

_get_code is exactly what you are looking for. Note you need to free the return value if it's no longer in use.

Offline John

  • Forum Support / SB Dev
  • Posts: 3006
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #70 on: April 25, 2015, 01:04:30 AM »
There is no _get_code in the my_basic.h, my_basic.c or a dump of the shared object.

Code: [Select]
jrs@laptop:~/sb/sb22/modules$ nm mb.so
                 U acosf@@GLIBC_2.2.5
0000000000006f10 t _append_char_to_symbol
                 U asinf@@GLIBC_2.2.5
                 U __assert_fail
                 U atanf@@GLIBC_2.2.5
0000000000214940 b bas
0000000000003010 T bootmodu
0000000000214938 B __bss_start
0000000000214960 b buf.6267
0000000000009340 t _calc_expression
                 U ceilf@@GLIBC_2.2.5
0000000000006fc0 t _clear_array
0000000000003a20 t _compare_numbers
00000000000079a0 t _core_add
0000000000003de0 t _core_and
0000000000003fe0 t _core_close_bracket
000000000000bb30 t _core_dim
0000000000004ef0 t _core_div
000000000000ac40 t _core_do
0000000000003930 t _core_dummy_assign
0000000000003b60 t _core_else
0000000000003b90 t _core_elseif
0000000000004910 t _core_end
0000000000003b30 t _core_endif
0000000000006a40 t _core_equal
0000000000005440 t _core_exit
000000000000b0c0 t _core_for
0000000000007d80 t _core_gosub
00000000000052f0 t _core_goto
0000000000006390 t _core_greater
0000000000005cd0 t _core_greater_equal
000000000000b630 t _core_if
00000000000066f0 t _core_less
0000000000006030 t _core_less_equal
000000000000a5a0 t _core_let
00000000002141a0 d _core_libs
000000000000e8d0 t _core_mem
00000000000041e0 t _core_min
0000000000004be0 t _core_mod
0000000000004040 t _core_mul
000000000000d7b0 t _core_neg
0000000000006df0 t _core_next
000000000000e950 t _core_not
0000000000005990 t _core_not_equal
0000000000004010 t _core_open_bracket
0000000000003bf0 t _core_or
00000000000043a0 t _core_pow
0000000000007250 t _core_return
00000000000039c0 t _core_step
0000000000003bc0 t _core_then
00000000000039f0 t _core_to
0000000000003960 t _core_until
0000000000003990 t _core_wend
000000000000af00 t _core_while
                 U cosf@@GLIBC_2.2.5
                 U __ctype_b_loc
                 U __ctype_toupper_loc
0000000000007fe0 t _cut_symbol
00000000000076c0 t _destroy_object
0000000000007700 t _destroy_object_non_syntax
00000000000073b0 t _dispose_object
0000000000214598 d _DYNAMIC
0000000000214938 D _edata
00000000002149a0 B _end
0000000000214420 d _ERR_DESC
000000000000a9b0 t _execute_statement
                 U exit
0000000000214988 b _exp_assign
                 U exp@@GLIBC_2.2.5
0000000000005930 t _extract_string
                 U fclose
                 U fgets
0000000000003030 T finimodu
                 U floorf@@GLIBC_2.2.5
                 U fopen
                 U fread
                 U free
                 U fseek
                 U ftell
                 U fwrite
0000000000008fd0 t _get_array_index
0000000000002eb0 t _get_inputer.part.23
0000000000002ed0 t _get_printer.part.24
0000000000005660 t _get_priority_index
0000000000005480 t _get_size_of.part.11
0000000000214728 d _GLOBAL_OFFSET_TABLE_
0000000000007340 t _ht_clear
0000000000003910 t _ht_cmp_int
0000000000004380 t _ht_cmp_string
0000000000008ee0 t _ht_create.constprop.74
00000000000078a0 t _ht_destroy
0000000000005270 t _ht_find
0000000000007800 t _ht_foreach
00000000000048e0 t _ht_hash_int
0000000000004890 t _ht_hash_string
0000000000007de0 t _ht_set_or_insert
0000000000006e50 t _internal_object_to_public_value
00000000000054e0 t _is_expression_terminal
0000000000004700 t _is_flow
0000000000004810 t _is_identifier_char
0000000000004600 t _is_operator
0000000000004850 t _is_operator_char
00000000000058d0 t _is_string
                 U logf@@GLIBC_2.2.5
00000000000072e0 t _ls_clear
00000000000038f0 t _ls_cmp_data
0000000000003900 t _ls_cmp_extra
0000000000004390 t _ls_cmp_extra_string
0000000000007ce0 t _ls_create_node
0000000000007860 t _ls_destroy
0000000000002e90 t _ls_empty.part.22
0000000000007760 t _ls_foreach
0000000000007190 t _ls_free_extra
00000000000071d0 t _ls_popback
0000000000007d30 t _ls_pushback
00000000000070b0 t _ls_try_remove
0000000000002ef0 T ltrim
                 U malloc
0000000000214980 b _mb_allocated
0000000000003130 T mbas_close
0000000000003090 T mbas_dispose
00000000000033c0 T mbas_getdbl
0000000000003320 T mbas_getint
0000000000003460 T mbas_getstr
0000000000003040 T mbas_init
0000000000003200 T mbas_load_file
0000000000003180 T mbas_load_str
00000000000030e0 T mbas_open
00000000000032d0 T mbas_reset
0000000000003280 T mbas_run
0000000000003660 T mbas_setdbl
0000000000003530 T mbas_setint
00000000000037a0 T mbas_setstr
000000000000d280 T mb_attempt_close_bracket
000000000000ce10 T mb_attempt_func_begin
000000000000cea0 T mb_attempt_func_end
000000000000d1e0 T mb_attempt_open_bracket
000000000000c940 T mb_close
000000000000f820 T mb_debug_get
000000000000f8f0 T mb_debug_set
000000000000f980 T mb_debug_set_stepped_handler
000000000000c340 T mb_dispose
000000000000bfd0 T mb_dispose_value
0000000000006f80 t mb_free
000000000000f9e0 T mb_get_error_desc
000000000000f9b0 T mb_get_last_error
00000000000045a0 T mb_gets
000000000000d350 T mb_has_arg
000000000000c090 T mb_init
000000000000fbf0 T mb_load_file
000000000000fa20 T mb_load_string
0000000000007950 t mb_malloc
000000000000ff60 T mb_memdup
000000000000c5f0 T mb_open
000000000000d580 T mb_pop_int
000000000000d600 T mb_pop_real
000000000000d680 T mb_pop_string
000000000000d6f0 T mb_pop_usertype
000000000000d3c0 T mb_pop_value
000000000000e870 T mb_push_int
000000000000f120 T mb_push_real
000000000000f220 T mb_push_string
000000000000f770 T mb_push_usertype
000000000000d760 T mb_push_value
000000000000cde0 T mb_register_func
000000000000cdf0 T mb_remove_func
000000000000ce00 T mb_remove_reserved_func
000000000000cb40 T mb_reset
000000000000fd20 T mb_run
000000000000fed0 T mb_set_error_handler
000000000000ff30 T mb_set_inputer
000000000000ff00 T mb_set_printer
0000000000004560 t mb_strupr
000000000000f7d0 T mb_suspend
000000000000c020 T mb_ver
000000000000c030 T mb_ver_string
                 U memcpy
                 U memmove
                 U memset
0000000000214990 b _OBJ_BOOL_FALSE
0000000000214998 b _OBJ_BOOL_TRUE
0000000000011550 r _OBJ_INT_ZERO
0000000000007e80 t _open_constant
0000000000008940 t _parse_char
                 U pow@@GLIBC_2.2.5
00000000000113e0 r _PRECEDE_TABLE
0000000000011320 r __PRETTY_FUNCTION__.5458
00000000000112a7 r __PRETTY_FUNCTION__.5473
00000000000112e3 r __PRETTY_FUNCTION__.5479
000000000001109e r __PRETTY_FUNCTION__.5488
0000000000011056 r __PRETTY_FUNCTION__.5499
0000000000010ec4 r __PRETTY_FUNCTION__.5507
00000000000110cb r __PRETTY_FUNCTION__.5512
000000000001104a r __PRETTY_FUNCTION__.5519
0000000000011350 r __PRETTY_FUNCTION__.5525
0000000000011340 r __PRETTY_FUNCTION__.5534
0000000000011330 r __PRETTY_FUNCTION__.5545
0000000000011293 r __PRETTY_FUNCTION__.5588
0000000000010e30 r __PRETTY_FUNCTION__.5600
0000000000010cb0 r __PRETTY_FUNCTION__.5609
0000000000010c66 r __PRETTY_FUNCTION__.5624
0000000000010c90 r __PRETTY_FUNCTION__.5632
0000000000011372 r __PRETTY_FUNCTION__.5641
000000000001139b r __PRETTY_FUNCTION__.5645
0000000000011114 r __PRETTY_FUNCTION__.5681
0000000000011100 r __PRETTY_FUNCTION__.5686
00000000000110e0 r __PRETTY_FUNCTION__.5698
00000000000111b0 r __PRETTY_FUNCTION__.5704
0000000000011240 r __PRETTY_FUNCTION__.5733
0000000000010de0 r __PRETTY_FUNCTION__.5780
00000000000112d0 r __PRETTY_FUNCTION__.5785
0000000000010dd2 r __PRETTY_FUNCTION__.5789
0000000000010dfe r __PRETTY_FUNCTION__.5793
0000000000010ab0 r __PRETTY_FUNCTION__.5824
0000000000010aff r __PRETTY_FUNCTION__.5836
0000000000010af0 r __PRETTY_FUNCTION__.5851
0000000000010ae1 r __PRETTY_FUNCTION__.5875
0000000000010ad0 r __PRETTY_FUNCTION__.5907
0000000000010b0b r __PRETTY_FUNCTION__.5937
00000000000112c0 r __PRETTY_FUNCTION__.5945
00000000000111e6 r __PRETTY_FUNCTION__.5950
0000000000011180 r __PRETTY_FUNCTION__.5957
0000000000011190 r __PRETTY_FUNCTION__.5972
0000000000011170 r __PRETTY_FUNCTION__.5988
0000000000010f70 r __PRETTY_FUNCTION__.6000
0000000000010f8a r __PRETTY_FUNCTION__.6006
00000000000111f3 r __PRETTY_FUNCTION__.6015
0000000000011200 r __PRETTY_FUNCTION__.6022
00000000000110c0 r __PRETTY_FUNCTION__.6028
00000000000110b0 r __PRETTY_FUNCTION__.6033
0000000000011210 r __PRETTY_FUNCTION__.6044
0000000000011070 r __PRETTY_FUNCTION__.6065
0000000000011220 r __PRETTY_FUNCTION__.6073
00000000000111d0 r __PRETTY_FUNCTION__.6080
0000000000010ff0 r __PRETTY_FUNCTION__.6086
0000000000011140 r __PRETTY_FUNCTION__.6092
0000000000010b80 r __PRETTY_FUNCTION__.6104
0000000000011080 r __PRETTY_FUNCTION__.6118
0000000000011260 r __PRETTY_FUNCTION__.6134
0000000000011041 r __PRETTY_FUNCTION__.6154
0000000000010fa0 r __PRETTY_FUNCTION__.6166
0000000000011251 r __PRETTY_FUNCTION__.6181
0000000000010e42 r __PRETTY_FUNCTION__.6195
0000000000010cbb r __PRETTY_FUNCTION__.6206
0000000000010ce0 r __PRETTY_FUNCTION__.6213
0000000000010c80 r __PRETTY_FUNCTION__.6218
0000000000011310 r __PRETTY_FUNCTION__.6224
0000000000010ca0 r __PRETTY_FUNCTION__.6233
0000000000010e16 r __PRETTY_FUNCTION__.6242
0000000000010cc8 r __PRETTY_FUNCTION__.6251
00000000000113b0 r __PRETTY_FUNCTION__.6260
0000000000011393 r __PRETTY_FUNCTION__.6272
0000000000011367 r __PRETTY_FUNCTION__.6277
000000000001135f r __PRETTY_FUNCTION__.6287
0000000000010cd7 r __PRETTY_FUNCTION__.6297
0000000000010c70 r __PRETTY_FUNCTION__.6307
0000000000010c50 r __PRETTY_FUNCTION__.6329
0000000000010c30 r __PRETTY_FUNCTION__.6337
0000000000010c10 r __PRETTY_FUNCTION__.6345
0000000000010bf0 r __PRETTY_FUNCTION__.6354
0000000000010be5 r __PRETTY_FUNCTION__.6363
0000000000010bda r __PRETTY_FUNCTION__.6372
0000000000010bce r __PRETTY_FUNCTION__.6387
0000000000010bc0 r __PRETTY_FUNCTION__.6402
0000000000010bb0 r __PRETTY_FUNCTION__.6416
0000000000010ba1 r __PRETTY_FUNCTION__.6433
0000000000010b6d r __PRETTY_FUNCTION__.6442
0000000000010b60 r __PRETTY_FUNCTION__.6451
0000000000010b51 r __PRETTY_FUNCTION__.6460
0000000000010b40 r __PRETTY_FUNCTION__.6469
0000000000010b26 r __PRETTY_FUNCTION__.6478
0000000000010b17 r __PRETTY_FUNCTION__.6493
0000000000010a99 r __PRETTY_FUNCTION__.6508
0000000000010a92 r __PRETTY_FUNCTION__.6516
0000000000010a87 r __PRETTY_FUNCTION__.6526
0000000000010a7a r __PRETTY_FUNCTION__.6536
0000000000010a6d r __PRETTY_FUNCTION__.6545
0000000000010a50 r __PRETTY_FUNCTION__.6551
0000000000010a30 r __PRETTY_FUNCTION__.6556
0000000000010a10 r __PRETTY_FUNCTION__.6560
00000000000109f0 r __PRETTY_FUNCTION__.6566
00000000000109df r __PRETTY_FUNCTION__.6572
00000000000109d0 r __PRETTY_FUNCTION__.6578
0000000000011380 r __PRETTY_FUNCTION__.6594
0000000000010e51 r __PRETTY_FUNCTION__.6601
0000000000010e5b r __PRETTY_FUNCTION__.6620
0000000000010e65 r __PRETTY_FUNCTION__.6632
0000000000010e6f r __PRETTY_FUNCTION__.6644
0000000000010e79 r __PRETTY_FUNCTION__.6663
0000000000010e83 r __PRETTY_FUNCTION__.6682
0000000000010e90 r __PRETTY_FUNCTION__.6694
0000000000010eb0 r __PRETTY_FUNCTION__.6701
0000000000010ece r __PRETTY_FUNCTION__.6711
0000000000010ed8 r __PRETTY_FUNCTION__.6727
0000000000010ee4 r __PRETTY_FUNCTION__.6757
0000000000010eef r __PRETTY_FUNCTION__.6788
0000000000010f00 r __PRETTY_FUNCTION__.6819
0000000000010f20 r __PRETTY_FUNCTION__.6850
0000000000010f40 r __PRETTY_FUNCTION__.6881
0000000000010f50 r __PRETTY_FUNCTION__.6910
0000000000010f5a r __PRETTY_FUNCTION__.6922
0000000000010f63 r __PRETTY_FUNCTION__.6935
0000000000010f80 r __PRETTY_FUNCTION__.6955
0000000000010f96 r __PRETTY_FUNCTION__.6983
0000000000010faf r __PRETTY_FUNCTION__.6998
0000000000010fb8 r __PRETTY_FUNCTION__.7013
0000000000010fc3 r __PRETTY_FUNCTION__.7020
0000000000010fd0 r __PRETTY_FUNCTION__.7027
0000000000010fdb r __PRETTY_FUNCTION__.7034
0000000000011001 r __PRETTY_FUNCTION__.7052
000000000001100b r __PRETTY_FUNCTION__.7069
0000000000011014 r __PRETTY_FUNCTION__.7076
000000000001101f r __PRETTY_FUNCTION__.7086
000000000001102a r __PRETTY_FUNCTION__.7097
0000000000011036 r __PRETTY_FUNCTION__.7108
0000000000011273 r __PRETTY_FUNCTION__.7120
000000000001127c r __PRETTY_FUNCTION__.7131
0000000000011288 r __PRETTY_FUNCTION__.7138
000000000001129c r __PRETTY_FUNCTION__.7148
00000000000112b4 r __PRETTY_FUNCTION__.7157
00000000000112ef r __PRETTY_FUNCTION__.7165
00000000000112fc r __PRETTY_FUNCTION__.7172
0000000000011306 r __PRETTY_FUNCTION__.7181
0000000000010cef r __PRETTY_FUNCTION__.7188
0000000000010cf8 r __PRETTY_FUNCTION__.7204
0000000000010d01 r __PRETTY_FUNCTION__.7220
0000000000010d0a r __PRETTY_FUNCTION__.7236
0000000000010d15 r __PRETTY_FUNCTION__.7252
0000000000010d1f r __PRETTY_FUNCTION__.7268
0000000000010d28 r __PRETTY_FUNCTION__.7284
0000000000010d33 r __PRETTY_FUNCTION__.7300
0000000000010d3c r __PRETTY_FUNCTION__.7310
0000000000010d45 r __PRETTY_FUNCTION__.7326
0000000000010d4e r __PRETTY_FUNCTION__.7342
0000000000010d57 r __PRETTY_FUNCTION__.7358
0000000000010d61 r __PRETTY_FUNCTION__.7374
0000000000010d6b r __PRETTY_FUNCTION__.7390
0000000000010d75 r __PRETTY_FUNCTION__.7406
0000000000010d7e r __PRETTY_FUNCTION__.7422
0000000000010d87 r __PRETTY_FUNCTION__.7438
0000000000010d90 r __PRETTY_FUNCTION__.7451
0000000000010d99 r __PRETTY_FUNCTION__.7464
0000000000010da3 r __PRETTY_FUNCTION__.7477
0000000000010dac r __PRETTY_FUNCTION__.7491
0000000000010db5 r __PRETTY_FUNCTION__.7507
0000000000010dc0 r __PRETTY_FUNCTION__.7521
0000000000010dc9 r __PRETTY_FUNCTION__.7535
0000000000010df3 r __PRETTY_FUNCTION__.7552
0000000000010e0b r __PRETTY_FUNCTION__.7574
                 U printf
00000000000055a0 t _public_value_to_internal_object
                 U rand
0000000000007f20 t _register_func
0000000000008da0 t _remove_func
00000000000054b0 t _remove_source_object
0000000000002f50 T rtrim
0000000000004950 t _set_current_error
0000000000002e70 t _set_error_pos.part.8
                 U sinf@@GLIBC_2.2.5
0000000000004990 t _skip_struct
0000000000004ad0 t _skip_to
                 U __sprintf_chk
                 U sqrtf@@GLIBC_2.2.5
                 U __stack_chk_fail
000000000000e710 t _std_abs
000000000000deb0 t _std_acos
000000000000eaa0 t _std_asc
000000000000e010 t _std_asin
000000000000dd50 t _std_atan
000000000000ed80 t _std_ceil
000000000000f6d0 t _std_chr
000000000000e2d0 t _std_cos
                 U stderr
000000000000dbd0 t _std_exp
000000000000ec60 t _std_fix
000000000000eea0 t _std_floor
                 U stdin
000000000000cee0 t _std_input
000000000000f5f0 t _std_left
000000000000ea10 t _std_len
0000000000214000 d _std_libs
000000000000da70 t _std_log
000000000000f4a0 t _std_mid
000000000000a0e0 t _std_print
000000000000f3a0 t _std_right
000000000000f180 t _std_rnd
000000000000eb30 t _std_round
000000000000efc0 t _std_sgn
000000000000e430 t _std_sin
000000000000e590 t _std_sqr
000000000000f280 t _std_str
000000000000e170 t _std_tan
000000000000d960 t _std_val
                 U strcat
                 U strcmp
                 U strcpy
                 U strlen
                 U strtod
                 U strtol
                 U tanf@@GLIBC_2.2.5
0000000000002fe0 T trim
0000000000006da0 t _try_clear_intermediate_value.isra.19
0000000000008f60 t _try_get_value.constprop.75
0000000000003000 T versmodu
jrs@laptop:~/sb/sb22/modules$

wangrenxin

  • Guest
Re: MY-BASIC
« Reply #71 on: April 25, 2015, 02:47:31 AM »
It's in main.c as well as _list_program.

Offline John

  • Forum Support / SB Dev
  • Posts: 3006
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #72 on: April 25, 2015, 07:38:35 AM »
It's in main.c as well as _list_program.

Can you make an exported - CORE version of this? The mb_assert() seems MIA if I try to use it.

Code: C
  1. static char* _get_code(_code_line_t* code) {
  2.         char* result = 0;
  3.         int i = 0;
  4.         mb_assert(code);
  5.         result = (char*)malloc((_MAX_LINE_LENGTH + 2) * code->count + 1);
  6.         result[0] = '\0';
  7.         for(i = 0; i < code->count; ++i) {
  8.                 result = strcat(result, code->lines[i]);
  9.                 if(i != code->count - 1)
  10.                         result = strcat(result, "\n");
  11.         }
  12.  
  13.         return result;
  14. }
  15.  

« Last Edit: April 25, 2015, 09:09:06 AM by John »

wangrenxin

  • Guest
Re: MY-BASIC
« Reply #73 on: April 25, 2015, 11:47:40 PM »
Well, as you see, it's not a part of core, but a part of shell. The source code is only manipulatable at the shell layer, the core layer doesn't know what the source text is, it's not possible and doesn't make any sence to export _get_code only, the proper way to manipulate source code is maintain it yourself, maybe port some functions from main.c.

Offline John

  • Forum Support / SB Dev
  • Posts: 3006
    • ScriptBasic Open Source Project
Re: MY-BASIC
« Reply #74 on: April 26, 2015, 12:10:50 AM »
That makes sense. This means the posted binaries are the MY-BASIC Script BASIC extension modules for Windows 32 bit and Lunux (Ubuntu) 64 bit.

Thanks Tony for your help and additions to your code to make this a worth while adventure.

I'm glad to see Markus (Cybermonkey) adding graphics primitives to My-BASIC. This might be a good project to generate a spark to ignite your Retro BASIC Gaming forum/site. I would like to see MY-BASIC be the BASM (tutorial compiler) of interpreters.



Code: [Select]
screen (512,512,"Fractal")

bx=0
by=0
bw=256*2
bh=256*2

sx=-2.2
sy=-1.7
sw=3.4
sh=3.4

cls

for x=bx to bx+bw
 for y=by to by+bh
   gx=(x-bx)/bw*sw+sx
   gy=(y-by)/bh*sh+sy
   zx=gx
   zy=gy
   for c=0 to 255
    col = c
    nzx=zx*zx - zy*zy + gx
    zy=2*zx*zy+gy
    zx=nzx
    if zx*zx + zy*zy > 4 then  col = c:  exit
  next
  r = col*256+col
  v = col*256+col*32
  b = col*256+col*64         
  ink (r,v,b)
  pset (x,y)
sync
 next
next

sync
do
sleep (15)
until keypressed=true
« Last Edit: April 26, 2015, 12:56:51 PM by John »