summaryrefslogtreecommitdiff
path: root/TAO/TAO_IDL/be/be_codegen.cpp
blob: cbdb76d52e4be1a164d1c23ac5723bc4e164fb97 (plain)
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
// $Id$

// ============================================================================
//
// = LIBRARY
//    TAO IDL
//
// = FILENAME
//    be_codegen.cpp
//
// = DESCRIPTION
//   Code generation
//
// = AUTHOR
//    Aniruddha Gokhale
//
// ============================================================================

#include        "idl.h"
#include        "idl_extern.h"
#include        "be.h"

ACE_RCSID(be, be_codegen, "$Id$")

TAO_CodeGen *tao_cg = TAO_CODEGEN::instance ();

/* BE global Data */
TAO_CodeGen::TAO_CodeGen (void)
  : client_header_ (0),
    client_stubs_ (0),
    client_inline_ (0),
    server_header_ (0),
    server_template_header_ (0),
    server_skeletons_ (0),
    server_template_skeletons_ (0),
    server_inline_ (0),
    server_template_inline_ (0),
    gperf_input_stream_ (0),
    gperf_input_filename_ (0),
    curr_os_ (0),
    visitor_factory_ (0),
    strategy_ (TAO_DYNAMIC_HASH)
{
}

// destructor
TAO_CodeGen::~TAO_CodeGen (void)
{
  delete this->client_header_;
  delete this->server_header_;
  delete this->server_template_header_;
  delete this->client_stubs_;
  delete this->server_skeletons_;
  delete this->server_template_skeletons_;
  delete this->client_inline_;
  delete this->server_inline_;
  delete this->server_template_inline_;
  this->curr_os_ = 0;
  delete this->visitor_factory_;
}

// visitor factory method
be_visitor *
TAO_CodeGen::make_visitor (be_visitor_context *ctx)
{
  ACE_ASSERT (this->visitor_factory_ != 0);
  return this->visitor_factory_->make_visitor (ctx);
}

// change the string to all upcase
const char *
TAO_CodeGen::upcase (const char *str)
{
  static char upcase_str [NAMEBUFSIZE];

  ACE_OS::memset (upcase_str, '\0', NAMEBUFSIZE);
  // convert letters in str to upcase
  for (unsigned int i=0; i < ACE_OS::strlen (str); i++)
    {
      if (isalpha (str [i]))
        {
          upcase_str[i] = toupper (str [i]);
        }
      else
        {
          // copy it as it is
          upcase_str[i] = str[i];
        }
    }
  return upcase_str;
}

// set the client header stream
int
TAO_CodeGen::start_client_header (const char *fname)
{
  // retrieve the singleton instance to the outstream factory
  TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();

  // retrieve a specialized instance
  this->client_header_ = factory->make_outstream ();
  if (!this->client_header_)
    {
      return -1;
    }

  if (this->client_header_->open (fname, TAO_OutStream::TAO_CLI_HDR) == -1)
    return -1;
  else
    {
      // now generate the #if !defined clause
      static char macro_name [NAMEBUFSIZE];

      ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
      const char *suffix = ACE_OS::strstr (fname, ".h");
      if (suffix == 0)
        return -1; // bad file name
      else
        {
          ACE_OS::sprintf (macro_name, "_TAO_IDL_");
          // convert letters in fname to upcase
          for (int i=0; i < (suffix - fname); i++)
            {
              if (isalpha (fname [i]))
                macro_name[i+9] = toupper (fname [i]);
              else if (isdigit (fname [i]))
                macro_name[i+9] = fname[i];
              else
                macro_name[i+9] = '_';
            }

          ACE_OS::strcat (macro_name, "_H_");

          // generate the #ifndef ... #define statements
          this->client_header_->print ("#if !defined (%s)\n", macro_name);
          this->client_header_->print ("#define %s\n\n", macro_name);

          *this->client_header_ << "#include \"tao/corba.h\"\n";

          if (idl_global->export_include () != 0)
            {
              *this->client_header_ << "#include \""
                                    << idl_global->export_include ()
                                    << "\"\n";
            }

          // We must include all the skeleton headers corresponding to
          // IDL files included by the current IDL file.
          for (size_t j = 0;
               j < idl_global->n_include_file_names ();
               ++j)
            {
              String* idl_name =
                idl_global->include_file_names()[j];

              const char* client_hdr =
                IDL_GlobalData::be_get_client_hdr (idl_name);

              if (client_hdr != 0)
                {
                  this->client_header_->print ("#include \"%s\"\n",
                                               client_hdr);
                }
              else
                {
                  ACE_ERROR ((LM_WARNING,
                              "WARNING, invalid file '%s' included\n",
                              idl_name->get_string ()));
                }
            }
          *this->client_header_ << "\n";

          // generate the TAO_EXPORT_MACRO macro
          *this->client_header_ << "#if defined (TAO_EXPORT_MACRO)\n";
          *this->client_header_ << "#undef TAO_EXPORT_MACRO\n";
          *this->client_header_ << "#endif\n";
          *this->client_header_ << "#define TAO_EXPORT_MACRO "
                                << idl_global->export_macro () << be_nl;
          
          *this->client_header_ << "#if defined(_MSC_VER)\n"
                                << "#pragma warning(disable:4250)\n"
                                << "#endif /* _MSC_VER */\n\n";

          return 0;
        }
    }
}

// get the client header stream
TAO_OutStream *
TAO_CodeGen::client_header (void)
{
  return this->client_header_;
}

// set the client stub stream
int
TAO_CodeGen::start_client_stubs (const char *fname)
{
  // retrieve the singleton instance to the outstream factory
  TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();

  // retrieve a specialized instance
  this->client_stubs_ = factory->make_outstream ();
  if (!this->client_stubs_)
    {
      return -1;
    }

  if (this->client_stubs_->open (fname, TAO_OutStream::TAO_CLI_IMPL) == -1)
    {
      return -1;
    }
  // generate the include statement for the client header
  *this->client_stubs_ << "#include \"" <<
    idl_global->be_get_client_hdr_fname () << "\"\n\n";

  *this->client_stubs_ << "#include \"" <<
    idl_global->be_get_server_hdr_fname () << "\"\n\n";

  // generate the code that includes the inline file if not included in the
  // header file
  *this->client_stubs_ << "#if !defined (__ACE_INLINE__)\n";
  *this->client_stubs_ << "#include \"" <<
    idl_global->be_get_client_inline_fname () << "\"\n";
  *this->client_stubs_ << "#endif /* !defined INLINE */\n\n";
  return 0;
}

// get the client stubs stream
TAO_OutStream *
TAO_CodeGen::client_stubs (void)
{
  return this->client_stubs_;
}

// set the client inline stream
int
TAO_CodeGen::start_client_inline (const char *fname)
{
  // retrieve the singleton instance to the outstream factory
  TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();

  // retrieve a specialized instance
  this->client_inline_ = factory->make_outstream ();
  if (!this->client_inline_)
    {
      return -1;
    }

  return this->client_inline_->open (fname, TAO_OutStream::TAO_CLI_INL);
}

// get the client inline stream
TAO_OutStream *
TAO_CodeGen::client_inline (void)
{
  return this->client_inline_;
}

// set the server header stream.
int
TAO_CodeGen::start_server_header (const char *fname)
{
  // retrieve the singleton instance to the outstream factory
  TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();

  // retrieve a specialized instance
  this->server_header_ = factory->make_outstream ();
  if (!this->server_header_)
    {
      return -1;
    }

  if (this->server_header_->open (fname, TAO_OutStream::TAO_SVR_HDR) == -1)
    return -1;
  else
    {
      // now generate the #if !defined clause
      static char macro_name [NAMEBUFSIZE];

      ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
      const char *suffix = ACE_OS::strstr (fname, ".h");
      if (suffix == 0)
        return -1; // bad file name
      else
        {
          ACE_OS::sprintf (macro_name, "_TAO_IDL_");
          // convert letters in fname to upcase
          for (int i=0; i < (suffix - fname); i++)
            if (isalpha (fname [i]))
              macro_name[i+9] = toupper (fname [i]);
            else if (isdigit (fname [i]))
              macro_name[i+9] = fname[i];
            else
              macro_name[i+9] = '_';

          ACE_OS::strcat (macro_name, "_H_");

          this->server_header_->print ("#if !defined (%s)\n", macro_name);
          this->server_header_->print ("#define %s\n\n", macro_name);

          // We must include all the skeleton headers corresponding to
          // IDL files included by the current IDL file.
          for (size_t j = 0;
               j < idl_global->n_include_file_names ();
               ++j)
            {
              String* idl_name =
                idl_global->include_file_names()[j];

              const char* server_hdr =
                IDL_GlobalData::be_get_server_hdr (idl_name);

              this->server_header_->print ("#include \"%s\"\n",
                                           server_hdr);
            }
          // the server header should include the client header
          *this->server_header_ << "#include \"" <<
            idl_global->be_get_client_hdr_fname () << "\"\n\n";

          *this->server_header_ << "#if defined(_MSC_VER)\n"
                                << "#pragma warning(disable:4250)\n"
                                << "#endif /* _MSC_VER */\n\n";

          return 0;
        }
    }
}

// get the server header stream
TAO_OutStream *
TAO_CodeGen::server_header (void)
{
  return this->server_header_;
}

// set the server header stream
int
TAO_CodeGen::start_server_template_header (const char *fname)
{
  // retrieve the singleton instance to the outstream factory
  TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();

  // retrieve a specialized instance
  this->server_template_header_ = factory->make_outstream ();
  if (!this->server_template_header_)
    return -1;

  if (this->server_template_header_->open (fname,
                                           TAO_OutStream::TAO_SVR_TMPL_HDR)
      == -1)
    return -1;
  else
    {
      // now generate the #if !defined clause
      static char macro_name [NAMEBUFSIZE];

      ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
      const char *suffix = ACE_OS::strstr (fname, ".h");
      if (suffix == 0)
        return -1; // bad file name
      else
        {
          ACE_OS::sprintf (macro_name, "_TAO_IDL_");
          // convert letters in fname to upcase
          for (int i=0; i < (suffix - fname); i++)
            if (isalpha (fname [i]))
              macro_name[i+9] = toupper (fname [i]);
            else if (isdigit (fname [i]))
              macro_name[i+9] = fname[i];
            else
              macro_name[i+9] = '_';

          ACE_OS::strcat (macro_name, "_H_");

          this->server_template_header_->print ("#if !defined (%s)\n",
                                                macro_name);
          this->server_template_header_->print ("#define %s\n\n", macro_name);

          *this->server_template_header_ << "#if defined(_MSC_VER)\n"
                                         << "#pragma warning(disable:4250)\n"
                                         << "#endif /* _MSC_VER */\n\n";

          return 0;
        }
    }
}

// get the server header stream
TAO_OutStream *
TAO_CodeGen::server_template_header (void)
{
  return this->server_template_header_;
}

// set the server skeletons stream
int
TAO_CodeGen::start_server_skeletons (const char *fname)
{
  // retrieve the singleton instance to the outstream factory
  TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();

  // retrieve a specialized instance
  this->server_skeletons_ = factory->make_outstream ();
  if (!this->server_skeletons_)
    {
      return -1;
    }

  if (this->server_skeletons_->open (fname, TAO_OutStream::TAO_SVR_IMPL) == -1)
    {
      return -1;
    }

  // generate the include statement for the server header
  *this->server_skeletons_ << "#include \"" <<
    idl_global->be_get_server_hdr_fname () << "\"\n\n";

  // generate the code that includes the inline file if not included in the
  // header file
  *this->server_skeletons_ << "#if !defined (__ACE_INLINE__)\n";
  *this->server_skeletons_ << "#include \"" <<
    idl_global->be_get_server_inline_fname () << "\"\n";
  *this->server_skeletons_ << "#endif /* !defined INLINE */\n\n";
  return 0;
}

// Get the server skeletons stream.
TAO_OutStream *
TAO_CodeGen::server_skeletons (void)
{
  return this->server_skeletons_;
}

// Start the server template skeleton stream.
int
TAO_CodeGen::start_server_template_skeletons (const char *fname)
{
  // retrieve the singleton instance to the outstream factory
  TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();

  // retrieve a specialized instance
  this->server_template_skeletons_ = factory->make_outstream ();
  if (!this->server_template_skeletons_)
    {
      return -1;
    }

  if (this->server_template_skeletons_->open (fname,
                                           TAO_OutStream::TAO_SVR_TMPL_IMPL)
      == -1)
    return -1;
  else
    {
      // now generate the #if !defined clause
      static char macro_name [NAMEBUFSIZE];

      ACE_OS::memset (macro_name, '\0', NAMEBUFSIZE);
      const char *suffix = ACE_OS::strstr (fname, ".cpp");
      if (suffix == 0)
        return -1; // bad file name

      ACE_OS::sprintf (macro_name, "_TAO_IDL_");
      // convert letters in fname to upcase
      for (int i=0; i < (suffix - fname); i++)
        if (isalpha (fname [i]))
          macro_name[i+9] = toupper (fname [i]);
        else if (isdigit (fname [i]))
          macro_name[i+9] = fname[i];
        else
          macro_name[i+9] = '_';

      ACE_OS::strcat (macro_name, "_CPP_");

      this->server_template_skeletons_->print ("#if !defined (%s)\n",
                                               macro_name);
      this->server_template_skeletons_->print ("#define %s\n\n", macro_name);

      *this->server_template_skeletons_ << "#if defined(_MSC_VER)\n"
                                        << "#pragma warning(disable:4250)\n"
                                        << "#endif /* _MSC_VER */\n\n";

      // generate the include statement for the server header
      *this->server_template_skeletons_ << "#include \"" <<
        idl_global->be_get_server_template_hdr_fname () << "\"\n\n";

      // generate the code that includes the inline file if not included in the
      // header file
      *this->server_template_skeletons_ << "#if !defined (__ACE_INLINE__)\n";
      *this->server_template_skeletons_ << "#include \"" <<
        idl_global->be_get_server_template_inline_fname () << "\"\n";
      *this->server_template_skeletons_ << "#endif /* !defined INLINE */\n\n";
      return 0;

    }
}

// get the server template skeletons stream
TAO_OutStream *
TAO_CodeGen::server_template_skeletons (void)
{
  return this->server_template_skeletons_;
}

// set the server inline stream
int
TAO_CodeGen::start_server_inline (const char *fname)
{
  // retrieve the singleton instance to the outstream factory
  TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();

  // retrieve a specialized instance
  this->server_inline_ = factory->make_outstream ();
  if (!this->server_inline_)
    {
      return -1;
    }

  return this->server_inline_->open (fname, TAO_OutStream::TAO_SVR_INL);
}

// get the server inline stream
TAO_OutStream *
TAO_CodeGen::server_inline (void)
{
  return this->server_inline_;
}

// set the server template inline stream
int
TAO_CodeGen::start_server_template_inline (const char *fname)
{
  // retrieve the singleton instance to the outstream factory
  TAO_OutStream_Factory *factory = TAO_OUTSTREAM_FACTORY::instance ();

  // retrieve a specialized instance
  this->server_template_inline_ = factory->make_outstream ();
  if (!this->server_template_inline_)
    {
      return -1;
    }

  return this->server_template_inline_->open (fname, TAO_OutStream::TAO_SVR_INL);
}

// get the server template inline stream
TAO_OutStream *
TAO_CodeGen::server_template_inline (void)
{
  return this->server_template_inline_;
}

// put the last #endif in the client and server headers
int
TAO_CodeGen::end_client_header (void)
{
  // generate the <<= and >>= operators here

  // insert the code to include the inline file
  *this->client_header_ << "\n#if defined (__ACE_INLINE__)\n";
  *this->client_header_ << "#include \"" <<
    idl_global->be_get_client_inline_fname () << "\"\n";
  *this->client_header_ << "#endif /* defined INLINE */\n\n";

  *this->client_header_ << "#if defined(_MSC_VER)\n"
                        << "#pragma warning(default:4250)\n"
                        << "#endif /* _MSC_VER */\n";

  // code to put the last #endif
  *this->client_header_ << "\n#endif /* if !defined */\n";
  return 0;
}

int
TAO_CodeGen::end_server_header (void)
{
  // insert the template header
  *this->server_header_ << "#include \"" <<
    idl_global->be_get_server_template_hdr_fname () << "\"\n";

  // insert the code to include the inline file
  *this->server_header_ << "\n#if defined (__ACE_INLINE__)\n";
  *this->server_header_ << "#include \"" <<
    idl_global->be_get_server_inline_fname () << "\"\n";
  *this->server_header_ << "#endif /* defined INLINE */\n\n";

  *this->server_header_ << "#if defined(_MSC_VER)\n"
                        << "#pragma warning(default:4250)\n"
                        << "#endif /* _MSC_VER */\n";

  // code to put the last #endif
  *this->server_header_ << "\n#endif /* if !defined */\n";
  return 0;
}

int
TAO_CodeGen::end_server_template_header (void)
{
  // insert the code to include the inline file
  *this->server_template_header_ << "\n#if defined (__ACE_INLINE__)\n";
  *this->server_template_header_ << "#include \"" <<
    idl_global->be_get_server_template_inline_fname () << "\"\n";
  *this->server_template_header_ << "#endif /* defined INLINE */\n\n";

  // insert the code to include the template source file
  *this->server_template_header_
    << "\n#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)\n";
  *this->server_template_header_ << "#include \"" <<
    idl_global->be_get_server_template_skeleton_fname () << "\"\n";
  *this->server_template_header_ << "#endif /* defined REQUIRED SOURCE */\n\n";

  // insert the code to include the template pragma
  *this->server_template_header_
    << "\n#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)\n";
  *this->server_template_header_ << "#pragma implementation (\"" <<
    idl_global->be_get_server_template_skeleton_fname () << "\")\n";
  *this->server_template_header_ << "#endif /* defined REQUIRED PRAGMA */\n\n";

  *this->server_template_header_ << "#if defined(_MSC_VER)\n"
                                 << "#pragma warning(default:4250)\n"
                                 << "#endif /* _MSC_VER */\n";

  // code to put the last #endif
  *this->server_template_header_ << "\n#endif /* if !defined */\n";
  return 0;
}

int
TAO_CodeGen::end_server_template_skeletons (void)
{
  // code to put the last #endif
  *this->server_template_skeletons_ << "\n#endif /* if !defined */\n";
  return 0;
}

// We use the following helper functions to pass information. This class is the
// best place to pass such information rather than passing information through
// global variables spread everywhere. This class is a singleton and is
// effectively a global.

void
TAO_CodeGen::gperf_input_stream (TAO_OutStream *os)
{
  this->gperf_input_stream_ = os;
}

TAO_OutStream *
TAO_CodeGen::gperf_input_stream (void)
{
  return this->gperf_input_stream_;
}

void
TAO_CodeGen::gperf_input_filename (char *filename)
{
  this->gperf_input_filename_ = filename;
}

char *
TAO_CodeGen::gperf_input_filename (void)
{
  return this->gperf_input_filename_;
}

void
TAO_CodeGen::outstream (TAO_OutStream *os)
{
  this->curr_os_ = os;
}

TAO_OutStream *
TAO_CodeGen::outstream (void)
{
  return this->curr_os_;
}

void
TAO_CodeGen::node (be_decl *n)
{
  this->node_ = n;
}

be_decl *
TAO_CodeGen::node (void)
{
  return this->node_;
}

void
TAO_CodeGen::visitor_factory (TAO_Visitor_Factory *f)
{
  this->visitor_factory_ = f;
}

void
TAO_CodeGen::lookup_strategy (LOOKUP_STRATEGY s)
{
  this->strategy_ = s;
}

TAO_CodeGen::LOOKUP_STRATEGY
TAO_CodeGen::lookup_strategy (void) const
{
  return this->strategy_;
}

#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>;
template class ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#pragma instantiate ACE_Singleton<TAO_CodeGen, ACE_SYNCH_RECURSIVE_MUTEX>
#pragma instantiate ACE_Singleton<TAO_OutStream_Factory, ACE_SYNCH_RECURSIVE_MUTEX>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */