Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
gambas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Custom issue tracker
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
6
Snippets
Groups
Projects
Show more breadcrumbs
Gambas
gambas
Commits
80595fe5
Commit
80595fe5
authored
6 years ago
by
gambas
Browse files
Options
Downloads
Patches
Plain Diff
Finish fixing thousand separator bug.
[INTERPRETER] * BUG: Finish fixing thousand separator bug.
parent
6f6224a9
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
main/gbx/gbx_number.c
+12
-5
12 additions, 5 deletions
main/gbx/gbx_number.c
main/share/gb_common_buffer.h
+2
-1
2 additions, 1 deletion
main/share/gb_common_buffer.h
main/share/gb_common_buffer_temp.h
+11
-3
11 additions, 3 deletions
main/share/gb_common_buffer_temp.h
with
25 additions
and
9 deletions
main/gbx/gbx_number.c
+
12
−
5
View file @
80595fe5
...
...
@@ -47,6 +47,7 @@
#define get_current COMMON_get_current
#define buffer_pos COMMON_pos
#define get_size_left COMMON_get_size_left
#define has_string COMMON_has_string
#define IS_PURE_INTEGER(_int64_val) ((_int64_val) == ((int)(_int64_val)))
...
...
@@ -54,11 +55,13 @@ static bool read_integer(int base, bool minus, int64_t *result, bool local)
{
uint64_t
nbr2
,
nbr
;
int
d
,
n
,
c
,
nmax
;
char
thsep
;
const
char
*
thsep
;
int
lthsep
;
int
ndigit_thsep
;
bool
first_thsep
;
thsep
=
LOCAL_get
(
local
)
->
thousand_sep
;
lthsep
=
LOCAL_get
(
local
)
->
len_thousand_sep
;
ndigit_thsep
=
0
;
first_thsep
=
FALSE
;
...
...
@@ -81,8 +84,9 @@ static bool read_integer(int base, bool minus, int64_t *result, bool local)
{
if
(
local
)
{
if
(
c
==
thsep
&&
(
ndigit_thsep
==
3
||
(
!
first_thsep
&&
ndigit_thsep
>=
1
&&
ndigit_thsep
<=
3
)))
if
(
has_string
(
thsep
,
l
thsep
)
&&
(
ndigit_thsep
==
3
||
(
!
first_thsep
&&
ndigit_thsep
>=
1
&&
ndigit_thsep
<=
3
)))
{
COMMON_pos
+=
lthsep
;
c
=
get_char
();
first_thsep
=
TRUE
;
ndigit_thsep
=
0
;
...
...
@@ -184,7 +188,8 @@ static bool read_float(double *result, bool local)
{
LOCAL_INFO
*
local_info
;
char
point
;
char
thsep
;
const
char
*
thsep
;
int
lthsep
;
int
ndigit_thsep
;
bool
first_thsep
;
int
c
,
n
;
...
...
@@ -201,6 +206,7 @@ static bool read_float(double *result, bool local)
local_info
=
LOCAL_get
(
local
);
point
=
local_info
->
decimal_point
;
thsep
=
local_info
->
thousand_sep
;
lthsep
=
local_info
->
len_thousand_sep
;
ndigit_thsep
=
0
;
first_thsep
=
FALSE
;
...
...
@@ -231,11 +237,12 @@ static bool read_float(double *result, bool local)
if
(
local
&&
!
frac
)
{
if
(
c
==
thsep
&&
(
ndigit_thsep
==
3
||
(
!
first_thsep
&&
ndigit_thsep
>=
1
&&
ndigit_thsep
<=
3
)))
if
(
has_string
(
thsep
,
l
thsep
)
&&
(
ndigit_thsep
==
3
||
(
!
first_thsep
&&
ndigit_thsep
>=
1
&&
ndigit_thsep
<=
3
)))
{
c
=
get_char
()
;
COMMON_pos
+=
lthsep
;
first_thsep
=
TRUE
;
ndigit_thsep
=
0
;
c
=
get_char
();
}
}
...
...
This diff is collapsed.
Click to expand it.
main/share/gb_common_buffer.h
+
2
−
1
View file @
80595fe5
...
...
@@ -24,7 +24,7 @@
#ifndef __GB_COMMON_BUFFER_H
#define __GB_COMMON_BUFFER_H
#define COMMON_BUF_MAX
256
#define COMMON_BUF_MAX
512
#ifndef __COMMON_BUFFER_C
EXTERN
int
COMMON_pos
;
...
...
@@ -42,4 +42,5 @@ int COMMON_put_char(char c);
void
COMMON_jump_space
(
void
);
char
*
COMMON_get_current
(
void
);
int
COMMON_get_size_left
(
void
);
bool
COMMON_has_string
(
const
char
*
str
,
int
len
);
#endif
This diff is collapsed.
Click to expand it.
main/share/gb_common_buffer_temp.h
+
11
−
3
View file @
80595fe5
...
...
@@ -24,17 +24,18 @@
#define __COMMON_BUFFER_C
#include
"gb_common.h"
#include
"gb_common_buffer.h"
char
COMMON_buffer
[
256
];
char
COMMON_buffer
[
COMMON_BUF_MAX
];
int
COMMON_pos
;
int
COMMON_len
;
static
char
*
common_buffer
;
static
int
common_last
;
void
COMMON_buffer_init
(
char
*
str
,
int
len
)
void
COMMON_buffer_init
(
const
char
*
str
,
int
len
)
{
common_buffer
=
str
;
common_buffer
=
(
char
*
)
str
;
COMMON_len
=
len
;
COMMON_pos
=
0
;
common_last
=
(
-
1
);
...
...
@@ -103,3 +104,10 @@ int COMMON_get_size_left(void)
}
bool
COMMON_has_string
(
const
char
*
str
,
int
len
)
{
if
(
COMMON_get_size_left
()
>
len
)
return
FALSE
;
return
memcmp
(
&
common_buffer
[
COMMON_pos
],
str
,
len
)
==
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment