-
Notifications
You must be signed in to change notification settings - Fork 0
/
ef_lang.cpp
8229 lines (6355 loc) · 201 KB
/
ef_lang.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "../ef.hpp"
#include "string.h"
#include <time.h>
#include "uv.h"
//#include "unistd.h"
#include <../libpq-fe.h>
#include "../../rpi_sock.h"
//#include "../utf/chacu.h"
//#include <iconv.h>
extern "C" {
//#include <libmemcached/memcached.h>
//#include <libmemcached/util.h>
#include "../sha1.h"
int utf8lcstr(const char * szSrc, int iSrcLen, char ** szDst, int * iDstLen);
int utf8ucstr(const char * szSrc, int iSrcLen, char ** szDst, int * iDstLen);
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
}
#ifdef _WIN32
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>
#define MSLEEP(x) Sleep(x)
#else
#define MSLEEP(x) usleep(x*1000)
#endif
extern char node_id[100];
extern unsigned long long node_cnt;
extern int node_idn;
//extern int node_idn;
extern char jstype_flg;
extern int argc_;
extern char **argv_;
extern uv_thread_t tprc;
extern int quit_flg;
char * get_file_text_utf8(char * fn,int *fsz);
static std::string lg_hVal(ef_Content &ec,hVal *v,int lev,std::string &o,int len);
#define MAX_UDP_B 20000
class UDP_T
{
public:
int s;
int sc;
struct sockaddr_in adr_bc; /* AF_INET */
struct sockaddr_in adr_bc_rc; /* AF_INET */
char b[MAX_UDP_B+1];
};
class RE_T
{
public:
pcre2_code *re;
pcre2_match_data *md;
char *s;
int rc;
RE_T(){
re = NULL;
md = NULL;
s = NULL;
rc = -1;
}
};
class SqlAdd
{
public:
PGresult *res;
// char* sql;
hVal *sql;
int flg_exec;
// int con;
hVal *con;
int pos;
// char stnm[100];
std::string stnm;
SqlAdd(){
res = NULL;
sql = NULL;
flg_exec = 0;
con = NULL;
pos = 0;
// stnm[0] = 0;
}
~SqlAdd(){
if( res) PQclear(res);
if( sql) delete sql;
if( con) delete con;
}
};
#define QBOOLOID 16
#define QINT8OID 20
#define QINT2OID 21
#define QINT4OID 23
#define QNUMERICOID 1700
#define QFLOAT4OID 700
#define QFLOAT8OID 701
#define QABSTIMEOID 702
#define QRELTIMEOID 703
#define QDATEOID 1082
#define QTIMEOID 1083
#define QTIMETZOID 1266
#define QTIMESTAMPOID 1114
#define QTIMESTAMPTZOID 1184
#define QOIDOID 2278
#define QBYTEAOID 17
#define QREGPROCOID 24
#define QXIDOID 28
#define QCIDOID 29
#define PREF_MAIN "MAIN"
//hVal G(hVal::CMAP,0,0);
hVal *G = NULL;//(hVal::CMAP,0,0);
HHMapIDF_T del_map;// = new HHMapIDF_T();
ef_Fac ef;
ef_Content ec;
//HHMapIDF_T *del_map = NULL;//new HHMapIDF_T();
hVal *vT = new hVal(hVal::_TRUE, 0,0);
hVal *vF = new hVal(hVal::_FALSE, 0,0);
hVal *vN = new hVal(hVal::NIL, 0,0);
hVal *vR = new hVal(hVal::RETURN, 0,0);
hVal *vB = new hVal(hVal::BREAK, 0,0);
hVal *vRP = new hVal(hVal::REPEATE, 0,0);
hVal *vZS = new hVal(hVal::CSTRING, new std::string(""),0);
//hVal *vNL = new hVal(hVal::CSTRING, new std::string("\n"),0);
hVal *vNL = new hVal(hVal::CSTRING, new std::string("\015\012"),0);
//hVal *vD1 = new hVal(hVal::CDOUBLE, 0,1);
char *tps_js[] ={
"true","false","null", "R","B","RP","CDOUBLE","CSTRING", "CMAP","CDEQ",
"DOUBLE","STRING","MAP","DEQ","FNC","FNCC","BUF",
"LOCK","DB","SQL","UDP","RE"
};
char *tps[] ={
"T","F","N", "R","B","RP","CDOUBLE","CSTRING", "CMAP","CDEQ",
"DOUBLE","STRING","MAP","DEQ","FNC","FNCC","BUF",
"LOCK","DB","SQL","UDP","RE"
};
#define TPS_LENGTH sizeof(tps)/sizeof(char*)
void tdel_f(void *v)
{
fprintf(stderr,"DEL_FNC tdel_f !!!\n"); fflush(stderr);
}
void tttst()
{
std::cerr << "<--TTTTT ES TTTTT +++\n"; std::cerr.flush();
}
std::string tp_f(int i)
{
std::string o;
if( i >= TPS_LENGTH) {
o = "UT_";
o += std::to_string((long long )i);
return o;
}
if( !jstype_flg) o = tps[i];
else o = tps_js[i];
return o;
}
//--------------------------
extern "C"
{
#ifdef WIN32
#include <Rpc.h>
#else
#include <uuid/uuid.h>
#endif
}
void delStrEf(std::string *s)
{
delete s;
}
/*
std::string *newUUID()
{
std::string *rs;
#ifdef WIN32
UUID uuid;
UuidCreate ( &uuid );
unsigned char * str;
UuidToStringA ( &uuid, &str );
// std::string s( ( char* ) str );
rs = new std::string( ( char* ) str );
RpcStringFreeA ( &str );
#else
uuid_t uuid;
// uuid_generate_random ( uuid );
uuid_generate_time ( uuid );
char s[37];
uuid_unparse ( uuid, s );
rs = new std::string( ( char* ) s);
#endif
return rs;
}
*/
//--------------------------
#define BUF_INT_SIZE 50000
static char b[BUF_INT_SIZE] = "";
static char b_in[BUF_INT_SIZE] = "";
static int bin_flg = 0;
void getsTrun(void* p)
{
while( gets(b) && !quit_flg) {
while( bin_flg) {
if( quit_flg) return;
MSLEEP(20);
}
strcpy(b_in,b);
bin_flg = 1;
// fprintf(stderr,"=====================%s\n",b);fflush(stderr);
}
}
int c_scselect( int sock)
{
fd_set scArr;
timeval tmW;
tmW.tv_sec = 0;
tmW.tv_usec = 10;
#ifdef _WIN32
scArr.fd_count = 1;
scArr.fd_array[0] = sock;
int r = select(0,&scArr,0,0,&tmW);
#else
FD_ZERO(&scArr);
FD_SET(sock,&scArr);
int r = select(sock+1,&scArr,0,0,&tmW);
#endif
return r;
}
static time_t tm = 0;
static time_t tm_clone = 0;
static char par[2000]= "";
/*
void pcloning()
{
char *a[200];
int ac = argc_;
memset(a,0,sizeof(a));
int f_ret = 0;
int i = 0;
for(i=0; i < argc_; ++i) {
// fprintf(stderr,"%s\n",argv_[i]);fflush(stderr);
if( !strcmp(argv_[i],"-CLONE")){
f_ret = 1;
}
a[i] = argv_[i];
}
if( !f_ret) {
a[i] = "-CLONE";
ac++;
}
// int i = 0;
// for(i=0; i < argc_; ++i) {
//// fprintf(stderr,"%s\n",argv_[i]);fflush(stderr);
// if( !strcmp(argv_[i],"-CLONE")){
// f_ret = 1;
// }
// a[i] = argv_[i];
// }
// if( !f_ret) {
// a[i] = "-CLONE";
// ac++;
// }
__pid_t npid = fork();
if( !npid) {
// fprintf(stderr,"\nIn new execv PROCESS! %s %s\n",prs,par);fflush(stderr);
setsid();
execvp(a[0],a);
// setsid();
}
}
*/
void ktThread(void *arg) {
while( !quit_flg) {
time_t tml = tm;
time_t tc = time(0);
if( tm_clone && tm_clone < tc){
// pcloning();
tm_clone = 0;
}
if( tml == 0) {
MSLEEP(150);
continue;
}
if( tml < tc){
if( par[0] != 0) {
// char prs[3000] = "Нечто";
// fprintf(stderr,"\nexecv PROCESS! %s %s\n",prs,par);fflush(stderr);
char *a[200];
int ac = argc_;
memset(a,0,sizeof(a));
int f_ret = 0;
int i = 0;
for(i=0; i < argc_; ++i) {
// fprintf(stderr,"%s\n",argv_[i]);fflush(stderr);
if( !strncmp(argv_[i],"-R",2)){
a[i] = par;
f_ret = 1;
continue;
}
a[i] = argv_[i];
}
if( !f_ret) {
a[i] = par;
ac++;
}
/*
for(int j=0; j < ac; ++j) {
fprintf(stderr,"%s\n",a[j]);fflush(stderr);
}
*/
/*
if( !fork()) {
// fprintf(stderr,"\nIn new execv PROCESS! %s %s\n",prs,par);fflush(stderr);
execvp(a[0],a);
// fprintf(stderr,"\nIn new execv PROCESS! %s %s\n",prs,par);fflush(stderr);
return;
}
*/
}
fprintf(stderr,"\nKILLED BY TIMEOUT! %d %d \n",tml , tc);fflush(stderr);
_exit(-1);
return;
}
MSLEEP(150);
}
}
//- DEQ
inline hVal* hVal::get(int pos){
// if( this->b.tp != hVal::DEQ && this->b.tp != hVal::CDEQ) return NULL;
register HHDeqV_T *q = this->v.q;
if( pos >= q->size()) return vN;
return q->at(pos);
}
void hVal::set(HHDeqV_T *v){
// if( this->b.tp != hVal::DEQ && this->b.tp != hVal::CDEQ && this->b.tp != hVal::FNC) return;
register HHDeqV_T *o = this->v.q;
if( !o) {
this->v.q = v;
return;
}
HHDeqV_TI it = o->begin();
while( it != o->end()){
delete *it;
++it;
}
delete o;
this->v.q = v;
}
inline void hVal::set(int pos, hVal* v){
if( this->b.tp != hVal::DEQ && this->b.tp != hVal::CDEQ) return;
register HHDeqV_T *q = this->v.q;
if( pos >= q->size()) return;
hVal* vv = q->at(pos);
delete vv;
++v->b.c;
q->at(pos) = v;
}
inline void hVal::push(hVal* v){
// if( this->b.tp != hVal::DEQ && this->b.tp != hVal::CDEQ) return;
// ++v->b.c;
this->v.q->push_back(v);
}
void hVal::_push(hVal* v){
// if( this->b.tp != hVal::DEQ && this->b.tp != hVal::CDEQ) return;
// ++v->b.c;
this->v.q->push_back(v);
}
inline hVal* hVal::pop(){
// if( this->b.tp != hVal::DEQ && this->b.tp != hVal::CDEQ) return NULL;
register HHDeqV_T *q = this->v.q;
if( q->size() == 0) return vN;
hVal* v = q->back();
q->pop_back();
// if( v->b.c > 0) --v->b.c;
// if( v->b.c < 0) v->b.c = 0;
return v;
}
//-- MAP
inline hVal* hVal::get(char *k){
// if( this->b.tp != hVal::MAP && this->b.tp != hVal::CMAP) return NULL;
register HHMapSV_T *o = this->v.m;
HHMapSV_TI it = o->find(k);
if( it != o->end()) {
return it->second;
}
return vN;
}
inline hVal* hVal::get(std::string k){
// if( this->b.tp != hVal::MAP && this->b.tp != hVal::CMAP) return NULL;
register HHMapSV_T *o = this->v.m;
HHMapSV_TI it = o->find(k);
if( it != o->end()) {
return it->second;
}
return vN;
}
inline void hVal::del(std::string k){
// if( this->b.tp != hVal::MAP && this->b.tp != hVal::CMAP) return;
register HHMapSV_T *o = this->v.m;
HHMapSV_TI it = o->find(k);
if( it != o->end()) {
delete it->second;
o->erase(it);
}
}
inline void hVal::del(char* k){
// if( this->b.tp != hVal::MAP && this->b.tp != hVal::CMAP) return;
register HHMapSV_T *o = this->v.m;
HHMapSV_TI it = o->find(k);
if( it != o->end()) {
delete it->second;
o->erase(it);
}
}
void hVal::set(HHMapSV_T *v){
// if( this->b.tp != hVal::MAP && this->b.tp != hVal::CMAP) return;
register HHMapSV_T *o = this->v.m;
if( !o) {
this->v.m = v;
return;
}
register HHMapSV_TI it = o->begin();
while( it != o->end()){
hVal *z = it->second;
delete z;
++it;
}
delete o;
this->v.m = v;
}
inline void hVal::set(std::string k,hVal* v){
// if( this->b.tp != hVal::MAP && this->b.tp != hVal::CMAP) return;
std::pair<HHMapSV_TI,bool> ret = this->v.m->insert ( std::pair<std::string, hVal*>(k,v) );
++v->b.c;
if( !ret.second) {
HHMapSV_TI it = this->v.m->find(k);
// if( it != this->v.m->end()) {
delete it->second;
it->second = v;
// }
}
}
void hVal::setMV(char * k,hVal* v){
// if( this->b.tp != hVal::MAP && this->b.tp != hVal::CMAP) return;
std::pair<HHMapSV_TI,bool> ret = this->v.m->insert ( std::pair<std::string, hVal*>(k,v) );
// ++v->b.c;
if( !ret.second) {
HHMapSV_TI it = this->v.m->find(k);
// if( it != this->v.m->end()) {
delete it->second;
it->second = v;
// }
}
}
//- some...
inline void hVal::set(std::string *s){
// if( this->b.tp != hVal::STRING) return;
if( this->v.s) delete this->v.s;
this->v.s = s;
}
inline void hVal::set(char *s){
// if( this->b.tp != hVal::STRING) return;
if( this->v.s) delete this->v.s;
this->v.s = new std::string(s);
}
inline void hVal::set(double d){
// if( this->b.tp != hVal::DOUBLE) return;
this->v.d = d;
}
//-- const-dest
hVal::hVal(int typ,void *value,double d){
b.c = 0;
b.tp = typ;
v.vl = NULL;
if(typ == hVal::DOUBLE || typ == hVal::CDOUBLE) {
v.d = d;
}else if( typ > hVal::NIL){
if( value){
v.vl = value;
}else{
switch(typ){
case hVal::MAP:
case hVal::CMAP:
v.m = new HHMapSV_T();
break;
case hVal::FNC:
case hVal::DEQ:
case hVal::CDEQ:
v.q = new HHDeqV_T();
break;
case hVal::LOCK:
v.vl = new hLock();
break;
}
}
}
}
std::mutex ml;
void hVal::operator delete(void *p){
if( !p) return;
hVal *v = (hVal *)p;
// printf("delete %lf %ld c: %d ntp: %d tp: %s\n",v->v.d,v->v.vl,v->b.c,v->b.tp,tp_f(v->b.tp).c_str());fflush(stdout);
// printf("!delete %lf %ld %d %d %s\n",v->v.d,v->v.vl,v->b.c,v->b.tp,tps[v->b.tp]);fflush(stdout);
if( v->b.tp < hVal::DOUBLE) return;
// return;
if( v->b.c <= 0 ) {
if(v->b.c < 0){
printf("<0 !!!REAL_delete %lf %ld %d %d %s\n",v->v.d,v->v.vl,v->b.c,v->b.tp,tps[v->b.tp]);fflush(stdout);
}
// printf("REAL_delete %lf %ld %d %d %s\n",v->v.d,v->v.vl,v->b.c,v->b.tp,tp_f(v->b.tp).c_str());fflush(stdout);
if( v->v.vl){
switch(v->b.tp){
case hVal::CMAP:
case hVal::MAP:
{
register HHMapSV_T *o = v->v.m;
register HHMapSV_TI it = o->begin();
while( it != o->end()){
hVal *z = it->second;
delete z;
++it;
}
delete o;
}
break;
case hVal::FNC:
case hVal::DEQ:
case hVal::CDEQ:
{
register HHDeqV_T *o = v->v.q;
register HHDeqV_TI it = o->begin();
while( it != o->end()){
delete *it;
++it;
}
delete o;
}
break;
case hVal::STRING:
case hVal::BUF:
// printf("delete %lf %ld c: %d ntp: %d tp: %s\n",v->v.d,v->v.vl,v->b.c,v->b.tp,tp_f(v->b.tp).c_str());
// printf("%s\n",v->v.s->c_str());
fflush(stdout);
// ml.lock();
delete v->v.s;
// ml.unlock();
break;
case hVal::LOCK:
delete (hLock*)v->v.vl;
break;
case hVal::DB:
PQfinish((PGconn*)v->v.vl);
break;
case hVal::SQL:
delete (SqlAdd*)v->v.vl;
break;
case hVal::UDP:
{
UDP_T * d = (UDP_T *)v->v.vl;
if( d->s >=0) hh_closesocket(d->s);
if( d->sc >=0) hh_closesocket(d->sc);
delete d;
}
break;
case hVal::RE:
{
RE_T * d = (RE_T *)v->v.vl;
if( d->md) pcre2_match_data_free(d->md); /* Release memory used for the match */
if(d->re) pcre2_code_free(d->re); /* data and the compiled pattern. */
delete d;
}
break;
default:
{
HHMapIDF_TI it = del_map.find(v->b.tp);
if( it != del_map.end()) {
DEL_FNC f = it->second;
(*f)(v->v.vl);
}
}
break;
}
v->v.vl = NULL;
}
// ml.lock();
::delete(p);
// ml.unlock();
// printf("REAL_delete DONE!\n");fflush(stdout);
}else{
ml.lock();
--v->b.c;
ml.unlock();
}
}
// ef_FAC
hVal *ef_Fac::new_hVal(int typ,void *value,double d){
return new hVal(typ,value,d);
}
std::string *ef_Fac::new_str(std::string s){
return new std::string(s);
}
std::string *ef_Fac::new_str(char *s){
return new std::string(s);
}
std::string *ef_Fac::new_str(char *s,int length){
return new std::string(s,length);
}
HHMapSV_T *ef_Fac::new_M(){
return new HHMapSV_T();
}
HHDeqV_T *ef_Fac::new_Q(){
return new HHDeqV_T();
}
void ef_Fac::del(std::string *v){
delete v;
}
void ef_Fac::del(HHMapSV_T *v){
delete v;
}
void ef_Fac::del(HHDeqV_T *v){
delete v;
}
void ef_Fac::del(hVal *v){
delete v;
}
//-- ef_Content
//std::mutex mtx_g;
hLock glock;
ef_Content::ef_Content(){
this->g = new HHMapSV_T();
this->f = new HHMapSV_T();
this->c = new HHMapSV_T();
this->mc = 0;
this->svi = new EF_STACKV_T();
// this->svi->reserve(2000);
this->svq = new EF_STACK_T();
this->sd = new HHVecV_T();
this->sd->reserve(2000);
this->sdv = new HHVecI_T();
this->sdv->reserve(2000);
this->G = this->ef.new_hVal(hVal::MAP,this->g,0);
this->dm = &del_map;
this->T = vT;
this->F = vF;
this->N = vN;
// this->mtx = mtx_g;
// ef_init(this,this->ef,argc_,argv_);
// this->t = tttst;
/*
this->t = (MyPFNC)&ef_Content::tst;
//methods... to .so
this->m.rl = (void(*)())&ef_Content::rl;
this->m.wl = (void(*)())&ef_Content::wl;
this->m.ru = (void(*)())&ef_Content::ru;
this->m.wu = (void(*)())&ef_Content::wu;
*/
}
ef_Content::ef_Content(HHMapSV_T *g,HHMapSV_T *f,HHMapSV_T *c,EF_STACKV_T *svi,EF_STACK_T *svq,HHVecV_T *sd)
{
this->mc = 0;
if( !g) this->g = new HHMapSV_T();
else this->g = g;
if( !f) this->f = new HHMapSV_T();
else this->f = f;
if( !c) this->c = new HHMapSV_T();
else this->c = c;
//--
if( !svi) this->svi = new EF_STACKV_T();
else this->svi = svi;
if( !svq) this->svq = new EF_STACK_T();
else this->svq = svq;
if( !sd) this->sd = new HHVecV_T();
else this->sd = sd;
this->sdv = new HHVecI_T();
this->sdv->reserve(2000);
this->G = this->ef.new_hVal(hVal::MAP,this->g,0);
this->dm = &del_map;
this->T = vT;
this->F = vF;
this->N = vN;
// this->mtx = mtx_g;
// ef_init(this,this->ef,argc_,argv_);
// this->t = tttst;
// this->t = (MyPFNC)&ef_Content::tst;
}
ef_Content::~ef_Content(){
// printf("destruct ef_Content\n");
if( g){
HHMapSV_TI i= this->g->begin();
while( i != g->end()){
hVal *z = i->second;
delete z;
++i;
}
delete g;
}
if( f){
HHMapSV_TI i= this->f->begin();
while( i != f->end()){
hVal *z = i->second;
delete z;
++i;
}
delete f;
}
if( c){
HHMapSV_TI i= this->c->begin();
while( i != c->end()){
hVal *z = i->second;
delete z;
++i;
}
delete c;
}
//--
if( svi){
/*
EF_STACKV_TI i= this->sv->begin();
while( i != sv->end()){
delete *i;
++i;
}
*/
delete svi;
}
if( svq){
/*
EF_STACKV_TI i= this->sv->begin();
while( i != sv->end()){
delete *i;
++i;
}
*/
delete svq;
}
if( sd){
HHVecV_TI i= this->sd->begin();
while( i != sd->end()){
delete *i;
++i;
}
delete sd;
}
this->G->v.vl = NULL;
delete this->G;
}
void ef_Content::dI(int id,DEL_FNC v){
// dm->insert( std::pair<int, DEL_FNC>(id, v));
del_map.insert( std::pair<int, DEL_FNC>(id, v));
}
void ef_Content::fI(std::string k,hVal*v){
f->insert( std::pair<std::string, hVal*>(k,v));
}
void ef_Content::sP(hVal*v){
sd->push_back(v);
}
void ef_Content::sPB(){
sd->pop_back();
}
void ef_Content::sB(hVal*v){
sd->back() = v;
}
hVal* ef_Content::gN(){
return vN;
}
hVal* ef_Content::gZS(){
return vZS;
}
void ef_Content::ts(hVal *v,std::string &o){
lg_hVal(*this,v,0,o,0);
}
/*
void ef_Content::gI(int id,hVal*v){
}
void ef_Content::sI(int id,hVal*v){
}
*/
hLock::hLock(){
mc=0;
}
void hLock::rl(){
while(1) {