Skip to content

Commit

Permalink
Code revision are enh. #967 adoption, comments damaged by code reform…
Browse files Browse the repository at this point in the history
…atting restored.
  • Loading branch information
codemanyak committed Apr 9, 2021
1 parent bfbaa46 commit dec5a8f
Show file tree
Hide file tree
Showing 4 changed files with 10,992 additions and 11,138 deletions.
63 changes: 49 additions & 14 deletions src/lu/fisch/structorizer/generators/ArmGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@

package lu.fisch.structorizer.generators;

/******************************************************************************************************
*
* Author: Alessandro Simonetta et al.
*
* Description: Generaor class
*
******************************************************************************************************
*
* Revision List
*
* Author Date Description
* ------ ---- -----------
* See @author 2021-03-25 Provided per Pull request on Enh. #96
* A. Simonetta 2021-04-02 Several revisions as requested
* Kay Gürtzig 2020-04-09 Syntax correction, some adaptations to fit into Structorizer environment
*
******************************************************************************************************
*
* Comment:
*
******************************************************************************************************///

import lu.fisch.structorizer.elements.*;
import lu.fisch.utils.StringList;

Expand All @@ -31,12 +53,12 @@
import java.util.regex.Pattern;

/**
* Description: This class generates ARM code.
* @author Daniele De Menna
* @author Robert Dorinel Milos
* @author Alessandro Simonetta,
* @author Giulio Palumbo
* @author Maurizio Fiusco
* Description: This class generates ARM code.
*/
public class ArmGenerator extends Generator {

Expand Down Expand Up @@ -630,39 +652,52 @@ private void generateInstructionLine(String line, boolean isDisabled) {
String newline;
ARM_OPERATIONS mode = getMode(line);

if (mode == ARM_OPERATIONS.ASSIGNMENT) {
switch (mode) {
case ASSIGNMENT:
newline = variablesToRegisters(line);
generateAssignment(newline, isDisabled);
} else if (mode == ARM_OPERATIONS.EXPRESSION) {
break;
case EXPRESSION:
newline = variablesToRegisters(line);
generateExpr(newline, isDisabled);
} else if (mode == ARM_OPERATIONS.MEMORY) {
break;
case MEMORY:
newline = variablesToRegisters(line);
generateMemoryAssignment(newline, isDisabled);
} else if (mode == ARM_OPERATIONS.ARRAY_EXPRESSION) {
break;
case ARRAY_EXPRESSION:
newline = variablesToRegisters(line);
generateArrayExpr(newline, isDisabled);
} else if (mode == ARM_OPERATIONS.ARRAY_ASSIGNMENT) {
break;
case ARRAY_ASSIGNMENT:
newline = variablesToRegisters(line);
generateArrayAssignment(newline, isDisabled);
} else if (mode == ARM_OPERATIONS.ARRAY_INITIALIZATION) {
break;
case ARRAY_INITIALIZATION:
generateArrayInitialization(line, isDisabled);
} else if (mode == ARM_OPERATIONS.ADDRESS) {
break;
case ADDRESS:
generateAddressAssignment(line, isDisabled);
} else if (mode == ARM_OPERATIONS.BOOLEAN_ASSIGNMENT) {
break;
case BOOLEAN_ASSIGNMENT:
newline = variablesToRegisters(line);
generateAssignment(newline.replace("true", "1").replace("false", "0"), isDisabled);
} else if (mode == ARM_OPERATIONS.STRING_ARRAY_INITIALIZATION) {
break;
case STRING_ARRAY_INITIALIZATION:
newline = variablesToRegisters(line);
generateString(newline, isDisabled);
} else if (mode == ARM_OPERATIONS.CHAR_ARRAY_INITIALIZATION) {
break;
case CHAR_ARRAY_INITIALIZATION:
newline = variablesToRegisters(line);
generateAssignment(newline.replace("\"", "'"), isDisabled);
} else if (mode == ARM_OPERATIONS.INSTRUCTION) {
break;
case INSTRUCTION:
newline = variablesToRegisters(line);
addCode(newline, getIndent(), isDisabled);
} else if (mode == ARM_OPERATIONS.NOT_IMPLEMENTED) {
break;
case NOT_IMPLEMENTED:
appendComment("Error: Not implemented yet\n" + line, getIndent());
break;
}
}

Expand Down Expand Up @@ -1526,6 +1561,6 @@ private String[] parseExpression(String expression) {

result.add(item.toString());

return result.toArray(String[]::new);
return result.toArray(new String[result.size()]);
}
}
Loading

0 comments on commit dec5a8f

Please sign in to comment.