StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
MakeTableClasses.cxx
1 // $Id: MakeTableClasses.cxx,v 1.3 2006/08/15 21:43:17 jeromel Exp $
2 // $Log: MakeTableClasses.cxx,v $
3 // Revision 1.3 2006/08/15 21:43:17 jeromel
4 // Fix rhic -> rhic.bnl.gov
5 //
6 // Revision 1.2 1999/05/21 15:33:51 kathy
7 // made sure Log & Id are in each file and also put in standard comment line with name of owner
8 //
9 //=======================================================================
10 // owner: Valery Fine
11 // what it does:
12 //=======================================================================
13 void MakeTableClasses(){
14 // gROOT->Reset();
15 //#pragma Ccomment on
16  // Create the St_<table> classes, where <table> is a name of the STAF
17  // table.
18  //
19  // Input: The directory with stic-generated C+structure descritions
20  // Output: St_%_Table.cxx and St_%_Table.h files
21 
22 // Load the share libraries
23 
24  Char_t *libs[] = {"St_base"};
25  Char_t *suffix=0;
26  Int_t nlist = 1;
27  Bool_t NT=kFALSE;
28  if (strcmp(gSystem.GetName(),"WinNT") == 0 ) {
29  NT = kTRUE;
30 // gSystem.Load("Root_html.dll");
31  suffix = ".dll";
32  }
33  else
34  suffix =".so";
35 // Load the extra share /dynamic libraries if any
36  Char_t buffer[256];
37  for(Int_t i=0;i<nlist;i++) {
38  strcpy(buffer,libs[i]);strcat(buffer,suffix);
39  if (gSystem.Load(buffer)) printf(" Loading DLL \"%s\" failed \n",buffer);
40  }
41 
42  void *dirhandle = 0;
43  char *sourcedir = 0;
44  if (NT)
45  sourcedir = "//sol/afs_rhic/star/packages/dev/.share/tables";
46  else
47  sourcedir = "/afs/rhic.bnl.gov/star/packages/dev/.share/tables";
48  NT = kFALSE;
49  dirhandle = gSystem->OpenDirectory(sourcedir);
50  if (dirhandle) {
51  char *na = 0;
52  Int_t count=0;
53  Char_t name[200];
54  Char_t *structname = 0;
55  while (na = gSystem->GetDirEntry(dirhandle) && count < 999993) {
56  char *dot = 0;
57  strcpy(name,na);
58  if (!strstr(name,"St_") && (dot = strstr(name,".h")) ){
59  Char_t *filename = gSystem->ConcatFileName(sourcedir,name);
60  printf("G__loadfile(\"%s\");\n",filename);
61  G__loadfile(filename);
62  *dot = 0;
63  structname = strrchr(name,'/');
64 
65  if (structname)
66  structname++;
67  else if (structname = strrchr(name,':'))
68  structname++;
69  else
70  structname = name;
71 
72  printf("St_Table tabs(\"%s\",1);\n",structname);
73  printf("tabs.StafStreamer();\n");
74  St_Table *tablest = new St_Table(structname,1);
75  if (tablest) {
76 // tablest->StafStreamer();
77  delete tablest;
78  count++;
79  }
80  else
81  printf(" CINT Error. The \"%s\" was not done!\n",structname);
82  if (filename) delete [] filename;
83  }
84  }
85  printf(" %d files have been converted\n",count);
86  }
87 }
Definition: TTable.h:48