File: libpaths.pir

package info (click to toggle)
parrot 6.6.0-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 25,164 kB
  • ctags: 16,050
  • sloc: ansic: 110,715; perl: 94,382; yacc: 1,911; lex: 1,529; lisp: 1,163; cpp: 782; python: 646; ruby: 335; sh: 140; makefile: 129; cs: 49; asm: 30
file content (73 lines) | stat: -rw-r--r-- 1,510 bytes parent folder | download
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#./parrot
# Copyright (C) 2012, Parrot Foundation.

=head1 NAME

examples/pir/libpaths.pir - Print the parrot library search paths

=head1 SYNOPSIS

    $ unset PARROT_LIBRARY
    $ unset PARROT_INCLUDE
    $ ./parrot examples/pir/libpaths.pir
    $ ./installed_parrot examples/pir/libpaths.pir

=head1 DESCRIPTION

Print the list of parrot library search paths.

See also F<t/library/lib_search_path.t>

=cut

.include 'iglobals.pasm'
.include 'libpaths.pasm'
.const int SIZE = 4

.sub main :main
    .local pmc interp
    getinterp interp
    .local pmc lib_paths
    lib_paths = interp[.IGLOBALS_LIB_PATHS]
    .local pmc idx, desc
    idx = new 'FixedIntegerArray', SIZE
    desc = new 'FixedStringArray', SIZE
    idx[0] = .PARROT_LIB_PATH_INCLUDE
    desc[0] = "PARROT_LIB_PATH_INCLUDE"
    idx[1] = .PARROT_LIB_PATH_LIBRARY
    desc[1] = "PARROT_LIB_PATH_LIBRARY"
    idx[2] = .PARROT_LIB_PATH_DYNEXT
    desc[2] = "PARROT_LIB_PATH_DYNEXT"
    # LANG is experimental
    idx[3] = .PARROT_LIB_PATH_LANG
    desc[3] = "PARROT_LIB_PATH_LANG"

    $I0 = 0
  while_idx:
    .local pmc path
    $I1 = idx[$I0]
    $S1 = desc[$I0]
    path = lib_paths[$I1]
    .local pmc p
    .local int i, size
    size = path
    i = 0
    print "\n"
    print $S1
    say ":"
  while_entry:
    p = path[i]
    say p
    i = i + 1
    if i < size goto while_entry

    $I0 = $I0 + 1
    if $I0 < SIZE goto while_idx

.end

# Local Variables:
#   mode: pir
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: