* 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();
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() {}
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,
}
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.
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, )
\*****************************************************************************/
#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.
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;
}
private:
- screen_rectangle _bounds;
+ structures::string_array _bounds;
int _color;
basis::byte_array _data;
};
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)
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)
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);
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
#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.
//const bool IMMEDIATE_EVALUATION = true;
const bool IMMEDIATE_EVALUATION = false;
-////////////////////////////////////////////////////////////////////////////
+//////////////
// forward.
class cromp_server_tester;
~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.
virtual int execute();
- IMPLEMENT_CLASS_NAME("cromp_server_tester");
+ DEFINE_CLASS_NAME("cromp_server_tester");
private:
our_cromp_server *_uplink;
internet_address c_address;
};
-////////////////////////////////////////////////////////////////////////////
+//////////////
class real_bubbles_tentacle : public bubbles_tentacle
{
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)
{
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;
//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)) ) {
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);
}
_uplink->enable_servers(_encryption);
}
- portable::sleep_ms(100);
+ time_control::sleep_ms(100);
}
return 0;
}
-////////////////////////////////////////////////////////////////////////////
+//////////////
HOOPLE_MAIN(cromp_server_tester, )