os/graphics/graphicscomposition/openwfcompositionengine/adaptation/src/Platform/OS/symbian/owfextensions.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 //
     3 // Permission is hereby granted, free of charge, to any person obtaining a
     4 // copy of this software and/or associated documentation files (the
     5 // "Materials"), to deal in the Materials without restriction, including
     6 // without limitation the rights to use, copy, modify, merge, publish,
     7 // distribute, sublicense, and/or sell copies of the Materials, and to
     8 // permit persons to whom the Materials are furnished to do so, subject to
     9 // the following conditions:
    10 //
    11 // The above copyright notice and this permission notice shall be included
    12 // in all copies or substantial portions of the Materials.
    13 //
    14 // THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    15 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    16 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
    17 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
    18 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
    19 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
    20 // MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
    21 //
    22 // Description:
    23 // Tables of OpenWF-C strings and extensions, plus access for EGL.
    24 //
    25 //
    26 
    27 #include <string.h>
    28 #include <e32def.h>
    29 #include <WF/wfc.h>
    30 #include <KHR/khrplatform.h>
    31 #include "owfextensions.h"
    32 #include "owftypes.h"
    33 
    34 /*!
    35  * Vendor, renderer and version strings
    36  */
    37 const char* wfc_strings[] =
    38 {
    39     "Nokia",
    40     "Sample Implementation",
    41     "1.0",
    42 };
    43 
    44 /*
    45  * Table of extensions supported, terminated by a NULL.
    46  */
    47 const char *wfc_extensions[] =
    48 {
    49     NULL
    50 };
    51 
    52 #ifdef __cplusplus
    53 typedef void (*OWFExtensionFunction)(...);
    54 #else
    55 typedef void (*OWFExtensionFunction)();
    56 #endif
    57 
    58 typedef struct OWFExtension_tag
    59 {
    60     const char *name;
    61     OWFExtensionFunction function;
    62 } OWFExtension;
    63 
    64 /*
    65  * Table of extension function name/pointer pairs, terminated with a NULL name
    66  * pair (pointer not used for terminating entry).
    67  */
    68 static OWFExtension OWF_ExtensionFunctionTable[] =
    69 {
    70     { NULL, NULL }
    71 };
    72 
    73 OWF_API_CALL OWFExtensionFunction
    74 owfGetProcAddress(const char *procName)
    75 {
    76     WFCint ii;
    77     
    78     if (!procName)
    79         {
    80         return NULL;
    81         }
    82     
    83     for (ii=0; OWF_ExtensionFunctionTable[ii].name != NULL; ii++)
    84     {
    85        if (strcmp(procName, OWF_ExtensionFunctionTable[ii].name)==0)
    86        {
    87            return OWF_ExtensionFunctionTable[ii].function;
    88        }
    89     }
    90     
    91     return NULL;
    92 }
    93 
    94 /*
    95  * eglGetProcAddress uses export 1 (implemented as GetExtensionFunctionTable) to
    96  * fill in a function pointer table. The first entry is the function that looks up
    97  * a function pointer for a given name. Other entries could be added in the
    98  * future if coordinated with the EGL implementation.
    99  */
   100 
   101 typedef struct
   102 {
   103     OWFExtensionFunction (*owfGetProcAddressFn) (const char* procname);
   104 } owfCFunctions;
   105 
   106 extern "C" WFC_API_CALL void WFC_APIENTRY
   107 GetExtensionFunctionTable(owfCFunctions* fnTable) WFC_APIEXIT
   108 {
   109     fnTable->owfGetProcAddressFn = owfGetProcAddress;
   110 }