*narrowed array structure;

*narrowed bool_t;
*updated doc;
*polished something.
This commit is contained in:
Wang Renxin 2016-12-20 20:33:42 +08:00
parent 091ce1d1b4
commit aa5885ff45
5 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,7 @@
Dec. 20 2016
Narrowed array structure
Narrowed bool_t
Dec. 16 2016 Dec. 16 2016
Improved INPUT statement Improved INPUT statement

Binary file not shown.

View File

@ -428,8 +428,8 @@ typedef struct _array_t {
#endif /* MB_SIMPLE_ARRAY */ #endif /* MB_SIMPLE_ARRAY */
void* raw; void* raw;
unsigned count; unsigned count;
int dimension_count; unsigned char dimension_count;
int dimensions[MB_MAX_DIMENSION_COUNT]; unsigned dimensions[MB_MAX_DIMENSION_COUNT];
} _array_t; } _array_t;
#ifdef MB_ENABLE_COLLECTION_LIB #ifdef MB_ENABLE_COLLECTION_LIB
@ -1817,7 +1817,7 @@ static int _skip_struct(mb_interpreter_t* s, _ls_node_t** l, mb_func_t open_func
static _running_context_t* _create_running_context(bool_t create_var_dict); static _running_context_t* _create_running_context(bool_t create_var_dict);
static _parsing_context_t* _reset_parsing_context(_parsing_context_t* context); static _parsing_context_t* _reset_parsing_context(_parsing_context_t* context);
static void _destroy_parsing_context(_parsing_context_t** context); static void _destroy_parsing_context(_parsing_context_t* _mb_unaligned * context);
/** Interface processors */ /** Interface processors */
@ -5051,7 +5051,7 @@ static int _create_symbol(mb_interpreter_t* s, _ls_node_t* l, char* sym, _object
if(context->class_state != _CLASS_STATE_NONE) if(context->class_state != _CLASS_STATE_NONE)
tmp.var->pathing = true; tmp.var->pathing = true;
else if(!is_field) else if(!is_field)
tmp.var->pathing = context->current_symbol_contains_accessor; tmp.var->pathing = !!context->current_symbol_contains_accessor;
#endif /* MB_ENABLE_CLASS */ #endif /* MB_ENABLE_CLASS */
(*obj)->data.variable = tmp.var; (*obj)->data.variable = tmp.var;
@ -6526,7 +6526,7 @@ static _array_t* _clone_array(mb_interpreter_t* s, _array_t* arr) {
static int _get_array_pos(mb_interpreter_t* s, _array_t* arr, int* d, int c) { static int _get_array_pos(mb_interpreter_t* s, _array_t* arr, int* d, int c) {
int result = 0; int result = 0;
int i = 0; int i = 0;
int n = 0; unsigned n = 0;
int f = 1; int f = 1;
mb_assert(s && arr && d); mb_assert(s && arr && d);
@ -6617,7 +6617,7 @@ static int _get_array_index(mb_interpreter_t* s, _ls_node_t** l, _object_t* c, u
if(dcount + 1 > arr->data.array->dimension_count) { if(dcount + 1 > arr->data.array->dimension_count) {
_handle_error_on_obj(s, SE_RN_DIMENSION_COUNT_OUT_OF_BOUND, s->source_file, DON(ast), MB_FUNC_ERR, _exit, result); _handle_error_on_obj(s, SE_RN_DIMENSION_COUNT_OUT_OF_BOUND, s->source_file, DON(ast), MB_FUNC_ERR, _exit, result);
} }
if((int)val.integer >= arr->data.array->dimensions[dcount]) { if((unsigned)val.integer >= arr->data.array->dimensions[dcount]) {
_handle_error_on_obj(s, SE_RN_INDEX_OUT_OF_BOUND, s->source_file, DON(ast), MB_FUNC_ERR, _exit, result); _handle_error_on_obj(s, SE_RN_INDEX_OUT_OF_BOUND, s->source_file, DON(ast), MB_FUNC_ERR, _exit, result);
} }
idx += (unsigned)val.integer * f; idx += (unsigned)val.integer * f;
@ -10476,7 +10476,7 @@ static _parsing_context_t* _reset_parsing_context(_parsing_context_t* context) {
} }
/* Destroy the parsing context of a MY-BASIC environment */ /* Destroy the parsing context of a MY-BASIC environment */
static void _destroy_parsing_context(_parsing_context_t** context) { static void _destroy_parsing_context(_parsing_context_t* _mb_unaligned * context) {
if(!context || !(*context)) if(!context || !(*context))
return; return;

View File

@ -180,7 +180,7 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#ifndef bool_t #ifndef bool_t
# define bool_t int # define bool_t char
#endif /* bool_t */ #endif /* bool_t */
#ifndef int_t #ifndef int_t
# define int_t int # define int_t int

View File

@ -1,8 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<!--
COPYRIGHT 2016 WANG RENXIN. ALL RIGHTS REESERVED.
THIS PAGE IS NOT OPEN SOURCE LICENSED.
DO NOT CHANGE THIS FILE.
-->
<html> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<title>Donate MY-BASIC</title> <title>Donate to MY-BASIC</title>
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css"> <style type="text/css">
body { body {
@ -30,7 +35,7 @@
<a href="https://github.com/paladin-t/my_basic">BACK TO MY-BASIC</a> <a href="https://github.com/paladin-t/my_basic">BACK TO MY-BASIC</a>
</p> </p>
<h1>Donate MY-BASIC</h1> <h1>Donate to MY-BASIC</h1>
<h2>List of Donors</h2> <h2>List of Donors</h2>
<p> <p>
@ -40,6 +45,7 @@
<p> <p>
- -
</p> </p>
<hr />
<h2>Notice</h2> <h2>Notice</h2>
<p> <p>
@ -70,6 +76,7 @@
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal The safer, easier way to pay online!"> <input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/zh_XC/i/scr/pixel.gif" width="1" height="1"> <img alt="" border="0" src="https://www.paypalobjects.com/zh_XC/i/scr/pixel.gif" width="1" height="1">
</form> </form>
<hr />
<h2>Questions</h2> <h2>Questions</h2>
<h3> <h3>
@ -92,7 +99,7 @@
</h3> </h3>
<p> <p>
A: PayPal's "Pay Now" doesn't support customized price by you. A: PayPal's "Pay Now" doesn't support customized price by you.
You could choose a base donation number and change the quantity for an approximate expected amount if it's not on the payment option list. You may choose a base donation number and change the quantity for an approximate expected amount, if it's not on the payment option list.
</p> </p>
<p> <p>