Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mustafaquraish committed Apr 27, 2024
1 parent 88c453d commit 335a95f
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 28 deletions.
36 changes: 18 additions & 18 deletions compiler/parser.oc
Original file line number Diff line number Diff line change
Expand Up @@ -2312,24 +2312,24 @@ def Parser::include_prelude_only(&this) {
.program.c_embeds.insert(prelude_path, content.str())
}

// This function is a bit of a hot-mess, it needs to basically be completely re-thought,
// and combined with the logic from some of the other functions above.
//
// General Idea: Given an input file we are loading to the compiler, say `foo/bar/baz.oc`
// There's two possible options: It's either a standalone script or project.
// Definitions:
// - Standalone: One-file script, no project-relative imports etc allowed. We just load the file.
// - Project: A project is a collection of files where we are allowed to do project-relative imports.
// In order to work with project-relative imports, we need to know the project root. A project
// *must* define it's root by having a `main.oc` file in the root directory. No other file anywhere
// in the project should have the name `main.oc`.
//
// The `single_flag` file below is supposed to tell us whether we are loading a standalone file or a project.
// ***HOWEVER***: Currently, we don't really have a way of figuring this out automatically.
//
// Solution: We will naively try to traverse up the file system until we find a `main.oc` file. If we do, we
// consider it a project, and load the file as such. If we don't, we consider it a standalone file.
// In the future, we need to add flags to the compiler to be able to specify this.
//! This function is a bit of a hot-mess, it needs to basically be completely re-thought,
//! and combined with the logic from some of the other functions above.
//!
//! General Idea: Given an input file we are loading to the compiler, say `foo/bar/baz.oc`
//! There's two possible options: It's either a standalone script or project.
//! Definitions:
//! - Standalone: One-file script, no project-relative imports etc allowed. We just load the file.
//! - Project: A project is a collection of files where we are allowed to do project-relative imports.
//! In order to work with project-relative imports, we need to know the project root. A project
//! *must* define it's root by having a `main.oc` file in the root directory. No other file anywhere
//! in the project should have the name `main.oc`.
//!
//! The `single_flag` file below is supposed to tell us whether we are loading a standalone file or a project.
//! ***HOWEVER***: Currently, we don't really have a way of figuring this out automatically.
//!
//! Solution: We will naively try to traverse up the file system until we find a `main.oc` file. If we do, we
//! consider it a project, and load the file as such. If we don't, we consider it a standalone file.
//! In the future, we need to add flags to the compiler to be able to specify this.
def Parser::create_namespaces_for_initial_file(&this, filename: str, single_file: bool) {

// NOTE: We currently special-case the standard library path, since it's also a "project root"
Expand Down
8 changes: 8 additions & 0 deletions meta/gen_bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ else
exit 1
fi

echo "[+] Testing docgen"
if ./meta/gen_docs.sh /tmp/docs.json; then
echo
else
echo
echo "[-] Error: Docgen failed"
exit 1
fi

read -p "Are you sure you want to replace bootstrap/stage0.c? [y/N] " confirm
if [[ $confirm =~ ^[Yy]$ ]]; then
Expand Down
2 changes: 1 addition & 1 deletion std/bencode.oc
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def serialize_into(val: &Value, sb: &Buffer) {
}
sb += "e"
}
else => panic(`Unsupported Value type {val.type} in Bencode::serialize_into()`)
else => std::panic(`Unsupported Value type {val.type} in Bencode::serialize_into()`)
}
}

Expand Down
2 changes: 1 addition & 1 deletion std/image/draw.oc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import std::image::Image
import .{ Image, Color }

def line_f(img: &Image, x1: f32, y1: f32, x2: f32, y2: f32, color: Color) {
// line algorithm
Expand Down
16 changes: 9 additions & 7 deletions std/sdl/gfx.oc
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
@compiler c_include "SDL2/SDL2_gfxPrimitives.h"
@compiler c_flag "-lSDL2_gfx"

[extern "trigonColor"] def Renderer::draw_tri_color(&this, x1: i32, y1: i32, x2: i32, y2: i32, x3: i32, y3: i32, coloru32: u32)
[extern "filledTrigonColor"] def Renderer::fill_tri_color(&this, x1: i32, y1: i32, x2: i32, y2: i32, x3: i32, y3: i32, coloru32: u32)
[extern "polygonColor"] def Renderer::draw_poly_color(&this, vx: &i16, vy: &i16, n: i32, coloru32: u32)
[extern "filledPolygonColor"] def Renderer::fill_poly_color(&this, vx: &i16, vy: &i16, n: i32, coloru32: u32)
[extern "bezierColor"] def Renderer::draw_bezier(&this, vx: &i16, vy: &i16, n: i32, s: i32, coloru32: u32)
[extern "aacircleColor"] def Renderer::draw_circle_color(&this, x: i32, y: i32, r: i32, coloru32: u32)
[extern "filledCircleColor"] def Renderer::fill_circle_color(&this, x: i32, y: i32, r: i32, coloru32: u32)
import .{ Renderer }

[extern "trigonColor"] def std::sdl::Renderer::draw_tri_color(&this, x1: i32, y1: i32, x2: i32, y2: i32, x3: i32, y3: i32, coloru32: u32)
[extern "filledTrigonColor"] def std::sdl::Renderer::fill_tri_color(&this, x1: i32, y1: i32, x2: i32, y2: i32, x3: i32, y3: i32, coloru32: u32)
[extern "polygonColor"] def std::sdl::Renderer::draw_poly_color(&this, vx: &i16, vy: &i16, n: i32, coloru32: u32)
[extern "filledPolygonColor"] def std::sdl::Renderer::fill_poly_color(&this, vx: &i16, vy: &i16, n: i32, coloru32: u32)
[extern "bezierColor"] def std::sdl::Renderer::draw_bezier(&this, vx: &i16, vy: &i16, n: i32, s: i32, coloru32: u32)
[extern "aacircleColor"] def std::sdl::Renderer::draw_circle_color(&this, x: i32, y: i32, r: i32, coloru32: u32)
[extern "filledCircleColor"] def std::sdl::Renderer::fill_circle_color(&this, x: i32, y: i32, r: i32, coloru32: u32)
2 changes: 1 addition & 1 deletion std/sdl/image.oc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

import std::sdl::{ Renderer, Texture }

[extern "IMG_LoadTexture"] def Renderer::load_image(&this, path: str): &Texture
[extern "IMG_LoadTexture"] def std::sdl::Renderer::load_image(&this, path: str): &Texture
1 change: 1 addition & 0 deletions std/video_renderer/ffmpeg.oc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import std::vector::Vector
import std::image::{ Image, Color }
import std::mem
import std::libc:: {
pipe, fork, dup2, close, execvp, waitpid, write, exit,
WEXITSTATUS, WTERMSIG, WIFEXITED, WIFSIGNALED, STDIN_FILENO
Expand Down
1 change: 1 addition & 0 deletions std/video_renderer/mod.oc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Library to render/display video from a series of images
import std::sdl
import std::mem

import .ffmpeg::FFMPEGContext
import .sdl::SDLContext
Expand Down
1 change: 1 addition & 0 deletions std/video_renderer/sdl.oc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! SDL implementation for displaying video frames.
import std::sdl
import std::mem
import std::image::{Image, Color}

struct SDLContext {
Expand Down

0 comments on commit 335a95f

Please sign in to comment.