@yuneta/gobj-js 7.8.7 → 7.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gobj-js.cjs.js +300 -25
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +1267 -1093
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +290 -26
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +1245 -1063
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +300 -25
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +1268 -1094
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +300 -25
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +1266 -1092
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/gobj-js.iife.js
CHANGED
|
@@ -401,6 +401,269 @@ var gobjJs = (function(exports) {
|
|
|
401
401
|
if (is_object(msg)) msg = JSON.stringify(msg);
|
|
402
402
|
log_debug(tab() + String(msg));
|
|
403
403
|
}
|
|
404
|
+
/***************************************************************
|
|
405
|
+
* Trace levels
|
|
406
|
+
*
|
|
407
|
+
* The SAME names and the SAME bits as the C kernel (gobj.h's
|
|
408
|
+
* enum + gobj.c's s_global_trace_level), so a level means one
|
|
409
|
+
* thing across the two implementations and a habit learned on
|
|
410
|
+
* one side transfers to the other. The levels that only exist
|
|
411
|
+
* on a node (fs, liburing, gbuffers) keep their bit anyway:
|
|
412
|
+
* dropping them would shift every bit above and break exactly
|
|
413
|
+
* that alignment.
|
|
414
|
+
*
|
|
415
|
+
* 16 higher bits are global, 16 lower bits are per-gclass user
|
|
416
|
+
* levels (`s_user_trace_level` in gclass_create).
|
|
417
|
+
***************************************************************/
|
|
418
|
+
var trace_level_t = Object.freeze({
|
|
419
|
+
TRACE_MACHINE: 65536,
|
|
420
|
+
TRACE_CREATE_DELETE: 131072,
|
|
421
|
+
TRACE_CREATE_DELETE2: 262144,
|
|
422
|
+
TRACE_SUBSCRIPTIONS: 524288,
|
|
423
|
+
TRACE_START_STOP: 1048576,
|
|
424
|
+
TRACE_EV_KW: 2097152,
|
|
425
|
+
TRACE_AUTHZS: 4194304,
|
|
426
|
+
TRACE_STATES: 8388608,
|
|
427
|
+
TRACE_GBUFFERS: 16777216,
|
|
428
|
+
TRACE_TIMER: 33554432,
|
|
429
|
+
TRACE_FS: 67108864,
|
|
430
|
+
TRACE_URING: 134217728,
|
|
431
|
+
TRACE_TIMER_PERIODIC: 268435456,
|
|
432
|
+
TRACE_URING_TIME: 536870912,
|
|
433
|
+
TRACE_COMMANDS: 1073741824
|
|
434
|
+
});
|
|
435
|
+
var TRACE_GLOBAL_LEVEL1 = 268369920;
|
|
436
|
+
var s_global_trace_level = [
|
|
437
|
+
[
|
|
438
|
+
"machine",
|
|
439
|
+
trace_level_t.TRACE_MACHINE,
|
|
440
|
+
"Trace machine"
|
|
441
|
+
],
|
|
442
|
+
[
|
|
443
|
+
"create_delete",
|
|
444
|
+
trace_level_t.TRACE_CREATE_DELETE,
|
|
445
|
+
"Trace create/delete of gobjs"
|
|
446
|
+
],
|
|
447
|
+
[
|
|
448
|
+
"create_delete2",
|
|
449
|
+
trace_level_t.TRACE_CREATE_DELETE2,
|
|
450
|
+
"Trace create/delete of gobjs level 2: with kw"
|
|
451
|
+
],
|
|
452
|
+
[
|
|
453
|
+
"subscriptions",
|
|
454
|
+
trace_level_t.TRACE_SUBSCRIPTIONS,
|
|
455
|
+
"Trace subscriptions of gobjs"
|
|
456
|
+
],
|
|
457
|
+
[
|
|
458
|
+
"start_stop",
|
|
459
|
+
trace_level_t.TRACE_START_STOP,
|
|
460
|
+
"Trace start/stop of gobjs"
|
|
461
|
+
],
|
|
462
|
+
[
|
|
463
|
+
"ev_kw",
|
|
464
|
+
trace_level_t.TRACE_EV_KW,
|
|
465
|
+
"Trace event keywords"
|
|
466
|
+
],
|
|
467
|
+
[
|
|
468
|
+
"authzs",
|
|
469
|
+
trace_level_t.TRACE_AUTHZS,
|
|
470
|
+
"Trace authorizations"
|
|
471
|
+
],
|
|
472
|
+
[
|
|
473
|
+
"states",
|
|
474
|
+
trace_level_t.TRACE_STATES,
|
|
475
|
+
"Trace change of states"
|
|
476
|
+
],
|
|
477
|
+
[
|
|
478
|
+
"gbuffers",
|
|
479
|
+
trace_level_t.TRACE_GBUFFERS,
|
|
480
|
+
"Trace gbuffers"
|
|
481
|
+
],
|
|
482
|
+
[
|
|
483
|
+
"timer",
|
|
484
|
+
trace_level_t.TRACE_TIMER,
|
|
485
|
+
"Trace timers"
|
|
486
|
+
],
|
|
487
|
+
[
|
|
488
|
+
"fs",
|
|
489
|
+
trace_level_t.TRACE_FS,
|
|
490
|
+
"Trace file system"
|
|
491
|
+
],
|
|
492
|
+
[
|
|
493
|
+
"liburing",
|
|
494
|
+
trace_level_t.TRACE_URING,
|
|
495
|
+
"Trace liburing mixins"
|
|
496
|
+
],
|
|
497
|
+
[
|
|
498
|
+
"timer_periodic",
|
|
499
|
+
trace_level_t.TRACE_TIMER_PERIODIC,
|
|
500
|
+
"Trace periodic timers"
|
|
501
|
+
],
|
|
502
|
+
[
|
|
503
|
+
"liburing_timer",
|
|
504
|
+
trace_level_t.TRACE_URING_TIME,
|
|
505
|
+
"Trace liburing timer"
|
|
506
|
+
],
|
|
507
|
+
[
|
|
508
|
+
"commands",
|
|
509
|
+
trace_level_t.TRACE_COMMANDS,
|
|
510
|
+
"Trace commands"
|
|
511
|
+
]
|
|
512
|
+
];
|
|
513
|
+
var __global_trace_level__ = 0;
|
|
514
|
+
var __global_trace_no_level__ = 0;
|
|
515
|
+
var __deep_trace__ = 0;
|
|
516
|
+
function level2bit(level) {
|
|
517
|
+
for (const [name, bit] of s_global_trace_level) if (name === level) return bit;
|
|
518
|
+
return 0;
|
|
519
|
+
}
|
|
520
|
+
function trace_bitmask(level, who) {
|
|
521
|
+
if (empty_string(level)) return TRACE_GLOBAL_LEVEL1;
|
|
522
|
+
if (/^[0-9]+$/.test(String(level))) {
|
|
523
|
+
const n = Number(level);
|
|
524
|
+
if (n) return n;
|
|
525
|
+
}
|
|
526
|
+
const bit = level2bit(String(level));
|
|
527
|
+
if (!bit) {
|
|
528
|
+
log_error(`${who}: trace level NOT FOUND: ${level}`);
|
|
529
|
+
return 0;
|
|
530
|
+
}
|
|
531
|
+
return bit;
|
|
532
|
+
}
|
|
533
|
+
/************************************************************
|
|
534
|
+
* The levels in force for a gobj: global, plus its gclass's,
|
|
535
|
+
* plus its own — the union, exactly as the C kernel computes
|
|
536
|
+
* it in gobj_trace_level().
|
|
537
|
+
************************************************************/
|
|
538
|
+
function gobj_trace_level(gobj) {
|
|
539
|
+
if (__deep_trace__) return 4294967295;
|
|
540
|
+
let bitmask = __global_trace_level__;
|
|
541
|
+
if (gobj) {
|
|
542
|
+
bitmask |= gobj.trace_level || 0;
|
|
543
|
+
if (gobj.gclass) bitmask |= gobj.gclass.trace_level || 0;
|
|
544
|
+
}
|
|
545
|
+
return bitmask;
|
|
546
|
+
}
|
|
547
|
+
function gobj_trace_no_level(gobj) {
|
|
548
|
+
let bitmask = __global_trace_no_level__;
|
|
549
|
+
if (gobj) {
|
|
550
|
+
bitmask |= gobj.no_trace_level || 0;
|
|
551
|
+
if (gobj.gclass) bitmask |= gobj.gclass.no_trace_level || 0;
|
|
552
|
+
}
|
|
553
|
+
return bitmask;
|
|
554
|
+
}
|
|
555
|
+
function legacy_yuno_trace_bits() {
|
|
556
|
+
if (!__yuno__ || !__yuno__.jn_attrs) return 0;
|
|
557
|
+
let bits = 0;
|
|
558
|
+
if (gobj_has_attr(__yuno__, "tracing")) {
|
|
559
|
+
const tracing = Number(gobj_read_attr(__yuno__, "tracing")) || 0;
|
|
560
|
+
if (tracing >= 1) bits |= trace_level_t.TRACE_MACHINE;
|
|
561
|
+
if (tracing >= 2) bits |= trace_level_t.TRACE_EV_KW;
|
|
562
|
+
}
|
|
563
|
+
if (gobj_has_attr(__yuno__, "trace_timer") && gobj_read_attr(__yuno__, "trace_timer")) bits |= trace_level_t.TRACE_TIMER;
|
|
564
|
+
if (gobj_has_attr(__yuno__, "trace_creation") && gobj_read_attr(__yuno__, "trace_creation")) bits |= trace_level_t.TRACE_CREATE_DELETE;
|
|
565
|
+
if (gobj_has_attr(__yuno__, "trace_start_stop") && gobj_read_attr(__yuno__, "trace_start_stop")) bits |= trace_level_t.TRACE_START_STOP;
|
|
566
|
+
return bits;
|
|
567
|
+
}
|
|
568
|
+
function __trace_gobj_create_delete__(gobj) {
|
|
569
|
+
return (gobj_trace_level(gobj) | legacy_yuno_trace_bits()) & trace_level_t.TRACE_CREATE_DELETE;
|
|
570
|
+
}
|
|
571
|
+
function __trace_gobj_start_stop__(gobj) {
|
|
572
|
+
return (gobj_trace_level(gobj) | legacy_yuno_trace_bits()) & trace_level_t.TRACE_START_STOP;
|
|
573
|
+
}
|
|
574
|
+
function __trace_gobj_ev_kw__(gobj) {
|
|
575
|
+
return (gobj_trace_level(gobj) | legacy_yuno_trace_bits()) & trace_level_t.TRACE_EV_KW;
|
|
576
|
+
}
|
|
577
|
+
function __trace_gobj_states__(gobj) {
|
|
578
|
+
return gobj_trace_level(gobj) & trace_level_t.TRACE_STATES;
|
|
579
|
+
}
|
|
580
|
+
/************************************************************
|
|
581
|
+
* Must trace? — the C kernel's is_machine_tracing(), including
|
|
582
|
+
* the two event-specific levels: `timer` and `timer_periodic`
|
|
583
|
+
* light up only for their own event.
|
|
584
|
+
************************************************************/
|
|
585
|
+
function is_machine_tracing(gobj, event) {
|
|
586
|
+
if (__deep_trace__ > 1) return true;
|
|
587
|
+
if (!gobj) return false;
|
|
588
|
+
const level = gobj_trace_level(gobj) | legacy_yuno_trace_bits();
|
|
589
|
+
return level & trace_level_t.TRACE_MACHINE || level & trace_level_t.TRACE_TIMER_PERIODIC && event === "EV_TIMEOUT_PERIODIC" || level & trace_level_t.TRACE_TIMER && event === "EV_TIMEOUT" ? true : false;
|
|
590
|
+
}
|
|
591
|
+
/************************************************************
|
|
592
|
+
* Must NOT trace? Asked of the SOURCE, so a noisy sender can
|
|
593
|
+
* be silenced without turning the destination off.
|
|
594
|
+
************************************************************/
|
|
595
|
+
function is_machine_not_tracing(gobj, event) {
|
|
596
|
+
if (__deep_trace__ > 1) return false;
|
|
597
|
+
if (!gobj) return true;
|
|
598
|
+
const level = gobj_trace_no_level(gobj);
|
|
599
|
+
return level & trace_level_t.TRACE_MACHINE || level & trace_level_t.TRACE_TIMER_PERIODIC && event === "EV_TIMEOUT_PERIODIC" || level & trace_level_t.TRACE_TIMER && event === "EV_TIMEOUT" ? true : false;
|
|
600
|
+
}
|
|
601
|
+
/************************************************************
|
|
602
|
+
* The setters — same signatures as the C kernel
|
|
603
|
+
************************************************************/
|
|
604
|
+
function gobj_set_global_trace(level, set) {
|
|
605
|
+
const bitmask = trace_bitmask(level, "gobj_set_global_trace");
|
|
606
|
+
if (!bitmask) return -1;
|
|
607
|
+
if (set) __global_trace_level__ |= bitmask;
|
|
608
|
+
else __global_trace_level__ &= ~bitmask;
|
|
609
|
+
return 0;
|
|
610
|
+
}
|
|
611
|
+
function gobj_set_global_no_trace(level, set) {
|
|
612
|
+
const bitmask = trace_bitmask(level, "gobj_set_global_no_trace");
|
|
613
|
+
if (!bitmask) return -1;
|
|
614
|
+
if (set) __global_trace_no_level__ |= bitmask;
|
|
615
|
+
else __global_trace_no_level__ &= ~bitmask;
|
|
616
|
+
return 0;
|
|
617
|
+
}
|
|
618
|
+
function gobj_global_trace_level() {
|
|
619
|
+
return __global_trace_level__;
|
|
620
|
+
}
|
|
621
|
+
function gobj_set_deep_trace(value) {
|
|
622
|
+
__deep_trace__ = Number(value) || 0;
|
|
623
|
+
return 0;
|
|
624
|
+
}
|
|
625
|
+
function gobj_set_gclass_trace(gclass, level, set) {
|
|
626
|
+
const gclass_ = is_string(gclass) ? gclass_find_by_name(gclass) : gclass;
|
|
627
|
+
if (!gclass_) {
|
|
628
|
+
log_error(`gobj_set_gclass_trace: gclass NOT FOUND: ${gclass}`);
|
|
629
|
+
return -1;
|
|
630
|
+
}
|
|
631
|
+
const bitmask = trace_bitmask(level, "gobj_set_gclass_trace");
|
|
632
|
+
if (!bitmask) return -1;
|
|
633
|
+
if (set) gclass_.trace_level |= bitmask;
|
|
634
|
+
else gclass_.trace_level &= ~bitmask;
|
|
635
|
+
return 0;
|
|
636
|
+
}
|
|
637
|
+
function gobj_set_gobj_trace(gobj, level, set) {
|
|
638
|
+
if (!gobj) {
|
|
639
|
+
log_error(`gobj_set_gobj_trace: gobj NULL`);
|
|
640
|
+
return -1;
|
|
641
|
+
}
|
|
642
|
+
const bitmask = trace_bitmask(level, "gobj_set_gobj_trace");
|
|
643
|
+
if (!bitmask) return -1;
|
|
644
|
+
if (set) gobj.trace_level |= bitmask;
|
|
645
|
+
else gobj.trace_level &= ~bitmask;
|
|
646
|
+
return 0;
|
|
647
|
+
}
|
|
648
|
+
function gobj_set_gobj_no_trace(gobj, level, set) {
|
|
649
|
+
if (!gobj) {
|
|
650
|
+
log_error(`gobj_set_gobj_no_trace: gobj NULL`);
|
|
651
|
+
return -1;
|
|
652
|
+
}
|
|
653
|
+
const bitmask = trace_bitmask(level, "gobj_set_gobj_no_trace");
|
|
654
|
+
if (!bitmask) return -1;
|
|
655
|
+
if (set) gobj.no_trace_level |= bitmask;
|
|
656
|
+
else gobj.no_trace_level &= ~bitmask;
|
|
657
|
+
return 0;
|
|
658
|
+
}
|
|
659
|
+
function gobj_repr_global_trace_levels() {
|
|
660
|
+
return s_global_trace_level.map(([name, bit, description]) => ({
|
|
661
|
+
name,
|
|
662
|
+
bit,
|
|
663
|
+
description,
|
|
664
|
+
set: __global_trace_level__ & bit ? true : false
|
|
665
|
+
}));
|
|
666
|
+
}
|
|
404
667
|
/************************************************************
|
|
405
668
|
* Start up
|
|
406
669
|
************************************************************/
|
|
@@ -1081,7 +1344,7 @@ var gobjJs = (function(exports) {
|
|
|
1081
1344
|
let gobj = new GObj(gobj_name, gclass, kw, parent, gobj_flag);
|
|
1082
1345
|
gobj.jn_attrs = sdata_create(gobj, gclass.attrs_table);
|
|
1083
1346
|
for (const [key, value] of Object.entries(gobj.jn_attrs)) if (key in gobj.priv) gobj.priv[key] = value;
|
|
1084
|
-
let trace_creation =
|
|
1347
|
+
let trace_creation = __trace_gobj_create_delete__(gobj);
|
|
1085
1348
|
if (trace_creation) trace_machine(sprintf("💙💙⏩ creating: %s^%s", gclass.gclass_name, gobj_name));
|
|
1086
1349
|
if (gobj.gobj_flag & gobj_flag_t.gobj_flag_service) _register_service(gobj);
|
|
1087
1350
|
if (gobj.gobj_flag & gobj_flag_t.gobj_flag_yuno) __yuno__ = gobj;
|
|
@@ -1132,15 +1395,6 @@ var gobjJs = (function(exports) {
|
|
|
1132
1395
|
return;
|
|
1133
1396
|
}
|
|
1134
1397
|
if (gobj.__refs__ > 0) log_error(`${gobj_short_name(gobj)}: gobj DESTROYING with references: ${gobj.__refs__}`);
|
|
1135
|
-
gobj.obflag |= obflag_t.obflag_destroying;
|
|
1136
|
-
let trace_creation = __yuno__ && gobj_read_bool_attr(__yuno__, "trace_creation");
|
|
1137
|
-
if (trace_creation) trace_machine(sprintf("💔💔⏩ destroying: %s", gobj_full_name(gobj)));
|
|
1138
|
-
let parent = gobj_parent(gobj);
|
|
1139
|
-
if (parent && parent.gclass.gmt.mt_child_removed) {
|
|
1140
|
-
if (trace_creation) trace_machine(sprintf("👦👦🔴 child_removed(%s): %s", gobj_full_name(parent), gobj_short_name(gobj)));
|
|
1141
|
-
parent.gclass.gmt.mt_child_removed(parent, gobj);
|
|
1142
|
-
}
|
|
1143
|
-
if (gobj.gobj_flag & gobj_flag_t.gobj_flag_service) _deregister_service(gobj);
|
|
1144
1398
|
if (gobj.playing) {
|
|
1145
1399
|
log_error(`Destroying a PLAYING gobj: ${gobj_full_name(gobj)}`);
|
|
1146
1400
|
gobj_pause(gobj);
|
|
@@ -1149,6 +1403,15 @@ var gobjJs = (function(exports) {
|
|
|
1149
1403
|
log_error(`Destroying a RUNNING gobj: ${gobj_full_name(gobj)}`);
|
|
1150
1404
|
gobj_stop(gobj);
|
|
1151
1405
|
}
|
|
1406
|
+
gobj.obflag |= obflag_t.obflag_destroying;
|
|
1407
|
+
let trace_creation = __trace_gobj_create_delete__(gobj);
|
|
1408
|
+
if (trace_creation) trace_machine(sprintf("💔💔⏩ destroying: %s", gobj_full_name(gobj)));
|
|
1409
|
+
let parent = gobj_parent(gobj);
|
|
1410
|
+
if (parent && parent.gclass.gmt.mt_child_removed) {
|
|
1411
|
+
if (trace_creation) trace_machine(sprintf("👦👦🔴 child_removed(%s): %s", gobj_full_name(parent), gobj_short_name(gobj)));
|
|
1412
|
+
parent.gclass.gmt.mt_child_removed(parent, gobj);
|
|
1413
|
+
}
|
|
1414
|
+
if (gobj.gobj_flag & gobj_flag_t.gobj_flag_service) _deregister_service(gobj);
|
|
1152
1415
|
gobj_unsubscribe_list(gobj, gobj.dl_subscriptions, true);
|
|
1153
1416
|
gobj_unsubscribe_list(gobj, gobj.dl_subscribings, true);
|
|
1154
1417
|
if (parent) {
|
|
@@ -1191,7 +1454,7 @@ var gobjJs = (function(exports) {
|
|
|
1191
1454
|
log_error(`${gobj_short_name(gobj)}: GObj DISABLED`);
|
|
1192
1455
|
return -1;
|
|
1193
1456
|
}
|
|
1194
|
-
if (
|
|
1457
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏺ ⏺ start: %s", gobj_full_name(gobj)));
|
|
1195
1458
|
gobj.running = true;
|
|
1196
1459
|
let ret = 0;
|
|
1197
1460
|
if (gobj.gclass.gmt.mt_start) ret = gobj.gclass.gmt.mt_start(gobj);
|
|
@@ -1226,7 +1489,7 @@ var gobjJs = (function(exports) {
|
|
|
1226
1489
|
log_error("gobj NULL or DESTROYED");
|
|
1227
1490
|
return -1;
|
|
1228
1491
|
}
|
|
1229
|
-
if (
|
|
1492
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏺ ⏺ ⏺ ⏺ start_tree: %s", gobj_full_name(gobj)));
|
|
1230
1493
|
if (gobj.gclass.gclass_flag & gclass_flag_t.gcflag_manual_start) return 0;
|
|
1231
1494
|
else if (gobj.disabled) return 0;
|
|
1232
1495
|
else if (!gobj.running) gobj_start(gobj);
|
|
@@ -1248,7 +1511,7 @@ var gobjJs = (function(exports) {
|
|
|
1248
1511
|
log_warning(`${gobj_short_name(gobj)}: GObj stopping without previous pause`);
|
|
1249
1512
|
gobj_pause(gobj);
|
|
1250
1513
|
}
|
|
1251
|
-
if (
|
|
1514
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏹ ⏹ stop: %s", gobj_full_name(gobj)));
|
|
1252
1515
|
gobj.running = false;
|
|
1253
1516
|
let ret = 0;
|
|
1254
1517
|
if (gobj.gclass.gmt.mt_stop) ret = gobj.gclass.gmt.mt_stop(gobj);
|
|
@@ -1276,7 +1539,7 @@ var gobjJs = (function(exports) {
|
|
|
1276
1539
|
log_error("gobj NULL or DESTROYED");
|
|
1277
1540
|
return -1;
|
|
1278
1541
|
}
|
|
1279
|
-
if (
|
|
1542
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏹ ⏹ ⏹ ⏹ stop_tree: %s", gobj_full_name(gobj)));
|
|
1280
1543
|
if (gobj_is_running(gobj)) gobj_stop(gobj);
|
|
1281
1544
|
return gobj_walk_gobj_children_tree(gobj, walk_type_t.WALK_TOP2BOTTOM, cb_stop_child, 0, 0);
|
|
1282
1545
|
}
|
|
@@ -1303,7 +1566,7 @@ var gobjJs = (function(exports) {
|
|
|
1303
1566
|
log_error(`${gobj_short_name(gobj)}: Cannot play, start not done`);
|
|
1304
1567
|
return -1;
|
|
1305
1568
|
}
|
|
1306
|
-
if (
|
|
1569
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏯ ⏯ play: %s", gobj_full_name(gobj)));
|
|
1307
1570
|
gobj.playing = true;
|
|
1308
1571
|
let ret = 0;
|
|
1309
1572
|
if (gobj.gclass.gmt.mt_play) {
|
|
@@ -1324,7 +1587,7 @@ var gobjJs = (function(exports) {
|
|
|
1324
1587
|
log_error(`${gobj_short_name(gobj)}: GObj NOT PLAYING`);
|
|
1325
1588
|
return -1;
|
|
1326
1589
|
}
|
|
1327
|
-
if (
|
|
1590
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏸ ⏸ pause: %s", gobj_full_name(gobj)));
|
|
1328
1591
|
gobj.playing = false;
|
|
1329
1592
|
if (gobj.gclass.gmt.mt_pause) return gobj.gclass.gmt.mt_pause(gobj);
|
|
1330
1593
|
else return 0;
|
|
@@ -2001,6 +2264,9 @@ var gobjJs = (function(exports) {
|
|
|
2001
2264
|
}
|
|
2002
2265
|
gobj.last_state = gobj.current_state;
|
|
2003
2266
|
gobj.current_state = new_state;
|
|
2267
|
+
let tracea = is_machine_tracing(gobj, "EV_STATE_CHANGED");
|
|
2268
|
+
let tracea_states = __trace_gobj_states__(gobj) ? true : false;
|
|
2269
|
+
if (tracea || tracea_states) trace_machine(sprintf("🔀🔀 mach(%s%s^%s), new st(%s), prev st(%s)", !gobj.running ? "!!" : "", gobj_gclass_name(gobj), gobj_name(gobj), gobj_current_state(gobj), gobj.last_state.state_name));
|
|
2004
2270
|
return true;
|
|
2005
2271
|
}
|
|
2006
2272
|
/***************************************************************************
|
|
@@ -2032,7 +2298,7 @@ var gobjJs = (function(exports) {
|
|
|
2032
2298
|
}
|
|
2033
2299
|
_add_child(parent, gobj);
|
|
2034
2300
|
if (parent.mt_child_added) {
|
|
2035
|
-
if (
|
|
2301
|
+
if (__trace_gobj_create_delete__(gobj)) log_debug(sprintf("👦👦🔵 child_added(%s): %s", gobj_full_name(parent), gobj_short_name(gobj)));
|
|
2036
2302
|
parent.mt_child_added(parent, gobj);
|
|
2037
2303
|
}
|
|
2038
2304
|
return 0;
|
|
@@ -2102,9 +2368,7 @@ var gobjJs = (function(exports) {
|
|
|
2102
2368
|
log_error(`${gobj_short_name(dst)}: current_state NULL`);
|
|
2103
2369
|
return -1;
|
|
2104
2370
|
}
|
|
2105
|
-
let tracea =
|
|
2106
|
-
tracea = __yuno__ && gobj_read_integer_attr(__yuno__, "tracing");
|
|
2107
|
-
if (gobj_gclass_name(src) === "C_TIMER") tracea = __yuno__ && gobj_read_integer_attr(__yuno__, "trace_timer");
|
|
2371
|
+
let tracea = is_machine_tracing(dst, event) && !is_machine_not_tracing(src, event);
|
|
2108
2372
|
__inside__++;
|
|
2109
2373
|
let event_action = _find_event_action(state, event);
|
|
2110
2374
|
if (!event_action) {
|
|
@@ -2133,7 +2397,7 @@ var gobjJs = (function(exports) {
|
|
|
2133
2397
|
trace_machine(sprintf("🔄 mach(%s%s^%s), st: %s, ev: %s%s%s, ac: %s, from(%s%s^%s)", !dst.running ? "!!" : "", gobj_gclass_name(dst), gobj_name(dst), state.state_name, "", event ? event : "", "", action_name, src && !src.running ? "!!" : "", gobj_gclass_name(src), gobj_name(src)));
|
|
2134
2398
|
}
|
|
2135
2399
|
if (kw) {
|
|
2136
|
-
if (
|
|
2400
|
+
if (__trace_gobj_ev_kw__(dst)) {
|
|
2137
2401
|
if (json_object_size(kw)) trace_json(kw);
|
|
2138
2402
|
}
|
|
2139
2403
|
}
|
|
@@ -2680,10 +2944,10 @@ var gobjJs = (function(exports) {
|
|
|
2680
2944
|
function log_error(format) {
|
|
2681
2945
|
let msg = format_log(format);
|
|
2682
2946
|
let hora = current_timestamp();
|
|
2683
|
-
if (f_error) if (f_error ===
|
|
2947
|
+
if (f_error) if (f_error === _console.error) {
|
|
2684
2948
|
if (__console_output_enabled__) f_error("%c" + hora + " ERROR: " + String(msg), "color:red");
|
|
2685
2949
|
} else {
|
|
2686
|
-
if (__console_output_enabled__)
|
|
2950
|
+
if (__console_output_enabled__) _console.error("%c" + hora + " ERROR: " + String(msg), "color:red");
|
|
2687
2951
|
f_error(`${hora} ERROR: ${String(msg)}`);
|
|
2688
2952
|
}
|
|
2689
2953
|
emit_log_callback("error", msg, hora);
|
|
@@ -2691,10 +2955,10 @@ var gobjJs = (function(exports) {
|
|
|
2691
2955
|
function log_warning(format) {
|
|
2692
2956
|
let msg = format_log(format);
|
|
2693
2957
|
let hora = current_timestamp();
|
|
2694
|
-
if (f_warning) if (f_warning ===
|
|
2958
|
+
if (f_warning) if (f_warning === _console.warn) {
|
|
2695
2959
|
if (__console_output_enabled__) f_warning("%c" + hora + " WARNING: " + String(msg), "color:yellow");
|
|
2696
2960
|
} else {
|
|
2697
|
-
if (__console_output_enabled__)
|
|
2961
|
+
if (__console_output_enabled__) _console.warn("%c" + hora + " WARNING: " + String(msg), "color:yellow");
|
|
2698
2962
|
f_warning(`${hora} WARNING: ${String(msg)}`);
|
|
2699
2963
|
}
|
|
2700
2964
|
emit_log_callback("warning", msg, hora);
|
|
@@ -6295,6 +6559,7 @@ var gobjJs = (function(exports) {
|
|
|
6295
6559
|
exports.gobj_flag_t = gobj_flag_t;
|
|
6296
6560
|
exports.gobj_full_name = gobj_full_name;
|
|
6297
6561
|
exports.gobj_gclass_name = gobj_gclass_name;
|
|
6562
|
+
exports.gobj_global_trace_level = gobj_global_trace_level;
|
|
6298
6563
|
exports.gobj_has_attr = gobj_has_attr;
|
|
6299
6564
|
exports.gobj_has_event = gobj_has_event;
|
|
6300
6565
|
exports.gobj_has_output_event = gobj_has_output_event;
|
|
@@ -6324,12 +6589,19 @@ var gobjJs = (function(exports) {
|
|
|
6324
6589
|
exports.gobj_read_pointer_attr = gobj_read_pointer_attr;
|
|
6325
6590
|
exports.gobj_read_str_attr = gobj_read_str_attr;
|
|
6326
6591
|
exports.gobj_remove_persistent_attrs = gobj_remove_persistent_attrs;
|
|
6592
|
+
exports.gobj_repr_global_trace_levels = gobj_repr_global_trace_levels;
|
|
6327
6593
|
exports.gobj_reset_volatil_attrs = gobj_reset_volatil_attrs;
|
|
6328
6594
|
exports.gobj_save_persistent_attrs = gobj_save_persistent_attrs;
|
|
6329
6595
|
exports.gobj_search_path = gobj_search_path;
|
|
6330
6596
|
exports.gobj_send_event = gobj_send_event;
|
|
6331
6597
|
exports.gobj_services = gobj_services;
|
|
6332
6598
|
exports.gobj_set_bottom_gobj = gobj_set_bottom_gobj;
|
|
6599
|
+
exports.gobj_set_deep_trace = gobj_set_deep_trace;
|
|
6600
|
+
exports.gobj_set_gclass_trace = gobj_set_gclass_trace;
|
|
6601
|
+
exports.gobj_set_global_no_trace = gobj_set_global_no_trace;
|
|
6602
|
+
exports.gobj_set_global_trace = gobj_set_global_trace;
|
|
6603
|
+
exports.gobj_set_gobj_no_trace = gobj_set_gobj_no_trace;
|
|
6604
|
+
exports.gobj_set_gobj_trace = gobj_set_gobj_trace;
|
|
6333
6605
|
exports.gobj_set_trace_machine_format = gobj_set_trace_machine_format;
|
|
6334
6606
|
exports.gobj_short_name = gobj_short_name;
|
|
6335
6607
|
exports.gobj_start = gobj_start;
|
|
@@ -6341,7 +6613,9 @@ var gobjJs = (function(exports) {
|
|
|
6341
6613
|
exports.gobj_stop_children = gobj_stop_children;
|
|
6342
6614
|
exports.gobj_stop_tree = gobj_stop_tree;
|
|
6343
6615
|
exports.gobj_subscribe_event = gobj_subscribe_event;
|
|
6616
|
+
exports.gobj_trace_level = gobj_trace_level;
|
|
6344
6617
|
exports.gobj_trace_machine_format = gobj_trace_machine_format;
|
|
6618
|
+
exports.gobj_trace_no_level = gobj_trace_no_level;
|
|
6345
6619
|
exports.gobj_unsubscribe_event = gobj_unsubscribe_event;
|
|
6346
6620
|
exports.gobj_unsubscribe_list = gobj_unsubscribe_list;
|
|
6347
6621
|
exports.gobj_walk_gobj_children = gobj_walk_gobj_children;
|
|
@@ -6460,6 +6734,7 @@ var gobjJs = (function(exports) {
|
|
|
6460
6734
|
exports.template_get_field_desc = template_get_field_desc;
|
|
6461
6735
|
exports.timeTracker = timeTracker;
|
|
6462
6736
|
exports.trace_json = trace_json;
|
|
6737
|
+
exports.trace_level_t = trace_level_t;
|
|
6463
6738
|
exports.trace_msg = trace_msg;
|
|
6464
6739
|
exports.treedb_decoder_fkey = treedb_decoder_fkey;
|
|
6465
6740
|
exports.treedb_decoder_hook = treedb_decoder_hook;
|