require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_MSDOSFS_DENODE_H_)) {
    eval 'sub _MSDOSFS_DENODE_H_ () {1;}' unless defined(&_MSDOSFS_DENODE_H_);
    unless(defined(&MAKEFS)) {
	require 'miscfs/genfs/genfs_node.ph';
    } else {
    }
    eval 'sub MSDOSFSROOT_OFS () {0x1fffffff;}' unless defined(&MSDOSFSROOT_OFS);
    eval 'sub FC_SIZE () {3;}' unless defined(&FC_SIZE);
    eval 'sub FC_LASTMAP () {0;}' unless defined(&FC_LASTMAP);
    eval 'sub FC_LASTFC () {1;}' unless defined(&FC_LASTFC);
    eval 'sub FC_NEXTTOLASTFC () {2;}' unless defined(&FC_NEXTTOLASTFC);
    eval 'sub FCE_EMPTY () {0xffffffff;}' unless defined(&FCE_EMPTY);
    eval 'sub fc_setcache {
        my($dep, $slot, $frcn, $fsrcn) = @_;
	    eval q(($dep)-> ($de_fc[$slot]->{fc_frcn}) = $frcn; ($dep)-> ($de_fc[$slot]->{fc_fsrcn}) = $fsrcn;);
    }' unless defined(&fc_setcache);
    eval 'sub fc_last_to_nexttolast {
        my($dep) = @_;
	    eval q( &do { ($dep)-> ($de_fc[&FC_NEXTTOLASTFC]->{fc_frcn}) = ($dep)-> ($de_fc[&FC_LASTFC]->{fc_frcn}); ($dep)-> ($de_fc[&FC_NEXTTOLASTFC]->{fc_fsrcn}) = ($dep)-> ($de_fc[&FC_LASTFC]->{fc_fsrcn}); }  &while (0));
    }' unless defined(&fc_last_to_nexttolast);
    eval 'sub de_dirclust () { ($de_key->{dk_dirclust});}' unless defined(&de_dirclust);
    eval 'sub de_diroffset () { ($de_key->{dk_diroffset});}' unless defined(&de_diroffset);
    eval 'sub de_dirgen () { ($de_key->{dk_dirgen});}' unless defined(&de_dirgen);
    eval 'sub DE_UPDATE () {0x1;}' unless defined(&DE_UPDATE);
    eval 'sub DE_CREATE () {0x2;}' unless defined(&DE_CREATE);
    eval 'sub DE_ACCESS () {0x4;}' unless defined(&DE_ACCESS);
    eval 'sub DE_MODIFIED () {0x8;}' unless defined(&DE_MODIFIED);
    eval 'sub DE_RENAME () {0x10;}' unless defined(&DE_RENAME);
    eval 'sub WIN_MAXLEN () {255;}' unless defined(&WIN_MAXLEN);
    eval 'sub MSDOSFS_FILESIZE_MAX () {0xffffffff;}' unless defined(&MSDOSFS_FILESIZE_MAX);
    eval 'sub DE_INTERNALIZE32 {
        my($dep, $dp) = @_;
	    eval q((($dep)-> &de_StartCluster |=  &getushort(($dp)-> &deHighClust) << 16));
    }' unless defined(&DE_INTERNALIZE32);
    eval 'sub DE_INTERNALIZE {
        my($dep, $dp) = @_;
	    eval q(( &memcpy(($dep)-> &de_Name, ($dp)-> &deName, 8),  &memcpy(($dep)-> &de_Name+8, ($dp)-> &deExtension, 3), ($dep)-> &de_Attributes = ($dp)-> &deAttributes, ($dep)-> &de_CHun = ($dp)-> &deCHundredth, ($dep)-> &de_CTime =  &getushort(($dp)-> &deCTime), ($dep)-> &de_CDate =  &getushort(($dp)-> &deCDate), ($dep)-> &de_ADate =  &getushort(($dp)-> &deADate), ($dep)-> &de_MTime =  &getushort(($dp)-> &deMTime), ($dep)-> &de_MDate =  &getushort(($dp)-> &deMDate), ($dep)-> &de_StartCluster =  &getushort(($dp)-> &deStartCluster), ($dep)-> &de_FileSize =  &getulong(($dp)-> &deFileSize), ( &FAT32(($dep)-> &de_pmp) ?  &DE_INTERNALIZE32(($dep), ($dp)) : 0)));
    }' unless defined(&DE_INTERNALIZE);
    eval 'sub DE_EXTERNALIZE32 {
        my($dp, $dep) = @_;
	    eval q( &putushort(($dp)-> &deHighClust, ($dep)-> &de_StartCluster >> 16));
    }' unless defined(&DE_EXTERNALIZE32);
    eval 'sub DE_EXTERNALIZE16 {
        my($dp, $dep) = @_;
	    eval q( &putushort(($dp)-> &deHighClust, 0));
    }' unless defined(&DE_EXTERNALIZE16);
    eval 'sub DE_EXTERNALIZE {
        my($dp, $dep) = @_;
	    eval q(( &memcpy(($dp)-> &deName, ($dep)-> &de_Name, 8),  &memcpy(($dp)-> &deExtension, ($dep)-> &de_Name+8, 3), ($dp)-> &deAttributes = ($dep)-> &de_Attributes, ($dp)-> &deCHundredth = ($dep)-> &de_CHun,  &putushort(($dp)-> &deCTime, ($dep)-> &de_CTime),  &putushort(($dp)-> &deCDate, ($dep)-> &de_CDate),  &putushort(($dp)-> &deADate, ($dep)-> &de_ADate),  &putushort(($dp)-> &deMTime, ($dep)-> &de_MTime),  &putushort(($dp)-> &deMDate, ($dep)-> &de_MDate),  &putushort(($dp)-> &deStartCluster, ($dep)-> &de_StartCluster),  &putulong(($dp)-> &deFileSize, (($dep)-> &de_Attributes &  &ATTR_DIRECTORY) ? 0: ($dep)-> &de_FileSize), ( &FAT32(($dep)-> &de_pmp) ?  &DE_EXTERNALIZE32(($dp), ($dep)) :  &DE_EXTERNALIZE16(($dp), ($dep)))));
    }' unless defined(&DE_EXTERNALIZE);
    eval 'sub de_forw () { $de_chain[0];}' unless defined(&de_forw);
    eval 'sub de_back () { $de_chain[1];}' unless defined(&de_back);
    if(defined(&_KERNEL) || defined(&MAKEFS)) {
	eval 'sub VTODE {
	    my($vp) = @_;
    	    eval q((($vp)-> &v_data));
	}' unless defined(&VTODE);
	eval 'sub DETOV {
	    my($de) = @_;
    	    eval q((($de)-> &de_vnode));
	}' unless defined(&DETOV);
	eval 'sub DETIMES {
	    my($dep, $acc, $mod, $cre, $gmtoff) = @_;
    	    eval q( &while (($dep)-> &de_flag & ( &DE_UPDATE |  &DE_CREATE |  &DE_ACCESS))  &msdosfs_detimes($dep, $acc, $mod, $cre, $gmtoff));
	}' unless defined(&DETIMES);
	if(defined(&MAKEFS)) {
	} else {
	}
    }
}
1;
