Skip to content

Commit

Permalink
WIP: Delete stale eager_endid code, replaced by eager_output.
Browse files Browse the repository at this point in the history
This can get squashed away in a rebase.
  • Loading branch information
silentbicycle committed Sep 24, 2024
1 parent 4f7f789 commit 19245f0
Show file tree
Hide file tree
Showing 22 changed files with 0 additions and 2,077 deletions.
1 change: 0 additions & 1 deletion src/libfsm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ SRC += src/libfsm/complete.c
SRC += src/libfsm/consolidate.c
SRC += src/libfsm/clone.c
SRC += src/libfsm/closure.c
SRC += src/libfsm/eager_endid.c
SRC += src/libfsm/eager_output.c
SRC += src/libfsm/edge.c
SRC += src/libfsm/empty.c
Expand Down
35 changes: 0 additions & 35 deletions src/libfsm/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "internal.h"
#include "capture.h"
#include "endids.h"
#include "eager_endid.h"
#include "eager_output.h"

#define LOG_CLONE_ENDIDS 0
Expand All @@ -30,9 +29,6 @@ copy_capture_actions(struct fsm *dst, const struct fsm *src);
static int
copy_end_ids(struct fsm *dst, const struct fsm *src);

static int
copy_eager_end_ids(struct fsm *dst, const struct fsm *src);

static int
copy_eager_output_ids(struct fsm *dst, const struct fsm *src);

Expand Down Expand Up @@ -90,11 +86,6 @@ fsm_clone(const struct fsm *fsm)
}

/* does not copy callback */
if (!copy_eager_end_ids(new, fsm)) {
fsm_free(new);
return NULL;
}

if (!copy_eager_output_ids(new, fsm)) {
fsm_free(new);
return NULL;
Expand Down Expand Up @@ -179,32 +170,6 @@ copy_end_ids(struct fsm *dst, const struct fsm *src)
return env.ok;
}

static int
copy_eager_end_ids_cb(fsm_state_t from, fsm_state_t to, fsm_end_id_t id, void *opaque)
{
struct copy_end_ids_env *env = opaque;
assert(env->tag == 'E');
if (!fsm_eager_endid_insert_entry(env->dst, from, to, id)) {
env->ok = false;
return 0;
}

return 1;
}

static int
copy_eager_end_ids(struct fsm *dst, const struct fsm *src)
{
struct copy_end_ids_env env;
env.tag = 'E'; /* for 'E'ager endids */
env.dst = dst;
env.src = src;
env.ok = 1;

fsm_eager_endid_iter_edges_all(src, copy_eager_end_ids_cb, &env);
return env.ok;
}

struct copy_eager_output_ids_env {
bool ok;
struct fsm *dst;
Expand Down
50 changes: 0 additions & 50 deletions src/libfsm/consolidate.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "internal.h"
#include "capture.h"
#include "endids.h"
#include "eager_endid.h"
#include "eager_output.h"

#define LOG_MAPPING 0
Expand Down Expand Up @@ -55,10 +54,6 @@ static int
consolidate_end_ids(struct fsm *dst, const struct fsm *src,
const fsm_state_t *mapping, size_t mapping_count);

static int
consolidate_eager_end_ids(struct fsm *dst, const struct fsm *src,
const fsm_state_t *mapping, size_t mapping_count);

static int
consolidate_eager_output_ids(struct fsm *dst, const struct fsm *src,
const fsm_state_t *mapping, size_t mapping_count);
Expand Down Expand Up @@ -164,10 +159,6 @@ fsm_consolidate(const struct fsm *src,
}
}

if (!consolidate_eager_end_ids(dst, src, mapping, mapping_count)) {
goto cleanup;
}

if (!consolidate_eager_output_ids(dst, src, mapping, mapping_count)) {
goto cleanup;
}
Expand Down Expand Up @@ -289,47 +280,6 @@ consolidate_end_ids(struct fsm *dst, const struct fsm *src,
return ret;
}

struct consolidate_eager_end_ids_env {
bool ok;
struct fsm *dst;
const fsm_state_t *mapping;
size_t mapping_count;
};

static int
consolidate_eager_end_ids_cb(fsm_state_t from, fsm_state_t to, fsm_end_id_t id, void *opaque)
{
struct consolidate_eager_end_ids_env *env = opaque;
assert(from < env->mapping_count);
assert(to < env->mapping_count);

const fsm_state_t dst_from = env->mapping[from];
const fsm_state_t dst_to = env->mapping[to];

if (!fsm_eager_endid_insert_entry(env->dst,
dst_from, dst_to, id)) {
env->ok = false;
return 0;
}

return 1;
}

static int
consolidate_eager_end_ids(struct fsm *dst, const struct fsm *src,
const fsm_state_t *mapping, size_t mapping_count)
{
struct consolidate_eager_end_ids_env env = {
.ok = true,
.dst = dst,
.mapping = mapping,
.mapping_count = mapping_count,
};
fsm_eager_endid_iter_edges_all(src,
consolidate_eager_end_ids_cb, &env);
return env.ok;
}

struct consolidate_eager_output_ids_env {
bool ok;
struct fsm *dst;
Expand Down
Loading

0 comments on commit 19245f0

Please sign in to comment.