diff options
author | Shashank | 2017-05-29 12:40:26 +0530 |
---|---|---|
committer | Shashank | 2017-05-29 12:40:26 +0530 |
commit | 0345245e860375a32c9a437c4a9d9cae807134e9 (patch) | |
tree | ad51ecbfa7bcd3cc5f09834f1bb8c08feaa526a4 /modules/helptools/src | |
download | scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.gz scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.tar.bz2 scilab_for_xcos_on_cloud-0345245e860375a32c9a437c4a9d9cae807134e9.zip |
CMSCOPE changed
Diffstat (limited to 'modules/helptools/src')
80 files changed, 33629 insertions, 0 deletions
diff --git a/modules/helptools/src/BuildHelp.vcxproj b/modules/helptools/src/BuildHelp.vcxproj new file mode 100755 index 000000000..427700df4 --- /dev/null +++ b/modules/helptools/src/BuildHelp.vcxproj @@ -0,0 +1,216 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{BFE3C796-D755-4BB2-840A-89A98D2A4AC1}</ProjectGuid> + <Keyword>MakeFileProj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l en -e xmltojar([],[],'en_US');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l fr -e xmltojar([],[],'fr_FR');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l pt_BR -e xmltojar([],[],'pt_BR');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ja_JP -e xmltojar([],[],'ja_JP');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ru_RU -e xmltojar([],[],'ru_RU');exit(0); +exit /B 0 +</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" + +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l en -e xmltojar([],[],'en_US');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l fr -e xmltojar([],[],'fr_FR');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l pt_BR -e xmltojar([],[],'pt_BR');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ja_JP -e xmltojar([],[],'ja_JP');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ru_RU -e xmltojar([],[],'ru_RU');exit(0); +exit /B 0 + +</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" + +IF EXIST "$(SolutionDir)modules\helptools\jar" del /q "$(SolutionDir)modules\helptools\jar\scilab_*.jar" 1>NUL 2>NUL + +"$(SolutionDir)bin\scilex.exe" -nb -l en -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l fr -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l pt_BR -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l ja_JP -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l ru_RU -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +exit /B 0 +</NMakeCleanCommandLine> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l en -e xmltojar([],[],'en_US');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l fr -e xmltojar([],[],'fr_FR');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l pt_BR -e xmltojar([],[],'pt_BR');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ja_JP -e xmltojar([],[],'ja_JP');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ru_RU -e xmltojar([],[],'ru_RU');exit(0); +exit /B 0 +</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" + +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l en -e xmltojar([],[],'en_US');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l fr -e xmltojar([],[],'fr_FR');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l pt_BR -e xmltojar([],[],'pt_BR');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ja_JP -e xmltojar([],[],'ja_JP');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ru_RU -e xmltojar([],[],'ru_RU');exit(0); +exit /B 0 + +</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" + +IF EXIST "$(SolutionDir)modules\helptools\jar" del /q "$(SolutionDir)modules\helptools\jar\scilab_*.jar" 1>NUL 2>NUL + +"$(SolutionDir)bin\scilex.exe" -nb -l en -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l fr -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l pt_BR -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l ja_JP -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l ru_RU -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +exit /B 0 +</NMakeCleanCommandLine> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l en -e xmltojar([],[],'en_US');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l fr -e xmltojar([],[],'fr_FR');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l pt_BR -e xmltojar([],[],'pt_BR');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ja_JP -e xmltojar([],[],'ja_JP');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ru_RU -e xmltojar([],[],'ru_RU');exit(0); +exit /B 0 +</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" + +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l en -e xmltojar([],[],'en_US');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l fr -e xmltojar([],[],'fr_FR');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l pt_BR -e xmltojar([],[],'pt_BR');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ja_JP -e xmltojar([],[],'ja_JP');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ru_RU -e xmltojar([],[],'ru_RU');exit(0); +exit /B 0 + +</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" + +IF EXIST "$(SolutionDir)modules\helptools\jar" del /q "$(SolutionDir)modules\helptools\jar\scilab_*.jar" 1>NUL 2>NUL + +"$(SolutionDir)bin\scilex.exe" -nb -l en -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l fr -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l pt_BR -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l ja_JP -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l ru_RU -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +exit /B 0 +</NMakeCleanCommandLine> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l en -e xmltojar([],[],'en_US');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l fr -e xmltojar([],[],'fr_FR');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l pt_BR -e xmltojar([],[],'pt_BR');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ja_JP -e xmltojar([],[],'ja_JP');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ru_RU -e xmltojar([],[],'ru_RU');exit(0); +exit /B 0 +</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" + +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l en -e xmltojar([],[],'en_US');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l fr -e xmltojar([],[],'fr_FR');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l pt_BR -e xmltojar([],[],'pt_BR');exit(0) +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ja_JP -e xmltojar([],[],'ja_JP');exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -nouserstartup -nw -noatomsautoload -l ru_RU -e xmltojar([],[],'ru_RU');exit(0); +exit /B 0 + +</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">IF EXIST "$(SolutionDir)modules\helptools\javaHelp" rmdir /s /q "$(SolutionDir)modules\helptools\javaHelp" + +IF EXIST "$(SolutionDir)modules\helptools\jar" del /q "$(SolutionDir)modules\helptools\jar\scilab_*.jar" 1>NUL 2>NUL + +"$(SolutionDir)bin\scilex.exe" -nb -l en -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l fr -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l pt_BR -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l ja_JP -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +"$(SolutionDir)bin\scilex.exe" -nb -l ru_RU -nouserstartup -nw -noatomsautoload -e clean_help();exit(0); +exit /B 0 +</NMakeCleanCommandLine> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + </PropertyGroup> + <ItemDefinitionGroup> + </ItemDefinitionGroup> + <ItemGroup> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/modules/helptools/src/BuildHelp.vcxproj.filters b/modules/helptools/src/BuildHelp.vcxproj.filters new file mode 100755 index 000000000..7ea7a7858 --- /dev/null +++ b/modules/helptools/src/BuildHelp.vcxproj.filters @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/modules/helptools/src/CheckHelp/CheckHelp.vcxproj b/modules/helptools/src/CheckHelp/CheckHelp.vcxproj new file mode 100755 index 000000000..a41a45c1c --- /dev/null +++ b/modules/helptools/src/CheckHelp/CheckHelp.vcxproj @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{1697EEE6-935C-4B9D-AD6A-5707DC120A1A}</ProjectGuid> + <Keyword>MakeFileProj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cd .. +nmake /f "makefile.mak" check /a</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cd .. +nmake /f "makefile.mak" check /a</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cd .. +nmake /f "makefile.mak" check /a</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cd .. +nmake /f "makefile.mak" check /a</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cd .. +nmake /f "makefile.mak" check /a</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cd .. +nmake /f "makefile.mak" check /a</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cd .. +nmake /f "makefile.mak" check /a</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cd .. +nmake /f "makefile.mak" check /a</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + </PropertyGroup> + <ItemDefinitionGroup> + </ItemDefinitionGroup> + <ItemGroup> + <None Include="..\makefile.mak" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/modules/helptools/src/CheckHelp/CheckHelp.vcxproj.filters b/modules/helptools/src/CheckHelp/CheckHelp.vcxproj.filters new file mode 100755 index 000000000..52fe1dab7 --- /dev/null +++ b/modules/helptools/src/CheckHelp/CheckHelp.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <None Include="..\makefile.mak"> + <Filter>Source Files</Filter> + </None> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/modules/helptools/src/c/DllmainHelptools.c b/modules/helptools/src/c/DllmainHelptools.c new file mode 100755 index 000000000..d9be56903 --- /dev/null +++ b/modules/helptools/src/c/DllmainHelptools.c @@ -0,0 +1,34 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) INRIA - Allan CORNET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +/*--------------------------------------------------------------------------*/ +#include <windows.h> +/*--------------------------------------------------------------------------*/ +#pragma comment(lib,"../../../../bin/libintl.lib") +/*--------------------------------------------------------------------------*/ +int WINAPI DllMain (HINSTANCE hInstance , DWORD reason, PVOID pvReserved) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + break; + case DLL_PROCESS_DETACH: + break; + case DLL_THREAD_ATTACH: + break; + case DLL_THREAD_DETACH: + break; + } + return 1; +} +/*--------------------------------------------------------------------------*/ + diff --git a/modules/helptools/src/c/core_Import.def b/modules/helptools/src/c/core_Import.def new file mode 100755 index 000000000..acb2b9d65 --- /dev/null +++ b/modules/helptools/src/c/core_Import.def @@ -0,0 +1,12 @@ +LIBRARY core.dll + + +EXPORTS + +; core +callFunctionFromGateway +getScilabMode +com_ +getSCIpath +MyHeapAlloc +MyHeapFree diff --git a/modules/helptools/src/c/helptools.rc b/modules/helptools/src/c/helptools.rc new file mode 100755 index 000000000..191b49537 --- /dev/null +++ b/modules/helptools/src/c/helptools.rc @@ -0,0 +1,97 @@ +// Microsoft Visual C++ generated resource script. +// + + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +//#include "afxres.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 5,5,2,0 + PRODUCTVERSION 5,5,2,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x0L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040c04b0" + BEGIN + VALUE "CompanyName", "Scilab" + VALUE "FileDescription", "helptools module" + VALUE "FileVersion", "5, 5, 2, 0" + VALUE "InternalName", "helptools" + VALUE "LegalCopyright", "Copyright (C) 2017" + VALUE "OriginalFilename", "helptools.rc" + VALUE "ProductName", " helptools" + VALUE "ProductVersion", "5, 5, 2, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40c, 1200 + END +END + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/modules/helptools/src/c/helptools.vcxproj b/modules/helptools/src/c/helptools.vcxproj new file mode 100755 index 000000000..d6f05dee6 --- /dev/null +++ b/modules/helptools/src/c/helptools.vcxproj @@ -0,0 +1,251 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{BED4A0F2-5129-487F-9F94-EC09480F04D7}</ProjectGuid> + <RootNamespace>helptools</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>false</WholeProgramOptimization> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)bin\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.;../jni;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../includes;../../../core/includes;../../../graphics/includes;../../../graphic_export/includes;../../../graphics/src/c/getHandleProperty;../../../renderer/src/cpp;../../../renderer/src/jni;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../../libs/intl;../../../string/includes;../../../windows_tools/includes;../../../renderer/includes;../../../api_scilab/includes;../../../commons/src/jni;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;HELPTOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>.;../jni;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../includes;../../../core/includes;../../../graphics/includes;../../../graphic_export/includes;../../../graphics/src/c/getHandleProperty;../../../renderer/src/cpp;../../../renderer/src/jni;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../../libs/intl;../../../string/includes;../../../windows_tools/includes;../../../renderer/includes;../../../api_scilab/includes;../../../commons/src/jni;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;HELPTOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>.;../jni;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../includes;../../../core/includes;../../../graphics/includes;../../../graphic_export/includes;../../../graphics/src/c/getHandleProperty;../../../renderer/src/cpp;../../../renderer/src/jni;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../../libs/intl;../../../string/includes;../../../windows_tools/includes;../../../renderer/includes;../../../api_scilab/includes;../../../commons/src/jni;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;HELPTOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> + <WholeProgramOptimization>false</WholeProgramOptimization> + <AdditionalIncludeDirectories>.;../jni;../../../../java/jdk/include;../../../../java/jdk/include/win32;../../includes;../../../core/includes;../../../graphics/includes;../../../graphic_export/includes;../../../graphics/src/c/getHandleProperty;../../../renderer/src/cpp;../../../renderer/src/jni;../../../localization/includes;../../../jvm/includes;../../../output_stream/includes;../../../dynamic_link/includes;../../../../libs/intl;../../../string/includes;../../../windows_tools/includes;../../../renderer/includes;../../../api_scilab/includes;../../../commons/src/jni;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;NDEBUG;_WINDOWS;_USRDLL;HELPTOOLS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <WarningLevel>Level3</WarningLevel> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <DisableSpecificWarnings>4251;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <PreLinkEvent> + <Message>Make dependencies</Message> + <Command>lib /DEF:"$(ProjectDir)core_import.def" /SUBSYSTEM:WINDOWS /MACHINE:$(Platform) /OUT:"$(ProjectDir)core.lib" 1>NUL 2>NUL +</Command> + </PreLinkEvent> + <Link> + <AdditionalDependencies>core.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(SolutionDir)bin\$(ProjectName).dll</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <ImportLibrary>$(SolutionDir)bin\$(ProjectName).lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\jni\BuildDocObject.cpp" /> + <ClCompile Include="DllmainHelptools.c" /> + <ClCompile Include="..\..\sci_gateway\c\gw_helptools.c" /> + <ClCompile Include="..\..\sci_gateway\cpp\sci_buildDoc.cpp" /> + <ClCompile Include="..\jni\SciDocMain.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\jni\BuildDocObject.hxx" /> + <ClInclude Include="..\..\includes\dynlib_helptools.h" /> + <ClInclude Include="..\..\includes\gw_helptools.h" /> + <ClInclude Include="..\jni\SciDocMain.hxx" /> + </ItemGroup> + <ItemGroup> + <None Include="..\..\locales\helptools.pot" /> + <None Include="core_import.def" /> + <None Include="..\..\helptools.iss" /> + <None Include="..\..\sci_gateway\helptools_gateway.xml" /> + <None Include="..\..\Makefile.am" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="helptools.rc" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\tools\Dumpexts\Dumpexts.vcxproj"> + <Project>{3170e4c2-1173-4264-a222-7ee8ccb3ddf7}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\api_scilab\api_scilab.vcxproj"> + <Project>{43c5bab1-1dca-4743-a183-77e0d42fe7d0}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\commons\src\c\commons.vcxproj"> + <Project>{eca09a1e-6d12-4a47-92e1-a671c181df77}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\jvm\libjvm.vcxproj"> + <Project>{8ba2dda8-bd04-4d4d-8ee6-6caa955f7470}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\localization\src\localization.vcxproj"> + <Project>{ecffeb0c-1eda-45ee-9a10-b18143852e17}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\output_stream\src\c\output_stream.vcxproj"> + <Project>{a5911cd7-f8e8-440c-a23e-4843a0636f3a}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + <ProjectReference Include="..\..\..\windows_tools\src\c\scilab_windows\scilab_windows.vcxproj"> + <Project>{8028f371-6a94-4a26-8804-6e7f05f1d1aa}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/modules/helptools/src/c/helptools.vcxproj.filters b/modules/helptools/src/c/helptools.vcxproj.filters new file mode 100755 index 000000000..a5846fde8 --- /dev/null +++ b/modules/helptools/src/c/helptools.vcxproj.filters @@ -0,0 +1,72 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{0f3c557d-c407-474e-a9e5-eae1cfa2d865}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{b83281d9-a756-48bb-94e6-1d8dcb268b6e}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="localization"> + <UniqueIdentifier>{88764958-4577-4396-aa75-b0b673009284}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries Dependencies"> + <UniqueIdentifier>{2bb2a1e4-3cd7-4173-9acf-4b982ed8102d}</UniqueIdentifier> + </Filter> + <Filter Include="Libraries Dependencies\Imports"> + <UniqueIdentifier>{bf0f900d-aa11-44ac-93fe-c7db0fb5cc64}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{b1f5187c-a8c8-4fef-ad85-f32876b34f5f}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\jni\BuildDocObject.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="DllmainHelptools.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sci_gateway\c\gw_helptools.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sci_gateway\cpp\sci_buildDoc.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\jni\SciDocMain.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\jni\BuildDocObject.hxx"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\includes\dynlib_helptools.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\includes\gw_helptools.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\jni\SciDocMain.hxx"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <None Include="core_import.def"> + <Filter>Libraries Dependencies\Imports</Filter> + </None> + <None Include="..\..\helptools.iss" /> + <None Include="..\..\sci_gateway\helptools_gateway.xml" /> + <None Include="..\..\Makefile.am" /> + <None Include="..\..\locales\helptools.pot"> + <Filter>localization</Filter> + </None> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="helptools.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/modules/helptools/src/java/jflex/c.jflex b/modules/helptools/src/java/jflex/c.jflex new file mode 100755 index 000000000..1a8ad00fd --- /dev/null +++ b/modules/helptools/src/java/jflex/c.jflex @@ -0,0 +1,253 @@ +//CHECKSTYLE:OFF + +package org.scilab.modules.helptools.c; + +import java.io.Reader; +import java.io.StringReader; +import java.io.IOException; + +@javax.annotation.Generated("JFlex") +@SuppressWarnings("fallthrough") +%% + +%public +%class CLexer +%final +%unicode +%char +%type void +%switch + +%{ + + private int whitesOnFirstLine; + private int saveLexState; + private AbstractCCodeHandler handler; + + public CLexer() { } + + private String trimEnd(String str) { + int end = str.length() - 1; + int i = end; + for (; i >= 0; i--) { + char c = str.charAt(i); + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { + break; + } + } + if (i != end) { + return str.substring(0, i + 1); + } + + return str; + } + + public String convert(AbstractCCodeHandler h, String code) { + Reader reader = new StringReader(trimEnd(code)); + String str = convert(h, reader, true); + try { + reader.close(); + } catch (IOException e) { } + + return str; + } + + public String convert(AbstractCCodeHandler h, Reader code, boolean ret) { + if (code == null) { + return null; + } else { + handler = h; + whitesOnFirstLine = 0; + yyreset(code); + yybegin(CLEANFIRST); + try { + yylex(); + } catch (IOException e) { + return null; + } + if (ret) { + return h.toString(); + } + return ""; + } + } +%} + +%x COMMENT, STRING, CLEAN, CLEANFIRST + +/* main character classes */ +eol = \r | \n | \r\n +white = [ \t\f]+ + +commentBeg = "/" "*"+ +commentEnd = "*"+ "/" +comment = ([^\r\n*/] | "*"+ [^\r\n*/] | [^\r\n*]"/")* + +oneLineComment = "//" [^\r\n]* + +id = [a-zA-Z]([0-9a-zA-Z_])* + +hex = [a-fA-F0-9] +is = (u|U|l|L)* +fs = (f|F|l|L) +digit = [0-9] +exp = [Ee] [+-]? {digit}+ +number = 0 [xX] {hex}+ {is}? | "0"? {digit}+ {is}? | {digit}* "." {digit}+ {exp}? {fs}? | {digit}+ "." {digit}* {exp}? {fs}? | "NULL" + +dquote = "\"" +string = ([^\r\n\\\"]* | "\\"[^\r\n])+ +char = "'" "\\"? [^\r\n\t] "'" + +keyword = "auto" | "break" | "case" | "catch" | "cin" | "const_cast" | "continue" | "cout" | "default" | "delete" | "do" | "dynamic_cast" | "else" | "enum" | "false" | "for" | "goto" | "if" | "namespace" | "new" | "reinterpret_cast" | "return" | "sizeof" | "static_cast" | "switch" | "template" | "this" | "throw" | "true" | "try" | "typedef" | "using" | "while" + +type = "bool" | "char" | "double" | "float" | "int" | "long" | "short" | "signed" | "struct" | "union" | "unsigned" | "void" + +modifier = "const" | "extern" | "friend" | "inline" | "mutable" | "noinline" | "private" | "protected" | "public" | "register" | "static" | "virtual" | "volatile" + +preprocessor = "#define" | "#elif" | "#else" | "#endif" | "#error" | "#if" | "#ifdef" | "#ifndef" | "#import" | "#include" | "#line" | "#pragma" | "#undef" | "#using" + +openclose = [(){}\[\]] + +operator = [=;,.><!~?:+-*/%&|\^] | ">>" | "<<" | "and" | "and_eq" | "bitand" | "bitor" | "compl" | "not" | "not_eq" | "operator" | "or" | "or_eq" | "typeid" | "xor" | "xor_eq" + +%% + +<CLEANFIRST> { + {white}*{eol}+ { } + + {white} { + whitesOnFirstLine = yylength(); + yybegin(YYINITIAL); + } + + . { + yypushback(1); + yybegin(YYINITIAL); + } +} + +<CLEAN> { + {eol}+ { + handler.handleNothing("\n"); + } + + {white} { + int len = yylength() - whitesOnFirstLine; + if (len > 0) { + yypushback(len); + } + yybegin(saveLexState); + } + + . { + yypushback(1); + yybegin(saveLexState); + } +} + +<YYINITIAL> { + {oneLineComment} { + handler.handleComment(yytext()); + } + + {commentBeg} { + yybegin(COMMENT); + handler.handleComment(yytext()); + } + + {dquote} { + yybegin(STRING); + handler.handleString(yytext()); + } + + {char} { + handler.handleString(yytext()); + } + + {number} { + handler.handleNumber(yytext()); + } + + {keyword} { + handler.handleKeyword(yytext()); + } + + {type} { + handler.handleType(yytext()); + } + + {modifier} { + handler.handleModifier(yytext()); + } + + {preprocessor} { + handler.handlePreprocessor(yytext()); + } + + {openclose} { + handler.handleOpenClose(yytext()); + } + + {operator} { + handler.handleOperator(yytext()); + } + + {id} { + handler.handleId(yytext()); + } + + . { + handler.handleDefault(yytext()); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } +} + +<COMMENT> { + {commentEnd} { + yybegin(YYINITIAL); + handler.handleComment(yytext()); + } + + {comment} { + handler.handleComment(yytext()); + } + + "*"{eol} { + handler.handleComment("*"); + handler.handleNothing("\n"); + saveLexState = COMMENT; + yybegin(CLEAN); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = COMMENT; + yybegin(CLEAN); + } +} + +<STRING> { + {string} { + handler.handleString(yytext()); + } + + {dquote} { + yybegin(YYINITIAL); + handler.handleString(yytext()); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = STRING; + yybegin(CLEAN); + } +} + +<<EOF>> { + return; + } diff --git a/modules/helptools/src/java/jflex/function.jflex b/modules/helptools/src/java/jflex/function.jflex new file mode 100755 index 000000000..2e0552a6b --- /dev/null +++ b/modules/helptools/src/java/jflex/function.jflex @@ -0,0 +1,118 @@ +//CHECKSTYLE:OFF + +package org.scilab.modules.helptools ; + +import java.io.IOException; +import java.io.StringReader; + +@javax.annotation.Generated("JFlex") +@SuppressWarnings("fallthrough") +%% + +%public +%class SynopsisLexer +%final +%unicode +%char +%type void + +%switch + +%{ + private static String currentName; + private static StringBuilder htmlBuffer = new StringBuilder(512); + private static SynopsisLexer lexer = new SynopsisLexer(); + + private SynopsisLexer() { } + + public static String convert(String name, String str) { + currentName = name; + try { + lexer.yyreset(new StringReader(str.trim())); + lexer.yybegin(YYINITIAL); + htmlBuffer.setLength(0); + lexer.yylex(); + + return htmlBuffer.toString(); + } catch (IOException e) { + return null; + } + } + +%} + +%eofval{ + return; +%eofval} + +/* main character classes */ +white = [ \t]+ +eol = ("\r" | "\n" | "\r\n"){white}* + +id = ([a-zA-Z%_#!?][a-zA-Z0-9_#!$?]*)|("$"[a-zA-Z0-9_#!$?]+) + +comments = "//"[^\r\n]* + +nothing = [^a-zA-Z%_#!?/\n\r<>&\"\']+ | "/" + +dquote = "\"" +quote = "'" +lt = "<" +gt = ">" +amp = "&" + +%% + +<YYINITIAL> { + + {comments} { + htmlBuffer.append("<span class=\"comment\">"); + htmlBuffer.append(yytext()); + htmlBuffer.append("</span>"); + } + + {id} { + String str = yytext(); + if (str.equals(currentName)) { + htmlBuffer.append("<span class=\"functionid\">"); + } else { + htmlBuffer.append("<span class=\"default\">"); + } + htmlBuffer.append(str); + htmlBuffer.append("</span>"); + } + + {dquote} { + htmlBuffer.append("""); + } + + {quote} { + htmlBuffer.append("'"); + } + + {lt} { + htmlBuffer.append("<"); + } + + {gt} { + htmlBuffer.append(">"); + } + + {amp} { + htmlBuffer.append("&"); + } + + {white} { + htmlBuffer.append(" "); + } + + {eol} { + htmlBuffer.append("\n"); + } + + {nothing} { + htmlBuffer.append("<span class=\"default\">"); + htmlBuffer.append(yytext()); + htmlBuffer.append("</span>"); + } +} diff --git a/modules/helptools/src/java/jflex/java.jflex b/modules/helptools/src/java/jflex/java.jflex new file mode 100755 index 000000000..4bb3231df --- /dev/null +++ b/modules/helptools/src/java/jflex/java.jflex @@ -0,0 +1,228 @@ +//CHECKSTYLE:OFF + +package org.scilab.modules.helptools.java; + +import java.io.Reader; +import java.io.StringReader; +import java.io.IOException; + +import org.scilab.modules.helptools.c.AbstractCCodeHandler; + +@javax.annotation.Generated("JFlex") +@SuppressWarnings("fallthrough") +%% + +%public +%class JavaLexer +%final +%unicode +%char +%type void +%pack + +%{ + + private int whitesOnFirstLine; + private int saveLexState; + private AbstractCCodeHandler handler; + + public JavaLexer() { } + + private String trimEnd(String str) { + int end = str.length() - 1; + int i = end; + for (; i >= 0; i--) { + char c = str.charAt(i); + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { + break; + } + } + if (i != end) { + return str.substring(0, i + 1); + } + + return str; + } + + public String convert(AbstractCCodeHandler h, String code) { + Reader reader = new StringReader(trimEnd(code)); + String str = convert(h, reader, true); + try { + reader.close(); + } catch (IOException e) { } + + return str; + } + + public String convert(AbstractCCodeHandler h, Reader code, boolean ret) { + if (code == null) { + return null; + } else { + handler = h; + whitesOnFirstLine = 0; + yyreset(code); + yybegin(CLEANFIRST); + try { + yylex(); + } catch (IOException e) { + return null; + } + if (ret) { + return h.toString(); + } + return ""; + } + } +%} + +%x COMMENT, CLEAN, CLEANFIRST + +/* main character classes */ +eol = \r | \n | \r\n +white = [ \t\f]+ + +commentBeg = "/" "*"+ +commentEnd = "*"+ "/" +comment = ([^\r\n*/] | "*"+ [^\r\n*/] | [^\r\n*]"/")* + +oneLineComment = "//" [^\r\n]* + +id = [a-zA-Z]([0-9a-zA-Z_])* + +hex = [a-fA-F0-9] +is = (l|L)? +fs = [fFdD]? +digit = [0-9] +exp = [Ee] [+-]? {digit}+ +number = 0 [xX] {hex}+ {is}? | "0"? {digit}+ {is}? | {digit}* "." {digit}+ {exp}? {fs}? | {digit}+ "." {digit}* {exp}? {fs}? + +string = ("\"" ([^\r\n\\\"]* | "\\"[^\r\n])+ "\"") | ("'" "\\"? [^\r\n\t] "'") + +keyword = "break" | "case" | "catch" | "class" | "const" | "continue" | "default" | "do" | "else" | "enum" | "extends" | "false" | "finally" | "for" | "goto" | "if" | "implements" | "import" | "interface" | "native" | "new" | "package" | "return" | "strictfp" | "super" | "switch" | "this" | "throw" | "throws" | "true" | "try" | "while" + +type = [Bb]"oolean" | [Bb]"yte" | "char" | "Character" | "Class" | [Dd]"ouble" | [Ff]"loat" | "int" | "Integer" | [Ll]"ong" | "Object" | [Ss]"hort" | "String" | "StringBuffer" | "StringBuilder" | "Thread" | "void" | "Void" + +exception = "ArithmeticException" | "ArrayIndexOutOfBoundsException" | "ClassCastException" | "ClassNotFoundException" | "CloneNotSupportedException" | "Exception" | "IllegalAccessException" | "IllegalArgumentException" | "IllegalStateException" | "IllegalThreadStateException" | "IndexOutOfBoundsException" | "InstantiationException" | "InterruptedException" | "NegativeArraySizeException" | "NoSuchFieldException" | "NoSuchMethodException" | "NullPointerException" | "NumberFormatException" | "RuntimeException" | "SecurityException" | "StringIndexOutOfBoundsException" | "UnsupportedOperationException" + +modifier = "abstract" | "final" | "private" | "protected" | "public" | "static" | "transient" | "volatile" + +openclose = [(){}\[\]] + +operator = [=;,.><!~?:+-*/%&|\^] | ">>" | "<<" | ">>>" + +%% + +<CLEANFIRST> { + {white}*{eol}+ { } + + {white} { + whitesOnFirstLine = yylength(); + yybegin(YYINITIAL); + } + + . { + yypushback(1); + yybegin(YYINITIAL); + } +} + +<CLEAN> { + {eol}+ { + handler.handleNothing("\n"); + } + + {white} { + int len = yylength() - whitesOnFirstLine; + if (len > 0) { + yypushback(len); + } + yybegin(saveLexState); + } + + . { + yypushback(1); + yybegin(saveLexState); + } +} + +<YYINITIAL> { + {oneLineComment} { + handler.handleComment(yytext()); + } + + {commentBeg} { + yybegin(COMMENT); + handler.handleComment(yytext()); + } + + {string} { + handler.handleString(yytext()); + } + + {number} { + handler.handleNumber(yytext()); + } + + {keyword} { + handler.handleKeyword(yytext()); + } + + {type} | + {exception} { + handler.handleType(yytext()); + } + + {modifier} { + handler.handleModifier(yytext()); + } + + {openclose} { + handler.handleOpenClose(yytext()); + } + + {operator} { + handler.handleOperator(yytext()); + } + + {id} { + handler.handleId(yytext()); + } + + . { + handler.handleDefault(yytext()); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } +} + +<COMMENT> { + {commentEnd} { + yybegin(YYINITIAL); + handler.handleComment(yytext()); + } + + {comment} { + handler.handleComment(yytext()); + } + + "*"{eol} { + handler.handleComment("*"); + handler.handleNothing("\n"); + saveLexState = COMMENT; + yybegin(CLEAN); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = COMMENT; + yybegin(CLEAN); + } +} + +<<EOF>> { + return; + } diff --git a/modules/helptools/src/java/jflex/scilab.jflex b/modules/helptools/src/java/jflex/scilab.jflex new file mode 100755 index 000000000..70dbe59f9 --- /dev/null +++ b/modules/helptools/src/java/jflex/scilab.jflex @@ -0,0 +1,827 @@ +//CHECKSTYLE:OFF + +package org.scilab.modules.helptools.scilab; + +import java.util.Arrays; +import java.util.Set; +import java.util.Map; +import java.util.HashSet; +import java.util.List; +import java.util.ArrayList; +import java.util.Iterator; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.Reader; +import java.io.StringReader; +import java.io.IOException; + +@javax.annotation.Generated("JFlex") +@SuppressWarnings("fallthrough") +%% + +%public +%class ScilabLexer +%final +%unicode +%char +%type void +%switch + +%{ + private static Set<String> commands; + private static Set<String> macros; + + private int beginString; + private boolean transposable; + private boolean breakstring; + private boolean breakargs; + private int whitesOnFirstLine; + private int saveLexState; + + private String id; + private List<String> returnValues = new ArrayList<String>(); + private List<String> argsValues = new ArrayList<String>(); + private List<String> localFun = new ArrayList<String>(); + + private AbstractScilabCodeHandler handler; + + public ScilabLexer(String[] primFile, String[] macroFile) { + if (commands == null) { + commands = new HashSet<String>(); + macros = new HashSet<String>(); + loadNames(primFile, commands); + loadNames(macroFile, macros); + } + } + + public ScilabLexer(String primFile, String macroFile) { + this(new String[]{primFile}, new String[]{macroFile}); + } + + public ScilabLexer(Set<String> primitives, Set<String> macros) { + commands = primitives; + this.macros = macros; + } + + private void loadNames(String[] files, Set<String> set) { + for (int i = 0; i < files.length; i++) { + loadNames(files[i], set); + } + } + + private void loadNames(String file, Set<String> set) { + if (file == null) { + return; + } + BufferedReader input = null; + try { + input = new BufferedReader(new FileReader(file)); + String line = null; + while ((line = input.readLine()) != null) { + set.add(line); + } + } catch (IOException e) { + System.err.println(e); + } + if (input != null) { + try { + input.close(); + } catch (IOException e) { + System.err.println(e); + } + } + } + + private String trimEnd(String str) { + int end = str.length() - 1; + int i = end; + for (; i >= 0; i--) { + char c = str.charAt(i); + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { + break; + } + } + if (i != end) { + return str.substring(0, i + 1); + } + + return str; + } + + public String convert(AbstractScilabCodeHandler h, String code) { + Reader reader = new StringReader(trimEnd(code)); + String str = convert(h, reader, true); + try { + reader.close(); + } catch (IOException e) { } + + return str; + } + + public String convert(AbstractScilabCodeHandler h, Reader code, boolean ret) { + if (code == null) { + return null; + } else { + handler = h; + transposable = false; + breakargs = false; + breakstring = false; + whitesOnFirstLine = 0; + localFun.clear(); + yyreset(code); + yybegin(CLEANFIRST); + try { + yylex(); + } catch (IOException e) { + return null; + } + if (ret) { + return h.toString(); + } + return ""; + } + } +%} + +/* main character classes */ +eol = "\r" | "\n" | "\r\n" + +open = "[" | "(" | "{" +close = "]" | ")" | "}" + +comment = "//" + +quote = "'" + +dquote = "\"" + +cstes = "%t" | "%T" | "%f" | "%F" | "%e" | "%pi" | "%inf" | "%i" | "%z" | "%s" | "%nan" | "%eps" | "SCI" | "WSCI" | "SCIHOME" | "TMPDIR" + +dottransp = ".'" +lt = "<" +gt = ">" +neq = "<>" +leq = "<=" +geq = ">=" +amp = "&" + +operator = ".*" | "./" | ".\\" | ".^" | ".**" | "+" | "-" | "/" | "\\" | "*" | "^" | "**" | "==" | "~=" | ".*." | "./." | ".\\." | "/." | "=" | "|" | "@" | "@=" | "~" + +structureKwds = "if" | "for" | "while" | "try" | "select" | "end" | "then" | "do" | "catch" | "case" | "elseif" | "else" + +controlKwds = "abort" | "break" | "quit" | "return" | "resume" | "pause" | "continue" | "exit" + +break = ".."(".")* +breakinstring = {break}[ \t]*({comment} | {eol}) + +special = "$" | ":" | {break} + +string = (([^\t\'\"\r\n<>&\.]*)|([\'\"]{2})|("."[^\t\'\"\r\n<>&\.]))+ + +argstring = ([^ \t,;/\n\r<>&]*) | ("/"[^ \t,;/\n\r<>&]*) + +id = ([a-zA-Z%_#!?][a-zA-Z0-9_#!$?]*)|("$"[a-zA-Z0-9_#!$?]+) + +dot = "." + +digit = [0-9] +exp = [dDeE][+-]?{digit}* +number = ({digit}+"."?{digit}*{exp}?)|("."{digit}+{exp}?) + +/* function declaration */ +white = [ \t]+ +funcomments = {white}* "//" +fun = "function" {white} +funb = "function[" +endfun = "endfunction" + +htmlentity = "&"[#a-zA-Z0-9]*";" + +%x QSTRING, COMMENT, FIELD, COMMANDS, COMMANDSWHITE, BREAKSTRING, FUNCTION, TYPEID, FUNNAME, RETS, ARGS, BREAKINARGS, WHITESEOL, CLEANFIRST, CLEAN + +%% + +<CLEANFIRST> { + {white}*{eol}+ { } + + {white} { + whitesOnFirstLine = yylength(); + yybegin(YYINITIAL); + } + + . { + yypushback(1); + yybegin(YYINITIAL); + } +} + +<CLEAN> { + {eol}+ { + handler.handleNothing("\n"); + } + + {white} { + int len = yylength() - whitesOnFirstLine; + if (len > 0) { + yypushback(len); + } + yybegin(saveLexState); + } + + . { + yypushback(1); + yybegin(saveLexState); + } +} + +<YYINITIAL> { + {htmlentity} { + transposable = false; + handler.handleDefault(yytext()); + } + + {comment} { + transposable = false; + yypushback(2); + yybegin(COMMENT); + } + + {dottransp} { + transposable = false; + handler.handleOperator(".'"); + } + + {lt} { + transposable = false; + handler.handleOperator("<"); + } + + {gt} { + transposable = false; + handler.handleOperator(">"); + } + + {leq} { + transposable = false; + handler.handleOperator("<="); + } + + {geq} { + transposable = false; + handler.handleOperator(">="); + } + + {neq} { + transposable = false; + handler.handleOperator("<>"); + } + + {amp} { + transposable = false; + handler.handleOperator("&"); + } + + {operator} { + transposable = false; + handler.handleOperator(yytext()); + } + + {funb} { + transposable = false; + handler.handleFKeywords("function"); + handler.handleNothing(" "); + handler.handleOpenClose("["); + yybegin(RETS); + } + + {fun} { + transposable = false; + handler.handleFKeywords("function"); + handler.handleNothing(" "); + yybegin(FUNCTION); + } + + {endfun} { + transposable = false; + returnValues.clear(); + argsValues.clear(); + handler.handleFKeywords("endfunction"); + } + + {structureKwds} { + transposable = false; + handler.handleSKeywords(yytext()); + } + + {controlKwds} { + transposable = false; + handler.handleCKeywords(yytext()); + } + + {cstes} { + transposable = true; + handler.handleConstants(yytext()); + } + + {id} { + transposable = true; + String str = yytext(); + if (commands.contains(str)) { + yybegin(COMMANDS); + handler.handleCommand(str); + } else if (macros.contains(str)) { + yybegin(COMMANDS); + handler.handleMacro(str); + } else if (localFun.contains(str)) { + yybegin(COMMANDS); + handler.handleFunctionId(str); + } else { + if (returnValues.contains(str) || argsValues.contains(str)) { + handler.handleInputOutputArgs(str); + } else { + handler.handleId(str); + } + } + } + + {number} { + transposable = true; + handler.handleNumber(yytext()); + } + + {special} { + transposable = false; + handler.handleSpecial(yytext()); + } + + {dot} { + transposable = false; + yybegin(FIELD); + handler.handleOperator(yytext()); + } + + {quote} { + if (transposable) { + handler.handleOperator("'"); + } else { + beginString = zzStartRead; + yybegin(QSTRING); + handler.handleString("'"); + } + } + + {open} { + transposable = false; + handler.handleOpenClose(yytext()); + } + + {close} { + transposable = true; + handler.handleOpenClose(yytext()); + } + + {dquote} { + transposable = false; + beginString = zzStartRead; + yybegin(QSTRING); + handler.handleString("""); + } + + " " { + transposable = false; + handler.handleNothing(" "); + } + + "\t" { + transposable = false; + handler.handleNothing(" "); + } + + "\0" { + return; + } + + . { + transposable = false; + handler.handleDefault(yytext()); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } + +} + +<FUNCTION> { + "[" { + handler.handleOpenClose("["); + yybegin(RETS); + } + + {id} { + id = yytext(); + yybegin(TYPEID); + } + + . | + {eol} { + yypushback(1); + yybegin(YYINITIAL); + } +} + +<TYPEID> { + "=" { + returnValues.add(id); + handler.handleInputOutputArgsDecl(id); + handler.handleOperator("="); + yybegin(FUNNAME); + } + + "(" { + localFun.add(id); + handler.handleFunctionIdDecl(id); + handler.handleOpenClose("("); + yybegin(ARGS); + } + + [ \t] { } + + {funcomments} { + localFun.add(id); + handler.handleFunctionIdDecl(id); + yypushback(yylength()); + yybegin(YYINITIAL); + } + + . | + {eol} { + yypushback(1); + yybegin(YYINITIAL); + } +} + +<FUNNAME> { + {id} { + id = yytext(); + localFun.add(id); + handler.handleFunctionIdDecl(id); + } + + [ \t] { } + + "(" { + handler.handleOpenClose("("); + yybegin(ARGS); + } + + {funcomments} { + yypushback(yylength()); + yybegin(YYINITIAL); + } + + . | + {eol} { + yypushback(1); + yybegin(YYINITIAL); + } +} + +<ARGS> { + {id} { + id = yytext(); + argsValues.add(id); + handler.handleInputOutputArgsDecl(id); + } + + "," { + handler.handleDefault(", "); + } + + {white} { } + + {break} { + handler.handleSpecial(yytext()); + yybegin(BREAKINARGS); + } + + ")" { + handler.handleOpenClose(")"); + yybegin(YYINITIAL); + } + + . | + {eol} { + yypushback(1); + yybegin(YYINITIAL); + } +} + +<BREAKINARGS> { + " " { + handler.handleNothing(" "); + } + + {comment} { + breakargs = true; + yypushback(2); + yybegin(COMMENT); + } + + {white}*{eol} { + handler.handleNothing("\n"); + saveLexState = WHITESEOL; + yybegin(CLEAN); + } + + . { + yypushback(1); + yybegin(YYINITIAL); + } +} + +<WHITESEOL> { + " " { + handler.handleNothing(" "); + } + + . | + {eol} { + yypushback(1); + yybegin(ARGS); + } +} + +<RETS> { + {id} { + id = yytext(); + returnValues.add(id); + handler.handleInputOutputArgsDecl(id); + } + + "," { + handler.handleDefault(", "); + } + + "]" { + handler.handleOpenClose("]"); + } + + "[" { + handler.handleOpenClose("["); + } + + "=" { + handler.handleOperator("="); + yybegin(FUNNAME); + } + + "..." { + handler.handleNothing("..."); + } + + {white} { } + + . | + {eol} { + yypushback(1); + yybegin(YYINITIAL); + } +} + +<COMMANDS> { + [ \t]*"(" { + yypushback(yylength()); + yybegin(YYINITIAL); + } + + " " { + yybegin(COMMANDSWHITE); + handler.handleNothing(" "); + } + + "\t" { + yybegin(COMMANDSWHITE); + handler.handleNothing(" "); + } + . + { + yypushback(1); + yybegin(YYINITIAL); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } +} + +<COMMANDSWHITE> { + {comment} { + transposable = false; + yypushback(2); + yybegin(COMMENT); + } + + {argstring} { + handler.handleString(yytext()); + } + + {lt} { + transposable = false; + handler.handleString("<"); + } + + {gt} { + transposable = false; + handler.handleString(">"); + } + + {amp} { + transposable = false; + handler.handleString("&"); + } + + " " { + handler.handleNothing(" "); + } + + "\t" { + handler.handleNothing(" "); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } + . + { + yypushback(1); + yybegin(YYINITIAL); + } + +} + +<FIELD> { + {id} { + handler.handleField(yytext()); + } + + . { + yypushback(1); + yybegin(YYINITIAL); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } +} + +<QSTRING> { + {breakinstring} { + yypushback(yylength()); + yybegin(BREAKSTRING); + transposable = false; + handler.handleString(yytext()); + } + + {lt} { + transposable = false; + handler.handleString("<"); + } + + {gt} { + transposable = false; + handler.handleString(">"); + } + + {amp} { + transposable = false; + handler.handleString("&"); + } + + {string} | + "." { + handler.handleString(yytext()); + } + + {quote} { + transposable = false; + yybegin(YYINITIAL); + handler.handleString("'"); + } + + {dquote} { + transposable = false; + yybegin(YYINITIAL); + handler.handleString("""); + } + + "\0" { + return; + } + + . { + handler.handleString(yytext()); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } +} + +<COMMENT> { + [^&<>\'\"\n\0]* { + handler.handleComment(yytext()); + } + + {lt} { + handler.handleComment("<"); + } + + {gt} { + handler.handleComment(">"); + } + + {amp} { + handler.handleComment("&"); + } + + {quote} { + handler.handleComment("'"); + } + + {dquote} { + handler.handleComment("""); + } + + {eol} { + if (breakstring) { + saveLexState = QSTRING; + breakstring = false; + } else if (breakargs) { + saveLexState = WHITESEOL; + breakargs = false; + } else { + saveLexState = YYINITIAL; + } + handler.handleNothing("\n"); + yybegin(CLEAN); + } + + "\0" { + return; + } +} + +<BREAKSTRING> { + {break} { + breakstring = true; + handler.handleSpecial(yytext()); + } + + " " { + handler.handleNothing(" "); + } + + "\t" { + handler.handleNothing(" "); + } + + {comment} { + transposable = false; + yypushback(2); + yybegin(COMMENT); + } + + . { + handler.handleDefault(yytext()); + } + + {eol} { + if (breakstring) { + breakstring = false; + saveLexState = QSTRING; + } else { + saveLexState = YYINITIAL; + } + handler.handleNothing("\n"); + yybegin(CLEAN); + } + + "\0" { + return; + } +} + +<<EOF>> { + return; + } diff --git a/modules/helptools/src/java/jflex/xml.jflex b/modules/helptools/src/java/jflex/xml.jflex new file mode 100755 index 000000000..a76de8ba2 --- /dev/null +++ b/modules/helptools/src/java/jflex/xml.jflex @@ -0,0 +1,288 @@ +//CHECKSTYLE:OFF + +package org.scilab.modules.helptools.XML; + +import java.io.Reader; +import java.io.StringReader; +import java.io.IOException; + +@javax.annotation.Generated("JFlex") +@SuppressWarnings("fallthrough") +%% + +%public +%class XMLLexer +%final +%unicode +%char +%type void +%switch + +%{ + + private int whitesOnFirstLine; + private int saveLexState; + private AbstractXMLCodeHandler handler; + + public XMLLexer() { } + + private String trimEnd(String str) { + int end = str.length() - 1; + int i = end; + for (; i >= 0; i--) { + char c = str.charAt(i); + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { + break; + } + } + if (i != end) { + return str.substring(0, i + 1); + } + + return str; + } + + public String convert(AbstractXMLCodeHandler h, String code) { + Reader reader = new StringReader(trimEnd(code)); + String str = convert(h, reader, true); + try { + reader.close(); + } catch (IOException e) { } + + return str; + } + + public String convert(AbstractXMLCodeHandler h, Reader code, boolean ret) { + if (code == null) { + return null; + } else { + handler = h; + whitesOnFirstLine = 0; + yyreset(code); + yybegin(CLEANFIRST); + try { + yylex(); + } catch (IOException e) { + return null; + } + if (ret) { + return h.toString(); + } + return ""; + } + } +%} + +%x COMMENT, CDATA, TAG, PI, CLEAN, CLEANFIRST + +/* main character classes */ +/* http://www.w3.org/TR/REC-xml/ */ + +white = [ \t]+ + +entity = "&"[#a-zA-Z0-9]*";" + +nameStartChar = ":" | [A-Z] | "_" | [a-z] | [\u00C0-\u00D6] | [\u00D8-\u00F6] | [\u00F8-\u02FF] | [\u0370-\u037D] | [\u037F-\u1FFF] | [\u200C-\u200D] | [\u2070-\u218F] | [\u2C00-\u2FEF] | [\u3001-\uD7FF] | [\uF900-\uFDCF] | [\uFDF0-\uFFFD] +nameChar = {nameStartChar} | "-" | "." | [0-9] | \u00B7 | [\u0300-\u036F] | [\u0203F-\u2040] +name = {nameStartChar} {nameChar}* + +commentBeg = "<!--" +commentEnd = "-->" +comment = ([^\r\n-]* | [^\r\n-]* "-" [^\r\n-] | [^\r\n-]* "--" [^\r\n>])+ + +cdataBeg = "<![CDATA[" +cdataEnd = "]]>" +cdata = ([^\r\n\]]* | [^\r\n\]]* "]" [^\r\n\]] | [^\r\n\]]* "]]" [^\r\n>])+ + +piBeg = "<?" {name} +piEnd = "?>" + +openTagBeg = "<" {name} +autocloseTag = "/>" +openTagEnd = ">" +closeTag = "</" {name} {white}* ">" + +attribute = {name} "=" +value = ("\"" [^\r\n\"]* "\"") | ("\'" [^\r\n\']* "\'") + +eol = [\r\n]+ + +%% +<CLEANFIRST> { + {white}*{eol}+ { } + + {white} { + whitesOnFirstLine = yylength(); + yybegin(YYINITIAL); + } + + . { + yypushback(1); + yybegin(YYINITIAL); + } +} + +<CLEAN> { + {eol}+ { + handler.handleNothing("\n"); + } + + {white} { + int len = yylength() - whitesOnFirstLine; + if (len > 0) { + yypushback(len); + } + yybegin(saveLexState); + } + + . { + yypushback(1); + yybegin(saveLexState); + } +} + +<YYINITIAL> { + {entity} { + handler.handleEntity("&" + yytext().substring(1)); + } + + {piBeg} { + yybegin(PI); + handler.handleOpenInstr("<?"); + handler.handleInstrName(yytext().substring(2)); + } + + {openTagBeg} { + yybegin(TAG); + handler.handleLow("<"); + handler.handleOpenTagName(yytext().substring(1)); + } + + {closeTag} { + handler.handleLowClose("</"); + String str = yytext(); + handler.handleOpenTagName(str.substring(2, str.length() - 1).trim()); + handler.handleGreat(">"); + } + + {commentBeg} { + yybegin(COMMENT); + handler.handleOpenComment("<!--"); + } + + {cdataBeg} { + yybegin(CDATA); + handler.handleOpenCdata("<![CDATA["); + } + + [^<\r\n]* { + handler.handleDefault(yytext()); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } +} + +<PI> { + {attribute} { + String str = yytext(); + handler.handleAttributeName(str.substring(0, str.length() - 1)); + handler.handleEqual("="); + } + + {value} { + handler.handleAttributeValue(yytext()); + } + + {piEnd} { + yybegin(YYINITIAL); + handler.handleCloseInstr("?>"); + } + + {white} { + handler.handleNothing(" "); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = PI; + yybegin(CLEAN); + } + + . { } +} + +<TAG> { + {attribute} { + String str = yytext(); + handler.handleAttributeName(str.substring(0, str.length() - 1)); + handler.handleEqual("="); + } + + {value} { + handler.handleAttributeValue(yytext()); + } + + {autocloseTag} { + yybegin(YYINITIAL); + handler.handleAutoClose("/>"); + } + + {openTagEnd} { + yybegin(YYINITIAL); + handler.handleGreat(">"); + } + + {white} { + handler.handleNothing(" "); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = TAG; + yybegin(CLEAN); + } + + . { } +} + +<COMMENT> { + {commentEnd} { + yybegin(YYINITIAL); + handler.handleCommentEnd("-->"); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = COMMENT; + yybegin(CLEAN); + } + + {comment} { + handler.handleComment(yytext()); + } +} + +<CDATA> { + {cdataEnd} { + yybegin(YYINITIAL); + handler.handleCdataEnd("]]>"); + } + + {eol} { + handler.handleNothing("\n"); + saveLexState = CDATA; + yybegin(CLEAN); + } + + {cdata} { + handler.handleCdata(yytext()); + } +} + +<<EOF>> { + return; + } diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/CHMDocbookTagConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/CHMDocbookTagConverter.java new file mode 100755 index 000000000..055307b18 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/CHMDocbookTagConverter.java @@ -0,0 +1,245 @@ +/*9 + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.List; + +import org.xml.sax.SAXException; +import org.scilab.modules.helptools.image.ImageConverter; +import org.scilab.modules.localization.LocaleToLCID; + +/** + * Class to convert DocBook to CHM + * @author Calixte DENIZET + */ +public class CHMDocbookTagConverter extends HTMLDocbookTagConverter { + + private StringBuilder buffer = new StringBuilder(8192); + private String outName; + private List<String> filesList = new ArrayList<String>(); + private String docWebsite; + + + /** + * Constructor + * @param inName the name of the input stream + * @param outName the output directory + * @param imgConvert The associated image converter + */ + public CHMDocbookTagConverter(String inName, SciDocMain sciDocMain, ImageConverter imgConvert) throws IOException, SAXException { + super(inName, sciDocMain, imgConvert); + this.outName = new File(outName).getCanonicalPath() + File.separator; + this.docWebsite = sciDocMain.getConf().getWebSiteURL(); + } + + /** + * {@inheritDoc} + */ + public void createHTMLFile(String id, String fileName, String subtitle, String contents) { + super.createHTMLFile(id, fileName, subtitle, contents); + filesList.add(fileName); + } + + /** + * {@inheritDoc} + */ + public String makePrevious(String id) { + buffer.setLength(0); + HTMLDocbookLinkResolver.TreeId leaf = mapTreeId.get(id); + if (leaf == null) { + return "<link rel=\"prev\" href=\"\" title=\"\">"; + } + HTMLDocbookLinkResolver.TreeId prev = leaf.getPrevious(); + if (prev.parent != null) { + buffer.append("<link rel=\"prev\" href=\""); + buffer.append(mapId.get(prev.id)); + buffer.append("\" title=\""); + buffer.append(tocitem.get(prev.id)); + buffer.append("\">"); + + return buffer.toString(); + } + + return "<link rel=\"prev\" href=\"\" title=\"\">"; + } + + /** + * {@inheritDoc} + */ + public String makeTop(String id) { + buffer.setLength(0); + HTMLDocbookLinkResolver.TreeId leaf = mapTreeId.get(id); + if (leaf == null) { + return "<link rel=\"up\" href=\"\" title=\"\">"; + } + + leaf = leaf.parent; + if (leaf != null) { + buffer.append("<link rel=\"up\" href=\""); + if (!leaf.isRoot()) { + buffer.append(mapId.get(leaf.id)); + buffer.append("\" title=\""); + buffer.append(tocitem.get(leaf.id)); + } else { + buffer.append(indexFilename); + buffer.append("\" title=\""); + buffer.append(bookTitle); + } + buffer.append("\">"); + + return buffer.toString(); + } + + return "<link rel=\"up\" href=\"\" title=\"\">"; + } + + /** + * {@inheritDoc} + */ + public String makeNext(String id) { + buffer.setLength(0); + HTMLDocbookLinkResolver.TreeId leaf = mapTreeId.get(id); + if (leaf == null) { + return "<link rel=\"next\" href=\"\" title=\"\">"; + } + HTMLDocbookLinkResolver.TreeId next = leaf.getNext(); + if (next != null) { + buffer.append("<link rel=\"next\" href=\""); + buffer.append(mapId.get(next.id)); + buffer.append("\" title=\""); + buffer.append(tocitem.get(next.id)); + buffer.append("\">"); + + return buffer.toString(); + } + + return "<link rel=\"next\" href=\"\" title=\"\">"; + } + + /** + * {@inheritDoc} + */ + public String makeStart(String id) { + buffer.setLength(0); + buffer.append("<link rel=\"start\" href=\""); + buffer.append(indexFilename); + buffer.append("\" title=\""); + buffer.append(bookTitle); + buffer.append("\">"); + + return buffer.toString(); + } + + /** + * {@inheritDoc} + */ + public void endDocument() throws SAXException { + try { + FileOutputStream outToc = new FileOutputStream("toc.hhc"); + FileOutputStream outFiles = new FileOutputStream("htmlhelp.hhp"); + OutputStreamWriter writerFiles = new OutputStreamWriter(outFiles, Charset.forName("UTF-8")); + OutputStreamWriter writerToc = new OutputStreamWriter(outToc, Charset.forName("UTF-8")); + convertTree(writerToc); + writerToc.flush(); + writerToc.close(); + outToc.flush(); + outToc.close(); + + convertFileList(writerFiles); + writerFiles.flush(); + writerFiles.close(); + outFiles.flush(); + outFiles.close(); + } catch (IOException e) { + fatalExceptionOccurred(e); + } + } + + private void convertFileList(Appendable buffer) throws IOException { + buffer.append("[OPTIONS]\n"); + buffer.append("Binary TOC=Yes\n"); + buffer.append("Compatibility=1.1 or later\n"); + buffer.append("Compiled file=htmlhelp.chm\n"); + buffer.append("Contents file="); + buffer.append(outName); + buffer.append("toc.hhc\n"); + buffer.append("Default Window=Main\n"); + buffer.append("Default topic="); + buffer.append(outName); + buffer.append("index.html\n"); + buffer.append("Display compile progress=Yes\n"); + buffer.append("Full-text search=Yes\n"); + buffer.append("Language="); + buffer.append(LocaleToLCID.convert(language)); + buffer.append("\nTitle="); + buffer.append(bookTitle); + buffer.append("\nEnhanced decompilation=No\n\n"); + buffer.append("[WINDOWS]\n"); + buffer.append("Main=\""); + buffer.append(bookTitle); + buffer.append("\",\","); + buffer.append(outName); + buffer.append("toc.hhc\",,\""); + buffer.append(outName); + buffer.append("index.html\",\""); + buffer.append(outName); + buffer.append("index.html\",,,,,0x2520,,0x603006,,,,,,,,0\n\n[FILES]\n"); + for (String s : filesList) { + buffer.append(outName); + buffer.append(s); + buffer.append("\n"); + } + } + + /** + * {@inheritDoc} + */ + protected String makeRemoteLink(String link) { + return docWebsite + link; + } + + private void convertTreeId(HTMLDocbookLinkResolver.TreeId leaf, Appendable buffer) throws IOException { + if (leaf.children != null) { + for (HTMLDocbookLinkResolver.TreeId c : leaf.children) { + buffer.append("<LI><OBJECT type=\"text/sitemap\">\n<param name=\"Name\" value=\""); + buffer.append(tocitem.get(c.id)); + buffer.append("\">\n<param name=\"Local\" value=\""); + buffer.append(outName); + buffer.append(mapId.get(c.id)); + buffer.append("\">\n</OBJECT>\n</LI>\n"); + if (c.children != null) { + buffer.append("<UL>\n"); + convertTreeId(c, buffer); + buffer.append("</UL>\n"); + } + } + } + } + + private void convertTree(Appendable buffer) throws IOException { + buffer.append("<HTML>\n<HEAD>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n</HEAD>\n<BODY>\n<OBJECT type=\"text/site properties\">\n<param name=\"ImageType\" value=\"Folder\">\n</OBJECT>\n"); + buffer.append("<UL>\n<LI><OBJECT type=\"text/sitemap\">\n<param name=\"Name\" value=\""); + buffer.append(bookTitle); + buffer.append("\">\n<param name=\"Local\" value=\""); + buffer.append(outName); + buffer.append("index.html\">\n</OBJECT>\n</LI>\n<UL>\n"); + convertTreeId(tree, buffer); + buffer.append("</UL>\n</UL>\n</BODY>\n</HTML>"); + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/ContainerConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/ContainerConverter.java new file mode 100755 index 000000000..2a80dfb4c --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/ContainerConverter.java @@ -0,0 +1,34 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises - Clement DAVID + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +/** + * Common class for container only converters + */ +public abstract class ContainerConverter implements Converter { + protected final String outputDirectory; + protected final String language; + + public ContainerConverter(String outputDirectory, String language) { + this.outputDirectory = outputDirectory; + this.language = language; + } + + /* + * Empty method declaration for optional ones + */ + + @Override + public void registerAllExternalXMLHandlers() { + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/Converter.java b/modules/helptools/src/java/org/scilab/modules/helptools/Converter.java new file mode 100755 index 000000000..c98b0fa2c --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/Converter.java @@ -0,0 +1,39 @@ +package org.scilab.modules.helptools; + +import java.io.IOException; + +import org.xml.sax.SAXException; + +public interface Converter { + + /** + * List all supported Converters backends for doc generation + */ + public static enum Backend { + /* Docbook converters */ + JAVAHELP, + HTML, + WEB, + CHM, + FO, + /* Containers */ + JAR_ONLY, + PDF, + PS + } + + /** + * Register all the converter related external xml handlers + */ + void registerAllExternalXMLHandlers(); + + /** + * Convert the document + */ + void convert() throws SAXException, IOException; + + /** + * Install converted files and other data to the target directory + */ + void install() throws IOException; +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java b/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java new file mode 100755 index 000000000..a6ab1a953 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java @@ -0,0 +1,937 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Hussein SHAFIE + * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ +package org.scilab.modules.helptools; + +import java.io.IOException; +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.net.URISyntaxException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Map; +import java.util.Iterator; +import java.util.HashMap; +import java.util.ArrayList; +import java.util.zip.GZIPInputStream; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; +import org.xml.sax.SAXParseException; +import org.xml.sax.SAXException; +import org.xml.sax.Locator; +import org.xml.sax.Attributes; +import org.xml.sax.helpers.DefaultHandler; + +import org.apache.batik.transcoder.TranscoderException; +import org.apache.batik.transcoder.ErrorHandler; +import org.apache.batik.transcoder.TranscoderInput; +import org.apache.batik.transcoder.TranscoderOutput; +import org.apache.batik.transcoder.Transcoder; +import org.apache.batik.transcoder.XMLAbstractTranscoder; +import org.apache.batik.transcoder.image.ImageTranscoder; +import org.apache.batik.transcoder.image.PNGTranscoder; + +import net.sourceforge.jeuclid.context.Parameter; +import net.sourceforge.jeuclid.MutableLayoutContext; +import net.sourceforge.jeuclid.context.LayoutContextImpl; +import net.sourceforge.jeuclid.converter.Converter; + +import org.scilab.forge.jlatexmath.TeXConstants; +import org.scilab.forge.jlatexmath.TeXFormula; +import org.scilab.forge.jlatexmath.ParseException; +import java.awt.Color; + +/** + * Preprocess before building the documentation + */ +public class CopyConvert extends DefaultHandler implements ErrorHandler { + + private static final String MATHML_NS = + "http://www.w3.org/1998/Math/MathML"; + + /** + * The tmp directory + */ + public static final File TMPDIR = new File(System.getenv("TMPDIR")); + + private boolean verbose; + private String printFormat; + + private File outDir; + private PrintWriter out; + private SAXParser parser; + private Locator locator; + + private ArrayList<String[]> inScopePrefixes; + private PrintWriter mainOut; + private int graphicsCounter; + private int embeddedGraphicsIsMathML; + + private int initTeX; + private File latex; + private File dvips; + private File gs; + private File ps2pdf; + + private LaTeXElement latexElem; + private boolean isLatexConverted = true; + + /** + * Enables the verbose mode + * + * @param verbose true if enable + */ + public void setVerbose(boolean verbose) { + this.verbose = verbose; + } + + /** + * Set the print format + * + * @param printFormat The print format + */ + public void setPrintFormat(String printFormat) { + this.printFormat = printFormat; + } + + + + /** + * Set if the LaTeX label are converted in PNG or not to use with + * the jlatexmath-fop plugin. + * @param isLatexConverted true if LaTeX label are converted in PNG + */ + public void setLatexConverted(boolean isLatexConverted) { + this.isLatexConverted = isLatexConverted; + } + + // ----------------------------------------------------------------------- + + /** + * Run the copy/convert process + * + * @param inFile Input file + * @param outputFile Output file + */ + public void run(File inFile, File outputFile) + throws SAXParseException, SAXException, IOException { + File outFile = outputFile.getCanonicalFile(); + outDir = outFile.getParentFile(); + if (!outDir.isDirectory() && !outDir.mkdirs()) { + throw new IOException("Cannot create directory '" + outDir + "'"); + } + + try { + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setNamespaceAware(true); + // We need qNames and xmlns*. +// FIXME: xmlns:db prefix is not handled by the thirdparty's stylesheet (not the right version) +// factory.setFeature( +// "http://xml.org/sax/features/namespace-prefixes", true); + factory.setValidating(false); + //factory.setXIncludeAware(false); + + parser = factory.newSAXParser(); + } catch (Exception e) { + throw new SAXParseException( + "Cannot create a properly configured SAX parser: " + Helpers.reason(e), locator); + } + + inScopePrefixes = new ArrayList<String[]>(); + mainOut = null; + graphicsCounter = 0; + embeddedGraphicsIsMathML = -1; + initTeX = -1; + + out = new PrintWriter( + new OutputStreamWriter(new FileOutputStream(outFile), "UTF-8")); + try { + parser.parse(inFile, this); + out.flush(); + if (out.checkError()) { + throw new IOException("Error writing '" + outFile + "'"); + } + } catch (SAXException e) { + if (locator != null) { + throw new SAXParseException("Cannot parse " + inFile + " " + Helpers.reason(e), locator); + } else { + throw new SAXException("Cannot parse " + inFile + " " + Helpers.reason(e)); + } + } finally { + out.close(); + } + } + + // ----------------------------------------------------------------------- + // ContentHandler + // ----------------------------------------------------------------------- + + /** + * Set the document Locator + * + * @param locator The locator + */ + public void setDocumentLocator(Locator locator) { + this.locator = locator; + } + + public void startDocument() throws SAXException { + out.write("<?xml version='1.0' encoding='UTF-8'?>\n"); + } + + public void endDocument() throws SAXException { + } + + + public void startPrefixMapping(String prefix, String uri) + throws SAXException { + inScopePrefixes.add(new String[] {prefix, uri }); + } + + public void endPrefixMapping(String prefix) + throws SAXException { + int count = inScopePrefixes.size(); + for (int i = count - 1; i >= 0; --i) { + String[] pair = inScopePrefixes.get(i); + if (pair[0].equals(prefix)) { + inScopePrefixes.remove(i); + break; + } + } + } + + public void startElement(String uri, String localName, String qName, + Attributes atts) + throws SAXException { + out.write('<'); + + if ("latex".equals(localName)) { + latexElem = new LaTeXElement(atts, isLatexConverted); + return; + } + + out.write(qName); + + boolean isImage = "imagedata".equals(localName); + boolean isGraphicsFile = false; + + int count = atts.getLength(); + for (int i = 0; i < count; ++i) { + String attValue = atts.getValue(i); + + if (isImage && "fileref".equals(atts.getLocalName(i))) { + isGraphicsFile = true; + + URL url = null; + + try { + URL base = new URL(locator.getSystemId()); + url = new URL(base, attValue); + } catch (MalformedURLException e) { + reportError("Malformed URL '" + attValue + "'"); + } + + if (url != null) { + File graphicsFile = null; + + try { + graphicsFile = new File(url.toURI()); + } catch (URISyntaxException e) { + reportError("Malformed URI '" + url + "'"); + } catch (IllegalArgumentException e) { + reportError("'" + url + "', not a 'file:' URL"); + } + + if (graphicsFile != null) { + String converted = + copyConvertGraphics(graphicsFile); + if (converted != null) { + // Substitute the basename of the converted file + // to attValue. + attValue = converted; + } + } + } + } + + out.write(' '); + out.write(atts.getQName(i)); + out.write("='"); + Helpers.escapeXML(attValue, out); + out.write('\''); + } + + if (mainOut != null) { + if (embeddedGraphicsIsMathML < 0) { + // Is embedded graphics SVG or MathML? + embeddedGraphicsIsMathML = MATHML_NS.equals(uri) ? 1 : 0; + } + + // Declare namespace prefixes in the extracted file. + declarePrefixes(atts); + } + + if (!isImage || isGraphicsFile) { + out.write('>'); + } else { + File extractedFile = + new File(outDir, "graphics-" + (++graphicsCounter) + ".tmp"); + try { + PrintWriter extracted = new PrintWriter( + new OutputStreamWriter(new FileOutputStream(extractedFile), + "UTF-8")); + + out.flush(); + mainOut = out; + + out = extracted; + out.write("<?xml version='1.0' encoding='UTF-8'?>\n"); + + embeddedGraphicsIsMathML = -1; + } catch (IOException e) { + reportError("Cannot create file '" + extractedFile + "': " + + Helpers.reason(e)); + // Keep embedded graphics. + out.write('>'); + } + } + } + + private void declarePrefixes(Attributes atts) { + HashMap<String, String> uniquePrefixes = new HashMap<String, String>(); + + int count = inScopePrefixes.size(); + for (int i = 0; i < count; ++i) { + String[] pair = inScopePrefixes.get(i); + + uniquePrefixes.put(pair[0], pair[1]); + } + + Iterator<Map.Entry<String, String>> iter = + uniquePrefixes.entrySet().iterator(); + while (iter.hasNext()) { + Map.Entry<String, String> e = iter.next(); + + String prefix = e.getKey(); + String namespace = e.getValue(); + + String xmlns; + if (prefix.length() == 0) { + xmlns = "xmlns"; + } else { + xmlns = "xmlns:" + prefix; + } + + if (atts.getValue(xmlns) == null) { // If not already declared. + out.write(' '); + out.write(xmlns); + out.write("='"); + Helpers.escapeXML(namespace, out); + out.write('\''); + } + } + } + + public void endElement(String uri, String localName, String qName) + throws SAXException { + if ("latex".equals(localName)) { + latexElem.generate(locator); + latexElem = null; + return; + } + + if ("imagedata".equals(localName) && mainOut != null) { + String rootName = "graphics-" + graphicsCounter; + String baseName = rootName + ".tmp"; + File extractedFile = new File(outDir, baseName); + + out.flush(); + if (out.checkError()) { + reportError("Error writing '" + extractedFile + "'"); + out.close(); + extractedFile = null; + } else { + out.close(); // Close now otherwise rename fails on Windows + + File extractedFile2 = new File( + outDir, + rootName + ((embeddedGraphicsIsMathML == 1) ? ".mml" : ".svg")); + if (!extractedFile.renameTo(extractedFile2)) { + reportError("Cannot rename '" + extractedFile + "' to '" + + extractedFile2 + "'"); + extractedFile = null; + } else { + extractedFile = extractedFile2; + } + } + + out = mainOut; + mainOut = null; + + if (extractedFile != null) { + reportInfo("Extracted embedded graphics from '" + extractedFile + "' to '" + extractedFile + "'."); + + String converted = copyConvertGraphics(extractedFile); + if (converted != null) { + baseName = converted; + + if (!extractedFile.delete()) { + reportError("Cannot delete '" + extractedFile + "'"); + } + } + } + + out.write(" fileref='"); + Helpers.escapeXML(baseName, out); + out.write("'/>"); + } else { + out.write("</"); + out.write(qName); + out.write('>'); + } + } + + public void characters(char[] ch, int start, int length) + throws SAXException { + if (latexElem != null) { + latexElem.setLaTeX(new String(ch, start, length)); + return; + } + + Helpers.escapeXML(ch, start, length, out); + } + + public void processingInstruction(String target, String data) + throws SAXException { + // The DocBook XSL style sheets make use of processing-instructions. + out.write("<?"); + out.write(target); + out.write(' '); + out.write(data); + out.write("?>"); + } + + public void ignorableWhitespace(char[] ch, int start, int length) + throws SAXException { } + + public void skippedEntity(String name) + throws SAXException { } + + // ----------------------------------------------------------------------- + // Copy & convert graphics file + // ----------------------------------------------------------------------- + + private String copyConvertGraphics(File graphicsFile) { + if (!graphicsFile.isFile()) { + reportError("'" + graphicsFile + "' not found"); + return null; + } + + String baseName = graphicsFile.getName(); + String rootName = Helpers.setFileExtension(baseName, null); + String ext = Helpers.getFileExtension(baseName); + + if ("tex".equalsIgnoreCase(ext)) { + if ("ps".equalsIgnoreCase(printFormat)) { + baseName = rootName + "_tex.eps"; + } else if ("pdf".equalsIgnoreCase(printFormat)) { + baseName = rootName + "_tex.pdf"; + } else { + baseName = rootName + "_tex.png"; + } + File convertedFile = new File(outDir, baseName); + + if (!convertedFile.exists() || convertedFile.lastModified() < graphicsFile.lastModified()) { + reportInfo("Converting TeX '" + graphicsFile + "' to '" + + convertedFile + "'..."); + + if (!convertTeX(graphicsFile, convertedFile)) { + baseName = null; + } + } + } else if ("mml".equalsIgnoreCase(ext)) { + baseName = rootName + "_mml.png"; + File convertedFile = new File(outDir, baseName); + + if (!convertedFile.exists() || convertedFile.lastModified() < graphicsFile.lastModified()) { + reportInfo("Converting MathML '" + graphicsFile + "' to '" + + convertedFile + "'..."); + + if (!convertMathML(graphicsFile, convertedFile)) { + baseName = null; + } + } + } else if ("svg".equalsIgnoreCase(ext) || "svgz".equalsIgnoreCase(ext)) { + baseName = rootName + "_svg.png"; + File convertedFile = new File(outDir, baseName); + + if (!convertedFile.exists() || convertedFile.lastModified() < graphicsFile.lastModified()) { + reportInfo("Converting SVG '" + graphicsFile + "' to '" + + convertedFile + "'..."); + + if (!convertSVG("svgz".equalsIgnoreCase(ext), graphicsFile, convertedFile)) { + baseName = null; + } + } + } else { + // Just copy the file --- + + File outFile = new File(outDir, baseName); + if (!outFile.exists() || outFile.lastModified() < graphicsFile.lastModified()) { + reportInfo("Copying '" + graphicsFile + "' to '" + + outFile + "'..."); + + try { + Helpers.copyFile(graphicsFile, outFile); + } catch (IOException e) { + reportError("Cannot copy '" + graphicsFile + "' to '" + + outFile + "': " + Helpers.reason(e)); + } + } + } + + return baseName; + } + + private boolean convertTeX(File inFile, File outFile) { + if (!initTeX()) { + return false; + } + + try { + doConvertTeX(inFile, outFile); + return true; + } catch (Exception e) { + reportError("Cannot convert '" + inFile + "' to '" + + outFile + "': " + Helpers.reason(e)); + return false; + } + } + + private boolean initTeX() { + if (initTeX == -1) { + latex = Helpers.findInPath("latex"); + if (latex == null) { + reportError("Don't find executable 'latex' in PATH"); + } + + dvips = Helpers.findInPath("dvips"); + if (dvips == null) { + reportError("Don't find executable 'dvips' in PATH"); + } + + String appName = Helpers.IS_WINDOWS ? "gswin32c" : "gs"; + gs = Helpers.findInPath(appName); + if (gs == null) { + reportError("Don't find executable '" + appName + "' in PATH"); + } + + ps2pdf = Helpers.findInPath("ps2pdf"); + if (ps2pdf == null) { + reportError("Don't find executable 'ps2pdf' in PATH"); + } + + if (latex == null || dvips == null || gs == null || ps2pdf == null) { + initTeX = 0; + } else { + initTeX = 1; + } + } + return (initTeX == 1); + } + + private void doConvertTeX(File inFile, File outFile) + throws IOException, InterruptedException { + File latexFile = wrapTeX(inFile); + + File tmpDir = latexFile.getParentFile(); + + String latexBaseName = latexFile.getName(); + String latexRootName = Helpers.setFileExtension(latexBaseName, null); + + File auxFile = new File(tmpDir, latexRootName + ".aux"); + File logFile = new File(tmpDir, latexRootName + ".log"); + File dviFile = new File(tmpDir, latexRootName + ".dvi"); + File epsFile = new File(tmpDir, latexRootName + ".eps"); + + try { + StringBuilder cmd = new StringBuilder(); + cmd.append('\"'); + cmd.append(latex); + cmd.append("\" --interaction batchmode "); + cmd.append(latexBaseName); + + shellExec(cmd.toString(), tmpDir); + + if (!dviFile.isFile()) { + throw new IOException("'" + inFile + "' has TeX errors"); + } + + cmd = new StringBuilder(); + cmd.append('\"'); + cmd.append(dvips); + cmd.append("\" -E -o \""); + cmd.append(epsFile); + cmd.append("\" \""); + cmd.append(dviFile); + cmd.append("\""); + + shellExec(cmd.toString(), tmpDir); + + if ("ps".equalsIgnoreCase(printFormat)) { + Helpers.copyFile(epsFile, outFile); + } else if ("pdf".equalsIgnoreCase(printFormat)) { + cmd = new StringBuilder(); + cmd.append('\"'); + cmd.append(ps2pdf); + cmd.append("\" -dEPSCrop \""); + cmd.append(epsFile); + cmd.append("\" \""); + cmd.append(outFile); + cmd.append("\""); + + shellExec(cmd.toString(), tmpDir); + } else { + cmd = new StringBuilder(); + cmd.append('\"'); + cmd.append(gs); + cmd.append("\" -q -dBATCH -dNOPAUSE -sDEVICE=png16m"); + cmd.append(" -r96 -dTextAlphaBits=4 -dGraphicsAlphaBits=4"); + cmd.append(" -dEPSCrop \"-sOutputFile="); + cmd.append(outFile); + cmd.append("\" \""); + cmd.append(epsFile); + cmd.append("\""); + + shellExec(cmd.toString(), tmpDir); + } + } finally { + // Delete all temporary files --- + latexFile.delete(); + if (auxFile.isFile()) { + auxFile.delete(); + } + if (logFile.isFile()) { + logFile.delete(); + } + if (dviFile.isFile()) { + dviFile.delete(); + } + if (epsFile.isFile()) { + epsFile.delete(); + } + } + } + + private File wrapTeX(File inFile) + throws IOException { + String tex = Helpers.loadString(inFile, "ISO-8859-1"); + + File latexFile = File.createTempFile("CopyConvert", ".tex", TMPDIR); + + StringBuilder buffer = new StringBuilder(); + buffer.append("\\documentclass[12pt]{article}\n"); + buffer.append("\\usepackage[latin1]{inputenc}\n"); + buffer.append("\\pagestyle{empty}\n"); + buffer.append("\\begin{document}\n"); + buffer.append(tex); + buffer.append('\n'); + buffer.append("\\end{document}\n"); + + Helpers.saveString(buffer.toString(), latexFile, "ISO-8859-1"); + + return latexFile; + } + + private void shellExec(String command, File workDir) + throws IOException, InterruptedException { + int status = + Helpers.shellExec(command, /*envp*/ null, workDir, verbose); + if (status != 0) { + throw new RuntimeException("command '" + command + + "' has exited with non-zero status " + + status); + } + } + + private boolean convertMathML(File inFile, File outFile) { + MutableLayoutContext context = new LayoutContextImpl(LayoutContextImpl + .getDefaultLayoutContext()); + context.setParameter(Parameter.ANTIALIAS, "true"); + // Workaround a XEP problem. FOP 1 is OK. + context.setParameter(Parameter.MATHBACKGROUND, "#FFFFFF"); + context.setParameter(Parameter.MATHSIZE, "18"); + + try { + Converter.getInstance().convert(inFile, outFile, "image/png", context); + + return true; + } catch (IOException e) { + reportError("Cannot convert '" + inFile + "' to '" + outFile + "': " + Helpers.reason(e)); + return false; + } + } + + private boolean convertSVG(boolean gunzip, File inFile, File outFile) { + Transcoder transcoder = new PNGTranscoder(); + transcoder.addTranscodingHint( + ImageTranscoder.KEY_FORCE_TRANSPARENT_WHITE, + Boolean.TRUE); + + try { + InputStream in = new FileInputStream(inFile); + if (gunzip) { + in = new GZIPInputStream(in); + } + + try { + TranscoderInput input = new TranscoderInput(in); + input.setURI(inFile.toURI().toASCIIString()); + + // Failing to do so causes Batik to report this error: SAX2 + // driver class org.apache.xerces.parsers.SAXParser not found + // which is normal because we don't want to bundle a copy of + // Xerces. + + transcoder.addTranscodingHint( + XMLAbstractTranscoder.KEY_XML_PARSER_CLASSNAME, + parser.getXMLReader().getClass().getName()); + transcoder.addTranscodingHint( + XMLAbstractTranscoder.KEY_XML_PARSER_VALIDATING, + Boolean.FALSE); + + OutputStream outf = new FileOutputStream(outFile); + + try { + TranscoderOutput output = new TranscoderOutput(outf); + transcoder.transcode(input, output); + outf.flush(); + } finally { + outf.close(); + } + } finally { + in.close(); + } + return true; + } catch (Exception e) { + reportError("Cannot convert '" + inFile + "' to '" + + outFile + "': " + Helpers.reason(e)); + return false; + } + } + + // ----------------------------------- + // Batik's ErrorHandler + // ----------------------------------- + + public void warning(TranscoderException e) + throws TranscoderException { + String msg = "SVG transcoder warning: " + Helpers.reason(e); + reportWarning(msg); + } + + public void error(TranscoderException e) + throws TranscoderException { + String msg = "SVG transcoder error: " + Helpers.reason(e); + reportError(msg); + } + + public void fatalError(TranscoderException e) + throws TranscoderException { + String msg = "SVG transcoder fatal error: " + Helpers.reason(e); + reportError(msg); + } + + // ----------------------------------------------------------------------- + // Utilities + // ----------------------------------------------------------------------- + + private void reportInfo(String message) { + if (verbose) { + System.out.println(message); + } + } + + private static void reportWarning(String message) { + System.err.println("warning: " + message); + } + + private static void reportError(String message) { + System.err.println("*** error: " + message); + } + + // ----------------------------------------------------------------------- + // Main + // ----------------------------------------------------------------------- + + public static int main(String[] args) { + boolean verbose = false; + String printFormat = null; + boolean usage = false; + int l = 0; + + for (; l < args.length; ++l) { + String arg = args[l]; + + if ("-v".equalsIgnoreCase(arg)) { + verbose = true; + } else if ("-ps".equalsIgnoreCase(arg)) { + printFormat = "ps"; + } else if ("-pdf".equalsIgnoreCase(arg)) { + printFormat = "pdf"; + } else { + if (arg.startsWith("-")) { + usage = true; + } + break; + } + } + + if (!usage && l + 2 != args.length) { + usage = true; + } + + if (usage) { + System.err.println( + "Usage: java org.scilab.modules.helptools.CopyConvert" + + " {-ps|-pdf}? {-v}? in_xml_file out_xml_file\n" + + "Creates out_xml_file as a ``flattened'' copy of\n" + + "in_xml_file.\n" + + "All graphics files referenced by <imagedata fileref='XXX'/>\n" + + "elements are copied, possibly after being converted to PNG,\n" + + "to the directory containing in_xml_file.\n" + + "(This directory is assumed to be a temporary \n" + + "working directory.)\n" + + "Options are:\n" + + " -ps Target format is PostScript rather than HTML.\n" + + " -pdf Target format is PDF rather than HTML.\n" + + " -v Verbose."); + return 1; + } + + File inFile = new File(args[l]); + File outFile = new File(args[l + 1]); + + CopyConvert copyConvert = new CopyConvert(); + copyConvert.verbose = verbose; + copyConvert.printFormat = printFormat; + + try { + copyConvert.run(inFile, outFile); + } catch (Exception e) { + reportError("Cannot copy/convert '" + inFile + "' to '" + outFile + + "': " + Helpers.reason(e)); + return 2; + } + return 0; + } + + protected class LaTeXElement { + int size = 18; + Color fg = null, bg = null; + int disp = TeXConstants.STYLE_DISPLAY; + String code = "mediaobject><imageobject><imagedata"; + String LaTeX = ""; + boolean exported; + String attribs, align = ""; + + protected LaTeXElement(Attributes attrs, boolean exported) { + this.exported = exported; + int n = attrs.getLength(); + String fgS = "", bgS = ""; + String dispS = "display"; + + for (int i = 0; i < n; i++) { + String attr = attrs.getValue(i); + String name = attrs.getLocalName(i); + if ("align".equals(name)) { + code += " align=\'" + attr + "\'"; + align = attr; + } else if ("style".equals(name)) { + if ("text".equals(attr)) { + disp = TeXConstants.STYLE_TEXT; + } else if ("script".equals(attr)) { + disp = TeXConstants.STYLE_SCRIPT; + } else if ("script_script".equals(attr)) { + disp = TeXConstants.STYLE_SCRIPT_SCRIPT; + } + dispS = attr; + } else if ("size".equals(name)) { + try { + size = Integer.parseInt(attr); + } catch (NumberFormatException e) { + size = 16; + } + } else if ("fg".equals(name)) { + fg = Color.decode(attr); + fgS = attr; + } else if ("bg".equals(name)) { + bg = Color.decode(attr); + bgS = attr; + } + } + + attribs = " align='" + align + "'"; + attribs += " size='" + size + "'"; + attribs += " style='" + dispS + "'"; + if (bg != null) { + attribs += " bg='" + bgS + "'"; + } + if (fg != null) { + attribs += " fg='" + fgS + "'"; + } + } + + protected void setLaTeX(String str) { + LaTeX += str; + } + + protected void generate(Locator loc) throws SAXParseException { + if (exported) { + generatePNG(loc); + return; + } + out.write("latex" + attribs + " xmlns=\"http://forge.scilab.org/p/jlatexmath\"><![CDATA[" + LaTeX + "]]></latex>"); + } + + protected void generatePNG(Locator loc) throws SAXParseException { + TeXFormula tf; + try { + tf = new TeXFormula(LaTeX); + } catch (ParseException e) { + throw new SAXParseException( + "\nThere was a problem in parsing the LaTeX' formula : \n" + + e.getMessage(), locator); + } + File f = new File(outDir, "graphics-" + (++graphicsCounter) + + "_latex.png"); + reportInfo("Converting LaTeX formula to " + f + "'..."); + tf.createPNG(disp, size, f.getPath(), bg, fg); + + String end = ""; + if (align.length() == 0) { + code = "inline" + code; + end = "inline"; + } + + out.write(code + " fileref='graphics-" + graphicsCounter + + "_latex.png'/>" + "</imageobject></" + end + + "mediaobject>"); + } + } + +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/DocbookElement.java b/modules/helptools/src/java/org/scilab/modules/helptools/DocbookElement.java new file mode 100755 index 000000000..2adec2bfb --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/DocbookElement.java @@ -0,0 +1,112 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.util.Map; + +public class DocbookElement { + + private Map<String, String> attributes; + private String name; + private StringBuilder contents; + private String uri; + + /** + * Default constructor + * @param name the tag name + * @param attributes the attributes and its values + */ + protected DocbookElement(String name, String uri, Map<String, String> attributes) { + this.name = name; + this.attributes = attributes; + this.uri = uri; + contents = new StringBuilder(); + } + + /** + * @return a new DocbookElement + */ + public DocbookElement getNewInstance(String name, String uri, Map<String, String> attributes) { + return new DocbookElement(name, uri, attributes); + } + + /** + * @return the tag name + */ + public String getName() { + return name; + } + + /** + * @return the tag uri + */ + public String getURI() { + return uri; + } + + /** + * @return the attributes + */ + public Map<String, String> getAttributes() { + return attributes; + } + + /** + * @return the buffer used to add contents of the tag + */ + public StringBuilder getStringBuilder() { + return contents; + } + + /** + * @param the buffer to use + */ + public void setStringBuilder(StringBuilder buf) { + contents = buf; + } + + /** + * This method can be used to store other things... + * and it should be override since it does nothing... + * I created it to handle the case where the converter has two String (or more) + * to generate with the same data. + * @param obj the Object to append. + */ + public void append(Object obj) { } + + /** + * This method can be used to get what it has been stored with append + * @return an object + */ + public Object get() { + return null; + } + + /** + * Add a parent to retrieve its contents + * @param elem the parent + */ + public void setParent(DocbookElement elem) { } + + /** + * @return the parent element + */ + public DocbookElement getParent() { + return null; + } + + @Override + public String toString() { + return "<" + name + ">:" + attributes; + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/DocbookTagConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/DocbookTagConverter.java new file mode 100755 index 000000000..be50ae1cf --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/DocbookTagConverter.java @@ -0,0 +1,665 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Stack; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.scilab.modules.commons.ScilabConstants; +import org.scilab.modules.helptools.external.ExternalXMLHandler; +import org.scilab.modules.helptools.image.Image; +import org.scilab.modules.helptools.image.ImageConverter; +import org.scilab.modules.helptools.image.LaTeXImageConverter; +import org.scilab.modules.helptools.image.MathMLImageConverter; +import org.scilab.modules.helptools.image.SVGImageConverter; +import org.scilab.modules.helptools.image.ScilabImageConverter; +import org.scilab.modules.helptools.image.XcosImageConverter; +import org.xml.sax.Attributes; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * Class the convert a DocBook xml file + * @author Calixte DENIZET + */ +public abstract class DocbookTagConverter extends DefaultHandler implements Converter { + + private static final String DOCBOOKURI = "http://docbook.org/ns/docbook"; + private static final Class<?>[] argsType = new Class[] {Map.class, String.class}; + protected static final String SCI = ScilabConstants.SCI.getPath(); + + private Map<String, Method> mapMeth = new HashMap<String, Method>(); + private Map<String, ExternalXMLHandler> externalHandlers = new HashMap<String, ExternalXMLHandler>(); + private List<DocbookTagConverter> converters; + private final ImageConverter imgConvert; + private final File in; + private DocbookElement baseElement = new DocbookElement(null, null, null); + private Stack<DocbookElement> stack = new Stack<DocbookElement>(); + private String errors = ""; + + /** + * True when an error is met during the parsing + */ + protected boolean hasError; + + /** + * The file which is parsed + */ + protected String currentFileName; + + /** + * The file which is parsed + */ + protected String currentBaseName; + + /** + * Useful to locate the errors + */ + protected Locator locator; + + /** + * Constructor + * @param in the input file path + */ + public DocbookTagConverter(String in, final ImageConverter imgConvert) throws IOException { + if (in != null && !in.isEmpty()) { + this.in = new File(in); + } else { + this.in = null; + } + + this.imgConvert = imgConvert; + imgConvert.registerExternalImageConverter(new LaTeXImageConverter(this)); + imgConvert.registerExternalImageConverter(new MathMLImageConverter(this)); + imgConvert.registerExternalImageConverter(new SVGImageConverter(this)); + imgConvert.registerExternalImageConverter(new ScilabImageConverter(this)); + imgConvert.registerExternalImageConverter(new XcosImageConverter(this)); + } + + /** + * Constructor + * @param in the inputstream + * @param inName the name of the input file + */ + public DocbookTagConverter(String inName, DocbookElement elem, final ImageConverter imgConvert) throws IOException { + this(inName, imgConvert); + baseElement = elem; + } + + public ImageConverter getImageConverter() { + return imgConvert; + } + + public String getBaseImagePath() { + return ""; + } + + /** + * Hook used by {@link ImageConverter}s to emit format specific code from any docbook image element + * @param code the code to translate + * @param fileName the filename + * @param attrs the attribute of the image + * @return a {@link Converter} specific code which embed the image and the source code + */ + public abstract String generateImageCode(String code, String fileName, Map<String, String> attrs); + + /** + * Hook used by {@link ImageConverter}s to emit format specific code from any docbook image element + * @param img image information + * @param fileName the filename + * @param attrs the attribute of the image + * @return a {@link Converter} specific code which embed the image and the source code + */ + public abstract String generateImageCode(Image img, String fileName, Map<String, String> attrs); + + /** + * Hook used by {@link ImageConverter}s to emit format specific code from any docbook image element + * @param fileName the filename + * @param attrs the attribute of the image + * @return a {@link Converter} specific code which embed the image and the source code + */ + public abstract String generateImageCode(String fileName, Map<String, String> attrs); + + /** + * Handle the tag + * @param tag the tag to handle + * @param attributes the attributes as a Map + * @param contents the contents between the matching tags + * @return the HTML code + * @throws UnhandledDocbookTagException if an handled tga is encountered + */ + public String handleDocbookTag(String tag, Map<String, String> attributes, String contents) throws SAXException { + if (tag != null && tag.length() > 0) { + Method method = mapMeth.get(tag); + if (method == null) { + String name = "handle" + Character.toString(Character.toUpperCase(tag.charAt(0))) + tag.substring(1); + try { + method = this.getClass().getMethod(name, argsType); + mapMeth.put(tag, method); + } catch (NoSuchMethodException e) { + throw new UnhandledDocbookTagException(tag); + } + } + try { + return (String) method.invoke(this, new Object[] {attributes, contents}); + } catch (IllegalAccessException e) { + throw new UnhandledDocbookTagException(tag); + } catch (InvocationTargetException e) { + throw new SAXException("Problem with tag " + tag + "\n" + e.getCause()); + } + } else { + throw new UnhandledDocbookTagException(tag); + } + } + + public String getCurrentFileName() { + return currentFileName; + } + + public String getCurrentBaseName() { + return currentBaseName; + } + + /** + * Register an Docbook tag converter. The aim is to parse the xml one time. + * @param c the converter to register + */ + public void registerConverter(DocbookTagConverter c) { + if (converters == null) { + converters = new ArrayList<DocbookTagConverter>(); + } + + converters.add(c); + c.setDocumentLocator(locator); + } + + /** + * @param c the converter to remove + */ + public void removeConverter(DocbookTagConverter c) { + if (converters != null) { + converters.remove(c); + } + } + + /** + * @return all the registered converters + */ + public DocbookTagConverter[] getConverters() { + if (converters == null) { + return null; + } + + return converters.toArray(new DocbookTagConverter[0]); + } + + /** + * Register an XMLHandler for external XML + * @param h the external XML handler + */ + protected void registerExternalXMLHandler(ExternalXMLHandler h) { + if (externalHandlers.get(h.getURI()) == null) { + externalHandlers.put(h.getURI(), h); + h.setConverter(this); + } + } + + /** + * Register all needed External XML Handler. + */ + @Override + public void registerAllExternalXMLHandlers() { + } + + /** + * Unregister all External XML Handler + */ + public void unregisterAllExternalXMLHandler() { + for (ExternalXMLHandler h : externalHandlers.values()) { + h.setConverter(null); + } + externalHandlers.clear(); + } + + /** + * @param tagName the tag name + * @return true if the contents of the tag must be escaped + */ + public boolean isEscapable(String tagName, String uri) { + return true; + } + + /** + * @param tagName the tag name + * @return true if the contents of the tag must be trimed + */ + public boolean isTrimable(String tagName) { + return true; + } + + /** + * @return the parent tag name + */ + public String getParentTagName() { + return stack.peek().getName(); + } + + /** + * @return the parent tag contents + */ + public String getParentContent() { + return stack.peek().getStringBuilder().toString(); + } + + /** + * Start the conversion + * @throws SAXException if a problem is encountered during the parsing + * @throws IOException if an IO problem is encountered + */ + public void convert() throws SAXException, IOException { + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setValidating(false); + factory.setNamespaceAware(true); + factory.setXIncludeAware(true); + + try { + factory.setFeature("http://xml.org/sax/features/namespace-prefixes", true); + SAXParser parser = factory.newSAXParser(); + // Must be uncommented to be able to read comments + //parser.setProperty("http://xml.org/sax/properties/lexical-handler", this); + parser.parse(in, this); + } catch (ParserConfigurationException e) { + exceptionOccurred(e); + } catch (SAXException e) { + System.err.println(e); + } catch (IOException e) { + System.err.println(e); + } + + if (hasError) { + throw new SAXException(errors); + } + } + + /** + * Install not converted files (templates, images) to the converted directory + */ + public void install() { + } + + /** + * {@inheritDoc} + */ + public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { + if (publicId != null) { + publicId = publicId.replaceAll(" ", "%20"); + } + if (systemId != null) { + systemId = systemId.replaceAll(" ", "%20"); + } + + currentFileName = systemId; + currentBaseName = new File(systemId).getName(); + + for (ExternalXMLHandler h : externalHandlers.values()) { + h.resetCompt(); + } + + if (converters != null) { + for (DocbookTagConverter conv : converters) { + conv.resolveEntity(publicId, systemId); + } + } + + return super.resolveEntity(publicId, systemId); + } + + /** + * {@inheritDoc} + */ + public void startDocument() throws SAXException { + stack.push(baseElement.getNewInstance(null, null, null)); + if (converters != null) { + for (DocbookTagConverter conv : converters) { + conv.startDocument(); + } + } + } + + /** + * {@inheritDoc} + */ + public void endDocument() throws SAXException { + stack.clear(); + + if (converters != null) { + for (DocbookTagConverter conv : converters) { + conv.endDocument(); + } + } + } + + /** + * {@inheritDoc} + */ + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + if (uri.equals(DOCBOOKURI)) { + int len = attributes.getLength(); + Map<String, String> map = new HashMap<String, String>(len); + for (int i = 0; i < len; i++) { + map.put(attributes.getLocalName(i), attributes.getValue(i)); + } + stack.push(baseElement.getNewInstance(localName, uri, map)); + } else { + ExternalXMLHandler h = externalHandlers.get(uri); + if (h == null) { + exceptionOccurred(new SAXException("uri " + uri + " not handled")); + return; + } + StringBuilder buf = h.startExternalXML(localName, attributes, locator); + if (buf != null) { + DocbookElement elem = baseElement.getNewInstance(localName, uri, null); + elem.setStringBuilder(buf); + stack.push(elem); + } + } + + if (converters != null) { + for (DocbookTagConverter conv : converters) { + conv.startElement(uri, localName, qName, attributes); + } + } + } + + /** + * {@inheritDoc} + */ + public void endElement(String uri, String localName, String qName) throws SAXException { + if (uri.equals(DOCBOOKURI)) { + DocbookElement elem = stack.pop(); + if (!elem.getName().equals(localName)) { + exceptionOccurred(new SAXException("tag " + elem.getName() + " is closed with tag " + localName)); + return; + } + try { + DocbookElement elemp = stack.peek(); + elemp.setParent(elem); + StringBuilder buf = elem.getStringBuilder(); + if (isTrimable(elem.getName())) { + buf = trim(buf); + } + String str = handleDocbookTag(elem.getName(), elem.getAttributes(), buf.toString()); + if (str != null) { + elemp.getStringBuilder().append(str); + } + } catch (SAXException e) { + exceptionOccurred(e); + return; + } + } else { + ExternalXMLHandler h = externalHandlers.get(uri); + if (h == null) { + exceptionOccurred(new SAXException("uri " + uri + " not handled")); + return; + } + String str = h.endExternalXML(localName); + if (str != null) { + stack.pop(); + stack.peek().getStringBuilder().append(str); + } + } + + if (converters != null) { + for (DocbookTagConverter conv : converters) { + conv.endElement(uri, localName, qName); + } + } + } + + /*public void comment(char[] ch, int start, int length) throws SAXException { + + }*/ + + /** + * {@inheritDoc} + */ + public void characters(char[] ch, int start, int length) throws SAXException { + int end = start + length; + + if (isEscapable(stack.peek().getName(), stack.peek().getURI())) { + StringBuilder buf = stack.peek().getStringBuilder(); + int save = start; + for (int i = start; i < end; i++) { + switch (ch[i]) { + case '\'' : + buf.append(ch, save, i - save); + buf.append("'"); + save = i + 1; + break; + case '\"' : + buf.append(ch, save, i - save); + buf.append("""); + save = i + 1; + break; + case '<' : + buf.append(ch, save, i - save); + buf.append("<"); + save = i + 1; + break; + case '>' : + buf.append(ch, save, i - save); + buf.append(">"); + save = i + 1; + break; + case '&' : + buf.append(ch, save, i - save); + buf.append("&"); + save = i + 1; + break; + default : + break; + } + } + + if (save < end) { + buf.append(ch, save, end - save); + } + } else { + stack.peek().getStringBuilder().append(ch, start, length); + } + + if (converters != null) { + for (DocbookTagConverter conv : converters) { + conv.characters(ch, start, length); + } + } + } + + /** + * {@inheritDoc} + */ + public void setDocumentLocator(Locator locator) { + this.locator = locator; + } + + /** + * @return the document locator + */ + public Locator getDocumentLocator() { + return locator; + } + + /** + * @return the used stack + */ + protected Stack<DocbookElement> getStack() { + return stack; + } + + /** + * Handle an exception depending on the presence of a locator + * @param e the exception to handle + * @throws SAXException if problem + */ + protected void fatalExceptionOccurred(Exception e) throws SAXException { + throw new SAXException(errors + "\nFATAL error:\n" + e.getMessage()); + } + + /** + * Handle an exception depending on the presence of a locator + * @param e the exception to handle + * @throws SAXException if problem + */ + protected void exceptionOccurred(Exception e) { + if (!hasError) { + hasError = true; + } + errors += makeErrorMessage(e); + } + + private String makeErrorMessage(Exception e) { + String sId = ""; + if (currentFileName != null) { + sId = "SystemID:" + currentFileName; + } + + String file; + try { + file = in.getCanonicalPath(); + } catch (IOException e1) { + e1.printStackTrace(); + file = null; + } + if (locator != null) { + return "\nCannot parse " + file + ":\n" + e.getMessage() + "\n" + sId + " at line " + locator.getLineNumber(); + } else { + return "\nCannot parse " + file + ":\n" + e.getMessage() + "\n" + sId; + } + } + + /** + * @param the StringBuilder to trim + * @return a trimed StringBuilder + */ + private static StringBuilder trim(StringBuilder buf) { + int i = 0; + int end = buf.length(); + char c; + for (; i < end; i++) { + c = buf.charAt(i); + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { + break; + } + } + buf.delete(0, i); + end = end - i; + for (i = end - 1; i >= 0; i--) { + c = buf.charAt(i); + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { + break; + } + } + buf.setLength(i + 1); + + return buf; + } + + /* + * All Handled tag method definition, these methods are the implementation of "Docbook 5.0 - subset Scilab" + */ + + public abstract String handleAnswer(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleBibliomixed(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleBibliomset(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleBook(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleCaption(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleCaution(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleChapter(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleCode(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleCommand(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleConstant(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleEmphasis(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleFirstname(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleFunction(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleImagedata(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleImageobject(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleImportant(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleInfo(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleInformalequation(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleInformaltable(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleInlinemediaobject(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleItemizedlist(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleLatex(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleLink(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleListitem(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleLiteral(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleMediaobject(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleMember(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleNote(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleOption(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleOrderedlist(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handlePara(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handlePart(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleProgramlisting(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handlePubdate(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleQandaentry(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleQandaset(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleQuestion(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRefentry(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRefnamediv(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRefname(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRefpurpose(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRefsection(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRefsynopsisdiv(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleReplaceable(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRevdescription(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRevhistory(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRevision(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRevnumber(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleRevremark(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleScreen(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleScreenshot(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleSection(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleSimplelist(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleSubscript(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleSuperscript(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleSurname(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleSynopsis(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleTable(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleTbody(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleTd(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleTerm(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleTh(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleTip(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleTitle(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleTr(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleUlink(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleVariablelist(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleVarlistentry(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleVarname(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleWarning(final Map<String, String> attributes, final String contents) throws SAXException; + public abstract String handleXref(final Map<String, String> attributes, final String contents) throws SAXException; +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/FODocbookTagConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/FODocbookTagConverter.java new file mode 100755 index 000000000..9abbbfffd --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/FODocbookTagConverter.java @@ -0,0 +1,202 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2013 - Scilab Enterprises - Clement DAVID + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; + +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerFactoryConfigurationError; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.scilab.modules.helptools.image.ImageConverter; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +/** + * Implement a docbook to fo converter. + * + * FIXME: Currently it use an externel xsl stylesheet to convert the tag. It should implement the Scilab subset by extending {@link DocbookTagConverter}. + */ +public class FODocbookTagConverter implements Converter { + + private static final String SCI = System.getenv("SCI"); + public static final boolean IS_WINDOWS = (File.pathSeparatorChar == ';'); + private static final String CANNOT_COPY_CONVERT = "Cannot copy/convert '"; + private static final String TO_WITH_QUOTES = "' to '"; + private static final String COLON_WITH_QUOTES = "': "; + + private final String inName; + private final SciDocMain sciDocMain; + + private final File docbookPath; + private final File styleDoc; + + public FODocbookTagConverter(String inName, SciDocMain sciDocMain, final ImageConverter imgConvert) throws IOException { + + this.inName = inName; + this.sciDocMain = sciDocMain; + + String localDocbookPath = System.getenv("DOCBOOK_ROOT"); + if (localDocbookPath == null) { + localDocbookPath = SCI + "/thirdparty/docbook"; + } + docbookPath = new File(localDocbookPath); + if (!docbookPath.isDirectory()) { + throw new FileNotFoundException("Could not find variable DOCBOOK_ROOT defining Docbook root directory"); + } + + styleDoc = new File(new File(docbookPath, "fo"), "docbook.xsl"); + if (!styleDoc.isFile()) { + throw new FileNotFoundException("Could not find " + styleDoc); + } + } + + @Override + public void registerAllExternalXMLHandlers() { + } + + @Override + public void convert() throws SAXException, IOException { + final File processedStyle = generateExtendedStyle(); + + final File sourceDocProcessed = preProcessMaster(inName); + if (!sourceDocProcessed.isFile()) { + throw new FileNotFoundException("Unable to parse generated master file : " + inName + " ."); + } + + final StreamResult outputTarget = new StreamResult(new File(Helpers.getTemporaryNameFo(sciDocMain.getOutputDirectory()))); + final StreamSource xmlSource = new StreamSource(sourceDocProcessed); + + /* + * We rely on the saxon implementation to compile xsl files (the default JVM implementation failed). + * + * Supported version : + * * Saxon-HE 9.5 (and may be 8.x too) which handle xinclude, XSLT-2 and has better performances + * * Saxon 6.5 if on the classpath + * * JVM Apache-xerces as a fallback but may probably fail to compile docbook.xsl + */ + TransformerFactory tfactory; + try { + tfactory = TransformerFactory.newInstance("net.sf.saxon.TransformerFactoryImpl", null); + } catch (TransformerFactoryConfigurationError e) { + // switch back to the default implementation which may be saxon 6.5 if found on the classpath or the JVM default implementation otherwise + tfactory = TransformerFactory.newInstance(); + } + + try { + final Transformer transform = tfactory.newTransformer(new StreamSource(processedStyle)); + + transform.setParameter("base.dir", sciDocMain.getOutputDirectory()); + + // FO specific parameters + transform.setParameter("use.extensions", "1"); + transform.setParameter("graphicsize.extension", "0"); + transform.setParameter("paper.type", "A4"); + transform.setParameter("generate.toc", "book toc,title,figure,table,example,equation part toc,title reference toc,title"); + transform.setParameter("toc.section.depth", "3"); + transform.setParameter("section.autolabel", "1"); + transform.setParameter("variablelist.as.blocks", "1"); + transform.setParameter("shade.verbatim", "1"); + transform.setParameter("img.src.path", sciDocMain.getOutputDirectory()); + + transform.transform(xmlSource, outputTarget); + + /* Delete the master temp file to avoid to be shipped with the rest */ + sourceDocProcessed.delete(); + processedStyle.delete(); + + } catch (TransformerException e) { + e.printStackTrace(); + } + + + } + + @Override + public void install() throws IOException { + + } + + /** + * Preprocess the extendedStyle.xsl file + * Basically, we load the xsl and replace STYLE_DOC by the actual path + * to the xsl file since docbook cannot replace env variables + * @return the path to the preprocessed file + */ + private File generateExtendedStyle() { + File mainStyleDoc = new File(SCI + "/modules/helptools/schema/extendedStyle.xsl"); + try { + String contentMainStyleDoc = Helpers.loadString(mainStyleDoc, "UTF-8"); + + /* STYLE_DOC is a predefined variable */ + contentMainStyleDoc = contentMainStyleDoc.replaceAll("STYLE_DOC", this.styleDoc.toURI().toString()); + + File temporaryStyleFile = File.createTempFile("style_", ".xsl"); + + Helpers.saveString(contentMainStyleDoc, temporaryStyleFile, "UTF-8"); + return temporaryStyleFile; + } catch (java.io.IOException e) { + System.err.println("Could not convert " + mainStyleDoc); + return null; + } + } + + /** + * Replace links by the contents of the XML files in the master + * @param masterXML name of the master file + * @param styleSheet CSS to be used + * @return the new master file + */ + private File preProcessMaster(String masterXML) { + + String filename = new File(masterXML).getName(); + /* Create the output file which will be created by copyconvert.run into the working directory */ + File masterXMLTransformed = new File(sciDocMain.getOutputDirectory() + + File.separator + filename.substring(0, filename.lastIndexOf(".")) + "-processed.xml"); + + CopyConvert copyConvert = new CopyConvert(); + copyConvert.setVerbose(true); + copyConvert.setPrintFormat(sciDocMain.getFormat().name()); + copyConvert.setLatexConverted(false); + + try { + copyConvert.run(new File(masterXML), masterXMLTransformed); + } catch (SAXParseException e) { + System.err.println(CANNOT_COPY_CONVERT + masterXML + TO_WITH_QUOTES + + masterXMLTransformed + COLON_WITH_QUOTES + Helpers.reason(e)); + System.err.println("Line: " + e.getLineNumber()); + System.err.println("Column: " + e.getColumnNumber()); + System.err.println("Public ID: " + e.getPublicId()); + System.err.println("System Id: " + e.getSystemId()); + return null; + } catch (SAXException e) { + System.err.println(CANNOT_COPY_CONVERT + masterXML + TO_WITH_QUOTES + + masterXMLTransformed + COLON_WITH_QUOTES + Helpers.reason(e)); + return null; + + } catch (IOException e) { + System.err.println(CANNOT_COPY_CONVERT + masterXML + TO_WITH_QUOTES + + masterXMLTransformed + COLON_WITH_QUOTES + Helpers.reason(e)); + return null; + } + + return masterXMLTransformed; + + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/FopConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/FopConverter.java new file mode 100755 index 000000000..c34f4aab0 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/FopConverter.java @@ -0,0 +1,105 @@ +package org.scilab.modules.helptools; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +import javax.xml.transform.Result; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FormattingResults; +import org.apache.fop.apps.MimeConstants; +import org.scilab.forge.jlatexmath.fop.JLaTeXMathElementMapping; +import org.scilab.forge.jlatexmath.fop.JLaTeXMathXMLHandler; +import org.scilab.modules.commons.xml.ScilabTransformerFactory; +import org.xml.sax.SAXException; + +public class FopConverter extends ContainerConverter { + + final Backend format; + + public FopConverter(SciDocMain sciDocMain) { + super(sciDocMain.getOutputDirectory(), sciDocMain.getLanguage()); + this.format = sciDocMain.getFormat(); + } + + @Override + public void convert() throws SAXException, IOException { + String baseName = Helpers.getBaseName(language); + /* the following '..' is used because we are in the current working + directory with all the tmp stuff in it */ + String fileName = outputDirectory + "/" + baseName + "." + format.name().toLowerCase(); + + try { + FopFactory fopFactory = FopFactory.newInstance(); + fopFactory.addElementMapping(new JLaTeXMathElementMapping()); + fopFactory.getXMLHandlerRegistry().addXMLHandler(new JLaTeXMathXMLHandler()); + fopFactory.setUserConfig(new File(System.getenv("SCI") + "/modules/helptools/etc/fopconf.xml")); + + // Step 3: Construct fop with desired output format + OutputStream out = new BufferedOutputStream(new FileOutputStream(fileName)); + final Fop fop; + switch (format) { + case PS: + fop = fopFactory.newFop(MimeConstants.MIME_POSTSCRIPT, out); + break; + case PDF: + fop = fopFactory.newFop(MimeConstants.MIME_POSTSCRIPT, out); + break; + + default: + out.close(); + throw new IOException(String.format("%s is not a supported format.\n", format)); + } + + // Step 4: Setup JAXP using identity transformer + String factoryName = ScilabTransformerFactory.useDefaultTransformerFactoryImpl(); + TransformerFactory factory = TransformerFactory.newInstance(); + Transformer transformer = factory.newTransformer(); // identity transformer + // Step 5: Setup input and output for XSLT transformation + // Setup input stream + Source src = new StreamSource(new File(Helpers.getTemporaryNameFo(outputDirectory))); + + // Resulting SAX events (the generated FO) must be piped through to FOP + Result res = new SAXResult(fop.getDefaultHandler()); + + // Step 6: Start XSLT transformation and FOP processing + transformer.transform(src, res); + ScilabTransformerFactory.restoreTransformerFactoryImpl(factoryName); + + FormattingResults foResults = fop.getResults(); + System.out.println("Generated " + foResults.getPageCount() + " pages in total."); + + //Clean-up + out.close(); + } catch (FOPException e) { + System.out.println(e.getLocalizedMessage()); + } catch (FileNotFoundException e) { + System.out.println(e.getLocalizedMessage()); + } catch (TransformerConfigurationException e) { + System.out.println(e.getLocalizedMessage()); + } catch (TransformerException e) { + System.out.println(e.getLocalizedMessage()); + } catch (IOException e) { + System.out.println(e.getLocalizedMessage()); + } catch (SAXException e) { + System.out.println(e.getLocalizedMessage()); + } + } + + @Override + public void install() throws IOException { + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/HTMLDocbookLinkResolver.java b/modules/helptools/src/java/org/scilab/modules/helptools/HTMLDocbookLinkResolver.java new file mode 100755 index 000000000..2ac556985 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/HTMLDocbookLinkResolver.java @@ -0,0 +1,368 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.io.IOException; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.Attributes; +import org.xml.sax.InputSource; +import org.xml.sax.Locator; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +import org.scilab.modules.commons.ScilabCommonsUtils; + +/** + * Class the convert a DocBook xml file + * @author Calixte DENIZET + */ +public class HTMLDocbookLinkResolver extends DefaultHandler { + + private static boolean isCaseInsensitiveOS = System.getProperty("os.name").toLowerCase().contains("windows"); + + private Map<String, String> mapId = new LinkedHashMap<String, String>(); + private List<String> listIdIgnoreCase = new ArrayList<String>(); + private Map<String, String> toc = new LinkedHashMap<String, String>(); + private Map<String, String> mapIdPurpose = new LinkedHashMap<String, String>(); + private Map<String, String> mapIdRefname = new LinkedHashMap<String, String>(); + private Map<String, TreeId> mapTreeId = new HashMap<String, TreeId>(); + private Map<String, String> mapIdDeclaringFile = new HashMap<String, String>(); + private TreeId tree = new TreeId(null, "root"); + + private TreeId currentLeaf = tree; + + private String current; + private String lastId; + private Locator locator; + private String currentFileName; + private boolean waitForRefname; + private boolean waitForRefpurpose; + private boolean waitForTitle; + private boolean getContents; + private boolean idInRefentry; + private final File in; + private StringBuilder buffer = new StringBuilder(256); + + /** + * Constructor + * @param in the input file path + */ + public HTMLDocbookLinkResolver(String in) throws IOException, SAXException { + this.in = new File(in); + resolvLinks(); + mapIdDeclaringFile = null; + } + + /** + * @return the map id + */ + public Map<String, String> getMapId() { + return mapId; + } + + /** + * @return the map id->title + */ + public Map<String, String> getMapIdPurpose() { + return mapIdPurpose; + } + + /** + * @return the map id->title + */ + public Map<String, String> getMapIdRefname() { + return mapIdRefname; + } + + /** + * @return the tocs + */ + public Map<String, String> getToc() { + return toc; + } + + /** + * @return the document tree + */ + public TreeId getTree() { + return tree; + } + + /** + * @return the document tree + */ + public Map<String, TreeId> getMapTreeId() { + return mapTreeId; + } + + /** + * {@inheritDoc} + */ + public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { + currentFileName = systemId; + return super.resolveEntity(publicId, systemId); + } + + /** + * {@inheritDoc} + */ + public void startDocument() throws SAXException { } + + /** + * {@inheritDoc} + */ + public void endDocument() throws SAXException { } + + /** + * {@inheritDoc} + */ + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + int len = attributes.getLength(); + String id = null; + for (int i = 0; i < len; i++) { + if (attributes.getLocalName(i).equals("id")) { + id = attributes.getValue(i); + break; + } + } + + if (localName.equals("refentry")) { + idInRefentry = false; + } + + if (localName.equals("title")) { + if (waitForTitle) { + getContents = true; + buffer.setLength(0); + } + } else if (localName.equals("refname")) { + if (waitForRefname) { + getContents = true; + buffer.setLength(0); + } + } else if (localName.equals("refpurpose")) { + if (waitForRefpurpose) { + getContents = true; + buffer.setLength(0); + } + } else if ((id != null && localName.equals("refentry")) || localName.equals("section") + || localName.equals("part") || localName.equals("chapter") || (!idInRefentry && localName.equals("refnamediv"))) { + if (id == null) { + throw new SAXException(errorMsg()); + } + current = makeFileName(id); + listIdIgnoreCase.add(id.toLowerCase()); + lastId = id; + if (mapIdDeclaringFile.containsKey(id)) { + String prev = mapIdDeclaringFile.get(id); + throw new SAXException("The id " + id + " in file " + currentFileName + " was previously declared in " + prev); + } else { + mapIdDeclaringFile.put(id, currentFileName); + } + mapId.put(id, current); + waitForTitle = localName.charAt(0) != 'r'; + waitForRefname = !waitForTitle; + idInRefentry = waitForRefname; + waitForRefpurpose = waitForRefname; + TreeId leaf = new TreeId(currentLeaf, id); + currentLeaf.add(leaf); + currentLeaf = leaf; + } else if (id != null && current != null) { + mapId.put(id, current + "#" + id); + } + } + + /** + * Make a file name which take into account that under Windows the file name + * is case insensitive and the xml:id is case sensitive. + * @param id the xml:id + * @return an unique file name + */ + public String makeFileName(String id) { + if (isCaseInsensitiveOS && listIdIgnoreCase.contains(id.toLowerCase())) { + return id + "-" + ScilabCommonsUtils.getMD5(id) + ".html"; + } + + return id + ".html"; + } + + /** + * {@inheritDoc} + */ + public void endElement(String uri, String localName, String qName) throws SAXException { + if (getContents) { + if (localName.equals("refpurpose")) { + mapIdPurpose.put(lastId, buffer.toString().trim()); + waitForRefpurpose = false; + getContents = false; + } else if (localName.equals("title") || localName.equals("refname")) { + toc.put(lastId, buffer.toString().trim()); + mapIdRefname.put(lastId, buffer.toString().trim()); + getContents = false; + waitForRefname = false; + waitForTitle = false; + } + } + if (localName.equals("refentry") || localName.equals("section") || localName.equals("part") || localName.equals("chapter")) { + currentLeaf = currentLeaf.parent; + } + } + + /** + * {@inheritDoc} + */ + public void setDocumentLocator(Locator locator) { + this.locator = locator; + } + + /** + * {@inheritDoc} + */ + public void characters(char[] ch, int start, int length) throws SAXException { + if (getContents) { + int end = start + length; + int save = start; + for (int i = start; i < end; i++) { + switch (ch[i]) { + case '\'' : + buffer.append(ch, save, i - save); + buffer.append("'"); + save = i + 1; + break; + case '\"' : + buffer.append(ch, save, i - save); + buffer.append("""); + save = i + 1; + break; + case '<' : + buffer.append(ch, save, i - save); + buffer.append("<"); + save = i + 1; + break; + case '>' : + buffer.append(ch, save, i - save); + buffer.append(">"); + save = i + 1; + break; + case '&' : + buffer.append(ch, save, i - save); + buffer.append("&"); + save = i + 1; + break; + default : + break; + } + } + + if (save < end) { + buffer.append(ch, save, end - save); + } + } + } + + /** + * Start the conversion + * @throws SAXException if a problem is encountered during the parsing + * @throws IOException if an IO problem is encountered + */ + protected void resolvLinks() throws SAXException, IOException { + SAXParserFactory factory = SAXParserFactory.newInstance(); + factory.setValidating(false); + factory.setNamespaceAware(true); + factory.setXIncludeAware(true); + + try { + SAXParser parser = factory.newSAXParser(); + parser.parse(in, this); + } catch (ParserConfigurationException e) { + System.err.println(e); + } + } + + /** + * @return the error message + */ + private String errorMsg() { + String str; + if (currentFileName != null) { + str = currentFileName; + } else { + try { + str = in.getCanonicalPath(); + } catch (IOException e) { + e.printStackTrace(); + str = null; + } + } + + return "No id attribute in <refentry> or <refnamediv> in file " + str + " at line " + locator.getLineNumber(); + } + + class TreeId { + + String id; + TreeId parent; + int pos; + List<TreeId> children; + + TreeId(TreeId parent, String id) { + this.parent = parent; + this.id = id; + if (parent == null) { + mapTreeId.clear(); + } + mapTreeId.put(id, this); + } + + void add(TreeId child) { + if (children == null) { + children = new ArrayList<TreeId>(); + } + child.pos = children.size(); + children.add(child); + } + + boolean isRoot() { + return parent == null; + } + + TreeId getPrevious() { + if (pos > 0) { + return parent.children.get(pos - 1); + } + return parent; + } + + TreeId getNext() { + TreeId l = this; + while (l.parent != null && l.pos == l.parent.children.size() - 1) { + l = l.parent; + } + + if (l.parent == null) { + return null; + } + return l.parent.children.get(l.pos + 1); + } + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/HTMLDocbookTagConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/HTMLDocbookTagConverter.java new file mode 100755 index 000000000..3fa6ba29d --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/HTMLDocbookTagConverter.java @@ -0,0 +1,1991 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.io.File; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Date; +import java.util.Map; +import java.util.Stack; +import java.util.regex.Pattern; + +import org.scilab.modules.commons.ScilabCommonsUtils; +import org.scilab.modules.helptools.XML.HTMLXMLCodeHandler; +import org.scilab.modules.helptools.XML.XMLLexer; +import org.scilab.modules.helptools.c.CLexer; +import org.scilab.modules.helptools.c.HTMLCCodeHandler; +import org.scilab.modules.helptools.external.HTMLMathMLHandler; +import org.scilab.modules.helptools.external.HTMLSVGHandler; +import org.scilab.modules.helptools.external.HTMLScilabHandler; +import org.scilab.modules.helptools.image.Image; +import org.scilab.modules.helptools.image.ImageConverter; +import org.scilab.modules.helptools.java.JavaLexer; +import org.scilab.modules.helptools.scilab.AbstractScilabCodeHandler; +import org.scilab.modules.helptools.scilab.HTMLScilabCodeHandler; +import org.scilab.modules.helptools.scilab.ScilabLexer; +import org.scilab.modules.localization.Messages; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + +/** + * Class to convert DocBook to HTML + * @author Calixte DENIZET + */ +public class HTMLDocbookTagConverter extends DocbookTagConverter implements TemplateFiller { + + public static enum GenerationType { WEB, JAVAHELP, CHM, HTML }; + + private static final String SCILAB_URI = "http://www.scilab.org"; + private static final String LATEXBASENAME = "_LaTeX_"; + private static final String VERSION = Messages.gettext("Version"); + private static final String DESCRIPTION = Messages.gettext("Description"); + + private final StringBuilder buffer = new StringBuilder(8192); + private int latexCompt = 1; + private boolean hasExamples; + private int warnings; + private int nbFiles; + + private final String imageDir; + protected String urlBase; + protected boolean linkToTheWeb; + protected final String outName; + protected String outImages; + + protected final Map<String, String> mapId; + protected final Map<String, String> tocitem; + protected final HTMLDocbookLinkResolver.TreeId tree; + protected final Map<String, HTMLDocbookLinkResolver.TreeId> mapTreeId; + protected final Map<String, String> mapIdPurpose; + protected final Map<String, String> mapIdRefname; + + protected final TemplateHandler templateHandler; + + protected final ScilabLexer scilabLexer; + protected final XMLLexer xmlLexer; + protected final CLexer cLexer; + protected final JavaLexer javaLexer; + + protected String bookTitle = ""; + protected String partTitle = ""; + protected String chapterTitle = ""; + protected String sectionTitle = ""; + protected String fileSubtitle = ""; + + protected String refpurpose = ""; + protected String refname = ""; + protected String version; + protected String appendToProgramListing; + protected String appendForExecToProgramListing; + protected String prependToProgramListing; + protected String currentId; + protected String indexFilename = "index" /*UUID.randomUUID().toString()*/ + ".html"; + protected final String language; + + protected final boolean isToolbox; + protected final Backend type; + + /** + * Constructor + * @param inName the name of the input stream + * @param sciDocMain provide useful doc generation properties + * @param imgConvert the shared image converter for all generation + */ + public HTMLDocbookTagConverter(String inName, SciDocMain sciDocMain, ImageConverter imgConvert) throws IOException, SAXException { + super(inName, imgConvert); + + this.version = sciDocMain.getConf().getVersion(); + this.imageDir = sciDocMain.getImagedir(); + this.outName = sciDocMain.getOutputDirectory() + File.separator; + this.outImages = this.outName; + + imgConvert.setDocbookTagConverter(this); + HTMLDocbookLinkResolver resolver = new HTMLDocbookLinkResolver(inName); + + mapId = resolver.getMapId(); + tocitem = resolver.getToc(); + tree = resolver.getTree(); + mapTreeId = resolver.getMapTreeId(); + mapIdPurpose = resolver.getMapIdPurpose(); + mapIdRefname = resolver.getMapIdRefname(); + + this.isToolbox = sciDocMain.isToolbox(); + this.language = sciDocMain.getLanguage(); + this.type = sciDocMain.getFormat(); + + if (isToolbox) { + urlBase = sciDocMain.getConf().getWebSiteURL() + language + "/"; + linkToTheWeb = true; + } else { + urlBase = null; + linkToTheWeb = false; + } + + if (isToolbox) {// we generate a toolbox's help + HTMLScilabCodeHandler.setLinkWriter(new AbstractScilabCodeHandler.LinkWriter() { + public String getLink(String id) { + if (id.length() > 0 && id.charAt(0) == '%') { + id = id.replace("%", "percent"); + } + String link = mapId.get(id); + if (link == null) { + return HTMLDocbookTagConverter.this.urlBase + id; + } else { + return link; + } + } + }); + } else {// we generate Scilab's help + HTMLScilabCodeHandler.setLinkWriter(new AbstractScilabCodeHandler.LinkWriter() { + public String getLink(String id) { + if (id.length() > 0 && id.charAt(0) == '%') { + id = id.replace("%", "percent"); + } + return mapId.get(id); + } + }); + } + + scilabLexer = new ScilabLexer(sciDocMain.getConf().getBuiltins(), sciDocMain.getConf().getMacros()); + xmlLexer = new XMLLexer(); + cLexer = new CLexer(); + javaLexer = new JavaLexer(); + + final String template = sciDocMain.getConf().getTemplate(sciDocMain.getFormat().toString().toLowerCase()); + File tpl = new File(template); + if (!tpl.isFile()) { + final String msg = "Could not find template document: " + template; + System.err.println(msg); + throw new RuntimeException(); + } + templateHandler = new TemplateHandler(this, tpl, language); + } + + public static boolean containsCJK(CharSequence seq) { + if (seq == null) { + return false; + } + + for (int i = 0; i < seq.length(); i++) { + Character.UnicodeBlock block = Character.UnicodeBlock.of(seq.charAt(i)); + if (block == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS + || block == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A + || block == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B + || block == Character.UnicodeBlock.CJK_COMPATIBILITY_FORMS + || block == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS + || block == Character.UnicodeBlock.CJK_RADICALS_SUPPLEMENT + || block == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION + || block == Character.UnicodeBlock.ENCLOSED_CJK_LETTERS_AND_MONTHS) { + return true; + } + } + + return false; + } + + public static boolean containsCyrillic(CharSequence seq) { + if (seq == null) { + return false; + } + + for (int i = 0; i < seq.length(); i++) { + Character.UnicodeBlock block = Character.UnicodeBlock.of(seq.charAt(i)); + if (block == Character.UnicodeBlock.CYRILLIC || block == Character.UnicodeBlock.CYRILLIC_SUPPLEMENTARY) { + return true; + } + } + + return false; + } + + /** + * Replace special chars + */ + public static final String replaceEntity(final String str) { + return str.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("\'", "'"); + } + + /** + * Get the type of the generation + * @return the generation type + */ + public final Backend getGenerationType() { + return type; + } + + public String getLanguage() { + return language; + } + + @Override + public void registerAllExternalXMLHandlers() { + super.registerAllExternalXMLHandlers(); + + registerExternalXMLHandler(new HTMLMathMLHandler(outImages, imageDir)); + registerExternalXMLHandler(new HTMLSVGHandler(outImages, imageDir)); + registerExternalXMLHandler(new HTMLScilabHandler(outImages, imageDir)); + } + + @Override + public void install() { + super.install(); + + ScilabCommonsUtils.copyFile(new File(SCI + "/modules/helptools/data/css/scilab_code.css"), new File(outName + "/scilab_code.css")); + ScilabCommonsUtils.copyFile(new File(SCI + "/modules/helptools/data/css/xml_code.css"), new File(outName + "/xml_code.css")); + ScilabCommonsUtils.copyFile(new File(SCI + "/modules/helptools/data/css/c_code.css"), new File(outName + "/c_code.css")); + ScilabCommonsUtils.copyFile(new File(SCI + "/modules/helptools/data/css/style.css"), new File(outName + "/style.css")); + } + + /** + * @return the buffer used + */ + public StringBuilder getBuffer() { + return buffer; + } + + /** + * @param tag the tag name + * @param contents the contents to enclose between opening and closing tags + */ + public String encloseContents(final String tag, final String contents) { + buffer.setLength(0); + buffer.append("<"); + buffer.append(tag); + buffer.append(">"); + if (contents != null) { + buffer.append(contents); + } + buffer.append("</"); + buffer.append(tag); + buffer.append(">"); + + return buffer.toString(); + } + + /** + * @param tag the tag name + * @param attrs the attributes {attr1, value1, attr2, value2, ...} + * @param contents the contents to enclose between opening and closing tags + */ + public String encloseContents(final String tag, final String[] attrs, final String contents) { + buffer.setLength(0); + buffer.append("<"); + buffer.append(tag); + if (attrs != null) { + for (int i = 0; i < attrs.length; i += 2) { + if (attrs[i + 1] != null && !attrs[i + 1].isEmpty()) { + buffer.append(" "); + buffer.append(attrs[i]); + buffer.append("=\""); + buffer.append(attrs[i + 1]); + buffer.append("\""); + } + } + } + + buffer.append(">"); + if (contents != null) { + buffer.append(contents); + } + buffer.append("</"); + buffer.append(tag); + buffer.append(">"); + + return buffer.toString(); + } + + /** + * @param tag the tag name + * @param clazz the css class name + * @param contents the contents to enclose between opening and closing tags + */ + public String encloseContents(final String tag, final String clazz, final String contents) { + buffer.setLength(0); + buffer.append("<"); + buffer.append(tag); + buffer.append(" class=\""); + buffer.append(clazz); + buffer.append("\">"); + if (contents != null) { + buffer.append(contents); + } + buffer.append("</"); + buffer.append(tag); + buffer.append(">"); + + return buffer.toString(); + } + + /** + * {@inheritDoc} + */ + public boolean isEscapable(final String tagName, final String uri) { + return !"latex".equals(tagName) && !"screen".equals(tagName) && !"programlisting".equals(tagName) && !"code".equals(tagName) && !"synopsis".equals(tagName) && !(uri.equals(SCILAB_URI) && tagName.equals("image")); + } + + /** + * {@inheritDoc} + */ + public boolean isTrimable(final String tagName) { + return !"screen".equals(tagName) && !"programlisting".equals(tagName) && !"code".equals(tagName) && !"synopsis".equals(tagName); + } + + /** + * @param fileName the file to create + * @param subtitle the subtitle of the file + * @param contents the contents of the file + */ + public void createHTMLFile(final String id, final String fileName, final String subtitle, final String contents) { + if (!hasError) { + fileSubtitle = subtitle; + nbFiles++; + templateHandler.generateFileFromTemplate(outName + fileName, id, contents); + } + } + + + + /** + * @param code the code to translate + * @param img image information + * @param fileName the filename + * @param attrs the attribute of the image + * @return the HTML code to insert the image + */ + public String generateCode(Image img, String fileName, Map<String, String> attrs, final String tooltipString) { + String style = attrs.get("style"); + String top = ""; + boolean display = style != null && style.equals("display"); + + if (!display) { + top = "top:" + img.descent + "px;"; + } + + String alignAttr = attrs.get("align"); + String align = ""; + String div = "div"; + if (alignAttr != null) { + align = " style=\'text-align:" + alignAttr + "\'"; + } else if (display) { + align = " style=\'text-align:center\'"; + } else { + div = "span"; + } + + return "<" + div + align + "><img src=\'" + fileName + "\' style=\'position:relative;" + top + "width:" + img.width + "px;height:" + img.height + "px\'/></" + div + ">"; + } + + /** + * {@inheritDoc} + */ + public String makeTitle(final String id) { + if (refname.length() > 0) { + return tocitem.get(id); + } + + return ""; + } + + /** + * {@inheritDoc} + */ + public String makeSubtitle(final String id) { + return fileSubtitle; + } + + /** + * {@inheritDoc} + */ + public String makePrevious(final String id) { + buffer.setLength(0); + buffer.append("<span class=\"previous\">"); + HTMLDocbookLinkResolver.TreeId leaf = mapTreeId.get(id); + if (leaf == null) { + return ""; + } + HTMLDocbookLinkResolver.TreeId prev = leaf.getPrevious(); + if (prev.parent != null) { + buffer.append("<a href=\""); + buffer.append(mapId.get(prev.id)); + buffer.append("\"><< "); + buffer.append(tocitem.get(prev.id)); + buffer.append("</a></span>\n"); + + return buffer.toString(); + } + + return ""; + } + + /** + * {@inheritDoc} + */ + public String makePath(final String id) { + buffer.setLength(0); + buffer.append("<span class=\"path\">"); + HTMLDocbookLinkResolver.TreeId leaf = mapTreeId.get(id); + if (leaf == null) { + return ""; + } + String str = tocitem.get(id); + leaf = leaf.parent; + while (leaf != null && !leaf.isRoot()) { + str = "<a href=\"" + mapId.get(leaf.id) + "\">" + tocitem.get(leaf.id) + "</a> > " + str; + leaf = leaf.parent; + } + + str = "<a href=\"" + indexFilename + "\">" + bookTitle + "</a> >> " + str; + buffer.append(str); + buffer.append("</span>\n"); + + return buffer.toString(); + } + + /** + * {@inheritDoc} + */ + public String makeTop(final String id) { + buffer.setLength(0); + buffer.append("<span class=\"top\">"); + HTMLDocbookLinkResolver.TreeId leaf = mapTreeId.get(id); + if (leaf == null) { + return ""; + } + + leaf = leaf.parent; + if (leaf != null) { + buffer.append("<a href=\""); + if (!leaf.isRoot()) { + buffer.append(mapId.get(leaf.id)); + buffer.append("\">"); + buffer.append(tocitem.get(leaf.id)); + } else { + buffer.append(indexFilename); + buffer.append("\">"); + buffer.append(bookTitle); + } + buffer.append("</a></span>\n"); + } else { + return ""; + } + + return buffer.toString(); + } + + /** + * {@inheritDoc} + */ + public String makeNext(final String id) { + buffer.setLength(0); + buffer.append("<span class=\"next\">"); + HTMLDocbookLinkResolver.TreeId leaf = mapTreeId.get(id); + if (leaf == null) { + return ""; + } + HTMLDocbookLinkResolver.TreeId next = leaf.getNext(); + if (next != null) { + buffer.append("<a href=\""); + buffer.append(mapId.get(next.id)); + buffer.append("\">"); + buffer.append(tocitem.get(next.id)); + buffer.append(" >></a></span>\n"); + + return buffer.toString(); + } + + return ""; + } + + /** + * {@inheritDoc} + */ + public String makeStart(final String id) { + buffer.setLength(0); + buffer.append("<span class=\"start\">"); + buffer.append("<a href=\""); + buffer.append(indexFilename); + buffer.append("\">"); + buffer.append(bookTitle); + buffer.append("</a></span>\n"); + + return buffer.toString(); + } + + /** + * {@inheritDoc} + */ + public String makeTocList(final String id) { + buffer.setLength(0); + HTMLDocbookLinkResolver.TreeId leaf = mapTreeId.get(id); + if (leaf == null) { + return ""; + } + + HTMLDocbookLinkResolver.TreeId parent = leaf.parent; + buffer.append("<ul class=\"toc\">\n"); + String str = ""; + while (parent != null && !parent.isRoot()) { + str = "<li class=\"parent\"><a href=\"" + mapId.get(parent.id) + "\">" + tocitem.get(parent.id) + "</a></li>\n" + str; + parent = parent.parent; + } + buffer.append("<li class=\"root\"><a href=\""); + buffer.append(indexFilename); + buffer.append("\">"); + buffer.append(bookTitle); + buffer.append("</a></li>\n"); + buffer.append(str); + + parent = leaf.parent; + + for (HTMLDocbookLinkResolver.TreeId c : parent.children) { + if (c == leaf) { + buffer.append("<li class=\"list-active\"><a href=\""); + } else { + buffer.append("<li><a href=\""); + } + buffer.append(mapId.get(c.id)); + buffer.append("\">"); + buffer.append(tocitem.get(c.id)); + buffer.append("</a></li>\n"); + } + buffer.append("</ul>\n"); + + return buffer.toString(); + } + + /** + * {@inheritDoc} + */ + public String makeLastModified(final String id) { + buffer.setLength(0); + try { + buffer.append("<span class=\"lastmodified\">"); + buffer.append(new Date(new File(new URI(currentFileName)).lastModified()).toString()); + buffer.append("</span>\n"); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + return buffer.toString(); + } + + /** + * {@inheritDoc} + */ + public String makeGenerationDate(final String id) { + buffer.setLength(0); + buffer.append("<span class=\"generationdate\">"); + buffer.append(new Date(System.currentTimeMillis()).toString()); + buffer.append("</span>\n"); + + return buffer.toString(); + } + + /** + * {@inheritDoc} + */ + public String makeVersion(final String id) { + buffer.setLength(0); + buffer.append("<span class=\"version\">"); + buffer.append(version); + buffer.append("</span>\n"); + + return buffer.toString(); + } + + private boolean isLinkedImage() { + Stack<DocbookElement> stack = getStack(); + return stack.size() >= 3 && stack.get(stack.size() - 3).getName().equals("link"); + } + + @Override + public String generateImageCode(String code, String fileName, Map<String, String> attrs) { + String alignAttr = attrs.get("align"); + boolean addDiv = getGenerationType() != Backend.JAVAHELP || !isLinkedImage(); + final StringBuilder buffer = new StringBuilder(128); + if (addDiv && alignAttr != null) { + buffer.append("<div style=\'text-align:").append(alignAttr).append("\'>"); + } + buffer.append("<img src=\'").append(fileName).append("\'/>"); + if (addDiv && alignAttr != null) { + buffer.append("</div>"); + } + + if (getGenerationType() == Backend.WEB) { + /* Prepare the code for the html inclusion */ + code = convertCode(code); + /* Provide a tooltip */ + return "<div rel='tooltip' title='" + code + "'>" + buffer.toString() + "</div>"; + } else { + /* No tooltip in the javahelp browser ... + * too limited html capabilities */ + return buffer.toString(); + } + } + + @Override + public String generateImageCode(Image img, String fileName, Map<String, String> attrs) { + String style = attrs.get("style"); + String top = ""; + boolean display = style != null && style.equals("display"); + + if (!display) { + top = "top:" + img.descent + "px;"; + } + + String alignAttr = attrs.get("align"); + String align = ""; + String div = "div"; + if (alignAttr != null) { + align = " style=\'text-align:" + alignAttr + "\'"; + } else if (display) { + align = " style=\'text-align:center\'"; + } else { + div = "span"; + } + + if (getGenerationType() == Backend.JAVAHELP && isLinkedImage()) { + // Java HTML renderer is not good... so when the image is linked, we remove the div + return "<img src=\'" + fileName + "\' style=\'position:relative;" + top + "width:" + img.width + "px;height:" + img.height + "px\'/>>"; + } else { + return "<" + div + align + "><img src=\'" + fileName + "\' style=\'position:relative;" + top + "width:" + img.width + "px;height:" + img.height + "px\'/></" + div + ">"; + } + } + + @Override + public String generateImageCode(String fileName, Map<String, String> attrs) { + String alignAttr = attrs.get("align"); + boolean addDiv = getGenerationType() != Backend.JAVAHELP || !isLinkedImage(); + final StringBuilder buffer = new StringBuilder(128); + if (addDiv && alignAttr != null) { + buffer.append("<div style=\'text-align:").append(alignAttr).append("\'>"); + } + buffer.append("<img src=\'").append(fileName).append("\'/>"); + if (addDiv && alignAttr != null) { + buffer.append("</div>"); + } + + return buffer.toString(); + } + + public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { + latexCompt = 1; + return super.resolveEntity(publicId, systemId); + } + + /** + * Handle a refentry + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRefentry(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + currentId = id; + } + String fileName = mapId.get(currentId); + String needsExampleAttr = attributes.get("needs-examples"); + createHTMLFile(currentId, fileName, refpurpose, contents); + if (!hasExamples && (needsExampleAttr == null || !needsExampleAttr.equals("no"))) { + warnings++; + //System.err.println("Warning (should be fixed): no example in " + currentFileName); + } else { + hasExamples = false; + } + String rp = encloseContents("span", "refentry-description", refpurpose); + String str = encloseContents("li", encloseContents("a", new String[] {"href", fileName, "class", "refentry"}, refname) + " — " + rp); + refpurpose = ""; + refname = ""; + currentId = null; + + return str; + } + + /** + * Handle a section + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleSection(final Map<String, String> attributes, final String contents) throws SAXException { + String fileName = attributes.get("id") + ".html"; + String str = encloseContents("ul", "list-refentry", contents); + String title = encloseContents("h3", "title-section", sectionTitle); + createHTMLFile(attributes.get("id"), fileName, sectionTitle, title + "\n" + str); + + str = encloseContents("li", encloseContents("a", new String[] {"href", fileName, "class", "section"}, sectionTitle) + "\n" + str); + sectionTitle = ""; + + return str; + } + + /** + * Handle a book + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleBook(final Map<String, String> attributes, final String contents) throws SAXException { + String str = encloseContents("ul", "list-part", contents); + String btitle; + if (bookTitle.trim().equalsIgnoreCase("Scilab")) { + btitle = version; + } else { + btitle = bookTitle; + } + String title = encloseContents("h3", "book-title", btitle); + createHTMLFile("index", indexFilename, btitle, title + "\n" + str); + + if (warnings != 0) { + System.err.println("Total files without example: " + warnings); + System.err.println("Total generated html files: " + nbFiles); + } + + return encloseContents("li", encloseContents("a", new String[] {"href", indexFilename, "class", "part"}, bookTitle) + "\n" + str); + } + + /** + * Handle a part + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handlePart(final Map<String, String> attributes, final String contents) throws SAXException { + String fileName = attributes.get("id") + ".html"; + String str = encloseContents("ul", "list-chapter", contents); + String title = encloseContents("h3", "title-part", partTitle); + createHTMLFile(attributes.get("id"), fileName, partTitle, title + "\n" + str); + str = encloseContents("li", encloseContents("a", new String[] {"href", fileName, "class", "part"}, partTitle) + "\n" + str); + partTitle = ""; + + return str; + } + + /** + * Handle a chapter + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleChapter(final Map<String, String> attributes, final String contents) throws SAXException { + String fileName = attributes.get("id") + ".html"; + String str = encloseContents("ul", "list-refentry", contents); + String title = encloseContents("h3", "title-chapter", chapterTitle); + createHTMLFile(attributes.get("id"), fileName, chapterTitle, title + "\n" + str); + + str = encloseContents("li", encloseContents("a", new String[] {"href", fileName, "class", "chapter"}, chapterTitle) + "\n" + str); + chapterTitle = ""; + + return str; + } + + // partiellement merdique car le style de title depend du noeud pere. + /** + * Handle a title + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleTitle(final Map<String, String> attributes, final String contents) throws SAXException { + String clazz = "title"; + String parent = getParentTagName(); + if (parent.equals("chapter")) { + chapterTitle = contents; + } else if (parent.equals("part")) { + partTitle = contents; + } else if (parent.equals("info")) { + bookTitle = contents; + } else if (parent.equals("section")) { + sectionTitle = contents; + } else if (parent.equals("refsection") && Pattern.matches("^[ \\t]*ex[ea]mpl[eo].*", contents.toLowerCase())) { + hasExamples = true; + return encloseContents("h3", clazz, contents); + } else { + return encloseContents("h3", clazz, contents); + } + + return null; + } + + /** + * Handle a para + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handlePara(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("p", "para", contents); + } + + /** + * Handle a literal + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleLiteral(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("code", "literal", contents); + } + + /** + * Handle a varname + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleVarname(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("code", "varname", contents); + } + + /** + * Handle a command + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleCommand(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("code", "command", contents); + } + + /** + * Handle a code + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleCode(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("code", "scilabcode", scilabLexer.convert(HTMLScilabCodeHandler.getInstance(refname, currentFileName), contents));//encloseContents("code", "code", contents); + } + + /** + * Handle a function + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleFunction(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("code", "function", contents); + } + + /** + * Handle a constant + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleConstant(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("code", "constant", contents); + } + + /** + * Handle an option + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleOption(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("code", "option", contents); + } + + /** + * Handle a refnamediv + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRefnamediv(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + currentId = id; + } + + return encloseContents("div", "refnamediv", contents); + } + + /** + * Handle a refname + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRefname(final Map<String, String> attributes, final String contents) throws SAXException { + refname = contents; + return encloseContents("h1", "refname", contents); + } + + /** + * Handle a refpurpose + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRefpurpose(final Map<String, String> attributes, final String contents) throws SAXException { + refpurpose = contents; + return encloseContents("p", "refpurpose", contents); + } + + /** + * Handle a refsynopsisdiv + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRefsynopsisdiv(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("div", "refsynopsisdiv", contents); + } else { + return encloseContents("div", "refsynopsisdiv", contents); + } + } + + /** + * Handle a synopsis + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleSynopsis(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String str = encloseContents("div", "synopsis", encloseContents("pre", SynopsisLexer.convert(refname, contents))); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + str; + } else { + return str; + } + } + + /** + * Handle a info + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleInfo(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("div", "info", contents); + } else { + return encloseContents("div", "info", contents); + } + } + + /** + * Handle a refsection + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRefsection(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("div", "refsection", contents); + } else { + return encloseContents("div", "refsection", contents); + } + } + + /** + * Handle a progamlisting + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleProgramlisting(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String role = attributes.get("role"); + String str; + if (role == null) { + String code = encloseContents("pre", "scilabcode", scilabLexer.convert(HTMLScilabCodeHandler.getInstance(refname, currentFileName), contents)); + if (prependToProgramListing != null) { + code = prependToProgramListing + code; + } + if (appendToProgramListing != null) { + code += appendToProgramListing; + } + str = encloseContents("div", "programlisting", code); + } else { + if (role.equals("xml")) { + str = encloseContents("div", "programlisting", encloseContents("pre", "xmlcode", xmlLexer.convert(HTMLXMLCodeHandler.getInstance(), contents))); + } else if (role.equals("c") || role.equals("cpp") || role.equals("code_gateway")) { + hasExamples = true; + str = encloseContents("div", "programlisting", encloseContents("pre", "ccode", cLexer.convert(HTMLCCodeHandler.getInstance(), contents))); + } else if (role.equals("java")) { + hasExamples = true; + str = encloseContents("div", "programlisting", encloseContents("pre", "ccode", javaLexer.convert(HTMLCCodeHandler.getInstance(), contents))); + } else if (role.equals("exec")) { + String code = encloseContents("pre", "scilabcode", scilabLexer.convert(HTMLScilabCodeHandler.getInstance(refname, currentFileName), contents)); + if (prependToProgramListing != null) { + code = prependToProgramListing + code; + } + if (appendForExecToProgramListing != null) { + code += appendForExecToProgramListing; + } + str = encloseContents("div", "programlisting", code); + } else if (role.equals("no-scilab-exec")) { + hasExamples = true; + String code = encloseContents("pre", "scilabcode", scilabLexer.convert(HTMLScilabCodeHandler.getInstance(refname, currentFileName), contents)); + str = encloseContents("div", "programlisting", code); + } else { + String code = encloseContents("pre", "scilabcode", scilabLexer.convert(HTMLScilabCodeHandler.getInstance(refname, currentFileName), contents)); + if (prependToProgramListing != null) { + code = prependToProgramListing + code; + } + if (appendToProgramListing != null) { + code += appendToProgramListing; + } + str = encloseContents("div", "programlisting", code); + } + } + if (id != null) { + return "<a name=\"" + id + "\"></a>" + str; + } else { + return str; + } + } + + /** + * Handle a screen + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleScreen(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String str = encloseContents("div", "screen", encloseContents("pre", contents)); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + str; + } else { + return str; + } + } + + /** + * Handle a pubdate + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handlePubdate(final Map<String, String> attributes, final String contents) throws SAXException { + return null; + } + + /** + * Handle a simplelist + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleSimplelist(final Map<String, String> attributes, final String contents) throws SAXException { + String style = "itemizedlist"; + + return encloseContents("ul", style, contents); + } + + /** + * Handle a member + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleMember(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("li", "member", contents); + } + + /** + * Handle a link + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleLink(final Map<String, String> attributes, final String contents) throws SAXException { + String link = attributes.get("linkend"); + if (link == null) { + throw new SAXException("No linkend attribute in tag link"); + } + + String type = attributes.get("type"); + String id; + if (type != null && type.equals("scilab")) { + if (this.type == Backend.JAVAHELP || this.type == Backend.HTML) { + id = resolvScilabLink(link); + } else { + return contents; + } + } else if (type != null && type.equals("remote")) { + id = makeRemoteLink(link); + } else { + id = mapId.get(link); + } + + if (id == null) { + if (isToolbox) { + if (this.type == Backend.HTML) { + id = urlBase + link; + if (linkToTheWeb) { + id += ".html"; + } + } + if (this.type == Backend.JAVAHELP) { + id = urlBase + link; + } + } else { + warnings++; + System.err.println("Warning (should be fixed): invalid internal link to " + link + " in " + currentFileName + "\nat line " + locator.getLineNumber()); + return null; + } + } + + Stack<DocbookElement> stack = getStack(); + String refnameTarget = mapIdRefname.get(link); + String str; + if (contents != null && !contents.isEmpty()) { + str = contents; + } else { + str = refnameTarget; + } + + if (str == null) { + warnings++; + System.err.println("Warning (should be fixed): empty link (no text will be printed) to " + link + " in " + currentFileName + "\nat line " + locator.getLineNumber()); + } + + String href = encloseContents("a", new String[] {"href", id, "class", "link"}, str); + + int s = stack.size(); + if (s >= 3) { + DocbookElement elem = stack.get(s - 3); + if (elem.getName().equals("refsection")) { + String role = elem.getAttributes().get("role"); + if (role != null && role.equals("see also")) { + String purpose = mapIdPurpose.get(link); + if (purpose != null) { + return href + " — " + purpose; + } else { + return href; + } + } + } + } + + return href; + } + + /** + * Rewrite a link when its type is "scilab" + * @param link the link + * @return the modified link with protocol scilab:// for example + */ + protected String resolvScilabLink(String link) { + int pos = link.indexOf("/"); + if (pos == -1) { + return null; + } + + String first = link.substring(0, pos); + String second = link.substring(pos + 1); + String[] toks = first.split("\\."); + if (toks == null || toks.length != 2) { + return null; + } + + if (!linkToTheWeb) { + return urlBase + link; + } else { + if (toks[0].equals("scilab") && toks[1].equals("help")) { + return urlBase + second + ".html"; + } else { + return "#"; + } + } + } + + /** + * Make a remote link + * @param link the link + * @return the good link + */ + protected String makeRemoteLink(String link) { + return link; + } + + /** + * Handle an ulink + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleUlink(final Map<String, String> attributes, final String contents) throws SAXException { + String link = attributes.get("url"); + if (link == null) { + throw new SAXException("No url attribute in tag ulink"); + } + + return encloseContents("a", new String[] {"href", link, "class", "ulink"}, contents); + } + + /** + * Handle a xref + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleXref(final Map<String, String> attributes, final String contents) throws SAXException { + String link = attributes.get("linkend"); + if (link == null) { + throw new SAXException("No linkend attribute in tag link"); + } + + String id = mapId.get(link); + if (id == null) { + warnings++; + System.err.println("Warning (should be fixed): invalid internal link to " + link + " in " + currentFileName + "\nat line " + locator.getLineNumber()); + return null; + } + + return encloseContents("a", new String[] {"href", id, "class", "xref"}, contents); + } + + /** + * Handle a latex (not really a docbook tag...) + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleLatex(final Map<String, String> attributes, final String contents) throws SAXException { + boolean isLocalized = "true".equals(attributes.get("localized")); + File f; + if (isLocalized) { + f = new File(outImages + "/" + imageDir, LATEXBASENAME + currentBaseName + "_" + language + "_" + (latexCompt++) + ".png"); + } else { + if ("ru_RU".equals(language) && HTMLDocbookTagConverter.containsCyrillic(contents)) { + System.err.println("Warning: LaTeX code in " + getCurrentFileName() + " contains cyrillic character. The tag <latex> should contain the attribute scilab:localized=\"true\""); + } else if ("ja_JP".equals(language) && HTMLDocbookTagConverter.containsCJK(contents)) { + System.err.println("Warning: LaTeX code in " + getCurrentFileName() + " contains CJK character. The tag <latex> should contain the attribute scilab:localized=\"true\""); + } + f = new File(outImages + "/" + imageDir, LATEXBASENAME + currentBaseName + "_" + (latexCompt++) + ".png"); + } + + String parent = getParentTagName(); + if (parent.equals("para") && !attributes.containsKey("style")) { + attributes.put("style", "text"); + } + String fs = attributes.get("fontsize"); + if (fs == null) { + attributes.put("fontsize", "16"); + } + + return getImageConverter().getImageByCode(currentFileName, contents, attributes, "image/latex", f, imageDir + "/" + f.getName(), getBaseImagePath(), locator.getLineNumber(), language, isLocalized); + } + + /** + * Handle a term + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleTerm(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("span", "term", contents); + } else { + return encloseContents("span", "term", contents); + } + } + + /** + * Handle a listitem + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleListitem(final Map<String, String> attributes, final String contents) throws SAXException { + String parent = getParentTagName(); + if (parent.equals("varlistentry")) { + return encloseContents("dd", contents); + } + return encloseContents("li", contents); + } + + /** + * Handle a varlistentry + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleVarlistentry(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("dt", contents); + } + + /** + * Handle a variablelist + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleVariablelist(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("dl", contents); + } + + /** + * Handle an itemizedlist + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleItemizedlist(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("ul", "itemizedlist", contents); + } else { + return encloseContents("ul", "itemizedlist", contents); + } + } + + /** + * Handle an emphasis + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleEmphasis(final Map<String, String> attributes, final String contents) throws SAXException { + String role = attributes.get("role"); + if (role != null) { + if (role.equals("bold")) { + return encloseContents("b", contents); + } + if (role.equals("italic")) { + return encloseContents("i", contents); + } + } + + return encloseContents("em", contents); + } + + /** + * Handle a tr + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleTr(final Map<String, String> attributes, final String contents) throws SAXException { + String bgcolor = attributes.get("bgcolor"); + + return encloseContents("tr", new String[] {"bgcolor", bgcolor}, contents); + } + + /** + * Handle a td + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleTd(final Map<String, String> attributes, final String contents) throws SAXException { + String align = attributes.get("align"); + String bgcolor = attributes.get("bgcolor"); + String colspan = attributes.get("colspan"); + String rowspan = attributes.get("rowspan"); + + return encloseContents("td", new String[] {"align", align, "bgcolor", bgcolor, "colspan", colspan, "rowspan", rowspan}, contents); + } + + /** + * Handle an informaltable + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleInformaltable(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String border = attributes.get("border"); + String cellpadding = attributes.get("cellpadding"); + String width = attributes.get("width"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("table", new String[] {"class", "informaltable", "border", border, "cellpadding", cellpadding, "width", width}, contents); + } else { + return encloseContents("table", new String[] {"class", "informaltable", "border", border, "cellpadding", cellpadding, "width", width}, contents); + } + } + + /** + * Handle an imagedata + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleImagedata(final Map<String, String> attributes, final String contents) throws SAXException { + String fileref = attributes.get("fileref"); + if (fileref == null) { + if (contents == null || contents.length() == 0) { + throw new SAXException("No fileref attribute or no data in tag imagedata"); + } + + return contents; + } + + try { + String path = new File(new URI(currentFileName)).getParent(); + File file = ImageConverter.imageExists(path, fileref); + if (file != null) { + throw new SAXException("The given fileref is not on an existing image file:\n" + fileref + " [" + file + "]"); + } + + return getImageConverter().getImageByFile(attributes, path, fileref, outImages, imageDir, getBaseImagePath()); + } catch (URISyntaxException e) { + System.err.println(e); + } + + return null; + } + + /** + * Handle an imageobject + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleImageobject(final Map<String, String> attributes, final String contents) throws SAXException { + return contents; + } + + /** + * Handle an textobject (as an alternative to imageobject) + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleTextobject(final Map<String, String> attributes, final String contents) throws SAXException { + return "<!-- " + contents + " -->"; + } + + /** + * Handle an inlinemediaobject + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleInlinemediaobject(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("span", contents); + } + + /** + * Handle a screenshot + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleScreenshot(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("div", "screenshot", contents); + } else { + return encloseContents("div", "screenshot", contents); + } + } + + /** + * Handle a mediaobject + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleMediaobject(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String c = contents.replaceFirst("top:([0-9]+)px;", ""); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("div", "mediaobject", c); + } else { + return encloseContents("div", "mediaobject", c); + } + } + + /** + * Handle an informalequation + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleInformalequation(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("div", "informalequation", contents); + } else { + return encloseContents("div", "informalequation", contents); + } + } + + /** + * Handle an orderedlist + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleOrderedlist(final Map<String, String> attributes, final String contents) throws SAXException { + String numeration = "1"; + String numAttr = attributes.get("numeration"); + if (numAttr != null) { + if (numAttr.equals("loweralpha")) { + numeration = "a"; + } else if (numAttr.equals("upperalpha")) { + numeration = "A"; + } else if (numAttr.equals("lowerroman")) { + numeration = "i"; + } else if (numAttr.equals("upperroman")) { + numeration = "I"; + } + } + + String id = attributes.get("id"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("ol", new String[] {"type", numeration}, contents); + } else { + return encloseContents("ol", new String[] {"type", numeration}, contents); + } + } + + /** + * Handle a subscript + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleSubscript(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("sub", contents); + } + + /** + * Handle a superscript + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleSuperscript(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("sup", contents); + } + + /** + * Handle a replaceable + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleReplaceable(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("span", "replaceable", contents); + } + + /** + * Handle a question + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleQuestion(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("dt", encloseContents("strong", contents)); + } + + /** + * Handle an answer + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleAnswer(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("dd", contents); + } + + /** + * Handle a qandaentry + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleQandaentry(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("dl", contents); + } + + /** + * Handle a qandaset + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleQandaset(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("div", "qandaset", contents); + } + + /** + * Handle a caption + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleCaption(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("caption", encloseContents("b", contents)); + } + + /** + * Handle a tbody + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleTbody(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("tbody", "tbody", contents); + } + + /** + * Handle a table + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleTable(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String bgcolor = attributes.get("bgcolor"); + String border = attributes.get("border"); + String cellpadding = attributes.get("cellpadding"); + + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("table", new String[] {"class", "doctable", "bgcolor", bgcolor, "border", border, "cellpadding", cellpadding}, contents); + } else { + return encloseContents("table", new String[] {"class", "doctable", "bgcolor", bgcolor, "border", border, "cellpadding", cellpadding}, contents); + } + } + + /** + * Handle a surname + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleSurname(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("span", "surname", contents); + } + + /** + * Handle a firstname + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleFirstname(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("span", "firstname", contents); + } + + /** + * Handle a bibliomset + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleBibliomset(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("div", "bibliomset", contents); + } else { + return encloseContents("div", "bibliomset", contents); + } + } + + /** + * Handle a bibliomixed + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleBibliomixed(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + if (id != null) { + return "<a name=\"" + id + "\"></a>" + encloseContents("div", "bibliomixed", contents); + } else { + return encloseContents("div", "bibliomixed", contents); + } + } + + /** + * Handle a th + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleTh(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("th", contents); + } + + /** + * Handle a revhistory + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRevhistory(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String str = "<table class=\"revhistory\"><tr class=\"title\"><td>" + VERSION + "</td><td>" + DESCRIPTION + "</td></tr>" + contents + "</table>"; + if (id != null) { + return "<a name=\"" + id + "\"></a>" + str; + } else { + return str; + } + } + + /** + * Handle a revision + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRevision(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("tr", contents); + } + + /** + * Handle a revnumber + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRevnumber(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("td", "revnumber", contents); + } + + /** + * Handle a revremark + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRevremark(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("td", "revremark", contents); + } + + /** + * Handle a revdescription + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleRevdescription(final Map<String, String> attributes, final String contents) throws SAXException { + return encloseContents("td", "revdescription", contents); + } + + /** + * Handle a note + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleNote(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String code = "<table><tr><td valign=\"top\"><img src=\"" + getBaseImagePath() + "ScilabNote.png\"/></td><td valign=\"top\">" + encloseContents("div", "note", contents) + "</td></tr></table>"; + if (id != null) { + return "<a name=\"" + id + "\"></a>" + code; + } else { + return code; + } + } + + /** + * Handle a warning + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleWarning(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String code = "<table><tr><td valign=\"top\"><img src=\"" + getBaseImagePath() + "ScilabWarning.png\"/></td><td valign=\"top\">" + encloseContents("div", "warning", contents) + "</td></tr></table>"; + if (id != null) { + return "<a name=\"" + id + "\"></a>" + code; + } else { + return code; + } + } + + /** + * Handle a caution + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleCaution(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String code = "<table><tr><td valign=\"top\"><img src=\"" + getBaseImagePath() + "ScilabCaution.png\"/></td><td valign=\"top\">" + encloseContents("div", "caution", contents) + "</td></tr></table>"; + if (id != null) { + return "<a name=\"" + id + "\"></a>" + code; + } else { + return code; + } + } + + /** + * Handle a tip + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleTip(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String code = "<table><tr><td valign=\"top\"><img src=\"" + getBaseImagePath() + "ScilabTip.png\"/></td><td valign=\"top\">" + encloseContents("div", "tip", contents) + "</td></tr></table>"; + if (id != null) { + return "<a name=\"" + id + "\"></a>" + code; + } else { + return code; + } + } + + /** + * Handle a important + * @param attributes the tag attributes + * @param contents the tag contents + * @return the HTML code + * @throws SAXEception if an error is encountered + */ + public String handleImportant(final Map<String, String> attributes, final String contents) throws SAXException { + String id = attributes.get("id"); + String code = "<table><tr><td valign=\"top\"><img src=\"" + getBaseImagePath() + "ScilabImportant.png\"/></td><td valign=\"top\">" + encloseContents("div", "important", contents) + "</td></tr></table>"; + if (id != null) { + return "<a name=\"" + id + "\"></a>" + code; + } else { + return code; + } + } + + private static final String convertCode(String code) { + if (code == null || code.length() == 0) { + return ""; + } + + StringBuffer buffer = new StringBuffer(2 * code.length()); + int start = 0; + int end = code.length() - 1; + char c = code.charAt(0); + + // first we trim + while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { + if (start < end) { + c = code.charAt(++start); + } else { + break; + } + } + c = code.charAt(end); + while (c == ' ' || c == '\t' || c == '\n' || c == '\r') { + if (end > 0) { + c = code.charAt(--end); + } else { + break; + } + } + + // replace chars by their html entities equivalent + for (int j = start; j <= end; j++) { + c = code.charAt(j); + switch (c) { + case '&': + buffer.append("&"); + break; + case '<': + buffer.append("<"); + break; + case '>': + buffer.append(">"); + break; + case '\n': + buffer.append("<br />"); + break; + case '\'': + buffer.append("'"); + break; + case '\"': + buffer.append("""); + break; + default: + buffer.append(c); + } + } + + return buffer.toString(); + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java b/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java new file mode 100755 index 000000000..037c8263e --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java @@ -0,0 +1,441 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Hussein SHAFIE + * Copyright (C) 2008 - INRIA - Sylvestre LEDRU + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ +package org.scilab.modules.helptools; + +import java.io.IOException; +import java.io.File; +import java.io.InputStream; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; + +public final class Helpers { + + public static final boolean IS_WINDOWS = (File.pathSeparatorChar == ';'); + + private Helpers() { } + + // ----------------------------------------------------------------------- + + public static String reason(Throwable e) { + String reason = e.getMessage(); + if (reason == null) { + return e.getClass().getName(); + } + + return reason; + } + + // ----------------------------------------------------------------------- + + public static void escapeXML(String text, PrintWriter out) { + char[] chars = text.toCharArray(); + escapeXML(chars, 0, chars.length, out); + } + + public static void escapeXML(char[] chars, int offset, int length, + PrintWriter out) { + int end = offset + length; + for (int i = offset; i < end; ++i) { + char c = chars[i]; + + switch (c) { + case '\'': + out.write("'"); + break; + case '\"': + out.write("""); + break; + case '<': + out.write("<"); + break; + case '>': + out.write(">"); + break; + case '&': + out.write("&"); + break; + default: + out.write(c); + break; + } + } + } + + // ----------------------------------------------------------------------- + + public static String getBaseName(String language) { + return "scilab_" + language + "_help"; + } + + public static String getTemporaryNameFo(String baseDirectory) { + return baseDirectory + "/__doc.fo"; + } + + public static String getFileExtension(File file) { + return getFileExtension(file.getPath()); + } + + public static String getFileExtension(String path) { + int dot = indexOfDot(path); + if (dot < 0) { + return null; + } else { + return path.substring(dot + 1); + } + } + + private static int indexOfDot(String path) { + int baseNameStart = path.lastIndexOf(File.separatorChar); + if (baseNameStart < 0) { + baseNameStart = 0; + } else { + ++baseNameStart; + } + + int dot = -1; + + int pos = path.length(); + while ((pos = path.lastIndexOf('.', pos - 1)) > baseNameStart) { + dot = pos; + } + + return dot; + } + + public static File setFileExtension(File file, String extension) { + String path = setFileExtension(file.getPath(), extension); + return new File(path); + } + + public static String setFileExtension(String path, String extension) { + if (path.endsWith(File.separator)) { + return path; + } + + int dot = indexOfDot(path); + if (dot < 0) { + if (extension == null) { + return path; + } else { + return path + "." + extension; + } + } else { + if (extension == null) { + return path.substring(0, dot); + } else { + return path.substring(0, dot + 1) + extension; + } + } + } + + // ----------------------------------------------------------------------- + + public static void copyFile(File srcFile, File dstFile) + throws IOException { + FileInputStream src = new FileInputStream(srcFile); + try { + copyFile(src, dstFile); + } finally { + src.close(); + } + } + + public static void copyFile(InputStream src, File dstFile) + throws IOException { + FileOutputStream dst = new FileOutputStream(dstFile); + byte[] bytes = new byte[65536]; + int count; + + try { + while ((count = src.read(bytes)) != -1) { + dst.write(bytes, 0, count); + } + + dst.flush(); + + } finally { + dst.close(); + } + } + + // ----------------------------------------------------------------------- + + /** + * Delete a directory and all his content + * + * @param dir The path to the directory + */ + public static void deleteDirectory(String dir) { + deleteDirectory(new File(dir)); + } + + /** + * Delete a directory and all his content + * + * @param dir The file object of the path to the directory + */ + public static void deleteDirectory(File dir) { + + String[] files = dir.list(); + if (files == null) { + files = new String[0]; + } + for (int i = 0; i < files.length; i++) { + File file = new File(dir, files[i]); + if (file.isDirectory()) { + Helpers.deleteDirectory(file); + } else { + file.delete(); + } + } + dir.delete(); + + } + + // ----------------------------------------------------------------------- + + public static String[] split(String string, char separatorChar) { + // Count elements --- + + int elementCount = 0; + int sep = 0; + while ((sep = string.indexOf(separatorChar, sep)) >= 0) { + ++elementCount; + ++sep; + } + ++elementCount; + + // Build element array --- + + String[] elements = new String[elementCount]; + + elementCount = 0; + sep = 0; + int nextSep; + while ((nextSep = string.indexOf(separatorChar, sep)) >= 0) { + elements[elementCount++] = + (sep == nextSep) ? "" : string.substring(sep, nextSep); + sep = nextSep + 1; + } + elements[elementCount++] = string.substring(sep); + + return elements; + } + + // ----------------------------------------------------------------------- + + public static File findInPath(String appName) { + String pathEnvVar = System.getenv("PATH"); + if (pathEnvVar == null) { + return null; + } + + String[] split = Helpers.split(pathEnvVar, File.pathSeparatorChar); + for (int i = 0; i < split.length; ++i) { + String path = split[i].trim(); + if (path.length() == 0) { + continue; + } + + if (!path.endsWith(File.separator)) { + path += File.separator; + } + + File file = new File(path + appName); + if (file.isFile()) { + return file; + } + + if (IS_WINDOWS && appName.lastIndexOf('.') < 0) { + String[] suffixes = {".COM", ".EXE", ".BAT", ".CMD" }; + + String pathExtEnvVar = System.getenv("PATHEXT"); + if (pathExtEnvVar != null) { + suffixes = Helpers.split(pathExtEnvVar, + File.pathSeparatorChar); + } + + for (int j = 0; j < suffixes.length; ++j) { + String suffix = suffixes[j].trim(); + if (!suffix.startsWith(".")) { + continue; + } + + file = new File(path + appName + suffix); + if (file.isFile()) { + return file; + } + } + } + } + + return null; + } + + public static Process shellStart(String command, String[] envp, File dir) + throws IOException { + Process process; + + if (IS_WINDOWS) { + process = Runtime.getRuntime().exec( + new String[] {"cmd.exe", "/s", "/c", "\"" + command + "\"" }, + envp, dir); + } else { + process = Runtime.getRuntime().exec( + new String[] {"/bin/sh", "-c", command }, envp, dir); + } + + return process; + } + + public static int shellExec(String command, String[] envp, File dir, + boolean verbose) + throws IOException, InterruptedException { + if (verbose) { + System.out.println(command); + } + + Process process = shellStart(command, envp, dir); + + // Without these consumer threads, any shell command that outputs + // something lengthy will block on Windows NT. + + InputConsumer consumer1; + InputConsumer consumer2; + if (verbose) { + consumer1 = new InputConsumer(process.getInputStream(), System.out); + consumer2 = new InputConsumer(process.getErrorStream(), System.err); + } else { + consumer1 = new InputConsumer(process.getInputStream()); + consumer2 = new InputConsumer(process.getErrorStream()); + } + consumer1.start(); + consumer2.start(); + + int exitStatus = process.waitFor(); + + consumer1.join(); + consumer2.join(); + + return exitStatus; + } + + private static class InputConsumer extends Thread { + private InputStream in; + private OutputStream out; + private byte[] bytes = new byte[4096]; + + public InputConsumer(InputStream in) { + this(in, null); + } + + public InputConsumer(InputStream in, OutputStream out) { + this.in = in; + this.out = out; + } + + public void run() { + for (;;) { + int count; + try { + count = in.read(bytes); + } catch (IOException e) { + //e.printStackTrace(); + count = -1; + } + if (count < 0) { + break; + } + + if (count > 0 && out != null) { + try { + out.write(bytes, 0, count); + out.flush(); + } catch (IOException e) { + //e.printStackTrace(); + out = null; + } + } + } + } + } + + // ----------------------------------------------------------------------- + + public static String loadString(File file, String charsetName) + throws IOException { + InputStream in = new FileInputStream(file); + + String loaded = null; + try { + loaded = loadString(in, charsetName); + } finally { + in.close(); + } + + return loaded; + } + + public static String loadString(InputStream stream, String charsetName) + throws IOException { + InputStreamReader in; + if (charsetName == null) { + in = new InputStreamReader(stream); + } else { + in = new InputStreamReader(stream, charsetName); + } + + char[] chars = new char[8192]; + StringBuffer buffer = new StringBuffer(chars.length); + int count; + + while ((count = in.read(chars, 0, chars.length)) != -1) { + if (count > 0) { + buffer.append(chars, 0, count); + } + } + + return buffer.toString(); + } + + public static void saveString(String string, File file, + String charsetName) + throws IOException { + OutputStream out = new FileOutputStream(file); + + try { + saveString(string, out, charsetName); + } finally { + out.close(); + } + } + + private static void saveString(String string, OutputStream stream, + String charsetName) + throws IOException { + OutputStreamWriter out; + if (charsetName == null) { + out = new OutputStreamWriter(stream); + } else { + out = new OutputStreamWriter(stream, charsetName); + } + + out.write(string, 0, string.length()); + out.flush(); + } +} + diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/JarOnlyConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/JarOnlyConverter.java new file mode 100755 index 000000000..2e2114d89 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/JarOnlyConverter.java @@ -0,0 +1,235 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2008 - INRIA - Sylvestre LEDRU + * Copyright (C) 2013 - Scilab Enterprises - Clement DAVID + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ +package org.scilab.modules.helptools; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.util.ArrayList; +import java.util.jar.JarOutputStream; +import java.util.zip.ZipEntry; + +import org.scilab.modules.commons.ScilabConstants; + +import com.sun.java.help.search.Indexer; + +public class JarOnlyConverter extends ContainerConverter { + + private static final String SCI = ScilabConstants.SCI.getPath(); + + private static final String JAVAHELPSEARCH_DIR = "/JavaHelpSearch/"; + private static final String COULD_NOT_FIND = "buildDoc: Could not find/access to "; + private static final String LEFT_PAR = " ( "; + private static final String RIGHT_PAR = " )"; + private static final String JAR_EXT = ".jar"; + private static final String SLASH = "/"; + private static final int JAR_COMPRESSION_LEVEL = 9; + private static Indexer indexer = new Indexer(); + + private final boolean isToolbox; + private final String outImages; + + public JarOnlyConverter(SciDocMain sciDocMain) { + super(sciDocMain.getOutputDirectory(), sciDocMain.getLanguage()); + + isToolbox = sciDocMain.isToolbox(); + + /* + * Reuse the shared generated images directory from scilab + */ + String images = sciDocMain.getOutputDirectory() + File.separator; + if (!isToolbox) { + images = ScilabConstants.SCI.getPath() + "/modules/helptools/images"; + File dir = new File(images); + if (!dir.exists()) { + dir.mkdir(); + } + } + outImages = images; + } + + /** + * Embed the javahelp html files to a jar + */ + @Override + public void convert() { + String outputJavaHelp = new String(outputDirectory + JAVAHELPSEARCH_DIR); + + try { + /* Purge the directory before launching the index */ + /* because the JavaHelp Indexer failed when launched twice on the same directory */ + Helpers.deleteDirectory(outputJavaHelp); + File directory = new File(outputJavaHelp); + directory.mkdirs(); + String jhs = new File(outputJavaHelp).getAbsolutePath(); + + String[] args = new String[] {"-db", jhs, "-nostopwords", "."}; + + indexer.compile(args); + } catch (Exception e) { + System.err.println("buildDoc: Error building search index: " + e.getLocalizedMessage()); + return; + } + + buildJar(outputDirectory, language); + } + + /** + * Embed the images files to another jar for non-toolboxes + */ + @Override + public void install() { + /* + * Toolboxes images are not in a separate jar. + */ + if (isToolbox) { + return; + } + + JarOutputStream jarFile = null; + FileOutputStream fileOutputStream = null; + + /* Stored into SCI/modules/helptools/jar */ + String fileName = SCI + "/modules/helptools/jar" + SLASH + "scilab_images" + JAR_EXT; + try { + fileOutputStream = new FileOutputStream(fileName); + jarFile = new JarOutputStream(fileOutputStream); + jarFile.setLevel(JAR_COMPRESSION_LEVEL); + } catch (java.io.FileNotFoundException e) { + System.err.println(COULD_NOT_FIND + fileName + LEFT_PAR + e.getLocalizedMessage() + RIGHT_PAR); + } catch (java.io.IOException e) { + System.err.println(COULD_NOT_FIND + fileName + LEFT_PAR + e.getLocalizedMessage() + RIGHT_PAR); + } + + File[] allFiles = new File(outImages).listFiles(); + for (int i = 0; i < allFiles.length; i++) { + try { + File workingFile = allFiles[i]; + FileInputStream fileInputStream = new FileInputStream(workingFile); + + int length = (int) workingFile.length(); + byte[] buffer = new byte[length]; + try { + fileInputStream.read(buffer, 0, length); + } catch (java.io.IOException e) { + System.err.println(COULD_NOT_FIND + workingFile + LEFT_PAR + e.getLocalizedMessage() + RIGHT_PAR); + } + ZipEntry zipEntry = new ZipEntry(workingFile.getName()); + jarFile.putNextEntry(zipEntry); + jarFile.write(buffer, 0, length); + fileInputStream.close(); + } catch (java.io.IOException e) { + System.err.println("buildDoc: An error occurs while building the JavaHelp ( " + e.getLocalizedMessage() + RIGHT_PAR); + } + + } + try { + jarFile.close(); + } catch (java.io.IOException e) { + System.err.println("buildDoc: An error occurs while closing the JavaHelp ( " + e.getLocalizedMessage() + RIGHT_PAR); + } + } + + /** + * Get the list of the files in a directory + * @param directory the directory where files have to be searched + * @param language String 'fr_FR' + * @return the list of the files found + */ + private static ArrayList<File> buildFileList(File directory, String language) { + final String baseNameJar = Helpers.getBaseName(language) + JAR_EXT; + ArrayList<File> listFile = new ArrayList<File>(); + + File[] files = directory.listFiles(new FilenameFilter() { + public boolean accept(File dir, String name) { + return !name.equals(baseNameJar); + } + }); + for (int i = 0; i < files.length; i++) { + if (files[i].isDirectory()) { + listFile.addAll(buildFileList(files[i], language)); + } else { + listFile.add(files[i]); + } + } + return listFile; + } + + /** + * Private method which is trying to build the jar + * + * @param outputDirectory Where to build the jar file + * @param language In which language (for the file name) + * @return The result of the operation + */ + static boolean buildJar(String outputDirectory, String language) { + String baseName = Helpers.getBaseName(language); + JarOutputStream jarFile = null; + FileOutputStream fileOutputStream = null; + + /* Stored into SCI/modules/helptools/jar */ + String fileName = outputDirectory + SLASH + baseName + JAR_EXT; + /* bug 4407 */ + /* we do list of files before to create scilab_xx_XX_help.jar */ + ArrayList<File> fileList = buildFileList(new File(outputDirectory), language); + + try { + fileOutputStream = new FileOutputStream(fileName); + jarFile = new JarOutputStream(fileOutputStream); + } catch (java.io.FileNotFoundException e) { + System.err.println(COULD_NOT_FIND + fileName + LEFT_PAR + e.getLocalizedMessage() + RIGHT_PAR); + } catch (java.io.IOException e) { + System.err.println(COULD_NOT_FIND + fileName + LEFT_PAR + e.getLocalizedMessage() + RIGHT_PAR); + } + + jarFile.setLevel(JAR_COMPRESSION_LEVEL); + + File[] allFiles = fileList.toArray(new File [fileList.size()]); + for (int i = 0; i < allFiles.length; i++) { + try { + File workingFile = allFiles[i]; + FileInputStream fileInputStream = new FileInputStream(workingFile); + + int length = (int) workingFile.length(); + byte[] buffer = new byte[length]; + try { + fileInputStream.read(buffer, 0, length); + } catch (java.io.IOException e) { + System.err.println(COULD_NOT_FIND + workingFile + LEFT_PAR + e.getLocalizedMessage() + RIGHT_PAR); + } + String relativeFileName = null; + if (workingFile.getPath().indexOf("JavaHelpSearch") == -1) { + relativeFileName = baseName + SLASH + workingFile.getName(); + } else { + relativeFileName = baseName + JAVAHELPSEARCH_DIR + workingFile.getName(); + } + ZipEntry zipEntry = new ZipEntry(relativeFileName); + jarFile.putNextEntry(zipEntry); + + jarFile.write(buffer, 0, length); + + fileInputStream.close(); + } catch (java.io.IOException e) { + System.err.println("buildDoc: An error occurs while building the JavaHelp ( " + e.getLocalizedMessage() + RIGHT_PAR); + } + + } + try { + jarFile.close(); + } catch (java.io.IOException e) { + System.err.println("buildDoc: An error occurs while closing the JavaHelp ( " + e.getLocalizedMessage() + RIGHT_PAR); + } + return true; + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/JavaHelpDocbookElement.java b/modules/helptools/src/java/org/scilab/modules/helptools/JavaHelpDocbookElement.java new file mode 100755 index 000000000..88dab3075 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/JavaHelpDocbookElement.java @@ -0,0 +1,68 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.util.Map; + +public class JavaHelpDocbookElement extends DocbookElement { + + private StringBuilder mapIdContents; + private DocbookElement parent; + + /** + * {@inheritDoc} + */ + protected JavaHelpDocbookElement(String name, String uri, Map<String, String> attributes) { + super(name, uri, attributes); + mapIdContents = new StringBuilder(); + } + + /** + * {@inheritDoc} + */ + public DocbookElement getNewInstance(String name, String uri, Map<String, String> attributes) { + return new JavaHelpDocbookElement(name, uri, attributes); + } + + /** + * {@inheritDoc} + */ + public void append(Object obj) { + if (obj instanceof String) { + mapIdContents.append((String) obj); + } else if (obj instanceof StringBuilder) { + mapIdContents.append((StringBuilder) obj); + } + } + + /** + * {@inheritDoc} + */ + public Object get() { + return mapIdContents; + } + + /** + * {@inheritDoc} + */ + public void setParent(DocbookElement elem) { + parent = elem; + } + + /** + * {@inheritDoc} + */ + public DocbookElement getParent() { + return parent; + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/JavaHelpDocbookTagConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/JavaHelpDocbookTagConverter.java new file mode 100755 index 000000000..9708257ca --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/JavaHelpDocbookTagConverter.java @@ -0,0 +1,207 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.nio.charset.Charset; +import java.util.Iterator; + +import org.scilab.modules.commons.ScilabCommonsUtils; +import org.scilab.modules.commons.ScilabConstants; +import org.scilab.modules.commons.gui.FindIconHelper; +import org.scilab.modules.helptools.image.ImageConverter; +import org.xml.sax.SAXException; + +/** + * Class to convert DocBook to JavaHelp + * @author Calixte DENIZET + */ +public class JavaHelpDocbookTagConverter extends HTMLDocbookTagConverter { + + private static final String XMLSTRING = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n"; + + private StringBuilder buffer = new StringBuilder(8192); + + /** + * Constructor + * @param inName the name of the input stream + * @param sciDocMain provide useful doc generation properties + * @param imgConvert the shared image converter for all generation + */ + public JavaHelpDocbookTagConverter(String inName, SciDocMain sciDocMain, ImageConverter imgConvert) throws IOException, SAXException { + super(inName, sciDocMain, imgConvert); + + urlBase = "scilab://"; + linkToTheWeb = false; + + if (!isToolbox) { + this.outImages = ScilabConstants.SCI.getPath() + "/modules/helptools/images"; + File dir = new File(this.outImages); + if (!dir.exists()) { + dir.mkdir(); + } + } + + prependToProgramListing = "<table border=\"0\" width=\"100%\"><tr><td width=\"98%\">"; + appendToProgramListing = "</td><td valign=\"top\"><a href=\"scilab://scilab.execexample/\"><img src=\"" + getBaseImagePath() + "ScilabExecute.png\" border=\"0\"/></a></td><td valign=\"top\"><a href=\"scilab://scilab.editexample/\"><img src=\"" + getBaseImagePath() + "ScilabEdit.png\" border=\"0\"/></a></td><td></td></tr></table>"; + appendForExecToProgramListing = "</td><td valign=\"top\"><a href=\"scilab://scilab.execexample/\"><img src=\"" + getBaseImagePath() + "ScilabExecute.png\" border=\"0\"/></a></td><td></td></tr></table>"; + } + + @Override + public void install() { + super.install(); + + ScilabCommonsUtils.copyFile(new File(FindIconHelper.findIcon("media-playback-start")), new File(outImages + "/ScilabExecute.png")); + ScilabCommonsUtils.copyFile(new File(FindIconHelper.findIcon("accessories-text-editor")), new File(outImages + "/ScilabEdit.png")); + ScilabCommonsUtils.copyFile(new File(FindIconHelper.findIcon("dialog-information")), new File(outImages + "/ScilabNote.png")); + ScilabCommonsUtils.copyFile(new File(FindIconHelper.findIcon("dialog-warning")), new File(outImages + "/ScilabWarning.png")); + ScilabCommonsUtils.copyFile(new File(FindIconHelper.findIcon("dialog-warning")), new File(outImages + "/ScilabCaution.png")); + ScilabCommonsUtils.copyFile(new File(FindIconHelper.findIcon("dialog-information")), new File(outImages + "/ScilabTip.png")); + ScilabCommonsUtils.copyFile(new File(FindIconHelper.findIcon("emblem-important")), new File(outImages + "/ScilabImportant.png")); + if (!isToolbox) { + ScilabCommonsUtils.copyFile(new File(SCI + "/modules/helptools/data/pages/error.html"), new File(outName + "/ScilabErrorPage.html")); + File homepage = new File(SCI + "/modules/helptools/data/pages/homepage-" + language + ".html"); + if (!homepage.isFile()) { + /* could not find the localized homepage. Switch to english */ + homepage = new File(SCI + "/modules/helptools/data/pages/homepage-en_US.html"); + } + ScilabCommonsUtils.copyFile(homepage, new File(outName + "/ScilabHomePage.html")); + + File homepageImage = new File(SCI + "/modules/helptools/data/pages/ban-" + language + ".png"); + if (!homepageImage.isFile()) { + homepageImage = new File(SCI + "/modules/helptools/data/pages/ban-en_US.png"); + } + ScilabCommonsUtils.copyFile(homepageImage, new File(outImages + "/ban_en_US.png")); + } + } + + /** + * {@inheritDoc} + */ + public void endDocument() throws SAXException { + try { + FileOutputStream outToc = new FileOutputStream("jhelptoc.xml"); + FileOutputStream outMap = new FileOutputStream("jhelpmap.jhm"); + FileOutputStream outSet = new FileOutputStream("jhelpset.hs"); + FileOutputStream outIndex = new FileOutputStream("jhelpidx.xml"); + OutputStreamWriter writerIndex = new OutputStreamWriter(outIndex, Charset.forName("UTF-8")); + OutputStreamWriter writerSet = new OutputStreamWriter(outSet, Charset.forName("UTF-8")); + OutputStreamWriter writerMap = new OutputStreamWriter(outMap, Charset.forName("UTF-8")); + OutputStreamWriter writerToc = new OutputStreamWriter(outToc, Charset.forName("UTF-8")); + writerMap.append(XMLSTRING); + writerMap.append("<!DOCTYPE map PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp Map Version 1.0//EN\" \"http://java.sun.com/products/javahelp/map_1_0.dtd\">\n"); + writerMap.append(convertMapId()); + writerMap.flush(); + writerMap.close(); + outMap.flush(); + outMap.close(); + + writerToc.append(XMLSTRING); + writerToc.append("<!DOCTYPE toc PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp TOC Version 1.0//EN\" \"http://java.sun.com/products/javahelp/toc_1_0.dtd\">\n"); + writerToc.append(convertTocItem()); + writerToc.flush(); + writerToc.close(); + outToc.flush(); + outToc.close(); + + writerSet.append(XMLSTRING); + String str = "<!DOCTYPE helpset\n PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 1.0//EN\" \"http://java.sun.com/products/javahelp/helpset_1_0.dtd\">\n<helpset version=\"1.0\">\n<title>TITLE</title>\n<maps>\n<homeID>top</homeID>\n<mapref location=\"jhelpmap.jhm\"/>\n</maps>\n<view>\n<name>TOC</name>\n<label>Table Of Contents</label>\n<type>javax.help.TOCView</type>\n<data>jhelptoc.xml</data>\n</view>\n<view>\n<name>Index</name>\n<label>Index</label>\n<type>javax.help.IndexView</type>\n<data>jhelpidx.xml</data>\n</view>\n<view>\n<name>Search</name>\n<label>Search</label>\n<type>javax.help.SearchView</type>\n<data engine=\"com.sun.java.help.search.DefaultSearchEngine\">JavaHelpSearch</data>\n</view>\n</helpset>".replaceFirst("TITLE", bookTitle); + writerSet.append(str); + writerSet.flush(); + writerSet.close(); + outSet.flush(); + outSet.close(); + + writerIndex.append(XMLSTRING); + writerIndex.append("<!DOCTYPE index PUBLIC \"-//Sun Microsystems Inc.//DTD JavaHelp Index Version 1.0//EN\" \"http://java.sun.com/products/javahelp/index_1_0.dtd\">\n<index version=\"1.0\"/>"); + writerIndex.flush(); + writerIndex.close(); + outIndex.flush(); + outIndex.close(); + + if (!isToolbox) { + getImageConverter().saveMD5s(ScilabConstants.SCI.getPath() + "/modules/helptools/etc"); + } + } catch (IOException e) { + fatalExceptionOccurred(e); + } + } + + /** + * {@inheritDoc} + */ + protected String makeRemoteLink(String link) { + return "file://SCI/modules/" + link; + } + + public String getBaseImagePath() { + if (isToolbox) { + return super.getBaseImagePath(); + } + + return "jarsci:"; + } + + private String convertMapId() { + buffer.setLength(0); + buffer.append("<map version=\"1.0\">\n<mapID target=\"index\" url=\"index.html\"/>\n"); + if (!isToolbox) { + buffer.append("<mapID target=\"whatsnew\" url=\"ScilabHomePage.html\"/>\n"); + } + Iterator<String> iter = mapId.keySet().iterator(); + while (iter.hasNext()) { + String id = iter.next(); + buffer.append("<mapID target=\""); + buffer.append(id); + buffer.append("\" url=\""); + buffer.append(mapId.get(id)); + buffer.append("\"/>\n"); + } + buffer.append("</map>"); + + return buffer.toString(); + } + + private void convertTreeId(HTMLDocbookLinkResolver.TreeId leaf) { + if (leaf.children != null) { + for (HTMLDocbookLinkResolver.TreeId c : leaf.children) { + buffer.append("<tocitem target=\""); + buffer.append(c.id); + buffer.append("\" text=\""); + buffer.append(tocitem.get(c.id)); + if (c.children == null) { + buffer.append("\"/>\n"); + } else { + buffer.append("\">\n"); + convertTreeId(c); + buffer.append("</tocitem>\n"); + } + } + } + } + + private String convertTocItem() { + buffer.setLength(0); + buffer.append("<toc version=\"1.0\">\n<tocitem target=\"index\" text=\"" + bookTitle + "\">\n"); + if (!isToolbox) { + buffer.append("<tocitem target=\"whatsnew\" text=\"Scilab Home\"/>\n"); + } + convertTreeId(tree); + buffer.append("</tocitem>\n</toc>"); + + return buffer.toString(); + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/SciDocConfiguration.java b/modules/helptools/src/java/org/scilab/modules/helptools/SciDocConfiguration.java new file mode 100755 index 000000000..63bbb0239 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/SciDocConfiguration.java @@ -0,0 +1,160 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2011 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.File; +import java.io.IOException; +import java.util.regex.Matcher; + +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import org.scilab.modules.commons.ScilabConstants; +import org.scilab.modules.commons.xml.ScilabDocumentBuilderFactory; + +/** + * @author Calixte Denizet + */ +public class SciDocConfiguration { + + private static final String SCIVAR = "\\$\\{SCI\\}"; + private static final String SCI = ScilabConstants.SCI.getPath(); + private static final String CONF = SCI + "/modules/helptools/etc/SciDocConf.xml"; + private static final String VERSION = SCI + "/Version.incl"; + private static final String ERROR_READ = "Problem to read the file "; + + private Document doc; + + /** + * Default constructor + * @param filename the configuration file + */ + public SciDocConfiguration() { + readDocument(CONF); + } + + /** + * Read the document + * @param filename the configuration file + */ + public void readDocument(String filename) { + try { + DocumentBuilderFactory factory = ScilabDocumentBuilderFactory.newInstance(); + doc = factory.newDocumentBuilder().parse(new File(filename)); + } catch (ParserConfigurationException e) { + System.err.println(ERROR_READ + filename); + } catch (SAXException e) { + System.err.println(ERROR_READ + filename); + } catch (IOException e) { + System.err.println(ERROR_READ + filename); + } + } + + /** + * @return the file path + */ + public String getCSS() { + String str = ((Element) doc.getDocumentElement().getElementsByTagName("css").item(0)).getAttribute("doc"); + return str.replaceAll(SCIVAR, Matcher.quoteReplacement(SCI)); + } + + /** + * @param kind should be javahelp, chm, html or web + * @return the template file path + */ + public String getTemplate(String kind) { + String str = ((Element) doc.getDocumentElement().getElementsByTagName("templates").item(0)).getAttribute(kind); + return str.replaceAll(SCIVAR, Matcher.quoteReplacement(SCI)); + } + + /** + * @return the Scilab's doc web url + */ + public String getWebSiteURL() { + return ((Element) doc.getDocumentElement().getElementsByTagName("website").item(0)).getAttribute("url"); + } + + /** + * @return the path of the file containing Scilab macros + */ + public String[] getMacros() { + return getPathList("macros"); + } + + /** + * @return the path of the file containing Scilab primitives + */ + public String[] getBuiltins() { + return getPathList("builtins"); + } + + /** + * @param kind should be "macros" or "builtins" + * @return the path of the file containing Scilab macros or built-in function. + */ + private String[] getPathList(String kind) { + Element macros = (Element) doc.getDocumentElement().getElementsByTagName(kind).item(0); + NodeList pathList = macros.getElementsByTagName("file"); + String[] paths = new String[pathList.getLength()]; + for (int i = 0; i < paths.length; i++) { + paths[i] = ((Element) pathList.item(i)).getAttribute("path").replaceAll(SCIVAR, Matcher.quoteReplacement(SCI)); + } + + return paths; + } + + /** + * @return the version string + */ + public String getVersion() { + String str = null; + NodeList list = doc.getDocumentElement().getElementsByTagName("version"); + if (list != null && list.getLength() > 0) { + Element el = (Element) list.item(0); + if (el != null) { + str = el.getAttribute("id"); + } + } + + return getVersion(str); + } + + /** + * Get the version in Version.incl if ver==null or ver=="". + * @param ver the actual version + * @return the version in Version.incl + */ + private static String getVersion(String ver) { + String ret = ""; + if (ver == null || ver.isEmpty()) { + try { + BufferedReader reader = new BufferedReader(new FileReader(VERSION)); + ret = reader.readLine().split("=")[1]; + reader.close(); + } catch (IOException e) { + System.err.println(e); + } + } else { + ret = ver; + } + + return ret; + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/SciDocMain.java b/modules/helptools/src/java/org/scilab/modules/helptools/SciDocMain.java new file mode 100755 index 000000000..ad22149db --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/SciDocMain.java @@ -0,0 +1,214 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.io.File; +import org.scilab.modules.commons.ScilabConstants; +import org.scilab.modules.helptools.Converter.Backend; +import org.scilab.modules.helptools.image.ImageConverter; +import org.xml.sax.SAXException; + +/** + * Class to convert DocBook + * @author Calixte DENIZET + */ +public final class SciDocMain { + /** + * The output directory + */ + private String outputDirectory; + /** + * The target language as locale string descriptor (en_US, fr_FR, ...) + */ + private String language; + /** + * Target format + */ + private Backend format; + /** + * Image directory relative to the outputDirectory + */ + private String imagedir = "."; + /** + * The configuration of the current generation + */ + private SciDocConfiguration conf = new SciDocConfiguration(); + /** + * True if the documentation should be generated for a toolbox, false for Scilab + */ + private boolean isToolbox; + + /* + * GIWS Exported methods + */ + + /** + * Set the directory where files must be exported + * Note that directory is created + * + * @param outputDirectoryectory The path to the directory + * @return If the directory exists + */ + public boolean setOutputDirectory(String outputDirectory) { + File directory = new File(outputDirectory); + if (!directory.isDirectory()) { + if (!directory.mkdirs()) { + return false; + } + } + this.outputDirectory = new File(outputDirectory).getAbsolutePath(); + return true; + } + + /** + * Defines the language + * + * @param language the language (xx_XX ex: en_US, fr_FR) + */ + public void setWorkingLanguage(String language) { + this.language = language; + } + + /** + * @param isToolbox must be true if we compile a toolbox doc + */ + public void setIsToolbox(boolean isToolbox) { + this.isToolbox = isToolbox; + } + + /** + * Defines the export format + * @param format the format (among the list CHM, HTML, PDF, JH, PS) + */ + public void setExportFormat(String format) { + final String f = format.toUpperCase().replace('-', '_'); + try { + this.format = Enum.valueOf(Backend.class, f); + return; + } catch (IllegalArgumentException e) { + } + + Backend[] values = Backend.values(); + final StringBuilder str = new StringBuilder(); + str.append('['); + str.append(values[0]); + for (int i = 1; i < values.length; i++) { + str.append(',').append(' '); + str.append(values[i].toString().toLowerCase()); + } + str.append(']'); + System.err.printf("%s is not a supported format : one of %s expected.\n", format.toString(), str); + + } + + /* Stylesheet is useless and just kept to keep the consistency with + * builddoc V1 */ + public String process(String sourceDoc, String styleSheet) throws Throwable { + String fileToExec = null; + + if (!new File(sourceDoc).isFile()) { + System.err.println("Could not find master document: " + sourceDoc); + return null; + } + + try { + Converter converter = null; + ImageConverter imgConvert = new ImageConverter(); + + switch (format) { + case JAVAHELP: + if (!isToolbox) { + imgConvert.loadMD5s(ScilabConstants.SCI.getPath() + "/modules/helptools/etc"); + } + converter = new JavaHelpDocbookTagConverter(sourceDoc, this, imgConvert); + break; + case HTML: + converter = new HTMLDocbookTagConverter(sourceDoc, this, imgConvert); + break; + case WEB: + if (!isToolbox) { + imgConvert.loadMD5s(ScilabConstants.SCI.getPath() + "/modules/helptools/etc"); + } + converter = new HTMLDocbookTagConverter(sourceDoc, this, imgConvert); + break; + case CHM: + if (!isToolbox) { + imgConvert.loadMD5s(ScilabConstants.SCI.getPath() + "/modules/helptools/etc"); + } + converter = new CHMDocbookTagConverter(sourceDoc, this, imgConvert); + break; + case FO: + converter = new FODocbookTagConverter(sourceDoc, this, imgConvert); + break; + case JAR_ONLY: + converter = new JarOnlyConverter(this); + break; + case PDF: + case PS: + converter = new FopConverter(this); + break; + default: + System.err.printf("%s is not a supported format.\n", format); + return null; + } + + converter.registerAllExternalXMLHandlers(); + + converter.convert(); + + converter.install(); + + if (imgConvert.getScilabImageConverter() != null) { + fileToExec = imgConvert.getScilabImageConverter().getFileWithScilabCode(); + } + + } catch (SAXException e) { + System.err.println("An error occurred during the conversion:"); + System.err.println(e.toString()); + } catch (Throwable e) { + System.err.println("An error occurred during the conversion:\n"); + e.printStackTrace(); + throw e; + } + + return fileToExec; + } + + /* + * Getters + */ + + public String getOutputDirectory() { + return outputDirectory; + } + + public String getLanguage() { + return language; + } + + public Backend getFormat() { + return format; + } + + public String getImagedir() { + return imagedir; + } + + public SciDocConfiguration getConf() { + return conf; + } + + public boolean isToolbox() { + return isToolbox; + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/SynopsisLexer.java b/modules/helptools/src/java/org/scilab/modules/helptools/SynopsisLexer.java new file mode 100755 index 000000000..d8d911470 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/SynopsisLexer.java @@ -0,0 +1,727 @@ +/* The following code was generated by JFlex 1.4.3 on 23/05/12 15:21 */ + +//CHECKSTYLE:OFF + +package org.scilab.modules.helptools ; + +import java.io.IOException; +import java.io.StringReader; + +@javax.annotation.Generated("JFlex") +@SuppressWarnings("fallthrough") + +/** + * This class is a scanner generated by + * <a href="http://www.jflex.de/">JFlex</a> 1.4.3 + * on 23/05/12 15:21 from the specification file + * <tt>./jflex/function.jflex</tt> + */ +public final class SynopsisLexer { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int YYINITIAL = 0; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0 + }; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\11\0\1\1\1\3\2\0\1\2\22\0\1\1\1\6\1\12\1\6" + + "\1\7\1\4\1\11\1\13\7\0\1\10\12\5\2\0\1\14\1\0" + + "\1\15\1\6\1\0\32\6\4\0\1\6\1\0\32\6\uff85\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\1\0\1\1\1\2\2\3\1\4\2\1\1\5\1\6" + + "\1\7\1\10\1\11\1\4\1\12"; + + private static int [] zzUnpackAction() { + int [] result = new int[15]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do { + result[j++] = value; + } while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** number of newlines encountered up to the start of the matched text */ + private int yyline; + + /** the number of characters up to the start of the matched text */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + private static String currentName; + private static StringBuilder htmlBuffer = new StringBuilder(512); + private static SynopsisLexer lexer = new SynopsisLexer(); + + private SynopsisLexer() { } + + public static String convert(String name, String str) { + currentName = name; + try { + lexer.yyreset(new StringReader(str.trim())); + lexer.yybegin(YYINITIAL); + htmlBuffer.setLength(0); + lexer.yylex(); + + return htmlBuffer.toString(); + } catch (IOException e) { + return null; + } + } + + + + /** + * Creates a new scanner + * There is also a java.io.InputStream version of this constructor. + * + * @param in the java.io.Reader to read input from. + */ + public SynopsisLexer(java.io.Reader in) { + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + public SynopsisLexer(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 58) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do { + map[j++] = value; + } while (--count > 0); + } + return map; + } + + + /** + * Refills the input buffer. + * + * @return <code>false</code>, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead - zzStartRead); + + /* translate stored positions */ + zzEndRead -= zzStartRead; + zzCurrentPos -= zzStartRead; + zzMarkedPos -= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos * 2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length - zzEndRead); + + if (numRead > 0) { + zzEndRead += numRead; + return false; + } + // unlikely but not impossible: read 0 characters, but not at end of stream + if (numRead == 0) { + int c = zzReader.read(); + if (c == -1) { + return true; + } else { + zzBuffer[zzEndRead++] = (char) c; + return false; + } + } + + // numRead < 0 + return true; + } + + + /** + * Closes the input stream. + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ + zzEndRead = zzStartRead; /* invalidate buffer */ + + if (zzReader != null) { + zzReader.close(); + } + } + + + /** + * Resets the scanner to read from a new input stream. + * Does not close the old reader. + * + * All internal variables are reset, the old input stream + * <b>cannot</b> be reused (internal buffer is discarded and lost). + * Lexical state is set to <tt>ZZ_INITIAL</tt>. + * + * @param reader the new input stream + */ + public final void yyreset(java.io.Reader reader) { + zzReader = reader; + zzAtBOL = true; + zzAtEOF = false; + zzEOFDone = false; + zzEndRead = zzStartRead = 0; + zzCurrentPos = zzMarkedPos = 0; + yyline = yychar = yycolumn = 0; + zzLexicalState = YYINITIAL; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final String yytext() { + return new String( zzBuffer, zzStartRead, zzMarkedPos - zzStartRead ); + } + + + /** + * Returns the character at position <tt>pos</tt> from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer[zzStartRead + pos]; + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos - zzStartRead; + } + + + /** + * Reports an error that occurred while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) { + zzScanError(ZZ_PUSHBACK_2BIG); + } + + zzMarkedPos -= number; + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public void yylex() throws java.io.IOException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + char [] zzBufferL = zzBuffer; + char [] zzCMapL = ZZ_CMAP; + + + while (true) { + zzMarkedPosL = zzMarkedPos; + + yychar += zzMarkedPosL - zzStartRead; + + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) { + zzInput = zzBufferL[zzCurrentPosL++]; + } else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } else { + zzInput = zzBufferL[zzCurrentPosL++]; + } + } + zzInput = zzCMapL[zzInput]; + + boolean zzIsFinal = false; + boolean zzNoLookAhead = false; + + zzForNext: { + switch (zzState) { + case 0: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 2; + break zzForNext; + case 2: + zzIsFinal = true; + zzState = 3; + break zzForNext; + case 3: + zzIsFinal = true; + zzState = 4; + break zzForNext; + case 4: + case 6: + zzIsFinal = true; + zzState = 5; + break zzForNext; + case 7: + zzIsFinal = true; + zzState = 6; + break zzForNext; + case 8: + zzIsFinal = true; + zzState = 7; + break zzForNext; + case 9: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 8; + break zzForNext; + case 10: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 9; + break zzForNext; + case 11: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 10; + break zzForNext; + case 12: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 11; + break zzForNext; + case 13: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 12; + break zzForNext; + default: + zzIsFinal = true; + zzState = 1; + break zzForNext; + } + + case 1: + switch (zzInput) { + case 0: + case 1: + case 5: + case 7: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 2: + switch (zzInput) { + case 0: + case 5: + case 7: + zzIsFinal = true; + zzState = 1; + break zzForNext; + case 1: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 3: + switch (zzInput) { + case 1: + case 3: + zzIsFinal = true; + zzState = 4; + break zzForNext; + default: + break zzForAction; + } + + case 4: + switch (zzInput) { + case 1: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 5: + switch (zzInput) { + case 5: + case 6: + case 7: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 6: + switch (zzInput) { + case 0: + case 1: + zzIsFinal = true; + zzState = 1; + break zzForNext; + case 6: + zzIsFinal = true; + zzState = 5; + break zzForNext; + case 5: + case 7: + zzIsFinal = true; + zzState = 13; + break zzForNext; + default: + break zzForAction; + } + + case 7: + switch (zzInput) { + case 8: + zzIsFinal = true; + zzState = 14; + break zzForNext; + default: + break zzForAction; + } + + case 13: + switch (zzInput) { + case 0: + case 1: + zzIsFinal = true; + zzState = 1; + break zzForNext; + case 6: + zzIsFinal = true; + zzState = 5; + break zzForNext; + case 5: + case 7: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 14: + switch (zzInput) { + case 2: + case 3: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + default: + // if this is ever reached, there is a serious bug in JFlex + zzScanError(ZZ_UNKNOWN_ERROR); + break; + } + } + + if ( zzIsFinal ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( zzNoLookAhead ) { + break zzForAction; + } + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 10 : + { + htmlBuffer.append("<span class=\"comment\">"); + htmlBuffer.append(yytext()); + htmlBuffer.append("</span>"); + } + case 11: + break; + case 9: { + htmlBuffer.append(">"); + } + case 12: + break; + case 2: { + htmlBuffer.append(" "); + } + case 13: + break; + case 3: { + htmlBuffer.append("\n"); + } + case 14: + break; + case 6: { + htmlBuffer.append("""); + } + case 15: + break; + case 5: { + htmlBuffer.append("&"); + } + case 16: + break; + case 4: { + String str = yytext(); + if (str.equals(currentName)) { + htmlBuffer.append("<span class=\"functionid\">"); + } else { + htmlBuffer.append("<span class=\"default\">"); + } + htmlBuffer.append(str); + htmlBuffer.append("</span>"); + } + case 17: + break; + case 8: { + htmlBuffer.append("<"); + } + case 18: + break; + case 1: { + htmlBuffer.append("<span class=\"default\">"); + htmlBuffer.append(yytext()); + htmlBuffer.append("</span>"); + } + case 19: + break; + case 7: { + htmlBuffer.append("'"); + } + case 20: + break; + default: + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + { + return; + } + } else { + zzScanError(ZZ_NO_MATCH); + } + } + } + } + + +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/TemplateFiller.java b/modules/helptools/src/java/org/scilab/modules/helptools/TemplateFiller.java new file mode 100755 index 000000000..fe8a0b75f --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/TemplateFiller.java @@ -0,0 +1,97 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +/** + * Class to convert DocBook to JavaHelp + * @author Calixte DENIZET + */ +public interface TemplateFiller { + + /** + * Make a previous item for the current id + * @param current id + * @return the corresponding html + */ + public String makePrevious(String id); + + /** + * Make a previous item for the current id + * @param current id + * @return the corresponding html + */ + public String makePath(String id); + + /** + * Make a top item for the current id + * @param current id + * @return the corresponding html + */ + public String makeTop(String id); + + /** + * Make a next item for the current id + * @param current id + * @return the corresponding html + */ + public String makeNext(String id); + + /** + * Make a list of the tocs + * @param current id + * @return the corresponding html + */ + public String makeTocList(String id); + + /** + * Make the lastModified html + * @param current id + * @return the corresponding html + */ + public String makeLastModified(String id); + + /** + * Make the subtitle + * @param current id + * @return the corresponding html + */ + public String makeSubtitle(String id); + + /** + * Make the title + * @param current id + * @return the corresponding html + */ + public String makeTitle(String id); + + /** + * Make the generation date + * @param current id + * @return the corresponding html + */ + public String makeGenerationDate(String id); + + /** + * Make the version + * @param current id + * @return the corresponding html + */ + public String makeVersion(String id); + + /** + * Make the start tag + * @param current id + * @return the corresponding html + */ + public String makeStart(String id); +}
\ No newline at end of file diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/TemplateHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/TemplateHandler.java new file mode 100755 index 000000000..c4f13ca82 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/TemplateHandler.java @@ -0,0 +1,106 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.BufferedReader; +import java.io.FileReader; +import java.nio.charset.Charset; + +/** + * Class to handle a template + * @author Calixte DENIZET + */ +public class TemplateHandler { + + private String[] array; + private TemplateFiller filler; + private String language; + + public TemplateHandler(TemplateFiller filler, File f, String language) { + this.filler = filler; + this.language = language; + parseFile(f); + } + + public void generateFileFromTemplate(String fileName, String id, String contents) { + try { + OutputStream out = new FileOutputStream(fileName); + OutputStreamWriter writer = new OutputStreamWriter(out, Charset.forName("UTF-8")); + + for (int i = 0; i < array.length; i += 2) { + writer.append(array[i]); + String str = ""; + if (i + 1 < array.length) { + if (array[i + 1].equals("content")) { + str = contents; + } else if (array[i + 1].equals("top")) { + str = filler.makeTop(id); + } else if (array[i + 1].equals("previous")) { + str = filler.makePrevious(id); + } else if (array[i + 1].equals("next")) { + str = filler.makeNext(id); + } else if (array[i + 1].equals("path")) { + str = filler.makePath(id); + } else if (array[i + 1].equals("title")) { + str = filler.makeTitle(id); + } else if (array[i + 1].equals("subtitle")) { + str = filler.makeSubtitle(id); + } else if (array[i + 1].equals("toclist")) { + str = filler.makeTocList(id); + } else if (array[i + 1].equals("lastmodified")) { + str = filler.makeLastModified(id); + } else if (array[i + 1].equals("generationdate")) { + str = filler.makeGenerationDate(id); + } else if (array[i + 1].equals("version")) { + str = filler.makeVersion(id);; + } else if (array[i + 1].equals("start")) { + str = filler.makeStart(id); + } else if (array[i + 1].startsWith("translate=")) { + String toTranslate = array[i + 1].substring("translate=".length()); + str = TemplateLocalization.getLocalized(language, toTranslate); + } + writer.append(str); + } + } + + writer.flush(); + writer.close(); + out.flush(); + out.close(); + } catch (IOException e) { + System.err.println(e); + } + } + + private void parseFile(File f) { + try { + BufferedReader reader = new BufferedReader(new FileReader(f)); + String line = null; + StringBuilder stringBuilder = new StringBuilder(); + while ((line = reader.readLine()) != null ) { + stringBuilder.append(line); + stringBuilder.append("\n"); + } + reader.close(); + + array = stringBuilder.toString().split("(<!--<)|(>-->)"); + } catch (IOException e) { + e.printStackTrace(); + } + } +}
\ No newline at end of file diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/TemplateLocalization.java b/modules/helptools/src/java/org/scilab/modules/helptools/TemplateLocalization.java new file mode 100755 index 000000000..a932eb15d --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/TemplateLocalization.java @@ -0,0 +1,55 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import java.util.HashMap; +import java.util.Map; + +/** + * Class to handle a template localization + * @author Calixte DENIZET + */ +public final class TemplateLocalization { + + private static final Map<String, Map<String, String>> map = new HashMap<String, Map<String, String>>(); + + static { + Map<String, String> report_an_issue = new HashMap<String, String>(); + report_an_issue.put("fr_FR", "Signaler un problème"); + report_an_issue.put("pt_BR", "Reportero a bugo"); + report_an_issue.put("es_ES", "Raportare el bugo"); + report_an_issue.put("ja_JP", "問題を報告"); + report_an_issue.put("ru_RU", "Сообщить об ошибке"); + + map.put("Report an issue", report_an_issue); + } + + public static final String getLocalized(final String language, final String str) { + if (language.equals("en_US")) { + return str; + } + + Map<String, String> m = map.get(str); + if (m == null) { + return str; + } + + String s = m.get(language); + if (s == null) { + return str; + } + + return s; + } +} + diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/UnhandledDocbookTagException.java b/modules/helptools/src/java/org/scilab/modules/helptools/UnhandledDocbookTagException.java new file mode 100755 index 000000000..6d1be418b --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/UnhandledDocbookTagException.java @@ -0,0 +1,23 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools; + +import org.xml.sax.SAXException; + +@SuppressWarnings(value = { "serial" }) +public class UnhandledDocbookTagException extends SAXException { + + public UnhandledDocbookTagException(String tag) { + super("The tag " + tag + " is not handled."); + } +}
\ No newline at end of file diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/XML/AbstractXMLCodeHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/XML/AbstractXMLCodeHandler.java new file mode 100755 index 000000000..759691366 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/XML/AbstractXMLCodeHandler.java @@ -0,0 +1,138 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.XML; + +import java.io.IOException; + +public abstract class AbstractXMLCodeHandler { + + /** + * Handle default: when a char sequence is unidentified + * @param seq the sequence to append + */ + public void handleDefault(String seq) throws IOException { } + + /** + * Handle entity such as &amp; + * @param seq the sequence to append + */ + public void handleEntity(String seq) throws IOException { } + + /** + * Nothing special + * @param seq the sequence to append + */ + public void handleNothing(String seq) throws IOException { } + + /** + * Handle <? + * @param seq the sequence to append + */ + public void handleOpenInstr(String seq) throws IOException { } + + /** + * Handle ?> + * @param seq the sequence to append + */ + public void handleCloseInstr(String seq) throws IOException { } + + /** + * Handle instruction name + * @param seq the sequence to append + */ + public void handleInstrName(String seq) throws IOException { } + + /** + * Handle < + * @param seq the sequence to append + */ + public void handleLow(String seq) throws IOException { } + + /** + * Handle <name + * @param seq the sequence to append + */ + public void handleOpenTagName(String seq) throws IOException { } + + /** + * Handle </ + * @param seq the sequence to append + */ + public void handleLowClose(String seq) throws IOException { } + + /** + * Handle > + * @param seq the sequence to append + */ + public void handleGreat(String seq) throws IOException { } + + /** + * Handle <!-- + * @param seq the sequence to append + */ + public void handleOpenComment(String seq) throws IOException { } + + /** + * Handle <![CDATA[ + * @param seq the sequence to append + */ + public void handleOpenCdata(String seq) throws IOException { } + + /** + * Handle an attribute name + * @param seq the sequence to append + */ + public void handleAttributeName(String seq) throws IOException { } + + /** + * Handle '=' used in attribute definition + * @param seq the sequence to append + */ + public void handleEqual(String seq) throws IOException { } + + /** + * Handle "value" or 'value' + * @param seq the sequence to append + */ + public void handleAttributeValue(String seq) throws IOException { } + + /** + * Handle /> + * @param seq the sequence to append + */ + public void handleAutoClose(String seq) throws IOException { } + + /** + * Handle --> + * @param seq the sequence to append + */ + public void handleCommentEnd(String seq) throws IOException { } + + /** + * Handle comments + * @param seq the sequence to append + */ + public void handleComment(String seq) throws IOException { } + + /** + * Handle ]]> + * @param seq the sequence to append + */ + public void handleCdataEnd(String seq) throws IOException { } + + /** + * Handle cdata contents + * @param seq the sequence to append + */ + public void handleCdata(String seq) throws IOException { } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/XML/HTMLXMLCodeHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/XML/HTMLXMLCodeHandler.java new file mode 100755 index 000000000..1d3b7a236 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/XML/HTMLXMLCodeHandler.java @@ -0,0 +1,221 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.XML; + +import java.io.IOException; + +public class HTMLXMLCodeHandler extends AbstractXMLCodeHandler { + + private static final int BUFCAPACITY = 8192; + private static HTMLXMLCodeHandler handler = new HTMLXMLCodeHandler(); + + protected Appendable buffer; + + protected HTMLXMLCodeHandler() { + buffer = new StringBuilder(BUFCAPACITY); + } + + public static AbstractXMLCodeHandler getInstance() { + ((StringBuilder) handler.buffer).setLength(0); + return handler; + } + + public static String replaceEntity(String str) { + return str.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("\'", "'"); + } + + /** + * {@inheritDoc} + */ + public void handleDefault(String seq) throws IOException { + buffer.append("<span class=\"xmldefault\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleEntity(String seq) throws IOException { + buffer.append("<span class=\"xmlentity\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleNothing(String seq) throws IOException { + buffer.append(seq); + } + + /** + * {@inheritDoc} + */ + public void handleOpenInstr(String seq) throws IOException { + buffer.append("<span class=\"xmlopeninstr\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleCloseInstr(String seq) throws IOException { + buffer.append("<span class=\"xmlcloseinstr\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleInstrName(String seq) throws IOException { + buffer.append("<span class=\"xmlinstrname\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleLow(String seq) throws IOException { + buffer.append("<span class=\"xmllowtag\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleOpenTagName(String seq) throws IOException { + buffer.append("<span class=\"xmltagname\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleLowClose(String seq) throws IOException { + buffer.append("<span class=\"xmllowclose\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleGreat(String seq) throws IOException { + buffer.append("<span class=\"xmlgreattag\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleOpenComment(String seq) throws IOException { + buffer.append("<span class=\"xmlopencomment\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleOpenCdata(String seq) throws IOException { + buffer.append("<span class=\"xmlopencdata\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleAttributeName(String seq) throws IOException { + buffer.append("<span class=\"xmlattributename\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleEqual(String seq) throws IOException { + buffer.append("<span class=\"xmlequal\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleAttributeValue(String seq) throws IOException { + buffer.append("<span class=\"xmlattributevalue\">"); + buffer.append(replaceEntity(seq)); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleAutoClose(String seq) throws IOException { + buffer.append("<span class=\"xmlautoclose\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleCommentEnd(String seq) throws IOException { + buffer.append("<span class=\"xmlcommentend\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleComment(String seq) throws IOException { + buffer.append("<span class=\"xmlcomment\">"); + buffer.append(replaceEntity(seq)); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleCdataEnd(String seq) throws IOException { + buffer.append("<span class=\"xmlcdataend\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleCdata(String seq) throws IOException { + buffer.append("<span class=\"xmlcdata\">"); + buffer.append(replaceEntity(seq)); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public String toString() { + return buffer.toString(); + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/XML/XMLLexer.java b/modules/helptools/src/java/org/scilab/modules/helptools/XML/XMLLexer.java new file mode 100755 index 000000000..1d9cd4626 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/XML/XMLLexer.java @@ -0,0 +1,1473 @@ +/* The following code was generated by JFlex 1.4.3 on 23/05/12 15:21 */ + +//CHECKSTYLE:OFF + +package org.scilab.modules.helptools.XML; + +import java.io.Reader; +import java.io.StringReader; +import java.io.IOException; + +@javax.annotation.Generated("JFlex") +@SuppressWarnings("fallthrough") + +/** + * This class is a scanner generated by + * <a href="http://www.jflex.de/">JFlex</a> 1.4.3 + * on 23/05/12 15:21 from the specification file + * <tt>./jflex/xml.jflex</tt> + */ +public final class XMLLexer { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int CLEANFIRST = 12; + public static final int CLEAN = 10; + public static final int YYINITIAL = 0; + public static final int COMMENT = 2; + public static final int CDATA = 4; + public static final int TAG = 6; + public static final int PI = 8; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 + }; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\11\0\1\1\1\15\2\0\1\15\22\0\1\1\1\13\1\27\1\3" + + "\2\0\1\2\1\30\5\0\1\7\1\10\1\25\12\11\1\5\1\4" + + "\1\12\1\26\1\14\1\24\1\0\1\21\1\6\1\17\1\20\1\6" + + "\16\6\1\22\6\6\1\16\1\10\1\23\1\10\1\5\1\10\32\6" + + "\74\10\1\10\10\10\27\5\1\10\37\5\1\10\u0208\5\160\10\16\5" + + "\1\10\u1c81\5\14\10\2\5\63\10\57\0\u0120\5\u0a70\0\u03f0\5\21\0" + + "\ua7ff\5\u2100\0\u04d0\5\40\0\u020e\5\2\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\1\1\1\2\1\3\4\0\2\1\1\0\1\4\1\2" + + "\1\0\1\5\1\3\1\6\1\0\1\7\1\10\1\7" + + "\1\11\1\12\3\7\1\13\1\7\1\14\1\15\1\16" + + "\1\17\1\20\1\7\1\21\1\22\10\0\1\23\1\24" + + "\1\0\1\25\1\0\1\26\2\0\1\27\2\0\1\30" + + "\1\0\1\31\1\32\2\0\1\33\4\0\1\34"; + + private static int [] zzUnpackAction() { + int [] result = new int[66]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do { + result[j++] = value; + } while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** number of newlines encountered up to the start of the matched text */ + private int yyline; + + /** the number of characters up to the start of the matched text */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + + private int whitesOnFirstLine; + private int saveLexState; + private AbstractXMLCodeHandler handler; + + public XMLLexer() { } + + private String trimEnd(String str) { + int end = str.length() - 1; + int i = end; + for (; i >= 0; i--) { + char c = str.charAt(i); + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { + break; + } + } + if (i != end) { + return str.substring(0, i + 1); + } + + return str; + } + + public String convert(AbstractXMLCodeHandler h, String code) { + Reader reader = new StringReader(trimEnd(code)); + String str = convert(h, reader, true); + try { + reader.close(); + } catch (IOException e) { } + + return str; + } + + public String convert(AbstractXMLCodeHandler h, Reader code, boolean ret) { + if (code == null) { + return null; + } else { + handler = h; + whitesOnFirstLine = 0; + yyreset(code); + yybegin(CLEANFIRST); + try { + yylex(); + } catch (IOException e) { + return null; + } + if (ret) { + return h.toString(); + } + return ""; + } + } + + + /** + * Creates a new scanner + * There is also a java.io.InputStream version of this constructor. + * + * @param in the java.io.Reader to read input from. + */ + public XMLLexer(java.io.Reader in) { + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + public XMLLexer(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 132) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do { + map[j++] = value; + } while (--count > 0); + } + return map; + } + + + /** + * Refills the input buffer. + * + * @return <code>false</code>, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead - zzStartRead); + + /* translate stored positions */ + zzEndRead -= zzStartRead; + zzCurrentPos -= zzStartRead; + zzMarkedPos -= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos * 2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length - zzEndRead); + + if (numRead > 0) { + zzEndRead += numRead; + return false; + } + // unlikely but not impossible: read 0 characters, but not at end of stream + if (numRead == 0) { + int c = zzReader.read(); + if (c == -1) { + return true; + } else { + zzBuffer[zzEndRead++] = (char) c; + return false; + } + } + + // numRead < 0 + return true; + } + + + /** + * Closes the input stream. + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ + zzEndRead = zzStartRead; /* invalidate buffer */ + + if (zzReader != null) { + zzReader.close(); + } + } + + + /** + * Resets the scanner to read from a new input stream. + * Does not close the old reader. + * + * All internal variables are reset, the old input stream + * <b>cannot</b> be reused (internal buffer is discarded and lost). + * Lexical state is set to <tt>ZZ_INITIAL</tt>. + * + * @param reader the new input stream + */ + public final void yyreset(java.io.Reader reader) { + zzReader = reader; + zzAtBOL = true; + zzAtEOF = false; + zzEOFDone = false; + zzEndRead = zzStartRead = 0; + zzCurrentPos = zzMarkedPos = 0; + yyline = yychar = yycolumn = 0; + zzLexicalState = YYINITIAL; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final String yytext() { + return new String( zzBuffer, zzStartRead, zzMarkedPos - zzStartRead ); + } + + + /** + * Returns the character at position <tt>pos</tt> from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer[zzStartRead + pos]; + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos - zzStartRead; + } + + + /** + * Reports an error that occurred while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) { + zzScanError(ZZ_PUSHBACK_2BIG); + } + + zzMarkedPos -= number; + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public void yylex() throws java.io.IOException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + char [] zzBufferL = zzBuffer; + char [] zzCMapL = ZZ_CMAP; + + + while (true) { + zzMarkedPosL = zzMarkedPos; + + yychar += zzMarkedPosL - zzStartRead; + + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) { + zzInput = zzBufferL[zzCurrentPosL++]; + } else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } else { + zzInput = zzBufferL[zzCurrentPosL++]; + } + } + zzInput = zzCMapL[zzInput]; + + boolean zzIsFinal = false; + boolean zzNoLookAhead = false; + + zzForNext: { + switch (zzState) { + case 0: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzState = 8; + break zzForNext; + case 10: + zzState = 9; + break zzForNext; + case 13: + zzIsFinal = true; + zzState = 10; + break zzForNext; + default: + zzIsFinal = true; + zzState = 7; + break zzForNext; + } + + case 1: + switch (zzInput) { + case 7: + zzState = 12; + break zzForNext; + case 13: + zzIsFinal = true; + zzState = 13; + break zzForNext; + default: + zzIsFinal = true; + zzState = 11; + break zzForNext; + } + + case 2: + switch (zzInput) { + case 13: + zzIsFinal = true; + zzState = 15; + break zzForNext; + case 19: + zzState = 16; + break zzForNext; + default: + zzIsFinal = true; + zzState = 14; + break zzForNext; + } + + case 3: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 18; + break zzForNext; + case 5: + case 6: + case 15: + case 16: + case 17: + case 18: + zzIsFinal = true; + zzState = 19; + break zzForNext; + case 12: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 20; + break zzForNext; + case 13: + zzIsFinal = true; + zzState = 21; + break zzForNext; + case 21: + zzIsFinal = true; + zzState = 22; + break zzForNext; + case 23: + zzIsFinal = true; + zzState = 23; + break zzForNext; + case 24: + zzIsFinal = true; + zzState = 24; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 17; + break zzForNext; + } + + case 4: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 18; + break zzForNext; + case 5: + case 6: + case 15: + case 16: + case 17: + case 18: + zzIsFinal = true; + zzState = 19; + break zzForNext; + case 23: + zzIsFinal = true; + zzState = 23; + break zzForNext; + case 24: + zzIsFinal = true; + zzState = 24; + break zzForNext; + case 13: + zzIsFinal = true; + zzState = 25; + break zzForNext; + case 20: + zzIsFinal = true; + zzState = 26; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 17; + break zzForNext; + } + + case 5: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 28; + break zzForNext; + case 13: + zzIsFinal = true; + zzState = 29; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 27; + break zzForNext; + } + + case 6: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 31; + break zzForNext; + case 13: + zzIsFinal = true; + zzState = 32; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 30; + break zzForNext; + } + + case 7: + switch (zzInput) { + case 10: + case 13: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 8: + switch (zzInput) { + case 3: + case 6: + case 9: + case 15: + case 16: + case 17: + case 18: + zzIsFinal = true; + break zzForNext; + case 4: + zzIsFinal = true; + zzState = 33; + break zzForNext; + case 10: + case 13: + break zzForAction; + default: + zzIsFinal = true; + zzState = 7; + break zzForNext; + } + + case 9: + switch (zzInput) { + case 5: + case 6: + case 15: + case 16: + case 17: + case 18: + zzIsFinal = true; + zzState = 34; + break zzForNext; + case 11: + zzState = 35; + break zzForNext; + case 20: + zzState = 36; + break zzForNext; + case 21: + zzState = 37; + break zzForNext; + default: + break zzForAction; + } + + case 10: + switch (zzInput) { + case 13: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 11: + switch (zzInput) { + case 7: + zzState = 38; + break zzForNext; + case 13: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 12: + switch (zzInput) { + case 7: + zzState = 39; + break zzForNext; + case 13: + break zzForAction; + default: + zzIsFinal = true; + zzState = 11; + break zzForNext; + } + + case 13: + switch (zzInput) { + case 13: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 14: + switch (zzInput) { + case 19: + zzState = 40; + break zzForNext; + case 13: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 15: + switch (zzInput) { + case 13: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 16: + switch (zzInput) { + case 19: + zzState = 41; + break zzForNext; + case 13: + break zzForAction; + default: + zzIsFinal = true; + zzState = 14; + break zzForNext; + } + + case 18: + switch (zzInput) { + case 1: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 19: + switch (zzInput) { + case 5: + case 6: + case 7: + case 8: + case 9: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + zzState = 42; + break zzForNext; + case 22: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 43; + break zzForNext; + default: + break zzForAction; + } + + case 21: + switch (zzInput) { + case 13: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 22: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 44; + break zzForNext; + default: + break zzForAction; + } + + case 23: + switch (zzInput) { + case 23: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 46; + break zzForNext; + case 13: + break zzForAction; + default: + zzState = 45; + break zzForNext; + } + + case 24: + switch (zzInput) { + case 24: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 46; + break zzForNext; + case 13: + break zzForAction; + default: + zzState = 47; + break zzForNext; + } + + case 25: + switch (zzInput) { + case 13: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 26: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 48; + break zzForNext; + default: + break zzForAction; + } + + case 28: + switch (zzInput) { + case 1: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 29: + switch (zzInput) { + case 13: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 31: + switch (zzInput) { + case 1: + zzIsFinal = true; + break zzForNext; + case 13: + zzIsFinal = true; + zzState = 32; + break zzForNext; + default: + break zzForAction; + } + + case 32: + switch (zzInput) { + case 13: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 33: + switch (zzInput) { + case 10: + case 13: + break zzForAction; + default: + zzIsFinal = true; + zzState = 7; + break zzForNext; + } + + case 34: + switch (zzInput) { + case 5: + case 6: + case 7: + case 8: + case 9: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 35: + switch (zzInput) { + case 7: + zzState = 49; + break zzForNext; + case 14: + zzState = 50; + break zzForNext; + default: + break zzForAction; + } + + case 36: + switch (zzInput) { + case 5: + case 6: + case 15: + case 16: + case 17: + case 18: + zzIsFinal = true; + zzState = 51; + break zzForNext; + default: + break zzForAction; + } + + case 37: + switch (zzInput) { + case 5: + case 6: + case 15: + case 16: + case 17: + case 18: + zzState = 52; + break zzForNext; + default: + break zzForAction; + } + + case 38: + switch (zzInput) { + case 7: + zzState = 53; + break zzForNext; + case 13: + break zzForAction; + default: + zzIsFinal = true; + zzState = 11; + break zzForNext; + } + + case 39: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 54; + break zzForNext; + case 13: + break zzForAction; + default: + zzIsFinal = true; + zzState = 11; + break zzForNext; + } + + case 40: + switch (zzInput) { + case 19: + zzState = 55; + break zzForNext; + case 13: + break zzForAction; + default: + zzIsFinal = true; + zzState = 14; + break zzForNext; + } + + case 41: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 56; + break zzForNext; + case 13: + break zzForAction; + default: + zzIsFinal = true; + zzState = 14; + break zzForNext; + } + + case 42: + switch (zzInput) { + case 5: + case 6: + case 7: + case 8: + case 9: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + break zzForNext; + case 22: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 43; + break zzForNext; + default: + break zzForAction; + } + + case 45: + switch (zzInput) { + case 23: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 46; + break zzForNext; + case 13: + break zzForAction; + default: + break zzForNext; + } + + case 47: + switch (zzInput) { + case 24: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 46; + break zzForNext; + case 13: + break zzForAction; + default: + break zzForNext; + } + + case 49: + switch (zzInput) { + case 7: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 57; + break zzForNext; + default: + break zzForAction; + } + + case 50: + switch (zzInput) { + case 15: + zzState = 58; + break zzForNext; + default: + break zzForAction; + } + + case 51: + switch (zzInput) { + case 5: + case 6: + case 7: + case 8: + case 9: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 52: + switch (zzInput) { + case 5: + case 6: + case 7: + case 8: + case 9: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + break zzForNext; + case 1: + zzState = 59; + break zzForNext; + case 12: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 60; + break zzForNext; + default: + break zzForAction; + } + + case 53: + switch (zzInput) { + case 12: + case 13: + break zzForAction; + default: + zzIsFinal = true; + zzState = 11; + break zzForNext; + } + + case 55: + switch (zzInput) { + case 12: + case 13: + break zzForAction; + default: + zzIsFinal = true; + zzState = 14; + break zzForNext; + } + + case 58: + switch (zzInput) { + case 16: + zzState = 61; + break zzForNext; + default: + break zzForAction; + } + + case 59: + switch (zzInput) { + case 1: + break zzForNext; + case 12: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 60; + break zzForNext; + default: + break zzForAction; + } + + case 61: + switch (zzInput) { + case 17: + zzState = 62; + break zzForNext; + default: + break zzForAction; + } + + case 62: + switch (zzInput) { + case 18: + zzState = 63; + break zzForNext; + default: + break zzForAction; + } + + case 63: + switch (zzInput) { + case 17: + zzState = 64; + break zzForNext; + default: + break zzForAction; + } + + case 64: + switch (zzInput) { + case 14: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 65; + break zzForNext; + default: + break zzForAction; + } + + default: + // if this is ever reached, there is a serious bug in JFlex + zzScanError(ZZ_UNKNOWN_ERROR); + break; + } + } + + if ( zzIsFinal ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( zzNoLookAhead ) { + break zzForAction; + } + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 15 : + { + yypushback(1); + yybegin(YYINITIAL); + } + case 29: + break; + case 27: { + handler.handleLowClose("</"); + String str = yytext(); + handler.handleOpenTagName(str.substring(2, str.length() - 1).trim()); + handler.handleGreat(">"); + } + case 30: + break; + case 5: { + handler.handleNothing("\n"); + saveLexState = COMMENT; + yybegin(CLEAN); + } + case 31: + break; + case 25: { + yybegin(YYINITIAL); + handler.handleCdataEnd("]]>"); + } + case 32: + break; + case 28: { + yybegin(CDATA); + handler.handleOpenCdata("<![CDATA["); + } + case 33: + break; + case 14: { + handler.handleNothing("\n"); + } + case 34: + break; + case 23: { + yybegin(PI); + handler.handleOpenInstr("<?"); + handler.handleInstrName(yytext().substring(2)); + } + case 35: + break; + case 2: { + handler.handleComment(yytext()); + } + case 36: + break; + case 18: { + yybegin(TAG); + handler.handleLow("<"); + handler.handleOpenTagName(yytext().substring(1)); + } + case 37: + break; + case 4: { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } + case 38: + break; + case 16: { + whitesOnFirstLine = yylength(); + yybegin(YYINITIAL); + } + case 39: + break; + case 12: { + yypushback(1); + yybegin(saveLexState); + } + case 40: + break; + case 17: { + handler.handleEntity("&" + yytext().substring(1)); + } + case 41: + break; + case 6: { + handler.handleNothing("\n"); + saveLexState = CDATA; + yybegin(CLEAN); + } + case 42: + break; + case 22: { + yybegin(YYINITIAL); + handler.handleCloseInstr("?>"); + } + case 43: + break; + case 11: { + handler.handleNothing("\n"); + saveLexState = PI; + yybegin(CLEAN); + } + case 44: + break; + case 8: { + handler.handleNothing(" "); + } + case 45: + break; + case 24: { + yybegin(YYINITIAL); + handler.handleCommentEnd("-->"); + } + case 46: + break; + case 21: { + handler.handleAttributeValue(yytext()); + } + case 47: + break; + case 1: { + handler.handleDefault(yytext()); + } + case 48: + break; + case 9: { + yybegin(YYINITIAL); + handler.handleGreat(">"); + } + case 49: + break; + case 3: { + handler.handleCdata(yytext()); + } + case 50: + break; + case 13: { + int len = yylength() - whitesOnFirstLine; + if (len > 0) { + yypushback(len); + } + yybegin(saveLexState); + } + case 51: + break; + case 20: { + yybegin(YYINITIAL); + handler.handleAutoClose("/>"); + } + case 52: + break; + case 26: { + yybegin(COMMENT); + handler.handleOpenComment("<!--"); + } + case 53: + break; + case 19: { + String str = yytext(); + handler.handleAttributeName(str.substring(0, str.length() - 1)); + handler.handleEqual("="); + } + case 54: + break; + case 10: { + handler.handleNothing("\n"); + saveLexState = TAG; + yybegin(CLEAN); + } + case 55: + break; + case 7: { + } + case 56: + break; + default: + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + { + return; + } + } else { + zzScanError(ZZ_NO_MATCH); + } + } + } + } + + +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/c/AbstractCCodeHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/c/AbstractCCodeHandler.java new file mode 100755 index 000000000..1bc66aa05 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/c/AbstractCCodeHandler.java @@ -0,0 +1,90 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.c; + +import java.io.IOException; + +public abstract class AbstractCCodeHandler { + + /** + * Handle default: when a char sequence is unidentified + * @param seq the sequence to append + */ + public void handleDefault(String seq) throws IOException { } + + /** + * Handle comments + * @param seq the sequence to append + */ + public void handleComment(String seq) throws IOException { } + + /** + * Nothing special + * @param seq the sequence to append + */ + public void handleNothing(String seq) throws IOException { } + + /** + * Handle string + * @param seq the sequence to append + */ + public void handleString(String seq) throws IOException { } + + /** + * Handle number + * @param seq the sequence to append + */ + public void handleNumber(String seq) throws IOException { } + + /** + * Handle keyword such as 'for' + * @param seq the sequence to append + */ + public void handleKeyword(String seq) throws IOException { } + + /** + * Handle type such as 'int' + * @param seq the sequence to append + */ + public void handleType(String seq) throws IOException { } + + /** + * Handle modifier such as 'inline' + * @param seq the sequence to append + */ + public void handleModifier(String seq) throws IOException { } + + /** + * Handle preprocessor instruction such as '#define' + * @param seq the sequence to append + */ + public void handlePreprocessor(String seq) throws IOException { } + + /** + * Handle (,),{,},... + * @param seq the sequence to append + */ + public void handleOpenClose(String seq) throws IOException { } + + /** + * Handle +,-,*,... + * @param seq the sequence to append + */ + public void handleOperator(String seq) throws IOException { } + + /** + * Handle an identifier (starts with a lower case char) + * @param seq the sequence to append + */ + public void handleId(String seq) throws IOException { } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/c/CLexer.java b/modules/helptools/src/java/org/scilab/modules/helptools/c/CLexer.java new file mode 100755 index 000000000..fdb6d93b5 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/c/CLexer.java @@ -0,0 +1,7944 @@ +/* The following code was generated by JFlex 1.4.3 on 23/05/12 15:21 */ + +//CHECKSTYLE:OFF + +package org.scilab.modules.helptools.c; + +import java.io.Reader; +import java.io.StringReader; +import java.io.IOException; + +@javax.annotation.Generated("JFlex") +@SuppressWarnings("fallthrough") + +/** + * This class is a scanner generated by + * <a href="http://www.jflex.de/">JFlex</a> 1.4.3 + * on 23/05/12 15:21 from the specification file + * <tt>./jflex/c.jflex</tt> + */ +public final class CLexer { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int STRING = 4; + public static final int CLEANFIRST = 8; + public static final int CLEAN = 6; + public static final int YYINITIAL = 0; + public static final int COMMENT = 2; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0, 1, 1, 2, 2, 3, 3, 4, 4 + }; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\11\0\1\31\1\2\1\0\1\3\1\1\22\0\1\3\1\61\1\26" + + "\1\57\1\0\2\61\1\30\2\60\1\5\1\21\1\61\1\21\1\24" + + "\1\4\1\22\11\11\2\61\1\63\1\61\1\62\1\61\1\0\4\10" + + "\1\20\1\17\5\6\1\15\1\6\1\25\6\6\1\13\2\6\1\23" + + "\2\6\1\60\1\27\1\60\1\61\1\7\1\0\1\32\1\35\1\41" + + "\1\46\1\37\1\16\1\51\1\43\1\44\1\6\1\40\1\14\1\50" + + "\1\45\1\34\1\52\1\64\1\36\1\42\1\33\1\12\1\55\1\53" + + "\1\56\1\47\1\54\1\60\1\61\1\60\1\61\uff81\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\1\0\1\1\1\2\2\0\2\3\1\4\1\5\1\6" + + "\1\7\3\6\1\7\1\5\1\6\1\10\1\3\21\6" + + "\1\3\1\11\3\5\1\1\2\12\2\0\1\2\2\13" + + "\1\14\1\0\1\15\1\16\1\17\1\20\1\21\1\22" + + "\1\1\1\23\2\7\7\6\1\0\1\6\2\0\6\6" + + "\1\5\20\6\1\24\4\6\1\24\11\6\7\0\1\1" + + "\2\25\1\26\1\0\1\7\1\0\6\6\1\7\1\6" + + "\2\2\34\6\1\27\16\6\6\0\1\30\4\0\1\7" + + "\1\0\5\6\1\7\40\6\11\0\4\6\1\5\5\6" + + "\1\31\15\6\1\0\1\30\4\0\1\31\11\6\3\0" + + "\12\6"; + + private static int [] zzUnpackAction() { + int [] result = new int[290]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do { + result[j++] = value; + } while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** number of newlines encountered up to the start of the matched text */ + private int yyline; + + /** the number of characters up to the start of the matched text */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + + private int whitesOnFirstLine; + private int saveLexState; + private AbstractCCodeHandler handler; + + public CLexer() { } + + private String trimEnd(String str) { + int end = str.length() - 1; + int i = end; + for (; i >= 0; i--) { + char c = str.charAt(i); + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { + break; + } + } + if (i != end) { + return str.substring(0, i + 1); + } + + return str; + } + + public String convert(AbstractCCodeHandler h, String code) { + Reader reader = new StringReader(trimEnd(code)); + String str = convert(h, reader, true); + try { + reader.close(); + } catch (IOException e) { } + + return str; + } + + public String convert(AbstractCCodeHandler h, Reader code, boolean ret) { + if (code == null) { + return null; + } else { + handler = h; + whitesOnFirstLine = 0; + yyreset(code); + yybegin(CLEANFIRST); + try { + yylex(); + } catch (IOException e) { + return null; + } + if (ret) { + return h.toString(); + } + return ""; + } + } + + + /** + * Creates a new scanner + * There is also a java.io.InputStream version of this constructor. + * + * @param in the java.io.Reader to read input from. + */ + public CLexer(java.io.Reader in) { + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + public CLexer(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 156) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do { + map[j++] = value; + } while (--count > 0); + } + return map; + } + + + /** + * Refills the input buffer. + * + * @return <code>false</code>, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead - zzStartRead); + + /* translate stored positions */ + zzEndRead -= zzStartRead; + zzCurrentPos -= zzStartRead; + zzMarkedPos -= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos * 2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length - zzEndRead); + + if (numRead > 0) { + zzEndRead += numRead; + return false; + } + // unlikely but not impossible: read 0 characters, but not at end of stream + if (numRead == 0) { + int c = zzReader.read(); + if (c == -1) { + return true; + } else { + zzBuffer[zzEndRead++] = (char) c; + return false; + } + } + + // numRead < 0 + return true; + } + + + /** + * Closes the input stream. + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ + zzEndRead = zzStartRead; /* invalidate buffer */ + + if (zzReader != null) { + zzReader.close(); + } + } + + + /** + * Resets the scanner to read from a new input stream. + * Does not close the old reader. + * + * All internal variables are reset, the old input stream + * <b>cannot</b> be reused (internal buffer is discarded and lost). + * Lexical state is set to <tt>ZZ_INITIAL</tt>. + * + * @param reader the new input stream + */ + public final void yyreset(java.io.Reader reader) { + zzReader = reader; + zzAtBOL = true; + zzAtEOF = false; + zzEOFDone = false; + zzEndRead = zzStartRead = 0; + zzCurrentPos = zzMarkedPos = 0; + yyline = yychar = yycolumn = 0; + zzLexicalState = YYINITIAL; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final String yytext() { + return new String( zzBuffer, zzStartRead, zzMarkedPos - zzStartRead ); + } + + + /** + * Returns the character at position <tt>pos</tt> from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer[zzStartRead + pos]; + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos - zzStartRead; + } + + + /** + * Reports an error that occurred while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) { + zzScanError(ZZ_PUSHBACK_2BIG); + } + + zzMarkedPos -= number; + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public void yylex() throws java.io.IOException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + char [] zzBufferL = zzBuffer; + char [] zzCMapL = ZZ_CMAP; + + + while (true) { + zzMarkedPosL = zzMarkedPos; + + yychar += zzMarkedPosL - zzStartRead; + + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) { + zzInput = zzBufferL[zzCurrentPosL++]; + } else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } else { + zzInput = zzBufferL[zzCurrentPosL++]; + } + } + zzInput = zzCMapL[zzInput]; + + boolean zzIsFinal = false; + boolean zzNoLookAhead = false; + + zzForNext: { + switch (zzState) { + case 0: + switch (zzInput) { + case 0: + case 3: + case 5: + case 7: + case 17: + case 23: + case 25: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 5; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 6; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 7; + break zzForNext; + case 4: + zzIsFinal = true; + zzState = 8; + break zzForNext; + case 9: + zzIsFinal = true; + zzState = 10; + break zzForNext; + case 10: + zzIsFinal = true; + zzState = 11; + break zzForNext; + case 12: + zzIsFinal = true; + zzState = 12; + break zzForNext; + case 14: + zzIsFinal = true; + zzState = 13; + break zzForNext; + case 18: + zzIsFinal = true; + zzState = 14; + break zzForNext; + case 20: + zzIsFinal = true; + zzState = 15; + break zzForNext; + case 21: + zzIsFinal = true; + zzState = 16; + break zzForNext; + case 22: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 17; + break zzForNext; + case 24: + zzIsFinal = true; + zzState = 18; + break zzForNext; + case 26: + zzIsFinal = true; + zzState = 19; + break zzForNext; + case 27: + zzIsFinal = true; + zzState = 20; + break zzForNext; + case 28: + zzIsFinal = true; + zzState = 21; + break zzForNext; + case 29: + zzIsFinal = true; + zzState = 22; + break zzForNext; + case 30: + zzIsFinal = true; + zzState = 23; + break zzForNext; + case 31: + zzIsFinal = true; + zzState = 24; + break zzForNext; + case 33: + zzIsFinal = true; + zzState = 25; + break zzForNext; + case 34: + zzIsFinal = true; + zzState = 26; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 27; + break zzForNext; + case 37: + zzIsFinal = true; + zzState = 28; + break zzForNext; + case 38: + zzIsFinal = true; + zzState = 29; + break zzForNext; + case 40: + zzIsFinal = true; + zzState = 30; + break zzForNext; + case 41: + zzIsFinal = true; + zzState = 31; + break zzForNext; + case 42: + zzIsFinal = true; + zzState = 32; + break zzForNext; + case 43: + zzIsFinal = true; + zzState = 33; + break zzForNext; + case 45: + zzIsFinal = true; + zzState = 34; + break zzForNext; + case 46: + zzIsFinal = true; + zzState = 35; + break zzForNext; + case 47: + zzIsFinal = true; + zzState = 36; + break zzForNext; + case 48: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 37; + break zzForNext; + case 49: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 38; + break zzForNext; + case 50: + zzIsFinal = true; + zzState = 39; + break zzForNext; + case 51: + zzIsFinal = true; + zzState = 40; + break zzForNext; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 1: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 42; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 43; + break zzForNext; + case 4: + zzState = 44; + break zzForNext; + case 5: + zzState = 45; + break zzForNext; + default: + zzIsFinal = true; + zzState = 41; + break zzForNext; + } + + case 2: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 47; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 48; + break zzForNext; + case 22: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 49; + break zzForNext; + case 23: + zzState = 50; + break zzForNext; + default: + zzIsFinal = true; + zzState = 46; + break zzForNext; + } + + case 3: + switch (zzInput) { + case 1: + case 2: + zzIsFinal = true; + zzState = 52; + break zzForNext; + case 3: + case 25: + zzIsFinal = true; + zzState = 53; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 51; + break zzForNext; + } + + case 4: + switch (zzInput) { + case 1: + case 2: + zzIsFinal = true; + zzState = 55; + break zzForNext; + case 3: + case 25: + zzIsFinal = true; + zzState = 56; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 54; + break zzForNext; + } + + case 6: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 7; + break zzForNext; + default: + break zzForAction; + } + + case 8: + switch (zzInput) { + case 4: + zzIsFinal = true; + zzState = 57; + break zzForNext; + case 5: + zzIsFinal = true; + zzState = 58; + break zzForNext; + default: + break zzForAction; + } + + case 9: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 10: + switch (zzInput) { + case 9: + case 18: + zzIsFinal = true; + break zzForNext; + case 10: + case 11: + case 12: + case 13: + zzIsFinal = true; + zzState = 59; + break zzForNext; + case 20: + zzIsFinal = true; + zzState = 60; + break zzForNext; + default: + break zzForAction; + } + + case 11: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzState = 61; + break zzForNext; + case 37: + zzIsFinal = true; + zzState = 62; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 12: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 63; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 13: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 64; + break zzForNext; + case 26: + zzIsFinal = true; + zzState = 65; + break zzForNext; + case 28: + zzIsFinal = true; + zzState = 66; + break zzForNext; + case 30: + zzIsFinal = true; + zzState = 67; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 14: + switch (zzInput) { + case 9: + case 18: + zzIsFinal = true; + zzState = 10; + break zzForNext; + case 10: + case 11: + case 12: + case 13: + zzIsFinal = true; + zzState = 59; + break zzForNext; + case 20: + zzIsFinal = true; + zzState = 60; + break zzForNext; + case 19: + case 46: + zzState = 68; + break zzForNext; + default: + break zzForAction; + } + + case 15: + switch (zzInput) { + case 9: + case 18: + zzIsFinal = true; + zzState = 60; + break zzForNext; + default: + break zzForAction; + } + + case 16: + switch (zzInput) { + case 11: + zzIsFinal = true; + zzState = 69; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 18: + switch (zzInput) { + case 23: + zzState = 71; + break zzForNext; + case 1: + case 2: + case 25: + break zzForAction; + default: + zzState = 70; + break zzForNext; + } + + case 19: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 72; + break zzForNext; + case 37: + zzIsFinal = true; + zzState = 73; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 20: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 74; + break zzForNext; + case 31: + zzIsFinal = true; + zzState = 75; + break zzForNext; + case 35: + zzIsFinal = true; + zzState = 76; + break zzForNext; + case 39: + zzIsFinal = true; + zzState = 77; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 21: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 78; + break zzForNext; + case 42: + zzIsFinal = true; + zzState = 79; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 22: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 80; + break zzForNext; + case 30: + zzIsFinal = true; + zzState = 81; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 82; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 23: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 83; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 24: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 84; + break zzForNext; + case 37: + zzIsFinal = true; + zzState = 85; + break zzForNext; + case 46: + zzIsFinal = true; + zzState = 86; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 25: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 87; + break zzForNext; + case 28: + zzIsFinal = true; + zzState = 88; + break zzForNext; + case 35: + zzIsFinal = true; + zzState = 89; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 90; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 26: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 91; + break zzForNext; + case 35: + zzIsFinal = true; + zzState = 92; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 93; + break zzForNext; + case 43: + zzIsFinal = true; + zzState = 94; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 27: + switch (zzInput) { + case 14: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 37: + zzIsFinal = true; + zzState = 96; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 28: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 97; + break zzForNext; + case 28: + zzIsFinal = true; + zzState = 98; + break zzForNext; + case 31: + zzIsFinal = true; + zzState = 99; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 29: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 100; + break zzForNext; + case 31: + zzIsFinal = true; + zzState = 101; + break zzForNext; + case 39: + zzIsFinal = true; + zzState = 102; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 30: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 103; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 31: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 72; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 32: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 104; + break zzForNext; + case 30: + zzIsFinal = true; + zzState = 105; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 33: + switch (zzInput) { + case 35: + zzIsFinal = true; + zzState = 106; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 34: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 107; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 108; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 35: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 109; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 36: + switch (zzInput) { + case 10: + zzState = 110; + break zzForNext; + case 12: + zzState = 111; + break zzForNext; + case 31: + zzState = 112; + break zzForNext; + case 36: + zzState = 113; + break zzForNext; + case 38: + zzState = 114; + break zzForNext; + case 42: + zzState = 115; + break zzForNext; + default: + break zzForAction; + } + + case 39: + switch (zzInput) { + case 50: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 38; + break zzForNext; + default: + break zzForAction; + } + + case 40: + switch (zzInput) { + case 51: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 38; + break zzForNext; + default: + break zzForAction; + } + + case 41: + switch (zzInput) { + case 5: + zzState = 116; + break zzForNext; + case 1: + case 2: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 42: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 43; + break zzForNext; + default: + break zzForAction; + } + + case 44: + switch (zzInput) { + case 4: + zzIsFinal = true; + zzState = 117; + break zzForNext; + default: + break zzForAction; + } + + case 45: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 118; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 119; + break zzForNext; + case 4: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 120; + break zzForNext; + case 5: + zzState = 121; + break zzForNext; + default: + zzIsFinal = true; + zzState = 117; + break zzForNext; + } + + case 46: + switch (zzInput) { + case 23: + zzState = 50; + break zzForNext; + case 1: + case 2: + case 22: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 47: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 48; + break zzForNext; + default: + break zzForAction; + } + + case 50: + switch (zzInput) { + case 1: + case 2: + break zzForAction; + default: + zzIsFinal = true; + zzState = 46; + break zzForNext; + } + + case 52: + switch (zzInput) { + case 1: + case 2: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 53: + switch (zzInput) { + case 3: + case 25: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 55: + switch (zzInput) { + case 1: + case 2: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 56: + switch (zzInput) { + case 1: + case 2: + zzIsFinal = true; + zzState = 55; + break zzForNext; + case 3: + case 25: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 57: + switch (zzInput) { + case 1: + case 2: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 58: + switch (zzInput) { + case 5: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 59: + switch (zzInput) { + case 10: + case 11: + case 12: + case 13: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 60: + switch (zzInput) { + case 9: + case 18: + zzIsFinal = true; + break zzForNext; + case 12: + case 13: + case 14: + case 15: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 122; + break zzForNext; + case 16: + case 31: + zzState = 123; + break zzForNext; + default: + break zzForAction; + } + + case 61: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 124; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 62: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzState = 125; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 126; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 63: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 127; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 64: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 128; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 65: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 84; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 66: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 67: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 129; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 68: + switch (zzInput) { + case 8: + case 9: + case 14: + case 15: + case 16: + case 18: + case 26: + case 29: + case 31: + case 33: + case 38: + zzIsFinal = true; + zzState = 130; + break zzForNext; + default: + break zzForAction; + } + + case 69: + switch (zzInput) { + case 13: + zzIsFinal = true; + zzState = 131; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 70: + switch (zzInput) { + case 24: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 132; + break zzForNext; + default: + break zzForAction; + } + + case 71: + switch (zzInput) { + case 24: + zzIsFinal = true; + zzState = 133; + break zzForNext; + case 1: + case 2: + case 25: + break zzForAction; + default: + zzState = 70; + break zzForNext; + } + + case 72: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 134; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 73: + switch (zzInput) { + case 38: + zzIsFinal = true; + zzState = 78; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 74: + switch (zzInput) { + case 39: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 10: + zzIsFinal = true; + zzState = 135; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 75: + switch (zzInput) { + case 40: + zzIsFinal = true; + zzState = 136; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 76: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 137; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 138; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 77: + switch (zzInput) { + case 42: + zzIsFinal = true; + zzState = 139; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 78: + switch (zzInput) { + case 7: + zzIsFinal = true; + zzState = 140; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 79: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 141; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 80: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 142; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 81: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 143; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 82: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 144; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 83: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 145; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 146; + break zzForNext; + case 41: + zzIsFinal = true; + zzState = 147; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 84: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzState = 135; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 85: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 148; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 86: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 149; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 87: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzState = 135; + break zzForNext; + case 27: + zzIsFinal = true; + zzState = 150; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 88: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 151; + break zzForNext; + case 37: + zzIsFinal = true; + zzState = 152; + break zzForNext; + case 40: + zzIsFinal = true; + zzState = 153; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 89: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 154; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 90: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 91: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 155; + break zzForNext; + case 30: + zzIsFinal = true; + zzState = 156; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 92: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 157; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 93: + switch (zzInput) { + case 41: + zzIsFinal = true; + zzState = 158; + break zzForNext; + case 44: + zzIsFinal = true; + zzState = 159; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 94: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 160; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 95: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 96: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 161; + break zzForNext; + case 27: + zzIsFinal = true; + zzState = 162; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 97: + switch (zzInput) { + case 40: + zzIsFinal = true; + zzState = 163; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 98: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 78; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 164; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 99: + switch (zzInput) { + case 43: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 100: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 165; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 101: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 166; + break zzForNext; + case 14: + zzIsFinal = true; + zzState = 167; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 102: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 168; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 103: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 169; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 104: + switch (zzInput) { + case 29: + zzIsFinal = true; + zzState = 170; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 105: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 171; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 172; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 106: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 173; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 107: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 174; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 175; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 108: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 176; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 109: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 78; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 110: + switch (zzInput) { + case 34: + zzState = 177; + break zzForNext; + case 37: + zzState = 178; + break zzForNext; + default: + break zzForAction; + } + + case 111: + switch (zzInput) { + case 36: + zzState = 179; + break zzForNext; + default: + break zzForAction; + } + + case 112: + switch (zzInput) { + case 12: + zzState = 180; + break zzForNext; + case 30: + zzState = 181; + break zzForNext; + case 37: + zzState = 182; + break zzForNext; + default: + break zzForAction; + } + + case 113: + switch (zzInput) { + case 14: + zzIsFinal = true; + zzState = 183; + break zzForNext; + case 37: + zzState = 184; + break zzForNext; + case 40: + zzState = 185; + break zzForNext; + default: + break zzForAction; + } + + case 114: + switch (zzInput) { + case 31: + zzState = 186; + break zzForNext; + default: + break zzForAction; + } + + case 115: + switch (zzInput) { + case 30: + zzState = 187; + break zzForNext; + default: + break zzForAction; + } + + case 116: + switch (zzInput) { + case 5: + break zzForNext; + case 1: + case 2: + case 4: + break zzForAction; + default: + zzIsFinal = true; + zzState = 117; + break zzForNext; + } + + case 117: + switch (zzInput) { + case 4: + zzState = 44; + break zzForNext; + case 5: + zzState = 116; + break zzForNext; + case 1: + case 2: + break zzForAction; + default: + zzIsFinal = true; + zzState = 41; + break zzForNext; + } + + case 118: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 119; + break zzForNext; + default: + break zzForAction; + } + + case 121: + switch (zzInput) { + case 4: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 120; + break zzForNext; + case 5: + break zzForNext; + case 1: + case 2: + break zzForAction; + default: + zzIsFinal = true; + zzState = 117; + break zzForNext; + } + + case 123: + switch (zzInput) { + case 9: + case 18: + zzIsFinal = true; + zzState = 188; + break zzForNext; + case 17: + zzState = 189; + break zzForNext; + default: + break zzForAction; + } + + case 124: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 190; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 125: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 191; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 126: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 192; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 127: + switch (zzInput) { + case 41: + zzIsFinal = true; + zzState = 162; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 128: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 193; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 129: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 194; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 130: + switch (zzInput) { + case 10: + case 11: + case 12: + case 13: + zzIsFinal = true; + zzState = 59; + break zzForNext; + case 8: + case 9: + case 14: + case 15: + case 16: + case 18: + case 26: + case 29: + case 31: + case 33: + case 38: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 131: + switch (zzInput) { + case 13: + zzIsFinal = true; + zzState = 195; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 133: + switch (zzInput) { + case 24: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 132; + break zzForNext; + default: + break zzForAction; + } + + case 134: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 135: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 136: + switch (zzInput) { + case 42: + zzIsFinal = true; + zzState = 196; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 137: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 99; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 138: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 139: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 197; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 140: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 198; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 141: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 199; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 142: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 162; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 143: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 200; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 144: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 201; + break zzForNext; + case 28: + zzIsFinal = true; + zzState = 202; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 145: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 203; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 146: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 204; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 147: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 205; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 148: + switch (zzInput) { + case 40: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 149: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 206; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 150: + switch (zzInput) { + case 33: + zzIsFinal = true; + zzState = 207; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 151: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 152: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 208; + break zzForNext; + case 34: + zzIsFinal = true; + zzState = 209; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 153: + switch (zzInput) { + case 42: + zzIsFinal = true; + zzState = 210; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 154: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 162; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 155: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 211; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 156: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 212; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 157: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 193; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 158: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 213; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 159: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 214; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 160: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 150; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 161: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 215; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 162: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 163: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 216; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 164: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 217; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 165: + switch (zzInput) { + case 29: + zzIsFinal = true; + zzState = 218; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 166: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 219; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 167: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 220; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 168: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 221; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 169: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 222; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 170: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 223; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 171: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 224; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 172: + switch (zzInput) { + case 45: + zzIsFinal = true; + zzState = 225; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 173: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 135; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 174: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 226; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 175: + switch (zzInput) { + case 38: + zzIsFinal = true; + zzState = 162; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 176: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 227; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 177: + switch (zzInput) { + case 36: + zzState = 228; + break zzForNext; + default: + break zzForAction; + } + + case 178: + switch (zzInput) { + case 38: + zzState = 229; + break zzForNext; + default: + break zzForAction; + } + + case 179: + switch (zzInput) { + case 37: + zzState = 230; + break zzForNext; + default: + break zzForAction; + } + + case 180: + switch (zzInput) { + case 34: + zzState = 230; + break zzForNext; + case 36: + zzState = 231; + break zzForNext; + default: + break zzForAction; + } + + case 181: + switch (zzInput) { + case 30: + zzState = 232; + break zzForNext; + default: + break zzForAction; + } + + case 182: + switch (zzInput) { + case 38: + zzState = 233; + break zzForNext; + default: + break zzForAction; + } + + case 183: + switch (zzInput) { + case 37: + zzState = 178; + break zzForNext; + case 38: + zzState = 229; + break zzForNext; + default: + break zzForAction; + } + + case 184: + switch (zzInput) { + case 33: + zzState = 234; + break zzForNext; + default: + break zzForAction; + } + + case 185: + switch (zzInput) { + case 42: + zzState = 235; + break zzForNext; + default: + break zzForAction; + } + + case 186: + switch (zzInput) { + case 14: + zzState = 111; + break zzForNext; + default: + break zzForAction; + } + + case 187: + switch (zzInput) { + case 26: + zzState = 236; + break zzForNext; + default: + break zzForAction; + } + + case 188: + switch (zzInput) { + case 12: + case 13: + case 14: + case 15: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 122; + break zzForNext; + case 9: + case 18: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 189: + switch (zzInput) { + case 9: + case 18: + zzIsFinal = true; + zzState = 188; + break zzForNext; + default: + break zzForAction; + } + + case 190: + switch (zzInput) { + case 41: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 191: + switch (zzInput) { + case 41: + zzIsFinal = true; + zzState = 158; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 192: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 162; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 193: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 162; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 194: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 237; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 195: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 196: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 238; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 197: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 239; + break zzForNext; + case 38: + zzIsFinal = true; + zzState = 240; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 198: + switch (zzInput) { + case 52: + zzIsFinal = true; + zzState = 241; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 199: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 242; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 200: + switch (zzInput) { + case 32: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 201: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 239; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 202: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 241; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 203: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 90; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 204: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 243; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 205: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzState = 244; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 206: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 245; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 207: + switch (zzInput) { + case 35: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 208: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 246; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 209: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 247; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 210: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 241; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 211: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 248; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 212: + switch (zzInput) { + case 33: + zzIsFinal = true; + zzState = 193; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 213: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 175; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 214: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 249; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 215: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 250; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 216: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzState = 251; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 217: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 161; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 218: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 252; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 219: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 135; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 220: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 253; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 221: + switch (zzInput) { + case 40: + zzIsFinal = true; + zzState = 254; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 222: + switch (zzInput) { + case 29: + zzIsFinal = true; + zzState = 255; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 223: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 256; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 224: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 257; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 225: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 258; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 226: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 259; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 227: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 260; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 228: + switch (zzInput) { + case 37: + zzState = 261; + break zzForNext; + default: + break zzForAction; + } + + case 229: + switch (zzInput) { + case 31: + zzState = 231; + break zzForNext; + default: + break zzForAction; + } + + case 230: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 262; + break zzForNext; + default: + break zzForAction; + } + + case 231: + switch (zzInput) { + case 14: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 262; + break zzForNext; + default: + break zzForAction; + } + + case 232: + switch (zzInput) { + case 28: + zzState = 263; + break zzForNext; + default: + break zzForAction; + } + + case 233: + switch (zzInput) { + case 36: + zzState = 231; + break zzForNext; + default: + break zzForAction; + } + + case 234: + switch (zzInput) { + case 12: + zzState = 264; + break zzForNext; + default: + break zzForAction; + } + + case 235: + switch (zzInput) { + case 28: + zzState = 265; + break zzForNext; + default: + break zzForAction; + } + + case 236: + switch (zzInput) { + case 41: + zzState = 266; + break zzForNext; + default: + break zzForAction; + } + + case 237: + switch (zzInput) { + case 38: + zzIsFinal = true; + zzState = 267; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 238: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 219; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 239: + switch (zzInput) { + case 38: + zzIsFinal = true; + zzState = 241; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 240: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 249; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 241: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 242: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 268; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 243: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 269; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 244: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 270; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 245: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 267; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 246: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzState = 271; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 247: + switch (zzInput) { + case 7: + zzIsFinal = true; + zzState = 272; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 248: + switch (zzInput) { + case 33: + zzIsFinal = true; + zzState = 247; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 249: + switch (zzInput) { + case 14: + zzIsFinal = true; + zzState = 95; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 250: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 267; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 251: + switch (zzInput) { + case 42: + zzIsFinal = true; + zzState = 273; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 252: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 162; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 253: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 151; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 254: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 274; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 255: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 250; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 256: + switch (zzInput) { + case 33: + zzIsFinal = true; + zzState = 267; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 257: + switch (zzInput) { + case 33: + zzIsFinal = true; + zzState = 275; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 258: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 250; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 259: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzState = 255; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 260: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 276; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 261: + switch (zzInput) { + case 41: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 262; + break zzForNext; + default: + break zzForAction; + } + + case 263: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 262; + break zzForNext; + default: + break zzForAction; + } + + case 264: + switch (zzInput) { + case 10: + zzState = 277; + break zzForNext; + default: + break zzForAction; + } + + case 265: + switch (zzInput) { + case 30: + zzState = 278; + break zzForNext; + default: + break zzForAction; + } + + case 266: + switch (zzInput) { + case 40: + zzState = 279; + break zzForNext; + default: + break zzForAction; + } + + case 267: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 268: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 202; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 269: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 280; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 270: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 281; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 271: + switch (zzInput) { + case 10: + zzIsFinal = true; + zzState = 135; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 272: + switch (zzInput) { + case 33: + zzIsFinal = true; + zzState = 282; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 273: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 283; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 274: + switch (zzInput) { + case 33: + zzIsFinal = true; + zzState = 284; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 275: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 285; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 276: + switch (zzInput) { + case 12: + zzIsFinal = true; + zzState = 267; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 277: + switch (zzInput) { + case 38: + zzState = 230; + break zzForNext; + default: + break zzForAction; + } + + case 278: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 262; + break zzForNext; + default: + break zzForAction; + } + + case 279: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 262; + break zzForNext; + default: + break zzForAction; + } + + case 280: + switch (zzInput) { + case 42: + zzIsFinal = true; + zzState = 286; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 281: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 267; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 282: + switch (zzInput) { + case 26: + zzIsFinal = true; + zzState = 287; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 283: + switch (zzInput) { + case 33: + zzIsFinal = true; + zzState = 135; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 284: + switch (zzInput) { + case 7: + zzIsFinal = true; + zzState = 272; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 285: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 237; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 286: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 288; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 287: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzState = 151; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 288: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 289; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + case 289: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 284; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 17: + case 20: + case 22: + case 23: + case 24: + case 25: + case 47: + case 48: + case 49: + case 50: + case 51: + break zzForAction; + default: + zzIsFinal = true; + zzState = 9; + break zzForNext; + } + + default: + // if this is ever reached, there is a serious bug in JFlex + zzScanError(ZZ_UNKNOWN_ERROR); + break; + } + } + + if ( zzIsFinal ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( zzNoLookAhead ) { + break zzForAction; + } + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 21 : + { + handler.handleComment("*"); + handler.handleNothing("\n"); + saveLexState = COMMENT; + yybegin(CLEAN); + } + case 26: + break; + case 20: { + handler.handleKeyword(yytext()); + } + case 27: + break; + case 2: { + handler.handleString(yytext()); + } + case 28: + break; + case 8: { + yybegin(STRING); + handler.handleString(yytext()); + } + case 29: + break; + case 13: { + yypushback(1); + yybegin(saveLexState); + } + case 30: + break; + case 14: { + handler.handleNothing("\n"); + } + case 31: + break; + case 7: { + handler.handleNumber(yytext()); + } + case 32: + break; + case 1: { + handler.handleComment(yytext()); + } + case 33: + break; + case 15: { + int len = yylength() - whitesOnFirstLine; + if (len > 0) { + yypushback(len); + } + yybegin(saveLexState); + } + case 34: + break; + case 18: { + whitesOnFirstLine = yylength(); + yybegin(YYINITIAL); + } + case 35: + break; + case 25: { + handler.handleModifier(yytext()); + } + case 36: + break; + case 9: { + handler.handleOpenClose(yytext()); + } + case 37: + break; + case 22: { + yybegin(YYINITIAL); + handler.handleComment(yytext()); + } + case 38: + break; + case 19: { + yybegin(COMMENT); + handler.handleComment(yytext()); + } + case 39: + break; + case 10: { + handler.handleNothing("\n"); + saveLexState = COMMENT; + yybegin(CLEAN); + } + case 40: + break; + case 4: { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } + case 41: + break; + case 6: { + handler.handleId(yytext()); + } + case 42: + break; + case 12: { + yybegin(YYINITIAL); + handler.handleString(yytext()); + } + case 43: + break; + case 24: { + handler.handlePreprocessor(yytext()); + } + case 44: + break; + case 16: { + yypushback(1); + yybegin(YYINITIAL); + } + case 45: + break; + case 11: { + handler.handleNothing("\n"); + saveLexState = STRING; + yybegin(CLEAN); + } + case 46: + break; + case 3: { + handler.handleDefault(yytext()); + } + case 47: + break; + case 23: { + handler.handleType(yytext()); + } + case 48: + break; + case 5: { + handler.handleOperator(yytext()); + } + case 49: + break; + case 17: { + } + case 50: + break; + default: + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + { + return; + } + } else { + zzScanError(ZZ_NO_MATCH); + } + } + } + } + + +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/c/HTMLCCodeHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/c/HTMLCCodeHandler.java new file mode 100755 index 000000000..d4c211bd3 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/c/HTMLCCodeHandler.java @@ -0,0 +1,149 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.c; + +import java.io.IOException; + +public class HTMLCCodeHandler extends AbstractCCodeHandler { + + private static final int BUFCAPACITY = 8192; + private static HTMLCCodeHandler handler = new HTMLCCodeHandler(); + + protected Appendable buffer; + + protected HTMLCCodeHandler() { + buffer = new StringBuilder(BUFCAPACITY); + } + + public static AbstractCCodeHandler getInstance() { + ((StringBuilder) handler.buffer).setLength(0); + return handler; + } + + public static String replaceEntity(String str) { + return str.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("\'", "'"); + } + + /** + * {@inheritDoc} + */ + public void handleDefault(String seq) throws IOException { + buffer.append("<span class=\"cdefault\">"); + buffer.append(replaceEntity(seq)); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleComment(String seq) throws IOException { + buffer.append("<span class=\"ccomment\">"); + buffer.append(replaceEntity(seq)); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleNothing(String seq) throws IOException { + buffer.append(seq); + } + + /** + * {@inheritDoc} + */ + public void handleString(String seq) throws IOException { + buffer.append("<span class=\"cstring\">"); + buffer.append(replaceEntity(seq)); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleNumber(String seq) throws IOException { + buffer.append("<span class=\"cnumber\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleKeyword(String seq) throws IOException { + buffer.append("<span class=\"ckeyword\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleType(String seq) throws IOException { + buffer.append("<span class=\"ctype\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleModifier(String seq) throws IOException { + buffer.append("<span class=\"cmodifier\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handlePreprocessor(String seq) throws IOException { + buffer.append("<span class=\"cpreprocessor\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleOpenClose(String seq) throws IOException { + buffer.append("<span class=\"copenclose\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleOperator(String seq) throws IOException { + buffer.append("<span class=\"coperator\">"); + buffer.append(replaceEntity(seq)); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleId(String seq) throws IOException { + buffer.append("<span class=\"cid\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public String toString() { + return buffer.toString(); + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/external/ExternalXMLHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/external/ExternalXMLHandler.java new file mode 100755 index 000000000..b9bbee8b5 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/external/ExternalXMLHandler.java @@ -0,0 +1,81 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.external; + +import org.xml.sax.Attributes; +import org.xml.sax.Locator; +import org.scilab.modules.helptools.DocbookTagConverter; + +public abstract class ExternalXMLHandler { + + private DocbookTagConverter converter; + protected int compt = 1; + + public abstract StringBuilder startExternalXML(String localName, Attributes attributes, Locator locator); + + public abstract String endExternalXML(String localName); + + public abstract String getURI(); + + public final DocbookTagConverter getConverter() { + return converter; + } + + public final void setConverter(DocbookTagConverter converter) { + this.converter = converter; + } + + public final void resetCompt() { + compt = 1; + } + + public String getScilabURI() { + return "http://www.scilab.org"; + } + + public void recreateTag(StringBuilder buf, String localName, Attributes attrs) { + if (attrs != null) { + buf.append("<"); + buf.append(localName); + int len = attrs.getLength(); + for (int i = 0; i < len; i++) { + String at = attrs.getLocalName(i); + if (at != null && at.length() > 0) { + buf.append(" "); + buf.append(at); + buf.append("=\'"); + buf.append(attrs.getValue(i)); + buf.append("\'"); + } + } + } else { + buf.append("</"); + buf.append(localName); + } + + buf.append(">"); + } + + protected static final Boolean getLocalized(final String URI, final Attributes attributes) { + String v = URI == null ? attributes.getValue("localized") : attributes.getValue(URI, "localized"); + if (v == null || v.isEmpty()) { + return Boolean.FALSE; + } else if ("true".equalsIgnoreCase(v)) { + return Boolean.TRUE; + } else if ("false".equalsIgnoreCase(v)) { + return null; + } else { + return Boolean.FALSE; + } + } +}
\ No newline at end of file diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/external/HTMLMathMLHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/external/HTMLMathMLHandler.java new file mode 100755 index 000000000..10490199e --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/external/HTMLMathMLHandler.java @@ -0,0 +1,108 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.external; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import org.xml.sax.Attributes; +import org.xml.sax.Locator; + +import org.scilab.modules.helptools.HTMLDocbookTagConverter; + +/** + * Handle the included SVG code + * @author Calixte DENIZET + */ +public class HTMLMathMLHandler extends ExternalXMLHandler { + + private static final String MATH = "math"; + private static final String BASENAME = "_MathML_"; + + private StringBuilder buffer = new StringBuilder(8192); + private String baseDir; + private String outputDir; + private Boolean isLocalized; + private int line; + + /** + * Constructor + * @param baseDir the base directory where to put the generated images + */ + public HTMLMathMLHandler(String outputDir, String baseDir) { + this.outputDir = outputDir + File.separator + baseDir; + this.baseDir = baseDir + "/"; + } + + /** + * {@inheritDoc} + */ + public String getURI() { + return "http://www.w3.org/1998/Math/MathML"; + } + + /** + * {@inheritDoc} + */ + public StringBuilder startExternalXML(String localName, Attributes attributes, Locator locator) { + if (MATH.equals(localName)) { + isLocalized = getLocalized(getScilabURI(), attributes); + line = locator.getLineNumber(); + } + + recreateTag(buffer, localName, attributes); + if (MATH.equals(localName)) { + return buffer; + } + + return null; + } + + /** + * {@inheritDoc} + */ + public String endExternalXML(String localName) { + if (MATH.equals(localName)) { + recreateTag(buffer, localName, null); + File f; + String language = ((HTMLDocbookTagConverter) getConverter()).getLanguage(); + if (isLocalized != null && isLocalized.booleanValue()) { + f = new File(outputDir, BASENAME + getConverter().getCurrentBaseName() + "_" + language + "_" + (compt++) + ".png"); + } else { + if ("ru_RU".equals(language) && HTMLDocbookTagConverter.containsCyrillic(buffer)) { + System.err.println("Warning: MathML code in " + getConverter().getCurrentFileName() + " at line " + line + " contains cyrillic character. The tag <math> should contain the attribute scilab:localized=\"true\""); + } else if ("ja_JP".equals(language) && HTMLDocbookTagConverter.containsCJK(buffer)) { + System.err.println("Warning: MathML code in " + getConverter().getCurrentFileName() + " at line " + line + " contains CJK character. The tag <math> should contain the attribute scilab:localized=\"true\""); + } + f = new File(outputDir, BASENAME + getConverter().getCurrentBaseName() + "_" + (compt++) + ".png"); + } + + Map<String, String> attributes = new HashMap<String, String>(); + attributes.put("fontsize", "16"); + String baseImagePath = ""; + if (getConverter() instanceof HTMLDocbookTagConverter) { + baseImagePath = ((HTMLDocbookTagConverter) getConverter()).getBaseImagePath(); + } + + String ret = getConverter().getImageConverter().getImageByCode(getConverter().getCurrentFileName(), buffer.toString(), attributes, "image/mathml", f, baseDir + f.getName(), baseImagePath, line, language, isLocalized); + buffer.setLength(0); + + return ret; + } + + recreateTag(buffer, localName, null); + + return null; + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/external/HTMLSVGHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/external/HTMLSVGHandler.java new file mode 100755 index 000000000..63ff65720 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/external/HTMLSVGHandler.java @@ -0,0 +1,107 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.external; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import org.xml.sax.Attributes; +import org.xml.sax.Locator; + +import org.scilab.modules.helptools.HTMLDocbookTagConverter; + +/** + * Handle the included SVG code + * @author Calixte DENIZET + */ +public class HTMLSVGHandler extends ExternalXMLHandler { + + private static final String SVG = "svg"; + private static final String BASENAME = "_SVG_"; + + private StringBuilder buffer = new StringBuilder(8192); + private String baseDir; + private String outputDir; + private Boolean isLocalized; + private int line; + + /** + * Constructor + * @param baseDir the base directory where to put the generated images + */ + public HTMLSVGHandler(String outputDir, String baseDir) { + this.outputDir = outputDir + File.separator + baseDir; + this.baseDir = baseDir + "/"; + } + + /** + * {@inheritDoc} + */ + public String getURI() { + return "http://www.w3.org/2000/svg"; + } + + /** + * {@inheritDoc} + */ + public StringBuilder startExternalXML(String localName, Attributes attributes, Locator locator) { + if (SVG.equals(localName)) { + isLocalized = getLocalized(getScilabURI(), attributes); + line = locator.getLineNumber(); + } + + recreateTag(buffer, localName, attributes); + if (SVG.equals(localName)) { + return buffer; + } + + return null; + } + + /** + * {@inheritDoc} + */ + public String endExternalXML(String localName) { + if (SVG.equals(localName)) { + recreateTag(buffer, localName, null); + File f; + String language = ((HTMLDocbookTagConverter) getConverter()).getLanguage(); + if (isLocalized != null && isLocalized.booleanValue()) { + f = new File(outputDir, BASENAME + getConverter().getCurrentBaseName() + "_" + language + "_" + (compt++) + ".png"); + } else { + if ("ru_RU".equals(language) && HTMLDocbookTagConverter.containsCyrillic(buffer)) { + System.err.println("Warning: SVG code in " + getConverter().getCurrentFileName() + " at line " + line + " contains cyrillic character. The tag <svg> should contain the attribute scilab:localized=\"true\""); + } else if ("ja_JP".equals(language) && HTMLDocbookTagConverter.containsCJK(buffer)) { + System.err.println("Warning: SVG code in " + getConverter().getCurrentFileName() + " at line " + line + " contains CJK character. The tag <svg> should contain the attribute scilab:localized=\"true\""); + } + f = new File(outputDir, BASENAME + getConverter().getCurrentBaseName() + "_" + (compt++) + ".png"); + } + + Map<String, String> attributes = new HashMap<String, String>(); + String baseImagePath = ""; + if (getConverter() instanceof HTMLDocbookTagConverter) { + baseImagePath = ((HTMLDocbookTagConverter) getConverter()).getBaseImagePath(); + } + + String ret = getConverter().getImageConverter().getImageByCode(getConverter().getCurrentFileName(), buffer.toString(), attributes, "image/svg", f, baseDir + f.getName(), baseImagePath, line, language, isLocalized); + buffer.setLength(0); + + return ret; + } + + recreateTag(buffer, localName, null); + + return null; + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/external/HTMLScilabHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/external/HTMLScilabHandler.java new file mode 100755 index 000000000..81a70e4b3 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/external/HTMLScilabHandler.java @@ -0,0 +1,139 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.external; + +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.xml.sax.Attributes; +import org.xml.sax.Locator; + +import org.scilab.modules.helptools.HTMLDocbookTagConverter; + +/** + * Handle the included SCILAB code + * @author Calixte DENIZET + */ +public class HTMLScilabHandler extends ExternalXMLHandler { + + private static final String IMAGE = "image"; + private static final String BASENAME = "_"; + + private StringBuilder buffer = new StringBuilder(8192); + private String baseDir; + private String outputDir; + private Boolean isLocalized; + private int line; + + /** + * Constructor + * @param baseDir the base directory where to put the generated images + */ + public HTMLScilabHandler(String outputDir, String baseDir) { + this.outputDir = outputDir + File.separator + baseDir; + this.baseDir = baseDir + "/"; + } + + /** + * {@inheritDoc} + */ + public String getURI() { + return "http://www.scilab.org"; + } + + /** + * {@inheritDoc} + */ + public StringBuilder startExternalXML(String localName, Attributes attributes, Locator locator) { + if (localName.equals("image")) { + isLocalized = getLocalized(null, attributes); + line = locator.getLineNumber(); + } + + if (IMAGE.equals(localName)) { + return buffer; + } else { + recreateTag(buffer, localName, attributes); + } + + return null; + } + + /** + * {@inheritDoc} + */ + public String endExternalXML(String localName) { + if (IMAGE.equals(localName)) { + String currentFileName = getConverter().getCurrentFileName(); + String baseName = new File(currentFileName).getName(); + int dotpos = baseName.lastIndexOf('.'); + if (dotpos != -1) { + baseName = baseName.substring(0, dotpos); + } + String language = ((HTMLDocbookTagConverter) getConverter()).getLanguage(); + String fileName; + if (isLocalized != null && isLocalized.booleanValue()) { + fileName = baseName + BASENAME + language + BASENAME + (compt++) + ".png"; + } else { + fileName = baseName + BASENAME + (compt++) + ".png"; + } + + File f = new File(outputDir, fileName); + Map<String, String> attributes = new HashMap<String, String>(); + + String ret; + File existing; + String baseImagePath = ""; + if (getConverter() instanceof HTMLDocbookTagConverter) { + baseImagePath = ((HTMLDocbookTagConverter) getConverter()).getBaseImagePath(); + } + if ((isLocalized != null && isLocalized.booleanValue()) || (existing = getExistingFile(outputDir, fileName)) == null) { + ret = getConverter().getImageConverter().getImageByCode(currentFileName, buffer.toString(), attributes, "image/scilab", f, baseDir + f.getName(), baseImagePath, line, language, isLocalized); + } else { + ret = getConverter().getImageConverter().getImageByFile(attributes, null, existing.getAbsolutePath(), outputDir, ".", baseImagePath); + } + + buffer.setLength(0); + return ret; + } + + recreateTag(buffer, localName, null); + + buffer.setLength(0); + return null; + } + + private static File getExistingFile(String outputDir, String filename) { + try { + final File outDir = new File(outputDir).getCanonicalFile(); + FileFilter filter = new FileFilter() { + public boolean accept(File f) { + return f.isDirectory() && !f.equals(outDir); + } + }; + File[] dirs = outDir.getParentFile().listFiles(filter); + File im = new File(filename); + for (File dir : dirs) { + File f = new File(dir, im.getName()); + if (f.exists() && f.canRead()) { + return f; + } + } + } catch (IOException e) { } + + return null; + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/image/ExternalImageConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/image/ExternalImageConverter.java new file mode 100755 index 000000000..d64fa94bf --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/image/ExternalImageConverter.java @@ -0,0 +1,27 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.image; + +import java.io.File; +import java.util.Map; + +public interface ExternalImageConverter { + + public String getMimeType(); + + public String convertToImage(File f, Map<String, String> attributes, File imageFile, String imageName); + + public String convertToImage(String currentFile, String code, Map<String, String> attributes, File imageFile, String imageName); + + public boolean mustRegenerate(); +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/image/Image.java b/modules/helptools/src/java/org/scilab/modules/helptools/image/Image.java new file mode 100755 index 000000000..446216ce7 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/image/Image.java @@ -0,0 +1,36 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.image; + +import javax.swing.Icon; + +public class Image { + + public Icon icon; + + public int width; + + public int height; + + public int ascent; + + public int descent; + + public Image(Icon icon, int width, int height, int ascent, int descent) { + this.icon = icon; + this.width = width; + this.height = height; + this.ascent = ascent; + this.descent = descent; + } +}
\ No newline at end of file diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/image/ImageConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/image/ImageConverter.java new file mode 100755 index 000000000..c92c08184 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/image/ImageConverter.java @@ -0,0 +1,328 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.image; + +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.channels.FileChannel; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import javax.activation.MimetypesFileTypeMap; +import javax.imageio.ImageIO; +import javax.swing.Icon; + +import org.scilab.modules.commons.ScilabCommonsUtils; +import org.scilab.modules.helptools.DocbookTagConverter; + +/** + * Class to handle the image conversion + * @author Calixte DENIZET + */ +public final class ImageConverter { + + private static final String MD5_FILE = "images_md5.txt"; + + private DocbookTagConverter conv; + private Map<String, ExternalImageConverter> externalConverters = new HashMap<String, ExternalImageConverter>(); + private MimetypesFileTypeMap mimeMap = new MimetypesFileTypeMap(); + private Map<String, String> md5s = null; + + public ImageConverter() { + mimeMap.addMimeTypes("type=image/latex exts=tex,latex"); + mimeMap.addMimeTypes("type=image/mathml exts=mml,mathml"); + mimeMap.addMimeTypes("type=image/svg exts=svg"); + mimeMap.addMimeTypes("type=image/scilab exts=sce"); + mimeMap.addMimeTypes("type=image/scilab-xcos exts=xcos,zcos"); + } + + public void setDocbookTagConverter(DocbookTagConverter conv) { + this.conv = conv; + } + + /** + * Register a new ExternalImageConverter + * @param c the converter to register + */ + public void registerExternalImageConverter(ExternalImageConverter c) { + if (c != null) { + externalConverters.put(c.getMimeType(), c); + } + } + + /** + * Get the current Scilab image converter + * @return a Scilab image converter + */ + public ScilabImageConverter getScilabImageConverter() { + return (ScilabImageConverter) externalConverters.get("image/scilab"); + } + + /** + * Load file containing md5s + * @param dir the directory where to find the file + */ + public void loadMD5s(String dir) { + md5s = getMD5s(dir); + } + + /** + * Save file containing md5s + * @param dir the directory where to find the file + */ + public void saveMD5s(String dir) { + writeMD5s(dir, md5s); + } + + /** + * Compare md5 + * @param code the code to compare + * @param file the file name of the future image + */ + public boolean compareMD5(String code, String file) { + if (md5s != null && code != null && file != null && !file.isEmpty()) { + code = code.trim().replaceAll("[ \t]*[\n]+[ \t]*", ""); + String md5 = ScilabCommonsUtils.getMD5(code); + String oldmd5 = md5s.get(file); + if (oldmd5 != null && md5.equals(oldmd5)) { + return true; + } + md5s.put(file, md5); + } + + return false; + } + + /** + * Get the generated md5s + * @param dir the dir where to find the files + * @return a map filename -> md5 of the code + */ + private static Map<String, String> getMD5s(String dir) { + File f = new File(dir + File.separator + MD5_FILE); + Map<String, String> map = new HashMap<String, String>(); + if (f.exists() && f.canRead()) { + BufferedReader reader = null; + try { + reader = new BufferedReader(new FileReader(f)); + String line = reader.readLine(); + while (line != null) { + String[] arr = line.split("="); + map.put(arr[0], arr[1]); + line = reader.readLine(); + } + } catch (IOException e) { + System.err.println(e); + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + + } + } + } + } + + return map; + } + + /** + * Write the generated md5s + * @param dir the dir where to find the files + * @param a map filename -> md5 of the code + */ + private static void writeMD5s(String dir, Map<String, String> map) { + File f = new File(dir + File.separator + MD5_FILE); + if (!f.exists()) { + try { + f.createNewFile(); + } catch (IOException e) { + System.err.println(e); + return; + } + } + + if (f.canWrite()) { + BufferedWriter writer = null; + try { + writer = new BufferedWriter(new FileWriter(f)); + Map<String, String> tree = new TreeMap<String, String>(map); + for (Map.Entry<String, String> entry : tree.entrySet()) { + String s = entry.getKey() + "=" + entry.getValue(); + writer.write(s, 0, s.length()); + writer.newLine(); + } + writer.flush(); + } catch (IOException e) { + System.err.println(e); + } finally { + if (writer != null) { + try { + writer.close(); + } catch (IOException e) { + + } + } + } + } + } + + /** + * @param attrs the attribute of the image + * @param path the current XML file which is parsed + * @param image the filename + * @param destDir the destination directory + * @return true if the code has been rendered into {@code imageFile} + */ + public String getImageByFile(Map<String, String> attrs, String path, String image, String outputDir, String destDir, String baseImagePath) { + File f = new File(image); + if (!f.isAbsolute()) { + f = new File(path + File.separator + image); + } + + String destFile = outputDir + File.separator + destDir + File.separator + f.getName(); + + ExternalImageConverter imgConv = externalConverters.get(mimeMap.getContentType(f)); + if (imgConv != null) { + destFile += ".png"; + } + File imageFile = new File(destFile); + String imageName = destDir + "/" + imageFile.getName(); + + if (f.lastModified() > imageFile.lastModified()) { + if (imgConv != null) { + return imgConv.convertToImage(f, attrs, imageFile, imageName); + } + copyImageFile(f, outputDir + File.separator + destDir); + } + + return conv.generateImageCode(conv.getBaseImagePath() + imageName, attrs); + } + + /** + * @param code the code to translate + * @param attrs the attribute of the image + * @param mime type + * @param imageFile the filename + * @return true if the code has been rendered into {@code imageFile} + */ + public String getImageByCode(String currentFile, String code, Map<String, String> attrs, String mime, File imageFile, String imageName, String baseImagePath, int lineNumber, String language, Boolean isLocalized) { + ExternalImageConverter imgConv = externalConverters.get(mime); + if (imgConv == null) { + System.err.println("In file " + currentFile + " at line " + lineNumber + ": invalid code:\n" + code); + return null; + } + + if (!imageFile.exists() && md5s != null) { + md5s.remove(imageFile.getName()); + } + + File current = new File(currentFile); + + if ((language.equals("en_US") || !imageFile.exists() || isLocalized != null) && !compareMD5(code, imageFile.getName())) { + if ((isLocalized != null && isLocalized.booleanValue()) || language.equals("en_US")) { + System.err.println("Info: Create image " + imageFile.getName() + " from line " + lineNumber + " in " + current.getName()); + } else if (!language.equals("en_US") && imageFile.exists()) { + System.err.println("Warning: Overwrite image " + imageFile.getName() + " from line " + lineNumber + " in " + current.getName() + ". Check the code or use scilab:localized=\"true\" attribute."); + } + + return imgConv.convertToImage(currentFile, code, attrs, imageFile, imageName); + } + + return conv.generateImageCode(conv.getBaseImagePath() + imageName, attrs); + } + + /** + * Test if an image file exists. + * @param path of the parsed file + * @param image the image name + * @return null if the image exists, the expected file path otherwise. + */ + public static File imageExists(String path, String image) { + File f = new File(image); + if (!f.isAbsolute()) { + f = new File(path + File.separator + image); + } + + if (f.exists()) { + return null; + } else { + return f; + } + } + + /** + * @param f the file to copy + * @param destDir the destination directory + */ + public static void copyImageFile(File f, String destDir) { + FileChannel src = null; + FileChannel dest = null; + try { + File destFile = new File(destDir + File.separator + f.getName()); + if (!destFile.exists()) { + destFile.createNewFile(); + } else if (f.lastModified() <= destFile.lastModified()) { + return; + } + + src = new FileInputStream(f).getChannel(); + dest = new FileOutputStream(destFile).getChannel(); + dest.transferFrom(src, 0, src.size()); + } catch (IOException e) { + System.err.println(e); + } finally { + try { + if (src != null) { + src.close(); + } + if (dest != null) { + dest.close(); + } + } catch (IOException e) { + System.err.println(e); + } + } + } + + /** + * @param icon the icon to convert into PNG + * @param imageFile the destination file + * @return true if all is ok + */ + public static boolean convertIconToPNG(Icon icon, File imageFile) { + BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = image.createGraphics(); + icon.paintIcon(null, g2d, 0, 0); + + try { + ImageIO.write(image, "png", imageFile.getAbsoluteFile()); + } catch (IOException ex) { + return false; + } + + g2d.dispose(); + + return true; + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/image/LaTeXImageConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/image/LaTeXImageConverter.java new file mode 100755 index 000000000..c5a90096b --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/image/LaTeXImageConverter.java @@ -0,0 +1,118 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.image; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.Map; + +import org.scilab.forge.jlatexmath.TeXConstants; +import org.scilab.forge.jlatexmath.TeXFormula; +import org.scilab.forge.jlatexmath.TeXIcon; +import org.scilab.forge.jlatexmath.ParseException; +import org.scilab.modules.helptools.DocbookTagConverter; + +/** + * A LaTeX to PNG converter + * @author Calixte DENIZET + */ +public class LaTeXImageConverter implements ExternalImageConverter { + + private final DocbookTagConverter conv; + + public LaTeXImageConverter(DocbookTagConverter conv) { + this.conv = conv; + } + + /** + * {@inheritDoc} + */ + public String getMimeType() { + return "image/latex"; + } + + /** + * {@inheritDoc} + */ + public boolean mustRegenerate() { + return true; + } + + /** + * {@inheritDoc} + */ + public String convertToImage(String currentFile, String latex, Map<String, String> attributes, File imageFile, String imageName) { + TeXIcon icon = null; + try { + TeXFormula formula = new TeXFormula(latex); + String display = attributes.get("style"); + int style = TeXConstants.STYLE_DISPLAY; + if (display != null && display.equals("text")) { + style = TeXConstants.STYLE_TEXT; + } + String fs = attributes.get("fontsize"); + int ifs = 16; + if (fs != null) { + try { + ifs = Integer.parseInt(fs); + } catch (Exception e) { } + } + + icon = formula.createTeXIcon(style, ifs); + + Image img = new Image(icon, icon.getIconWidth(), icon.getIconHeight(), icon.getIconHeight() - icon.getIconDepth(), icon.getIconDepth()); + if (img != null && ImageConverter.convertIconToPNG(img.icon, imageFile)) { + return conv.generateImageCode(img, conv.getBaseImagePath() + imageName, attributes); + } + + } catch (ParseException e) { + System.err.println("LaTeX code in\n" + currentFile + "\nhas generated an error: " + e.getMessage()); + } + return null; + } + + /** + * {@inheritDoc} + */ + public String convertToImage(File latex, Map<String, String> attributes, File imageFile, String imageName) { + BufferedReader input = null; + StringBuilder buffer = new StringBuilder(); + boolean ok = false; + try { + input = new BufferedReader(new FileReader(latex)); + String line = null; + while ((line = input.readLine()) != null) { + buffer.append(line); + buffer.append("\n"); + } + ok = true; + } catch (IOException e) { + System.err.println(e); + } + if (input != null) { + try { + input.close(); + } catch (IOException e) { + System.err.println(e); + } + } + + if (ok) { + return convertToImage(latex.getName(), buffer.toString(), attributes, imageFile, imageName); + } + + return null; + } +}
\ No newline at end of file diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/image/MathMLImageConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/image/MathMLImageConverter.java new file mode 100755 index 000000000..3c1603eeb --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/image/MathMLImageConverter.java @@ -0,0 +1,146 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.image; + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.util.Map; + +import javax.swing.ImageIcon; +import javax.xml.parsers.ParserConfigurationException; + +import net.sourceforge.jeuclid.MathMLParserSupport; +import net.sourceforge.jeuclid.context.LayoutContextImpl; +import net.sourceforge.jeuclid.context.Parameter; +import net.sourceforge.jeuclid.layout.JEuclidView; + +import org.scilab.modules.helptools.DocbookTagConverter; +import org.w3c.dom.Document; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * A MathML to PNG converter + * @author Calixte DENIZET + */ +public class MathMLImageConverter implements ExternalImageConverter { + + private static final Graphics2D TEMPGRAPHIC = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics(); + private final DocbookTagConverter conv; + + public MathMLImageConverter(DocbookTagConverter conv) { + this.conv = conv; + } + + /** + * {@inheritDoc} + */ + public String getMimeType() { + return "image/mathml"; + } + + /** + * {@inheritDoc} + */ + public boolean mustRegenerate() { + return true; + } + + /** + * {@inheritDoc} + */ + public String convertToImage(String currentFile, String mathml, Map<String, String> attributes, File imageFile, String imageName) { + Document doc = null; + try { + doc = MathMLParserSupport.parseString(mathml); + } catch (final SAXException e) { + return null; + } catch (final ParserConfigurationException e) { + return null; + } catch (final IOException e) { + return null; + } + + String fontsize = attributes.get("fontsize"); + int fs = 16; + if (fontsize != null) { + fs = Integer.parseInt(fontsize); + } + + Image img = convertMathML(doc, fs); + if (img != null && ImageConverter.convertIconToPNG(img.icon, imageFile)) { + return conv.generateImageCode(img, conv.getBaseImagePath() + imageName, attributes); + } + + return null; + } + + /** + * {@inheritDoc} + */ + public String convertToImage(File mathml, Map<String, String> attributes, File imageFile, String imageName) { + Document doc = null; + try { + doc = MathMLParserSupport.parseFile(mathml); + } catch (final SAXException e) { + return null; + } catch (final IOException e) { + return null; + } + + String fontsize = attributes.get("fontsize"); + int fs = 16; + if (fontsize != null) { + fs = Integer.parseInt(fontsize); + } + + Image img = convertMathML(doc, fs); + if (img != null && ImageConverter.convertIconToPNG(img.icon, imageFile)) { + return conv.generateImageCode(img, conv.getBaseImagePath() + imageName, attributes); + } + + return null; + } + + /** + * @param mathml the document to convert + * @param fontSize the font size + * @return an image information + */ + private static Image convertMathML(Document mathml, int fontSize) { + LayoutContextImpl parameters = new LayoutContextImpl(LayoutContextImpl.getDefaultLayoutContext()); + parameters.setParameter(Parameter.MATHSIZE, fontSize); + JEuclidView jev = new JEuclidView((Node) mathml, parameters, TEMPGRAPHIC); + + int width = (int) Math.ceil(jev.getWidth()); + int ascent = (int) Math.ceil(jev.getAscentHeight()); + int height = (int) Math.ceil(jev.getDescentHeight()) + ascent; + + if (width <= 0 || height <= 0) { + return null; + } + + BufferedImage bimg = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = bimg.createGraphics(); + g2d.setColor(new Color(255, 255, 255, 0)); + g2d.fillRect(0, 0, width, height); + + jev.draw(g2d, 0, ascent); + g2d.dispose(); + + return new Image(new ImageIcon(bimg), width, height, ascent, height - ascent); + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/image/SVGImageConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/image/SVGImageConverter.java new file mode 100755 index 000000000..f07e7956e --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/image/SVGImageConverter.java @@ -0,0 +1,94 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.image; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.io.StringReader; +import java.util.Map; + +import org.apache.batik.transcoder.TranscoderInput; +import org.apache.batik.transcoder.TranscoderOutput; +import org.apache.batik.transcoder.Transcoder; +import org.apache.batik.transcoder.image.ImageTranscoder; +import org.apache.batik.transcoder.image.PNGTranscoder; +import org.scilab.modules.helptools.DocbookTagConverter; + +/** + * SVG to PNG converter + */ +public class SVGImageConverter implements ExternalImageConverter { + private final DocbookTagConverter conv; + + public SVGImageConverter(DocbookTagConverter conv) { + this.conv = conv; + } + + /** + * {@inheritDoc} + */ + public String getMimeType() { + return "image/svg"; + } + + /** + * {@inheritDoc} + */ + public boolean mustRegenerate() { + return false; + } + + /** + * {@inheritDoc} + */ + public String convertToImage(String currentFile, String svg, Map<String, String> attributes, File imageFile, String imageName) { + return convertToPNG(new TranscoderInput(new StringReader(svg)), attributes, imageFile, imageName); + } + + /** + * {@inheritDoc} + */ + public String convertToImage(File svg, Map<String, String> attributes, File imageFile, String imageName) { + try { + return convertToPNG(new TranscoderInput(new FileInputStream(svg)), attributes, imageFile, conv.getBaseImagePath() + imageName); + } catch (FileNotFoundException e) { + System.err.println("Problem when exporting SVG to " + imageFile + "!\n" + e.toString()); + } + + return null; + } + + /** + * Make really the conversion from svg to png + */ + private String convertToPNG(TranscoderInput input, Map<String, String> attributes, File imageFile, String imageName) { + Transcoder trans = new PNGTranscoder(); + trans.addTranscodingHint(ImageTranscoder.KEY_FORCE_TRANSPARENT_WHITE, Boolean.TRUE); + + try { + OutputStream os = new FileOutputStream(imageFile); + TranscoderOutput output = new TranscoderOutput(os); + trans.transcode(input, output); + os.flush(); + os.close(); + return conv.generateImageCode(conv.getBaseImagePath() + imageName, attributes); + } catch (Exception e) { + System.err.println("Problem when exporting SVG to " + imageFile + "!\n" + e.toString()); + } + + return null; + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/image/ScilabImageConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/image/ScilabImageConverter.java new file mode 100755 index 000000000..d7c80e73c --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/image/ScilabImageConverter.java @@ -0,0 +1,121 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.image; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.Map; + +import org.scilab.modules.commons.ScilabCommons; +import org.scilab.modules.helptools.DocbookTagConverter; + +/** + * Scilab code to PNG converter + */ +public class ScilabImageConverter implements ExternalImageConverter { + + private static final byte[] BOM = { (byte) 0xEF, (byte) 0xBB, (byte) 0xBF }; + private final StringBuilder buffer; + private final DocbookTagConverter conv; + + public ScilabImageConverter(DocbookTagConverter conv) { + buffer = new StringBuilder(8192); + this.conv = conv; + } + + public String getMimeType() { + return "image/scilab"; + } + + /** + * {@inheritDoc} + */ + public boolean mustRegenerate() { + return false; + } + + public String getFileWithScilabCode() { + if (buffer.length() != 0) { + try { + File f = File.createTempFile("help-", ".sce", new File(ScilabCommons.getTMPDIR())); + FileOutputStream fos = new FileOutputStream(f); + Writer out = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8")); + fos.write(BOM); + out.write(buffer.toString()); + out.flush(); + + out.close(); + fos.close(); + + return f.getAbsolutePath(); + } catch (Exception e) { + System.err.println("Cannot generate the file with Scilab code to execute:\n" + e); + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public String convertToImage(String currentFile, String code, Map<String, String> attributes, File imageFile, String imageName) { + return convertToPNG(currentFile, code, attributes, imageFile, imageName); + } + + /** + * {@inheritDoc} + */ + public String convertToImage(File code, Map<String, String> attributes, File imageFile, String imageName) { + try { + BufferedReader in = new BufferedReader(new FileReader(code)); + StringBuilder buffer = new StringBuilder(8192); + String line; + + while ((line = in.readLine()) != null) { + buffer.append(line).append("\n"); + } + + in.close(); + + return convertToPNG(code.getName(), buffer.toString(), attributes, imageFile, imageName); + } catch (Exception e) { + System.err.println("Problem when exporting Scilab code to " + imageFile + "!\n" + e.toString()); + } + + return null; + } + + private final String convertToPNG(String currentFile, String code, Map<String, String> attributes, File imageFile, String imageName) { + buffer.append("function _generate_image_from_doc\n"); + buffer.append("__olddrv__=driver();\n"); + buffer.append("disp(\"Generate image " + imageName + " from Scilab code from file " + new File(currentFile).getName() + "\");"); + buffer.append("driver(\"png\");\n"); + buffer.append("xinit(\"").append(imageFile.getAbsolutePath()).append("\");\n"); + buffer.append("clf();\n"); + buffer.append(code).append("\n"); + buffer.append("___f___=gcf();___f___.anti_aliasing=\"2x\";clear(\"___f___\");\n"); + buffer.append("xend();\n"); + buffer.append("driver(__olddrv__);\n"); + buffer.append("endfunction\n"); + buffer.append("_generate_image_from_doc();\n"); + buffer.append("clear _generate_image_from_doc;\n"); + + return conv.generateImageCode(code, conv.getBaseImagePath() + imageName, attributes); + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/image/XcosImageConverter.java b/modules/helptools/src/java/org/scilab/modules/helptools/image/XcosImageConverter.java new file mode 100755 index 000000000..57534b9f6 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/image/XcosImageConverter.java @@ -0,0 +1,80 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2012 - Scilab Enterprises - Clément David + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.image; + +import java.io.File; +import java.lang.reflect.Method; +import java.util.Map; + +import org.scilab.modules.helptools.DocbookTagConverter; + +/** + * Xcos schema to PNG converter + */ +public class XcosImageConverter implements ExternalImageConverter { + private final DocbookTagConverter conv; + + public XcosImageConverter(DocbookTagConverter conv) { + this.conv = conv; + } + + @Override + public String getMimeType() { + return "image/scilab-xcos"; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean mustRegenerate() { + return false; + } + + /** + * {@inheritDoc} + * + * Redirect to the scilab code implementation. + */ + @Override + public String convertToImage(String currentFile, String code, Map<String, String> attributes, File imageFile, String imageName) { + return conv.getImageConverter().getScilabImageConverter().convertToImage(currentFile, code, attributes, imageFile, imageName); + } + + /** + * {@inheritDoc} + */ + @Override + public String convertToImage(File schema, Map<String, String> attributes, File imageFile, String imageName) { + try { + final String name = schema.getName(); + return convertToPNG(name, schema.getAbsolutePath(), attributes, imageFile, imageName); + } catch (Exception e) { + e.printStackTrace(); + System.err.printf("Problem when exporting Xcos schema %s !\n%s\n", schema, e.toString()); + } + + return null; + } + + private final String convertToPNG(final String helpID, final String xcosFile, Map<String, String> attributes, final File imageFile, final String imageName) throws Exception { + /* + * use a delegate method to avoid a static dependency + */ + final Class<?> export = Class.forName("org.scilab.modules.xcos.utils.XcosDelegates"); + final Method convertToPNG = export.getDeclaredMethod("convertToPNG", String.class, String.class, File.class, String.class); + convertToPNG.invoke(null, helpID, xcosFile, imageFile, imageName); + + return conv.generateImageCode(xcosFile, conv.getBaseImagePath() + imageName, attributes); + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/java/JavaLexer.java b/modules/helptools/src/java/org/scilab/modules/helptools/java/JavaLexer.java new file mode 100755 index 000000000..c4ba40c4a --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/java/JavaLexer.java @@ -0,0 +1,1190 @@ +/* The following code was generated by JFlex 1.4.3 on 23/05/12 15:21 */ + +//CHECKSTYLE:OFF + +package org.scilab.modules.helptools.java; + +import java.io.Reader; +import java.io.StringReader; +import java.io.IOException; + +import org.scilab.modules.helptools.c.AbstractCCodeHandler; + +@javax.annotation.Generated("JFlex") +@SuppressWarnings("fallthrough") + +/** + * This class is a scanner generated by + * <a href="http://www.jflex.de/">JFlex</a> 1.4.3 + * on 23/05/12 15:21 from the specification file + * <tt>./jflex/java.jflex</tt> + */ +public final class JavaLexer { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int CLEANFIRST = 6; + public static final int CLEAN = 4; + public static final int YYINITIAL = 0; + public static final int COMMENT = 2; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0, 1, 1, 2, 2, 3, 3 + }; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\11\0\1\25\1\2\1\0\1\3\1\1\22\0\1\3\1\74\1\22" + + "\2\0\2\74\1\24\2\73\1\5\1\16\1\74\1\16\1\21\1\4" + + "\1\17\11\11\2\74\1\76\1\74\1\75\1\74\1\0\1\10\1\54" + + "\1\55\1\56\1\15\1\14\2\6\1\57\2\6\1\13\1\67\1\65" + + "\1\60\1\70\1\6\1\71\1\62\1\63\1\72\1\64\1\6\1\20" + + "\2\6\1\73\1\23\1\73\1\74\1\7\1\0\1\31\1\26\1\33" + + "\1\43\1\30\1\44\1\50\1\36\1\41\1\61\1\32\1\12\1\45" + + "\1\40\1\37\1\51\1\6\1\27\1\34\1\35\1\42\1\52\1\53" + + "\1\46\1\47\1\66\1\73\1\74\1\73\1\74\uff81\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\1\0\1\1\2\0\2\2\1\3\1\4\2\5\1\6" + + "\3\5\1\6\1\4\2\2\32\5\1\7\3\4\1\1" + + "\2\10\2\0\1\11\1\12\1\13\1\14\1\15\1\16" + + "\1\1\1\17\1\5\2\6\3\5\2\0\1\20\3\0" + + "\25\5\1\21\2\5\1\21\30\5\1\4\1\0\1\1" + + "\2\22\1\23\1\0\2\5\1\0\3\5\1\6\1\20" + + "\25\5\1\24\37\5\1\6\1\0\1\24\65\5\1\21" + + "\3\5\1\25\4\5\1\24\26\5\1\25\20\5\1\24" + + "\156\5"; + + private static int [] zzUnpackAction() { + int [] result = new int[406]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do { + result[j++] = value; + } while (--count > 0); + } + return j; + } + + + /** + * Translates a state to a row index in the transition table + */ + private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); + + private static final String ZZ_ROWMAP_PACKED_0 = + "\0\0\0\77\0\176\0\275\0\374\0\u013b\0\374\0\u017a" + + "\0\u01b9\0\u01f8\0\u0237\0\u0276\0\u02b5\0\u02f4\0\u0333\0\u0372" + + "\0\u03b1\0\u03f0\0\u042f\0\u046e\0\u04ad\0\u04ec\0\u052b\0\u056a" + + "\0\u05a9\0\u05e8\0\u0627\0\u0666\0\u06a5\0\u06e4\0\u0723\0\u0762" + + "\0\u07a1\0\u07e0\0\u081f\0\u085e\0\u089d\0\u08dc\0\u091b\0\u095a" + + "\0\u0999\0\u09d8\0\u0a17\0\u0a56\0\374\0\374\0\u0a95\0\u0ad4" + + "\0\u0b13\0\u0b52\0\374\0\u0b91\0\u0bd0\0\374\0\u0c0f\0\u0c4e" + + "\0\374\0\u0c8d\0\u0ccc\0\u0d0b\0\u0d4a\0\u0d89\0\374\0\u0dc8" + + "\0\u0e07\0\u0e46\0\u0e85\0\u0ec4\0\u03b1\0\374\0\u0f03\0\u0f42" + + "\0\u0f81\0\u0fc0\0\u0fff\0\u103e\0\u107d\0\u10bc\0\u10fb\0\u113a" + + "\0\u1179\0\u11b8\0\u11f7\0\u1236\0\u1275\0\u12b4\0\u12f3\0\u1332" + + "\0\u1371\0\u13b0\0\u13ef\0\u142e\0\u146d\0\u14ac\0\u01b9\0\u14eb" + + "\0\u152a\0\u1569\0\u15a8\0\u15e7\0\u1626\0\u1665\0\u16a4\0\u16e3" + + "\0\u1722\0\u1761\0\u17a0\0\u17df\0\u181e\0\u1569\0\u185d\0\u189c" + + "\0\u18db\0\u191a\0\u1959\0\u1998\0\u19d7\0\u1a16\0\u1a55\0\u1a94" + + "\0\u1ad3\0\u1b12\0\u1b51\0\u1b90\0\u1bcf\0\u1c0e\0\374\0\374" + + "\0\u1c4d\0\u1c8c\0\u1ccb\0\u1d0a\0\u1d49\0\u1d88\0\u1dc7\0\u1e06" + + "\0\u0f42\0\u1e45\0\u1e84\0\u1ec3\0\u1f02\0\u1f41\0\u1f80\0\u1fbf" + + "\0\u1ffe\0\u203d\0\u207c\0\u20bb\0\u20fa\0\u2139\0\u2178\0\u21b7" + + "\0\u21f6\0\u2235\0\u2274\0\u22b3\0\u22f2\0\u2331\0\u2370\0\u23af" + + "\0\u23ee\0\u242d\0\u246c\0\u24ab\0\u24ea\0\u2529\0\u2568\0\u25a7" + + "\0\u25e6\0\u2625\0\u2664\0\u26a3\0\u26e2\0\u2721\0\u2760\0\u279f" + + "\0\u27de\0\u281d\0\u285c\0\u289b\0\u28da\0\u2919\0\u2958\0\u2997" + + "\0\u29d6\0\u2a15\0\u2a54\0\u2a93\0\u2ad2\0\u2b11\0\u2b50\0\u2b8f" + + "\0\u01b9\0\u2bce\0\u2c0d\0\u2c4c\0\u2c8b\0\u2cca\0\u2d09\0\u2d48" + + "\0\u2d87\0\u2dc6\0\u2e05\0\u2e44\0\u2e83\0\u2ec2\0\u2f01\0\u2f40" + + "\0\u2f7f\0\u2fbe\0\u2ffd\0\u303c\0\u307b\0\u30ba\0\u30f9\0\u3138" + + "\0\u3177\0\u31b6\0\u31f5\0\u3234\0\u3273\0\u32b2\0\u32f1\0\u3330" + + "\0\u336f\0\u33ae\0\u33ed\0\u342c\0\u346b\0\u34aa\0\u34e9\0\u3528" + + "\0\u3567\0\u35a6\0\u35e5\0\u3624\0\u3663\0\u36a2\0\u36e1\0\u3720" + + "\0\u375f\0\u379e\0\u37dd\0\u381c\0\u385b\0\u389a\0\u22f2\0\u38d9" + + "\0\u3918\0\u3957\0\u3996\0\u39d5\0\u3a14\0\u3a53\0\u3a92\0\u3ad1" + + "\0\u3b10\0\u3b4f\0\u3b8e\0\u3bcd\0\u3c0c\0\u3c4b\0\u3c8a\0\u3cc9" + + "\0\u3d08\0\u3d47\0\u3d86\0\u3dc5\0\u3e04\0\u3e43\0\u3e82\0\u3ec1" + + "\0\u3f00\0\u3f3f\0\u3f7e\0\u3fbd\0\u3ffc\0\u403b\0\u01b9\0\u407a" + + "\0\u40b9\0\u40f8\0\u4137\0\u4176\0\u41b5\0\u41f4\0\u4233\0\u4272" + + "\0\u42b1\0\u42f0\0\u432f\0\u436e\0\u43ad\0\u43ec\0\u442b\0\u446a" + + "\0\u44a9\0\u44e8\0\u4527\0\u4566\0\u45a5\0\u45e4\0\u4623\0\u4662" + + "\0\u46a1\0\u46e0\0\u471f\0\u475e\0\u479d\0\u47dc\0\u481b\0\u485a" + + "\0\u4899\0\u48d8\0\u4917\0\u4956\0\u4995\0\u49d4\0\u4a13\0\u4a52" + + "\0\u4a91\0\u4ad0\0\u4b0f\0\u4b4e\0\u4b8d\0\u4bcc\0\u4c0b\0\u4c4a" + + "\0\u4c89\0\u4cc8\0\u4d07\0\u4d46\0\u4d85\0\u4dc4\0\u4e03\0\u4e42" + + "\0\u4e81\0\u4ec0\0\u4eff\0\u4f3e\0\u4f7d\0\u4fbc\0\u4ffb\0\u503a" + + "\0\u5079\0\u50b8\0\u50f7\0\u5136\0\u5175\0\u51b4\0\u51f3\0\u5232" + + "\0\u5271\0\u52b0\0\u52ef\0\u532e\0\u536d\0\u53ac\0\u53eb\0\u542a" + + "\0\u5469\0\u54a8\0\u54e7\0\u5526\0\u5565\0\u55a4\0\u55e3\0\u5622" + + "\0\u5661\0\u56a0\0\u56df\0\u571e\0\u575d\0\u579c\0\u57db\0\u581a" + + "\0\u5859\0\u5898\0\u58d7\0\u5916\0\u5955\0\u5994\0\u59d3\0\u5a12" + + "\0\u5a51\0\u5a90\0\u5acf\0\u5b0e\0\u5b4d\0\u5b8c\0\u5bcb\0\u5c0a" + + "\0\u5c49\0\u5c88\0\u5cc7\0\u5d06\0\u5d45\0\u5d84\0\u5dc3\0\u5e02" + + "\0\u5e41\0\u5e80\0\u5ebf\0\u5efe\0\u5f3d\0\u5f7c"; + + private static int [] zzUnpackRowMap() { + int [] result = new int[406]; + int offset = 0; + offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackRowMap(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int high = packed.charAt(i++) << 16; + result[j++] = high | packed.charAt(i++); + } + return j; + } + + /** + * The transition table of the DFA + */ + private static final int [] ZZ_TRANS = zzUnpackTrans(); + + private static final String ZZ_TRANS_PACKED_0 = + "\1\5\1\6\1\7\1\5\1\10\1\5\1\11\1\5" + + "\1\12\1\13\2\14\1\15\1\16\1\5\1\17\1\11" + + "\1\20\1\21\1\5\1\22\1\5\1\23\1\24\1\25" + + "\1\26\1\11\1\27\1\30\1\31\2\11\1\32\1\33" + + "\1\11\1\34\1\35\3\11\1\36\1\37\1\40\1\41" + + "\1\42\1\43\1\44\1\45\1\46\1\11\1\47\1\50" + + "\1\51\1\52\3\11\1\53\1\54\1\55\1\56\1\57" + + "\1\60\1\61\1\62\1\63\1\61\1\64\1\65\71\61" + + "\1\66\2\67\1\70\21\66\1\70\51\66\1\71\2\72" + + "\1\73\21\71\1\73\51\71\101\0\1\7\100\0\1\74" + + "\1\75\77\0\10\11\1\0\2\11\5\0\45\11\12\0" + + "\10\11\1\0\2\11\5\0\1\11\1\76\43\11\15\0" + + "\1\13\2\77\3\0\1\13\1\0\1\100\63\0\10\11" + + "\1\0\2\11\5\0\11\11\1\101\33\11\12\0\4\11" + + "\1\102\3\11\1\0\2\11\5\0\45\11\12\0\10\11" + + "\1\0\2\11\5\0\20\11\1\103\24\11\15\0\1\13" + + "\2\77\3\0\1\13\1\104\1\100\24\0\1\104\41\0" + + "\1\100\5\0\1\100\57\0\1\105\2\0\17\105\1\106" + + "\1\107\53\105\1\110\2\0\20\110\1\111\1\110\1\0" + + "\51\110\6\0\10\11\1\0\2\11\5\0\1\11\1\112" + + "\7\11\1\113\7\11\1\114\23\11\12\0\10\11\1\0" + + "\2\11\5\0\2\11\1\115\42\11\12\0\4\11\1\116" + + "\3\11\1\0\2\11\5\0\12\11\1\117\5\11\1\120" + + "\24\11\12\0\10\11\1\0\2\11\5\0\1\121\44\11" + + "\12\0\4\11\1\122\3\11\1\0\2\11\5\0\3\11" + + "\1\123\4\11\1\124\1\125\33\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\126\1\127\3\11\1\130\10\11" + + "\1\131\17\11\12\0\10\11\1\0\2\11\5\0\1\11" + + "\1\132\6\11\1\133\34\11\12\0\10\11\1\0\2\11" + + "\5\0\2\11\1\134\1\135\41\11\12\0\10\11\1\0" + + "\2\11\5\0\12\11\1\136\3\11\1\137\1\140\25\11" + + "\12\0\10\11\1\0\2\11\5\0\2\11\1\141\6\11" + + "\1\142\33\11\12\0\4\11\1\102\3\11\1\0\2\11" + + "\5\0\3\11\1\143\5\11\1\144\1\11\1\145\31\11" + + "\12\0\10\11\1\0\2\11\5\0\11\11\1\146\33\11" + + "\12\0\10\11\1\0\2\11\5\0\1\11\1\147\1\11" + + "\1\150\10\11\1\151\30\11\12\0\10\11\1\0\2\11" + + "\5\0\11\11\1\152\33\11\12\0\10\11\1\0\2\11" + + "\5\0\10\11\1\153\34\11\12\0\10\11\1\0\2\11" + + "\5\0\11\11\1\113\7\11\1\114\23\11\12\0\4\11" + + "\1\154\3\11\1\0\2\11\5\0\10\11\1\155\34\11" + + "\12\0\10\11\1\0\2\11\5\0\11\11\1\156\33\11" + + "\12\0\4\11\1\157\3\11\1\0\2\11\5\0\12\11" + + "\1\160\32\11\12\0\10\11\1\0\2\11\5\0\1\161" + + "\44\11\12\0\10\11\1\0\2\11\5\0\2\11\1\162" + + "\4\11\1\163\1\127\34\11\12\0\10\11\1\0\2\11" + + "\5\0\10\11\1\164\34\11\12\0\10\11\1\0\2\11" + + "\5\0\11\11\1\165\33\11\12\0\10\11\1\0\2\11" + + "\5\0\2\11\1\166\6\11\1\167\2\11\1\170\30\11" + + "\12\0\10\11\1\0\2\11\5\0\14\11\1\171\30\11" + + "\12\0\10\11\1\0\2\11\5\0\12\11\1\172\32\11" + + "\101\0\1\173\77\0\1\56\1\61\2\0\2\61\1\174" + + "\71\61\2\0\1\63\100\0\1\175\72\0\1\175\1\176" + + "\1\177\1\175\1\200\1\201\71\175\1\0\2\67\77\0" + + "\1\70\21\0\1\70\52\0\2\72\75\0\2\72\1\73" + + "\21\0\1\73\51\0\1\74\2\0\74\74\5\0\1\75" + + "\77\0\10\11\1\0\2\11\5\0\1\11\1\202\11\11" + + "\1\203\31\11\15\0\1\100\2\0\1\77\1\204\1\0" + + "\1\100\10\0\1\204\12\0\2\77\11\0\1\77\26\0" + + "\10\11\1\0\2\11\5\0\12\11\1\205\32\11\12\0" + + "\10\11\1\0\2\11\5\0\11\11\1\206\33\11\12\0" + + "\10\11\1\0\2\11\5\0\5\11\1\207\37\11\14\0" + + "\2\210\2\0\2\210\1\0\1\210\6\0\1\210\1\0" + + "\2\210\1\0\1\210\7\0\2\210\7\0\3\210\20\0" + + "\1\105\2\0\74\105\24\0\1\106\52\0\1\110\2\0" + + "\21\110\1\211\1\0\51\110\6\0\10\11\1\0\2\11" + + "\5\0\2\11\1\212\42\11\12\0\10\11\1\0\2\11" + + "\5\0\11\11\1\213\33\11\12\0\10\11\1\0\2\11" + + "\5\0\7\11\1\214\35\11\12\0\10\11\1\0\2\11" + + "\5\0\7\11\1\215\35\11\12\0\10\11\1\0\2\11" + + "\5\0\6\11\1\216\36\11\12\0\10\11\1\0\2\11" + + "\5\0\14\11\1\217\30\11\12\0\10\11\1\0\2\11" + + "\5\0\7\11\1\220\35\11\12\0\10\11\1\0\2\11" + + "\5\0\6\11\1\221\36\11\12\0\10\11\1\0\2\11" + + "\5\0\3\11\1\222\41\11\12\0\10\11\1\0\2\11" + + "\5\0\6\11\1\216\1\223\35\11\12\0\10\11\1\0" + + "\2\11\5\0\3\11\1\224\41\11\12\0\10\11\1\0" + + "\2\11\5\0\12\11\1\225\32\11\12\0\10\11\1\0" + + "\2\11\5\0\1\11\1\226\1\11\1\227\41\11\12\0" + + "\10\11\1\0\2\11\5\0\11\11\1\230\33\11\12\0" + + "\10\11\1\0\2\11\5\0\23\11\1\231\21\11\12\0" + + "\10\11\1\0\2\11\5\0\13\11\1\232\31\11\12\0" + + "\10\11\1\0\2\11\5\0\3\11\1\233\10\11\1\216" + + "\4\11\1\137\23\11\12\0\10\11\1\0\2\11\5\0" + + "\1\11\1\234\11\11\1\235\31\11\12\0\10\11\1\0" + + "\2\11\5\0\25\11\1\137\17\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\236\35\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\237\35\11\12\0\10\11\1\0" + + "\2\11\5\0\23\11\1\240\21\11\12\0\10\11\1\0" + + "\2\11\5\0\16\11\1\241\26\11\12\0\10\11\1\0" + + "\2\11\5\0\14\11\1\242\30\11\12\0\4\11\1\116" + + "\3\11\1\0\2\11\5\0\45\11\12\0\10\11\1\0" + + "\2\11\5\0\1\11\1\137\43\11\12\0\10\11\1\0" + + "\2\11\5\0\12\11\1\243\32\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\244\35\11\12\0\10\11\1\0" + + "\2\11\5\0\11\11\1\245\1\11\1\246\31\11\12\0" + + "\10\11\1\0\2\11\5\0\5\11\1\247\37\11\12\0" + + "\10\11\1\0\2\11\5\0\1\250\44\11\12\0\4\11" + + "\1\251\3\11\1\0\2\11\5\0\13\11\1\252\31\11" + + "\12\0\10\11\1\0\2\11\5\0\13\11\1\253\31\11" + + "\12\0\10\11\1\0\2\11\5\0\3\11\1\254\5\11" + + "\1\255\33\11\12\0\10\11\1\0\2\11\5\0\3\11" + + "\1\256\41\11\12\0\4\11\1\257\3\11\1\0\2\11" + + "\5\0\45\11\12\0\10\11\1\0\2\11\5\0\6\11" + + "\1\260\1\261\5\11\1\262\27\11\12\0\10\11\1\0" + + "\2\11\5\0\33\11\1\263\11\11\12\0\10\11\1\0" + + "\2\11\5\0\5\11\1\264\37\11\12\0\10\11\1\0" + + "\2\11\5\0\1\11\1\265\43\11\12\0\10\11\1\0" + + "\2\11\5\0\1\11\1\266\43\11\12\0\10\11\1\0" + + "\2\11\5\0\13\11\1\252\31\11\12\0\10\11\1\0" + + "\2\11\5\0\22\11\1\267\22\11\12\0\10\11\1\0" + + "\2\11\5\0\34\11\1\270\10\11\12\0\4\11\1\271" + + "\3\11\1\0\2\11\5\0\17\11\1\272\25\11\12\0" + + "\10\11\1\0\2\11\5\0\12\11\1\273\32\11\12\0" + + "\10\11\1\0\2\11\5\0\6\11\1\274\36\11\101\0" + + "\1\56\1\0\1\175\2\0\1\175\1\0\1\174\71\175" + + "\1\61\2\0\1\61\1\64\1\174\71\61\2\0\1\177" + + "\74\0\1\175\2\0\1\175\1\200\1\201\71\175\6\0" + + "\10\11\1\0\2\11\5\0\3\11\1\275\41\11\12\0" + + "\10\11\1\0\2\11\5\0\7\11\1\276\35\11\15\0" + + "\1\277\4\0\1\300\1\277\65\0\10\11\1\0\2\11" + + "\5\0\22\11\1\301\22\11\12\0\10\11\1\0\2\11" + + "\5\0\3\11\1\302\41\11\12\0\10\11\1\0\2\11" + + "\5\0\2\11\1\303\42\11\14\0\2\210\2\77\2\210" + + "\1\0\1\210\6\0\1\210\1\0\2\210\1\0\1\210" + + "\7\0\2\210\7\0\3\210\26\0\10\11\1\0\2\11" + + "\5\0\3\11\1\304\41\11\12\0\4\11\1\305\3\11" + + "\1\0\2\11\5\0\45\11\12\0\10\11\1\0\2\11" + + "\5\0\2\11\1\301\42\11\12\0\10\11\1\0\2\11" + + "\5\0\14\11\1\306\30\11\12\0\10\11\1\0\2\11" + + "\5\0\2\11\1\137\42\11\12\0\10\11\1\0\2\11" + + "\5\0\17\11\1\137\25\11\12\0\10\11\1\0\2\11" + + "\5\0\2\11\1\307\42\11\12\0\10\11\1\0\2\11" + + "\5\0\7\11\1\310\35\11\12\0\10\11\1\0\2\11" + + "\5\0\6\11\1\235\36\11\12\0\10\11\1\0\2\11" + + "\5\0\5\11\1\311\37\11\12\0\10\11\1\0\2\11" + + "\5\0\1\11\1\301\43\11\12\0\10\11\1\0\2\11" + + "\5\0\6\11\1\312\1\313\35\11\12\0\10\11\1\0" + + "\2\11\5\0\13\11\1\314\31\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\315\35\11\12\0\10\11\1\0" + + "\2\11\5\0\1\11\1\302\43\11\12\0\10\11\1\0" + + "\2\11\5\0\2\11\1\144\42\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\223\35\11\12\0\10\11\1\0" + + "\2\11\5\0\12\11\1\316\32\11\12\0\10\11\1\0" + + "\2\11\5\0\11\11\1\317\33\11\12\0\10\11\1\0" + + "\2\11\5\0\6\11\1\137\36\11\12\0\10\11\1\0" + + "\2\11\5\0\13\11\1\320\31\11\12\0\10\11\1\0" + + "\2\11\5\0\2\11\1\321\42\11\12\0\4\11\1\322" + + "\3\11\1\0\2\11\5\0\11\11\1\323\33\11\12\0" + + "\10\11\1\0\2\11\5\0\3\11\1\324\41\11\12\0" + + "\10\11\1\0\2\11\5\0\1\325\44\11\12\0\10\11" + + "\1\0\2\11\5\0\3\11\1\326\41\11\12\0\10\11" + + "\1\0\2\11\5\0\11\11\1\137\33\11\12\0\10\11" + + "\1\0\2\11\5\0\7\11\1\327\35\11\12\0\10\11" + + "\1\0\2\11\5\0\24\11\1\330\20\11\12\0\10\11" + + "\1\0\2\11\5\0\4\11\1\331\40\11\12\0\4\11" + + "\1\315\3\11\1\0\2\11\5\0\45\11\12\0\10\11" + + "\1\0\2\11\5\0\3\11\1\332\41\11\12\0\10\11" + + "\1\0\2\11\5\0\15\11\1\301\27\11\12\0\4\11" + + "\1\216\3\11\1\0\2\11\5\0\45\11\12\0\10\11" + + "\1\0\2\11\5\0\6\11\1\333\36\11\12\0\10\11" + + "\1\0\2\11\5\0\12\11\1\334\32\11\12\0\10\11" + + "\1\0\2\11\5\0\1\11\1\335\43\11\12\0\10\11" + + "\1\0\2\11\5\0\2\11\1\336\42\11\12\0\10\11" + + "\1\0\2\11\5\0\7\11\1\337\35\11\12\0\10\11" + + "\1\0\2\11\5\0\2\11\1\340\42\11\12\0\10\11" + + "\1\0\2\11\5\0\2\11\1\341\42\11\12\0\10\11" + + "\1\0\2\11\5\0\2\11\1\342\42\11\12\0\10\11" + + "\1\0\2\11\5\0\14\11\1\343\30\11\12\0\10\11" + + "\1\0\2\11\5\0\13\11\1\344\31\11\12\0\10\11" + + "\1\0\2\11\5\0\2\11\1\345\42\11\12\0\10\11" + + "\1\0\2\11\5\0\3\11\1\346\41\11\12\0\10\11" + + "\1\0\2\11\5\0\14\11\1\347\30\11\12\0\4\11" + + "\1\350\3\11\1\0\2\11\5\0\45\11\12\0\10\11" + + "\1\0\2\11\5\0\1\351\44\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\352\35\11\12\0\10\11\1\0" + + "\2\11\5\0\14\11\1\353\30\11\12\0\10\11\1\0" + + "\2\11\5\0\21\11\1\354\23\11\12\0\10\11\1\0" + + "\2\11\5\0\10\11\1\355\34\11\15\0\1\277\2\0" + + "\1\77\2\0\1\277\23\0\2\77\11\0\1\77\31\0" + + "\1\277\5\0\1\277\65\0\10\11\1\0\2\11\5\0" + + "\7\11\1\301\35\11\12\0\10\11\1\0\2\11\5\0" + + "\23\11\1\356\21\11\12\0\10\11\1\0\2\11\5\0" + + "\4\11\1\137\40\11\12\0\10\11\1\0\2\11\5\0" + + "\2\11\1\357\42\11\12\0\10\11\1\0\2\11\5\0" + + "\1\11\1\360\43\11\12\0\10\11\1\0\2\11\5\0" + + "\12\11\1\361\32\11\12\0\10\11\1\0\2\11\5\0" + + "\1\11\1\362\43\11\12\0\10\11\1\0\2\11\5\0" + + "\10\11\1\137\34\11\12\0\10\11\1\0\2\11\5\0" + + "\7\11\1\137\35\11\12\0\10\11\1\0\2\11\5\0" + + "\13\11\1\363\31\11\12\0\10\11\1\0\2\11\5\0" + + "\5\11\1\364\37\11\12\0\10\11\1\0\2\11\5\0" + + "\13\11\1\365\31\11\12\0\10\11\1\0\2\11\5\0" + + "\6\11\1\366\36\11\12\0\10\11\1\0\2\11\5\0" + + "\25\11\1\367\17\11\12\0\10\11\1\0\2\11\5\0" + + "\24\11\1\216\20\11\12\0\10\11\1\0\2\11\5\0" + + "\1\11\1\370\43\11\12\0\10\11\1\0\2\11\5\0" + + "\2\11\1\371\42\11\12\0\10\11\1\0\2\11\5\0" + + "\1\11\1\312\43\11\12\0\10\11\1\0\2\11\5\0" + + "\14\11\1\372\30\11\12\0\4\11\1\214\3\11\1\0" + + "\2\11\5\0\45\11\12\0\4\11\1\373\3\11\1\0" + + "\2\11\5\0\45\11\12\0\10\11\1\0\2\11\5\0" + + "\2\11\1\374\42\11\12\0\10\11\1\0\2\11\5\0" + + "\3\11\1\375\41\11\12\0\10\11\1\0\2\11\5\0" + + "\3\11\1\376\41\11\12\0\10\11\1\0\2\11\5\0" + + "\7\11\1\377\35\11\12\0\10\11\1\0\2\11\5\0" + + "\6\11\1\u0100\36\11\12\0\10\11\1\0\2\11\5\0" + + "\2\11\1\u0101\42\11\12\0\10\11\1\0\2\11\5\0" + + "\3\11\1\u0102\41\11\12\0\10\11\1\0\2\11\5\0" + + "\22\11\1\u0103\22\11\12\0\10\11\1\0\2\11\5\0" + + "\3\11\1\u0104\41\11\12\0\10\11\1\0\2\11\5\0" + + "\1\11\1\u0105\20\11\1\u0106\22\11\12\0\10\11\1\0" + + "\2\11\5\0\20\11\1\u0107\24\11\12\0\10\11\1\0" + + "\2\11\5\0\5\11\1\302\37\11\12\0\10\11\1\0" + + "\2\11\5\0\1\11\1\u0108\43\11\12\0\10\11\1\0" + + "\2\11\5\0\12\11\1\u0109\32\11\12\0\10\11\1\0" + + "\2\11\5\0\3\11\1\252\41\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\u010a\35\11\12\0\10\11\1\0" + + "\2\11\5\0\5\11\1\u010b\37\11\12\0\10\11\1\0" + + "\2\11\5\0\42\11\1\u010c\2\11\12\0\10\11\1\0" + + "\2\11\5\0\2\11\1\u010d\42\11\12\0\10\11\1\0" + + "\2\11\5\0\13\11\1\u010e\31\11\12\0\10\11\1\0" + + "\2\11\5\0\23\11\1\u010f\21\11\12\0\10\11\1\0" + + "\2\11\5\0\31\11\1\u0110\13\11\12\0\10\11\1\0" + + "\2\11\5\0\17\11\1\u0111\25\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\u0112\35\11\12\0\10\11\1\0" + + "\2\11\5\0\3\11\1\u0113\41\11\12\0\10\11\1\0" + + "\2\11\5\0\12\11\1\137\32\11\12\0\10\11\1\0" + + "\2\11\5\0\15\11\1\235\27\11\12\0\10\11\1\0" + + "\2\11\5\0\3\11\1\u0114\41\11\12\0\10\11\1\0" + + "\2\11\5\0\12\11\1\u0115\32\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\u0116\35\11\12\0\10\11\1\0" + + "\2\11\5\0\5\11\1\u0117\37\11\12\0\10\11\1\0" + + "\2\11\5\0\13\11\1\u0118\31\11\12\0\10\11\1\0" + + "\2\11\5\0\16\11\1\u0119\26\11\12\0\10\11\1\0" + + "\2\11\5\0\17\11\1\u011a\25\11\12\0\4\11\1\312" + + "\3\11\1\0\2\11\5\0\45\11\12\0\4\11\1\u011b" + + "\3\11\1\0\2\11\5\0\45\11\12\0\10\11\1\0" + + "\2\11\5\0\5\11\1\u011c\37\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\u011d\35\11\12\0\10\11\1\0" + + "\2\11\5\0\22\11\1\216\22\11\12\0\10\11\1\0" + + "\2\11\5\0\13\11\1\u011e\31\11\12\0\10\11\1\0" + + "\2\11\5\0\27\11\1\u011f\7\11\1\u0120\5\11\12\0" + + "\10\11\1\0\2\11\5\0\37\11\1\u0121\5\11\12\0" + + "\10\11\1\0\2\11\5\0\5\11\1\u0122\37\11\12\0" + + "\10\11\1\0\2\11\5\0\3\11\1\u0123\41\11\12\0" + + "\10\11\1\0\2\11\5\0\12\11\1\u0124\32\11\12\0" + + "\10\11\1\0\2\11\5\0\1\11\1\u0125\43\11\12\0" + + "\10\11\1\0\2\11\5\0\2\11\1\224\42\11\12\0" + + "\10\11\1\0\2\11\5\0\32\11\1\u0126\12\11\12\0" + + "\10\11\1\0\2\11\5\0\13\11\1\u0127\31\11\12\0" + + "\10\11\1\0\2\11\5\0\22\11\1\u0128\22\11\12\0" + + "\10\11\1\0\2\11\5\0\13\11\1\u0129\31\11\12\0" + + "\10\11\1\0\2\11\5\0\10\11\1\u012a\34\11\12\0" + + "\10\11\1\0\2\11\5\0\11\11\1\u012b\33\11\12\0" + + "\10\11\1\0\2\11\5\0\1\11\1\u012c\43\11\12\0" + + "\10\11\1\0\2\11\5\0\17\11\1\u012d\25\11\12\0" + + "\10\11\1\0\2\11\5\0\23\11\1\u012e\21\11\12\0" + + "\10\11\1\0\2\11\5\0\12\11\1\u012f\32\11\12\0" + + "\10\11\1\0\2\11\5\0\2\11\1\u0130\42\11\12\0" + + "\10\11\1\0\2\11\5\0\13\11\1\u0131\31\11\12\0" + + "\10\11\1\0\2\11\5\0\12\11\1\301\32\11\12\0" + + "\10\11\1\0\2\11\5\0\5\11\1\u0132\37\11\12\0" + + "\10\11\1\0\2\11\5\0\14\11\1\216\30\11\12\0" + + "\10\11\1\0\2\11\5\0\16\11\1\u0133\26\11\12\0" + + "\10\11\1\0\2\11\5\0\2\11\1\u0134\42\11\12\0" + + "\10\11\1\0\2\11\5\0\3\11\1\u0135\41\11\12\0" + + "\10\11\1\0\2\11\5\0\2\11\1\u0136\42\11\12\0" + + "\10\11\1\0\2\11\5\0\21\11\1\137\23\11\12\0" + + "\10\11\1\0\2\11\5\0\7\11\1\u0137\35\11\12\0" + + "\10\11\1\0\2\11\5\0\2\11\1\u0117\42\11\12\0" + + "\4\11\1\u011d\3\11\1\0\2\11\5\0\45\11\12\0" + + "\10\11\1\0\2\11\5\0\3\11\1\u0138\41\11\12\0" + + "\10\11\1\0\2\11\5\0\11\11\1\u0139\33\11\12\0" + + "\10\11\1\0\2\11\5\0\11\11\1\u013a\33\11\12\0" + + "\10\11\1\0\2\11\5\0\7\11\1\u0106\35\11\12\0" + + "\4\11\1\u013b\3\11\1\0\2\11\5\0\45\11\12\0" + + "\10\11\1\0\2\11\5\0\7\11\1\u013c\35\11\12\0" + + "\10\11\1\0\2\11\5\0\14\11\1\u013d\30\11\12\0" + + "\10\11\1\0\2\11\5\0\14\11\1\u013e\30\11\12\0" + + "\10\11\1\0\2\11\5\0\7\11\1\u013f\35\11\12\0" + + "\10\11\1\0\2\11\5\0\26\11\1\u0140\2\11\1\u0110" + + "\13\11\12\0\10\11\1\0\2\11\5\0\24\11\1\u0141" + + "\20\11\12\0\6\11\1\u0142\1\11\1\0\2\11\5\0" + + "\41\11\1\u0143\3\11\12\0\10\11\1\0\2\11\5\0" + + "\13\11\1\u0144\31\11\12\0\6\11\1\u0145\1\11\1\0" + + "\2\11\5\0\45\11\12\0\10\11\1\0\2\11\5\0" + + "\2\11\1\u0146\42\11\12\0\10\11\1\0\2\11\5\0" + + "\11\11\1\u0147\33\11\12\0\10\11\1\0\2\11\5\0" + + "\15\11\1\262\27\11\12\0\10\11\1\0\2\11\5\0" + + "\7\11\1\u0148\35\11\12\0\10\11\1\0\2\11\5\0" + + "\11\11\1\u0113\33\11\12\0\10\11\1\0\2\11\5\0" + + "\7\11\1\u0117\35\11\12\0\10\11\1\0\2\11\5\0" + + "\23\11\1\137\21\11\12\0\10\11\1\0\2\11\5\0" + + "\12\11\1\u0132\32\11\12\0\10\11\1\0\2\11\5\0" + + "\5\11\1\216\37\11\12\0\10\11\1\0\2\11\5\0" + + "\12\11\1\u0149\32\11\12\0\10\11\1\0\2\11\5\0" + + "\2\11\1\u014a\42\11\12\0\10\11\1\0\2\11\5\0" + + "\6\11\1\u014b\36\11\12\0\10\11\1\0\2\11\5\0" + + "\7\11\1\u014c\35\11\12\0\10\11\1\0\2\11\5\0" + + "\7\11\1\u014d\35\11\12\0\2\11\1\u014e\5\11\1\0" + + "\2\11\5\0\34\11\1\u014f\1\u0150\7\11\12\0\10\11" + + "\1\0\2\11\5\0\13\11\1\u0151\31\11\12\0\10\11" + + "\1\0\2\11\5\0\23\11\1\u0152\21\11\12\0\10\11" + + "\1\0\2\11\5\0\7\11\1\u0153\35\11\12\0\10\11" + + "\1\0\2\11\5\0\21\11\1\u0146\23\11\12\0\10\11" + + "\1\0\2\11\5\0\14\11\1\u0154\30\11\12\0\10\11" + + "\1\0\2\11\5\0\2\11\1\u0155\42\11\12\0\10\11" + + "\1\0\2\11\5\0\13\11\1\u0156\31\11\12\0\10\11" + + "\1\0\2\11\5\0\2\11\1\u0157\42\11\12\0\10\11" + + "\1\0\2\11\5\0\12\11\1\u0158\32\11\12\0\10\11" + + "\1\0\2\11\5\0\11\11\1\u0159\33\11\12\0\7\11" + + "\1\16\1\0\2\11\5\0\45\11\12\0\10\11\1\0" + + "\2\11\5\0\1\11\1\u015a\43\11\12\0\10\11\1\0" + + "\2\11\5\0\13\11\1\u015b\31\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\235\35\11\12\0\10\11\1\0" + + "\2\11\5\0\15\11\1\u0117\27\11\12\0\10\11\1\0" + + "\2\11\5\0\7\11\1\u0146\35\11\12\0\6\11\1\u015c" + + "\1\11\1\0\2\11\5\0\45\11\12\0\10\11\1\0" + + "\2\11\5\0\34\11\1\u015d\10\11\12\0\10\11\1\0" + + "\2\11\5\0\1\11\1\u015e\3\11\1\u015f\37\11\12\0" + + "\10\11\1\0\2\11\5\0\7\11\1\u0160\35\11\12\0" + + "\10\11\1\0\2\11\5\0\10\11\1\u0161\34\11\12\0" + + "\10\11\1\0\2\11\5\0\3\11\1\u0162\41\11\12\0" + + "\10\11\1\0\2\11\5\0\7\11\1\u0163\35\11\12\0" + + "\10\11\1\0\2\11\5\0\32\11\1\u0164\12\11\12\0" + + "\10\11\1\0\2\11\5\0\13\11\1\u0165\2\11\1\u0166" + + "\26\11\12\0\2\11\1\u0167\5\11\1\0\2\11\5\0" + + "\45\11\12\0\10\11\1\0\2\11\5\0\2\11\1\u0168" + + "\42\11\12\0\10\11\1\0\2\11\5\0\7\11\1\u0169" + + "\35\11\12\0\10\11\1\0\2\11\5\0\7\11\1\u016a" + + "\35\11\12\0\10\11\1\0\2\11\5\0\1\11\1\u016b" + + "\43\11\12\0\10\11\1\0\2\11\5\0\7\11\1\u016c" + + "\35\11\12\0\10\11\1\0\2\11\5\0\5\11\1\u0146" + + "\37\11\12\0\10\11\1\0\2\11\5\0\11\11\1\u016d" + + "\33\11\12\0\10\11\1\0\2\11\5\0\14\11\1\u016e" + + "\30\11\12\0\10\11\1\0\2\11\5\0\22\11\1\u016f" + + "\22\11\12\0\10\11\1\0\2\11\5\0\5\11\1\u0170" + + "\37\11\12\0\10\11\1\0\2\11\5\0\3\11\1\u0171" + + "\41\11\12\0\10\11\1\0\2\11\5\0\1\11\1\u0172" + + "\43\11\12\0\10\11\1\0\2\11\5\0\7\11\1\u0173" + + "\35\11\12\0\10\11\1\0\2\11\5\0\2\11\1\u0174" + + "\42\11\12\0\10\11\1\0\2\11\5\0\16\11\1\u0175" + + "\26\11\12\0\4\11\1\u0176\3\11\1\0\2\11\5\0" + + "\45\11\12\0\10\11\1\0\2\11\5\0\16\11\1\u0106" + + "\26\11\12\0\10\11\1\0\2\11\5\0\1\11\1\u0177" + + "\43\11\12\0\4\11\1\u0174\3\11\1\0\2\11\5\0" + + "\45\11\12\0\10\11\1\0\2\11\5\0\10\11\1\u0178" + + "\34\11\12\0\10\11\1\0\2\11\5\0\2\11\1\u0179" + + "\42\11\12\0\10\11\1\0\2\11\5\0\17\11\1\u017a" + + "\25\11\12\0\10\11\1\0\2\11\5\0\2\11\1\u017b" + + "\42\11\12\0\10\11\1\0\2\11\5\0\14\11\1\u017c" + + "\30\11\12\0\10\11\1\0\2\11\5\0\23\11\1\u017d" + + "\21\11\12\0\10\11\1\0\2\11\5\0\14\11\1\u017e" + + "\30\11\12\0\10\11\1\0\2\11\5\0\2\11\1\u017f" + + "\42\11\12\0\10\11\1\0\2\11\5\0\7\11\1\u012d" + + "\35\11\12\0\10\11\1\0\2\11\5\0\2\11\1\u0180" + + "\42\11\12\0\10\11\1\0\2\11\5\0\13\11\1\u0181" + + "\31\11\12\0\10\11\1\0\2\11\5\0\15\11\1\u0146" + + "\27\11\12\0\10\11\1\0\2\11\5\0\26\11\1\u0182" + + "\16\11\12\0\10\11\1\0\2\11\5\0\15\11\1\u0106" + + "\27\11\12\0\10\11\1\0\2\11\5\0\1\11\1\u0183" + + "\43\11\12\0\10\11\1\0\2\11\5\0\11\11\1\u0174" + + "\33\11\12\0\10\11\1\0\2\11\5\0\1\11\1\u0146" + + "\43\11\12\0\10\11\1\0\2\11\5\0\3\11\1\u014b" + + "\41\11\12\0\10\11\1\0\2\11\5\0\15\11\1\u0184" + + "\27\11\12\0\10\11\1\0\2\11\5\0\12\11\1\u0174" + + "\32\11\12\0\10\11\1\0\2\11\5\0\23\11\1\u0185" + + "\21\11\12\0\10\11\1\0\2\11\5\0\17\11\1\u0186" + + "\25\11\12\0\10\11\1\0\2\11\5\0\6\11\1\u0187" + + "\36\11\12\0\10\11\1\0\2\11\5\0\3\11\1\u0188" + + "\41\11\12\0\10\11\1\0\2\11\5\0\11\11\1\u0189" + + "\33\11\12\0\10\11\1\0\2\11\5\0\11\11\1\u018a" + + "\33\11\12\0\10\11\1\0\2\11\5\0\3\11\1\u018b" + + "\41\11\12\0\10\11\1\0\2\11\5\0\32\11\1\u018c" + + "\12\11\12\0\10\11\1\0\2\11\5\0\11\11\1\u018d" + + "\33\11\12\0\10\11\1\0\2\11\5\0\2\11\1\u018e" + + "\42\11\12\0\10\11\1\0\2\11\5\0\6\11\1\u0146" + + "\36\11\12\0\10\11\1\0\2\11\5\0\15\11\1\u018f" + + "\27\11\12\0\10\11\1\0\2\11\5\0\12\11\1\u0146" + + "\32\11\12\0\10\11\1\0\2\11\5\0\14\11\1\u0190" + + "\30\11\12\0\10\11\1\0\2\11\5\0\21\11\1\u0191" + + "\23\11\12\0\10\11\1\0\2\11\5\0\23\11\1\u0192" + + "\21\11\12\0\10\11\1\0\2\11\5\0\1\11\1\u0152" + + "\43\11\12\0\10\11\1\0\2\11\5\0\12\11\1\u014b" + + "\32\11\12\0\10\11\1\0\2\11\5\0\34\11\1\u014f" + + "\10\11\12\0\10\11\1\0\2\11\5\0\12\11\1\u0193" + + "\32\11\12\0\10\11\1\0\2\11\5\0\34\11\1\u0194" + + "\10\11\12\0\10\11\1\0\2\11\5\0\2\11\1\u0195" + + "\42\11\12\0\10\11\1\0\2\11\5\0\15\11\1\u0187" + + "\27\11\12\0\10\11\1\0\2\11\5\0\13\11\1\u0196" + + "\31\11\12\0\10\11\1\0\2\11\5\0\1\11\1\u0151" + + "\43\11\12\0\10\11\1\0\2\11\5\0\40\11\1\u012d" + + "\4\11\4\0"; + + private static int [] zzUnpackTrans() { + int [] result = new int[24507]; + int offset = 0; + offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackTrans(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + value--; + do { + result[j++] = value; + } while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** + * ZZ_ATTRIBUTE[aState] contains the attributes of state <code>aState</code> + */ + private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); + + private static final String ZZ_ATTRIBUTE_PACKED_0 = + "\1\0\1\1\2\0\1\11\1\1\1\11\45\1\2\11" + + "\4\1\1\11\2\0\1\11\2\1\1\11\5\1\1\11" + + "\4\1\2\0\1\11\3\0\62\1\1\0\2\1\2\11" + + "\1\0\2\1\1\0\73\1\1\0\326\1"; + + private static int [] zzUnpackAttribute() { + int [] result = new int[406]; + int offset = 0; + offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAttribute(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do { + result[j++] = value; + } while (--count > 0); + } + return j; + } + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** number of newlines encountered up to the start of the matched text */ + private int yyline; + + /** the number of characters up to the start of the matched text */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + + private int whitesOnFirstLine; + private int saveLexState; + private AbstractCCodeHandler handler; + + public JavaLexer() { } + + private String trimEnd(String str) { + int end = str.length() - 1; + int i = end; + for (; i >= 0; i--) { + char c = str.charAt(i); + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { + break; + } + } + if (i != end) { + return str.substring(0, i + 1); + } + + return str; + } + + public String convert(AbstractCCodeHandler h, String code) { + Reader reader = new StringReader(trimEnd(code)); + String str = convert(h, reader, true); + try { + reader.close(); + } catch (IOException e) { } + + return str; + } + + public String convert(AbstractCCodeHandler h, Reader code, boolean ret) { + if (code == null) { + return null; + } else { + handler = h; + whitesOnFirstLine = 0; + yyreset(code); + yybegin(CLEANFIRST); + try { + yylex(); + } catch (IOException e) { + return null; + } + if (ret) { + return h.toString(); + } + return ""; + } + } + + + /** + * Creates a new scanner + * There is also a java.io.InputStream version of this constructor. + * + * @param in the java.io.Reader to read input from. + */ + public JavaLexer(java.io.Reader in) { + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + public JavaLexer(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 176) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do { + map[j++] = value; + } while (--count > 0); + } + return map; + } + + + /** + * Refills the input buffer. + * + * @return <code>false</code>, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead - zzStartRead); + + /* translate stored positions */ + zzEndRead -= zzStartRead; + zzCurrentPos -= zzStartRead; + zzMarkedPos -= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos * 2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length - zzEndRead); + + if (numRead > 0) { + zzEndRead += numRead; + return false; + } + // unlikely but not impossible: read 0 characters, but not at end of stream + if (numRead == 0) { + int c = zzReader.read(); + if (c == -1) { + return true; + } else { + zzBuffer[zzEndRead++] = (char) c; + return false; + } + } + + // numRead < 0 + return true; + } + + + /** + * Closes the input stream. + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ + zzEndRead = zzStartRead; /* invalidate buffer */ + + if (zzReader != null) { + zzReader.close(); + } + } + + + /** + * Resets the scanner to read from a new input stream. + * Does not close the old reader. + * + * All internal variables are reset, the old input stream + * <b>cannot</b> be reused (internal buffer is discarded and lost). + * Lexical state is set to <tt>ZZ_INITIAL</tt>. + * + * @param reader the new input stream + */ + public final void yyreset(java.io.Reader reader) { + zzReader = reader; + zzAtBOL = true; + zzAtEOF = false; + zzEOFDone = false; + zzEndRead = zzStartRead = 0; + zzCurrentPos = zzMarkedPos = 0; + yyline = yychar = yycolumn = 0; + zzLexicalState = YYINITIAL; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final String yytext() { + return new String( zzBuffer, zzStartRead, zzMarkedPos - zzStartRead ); + } + + + /** + * Returns the character at position <tt>pos</tt> from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer[zzStartRead + pos]; + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos - zzStartRead; + } + + + /** + * Reports an error that occurred while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) { + zzScanError(ZZ_PUSHBACK_2BIG); + } + + zzMarkedPos -= number; + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public void yylex() throws java.io.IOException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + char [] zzBufferL = zzBuffer; + char [] zzCMapL = ZZ_CMAP; + + int [] zzTransL = ZZ_TRANS; + int [] zzRowMapL = ZZ_ROWMAP; + int [] zzAttrL = ZZ_ATTRIBUTE; + + while (true) { + zzMarkedPosL = zzMarkedPos; + + yychar += zzMarkedPosL - zzStartRead; + + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) { + zzInput = zzBufferL[zzCurrentPosL++]; + } else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } else { + zzInput = zzBufferL[zzCurrentPosL++]; + } + } + int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; + if (zzNext == -1) { + break zzForAction; + } + zzState = zzNext; + + int zzAttributes = zzAttrL[zzState]; + if ( (zzAttributes & 1) == 1 ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( (zzAttributes & 8) == 8 ) { + break zzForAction; + } + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 18 : + { + handler.handleComment("*"); + handler.handleNothing("\n"); + saveLexState = COMMENT; + yybegin(CLEAN); + } + case 22: + break; + case 16: { + handler.handleString(yytext()); + } + case 23: + break; + case 17: { + handler.handleKeyword(yytext()); + } + case 24: + break; + case 9: { + yypushback(1); + yybegin(saveLexState); + } + case 25: + break; + case 10: { + handler.handleNothing("\n"); + } + case 26: + break; + case 6: { + handler.handleNumber(yytext()); + } + case 27: + break; + case 1: { + handler.handleComment(yytext()); + } + case 28: + break; + case 11: { + int len = yylength() - whitesOnFirstLine; + if (len > 0) { + yypushback(len); + } + yybegin(saveLexState); + } + case 29: + break; + case 14: { + whitesOnFirstLine = yylength(); + yybegin(YYINITIAL); + } + case 30: + break; + case 21: { + handler.handleModifier(yytext()); + } + case 31: + break; + case 7: { + handler.handleOpenClose(yytext()); + } + case 32: + break; + case 19: { + yybegin(YYINITIAL); + handler.handleComment(yytext()); + } + case 33: + break; + case 15: { + yybegin(COMMENT); + handler.handleComment(yytext()); + } + case 34: + break; + case 8: { + handler.handleNothing("\n"); + saveLexState = COMMENT; + yybegin(CLEAN); + } + case 35: + break; + case 3: { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } + case 36: + break; + case 5: { + handler.handleId(yytext()); + } + case 37: + break; + case 12: { + yypushback(1); + yybegin(YYINITIAL); + } + case 38: + break; + case 2: { + handler.handleDefault(yytext()); + } + case 39: + break; + case 20: { + handler.handleType(yytext()); + } + case 40: + break; + case 4: { + handler.handleOperator(yytext()); + } + case 41: + break; + case 13: { + } + case 42: + break; + default: + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + { + return; + } + } else { + zzScanError(ZZ_NO_MATCH); + } + } + } + } + + +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/scilab/AbstractScilabCodeHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/scilab/AbstractScilabCodeHandler.java new file mode 100755 index 000000000..38b8924a5 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/scilab/AbstractScilabCodeHandler.java @@ -0,0 +1,158 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.scilab; + +import java.io.IOException; + +public abstract class AbstractScilabCodeHandler { + + /** + * Handle default: when a char sequence is unidentified + * @param seq the sequence to append + */ + public void handleDefault(String seq) throws IOException { } + + /** + * Handle operator: '+', '/', '*', ... + * @param seq the sequence to append + */ + public void handleOperator(String seq) throws IOException { } + + /** + * Handle open/close: '(', ')', '[', ']', ... + * @param seq the sequence to append + */ + public void handleOpenClose(String seq) throws IOException { } + + /** + * Handle function keywords: 'function' or 'endfunction' + * @param seq the sequence to append + */ + public void handleFKeywords(String seq) throws IOException { } + + /** + * Handle structure keywords: 'if', 'for', ... + * @param seq the sequence to append + */ + public void handleSKeywords(String seq) throws IOException { } + + /** + * Handle control keywords: 'abort', 'return', ... + * @param seq the sequence to append + */ + public void handleCKeywords(String seq) throws IOException { } + + /** + * Handle contants: '%pi', '%e', ... + * @param seq the sequence to append + */ + public void handleConstants(String seq) throws IOException { } + + /** + * Handle command: 'sin', 'cos', ... + * @param seq the sequence to append + */ + public void handleCommand(String seq) throws IOException { } + + /** + * Handle macro: 'cosh', 'sinh', ... + * @param seq the sequence to append + */ + public void handleMacro(String seq) throws IOException { } + + /** + * Handle function identifier which appears in the code + * @param seq the sequence to append + */ + public void handleFunctionId(String seq) throws IOException { } + + /** + * Handle function identifier: 'function identifier(...)' + * @param seq the sequence to append + */ + public void handleFunctionIdDecl(String seq) throws IOException { } + + /** + * Handle a valid scilab identifier + * @param seq the sequence to append + */ + public void handleId(String seq) throws IOException { } + + /** + * Handle in/out args: 'function [...,out,...]=id(...,in,...)' + * @param seq the sequence to append + */ + public void handleInputOutputArgsDecl(String seq) throws IOException { } + + /** + * Handle in/out args which appears in the code + * @param seq the sequence to append + */ + public void handleInputOutputArgs(String seq) throws IOException { } + + /** + * Handle number: 123, 123.4, 123e4... + * @param seq the sequence to append + */ + public void handleNumber(String seq) throws IOException { } + + /** + * Handle special: '$', ':', '..' (break operator) + * @param seq the sequence to append + */ + public void handleSpecial(String seq) throws IOException { } + + /** + * Handle string: "hello world" + * @param seq the sequence to append + */ + public void handleString(String seq) throws IOException { } + + /** + * Handle nothing: when no particular formatting is required + * @param seq the sequence to append + */ + public void handleNothing(String seq) throws IOException { } + + /** + * Handle field: 'foo.bar' + * @param seq the sequence to append + */ + public void handleField(String seq) throws IOException { } + + /** + * Handle comment: '// comments...' + * @param seq the sequence to append + */ + public void handleComment(String seq) throws IOException { } + + + /** + * Inner class to have different way to handle links + */ + public static class LinkWriter { + + /** + * Default Constructor + */ + public LinkWriter() { } + + /** + * @param id the id + * @return the modified link + */ + public String getLink(String id) { + return id; + } + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/scilab/HTMLScilabCodeHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/scilab/HTMLScilabCodeHandler.java new file mode 100755 index 000000000..538c7e322 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/scilab/HTMLScilabCodeHandler.java @@ -0,0 +1,278 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.scilab; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +public class HTMLScilabCodeHandler extends AbstractScilabCodeHandler { + + private static final int BUFCAPACITY = 8192; + private static HTMLScilabCodeHandler handler = new HTMLScilabCodeHandler(); + private static LinkWriter linkWriter = new LinkWriter(); + + private List<String> undoc = new ArrayList<String>(); + + protected String currentCommand; + protected String currentFileName; + protected Appendable buffer; + + /** + * Default constructor + */ + protected HTMLScilabCodeHandler() { + buffer = new StringBuilder(BUFCAPACITY); + } + + /** + * @param lw the LinkWriter to use to handle links + */ + public static void setLinkWriter(LinkWriter lw) { + HTMLScilabCodeHandler.linkWriter = lw; + } + + /** + * @return an instance of HTMLScilabCodeHandler + */ + public static AbstractScilabCodeHandler getInstance(String currentCommand, String filename) { + handler.currentCommand = currentCommand; + handler.currentFileName = filename; + ((StringBuilder) handler.buffer).setLength(0); + return handler; + } + + /** + * {@inheritDoc} + */ + public void handleDefault(String seq) throws IOException { + buffer.append("<span class=\"scilabdefault\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleOperator(String seq) throws IOException { + buffer.append("<span class=\"scilaboperator\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleOpenClose(String seq) throws IOException { + buffer.append("<span class=\"scilabopenclose\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleFKeywords(String seq) throws IOException { + buffer.append("<span class=\"scilabfkeyword\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleSKeywords(String seq) throws IOException { + buffer.append("<span class=\"scilabskeyword\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleCKeywords(String seq) throws IOException { + buffer.append("<span class=\"scilabckeyword\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleConstants(String seq) throws IOException { + buffer.append("<span class=\"scilabconstants\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleCommand(String seq) throws IOException { + if (seq.equals(currentCommand)) { + buffer.append("<span class=\"scilabcommand\">"); + buffer.append(seq); + buffer.append("</span>"); + } else { + String link = linkWriter.getLink(seq); + if (link == null) {// the command is not internal + buffer.append("<span class=\"scilabcommand\">"); + buffer.append(seq); + buffer.append("</span>"); + //if (!undoc.contains(seq)) { + System.err.println("Warning: the command " + seq + " is used in an example and is undocumented (" + new File(currentFileName).getName() + ")."); + undoc.add(seq); + //} + } else { + buffer.append("<a class=\"scilabcommand\" href=\""); + buffer.append(link); + buffer.append("\">"); + buffer.append(seq); + buffer.append("</a>"); + } + } + } + + /** + * {@inheritDoc} + */ + public void handleMacro(String seq) throws IOException { + if (seq.equals(currentCommand)) { + buffer.append("<span class=\"scilabmacro\">"); + buffer.append(seq); + buffer.append("</span>"); + } else { + String link = linkWriter.getLink(seq); + if (link == null) { + buffer.append("<span class=\"scilabmacro\">"); + buffer.append(seq); + buffer.append("</span>"); + //if (!undoc.contains(seq)) { + System.err.println("Warning: the macro " + seq + " is used in an example and is undocumented (" + new File(currentFileName).getName() + ")."); + undoc.add(seq); + //} + } else { + buffer.append("<a class=\"scilabmacro\" href=\""); + buffer.append(link); + buffer.append("\">"); + buffer.append(seq); + buffer.append("</a>"); + } + } + } + + /** + * {@inheritDoc} + */ + public void handleFunctionId(String seq) throws IOException { + buffer.append("<span class=\"scilabfunctionid\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleFunctionIdDecl(String seq) throws IOException { + buffer.append("<span class=\"scilabfunctionid\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleId(String seq) throws IOException { + buffer.append("<span class=\"scilabid\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleInputOutputArgs(String seq) throws IOException { + buffer.append("<span class=\"scilabinputoutputargs\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleInputOutputArgsDecl(String seq) throws IOException { + buffer.append("<span class=\"scilabinputoutputargs\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleNumber(String seq) throws IOException { + buffer.append("<span class=\"scilabnumber\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleSpecial(String seq) throws IOException { + buffer.append("<span class=\"scilabspecial\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleString(String seq) throws IOException { + buffer.append("<span class=\"scilabstring\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleNothing(String seq) throws IOException { + buffer.append(seq); + } + + /** + * {@inheritDoc} + */ + public void handleField(String seq) throws IOException { + buffer.append("<span class=\"scilabfield\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleComment(String seq) throws IOException { + buffer.append("<span class=\"scilabcomment\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public String toString() { + return buffer.toString(); + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/scilab/HTMLWithStyleScilabCodeHandler.java b/modules/helptools/src/java/org/scilab/modules/helptools/scilab/HTMLWithStyleScilabCodeHandler.java new file mode 100755 index 000000000..3f2b12b31 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/scilab/HTMLWithStyleScilabCodeHandler.java @@ -0,0 +1,273 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.scilab; + +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; + +import java.util.Set; + +public class HTMLWithStyleScilabCodeHandler extends AbstractScilabCodeHandler { + + public static final String OPENCLOSE = "<span style=\"font-style:normal;color:rgb(74,85,219)\">"; + public static final String FIELD = "<span style=\"font-style:normal;color:rgb(170,170,170)\">"; + public static final String FUNCTIONID = "<span style=\"font-weight:bold;color:rgb(0,0,0)\">"; + public static final String INPUTOUTPUTARGS = "<span style=\"font-weight:bold;color:rgb(131,67,16)\">"; + public static final String ID = "<span style=\"font-style:normal;color:rgb(0,0,0)\">"; + public static final String STRING = "<span style=\"font-style:normal;color:rgb(188,143,143)\">"; + public static final String MACRO = "<span style=\"font-style:normal;color:rgb(174,92,176)\">"; + public static final String COMMAND = "<span style=\"font-style:normal;color:rgb(50,185,185)\">"; + public static final String CKEYWORD = "<span style=\"font-style:normal;color:rgb(95,158,160)\">"; + public static final String SKEYWORD = "<span style=\"font-style:normal;color:rgb(160,32,240)\">"; + public static final String FKEYWORD = "<span style=\"font-style:normal;color:rgb(176,24,19)\">"; + public static final String NUMBER = "<span style=\"font-style:normal;color:rgb(188,143,143)\">"; + public static final String OPERATOR = "<span style=\"font-style:normal;color:rgb(92,92,92)\">"; + public static final String CONSTANTS = "<span style=\"font-style:normal;color:rgb(218,112,214)\">"; + public static final String SPECIAL = "<span style=\"font-style:normal;color:rgb(255,170,0)\">"; + public static final String DEFAULT = "<span style=\"font-style:normal;color:rgb(0,0,0)\">"; + public static final String COMMENT = "<span style=\"font-style:italic;color:rgb(1,168,1)\">"; + + private static final int BUFCAPACITY = 8192; + + private Appendable buffer; + private ScilabLexer lexer; + + /** + * Default constructor + * @param primFile the file containing the scilab primitives + * @param macroFile the file containing the scilab macros + **/ + public HTMLWithStyleScilabCodeHandler(String primFile, String macroFile) { + this.lexer = new ScilabLexer(primFile, macroFile); + } + + /** + * Default constructor + * @param primitives the set containing the scilab primitives + * @param macros the set containing the scilab macros + **/ + public HTMLWithStyleScilabCodeHandler(Set<String> primitives, Set<String> macros) { + this.lexer = new ScilabLexer(primitives, macros); + } + + /** + * @param scilabCode the code to convert + * @return a String containing the HTML + */ + public void convert(Reader in, Writer out) throws IOException { + buffer = out; + buffer.append("<pre>\n"); + String s = lexer.convert(this, in, false); + if (s == null) { + out.append("An error occurred during the conversion"); + } + buffer.append("\n</pre>\n"); + out.flush(); + } + + /** + * @param scilabCode the code to convert + * @return a String containing the HTML + */ + public String convert(String scilabCode) { + buffer = new StringBuilder(BUFCAPACITY); + ((StringBuilder) buffer).append("<pre>\n"); + return lexer.convert(this, scilabCode) + "\n</pre>\n"; + } + + /** + * {@inheritDoc} + */ + public void handleDefault(String seq) throws IOException { + buffer.append(DEFAULT); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleOperator(String seq) throws IOException { + buffer.append(OPERATOR); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleOpenClose(String seq) throws IOException { + buffer.append(OPENCLOSE); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleFKeywords(String seq) throws IOException { + buffer.append(FKEYWORD); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleSKeywords(String seq) throws IOException { + buffer.append(SKEYWORD); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleCKeywords(String seq) throws IOException { + buffer.append(CKEYWORD); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleConstants(String seq) throws IOException { + buffer.append(CONSTANTS); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleCommand(String seq) throws IOException { + buffer.append(COMMAND); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleMacro(String seq) throws IOException { + buffer.append(MACRO); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleFunctionId(String seq) throws IOException { + buffer.append(FUNCTIONID); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleFunctionIdDecl(String seq) throws IOException { + buffer.append(FUNCTIONID); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleId(String seq) throws IOException { + buffer.append(ID); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleInputOutputArgs(String seq) throws IOException { + buffer.append(INPUTOUTPUTARGS); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleInputOutputArgsDecl(String seq) throws IOException { + buffer.append(INPUTOUTPUTARGS); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleNumber(String seq) throws IOException { + buffer.append(NUMBER); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleSpecial(String seq) throws IOException { + buffer.append(SPECIAL); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleString(String seq) throws IOException { + buffer.append(STRING); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleNothing(String seq) throws IOException { + buffer.append(seq); + } + + /** + * {@inheritDoc} + */ + public void handleField(String seq) throws IOException { + buffer.append(FIELD); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleComment(String seq) throws IOException { + buffer.append(COMMENT); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public String toString() { + return buffer.toString(); + } +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/scilab/ScilabCodeServer.java b/modules/helptools/src/java/org/scilab/modules/helptools/scilab/ScilabCodeServer.java new file mode 100755 index 000000000..860c72b98 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/scilab/ScilabCodeServer.java @@ -0,0 +1,227 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.scilab; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.IOException; +import java.io.Reader; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.net.Socket; +import java.net.ServerSocket; +import java.nio.charset.Charset; +import java.util.HashMap; +import java.util.Map; +import java.util.Stack; + +/** + * Server to colorize Scilab code. + * The string passed to the server must be terminated with an EOF or a null char "\0". + */ +public final class ScilabCodeServer { + + private static final int DEFAULTMAXHANDLERS = 5; + + private Stack<HTMLWithStyleScilabCodeHandler> stack = new Stack<HTMLWithStyleScilabCodeHandler>(); + private String prim; + private String macro; + private int maxHandler; + + /** + * Main method + * @param args the command line arguments + */ + public static void main(String[] args) { + Map<String, String> map = parseCommandLine(args); + if (map.containsKey("help")) { + System.out.println("Usage scicodeserver [OPTION]..."); + System.out.println("Create a multi-thread server to colorize Scilab code"); + System.out.println(""); + System.out.println("-port An integer giving the port where to listen to"); + System.out.println("-sciprim A file containing the list of the Scilab primitives"); + System.out.println("-scimacro A file containing the list of the Scilab macros"); + System.out.println("-maxhandlers An integer giving the maximum of Scilab code handlers"); + System.out.println(" which must be kept in memory (5 by default)"); + System.out.println(""); + System.out.println("Report bugs on: <http://bugzilla.scilab.org>"); + System.out.println("Project page: <http://forge.scilab.org/index.php/p/scidoc>"); + return; + } + + if (!map.containsKey("port")) { + System.err.println("No port"); + System.err.println("Use the option -help"); + return; + } + + int max = DEFAULTMAXHANDLERS; + if (map.containsKey("maxhandlers")) { + try { + max = Integer.parseInt(map.get("maxhandlers")); + } catch (Exception e) { + System.err.println("The option -maxhandlers expects a positive integer"); + return; + } + } + + int port = 0; + if (map.containsKey("port")) { + try { + port = Integer.parseInt(map.get("port")); + } catch (Exception e) { + System.err.println("The option -port expects a positive integer"); + return; + } + } + + ScilabCodeServer scs = new ScilabCodeServer(map.get("sciprim"), map.get("scimacro"), max); + try { + ServerSocket server = new ServerSocket(port); + while (true) { + new ScilabCodeThread(server.accept(), scs); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * Private constructor + * @param primFile the filename containing the list of the scilab built-in commands + * @param macroFile the filename containing the list of the scilab macros + * @param maxHandler the maximum handlers which must be cached + */ + private ScilabCodeServer(String primFile, String macroFile, int maxHandler) { + this.prim = primFile; + this.macro = macroFile; + this.maxHandler = maxHandler; + } + + /** + * Get an handler. The stack is synchronized. + * @return an handler + */ + private HTMLWithStyleScilabCodeHandler getHandler() { + synchronized (stack) { + if (stack.isEmpty()) { + return new HTMLWithStyleScilabCodeHandler(prim, macro); + } + return stack.pop(); + } + } + + /** + * Push an handler in the stack to cach it. The stack is synchronized. + * @param h the handler + */ + private void pushHandler(HTMLWithStyleScilabCodeHandler h) { + synchronized (stack) { + if (stack.size() < maxHandler) { + stack.push(h); + } + } + } + + /** + * @param in the input + * @param out the output + * @throws IOException + */ + private void convert(Reader in, Writer out) throws IOException { + HTMLWithStyleScilabCodeHandler handler = getHandler(); + handler.convert(in, out); + pushHandler(handler); + } + + /** + * Parse the command line + * @param args the arguments + * @return the options with their argument in a map + */ + private static Map<String, String> parseCommandLine(String[] args) { + String option = null; + boolean in = false; + Map<String, String> map = new HashMap<String, String>(); + for (int i = 0; i < args.length; i++) { + if (args[i].length() >= 2 && args[i].charAt(0) == '-') { + if (option != null) { + map.put(option, ""); + option = null; + option = args[i]; + } + if (args[i].charAt(1) == '-') { + option = args[i].substring(2); + } else { + option = args[i].substring(1); + } + } else { + if (option != null) { + map.put(option, args[i]); + option = null; + } else if (!in) { + map.put("input", args[i]); + in = true; + } else { + System.err.println("Not an argument " + args[i]); + return null; + } + } + } + if (option != null) { + map.put(option, ""); + } + + return map; + } + + /** + * Inner class + */ + private static class ScilabCodeThread implements Runnable { + + private Reader in; + private Writer out; + private Socket sock; + private ScilabCodeServer scs; + + /** + * Default constructor + * @param sock the socket where to read and write + * @param scs the server + */ + ScilabCodeThread(Socket sock, ScilabCodeServer scs) { + this.sock = sock; + this.scs = scs; + try { + in = new BufferedReader(new InputStreamReader(sock.getInputStream())); + out = new OutputStreamWriter(sock.getOutputStream(), Charset.forName("UTF-8")); + } catch (IOException e) { + e.printStackTrace(); + } + new Thread(this).start(); + } + + public void run() { + try { + scs.convert(in, out); + out.flush(); + out.close(); + in.close(); + sock.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } +}
\ No newline at end of file diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/scilab/ScilabLexer.java b/modules/helptools/src/java/org/scilab/modules/helptools/scilab/ScilabLexer.java new file mode 100755 index 000000000..1ae1a1a00 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/scilab/ScilabLexer.java @@ -0,0 +1,7375 @@ +/* The following code was generated by JFlex 1.4.3 on 06/11/12 12:39 */ + +//CHECKSTYLE:OFF + +package org.scilab.modules.helptools.scilab; + +import java.util.Set; +import java.util.HashSet; +import java.util.List; +import java.util.ArrayList; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.Reader; +import java.io.StringReader; +import java.io.IOException; + +@javax.annotation.Generated("JFlex") +@SuppressWarnings("fallthrough") + +/** + * This class is a scanner generated by + * <a href="http://www.jflex.de/">JFlex</a> 1.4.3 + * on 06/11/12 12:39 from the specification file + * <tt>scilab.jflex</tt> + */ +public final class ScilabLexer { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int CLEANFIRST = 28; + public static final int BREAKINARGS = 24; + public static final int QSTRING = 2; + public static final int CLEAN = 30; + public static final int FUNNAME = 18; + public static final int FIELD = 6; + public static final int ARGS = 22; + public static final int COMMANDS = 8; + public static final int WHITESEOL = 26; + public static final int YYINITIAL = 0; + public static final int COMMANDSWHITE = 10; + public static final int RETS = 20; + public static final int BREAKSTRING = 12; + public static final int FUNCTION = 14; + public static final int TYPEID = 16; + public static final int COMMENT = 4; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, + 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15 + }; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\1\104\10\0\1\76\1\2\2\0\1\1\22\0\1\73\1\100\1\13" + + "\1\102\1\74\1\14\1\46\1\12\1\4\1\7\1\47\1\52\1\77" + + "\1\52\1\42\1\11\12\101\1\75\1\103\1\43\1\45\1\44\1\100" + + "\1\53\2\102\1\30\1\40\1\36\1\20\1\102\1\33\1\31\3\102" + + "\1\35\1\102\1\34\1\37\1\102\1\41\1\27\1\16\2\102\1\32" + + "\3\102\1\3\1\50\1\6\1\51\1\100\1\0\1\26\1\65\1\63" + + "\1\64\1\21\1\17\1\102\1\60\1\23\1\102\1\66\1\61\1\71" + + "\1\24\1\55\1\22\1\67\1\56\1\25\1\15\1\70\1\102\1\57" + + "\1\72\1\62\1\20\1\5\1\54\1\10\1\53\uff81\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\1\0\1\1\1\2\2\0\1\1\12\0\2\3\1\4" + + "\1\5\1\6\1\7\1\10\1\11\14\12\1\13\1\14" + + "\1\15\1\7\1\16\2\7\6\12\1\17\2\20\1\21" + + "\1\22\1\23\2\1\1\24\1\25\1\1\1\26\1\27" + + "\1\30\1\1\2\2\1\31\1\32\1\33\1\34\1\35" + + "\1\36\2\37\1\40\1\37\1\41\1\42\1\43\1\1" + + "\1\4\1\1\1\44\1\45\2\46\1\47\2\46\1\37" + + "\1\50\1\51\1\37\1\52\1\37\1\53\1\54\1\55" + + "\1\37\1\56\1\54\1\37\1\57\1\60\1\61\1\37" + + "\1\62\1\54\1\37\1\63\1\64\1\65\2\37\2\66" + + "\1\37\1\44\1\37\2\67\1\54\1\70\1\71\1\72" + + "\1\73\1\74\2\75\1\12\1\75\12\12\1\76\4\12" + + "\1\7\1\77\1\20\1\7\1\22\1\100\1\101\1\102" + + "\1\0\5\12\1\22\4\0\1\103\1\104\5\0\1\105" + + "\1\106\1\0\6\12\1\76\5\12\1\75\10\12\1\22" + + "\2\107\2\0\1\110\3\12\1\76\1\111\27\12\1\112" + + "\1\113\2\12\1\114"; + + private static int [] zzUnpackAction() { + int [] result = new int[235]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do { + result[j++] = value; + } while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** number of newlines encountered up to the start of the matched text */ + private int yyline; + + /** the number of characters up to the start of the matched text */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + private static Set<String> commands; + private static Set<String> macros; + + private int beginString; + private boolean transposable; + private boolean breakstring; + private boolean breakargs; + private int whitesOnFirstLine; + private int saveLexState; + + private String id; + private List<String> returnValues = new ArrayList<String>(); + private List<String> argsValues = new ArrayList<String>(); + private List<String> localFun = new ArrayList<String>(); + + private AbstractScilabCodeHandler handler; + + public ScilabLexer(String[] primFile, String[] macroFile) { + if (commands == null) { + commands = new HashSet<String>(); + macros = new HashSet<String>(); + loadNames(primFile, commands); + loadNames(macroFile, macros); + } + } + + public ScilabLexer(String primFile, String macroFile) { + this(new String[] {primFile}, new String[] {macroFile}); + } + + public ScilabLexer(Set<String> primitives, Set<String> macros) { + commands = primitives; + ScilabLexer.macros = macros; + } + + private void loadNames(String[] files, Set<String> set) { + for (int i = 0; i < files.length; i++) { + loadNames(files[i], set); + } + } + + private void loadNames(String file, Set<String> set) { + if (file == null) { + return; + } + BufferedReader input = null; + try { + input = new BufferedReader(new FileReader(file)); + String line = null; + while ((line = input.readLine()) != null) { + set.add(line); + } + } catch (IOException e) { + System.err.println(e); + } + if (input != null) { + try { + input.close(); + } catch (IOException e) { + System.err.println(e); + } + } + } + + private String trimEnd(String str) { + int end = str.length() - 1; + int i = end; + for (; i >= 0; i--) { + char c = str.charAt(i); + if (c != ' ' && c != '\t' && c != '\r' && c != '\n') { + break; + } + } + if (i != end) { + return str.substring(0, i + 1); + } + + return str; + } + + public String convert(AbstractScilabCodeHandler h, String code) { + Reader reader = new StringReader(trimEnd(code)); + String str = convert(h, reader, true); + try { + reader.close(); + } catch (IOException e) { } + + return str; + } + + public String convert(AbstractScilabCodeHandler h, Reader code, boolean ret) { + if (code == null) { + return null; + } else { + handler = h; + transposable = false; + breakargs = false; + breakstring = false; + whitesOnFirstLine = 0; + localFun.clear(); + yyreset(code); + yybegin(CLEANFIRST); + try { + yylex(); + } catch (IOException e) { + return null; + } + if (ret) { + return h.toString(); + } + return ""; + } + } + + + /** + * Creates a new scanner + * There is also a java.io.InputStream version of this constructor. + * + * @param in the java.io.Reader to read input from. + */ + public ScilabLexer(java.io.Reader in) { + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + public ScilabLexer(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 176) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do { + map[j++] = value; + } while (--count > 0); + } + return map; + } + + + /** + * Refills the input buffer. + * + * @return <code>false</code>, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead - zzStartRead); + + /* translate stored positions */ + zzEndRead -= zzStartRead; + zzCurrentPos -= zzStartRead; + zzMarkedPos -= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos * 2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length - zzEndRead); + + if (numRead > 0) { + zzEndRead += numRead; + return false; + } + // unlikely but not impossible: read 0 characters, but not at end of stream + if (numRead == 0) { + int c = zzReader.read(); + if (c == -1) { + return true; + } else { + zzBuffer[zzEndRead++] = (char) c; + return false; + } + } + + // numRead < 0 + return true; + } + + + /** + * Closes the input stream. + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ + zzEndRead = zzStartRead; /* invalidate buffer */ + + if (zzReader != null) { + zzReader.close(); + } + } + + + /** + * Resets the scanner to read from a new input stream. + * Does not close the old reader. + * + * All internal variables are reset, the old input stream + * <b>cannot</b> be reused (internal buffer is discarded and lost). + * Lexical state is set to <tt>ZZ_INITIAL</tt>. + * + * @param reader the new input stream + */ + public final void yyreset(java.io.Reader reader) { + zzReader = reader; + zzAtBOL = true; + zzAtEOF = false; + zzEOFDone = false; + zzEndRead = zzStartRead = 0; + zzCurrentPos = zzMarkedPos = 0; + yyline = yychar = yycolumn = 0; + zzLexicalState = YYINITIAL; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final String yytext() { + return new String( zzBuffer, zzStartRead, zzMarkedPos - zzStartRead ); + } + + + /** + * Returns the character at position <tt>pos</tt> from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer[zzStartRead + pos]; + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos - zzStartRead; + } + + + /** + * Reports an error that occurred while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) { + zzScanError(ZZ_PUSHBACK_2BIG); + } + + zzMarkedPos -= number; + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public void yylex() throws java.io.IOException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + char [] zzBufferL = zzBuffer; + char [] zzCMapL = ZZ_CMAP; + + + while (true) { + zzMarkedPosL = zzMarkedPos; + + yychar += zzMarkedPosL - zzStartRead; + + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) { + zzInput = zzBufferL[zzCurrentPosL++]; + } else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } else { + zzInput = zzBufferL[zzCurrentPosL++]; + } + } + zzInput = zzCMapL[zzInput]; + + boolean zzIsFinal = false; + boolean zzNoLookAhead = false; + + zzForNext: { + switch (zzState) { + case 0: + switch (zzInput) { + case 0: + case 63: + case 67: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 16; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 17; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 18; + break zzForNext; + case 3: + case 4: + case 5: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 19; + break zzForNext; + case 6: + case 7: + case 8: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 20; + break zzForNext; + case 9: + zzIsFinal = true; + zzState = 21; + break zzForNext; + case 10: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 22; + break zzForNext; + case 11: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 23; + break zzForNext; + case 12: + zzIsFinal = true; + zzState = 24; + break zzForNext; + case 13: + zzIsFinal = true; + zzState = 25; + break zzForNext; + case 14: + zzIsFinal = true; + zzState = 26; + break zzForNext; + case 15: + zzIsFinal = true; + zzState = 27; + break zzForNext; + case 17: + zzIsFinal = true; + zzState = 29; + break zzForNext; + case 18: + zzIsFinal = true; + zzState = 30; + break zzForNext; + case 19: + zzIsFinal = true; + zzState = 31; + break zzForNext; + case 21: + zzIsFinal = true; + zzState = 32; + break zzForNext; + case 22: + zzIsFinal = true; + zzState = 33; + break zzForNext; + case 23: + zzIsFinal = true; + zzState = 34; + break zzForNext; + case 26: + zzIsFinal = true; + zzState = 35; + break zzForNext; + case 34: + zzIsFinal = true; + zzState = 36; + break zzForNext; + case 35: + zzIsFinal = true; + zzState = 37; + break zzForNext; + case 36: + zzIsFinal = true; + zzState = 38; + break zzForNext; + case 37: + case 43: + zzIsFinal = true; + zzState = 39; + break zzForNext; + case 38: + zzIsFinal = true; + zzState = 40; + break zzForNext; + case 39: + zzIsFinal = true; + zzState = 41; + break zzForNext; + case 40: + case 41: + case 42: + case 44: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 42; + break zzForNext; + case 46: + zzIsFinal = true; + zzState = 43; + break zzForNext; + case 47: + zzIsFinal = true; + zzState = 44; + break zzForNext; + case 51: + zzIsFinal = true; + zzState = 45; + break zzForNext; + case 52: + zzIsFinal = true; + zzState = 46; + break zzForNext; + case 53: + zzIsFinal = true; + zzState = 47; + break zzForNext; + case 55: + zzIsFinal = true; + zzState = 48; + break zzForNext; + case 59: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 49; + break zzForNext; + case 60: + zzIsFinal = true; + zzState = 50; + break zzForNext; + case 61: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 51; + break zzForNext; + case 62: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 52; + break zzForNext; + case 65: + zzIsFinal = true; + zzState = 53; + break zzForNext; + case 68: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 54; + break zzForNext; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 1: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 18; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 56; + break zzForNext; + case 10: + zzIsFinal = true; + zzState = 57; + break zzForNext; + case 11: + zzIsFinal = true; + zzState = 58; + break zzForNext; + case 34: + zzIsFinal = true; + zzState = 59; + break zzForNext; + case 35: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 60; + break zzForNext; + case 36: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 61; + break zzForNext; + case 38: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 62; + break zzForNext; + case 62: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 63; + break zzForNext; + default: + zzIsFinal = true; + zzState = 55; + break zzForNext; + } + + case 2: + switch (zzInput) { + case 68: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 54; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 65; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 66; + break zzForNext; + case 10: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 67; + break zzForNext; + case 11: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 68; + break zzForNext; + case 35: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 69; + break zzForNext; + case 36: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 70; + break zzForNext; + case 38: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 71; + break zzForNext; + default: + zzIsFinal = true; + zzState = 64; + break zzForNext; + } + + case 3: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 18; + break zzForNext; + case 0: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 65: + case 67: + case 68: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 73; + break zzForNext; + case 60: + zzIsFinal = true; + zzState = 75; + break zzForNext; + default: + zzIsFinal = true; + zzState = 74; + break zzForNext; + } + + case 4: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 18; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 73; + break zzForNext; + case 4: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 76; + break zzForNext; + case 59: + zzIsFinal = true; + zzState = 77; + break zzForNext; + case 62: + zzIsFinal = true; + zzState = 78; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + } + + case 5: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 18; + break zzForNext; + case 35: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 60; + break zzForNext; + case 36: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 61; + break zzForNext; + case 38: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 62; + break zzForNext; + case 63: + case 67: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 80; + break zzForNext; + case 9: + zzIsFinal = true; + zzState = 81; + break zzForNext; + case 59: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 82; + break zzForNext; + case 62: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 83; + break zzForNext; + default: + zzIsFinal = true; + zzState = 79; + break zzForNext; + } + + case 6: + switch (zzInput) { + case 59: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 82; + break zzForNext; + case 62: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 83; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 85; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 86; + break zzForNext; + case 9: + zzIsFinal = true; + zzState = 87; + break zzForNext; + case 34: + zzIsFinal = true; + zzState = 88; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 84; + break zzForNext; + } + + case 7: + switch (zzInput) { + case 0: + case 2: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 65: + case 67: + case 68: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 89; + break zzForNext; + case 3: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 90; + break zzForNext; + case 60: + zzIsFinal = true; + zzState = 92; + break zzForNext; + default: + zzIsFinal = true; + zzState = 91; + break zzForNext; + } + + case 8: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 89; + break zzForNext; + case 4: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 93; + break zzForNext; + case 9: + zzIsFinal = true; + zzState = 94; + break zzForNext; + case 37: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 95; + break zzForNext; + case 59: + case 62: + zzIsFinal = true; + zzState = 96; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + } + + case 9: + switch (zzInput) { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + case 8: + case 10: + case 11: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 61: + case 63: + case 65: + case 67: + case 68: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 89; + break zzForNext; + case 4: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 97; + break zzForNext; + case 9: + zzIsFinal = true; + zzState = 98; + break zzForNext; + case 59: + case 62: + zzIsFinal = true; + zzState = 100; + break zzForNext; + case 60: + zzIsFinal = true; + zzState = 101; + break zzForNext; + default: + zzIsFinal = true; + zzState = 99; + break zzForNext; + } + + case 10: + switch (zzInput) { + case 0: + case 2: + case 4: + case 5: + case 7: + case 8: + case 9: + case 10: + case 11: + case 35: + case 36: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 61: + case 65: + case 67: + case 68: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 89; + break zzForNext; + case 3: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 102; + break zzForNext; + case 6: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 103; + break zzForNext; + case 34: + zzIsFinal = true; + zzState = 105; + break zzForNext; + case 37: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 106; + break zzForNext; + case 59: + case 62: + zzIsFinal = true; + zzState = 107; + break zzForNext; + case 60: + zzIsFinal = true; + zzState = 108; + break zzForNext; + case 63: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 109; + break zzForNext; + default: + zzIsFinal = true; + zzState = 104; + break zzForNext; + } + + case 11: + switch (zzInput) { + case 0: + case 2: + case 3: + case 4: + case 5: + case 6: + case 8: + case 9: + case 10: + case 11: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 61: + case 65: + case 67: + case 68: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 89; + break zzForNext; + case 59: + case 62: + zzIsFinal = true; + zzState = 107; + break zzForNext; + case 63: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 109; + break zzForNext; + case 7: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 110; + break zzForNext; + case 34: + zzIsFinal = true; + zzState = 112; + break zzForNext; + case 60: + zzIsFinal = true; + zzState = 113; + break zzForNext; + default: + zzIsFinal = true; + zzState = 111; + break zzForNext; + } + + case 12: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 114; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 115; + break zzForNext; + case 9: + zzIsFinal = true; + zzState = 116; + break zzForNext; + case 59: + zzIsFinal = true; + zzState = 117; + break zzForNext; + case 62: + zzIsFinal = true; + zzState = 118; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + } + + case 13: + switch (zzInput) { + case 59: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 82; + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 120; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 119; + break zzForNext; + } + + case 14: + switch (zzInput) { + case 1: + case 2: + zzIsFinal = true; + zzState = 121; + break zzForNext; + case 59: + case 62: + zzIsFinal = true; + zzState = 122; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + } + + case 15: + switch (zzInput) { + case 1: + case 2: + zzIsFinal = true; + zzState = 124; + break zzForNext; + case 59: + case 62: + zzIsFinal = true; + zzState = 125; + break zzForNext; + default: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 123; + break zzForNext; + } + + case 17: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 18; + break zzForNext; + default: + break zzForAction; + } + + case 21: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 42; + break zzForNext; + case 9: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 126; + break zzForNext; + default: + break zzForAction; + } + + case 24: + switch (zzInput) { + case 13: + case 14: + case 15: + case 16: + case 21: + zzIsFinal = true; + zzState = 127; + break zzForNext; + case 17: + zzIsFinal = true; + zzState = 128; + break zzForNext; + case 18: + zzIsFinal = true; + zzState = 129; + break zzForNext; + case 19: + zzIsFinal = true; + zzState = 130; + break zzForNext; + case 20: + zzIsFinal = true; + zzState = 131; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 25: + switch (zzInput) { + case 46: + zzIsFinal = true; + zzState = 132; + break zzForNext; + case 48: + zzIsFinal = true; + zzState = 133; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 26: + switch (zzInput) { + case 29: + zzIsFinal = true; + zzState = 134; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 27: + switch (zzInput) { + case 45: + zzIsFinal = true; + zzState = 135; + break zzForNext; + case 56: + zzIsFinal = true; + zzState = 136; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 28: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 29: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 137; + break zzForNext; + case 49: + zzIsFinal = true; + zzState = 138; + break zzForNext; + case 58: + zzIsFinal = true; + zzState = 139; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 30: + switch (zzInput) { + case 22: + zzIsFinal = true; + zzState = 140; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 31: + switch (zzInput) { + case 15: + zzIsFinal = true; + zzState = 141; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 32: + switch (zzInput) { + case 17: + zzIsFinal = true; + zzState = 142; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 33: + switch (zzInput) { + case 53: + zzIsFinal = true; + zzState = 143; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 34: + switch (zzInput) { + case 24: + zzIsFinal = true; + zzState = 144; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 35: + switch (zzInput) { + case 23: + zzIsFinal = true; + zzState = 145; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 36: + switch (zzInput) { + case 41: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 42; + break zzForNext; + case 9: + case 40: + zzIsFinal = true; + zzState = 146; + break zzForNext; + case 10: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 147; + break zzForNext; + case 34: + zzIsFinal = true; + zzState = 148; + break zzForNext; + case 39: + zzIsFinal = true; + zzState = 149; + break zzForNext; + case 65: + zzIsFinal = true; + zzState = 150; + break zzForNext; + default: + break zzForAction; + } + + case 37: + switch (zzInput) { + case 36: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 151; + break zzForNext; + case 37: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 152; + break zzForNext; + default: + break zzForAction; + } + + case 38: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 153; + break zzForNext; + default: + break zzForAction; + } + + case 39: + switch (zzInput) { + case 37: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 42; + break zzForNext; + default: + break zzForAction; + } + + case 40: + switch (zzInput) { + case 67: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 16; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 68: + break zzForAction; + default: + zzState = 154; + break zzForNext; + } + + case 41: + switch (zzInput) { + case 39: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 42; + break zzForNext; + default: + break zzForAction; + } + + case 43: + switch (zzInput) { + case 17: + zzIsFinal = true; + zzState = 155; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 44: + switch (zzInput) { + case 48: + zzIsFinal = true; + zzState = 156; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 45: + switch (zzInput) { + case 22: + zzIsFinal = true; + zzState = 157; + break zzForNext; + case 45: + zzIsFinal = true; + zzState = 158; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 46: + switch (zzInput) { + case 45: + zzIsFinal = true; + zzState = 141; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 47: + switch (zzInput) { + case 46: + zzIsFinal = true; + zzState = 159; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 48: + switch (zzInput) { + case 56: + zzIsFinal = true; + zzState = 139; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 50: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 53: + switch (zzInput) { + case 65: + zzIsFinal = true; + break zzForNext; + case 34: + zzIsFinal = true; + zzState = 150; + break zzForNext; + case 17: + case 30: + case 32: + case 52: + zzIsFinal = true; + zzState = 160; + break zzForNext; + default: + break zzForAction; + } + + case 55: + switch (zzInput) { + case 10: + case 11: + zzState = 161; + break zzForNext; + case 34: + zzState = 162; + break zzForNext; + case 1: + case 2: + case 35: + case 36: + case 38: + case 62: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 56: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 18; + break zzForNext; + default: + break zzForAction; + } + + case 57: + switch (zzInput) { + case 10: + case 11: + zzIsFinal = true; + zzState = 55; + break zzForNext; + default: + break zzForAction; + } + + case 58: + switch (zzInput) { + case 10: + case 11: + zzIsFinal = true; + zzState = 55; + break zzForNext; + default: + break zzForAction; + } + + case 59: + switch (zzInput) { + case 34: + zzState = 163; + break zzForNext; + case 1: + case 2: + case 10: + case 11: + case 35: + case 36: + case 38: + case 62: + break zzForAction; + default: + zzIsFinal = true; + zzState = 55; + break zzForNext; + } + + case 64: + switch (zzInput) { + case 2: + case 10: + case 11: + case 35: + case 36: + case 38: + case 68: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 65: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 66; + break zzForNext; + case 10: + case 11: + case 35: + case 36: + case 38: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 64; + break zzForNext; + } + + case 73: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 18; + break zzForNext; + default: + break zzForAction; + } + + case 74: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 75: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 74; + break zzForNext; + } + + case 77: + switch (zzInput) { + case 4: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 76; + break zzForNext; + case 59: + case 62: + zzState = 164; + break zzForNext; + default: + break zzForAction; + } + + case 78: + switch (zzInput) { + case 4: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 76; + break zzForNext; + case 59: + case 62: + zzState = 164; + break zzForNext; + default: + break zzForAction; + } + + case 79: + switch (zzInput) { + case 1: + case 2: + case 9: + case 35: + case 36: + case 38: + case 59: + case 62: + case 63: + case 67: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 80: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 18; + break zzForNext; + default: + break zzForAction; + } + + case 81: + switch (zzInput) { + case 9: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 126; + break zzForNext; + case 1: + case 2: + case 35: + case 36: + case 38: + case 59: + case 62: + case 63: + case 67: + break zzForAction; + default: + zzIsFinal = true; + zzState = 79; + break zzForNext; + } + + case 85: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 86; + break zzForNext; + default: + break zzForAction; + } + + case 87: + switch (zzInput) { + case 9: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 126; + break zzForNext; + default: + break zzForAction; + } + + case 88: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzState = 165; + break zzForNext; + default: + break zzForAction; + } + + case 89: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 72; + break zzForNext; + default: + break zzForAction; + } + + case 91: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 92: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 91; + break zzForNext; + } + + case 94: + switch (zzInput) { + case 9: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 166; + break zzForNext; + default: + break zzForAction; + } + + case 96: + switch (zzInput) { + case 9: + zzState = 167; + break zzForNext; + case 59: + case 62: + zzState = 168; + break zzForNext; + default: + break zzForAction; + } + + case 98: + switch (zzInput) { + case 9: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 76; + break zzForNext; + default: + break zzForAction; + } + + case 99: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 100: + switch (zzInput) { + case 9: + zzState = 169; + break zzForNext; + case 59: + case 62: + zzState = 170; + break zzForNext; + default: + break zzForAction; + } + + case 101: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 99; + break zzForNext; + } + + case 104: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 105: + switch (zzInput) { + case 34: + zzState = 171; + break zzForNext; + default: + break zzForAction; + } + + case 107: + switch (zzInput) { + case 59: + case 62: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 108: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 104; + break zzForNext; + } + + case 111: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + break zzForNext; + } + + case 112: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzState = 172; + break zzForNext; + default: + break zzForAction; + } + + case 113: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 111; + break zzForNext; + } + + case 114: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 115; + break zzForNext; + default: + break zzForAction; + } + + case 116: + switch (zzInput) { + case 9: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 173; + break zzForNext; + default: + break zzForAction; + } + + case 117: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 114; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 115; + break zzForNext; + case 59: + case 62: + zzState = 174; + break zzForNext; + default: + break zzForAction; + } + + case 118: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 114; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 115; + break zzForNext; + case 59: + case 62: + zzState = 174; + break zzForNext; + default: + break zzForAction; + } + + case 120: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 119; + break zzForNext; + default: + break zzForAction; + } + + case 121: + switch (zzInput) { + case 1: + case 2: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 122: + switch (zzInput) { + case 1: + case 2: + zzIsFinal = true; + zzState = 121; + break zzForNext; + case 59: + case 62: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 124: + switch (zzInput) { + case 1: + case 2: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 125: + switch (zzInput) { + case 59: + case 62: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 127: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 128: + switch (zzInput) { + case 18: + zzIsFinal = true; + zzState = 175; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 129: + switch (zzInput) { + case 19: + zzIsFinal = true; + zzState = 127; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 130: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 176; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 131: + switch (zzInput) { + case 22: + zzIsFinal = true; + zzState = 177; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 132: + switch (zzInput) { + case 50: + zzIsFinal = true; + zzState = 141; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 133: + switch (zzInput) { + case 17: + zzIsFinal = true; + zzState = 178; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 134: + switch (zzInput) { + case 31: + zzIsFinal = true; + zzState = 179; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 135: + switch (zzInput) { + case 46: + zzIsFinal = true; + zzState = 141; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 136: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 180; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 137: + switch (zzInput) { + case 52: + zzIsFinal = true; + zzState = 181; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 138: + switch (zzInput) { + case 21: + zzIsFinal = true; + zzState = 182; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 139: + switch (zzInput) { + case 19: + zzIsFinal = true; + zzState = 183; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 140: + switch (zzInput) { + case 56: + zzIsFinal = true; + zzState = 184; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 141: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 142: + switch (zzInput) { + case 49: + zzIsFinal = true; + zzState = 185; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 143: + switch (zzInput) { + case 45: + zzIsFinal = true; + zzState = 186; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 144: + switch (zzInput) { + case 25: + zzIsFinal = true; + zzState = 187; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 145: + switch (zzInput) { + case 24: + zzIsFinal = true; + zzState = 188; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 146: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 42; + break zzForNext; + default: + break zzForAction; + } + + case 148: + switch (zzInput) { + case 34: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 149: + switch (zzInput) { + case 34: + case 39: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 42; + break zzForNext; + default: + break zzForAction; + } + + case 150: + switch (zzInput) { + case 65: + zzIsFinal = true; + break zzForNext; + case 17: + case 30: + case 32: + case 52: + zzIsFinal = true; + zzState = 160; + break zzForNext; + default: + break zzForAction; + } + + case 154: + switch (zzInput) { + case 67: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 16; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 68: + break zzForAction; + default: + break zzForNext; + } + + case 155: + switch (zzInput) { + case 13: + zzIsFinal = true; + zzState = 189; + break zzForNext; + case 21: + zzIsFinal = true; + zzState = 190; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 156: + switch (zzInput) { + case 19: + zzIsFinal = true; + zzState = 191; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 157: + switch (zzInput) { + case 13: + zzIsFinal = true; + zzState = 192; + break zzForNext; + case 21: + zzIsFinal = true; + zzState = 193; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 158: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 194; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 159: + switch (zzInput) { + case 17: + zzIsFinal = true; + zzState = 195; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 160: + switch (zzInput) { + case 42: + case 65: + zzIsFinal = true; + zzState = 196; + break zzForNext; + default: + break zzForAction; + } + + case 161: + switch (zzInput) { + case 10: + case 11: + zzIsFinal = true; + zzState = 55; + break zzForNext; + default: + break zzForAction; + } + + case 162: + switch (zzInput) { + case 1: + case 2: + case 10: + case 11: + case 34: + case 35: + case 36: + case 38: + case 62: + break zzForAction; + default: + zzIsFinal = true; + zzState = 55; + break zzForNext; + } + + case 163: + switch (zzInput) { + case 34: + break zzForNext; + case 1: + zzIsFinal = true; + zzState = 197; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 198; + break zzForNext; + case 9: + zzState = 199; + break zzForNext; + case 59: + case 62: + zzState = 200; + break zzForNext; + default: + break zzForAction; + } + + case 164: + switch (zzInput) { + case 4: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 76; + break zzForNext; + case 59: + case 62: + break zzForNext; + default: + break zzForAction; + } + + case 165: + switch (zzInput) { + case 34: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 167: + switch (zzInput) { + case 9: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 166; + break zzForNext; + default: + break zzForAction; + } + + case 168: + switch (zzInput) { + case 9: + zzState = 167; + break zzForNext; + case 59: + case 62: + break zzForNext; + default: + break zzForAction; + } + + case 169: + switch (zzInput) { + case 9: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 76; + break zzForNext; + default: + break zzForAction; + } + + case 170: + switch (zzInput) { + case 9: + zzState = 169; + break zzForNext; + case 59: + case 62: + break zzForNext; + default: + break zzForAction; + } + + case 171: + switch (zzInput) { + case 34: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 201; + break zzForNext; + default: + break zzForAction; + } + + case 172: + switch (zzInput) { + case 34: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 174: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 114; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 115; + break zzForNext; + case 59: + case 62: + break zzForNext; + default: + break zzForAction; + } + + case 175: + switch (zzInput) { + case 21: + zzIsFinal = true; + zzState = 127; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 176: + switch (zzInput) { + case 15: + zzIsFinal = true; + zzState = 127; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 177: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 127; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 178: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 141; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 179: + switch (zzInput) { + case 32: + zzIsFinal = true; + zzState = 202; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 180: + switch (zzInput) { + case 51: + zzIsFinal = true; + zzState = 203; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 181: + switch (zzInput) { + case 15: + zzIsFinal = true; + zzState = 204; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 182: + switch (zzInput) { + case 17: + zzIsFinal = true; + zzState = 205; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 183: + switch (zzInput) { + case 13: + zzIsFinal = true; + zzState = 206; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 184: + switch (zzInput) { + case 21: + zzIsFinal = true; + zzState = 207; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 185: + switch (zzInput) { + case 17: + zzIsFinal = true; + zzState = 208; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 186: + switch (zzInput) { + case 46: + zzIsFinal = true; + zzState = 183; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 187: + switch (zzInput) { + case 27: + zzIsFinal = true; + zzState = 209; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 188: + switch (zzInput) { + case 25: + zzIsFinal = true; + zzState = 127; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 189: + switch (zzInput) { + case 56: + zzIsFinal = true; + zzState = 210; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 190: + switch (zzInput) { + case 56: + zzIsFinal = true; + zzState = 211; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 191: + switch (zzInput) { + case 49: + zzIsFinal = true; + zzState = 193; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 192: + switch (zzInput) { + case 51: + zzIsFinal = true; + zzState = 212; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 193: + switch (zzInput) { + case 17: + zzIsFinal = true; + zzState = 141; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 194: + switch (zzInput) { + case 13: + zzIsFinal = true; + zzState = 213; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 195: + switch (zzInput) { + case 22: + zzIsFinal = true; + zzState = 214; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 196: + switch (zzInput) { + case 65: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 197: + switch (zzInput) { + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 198; + break zzForNext; + default: + break zzForAction; + } + + case 199: + switch (zzInput) { + case 9: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 198; + break zzForNext; + default: + break zzForAction; + } + + case 200: + switch (zzInput) { + case 1: + zzIsFinal = true; + zzState = 197; + break zzForNext; + case 2: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 198; + break zzForNext; + case 9: + zzState = 199; + break zzForNext; + case 59: + case 62: + break zzForNext; + default: + break zzForAction; + } + + case 202: + switch (zzInput) { + case 25: + zzIsFinal = true; + zzState = 215; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 203: + switch (zzInput) { + case 13: + zzIsFinal = true; + zzState = 216; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 204: + switch (zzInput) { + case 56: + zzIsFinal = true; + zzState = 217; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 205: + switch (zzInput) { + case 19: + zzIsFinal = true; + zzState = 31; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 206: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 207: + switch (zzInput) { + case 17: + zzIsFinal = true; + zzState = 206; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 208: + switch (zzInput) { + case 51: + zzIsFinal = true; + zzState = 218; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 209: + switch (zzInput) { + case 28: + zzIsFinal = true; + zzState = 219; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 210: + switch (zzInput) { + case 46: + zzIsFinal = true; + zzState = 220; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 211: + switch (zzInput) { + case 57: + zzIsFinal = true; + zzState = 207; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 212: + switch (zzInput) { + case 48: + zzIsFinal = true; + zzState = 141; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 213: + switch (zzInput) { + case 19: + zzIsFinal = true; + zzState = 221; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 214: + switch (zzInput) { + case 54: + zzIsFinal = true; + zzState = 206; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 215: + switch (zzInput) { + case 33: + zzIsFinal = true; + zzState = 127; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 216: + switch (zzInput) { + case 19: + zzIsFinal = true; + zzState = 222; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 217: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 223; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 218: + switch (zzInput) { + case 13: + zzIsFinal = true; + zzState = 141; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 219: + switch (zzInput) { + case 29: + zzIsFinal = true; + zzState = 224; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 220: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 206; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 221: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 225; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 222: + switch (zzInput) { + case 45: + zzIsFinal = true; + zzState = 226; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 223: + switch (zzInput) { + case 51: + zzIsFinal = true; + zzState = 227; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 224: + switch (zzInput) { + case 30: + zzIsFinal = true; + zzState = 127; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 225: + switch (zzInput) { + case 56: + zzIsFinal = true; + zzState = 207; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 226: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 228; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 227: + switch (zzInput) { + case 13: + zzIsFinal = true; + zzState = 229; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 228: + switch (zzInput) { + case 3: + zzIsFinal = true; + zzNoLookAhead = true; + zzState = 230; + break zzForNext; + case 59: + case 62: + zzIsFinal = true; + zzState = 231; + break zzForNext; + case 0: + case 1: + case 2: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 61: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 229: + switch (zzInput) { + case 19: + zzIsFinal = true; + zzState = 232; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 231: + switch (zzInput) { + case 59: + case 62: + zzIsFinal = true; + break zzForNext; + default: + break zzForAction; + } + + case 232: + switch (zzInput) { + case 45: + zzIsFinal = true; + zzState = 233; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 233: + switch (zzInput) { + case 20: + zzIsFinal = true; + zzState = 234; + break zzForNext; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + case 234: + switch (zzInput) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 59: + case 61: + case 62: + case 63: + case 67: + case 68: + break zzForAction; + default: + zzIsFinal = true; + zzState = 28; + break zzForNext; + } + + default: + // if this is ever reached, there is a serious bug in JFlex + zzScanError(ZZ_UNKNOWN_ERROR); + break; + } + } + + if ( zzIsFinal ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( zzNoLookAhead ) { + break zzForAction; + } + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 51 : + { + handler.handleDefault(", "); + } + case 77: + break; + case 2: { + handler.handleComment(yytext()); + } + case 78: + break; + case 8: { + if (transposable) { + handler.handleOperator("'"); + } else { + beginString = zzStartRead; + yybegin(QSTRING); + handler.handleString("'"); + } + } + case 79: + break; + case 58: { + handler.handleNothing("\n"); + } + case 80: + break; + case 9: { + transposable = false; + beginString = zzStartRead; + yybegin(QSTRING); + handler.handleString("""); + } + case 81: + break; + case 65: { + transposable = false; + handler.handleOperator("<="); + } + case 82: + break; + case 52: { + handler.handleOpenClose(")"); + yybegin(YYINITIAL); + } + case 83: + break; + case 69: { + handler.handleSpecial(yytext()); + yybegin(BREAKINARGS); + } + case 84: + break; + case 38: { + handler.handleDefault(yytext()); + } + case 85: + break; + case 46: { + id = yytext(); + localFun.add(id); + handler.handleFunctionIdDecl(id); + } + case 86: + break; + case 64: { + transposable = false; + handler.handleOperator("<>"); + } + case 87: + break; + case 71: { + yypushback(yylength()); + yybegin(BREAKSTRING); + transposable = false; + handler.handleString(yytext()); + } + case 88: + break; + case 28: { + handler.handleComment("<"); + } + case 89: + break; + case 30: { + handler.handleComment("&"); + } + case 90: + break; + case 1: { + handler.handleString(yytext()); + } + case 91: + break; + case 39: { + if (breakstring) { + breakstring = false; + saveLexState = QSTRING; + } else { + saveLexState = YYINITIAL; + } + handler.handleNothing("\n"); + yybegin(CLEAN); + } + case 92: + break; + case 76: { + transposable = false; + returnValues.clear(); + argsValues.clear(); + handler.handleFKeywords("endfunction"); + } + case 93: + break; + case 15: { + transposable = false; + handler.handleNothing(" "); + } + case 94: + break; + case 22: { + transposable = false; + handler.handleString("<"); + } + case 95: + break; + case 43: { + returnValues.add(id); + handler.handleInputOutputArgsDecl(id); + handler.handleOperator("="); + yybegin(FUNNAME); + } + case 96: + break; + case 60: { + transposable = false; + yypushback(2); + yybegin(COMMENT); + } + case 97: + break; + case 16: { + transposable = false; + handler.handleSpecial(yytext()); + } + case 98: + break; + case 75: { + transposable = false; + handler.handleFKeywords("function"); + handler.handleNothing(" "); + yybegin(FUNCTION); + } + case 99: + break; + case 24: { + transposable = false; + handler.handleString("&"); + } + case 100: + break; + case 50: { + handler.handleOperator("="); + yybegin(FUNNAME); + } + case 101: + break; + case 10: { + transposable = true; + String str = yytext(); + if (commands.contains(str)) { + yybegin(COMMANDS); + handler.handleCommand(str); + } else if (macros.contains(str)) { + yybegin(COMMANDS); + handler.handleMacro(str); + } else if (localFun.contains(str)) { + yybegin(COMMANDS); + handler.handleFunctionId(str); + } else { + if (returnValues.contains(str) || argsValues.contains(str)) { + handler.handleInputOutputArgs(str); + } else { + handler.handleId(str); + } + } + } + case 102: + break; + case 47: { + handler.handleOpenClose("["); + } + case 103: + break; + case 17: { + transposable = false; + handler.handleNothing(" "); + } + case 104: + break; + case 34: { + yybegin(COMMANDSWHITE); + handler.handleNothing(" "); + } + case 105: + break; + case 74: { + transposable = false; + handler.handleFKeywords("function"); + handler.handleNothing(" "); + handler.handleOpenClose("["); + yybegin(RETS); + } + case 106: + break; + case 67: { + breakstring = true; + handler.handleSpecial(yytext()); + } + case 107: + break; + case 48: { + handler.handleOpenClose("]"); + } + case 108: + break; + case 12: { + transposable = false; + handler.handleOperator("<"); + } + case 109: + break; + case 14: { + transposable = false; + handler.handleOperator("&"); + } + case 110: + break; + case 70: { + breakargs = true; + yypushback(2); + yybegin(COMMENT); + } + case 111: + break; + case 66: { + transposable = false; + handler.handleOperator(">="); + } + case 112: + break; + case 21: { + transposable = false; + yybegin(YYINITIAL); + handler.handleString("""); + } + case 113: + break; + case 18: { + transposable = true; + handler.handleNumber(yytext()); + } + case 114: + break; + case 72: { + handler.handleNothing("..."); + } + case 115: + break; + case 45: { + handler.handleOpenClose("("); + yybegin(ARGS); + } + case 116: + break; + case 7: { + transposable = false; + handler.handleOperator(yytext()); + } + case 117: + break; + case 20: { + transposable = false; + yybegin(YYINITIAL); + handler.handleString("'"); + } + case 118: + break; + case 59: { + int len = yylength() - whitesOnFirstLine; + if (len > 0) { + yypushback(len); + } + yybegin(saveLexState); + } + case 119: + break; + case 32: { + handler.handleField(yytext()); + } + case 120: + break; + case 5: { + transposable = false; + handler.handleOpenClose(yytext()); + } + case 121: + break; + case 63: { + transposable = false; + handler.handleOperator(".'"); + } + case 122: + break; + case 37: { + handler.handleNothing(" "); + } + case 123: + break; + case 4: { + handler.handleNothing("\n"); + saveLexState = YYINITIAL; + yybegin(CLEAN); + } + case 124: + break; + case 53: { + id = yytext(); + argsValues.add(id); + handler.handleInputOutputArgsDecl(id); + } + case 125: + break; + case 36: { + handler.handleNothing(" "); + } + case 126: + break; + case 6: { + transposable = true; + handler.handleOpenClose(yytext()); + } + case 127: + break; + case 31: { + yypushback(1); + yybegin(YYINITIAL); + } + case 128: + break; + case 40: { + handler.handleOpenClose("["); + yybegin(RETS); + } + case 129: + break; + case 25: { + if (breakstring) { + saveLexState = QSTRING; + breakstring = false; + } else if (breakargs) { + saveLexState = WHITESEOL; + breakargs = false; + } else { + saveLexState = YYINITIAL; + } + handler.handleNothing("\n"); + yybegin(CLEAN); + } + case 130: + break; + case 35: { + yybegin(COMMANDSWHITE); + handler.handleNothing(" "); + } + case 131: + break; + case 57: { + yypushback(1); + yybegin(saveLexState); + } + case 132: + break; + case 33: { + yypushback(yylength()); + yybegin(YYINITIAL); + } + case 133: + break; + case 68: { + localFun.add(id); + handler.handleFunctionIdDecl(id); + yypushback(yylength()); + yybegin(YYINITIAL); + } + case 134: + break; + case 54: { + handler.handleNothing("\n"); + saveLexState = WHITESEOL; + yybegin(CLEAN); + } + case 135: + break; + case 49: { + id = yytext(); + returnValues.add(id); + handler.handleInputOutputArgsDecl(id); + } + case 136: + break; + case 61: { + transposable = true; + handler.handleConstants(yytext()); + } + case 137: + break; + case 55: { + yypushback(1); + yybegin(ARGS); + } + case 138: + break; + case 29: { + handler.handleComment(">"); + } + case 139: + break; + case 62: { + transposable = false; + handler.handleSKeywords(yytext()); + } + case 140: + break; + case 3: { + transposable = false; + handler.handleDefault(yytext()); + } + case 141: + break; + case 11: { + transposable = false; + yybegin(FIELD); + handler.handleOperator(yytext()); + } + case 142: + break; + case 19: { + return; + } + case 143: + break; + case 23: { + transposable = false; + handler.handleString(">"); + } + case 144: + break; + case 41: { + id = yytext(); + yybegin(TYPEID); + } + case 145: + break; + case 56: { + whitesOnFirstLine = yylength(); + yybegin(YYINITIAL); + } + case 146: + break; + case 27: { + handler.handleComment("""); + } + case 147: + break; + case 73: { + transposable = false; + handler.handleCKeywords(yytext()); + } + case 148: + break; + case 42: { + localFun.add(id); + handler.handleFunctionIdDecl(id); + handler.handleOpenClose("("); + yybegin(ARGS); + } + case 149: + break; + case 26: { + handler.handleComment("'"); + } + case 150: + break; + case 13: { + transposable = false; + handler.handleOperator(">"); + } + case 151: + break; + case 44: { + } + case 152: + break; + default: + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + { + return; + } + } else { + zzScanError(ZZ_NO_MATCH); + } + } + } + } + + +} diff --git a/modules/helptools/src/java/org/scilab/modules/helptools/source/ScilabSourceBrowser.java b/modules/helptools/src/java/org/scilab/modules/helptools/source/ScilabSourceBrowser.java new file mode 100755 index 000000000..412f5aa52 --- /dev/null +++ b/modules/helptools/src/java/org/scilab/modules/helptools/source/ScilabSourceBrowser.java @@ -0,0 +1,180 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2010 - Calixte DENIZET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +package org.scilab.modules.helptools.source; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.Reader; +import java.io.Writer; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.scilab.modules.helptools.scilab.AbstractScilabCodeHandler; +import org.scilab.modules.helptools.scilab.HTMLScilabCodeHandler; +import org.scilab.modules.helptools.scilab.ScilabLexer; + +public class ScilabSourceBrowser extends HTMLScilabCodeHandler { + + private static final String entete = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"{$lang}\" lang=\"{$lang}\">\n <head{$profile}>\n <title><!--<title>--> <!--<subtitle>--></title>\n <style type=\"text/css\" media=\"all\">\n @import url(\"site.css\");\n @import url(\"css/scilab_code.css\");\n @import url(\"css/style.css\");\n </style>\n <!--[if IE]><![endif]><![endif]-->\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n <!-- <link rel=\"shortcut icon\" href=\"{$_SERVER['STATIC_ROOT']}/favicon.ico\" />{$link}\n $canonical\n <script type=\"text/javascript\" src=\"{$_SERVER['STATIC_ROOT']}/userprefs.js\"></script>{$base}{$meta}{$moreheadtags}\n -->\n </head>\n <body>"; + + private List<String> files; + private Map<String, Set<String>> macroUsage = new HashMap<String, Set<String>>(); + private ScilabLexer scilabLexer; + private String outputDirectory; + private Map<String, String> mapId; + + public static void main(String[] args) { + ScilabSourceBrowser b = new ScilabSourceBrowser(args[0], args[1], args[2], args[3]); + b.generateSource(); + } + + public ScilabSourceBrowser(String paths, String primFile, String macroFile, String outputDirectory) { + super(); + this.outputDirectory = outputDirectory; + scilabLexer = new ScilabLexer(primFile, macroFile); + generateMapId(paths); + } + + public void generateSource() { + new FirstPass().getMacroUsage(); + for (String file : files) { + try { + File f = new File(file); + System.out.println(f); + Reader input = new BufferedReader(new FileReader(f)); + currentCommand = f.getName().split("\\.")[0]; + buffer = new FileWriter(outputDirectory + File.separator + currentCommand + ".html"); + buffer.append(entete); + buffer.append("<div style=\"code\"><pre>"); + scilabLexer.convert(this, input, false); + buffer.append("</pre></div>\n</body>\n</html>"); + ((Writer) buffer).flush(); + ((Writer) buffer).close(); + input.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * {@inheritDoc} + */ + public void handleCommand(String seq) throws IOException { + buffer.append("<span class=\"command\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleFunctionId(String seq) throws IOException { + buffer.append("<a href=\"#"); + buffer.append(seq); + buffer.append("\"><span class=\"functionid\">"); + buffer.append(seq); + buffer.append("</span></a>"); + } + + /** + * {@inheritDoc} + */ + public void handleFunctionIdDecl(String seq) throws IOException { + buffer.append("<a name=\""); + buffer.append(seq); + buffer.append("\"></a><span class=\"functionid\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + /** + * {@inheritDoc} + */ + public void handleInputOutputArgs(String seq) throws IOException { + buffer.append("<a href=\"#"); + buffer.append(seq); + buffer.append("\"><span class=\"inputoutputargs\">"); + buffer.append(seq); + buffer.append("</span></a>"); + } + + /** + * {@inheritDoc} + */ + public void handleInputOutputArgsDecl(String seq) throws IOException { + buffer.append("<a name=\""); + buffer.append(seq); + buffer.append("\"></a><span class=\"inputoutputargs\">"); + buffer.append(seq); + buffer.append("</span>"); + } + + private void generateMapId(String filename) { + BufferedReader input = null; + files = new ArrayList<String>(); + mapId = new HashMap<String, String>(); + try { + input = new BufferedReader(new FileReader(filename)); + String line = null; + while ((line = input.readLine()) != null) { + files.add(line); + String name = new File(line).getName().split("\\.")[0]; + mapId.put(name, name + ".html"); + } + } catch (IOException e) { + System.err.println(e); + } + if (input != null) { + try { + input.close(); + } catch (IOException e) { + System.err.println(e); + } + } + } + + class FirstPass extends AbstractScilabCodeHandler { + + FirstPass() { } + + void getMacroUsage() { + for (String file : files) { + try { + File f = new File(file); + Reader input = new BufferedReader(new FileReader(f)); + currentCommand = f.getName().split("\\.")[0]; + scilabLexer.convert(this, input, false); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + public void handleMacro(String macro) throws IOException { + Set<String> set = macroUsage.get(macro); + if (set == null) { + set = new HashSet<String>(); + macroUsage.put(macro, set); + } + set.add(currentCommand); + } + } +} diff --git a/modules/helptools/src/javadoc/javadoc.vcxproj b/modules/helptools/src/javadoc/javadoc.vcxproj new file mode 100755 index 000000000..2c1c2373e --- /dev/null +++ b/modules/helptools/src/javadoc/javadoc.vcxproj @@ -0,0 +1,143 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>BuildJavadoc</ProjectName> + <ProjectGuid>{F1D56B26-F11F-4ECE-AB82-127B5E1C58E0}</ProjectGuid> + <RootNamespace>BuildJavadoc</RootNamespace> + <Keyword>MakeFileProj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Makefile</ConfigurationType> + <PlatformToolset>v110</PlatformToolset> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">set PATH=;$(SolutionDir)java\jdk\bin;%PATH%; +IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +javadoc -noindex -nohelp -nonavbar -notree -d "$(SolutionDir)modules/javasci/javadoc" -sourcepath "$(SolutionDir)modules/javasci/src/java;$(SolutionDir)modules/types/src/java;$(SolutionDir)modules/localization/src/java" org.scilab.modules.javasci org.scilab.modules.types +</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">set PATH=;$(SolutionDir)java\jdk\bin;%PATH%; +IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +javadoc -noindex -nohelp -nonavbar -notree -d "$(SolutionDir)modules/javasci/javadoc" -sourcepath "$(SolutionDir)modules/javasci/src/java;$(SolutionDir)modules/types/src/java;$(SolutionDir)modules/localization/src/java" org.scilab.modules.javasci org.scilab.modules.types -exclude org.scilab.modules.localization +</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +</NMakeCleanCommandLine> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">set PATH=;$(SolutionDir)java\jdk\bin;%PATH%; +IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +javadoc -noindex -nohelp -nonavbar -notree -d "$(SolutionDir)modules/javasci/javadoc" -sourcepath "$(SolutionDir)modules/javasci/src/java;$(SolutionDir)modules/types/src/java;$(SolutionDir)modules/localization/src/java" org.scilab.modules.javasci org.scilab.modules.types -exclude org.scilab.modules.localization +</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">set PATH=;$(SolutionDir)java\jdk\bin;%PATH%; +IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +javadoc -noindex -nohelp -nonavbar -notree -d "$(SolutionDir)modules/javasci/javadoc" -sourcepath "$(SolutionDir)modules/javasci/src/java;$(SolutionDir)modules/types/src/java;$(SolutionDir)modules/localization/src/java" org.scilab.modules.javasci org.scilab.modules.types -exclude org.scilab.modules.localization +</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +</NMakeCleanCommandLine> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">set PATH=;$(SolutionDir)java\jdk\bin;%PATH%; +IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +javadoc -noindex -nohelp -nonavbar -notree -d "$(SolutionDir)modules/javasci/javadoc" -sourcepath "$(SolutionDir)modules/javasci/src/java;$(SolutionDir)modules/types/src/java;$(SolutionDir)modules/localization/src/java" org.scilab.modules.javasci org.scilab.modules.types -exclude org.scilab.modules.localization +</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">set PATH=;$(SolutionDir)java\jdk\bin;%PATH%; +IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +javadoc -noindex -nohelp -nonavbar -notree -d "$(SolutionDir)modules/javasci/javadoc" -sourcepath "$(SolutionDir)modules/javasci/src/java;$(SolutionDir)modules/types/src/java;$(SolutionDir)modules/localization/src/java" org.scilab.modules.javasci org.scilab.modules.types -exclude org.scilab.modules.localization +</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +</NMakeCleanCommandLine> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)$(Configuration)\</IntDir> + <NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">set PATH=;$(SolutionDir)java\jdk\bin;%PATH%; +IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +javadoc -noindex -nohelp -nonavbar -notree -d "$(SolutionDir)modules/javasci/javadoc" -sourcepath "$(SolutionDir)modules/javasci/src/java;$(SolutionDir)modules/types/src/java;$(SolutionDir)modules/localization/src/java" org.scilab.modules.javasci org.scilab.modules.types -exclude org.scilab.modules.localization +</NMakeBuildCommandLine> + <NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">set PATH=;$(SolutionDir)java\jdk\bin;%PATH%; +IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +javadoc -noindex -nohelp -nonavbar -notree -d "$(SolutionDir)modules/javasci/javadoc" -sourcepath "$(SolutionDir)modules/javasci/src/java;$(SolutionDir)modules/types/src/java;$(SolutionDir)modules/localization/src/java" org.scilab.modules.javasci org.scilab.modules.types -exclude org.scilab.modules.localization +</NMakeReBuildCommandLine> + <NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='Release|x64'">IF EXIST "$(SolutionDir)modules\javasci\javadoc" rmdir /s /q "$(SolutionDir)modules\javasci\javadoc" +</NMakeCleanCommandLine> + <NMakeOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions> + <NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeIncludeSearchPath)</NMakeIncludeSearchPath> + <NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeForcedIncludes)</NMakeForcedIncludes> + <NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath> + <NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies> + </PropertyGroup> + <ItemDefinitionGroup> + </ItemDefinitionGroup> + <ItemGroup> + <None Include="makefile.mak" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/modules/helptools/src/javadoc/javadoc.vcxproj.filters b/modules/helptools/src/javadoc/javadoc.vcxproj.filters new file mode 100755 index 000000000..58c17f5ab --- /dev/null +++ b/modules/helptools/src/javadoc/javadoc.vcxproj.filters @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <None Include="makefile.mak" /> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/modules/helptools/src/jni/.deps/.dirstamp b/modules/helptools/src/jni/.deps/.dirstamp new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/modules/helptools/src/jni/.deps/.dirstamp diff --git a/modules/helptools/src/jni/.deps/libscihelptools_algo_la-BuildDocObject.Plo b/modules/helptools/src/jni/.deps/libscihelptools_algo_la-BuildDocObject.Plo new file mode 100755 index 000000000..6a871f807 --- /dev/null +++ b/modules/helptools/src/jni/.deps/libscihelptools_algo_la-BuildDocObject.Plo @@ -0,0 +1,341 @@ +src/jni/libscihelptools_algo_la-BuildDocObject.lo: \ + src/jni/BuildDocObject.cpp /usr/include/stdc-predef.h \ + src/jni/BuildDocObject.hxx /usr/include/c++/5/iostream \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/cpu_defines.h \ + /usr/include/c++/5/ostream /usr/include/c++/5/ios \ + /usr/include/c++/5/iosfwd /usr/include/c++/5/bits/stringfwd.h \ + /usr/include/c++/5/bits/memoryfwd.h /usr/include/c++/5/bits/postypes.h \ + /usr/include/c++/5/cwchar /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h /usr/include/c++/5/exception \ + /usr/include/c++/5/bits/atomic_lockfree_defines.h \ + /usr/include/c++/5/bits/char_traits.h \ + /usr/include/c++/5/bits/stl_algobase.h \ + /usr/include/c++/5/bits/functexcept.h \ + /usr/include/c++/5/bits/exception_defines.h \ + /usr/include/c++/5/bits/cpp_type_traits.h \ + /usr/include/c++/5/ext/type_traits.h \ + /usr/include/c++/5/ext/numeric_traits.h \ + /usr/include/c++/5/bits/stl_pair.h /usr/include/c++/5/bits/move.h \ + /usr/include/c++/5/bits/concept_check.h \ + /usr/include/c++/5/bits/stl_iterator_base_types.h \ + /usr/include/c++/5/bits/stl_iterator_base_funcs.h \ + /usr/include/c++/5/debug/debug.h /usr/include/c++/5/bits/stl_iterator.h \ + /usr/include/c++/5/bits/ptr_traits.h \ + /usr/include/c++/5/bits/predefined_ops.h \ + /usr/include/c++/5/bits/localefwd.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++locale.h \ + /usr/include/c++/5/clocale /usr/include/locale.h \ + /usr/include/x86_64-linux-gnu/bits/locale.h /usr/include/c++/5/cctype \ + /usr/include/ctype.h /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/c++/5/bits/ios_base.h /usr/include/c++/5/ext/atomicity.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/gthr.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/bits/sched.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/timex.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \ + /usr/include/x86_64-linux-gnu/bits/setjmp.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/atomic_word.h \ + /usr/include/c++/5/bits/locale_classes.h /usr/include/c++/5/string \ + /usr/include/c++/5/bits/allocator.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h \ + /usr/include/c++/5/ext/new_allocator.h /usr/include/c++/5/new \ + /usr/include/c++/5/bits/ostream_insert.h \ + /usr/include/c++/5/bits/cxxabi_forced.h \ + /usr/include/c++/5/bits/stl_function.h \ + /usr/include/c++/5/backward/binders.h \ + /usr/include/c++/5/bits/range_access.h \ + /usr/include/c++/5/bits/basic_string.h \ + /usr/include/c++/5/ext/alloc_traits.h \ + /usr/include/c++/5/bits/basic_string.tcc \ + /usr/include/c++/5/bits/locale_classes.tcc /usr/include/c++/5/stdexcept \ + /usr/include/c++/5/streambuf /usr/include/c++/5/bits/streambuf.tcc \ + /usr/include/c++/5/bits/basic_ios.h \ + /usr/include/c++/5/bits/locale_facets.h /usr/include/c++/5/cwctype \ + /usr/include/wctype.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/ctype_base.h \ + /usr/include/c++/5/bits/streambuf_iterator.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/ctype_inline.h \ + /usr/include/c++/5/bits/locale_facets.tcc \ + /usr/include/c++/5/bits/basic_ios.tcc \ + /usr/include/c++/5/bits/ostream.tcc /usr/include/c++/5/istream \ + /usr/include/c++/5/bits/istream.tcc /usr/include/string.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h \ + /usr/include/x86_64-linux-gnu/sys/types.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + /usr/lib/jvm/java-8-openjdk-amd64/include/jni.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \ + /usr/include/x86_64-linux-gnu/bits/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/stdio2.h \ + /usr/lib/jvm/java-8-openjdk-amd64/include/linux/jni_md.h \ + ../../modules/commons/src/jni/GiwsException.hxx + +/usr/include/stdc-predef.h: + +src/jni/BuildDocObject.hxx: + +/usr/include/c++/5/iostream: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/cpu_defines.h: + +/usr/include/c++/5/ostream: + +/usr/include/c++/5/ios: + +/usr/include/c++/5/iosfwd: + +/usr/include/c++/5/bits/stringfwd.h: + +/usr/include/c++/5/bits/memoryfwd.h: + +/usr/include/c++/5/bits/postypes.h: + +/usr/include/c++/5/cwchar: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +/usr/include/c++/5/exception: + +/usr/include/c++/5/bits/atomic_lockfree_defines.h: + +/usr/include/c++/5/bits/char_traits.h: + +/usr/include/c++/5/bits/stl_algobase.h: + +/usr/include/c++/5/bits/functexcept.h: + +/usr/include/c++/5/bits/exception_defines.h: + +/usr/include/c++/5/bits/cpp_type_traits.h: + +/usr/include/c++/5/ext/type_traits.h: + +/usr/include/c++/5/ext/numeric_traits.h: + +/usr/include/c++/5/bits/stl_pair.h: + +/usr/include/c++/5/bits/move.h: + +/usr/include/c++/5/bits/concept_check.h: + +/usr/include/c++/5/bits/stl_iterator_base_types.h: + +/usr/include/c++/5/bits/stl_iterator_base_funcs.h: + +/usr/include/c++/5/debug/debug.h: + +/usr/include/c++/5/bits/stl_iterator.h: + +/usr/include/c++/5/bits/ptr_traits.h: + +/usr/include/c++/5/bits/predefined_ops.h: + +/usr/include/c++/5/bits/localefwd.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++locale.h: + +/usr/include/c++/5/clocale: + +/usr/include/locale.h: + +/usr/include/x86_64-linux-gnu/bits/locale.h: + +/usr/include/c++/5/cctype: + +/usr/include/ctype.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/c++/5/bits/ios_base.h: + +/usr/include/c++/5/ext/atomicity.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/gthr.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/bits/sched.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/timex.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/x86_64-linux-gnu/bits/setjmp.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/atomic_word.h: + +/usr/include/c++/5/bits/locale_classes.h: + +/usr/include/c++/5/string: + +/usr/include/c++/5/bits/allocator.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h: + +/usr/include/c++/5/ext/new_allocator.h: + +/usr/include/c++/5/new: + +/usr/include/c++/5/bits/ostream_insert.h: + +/usr/include/c++/5/bits/cxxabi_forced.h: + +/usr/include/c++/5/bits/stl_function.h: + +/usr/include/c++/5/backward/binders.h: + +/usr/include/c++/5/bits/range_access.h: + +/usr/include/c++/5/bits/basic_string.h: + +/usr/include/c++/5/ext/alloc_traits.h: + +/usr/include/c++/5/bits/basic_string.tcc: + +/usr/include/c++/5/bits/locale_classes.tcc: + +/usr/include/c++/5/stdexcept: + +/usr/include/c++/5/streambuf: + +/usr/include/c++/5/bits/streambuf.tcc: + +/usr/include/c++/5/bits/basic_ios.h: + +/usr/include/c++/5/bits/locale_facets.h: + +/usr/include/c++/5/cwctype: + +/usr/include/wctype.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/ctype_base.h: + +/usr/include/c++/5/bits/streambuf_iterator.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/ctype_inline.h: + +/usr/include/c++/5/bits/locale_facets.tcc: + +/usr/include/c++/5/bits/basic_ios.tcc: + +/usr/include/c++/5/bits/ostream.tcc: + +/usr/include/c++/5/istream: + +/usr/include/c++/5/bits/istream.tcc: + +/usr/include/string.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +/usr/lib/jvm/java-8-openjdk-amd64/include/jni.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/x86_64-linux-gnu/bits/sys_errlist.h: + +/usr/include/x86_64-linux-gnu/bits/stdio.h: + +/usr/include/x86_64-linux-gnu/bits/stdio2.h: + +/usr/lib/jvm/java-8-openjdk-amd64/include/linux/jni_md.h: + +../../modules/commons/src/jni/GiwsException.hxx: diff --git a/modules/helptools/src/jni/.deps/libscihelptools_algo_la-SciDocMain.Plo b/modules/helptools/src/jni/.deps/libscihelptools_algo_la-SciDocMain.Plo new file mode 100755 index 000000000..025567e50 --- /dev/null +++ b/modules/helptools/src/jni/.deps/libscihelptools_algo_la-SciDocMain.Plo @@ -0,0 +1,341 @@ +src/jni/libscihelptools_algo_la-SciDocMain.lo: src/jni/SciDocMain.cpp \ + /usr/include/stdc-predef.h src/jni/SciDocMain.hxx \ + /usr/include/c++/5/iostream \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h \ + /usr/include/features.h /usr/include/x86_64-linux-gnu/sys/cdefs.h \ + /usr/include/x86_64-linux-gnu/bits/wordsize.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs.h \ + /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/cpu_defines.h \ + /usr/include/c++/5/ostream /usr/include/c++/5/ios \ + /usr/include/c++/5/iosfwd /usr/include/c++/5/bits/stringfwd.h \ + /usr/include/c++/5/bits/memoryfwd.h /usr/include/c++/5/bits/postypes.h \ + /usr/include/c++/5/cwchar /usr/include/wchar.h /usr/include/stdio.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h \ + /usr/include/x86_64-linux-gnu/bits/wchar.h \ + /usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h /usr/include/xlocale.h \ + /usr/include/x86_64-linux-gnu/bits/wchar2.h /usr/include/c++/5/exception \ + /usr/include/c++/5/bits/atomic_lockfree_defines.h \ + /usr/include/c++/5/bits/char_traits.h \ + /usr/include/c++/5/bits/stl_algobase.h \ + /usr/include/c++/5/bits/functexcept.h \ + /usr/include/c++/5/bits/exception_defines.h \ + /usr/include/c++/5/bits/cpp_type_traits.h \ + /usr/include/c++/5/ext/type_traits.h \ + /usr/include/c++/5/ext/numeric_traits.h \ + /usr/include/c++/5/bits/stl_pair.h /usr/include/c++/5/bits/move.h \ + /usr/include/c++/5/bits/concept_check.h \ + /usr/include/c++/5/bits/stl_iterator_base_types.h \ + /usr/include/c++/5/bits/stl_iterator_base_funcs.h \ + /usr/include/c++/5/debug/debug.h /usr/include/c++/5/bits/stl_iterator.h \ + /usr/include/c++/5/bits/ptr_traits.h \ + /usr/include/c++/5/bits/predefined_ops.h \ + /usr/include/c++/5/bits/localefwd.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++locale.h \ + /usr/include/c++/5/clocale /usr/include/locale.h \ + /usr/include/x86_64-linux-gnu/bits/locale.h /usr/include/c++/5/cctype \ + /usr/include/ctype.h /usr/include/x86_64-linux-gnu/bits/types.h \ + /usr/include/x86_64-linux-gnu/bits/typesizes.h /usr/include/endian.h \ + /usr/include/x86_64-linux-gnu/bits/endian.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap.h \ + /usr/include/x86_64-linux-gnu/bits/byteswap-16.h \ + /usr/include/c++/5/bits/ios_base.h /usr/include/c++/5/ext/atomicity.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/gthr.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h \ + /usr/include/pthread.h /usr/include/sched.h /usr/include/time.h \ + /usr/include/x86_64-linux-gnu/bits/sched.h \ + /usr/include/x86_64-linux-gnu/bits/time.h \ + /usr/include/x86_64-linux-gnu/bits/timex.h \ + /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \ + /usr/include/x86_64-linux-gnu/bits/setjmp.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/atomic_word.h \ + /usr/include/c++/5/bits/locale_classes.h /usr/include/c++/5/string \ + /usr/include/c++/5/bits/allocator.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h \ + /usr/include/c++/5/ext/new_allocator.h /usr/include/c++/5/new \ + /usr/include/c++/5/bits/ostream_insert.h \ + /usr/include/c++/5/bits/cxxabi_forced.h \ + /usr/include/c++/5/bits/stl_function.h \ + /usr/include/c++/5/backward/binders.h \ + /usr/include/c++/5/bits/range_access.h \ + /usr/include/c++/5/bits/basic_string.h \ + /usr/include/c++/5/ext/alloc_traits.h \ + /usr/include/c++/5/bits/basic_string.tcc \ + /usr/include/c++/5/bits/locale_classes.tcc /usr/include/c++/5/stdexcept \ + /usr/include/c++/5/streambuf /usr/include/c++/5/bits/streambuf.tcc \ + /usr/include/c++/5/bits/basic_ios.h \ + /usr/include/c++/5/bits/locale_facets.h /usr/include/c++/5/cwctype \ + /usr/include/wctype.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/ctype_base.h \ + /usr/include/c++/5/bits/streambuf_iterator.h \ + /usr/include/x86_64-linux-gnu/c++/5/bits/ctype_inline.h \ + /usr/include/c++/5/bits/locale_facets.tcc \ + /usr/include/c++/5/bits/basic_ios.tcc \ + /usr/include/c++/5/bits/ostream.tcc /usr/include/c++/5/istream \ + /usr/include/c++/5/bits/istream.tcc /usr/include/string.h \ + /usr/include/x86_64-linux-gnu/bits/string3.h /usr/include/stdlib.h \ + /usr/include/x86_64-linux-gnu/bits/waitflags.h \ + /usr/include/x86_64-linux-gnu/bits/waitstatus.h \ + /usr/include/x86_64-linux-gnu/sys/types.h \ + /usr/include/x86_64-linux-gnu/sys/select.h \ + /usr/include/x86_64-linux-gnu/bits/select.h \ + /usr/include/x86_64-linux-gnu/bits/sigset.h \ + /usr/include/x86_64-linux-gnu/bits/select2.h \ + /usr/include/x86_64-linux-gnu/sys/sysmacros.h /usr/include/alloca.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib-float.h \ + /usr/include/x86_64-linux-gnu/bits/stdlib.h \ + /usr/lib/jvm/java-8-openjdk-amd64/include/jni.h /usr/include/libio.h \ + /usr/include/_G_config.h /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \ + /usr/include/x86_64-linux-gnu/bits/sys_errlist.h \ + /usr/include/x86_64-linux-gnu/bits/stdio.h \ + /usr/include/x86_64-linux-gnu/bits/stdio2.h \ + /usr/lib/jvm/java-8-openjdk-amd64/include/linux/jni_md.h \ + ../../modules/commons/src/jni/GiwsException.hxx + +/usr/include/stdc-predef.h: + +src/jni/SciDocMain.hxx: + +/usr/include/c++/5/iostream: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/os_defines.h: + +/usr/include/features.h: + +/usr/include/x86_64-linux-gnu/sys/cdefs.h: + +/usr/include/x86_64-linux-gnu/bits/wordsize.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs.h: + +/usr/include/x86_64-linux-gnu/gnu/stubs-64.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/cpu_defines.h: + +/usr/include/c++/5/ostream: + +/usr/include/c++/5/ios: + +/usr/include/c++/5/iosfwd: + +/usr/include/c++/5/bits/stringfwd.h: + +/usr/include/c++/5/bits/memoryfwd.h: + +/usr/include/c++/5/bits/postypes.h: + +/usr/include/c++/5/cwchar: + +/usr/include/wchar.h: + +/usr/include/stdio.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stdarg.h: + +/usr/include/x86_64-linux-gnu/bits/wchar.h: + +/usr/lib/gcc/x86_64-linux-gnu/5/include/stddef.h: + +/usr/include/xlocale.h: + +/usr/include/x86_64-linux-gnu/bits/wchar2.h: + +/usr/include/c++/5/exception: + +/usr/include/c++/5/bits/atomic_lockfree_defines.h: + +/usr/include/c++/5/bits/char_traits.h: + +/usr/include/c++/5/bits/stl_algobase.h: + +/usr/include/c++/5/bits/functexcept.h: + +/usr/include/c++/5/bits/exception_defines.h: + +/usr/include/c++/5/bits/cpp_type_traits.h: + +/usr/include/c++/5/ext/type_traits.h: + +/usr/include/c++/5/ext/numeric_traits.h: + +/usr/include/c++/5/bits/stl_pair.h: + +/usr/include/c++/5/bits/move.h: + +/usr/include/c++/5/bits/concept_check.h: + +/usr/include/c++/5/bits/stl_iterator_base_types.h: + +/usr/include/c++/5/bits/stl_iterator_base_funcs.h: + +/usr/include/c++/5/debug/debug.h: + +/usr/include/c++/5/bits/stl_iterator.h: + +/usr/include/c++/5/bits/ptr_traits.h: + +/usr/include/c++/5/bits/predefined_ops.h: + +/usr/include/c++/5/bits/localefwd.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++locale.h: + +/usr/include/c++/5/clocale: + +/usr/include/locale.h: + +/usr/include/x86_64-linux-gnu/bits/locale.h: + +/usr/include/c++/5/cctype: + +/usr/include/ctype.h: + +/usr/include/x86_64-linux-gnu/bits/types.h: + +/usr/include/x86_64-linux-gnu/bits/typesizes.h: + +/usr/include/endian.h: + +/usr/include/x86_64-linux-gnu/bits/endian.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap.h: + +/usr/include/x86_64-linux-gnu/bits/byteswap-16.h: + +/usr/include/c++/5/bits/ios_base.h: + +/usr/include/c++/5/ext/atomicity.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/gthr.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/gthr-default.h: + +/usr/include/pthread.h: + +/usr/include/sched.h: + +/usr/include/time.h: + +/usr/include/x86_64-linux-gnu/bits/sched.h: + +/usr/include/x86_64-linux-gnu/bits/time.h: + +/usr/include/x86_64-linux-gnu/bits/timex.h: + +/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h: + +/usr/include/x86_64-linux-gnu/bits/setjmp.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/atomic_word.h: + +/usr/include/c++/5/bits/locale_classes.h: + +/usr/include/c++/5/string: + +/usr/include/c++/5/bits/allocator.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h: + +/usr/include/c++/5/ext/new_allocator.h: + +/usr/include/c++/5/new: + +/usr/include/c++/5/bits/ostream_insert.h: + +/usr/include/c++/5/bits/cxxabi_forced.h: + +/usr/include/c++/5/bits/stl_function.h: + +/usr/include/c++/5/backward/binders.h: + +/usr/include/c++/5/bits/range_access.h: + +/usr/include/c++/5/bits/basic_string.h: + +/usr/include/c++/5/ext/alloc_traits.h: + +/usr/include/c++/5/bits/basic_string.tcc: + +/usr/include/c++/5/bits/locale_classes.tcc: + +/usr/include/c++/5/stdexcept: + +/usr/include/c++/5/streambuf: + +/usr/include/c++/5/bits/streambuf.tcc: + +/usr/include/c++/5/bits/basic_ios.h: + +/usr/include/c++/5/bits/locale_facets.h: + +/usr/include/c++/5/cwctype: + +/usr/include/wctype.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/ctype_base.h: + +/usr/include/c++/5/bits/streambuf_iterator.h: + +/usr/include/x86_64-linux-gnu/c++/5/bits/ctype_inline.h: + +/usr/include/c++/5/bits/locale_facets.tcc: + +/usr/include/c++/5/bits/basic_ios.tcc: + +/usr/include/c++/5/bits/ostream.tcc: + +/usr/include/c++/5/istream: + +/usr/include/c++/5/bits/istream.tcc: + +/usr/include/string.h: + +/usr/include/x86_64-linux-gnu/bits/string3.h: + +/usr/include/stdlib.h: + +/usr/include/x86_64-linux-gnu/bits/waitflags.h: + +/usr/include/x86_64-linux-gnu/bits/waitstatus.h: + +/usr/include/x86_64-linux-gnu/sys/types.h: + +/usr/include/x86_64-linux-gnu/sys/select.h: + +/usr/include/x86_64-linux-gnu/bits/select.h: + +/usr/include/x86_64-linux-gnu/bits/sigset.h: + +/usr/include/x86_64-linux-gnu/bits/select2.h: + +/usr/include/x86_64-linux-gnu/sys/sysmacros.h: + +/usr/include/alloca.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-bsearch.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib-float.h: + +/usr/include/x86_64-linux-gnu/bits/stdlib.h: + +/usr/lib/jvm/java-8-openjdk-amd64/include/jni.h: + +/usr/include/libio.h: + +/usr/include/_G_config.h: + +/usr/include/x86_64-linux-gnu/bits/stdio_lim.h: + +/usr/include/x86_64-linux-gnu/bits/sys_errlist.h: + +/usr/include/x86_64-linux-gnu/bits/stdio.h: + +/usr/include/x86_64-linux-gnu/bits/stdio2.h: + +/usr/lib/jvm/java-8-openjdk-amd64/include/linux/jni_md.h: + +../../modules/commons/src/jni/GiwsException.hxx: diff --git a/modules/helptools/src/jni/.dirstamp b/modules/helptools/src/jni/.dirstamp new file mode 100755 index 000000000..e69de29bb --- /dev/null +++ b/modules/helptools/src/jni/.dirstamp diff --git a/modules/helptools/src/jni/.libs/libscihelptools_algo_la-BuildDocObject.o b/modules/helptools/src/jni/.libs/libscihelptools_algo_la-BuildDocObject.o Binary files differnew file mode 100755 index 000000000..02ed71ba3 --- /dev/null +++ b/modules/helptools/src/jni/.libs/libscihelptools_algo_la-BuildDocObject.o diff --git a/modules/helptools/src/jni/.libs/libscihelptools_algo_la-SciDocMain.o b/modules/helptools/src/jni/.libs/libscihelptools_algo_la-SciDocMain.o Binary files differnew file mode 100755 index 000000000..9a820dbbd --- /dev/null +++ b/modules/helptools/src/jni/.libs/libscihelptools_algo_la-SciDocMain.o diff --git a/modules/helptools/src/jni/BuildDocObject.cpp b/modules/helptools/src/jni/BuildDocObject.cpp new file mode 100755 index 000000000..70f3259dc --- /dev/null +++ b/modules/helptools/src/jni/BuildDocObject.cpp @@ -0,0 +1,267 @@ +#include "BuildDocObject.hxx" +/* Generated by GIWS (version 2.0.2) with command: +giws --disable-return-size-array --output-dir src/jni/ --throws-exception-on-error --description-file src/jni/BuildDocObject.giws.xml +*/ +/* + +This is generated code. + +This software is a computer program whose purpose is to hide the complexity +of accessing Java objects/methods from C++ code. + +This software is governed by the CeCILL-B license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL-B +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL-B license and that you accept its terms. +*/ + +namespace org_scilab_modules_helptools { + + // Static declarations (if any) + +// Returns the current env + +JNIEnv * BuildDocObject::getCurrentEnv() { +JNIEnv * curEnv = NULL; +jint res=this->jvm->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL); +if (res != JNI_OK) { +throw GiwsException::JniException(getCurrentEnv()); +} +return curEnv; +} +// Destructor + +BuildDocObject::~BuildDocObject() { +JNIEnv * curEnv = NULL; +this->jvm->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL); +curEnv->DeleteGlobalRef(this->instance); +curEnv->DeleteGlobalRef(this->instanceClass); +} +// Constructors +BuildDocObject::BuildDocObject(JavaVM * jvm_) { +jmethodID constructObject = NULL ; +jobject localInstance ; +jclass localClass ; + +const std::string construct="<init>"; +const std::string param="()V"; +jvm=jvm_; + +JNIEnv * curEnv = getCurrentEnv(); + +localClass = curEnv->FindClass( this->className().c_str() ) ; +if (localClass == NULL) { + throw GiwsException::JniClassNotFoundException(curEnv, this->className()); +} + +this->instanceClass = static_cast<jclass>(curEnv->NewGlobalRef(localClass)); + +/* localClass is not needed anymore */ +curEnv->DeleteLocalRef(localClass); + +if (this->instanceClass == NULL) { +throw GiwsException::JniObjectCreationException(curEnv, this->className()); +} + + +constructObject = curEnv->GetMethodID( this->instanceClass, construct.c_str() , param.c_str() ) ; +if(constructObject == NULL){ +throw GiwsException::JniObjectCreationException(curEnv, this->className()); +} + +localInstance = curEnv->NewObject( this->instanceClass, constructObject ) ; +if(localInstance == NULL){ +throw GiwsException::JniObjectCreationException(curEnv, this->className()); +} + +this->instance = curEnv->NewGlobalRef(localInstance) ; +if(this->instance == NULL){ +throw GiwsException::JniObjectCreationException(curEnv, this->className()); +} +/* localInstance not needed anymore */ +curEnv->DeleteLocalRef(localInstance); + + /* Methods ID set to NULL */ +jbooleansetOutputDirectoryjstringjava_lang_StringID=NULL; +voidsetWorkingLanguagejstringjava_lang_StringID=NULL; +voidsetExportFormatjstringjava_lang_StringID=NULL; +jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID=NULL; + + +} + +BuildDocObject::BuildDocObject(JavaVM * jvm_, jobject JObj) { + jvm=jvm_; + + JNIEnv * curEnv = getCurrentEnv(); + +jclass localClass = curEnv->GetObjectClass(JObj); + this->instanceClass = static_cast<jclass>(curEnv->NewGlobalRef(localClass)); + curEnv->DeleteLocalRef(localClass); + + if (this->instanceClass == NULL) { +throw GiwsException::JniObjectCreationException(curEnv, this->className()); + } + + this->instance = curEnv->NewGlobalRef(JObj) ; + if(this->instance == NULL){ +throw GiwsException::JniObjectCreationException(curEnv, this->className()); + } + /* Methods ID set to NULL */ + jbooleansetOutputDirectoryjstringjava_lang_StringID=NULL; +voidsetWorkingLanguagejstringjava_lang_StringID=NULL; +voidsetExportFormatjstringjava_lang_StringID=NULL; +jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID=NULL; + + +} + +// Generic methods + +void BuildDocObject::synchronize() { +if (getCurrentEnv()->MonitorEnter(instance) != JNI_OK) { +throw GiwsException::JniMonitorException(getCurrentEnv(), "BuildDocObject"); +} +} + +void BuildDocObject::endSynchronize() { +if ( getCurrentEnv()->MonitorExit(instance) != JNI_OK) { +throw GiwsException::JniMonitorException(getCurrentEnv(), "BuildDocObject"); +} +} +// Method(s) + +bool BuildDocObject::setOutputDirectory (char const* directory){ + +JNIEnv * curEnv = getCurrentEnv(); + +if (jbooleansetOutputDirectoryjstringjava_lang_StringID==NULL) { /* Use the cache */ + jbooleansetOutputDirectoryjstringjava_lang_StringID = curEnv->GetMethodID(this->instanceClass, "setOutputDirectory", "(Ljava/lang/String;)Z" ) ; +if (jbooleansetOutputDirectoryjstringjava_lang_StringID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "setOutputDirectory"); +} +} +jstring directory_ = curEnv->NewStringUTF( directory ); +if (directory != NULL && directory_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + + jboolean res = static_cast<jboolean>( curEnv->CallBooleanMethod( this->instance, jbooleansetOutputDirectoryjstringjava_lang_StringID ,directory_)); + curEnv->DeleteLocalRef(directory_); + +return (res == JNI_TRUE); + +} + +void BuildDocObject::setWorkingLanguage (char const* language){ + +JNIEnv * curEnv = getCurrentEnv(); + +if (voidsetWorkingLanguagejstringjava_lang_StringID==NULL) { /* Use the cache */ + voidsetWorkingLanguagejstringjava_lang_StringID = curEnv->GetMethodID(this->instanceClass, "setWorkingLanguage", "(Ljava/lang/String;)V" ) ; +if (voidsetWorkingLanguagejstringjava_lang_StringID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "setWorkingLanguage"); +} +} +jstring language_ = curEnv->NewStringUTF( language ); +if (language != NULL && language_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + + curEnv->CallVoidMethod( this->instance, voidsetWorkingLanguagejstringjava_lang_StringID ,language_); + curEnv->DeleteLocalRef(language_); + +} + +void BuildDocObject::setExportFormat (char const* format){ + +JNIEnv * curEnv = getCurrentEnv(); + +if (voidsetExportFormatjstringjava_lang_StringID==NULL) { /* Use the cache */ + voidsetExportFormatjstringjava_lang_StringID = curEnv->GetMethodID(this->instanceClass, "setExportFormat", "(Ljava/lang/String;)V" ) ; +if (voidsetExportFormatjstringjava_lang_StringID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "setExportFormat"); +} +} +jstring format_ = curEnv->NewStringUTF( format ); +if (format != NULL && format_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + + curEnv->CallVoidMethod( this->instance, voidsetExportFormatjstringjava_lang_StringID ,format_); + curEnv->DeleteLocalRef(format_); + +} + +char* BuildDocObject::process (char const* sourceDoc, char const* styleSheet){ + +JNIEnv * curEnv = getCurrentEnv(); + +if (jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID==NULL) { /* Use the cache */ + jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID = curEnv->GetMethodID(this->instanceClass, "process", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;" ) ; +if (jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "process"); +} +} +jstring sourceDoc_ = curEnv->NewStringUTF( sourceDoc ); +if (sourceDoc != NULL && sourceDoc_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + +jstring styleSheet_ = curEnv->NewStringUTF( styleSheet ); +if (styleSheet != NULL && styleSheet_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + + jstring res = static_cast<jstring>( curEnv->CallObjectMethod( this->instance, jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID ,sourceDoc_, styleSheet_)); + if (curEnv->ExceptionCheck()) { +throw GiwsException::JniCallMethodException(curEnv); +}if (res != NULL) { + +const char *tempString = curEnv->GetStringUTFChars(res, 0); +char * myStringBuffer = new char[strlen(tempString) + 1]; +strcpy(myStringBuffer, tempString); +curEnv->ReleaseStringUTFChars(res, tempString); +curEnv->DeleteLocalRef(res); +curEnv->DeleteLocalRef(sourceDoc_); +curEnv->DeleteLocalRef(styleSheet_); + +return myStringBuffer; + } else { +curEnv->DeleteLocalRef(res); +return NULL; +} +} + +} diff --git a/modules/helptools/src/jni/BuildDocObject.giws.xml b/modules/helptools/src/jni/BuildDocObject.giws.xml new file mode 100755 index 000000000..9fc2e987f --- /dev/null +++ b/modules/helptools/src/jni/BuildDocObject.giws.xml @@ -0,0 +1,22 @@ + <package name="org.scilab.modules.helptools"> + <object name="BuildDocObject"> + + <method name="setOutputDirectory" returnType="boolean"> + <param type="String" name="directory" /> + </method> + + <method name="setWorkingLanguage" returnType="void"> + <param type="String" name="language" /> + </method> + + <method name="setExportFormat" returnType="void"> + <param type="String" name="format" /> + </method> + + <method name="process" returnType="String"> + <param type="String" name="sourceDoc" /> + <param type="String" name="styleSheet" /> + </method> + + </object> +</package> diff --git a/modules/helptools/src/jni/BuildDocObject.hxx b/modules/helptools/src/jni/BuildDocObject.hxx new file mode 100755 index 000000000..e4b0567b7 --- /dev/null +++ b/modules/helptools/src/jni/BuildDocObject.hxx @@ -0,0 +1,187 @@ +/* Generated by GIWS (version 2.0.2) with command: +giws --disable-return-size-array --output-dir src/jni/ --throws-exception-on-error --description-file src/jni/BuildDocObject.giws.xml +*/ +/* + +This is generated code. + +This software is a computer program whose purpose is to hide the complexity +of accessing Java objects/methods from C++ code. + +This software is governed by the CeCILL-B license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL-B +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL-B license and that you accept its terms. +*/ + + +#ifndef __ORG_SCILAB_MODULES_HELPTOOLS_BUILDDOCOBJECT__ +#define __ORG_SCILAB_MODULES_HELPTOOLS_BUILDDOCOBJECT__ +#include <iostream> +#include <string> +#include <string.h> +#include <stdlib.h> +#include <jni.h> + +#include "GiwsException.hxx" + + #if defined(_MSC_VER) /* Defined anyway with Visual */ + #include <Windows.h> + #else + typedef signed char byte; + #endif + + +#ifndef GIWSEXPORT +# if defined(_MSC_VER) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define GIWSEXPORT +# else +# define GIWSEXPORT __declspec(dllexport) +# endif +# else +# if __GNUC__ >= 4 +# define GIWSEXPORT __attribute__ ((visibility ("default"))) +# else +# define GIWSEXPORT +# endif +# endif +#endif + +namespace org_scilab_modules_helptools { +class GIWSEXPORT BuildDocObject { + +private: +JavaVM * jvm; + +protected: +jmethodID jbooleansetOutputDirectoryjstringjava_lang_StringID; // cache method id +jmethodID voidsetWorkingLanguagejstringjava_lang_StringID; // cache method id +jmethodID voidsetExportFormatjstringjava_lang_StringID; // cache method id +jmethodID jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID; // cache method id + + + +jobject instance; +jclass instanceClass; // cache class + + +// Caching (if any) + + +/** +* Get the environment matching to the current thread. +*/ +virtual JNIEnv * getCurrentEnv(); + +public: +// Constructor +/** +* Create a wrapping of the object from a JNIEnv. +* It will call the default constructor +* @param JEnv_ the Java Env +*/ +BuildDocObject(JavaVM * jvm_); + +/** +* Create a wrapping of an already existing object from a JNIEnv. +* The object must have already been instantiated +* @param JEnv_ the Java Env +* @param JObj the object +*/ +BuildDocObject(JavaVM * jvm_, jobject JObj); + + +/** +* This is a fake constructor to avoid the constructor +* chaining when dealing with extended giws classes +*/ +#ifdef FAKEGIWSDATATYPE +BuildDocObject(fakeGiwsDataType::fakeGiwsDataType /* unused */) {} +#endif + +// Destructor +~BuildDocObject(); + +// Generic method +// Synchronization methods +/** +* Enter monitor associated with the object. +* Equivalent of creating a "synchronized(obj)" scope in Java. +*/ +void synchronize(); + +/** +* Exit monitor associated with the object. +* Equivalent of ending a "synchronized(obj)" scope. +*/ +void endSynchronize(); + +// Methods +bool setOutputDirectory(char const* directory); + +void setWorkingLanguage(char const* language); + +void setExportFormat(char const* format); + +char* process(char const* sourceDoc, char const* styleSheet); + + + /** + * Get class name to use for static methods + * @return class name to use for static methods + */ + + static const std::string className() + { + return "org/scilab/modules/helptools/BuildDocObject"; + } + + + /** + * Get class to use for static methods + * @return class to use for static methods + */ + + static jclass initClass(JNIEnv * curEnv) + { + static jclass cls = 0; + + if (cls == 0) + { + jclass _cls = curEnv->FindClass(className().c_str()); + if (_cls) + { + cls = static_cast<jclass>(curEnv->NewGlobalRef(_cls)); + } + } + + return cls; + } + +}; + + +} +#endif diff --git a/modules/helptools/src/jni/BuildDocObjectv2.giws.xml b/modules/helptools/src/jni/BuildDocObjectv2.giws.xml new file mode 100755 index 000000000..f0b160a0c --- /dev/null +++ b/modules/helptools/src/jni/BuildDocObjectv2.giws.xml @@ -0,0 +1,36 @@ + <package name="org.scilab.modules.helptools"> + <object name="SciDocMain"> + + <method name="buildDocumentation" returnType="void"> + <param type="String" name="type" /> + </method> + + <method name="setOutputDirectory" returnType="boolean"> + <param type="String" name="directory" /> + </method> + + <method name="setWorkingLanguage" returnType="void"> + <param type="String" name="language" /> + </method> + + <method name="setExportFormat" returnType="void"> + <param type="String" name="format" /> + </method> + + <method name="setIsToolbox" returnType="void"> + <param type="boolean" name="isToolbox" /> + </method> + + <method name="process" returnType="String"> + <param type="String" name="sourceDoc" /> + <param type="String" name="styleSheet" /> + </method> + + <method name="generateJavahelp" returnType="void" modifier="static"> + <param type="String" name="outputDir" /> + <param type="String" name="language" /> + <param type="boolean" name="isToolbox" /> + </method> + + </object> +</package> diff --git a/modules/helptools/src/jni/SciDocMain.cpp b/modules/helptools/src/jni/SciDocMain.cpp new file mode 100755 index 000000000..46b07a16e --- /dev/null +++ b/modules/helptools/src/jni/SciDocMain.cpp @@ -0,0 +1,349 @@ +#include "SciDocMain.hxx" +/* Generated by GIWS (version 2.0.2) with command: +giws --disable-return-size-array --output-dir src/jni/ --throws-exception-on-error --description-file src/jni/BuildDocObjectv2.giws.xml +*/ +/* + +This is generated code. + +This software is a computer program whose purpose is to hide the complexity +of accessing Java objects/methods from C++ code. + +This software is governed by the CeCILL-B license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL-B +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL-B license and that you accept its terms. +*/ + +namespace org_scilab_modules_helptools { + + // Static declarations (if any) + +// Returns the current env + +JNIEnv * SciDocMain::getCurrentEnv() { +JNIEnv * curEnv = NULL; +jint res=this->jvm->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL); +if (res != JNI_OK) { +throw GiwsException::JniException(getCurrentEnv()); +} +return curEnv; +} +// Destructor + +SciDocMain::~SciDocMain() { +JNIEnv * curEnv = NULL; +this->jvm->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL); +curEnv->DeleteGlobalRef(this->instance); +curEnv->DeleteGlobalRef(this->instanceClass); +} +// Constructors +SciDocMain::SciDocMain(JavaVM * jvm_) { +jmethodID constructObject = NULL ; +jobject localInstance ; +jclass localClass ; + +const std::string construct="<init>"; +const std::string param="()V"; +jvm=jvm_; + +JNIEnv * curEnv = getCurrentEnv(); + +localClass = curEnv->FindClass( this->className().c_str() ) ; +if (localClass == NULL) { + throw GiwsException::JniClassNotFoundException(curEnv, this->className()); +} + +this->instanceClass = static_cast<jclass>(curEnv->NewGlobalRef(localClass)); + +/* localClass is not needed anymore */ +curEnv->DeleteLocalRef(localClass); + +if (this->instanceClass == NULL) { +throw GiwsException::JniObjectCreationException(curEnv, this->className()); +} + + +constructObject = curEnv->GetMethodID( this->instanceClass, construct.c_str() , param.c_str() ) ; +if(constructObject == NULL){ +throw GiwsException::JniObjectCreationException(curEnv, this->className()); +} + +localInstance = curEnv->NewObject( this->instanceClass, constructObject ) ; +if(localInstance == NULL){ +throw GiwsException::JniObjectCreationException(curEnv, this->className()); +} + +this->instance = curEnv->NewGlobalRef(localInstance) ; +if(this->instance == NULL){ +throw GiwsException::JniObjectCreationException(curEnv, this->className()); +} +/* localInstance not needed anymore */ +curEnv->DeleteLocalRef(localInstance); + + /* Methods ID set to NULL */ +voidbuildDocumentationjstringjava_lang_StringID=NULL; +jbooleansetOutputDirectoryjstringjava_lang_StringID=NULL; +voidsetWorkingLanguagejstringjava_lang_StringID=NULL; +voidsetExportFormatjstringjava_lang_StringID=NULL; +voidsetIsToolboxjbooleanbooleanID=NULL; +jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID=NULL; +voidgenerateJavahelpjstringjava_lang_Stringjstringjava_lang_StringjbooleanbooleanID=NULL; + + +} + +SciDocMain::SciDocMain(JavaVM * jvm_, jobject JObj) { + jvm=jvm_; + + JNIEnv * curEnv = getCurrentEnv(); + +jclass localClass = curEnv->GetObjectClass(JObj); + this->instanceClass = static_cast<jclass>(curEnv->NewGlobalRef(localClass)); + curEnv->DeleteLocalRef(localClass); + + if (this->instanceClass == NULL) { +throw GiwsException::JniObjectCreationException(curEnv, this->className()); + } + + this->instance = curEnv->NewGlobalRef(JObj) ; + if(this->instance == NULL){ +throw GiwsException::JniObjectCreationException(curEnv, this->className()); + } + /* Methods ID set to NULL */ + voidbuildDocumentationjstringjava_lang_StringID=NULL; +jbooleansetOutputDirectoryjstringjava_lang_StringID=NULL; +voidsetWorkingLanguagejstringjava_lang_StringID=NULL; +voidsetExportFormatjstringjava_lang_StringID=NULL; +voidsetIsToolboxjbooleanbooleanID=NULL; +jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID=NULL; +voidgenerateJavahelpjstringjava_lang_Stringjstringjava_lang_StringjbooleanbooleanID=NULL; + + +} + +// Generic methods + +void SciDocMain::synchronize() { +if (getCurrentEnv()->MonitorEnter(instance) != JNI_OK) { +throw GiwsException::JniMonitorException(getCurrentEnv(), "SciDocMain"); +} +} + +void SciDocMain::endSynchronize() { +if ( getCurrentEnv()->MonitorExit(instance) != JNI_OK) { +throw GiwsException::JniMonitorException(getCurrentEnv(), "SciDocMain"); +} +} +// Method(s) + +void SciDocMain::buildDocumentation (char const* type){ + +JNIEnv * curEnv = getCurrentEnv(); + +if (voidbuildDocumentationjstringjava_lang_StringID==NULL) { /* Use the cache */ + voidbuildDocumentationjstringjava_lang_StringID = curEnv->GetMethodID(this->instanceClass, "buildDocumentation", "(Ljava/lang/String;)V" ) ; +if (voidbuildDocumentationjstringjava_lang_StringID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "buildDocumentation"); +} +} +jstring type_ = curEnv->NewStringUTF( type ); +if (type != NULL && type_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + + curEnv->CallVoidMethod( this->instance, voidbuildDocumentationjstringjava_lang_StringID ,type_); + curEnv->DeleteLocalRef(type_); + +} + +bool SciDocMain::setOutputDirectory (char const* directory){ + +JNIEnv * curEnv = getCurrentEnv(); + +if (jbooleansetOutputDirectoryjstringjava_lang_StringID==NULL) { /* Use the cache */ + jbooleansetOutputDirectoryjstringjava_lang_StringID = curEnv->GetMethodID(this->instanceClass, "setOutputDirectory", "(Ljava/lang/String;)Z" ) ; +if (jbooleansetOutputDirectoryjstringjava_lang_StringID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "setOutputDirectory"); +} +} +jstring directory_ = curEnv->NewStringUTF( directory ); +if (directory != NULL && directory_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + + jboolean res = static_cast<jboolean>( curEnv->CallBooleanMethod( this->instance, jbooleansetOutputDirectoryjstringjava_lang_StringID ,directory_)); + curEnv->DeleteLocalRef(directory_); + +return (res == JNI_TRUE); + +} + +void SciDocMain::setWorkingLanguage (char const* language){ + +JNIEnv * curEnv = getCurrentEnv(); + +if (voidsetWorkingLanguagejstringjava_lang_StringID==NULL) { /* Use the cache */ + voidsetWorkingLanguagejstringjava_lang_StringID = curEnv->GetMethodID(this->instanceClass, "setWorkingLanguage", "(Ljava/lang/String;)V" ) ; +if (voidsetWorkingLanguagejstringjava_lang_StringID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "setWorkingLanguage"); +} +} +jstring language_ = curEnv->NewStringUTF( language ); +if (language != NULL && language_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + + curEnv->CallVoidMethod( this->instance, voidsetWorkingLanguagejstringjava_lang_StringID ,language_); + curEnv->DeleteLocalRef(language_); + +} + +void SciDocMain::setExportFormat (char const* format){ + +JNIEnv * curEnv = getCurrentEnv(); + +if (voidsetExportFormatjstringjava_lang_StringID==NULL) { /* Use the cache */ + voidsetExportFormatjstringjava_lang_StringID = curEnv->GetMethodID(this->instanceClass, "setExportFormat", "(Ljava/lang/String;)V" ) ; +if (voidsetExportFormatjstringjava_lang_StringID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "setExportFormat"); +} +} +jstring format_ = curEnv->NewStringUTF( format ); +if (format != NULL && format_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + + curEnv->CallVoidMethod( this->instance, voidsetExportFormatjstringjava_lang_StringID ,format_); + curEnv->DeleteLocalRef(format_); + +} + +void SciDocMain::setIsToolbox (bool isToolbox){ + +JNIEnv * curEnv = getCurrentEnv(); + +if (voidsetIsToolboxjbooleanbooleanID==NULL) { /* Use the cache */ + voidsetIsToolboxjbooleanbooleanID = curEnv->GetMethodID(this->instanceClass, "setIsToolbox", "(Z)V" ) ; +if (voidsetIsToolboxjbooleanbooleanID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "setIsToolbox"); +} +} +jboolean isToolbox_ = (static_cast<bool>(isToolbox) ? JNI_TRUE : JNI_FALSE); + + curEnv->CallVoidMethod( this->instance, voidsetIsToolboxjbooleanbooleanID ,isToolbox_); + +} + +char* SciDocMain::process (char const* sourceDoc, char const* styleSheet){ + +JNIEnv * curEnv = getCurrentEnv(); + +if (jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID==NULL) { /* Use the cache */ + jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID = curEnv->GetMethodID(this->instanceClass, "process", "(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;" ) ; +if (jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "process"); +} +} +jstring sourceDoc_ = curEnv->NewStringUTF( sourceDoc ); +if (sourceDoc != NULL && sourceDoc_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + +jstring styleSheet_ = curEnv->NewStringUTF( styleSheet ); +if (styleSheet != NULL && styleSheet_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + + jstring res = static_cast<jstring>( curEnv->CallObjectMethod( this->instance, jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID ,sourceDoc_, styleSheet_)); + if (curEnv->ExceptionCheck()) { +throw GiwsException::JniCallMethodException(curEnv); +}if (res != NULL) { + +const char *tempString = curEnv->GetStringUTFChars(res, 0); +char * myStringBuffer = new char[strlen(tempString) + 1]; +strcpy(myStringBuffer, tempString); +curEnv->ReleaseStringUTFChars(res, tempString); +curEnv->DeleteLocalRef(res); +curEnv->DeleteLocalRef(sourceDoc_); +curEnv->DeleteLocalRef(styleSheet_); + +return myStringBuffer; + } else { +curEnv->DeleteLocalRef(res); +return NULL; +} +} + +void SciDocMain::generateJavahelp (JavaVM * jvm_, char const* outputDir, char const* language, bool isToolbox){ + +JNIEnv * curEnv = NULL; +jvm_->AttachCurrentThread(reinterpret_cast<void **>(&curEnv), NULL); +jclass cls = initClass(curEnv); +if ( cls == NULL) { +throw GiwsException::JniCallMethodException(curEnv); +} + +static jmethodID voidgenerateJavahelpjstringjava_lang_Stringjstringjava_lang_StringjbooleanbooleanID = curEnv->GetStaticMethodID(cls, "generateJavahelp", "(Ljava/lang/String;Ljava/lang/String;Z)V" ) ; +if (voidgenerateJavahelpjstringjava_lang_Stringjstringjava_lang_StringjbooleanbooleanID == NULL) { +throw GiwsException::JniMethodNotFoundException(curEnv, "generateJavahelp"); +} + +jstring outputDir_ = curEnv->NewStringUTF( outputDir ); +if (outputDir != NULL && outputDir_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + +jstring language_ = curEnv->NewStringUTF( language ); +if (language != NULL && language_ == NULL) +{ +throw GiwsException::JniBadAllocException(curEnv); +} + + +jboolean isToolbox_ = (static_cast<bool>(isToolbox) ? JNI_TRUE : JNI_FALSE); + + curEnv->CallStaticVoidMethod(cls, voidgenerateJavahelpjstringjava_lang_Stringjstringjava_lang_StringjbooleanbooleanID ,outputDir_, language_, isToolbox_); + curEnv->DeleteLocalRef(outputDir_); +curEnv->DeleteLocalRef(language_); +if (curEnv->ExceptionCheck()) { +throw GiwsException::JniCallMethodException(curEnv); +} +} + +} diff --git a/modules/helptools/src/jni/SciDocMain.hxx b/modules/helptools/src/jni/SciDocMain.hxx new file mode 100755 index 000000000..15612b70f --- /dev/null +++ b/modules/helptools/src/jni/SciDocMain.hxx @@ -0,0 +1,196 @@ +/* Generated by GIWS (version 2.0.2) with command: +giws --disable-return-size-array --output-dir src/jni/ --throws-exception-on-error --description-file src/jni/BuildDocObjectv2.giws.xml +*/ +/* + +This is generated code. + +This software is a computer program whose purpose is to hide the complexity +of accessing Java objects/methods from C++ code. + +This software is governed by the CeCILL-B license under French law and +abiding by the rules of distribution of free software. You can use, +modify and/ or redistribute the software under the terms of the CeCILL-B +license as circulated by CEA, CNRS and INRIA at the following URL +"http://www.cecill.info". + +As a counterpart to the access to the source code and rights to copy, +modify and redistribute granted by the license, users are provided only +with a limited warranty and the software's author, the holder of the +economic rights, and the successive licensors have only limited +liability. + +In this respect, the user's attention is drawn to the risks associated +with loading, using, modifying and/or developing or reproducing the +software by the user in light of its specific status of free software, +that may mean that it is complicated to manipulate, and that also +therefore means that it is reserved for developers and experienced +professionals having in-depth computer knowledge. Users are therefore +encouraged to load and test the software's suitability as regards their +requirements in conditions enabling the security of their systems and/or +data to be ensured and, more generally, to use and operate it in the +same conditions as regards security. + +The fact that you are presently reading this means that you have had +knowledge of the CeCILL-B license and that you accept its terms. +*/ + + +#ifndef __ORG_SCILAB_MODULES_HELPTOOLS_SCIDOCMAIN__ +#define __ORG_SCILAB_MODULES_HELPTOOLS_SCIDOCMAIN__ +#include <iostream> +#include <string> +#include <string.h> +#include <stdlib.h> +#include <jni.h> + +#include "GiwsException.hxx" + + #if defined(_MSC_VER) /* Defined anyway with Visual */ + #include <Windows.h> + #else + typedef signed char byte; + #endif + + +#ifndef GIWSEXPORT +# if defined(_MSC_VER) || defined(__WIN32__) || defined(__CYGWIN__) +# if defined(STATIC_LINKED) +# define GIWSEXPORT +# else +# define GIWSEXPORT __declspec(dllexport) +# endif +# else +# if __GNUC__ >= 4 +# define GIWSEXPORT __attribute__ ((visibility ("default"))) +# else +# define GIWSEXPORT +# endif +# endif +#endif + +namespace org_scilab_modules_helptools { +class GIWSEXPORT SciDocMain { + +private: +JavaVM * jvm; + +protected: +jmethodID voidbuildDocumentationjstringjava_lang_StringID; // cache method id +jmethodID jbooleansetOutputDirectoryjstringjava_lang_StringID; // cache method id +jmethodID voidsetWorkingLanguagejstringjava_lang_StringID; // cache method id +jmethodID voidsetExportFormatjstringjava_lang_StringID; // cache method id +jmethodID voidsetIsToolboxjbooleanbooleanID; // cache method id +jmethodID jstringprocessjstringjava_lang_Stringjstringjava_lang_StringID; // cache method id +jmethodID voidgenerateJavahelpjstringjava_lang_Stringjstringjava_lang_StringjbooleanbooleanID; // cache method id + + + +jobject instance; +jclass instanceClass; // cache class + + +// Caching (if any) + + +/** +* Get the environment matching to the current thread. +*/ +virtual JNIEnv * getCurrentEnv(); + +public: +// Constructor +/** +* Create a wrapping of the object from a JNIEnv. +* It will call the default constructor +* @param JEnv_ the Java Env +*/ +SciDocMain(JavaVM * jvm_); + +/** +* Create a wrapping of an already existing object from a JNIEnv. +* The object must have already been instantiated +* @param JEnv_ the Java Env +* @param JObj the object +*/ +SciDocMain(JavaVM * jvm_, jobject JObj); + + +/** +* This is a fake constructor to avoid the constructor +* chaining when dealing with extended giws classes +*/ +#ifdef FAKEGIWSDATATYPE +SciDocMain(fakeGiwsDataType::fakeGiwsDataType /* unused */) {} +#endif + +// Destructor +~SciDocMain(); + +// Generic method +// Synchronization methods +/** +* Enter monitor associated with the object. +* Equivalent of creating a "synchronized(obj)" scope in Java. +*/ +void synchronize(); + +/** +* Exit monitor associated with the object. +* Equivalent of ending a "synchronized(obj)" scope. +*/ +void endSynchronize(); + +// Methods +void buildDocumentation(char const* type); + +bool setOutputDirectory(char const* directory); + +void setWorkingLanguage(char const* language); + +void setExportFormat(char const* format); + +void setIsToolbox(bool isToolbox); + +char* process(char const* sourceDoc, char const* styleSheet); + +static void generateJavahelp(JavaVM * jvm_, char const* outputDir, char const* language, bool isToolbox); + + + /** + * Get class name to use for static methods + * @return class name to use for static methods + */ + + static const std::string className() + { + return "org/scilab/modules/helptools/SciDocMain"; + } + + + /** + * Get class to use for static methods + * @return class to use for static methods + */ + + static jclass initClass(JNIEnv * curEnv) + { + static jclass cls = 0; + + if (cls == 0) + { + jclass _cls = curEnv->FindClass(className().c_str()); + if (_cls) + { + cls = static_cast<jclass>(curEnv->NewGlobalRef(_cls)); + } + } + + return cls; + } + +}; + + +} +#endif diff --git a/modules/helptools/src/jni/libscihelptools_algo_la-BuildDocObject.lo b/modules/helptools/src/jni/libscihelptools_algo_la-BuildDocObject.lo new file mode 100755 index 000000000..dc410a56a --- /dev/null +++ b/modules/helptools/src/jni/libscihelptools_algo_la-BuildDocObject.lo @@ -0,0 +1,12 @@ +# src/jni/libscihelptools_algo_la-BuildDocObject.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libscihelptools_algo_la-BuildDocObject.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/helptools/src/jni/libscihelptools_algo_la-SciDocMain.lo b/modules/helptools/src/jni/libscihelptools_algo_la-SciDocMain.lo new file mode 100755 index 000000000..87d9f6ec0 --- /dev/null +++ b/modules/helptools/src/jni/libscihelptools_algo_la-SciDocMain.lo @@ -0,0 +1,12 @@ +# src/jni/libscihelptools_algo_la-SciDocMain.lo - a libtool object file +# Generated by libtool (GNU libtool) 2.4.2 +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# Name of the PIC object. +pic_object='.libs/libscihelptools_algo_la-SciDocMain.o' + +# Name of the non-PIC object +non_pic_object=none + diff --git a/modules/helptools/src/script/8859_to_utf8.pl b/modules/helptools/src/script/8859_to_utf8.pl new file mode 100755 index 000000000..c5c703f1b --- /dev/null +++ b/modules/helptools/src/script/8859_to_utf8.pl @@ -0,0 +1,271 @@ +#!/usr/bin/perl + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.org> +# +# This file must be used under the terms of the CeCILL. +# This source file is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at +# http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +use strict; +use Cwd; +use File::Basename; + +# Current directory +# ============================================================================== + +my $directory = getcwd(); + +if( dirname($0) ne '.' ) +{ + $directory .= '/'.dirname($0); +} + +if( dirname($0) =~ m/^\// ) +{ + $directory = dirname($0); +} + +# modules dir path +# ============================================================================== +my $sci_modules_dir = $directory; +$sci_modules_dir =~ s/\/helptools\/src\/perl//g; + + +# Module list +# ============================================================================== + +my %modules; + +if( $ARGV[0] ne '' ) +{ + $modules{$ARGV[0]} = 1; +} +else +{ + %modules = get_module_list(); +} + +my %xmllist; + +my $count = 0; + +my %languages; +$languages{'en_US'} = 1; +$languages{'fr_FR'} = 1; +$languages{'pt_BR'} = 1; + +foreach my $module (sort keys %modules) +{ + foreach my $language (sort keys %languages) + { + my $this_directory = $sci_modules_dir.'/'.$module.'/help/'.$language; + + if( -e $this_directory ) + { + get_xml_list($sci_modules_dir.'/'.$module.'/help/'.$language); + } + } +} + +foreach my $xmlfile (sort keys %xmllist) +{ + $count++; + printf('%03d - %s ',$count,$xmlfile); + + for( my $i=length($xmlfile);$i<140;$i++) + { + print '.'; + } + + if( is_8859($xmlfile) == 1 ) + { + convert_8859_to_utf8($xmlfile); + replace_8859_to_utf8($xmlfile); + print 'PROCESSED'; + } + else + { + print 'UTF-8'; + } + + print "\n"; +} + +# ============================================================================== +# get_module_list +# ============================================================================== + +sub get_module_list +{ + my %list; + + unless( chdir($sci_modules_dir) ) + { + print 'ERROR: The directory '.$sci_modules_dir.' doesn\'t exist or read access denied'."\n"; + del_tmp_file(); + exit(0); + } + + my @candidates = <*>; + + foreach my $candidate (@candidates) + { + if( -e $sci_modules_dir.'/'.$candidate.'/help' ) + { + $list{$candidate} = 1; + } + } + + return %list; +} + +# ============================================================================== +# get_xml_list +# ============================================================================== + +sub get_xml_list +{ + my $dir = $_[0]; + my @list_dir; + + my $current_directory; + + # On enregistre le répertoire dans lequel on se situe à l'entrée de la fonction + my $previous_directory = getcwd(); + + chdir($dir); + + @list_dir = <*>; + + foreach my $list_dir (@list_dir) + { + $current_directory = getcwd(); + + if(-d $list_dir) + { + get_xml_list($current_directory.'/'.$list_dir); + } + + if( (-f $list_dir) && ($list_dir =~ m/\.xml$/) ) + { + $xmllist{$current_directory.'/'.$list_dir} = 1; + } + } + + chdir($previous_directory); +} + +# ============================================================================== +# is_8859 +# ============================================================================== + +sub is_8859 +{ + my $xmlfile = $_[0]; + + unless( open(XMLFILE,$xmlfile) ) + { + print 'ERROR: Le fichier '.$xmlfile.' n\'a pu être ouvert en lecture'."\n"; + exit(0); + } + + my $is_8859 = 0; + + while(<XMLFILE>) + { + if( ($_ =~ m/encoding/) && ( $_ =~ m/8859/ ) && (index(lc($_),'version="1.0" encoding="iso-8859-1"')!= -1) ) + { + $is_8859 = 1; + last; + } + + last; + } + + close(XMLFILE); + + return $is_8859; +} + +# ============================================================================== +# convert_8859_to_utf8 +# ============================================================================== + +sub convert_8859_to_utf8 +{ + my $xmlfile_in = $_[0]; + my $xmlfile_out = $xmlfile_in.'.utf8'; + + my $cmd = 'iconv -f ISO_8859-1 -t UTF-8 "'.$xmlfile_in.'" -o "'.$xmlfile_out.'"'; + + my $code = system($cmd); + + if( $code != 0 ) + { + print 'ERROR: La commande "'.$cmd.'" a échoué'."\n"; + exit(0); + } + + unless(unlink($xmlfile_in)) + { + print 'ERROR: Le fichier '.$xmlfile_in.' n\'a pu être supprimé'."\n"; + exit(0); + } + + unless(rename($xmlfile_out,$xmlfile_in)) + { + print 'ERROR: Le fichier '.$xmlfile_out.' n\'a pu être renommé en '.$xmlfile_in."\n"; + exit(0); + } +} + +# ============================================================================== +# convert_8859_to_utf8 +# ============================================================================== + +sub replace_8859_to_utf8 +{ + my $xmlfile_in = $_[0]; + my $xmlfile_out = $xmlfile_in.'.utf8'; + + unless( open(XMLREAD,$xmlfile_in) ) + { + print 'ERROR: Le fichier '.$xmlfile_in.' n\'a pu être ouvert en lecture'."\n"; + exit(0); + } + + unless( open(XMLWRITE,'> '.$xmlfile_out) ) + { + print 'ERROR: Le fichier '.$xmlfile_out.' n\'a pu être ouvert en écriture'."\n"; + exit(0); + } + + while(<XMLREAD>) + { + if( ($_ =~ m/encoding/) && ( $_ =~ m/iso-8859-1/i ) && (index(lc($_),'version="1.0" encoding="iso-8859-1"')!= -1) ) + { + $_ =~ s/iso-8859-1/UTF-8/g; + $_ =~ s/ISO-8859-1/UTF-8/g; + } + + print XMLWRITE $_; + } + + close(XMLREAD); + close(XMLWRITE); + + unless(unlink($xmlfile_in)) + { + print 'ERROR: Le fichier '.$xmlfile_in.' n\'a pu être supprimé'."\n"; + exit(0); + } + + unless(rename($xmlfile_out,$xmlfile_in)) + { + print 'ERROR: Le fichier '.$xmlfile_out.' n\'a pu être renommé en '.$xmlfile_in."\n"; + exit(0); + } +} diff --git a/modules/helptools/src/script/check_xml.pl b/modules/helptools/src/script/check_xml.pl new file mode 100755 index 000000000..0e45209a5 --- /dev/null +++ b/modules/helptools/src/script/check_xml.pl @@ -0,0 +1,468 @@ +#!/usr/bin/perl + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +# +# This file must be used under the terms of the CeCILL. +# This source file is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at +# http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +use strict; +use Cwd; +use File::Basename; +use XML::Simple; +use Data::Dumper; + +# Current directory +my $directory = getcwd(); + +$0 =~ s/^\.\///; + +if( dirname($0) ne '.' ) +{ + $directory .= '/'.dirname($0); +} + +if( dirname($0) =~ m/^\// ) +{ + $directory = dirname($0); +} + +# modules dir path +my $sci_modules_dir = $directory; +$sci_modules_dir =~ s/\/helptools\/src\/perl//g; + +# schema path +my $rng = $sci_modules_dir.'/helptools/schema/scilab.rng'; +#my $rng = $sci_modules_dir.'/helptools/schema/docbook.rng'; + +# tmp file +my $tmp = $directory.'/tmp.txt'; + +# log file +my $log = $directory.'/log.txt'; + +# XML list +my %xmllist; +my %idlist; + +# stats +my $nb_bad_file = 0; +my %bad_file_list; + +my %languages; +$languages{'fr_FR'} = 1; +$languages{'en_US'} = 1; +$languages{'pt_BR'} = 1; + +# Initialisation du fichier de log +unless( open(LOG,'> '.$log) ) +{ + print 'The file '.$log.' doesn\'t exist or write access denied'."\n"; + exit(0); +} + +# Module list +my %modules; +if( $ARGV[0] ne '' ) +{ + $modules{$ARGV[0]} = 1; +} +else +{ + %modules = get_module_list(); +} + +# ============================================================================== +# First step : get the XML list +# ============================================================================== + +foreach my $module (sort keys %modules) +{ + foreach my $language (sort keys %languages) + { + my $this_directory = $sci_modules_dir.'/'.$module.'/help/'.$language; + + if( -d $this_directory ) + { + get_xml_list($this_directory,$language); + } + } +} + +# ============================================================================== +# Second step : valid each XML file +# ============================================================================== + +my $xmllist_size = 0; + +foreach my $xmlfile (sort keys %xmllist) +{ + $xmllist_size++; +} + +my $count = 0; + +foreach my $xmlfile (sort keys %xmllist) +{ + $count++; + + my $xmlfile_print = 'SCI/modules'.substr($xmlfile,length($sci_modules_dir)); + + printf('%04d/%04d - %s ',$count,$xmllist_size,$xmlfile_print); + + for( my $i =length($xmlfile) ; $i < 120 ; $i++ ) + { + print '.'; + } + + my $nb_error = valid($xmlfile); + $nb_error += get_id_list($xmlfile,$xmllist{$xmlfile}); + + if( $nb_error == 0) + { + print 'OK !'; + } + else + { + print "\t".$nb_error.' ERRORS'; + } + + print "\n"; +} + +# ============================================================================== +# Third step : Summary +# ============================================================================== + +print "\n\n"; +$count = 0; + +foreach my $bad_file (sort keys %bad_file_list) +{ + $count++; + printf(" %02d",$count); + print ' - '.$bad_file.' '; + for( my $i =length($bad_file) ; $i < 100 ; $i++ ) + { + print '.'; + } + print $bad_file_list{$bad_file}." ERRORS\n"; +} + +# ============================================================================== +# get_module_list +# ============================================================================== + +sub get_module_list +{ + my %list; + + unless( chdir($sci_modules_dir) ) + { + print 'The directory '.$sci_modules_dir.' doesn\'t exist or read access denied'."\n"; + del_tmp_file(); + exit(0); + } + + my @candidates = <*>; + + foreach my $candidate (@candidates) + { + if( -e $sci_modules_dir.'/'.$candidate.'/help' ) + { + $list{$candidate} = 1; + } + } + + return %list; +} + +# ============================================================================== +# get_xml_list +# ============================================================================== + +sub get_xml_list +{ + my $dir = $_[0]; + my $language = $_[1]; + my @list_dir; + + my $current_directory; + + # On enregistre le répertoire dans lequel on se situe à l'entrée de la fonction + my $previous_directory = getcwd(); + + chdir($dir); + + @list_dir = <*>; + + foreach my $list_dir (@list_dir) + { + $current_directory = getcwd(); + + if( (-d $list_dir) && ( ! ($list_dir =~ m/^scilab_[a-z][a-z]_[A-Z][A-Z]_help$/ )) ) + { + get_xml_list($current_directory.'/'.$list_dir,$language); + } + + if( (-f $list_dir) + && ($list_dir =~ m/\.xml$/) + && ($list_dir ne 'master.xml') + && ($list_dir ne 'master_help.xml') ) + { + $xmllist{$current_directory.'/'.$list_dir} = $language; + } + } + + chdir($previous_directory); +} + +# ============================================================================== +# valid +# ============================================================================== + +sub valid +{ + my $xmlfile = $_[0]; + + # construction de la commande + my $cmd = 'xmllint --noout --relaxng '.$rng.' '.$xmlfile.' '; + $cmd .= '> '.$tmp.' 2>&1'; + + # Lancement de la commande + system($cmd); + + # Vérification + + my $nb_error = 0; + my $error_str = ''; + + unless( open(TMP,$tmp) ) + { + print 'Le fichier '.$tmp.' n\'a pu être ouvert en lecture'."\n"; + del_tmp_file(); + exit(0); + } + + while(<TMP>) + { + if( $_ eq $xmlfile.' validates'."\n" ) + { + $nb_error = 0; + $error_str = ''; + last; + } + + if( (!($_ =~ m/IDREF attribute linkend references an unknown ID/)) && + (!($_ =~ m/Did not expect element ulink there/)) && + (!($_ =~ m/element imagedata: Relax-NG validity error :/)) && + (!( $_ =~ /fails to validate/)) ) + { + $nb_error++; + $error_str .= $_; + } + } + + close(TMP); + + if( $nb_error > 0 ) + { + $nb_bad_file++;; + $bad_file_list{$xmlfile} = $nb_error; + + print LOG "=================================================================\n"; + print LOG $xmlfile."\n"; + print LOG "=================================================================\n"; + print LOG $error_str; + } + + return $nb_error; +} + +# ============================================================================== +# del_tmp_file +# ============================================================================== + +sub del_tmp_file +{ + unlink($tmp); + unlink($log); +} + +# ============================================================================== +# get_id_list +# ============================================================================== + +sub get_id_list +{ + my $xmlfile = $_[0]; + my $language = $_[1]; + + my $xml_ref = XMLin($xmlfile); + my %xml_hash = %$xml_ref; + + my $nb_error = 0; + my $error_str = ''; + + my %list = (); + + # First step : get the list + # ========================================================================== + + # xml:id of this refentry + + if( exists($xml_hash{'xml:id'}) ) + { + $list{$xml_hash{'xml:id'}} = 1; + } + + # Other xml:id of this refentry + + if( exists($xml_hash{'refnamediv'}) ) + { + my $refnamediv_ref = $xml_hash{'refnamediv'}; + + # One refnamediv in this XML file + if( (ref($refnamediv_ref) eq 'HASH') && exists($refnamediv_ref->{'xml:id'}) ) + { + $list{$refnamediv_ref->{'xml:id'}} = 1; + } + + # Several refnamediv in this XML file + elsif( ref($refnamediv_ref) eq 'ARRAY' ) + { + my @refnamediv_tab = @$refnamediv_ref; + + foreach my $refnamediv (@refnamediv_tab) + { + my %refnamediv_hash = %$refnamediv; + + if(exists($refnamediv->{'xml:id'}) ) + { + $list{$refnamediv->{'xml:id'}} = 1; + } + } + } + } + + # Second step : Check + # ========================================================================== + + foreach my $id (sort keys %list) + { + my $final_id = $language.'_'.$id; + + if( exists($idlist{$final_id}) ) + { + # ERROR + + if( exists($bad_file_list{$xmlfile}) ) + { + $bad_file_list{$xmlfile} = $bad_file_list{$xmlfile} + 1; + } + else + { + $nb_bad_file++;; + $bad_file_list{$xmlfile} = 1; + } + + print LOG "=================================================================\n"; + print LOG $xmlfile."\n"; + print LOG "=================================================================\n"; + print LOG 'The xml:id "'.$id.'" is already used in the file "'.$idlist{$final_id}.'"'."\n"; + + $nb_error++; + } + else + { + $idlist{$final_id} = $xmlfile; + } + } + + return $nb_error; +} +# ============================================================================== +# check_links +# ============================================================================== + +sub check_links +{ + my $xmlfile = $_[0]; + my $language = $_[1]; + + my %links = (); + + my $nb_error = 0; + + my $xml_ref = XMLin($xmlfile); + get_links($xml_ref,\%links); + + foreach my $link (sort keys %links) + { + if( ! exists($idlist{$language.'_'.$link}) ) + { + # ERROR + + if( exists($bad_file_list{$xmlfile}) ) + { + $bad_file_list{$xmlfile} = $bad_file_list{$xmlfile} + 1; + } + else + { + $nb_bad_file++;; + $bad_file_list{$xmlfile} = 1; + } + + print LOG "=================================================================\n"; + print LOG $xmlfile."\n"; + print LOG "=================================================================\n"; + print LOG 'The id "'.$link.'" hasn\'t been found'."\n"; + + $nb_error++; + } + } + + return $nb_error; +} + +# ============================================================================== +# get_links +# ============================================================================== + +sub get_links +{ + my $ref = $_[0]; + my $links_ref = $_[1]; + + if( ref($ref) eq 'HASH' ) + { + if( exists($ref->{'link'}) ) + { + my $linkref = $ref->{'link'}; + + if( (ref($linkref) eq 'HASH') && exists($linkref->{'linkend'}) ) + { + $links_ref->{$linkref->{'linkend'}} = 1; + } + } + + my %ref_hash = %$ref; + + foreach my $item (keys %ref_hash) + { + get_links($ref_hash{$item},$links_ref); + } + } + elsif( ref($ref) eq 'ARRAY' ) + { + my @ref_tab = @$ref; + + foreach my $item (@ref_tab) + { + get_links($item,$links_ref); + } + } +} diff --git a/modules/helptools/src/script/check_xml_dir.pl b/modules/helptools/src/script/check_xml_dir.pl new file mode 100755 index 000000000..5e5e85804 --- /dev/null +++ b/modules/helptools/src/script/check_xml_dir.pl @@ -0,0 +1,251 @@ +#!/usr/bin/perl + +# Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +# Copyright (C) 2008 - INRIA - Pierre MARECHAL <pierre.marechal@inria.fr> +# +# This file must be used under the terms of the CeCILL. +# This source file is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at +# http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + +use strict; +use Cwd; +use File::Basename; +use XML::Simple; +use Data::Dumper; + +# Current directory +my $directory = getcwd(); + +if( dirname($0) ne '.' ) +{ + $directory .= '/'.dirname($0); +} + +if( dirname($0) =~ m/^\// ) +{ + $directory = dirname($0); +} + +# modules dir path +my $sci_modules_dir = $directory; +$sci_modules_dir =~ s/\/helptools\/src\/perl//g; + +# schema path +my $rng = $sci_modules_dir.'/helptools/schema/scilab.rng'; + +# tmp file +my $tmp = $directory.'/tmp.txt'; + +# log file +my $log = $directory.'/log.txt'; + +# XML list +my %xmllist; + +# stats +my $nb_bad_file = 0; +my %bad_file_list; + +# Initialisation du fichier de log +unless( open(LOG,'> '.$log) ) +{ + print 'The file '.$log.' doesn\'t exist or write access denied'."\n"; + exit(0); +} + +# ============================================================================== +# First step : get the XML list +# ============================================================================== + +get_xml_list($ARGV[0]); + + +# ============================================================================== +# Second step : valid each XML file +# ============================================================================== + +my $xmllist_size = 0; + +foreach my $xmlfile (sort keys %xmllist) +{ + $xmllist_size++; +} + +my $count = 0; + +foreach my $xmlfile (sort keys %xmllist) +{ + $count++; + + my $xmlfile_print = 'SCI/modules'.substr($xmlfile,length($sci_modules_dir)); + + printf('%04d/%04d - %s ',$count,$xmllist_size,$xmlfile_print); + + for( my $i =length($xmlfile) ; $i < 120 ; $i++ ) + { + print '.'; + } + + my $nb_error = valid($xmlfile); + + if( $nb_error == 0) + { + print 'OK !'; + } + else + { + print "\t".$nb_error.' ERRORS'; + } + + print "\n"; +} + +# ============================================================================== +# Third step : Summary +# ============================================================================== + +print "\n\n"; +$count = 0; + +foreach my $bad_file (sort keys %bad_file_list) +{ + $count++; + printf(" %02d",$count); + print ' - '.$bad_file.' '; + for( my $i =length($bad_file) ; $i < 100 ; $i++ ) + { + print '.'; + } + print $bad_file_list{$bad_file}." ERRORS\n"; +} + +# ============================================================================== +# get_module_list +# ============================================================================== + +sub get_module_list +{ + my %list; + + unless( chdir($sci_modules_dir) ) + { + print 'The directory '.$sci_modules_dir.' doesn\'t exist or read access denied'."\n"; + del_tmp_file(); + exit(0); + } + + my @candidates = <*>; + + foreach my $candidate (@candidates) + { + if( -e $sci_modules_dir.'/'.$candidate.'/help' ) + { + $list{$candidate} = 1; + } + } + + return %list; +} + +# ============================================================================== +# get_xml_list +# ============================================================================== + +sub get_xml_list +{ + my $dir = $_[0]; + my @list_dir; + + my $current_directory; + + # On enregistre le répertoire dans lequel on se situe à l'entrée de la fonction + my $previous_directory = getcwd(); + + chdir($dir); + + @list_dir = <*>; + + foreach my $list_dir (@list_dir) + { + $current_directory = getcwd(); + + if( (-d $list_dir) && ( ! ($list_dir =~ m/^scilab_[a-z][a-z]_[A-Z][A-Z]_help$/ )) ) + { + get_xml_list($current_directory.'/'.$list_dir); + } + + if( (-f $list_dir) + && ($list_dir =~ m/\.xml$/) + && ($list_dir ne 'master.xml') + && ($list_dir ne 'master_help.xml') ) + { + $xmllist{$current_directory.'/'.$list_dir} = 1; + } + } + + chdir($previous_directory); +} + +# ============================================================================== +# valid +# ============================================================================== + +sub valid +{ + my $xmlfile = $_[0]; + + # construction de la commande + my $cmd = 'xmllint --noout --relaxng '.$rng.' '.$xmlfile.' '; + $cmd .= '> '.$tmp.' 2>&1'; + + # Lancement de la commande + system($cmd); + + # Vérification + + my $nb_error = 0; + my $error_str = ''; + + unless( open(TMP,$tmp) ) + { + print 'Le fichier '.$tmp.' n\'a pu être ouvert en lecture'."\n"; + del_tmp_file(); + exit(0); + } + + while(<TMP>) + { + if( $_ eq $xmlfile.' validates'."\n" ) + { + $nb_error = 0; + $error_str = ''; + last; + } + + if( (!($_ =~ m/IDREF attribute linkend references an unknown ID/)) && + (!($_ =~ m/Did not expect element ulink there/)) && + (!($_ =~ m/element imagedata: Relax-NG validity error :/)) && + (!( $_ =~ /fails to validate/)) ) + { + $nb_error++; + $error_str .= $_; + } + } + + close(TMP); + + if( $nb_error > 0 ) + { + $nb_bad_file++;; + $bad_file_list{$xmlfile} = $nb_error; + + print LOG "=================================================================\n"; + print LOG $xmlfile."\n"; + print LOG "=================================================================\n"; + print LOG $error_str; + } + + return $nb_error; +} diff --git a/modules/helptools/src/script/dispatchHelp.sh b/modules/helptools/src/script/dispatchHelp.sh new file mode 100755 index 000000000..e8ee6e81b --- /dev/null +++ b/modules/helptools/src/script/dispatchHelp.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# English is the reference. Update all other languages to put them at the right +# place. + +if test -z "$SCI"; then + echo "Please define the variable SCI" + exit 254 +fi + +REFERENCE_LANG=en_US +LANGS="ja_JP fr_FR pt_BR" + +ENGLISH_FILES=$(find modules/ -iname '*.xml'|grep "/help/$REFERENCE_LANG") + +for f in $ENGLISH_FILES; do + FILENAME=$(basename $f) + DIRNAME=$(dirname $f) + MODULENAME=$(echo $f|awk -F '/' '{print $1"/"$2}') + + # Check if the file already exists in other langs + for l in $LANGS; do + fTranslated=$(echo $f|sed -e "s|$REFERENCE_LANG|$l|") + + if test ! -f $fTranslated; then + # File not found. However, it might not have been translated + # Look if it the case or not + + # File found but at the wrong place + FOUNDFILE=$(find $MODULENAME -name $FILENAME|grep $l) + if test "$FOUNDFILE" != ""; then + # File found. + TARGET=$(echo $DIRNAME|sed -e "s|$REFERENCE_LANG|$l|") + if test ! -d $TARGET; then + echo "Creation of $TARGET" + mkdir $TARGET + fi + echo "mv $FOUNDFILE $TARGET" + mv $FOUNDFILE $TARGET + fi + + + fi + done +done |