]> feistymeow.org Git - feisty_meow.git/commitdiff
cromp decoder and test cromp client compiling
authorFred T. Hamster <fred@feistymeow.org>
Sun, 15 Feb 2026 02:03:23 +0000 (21:03 -0500)
committerFred T. Hamster <fred@feistymeow.org>
Sun, 15 Feb 2026 02:03:23 +0000 (21:03 -0500)
octopi/library/tests_cromp/cromp_decoder.cpp
octopi/library/tests_cromp/crompish_pax.h
octopi/library/tests_cromp/makefile
octopi/library/tests_cromp/makefile.decoder
octopi/library/tests_cromp/test_cromp_client.cpp
octopi/library/tests_cromp/test_cromp_server.cpp

index 6e9ff9e672e70c786dd2cb207235e83ab9023526..1355f9ba488d003c2c8d9c1267a3866a97873365 100644 (file)
 * Please send any updates to: fred@gruntose.com                               *
 \*****************************************************************************/
 
-#include <basis/istring.h>
+#include <application/application_shell.h>
+#include <application/hoople_main.h>
+#include <basis/astring.h>
 #include <cromp/cromp_common.h>
-#include <octopus/entity_defs.h>
-#include <opsystem/application_shell.h>
+#include <loggers/program_wide_logger.h>
 #include <loggers/console_logger.h>
 #include <loggers/file_logger.h>
-#include <data_struct/static_memory_gremlin.h>
+#include <octopus/entity_defs.h>
 #include <sockets/machine_uid.h>
-#include <textual/byte_format.h>
+#include <structures/static_memory_gremlin.h>
+#include <textual/byte_formatter.h>
+#include <unit_test/unit_base.h>
 
 #include <stdio.h>
 
-#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger(), s)
-#define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger(), s)
+using namespace application;
+using namespace basis;
+using namespace configuration;
+using namespace cromp;
+using namespace mathematics;
+using namespace filesystem;
+using namespace loggers;
+using namespace octopi;
+using namespace processes;
+using namespace sockets;
+using namespace structures;
+using namespace textual;
+using namespace timely;
+using namespace unit_test;
+
+#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
+#define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger::get(), astring(s))
 
 const int MAX_LINE = 2048;
   // the longest line we'll bother to try to process.
 
-class cromp_decoder : public application_shell
+class cromp_decoder : virtual public unit_base, virtual public application_shell
 {
 public:
   cromp_decoder();
@@ -38,12 +56,12 @@ public:
 
   virtual int execute();
 
-  IMPLEMENT_CLASS_NAME("cromp_decoder");
+  DEFINE_CLASS_NAME("cromp_decoder");
 };
 
-////////////////////////////////////////////////////////////////////////////
+//////////////
 
-cromp_decoder::cromp_decoder() : application_shell(class_name()) {}
+cromp_decoder::cromp_decoder() : application_shell() {}
 
 cromp_decoder::~cromp_decoder() {}
 
@@ -56,12 +74,12 @@ This application will decode a cromp entity and report the different values");
   BASE_LOG("\
 that are encoded into it.");
 
-  istring buffer;  // we'll read input from the user into this.
+  astring buffer;  // we'll read input from the user into this.
 
   while (true) {
     BASE_LOG("Please enter the entity (or hit just enter to exit).")
     
-    buffer = istring('\0', MAX_LINE + 10);  // reset the buffer.
+    buffer = astring('\0', MAX_LINE + 10);  // reset the buffer.
     char *buf2 = fgets(buffer.s(), MAX_LINE, stdin);
     if (buf2 != buffer.s()) {
       deadly_error(class_name(), func,
@@ -69,7 +87,7 @@ that are encoded into it.");
     }
 
     buffer.shrink();
-    buffer.strip("\r\n", istring::FROM_END);
+    buffer.strip("\r\n", astring::FROM_END);
     if (!buffer.length()) break;
 
     // make sure they didn't actually give us a request id.
@@ -87,26 +105,26 @@ that are encoded into it.");
     BASE_LOG("");
     BASE_LOG("Entity contains:");
     BASE_LOG("");
-    BASE_LOG(isprintf("\tProcess ID=%d", ent.process_id()));
-    BASE_LOG(isprintf("\tSequencer=%d", ent.sequencer()));
-    BASE_LOG(isprintf("\tChaotic Addin=%d", ent.add_in()));
+    BASE_LOG(a_sprintf("\tProcess ID=%d", ent.process_id()));
+    BASE_LOG(a_sprintf("\tSequencer=%d", ent.sequencer()));
+    BASE_LOG(a_sprintf("\tChaotic Addin=%d", ent.add_in()));
 
-    istring host;
+    astring host;
     machine_uid machine;
     bool worked = cromp_common::decode_host(ent.hostname(), host, machine);
     if (!worked) {
       BASE_LOG("Failed to decode the hostname!  Was it a valid entity?");
       continue;
     }
-    BASE_LOG(istring("\tPartial Hostname=") + host);
-    BASE_LOG(istring("\tMachine UID=") + machine.text_form());
+    BASE_LOG(astring("\tPartial Hostname=") + host);
+    BASE_LOG(astring("\tMachine UID=") + machine.text_form());
     BASE_LOG("");
   }
 
   return 0;
 }
 
-////////////////////////////////////////////////////////////////////////////
+//////////////
 
 HOOPLE_MAIN(cromp_decoder, )
 
index 5634e5917adf0e1240c433ef9c7d0b377e087810..03b35fa56faceaf564c12d4406449d676cb74a16 100644 (file)
 \*****************************************************************************/
 
 #include <cromp/cromp_transaction.h>
-#include <geometric/screen_rectangle.h>
 #include <mathematics/chaos.h>
 #include <octopus/infoton.h>
 #include <octopus/tentacle_helper.h>
 #include <structures/string_array.h>
 
-using namespace geometric;
-
 class bubble : public octopi::infoton
 {
 public:
-  bubble(int data_segment_size = 0, const screen_rectangle &boundaries
-      = screen_rectangle(), int color = 0)
+  bubble(int data_segment_size = 0, const structures::string_array &boundaries
+      = structures::string_array(), int color = 0)
     // constructs a bubble within the "boundaries" that has "color" and a data
     // segment size specified by "data_segment_size".  the color definitions
     // reside elsewhere.
@@ -45,7 +42,7 @@ public:
     return barray;
   }
 
-  void reset(int data_segment_size, const screen_rectangle &boundaries,
+  void reset(int data_segment_size, const structures::string_array &boundaries,
       int color) {
     _color = color;
     _bounds = boundaries;
@@ -86,7 +83,7 @@ public:
   }
 
 private:
-  screen_rectangle _bounds;
+  structures::string_array _bounds;
   int _color;
   basis::byte_array _data;
 };
index a359a61e9321a3d710429433589d11308daaf6c2..48a1984831a210456935cc9b51410f6606b2f9ec 100644 (file)
@@ -6,9 +6,9 @@ PROJECT = test_cromp
 TYPE = test
 TARGETS = test_cromp_client.exe test_cromp_server.exe test_many_cromp.exe
 LAST_TARGETS = create_decoder_ring
-LOCAL_LIBS_USED = unit_test application configuration filesystem loggers \
-  mathematics nodes octopi processes sockets structures textual timely \
-  structures basis 
+LOCAL_LIBS_USED = unit_test crypto application configuration filesystem loggers \
+  mathematics nodes processes sockets structures textual timely octopus cromp \
+  tentacles structures basis 
 USE_SSL = t
 #RUN_TARGETS = $(ACTUAL_TARGETS)
 
index 564d3b337ea5a0817b5acb4641b868b68669d0d1..82d48d01d2ac8bbba816f0eedfdd8a0a8d738192 100644 (file)
@@ -5,7 +5,9 @@ include cpp/variables.def
 PROJECT = decoder_ring
 TYPE = application
 TARGETS = cromp_decoder.exe
-LOCAL_LIBS_USED = basis 
+LOCAL_LIBS_USED = unit_test octopus cromp crypto application configuration filesystem loggers \
+  mathematics nodes processes sockets structures textual timely \
+  tentacles structures basis 
 USE_SSL = t
 RUN_TARGETS = $(ACTUAL_TARGETS)
 
index b8ed2613bab2739ce71fd862854ac70112512ff6..b0bc262e9b631dd3b4ca53e2c163e57c729e896a 100644 (file)
@@ -516,10 +516,13 @@ void cromp_client_tester::bite_server(structures::set<octopus_request_id> &ids,
 
   double overall_sent = 0;
 
+//hmmm: not very interesting boundaries below, non-randomized and identical in both places.
+  const char *bounds_init[] = { "0", "120", "220", "280" };
+  string_array boundish(4, bounds_init);
+
   // this computes the size of the exchange object with no extra data attached.
   byte_array temp;
-  bubble test_size(_dataseg_size, screen_rectangle(0, 120, 220, 280),
-      238843);
+  bubble test_size(_dataseg_size, boundish, 238843);
   test_size.data().reset();
     // set the data segment to zero length.
   test_size.pack(temp);
@@ -531,8 +534,7 @@ void cromp_client_tester::bite_server(structures::set<octopus_request_id> &ids,
   time_stamp start;  // record when our testing started.
 
   for (int sends = 1; sends <= _send_count; sends++) {
-    bubble to_send(_dataseg_size, screen_rectangle(0, 120, 220, 280),
-        238843);
+    bubble to_send(_dataseg_size, boundish, 238843);
     int curr_sending = to_send.data_length() + base_length * 2;
     overall_sent += curr_sending;
       // we compute the overall sent by what's sent in the request (which is
index e2a5da928c72f092ff62ea72924a1180377a8f9c..be3db71b928dc06abd64f93e77298ab02f74a5bb 100644 (file)
 #include "crompish_pax.h"
 
 #include <basis/byte_array.h>
-#include <basis/function.h>
-#include <basis/istring.h>
-#include <basis/log_base.h>
-#include <basis/portable.h>
+#include <basis/functions.h>
+#include <basis/astring.h>
 #include <cromp/cromp_server.h>
-#include <mechanisms/time_stamp.h>
+#include <timely/time_stamp.h>
 #include <octopus/tentacle.h>
-#include <opsystem/application_shell.h>
-#include <opsystem/command_line.h>
+#include <application/application_shell.h>
+#include <application/command_line.h>
 #include <loggers/console_logger.h>
 #include <loggers/file_logger.h>
-#include <data_struct/static_memory_gremlin.h>
-#include <sockets/address.h>
+#include <structures/static_memory_gremlin.h>
+#include <sockets/internet_address.h>
 #include <sockets/machine_uid.h>
 #include <sockets/tcpip_stack.h>
-
-#define LOG(a) CLASS_EMERGENCY_LOG(program_wide_logger(), a)
+#include <unit_test/unit_base.h>
+
+using namespace application;
+using namespace basis;
+using namespace configuration;
+using namespace cromp;
+using namespace mathematics;
+using namespace filesystem;
+using namespace loggers;
+using namespace octopi;
+using namespace processes;
+using namespace sockets;
+using namespace structures;
+using namespace textual;
+using namespace timely;
+using namespace unit_test;
+
+#define LOG(a) CLASS_EMERGENCY_LOG(program_wide_logger::get(), a)
 
 const int REPORTING_INTERVAL = 28 * SECOND_ms;  // how often to squawk.
 
@@ -46,7 +60,7 @@ const bool SUPPORT_BACKGROUNDING = false;
 //const bool IMMEDIATE_EVALUATION = true;
 const bool IMMEDIATE_EVALUATION = false;
 
-////////////////////////////////////////////////////////////////////////////
+//////////////
 
 // forward.
 class cromp_server_tester;
@@ -60,15 +74,15 @@ public:
 
   ~our_cromp_server() {}
 
-  IMPLEMENT_CLASS_NAME("our_cromp_server");
+  DEFINE_CLASS_NAME("our_cromp_server");
 
 private:
   cromp_server_tester &_parent;
 };
 
-////////////////////////////////////////////////////////////////////////////
+//////////////
 
-class cromp_server_tester : public application_shell
+class cromp_server_tester : virtual public unit_base, virtual public application_shell
 {
 public:
   bool _saw_clients;  // true if we ever got a connection.
@@ -78,7 +92,7 @@ public:
 
   virtual int execute();
 
-  IMPLEMENT_CLASS_NAME("cromp_server_tester");
+  DEFINE_CLASS_NAME("cromp_server_tester");
 
 private:
   our_cromp_server *_uplink;
@@ -88,7 +102,7 @@ private:
   internet_address c_address;
 };
 
-////////////////////////////////////////////////////////////////////////////
+//////////////
 
 class real_bubbles_tentacle : public bubbles_tentacle
 {
@@ -114,12 +128,13 @@ private:
   cromp_server_tester &_parent;
 };
 
-////////////////////////////////////////////////////////////////////////////
+//////////////
 
 cromp_server_tester::cromp_server_tester()
-: application_shell("cromp_server_tester"),
+: application_shell(),
+///"cromp_server_tester"),
   _saw_clients(false),
-  _uplink(NIL),
+  _uplink(NULL_POINTER),
   _leave_when_no_clients(false),
   _encryption(false)
 {
@@ -128,12 +143,12 @@ cromp_server_tester::cromp_server_tester()
   LOG("");
   LOG("");
 
-  command_line args(__argc, __argv);
+  command_line args(application::_global_argc, application::_global_argv);
   // check for a port on the command line.
-  istring port_text;
+  astring port_text;
   int port = 5678;
   if (args.get_value("port", port_text, false)) {
-    LOG(istring("using port: ") + port_text);
+    LOG(astring("using port: ") + port_text);
     port = port_text.convert(5678);
   }
   int posn = 0;
@@ -145,15 +160,15 @@ cromp_server_tester::cromp_server_tester()
 //hmmm:normalize host so this can take either name or IP.
 
   // check for a hostname on the command line.
-  istring hostname("local");
-  istring host_temp;
+  astring hostname("local");
+  astring host_temp;
   if (args.get_value("host", host_temp, false)) {
-    LOG(istring("using host: ") + host_temp);
+    LOG(astring("using host: ") + host_temp);
     hostname = host_temp;
   }
   strcpy(c_address.hostname, hostname.s());
 
-//LOG(istring("here's the command line:") + log_base::platform_ending() + args.text_form());
+//LOG(astring("here's the command line:") + parser_bits::platform_eol_to_chars() + args.text_form());
 
   int indy = 0;
   if (args.find("encrypt", indy) || (args.find('e', indy)) ) {
@@ -196,7 +211,7 @@ int cromp_server_tester::execute()
       if (client_count == 1) verb = "is";
       const char *ending = "s";
       if (client_count == 1) ending = "";
-      LOG(isprintf("There %s %d client%s.", verb, client_count, ending));
+      LOG(a_sprintf("There %s %d client%s.", verb, client_count, ending));
       next_report.reset(REPORTING_INTERVAL);
     }
 
@@ -209,12 +224,12 @@ _uplink->add_tentacle(new real_bubbles_tentacle(*this, SUPPORT_BACKGROUNDING));
 _uplink->enable_servers(_encryption);
 }
 
-    portable::sleep_ms(100); 
+    time_control::sleep_ms(100); 
   }
   return 0;
 }
 
-////////////////////////////////////////////////////////////////////////////
+//////////////
 
 HOOPLE_MAIN(cromp_server_tester, )