More simplification through code generation

Moved the maigre-codegen project to be a plain generic MD project
This commit is contained in:
Aaron Bockover 2010-11-08 16:48:01 -05:00
Родитель 2a08e87010
Коммит e8cc8ac7e2
6 изменённых файлов: 22 добавлений и 87 удалений

Просмотреть файл

@ -5,22 +5,25 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Maigre", "Maigre\Maigre.csp
EndProject
Project("{2857B73E-F847-4B02-9238-064979017E93}") = "libmaigre", "libmaigre\libmaigre.cproj", "{3C4985A8-E1D7-4633-8D79-B2816289F777}"
EndProject
Project("{9344bdbb-3e7f-41fc-a0dd-8665d75ee146}") = "maigre-codegen", "maigre-codegen\maigre-codegen.mdproj", "{94D14E44-7644-4331-AB34-BA909AE10EC7}"
Project("{9344bdbb-3e7f-41fc-a0dd-8665d75ee146}") = "maigre-codegen", "maigre-codegen\maigre-codegen.mdproj", "{B46730C2-5984-432D-9A11-B08ABAC62C2E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Default|Any CPU = Default|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1D12C856-6559-4CE2-9DC5-CF2C5CA76D8C}.Debug|x86.ActiveCfg = Debug|x86
{1D12C856-6559-4CE2-9DC5-CF2C5CA76D8C}.Debug|x86.Build.0 = Debug|x86
{3C4985A8-E1D7-4633-8D79-B2816289F777}.Debug|x86.ActiveCfg = Debug|Any CPU
{3C4985A8-E1D7-4633-8D79-B2816289F777}.Debug|x86.Build.0 = Debug|Any CPU
{94D14E44-7644-4331-AB34-BA909AE10EC7}.Debug|x86.ActiveCfg = Debug|Any CPU
{94D14E44-7644-4331-AB34-BA909AE10EC7}.Debug|x86.Build.0 = Debug|Any CPU
{94D14E44-7644-4331-AB34-BA909AE10EC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{94D14E44-7644-4331-AB34-BA909AE10EC7}.Release|Any CPU.Build.0 = Release|Any CPU
{B46730C2-5984-432D-9A11-B08ABAC62C2E}.Debug|x86.ActiveCfg = Default|Any CPU
{B46730C2-5984-432D-9A11-B08ABAC62C2E}.Debug|x86.Build.0 = Default|Any CPU
{B46730C2-5984-432D-9A11-B08ABAC62C2E}.Default|Any CPU.ActiveCfg = Default|Any CPU
{B46730C2-5984-432D-9A11-B08ABAC62C2E}.Default|Any CPU.Build.0 = Default|Any CPU
{B46730C2-5984-432D-9A11-B08ABAC62C2E}.Release|Any CPU.ActiveCfg = Default|Any CPU
{B46730C2-5984-432D-9A11-B08ABAC62C2E}.Release|Any CPU.Build.0 = Default|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Maigre\Maigre.csproj

Просмотреть файл

@ -1,10 +1,8 @@
all:
$(MAKE) -C maigre-codegen
$(MAKE) -C libmaigre
$(MAKE) -C Maigre
clean:
$(MAKE) -C maigre-codegen clean
$(MAKE) -C libmaigre clean
$(MAKE) -C Maigre clean
rm -rf lib

Просмотреть файл

@ -51,21 +51,5 @@ maigre_style_init (MaigreStyle *maigre)
static void
maigre_style_class_init (MaigreStyleClass *klass)
{
MaigreMonoBridge *bridge;
gint i;
bridge = maigre_mono_bridge ();
if (!bridge->init_success) {
return;
}
maigre_style_init_method_map ();
for (i = 0; native_draw_methods[i] != NULL; i++) {
DrawFnptr *slot = G_STRUCT_MEMBER_P (
GTK_STYLE_CLASS (klass),
G_STRUCT_OFFSET (GtkStyleClass, draw_hline) + i * sizeof (gpointer)
);
*slot = (DrawFnptr)native_draw_methods[i];
}
maigre_style_override_methods (GTK_STYLE_CLASS (klass));
}

Просмотреть файл

@ -1,9 +0,0 @@
GENERATED = \
../libmaigre/maigre-style-overrides.c \
../Maigre/Maigre/Theme_Generated.cs
all: maigre-codegen.py
./$<
clean:
rm -rf $(GENERATED)

Просмотреть файл

@ -1,50 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Configuration Condition=" '$(Configuration)' == '' ">Default</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ItemType>PythonProject</ItemType>
<ItemType>GenericProject</ItemType>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{94D14E44-7644-4331-AB34-BA909AE10EC7}</ProjectGuid>
<ProjectGuid>{B46730C2-5984-432D-9A11-B08ABAC62C2E}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>.\Debug</OutputPath>
<Build>
<Build Optimize="false" />
</Build>
<Runtime>
<Runtime Module="maigre-codegen" PythonOptions="">
<Interpreter path="/usr/bin/python2.6" ctype="Python26Runtime" />
</Runtime>
</Runtime>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Default|AnyCPU' ">
<OutputPath>.\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>.\Release</OutputPath>
<Build>
<Build Optimize="true" />
</Build>
<Runtime>
<Runtime Module="main" PythonOptions="">
<Interpreter path="/usr/bin/python2.6" ctype="Python26Runtime" />
</Runtime>
</Runtime>
</PropertyGroup>
<ProjectExtensions>
<MonoDevelop>
<Properties>
<MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="true" RelativeMakefileName="Makefile" BuildTargetName="">
<BuildFilesVar />
<DeployFilesVar />
<ResourcesVar />
<OthersVar />
<GacRefVar />
<AsmRefVar />
<ProjectRefVar />
</MonoDevelop.Autotools.MakefileInfo>
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<None Include="maigre-codegen.py" />
</ItemGroup>

Просмотреть файл

@ -104,11 +104,7 @@ for item in draw_context:
line = item[0] + ' ' + item[1]
out.write (' %s;\n' % line)
out.write ('''} MaigreDrawContext;
static gpointer *native_draw_methods[%d];
''' % (len (methods) + 1))
out.write ('} MaigreDrawContext;\n')
method_index = 0
for method in methods:
@ -143,7 +139,7 @@ for method in methods:
static MonoMethod *managed_method = NULL;
MaigreMonoBridge *bridge;
MaigreDrawContext draw_context, *dcp;
MaigreDrawContext draw_context, *draw_context_ptr;
gpointer args[1];
''')
@ -174,8 +170,8 @@ for method in methods:
out.write (' draw_context.%s = %s;\n' % (var, var))
out.write ('''
dcp = &draw_context;
args[0] = &dcp;
draw_context_ptr = &draw_context;
args[0] = &draw_context_ptr;
if (*(guchar *)mono_object_unbox (mono_runtime_invoke (
managed_method, bridge->theme_object, args, NULL)) == 0) {
@ -201,14 +197,12 @@ for method in methods:
out.write ('''
static void
maigre_style_init_method_map ()
maigre_style_override_methods (GtkStyleClass *klass)
{
''')
method_index = 0
for method in methods:
out.write (' native_draw_methods[%d] = (gpointer)maigre_style_%s;\n' \
% (method_index, method[0]))
method_index += 1
out.write (' klass->%s = maigre_style_%s;\n' \
% (method[0], method[0]))
out.write ('}')
@ -299,8 +293,7 @@ for type, name, gobject_type, native_name in managed_draw_context:
: null;
''' % (native_name, name, gobject_type, name))
out.write ('''
}
out.write (''' }
''')