about summary refs log blame commit diff stats
path: root/html/archive/2.vm/f2c-2.png
blob: 23a2fd380b1659081ded20be618bab61d3ca30dc (plain) (tree)
blob is binary.
evem662@gmail.com> 2023-08-15 18:35:19 +0200 Move HTML parsing into Chame' href='/ahoang/chawan/commit/src/version.nim?id=aea27f52335d203f8acfed3f2113ab0e61cdafd5'>aea27f52 ^
6b0b7ccf ^


aea27f52 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

























                                                                           
                                


                                  
                                
{.used.}

import macros

template imp(x: untyped) = import x

macro tryImport(x: untyped, name: static string) =
  let vs = ident(name & "Version")
  quote do:
    when not compiles(imp `x`):
      static:
        error("Cannot find submodule " & `name` & ".\n" &
          "Please run `make submodule` to fetch the required submodules.")
    import `x` as `vs`

macro checkVersion(xs: static string, major, minor, patch: int) =
  let x = ident(xs & "Version")
  quote do:
    when `x`.Major < `major` or `x`.Minor < `minor` or `x`.Patch < `patch`:
      var es = $`major` & "." & $`minor` & "." & $`patch`
      var gs = $`x`.Major & "." & $`x`.Minor & "." & $`x`.Patch
      error("Version of " & `xs` & " too low (expected " & es & ", got " &
        gs & ").\n" &
        "Please run `make submodule` to update.")

tryImport chakasu/version, "chakasu"
tryImport chame/version, "chame"

static:
  checkVersion("chakasu", 0, 1, 2)
  checkVersion("chame", 0, 9, 3)