Several C/C++/PHP/Smalltalk/Vala examples added

This commit is contained in:
Kolan Sh 2014-04-18 17:22:46 +04:00
parent ad11e3bcab
commit 93fc0b727d
21 changed files with 735 additions and 1 deletions

View File

@ -0,0 +1,14 @@
#ifndef __EXPORT_H__
#define __EXPORT_H__
#ifdef WIN32
# ifdef libmean_EXPORTS
# define LIBMEAN_EXPORT extern __declspec(dllexport)
# else
# define LIBMEAN_EXPORT __declspec(dllimport)
# endif
#else
# define LIBMEAN_EXPORT
#endif
#endif __EXPORT_H__

View File

@ -0,0 +1,14 @@
#ifndef __PLATFORM_H__
#define __PLATFORM_H__
#ifdef WIN32
# ifdef libmean_EXPORTS
# define LIBMEAN_EXPORT extern __declspec(dllexport)
# else
# define LIBMEAN_EXPORT __declspec(dllimport)
# endif
#else
# define LIBMEAN_EXPORT
#endif
#endif /* __PLATFORM_H__ */

View File

@ -0,0 +1,6 @@
#include "sub.h"
double
mean(double a, double b) {
return (a+b) / 2;
}

13
c/cmake_lib/libmean/sub.h Normal file
View File

@ -0,0 +1,13 @@
#include "export.h"
//#if defined __cplusplus
//extern "C"
//{
//#endif
double LIBMEAN_EXPORT
mean(double, double);
//#if defined __cplusplus
//}
//#endif

View File

@ -0,0 +1,15 @@
#include <vcl.h>
#include <windows.h>
#pragma hdrstop
#pragma argsused
#include <tchar.h>
#include <stdio.h>
int _tmain(int argc, _TCHAR* argv[])
{
printf ("%2$.2d, %1$s\n", "ñòðîêà", 2000);
system("pause");
return 0;
}

View File

@ -0,0 +1,170 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{7F4ECED6-C69A-4F64-8423-D897638FE026}</ProjectGuid>
<ProjectVersion>14.3</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Console</AppType>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<ProjectType>CppConsoleApplication</ProjectType>
<Multithreaded>true</Multithreaded>
<VerInfo_Locale>1049</VerInfo_Locale>
<_TCHARMapping>wchar_t</_TCHARMapping>
<Manifest_File>None</Manifest_File>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
<IntermediateOutputDir>.\$(Platform)\$(Config)</IntermediateOutputDir>
<FinalOutputDir>.\$(Platform)\$(Config)</FinalOutputDir>
<BCC_wpar>false</BCC_wpar>
<BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
<BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
<ILINK_TranslatedLibraryPath>$(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath)</ILINK_TranslatedLibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<VerInfo_Locale>1033</VerInfo_Locale>
<PackageImports>JvBDE;JvGlobus;JvWizards;JvMM;JvManagedThreads;fs17;frx17;JvHMI;bindcompfmx;JvBands;vcldbx;fmx;rtl;dbrtl;IndySystem;TeeDB;JvDlgs;bindcomp;inetdb;JvCrypt;JvPluginSystem;vclib;inetdbbde;DBXInterBaseDriver;Tee;JclContainers;DataSnapCommon;JvCmp;JvNet;JvSystem;xmlrtl;JvDotNetCtrls;ibxpress;DbxCommonDriver;JvControls;vclimg;JvTimeFramework;IndyProtocols;dbxcds;MetropolisUILiveTile;JvXPCtrls;soaprtl;bindcompdbx;FMXTee;TeeUI;vclactnband;bindengine;bindcompvcl;vcldb;vcldsnap;Jcl;vclie;JvStdCtrls;JvCustom;JvJans;JvPageComps;JvPrintPreview;vcltouch;bcbsmp;websnap;CustomIPTransport;JvCore;dsnap;IndyIPServer;IndyCore;vcl;IndyIPCommon;dsnapcon;FmxTeeUI;frxDB17;inet;fsDB17;JclVcl;JvAppFrm;JvDB;JvPascalInterpreter;vclx;frxe17;inetdbxpress;webdsnap;JvRuntimeDesign;JclDeveloperTools;bdertl;JvDocking;dbexpress;adortl;bcbie;IndyIPClient;$(PackageImports)</PackageImports>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<IncludePath>$(BDSINCLUDE)\windows\vcl;$(IncludePath)</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
<BCC_DisableOptimizations>true</BCC_DisableOptimizations>
<DCC_Optimize>false</DCC_Optimize>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<Defines>_DEBUG;$(Defines)</Defines>
<BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
<BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
<DCC_Define>DEBUG</DCC_Define>
<BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
<TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
<BCC_StackFrames>true</BCC_StackFrames>
<ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
<TASM_Debugging>Full</TASM_Debugging>
<BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
<BCC_EnableCPPExceptions>true</BCC_EnableCPPExceptions>
<BCC_DisableFramePtrElimOpt>true</BCC_DisableFramePtrElimOpt>
<BCC_DisableSpellChecking>true</BCC_DisableSpellChecking>
<CLANG_UnwindTables>true</CLANG_UnwindTables>
<ILINK_LibraryPath>$(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<ILINK_TranslatedLibraryPath>$(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath)</ILINK_TranslatedLibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<UsePackages>false</UsePackages>
<VerInfo_Locale>1033</VerInfo_Locale>
<LinkPackageStatics>rtl.lib;vcl.lib</LinkPackageStatics>
<Manifest_File>None</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<Defines>NDEBUG;$(Defines)</Defines>
<TASM_Debugging>None</TASM_Debugging>
</PropertyGroup>
<ItemGroup>
<CppCompile Include="File1.cpp">
<BuildOrder>1</BuildOrder>
</CppCompile>
<PCHCompile Include="Project1PCH1.h">
<BuildOrder>0</BuildOrder>
</PCHCompile>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>CPlusPlusBuilder.Personality.12</Borland.Personality>
<Borland.ProjectType>CppConsoleApplication</Borland.ProjectType>
<BorlandProject>
<CPlusPlusBuilder.Personality>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">1049</VersionInfo>
<VersionInfo Name="CodePage">1251</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
<VersionInfoKeys Name="CFBundleName"/>
<VersionInfoKeys Name="CFBundleDisplayName"/>
<VersionInfoKeys Name="CFBundleIdentifier"/>
<VersionInfoKeys Name="CFBundleVersion"/>
<VersionInfoKeys Name="CFBundlePackageType"/>
<VersionInfoKeys Name="CFBundleSignature"/>
<VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/>
<VersionInfoKeys Name="CFBundleExecutable"/>
</VersionInfoKeys>
<ProjectProperties>
<ProjectProperties Name="AutoShowDeps">False</ProjectProperties>
<ProjectProperties Name="ManagePaths">True</ProjectProperties>
<ProjectProperties Name="VerifyPackages">True</ProjectProperties>
</ProjectProperties>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\bcboffice2k170.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\bcbofficexp170.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
</Excluded_Packages>
</CPlusPlusBuilder.Personality>
<Deployment/>
<Platforms>
<Platform value="Win32">True</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Cpp.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>

6
c/sprintf/sprintf.c Normal file
View File

@ -0,0 +1,6 @@
#include <stdio.h>
void main (void)
{
printf ("%2$.2d, %1$s", "строка", 2000);
}

View File

@ -0,0 +1,193 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{4E50FA4D-63CB-49EE-922A-7D545B4343DC}</ProjectGuid>
<ProjectVersion>14.3</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<AppType>Application</AppType>
<MainSource>Project1.cpp</MainSource>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<ProjectType>CppVCLApplication</ProjectType>
<Multithreaded>true</Multithreaded>
<VerInfo_Locale>1049</VerInfo_Locale>
<Icon_MainIcon>$(BDS)\bin\cbuilder_PROJECTICON.ico</Icon_MainIcon>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<AllPackageLibs>rtl.lib;vcl.lib</AllPackageLibs>
<Manifest_File>None</Manifest_File>
<_TCHARMapping>wchar_t</_TCHARMapping>
<DCC_CBuilderOutput>JPHNE</DCC_CBuilderOutput>
<IntermediateOutputDir>.\$(Platform)\$(Config)</IntermediateOutputDir>
<FinalOutputDir>.\$(Platform)\$(Config)</FinalOutputDir>
<BCC_wpar>false</BCC_wpar>
<BCC_OptimizeForSpeed>true</BCC_OptimizeForSpeed>
<BCC_ExtendedErrorInfo>true</BCC_ExtendedErrorInfo>
<ILINK_TranslatedLibraryPath>$(BDSLIB)\$(PLATFORM)\release\$(LANGDIR);$(ILINK_TranslatedLibraryPath)</ILINK_TranslatedLibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<IncludePath>$(BDSINCLUDE)\windows\vcl;$(IncludePath)</IncludePath>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<PackageImports>JvBDE;JvGlobus;JvWizards;JvMM;JvManagedThreads;fs17;frx17;JvHMI;bindcompfmx;JvBands;vcldbx;fmx;rtl;dbrtl;IndySystem;TeeDB;JvDlgs;bindcomp;inetdb;JvCrypt;JvPluginSystem;vclib;inetdbbde;DBXInterBaseDriver;Tee;JclContainers;DataSnapCommon;JvCmp;JvNet;JvSystem;xmlrtl;JvDotNetCtrls;ibxpress;DbxCommonDriver;JvControls;vclimg;JvTimeFramework;IndyProtocols;dbxcds;MetropolisUILiveTile;JvXPCtrls;soaprtl;bindcompdbx;FMXTee;TeeUI;vclactnband;bindengine;bindcompvcl;vcldb;vcldsnap;Jcl;vclie;JvStdCtrls;JvCustom;JvJans;JvPageComps;JvPrintPreview;vcltouch;bcbsmp;websnap;CustomIPTransport;JvCore;dsnap;IndyIPServer;IndyCore;vcl;IndyIPCommon;dsnapcon;FmxTeeUI;frxDB17;inet;fsDB17;JclVcl;JvAppFrm;JvDB;JvPascalInterpreter;vclx;frxe17;inetdbxpress;webdsnap;JvRuntimeDesign;JclDeveloperTools;bdertl;JvDocking;dbexpress;adortl;bcbie;IndyIPClient;$(PackageImports)</PackageImports>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<BCC_OptimizeForSpeed>false</BCC_OptimizeForSpeed>
<BCC_DisableOptimizations>true</BCC_DisableOptimizations>
<DCC_Optimize>false</DCC_Optimize>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<Defines>_DEBUG;$(Defines)</Defines>
<BCC_InlineFunctionExpansion>false</BCC_InlineFunctionExpansion>
<BCC_UseRegisterVariables>None</BCC_UseRegisterVariables>
<DCC_Define>DEBUG</DCC_Define>
<BCC_DebugLineNumbers>true</BCC_DebugLineNumbers>
<TASM_DisplaySourceLines>true</TASM_DisplaySourceLines>
<BCC_StackFrames>true</BCC_StackFrames>
<ILINK_FullDebugInfo>true</ILINK_FullDebugInfo>
<TASM_Debugging>Full</TASM_Debugging>
<BCC_SourceDebuggingOn>true</BCC_SourceDebuggingOn>
<BCC_EnableCPPExceptions>true</BCC_EnableCPPExceptions>
<BCC_DisableFramePtrElimOpt>true</BCC_DisableFramePtrElimOpt>
<BCC_DisableSpellChecking>true</BCC_DisableSpellChecking>
<CLANG_UnwindTables>true</CLANG_UnwindTables>
<ILINK_LibraryPath>$(BDSLIB)\$(PLATFORM)\debug;$(ILINK_LibraryPath)</ILINK_LibraryPath>
<ILINK_TranslatedLibraryPath>$(BDSLIB)\$(PLATFORM)\debug\$(LANGDIR);$(ILINK_TranslatedLibraryPath)</ILINK_TranslatedLibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<LinkPackageStatics>rtl.lib;vcl.lib</LinkPackageStatics>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<Defines>NDEBUG;$(Defines)</Defines>
<TASM_Debugging>None</TASM_Debugging>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup>
<ItemGroup>
<CppCompile Include="Project1.cpp">
<BuildOrder>0</BuildOrder>
</CppCompile>
<PCHCompile Include="Project1PCH1.h">
<BuildOrder>1</BuildOrder>
</PCHCompile>
<CppCompile Include="Unit1.cpp">
<Form>Form1</Form>
<FormType>dfm</FormType>
<DependentOn>Unit1.h</DependentOn>
<BuildOrder>2</BuildOrder>
</CppCompile>
<FormResources Include="Unit1.dfm"/>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>CPlusPlusBuilder.Personality.12</Borland.Personality>
<Borland.ProjectType>CppVCLApplication</Borland.ProjectType>
<BorlandProject>
<CPlusPlusBuilder.Personality>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
<VersionInfo Name="Release">0</VersionInfo>
<VersionInfo Name="Build">0</VersionInfo>
<VersionInfo Name="Debug">False</VersionInfo>
<VersionInfo Name="PreRelease">False</VersionInfo>
<VersionInfo Name="Special">False</VersionInfo>
<VersionInfo Name="Private">False</VersionInfo>
<VersionInfo Name="DLL">False</VersionInfo>
<VersionInfo Name="Locale">1049</VersionInfo>
<VersionInfo Name="CodePage">1251</VersionInfo>
</VersionInfo>
<VersionInfoKeys>
<VersionInfoKeys Name="CompanyName"/>
<VersionInfoKeys Name="FileDescription"/>
<VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="InternalName"/>
<VersionInfoKeys Name="LegalCopyright"/>
<VersionInfoKeys Name="LegalTrademarks"/>
<VersionInfoKeys Name="OriginalFilename"/>
<VersionInfoKeys Name="ProductName"/>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"/>
<VersionInfoKeys Name="CFBundleName"/>
<VersionInfoKeys Name="CFBundleDisplayName"/>
<VersionInfoKeys Name="CFBundleIdentifier"/>
<VersionInfoKeys Name="CFBundleVersion"/>
<VersionInfoKeys Name="CFBundlePackageType"/>
<VersionInfoKeys Name="CFBundleSignature"/>
<VersionInfoKeys Name="CFBundleAllowMixedLocalizations"/>
<VersionInfoKeys Name="CFBundleExecutable"/>
</VersionInfoKeys>
<ProjectProperties>
<ProjectProperties Name="AutoShowDeps">False</ProjectProperties>
<ProjectProperties Name="ManagePaths">True</ProjectProperties>
<ProjectProperties Name="VerifyPackages">True</ProjectProperties>
</ProjectProperties>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\bcboffice2k170.bpl">Embarcadero C++Builder Office 2000 Servers Package</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\bcbofficexp170.bpl">Embarcadero C++Builder Office XP Servers Package</Excluded_Packages>
</Excluded_Packages>
<Source>
<Source Name="MainSource">Project1.cpp</Source>
</Source>
</CPlusPlusBuilder.Personality>
<Deployment/>
<Platforms>
<Platform value="Win32">True</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Cpp.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Cpp.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
</Project>

View File

@ -0,0 +1,35 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <tchar.h>
//---------------------------------------------------------------------------
USEFORM("Unit1.cpp", Form1);
//---------------------------------------------------------------------------
int WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
try
{
Application->Initialize();
Application->MainFormOnTaskBar = true;
Application->CreateForm(__classid(TForm1), &Form1);
Application->Run();
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
catch (...)
{
try
{
throw Exception("");
}
catch (Exception &exception)
{
Application->ShowException(&exception);
}
}
return 0;
}
//---------------------------------------------------------------------------

View File

@ -0,0 +1,23 @@
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString as;
Label1->Caption = as = ExtractFileExt (Edit1->Text);
Label2->Caption = IntToStr((int)as.IsEmpty());
}
//---------------------------------------------------------------------------

View File

@ -0,0 +1,47 @@
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 136
ClientWidth = 394
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 88
Top = 72
Width = 265
Height = 13
Caption = 'Label1'
end
object Label2: TLabel
Left = 88
Top = 104
Width = 265
Height = 13
Caption = 'Label2'
end
object Edit1: TEdit
Left = 88
Top = 16
Width = 121
Height = 21
TabOrder = 0
Text = 'Edit1'
end
object Button1: TButton
Left = 280
Top = 24
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 1
OnClick = Button1Click
end
end

View File

@ -0,0 +1,26 @@
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <System.Classes.hpp>
#include <Vcl.Controls.hpp>
#include <Vcl.StdCtrls.hpp>
#include <Vcl.Forms.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TLabel *Label1;
TEdit *Edit1;
TLabel *Label2;
TButton *Button1;
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif

18
php/preg_replace.php Executable file
View File

@ -0,0 +1,18 @@
<?php
$string = '<?if($var )?>content<endif> text... text... text... <?if($var )?>content<endif> text... text... text...';
$pattern = 'var';
$replacement = 'VAR';
$pattern = '/<\?if\(\$var \)\?>([^>]*)<endif>/i';
$replacement = '<?php if($var ) { echo \'\1\';?>';
#echo preg_replace($pattern, $replacement, $string);
/*$user = preg_replace("<\?if\(\$(.*?)\)\?>(.*?)<endif>/i","<\?php if\($(.*?)\) { echo \'\2\';?>",$user);
echo $user
*/
$user="User1";
$user = preg_replace("(.*)","{1}aaa",$user);
echo $user;
?>

View File

@ -4,4 +4,5 @@ a := #(1 'hi' 3.14 1 2 (4 5))
(a asSet) displayNl "Set(1 'hi' 3.14 2 (4 5))"
.
hash := Dictionary from: { 'water' -> 'wet'. 'fire' -> 'hot' }.
hash at: 'fire' displayNl "Prints: hot"
hash at: 'fire' displayNl. "Prints: hot"
hash keysAndValuesDo: [ :k :v | ('%1 is %2' % { k. v }) displayNl ].

View File

@ -0,0 +1,2 @@
match: inputState
^ inputState.

View File

@ -0,0 +1,60 @@
#include <iostream>
using namespace std;
/*
class B {
int *ptr;
};
class A {
public:
int x;
double y;
int *ptr;
};
*/
class A {
std::string _s;
A ();
public:
A (const std::string& s) { _s = s; }
std::string get_s () { return _s; }
std::string set_s (const std::string& s) { _s = s; }
};
int main () {
A a ("0");
A& b = a;
b = a;
cout << "a = " << a.get_s() << endl;
cout << "b = " << b.get_s() << endl;
b.set_s ("1");
cout << "a = " << a.get_s() << endl;
cout << "b = " << b.get_s() << endl;
/* A a;
a.x = 1;
a.y = 2;
a.ptr = &a.x;
A b;
b = a;
cout << a.x << " " << b.x << endl;
cout << a.y << " " << b.y << endl;
cout << a.ptr << " " << b.ptr << endl;
*/
return 0;
}

View File

@ -0,0 +1,25 @@
#!/usr/bin/env vala --pkg gtk+-3.0
using Gtk;
public static int main (string[] args) {
Gtk.init (ref args);
Window window = new Window(WindowType.TOPLEVEL);
window.set_size_request(100, 100);
window.destroy.connect(main_quit);
Button button = new Button.with_label("Push me");
button.clicked.connect(() => {
MessageDialog msg = new MessageDialog(window, DialogFlags.MODAL,
MessageType.INFO, ButtonsType.OK, "Some message");
msg.run();
msg.close();
});
window.add(button);
window.show_all();
Gtk.main();
return 0;
}

25
vala/concat/concat.vala Normal file
View File

@ -0,0 +1,25 @@
public class AAA : Object {
public string str { get; set; default = ""; }
}
void func (string str)
{
}
void main () {
string tmp = "aaa";
string n = null;
tmp = tmp.concat (n, "B");
print (tmp);
print ("\n---- AAA ----\n");
var a = new AAA ();
print ("AAA".concat(a.str, "BBB"));
var tmp2 = "";//null;
func (tmp2);
print ("\n---- Construct ----\n");
var tmp3 = Object.new (typeof (AAA)) as AAA;
print ("AAA".concat(tmp3.str, "BBB"));
}

View File

@ -0,0 +1,17 @@
public class AAA : Object {
}
public class BBB : AAA {
}
void main () {
AAA real_a = new AAA ();
stdout.printf ("real_a = %s\n", real_a.get_type ().to_string ());
BBB real_b = new BBB ();
stdout.printf ("real_b = %s\n", real_b.get_type ().to_string ());
var a_new = Object.new (real_a.get_type ());
stdout.printf ("a_new = %s\n", a_new.get_type ().to_string ());
var b_new = Object.new (real_b.get_type ());
stdout.printf ("b_new = %s\n", b_new.get_type ().to_string ());
}

18
vala/list/list2.vala Normal file
View File

@ -0,0 +1,18 @@
public static int main (string[] args) {
List<string> list = new List<string> ();
list.append ("1. entry");
list.append ("2. entry");
list.append ("3. entry");
// Output:
// ``1. entry``
// ``2. entry``
// ``3. entry``
list.foreach ((entry) => {
stdout.puts (entry);
stdout.putc ('\n');
});
return 0;
}

6
vala/string/string.vala Normal file
View File

@ -0,0 +1,6 @@
static void main () {
string s1 = null;
string s2 = "";
bool b = (s1 == s2);
stdout.printf ("%s", b.to_string());
}