-
Notifications
You must be signed in to change notification settings - Fork 1
/
dirname.fs
41 lines (31 loc) · 1008 Bytes
/
dirname.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
\ galope/dirname.fs
\ This file is part of Galope
\ http://programandala.net/en.program.galope.html
\ Credit: Code from Gforth 0.7.3.
\ ==============================================================
[undefined] dirname [if]
require ./scan-back.fs
: dirname ( ca1 len1 -- ca2 len2 )
'\' scan-back ;
[then]
\ doc{
\
\ dirname ( ca1 len1 -- ca2 len2 )
\
\ Return the directory name _ca2 len2_ from the file name _ca1
\ len1_, including the final "/".
\
\ NOTE: ``dirname`` is already included in Gforth.
\
\ See: `basename`, `scan-back`.
\
\ }doc
\ ==============================================================
\ Change log
\ 2017-07-26: In Gforth 0.7.3. `dirname` was defined in
\ `forth-wordlist`, but in Gforth 0.7.9. it's defined in the `c-lib`
\ vocabulary. This module solves it.
\
\ 2017-08-20: `dirname` has been moved to `forth-wordlist` in Gforth
\ 0.7.9, which is under development. Therefore, an `[undefined]` check
\ is added here. Improve documentation.