Pooh program example 04-file-list.p

Test 04-file-list.p

Source of programm

# test listing files in directory.
println( ~msg '*** list *.c files ***' )
for f listdir( ~pattern '../cutils/*.c' )
  println ( ~msg 'file name [f]' )
end

println( ~msg '*** list *.c and *.h files ***' )

for f listdir( ~pattern [ '../cutils/*.h' , '../cutils/*.c' ] )
  println ( ~msg 'file name [f]' )
end

println( ~msg '*** list *.c and *.h files (2) ***' )
ofile = listdir( ~pattern [ '../cutils/*.h' , '../cutils/*.c' ] )
for f ofile
  println ( ~msg 'file name [f]' )
end
 
println( ~msg '*** eof files ***' )


Standard output for 04-file-list.p

*** list *.c files ***
file name ../cutils/array.c
file name ../cutils/bhash.c
file name ../cutils/dbuf.c
file name ../cutils/dddlist.c
file name ../cutils/ddlist.c
file name ../cutils/dlist.c
file name ../cutils/dlistunr.c
file name ../cutils/dring.c
file name ../cutils/hashfunction.c
file name ../cutils/heap.c
file name ../cutils/properties.c
file name ../cutils/slist.c
file name ../cutils/sring.c
file name ../cutils/tree.c
file name ../cutils/util.c
*** list *.c and *.h files ***
file name ../cutils/array.h
file name ../cutils/base.h
file name ../cutils/bhash.h
file name ../cutils/dbuf.h
file name ../cutils/dddlist.h
file name ../cutils/ddlist.h
file name ../cutils/dlist.h
file name ../cutils/dlistunr.h
file name ../cutils/dring.h
file name ../cutils/hashfunction.h
file name ../cutils/heap.h
file name ../cutils/properties.h
file name ../cutils/slist.h
file name ../cutils/sring.h
file name ../cutils/strtoint.h
file name ../cutils/tree.h
file name ../cutils/util.h
file name ../cutils/array.c
file name ../cutils/bhash.c
file name ../cutils/dbuf.c
file name ../cutils/dddlist.c
file name ../cutils/ddlist.c
file name ../cutils/dlist.c
file name ../cutils/dlistunr.c
file name ../cutils/dring.c
file name ../cutils/hashfunction.c
file name ../cutils/heap.c
file name ../cutils/properties.c
file name ../cutils/slist.c
file name ../cutils/sring.c
file name ../cutils/tree.c
file name ../cutils/util.c
*** list *.c and *.h files (2) ***
file name ../cutils/array.h
file name ../cutils/base.h
file name ../cutils/bhash.h
file name ../cutils/dbuf.h
file name ../cutils/dddlist.h
file name ../cutils/ddlist.h
file name ../cutils/dlist.h
file name ../cutils/dlistunr.h
file name ../cutils/dring.h
file name ../cutils/hashfunction.h
file name ../cutils/heap.h
file name ../cutils/properties.h
file name ../cutils/slist.h
file name ../cutils/sring.h
file name ../cutils/strtoint.h
file name ../cutils/tree.h
file name ../cutils/util.h
file name ../cutils/array.c
file name ../cutils/bhash.c
file name ../cutils/dbuf.c
file name ../cutils/dddlist.c
file name ../cutils/ddlist.c
file name ../cutils/dlist.c
file name ../cutils/dlistunr.c
file name ../cutils/dring.c
file name ../cutils/hashfunction.c
file name ../cutils/heap.c
file name ../cutils/properties.c
file name ../cutils/slist.c
file name ../cutils/sring.c
file name ../cutils/tree.c
file name ../cutils/util.c
*** eof files ***

Trace output for 04-file-list.p

002|println( ~msg '*** list *.c files ***' )...
003|for ... listdir( ~pattern '../cutils/*.c' )...
003| for f = '../cutils/array.c'
004|  println( ~msg 'file name ' .. f:'../cutils/array.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/bhash.c'
004|  println( ~msg 'file name ' .. f:'../cutils/bhash.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/dbuf.c'
004|  println( ~msg 'file name ' .. f:'../cutils/dbuf.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/dddlist.c'
004|  println( ~msg 'file name ' .. f:'../cutils/dddlist.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/ddlist.c'
004|  println( ~msg 'file name ' .. f:'../cutils/ddlist.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/dlist.c'
004|  println( ~msg 'file name ' .. f:'../cutils/dlist.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/dlistunr.c'
004|  println( ~msg 'file name ' .. f:'../cutils/dlistunr.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/dring.c'
004|  println( ~msg 'file name ' .. f:'../cutils/dring.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/hashfunction.c'
004|  println( ~msg 'file name ' .. f:'../cutils/hashfunction.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/heap.c'
004|  println( ~msg 'file name ' .. f:'../cutils/heap.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/properties.c'
004|  println( ~msg 'file name ' .. f:'../cutils/properties.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/slist.c'
004|  println( ~msg 'file name ' .. f:'../cutils/slist.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/sring.c'
004|  println( ~msg 'file name ' .. f:'../cutils/sring.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/tree.c'
004|  println( ~msg 'file name ' .. f:'../cutils/tree.c' .. '' )...
003| end
003| for ...
003| for f = '../cutils/util.c'
004|  println( ~msg 'file name ' .. f:'../cutils/util.c' .. '' )...
003| end
003| for ...
003| end # finish for loop
007| println( ~msg '*** list *.c and *.h files ***' )...
009| for ... listdir( ~pattern [ '../cutils/*.h' , '../cutils/*.c']  )...
009|  for f = '../cutils/array.h'
010|   println( ~msg 'file name ' .. f:'../cutils/array.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/base.h'
010|   println( ~msg 'file name ' .. f:'../cutils/base.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/bhash.h'
010|   println( ~msg 'file name ' .. f:'../cutils/bhash.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/dbuf.h'
010|   println( ~msg 'file name ' .. f:'../cutils/dbuf.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/dddlist.h'
010|   println( ~msg 'file name ' .. f:'../cutils/dddlist.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/ddlist.h'
010|   println( ~msg 'file name ' .. f:'../cutils/ddlist.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/dlist.h'
010|   println( ~msg 'file name ' .. f:'../cutils/dlist.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/dlistunr.h'
010|   println( ~msg 'file name ' .. f:'../cutils/dlistunr.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/dring.h'
010|   println( ~msg 'file name ' .. f:'../cutils/dring.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/hashfunction.h'
010|   println( ~msg 'file name ' .. f:'../cutils/hashfunction.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/heap.h'
010|   println( ~msg 'file name ' .. f:'../cutils/heap.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/properties.h'
010|   println( ~msg 'file name ' .. f:'../cutils/properties.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/slist.h'
010|   println( ~msg 'file name ' .. f:'../cutils/slist.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/sring.h'
010|   println( ~msg 'file name ' .. f:'../cutils/sring.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/strtoint.h'
010|   println( ~msg 'file name ' .. f:'../cutils/strtoint.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/tree.h'
010|   println( ~msg 'file name ' .. f:'../cutils/tree.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/util.h'
010|   println( ~msg 'file name ' .. f:'../cutils/util.h' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/array.c'
010|   println( ~msg 'file name ' .. f:'../cutils/array.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/bhash.c'
010|   println( ~msg 'file name ' .. f:'../cutils/bhash.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/dbuf.c'
010|   println( ~msg 'file name ' .. f:'../cutils/dbuf.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/dddlist.c'
010|   println( ~msg 'file name ' .. f:'../cutils/dddlist.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/ddlist.c'
010|   println( ~msg 'file name ' .. f:'../cutils/ddlist.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/dlist.c'
010|   println( ~msg 'file name ' .. f:'../cutils/dlist.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/dlistunr.c'
010|   println( ~msg 'file name ' .. f:'../cutils/dlistunr.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/dring.c'
010|   println( ~msg 'file name ' .. f:'../cutils/dring.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/hashfunction.c'
010|   println( ~msg 'file name ' .. f:'../cutils/hashfunction.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/heap.c'
010|   println( ~msg 'file name ' .. f:'../cutils/heap.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/properties.c'
010|   println( ~msg 'file name ' .. f:'../cutils/properties.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/slist.c'
010|   println( ~msg 'file name ' .. f:'../cutils/slist.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/sring.c'
010|   println( ~msg 'file name ' .. f:'../cutils/sring.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/tree.c'
010|   println( ~msg 'file name ' .. f:'../cutils/tree.c' .. '' )...
009|  end
009|  for ...
009|  for f = '../cutils/util.c'
010|   println( ~msg 'file name ' .. f:'../cutils/util.c' .. '' )...
009|  end
009|  for ...
009|  end # finish for loop
013|  println( ~msg '*** list *.c and *.h files (2) ***' )...
014|  ... = listdir( ~pattern [ '../cutils/*.h' , '../cutils/*.c']  )...
014|  ofile = listdir( ~pattern [ '../cutils/*.h' , '../cutils/*.c']  ):-> [ '../cutils/array.h', '../cutils/base.h', '../cutils/bhash.h', '../cutils/dbuf.h', '../cutils/dddlist.h', '../cutils/ddlist.h', '../cutils/dlist.h', '../cutils/dlistunr.h', '../cutils/dring.h', '../cutils/hashfunction.h', '../cutils/heap.h', '../cutils/properties.h', '../cutils/slist.h', '../cutils/sring.h', '../cutils/strtoint.h', '../cutils/tree.h', '../cutils/util.h', '../cutils/array.c', '../cutils/bhash.c', '../cutils/dbuf.c', '../cutils/dddlist.c', '../cutils/ddlist.c', '../cutils/dlist.c', '../cutils/dlistunr.c', '../cutils/dring.c', '../cutils/hashfunction.c', '../cutils/heap.c', '../cutils/properties.c', '../cutils/slist.c', '../cutils/sring.c', '../cutils/tree.c', '../cutils/util.c' ]
015|  for f = '../cutils/array.h'
016|   println( ~msg 'file name ' .. f:'../cutils/array.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/base.h'
016|   println( ~msg 'file name ' .. f:'../cutils/base.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/bhash.h'
016|   println( ~msg 'file name ' .. f:'../cutils/bhash.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/dbuf.h'
016|   println( ~msg 'file name ' .. f:'../cutils/dbuf.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/dddlist.h'
016|   println( ~msg 'file name ' .. f:'../cutils/dddlist.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/ddlist.h'
016|   println( ~msg 'file name ' .. f:'../cutils/ddlist.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/dlist.h'
016|   println( ~msg 'file name ' .. f:'../cutils/dlist.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/dlistunr.h'
016|   println( ~msg 'file name ' .. f:'../cutils/dlistunr.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/dring.h'
016|   println( ~msg 'file name ' .. f:'../cutils/dring.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/hashfunction.h'
016|   println( ~msg 'file name ' .. f:'../cutils/hashfunction.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/heap.h'
016|   println( ~msg 'file name ' .. f:'../cutils/heap.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/properties.h'
016|   println( ~msg 'file name ' .. f:'../cutils/properties.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/slist.h'
016|   println( ~msg 'file name ' .. f:'../cutils/slist.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/sring.h'
016|   println( ~msg 'file name ' .. f:'../cutils/sring.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/strtoint.h'
016|   println( ~msg 'file name ' .. f:'../cutils/strtoint.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/tree.h'
016|   println( ~msg 'file name ' .. f:'../cutils/tree.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/util.h'
016|   println( ~msg 'file name ' .. f:'../cutils/util.h' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/array.c'
016|   println( ~msg 'file name ' .. f:'../cutils/array.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/bhash.c'
016|   println( ~msg 'file name ' .. f:'../cutils/bhash.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/dbuf.c'
016|   println( ~msg 'file name ' .. f:'../cutils/dbuf.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/dddlist.c'
016|   println( ~msg 'file name ' .. f:'../cutils/dddlist.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/ddlist.c'
016|   println( ~msg 'file name ' .. f:'../cutils/ddlist.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/dlist.c'
016|   println( ~msg 'file name ' .. f:'../cutils/dlist.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/dlistunr.c'
016|   println( ~msg 'file name ' .. f:'../cutils/dlistunr.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/dring.c'
016|   println( ~msg 'file name ' .. f:'../cutils/dring.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/hashfunction.c'
016|   println( ~msg 'file name ' .. f:'../cutils/hashfunction.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/heap.c'
016|   println( ~msg 'file name ' .. f:'../cutils/heap.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/properties.c'
016|   println( ~msg 'file name ' .. f:'../cutils/properties.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/slist.c'
016|   println( ~msg 'file name ' .. f:'../cutils/slist.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/sring.c'
016|   println( ~msg 'file name ' .. f:'../cutils/sring.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/tree.c'
016|   println( ~msg 'file name ' .. f:'../cutils/tree.c' .. '' )...
015|  end
015|  for ...
015|  for f = '../cutils/util.c'
016|   println( ~msg 'file name ' .. f:'../cutils/util.c' .. '' )...
015|  end
015|  for ...
015|  end # finish for loop
019|  println( ~msg '*** eof files ***' )...