Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ArduBlock2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
letsgoING
ArduBlock Source
ArduBlock2
Commits
d0ae58c0
Commit
d0ae58c0
authored
Nov 19, 2021
by
Anian Bühler
Browse files
Options
Downloads
Patches
Plain Diff
updated itoa-Block
parent
4947d3e8
Branches
Branches containing commit
No related tags found
1 merge request
!1
dev_prefereences to master
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/com/ardublock/translator/block/cast/CastItoa.java
+18
-3
18 additions, 3 deletions
...in/java/com/ardublock/translator/block/cast/CastItoa.java
src/main/resources/com/ardublock/block/ardublock.xml
+3
-0
3 additions, 0 deletions
src/main/resources/com/ardublock/block/ardublock.xml
with
21 additions
and
3 deletions
src/main/java/com/ardublock/translator/block/cast/CastItoa.java
+
18
−
3
View file @
d0ae58c0
package
com.ardublock.translator.block.cast
;
import
java.util.ResourceBundle
;
import
com.ardublock.translator.Translator
;
import
com.ardublock.translator.block.TranslatorBlock
;
import
com.ardublock.translator.block.exception.BlockException
;
import
com.ardublock.translator.block.exception.SocketNullException
;
import
com.ardublock.translator.block.exception.SubroutineNotDeclaredException
;
import
com.ardublock.translator.block.numbers.ConstantStringBlock
;
import
com.ardublock.translator.block.numbers.LocalVariableStringBlock
;
import
com.ardublock.translator.block.numbers.VariableStringBlock
;
public
class
CastItoa
extends
TranslatorBlock
{
private
static
ResourceBundle
uiMessageBundle
=
ResourceBundle
.
getBundle
(
"com/ardublock/block/ardublock"
);
public
CastItoa
(
Long
blockId
,
Translator
translator
,
String
codePrefix
,
String
codeSuffix
,
String
label
)
{
super
(
blockId
,
translator
,
codePrefix
,
codeSuffix
,
label
);
}
...
...
@@ -14,10 +22,17 @@ public class CastItoa extends TranslatorBlock
@Override
public
String
toCode
()
throws
SocketNullException
,
SubroutineNotDeclaredException
{
TranslatorBlock
tb
=
this
.
getRequiredTranslatorBlockAtSocket
(
0
);
String
intValue
=
tb
.
toCode
().
replaceAll
(
"\\s*_.new\\b\\s*"
,
""
);
TranslatorBlock
tb_value
=
this
.
getRequiredTranslatorBlockAtSocket
(
0
);
TranslatorBlock
tb_buffer
=
this
.
getRequiredTranslatorBlockAtSocket
(
1
);
String
intValue
=
tb_value
.
toCode
().
replaceAll
(
"\\s*_.new\\b\\s*"
,
""
);
String
charBuffer
=
tb_buffer
.
toCode
().
replaceAll
(
"\\s*_.new\\b\\s*"
,
""
);
if
(!(
tb_buffer
instanceof
VariableStringBlock
)
&&
!(
tb_buffer
instanceof
LocalVariableStringBlock
)
&&
!(
tb_buffer
instanceof
ConstantStringBlock
))
{
throw
new
BlockException
(
blockId
,
uiMessageBundle
.
getString
(
"ardublock.error_msg.string_var_slot"
));
}
return
"itoa("
+
intValue
+
")"
;
return
"itoa("
+
intValue
+
"
, "
+
charBuffer
+
", 10
)"
;
}
}
This diff is collapsed.
Click to expand it.
src/main/resources/com/ardublock/block/ardublock.xml
+
3
−
0
View file @
d0ae58c0
...
...
@@ -1491,6 +1491,9 @@
</description>
<BlockConnectors>
<BlockConnector
connector-type=
"string"
connector-kind=
"plug"
/>
<BlockConnector
connector-type=
"string"
connector-kind=
"socket"
>
<DefaultArg
genus-name=
"variable_string"
label=
"buffer"
/>
</BlockConnector>
<BlockConnector
connector-type=
"number"
connector-kind=
"socket"
/>
</BlockConnectors>
</BlockGenus>
...
...
...
...
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
sign in
to comment