Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
clean-compiler-and-rts
compiler
Commits
11927276
Commit
11927276
authored
Dec 02, 2019
by
johnvg@science.ru.nl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add and use function convert_int_to_string
parent
e787e618
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
6 deletions
+78
-6
backendC/CleanCompilerSources/codegen1.c
backendC/CleanCompilerSources/codegen1.c
+7
-4
backendC/CleanCompilerSources/comsupport.c
backendC/CleanCompilerSources/comsupport.c
+63
-0
backendC/CleanCompilerSources/comsupport.h
backendC/CleanCompilerSources/comsupport.h
+2
-0
backendC/CleanCompilerSources/optimisations.c
backendC/CleanCompilerSources/optimisations.c
+6
-2
No files found.
backendC/CleanCompilerSources/codegen1.c
View file @
11927276
...
...
@@ -2581,7 +2581,8 @@ SymbDef CreateUpdateFunction (ArgS *record_arg,ArgS *first_field_arg,Node node
StateS
record_state
,
boxed_record_state
;
StateP
strict_record_state_p
;
sprintf
(
update_function_name
,
"_upd%d"
,
next_update_function_n
);
strcpy
(
update_function_name
,
"_upd"
);
int_to_string
(
&
update_function_name
[
4
],
next_update_function_n
);
++
next_update_function_n
;
n_arguments
=
node
->
node_arity
;
...
...
@@ -2764,8 +2765,9 @@ SymbDef create_select_function (Symbol selector_symbol,int selector_kind)
int
fieldnr
;
selector_sdef
=
selector_symbol
->
symb_def
;
sprintf
(
select_function_name
,
"_sel%d"
,
next_update_function_n
);
strcpy
(
select_function_name
,
"_sel"
);
int_to_string
(
&
select_function_name
[
4
],
next_update_function_n
);
++
next_update_function_n
;
select_function_sdef
=
MakeNewSymbolDefinition
(
CurrentModule
,
select_function_name
,
1
,
IMPRULE
);
...
...
@@ -2852,7 +2854,8 @@ static SymbDef create_match_function_sdef (void)
char
match_function_name
[
16
];
SymbDef
match_function_sdef
;
sprintf
(
match_function_name
,
"_match%d"
,
next_match_function_n
);
strcpy
(
match_function_name
,
"_match"
);
int_to_string
(
&
match_function_name
[
6
],
next_match_function_n
);
++
next_match_function_n
;
match_function_sdef
=
MakeNewSymbolDefinition
(
CurrentModule
,
match_function_name
,
1
,
IMPRULE
);
...
...
backendC/CleanCompilerSources/comsupport.c
View file @
11927276
...
...
@@ -185,6 +185,69 @@ void CompFree (void)
}
}
void
int_to_string
(
char
*
s
,
long
i
)
{
unsigned
long
u
;
unsigned
int
p
,
ua
[
8
];
int
ua_i
;
if
(
i
<
0
){
*
s
++
=
'-'
;
u
=
-
i
;
}
else
u
=
i
;
ua_i
=
0
;
while
(
u
>=
10000
){
unsigned
long
d
;
d
=
u
/
10000
;
ua
[
ua_i
++
]
=
u
-
d
*
10000
;
u
=
d
;
}
if
(
u
<
10
){
*
s
++
=
'0'
+
u
;
}
else
if
(
u
<
100
){
unsigned
int
i
;
p
=
u
*
103
;
i
=
p
>>
10
;
*
s
++
=
'0'
+
i
;
*
s
++
=
'0'
+
(
u
-
10
*
i
);
}
else
if
(
u
<
1000
){
p
=
u
*
41
;
*
s
++
=
'0'
+
(
p
>>
12
);
p
=
10
*
(
p
&
0xfff
);
*
s
++
=
'0'
+
(
p
>>
12
);
p
=
10
*
(
p
&
0xfff
);
*
s
++
=
'0'
+
(
p
>>
12
);
}
else
{
p
=
u
*
8389
;
*
s
++
=
'0'
+
(
p
>>
23
);
p
=
10
*
(
p
&
0x7fffff
);
*
s
++
=
'0'
+
(
p
>>
23
);
p
=
10
*
(
p
&
0x7fffff
);
*
s
++
=
'0'
+
(
p
>>
23
);
p
=
10
*
(
p
&
0x7fffff
);
*
s
++
=
'0'
+
(
p
>>
23
);
}
while
(
ua_i
>
0
){
u
=
ua
[
--
ua_i
];
p
=
u
*
8389
;
*
s
++
=
'0'
+
(
p
>>
23
);
p
=
10
*
(
p
&
0x7fffff
);
*
s
++
=
'0'
+
(
p
>>
23
);
p
=
10
*
(
p
&
0x7fffff
);
*
s
++
=
'0'
+
(
p
>>
23
);
p
=
10
*
(
p
&
0x7fffff
);
*
s
++
=
'0'
+
(
p
>>
23
);
}
*
s
=
'\0'
;
}
/* The environment to leave the compiler if a fatal error occurs */
void
FatalCompError
(
char
*
mod
,
char
*
proc
,
char
*
mess
)
...
...
backendC/CleanCompilerSources/comsupport.h
View file @
11927276
...
...
@@ -44,6 +44,8 @@ extern void *CompAlloc (SizeT size);
extern
void
InitStorage
(
void
);
extern
void
CompFree
(
void
);
extern
void
int_to_string
(
char
*
s
,
long
i
);
extern
void
FatalCompError
(
char
*
mod
,
char
*
proc
,
char
*
mess
);
extern
void
InitSettings
(
void
);
...
...
backendC/CleanCompilerSources/optimisations.c
View file @
11927276
...
...
@@ -1696,7 +1696,9 @@ static ImpRuleP create_new_partially_applied_local_function (Node node,int old_f
Node
lhs_root
,
rhs_root
;
char
*
function_name_p
,
*
end_function_name
;
sprintf
(
function_name
,
"_f%d"
,
next_function_n
);
function_name
[
0
]
=
'_'
;
function_name
[
1
]
=
'f'
;
int_to_string
(
&
function_name
[
2
],
next_function_n
);
++
next_function_n
;
if
(
DoTimeProfiling
||
DoProfiling
){
...
...
@@ -1895,7 +1897,9 @@ static struct node *create_new_local_function (Node node,StateP function_state_p
if
(
n_arguments
>
MAX_N_FUNCTION_ARGUMENTS
)
return
NULL
;
sprintf
(
function_name
,
"_f%d"
,
next_function_n
);
function_name
[
0
]
=
'_'
;
function_name
[
1
]
=
'f'
;
int_to_string
(
&
function_name
[
2
],
next_function_n
);
++
next_function_n
;
if
(
DoTimeProfiling
||
DoProfiling
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment