Skip to content

Commit

Permalink
add comments, rename vm to dynloader
Browse files Browse the repository at this point in the history
Signed-off-by: George Lemon <[email protected]>
  • Loading branch information
georgelemon committed May 14, 2024
1 parent 354c2f9 commit f8fffc2
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 39 deletions.
6 changes: 6 additions & 0 deletions src/tim/app/astCmd.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# A super fast template engine for cool kids
#
# (c) 2024 George Lemon | LGPL-v3 License
# Made by Humans from OpenPeeps
# https://github.com/openpeeps/tim

import std/os
import pkg/flatty
import pkg/kapsis/[cli, runtime]
Expand Down
8 changes: 7 additions & 1 deletion src/tim/app/jitCmd.nim
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# A super fast template engine for cool kids
#
# (c) 2024 George Lemon | LGPL-v3 License
# Made by Humans from OpenPeeps
# https://github.com/openpeeps/tim

import std/[osproc, os]
import pkg/flatty
import pkg/kapsis/[runtime, cli]

import ../engine/[parser, ast]
import ../engine/compilers/nimc
import ../server/vm
import ../server/dynloader

proc binCommand*(v: Values) =
## Execute Just-in-Time compilation of the specifie
Expand Down
6 changes: 6 additions & 0 deletions src/tim/app/liveCmd.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# A super fast template engine for cool kids
#
# (c) 2024 George Lemon | LGPL-v3 License
# Made by Humans from OpenPeeps
# https://github.com/openpeeps/tim

import std/[os, strutils]
import pkg/nyml
import pkg/kapsis/[cli, runtime]
Expand Down
6 changes: 6 additions & 0 deletions src/tim/app/reprCmd.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# A super fast template engine for cool kids
#
# (c) 2024 George Lemon | LGPL-v3 License
# Made by Humans from OpenPeeps
# https://github.com/openpeeps/tim

import std/[os, strutils]
import pkg/flatty
import pkg/kapsis/[cli, runtime]
Expand Down
41 changes: 7 additions & 34 deletions src/tim/app/srcCmd.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# A super fast template engine for cool kids
#
# (c) 2024 George Lemon | LGPL-v3 License
# Made by Humans from OpenPeeps
# https://github.com/openpeeps/tim

import std/[os, strutils]
import pkg/kapsis/[cli, runtime]
import ../engine/parser
Expand Down Expand Up @@ -41,37 +47,4 @@ proc srcCommand*(v: Values) =
for err in p.logger.errors:
display(err)
displayInfo p.logger.filePath
quit(1)


# import std/critbits

# type
# ViewHandle* = proc(): string
# LayoutHandle* = proc(viewHtml: string): string
# ViewsTree* = CritBitTree[ViewHandle]
# LayoutsTree* = CritBitTree[LayoutHandle]

# proc getIndex(): string =
# result = "view html"

# var views = ViewsTree()
# views["index"] = getIndex

# proc getBaseLayout(viewHtml: string): string =
# result = "start layout"
# add result, viewHtml
# add result, "end layout"

# var layouts = LayoutsTree()
# layouts["base"] = getBaseLayout

# template render*(viewName: string, layoutName = "base"): untyped =
# if likely(views.hasKey(viewName)):
# let viewHtml = views[viewName]()
# if likely(layouts.hasKey(layoutName)):
# layouts[layoutName](viewHtml)
# else: ""
# else: ""

# echo render("index")
quit(1)
8 changes: 7 additions & 1 deletion src/tim/server/app.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# A super fast template engine for cool kids
#
# (c) 2024 George Lemon | LGPL-v3 License
# Made by Humans from OpenPeeps
# https://github.com/openpeeps/tim

import std/[os, strutils, sequtils, json, critbits]
import pkg/[zmq, watchout, jsony]
import pkg/kapsis/[cli]
Expand Down Expand Up @@ -208,4 +214,4 @@ proc run*(engine: var TimEngine, config: TimConfig) =
discard existsOrCreateDir(config.output / "layouts")
discard existsOrCreateDir(config.output / "partials")
display("Tim Engine is running Source-to-Source")
engine.precompile(config, newJObject())
engine.precompile(config, newJObject())
6 changes: 6 additions & 0 deletions src/tim/server/config.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# A super fast template engine for cool kids
#
# (c) 2024 George Lemon | LGPL-v3 License
# Made by Humans from OpenPeeps
# https://github.com/openpeeps/tim

from std/net import Port, `$`
export `$`

Expand Down
5 changes: 2 additions & 3 deletions src/tim/server/vm.nim → src/tim/server/dynloader.nim
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# A super fast template engine for cool kids
#
# (c) 2023 George Lemon | LGPL License
# (c) 2024 George Lemon | LGPL-v3 License
# Made by Humans from OpenPeeps
# https://github.com/openpeeps/tim

## This module implements a high-performance Just-in-Time
import std/[tables, dynlib, json]
type
DynamicTemplate = object
Expand All @@ -17,7 +16,7 @@ type

when defined macosx:
const ext = ".dylib"
elif windows:
elif defined windows:
const ext = ".dll"
else:
const ext = ".so"
Expand Down

0 comments on commit f8fffc2

Please sign in to comment.