From 05f99af07daa95f933592dafabc700c201fb3a26 Mon Sep 17 00:00:00 2001 From: Koichi Nakamura Date: Thu, 6 May 2021 00:21:23 +0900 Subject: [PATCH] Add sourcefilename --- bootstrap.fs | 6 +++++- test/core.fs | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bootstrap.fs b/bootstrap.fs index a68faa3..9703971 100644 --- a/bootstrap.fs +++ b/bootstrap.fs @@ -1907,6 +1907,10 @@ variable inputstreams stdin_ push-inputstream +: sourcefilename ( -- c-addr ) + inputstreams @ input>file @ file>name +; + \ Replacing parser functions using input stream. variable source-buffer BUFSIZE allot @@ -2594,7 +2598,7 @@ need-defined (read) insn:docol insn:exit insn:lit insn:litstring insn:branch insn:0branch words id. name>string name>link - include included source >in + include included source >in sourcefilename next-arg shift-args arg argv argc version runtime copyright [if] [unless] [else] [then] defined? private{ }private export diff --git a/test/core.fs b/test/core.fs index 03adadd..8bcc5d4 100644 --- a/test/core.fs +++ b/test/core.fs @@ -809,6 +809,9 @@ skip T{ bl gs3 drop -> 0 }T \ blank line return zero-length string \ T{ gs4 123 456 \ -> }T +testing sourcefilename +T{ sourcefilename s" test/core.fs" streq -> }T + \ ------------------------------------------------------------------------ testing <# # #s #> hold sign base >number hex decimal