Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
[Revert Commit]: 3c059c4
Browse files Browse the repository at this point in the history
This reverts commit 3c059c4.
  • Loading branch information
KTSnowy committed Feb 8, 2024
1 parent 3c059c4 commit d7a4022
Show file tree
Hide file tree
Showing 113 changed files with 20,121 additions and 8 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '0 0 * * MON'
workflow_dispatch:

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
80 changes: 80 additions & 0 deletions .github/workflows/compile-native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Compile Native Bindings

on: workflow_dispatch

jobs:
compile-linux-x64:
runs-on: ubuntu-latest
env:
COMMIT_MESSAGE: Automated Linux-x64 Build Files
COMMIT_AUTHOR: Continuous Integration
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.OTTERKIT_GITHUB_TOKEN }}

- name: Compile Native Bindings
run: |
cd Libraries/Otterkit.Native/nativelib
clang -shared -Wl,-rpath -fPIC -O3 -Wall -W -o ../build/nativelib.so allocator.c u8console.c decimals.c ../decNumber/decContext.c ../decNumber/decDouble.c ../decNumber/decQuad.c ../decNumber/decNumber.c ../decNumber/decimal128.c ../decNumber/decimal64.c
- name: GIT Commit Build Files
run: |
git config --global user.name "${{ env.COMMIT_AUTHOR }}"
git config --global user.email "[email protected]"
git pull
git add --all
git commit -m "${{ env.COMMIT_MESSAGE }}"
git push
compile-macos-x64:
runs-on: macos-latest
env:
COMMIT_MESSAGE: Automated macOS-x64 Build Files
COMMIT_AUTHOR: Continuous Integration
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.OTTERKIT_GITHUB_TOKEN }}

- name: Compile Native Bindings
run: |
cd Libraries/Otterkit.Native/nativelib
clang -dynamiclib -O3 -Wall -W -o ../build/nativelib.dylib allocator.c u8console.c decimals.c ../decNumber/decContext.c ../decNumber/decDouble.c ../decNumber/decQuad.c ../decNumber/decNumber.c ../decNumber/decimal128.c ../decNumber/decimal64.c
- name: GIT Commit Build Files
run: |
git config --global user.name "${{ env.COMMIT_AUTHOR }}"
git config --global user.email "[email protected]"
git pull
git add --all
git commit -m "${{ env.COMMIT_MESSAGE }}"
git push
compile-windows-x64:
runs-on: windows-latest
env:
COMMIT_MESSAGE: Automated Windows-x64 Build Files
COMMIT_AUTHOR: Continuous Integration
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.OTTERKIT_GITHUB_TOKEN }}

- name: Compile Native Bindings
shell: cmd
run: |
cd Libraries\Otterkit.Native\nativelib
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cl.exe /O2 /LD /Fe:..\build\nativelib.dll allocator.c u8console.c decimals.c ..\decNumber\decContext.c ..\decNumber\decDouble.c ..\decNumber\decQuad.c ..\decNumber\decNumber.c ..\decNumber\decimal128.c ..\decNumber\decimal64.c
- name: GIT Commit Build Files
run: |
git config --global user.name "${{ env.COMMIT_AUTHOR }}"
git config --global user.email "[email protected]"
git add --all
git commit -m "${{ env.COMMIT_MESSAGE }}"
git push
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

# Otterkit compiler files
.otterkit/
nupkg/
publish/

# COBOL source files
*.cob
*.cbl
*.cpy

# Build files
nativeBindings/*.dylib
nativeBindings/*.dll
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2024 Gabriel Gonçalves <[email protected]>
Copyright 2022 Gabriel Gonçalves <[email protected]>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
6 changes: 6 additions & 0 deletions Libraries/Otterkit.Extensions/Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Otterkit.Extensions;

public static class Extensions
{

}
9 changes: 9 additions & 0 deletions Libraries/Otterkit.Extensions/Otterkit.Extensions.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
36 changes: 36 additions & 0 deletions Libraries/Otterkit.Extensions/comp3.gnomes
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
EXTENSION-GNOMES SECTION.

COMP3-PARSING.
USE ON USAGE-CLAUSE DURING PARSING

IF VALUE EQUALS COMP-3
REPLACE [WITH] PACKED-DECIMAL
CONTINUE
END-IF

COMP6-PARSING.
USE [ON] USAGE-CLAUSE [DURING] PARSING

IF CURRENT [VALUE] EQUALS COMP-6 [THEN]
REPLACE [BY] PACKED-DECIMAL
INSERT [TOKEN] NO
INSERT [TOKEN] SIGN
CONTINUE 3
END-IF

AUTHOR-PARSING.
USE [ON] IDENTIFICATION [DURING] PARSING

IF CURRENT [VALUE] EQUALS AUTHOR [THEN]
CONTINUE
EXPECTED SEPARATOR-PERIOD

REMOVE PREVIOUS 2 [TOKENS]

IF CURRENT TYPE EQUALS IDENTIFIER [THEN]
CONTINUE
EXPECTED SEPARATOR-PERIOD

REMOVE PREVIOUS 2 [TOKENS]
END-IF
END-IF
57 changes: 57 additions & 0 deletions Libraries/Otterkit.Extensions/extensiontest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[
{
"name": "COMP3-PARSING",
"use": "USAGE-CLAUSE",
"during": "PARSING",
"steps": [
"IF VALUE",
"COMP-3",
"REPLACE",
"PACKED-DECIMAL",
"CONTINUE",
"END-IF"
]
},
{
"name": "COMP6-PARSING",
"use": "USAGE-CLAUSE",
"during": "PARSING",
"steps": [
"IF VALUE",
"COMP-6",
"REPLACE",
"PACKED-DECIMAL",
"INSERT",
"NO",
"INSERT",
"SIGN",
"CONTINUE",
"CONTINUE",
"CONTINUE",
"END-IF"
]
},
{
"name": "AUTHOR-PARSING",
"use": "IDENTIFICATION",
"during": "PARSING",
"steps": [
"IF VALUE",
"AUTHOR",
"CONTINUE",
"EXPECTED",
"SEPARATOR-PERIOD",
"REMOVE PREVIOUS",
"REMOVE PREVIOUS",
"IF TYPE",
"IDENTIFIER",
"CONTINUE",
"EXPECTED",
"SEPARATOR-PERIOD",
"REMOVE PREVIOUS",
"REMOVE PREVIOUS",
"END-IF",
"END-IF"
]
}
]
21 changes: 21 additions & 0 deletions Libraries/Otterkit.Native/src/Allocator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Runtime.InteropServices;

namespace Otterkit.Native;

public static unsafe partial class Allocator
{
public static int StackUsage => GetStackUsage();
public static int StackFree => GetStackFree();

[LibraryImport("nativelib", EntryPoint = "GetStackUsage")]
private static partial int GetStackUsage();

[LibraryImport("nativelib", EntryPoint = "GetStackFree")]
private static partial int GetStackFree();

[LibraryImport("nativelib", EntryPoint = "Alloc")]
public static partial byte* Alloc(int length);

[LibraryImport("nativelib", EntryPoint = "Dealloc")]
public static partial void Dealloc(byte* memory);
}
47 changes: 47 additions & 0 deletions Libraries/Otterkit.Native/src/Otterkit.Native.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Optimize>true</Optimize>
<Deterministic>true</Deterministic>
<PublishRelease>true</PublishRelease>
<!-- <PublishAot>true</PublishAot> -->
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>$(NoWarn);NU5100</NoWarn>
</PropertyGroup>

<PropertyGroup>
<PackRelease>true</PackRelease>
<PackageId>Otterkit.Native</PackageId>
<PackageOutputPath>./nupkg</PackageOutputPath>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Version>1.7.80</Version>
<Copyright>Copyright (c) Otterkit 2023</Copyright>
<Authors>Otterkit Authors</Authors>
<Company>Otterkit Project</Company>
<PackageIcon>OtterkitIcon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>Otterkit;COBOL;Native;Library</PackageTags>
<PackageProjectUrl>https://github.com/otterkit</PackageProjectUrl>
<RepositoryUrl>https://github.com/otterkit/libotterkit</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<Description>
This package contains native interop methods for Otterkit's runtime library.
</Description>
</PropertyGroup>

<ItemGroup>
<None Include="../../../Assets/OtterkitIcon.png" Pack="true" PackagePath="/" />
<None Include="../README.md" Pack="true" PackagePath="/" />
</ItemGroup>

<ItemGroup>
<Content Include="../build/nativelib.*" Pack="true" PackagePath="/">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<PackageCopyToOutput>true</PackageCopyToOutput>
</Content>
</ItemGroup>

</Project>
Loading

0 comments on commit d7a4022

Please sign in to comment.