*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
Improved INPUT statement

Binary file not shown.

View File

@ -428,8 +428,8 @@ typedef struct _array_t {
#endif /* MB_SIMPLE_ARRAY */
void* raw;
unsigned count;
int dimension_count;
int dimensions[MB_MAX_DIMENSION_COUNT];
unsigned char dimension_count;
unsigned dimensions[MB_MAX_DIMENSION_COUNT];
} _array_t;
#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 _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 */
@ -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)
tmp.var->pathing = true;
else if(!is_field)
tmp.var->pathing = context->current_symbol_contains_accessor;
tmp.var->pathing = !!context->current_symbol_contains_accessor;
#endif /* MB_ENABLE_CLASS */
(*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) {
int result = 0;
int i = 0;
int n = 0;
unsigned n = 0;
int f = 1;
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) {
_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);
}
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 */
static void _destroy_parsing_context(_parsing_context_t** context) {
static void _destroy_parsing_context(_parsing_context_t* _mb_unaligned * context) {
if(!context || !(*context))
return;

View File

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

View File

@ -1,8 +1,13 @@
<!DOCTYPE html>
<!--
COPYRIGHT 2016 WANG RENXIN. ALL RIGHTS REESERVED.
THIS PAGE IS NOT OPEN SOURCE LICENSED.
DO NOT CHANGE THIS FILE.
-->
<html>
<head>
<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" />
<style type="text/css">
body {
@ -30,7 +35,7 @@
<a href="https://github.com/paladin-t/my_basic">BACK TO MY-BASIC</a>
</p>
<h1>Donate MY-BASIC</h1>
<h1>Donate to MY-BASIC</h1>
<h2>List of Donors</h2>
<p>
@ -40,6 +45,7 @@
<p>
-
</p>
<hr />
<h2>Notice</h2>
<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!">
<img alt="" border="0" src="https://www.paypalobjects.com/zh_XC/i/scr/pixel.gif" width="1" height="1">
</form>
<hr />
<h2>Questions</h2>
<h3>
@ -92,7 +99,7 @@
</h3>
<p>
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>