os/ossrv/genericopenlibs/liboil/tsrc/testsuite/proto4/src/proto4.c
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2  * LIBOIL - Library of Optimized Inner Loops
     3  * Copyright (c) 2004 David A. Schleef <ds@schleef.org>
     4  * All rights reserved.
     5  *
     6  * Redistribution and use in source and binary forms, with or without
     7  * modification, are permitted provided that the following conditions
     8  * are met:
     9  * 1. Redistributions of source code must retain the above copyright
    10  *    notice, this list of conditions and the following disclaimer.
    11  * 2. Redistributions in binary form must reproduce the above copyright
    12  *    notice, this list of conditions and the following disclaimer in the
    13  *    documentation and/or other materials provided with the distribution.
    14  * 
    15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    17  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
    19  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    20  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    21  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    23  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
    24  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    25  * POSSIBILITY OF SUCH DAMAGE.
    26  */
    27 
    28 
    29 #include <stdio.h>
    30 #include <liboil/liboilprototype.h>
    31 #include <liboil/liboil.h>
    32 #include <ctype.h>
    33 #include <stdlib.h>
    34 #include <string.h>
    35 
    36 
    37 #define LOG_FILE "c:\\logs\\testsuite_proto4_log1.txt"
    38 #include "std_log_result.h"
    39 #define LOG_FILENAME_LINE __FILE__, __LINE__
    40 
    41 void create_xml(int result)
    42 {
    43     if(result)
    44         assert_failed = 1;
    45     
    46     testResultXml("testsuite_proto4");
    47     close_log_file();
    48 }
    49 
    50 int main (int argc, char *argv[])
    51 {
    52   OilFunctionClass *klass;
    53   int i;
    54   int n;
    55   //xmlfile = "proto4";
    56   std_log(LOG_FILENAME_LINE, "Test Started testsuite_proto4");
    57 
    58   oil_init ();
    59 
    60   n = oil_class_get_n_classes ();
    61   for (i=0;i<n; i++ ){
    62     klass = oil_class_get_by_index(i);
    63 
    64     if(klass->prototype) {
    65       OilPrototype *proto;
    66       char *string;
    67 
    68       proto = oil_prototype_from_string (klass->prototype);     /*Converts the string s containing C prototype that follows Liboil parameter naming rules into a OilPrototype.*/
    69       if (proto == NULL) {
    70         std_log(LOG_FILENAME_LINE, "ERROR bad prototype");
    71         printf ("ERROR bad prototype for %s\n", klass->name);
    72         continue;
    73       }
    74 
    75       string = oil_prototype_to_string (proto);                 /* Converts a prototype into the corresponding C style declaration. */
    76 
    77       printf("%s (%s)\n", klass->name, string);
    78 
    79       oil_prototype_free (proto);
    80       free(string);
    81     } else {
    82       std_log(LOG_FILENAME_LINE, "ERROR no prototype");
    83       printf("ERROR no prototype for %s\n", klass->name);
    84     }
    85   }
    86   std_log(LOG_FILENAME_LINE, "Test Successful");
    87   create_xml(0);
    88   return 0;
    89 }
    90 
    91