Skip to content

Commit

Permalink
update(fildesh): without getline_FildeshX()
Browse files Browse the repository at this point in the history
  • Loading branch information
grencez committed Feb 12, 2024
1 parent c412ade commit b9c4507
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 30 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bazel_dep(name = "rules_peg", version = "0.1.18")
git_override(
module_name = "fildesh",
remote = "https://github.com/fildesh/fildesh.git",
commit="fc27c09ec95a94f434348ea014bf6ccda92ad01f",
commit="9defdbec27700e01888d0834015e28947baba7cd",
)
git_override(
module_name = "mdd-glu",
Expand Down
2 changes: 1 addition & 1 deletion dep/cmake_fetchcontent/fildesh.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FetchContent_Declare(
Fildesh
GIT_REPOSITORY "https://github.com/fildesh/fildesh.git"
GIT_TAG "fc27c09ec95a94f434348ea014bf6ccda92ad01f"
GIT_TAG "9defdbec27700e01888d0834015e28947baba7cd"
)
FetchContent_MakeAvailable(Fildesh)
28 changes: 9 additions & 19 deletions src/opt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,16 @@ static
std::string
pathname2(std::string_view opt_dir, std::string_view filename)
{
const auto slash_index = filename.rfind('/');
const unsigned pflen = (slash_index < filename.size() ? slash_index+1 : 0);
const unsigned flen = filename.size() - pflen;
unsigned plen = opt_dir.size();

if (pflen > 0 && filename[0] == '/') {
plen = 0;
}

if (plen > 0 && opt_dir[plen-1] != '/') {
plen += 1;
}

std::string pathname;
if (plen > 0) {
pathname += opt_dir.substr(0, plen-1);
pathname += '/';
fildesh::ostringstream oss;
oss << opt_dir;
if (!oss.view().empty()) {
if (oss.view().back() != '/') {
oss << '/';
}
}
pathname += filename.substr(0, pflen+flen);
return pathname;
sibling_pathname_bytestring_FildeshO(
oss.c_struct(), (const unsigned char*)filename.data(), filename.size());
return oss.str();
}

static
Expand Down
5 changes: 3 additions & 2 deletions src/pla.cc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ oput_protocon_pc_acts_espresso_spawn(std::ostream& out, const Xn::PcSymm& pc_sym
if (istat == 0) {
from_espresso = open_fd_FildeshX(from_espresso_fd);
while (!skipstr_FildeshX(from_espresso, ".p")) {
if (!getline_FildeshX(from_espresso)) {
FildeshX slice = sliceline_FildeshX(from_espresso);
if (!slice.at) {
fildesh_log_error("espresso output finished early");
istat = -1;
break;
Expand All @@ -243,7 +244,7 @@ oput_protocon_pc_acts_espresso_spawn(std::ostream& out, const Xn::PcSymm& pc_sym
fildesh_log_error("Cannot parse number of lines");
istat = -1;
}
getline_FildeshX(from_espresso);
sliceline_FildeshX(from_espresso);
}

for (int i = 0; istat == 0 && i < n; ++i) {
Expand Down
9 changes: 6 additions & 3 deletions src/satsyn/dimacs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ oput_dimacs_CnfFmla(FildeshO* out, const CnfFmla* fmla)
void
xget_dimacs_result (FildeshX* in, bool* sat, BitTable evs)
{
const char* line = getline_FildeshX(in);
FildeshX slice = sliceline_FildeshX(in);
wipe_BitTable (evs, 0);
if (!line) {
if (!slice.at) {
*sat = false;
DBog0( "No output!" );
return;
}
if (0 == strcmp(line, "UNSAT") || 0 == strcmp(line, "unsat")) {
if (0 == fildesh_compare_bytestring(
bytestring_of_FildeshX(&slice), fildesh_bytestrlit("UNSAT")) ||
0 == fildesh_compare_bytestring(
bytestring_of_FildeshX(&slice), fildesh_bytestrlit("unsat"))) {
*sat = false;
}
else {
Expand Down
2 changes: 1 addition & 1 deletion test/examplesoln/UDP_TokenRingRand_test.fildesh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@

|< protocon -nop -x $(XOF TokenRingRand_file) -param N 10 -o-udp-include -
|- cmp $(XOF expect_file)
|> stderr
|> stdout

6 changes: 3 additions & 3 deletions test/uni/ppgfun_livelock_test.fildesh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ zec -o $(OF expect) / "livelock\tperiod:6\n" /
|- xlate -x-list - -o-id -
|- classify 6 -domsz 14
|- cmp - $(XF expect)
|> stderr
|> stdout

$(barrier)

Expand Down Expand Up @@ -68,12 +68,12 @@ zec -o $(OF expect) / "${expect_output_content}" /
|< zec / "${interactive_input_content}" /
|- protocon -interactive -x $(XF protocon_file)
|- cmp - $(XF expect)
|> stderr
|> stdout

$(barrier)

|< zec / "${ppgfun}" /
|- xlate -x-list - -cutoff 6 -o-svg-livelock $(OF void)
|> stderr
|> stdout

void $(X void)

0 comments on commit b9c4507

Please sign in to comment.