Commit 01b92a6873591d91aaef574cd83527a9b2a9bef4

Thomas de Grivel 2023-01-30T17:13:03

shutdown -> clean

diff --git a/c3s/c3s.c b/c3s/c3s.c
index 129b6a3..0198494 100644
--- a/c3s/c3s.c
+++ b/c3s/c3s.c
@@ -61,9 +61,7 @@ sw buf_xfer_spaces (s_buf *out, s_buf *in)
 
 int main (int argc, char **argv)
 {
-  s_module c3;
   s_env env;
-  s_facts facts;
   s8 i[BUF_SIZE];
   s_buf in;
   s_tag input;
@@ -71,9 +69,7 @@ int main (int argc, char **argv)
   s_buf out;
   sw r;
   s_tag result;
-  libc3_init();
-  facts_init(&facts);
-  c3_init(&c3, &facts);
+  c3_init();
   if (argc < 1)
     return usage(argv[0]);
   buf_init(&in, false, sizeof(i), i);
@@ -108,9 +104,7 @@ int main (int argc, char **argv)
   env_clean(&env);
   buf_readline_close(&in);
   buf_file_close(&out);
-  c3_clean(&c3);
-  facts_clean(&facts);
-  libc3_shutdown();
+  c3_clean();
   return 0;
 }
 
diff --git a/ic3/ic3.c b/ic3/ic3.c
index b43a2e8..5555b90 100644
--- a/ic3/ic3.c
+++ b/ic3/ic3.c
@@ -61,9 +61,7 @@ sw buf_xfer_spaces (s_buf *out, s_buf *in)
 
 int main (int argc, char **argv)
 {
-  s_module c3;
   s_env env;
-  s_facts facts;
   s8 i[BUF_SIZE];
   s_buf in;
   s_tag input;
@@ -71,9 +69,7 @@ int main (int argc, char **argv)
   s_buf out;
   sw r;
   s_tag result;
-  libc3_init();
-  facts_init(&facts);
-  c3_init(&c3, &facts);
+  c3_init();
   if (argc < 1)
     return usage(argv[0]);
   buf_init(&in, false, sizeof(i), i);
@@ -107,9 +103,7 @@ int main (int argc, char **argv)
   env_clean(&env);
   buf_linenoise_close(&in);
   buf_file_close(&out);
-  c3_clean(&c3);
-  facts_clean(&facts);
-  libc3_shutdown();
+  c3_clean();
   return 0;
 }
 
diff --git a/libc3/c3.c b/libc3/c3.c
index e18f43a..5e29d93 100644
--- a/libc3/c3.c
+++ b/libc3/c3.c
@@ -18,7 +18,7 @@
 
 s_env g_c3_env = {0};
 
-void libc3_init ()
+void c3_init ()
 {
   env_init(&g_c3_env);
 #ifdef DEBUG
@@ -27,12 +27,12 @@ void libc3_init ()
 #endif
 }
 
-void libc3_shutdown ()
+void c3_clean ()
 {
-  sym_delete_all();
-  env_clean(&g_c3_env);
 #ifdef DEBUG
   buf_file_close(&g_debug_buf);
   buf_clean(&g_debug_buf);
 #endif
+  sym_delete_all();
+  env_clean(&g_c3_env);
 }
diff --git a/libc3/c3.h b/libc3/c3.h
index 7064c80..c174f33 100644
--- a/libc3/c3.h
+++ b/libc3/c3.h
@@ -42,8 +42,7 @@
 
 extern s_env g_c3_env;
 
-/* libc3 */
-void libc3_init ();
-void libc3_shutdown ();
+void c3_init ();
+void c3_clean ();
 
 #endif /* C3_H */
diff --git a/test/libc3_test.c b/test/libc3_test.c
index 05199f9..ed15289 100644
--- a/test/libc3_test.c
+++ b/test/libc3_test.c
@@ -40,7 +40,7 @@ void types_test ();
 int main (int argc, char **argv)
 {
   test_init(argc, argv);
-  libc3_init();
+  c3_init();
   if (test_target("types")) {
     printf("\ntypes\n");
     types_test();
@@ -130,7 +130,7 @@ int main (int argc, char **argv)
     facts_with_test();
   }
   test_summary();
-  test_shutdown();
-  libc3_shutdown();
+  test_clean();
+  c3_clean();
   return 0;
 }
diff --git a/test/test.c b/test/test.c
index 987ad72..172f823 100644
--- a/test/test.c
+++ b/test/test.c
@@ -30,6 +30,10 @@ char         g_test_targets_env[TARGETS_MAX * TARGET_NAME_MAX];
 char        *g_test_targets_env_v[TARGETS_MAX + 1];
 const char **g_test_targets = {NULL};
 
+void test_clean ()
+{
+}
+
 void test_context (const char *context)
 {
   g_test_context = context;
@@ -136,10 +140,6 @@ void test_ok ()
   g_test_last_ok = 1;
 }
 
-void test_shutdown ()
-{
-}
-
 void test_summary ()
 {
   fprintf(stderr, "\n");
diff --git a/test/test.h b/test/test.h
index 2b3e151..4bf2dea 100644
--- a/test/test.h
+++ b/test/test.h
@@ -145,12 +145,12 @@ extern long         g_test_last_ok;
 extern long         g_test_ok;
 extern const char **g_test_targets;
 
+void test_clean ();
 void test_context (const char *context);
 int  test_file_compare (const char *path_a, const char *path_b);
 void test_init (int argc, char **argv);
 void test_ko ();
 void test_ok ();
-void test_shutdown ();
 void test_summary ();
 int  test_target (const char *target);