-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
123 changed files
with
2,513 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
apps/halcsd/src/systemd/sysfiles/usr/local/share/halcs/scripts/generate-board-halcs-idx.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
INPUT=$1 | ||
|
||
INSTANCE_IDX=$(echo ${INPUT} | sed 's|.*-||g') | ||
BOARD_IDX=$(expr ${INSTANCE_IDX} / 2 + ${INSTANCE_IDX} % 2) | ||
HALCS_IDX=$(expr 1 - ${INSTANCE_IDX} % 2) | ||
|
||
# Output space-separated indexes | ||
echo ${INSTANCE_IDX} ${BOARD_IDX} ${HALCS_IDX} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
buildSrc/src/main/groovy/br/lnls/dig/gradle/sedtask/Command.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package br.lnls.dig.gradle.sedtask | ||
|
||
interface Command { | ||
void apply(StringBuffer buffer, CommandCursor commandPosition) | ||
} |
26 changes: 26 additions & 0 deletions
26
buildSrc/src/main/groovy/br/lnls/dig/gradle/sedtask/CommandCursor.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package br.lnls.dig.gradle.sedtask | ||
|
||
class CommandCursor { | ||
private ArrayList<Command> commands | ||
private int commandIndex = 0 | ||
|
||
CommandCursor(ArrayList<Command> commands) { | ||
this.commands = commands | ||
} | ||
|
||
void next() { | ||
commandIndex += 1 | ||
} | ||
|
||
void advance(int count) { | ||
commandIndex += count | ||
} | ||
|
||
Command getCurrentCommand() { | ||
return commands.get(commandIndex) | ||
} | ||
|
||
boolean finished() { | ||
return commandIndex == commands.size() | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
buildSrc/src/main/groovy/br/lnls/dig/gradle/sedtask/ConditionalCommand.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package br.lnls.dig.gradle.sedtask | ||
|
||
abstract class ConditionalCommand implements Command { | ||
int commandCount = 0 | ||
|
||
public void apply(StringBuffer buffer, CommandCursor commandPosition) { | ||
if (conditionResult(buffer) != true) | ||
commandPosition.advance(commandCount) | ||
|
||
commandPosition.next() | ||
} | ||
|
||
protected abstract boolean conditionResult(StringBuffer buffer) | ||
} |
23 changes: 23 additions & 0 deletions
23
buildSrc/src/main/groovy/br/lnls/dig/gradle/sedtask/ReplaceCommand.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package br.lnls.dig.gradle.sedtask | ||
|
||
import java.util.regex.Pattern | ||
|
||
class ReplaceCommand implements Command { | ||
private Pattern pattern | ||
private String replacement | ||
|
||
ReplaceCommand(Pattern pattern, String replacement) { | ||
this.pattern = pattern | ||
this.replacement = replacement | ||
} | ||
|
||
void apply(StringBuffer buffer, CommandCursor commandPosition) { | ||
String line = buffer.toString() | ||
String updatedLine = pattern.matcher(line).replaceFirst(replacement) | ||
|
||
buffer.delete(0, buffer.length()) | ||
buffer.append(updatedLine) | ||
|
||
commandPosition.next() | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
buildSrc/src/main/groovy/br/lnls/dig/gradle/sedtask/SedCommands.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package br.lnls.dig.gradle.sedtask | ||
|
||
import java.util.regex.Pattern | ||
|
||
class SedCommands { | ||
private List<Command> commands | ||
|
||
SedCommands(List<Command> commands) { | ||
this.commands = commands | ||
} | ||
|
||
void when(Pattern pattern, Closure commandBlock) { | ||
WhenCommand command = new WhenCommand(pattern) | ||
int commandBlockStart = commands.size() + 1 | ||
|
||
commands.add(command) | ||
|
||
commandBlock.resolveStrategy = Closure.DELEGATE_FIRST | ||
commandBlock.delegate = this | ||
commandBlock() | ||
|
||
int commandBlockEnd = commands.size() | ||
int commandBlockSize = commandBlockEnd - commandBlockStart | ||
|
||
command.commandCount = commandBlockSize | ||
} | ||
|
||
void replace(Pattern pattern, String replacement) { | ||
commands.add(new ReplaceCommand(pattern, replacement)) | ||
} | ||
} |
Oops, something went wrong.