Skip to content

Commit 2bb12b5

Browse files
committed
submit command extracts a-number
1 parent 84807b7 commit 2bb12b5

File tree

7 files changed

+32
-16
lines changed

7 files changed

+32
-16
lines changed

CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@ To install or update LODA, please follow the [installation instructions](https:/
22

33
## [Unreleased]
44

5-
### Enhancements
6-
7-
* Incremental evaluation (IE) partially supports programs with non-commutative updates of output cells. IE is supported for 5200 programs now.
8-
* Store default values in `setup.txt`
5+
## v22.3.11
96

107
### Features
118

129
* Parallel mining with custom number of instances: `-P <number>`
1310
* Short-hand parameter for b-file output with offset 0: `-b`
11+
* `submit` command extracts A-number from comment in programs
12+
13+
### Enhancements
14+
15+
* Incremental evaluation (IE) partially supports programs with non-commutative updates of output cells. IE is supported for 5200 programs now.
16+
* Store default values in `setup.txt`
1417

1518
## v22.2.17
1619

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ To mine programs for OEIS sequences, you can run `loda mine` (single-core) or `l
2626
The `loda` command-line tool provides the following commands and options:
2727

2828
```
29-
Welcome to LODA developer version. More information at https://loda-lang.org
29+
Welcome to LODA developer version. More information at https://loda-lang.org/
3030
3131
Usage: loda <command> <options>
3232
@@ -37,9 +37,9 @@ Core Commands:
3737
setup Run interactive setup to configure LODA
3838
3939
OEIS Commands:
40-
mine Mine programs for OEIS sequences (see -i)
40+
mine Mine programs for OEIS sequences (see -i,-p)
4141
check <id> Check a program for an OEIS sequence (see -b)
42-
submit <id> <file> Submit a program for an OEIS sequence
42+
submit <file> [id] Submit a program for an OEIS sequence
4343
4444
Targets:
4545
<file> Path to a LODA file (file extension: *.asm)
@@ -48,12 +48,15 @@ Targets:
4848
4949
Options:
5050
-t <number> Number of sequence terms (default: 10)
51-
-b <number> Print result in b-file format from a given offset
51+
-b Print result in b-file format from offset 0
52+
-B <number> Print result in b-file format from a custom offset
5253
-s Evaluate program to number of execution steps
5354
-c <number> Maximum number of interpreter cycles (no limit: -1)
5455
-m <number> Maximum number of used memory cells (no limit: -1)
5556
-l <string> Log level (values: debug,info,warn,error,alert)
5657
-i <string> Name of miner configuration from miners.json
58+
-p Parallel mining using default number of instances
59+
-P <number> Parallel mining using custom number of instances
5760
```
5861

5962
### Core Commands

src/commands.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void Commands::help() {
5252
std::cout << " check <id> Check a program for an OEIS sequence "
5353
"(see -b)"
5454
<< std::endl;
55-
std::cout << " submit <id> <file> Submit a program for an OEIS sequence"
55+
std::cout << " submit <file> [id] Submit a program for an OEIS sequence"
5656
<< std::endl;
5757
std::cout << std::endl << "Targets:" << std::endl;
5858
std::cout
@@ -168,10 +168,10 @@ void Commands::mine() {
168168
miner.mine();
169169
}
170170

171-
void Commands::submit(const std::string& id, const std::string& path) {
171+
void Commands::submit(const std::string& path, const std::string& id) {
172172
initLog(false);
173173
Miner miner(settings);
174-
miner.submit(id, path);
174+
miner.submit(path, id);
175175
}
176176

177177
// hidden commands (only in development versions)

src/include/commands.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class Commands {
2424

2525
void mine();
2626

27-
void submit(const std::string& id, const std::string& path);
27+
void submit(const std::string& path, const std::string& id);
2828

2929
// hidden commands (only in development versions)
3030

src/include/miner.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Miner {
2828

2929
void mine();
3030

31-
void submit(const std::string &id, const std::string &path);
31+
void submit(const std::string &path, std::string id);
3232

3333
private:
3434
void checkRegularTasks();

src/main.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,14 @@ int dispatch(Settings settings, const std::vector<std::string>& args) {
125125
commands.mine();
126126
}
127127
} else if (cmd == "submit") {
128-
if (args.size() != 3) {
128+
if (args.size() == 2) {
129+
commands.submit(args.at(1), "");
130+
} else if (args.size() == 3) {
131+
commands.submit(args.at(1), args.at(2));
132+
} else {
129133
std::cout << "invalid number of arguments" << std::endl;
130134
return 1;
131135
}
132-
commands.submit(args.at(1), args.at(2));
133136
}
134137
#ifdef _WIN64
135138
// hidden helper command for updates on windows

src/miner.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,18 @@ void Miner::checkRegularTasks() {
205205
}
206206
}
207207

208-
void Miner::submit(const std::string &id, const std::string &path) {
208+
void Miner::submit(const std::string &path, std::string id) {
209209
Parser parser;
210210
auto program = parser.parse(path);
211211
ConfigLoader::MAINTAINANCE_MODE = true;
212212
reload();
213+
if (id.empty() && program.ops.size() > 0 && !program.ops[0].comment.empty()) {
214+
id = program.ops[0].comment;
215+
auto n = id.find(':');
216+
if (n != std::string::npos) {
217+
id = id.substr(0, n);
218+
}
219+
}
213220
OeisSequence seq(id);
214221
Settings settings(this->settings);
215222
settings.print_as_b_file = false;

0 commit comments

Comments
 (0)