summaryrefslogtreecommitdiff
path: root/src/PMMgt/PMMgt_InsertDelete.tcl
blob: 67a6d2f6c3a9d963fd852a372edcc314c41925d9 (plain)
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
proc PMMgt_InsertDelete:AdmFileType {} {
    return "dbadmfile";
}

proc PMMgt_InsertDelete:OutputDirTypeName {} {
    return "dbtmpfile";
}


proc PMMgt_InsertDelete:HandleInputFile { ID } { 

    scan $ID "%\[^:\]:%\[^:\]:%\[^:\]"  unit type name

    switch $name {
	Handle_PMMgt_PManaged.hxx  {return 1;} 
	default {
	    return 0;
	}
    }
}
proc PMMgt_InsertDelete:AddDelete {name func} {
    set status 0
    set dbmsprof [wokprofile -b]
    if {$dbmsprof != "DFLT"} {
	set status [catch { exec grep  -s "^$func" $name >& /dev/null}]
	if {$status != 0} { 
	    set status [catch {exec sed -e "s?public:?$func?" <$name >${name}.new}]
	    msgprint -i -c "PMMgt_InsertDelete:Execute" "mv ${name}.new  $name"
	    set status [catch {exec mv ${name}.new  $name}]
	    if {$status == 0} {
		set status [catch {exec chmod 664 $name}]
	    }
	}
    }

    return $status
}

proc PMMgt_InsertDelete:Execute { unit args } {
    
    msgprint -i -c "PMMgt_InsertDelete:Execute" "Insert virtual void delete() in Handle"
    set dbmsprof [wokprofile -b]

    foreach file  $args {
	scan $file "%\[^:\]:%\[^:\]:%\[^:\]"  Unit type name

	if {$name == "Handle_PMMgt_PManaged.hxx"} {
	    set vistarget [woklocate -p PMMgt:pubinclude:$name [wokinfo -N $unit]]
	    set target    [wokinfo -p pubinclude:$name $unit]
	    set status [PMMgt_InsertDelete:AddDelete $vistarget "public: Standard_EXPORT void Delete();"]
	}
    }

    return 0;
}