58 строки
1.9 KiB
C
58 строки
1.9 KiB
C
// vim: set filetype=c :
|
|
//
|
|
// delegates.m:
|
|
//
|
|
// Authors:
|
|
// Rolf Bjarne Kvinge <rolf@xamarin.com>
|
|
//
|
|
// Copyright 2013-2014 Xamarin Inc.
|
|
//
|
|
<#@ include file="delegates.t4" #>
|
|
|
|
/*
|
|
* This file was generated from delegates.inc.t4, any modifications will be lost once this file is re-generated.
|
|
*/
|
|
|
|
#include "delegates.h"
|
|
|
|
<# foreach (var d in delegates) { #>
|
|
typedef <#= d.CReturnType #><#= d.AlignCReturnType #> (*func_<#= d.EntryPoint #>)<#= d.AlignEntryPoint #> (<#= d.CArgumentSignature #>);
|
|
<# } #>
|
|
|
|
struct Delegates {
|
|
<# foreach (var d in delegates) { #>
|
|
func_<#= d.EntryPoint #><#= d.AlignEntryPoint #> <#= d.EntryPoint.Substring ("xamarin_".Length) #>;
|
|
<# } #>
|
|
};
|
|
|
|
static struct Delegates delegates = { 0 };
|
|
|
|
static guint32
|
|
create_linked_away_exception (const char *func)
|
|
{
|
|
char *msg = xamarin_strdup_printf ("The runtime function %s has been linked away.", func);
|
|
guint32 gchandle = xamarin_create_product_exception (8028, msg);
|
|
xamarin_free (msg);
|
|
return gchandle;
|
|
}
|
|
|
|
<# foreach (var d in delegates) { #>
|
|
<#= d.CReturnType #>
|
|
<#= d.EntryPoint #> (<#= d.CArgumentSignature #>)
|
|
{
|
|
<#if (d.ExceptionHandling && d.OnlyDynamicUsage) {#> if (delegates.<#= d.EntryPoint.Substring ("xamarin_".Length) #> == NULL) {
|
|
*exception_gchandle = create_linked_away_exception ("<#= d.EntryPoint.Substring ("xamarin_".Length) #>");
|
|
return<# if (d.CReturnType != "void") { #> (<#= d.CReturnType #>) 0<# } #>;
|
|
}
|
|
<#} else {#>#if DEBUG
|
|
if (delegates.<#= d.EntryPoint.Substring ("xamarin_".Length) #> == NULL) {
|
|
NSLog (@PRODUCT ": The managed function <#= d.EntryPoint.Substring ("xamarin_".Length) #> could not be loaded.");
|
|
xamarin_assertion_message ("The managed function <#= d.EntryPoint.Substring ("xamarin_".Length) #> could not be loaded.");
|
|
}
|
|
#endif
|
|
<#}#>
|
|
<# if (d.CReturnType != "void") { #>return <# } #>delegates.<#= d.EntryPoint.Substring ("xamarin_".Length) #> (<#= d.CArgumentNames #>);
|
|
}
|
|
|
|
<# } #>
|