Skip to content

Commit ca34692

Browse files
committed
Added the jsowl-cgi project
1 parent 0698c2d commit ca34692

File tree

5 files changed

+137
-0
lines changed

5 files changed

+137
-0
lines changed

src/jsowl-cgi/Compiler.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using libjsowl;
3+
4+
namespace jsowlcgi
5+
{
6+
public class Compiler
7+
{
8+
Lexer lex;
9+
CodeGen gen;
10+
Beautifier sexify;
11+
12+
public Compiler () {
13+
lex = new Lexer ((reason) => { Console.WriteLine ("// ERROR."); });
14+
gen = new CodeGen (CompilerOptions.None);
15+
sexify = new Beautifier ();
16+
}
17+
18+
public string Run (string content) {
19+
string src;
20+
lex.FeedSource (content);
21+
src = gen.Feed (lex.tokens);
22+
src = sexify.Feed (src);
23+
return src;
24+
}
25+
}
26+
}
27+

src/jsowl-cgi/Program.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.IO;
3+
using System.Net;
4+
using System.Net.Sockets;
5+
using System.Net.WebSockets;
6+
using System.Text;
7+
8+
namespace jsowlcgi
9+
{
10+
class MainClass
11+
{
12+
[STAThread]
13+
public static void Main (string[] args)
14+
{
15+
Console.Write ("Content-Type: text/javascript\n\n");
16+
string path = Environment.GetEnvironmentVariable ("PATH_TRANSLATED");
17+
if (File.Exists (path)) {
18+
string input = string.Empty;
19+
using (FileStream FILE = new FileStream (path, FileMode.Open)) {
20+
using (StreamReader reader = new StreamReader (FILE)) {
21+
input = reader.ReadToEnd ();
22+
}
23+
}
24+
Compiler compiler = new Compiler ();
25+
string src = compiler.Run (input);
26+
Console.WriteLine (src);
27+
}
28+
}
29+
}
30+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
4+
// Information about this assembly is defined by the following attributes.
5+
// Change them to the values specific to your project.
6+
7+
[assembly: AssemblyTitle ("jsowl-cgi")]
8+
[assembly: AssemblyDescription ("")]
9+
[assembly: AssemblyConfiguration ("")]
10+
[assembly: AssemblyCompany ("")]
11+
[assembly: AssemblyProduct ("")]
12+
[assembly: AssemblyCopyright ("SplittyDev")]
13+
[assembly: AssemblyTrademark ("")]
14+
[assembly: AssemblyCulture ("")]
15+
16+
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17+
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
18+
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
19+
20+
[assembly: AssemblyVersion ("1.0.*")]
21+
22+
// The following attributes are used to specify the signing key for the assembly,
23+
// if desired. See the Mono documentation for more information about signing.
24+
25+
//[assembly: AssemblyDelaySign(false)]
26+
//[assembly: AssemblyKeyFile("")]
27+

src/jsowl-cgi/jsowl-cgi.csproj

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProjectGuid>{6A6A7C17-704D-48C3-BC28-967EE3607A20}</ProjectGuid>
7+
<OutputType>Exe</OutputType>
8+
<RootNamespace>jsowlcgi</RootNamespace>
9+
<AssemblyName>jsowl-cgi</AssemblyName>
10+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11+
</PropertyGroup>
12+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
13+
<DebugSymbols>true</DebugSymbols>
14+
<DebugType>full</DebugType>
15+
<Optimize>false</Optimize>
16+
<OutputPath>..\bin\Debug</OutputPath>
17+
<DefineConstants>DEBUG;</DefineConstants>
18+
<ErrorReport>prompt</ErrorReport>
19+
<WarningLevel>4</WarningLevel>
20+
<PlatformTarget>x86</PlatformTarget>
21+
<Externalconsole>true</Externalconsole>
22+
</PropertyGroup>
23+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
24+
<DebugType>full</DebugType>
25+
<Optimize>true</Optimize>
26+
<OutputPath>..\bin\Release</OutputPath>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
<PlatformTarget>x86</PlatformTarget>
30+
<Externalconsole>true</Externalconsole>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Reference Include="System" />
34+
</ItemGroup>
35+
<ItemGroup>
36+
<Compile Include="Program.cs" />
37+
<Compile Include="Properties\AssemblyInfo.cs" />
38+
<Compile Include="Compiler.cs" />
39+
</ItemGroup>
40+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
41+
<ItemGroup>
42+
<ProjectReference Include="..\libjsowl\libjsowl.csproj">
43+
<Project>{70F6F984-CDE0-494B-B8AA-158D586CFE0F}</Project>
44+
<Name>libjsowl</Name>
45+
</ProjectReference>
46+
</ItemGroup>
47+
</Project>

src/jsowl.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jsowl", "jsowl\jsowl.csproj
55
EndProject
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "libjsowl", "libjsowl\libjsowl.csproj", "{70F6F984-CDE0-494B-B8AA-158D586CFE0F}"
77
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "jsowl-cgi", "jsowl-cgi\jsowl-cgi.csproj", "{6A6A7C17-704D-48C3-BC28-967EE3607A20}"
9+
EndProject
810
Global
911
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1012
Debug|x86 = Debug|x86
1113
Release|x86 = Release|x86
1214
EndGlobalSection
1315
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{6A6A7C17-704D-48C3-BC28-967EE3607A20}.Debug|x86.ActiveCfg = Debug|x86
17+
{6A6A7C17-704D-48C3-BC28-967EE3607A20}.Debug|x86.Build.0 = Debug|x86
18+
{6A6A7C17-704D-48C3-BC28-967EE3607A20}.Release|x86.ActiveCfg = Release|x86
19+
{6A6A7C17-704D-48C3-BC28-967EE3607A20}.Release|x86.Build.0 = Release|x86
1420
{70F6F984-CDE0-494B-B8AA-158D586CFE0F}.Debug|x86.ActiveCfg = Debug|Any CPU
1521
{70F6F984-CDE0-494B-B8AA-158D586CFE0F}.Debug|x86.Build.0 = Debug|Any CPU
1622
{70F6F984-CDE0-494B-B8AA-158D586CFE0F}.Release|x86.ActiveCfg = Release|Any CPU

0 commit comments

Comments
 (0)