+ printf("MAIN: CDS:\n");
+ if (($debug & 1) == 1)
+ print_r($cds);
+ printf("MAIN: Deregister 'long_cls'\n");
+ if (($cds->cmd_cls_deregister($long_cls)) == FALSE) {
+ fprintf(STDERR, "MAIN: 'long_cls' deregistration failed\n");
+ exit(4);
+ }
+ printf("MAIN:");
+ if (($debug & 1) == 1) {
+ printf(" CDS:\n");
+ print_r($cds);
+ }
+ printf("\n");
+ // re-re-register long_cls
+ printf("MAIN: Re-re-register 'long_cls'\n");
+ if (($cds->cmd_cls_register($long_cls)) == FALSE) {
+ fprintf(STDERR, "MAIN: 'long_cls' re-re-registration failed\n");
+ exit(5);
+ }
+
+ printf("MAIN: Deregister all\n");
+ $cds->cmd_cls_deregister_all();
+
+ // registrer short_cls
+ printf("MAIN: register 'short_cls'\n");
+ if (($cds->cmd_cls_register($short_cls, 10)) == FALSE) {
+ fprintf(STDERR, "MAIN: 'short_cls' registration failed\n");
+ exit(1);
+ }
+
+ // register long_cls
+ printf("MAIN: register 'long_cls'\n");
+ if (($cds->cmd_cls_register($long_cls, 4)) == FALSE) {
+ fprintf(STDERR, "MAIN: 'long_cls' registration failed\n");
+ exit(2);
+ }
+ printf("MAIN:");
+ if (($debug & 1) == 1) {
+ printf(" CDS:\n");
+ print_r($cds);
+ }
+ printf("\n");
+
+ // for ($i = -15 ; $i < 30 ; $i++) {
+ for ($i = 0 ; $i < 20 ; $i++) {
+ printf("MAIN: START ITERATION %d\n", $i);
+
+ if ($i == 2) {
+ printf("MAIN: load 'short'\n");
+ if ($cds->execute("short", WEB_URL.'/test/short.php') == FALSE) {
+ printf("MAIN: push 'short' command failed\n");
+ exit(123);
+ }
+ }
+
+ if ($i == 3) {
+ printf("MAIN: load 'short'\n");
+ if ($cds->execute("short", WEB_URL.'/test/short.php') == FALSE) {
+ printf("MAIN: push 'short' command failed\n");
+ exit(123);
+ }
+ }
+
+ if ($i == 4) {
+ printf("MAIN: load 'long'\n");
+ if ($cds->execute("long", WEB_URL.'/test/long.php') == FALSE) {
+ printf("MAIN: push 'long' command failed\n");
+ exit(123);
+ }
+ }
+
+ printf("MAIN:");
+ if (($debug & 1) == 1) {
+ printf(" CDS:\n");
+ print_r($cds);
+ }
+ printf("\n");
+
+ printf("MAIN: Call process\n");
+ $cds->process();
+ sleep(1);
+ }
+ printf("MAIN: finished, dump cds:\n");
+ print_r($cds);