home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 98 / af098sub.adf / gallery.LZX / Gallery / Gallery.cpp < prev    next >
C/C++ Source or Header  |  1990-06-03  |  16KB  |  560 lines

  1. #define __VERSION__     "39"
  2. #define __REVISION__     "2"
  3. #define __NAME__            "Gallery"
  4. #define __AUTHOR__        "Markus Hillenbrand"
  5.  
  6. char *V = "$VER: " __NAME__ " " __VERSION__ "." __REVISION__ " (" __DATE__ ")";
  7.  
  8.  
  9. #include <string.h>
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12.  
  13. #include <GUIC_Classes/GUIC_System.hpp>
  14. #include <GUIC_Classes/GUIC_Date.hpp>
  15. #include <GUIC_Classes/GUIC_Error.hpp>
  16. #include <GUIC_Classes/GUIC_Frame.hpp>
  17. #include <GUIC_Classes/GUIC_Application.hpp>
  18. #include <GUIC_Classes/GUIC_Screen.hpp>
  19. #include <GUIC_Classes/GUIC_Window.hpp>
  20. #include <GUIC_Classes/GUIC_Error.hpp>
  21. #include <GUIC_Classes/GUIC_Exceptions.hpp>
  22. #include <GUIC_Classes/GUIC_DirectoryExamine.hpp>
  23. #include <GUIC_Classes/GUIC_FileExamine.hpp>
  24. #include <GUIC_Classes/GUIC_File.hpp>
  25. #include <GUIC_Classes/GUIC_Key.hpp>
  26. #include <GUIC_Classes/GUIC_List.hpp>
  27. #include <GUIC_Classes/GUIC_Node.hpp>
  28. #include <GUIC_Classes/GUIC_Exceptions.hpp>
  29. #include <GUIC_Classes/GUIC_Button.hpp>
  30. #include <GUIC_Classes/GUIC_String.hpp>
  31. #include <GUIC_Classes/GUIC_Integer.hpp>
  32. #include <GUIC_Classes/GUIC_Slider.hpp>
  33. #include <GUIC_Classes/GUIC_Label.hpp>
  34. #include <GUIC_Classes/GUIC_SlidingInteger.hpp>
  35. #include <GUIC_Classes/GUIC_FileString.hpp>
  36. #include <GUIC_Classes/GUIC_PathString.hpp>
  37. #include <GUIC_Classes/GUIC_Message.hpp>
  38. #include <GUIC_Classes/GUIC_FileRequester.hpp>
  39. #include <GUIC_Classes/GUIC_ProgramArgs.hpp>
  40.  
  41. #define COPYRIGHT    "<SMALL> index file created with 'Gallery', (c) 1997 by <A HREF=\"http://www.student.uni-kl.de/~hillenbr\">Markus Hillenbrand</A> </SMALL>"
  42. #define FILEFILTER     "#?.(jpeg|jpg|gif|iff|ilbm|iff24|png)"
  43. #define MINLINES        3
  44. #define ROWS            5
  45. #define MAXLINES        200
  46.  
  47. GUIC_ListC errorList;
  48. int lastDay=0,lastMonth=0,lastYear=0;
  49.  
  50.  
  51. class GalleryEntryC : public GUIC_ObjectC
  52.     {
  53.     public:
  54.         GalleryEntryC    (STRPTR f, LONG s, int d, int m, int y)     { fileName=f; size=s; day=d; month=m; year=y; }
  55.         int compare     (GUIC_ObjectC &o);
  56.         String fileName;
  57.         int day,month,year;
  58.         LONG size;
  59.     protected:
  60.         void cleanUp(void) {};
  61.     };
  62.     
  63. int GalleryEntryC::compare(GUIC_ObjectC &o)
  64.     // First we must convert the argument to what it really is:
  65.     GalleryEntryC *g = (GalleryEntryC *)&o; 
  66.     
  67.     int result = strcmp(this->fileName, g->fileName); // Just compare the two file names
  68.     if (result == 0) return 0; // if there are equal, just return zero
  69.     
  70.     if (this->day && g->day) // then both are normal galleries without any subdirectories
  71.         {
  72.         return result;
  73.         }
  74.     else if (! this->day && ! g->day) // then both are galleries which contain subdirectories
  75.         {
  76.         return result;
  77.         }
  78.     else if (this->day) // this this is a normal entry and should be inserted after the gallery with subdirectories
  79.         {
  80.         return 1;
  81.         }
  82.     else return -1; // the other case
  83. }
  84.  
  85. String     makeThumbnail    (GUIC_FileExamineC &file)
  86. {
  87.     String fileName = file.getName();
  88.  
  89.     int i = fileName.length();
  90.     while (--i) if (fileName[i] == '.') break;
  91.  
  92.     String thumbName = fileName.left(i);
  93.     thumbName+="_.jpg";
  94.  
  95.     try
  96.         {
  97.         GUIC_FileExamineC f(thumbName);
  98.         if (f.newer(file)) return thumbName;
  99.         }
  100.     catch (GUIC_SystemX &e) { }
  101.  
  102.     String args = "<>NIL: \"" + fileName + "\" TO \"" + thumbName + "\" FORMAT JPEG QUALITY 90 BOXFIT 100 100";
  103.  
  104.     cout << " - creating thumbnail for file '" << fileName << "' ... " << flush;
  105.     BOOL result = GUIC_SystemC::runProgram("GfxCon_68020", 100000, args);
  106.     if (result) cout << "done." << endl; else cout << "error occured." << endl;
  107.  
  108.     return thumbName;
  109. }
  110. void         createGallery        (GUIC_ListC &fileList, STRPTR pattern, LONG maxLines)
  111. {
  112.     GalleryEntryC *key = (GalleryEntryC *)fileList.objectAt(1);
  113.     GUIC_FileExamineC firstFile(key->fileName);
  114.     String currentDir = firstFile.getPathPart();
  115.     
  116.     ldiv_t d = ldiv ( fileList.length(), ROWS );
  117.     int lines = d.quot;
  118.     if (d.rem) lines++;
  119.     
  120.     d = ldiv (lines, maxLines);
  121.     int galleries = d.quot;
  122.     if (d.rem) galleries++;
  123.  
  124.     cout << "Creating " << galleries << " galleries in directory '" << currentDir << "' " << endl;
  125.     
  126.     fileList.sort();
  127.     
  128.     GUIC_FileExamineC directoryName(currentDir);
  129.  
  130.     // Create the index file with the frames
  131.     GUIC_FileC gallery(currentDir, "index.html", GUIC_Write);
  132.     gallery.write("<TITLE>Gallery '");
  133.     gallery.write(directoryName.getFilePart());
  134.     gallery.writeLn("'</TITLE>");
  135.     gallery.writeLn("<FRAMESET COLS=150,*>");
  136.     gallery.writeLn("<FRAME NAME=F1 SRC=\"galleries.html\" MarginHeight=0 MarginWidth=0 Scrolling=\"auto\" FrameBorder=0>");
  137.     gallery.writeLn("<FRAME NAME=F2 SRC=\"index1.html\" MarginHeight=0 MarginWidth=0 Scrolling=\"auto\" FrameBorder=0>");
  138.     gallery.writeLn("</FRAMESET>");
  139.     
  140.     // now create the overview over the galleries
  141.     GUIC_FileC overview (currentDir, "galleries.html", GUIC_Write);
  142.     overview.writeLn("<HTML>");
  143.     overview.write("<H2>"); 
  144.     overview.write(directoryName.getFilePart());
  145.     overview.writeLn("</H2><BR>");
  146.     for (int i=1; i<=galleries; i++)
  147.         {
  148.         overview.write("<A HREF=\"index");
  149.         overview.write(i);
  150.         overview.write(".html\" TARGET=F2>Gallery ");
  151.         overview.write(i);
  152.         overview.writeLn("</A> <BR>");
  153.         }
  154.     overview.writeLn("</HTML>");
  155.  
  156.     // create each gallery
  157.     int count = 0;
  158.     for (i=1; i<=galleries; i++)
  159.         {
  160.         char filename[256];
  161.         sprintf(filename, "index%ld.html", i);
  162.         
  163.         GUIC_FileC indexFile(currentDir, filename, GUIC_Write);
  164.  
  165.         // write head and title    
  166.         indexFile.writeLn("<HTML>");
  167.         indexFile.writeLn("<HEAD>");
  168.     
  169.         indexFile.write("<TITLE> "); indexFile.write(directoryName.getFilePart());    indexFile.writeLn(" </TITLE>");
  170.         indexFile.writeLn("</HEAD>");
  171.         indexFile.write("<BODY");
  172.         if (pattern)
  173.             {
  174.             indexFile.write(" Background=\"");
  175.             indexFile.write(pattern);
  176.             indexFile.write("\"");
  177.             }
  178.         indexFile.writeLn(">");
  179.         
  180.         indexFile.write("<CENTER><H2>"); 
  181.         indexFile.write(directoryName.getFilePart()); 
  182.         indexFile.write("</H2> (Part ");
  183.         indexFile.write(i);
  184.         indexFile.write(" of ");
  185.         indexFile.write(galleries);
  186.         indexFile.writeLn(")<BR>");
  187.  
  188.         indexFile.writeLn("<HR>");
  189.         indexFile.writeLn("<TABLE Border=1 CellSpacing=4 CellPadding=4>");
  190.         
  191.         int boundary = count + ROWS*maxLines;
  192.         if (boundary>fileList.length()) boundary = fileList.length();
  193.         
  194.         for (int j=count; j<boundary; j++)
  195.             {
  196.             key = (GalleryEntryC *)fileList.objectAt(j+1);
  197.             GUIC_FileExamineC file(key->fileName);
  198.             String thumbName = "";
  199.  
  200.             // Create the thumbnail now            
  201.             try
  202.                 {
  203.                 thumbName = makeThumbnail(file);
  204.                 GUIC_FileExamineC thumb (thumbName);
  205.                 thumbName = thumb.getFilePart();
  206.                 }
  207.             catch (GUIC_SystemX &e) { GalleryEntryC *s = new GalleryEntryC(key->fileName,0,0,0,0); errorList.addTail(*s); }
  208.  
  209.             // Check the date
  210.             GUIC_DateC oldDate(lastDay,lastMonth,lastYear),*fileDate = file.getDate();;
  211.             if (fileDate->greater(oldDate) )
  212.                 {
  213.                 lastDay   = fileDate->getDay();
  214.                 lastMonth = fileDate->getMonth();
  215.                 lastYear  = fileDate->getYear();
  216.                 }
  217.  
  218.             // Check if there are 5 entries per line in the table
  219.             if (count++ % ROWS == 0) indexFile.write("<TR> ");
  220.  
  221.             // write the picture data                
  222.             indexFile.write("<TD> <CENTER> <IMG SRC=\"");
  223.             indexFile.write(thumbName);
  224.             indexFile.write("\"> <BR> <A HREF=\"");
  225.             indexFile.write(file.getFilePart());
  226.             indexFile.write("\"> ");
  227.             indexFile.write(file.getFilePart());
  228.             indexFile.write(" </A> <BR> Size: ");
  229.             indexFile.write(key->size);
  230.             indexFile.write(" <BR> Date: ");
  231.             indexFile.write(key->day);
  232.             indexFile.write(".");
  233.             indexFile.write(key->month);
  234.             indexFile.write(".");
  235.             indexFile.write(key->year);
  236.             indexFile.writeLn("</TD>");
  237.             }
  238.  
  239.         indexFile.writeLn("</TABLE>");
  240.  
  241.         indexFile.writeLn("<HR>");
  242.         indexFile.writeLn(COPYRIGHT);
  243.         indexFile.writeLn("</BODY>");
  244.         indexFile.writeLn("</HTML>");
  245.         }
  246. }
  247. void         createHTML        (GUIC_ListC &fileList, STRPTR pattern, BOOL hasParent)
  248. {
  249.     GalleryEntryC *key = (GalleryEntryC *)fileList.objectAt(1);
  250.     GUIC_FileExamineC firstFile(key->fileName);
  251.  
  252.     STRPTR currentDir = firstFile.getPathPart();
  253.     GUIC_FileC indexFile(currentDir, "index.html", GUIC_Write);
  254.     GUIC_FileExamineC directoryName(currentDir);
  255.  
  256.     String titleString = directoryName.getFilePart();
  257.     if (titleString == String("") ) titleString = directoryName.getName();
  258.  
  259.     cout << "Creating file '" << indexFile.getName() << "'" << endl;
  260.  
  261.     indexFile.writeLn("<HTML>");
  262.     indexFile.writeLn("<HEAD>");
  263.     indexFile.write("<TITLE> "); indexFile.write(titleString); indexFile.writeLn(" </TITLE>");
  264.     indexFile.writeLn("</HEAD>");
  265.     indexFile.write("<BODY");
  266.     if (pattern)
  267.         {
  268.         indexFile.write(" Background=\"");
  269.         indexFile.write(pattern);
  270.         indexFile.write("\"");
  271.         }
  272.     indexFile.writeLn(">");
  273.     indexFile.write("<CENTER><H1>"); indexFile.write(titleString); indexFile.writeLn("</H1>");
  274.     indexFile.writeLn("<HR><BR><BR>");
  275.     indexFile.writeLn("<TABLE Border=1 CellSpacing=4 CellPadding=4>");
  276.     indexFile.writeLn("<TR> <TH> <CENTER> <H3> Gallery Name </H3> </TH> <TH> <CENTER> <H3> Entries </H3> </TH> <TH> <CENTER> <H3> Last Update </H3> </TH>");
  277.     
  278.     fileList.sort();
  279.  
  280.     for (int i=1; i<=fileList.length(); i++)
  281.         {
  282.         key = (GalleryEntryC *)fileList.objectAt(i);
  283.         GUIC_FileExamineC file (key->fileName);
  284.  
  285.         indexFile.write("<TR> <TD> <CENTER> <A HREF=\"");
  286.         indexFile.write(file.getFilePart());
  287.         indexFile.write("/index.html\"");
  288.         indexFile.write("> ");
  289.         indexFile.write(file.getFilePart());
  290.         indexFile.write(" </A> </TD> <TD> <CENTER> ");
  291.         indexFile.write(key->size);
  292.         indexFile.write(" </TD> <TD> <CENTER> ");
  293.  
  294.         if (key->day)
  295.             {
  296.             indexFile.write(key->day);
  297.             indexFile.write(".");
  298.             indexFile.write(key->month);
  299.             indexFile.write(".");
  300.             indexFile.write(key->year);
  301.             }
  302.         else indexFile.write("(Directory)");
  303.         indexFile.writeLn(" </TD>");
  304.         }
  305.  
  306.     indexFile.writeLn("</TABLE>");
  307.  
  308.     indexFile.writeLn("<HR>");
  309.     indexFile.writeLn(COPYRIGHT);
  310.     indexFile.writeLn("</BODY>");
  311.     indexFile.writeLn("</HTML>");
  312. }
  313. int             scanDir                (STRPTR startDir, STRPTR pattern, LONG maxEntries)
  314. {
  315.     GUIC_ListC fileList,dirList;
  316.     GalleryEntryC *key = 0;
  317.     GUIC_FileExamineC *filex = 0;
  318.     int entries = 0;
  319.  
  320.     GUIC_FileExamineC *examine = new GUIC_FileExamineC(startDir);
  321.     if (!examine->isDirectory()) throw GUIC_SystemX("Error in function ScanDir (directory name expected).");
  322.     String dirName = examine->getName();
  323.     delete examine; examine=0;
  324.  
  325.     GUIC_DirectoryExamineC *direx= new GUIC_DirectoryExamineC(dirName);
  326.     BOOL hasSubDirs = direx->hasSubdirectory();
  327.     if (!hasSubDirs) direx->setFilter(FILEFILTER);
  328.  
  329.     try
  330.         {
  331.         while ( (filex = direx->examineNext()) )
  332.             {
  333.             String fileName  = filex->getName();
  334.             GUIC_DateC *date = filex->getDate();
  335.  
  336.             if (filex->isDirectory())
  337.                 {
  338.                 String newPattern = String("../") + String(pattern);
  339.                 int entriesInDir  = scanDir(fileName, newPattern, maxEntries);
  340.                 if (entriesInDir)
  341.                     {
  342.                     key = new GalleryEntryC(fileName, entriesInDir, lastDay, lastMonth, lastYear);
  343.                     if (!key) throw GUIC_MemoryX("Can't allocate memory for key.");
  344.                     dirList.addTail(*key);
  345.                     entries+=entriesInDir;
  346.                     }
  347.                 lastDay=0; lastMonth=0; lastYear=0;
  348.                 }
  349.             else if (! hasSubDirs && (fileName.right(5) != String("_.jpg") ) )
  350.                 {
  351.                 key = new GalleryEntryC(fileName, filex->getSize(), date->getDay(), date->getMonth(), date->getYear() );
  352.                 if (!key) throw GUIC_MemoryX("Can't allocate memory for key.");
  353.                 fileList.addTail(*key);
  354.                 entries++;
  355.                 }
  356.             }
  357.         }
  358.     catch (GUIC_SystemX &e) { cerr << "Exception caught while processing directory '" << direx->getName() << "': " << e.getMessage() << endl; }
  359.     delete direx;direx=0; /* Damit der lock auf das Verzeichnis freigegeben wird ! */
  360.  
  361.     if (dirList.length())     createHTML        (dirList,pattern, TRUE);
  362.     if (fileList.length())    createGallery        (fileList,pattern, maxEntries);
  363.  
  364.     while (fileList.length()) delete (GalleryEntryC *)fileList.remove(1);
  365.     while ( dirList.length()) delete (GalleryEntryC *) dirList.remove(1);
  366.  
  367.     return entries;
  368. }
  369.  
  370.  
  371. class GalleryWindowC : public GUIC_WindowC
  372.     {
  373.     public:
  374.         GalleryWindowC    (GUIC_ApplicationC *app, GUIC_ScreenC *screen);
  375.         ~GalleryWindowC (void);
  376.         BOOL action        (GUIC_EventC &);
  377.     private:
  378.         GUIC_ButtonC                *start, *quit;
  379.         GUIC_FileStringC            *pattern;
  380.         GUIC_PathStringC        *directory;
  381.         GUIC_SlidingIntegerC     *entries;
  382.         GUIC_FrameC                *frame;
  383.         GUIC_LabelC                *dirLabel, *pattLabel, *entrLabel;
  384.     };
  385.     
  386. GalleryWindowC::GalleryWindowC    (GUIC_ApplicationC *app, GUIC_ScreenC *screen) : GUIC_WindowC (-1,-1,50,19)
  387. {
  388.     frame            = new GUIC_FrameC                (1,1,48,14,"Gallery");
  389.  
  390.     dirLabel        = new GUIC_LabelC                (3,2,44,2,"Start _directory:");
  391.     directory        = new GUIC_PathStringC        (3,4,44,2,"");
  392.     
  393.     pattLabel    = new GUIC_LabelC                (3,6,44,2,"Background _pattern:");
  394.     pattern        = new GUIC_FileStringC            (3,8,44,2,"");
  395.  
  396.     entrLabel    = new GUIC_LabelC                (3,10,44,2,"_Number of entries in each gallery:");
  397.     entries        = new GUIC_SlidingIntegerC    (3,12,44,2,MINLINES,MAXLINES,10);
  398.     
  399.     start            = new GUIC_ButtonC                (1,16,15,2,"_Start");
  400.     quit                = new GUIC_ButtonC                (34,16,15,2,"_Quit");
  401.     
  402.     directory    ->setHelp("Directory path for the first index file.");
  403.     pattern    ->setHelp("Default background pattern in HTML pages.");
  404.     entries    ->setHelp("The maximum number of entries per page.");
  405.     start        ->setHelp("Start the creation of the gallery.");
  406.     quit            ->setHelp("Quit the program.");
  407.     
  408.     directory    ->setShortcut('d');
  409.     pattern    ->setShortcut('p');
  410.     entries    ->setShortcut('n');
  411.     start        ->setShortcut('s');
  412.     quit            ->setShortcut('q');
  413.     
  414.     add(frame);
  415.     add(dirLabel);
  416.     add(directory);
  417.     add(pattLabel);
  418.     add(pattern);
  419.     add(entrLabel);
  420.     add(entries);
  421.     add(start);
  422.     add(quit);
  423.     
  424.     app->addPrefs("GalleryWindow", this);
  425.     app->addPrefs("StartDirectory", directory);
  426.     app->addPrefs("BackgroundPattern", pattern);
  427.     app->addPrefs("NumberOfEntries", entries);
  428.  
  429.     setTitle("Gallery - (c) by Markus Hillenbrand");
  430.     setHelp(TRUE);
  431.     activate();
  432. }
  433. GalleryWindowC::~GalleryWindowC    (void)
  434. {
  435.     delete frame;
  436.     delete dirLabel;
  437.     delete directory;
  438.     delete pattLabel;
  439.     delete pattern;
  440.     delete entrLabel;
  441.     delete entries;
  442.     delete start;
  443.     delete quit;
  444. }
  445.  
  446. BOOL GalleryWindowC::action(GUIC_EventC &e)
  447. {
  448.     switch (e.id)
  449.         {
  450.         case GUIC_GadgetEvent:
  451.             if (e.gadget == (GUIC_GadgetC *)start)
  452.                 {
  453.                 if (! strcmp(directory->get(), "") )
  454.                     {
  455.                     GUIC_ErrorC e("You must at least enter a directory name!");
  456.                     e.request(this);
  457.                     }
  458.                 else 
  459.                     {
  460.                     sleep();
  461.                     GUIC_SystemC::openConsole();
  462.                     try 
  463.                         {
  464.                         scanDir (directory->get(), pattern->get(), entries->get() );
  465.                         }
  466.                     catch (GUIC_Exception &x) { GUIC_ErrorC e("Exception caught:", x.getMessage() ); e.request(this); }
  467.                     waken();
  468.                     }
  469.                 }
  470.             else if (e.gadget == (GUIC_GadgetC *)quit) 
  471.                 {
  472.                 dispose();
  473.                 }
  474.             return TRUE;
  475.             break;
  476.         case GUIC_CloseWindow: 
  477.             return TRUE;
  478.             break;
  479.         default:
  480.             cerr << "Got an event: " << e.id << endl;
  481.         }
  482.     
  483.     return FALSE;
  484. }
  485.  
  486.  
  487.  
  488. void         shell                    (void)
  489. {
  490.     LONG result[3] = { 0,0,0 };
  491.     GUIC_ProgramArgsC args;
  492.     if (! args.fit("STARTDIR/A,MAXENTRIES/N,BGPATTERN",result))
  493.         {
  494.         cerr << "Usage: Gallery <directory> [pattern]" << endl;
  495.         GUIC_SystemC::exit(GUIC_ExitError);
  496.         }
  497.     
  498.     LONG maxEntries = result[1] ? *(LONG *)result[1] : 0;
  499.     if (maxEntries < MINLINES)     maxEntries=MINLINES;
  500.     if (maxEntries > MAXLINES)    maxEntries=MAXLINES;
  501.     
  502.     scanDir((STRPTR)result[0], (STRPTR)result[2], maxEntries); 
  503.  
  504.     if (errorList.length())
  505.         {
  506.         cerr << "The following files could not be converted to a thumbnail:" << endl;
  507.         while (errorList.length())
  508.             {
  509.             GalleryEntryC *s = (GalleryEntryC *)errorList.remove(1);
  510.             cerr << "- " << s->fileName << endl;
  511.             delete s;
  512.             }
  513.         cerr << "Please check them and run 'Gallery' again." << endl;
  514.         }
  515. }
  516. void        workbench            (void)
  517. {
  518.     GUIC_ApplicationC    app("Gallery");
  519.  
  520.     app.setAuthor        (__AUTHOR__);
  521.     app.setVersion    (__VERSION__);
  522.     app.setRevision    (__REVISION__);
  523.     app.setDate        (__DATE__);
  524.     app.setTime        (__TIME__);
  525.     app.setInitializer    (TRUE);
  526.  
  527.     GUIC_ScreenC            screen;
  528.     GalleryWindowC     window(&app, &screen);
  529.     
  530.     screen.add(window);
  531.     app.add(screen);
  532.  
  533.     app.start();
  534.  
  535.     BOOL running = TRUE;
  536.     GUIC_EventC *event = 0;
  537.  
  538.     int count = 0;
  539.     
  540.     while (running && (event = app.wait()) )
  541.         {
  542.         // As we have only one window, it is not neccessary to check for the window id
  543.         if (event->id == GUIC_CloseWindow) 
  544.             {
  545.             GUIC_MessageC    message    ("Do you really want to quit ?", "Yes|No");
  546.             if (1 == message.request(*event->window)) running = FALSE;
  547.             }
  548.         }
  549.  
  550.     app.stop();
  551. }
  552.  
  553. void         main                    (int argc, char **argv)
  554. {
  555.     GUIC_SystemC::checkStackSize(20000);
  556.     if (GUIC_SystemC::runFromShell() ) shell(); else workbench();
  557. }
  558.  
  559.