~dexter/parrot-pkg/maverick

« back to all changes in this revision

Viewing changes to examples/nci/ls.pir

  • Committer: Piotr Roszatycki
  • Date: 2011-01-11 14:34:28 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: piotr.roszatycki@gmail.com-20110111143428-s7pa7qz38m61o4tw
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2008, Parrot Foundation.
2
 
# $Id: ls.pir 37201 2009-03-08 12:07:48Z fperrad $
 
1
# Copyright (C) 2005-2010, Parrot Foundation.
3
2
 
4
3
=head1 NAME
5
4
 
9
8
 
10
9
List the content of the directory 'docs'.
11
10
 
 
11
This program uses the 'dirent' structure, whose content is not fully
 
12
standarized, thus may need modifications depending on platform.
 
13
 
 
14
In this encarnation it works on linux i386 and amd64 systems.
 
15
 
12
16
=cut
13
17
 
14
18
.sub _main :main
26
30
 
27
31
     .include "datatypes.pasm"
28
32
     new $P2, 'OrderedHash'
29
 
     set $P2["d_fileno"], .DATATYPE_INT64
 
33
     set $P2["d_fileno"], .DATATYPE_LONG
 
34
     push $P2, 0
 
35
     push $P2, 0
 
36
     set $P2["d_off"], .DATATYPE_LONG
30
37
     push $P2, 0
31
38
     push $P2, 0
32
39
     set $P2["d_reclen"], .DATATYPE_SHORT
40
47
     push $P2, 0           # 11
41
48
lp_dir:
42
49
     entry = readdir(curdir)
43
 
     $I0 = get_addr entry
 
50
     $I0 = defined entry
44
51
     unless $I0 goto done
45
52
     assign entry, $P2
46
53