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

Commit

Permalink
Generate docs for everything
Browse files Browse the repository at this point in the history
Use `./meta/gen_docs.sh doc.json` to generate docs for all
the libraries
  • Loading branch information
mustafaquraish committed Jul 23, 2023
1 parent 3281b9d commit d1d9acb
Show file tree
Hide file tree
Showing 7 changed files with 222 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gen_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
run: |
cd ${{ github.workspace }}
mkdir -p build-docs
./bootstrap/ocen compiler/main.oc --docs build-docs/docs.json
./meta/gen_docs.sh build-docs/docs.json
- name: Copy
if: ${{ github.ref == 'refs/heads/master' }}
Expand Down
289 changes: 152 additions & 137 deletions bootstrap/stage0.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion examples/jpegify.oc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import std::fft::{ ffgat2, ifft2 }
import std::fft::{ fft2, ifft2 }
import std::math::{ TAU }
import std::image::Image
import std::vec::Vec
Expand Down
48 changes: 48 additions & 0 deletions meta/gen_docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

if [[ $# -eq 0 ]] ; then
echo 'Usage: ./meta/gen_docs.sh <output json path>'
exit 1
fi

cat > compiler/doc.oc << EOF
//* Dummy file to include all library documentation
//*
//* Nothing to see here
import std::buffer
import std::bufferio
import std::compact_map
import std::complex
import std::deque
import std::fft
import std::glut
import std::hash
import std::heap
import std::image
import std::json
import std::libc
import std::linkedlist
import std::map
import std::math
import std::sdl
import std::socket
import std::sort
import std::span
import std::thread
import std::value
import std::vec
import std::vector
// Compiler imports
import .ast::{ nodes, scopes, program }
import .passes
import .parser
import .utils
import .docgen
EOF

./bootstrap/ocen compiler/doc.oc --docs $1

rm compiler/doc.oc
12 changes: 0 additions & 12 deletions std/funcs.oc

This file was deleted.

18 changes: 18 additions & 0 deletions tests/sorting.oc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// exit: 0

import std::sort::sort

def main() {
let foo: [str; 4]
foo[0] = "foo"
foo[2] = "baz"
foo[3] = "quux"
foo[1] = "bar"

sort<str>(foo, 4)

assert foo[0].eq("bar")
assert foo[1].eq("baz")
assert foo[2].eq("foo")
assert foo[3].eq("quux")
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/// compile

struct Foo {}

def Foo::bar<T>(x: T): T => x


def main() {
Foo::bar<i32>(5)
Foo::bar<str>("hello")
Expand Down

0 comments on commit d1d9acb

Please sign in to comment.