From e95515664a943d8968c492f242a7d4b0729ea4b5 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Mon, 22 Feb 2016 12:50:48 -0500 Subject: eshtrans/backend: Generate translation unit ID --- (limited to 'eshtrans/backend') diff --git a/eshtrans/backend/codegen.esh b/eshtrans/backend/codegen.esh index 8d77ce9..a9c3cef 100644 --- a/eshtrans/backend/codegen.esh +++ b/eshtrans/backend/codegen.esh @@ -109,3 +109,13 @@ sh_parse_stack() done codegen_sub "${array}" } + +sh_set_tu_id() +{ + local toks="${1}" + + tu_id="$(printf '%s' "${toks}" | sha256sum -)" + tu_id="${tu_id% -}" + + return 0 +} diff --git a/eshtrans/backend/main.esh b/eshtrans/backend/main.esh index 884a2c3..485e9be 100644 --- a/eshtrans/backend/main.esh +++ b/eshtrans/backend/main.esh @@ -23,6 +23,7 @@ sh_codegen() local toks="${1}" shift 1 + sh_set_tu_id "${toks}" if printf '%s' "${toks}" | sh_parse_stack; then return 0 else -- cgit v0.9.1