1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-21 02:27:10 +03:00
mal/impls/swift/templates/add_steps.sh
Joel Martin 8a19f60386 Move implementations into impls/ dir
- Reorder README to have implementation list after "learning tool"
  bullet.

- This also moves tests/ and libs/ into impls. It would be preferrable
  to have these directories at the top level.  However, this causes
  difficulties with the wasm implementations which need pre-open
  directories and have trouble with paths starting with "../../". So
  in lieu of that, symlink those directories to the top-level.

- Move the run_argv_test.sh script into the tests directory for
  general hygiene.
2020-02-10 23:50:16 -06:00

24 lines
718 B
Bash
Executable File

#!/bin/bash
# add_steps.sh input-file output-file
#
# Adds placeholder annotations to each line of a file. These annotations
# indicate which version(s) of the main (step*.swift) file the line should be
# included in. The annotations are just placeholders, and need to be edited to
# identify the right file versions.
#
# e.g.:
#
# $ ./add_steps.sh stepA_mal.swift main_template.swift
SPC10=" "
SPC20="${SPC10}${SPC10}"
SPC40="${SPC20}${SPC20}"
SPC80="${SPC40}${SPC40}"
SPC160="${SPC80}${SPC80}"
sed < $1 > $2 -e "s/\(.*\)/\1${SPC160}/" -e "/^\(.\)\{156\} .*$/s/\(.\{160\}\).*/\1\/\/ malstep(A)/"
# TBD: try the following, subsequently found on stackoverflow:
#
# sed -i ':a;/.\{63\}/!{s/$/ /;ba}' file