Revision 23839a6cb5c6ce1890674b83787f024bfdbf0c83 authored by Sergey Linev on 03 March 2015, 16:23:43 UTC, committed by Bertrand Bellenot on 04 March 2015, 08:35:14 UTC
1. Introduce central method where all kind of text drawings
   are handled. At this place decide which kind of rendering -
   plain text, simplify latex or normal MathJax is used
2. Implement correct size adjustment and alignment for
   all kinds of text output (with and without MathJax)
3. Support TMathText class - always MathJax will be used
4. Draw label in TPabeText
5. Avoid concurent calls of JSROOT.AssertPrerequisities

Signed-off-by: Bertrand Bellenot <bertrand.bellenot@cern.ch>
1 parent 3cb3124
Raw File
t1046.cxx
/* -*- C++ -*- */
/*************************************************************************
 * Copyright(c) 1995~2005  Masaharu Goto (root-cint@cern.ch)
 *
 * For the licensing terms see the file COPYING
 *
 ************************************************************************/
// demo/exception/ehdemo.cxx
// This source has to be interpreted

#include <stdio.h>

#if defined(interp) && defined(makecint)
#pragma include "test.dll"
#else
#include "t1046.h"
#endif


////////////////////////////////////////////////////////////////////////
// You can use simple try, catch block in an interpreted code. However,
// that portion can not be bytecode optimized. 
////////////////////////////////////////////////////////////////////////

void test1() {
  try {
	int iRows = 10000;
	int iCols = 10000;

	IntVar iv0(2,2);
	
	// When the braces are removed,
	// everything is OK
	//if (iRows > 1) {IntVar iv1(iRows, iCols);}
	IntVar iv1(iRows, iCols);
	

	printf("after exception has been thrown.");
	IntVar iv2(2,2);
	
  }
  catch(exception& z) {
    printf("This is a std::exception '%s'\n",z.what()); 
	
  }
 
}

void test2() {
  try {
	int iRows = 10000;
	int iCols = 10000;

	IntVar iv0(2,2);
	
	// When the braces are removed,
	// everything is OK
	if (iRows > 1) {IntVar iv1(iRows, iCols);}
	//IntVar iv1(iRows, iCols);
	

	printf("after exception has been thrown.");
	IntVar iv2(2,2);
	
  }
  catch(exception& z) {
    printf("This is a std::exception '%s'\n",z.what()); 
	
  }
 
}

void test3() {
  try {
	int iRows = 10000;
	int iCols = 10000;

	IntVar iv0(2,2);
	
	// When the braces are removed,
	// everything is OK
	for(;;) {IntVar iv1(iRows, iCols);}
	//IntVar iv1(iRows, iCols);
	

	printf("after exception has been thrown.");
	IntVar iv2(2,2);
	
  }
  catch(exception& z) {
    printf("This is a std::exception '%s'\n",z.what()); 
	
  }
 
}

void test4() {
  try {
	int iRows = 10000;
	int iCols = 10000;

	IntVar iv0(2,2);
	
	// When the braces are removed,
	// everything is OK
	while(1) {IntVar iv1(iRows, iCols);}
	//IntVar iv1(iRows, iCols);
	

	printf("after exception has been thrown.");
	IntVar iv2(2,2);
	
  }
  catch(exception& z) {
    printf("This is a std::exception '%s'\n",z.what()); 
	
  }
 
}


void test5() {
  try {
	int iRows = 10000;
	int iCols = 10000;

	IntVar iv0(2,2);
	
	// When the braces are removed,
	// everything is OK
	do {IntVar iv1(iRows, iCols);} while(1);
	//IntVar iv1(iRows, iCols);
	

	printf("after exception has been thrown.");
	IntVar iv2(2,2);
	
  }
  catch(exception& z) {
    printf("This is a std::exception '%s'\n",z.what()); 
	
  }
 
}

void test6() {
  try {
	int iRows = 10000;
	int iCols = 10000;

	IntVar iv0(2,2);
	
	// When the braces are removed,
	// everything is OK
	switch(iRows) {
	case 0:
	case 1:
	  break;
	default:
	  IntVar iv1(iRows, iCols);
	  break;
	} 
	//IntVar iv1(iRows, iCols);
	

	printf("after exception has been thrown.");
	IntVar iv2(2,2);
	
  }
  catch(exception& z) {
    printf("This is a std::exception '%s'\n",z.what()); 
	
  }
 
}

void test7() {
  try {
	int iRows = 10000;
	int iCols = 10000;

	IntVar iv0(2,2);
	
	// When the braces are removed,
	// everything is OK
	switch(iRows) {
	case 0:
	case 1:
	  break;
	default:
	  if(1) {
	    for(;;) {
	      IntVar iv1(iRows, iCols);
	    }
	  }
	  break;
	} 
	//IntVar iv1(iRows, iCols);
	

	printf("after exception has been thrown.");
	IntVar iv2(2,2);
	
  }
  catch(exception& z) {
    printf("This is a std::exception '%s'\n",z.what()); 
	
  }
 
}


////////////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////////////
int main() {
  printf("------- START -------\n");
  // Calling compiled function that throws exception with interpreted
  // try, catch block

  printf("test1 ");
  test1();
  printf("test2 ");
  test2();
  printf("test3 ");
  test3();
  printf("test4 ");
  test4();
  printf("test5 ");
  test5();
  printf("test6 ");
  test6();
  printf("test7 ");
  test7();

  printf("-------- END --------\n");
  return 0;
}
back to top