Exemplo n.º 1
0
void Code5() {
  int i_array[] = {1, 2, 3};
  PrintRange(i_array);
  std::vector<int> i_vec = {4, 5, 6};
  PrintRange(i_vec);
  std::vector<std::string> str_vec = {
    "ふるいけや", "かわずとびこむ", "みずのおと"
  };
  PrintRange(str_vec);
}
Exemplo n.º 2
0
void PrintResults(void)
{
    int ix;
#ifdef DEBUG
    fprintf(ofp, "Debug dump of globals global struct:\n");
    fprintf(ofp, "  files_are_different = %d\n", globals.files_are_different);
    fprintf(ofp, "  file1_size          = %d\n", globals.file1_size);
    fprintf(ofp, "  file2_size          = %d\n", globals.file2_size);
    fprintf(ofp, "  compare_size        = %d\n", globals.compare_size);
    fprintf(ofp, "  filename1           = '%s'\n", globals.filename1);
    fprintf(ofp, "  filename2           = '%s'\n", globals.filename2);
    fprintf(ofp, "  rng_size            = %d\n", globals.rng_size);
    fprintf(ofp, "  rng_numel           = %d\n", globals.rng_numel);
    fprintf(ofp, "Debug dump of range array:\n");
    for (ix = 0; ix < globals.rng_numel; ix++) {
        fprintf(ofp, "  %8d %8d\n", globals.rng[ix].start, globals.rng[ix].end);
    }
#endif
    if (histogram) {
        PrintHistogram();
    } else {
        PrintHeader();
        PrintSeparator();
        for (ix = 0; ix < globals.rng_numel; ix++) {
            PrintRange(globals.rng[ix].start, globals.rng[ix].end);
        }
    }
}
Exemplo n.º 3
0
main( )
{
    KdTree T;
    ItemType It, L, H;
    int i;

    printf( "Starting program\n" );

    T = NULL;
    for( i = 300; i < 370; i++ )
    {
        It[ 0 ] = i; It[ 1 ] = 2500 - i;
        T = Insert( It, T );
    }

    printf( "Insertions complete\n" );

    i = 1;
    L[ 0 ] = 70; L[ 1 ] = 2186; H[ 0 ] = 1200; H[ 1 ] = 2200;
    PrintRange( L, H, T );

    printf( "Done...\n" ) ;
    return 0;
}
Exemplo n.º 4
0
globle void ConstraintViolationErrorMessage(
  void *theEnv,
  const char *theWhat,
  const char *thePlace,
  int command,
  int thePattern,
  struct symbolHashNode *theSlot,
  int theField,
  int violationType,
  CONSTRAINT_RECORD *theConstraint,
  int printPrelude)
  {
   /*======================================================*/
   /* Don't print anything other than the tail explanation */
   /* of the error unless asked to do so.                  */
   /*======================================================*/

   if (printPrelude)
     {
      /*===================================*/
      /* Print the name of the thing which */
      /* caused the constraint violation.  */
      /*===================================*/

      if (violationType == FUNCTION_RETURN_TYPE_VIOLATION)
        {
         PrintErrorID(theEnv,"CSTRNCHK",1,TRUE);
         EnvPrintRouter(theEnv,WERROR,"The function return value ");
        }
      else if (theWhat != NULL)
        {
         PrintErrorID(theEnv,"CSTRNCHK",1,TRUE);
         EnvPrintRouter(theEnv,WERROR,theWhat);
         EnvPrintRouter(theEnv,WERROR," ");
        }

      /*=======================================*/
      /* Print the location of the thing which */
      /* caused the constraint violation.      */
      /*=======================================*/

      if (thePlace != NULL)
        {
         EnvPrintRouter(theEnv,WERROR,"found in ");
         if (command) EnvPrintRouter(theEnv,WERROR,"the ");
         EnvPrintRouter(theEnv,WERROR,thePlace);
         if (command) EnvPrintRouter(theEnv,WERROR," command");
        }

      /*================================================*/
      /* If the violation occured in the LHS of a rule, */
      /* indicate which pattern was at fault.           */
      /*================================================*/

      if (thePattern > 0)
        {
         EnvPrintRouter(theEnv,WERROR,"found in CE #");
         PrintLongInteger(theEnv,WERROR,(long int) thePattern);
        }
     }

   /*===============================================================*/
   /* Indicate the type of constraint violation (type, range, etc). */
   /*===============================================================*/

   if ((violationType == TYPE_VIOLATION) ||
       (violationType == FUNCTION_RETURN_TYPE_VIOLATION))
     { EnvPrintRouter(theEnv,WERROR,"\ndoes not match the allowed types"); }
   else if (violationType == RANGE_VIOLATION)
     {
      EnvPrintRouter(theEnv,WERROR,"\ndoes not fall in the allowed range ");
      PrintRange(theEnv,WERROR,theConstraint);
     }
   else if (violationType == ALLOWED_VALUES_VIOLATION)
     { EnvPrintRouter(theEnv,WERROR,"\ndoes not match the allowed values"); }
   else if (violationType == CARDINALITY_VIOLATION)
     { EnvPrintRouter(theEnv,WERROR,"\ndoes not satisfy the cardinality restrictions"); }
   else if (violationType == ALLOWED_CLASSES_VIOLATION)
     { EnvPrintRouter(theEnv,WERROR,"\ndoes not match the allowed classes"); }

   /*==============================================*/
   /* Print either the slot name or field position */
   /* where the constraint violation occured.      */
   /*==============================================*/

   if (theSlot != NULL)
     {
      EnvPrintRouter(theEnv,WERROR," for slot ");
      EnvPrintRouter(theEnv,WERROR,ValueToString(theSlot));
     }
   else if (theField > 0)
     {
      EnvPrintRouter(theEnv,WERROR," for field #");
      PrintLongInteger(theEnv,WERROR,(long long) theField);
     }

   EnvPrintRouter(theEnv,WERROR,".\n");
  }
Exemplo n.º 5
0
static
void Print100(const char* C, double v)
{
       PrintRange(C, v, 100.0);
}
Exemplo n.º 6
0
static
void PrintOne(const char* C, double v)
{
       PrintRange(C, v, 255.0);
}