text:
Set intercharacter spacing for text in pdf with pdf sdk is simple to apply in VB.NET if you use these source codes below. ByteScout PDF Suite: the set that includes 6 SDK products to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript. It can set intercharacter spacing for text in pdf with pdf sdk in VB.NET.

This prolific sample source code in VB.NET for ByteScout PDF Suite contains various functions and other necessary options you should do calling the API to set intercharacter spacing for text in pdf with pdf sdk. IF you want to implement the functionality, just copy and paste this code for VB.NET below into your code editor with your app, compile and run your application. Further improvement of the code will make it more robust.

ByteScout provides the free trial version of ByteScout PDF Suite along with the documentation and source code samples.

## REQUEST FREE TECH SUPPORT

[Click here to get in touch](https://bytescout.zendesk.com/hc/en-us/requests/new?subject=ByteScout%20PDF%20Suite%20Question)

or just send email to [support@bytescout.com](mailto:support@bytescout.com?subject=ByteScout%20PDF%20Suite%20Question)

## ON-PREMISE OFFLINE SDK

[Get Your 60 Day Free Trial](https://bytescout.com/download/web-installer?utm_source=github-readme)
[Explore SDK Docs](https://bytescout.com/documentation/index.html?utm_source=github-readme)
[Sign Up For Online Training](https://academy.bytescout.com/)

## ON-DEMAND REST WEB API

[Get your API key](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Documentation](https://pdf.co/documentation/api?utm_source=github-readme)
[Explore Web API Samples](https://github.com/bytescout/ByteScout-SDK-SourceCode/tree/master/PDF.co%20Web%20API)

## VIDEO REVIEW

[https://www.youtube.com/watch?v=NEwNs2b9YN8](https://www.youtube.com/watch?v=NEwNs2b9YN8)

<!-- code block begin -->

##### ****IntercharacterSpacing.VS2005.vbproj:**

```
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{951C634C-4684-40A5-919C-741C5CA61EA4}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <StartupObject>Sub Main</StartupObject>
    <RootNamespace>IntercharacterSpacing</RootNamespace>
    <AssemblyName>IntercharacterSpacing</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <MyType>Console</MyType>
    <ProductVersion>8.0.50727</ProductVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <DefineDebug>false</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup>
    <OptionExplicit>On</OptionExplicit>
  </PropertyGroup>
  <PropertyGroup>
    <OptionCompare>Binary</OptionCompare>
  </PropertyGroup>
  <PropertyGroup>
    <OptionStrict>Off</OptionStrict>
  </PropertyGroup>
  <PropertyGroup>
    <OptionInfer>On</OptionInfer>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.PDF, Version=1.0.0.15, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
  </ItemGroup>
  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
    <Import Include="System.Collections" />
    <Import Include="System.Collections.Generic" />
    <Import Include="System.Data" />
    <Import Include="System.Diagnostics" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.vb" />
    <Compile Include="My Project\AssemblyInfo.vb" />
    <Compile Include="My Project\Application.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Application.myapp</DependentUpon>
    </Compile>
    <Compile Include="My Project\Resources.Designer.vb">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="My Project\Settings.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="My Project\Application.myapp">
      <Generator>MyApplicationCodeGenerator</Generator>
      <LastGenOutput>Application.Designer.vb</LastGenOutput>
    </None>
    <None Include="My Project\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <CustomToolNamespace>My</CustomToolNamespace>
      <LastGenOutput>Settings.Designer.vb</LastGenOutput>
    </None>
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.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.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****IntercharacterSpacing.VS2008.vbproj:**

```
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{951C634C-4684-40A5-919C-741C5CA61EA4}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <StartupObject>Sub Main</StartupObject>
    <RootNamespace>IntercharacterSpacing</RootNamespace>
    <AssemblyName>IntercharacterSpacing</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <MyType>Console</MyType>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <ProductVersion>9.0.30729</ProductVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <DefineDebug>false</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup>
    <OptionExplicit>On</OptionExplicit>
  </PropertyGroup>
  <PropertyGroup>
    <OptionCompare>Binary</OptionCompare>
  </PropertyGroup>
  <PropertyGroup>
    <OptionStrict>Off</OptionStrict>
  </PropertyGroup>
  <PropertyGroup>
    <OptionInfer>On</OptionInfer>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.PDF, Version=1.0.0.15, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
  </ItemGroup>
  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
    <Import Include="System.Collections" />
    <Import Include="System.Collections.Generic" />
    <Import Include="System.Data" />
    <Import Include="System.Diagnostics" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.vb" />
    <Compile Include="My Project\AssemblyInfo.vb" />
    <Compile Include="My Project\Application.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Application.myapp</DependentUpon>
    </Compile>
    <Compile Include="My Project\Resources.Designer.vb">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="My Project\Settings.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="My Project\Application.myapp">
      <Generator>MyApplicationCodeGenerator</Generator>
      <LastGenOutput>Application.Designer.vb</LastGenOutput>
    </None>
    <None Include="My Project\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <CustomToolNamespace>My</CustomToolNamespace>
      <LastGenOutput>Settings.Designer.vb</LastGenOutput>
    </None>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.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.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****IntercharacterSpacing.VS2010.vbproj:**

```
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{951C634C-4684-40A5-919C-741C5CA61EA4}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <StartupObject>Sub Main</StartupObject>
    <RootNamespace>IntercharacterSpacing</RootNamespace>
    <AssemblyName>IntercharacterSpacing</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <MyType>Console</MyType>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <DefineDebug>false</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup>
    <OptionExplicit>On</OptionExplicit>
  </PropertyGroup>
  <PropertyGroup>
    <OptionCompare>Binary</OptionCompare>
  </PropertyGroup>
  <PropertyGroup>
    <OptionStrict>Off</OptionStrict>
  </PropertyGroup>
  <PropertyGroup>
    <OptionInfer>On</OptionInfer>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.PDF, Version=1.0.0.15, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
  </ItemGroup>
  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
    <Import Include="System.Collections" />
    <Import Include="System.Collections.Generic" />
    <Import Include="System.Data" />
    <Import Include="System.Diagnostics" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.vb" />
    <Compile Include="My Project\AssemblyInfo.vb" />
    <Compile Include="My Project\Application.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Application.myapp</DependentUpon>
    </Compile>
    <Compile Include="My Project\Resources.Designer.vb">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="My Project\Settings.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="My Project\Application.myapp">
      <Generator>MyApplicationCodeGenerator</Generator>
      <LastGenOutput>Application.Designer.vb</LastGenOutput>
    </None>
    <None Include="My Project\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <CustomToolNamespace>My</CustomToolNamespace>
      <LastGenOutput>Settings.Designer.vb</LastGenOutput>
    </None>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.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.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****IntercharacterSpacing.VS2012.vbproj:**

```
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{951C634C-4684-40A5-919C-741C5CA61EA4}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <StartupObject>Sub Main</StartupObject>
    <RootNamespace>IntercharacterSpacing</RootNamespace>
    <AssemblyName>IntercharacterSpacing</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <MyType>Console</MyType>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <DefineDebug>false</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup>
    <OptionExplicit>On</OptionExplicit>
  </PropertyGroup>
  <PropertyGroup>
    <OptionCompare>Binary</OptionCompare>
  </PropertyGroup>
  <PropertyGroup>
    <OptionStrict>Off</OptionStrict>
  </PropertyGroup>
  <PropertyGroup>
    <OptionInfer>On</OptionInfer>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.PDF, Version=1.0.0.15, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
  </ItemGroup>
  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
    <Import Include="System.Collections" />
    <Import Include="System.Collections.Generic" />
    <Import Include="System.Data" />
    <Import Include="System.Diagnostics" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.vb" />
    <Compile Include="My Project\AssemblyInfo.vb" />
    <Compile Include="My Project\Application.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Application.myapp</DependentUpon>
    </Compile>
    <Compile Include="My Project\Resources.Designer.vb">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="My Project\Settings.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="My Project\Application.myapp">
      <Generator>MyApplicationCodeGenerator</Generator>
      <LastGenOutput>Application.Designer.vb</LastGenOutput>
    </None>
    <None Include="My Project\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <CustomToolNamespace>My</CustomToolNamespace>
      <LastGenOutput>Settings.Designer.vb</LastGenOutput>
    </None>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.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.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****IntercharacterSpacing.VS2013.vbproj:**

```
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{951C634C-4684-40A5-919C-741C5CA61EA4}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <StartupObject>Sub Main</StartupObject>
    <RootNamespace>IntercharacterSpacing</RootNamespace>
    <AssemblyName>IntercharacterSpacing</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <MyType>Console</MyType>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <DefineDebug>false</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup>
    <OptionExplicit>On</OptionExplicit>
  </PropertyGroup>
  <PropertyGroup>
    <OptionCompare>Binary</OptionCompare>
  </PropertyGroup>
  <PropertyGroup>
    <OptionStrict>Off</OptionStrict>
  </PropertyGroup>
  <PropertyGroup>
    <OptionInfer>On</OptionInfer>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.PDF, Version=1.0.0.15, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
  </ItemGroup>
  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
    <Import Include="System.Collections" />
    <Import Include="System.Collections.Generic" />
    <Import Include="System.Data" />
    <Import Include="System.Diagnostics" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.vb" />
    <Compile Include="My Project\AssemblyInfo.vb" />
    <Compile Include="My Project\Application.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Application.myapp</DependentUpon>
    </Compile>
    <Compile Include="My Project\Resources.Designer.vb">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="My Project\Settings.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="My Project\Application.myapp">
      <Generator>MyApplicationCodeGenerator</Generator>
      <LastGenOutput>Application.Designer.vb</LastGenOutput>
    </None>
    <None Include="My Project\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <CustomToolNamespace>My</CustomToolNamespace>
      <LastGenOutput>Settings.Designer.vb</LastGenOutput>
    </None>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.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.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****IntercharacterSpacing.VS2015.vbproj:**

```
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{951C634C-4684-40A5-919C-741C5CA61EA4}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <StartupObject>Sub Main</StartupObject>
    <RootNamespace>IntercharacterSpacing</RootNamespace>
    <AssemblyName>IntercharacterSpacing</AssemblyName>
    <FileAlignment>512</FileAlignment>
    <MyType>Console</MyType>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <DefineDebug>true</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <OutputPath>bin\Debug\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <DefineDebug>false</DefineDebug>
    <DefineTrace>true</DefineTrace>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
  </PropertyGroup>
  <PropertyGroup>
    <OptionExplicit>On</OptionExplicit>
  </PropertyGroup>
  <PropertyGroup>
    <OptionCompare>Binary</OptionCompare>
  </PropertyGroup>
  <PropertyGroup>
    <OptionStrict>Off</OptionStrict>
  </PropertyGroup>
  <PropertyGroup>
    <OptionInfer>On</OptionInfer>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Bytescout.PDF, Version=1.0.0.15, Culture=neutral, PublicKeyToken=f7dd1bd9d40a50eb, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
  </ItemGroup>
  <ItemGroup>
    <Import Include="Microsoft.VisualBasic" />
    <Import Include="System" />
    <Import Include="System.Collections" />
    <Import Include="System.Collections.Generic" />
    <Import Include="System.Data" />
    <Import Include="System.Diagnostics" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.vb" />
    <Compile Include="My Project\AssemblyInfo.vb" />
    <Compile Include="My Project\Application.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Application.myapp</DependentUpon>
    </Compile>
    <Compile Include="My Project\Resources.Designer.vb">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="My Project\Settings.Designer.vb">
      <AutoGen>True</AutoGen>
      <DependentUpon>Settings.settings</DependentUpon>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="My Project\Resources.resx">
      <Generator>VbMyResourcesResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.vb</LastGenOutput>
      <CustomToolNamespace>My.Resources</CustomToolNamespace>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="My Project\Application.myapp">
      <Generator>MyApplicationCodeGenerator</Generator>
      <LastGenOutput>Application.Designer.vb</LastGenOutput>
    </None>
    <None Include="My Project\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <CustomToolNamespace>My</CustomToolNamespace>
      <LastGenOutput>Settings.Designer.vb</LastGenOutput>
    </None>
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.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.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
```

<!-- code block end -->

<!-- code block begin -->

##### ****Program.vb:**

```
Imports Bytescout.PDF

''' <summary>
''' This example demonstrates how to change the intercharacter spacing.
''' </summary>
Class Program

    Shared Sub Main()

        ' Create new document
        Dim pdfDocument = New Document()
        pdfDocument.RegistrationName = "demo"
		pdfDocument.RegistrationKey = "demo"
        ' Add page
        Dim page = New Page(PaperFormat.A4)
        pdfDocument.Pages.Add(page)

        Dim canvas = page.Canvas

        Dim font = New Font("Arial", 16)
        Dim brush = New SolidBrush()
        Dim stringFormat = New StringFormat()

        ' Standard spacing
        stringFormat.CharacterSpacing = 0.0F
        canvas.DrawString("Standard intercharacter spacing 0.0", font, brush, 20, 20, stringFormat)

        ' Increased spacing
        stringFormat.CharacterSpacing = 1.0F
        canvas.DrawString("Increased intercharacter spacing 1.0", font, brush, 20, 50, stringFormat)

        ' Reduced spacing
        stringFormat.CharacterSpacing = -0.75F
        canvas.DrawString("Reduced intercharacter spacing -0.75", font, brush, 20, 80, stringFormat)

        ' Save document to file
        pdfDocument.Save("result.pdf")

        ' Cleanup
		pdfDocument.Dispose()

        ' Open document in default PDF viewer app
        Process.Start("result.pdf")

    End Sub

End Class

```

<!-- code block end -->


text:
/*
This program models the effect of flu and hay fever on the sneezing symptom.
From
F. Riguzzi and T. Swift. The PITA system: Tabling and answer subsumption for reasoning under uncertainty. Theory and Practice of Logic Programming, 27th International Conference on Logic Programming (ICLP'11) Special Issue, 11(4-5):433-449, 2011.
*/
:- use_module(library(pita)).

:- if(current_predicate(use_rendering/1)).
:- use_rendering(graphviz).
:- use_rendering(table,[header(['Multivalued variable index','Rule index','Grounding substitution'])]).
:- endif.

:- pita.

:- begin_lpad.

strong_sneezing(X) : 0.3 ; moderate_sneezing(X) : 0.5 :- flu(X).
% if X has the flu, there is a probability of 0.3 that he has strong sneezing
% and a probability of 0.5 that she has moderate sneezing

strong_sneezing(X) : 0.2 ; moderate_sneezing(X) : 0.6 :- hay_fever(X).
% if X has hay fever, there is a probability of 0.2 that he has strong sneezing
% and a probability of 0.6 that she has moderate sneezing

flu(bob).
% bob has certainly the flu

hay_fever(bob).
% bob has certainly hay fever

:- end_lpad.

/** <examples>

?- prob(strong_sneezing(bob),Prob). % what is the probability that bob has strong sneezing?
% expected result 0.43999999999999995
?- prob(moderate_sneezing(bob),Prob). % what is the probability that bob has
% moderate sneezing?
% expected result 0.7999999999999998
?- prob(strong_sneezing(bob),Prob),bar(Prob,C). % what is the probability that bob has strong sneezing?
% expected result 0.43999999999999995
?- prob(moderate_sneezing(bob),Prob),bar(Prob,C). % what is the probability that bob has
% moderate sneezing?
% expected result 0.7999999999999998
?- bdd_dot_string(strong_sneezing(bob),BDD,Var).

*/

redpajama_set_name: RedPajamaGithub


text:
Rails.application.routes.draw do
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

  post '/graphql', to: 'graphql#execute'
end


text:
#include <stdio.h>
#include <string.h>
#include <sys/queue.h>
#include <netinet/in.h>

#include <rte_common.h>
#include <rte_hexdump.h>
#include <rte_malloc.h>
#include <cmdline_rdline.h>
#include <cmdline_parse.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
#include <cmdline_parse_ipaddr.h>
#include <cmdline_parse_etheraddr.h>
#include <cmdline_socket.h>

#include "app.h"
#include "pipeline_common_fe.h"
#include "pipeline_firewall.h"

#define BUF_SIZE		1024

struct app_pipeline_firewall_rule {
	struct pipeline_firewall_key key;
	int32_t priority;
	uint32_t port_id;
	void *entry_ptr;

	TAILQ_ENTRY(app_pipeline_firewall_rule) node;
};

struct app_pipeline_firewall {
	/* parameters */
	uint32_t n_ports_in;
	uint32_t n_ports_out;

	/* rules */
	TAILQ_HEAD(, app_pipeline_firewall_rule) rules;
	uint32_t n_rules;
	uint32_t default_rule_present;
	uint32_t default_rule_port_id;
	void *default_rule_entry_ptr;
};

struct app_pipeline_add_bulk_params {
	struct pipeline_firewall_key *keys;
	uint32_t n_keys;
	uint32_t *priorities;
	uint32_t *port_ids;
};

struct app_pipeline_del_bulk_params {
	struct pipeline_firewall_key *keys;
	uint32_t n_keys;
};

static void
print_firewall_ipv4_rule(struct app_pipeline_firewall_rule *rule)
{
	printf("Prio = %" PRId32 " (SA = %" PRIu32 ".%" PRIu32
		".%" PRIu32 ".%" PRIu32 "/%" PRIu32 ", "
		"DA = %" PRIu32 ".%" PRIu32
		".%"PRIu32 ".%" PRIu32 "/%" PRIu32 ", "
		"SP = %" PRIu32 "-%" PRIu32 ", "
		"DP = %" PRIu32 "-%" PRIu32 ", "
		"Proto = %" PRIu32 " / 0x%" PRIx32 ") => "
		"Port = %" PRIu32 " (entry ptr = %p)\n",

		rule->priority,

		(rule->key.key.ipv4_5tuple.src_ip >> 24) & 0xFF,
		(rule->key.key.ipv4_5tuple.src_ip >> 16) & 0xFF,
		(rule->key.key.ipv4_5tuple.src_ip >> 8) & 0xFF,
		rule->key.key.ipv4_5tuple.src_ip & 0xFF,
		rule->key.key.ipv4_5tuple.src_ip_mask,

		(rule->key.key.ipv4_5tuple.dst_ip >> 24) & 0xFF,
		(rule->key.key.ipv4_5tuple.dst_ip >> 16) & 0xFF,
		(rule->key.key.ipv4_5tuple.dst_ip >> 8) & 0xFF,
		rule->key.key.ipv4_5tuple.dst_ip & 0xFF,
		rule->key.key.ipv4_5tuple.dst_ip_mask,

		rule->key.key.ipv4_5tuple.src_port_from,
		rule->key.key.ipv4_5tuple.src_port_to,

		rule->key.key.ipv4_5tuple.dst_port_from,
		rule->key.key.ipv4_5tuple.dst_port_to,

		rule->key.key.ipv4_5tuple.proto,
		rule->key.key.ipv4_5tuple.proto_mask,

		rule->port_id,
		rule->entry_ptr);
}

static struct app_pipeline_firewall_rule *
app_pipeline_firewall_rule_find(struct app_pipeline_firewall *p,
	struct pipeline_firewall_key *key)
{
	struct app_pipeline_firewall_rule *r;

	TAILQ_FOREACH(r, &p->rules, node)
		if (memcmp(key,
			&r->key,
			sizeof(struct pipeline_firewall_key)) == 0)
			return r;

	return NULL;
}

static int
app_pipeline_firewall_ls(
	struct app_params *app,
	uint32_t pipeline_id)
{
	struct app_pipeline_firewall *p;
	struct app_pipeline_firewall_rule *rule;
	uint32_t n_rules;
	int priority;

	/* Check input arguments */
	if (app == NULL)
		return -1;

	p = app_pipeline_data_fe(app, pipeline_id, &pipeline_firewall);
	if (p == NULL)
		return -1;

	n_rules = p->n_rules;
	for (priority = 0; n_rules; priority++)
		TAILQ_FOREACH(rule, &p->rules, node)
			if (rule->priority == priority) {
				print_firewall_ipv4_rule(rule);
				n_rules--;
			}

	if (p->default_rule_present)
		printf("Default rule: port %" PRIu32 " (entry ptr = %p)\n",
			p->default_rule_port_id,
			p->default_rule_entry_ptr);
	else
		printf("Default rule: DROP\n");

	printf("\n");

	return 0;
}

static void*
app_pipeline_firewall_init(struct pipeline_params *params,
	__rte_unused void *arg)
{
	struct app_pipeline_firewall *p;
	uint32_t size;

	/* Check input arguments */
	if ((params == NULL) ||
		(params->n_ports_in == 0) ||
		(params->n_ports_out == 0))
		return NULL;

	/* Memory allocation */
	size = RTE_CACHE_LINE_ROUNDUP(sizeof(struct app_pipeline_firewall));
	p = rte_zmalloc(NULL, size, RTE_CACHE_LINE_SIZE);
	if (p == NULL)
		return NULL;

	/* Initialization */
	p->n_ports_in = params->n_ports_in;
	p->n_ports_out = params->n_ports_out;

	TAILQ_INIT(&p->rules);
	p->n_rules = 0;
	p->default_rule_present = 0;
	p->default_rule_port_id = 0;
	p->default_rule_entry_ptr = NULL;

	return (void *) p;
}

static int
app_pipeline_firewall_free(void *pipeline)
{
	struct app_pipeline_firewall *p = pipeline;

	/* Check input arguments */
	if (p == NULL)
		return -1;

	/* Free resources */
	while (!TAILQ_EMPTY(&p->rules)) {
		struct app_pipeline_firewall_rule *rule;

		rule = TAILQ_FIRST(&p->rules);
		TAILQ_REMOVE(&p->rules, rule, node);
		rte_free(rule);
	}

	rte_free(p);
	return 0;
}

static int
app_pipeline_firewall_key_check_and_normalize(struct pipeline_firewall_key *key)
{
	switch (key->type) {
	case PIPELINE_FIREWALL_IPV4_5TUPLE:
	{
		uint32_t src_ip_depth = key->key.ipv4_5tuple.src_ip_mask;
		uint32_t dst_ip_depth = key->key.ipv4_5tuple.dst_ip_mask;
		uint16_t src_port_from = key->key.ipv4_5tuple.src_port_from;
		uint16_t src_port_to = key->key.ipv4_5tuple.src_port_to;
		uint16_t dst_port_from = key->key.ipv4_5tuple.dst_port_from;
		uint16_t dst_port_to = key->key.ipv4_5tuple.dst_port_to;

		uint32_t src_ip_netmask = 0;
		uint32_t dst_ip_netmask = 0;

		if ((src_ip_depth > 32) ||
			(dst_ip_depth > 32) ||
			(src_port_from > src_port_to) ||
			(dst_port_from > dst_port_to))
			return -1;

		if (src_ip_depth)
			src_ip_netmask = (~0) << (32 - src_ip_depth);

		if (dst_ip_depth)
			dst_ip_netmask = ((~0) << (32 - dst_ip_depth));

		key->key.ipv4_5tuple.src_ip &= src_ip_netmask;
		key->key.ipv4_5tuple.dst_ip &= dst_ip_netmask;

		return 0;
	}

	default:
		return -1;
	}
}

static int
app_pipeline_add_bulk_parse_file(char *filename,
		struct app_pipeline_add_bulk_params *params)
{
	FILE *f;
	char file_buf[BUF_SIZE];
	uint32_t i;
	int status = 0;

	f = fopen(filename, "r");
	if (f == NULL)
		return -1;

	params->n_keys = 0;
	while (fgets(file_buf, BUF_SIZE, f) != NULL)
		params->n_keys++;
	rewind(f);

	if (params->n_keys == 0) {
		status = -1;
		goto end;
	}

	params->keys = rte_malloc(NULL,
			params->n_keys * sizeof(struct pipeline_firewall_key),
			RTE_CACHE_LINE_SIZE);
	if (params->keys == NULL) {
		status = -1;
		goto end;
	}

	params->priorities = rte_malloc(NULL,
			params->n_keys * sizeof(uint32_t),
			RTE_CACHE_LINE_SIZE);
	if (params->priorities == NULL) {
		status = -1;
		goto end;
	}

	params->port_ids = rte_malloc(NULL,
			params->n_keys * sizeof(uint32_t),
			RTE_CACHE_LINE_SIZE);
	if (params->port_ids == NULL) {
		status = -1;
		goto end;
	}

	i = 0;
	while (fgets(file_buf, BUF_SIZE, f) != NULL) {
		char *str;

		str = strtok(file_buf, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->priorities[i] = atoi(str);

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_ip = atoi(str)<<24;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_ip |= atoi(str)<<16;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_ip |= atoi(str)<<8;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_ip |= atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_ip_mask = atoi(str);

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_ip = atoi(str)<<24;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_ip |= atoi(str)<<16;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_ip |= atoi(str)<<8;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_ip |= atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_ip_mask = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_port_from = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_port_to = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_port_from = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_port_to = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.proto = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		/* Need to add 2 to str to skip leading 0x */
		params->keys[i].key.ipv4_5tuple.proto_mask = strtol(str+2, NULL, 16);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->port_ids[i] = atoi(str);
		params->keys[i].type = PIPELINE_FIREWALL_IPV4_5TUPLE;

		i++;
	}

end:
	fclose(f);
	return status;
}

static int
app_pipeline_del_bulk_parse_file(char *filename,
		struct app_pipeline_del_bulk_params *params)
{
	FILE *f;
	char file_buf[BUF_SIZE];
	uint32_t i;
	int status = 0;

	f = fopen(filename, "r");
	if (f == NULL)
		return -1;

	params->n_keys = 0;
	while (fgets(file_buf, BUF_SIZE, f) != NULL)
		params->n_keys++;
	rewind(f);

	if (params->n_keys == 0) {
		status = -1;
		goto end;
	}

	params->keys = rte_malloc(NULL,
			params->n_keys * sizeof(struct pipeline_firewall_key),
			RTE_CACHE_LINE_SIZE);
	if (params->keys == NULL) {
		status = -1;
		goto end;
	}

	i = 0;
	while (fgets(file_buf, BUF_SIZE, f) != NULL) {
		char *str;

		str = strtok(file_buf, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_ip = atoi(str)<<24;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_ip |= atoi(str)<<16;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_ip |= atoi(str)<<8;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_ip |= atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_ip_mask = atoi(str);

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_ip = atoi(str)<<24;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_ip |= atoi(str)<<16;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_ip |= atoi(str)<<8;

		str = strtok(NULL, " .");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_ip |= atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_ip_mask = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_port_from = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.src_port_to = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_port_from = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.dst_port_to = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		params->keys[i].key.ipv4_5tuple.proto = atoi(str);

		str = strtok(NULL, " ");
		if (str == NULL) {
			status = -1;
			goto end;
		}
		/* Need to add 2 to str to skip leading 0x */
		params->keys[i].key.ipv4_5tuple.proto_mask = strtol(str+2, NULL, 16);

		params->keys[i].type = PIPELINE_FIREWALL_IPV4_5TUPLE;

		i++;
	}

	for (i = 0; i < params->n_keys; i++) {
		if (app_pipeline_firewall_key_check_and_normalize(&params->keys[i]) != 0) {
			status = -1;
			goto end;
		}
	}

end:
	fclose(f);
	return status;
}

int
app_pipeline_firewall_add_rule(struct app_params *app,
	uint32_t pipeline_id,
	struct pipeline_firewall_key *key,
	uint32_t priority,
	uint32_t port_id)
{
	struct app_pipeline_firewall *p;
	struct app_pipeline_firewall_rule *rule;
	struct pipeline_firewall_add_msg_req *req;
	struct pipeline_firewall_add_msg_rsp *rsp;
	int new_rule;

	/* Check input arguments */
	if ((app == NULL) ||
		(key == NULL) ||
		(key->type != PIPELINE_FIREWALL_IPV4_5TUPLE))
		return -1;

	p = app_pipeline_data_fe(app, pipeline_id, &pipeline_firewall);
	if (p == NULL)
		return -1;

	if (port_id >= p->n_ports_out)
		return -1;

	if (app_pipeline_firewall_key_check_and_normalize(key) != 0)
		return -1;

	/* Find existing rule or allocate new rule */
	rule = app_pipeline_firewall_rule_find(p, key);
	new_rule = (rule == NULL);
	if (rule == NULL) {
		rule = rte_malloc(NULL, sizeof(*rule), RTE_CACHE_LINE_SIZE);

		if (rule == NULL)
			return -1;
	}

	/* Allocate and write request */
	req = app_msg_alloc(app);
	if (req == NULL) {
		if (new_rule)
			rte_free(rule);
		return -1;
	}

	req->type = PIPELINE_MSG_REQ_CUSTOM;
	req->subtype = PIPELINE_FIREWALL_MSG_REQ_ADD;
	memcpy(&req->key, key, sizeof(*key));
	req->priority = priority;
	req->port_id = port_id;

	/* Send request and wait for response */
	rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
	if (rsp == NULL) {
		if (new_rule)
			rte_free(rule);
		return -1;
	}

	/* Read response and write rule */
	if (rsp->status ||
		(rsp->entry_ptr == NULL) ||
		((new_rule == 0) && (rsp->key_found == 0)) ||
		((new_rule == 1) && (rsp->key_found == 1))) {
		app_msg_free(app, rsp);
		if (new_rule)
			rte_free(rule);
		return -1;
	}

	memcpy(&rule->key, key, sizeof(*key));
	rule->priority = priority;
	rule->port_id = port_id;
	rule->entry_ptr = rsp->entry_ptr;

	/* Commit rule */
	if (new_rule) {
		TAILQ_INSERT_TAIL(&p->rules, rule, node);
		p->n_rules++;
	}

	print_firewall_ipv4_rule(rule);

	/* Free response */
	app_msg_free(app, rsp);

	return 0;
}

int
app_pipeline_firewall_delete_rule(struct app_params *app,
	uint32_t pipeline_id,
	struct pipeline_firewall_key *key)
{
	struct app_pipeline_firewall *p;
	struct app_pipeline_firewall_rule *rule;
	struct pipeline_firewall_del_msg_req *req;
	struct pipeline_firewall_del_msg_rsp *rsp;

	/* Check input arguments */
	if ((app == NULL) ||
		(key == NULL) ||
		(key->type != PIPELINE_FIREWALL_IPV4_5TUPLE))
		return -1;

	p = app_pipeline_data_fe(app, pipeline_id, &pipeline_firewall);
	if (p == NULL)
		return -1;

	if (app_pipeline_firewall_key_check_and_normalize(key) != 0)
		return -1;

	/* Find rule */
	rule = app_pipeline_firewall_rule_find(p, key);
	if (rule == NULL)
		return 0;

	/* Allocate and write request */
	req = app_msg_alloc(app);
	if (req == NULL)
		return -1;

	req->type = PIPELINE_MSG_REQ_CUSTOM;
	req->subtype = PIPELINE_FIREWALL_MSG_REQ_DEL;
	memcpy(&req->key, key, sizeof(*key));

	/* Send request and wait for response */
	rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
	if (rsp == NULL)
		return -1;

	/* Read response */
	if (rsp->status || !rsp->key_found) {
		app_msg_free(app, rsp);
		return -1;
	}

	/* Remove rule */
	TAILQ_REMOVE(&p->rules, rule, node);
	p->n_rules--;
	rte_free(rule);

	/* Free response */
	app_msg_free(app, rsp);

	return 0;
}

int
app_pipeline_firewall_add_bulk(struct app_params *app,
		uint32_t pipeline_id,
		struct pipeline_firewall_key *keys,
		uint32_t n_keys,
		uint32_t *priorities,
		uint32_t *port_ids)
{
	struct app_pipeline_firewall *p;
	struct pipeline_firewall_add_bulk_msg_req *req;
	struct pipeline_firewall_add_bulk_msg_rsp *rsp;

	struct app_pipeline_firewall_rule **rules;
	int *new_rules;

	int *keys_found;
	void **entries_ptr;

	uint32_t i;
	int status = 0;

	/* Check input arguments */
	if (app == NULL)
		return -1;

	p = app_pipeline_data_fe(app, pipeline_id, &pipeline_firewall);
	if (p == NULL)
		return -1;

	rules = rte_malloc(NULL,
			n_keys * sizeof(struct app_pipeline_firewall_rule *),
			RTE_CACHE_LINE_SIZE);
	if (rules == NULL)
		return -1;

	new_rules = rte_malloc(NULL,
			n_keys * sizeof(int),
			RTE_CACHE_LINE_SIZE);
	if (new_rules == NULL) {
		rte_free(rules);
		return -1;
	}

	/* check data integrity and add to rule list */
	for (i = 0; i < n_keys; i++) {
		if (port_ids[i]  >= p->n_ports_out) {
			rte_free(rules);
			rte_free(new_rules);
			return -1;
		}

		if (app_pipeline_firewall_key_check_and_normalize(&keys[i]) != 0) {
			rte_free(rules);
			rte_free(new_rules);
			return -1;
		}

		rules[i] = app_pipeline_firewall_rule_find(p, &keys[i]);
		new_rules[i] = (rules[i] == NULL);
		if (rules[i] == NULL) {
			rules[i] = rte_malloc(NULL, sizeof(rules[i]),
					RTE_CACHE_LINE_SIZE);

			if (rules[i] == NULL) {
				uint32_t j;

				for (j = 0; j <= i; j++)
					if (new_rules[j])
						rte_free(rules[j]);

				rte_free(rules);
				rte_free(new_rules);
				return -1;
			}
		}
	}

	keys_found = rte_malloc(NULL,
			n_keys * sizeof(int),
			RTE_CACHE_LINE_SIZE);
	if (keys_found == NULL) {
		uint32_t j;

		for (j = 0; j < n_keys; j++)
			if (new_rules[j])
				rte_free(rules[j]);

		rte_free(rules);
		rte_free(new_rules);
		return -1;
	}

	entries_ptr = rte_malloc(NULL,
			n_keys * sizeof(struct rte_pipeline_table_entry *),
			RTE_CACHE_LINE_SIZE);
	if (entries_ptr == NULL) {
		uint32_t j;

		for (j = 0; j < n_keys; j++)
			if (new_rules[j])
				rte_free(rules[j]);

		rte_free(rules);
		rte_free(new_rules);
		rte_free(keys_found);
		return -1;
	}
	for (i = 0; i < n_keys; i++) {
		entries_ptr[i] = rte_malloc(NULL,
				sizeof(struct rte_pipeline_table_entry),
				RTE_CACHE_LINE_SIZE);

		if (entries_ptr[i] == NULL) {
			uint32_t j;

			for (j = 0; j < n_keys; j++)
				if (new_rules[j])
					rte_free(rules[j]);

			for (j = 0; j <= i; j++)
				rte_free(entries_ptr[j]);

			rte_free(rules);
			rte_free(new_rules);
			rte_free(keys_found);
			rte_free(entries_ptr);
			return -1;
		}
	}

	/* Allocate and write request */
	req = app_msg_alloc(app);
	if (req == NULL) {
		uint32_t j;

		for (j = 0; j < n_keys; j++)
			if (new_rules[j])
				rte_free(rules[j]);

		for (j = 0; j < n_keys; j++)
			rte_free(entries_ptr[j]);

		rte_free(rules);
		rte_free(new_rules);
		rte_free(keys_found);
		rte_free(entries_ptr);
		return -1;
	}

	req->type = PIPELINE_MSG_REQ_CUSTOM;
	req->subtype = PIPELINE_FIREWALL_MSG_REQ_ADD_BULK;

	req->keys = keys;
	req->n_keys = n_keys;
	req->port_ids = port_ids;
	req->priorities = priorities;
	req->keys_found = keys_found;
	req->entries_ptr = entries_ptr;

	/* Send request and wait for response */
	rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
	if (rsp == NULL) {
		uint32_t j;

		for (j = 0; j < n_keys; j++)
			if (new_rules[j])
				rte_free(rules[j]);

		for (j = 0; j < n_keys; j++)
			rte_free(entries_ptr[j]);

		rte_free(rules);
		rte_free(new_rules);
		rte_free(keys_found);
		rte_free(entries_ptr);
		return -1;
	}

	if (rsp->status) {
		for (i = 0; i < n_keys; i++)
			if (new_rules[i])
				rte_free(rules[i]);

		for (i = 0; i < n_keys; i++)
			rte_free(entries_ptr[i]);

		status = -1;
		goto cleanup;
	}

	for (i = 0; i < n_keys; i++) {
		if (entries_ptr[i] == NULL ||
			((new_rules[i] == 0) && (keys_found[i] == 0)) ||
			((new_rules[i] == 1) && (keys_found[i] == 1))) {
			for (i = 0; i < n_keys; i++)
				if (new_rules[i])
					rte_free(rules[i]);

			for (i = 0; i < n_keys; i++)
				rte_free(entries_ptr[i]);

			status = -1;
			goto cleanup;
		}
	}

	for (i = 0; i < n_keys; i++) {
		memcpy(&rules[i]->key, &keys[i], sizeof(keys[i]));
		rules[i]->priority = priorities[i];
		rules[i]->port_id = port_ids[i];
		rules[i]->entry_ptr = entries_ptr[i];

		/* Commit rule */
		if (new_rules[i]) {
			TAILQ_INSERT_TAIL(&p->rules, rules[i], node);
			p->n_rules++;
		}

		print_firewall_ipv4_rule(rules[i]);
	}

cleanup:
	app_msg_free(app, rsp);
	rte_free(rules);
	rte_free(new_rules);
	rte_free(keys_found);
	rte_free(entries_ptr);

	return status;
}

int
app_pipeline_firewall_delete_bulk(struct app_params *app,
	uint32_t pipeline_id,
	struct pipeline_firewall_key *keys,
	uint32_t n_keys)
{
	struct app_pipeline_firewall *p;
	struct pipeline_firewall_del_bulk_msg_req *req;
	struct pipeline_firewall_del_bulk_msg_rsp *rsp;

	struct app_pipeline_firewall_rule **rules;
	int *keys_found;

	uint32_t i;
	int status = 0;

	/* Check input arguments */
	if (app == NULL)
		return -1;

	p = app_pipeline_data_fe(app, pipeline_id, &pipeline_firewall);
	if (p == NULL)
		return -1;

	rules = rte_malloc(NULL,
			n_keys * sizeof(struct app_pipeline_firewall_rule *),
			RTE_CACHE_LINE_SIZE);
	if (rules == NULL)
		return -1;

	for (i = 0; i < n_keys; i++) {
		if (app_pipeline_firewall_key_check_and_normalize(&keys[i]) != 0) {
			return -1;
		}

		rules[i] = app_pipeline_firewall_rule_find(p, &keys[i]);
	}

	keys_found = rte_malloc(NULL,
			n_keys * sizeof(int),
			RTE_CACHE_LINE_SIZE);
	if (keys_found == NULL) {
		rte_free(rules);
		return -1;
	}

	/* Allocate and write request */
	req = app_msg_alloc(app);
	if (req == NULL) {
		rte_free(rules);
		rte_free(keys_found);
		return -1;
	}

	req->type = PIPELINE_MSG_REQ_CUSTOM;
	req->subtype = PIPELINE_FIREWALL_MSG_REQ_DEL_BULK;

	req->keys = keys;
	req->n_keys = n_keys;
	req->keys_found = keys_found;

	/* Send request and wait for response */
	rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
	if (rsp == NULL) {
		rte_free(rules);
		rte_free(keys_found);
		return -1;
	}

	if (rsp->status) {
		status = -1;
		goto cleanup;
	}

	for (i = 0; i < n_keys; i++) {
		if (keys_found[i] == 0) {
			status = -1;
			goto cleanup;
		}
	}

	for (i = 0; i < n_keys; i++) {
		TAILQ_REMOVE(&p->rules, rules[i], node);
		p->n_rules--;
		rte_free(rules[i]);
	}

cleanup:
	app_msg_free(app, rsp);
	rte_free(rules);
	rte_free(keys_found);

	return status;
}

int
app_pipeline_firewall_add_default_rule(struct app_params *app,
	uint32_t pipeline_id,
	uint32_t port_id)
{
	struct app_pipeline_firewall *p;
	struct pipeline_firewall_add_default_msg_req *req;
	struct pipeline_firewall_add_default_msg_rsp *rsp;

	/* Check input arguments */
	if (app == NULL)
		return -1;

	p = app_pipeline_data_fe(app, pipeline_id, &pipeline_firewall);
	if (p == NULL)
		return -1;

	if (port_id >= p->n_ports_out)
		return -1;

	/* Allocate and write request */
	req = app_msg_alloc(app);
	if (req == NULL)
		return -1;

	req->type = PIPELINE_MSG_REQ_CUSTOM;
	req->subtype = PIPELINE_FIREWALL_MSG_REQ_ADD_DEFAULT;
	req->port_id = port_id;

	/* Send request and wait for response */
	rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
	if (rsp == NULL)
		return -1;

	/* Read response and write rule */
	if (rsp->status || (rsp->entry_ptr == NULL)) {
		app_msg_free(app, rsp);
		return -1;
	}

	p->default_rule_port_id = port_id;
	p->default_rule_entry_ptr = rsp->entry_ptr;

	/* Commit rule */
	p->default_rule_present = 1;

	/* Free response */
	app_msg_free(app, rsp);

	return 0;
}

int
app_pipeline_firewall_delete_default_rule(struct app_params *app,
	uint32_t pipeline_id)
{
	struct app_pipeline_firewall *p;
	struct pipeline_firewall_del_default_msg_req *req;
	struct pipeline_firewall_del_default_msg_rsp *rsp;

	/* Check input arguments */
	if (app == NULL)
		return -1;

	p = app_pipeline_data_fe(app, pipeline_id, &pipeline_firewall);
	if (p == NULL)
		return -1;

	/* Allocate and write request */
	req = app_msg_alloc(app);
	if (req == NULL)
		return -1;

	req->type = PIPELINE_MSG_REQ_CUSTOM;
	req->subtype = PIPELINE_FIREWALL_MSG_REQ_DEL_DEFAULT;

	/* Send request and wait for response */
	rsp = app_msg_send_recv(app, pipeline_id, req, MSG_TIMEOUT_DEFAULT);
	if (rsp == NULL)
		return -1;

	/* Read response and write rule */
	if (rsp->status) {
		app_msg_free(app, rsp);
		return -1;
	}

	/* Commit rule */
	p->default_rule_present = 0;

	/* Free response */
	app_msg_free(app, rsp);

	return 0;
}

/*
 * p firewall add ipv4
 */

struct cmd_firewall_add_ipv4_result {
	cmdline_fixed_string_t p_string;
	uint32_t pipeline_id;
	cmdline_fixed_string_t firewall_string;
	cmdline_fixed_string_t add_string;
	cmdline_fixed_string_t ipv4_string;
	int32_t priority;
	cmdline_ipaddr_t src_ip;
	uint32_t src_ip_mask;
	cmdline_ipaddr_t dst_ip;
	uint32_t dst_ip_mask;
	uint16_t src_port_from;
	uint16_t src_port_to;
	uint16_t dst_port_from;
	uint16_t dst_port_to;
	uint8_t proto;
	uint8_t proto_mask;
	uint8_t port_id;
};

static void
cmd_firewall_add_ipv4_parsed(
	void *parsed_result,
	__attribute__((unused)) struct cmdline *cl,
	void *data)
{
	struct cmd_firewall_add_ipv4_result *params = parsed_result;
	struct app_params *app = data;
	struct pipeline_firewall_key key;
	int status;

	key.type = PIPELINE_FIREWALL_IPV4_5TUPLE;
	key.key.ipv4_5tuple.src_ip = rte_bswap32(
		(uint32_t) params->src_ip.addr.ipv4.s_addr);
	key.key.ipv4_5tuple.src_ip_mask = params->src_ip_mask;
	key.key.ipv4_5tuple.dst_ip = rte_bswap32(
		(uint32_t) params->dst_ip.addr.ipv4.s_addr);
	key.key.ipv4_5tuple.dst_ip_mask = params->dst_ip_mask;
	key.key.ipv4_5tuple.src_port_from = params->src_port_from;
	key.key.ipv4_5tuple.src_port_to = params->src_port_to;
	key.key.ipv4_5tuple.dst_port_from = params->dst_port_from;
	key.key.ipv4_5tuple.dst_port_to = params->dst_port_to;
	key.key.ipv4_5tuple.proto = params->proto;
	key.key.ipv4_5tuple.proto_mask = params->proto_mask;

	status = app_pipeline_firewall_add_rule(app,
		params->pipeline_id,
		&key,
		params->priority,
		params->port_id);

	if (status != 0) {
		printf("Command failed\n");
		return;
	}
}

cmdline_parse_token_string_t cmd_firewall_add_ipv4_p_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_ipv4_result, p_string,
		"p");

cmdline_parse_token_num_t cmd_firewall_add_ipv4_pipeline_id =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result, pipeline_id,
		UINT32);

cmdline_parse_token_string_t cmd_firewall_add_ipv4_firewall_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_ipv4_result,
		firewall_string, "firewall");

cmdline_parse_token_string_t cmd_firewall_add_ipv4_add_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_ipv4_result,
		add_string, "add");

cmdline_parse_token_string_t cmd_firewall_add_ipv4_ipv4_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_ipv4_result,
		ipv4_string, "ipv4");

cmdline_parse_token_num_t cmd_firewall_add_ipv4_priority =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result, priority,
		INT32);

cmdline_parse_token_ipaddr_t cmd_firewall_add_ipv4_src_ip =
	TOKEN_IPV4_INITIALIZER(struct cmd_firewall_add_ipv4_result, src_ip);

cmdline_parse_token_num_t cmd_firewall_add_ipv4_src_ip_mask =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result, src_ip_mask,
		UINT32);

cmdline_parse_token_ipaddr_t cmd_firewall_add_ipv4_dst_ip =
	TOKEN_IPV4_INITIALIZER(struct cmd_firewall_add_ipv4_result, dst_ip);

cmdline_parse_token_num_t cmd_firewall_add_ipv4_dst_ip_mask =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result, dst_ip_mask,
		UINT32);

cmdline_parse_token_num_t cmd_firewall_add_ipv4_src_port_from =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result,
		src_port_from, UINT16);

cmdline_parse_token_num_t cmd_firewall_add_ipv4_src_port_to =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result,
		src_port_to, UINT16);

cmdline_parse_token_num_t cmd_firewall_add_ipv4_dst_port_from =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result,
		dst_port_from, UINT16);

cmdline_parse_token_num_t cmd_firewall_add_ipv4_dst_port_to =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result,
		dst_port_to, UINT16);

cmdline_parse_token_num_t cmd_firewall_add_ipv4_proto =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result,
		proto, UINT8);

cmdline_parse_token_num_t cmd_firewall_add_ipv4_proto_mask =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result,
		proto_mask, UINT8);

cmdline_parse_token_num_t cmd_firewall_add_ipv4_port_id =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_ipv4_result,
		port_id, UINT8);

cmdline_parse_inst_t cmd_firewall_add_ipv4 = {
	.f = cmd_firewall_add_ipv4_parsed,
	.data = NULL,
	.help_str = "Firewall rule add",
	.tokens = {
		(void *) &cmd_firewall_add_ipv4_p_string,
		(void *) &cmd_firewall_add_ipv4_pipeline_id,
		(void *) &cmd_firewall_add_ipv4_firewall_string,
		(void *) &cmd_firewall_add_ipv4_add_string,
		(void *) &cmd_firewall_add_ipv4_ipv4_string,
		(void *) &cmd_firewall_add_ipv4_priority,
		(void *) &cmd_firewall_add_ipv4_src_ip,
		(void *) &cmd_firewall_add_ipv4_src_ip_mask,
		(void *) &cmd_firewall_add_ipv4_dst_ip,
		(void *) &cmd_firewall_add_ipv4_dst_ip_mask,
		(void *) &cmd_firewall_add_ipv4_src_port_from,
		(void *) &cmd_firewall_add_ipv4_src_port_to,
		(void *) &cmd_firewall_add_ipv4_dst_port_from,
		(void *) &cmd_firewall_add_ipv4_dst_port_to,
		(void *) &cmd_firewall_add_ipv4_proto,
		(void *) &cmd_firewall_add_ipv4_proto_mask,
		(void *) &cmd_firewall_add_ipv4_port_id,
		NULL,
	},
};

/*
 * p firewall del ipv4
 */

struct cmd_firewall_del_ipv4_result {
	cmdline_fixed_string_t p_string;
	uint32_t pipeline_id;
	cmdline_fixed_string_t firewall_string;
	cmdline_fixed_string_t del_string;
	cmdline_fixed_string_t ipv4_string;
	cmdline_ipaddr_t src_ip;
	uint32_t src_ip_mask;
	cmdline_ipaddr_t dst_ip;
	uint32_t dst_ip_mask;
	uint16_t src_port_from;
	uint16_t src_port_to;
	uint16_t dst_port_from;
	uint16_t dst_port_to;
	uint8_t proto;
	uint8_t proto_mask;
};

static void
cmd_firewall_del_ipv4_parsed(
	void *parsed_result,
	__attribute__((unused)) struct cmdline *cl,
	void *data)
{
	struct cmd_firewall_del_ipv4_result *params = parsed_result;
	struct app_params *app = data;
	struct pipeline_firewall_key key;
	int status;

	key.type = PIPELINE_FIREWALL_IPV4_5TUPLE;
	key.key.ipv4_5tuple.src_ip = rte_bswap32(
		(uint32_t) params->src_ip.addr.ipv4.s_addr);
	key.key.ipv4_5tuple.src_ip_mask = params->src_ip_mask;
	key.key.ipv4_5tuple.dst_ip = rte_bswap32(
		(uint32_t) params->dst_ip.addr.ipv4.s_addr);
	key.key.ipv4_5tuple.dst_ip_mask = params->dst_ip_mask;
	key.key.ipv4_5tuple.src_port_from = params->src_port_from;
	key.key.ipv4_5tuple.src_port_to = params->src_port_to;
	key.key.ipv4_5tuple.dst_port_from = params->dst_port_from;
	key.key.ipv4_5tuple.dst_port_to = params->dst_port_to;
	key.key.ipv4_5tuple.proto = params->proto;
	key.key.ipv4_5tuple.proto_mask = params->proto_mask;

	status = app_pipeline_firewall_delete_rule(app,
		params->pipeline_id,
		&key);

	if (status != 0) {
		printf("Command failed\n");
		return;
	}
}

cmdline_parse_token_string_t cmd_firewall_del_ipv4_p_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_ipv4_result, p_string,
		"p");

cmdline_parse_token_num_t cmd_firewall_del_ipv4_pipeline_id =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_ipv4_result, pipeline_id,
		UINT32);

cmdline_parse_token_string_t cmd_firewall_del_ipv4_firewall_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_ipv4_result,
		firewall_string, "firewall");

cmdline_parse_token_string_t cmd_firewall_del_ipv4_del_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_ipv4_result,
		del_string, "del");

cmdline_parse_token_string_t cmd_firewall_del_ipv4_ipv4_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_ipv4_result,
		ipv4_string, "ipv4");

cmdline_parse_token_ipaddr_t cmd_firewall_del_ipv4_src_ip =
	TOKEN_IPV4_INITIALIZER(struct cmd_firewall_del_ipv4_result, src_ip);

cmdline_parse_token_num_t cmd_firewall_del_ipv4_src_ip_mask =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_ipv4_result, src_ip_mask,
		UINT32);

cmdline_parse_token_ipaddr_t cmd_firewall_del_ipv4_dst_ip =
	TOKEN_IPV4_INITIALIZER(struct cmd_firewall_del_ipv4_result, dst_ip);

cmdline_parse_token_num_t cmd_firewall_del_ipv4_dst_ip_mask =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_ipv4_result, dst_ip_mask,
		UINT32);

cmdline_parse_token_num_t cmd_firewall_del_ipv4_src_port_from =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_ipv4_result,
		src_port_from, UINT16);

cmdline_parse_token_num_t cmd_firewall_del_ipv4_src_port_to =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_ipv4_result, src_port_to,
		UINT16);

cmdline_parse_token_num_t cmd_firewall_del_ipv4_dst_port_from =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_ipv4_result,
		dst_port_from, UINT16);

cmdline_parse_token_num_t cmd_firewall_del_ipv4_dst_port_to =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_ipv4_result,
		dst_port_to, UINT16);

cmdline_parse_token_num_t cmd_firewall_del_ipv4_proto =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_ipv4_result,
		proto, UINT8);

cmdline_parse_token_num_t cmd_firewall_del_ipv4_proto_mask =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_ipv4_result, proto_mask,
		UINT8);

cmdline_parse_inst_t cmd_firewall_del_ipv4 = {
	.f = cmd_firewall_del_ipv4_parsed,
	.data = NULL,
	.help_str = "Firewall rule delete",
	.tokens = {
		(void *) &cmd_firewall_del_ipv4_p_string,
		(void *) &cmd_firewall_del_ipv4_pipeline_id,
		(void *) &cmd_firewall_del_ipv4_firewall_string,
		(void *) &cmd_firewall_del_ipv4_del_string,
		(void *) &cmd_firewall_del_ipv4_ipv4_string,
		(void *) &cmd_firewall_del_ipv4_src_ip,
		(void *) &cmd_firewall_del_ipv4_src_ip_mask,
		(void *) &cmd_firewall_del_ipv4_dst_ip,
		(void *) &cmd_firewall_del_ipv4_dst_ip_mask,
		(void *) &cmd_firewall_del_ipv4_src_port_from,
		(void *) &cmd_firewall_del_ipv4_src_port_to,
		(void *) &cmd_firewall_del_ipv4_dst_port_from,
		(void *) &cmd_firewall_del_ipv4_dst_port_to,
		(void *) &cmd_firewall_del_ipv4_proto,
		(void *) &cmd_firewall_del_ipv4_proto_mask,
		NULL,
	},
};

/*
 * p firewall add bulk
 */

struct cmd_firewall_add_bulk_result {
	cmdline_fixed_string_t p_string;
	uint32_t pipeline_id;
	cmdline_fixed_string_t firewall_string;
	cmdline_fixed_string_t add_string;
	cmdline_fixed_string_t bulk_string;
	cmdline_fixed_string_t file_path;
};

static void
cmd_firewall_add_bulk_parsed(
	void *parsed_result,
	__attribute__((unused)) struct cmdline *cl,
	void *data)
{
	struct cmd_firewall_add_bulk_result *params = parsed_result;
	struct app_params *app = data;
	int status;

	struct app_pipeline_add_bulk_params add_bulk_params;

	status = app_pipeline_add_bulk_parse_file(params->file_path, &add_bulk_params);
	if (status != 0) {
		printf("Command failed\n");
		goto end;
	}

	status = app_pipeline_firewall_add_bulk(app, params->pipeline_id, add_bulk_params.keys,
			add_bulk_params.n_keys, add_bulk_params.priorities, add_bulk_params.port_ids);
	if (status != 0) {
		printf("Command failed\n");
		goto end;
	}

end:
	rte_free(add_bulk_params.keys);
	rte_free(add_bulk_params.priorities);
	rte_free(add_bulk_params.port_ids);
}

cmdline_parse_token_string_t cmd_firewall_add_bulk_p_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_bulk_result, p_string,
		"p");

cmdline_parse_token_num_t cmd_firewall_add_bulk_pipeline_id =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_bulk_result, pipeline_id,
		UINT32);

cmdline_parse_token_string_t cmd_firewall_add_bulk_firewall_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_bulk_result,
		firewall_string, "firewall");

cmdline_parse_token_string_t cmd_firewall_add_bulk_add_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_bulk_result,
		add_string, "add");

cmdline_parse_token_string_t cmd_firewall_add_bulk_bulk_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_bulk_result,
		bulk_string, "bulk");

cmdline_parse_token_string_t cmd_firewall_add_bulk_file_path_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_bulk_result,
		file_path, NULL);

cmdline_parse_inst_t cmd_firewall_add_bulk = {
	.f = cmd_firewall_add_bulk_parsed,
	.data = NULL,
	.help_str = "Firewall rule add bulk",
	.tokens = {
		(void *) &cmd_firewall_add_bulk_p_string,
		(void *) &cmd_firewall_add_bulk_pipeline_id,
		(void *) &cmd_firewall_add_bulk_firewall_string,
		(void *) &cmd_firewall_add_bulk_add_string,
		(void *) &cmd_firewall_add_bulk_bulk_string,
		(void *) &cmd_firewall_add_bulk_file_path_string,
		NULL,
	},
};

/*
 * p firewall del bulk
 */

struct cmd_firewall_del_bulk_result {
	cmdline_fixed_string_t p_string;
	uint32_t pipeline_id;
	cmdline_fixed_string_t firewall_string;
	cmdline_fixed_string_t del_string;
	cmdline_fixed_string_t bulk_string;
	cmdline_fixed_string_t file_path;
};

static void
cmd_firewall_del_bulk_parsed(
	void *parsed_result,
	__attribute__((unused)) struct cmdline *cl,
	void *data)
{
	struct cmd_firewall_del_bulk_result *params = parsed_result;
	struct app_params *app = data;
	int status;

	struct app_pipeline_del_bulk_params del_bulk_params;

	status = app_pipeline_del_bulk_parse_file(params->file_path, &del_bulk_params);
	if (status != 0) {
		printf("Command failed\n");
		goto end;
	}

	status = app_pipeline_firewall_delete_bulk(app, params->pipeline_id,
			del_bulk_params.keys, del_bulk_params.n_keys);
	if (status != 0) {
		printf("Command failed\n");
		goto end;
	}

end:
	rte_free(del_bulk_params.keys);
}

cmdline_parse_token_string_t cmd_firewall_del_bulk_p_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_bulk_result, p_string,
		"p");

cmdline_parse_token_num_t cmd_firewall_del_bulk_pipeline_id =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_bulk_result, pipeline_id,
		UINT32);

cmdline_parse_token_string_t cmd_firewall_del_bulk_firewall_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_bulk_result,
		firewall_string, "firewall");

cmdline_parse_token_string_t cmd_firewall_del_bulk_add_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_bulk_result,
		del_string, "del");

cmdline_parse_token_string_t cmd_firewall_del_bulk_bulk_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_bulk_result,
		bulk_string, "bulk");

cmdline_parse_token_string_t cmd_firewall_del_bulk_file_path_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_bulk_result,
		file_path, NULL);

cmdline_parse_inst_t cmd_firewall_del_bulk = {
	.f = cmd_firewall_del_bulk_parsed,
	.data = NULL,
	.help_str = "Firewall rule del bulk",
	.tokens = {
		(void *) &cmd_firewall_del_bulk_p_string,
		(void *) &cmd_firewall_del_bulk_pipeline_id,
		(void *) &cmd_firewall_del_bulk_firewall_string,
		(void *) &cmd_firewall_del_bulk_add_string,
		(void *) &cmd_firewall_del_bulk_bulk_string,
		(void *) &cmd_firewall_del_bulk_file_path_string,
		NULL,
	},
};

/*
 * p firewall add default
 */
struct cmd_firewall_add_default_result {
	cmdline_fixed_string_t p_string;
	uint32_t pipeline_id;
	cmdline_fixed_string_t firewall_string;
	cmdline_fixed_string_t add_string;
	cmdline_fixed_string_t default_string;
	uint8_t port_id;
};

static void
cmd_firewall_add_default_parsed(
	void *parsed_result,
	__attribute__((unused)) struct cmdline *cl,
	void *data)
{
	struct cmd_firewall_add_default_result *params = parsed_result;
	struct app_params *app = data;
	int status;

	status = app_pipeline_firewall_add_default_rule(app,
		params->pipeline_id,
		params->port_id);

	if (status != 0) {
		printf("Command failed\n");
		return;
	}
}

cmdline_parse_token_string_t cmd_firewall_add_default_p_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_default_result,
		p_string, "p");

cmdline_parse_token_num_t cmd_firewall_add_default_pipeline_id =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_default_result,
		pipeline_id, UINT32);

cmdline_parse_token_string_t cmd_firewall_add_default_firewall_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_default_result,
	firewall_string, "firewall");

cmdline_parse_token_string_t cmd_firewall_add_default_add_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_default_result,
	add_string, "add");

cmdline_parse_token_string_t cmd_firewall_add_default_default_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_add_default_result,
		default_string, "default");

cmdline_parse_token_num_t cmd_firewall_add_default_port_id =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_add_default_result, port_id,
		UINT8);

cmdline_parse_inst_t cmd_firewall_add_default = {
	.f = cmd_firewall_add_default_parsed,
	.data = NULL,
	.help_str = "Firewall default rule add",
	.tokens = {
		(void *) &cmd_firewall_add_default_p_string,
		(void *) &cmd_firewall_add_default_pipeline_id,
		(void *) &cmd_firewall_add_default_firewall_string,
		(void *) &cmd_firewall_add_default_add_string,
		(void *) &cmd_firewall_add_default_default_string,
		(void *) &cmd_firewall_add_default_port_id,
		NULL,
	},
};

/*
 * p firewall del default
 */
struct cmd_firewall_del_default_result {
	cmdline_fixed_string_t p_string;
	uint32_t pipeline_id;
	cmdline_fixed_string_t firewall_string;
	cmdline_fixed_string_t del_string;
	cmdline_fixed_string_t default_string;
};

static void
cmd_firewall_del_default_parsed(
	void *parsed_result,
	__attribute__((unused)) struct cmdline *cl,
	void *data)
{
	struct cmd_firewall_del_default_result *params = parsed_result;
	struct app_params *app = data;
	int status;

	status = app_pipeline_firewall_delete_default_rule(app,
		params->pipeline_id);

	if (status != 0) {
		printf("Command failed\n");
		return;
	}
}

cmdline_parse_token_string_t cmd_firewall_del_default_p_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_default_result,
		p_string, "p");

cmdline_parse_token_num_t cmd_firewall_del_default_pipeline_id =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_del_default_result,
		pipeline_id, UINT32);

cmdline_parse_token_string_t cmd_firewall_del_default_firewall_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_default_result,
	firewall_string, "firewall");

cmdline_parse_token_string_t cmd_firewall_del_default_del_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_default_result,
		del_string, "del");

cmdline_parse_token_string_t cmd_firewall_del_default_default_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_del_default_result,
		default_string, "default");

cmdline_parse_inst_t cmd_firewall_del_default = {
	.f = cmd_firewall_del_default_parsed,
	.data = NULL,
	.help_str = "Firewall default rule delete",
	.tokens = {
		(void *) &cmd_firewall_del_default_p_string,
		(void *) &cmd_firewall_del_default_pipeline_id,
		(void *) &cmd_firewall_del_default_firewall_string,
		(void *) &cmd_firewall_del_default_del_string,
		(void *) &cmd_firewall_del_default_default_string,
		NULL,
	},
};

/*
 * p firewall ls
 */

struct cmd_firewall_ls_result {
	cmdline_fixed_string_t p_string;
	uint32_t pipeline_id;
	cmdline_fixed_string_t firewall_string;
	cmdline_fixed_string_t ls_string;
};

static void
cmd_firewall_ls_parsed(
	void *parsed_result,
	__attribute__((unused)) struct cmdline *cl,
	void *data)
{
	struct cmd_firewall_ls_result *params = parsed_result;
	struct app_params *app = data;
	int status;

	status = app_pipeline_firewall_ls(app, params->pipeline_id);

	if (status != 0) {
		printf("Command failed\n");
		return;
	}
}

cmdline_parse_token_string_t cmd_firewall_ls_p_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_ls_result, p_string,
		"p");

cmdline_parse_token_num_t cmd_firewall_ls_pipeline_id =
	TOKEN_NUM_INITIALIZER(struct cmd_firewall_ls_result, pipeline_id,
		UINT32);

cmdline_parse_token_string_t cmd_firewall_ls_firewall_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_ls_result,
	firewall_string, "firewall");

cmdline_parse_token_string_t cmd_firewall_ls_ls_string =
	TOKEN_STRING_INITIALIZER(struct cmd_firewall_ls_result, ls_string,
	"ls");

cmdline_parse_inst_t cmd_firewall_ls = {
	.f = cmd_firewall_ls_parsed,
	.data = NULL,
	.help_str = "Firewall rule list",
	.tokens = {
		(void *) &cmd_firewall_ls_p_string,
		(void *) &cmd_firewall_ls_pipeline_id,
		(void *) &cmd_firewall_ls_firewall_string,
		(void *) &cmd_firewall_ls_ls_string,
		NULL,
	},
};

static cmdline_parse_ctx_t pipeline_cmds[] = {
	(cmdline_parse_inst_t *) &cmd_firewall_add_ipv4,
	(cmdline_parse_inst_t *) &cmd_firewall_del_ipv4,
	(cmdline_parse_inst_t *) &cmd_firewall_add_bulk,
	(cmdline_parse_inst_t *) &cmd_firewall_del_bulk,
	(cmdline_parse_inst_t *) &cmd_firewall_add_default,
	(cmdline_parse_inst_t *) &cmd_firewall_del_default,
	(cmdline_parse_inst_t *) &cmd_firewall_ls,
	NULL,
};

static struct pipeline_fe_ops pipeline_firewall_fe_ops = {
	.f_init = app_pipeline_firewall_init,
	.f_free = app_pipeline_firewall_free,
	.cmds = pipeline_cmds,
};

struct pipeline_type pipeline_firewall = {
	.name = "FIREWALL",
	.be_ops = &pipeline_firewall_be_ops,
	.fe_ops = &pipeline_firewall_fe_ops,
};


text:
package org.assertj.android.api.util;

import android.util.AbstractAnInterface;

public abstract class AbstractAbstractAnInterfaceAssert<
  S extends AbstractAbstractAnInterfaceAssert<S,A>,
  A extends AbstractAnInterface> extends AbstractAnInterfaceAssert<S,A> {

  protected AbstractAbstractAnInterfaceAssert(A actual, Class<S> selfType) {
    super(actual, selfType);
  }

  public S hasInt(int expected) {
    return myself;
  }
}


text:
// `assert` initialized at top of scope
// Assert helpers
// All of these must either call QUnit.push() or manually do:
// - runLoggingCallbacks( "log", .. );
// - config.current.assertions.push({ .. });
assert = QUnit.assert = {
	/**
	 * Asserts rough true-ish result.
	 * @name ok
	 * @function
	 * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
	 */
	ok: function( result, msg ) {
		if ( !config.current ) {
			throw new Error( "ok() assertion outside test context, was " + sourceFromStacktrace(2) );
		}
		result = !!result;
		msg = msg || ( result ? "okay" : "failed" );

		var source,
			details = {
				module: config.current.module,
				name: config.current.testName,
				result: result,
				message: msg
			};

		msg = "" + escapeText( msg ) + "";

		if ( !result ) {
			source = sourceFromStacktrace( 2 );
			if ( source ) {
				details.source = source;
				msg += "

Source:
" +
					escapeText( source ) +
					"

";
			}
		}
		runLoggingCallbacks( "log", QUnit, details );
		config.current.assertions.push({
			result: result,
			message: msg
		});
	},

	/**
	 * Assert that the first two arguments are equal, with an optional message.
	 * Prints out both actual and expected values.
	 * @name equal
	 * @function
	 * @example equal( format( "Received {0} bytes.", 2), "Received 2 bytes.", "format() replaces {0} with next argument" );
	 */
	equal: function( actual, expected, message ) {
		/*jshint eqeqeq:false */
		QUnit.push( expected == actual, actual, expected, message );
	},

	/**
	 * @name notEqual
	 * @function
	 */
	notEqual: function( actual, expected, message ) {
		/*jshint eqeqeq:false */
		QUnit.push( expected != actual, actual, expected, message );
	},

	/**
	 * @name propEqual
	 * @function
	 */
	propEqual: function( actual, expected, message ) {
		actual = objectValues(actual);
		expected = objectValues(expected);
		QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
	},

	/**
	 * @name notPropEqual
	 * @function
	 */
	notPropEqual: function( actual, expected, message ) {
		actual = objectValues(actual);
		expected = objectValues(expected);
		QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
	},

	/**
	 * @name deepEqual
	 * @function
	 */
	deepEqual: function( actual, expected, message ) {
		QUnit.push( QUnit.equiv(actual, expected), actual, expected, message );
	},

	/**
	 * @name notDeepEqual
	 * @function
	 */
	notDeepEqual: function( actual, expected, message ) {
		QUnit.push( !QUnit.equiv(actual, expected), actual, expected, message );
	},

	/**
	 * @name strictEqual
	 * @function
	 */
	strictEqual: function( actual, expected, message ) {
		QUnit.push( expected === actual, actual, expected, message );
	},

	/**
	 * @name notStrictEqual
	 * @function
	 */
	notStrictEqual: function( actual, expected, message ) {
		QUnit.push( expected !== actual, actual, expected, message );
	},

	"throws": function( block, expected, message ) {
		var actual,
			expectedOutput = expected,
			ok = false;

		// 'expected' is optional
		if ( typeof expected === "string" ) {
			message = expected;
			expected = null;
		}

		config.current.ignoreGlobalErrors = true;
		try {
			block.call( config.current.testEnvironment );
		} catch (e) {
			actual = e;
		}
		config.current.ignoreGlobalErrors = false;

		if ( actual ) {
			// we don't want to validate thrown error
			if ( !expected ) {
				ok = true;
				expectedOutput = null;
			// expected is a regexp
			} else if ( QUnit.objectType( expected ) === "regexp" ) {
				ok = expected.test( errorString( actual ) );
			// expected is a constructor
			} else if ( actual instanceof expected ) {
				ok = true;
			// expected is a validation function which returns true is validation passed
			} else if ( expected.call( {}, actual ) === true ) {
				expectedOutput = null;
				ok = true;
			}

			QUnit.push( ok, actual, expectedOutput, message );
		} else {
			QUnit.pushFailure( message, null, "No exception was thrown." );
		}
	}
};

/**
 * @deprecated since 1.8.0
 * Kept assertion helpers in root for backwards compatibility.
 */
extend( QUnit.constructor.prototype, assert );

/**
 * @deprecated since 1.9.0
 * Kept to avoid TypeErrors for undefined methods.
 */
QUnit.constructor.prototype.raises = function() {
	QUnit.push( false, false, false, "QUnit.raises has been deprecated since 2012 (fad3c1ea), use QUnit.throws instead" );
};

/**
 * @deprecated since 1.0.0, replaced with error pushes since 1.3.0
 * Kept to avoid TypeErrors for undefined methods.
 */
QUnit.constructor.prototype.equals = function() {
	QUnit.push( false, false, false, "QUnit.equals has been deprecated since 2009 (e88049a0), use QUnit.equal instead" );
};
QUnit.constructor.prototype.same = function() {
	QUnit.push( false, false, false, "QUnit.same has been deprecated since 2009 (e88049a0), use QUnit.deepEqual instead" );
};


text:
char *crn_cgroup_mountpoint(const char *subsystem);
crn_list_t *crn_all_subsystems();
int crn_write_cgroup(const char *path, const char *name, const char *value);

#endif


text:
// Copyright 2014 Samsung Electronics. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "utc_blink_ewk_base.h"

class utc_blink_ewk_context_certificate_file_get: public utc_blink_ewk_base
{
};

/**
 * @brief Getting certificate file and comparing with the one which was just set.
 */
TEST_F(utc_blink_ewk_context_certificate_file_get, POS_TEST)
{
  std::string const certificate_file = GetResourcePath("ewk_context/google-cert.pem");
  ewk_context_certificate_file_set(
      ewk_context_default_get(),
      certificate_file.c_str());

  EXPECT_STREQ(certificate_file.c_str(), ewk_context_certificate_file_get(ewk_context_default_get()));
}


text:
package org.jabref.logic.bibtex;

import org.jabref.logic.util.OS;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.InternalField;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.strings.StringUtil;

/**
 * Currently the only implementation of org.jabref.exporter.FieldFormatter
 *

 * Obeys following settings:
 * * JabRefPreferences.RESOLVE_STRINGS_ALL_FIELDS
 * * JabRefPreferences.DO_NOT_RESOLVE_STRINGS_FOR
 * * JabRefPreferences.WRITEFIELD_WRAPFIELD
 */
public class LatexFieldFormatter {

    private static final char FIELD_START = '{';
    private static final char FIELD_END = '}';
    private final boolean neverFailOnHashes;
    private final LatexFieldFormatterPreferences prefs;
    private final FieldContentParser parser;
    private StringBuilder stringBuilder;

    public LatexFieldFormatter(LatexFieldFormatterPreferences prefs) {
        this(true, prefs);
    }

    private LatexFieldFormatter(boolean neverFailOnHashes, LatexFieldFormatterPreferences prefs) {
        this.neverFailOnHashes = neverFailOnHashes;
        this.prefs = prefs;

        parser = new FieldContentParser(prefs.getFieldContentParserPreferences());
    }

    public static LatexFieldFormatter buildIgnoreHashes(LatexFieldFormatterPreferences prefs) {
        return new LatexFieldFormatter(true, prefs);
    }

    private static void checkBraces(String text) throws InvalidFieldValueException {
        int left = 0;
        int right = 0;

        // First we collect all occurrences:
        for (int i = 0; i < text.length(); i++) {
            char item = text.charAt(i);

            boolean charBeforeIsEscape = false;
            if ((i > 0) && (text.charAt(i - 1) == '\\')) {
                charBeforeIsEscape = true;
            }

            if (!charBeforeIsEscape && (item == '{')) {
                left++;
            } else if (!charBeforeIsEscape && (item == '}')) {
                right++;
            }
        }

        // Then we throw an exception if the error criteria are met.
        if (!(right == 0) && (left == 0)) {
            throw new InvalidFieldValueException("Unescaped '}' character without opening bracket ends string prematurely. Field value: " + text);
        }
        if (!(right == 0) && (right < left)) {
            throw new InvalidFieldValueException("Unescaped '}' character without opening bracket ends string prematurely. Field value: " + text);
        }
        if (left != right) {
            throw new InvalidFieldValueException("Braces don't match. Field value: " + text);
        }
    }

    /**
     * Formats the content of a field.
     *
     * @param content   the content of the field
     * @param field the name of the field - used to trigger different serializations, e.g., turning off resolution for some strings
     * @return a formatted string suitable for output
     * @throws InvalidFieldValueException if s is not a correct bibtex string, e.g., because of improperly balanced braces or using # not paired
     */
    public String format(String content, Field field) throws InvalidFieldValueException {
        if (content == null) {
            return FIELD_START + String.valueOf(FIELD_END);
        }

        String result = content;

        // normalize newlines
        boolean shouldNormalizeNewlines = !result.contains(OS.NEWLINE) && result.contains("\n");
        if (shouldNormalizeNewlines) {
            // if we don't have real new lines, but pseudo newlines, we replace them
            // On Win 8.1, this is always true for multiline fields
            result = result.replace("\n", OS.NEWLINE);
        }

        // If the field is non-standard, we will just append braces, wrap and write.
        if (!shouldResolveStrings(field)) {
            return formatWithoutResolvingStrings(result, field);
        }

        // Trim whitespace
        result = result.trim();
        return formatAndResolveStrings(result, field);
    }

    /**
     * This method handles # in the field content to get valid bibtex strings
     *
     * For instance, #jan# - #feb# gets  jan #{ - } # feb (see @link{org.jabref.logic.bibtex.LatexFieldFormatterTests#makeHashEnclosedWordsRealStringsInMonthField()})
     */
    private String formatAndResolveStrings(String content, Field field) throws InvalidFieldValueException {
        stringBuilder = new StringBuilder();
        checkBraces(content);

        // Here we assume that the user encloses any bibtex strings in #, e.g.:
        // #jan# - #feb#
        // ...which will be written to the file like this:
        // jan # { - } # feb
        int pivot = 0;
        while (pivot < content.length()) {
            int goFrom = pivot;
            int pos1 = pivot;
            while (goFrom == pos1) {
                pos1 = content.indexOf('#', goFrom);
                if ((pos1 > 0) && (content.charAt(pos1 - 1) == '\\')) {
                    goFrom = pos1 + 1;
                    pos1++;
                } else {
                    goFrom = pos1 - 1; // Ends the loop.
                }
            }

            int pos2;
            if (pos1 == -1) {
                pos1 = content.length(); // No more occurrences found.
                pos2 = -1;
            } else {
                pos2 = content.indexOf('#', pos1 + 1);
                if (pos2 == -1) {
                    if (neverFailOnHashes) {
                        pos1 = content.length(); // just write out the rest of the text, and throw no exception
                    } else {
                        throw new InvalidFieldValueException(
                                                             "The # character is not allowed in BibTeX strings unless escaped as in '\\#'.\n"
                                                             + "In JabRef, use pairs of # characters to indicate a string.\n"
                                                             + "Note that the entry causing the problem has been selected. Field value: " + content);
                    }
                }
            }

            if (pos1 > pivot) {
                writeText(content, pivot, pos1);
            }
            if ((pos1 < content.length()) && ((pos2 - 1) > pos1)) {
                // We check that the string label is not empty. That means
                // an occurrence of ## will simply be ignored. Should it instead
                // cause an error message?
                writeStringLabel(content, pos1 + 1, pos2, pos1 == pivot,
                                 (pos2 + 1) == content.length());
            }

            if (pos2 > -1) {
                pivot = pos2 + 1;
            } else {
                pivot = pos1 + 1;
            }
        }

        return parser.format(stringBuilder, field);
    }

    private boolean shouldResolveStrings(Field field) {
        if (prefs.isResolveStringsAllFields()) {
            // Resolve strings for all fields except some:
            return !prefs.getDoNotResolveStringsFor().contains(field);
        } else {
            // Default operation - we only resolve strings for standard fields:
            return field instanceof StandardField || InternalField.BIBTEX_STRING.equals(field);
        }
    }

    private String formatWithoutResolvingStrings(String content, Field field) throws InvalidFieldValueException {
        checkBraces(content);

        stringBuilder = new StringBuilder(String.valueOf(FIELD_START));

        stringBuilder.append(parser.format(content, field));

        stringBuilder.append(FIELD_END);

        return stringBuilder.toString();
    }

    private void writeText(String text, int startPos, int endPos) {
        stringBuilder.append(FIELD_START);
        boolean escape = false;
        boolean inCommandName = false;
        boolean inCommand = false;
        boolean inCommandOption = false;
        int nestedEnvironments = 0;
        StringBuilder commandName = new StringBuilder();
        for (int i = startPos; i < endPos; i++) {
            char c = text.charAt(i);

            // Track whether we are in a LaTeX command of some sort.
            if (Character.isLetter(c) && (escape || inCommandName)) {
                inCommandName = true;
                if (!inCommandOption) {
                    commandName.append(c);
                }
            } else if (Character.isWhitespace(c) && (inCommand || inCommandOption)) {
                // Whitespace
            } else if (inCommandName) {
                // This means the command name is ended.
                // Perhaps the beginning of an argument:
                if (c == '[') {
                    inCommandOption = true;
                } else if (inCommandOption && (c == ']')) {
                    // Or the end of an argument:
                    inCommandOption = false;
                } else if (!inCommandOption && (c == '{')) {
                    inCommandName = false;
                    inCommand = true;
                } else {
                    // Or simply the end of this command alltogether:
                    commandName.delete(0, commandName.length());
                    inCommandName = false;
                }
            }
            // If we are in a command body, see if it has ended:
            if (inCommand && (c == '}')) {
                if ("begin".equals(commandName.toString())) {
                    nestedEnvironments++;
                }
                if ((nestedEnvironments > 0) && "end".equals(commandName.toString())) {
                    nestedEnvironments--;
                }

                commandName.delete(0, commandName.length());
                inCommand = false;
            }

            // We add a backslash before any ampersand characters, with one exception: if
            // we are inside an \\url{...} command, we should write it as it is. Maybe.
            if ((c == '&') && !escape && !(inCommand && "url".equals(commandName.toString()))
                && (nestedEnvironments == 0)) {
                stringBuilder.append("\\&");
            } else {
                stringBuilder.append(c);
            }
            escape = c == '\\';
        }
        stringBuilder.append(FIELD_END);
    }

    private void writeStringLabel(String text, int startPos, int endPos, boolean first, boolean last) {
        putIn((first ? "" : " # ") + text.substring(startPos, endPos)
              + (last ? "" : " # "));
    }

    private void putIn(String s) {
        stringBuilder.append(StringUtil.wrap(s, prefs.getLineLength(), OS.NEWLINE));
    }

}


text:
package tk.cvrunmin.mcme.api.item;

import java.util.Random;

import net.minecraft.item.Item;

public class MEItem extends Item {
	private String registeredName;
	private Random rand = new Random();

	public String getRegisteredName() {
		String name = null;
		if(registeredName != null){
		 name = registeredName;
		}
		else{
			name = "item_" + Integer.toString(rand.nextInt(256));
		}
		return name;
	}

	public MEItem setRegisteredName(String registeredName) {
		this.registeredName = registeredName;
		return this;
	}
}


text:
@interface XFWeiboExpressPack : XFExpressPack

@end