Skip to content

Commit

Permalink
Merge pull request #70 from arturo-lang/code-cleanup
Browse files Browse the repository at this point in the history
Code cleanup
  • Loading branch information
drkameleon authored Feb 4, 2021
2 parents e1ad9a6 + 34535af commit 41882d1
Show file tree
Hide file tree
Showing 48 changed files with 1,311 additions and 3,722 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
/.cache
.gitattributes
test
test.nim
test.nim
test.art
old.nim
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ The list of things to fix and/or add could be endless. But here is one, a bit pr
Contributing
------------------------------

Please read [CONTRIBUTING.md](https://github.com/arturo-lang/arturo/blob/master/CONTRIBUTING.md) for more details and the process for submitting pull requests.
Please read [docs/CONTRIBUTING.md](https://github.com/arturo-lang/arturo/blob/master/docs/CONTRIBUTING.md) for more details and the process for submitting pull requests.

**In a few words:** all contributions (even if they are just ideas or suggestions) are 100% welcome!

Expand Down
9 changes: 3 additions & 6 deletions arturo.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
# Arturo
# Programming Language + Bytecode VM compiler
# (c) 2020 Arturo Contributors
# (c) 2021 Yanis Zafirópulos
#
# @file: arturo.nimble
######################################################

# Package

version = "0.9.4"
author = "arturo-lang"
version = static readFile("version/version")
author = "Yanis Zafirópulos"
description = "Simple, modern and portable interpreted programming language for efficient scripting"
license = "MIT"
srcDir = "src"
Expand All @@ -19,7 +20,3 @@ binDir = "bin"
# Dependencies

requires "nim >= 1.4.0"

task buildJS, "build with js backend":
switch("d", "WEB")
selfExec "js src/arturo.nim"
179 changes: 0 additions & 179 deletions build.sh

This file was deleted.

47 changes: 14 additions & 33 deletions config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,27 @@
# Arturo
# Programming Language + Bytecode VM compiler
# (c) 2020 Arturo Contributors
# (c) 2021 Yanis Zafirópulos
#
# @file: config.nims
######################################################

#switch("warning[UnusedImport]", "off")
switch("checks", "off")
switch("cincludes", "extras")
switch("colors", "off")
#switch("d", "PYTHONIC")
switch("d", "danger")
switch("d", "release")
switch("d", "ssl")
switch("embedsrc", "on")
switch("gc", "orc")
#switch("nimcache", ".cache")
switch("opt", "speed")
switch("overflowChecks", "on")
switch("panics", "off")
switch("threads", "on")
switch("threadAnalysis", "off")
switch("hints", "off")
switch("colors","off")
switch("d","release")
switch("d","danger")
switch("panics","off")
switch("gc","orc")
switch("checks","off")
switch("overflowChecks","on")
switch("d","ssl")
switch("passC","-O3")
switch("cincludes","extras")
switch("nimcache",".cache")
switch("embedsrc","on")
switch("path","src")

when not defined DEBUG:
switch("passC", "-O3")

when defined MINI:
switch("opt", "size")
elif defined VERBOSE:
switch("opt", "speed")
elif defined BENCHMARK:
switch("opt", "speed")
elif defined DEBUG:
switch("linedir", "on")
switch("debugger", "on")
switch("debuginfo", "on")
elif defined PROFILE:
switch("debuginfo", "on")
switch("profiler", "on")
switch("stackTrace", "on")
elif defined WEB:
discard
else:
switch("opt", "speed")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
26 changes: 3 additions & 23 deletions install
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# @file: install
######################################################

source utils.sh
source tools/utils.sh

################################################
# FUNCTIONS
Expand Down Expand Up @@ -80,20 +80,6 @@ fi

CONFIG=""
#--warning[UnusedImport]:off\
FLAGS="\
--colors:off\
-d:release\
-d:danger\
--panics:off\
--gc:orc\
--checks:off\
--overflowChecks:on\
-d:ssl\
--passC:"-O3"\
--cincludes:extras\
--nimcache:.cache\
--embedsrc:on\
--path:src"

# check switches

Expand Down Expand Up @@ -133,17 +119,11 @@ else
FLAGS="$FLAGS --opt:speed"
fi

# if $IS_DEV_BUILD; then
# FLAGS="$FLAGS --hint[Performance]:off"
# else
# if ! $PRINT_LOG; then
# FLAGS="$FLAGS --hints:off"
# fi
# fi

if $IS_DEV_BUILD; then
awk '{sub(/[[:digit:]]+$/,$NF+1)}1' version/build > version/build_tmp && mv version/build_tmp version/build
git commit -m 'build update' version/build

FLAGS="$FLAGS -d:DEV"
fi

################################################
Expand Down
2 changes: 1 addition & 1 deletion package
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# @file: package
######################################################

source utils.sh
source tools/utils.sh

################################################
# FUNCTIONS
Expand Down
11 changes: 4 additions & 7 deletions src/arturo.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@
# Libraries
#=======================================

import parseopt, segFaults, tables

when defined(PROFILE):
import nimprof

import parseopt, segFaults, tables

import vm/[version, value, vm]

when defined(BENCHMARK):
import utils

#=======================================
# Types
#=======================================
Expand All @@ -34,13 +31,13 @@ type
showVersion

#=======================================
# Globals
# Constants
#=======================================

# -o --output Compile script and write bytecode
# -i --input Execute script from bytecode

let helpTxt = """
const helpTxt = """
Usage:
arturo [options] <path>
Expand Down
5 changes: 3 additions & 2 deletions src/helpers/datasource.nim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Libraries
#=======================================

import httpClient, os
import asyncdispatch, httpClient, os

import helpers/url as UrlHelper

Expand All @@ -32,7 +32,8 @@ type

proc getSource*(src: string): DataSource {.inline.} =
if src.isUrl():
result = (newHttpClient().getContent(src), WebData)
let content = waitFor (newAsyncHttpClient().getContent(src))
result = (content, WebData)
elif src.fileExists():
result = (readFile(src), FileData)
else:
Expand Down
Loading

0 comments on commit 41882d1

Please sign in to comment.