Jonathan Worthington wrote:
James E Keenan wrote:

File src/pmc/classobject.h was added very recently:

r18244 | jonathan | 2007-04-16 19:26:34 -0400 (Mon, 16 Apr 2007) | 1 line

Aye.

I'm wondering why it was added in directory src/pmc/. Previously, that directory held only files with names ending in .num or .pmc:

[parrot] 527 $ ls src/pmc/ | cut -d '.' -f 2 | sort | uniq -c
   1 num
  81 pmc

These were the 'pmc' files transformed by tools/build/pmc2c.pl into c files. Is src/pmc/ the most appropriate location for a .h file?

Only the Class and Object PMCs need this header file. Nothing else should include it. It's part of my attempt to encourage encapsulation. I was following the precedent that src/ contains some .h files (I guess, for a similar reason). I'm pretty sure I've seen .h files show up in languages PMC directories too.

The fact that you've pointed out its unusual for a .h file to be there is perhaps a good thing, 'cus anyone thinking of including it themselves will hopefully think the same. ;-) If anyone feels really strongly otherwise, I won't be bothered if it gets moved.



I stumbled across it because I was re-running the build tools tests in t/tools/pmc2cutils/*.t.

[parrot] 502 $ prove -v t/tools/pmc2cutils/00-qualify.t
t/tools/pmc2cutils/00-qualify....1..9
ok 1 - use Parrot::Pmc2c::Utils;
ok 2 - Makefile located
ok 3 - myconfig located
ok 4 - lib/Parrot/PMC.pm located
not ok 5 - only 2 file suffixes in src/pmc

#   Failed test 'only 2 file suffixes in src/pmc'
#   at t/tools/pmc2cutils/00-qualify.t line 26.
#          got: '3'
#     expected: '2'
...
# Looks like you failed 1 test of 9.
dubious
        Test returned status 1 (wstat 256, 0x100)
DIED. FAILED test 5
        Failed 1/9 tests, 88.89% okay
Failed Test                     Stat Wstat Total Fail  List of Failed
-------------------------------------------------------------------------------
t/tools/pmc2cutils/00-qualify.t    1   256     9    1  5
Failed 1/1 test scripts. 1/9 subtests failed.
Files=1, Tests=9,  2 wallclock secs ( 0.25 cusr +  0.13 csys =  0.38 CPU)
Failed 1/1 test programs. 1/9 subtests failed.


Now, granted, the test that failed may have been written in a too restrictive manner. But I was trying to determine which files in src/pmc/ I needed to copy to a temporary directory for the purpose of running tests later in the test suite.

Since I use src/pmc/class.pmc later in the test suite, I may have to reformulate a test there as well:

[parrot] 506 $ grep -n 'src/pmc/class' t/tools/pmc2cutils/*.t
t/tools/pmc2cutils/05-gen_c.t:286: my @pmcfiles = ( "$main::topdir/src/pmc/default.pmc", "$main::topdir/src/pmc/class.pmc", );

Reply via email to