Skip to content

Commit

Permalink
csharp branch cleanup, ignore patterns update
Browse files Browse the repository at this point in the history
git-svn-id: https://lcm.googlecode.com/svn/branches/csharp@426 989093bb-e83e-0410-a25a-9184cbcad8d0
  • Loading branch information
jan.hrbacek committed Nov 28, 2009
1 parent 4951617 commit ebd4243
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 40 deletions.
9 changes: 6 additions & 3 deletions examples/csharp/example_t_demo/example_t_demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="lcm-net, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
Expand All @@ -52,6 +49,12 @@
<Compile Include="Program.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\lcm-dotnet\lcm\lcm.csproj">
<Project>{1A945928-4DDA-465B-949B-7A867860EDCF}</Project>
<Name>lcm</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
6 changes: 6 additions & 0 deletions examples/csharp/lcm-csharp-examples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "example_t_demo", "example_t
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tcp_provider_demo", "tcp_provider_demo\tcp_provider_demo.csproj", "{73DF9E5E-47C6-4235-96E2-4796D5DA8108}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lcm", "..\..\lcm-dotnet\lcm\lcm.csproj", "{1A945928-4DDA-465B-949B-7A867860EDCF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -19,6 +21,10 @@ Global
{73DF9E5E-47C6-4235-96E2-4796D5DA8108}.Debug|Any CPU.Build.0 = Debug|Any CPU
{73DF9E5E-47C6-4235-96E2-4796D5DA8108}.Release|Any CPU.ActiveCfg = Release|Any CPU
{73DF9E5E-47C6-4235-96E2-4796D5DA8108}.Release|Any CPU.Build.0 = Release|Any CPU
{1A945928-4DDA-465B-949B-7A867860EDCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A945928-4DDA-465B-949B-7A867860EDCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A945928-4DDA-465B-949B-7A867860EDCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A945928-4DDA-465B-949B-7A867860EDCF}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
9 changes: 6 additions & 3 deletions examples/csharp/tcp_provider_demo/tcp_provider_demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="lcm-net, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
Expand All @@ -51,6 +48,12 @@
<Compile Include="Program.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\lcm-dotnet\lcm\lcm.csproj">
<Project>{1A945928-4DDA-465B-949B-7A867860EDCF}</Project>
<Name>lcm</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
1 change: 0 additions & 1 deletion lcm-dotnet/lcm/lcm/LCM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ public LCM(params string[] urls)
if (protocol.Equals("udpm"))
{
providers.Add(new UDPMulticastProvider(this, up));
TCPProvider u = new TCPProvider(this, up);
}
else if (protocol.Equals("tcp"))
{
Expand Down
66 changes: 33 additions & 33 deletions lcmgen/emit_csharp.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ int emit_csharp(lcmgen_t *lcm)
//////////////////////////////////////////////////////////////
// ENUMS
for (unsigned int en = 0; en < g_ptr_array_size(lcm->enums); en++) {
lcm_enum_t *le = g_ptr_array_index(lcm->enums, en);
lcm_enum_t *le = (lcm_enum_t *) g_ptr_array_index(lcm->enums, en);

const char *classname = make_fqn_csharp(lcm, le->enumname->typename);
const char *classname = make_fqn_csharp(lcm, le->enumname->lctypename);
char *path = sprintfalloc("%s%s%s.cs",
getopt_get_string(lcm->gopt, "csharp-path"),
strlen(getopt_get_string(lcm->gopt, "csharp-path")) > 0 ? "/" : "",
Expand Down Expand Up @@ -222,9 +222,9 @@ int emit_csharp(lcmgen_t *lcm)
emit(2,"}");
emit(0," ");

emit(2,"public static %s _decodeRecursiveFactory(BinaryReader ins)", make_fqn_csharp(lcm, le->enumname->typename));
emit(2,"public static %s _decodeRecursiveFactory(BinaryReader ins)", make_fqn_csharp(lcm, le->enumname->lctypename));
emit(2,"{");
emit(3,"%s o = new %s(0);", make_fqn_csharp(lcm, le->enumname->typename), make_fqn_csharp(lcm, le->enumname->typename));
emit(3,"%s o = new %s(0);", make_fqn_csharp(lcm, le->enumname->lctypename), make_fqn_csharp(lcm, le->enumname->lctypename));
emit(3,"o._decodeRecursive(ins);");
emit(3,"return o;");
emit(2,"}");
Expand Down Expand Up @@ -263,9 +263,9 @@ int emit_csharp(lcmgen_t *lcm)
}

for (unsigned int st = 0; st < g_ptr_array_size(lcm->structs); st++) {
lcm_struct_t *lr = g_ptr_array_index(lcm->structs, st);
lcm_struct_t *lr = (lcm_struct_t *) g_ptr_array_index(lcm->structs, st);

const char *classname = make_fqn_csharp(lcm, lr->structname->typename);
const char *classname = make_fqn_csharp(lcm, lr->structname->lctypename);
char *path = sprintfalloc("%s%s%s.cs",
getopt_get_string(lcm->gopt, "csharp-path"),
strlen(getopt_get_string(lcm->gopt, "csharp-path")) > 0 ? "/" : "",
Expand Down Expand Up @@ -303,12 +303,12 @@ int emit_csharp(lcmgen_t *lcm)

for (unsigned int member = 0; member < g_ptr_array_size(lr->members); member++) {
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(lr->members, member);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->typename);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->lctypename);

emit_start(2, "public ");

if (pinfo==NULL) {
emit_continue("%s", make_fqn_csharp(lcm, lm->type->typename));
emit_continue("%s", make_fqn_csharp(lcm, lm->type->lctypename));
} else {
emit_continue("%s", pinfo->storage);
}
Expand All @@ -327,7 +327,7 @@ int emit_csharp(lcmgen_t *lcm)
// pre-allocate any fixed-size arrays.
for (unsigned int member = 0; member < g_ptr_array_size(lr->members); member++) {
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(lr->members, member);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->typename);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->lctypename);

if (g_ptr_array_size(lm->dimensions)==0 || !lcm_is_constant_size_array(lm))
continue;
Expand All @@ -336,7 +336,7 @@ int emit_csharp(lcmgen_t *lcm)
if (pinfo != NULL)
emit_continue("%s", pinfo->storage);
else
emit_continue("%s", make_fqn_csharp(lcm, lm->type->typename));
emit_continue("%s", make_fqn_csharp(lcm, lm->type->lctypename));

for (unsigned int i = 0; i < g_ptr_array_size(lm->dimensions); i++) {
lcm_dimension_t *dim = (lcm_dimension_t*) g_ptr_array_index(lm->dimensions, i);
Expand All @@ -354,18 +354,18 @@ int emit_csharp(lcmgen_t *lcm)
//////////////////////////////////////////////////////////////
// CONSTANTS
for (unsigned int cn = 0; cn < g_ptr_array_size(lr->constants); cn++) {
lcm_constant_t *lc = g_ptr_array_index(lr->constants, cn);
assert(lcm_is_legal_const_type(lc->typename));
lcm_constant_t *lc = (lcm_constant_t *) g_ptr_array_index(lr->constants, cn);
assert(lcm_is_legal_const_type(lc->lctypename));

if (!strcmp(lc->typename, "int8_t") ||
!strcmp(lc->typename, "int16_t") ||
!strcmp(lc->typename, "int32_t")) {
if (!strcmp(lc->lctypename, "int8_t") ||
!strcmp(lc->lctypename, "int16_t") ||
!strcmp(lc->lctypename, "int32_t")) {
emit(2, "public const int %s = %s;", lc->membername, lc->val_str);
} else if (!strcmp(lc->typename, "int64_t")) {
} else if (!strcmp(lc->lctypename, "int64_t")) {
emit(2, "public const long %s = %sL;", lc->membername, lc->val_str);
} else if (!strcmp(lc->typename, "float")) {
} else if (!strcmp(lc->lctypename, "float")) {
emit(2, "public const float %s = %s;", lc->membername, lc->val_str);
} else if (!strcmp(lc->typename, "double")) {
} else if (!strcmp(lc->lctypename, "double")) {
emit(2, "public const double %s = %s;", lc->membername, lc->val_str);
} else {
assert(0);
Expand All @@ -382,20 +382,20 @@ int emit_csharp(lcmgen_t *lcm)

emit(2, "public static ulong _hashRecursive(List<String> classes)");
emit(2, "{");
emit(3, "if (classes.Contains(\"%s\"))", make_fqn_csharp(lcm, lr->structname->typename));
emit(3, "if (classes.Contains(\"%s\"))", make_fqn_csharp(lcm, lr->structname->lctypename));
emit(4, "return 0L;");
emit(0, " ");
emit(3, "classes.Add(\"%s\");", make_fqn_csharp(lcm, lr->structname->typename));
emit(3, "classes.Add(\"%s\");", make_fqn_csharp(lcm, lr->structname->lctypename));

emit(3, "ulong hash = LCM_FINGERPRINT_BASE");
for (unsigned int member = 0; member < g_ptr_array_size(lr->members); member++) {
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(lr->members, member);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->typename);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->lctypename);

if (pinfo)
continue;

emit(4, " + %s._hashRecursive(classes)", make_fqn_csharp(lcm, lm->type->typename));
emit(4, " + %s._hashRecursive(classes)", make_fqn_csharp(lcm, lm->type->lctypename));
}
emit(4,";");

Expand All @@ -420,8 +420,8 @@ int emit_csharp(lcmgen_t *lcm)
char accessor[1024];

for (unsigned int member = 0; member < g_ptr_array_size(lr->members); member++) {
lcm_member_t *lm = g_ptr_array_index(lr->members, member);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->typename);
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(lr->members, member);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->lctypename);
make_accessor(lm, "this", accessor);

for (unsigned int i = 0; i < g_ptr_array_size(lm->dimensions); i++) {
Expand Down Expand Up @@ -460,9 +460,9 @@ int emit_csharp(lcmgen_t *lcm)
emit(2,"}");
emit(0," ");

emit(2,"public static %s _decodeRecursiveFactory(BinaryReader ins)", make_fqn_csharp(lcm, lr->structname->typename));
emit(2,"public static %s _decodeRecursiveFactory(BinaryReader ins)", make_fqn_csharp(lcm, lr->structname->lctypename));
emit(2,"{");
emit(3,"%s o = new %s();", make_fqn_csharp(lcm, lr->structname->typename), make_fqn_csharp(lcm, lr->structname->typename));
emit(3,"%s o = new %s();", make_fqn_csharp(lcm, lr->structname->lctypename), make_fqn_csharp(lcm, lr->structname->lctypename));
emit(3,"o._decodeRecursive(ins);");
emit(3,"return o;");
emit(2,"}");
Expand All @@ -472,8 +472,8 @@ int emit_csharp(lcmgen_t *lcm)
emit(2,"{");
emit(3, "byte[] __strbuf = null;");
for (unsigned int member = 0; member < g_ptr_array_size(lr->members); member++) {
lcm_member_t *lm = g_ptr_array_index(lr->members, member);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->typename);
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(lr->members, member);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->lctypename);

make_accessor(lm, "this", accessor);

Expand All @@ -485,7 +485,7 @@ int emit_csharp(lcmgen_t *lcm)
if (pinfo != NULL)
emit_continue("%s", pinfo->storage);
else
emit_continue("%s", make_fqn_csharp(lcm, lm->type->typename));
emit_continue("%s", make_fqn_csharp(lcm, lm->type->lctypename));

for (unsigned int i = 0; i < g_ptr_array_size(lm->dimensions); i++) {
lcm_dimension_t *dim = (lcm_dimension_t*) g_ptr_array_index(lm->dimensions, i);
Expand All @@ -503,7 +503,7 @@ int emit_csharp(lcmgen_t *lcm)
if (pinfo != NULL)
freplace(f, pinfo->decode, accessor);
else {
emit_continue("%s = %s._decodeRecursiveFactory(ins);", accessor, make_fqn_csharp(lcm, lm->type->typename));
emit_continue("%s = %s._decodeRecursiveFactory(ins);", accessor, make_fqn_csharp(lcm, lm->type->lctypename));
}
emit_end("");

Expand All @@ -523,8 +523,8 @@ int emit_csharp(lcmgen_t *lcm)
emit(3,"%s outobj = new %s();", classname, classname);

for (unsigned int member = 0; member < g_ptr_array_size(lr->members); member++) {
lcm_member_t *lm = g_ptr_array_index(lr->members, member);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->typename);
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(lr->members, member);
primitive_info_t *pinfo = (primitive_info_t*) g_hash_table_lookup(type_table, lm->type->lctypename);
make_accessor(lm, "", accessor);

// allocate an array if necessary
Expand All @@ -535,7 +535,7 @@ int emit_csharp(lcmgen_t *lcm)
if (pinfo != NULL)
emit_continue("%s", pinfo->storage);
else
emit_continue("%s", make_fqn_csharp(lcm, lm->type->typename));
emit_continue("%s", make_fqn_csharp(lcm, lm->type->lctypename));

for (unsigned int i = 0; i < g_ptr_array_size(lm->dimensions); i++) {
lcm_dimension_t *dim = (lcm_dimension_t*) g_ptr_array_index(lm->dimensions, i);
Expand Down
20 changes: 20 additions & 0 deletions lcmgen/lcmgen.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,26 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=".\emit_csharp.c"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="2"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\getopt.c"
>
Expand Down

0 comments on commit ebd4243

Please sign in to comment.