From 123178c34092a681782242c0b99fd88cf697aa76 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Wed, 1 Feb 2023 12:36:23 +0100 Subject: [PATCH] Remove emu prefix from player --- src/emu/CMakeLists.txt | 2 +- src/emu/emu.c | 10 +++++----- src/emu/emu.h | 4 ++-- src/emu/{emu_player.c => player.c} | 22 +++++++++++----------- src/emu/{emu_player.h => player.h} | 10 +++++----- 5 files changed, 24 insertions(+), 24 deletions(-) rename src/emu/{emu_player.c => player.c} (83%) rename src/emu/{emu_player.h => player.h} (60%) diff --git a/src/emu/CMakeLists.txt b/src/emu/CMakeLists.txt index bd289e6..4088504 100644 --- a/src/emu/CMakeLists.txt +++ b/src/emu/CMakeLists.txt @@ -18,7 +18,7 @@ add_library(emu STATIC emu_args.c emu_ev.c emu_model.c - emu_player.c + player.c stream.c trace.c loom.c diff --git a/src/emu/emu.c b/src/emu/emu.c index c7b6acb..b6d7a3f 100644 --- a/src/emu/emu.c +++ b/src/emu/emu.c @@ -45,7 +45,7 @@ emu_init(struct emu *emu, int argc, char *argv[]) return -1; } - if (emu_player_init(&emu->player, &emu->trace) != 0) { + if (player_init(&emu->player, &emu->trace) != 0) { err("emu_init: cannot init player for trace '%s'\n", emu->args.tracedir); return -1; @@ -84,8 +84,8 @@ emu_connect(struct emu *emu) static void set_current(struct emu *emu) { - emu->ev = emu_player_ev(&emu->player); - emu->stream = emu_player_stream(&emu->player); + emu->ev = player_ev(&emu->player); + emu->stream = player_stream(&emu->player); struct lpt *lpt = system_get_lpt(emu->stream); emu->loom = lpt->loom; emu->proc = lpt->proc; @@ -120,7 +120,7 @@ panic(struct emu *emu) int emu_step(struct emu *emu) { - int ret = emu_player_step(&emu->player); + int ret = player_step(&emu->player); /* No more events */ if (ret > 0) @@ -128,7 +128,7 @@ emu_step(struct emu *emu) /* Error happened */ if (ret < 0) { - err("emu_player_step failed"); + err("player_step failed"); return -1; } diff --git a/src/emu/emu.h b/src/emu/emu.h index d800b2b..8e184c6 100644 --- a/src/emu/emu.h +++ b/src/emu/emu.h @@ -8,7 +8,7 @@ #include "trace.h" #include "emu_args.h" #include "system.h" -#include "emu_player.h" +#include "player.h" #include "emu_model.h" #include "emu_ev.h" #include "recorder.h" @@ -24,7 +24,7 @@ struct emu { struct emu_args args; struct trace trace; struct system system; - struct emu_player player; + struct player player; struct emu_model model; struct recorder recorder; diff --git a/src/emu/emu_player.c b/src/emu/player.c similarity index 83% rename from src/emu/emu_player.c rename to src/emu/player.c index 1eb6da7..3335576 100644 --- a/src/emu/emu_player.c +++ b/src/emu/player.c @@ -1,4 +1,4 @@ -#include "emu_player.h" +#include "player.h" #include "heap.h" #include "utlist.h" @@ -33,7 +33,7 @@ stream_cmp(heap_node_t *a, heap_node_t *b) } static int -step_stream(struct emu_player *player, struct stream *stream) +step_stream(struct player *player, struct stream *stream) { if (!stream->active) return +1; @@ -54,9 +54,9 @@ step_stream(struct emu_player *player, struct stream *stream) } int -emu_player_init(struct emu_player *player, struct trace *trace) +player_init(struct player *player, struct trace *trace) { - memset(player, 0, sizeof(struct emu_player)); + memset(player, 0, sizeof(struct player)); heap_init(&player->heap); @@ -71,7 +71,7 @@ emu_player_init(struct emu_player *player, struct trace *trace) /* No more events */ continue; } else if (ret < 0) { - err("emu_player_init: step_stream failed\n"); + err("player_init: step_stream failed\n"); return -1; } } @@ -80,7 +80,7 @@ emu_player_init(struct emu_player *player, struct trace *trace) } static int -update_clocks(struct emu_player *player, struct stream *stream) +update_clocks(struct player *player, struct stream *stream) { /* This can happen if two events are not ordered in the stream, but the * emulator picks other events in the middle. Example: @@ -118,7 +118,7 @@ update_clocks(struct emu_player *player, struct stream *stream) /* Returns -1 on error, +1 if there are no more events and 0 if next event * loaded properly */ int -emu_player_step(struct emu_player *player) +player_step(struct player *player) { /* Add the stream back if still active */ if (player->stream != NULL && step_stream(player, player->stream) < 0) { @@ -136,12 +136,12 @@ emu_player_step(struct emu_player *player) struct stream *stream = heap_elem(node, struct stream, hh); if (stream == NULL) { - err("emu_player_step: heap_elem() returned NULL\n"); + err("player_step: heap_elem() returned NULL\n"); return -1; } if (update_clocks(player, stream) != 0) { - err("emu_player_step: update_clocks() failed\n"); + err("player_step: update_clocks() failed\n"); return -1; } @@ -155,13 +155,13 @@ emu_player_step(struct emu_player *player) } struct emu_ev * -emu_player_ev(struct emu_player *player) +player_ev(struct player *player) { return &player->ev; } struct stream * -emu_player_stream(struct emu_player *player) +player_stream(struct player *player) { return player->stream; } diff --git a/src/emu/emu_player.h b/src/emu/player.h similarity index 60% rename from src/emu/emu_player.h rename to src/emu/player.h index bd9c3cf..72f5f02 100644 --- a/src/emu/emu_player.h +++ b/src/emu/player.h @@ -9,7 +9,7 @@ #include -struct emu_player { +struct player { heap_head_t heap; int64_t firstclock; int64_t lastclock; @@ -19,9 +19,9 @@ struct emu_player { struct emu_ev ev; }; -int emu_player_init(struct emu_player *player, struct trace *trace); -int emu_player_step(struct emu_player *player); -struct emu_ev *emu_player_ev(struct emu_player *player); -struct stream *emu_player_stream(struct emu_player *player); +int player_init(struct player *player, struct trace *trace); +int player_step(struct player *player); +struct emu_ev *player_ev(struct player *player); +struct stream *player_stream(struct player *player); #endif /* EMU_PLAYER_H */