This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

internal_error


#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1999-12-08 11:18 CST by <glew@elmer>.
# Source directory was `/home/glew/work/comp/libag/test/p'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#    676 -rw-r--r-- INTERNAL_ERROR_REPORT
#     89 -r--r--r-- Makefile
#    217 -r--r--r-- test.cc
#    190 -r--r--r-- test2.cc
#   2709 -r--r--r-- test.hh
#
save_IFS="${IFS}"
IFS="${IFS}:"
gettext_dir=FAILED
locale_dir=FAILED
first_param="$1"
for dir in $PATH
do
  if test "$gettext_dir" = FAILED && test -f $dir/gettext \
     && ($dir/gettext --version >/dev/null 2>&1)
  then
    set `$dir/gettext --version 2>&1`
    if test "$3" = GNU
    then
      gettext_dir=$dir
    fi
  fi
  if test "$locale_dir" = FAILED && test -f $dir/shar \
     && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
  then
    locale_dir=`$dir/shar --print-text-domain-dir`
  fi
done
IFS="$save_IFS"
if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
then
  echo=echo
else
  TEXTDOMAINDIR=$locale_dir
  export TEXTDOMAINDIR
  TEXTDOMAIN=sharutils
  export TEXTDOMAIN
  echo="$gettext_dir/gettext -s"
fi
touch -am 1231235999 $$.touch >/dev/null 2>&1
if test ! -f 1231235999 && test -f $$.touch; then
  shar_touch=touch
else
  shar_touch=:
  echo
  $echo 'WARNING: not restoring timestamps.  Consider getting and'
  $echo "installing GNU \`touch', distributed in GNU File Utilities..."
  echo
fi
rm -f 1231235999 $$.touch
#
if mkdir _sh13315; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= INTERNAL_ERROR_REPORT ==============
if test -f 'INTERNAL_ERROR_REPORT' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'INTERNAL_ERROR_REPORT' '(file already exists)'
else
  $echo 'x -' extracting 'INTERNAL_ERROR_REPORT' '(binary)'
  sed 's/^X//' << 'SHAR_EOF' | uudecode &&
begin 600 INTERNAL_ERROR_REPORT
M9VQE=R`@96QM97(@+VAO;64O9VQE=R]W;W)K+V-O;7`O;&EB86<O=&5S="]P
M(`H^(&UA:V4*9RLK("`@("UC('1E<W0R+F-C("UO('1E<W0R+F\*9RLK("UG
M9'=A<F8M,B`M9S,@+6\@=&5S="!T97-T+F-C('1E<W0R+F\*=&5S="YH:#HU
M-3H@26YT97)N86P@8V]M<&EL97(@97)R;W(@:6X@8&]U='!U=%]D:64G+"!A
M="!D=V%R9C)O=70N8SHU-#(V"E!L96%S92!S=6)M:70@82!F=6QL(&)U9R!R
M97!O<G0N"E-E92`\55),.FAT='`Z+R]W=W<N9VYU+F]R9R]S;V9T=V%R92]G
M8V,O9F%Q+FAT;6PC8G5G<F5P;W)T/B!F;W(@:6YS=')U8W1I;VYS+@IM86ME
M.B`J*BH@6W1E<W1=($5R<F]R(#$*9VQE=R`@96QM97(@+VAO;64O9VQE=R]W
M;W)K+V-O;7`O;&EB86<O=&5S="]P(`H^(&=C8R`M=@I296%D:6YG('-P96-S
M(&9R;VT@+W5S<B]L;V-A;"]L:6(O9V-C+6QI8B]I-C@V+7!C+6QI;G5X+6=N
M=2\R+CDU+C(O<W!E8W,*9V-C('9E<G-I;VX@,BXY-2XR(#$Y.3DQ,#(T("AR
M96QE87-E*0IG;&5W("!E;&UE<B`O:&]M92]G;&5W+W=O<FLO8V]M<"]L:6)A
M9R]T97-T+W`@"CX@=6YA;64@+6$*3&EN=7@@96QM97(@,BXR+C4M,34@(S$@
M36]N($%P<B`Q.2`R,SHP,#HT-B!%1%0@,3DY.2!I-C@V('5N:VYO=VX*9VQE
M=R`@96QM97(@+VAO;64O9VQE=R]W;W)K+V-O;7`O;&EB86<O=&5S="]P(`H^
!("`@
`
end
SHAR_EOF
  $shar_touch -am 1208111799 'INTERNAL_ERROR_REPORT' &&
  chmod 0644 'INTERNAL_ERROR_REPORT' ||
  $echo 'restore of' 'INTERNAL_ERROR_REPORT' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'INTERNAL_ERROR_REPORT:' 'MD5 check failed'
dd7fad664b3cf1f1c193c75fbba1f5fc  INTERNAL_ERROR_REPORT
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'INTERNAL_ERROR_REPORT'`"
    test 676 -eq "$shar_count" ||
    $echo 'INTERNAL_ERROR_REPORT:' 'original size' '676,' 'current size' "$shar_count!"
  fi
fi
# ============= Makefile ==============
if test -f 'Makefile' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'Makefile' '(file already exists)'
else
  $echo 'x -' extracting 'Makefile' '(binary)'
  sed 's/^X//' << 'SHAR_EOF' | uudecode &&
begin 600 Makefile
M0T9,04=3/2UG9'=A<F8M,B`M9S,*=&5S=#H@=&5S="YC8R!T97-T+FAH('1E
L<W0R+F\*"6<K*R`D*$-&3$%'4RD@+6\@=&5S="!T97-T+F-C('1E<W0R+F]E
`
end
SHAR_EOF
  $shar_touch -am 1208111199 'Makefile' &&
  chmod 0444 'Makefile' ||
  $echo 'restore of' 'Makefile' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'Makefile:' 'MD5 check failed'
9620f0f431871baa97991654bcc45a10  Makefile
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'Makefile'`"
    test 89 -eq "$shar_count" ||
    $echo 'Makefile:' 'original size' '89,' 'current size' "$shar_count!"
  fi
fi
# ============= test.cc ==============
if test -f 'test.cc' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'test.cc' '(file already exists)'
else
  $echo 'x -' extracting 'test.cc' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'test.cc' &&
#include "test.hh"
X
void dummy_test_function()
{
X  cout << "dummy test function\n";
}
Test_Instance(t,"dummy_test_function",dummy_test_function);
X
main()
{
X  test_registry_t::global_test_registry().run_all_tests();
}
SHAR_EOF
  $shar_touch -am 1208111299 'test.cc' &&
  chmod 0444 'test.cc' ||
  $echo 'restore of' 'test.cc' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'test.cc:' 'MD5 check failed'
56cf9408da763522dd83909eabf30e74  test.cc
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'test.cc'`"
    test 217 -eq "$shar_count" ||
    $echo 'test.cc:' 'original size' '217,' 'current size' "$shar_count!"
  fi
fi
# ============= test2.cc ==============
if test -f 'test2.cc' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'test2.cc' '(file already exists)'
else
  $echo 'x -' extracting 'test2.cc' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'test2.cc' &&
// Check to see if the global registry truly is global,
// or is static per file
X
#include "test.hh"
X
void test2_f()
{
X  cout << "dummy test function\n";
}
Test_Instance(t,"test2",test2_f);
SHAR_EOF
  $shar_touch -am 1208111099 'test2.cc' &&
  chmod 0444 'test2.cc' ||
  $echo 'restore of' 'test2.cc' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'test2.cc:' 'MD5 check failed'
a91245f3050c55a07add77bb9bd7679a  test2.cc
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'test2.cc'`"
    test 190 -eq "$shar_count" ||
    $echo 'test2.cc:' 'original size' '190,' 'current size' "$shar_count!"
  fi
fi
# ============= test.hh ==============
if test -f 'test.hh' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING 'test.hh' '(file already exists)'
else
  $echo 'x -' extracting 'test.hh' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > 'test.hh' &&
// Andy Glew's ultra simple test framework
X
// Basically,
X
// 0) Tests are objects that contain a virtual function
//    to run the test. Perhaps also support info.
//    Also a virtual destructor.
// 0a) Objects with virtual functions are used
//     bcause, in combination with G++'s statement
//     expressions, something like a lambda function is 
//     afforded.
// 0b) A declaration parameterized with a void function
//     is provided.
// 1) simply declaring a test registers
//    the test name and the test object
//    with a global registry.
// 2) all the tests in the registry are run whenever...
//    e.g. provide a command line argument 
//    to debug version.
X
#include <string>
#include <list>
#include <iostream>
X
#ifndef LIBAG_TEST_HH
#define LIBAG_TEST_HH 1
X
struct test_object_t {
X  string name;
X  string filename;
X  int line_number;
X  test_object_t() : name("unnamed test"), filename("unknown file"), line_number(0) {}
X  virtual void run_test() { cout << "no test defined" << endl; }
X  virtual ~test_object_t() {}
};
X
class void_function_ptr_test_object_t :
X  public test_object_t
{
public: 
X  void (*funcptr)();
X  void_function_ptr_test_object_t( char* n, void (*f)(), char* fn, int ln ) {
X    name = n; 
X    funcptr = f;
X    filename = fn;
X    line_number = ln;
X  }
X  virtual void run_test() { funcptr(); }
};
X
class test_registry_t {
public:
X  string name;
X  typedef list<test_object_t*> test_registry_list_t;
X  test_registry_list_t list;
X  void run_all_tests() {
X    for( test_registry_list_t::iterator i = list.begin(); i != list.end(); i++ ) {
X      cout << (*i)->filename << ":" << (*i)->line_number << " " << (*i)->name << " TEST BEGIN" << endl;
X      ((*i)->run_test)();
X      cout << (*i)->filename << ":" << (*i)->line_number << " " << (*i)->name << " TEST END" << endl;
X    }
X  }
X  test_registry_t(char* n) : name(n) {}
X
X  static test_registry_t& global_test_registry()
X    {
X      static test_registry_t global_test_registry_static("global test registry");
X      return global_test_registry_static;
X    }
X
};
X
class test_instance {
public:
X  test_instance(char* n, test_object_t& tobj, char* filename = "unknown file", int line=0 ) {
X    tobj.name = n;
X    tobj.filename = filename;
X    tobj.line_number = line;
X    test_registry_t::global_test_registry().list.push_back(&tobj);
X  }
X  test_instance(char* n, void (*f)(), char* filename = "unknown file", int line=0 ) {
X    void_function_ptr_test_object_t* vfpo =
X      new void_function_ptr_test_object_t(n,f,filename,line);
X    test_registry_t::global_test_registry().list.push_back(vfpo);
X  }
};
X
#define Test_Instance(varname,name,test) test_instance varname(name,test,__FILE__,__LINE__)
X
#endif // LIBAG_TEST_HH
X
X
X
X
SHAR_EOF
  $shar_touch -am 1207153399 'test.hh' &&
  chmod 0444 'test.hh' ||
  $echo 'restore of' 'test.hh' 'failed'
  if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
  && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
    md5sum -c << SHAR_EOF >/dev/null 2>&1 \
    || $echo 'test.hh:' 'MD5 check failed'
e1448d23206f71282baa5031a198a05e  test.hh
SHAR_EOF
  else
    shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'test.hh'`"
    test 2709 -eq "$shar_count" ||
    $echo 'test.hh:' 'original size' '2709,' 'current size' "$shar_count!"
  fi
fi
rm -fr _sh13315
exit 0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]