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