summary refs log tree commit diff stats
path: root/lib
Commit message (Expand)AuthorAgeFilesLines
* fixes macros.quote documentation; doubling of the escape operator never worked!Araq2019-05-051-3/+1
* iterators: several small fixes (#11162)Miran2019-05-041-24/+51
* tables: check for mutation when iterating (#11160)Miran2019-05-041-42/+127
* Fix ..< iterator (#11103)Arne Döring2019-05-031-0/+14
* introduce temporary <//> for 'owned' to get this compile with 0.19 (#11145)Andreas Rumpf2019-05-025-23/+33
* Fix ospaths import error (#11150)genotrance2019-05-012-2/+2
* Fix unexpected result of rand on a range, fixes #11015 (#11035)Jasper Jenkins2019-04-301-8/+14
* added system.unown to make 'owned' sane to use in practice; later on we might...Araq2019-04-291-1/+6
* streams: Update documentation, refs #10330 (#11059)jiro2019-04-291-81/+832
* Initialized collections (#11094)Miran2019-04-296-424/+650
* reimplement_pr_10974 (#11130)cooldome2019-04-271-0/+16
* add progmas to params of macros.newProc (#11025)Lolo Iccl2019-04-271-3/+7
* newruntime: make 'discard new RootObj' workAraq2019-04-261-1/+1
* make seq.add more effective for --newruntimeAraq2019-04-252-12/+15
* Fix: remove pragma inline from parseBin|Oct|Hex (#11105)Alvydas Vitkauskas2019-04-241-3/+3
* Make parseutils.parseBin|Oct|Hex generic (#11067)Alvydas Vitkauskas2019-04-241-69/+114
* Add missing `deprecated` pragma (#11100) [ci skip]Oscar Nihlgård2019-04-241-1/+1
* newruntime: fix for -d:useMallocAndreas Rumpf2019-04-231-1/+2
* fixes #1192Araq2019-04-231-0/+7
* deprecate programResult, avoid exposing in standalone mode (#11075)Jacek Sieka2019-04-231-6/+4
* fixes #11089Araq2019-04-231-1/+7
* strformat: minor style changesAraq2019-04-231-4/+4
* tables: fix link (#11090) [ci skip]Jjp1372019-04-231-1/+1
* Fix header inconsistencies in documentation (#11071)Zed2019-04-2317-98/+95
* fixes #11065Araq2019-04-221-7/+20
* system.nim: copyMem and friends do not raise any exceptionAraq2019-04-221-4/+6
* Documentation import fixes (#11070)Zed2019-04-212-29/+23
* make -d:nimQuirky work with develAndreas Rumpf2019-04-202-1/+3
* hotfix: nimParseBiggestFloat needs to be patched for the newer string impleme...Andreas Rumpf2019-04-201-20/+20
* Improve tables docs for del/take (#11030)Christopher Dunn2019-04-171-1/+5
* faster CountTable sort(), optional SortOrder (#11010)Andy Davidoff2019-04-161-27/+30
* Add len check for newIfStmt to avoid segfault (#11032)Jasper Jenkins2019-04-151-0/+2
* fixes another regression; the behaviour of 'array' formatting was changedAraq2019-04-151-8/+0
* fixes #11012Araq2019-04-151-28/+10
* added system.disarm (experimental)Araq2019-04-121-0/+7
* fixes #11005Araq2019-04-121-3/+3
* Compiler plugin for implementing incremental computation in user space (#10819)cooldome2019-04-113-1/+29
* fixes #10765 (#10993) [backport]cooldome2019-04-111-4/+21
* random: works for slices and enums, fixes #7698 (#10998)Miran2019-04-111-3/+3
* Make `secureHash` accept any `openArray[char]`, not only `string`. (#10988)c-blake2019-04-101-1/+1
* rst: parse brackets individually, fixes #10475 (#10997)Miran2019-04-101-6/+17
* json: add '\v' support, fixes #10541 (#10987)Miran2019-04-102-0/+4
* enable most tnewruntime_strutils testsAraq2019-04-101-1/+1
* strutils.nim: fixes the indentation of formatEngAraq2019-04-101-5/+5
* newruntime: fixes another bugAraq2019-04-102-3/+2
* newruntime: fixes memory leakAraq2019-04-091-3/+4
* strs.nim: fixed a silly typoAraq2019-04-091-1/+1
* make tests green againAraq2019-04-091-2/+6
* add strformat limitations section (#10982)Arne Döring2019-04-091-0/+59
* allocators.nim: use zero initializationAndreas Rumpf2019-04-081-3/+8
141




                                                    
                                  






                                                     


                                                                                                
 
                                                           





                                                                                            
                                                          






























































                                                                                                      
                                                                                                     
                                  
                 










                                                                                                
                                                                                               
 



                                       

               
 


                                                                         


                           
                                                    


                                                              
 
















                                                                                            
 
      
#!/bin/sh
# returns 0 on successful build or nothing to build
# non-zero exit status only on error during building
set -e  # stop immediately on error

# [0-9]*.cc -> subx.cc -> subx_bin
# (layers)   |          |
#          tangle      $CXX

# can also be called with a layer to only build until
#   $ ./build --until 050
UNTIL_LAYER=${2:-zzz}

# we use two mechanisms to speed up rebuilds:
# - older_than: run a command if the output is older than any of the inputs
# - update: if a command is quick to run, always run it but update the result only on any change
#
# avoid combining both mechanisms to generate a single file
# otherwise you'll see spurious messages about files being updated
# risk: a file may unnecessarily update without changes, causing unnecessary work downstream

test "$CXX" || export CXX=c++
test "$CC" || export CC=cc
test "$CFLAGS" || export CFLAGS="-g -O3"
export CFLAGS="$CFLAGS -Wall -Wextra -fno-strict-aliasing"

# return 1 if $1 is older than _any_ of the remaining args
older_than() {
  local target=$1
  shift
  if [ ! -e $target ]
  then
#?     echo "$target doesn't exist"
    echo "updating $target" >&2
    return 0  # success
  fi
  local f
  for f in $*
  do
    if [ $f -nt $target ]
    then
      echo "updating $target" >&2
      return 0  # success
    fi
  done
  return 1  # failure
}

# redirect to $1, unless it's already identical
update() {
  if [ ! -e $1 ]
  then
    cat > $1
  else
    cat > $1.tmp
    diff -q $1 $1.tmp >/dev/null  &&  rm $1.tmp  ||  mv $1.tmp $1
  fi
}

update_cp() {
  if [ ! -e $2/$1 ]
  then
    cp $1 $2
  elif [ $1 -nt $2/$1 ]
  then
    cp $1 $2
  fi
}

noisy_cd() {
  cd $1
  echo "-- `pwd`" >&2
}

older_than ../enumerate/enumerate ../enumerate/enumerate.cc && {
  $CXX $CFLAGS ../enumerate/enumerate.cc -o ../enumerate/enumerate
}

older_than ../tangle/tangle ../tangle/*.cc && {
  noisy_cd ../tangle
    {
      grep -h "^struct .* {" [0-9]*.cc  |sed 's/\(struct *[^ ]*\).*/\1;/'
      grep -h "^typedef " [0-9]*.cc
    }  |update type_list
    grep -h "^[^ #].*) {" [0-9]*.cc  |sed 's/ {.*/;/'  |update function_list
    ls [0-9]*.cc  |grep -v "\.test\.cc$"  |sed 's/.*/#include "&"/'  |update file_list
    ls [0-9]*.test.cc  |sed 's/.*/#include "&"/'  |update test_file_list
    grep -h "^[[:space:]]*void test_" [0-9]*.cc  |sed 's/^\s*void \(.*\)() {$/\1,/'  |update test_list
    grep -h "^\s*void test_" [0-9]*.cc  |sed 's/^\s*void \(.*\)() {.*/"\1",/'  |update test_name_list
    $CXX $CFLAGS boot.cc -o tangle
    ./tangle test
  noisy_cd ../subx  # no effect; just to show us returning to the parent directory
}

LAYERS=$(../enumerate/enumerate --until $UNTIL_LAYER  |grep '.cc$')
older_than subx.cc $LAYERS ../enumerate/enumerate ../tangle/tangle && {
  # no update here; rely on 'update' calls downstream
  ../tangle/tangle $LAYERS  > subx.cc
}

grep -h "^[^[:space:]#].*) {$" subx.cc  |grep -v ":.*("  |sed 's/ {.*/;/'  |update function_list
grep -h "^\s*void test_" subx.cc  |sed 's/^\s*void \(.*\)() {.*/\1,/'  |update test_list
grep -h "^\s*void test_" subx.cc  |sed 's/^\s*void \(.*\)() {.*/"\1",/'  |update test_name_list

older_than subx_bin subx.cc *_list && {
  $CXX $CFLAGS subx.cc -o subx_bin
}

if [ $# -eq 0 ]
then

  # Assumption: SubX programs don't need to be retranslated every time we
  # rebuild the C++ bootstrap.

  # simple example programs
  for n in `seq 1 12`
  do
    older_than examples/ex$n examples/ex$n.subx && {
      ./subx_bin translate examples/ex$n.subx -o examples/ex$n
    }
  done

  # simple apps that use the standard library
  for app in factorial crenshaw2-1 crenshaw2-1b handle
  do
    older_than apps/$app apps/$app.subx [0-9]*.subx && {
      ./subx_bin translate [0-9]*.subx apps/$app.subx -o apps/$app
    }
  done

  # self-hosting translator
  for phase in hex survey pack assort dquotes tests
  do
    older_than apps/$phase apps/$phase.subx apps/subx-common.subx [0-9]*.subx && {
      ./subx_bin translate [0-9]*.subx apps/subx-common.subx apps/$phase.subx -o apps/$phase
    }
  done

fi

exit 0