add src-space/* and clear src files

This commit is contained in:
2025-05-12 05:18:28 +09:00
parent 2f2e0759fd
commit 9e38b7ca63
13 changed files with 90 additions and 73 deletions

3
.gitignore vendored
View File

@@ -31,3 +31,6 @@ __pycache__
*.pyc
target
state.yml
config.yml

View File

@@ -35,15 +35,19 @@ yenru0 code storage
* `run`
```sh
# workspace로 불러오는 file
run load 1000 to py # load 1000.py from python repository
# if there loaded file
run load 1000.py # run type inference by extension
run load 1000.py from zeta # default is `zeta`/*
run load 1000.rs from zeta/c-
run load 1000.rs from zet
run export 1000.py --to zeta/completed
# 테스트 케이스 생성 with count=5
run init 5
# workspace로 불러오는 file
run load 1000 --to py # load 1000.py from python source space
# if there loaded file
run load 1000.py # language inference by extension
run load 1000.py --from zeta
run load 1000.rs --from zeta --force # already in src space force overwrite
run export --from c --completed
run time rust.it

View File

@@ -1 +0,0 @@
curret-source =

View File

@@ -1,17 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
int fib(int n) {
if (n == 1 || n == 0) {
return n;
} else {
return fib(n - 1) + fib(n - 2);
}
}
int main() {
int temp;
scanf("%d", &temp);
printf("%d\n", fib(temp));
return 0;
}

View File

@@ -1,17 +0,0 @@
#include <iostream>
int fib(int n) {
if (n == 0 || n == 1) {
return n;
}
return fib(n - 1) + fib(n - 2);
}
int main() {
int temp;
std::cin >> temp;
std::cout << fib(temp) << std::endl;
return 0;
}

View File

@@ -1,6 +1,3 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.archivesName
plugins {
val kotlinVersion = "1.9.10"
kotlin("jvm") version kotlinVersion
@@ -52,6 +49,9 @@ tasks.named<Jar>("jar") {
manifest {
attributes["Main-Class"] = "MainKt"
}
from(configurations.runtimeClasspath.get().map { if(it.isDirectory) it else zipTree(it)})
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
finalizedBy("copyJarToBuild")
}

View File

@@ -1,13 +0,0 @@
import java.util.Scanner
fun fib(n: Int): Int {
if (n == 0 || n == 1) {
return n
} else return fib(n - 1) + fib(n - 2)
}
fun main() {
val sc = Scanner(System.`in`)
val n = sc.nextInt()
println(fib(n))
}

View File

@@ -6,8 +6,10 @@ TARGET = main.lua
BUILD_DIR = ../../build
OUTPUT = lua.luac
build:
${CC} -o ${BUILD_DIR}/lua.luac ${SRC_DIR}/${TARGET}
${CC} -o ${BUILD_DIR}/$(OUTPUT) ${SRC_DIR}/${TARGET}
run: build
lua ${BUILD_DIR}/lua.luac
lua ${BUILD_DIR}/$(OUTPUT)

View File

@@ -1,11 +0,0 @@
local function fib(n)
if n == 0 or n == 1 then
return n
else
return fib(n - 1) + fib(n - 2)
end
end
local n = io.read("*n")
print(fib(n))

33
space/src-py/make.py Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env python3
import py_compile
import click
SRC_DIR = r"./src"
TARGET = r"main.py"
OUTPUT = r"py.pyc"
BUILD_DIR = r"../../build"
@click.group()
def cli():
pass
@click.command(name="build")
def build():
try:
py_compile.compile(
f"{SRC_DIR}/{TARGET}", f"{BUILD_DIR}/{OUTPUT}", optimize=2, doraise=True
)
except Exception as e:
raise click.ClickException(e)
cli.add_command(build)
if __name__ == "__main__":
cli()

7
space/src-rs/Cargo.lock generated Normal file
View File

@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "srcrs"
version = "0.1.0"

9
space/src-rs/Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "srcrs"
version = "0.1.0"
edition = "2021"
[dependencies]
[profile.dev]
opt-level = 2

18
space/src-rs/build.rs Normal file
View File

@@ -0,0 +1,18 @@
use std::env;
use std::fs;
use std::path::Path;
fn main() {
let target_dir = env::var("CARGO_TARGET_DIR").unwrap_or_else(|_| "target".to_string());
let profile = env::var("PROFILE").unwrap();
let exe_name = env::var("CARGO_PKG_NAME").unwrap();
println!("cargo::warning={}", profile);
let target_path = Path::new(&target_dir).join(&profile).join(&exe_name);
let dest_path = Path::new("../../build").join("rs.out");
if target_path.exists() {
fs::copy(&target_path, &dest_path).expect("Failed to copy executable");
}
}