summaryrefslogtreecommitdiff
path: root/src/DrawResources/BuildWorkbench.tcl
blob: 53359d0b871952e78d38c1319000508c81402b8e (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
#
#
#  procedures pour automatiser la fabrication de gti
#
#
puts " *****  loading  build_list   ***** "
###############################################################################
#
#
proc build_list { factory ilot workbench  exelist toolkitlist   packagelist } {
#
#
###############################################################################
# fabrique la liste des executables, toolkits et packages
# pour un workbench donne
#

    upvar $exelist      EXECUTABLE_LIST
    upvar $toolkitlist  TOOLKIT_LIST
    upvar $packagelist  PACKAGE_LIST
    wokcd [concat $factory:$ilot:$workbench]
    wokprofile -d
    set UD_LIST [ w_info -l ]
    set PACKAGE_LIST ""
    set EXECUTABLE_LIST ""
    set TOOLKIT_LIST ""
    for { set i 0 } { $i <= [expr [ llength $UD_LIST ] - 1 ]} { incr i } {
	set p [lindex $UD_LIST $i]
	set typ [ uinfo -t $p ]
	if { $typ == "executable" } {
	    lappend EXECUTABLE_LIST $p
	} elseif { $typ == "toolkit" } {
	    lappend TOOLKIT_LIST $p
	} elseif { $typ == "package" || $typ == "nocdlpack" } {
	    lappend PACKAGE_LIST $p
	}
    }
}
puts " *****  loading   extract_from_cdl ***** "
###############################################################################
#
#
proc extract_from_cdl { factory ilot workbench } {
#
#
###############################################################################
    build_list $factory $ilot $workbench  TYPE_OF_PACKAGE_LIST(1) TYPE_OF_PACKAGE_LIST(2) TYPE_OF_PACKAGE_LIST(3) 
    puts " *********** Extraction commencing at "
    puts "[exec date]"
    for { set i 0 } { $i <= [expr [ llength $TYPE_OF_PACKAGE_LIST(3) ] - 1 ]} { incr i } {
	    set PACKAGE [lindex $TYPE_OF_PACKAGE_LIST(3) $i]
	    wokcd $PACKAGE
	    set LOCAL_UD [ wokcd ] 

            
	    set ERROR_FILE [ wokinfo -p admfile:cdlcompile.log $LOCAL_UD ] 
            set ERROR_DIRECTORY [ file dirname $ERROR_FILE ] 
	    puts " $ERROR_FILE "
#
#  attention : verifier que la directory existe 
#
	    if { [ file isdirectory  $ERROR_DIRECTORY ] } {
		set FILE_DESCRIPTOR [ open $ERROR_FILE w ] 
#
#   on initialise avec un chaine null le fichier
#
		puts $FILE_DESCRIPTOR ""
#
#   on redirige les erreurs avec un dispatcheur
#
		msgsetcmd dispatch_compile_message $FILE_DESCRIPTOR
	    }
	    catch { umake -fe obj.inc } 
#           puts "umake -fe obj.inc"
	    if { [ file isdirectory  $ERROR_DIRECTORY ] } {
		close $FILE_DESCRIPTOR
		msgunsetcmd
            }
	
    }
    puts " ********** Extraction ending at " 
    puts " [exec date]"
    msclear
}
puts " *****  loading  force_build_only_obj *****  "
###############################################################################
#
#
proc force_build_only_obj { factory ilot workbench } {
#
#
###############################################################################
    build_list $factory $ilot $workbench  TYPE_OF_PACKAGE_LIST(1) TYPE_OF_PACKAGE_LIST(2) TYPE_OF_PACKAGE_LIST(3) 
    puts " *********   Obj commencing at "
    puts " [ exec date ] "
    for { set i 0 } { $i <= [expr [ llength $TYPE_OF_PACKAGE_LIST(3) ] - 1 ]} { incr i } {
	set p [lindex $TYPE_OF_PACKAGE_LIST(3) $i]
	wokcd $p
	set LOCAL_UD [ wokcd ] 
	set ERROR_FILE [ wokinfo -p stadmfile:objcompile.log $LOCAL_UD ]
        set ERROR_DIRECTORY [ file dirname $ERROR_FILE ] 
	puts " $ERROR_FILE "
#
#  attention : verifier que la directory existe 
#
	if { [ file isdirectory  $ERROR_DIRECTORY ] } {
		set FILE_DESCRIPTOR [ open $ERROR_FILE w ] 
#
#   on initialise avec un chaine null le fichier
#
		puts $FILE_DESCRIPTOR ""
#
#   on redirige les erreurs avec un dispatcheur
#
		msgsetcmd dispatch_compile_message $FILE_DESCRIPTOR
	    } 
	catch { umake -of obj } 
#       puts " umake -o obj  $p "
	if { [ file isdirectory  $ERROR_DIRECTORY ] } {
		close $FILE_DESCRIPTOR
		msgunsetcmd 
	}

	
    }
    for { set j 1 } { $j <= 2 } { incr j } {
	for { set i 0 } { $i <= [expr [ llength $TYPE_OF_PACKAGE_LIST($j) ] - 1 ]} { incr i } {
	    set p [lindex $TYPE_OF_PACKAGE_LIST($j) $i]
	    wokcd $p
	    set LOCAL_UD [ wokcd ] 
	    set ERROR_FILE [ wokinfo -p stadmfile:objcompile.log $LOCAL_UD ]
            set ERROR_DIRECTORY [ file dirname $ERROR_FILE ] 
	    puts " $ERROR_FILE "
#
#  attention : verifier que la directory existe 
#
	    if { [ file isdirectory  $ERROR_DIRECTORY ] } {
		set FILE_DESCRIPTOR [ open $ERROR_FILE w ] 
#
#   on initialise avec un chaine null le fichier
#
		puts $FILE_DESCRIPTOR ""
#
#   on redirige les erreurs avec un dispatcheur
#
		msgsetcmd dispatch_compile_message $FILE_DESCRIPTOR
	    } 
	    
	    catch { umake -f  } 
#           puts " umake $p "
	    if { [ file isdirectory  $ERROR_DIRECTORY ] } {
		close $FILE_DESCRIPTOR
		msgunsetcmd 
	    }
	}
    }

    puts " *********   Obj ending at "
    puts " [ exec date ] " 
    msclear
}
puts " *****  loading  build_only_obj ****** "
###############################################################################
#
#
proc build_only_obj { factory ilot workbench } {
#
#
###############################################################################

    build_list $factory $ilot $workbench  TYPE_OF_PACKAGE_LIST(1) TYPE_OF_PACKAGE_LIST(2) TYPE_OF_PACKAGE_LIST(3) 
    puts " *********   Obj commencing at "
    puts " [ exec date ] "
    for { set i 0 } { $i <= [expr [ llength $TYPE_OF_PACKAGE_LIST(3) ] - 1 ]} { incr i } {
	set p [lindex $TYPE_OF_PACKAGE_LIST(3) $i]
	wokcd $p
	set LOCAL_UD [ wokcd ] 
	set ERROR_FILE [ wokinfo -p stadmfile:objcompile.log $LOCAL_UD ]
        set ERROR_DIRECTORY [ file dirname $ERROR_FILE ] 
	puts " $ERROR_FILE "
#
#  attention : verifier que la directory existe 
#
	if { [ file isdirectory  $ERROR_DIRECTORY ] } {
		set FILE_DESCRIPTOR [ open $ERROR_FILE w ] 
#
#   on initialise avec un chaine null le fichier
#
		puts $FILE_DESCRIPTOR ""
#
#   on redirige les erreurs avec un dispatcheur
#
		msgsetcmd dispatch_compile_message $FILE_DESCRIPTOR
	    } 
	catch { umake -o obj } 
#       puts " umake -o obj  $p "
	if { [ file isdirectory  $ERROR_DIRECTORY ] } {
		close $FILE_DESCRIPTOR
		msgunsetcmd 
	}

	
    }
    for { set j 1 } { $j <= 2 } { incr j } {
	for { set i 0 } { $i <= [expr [ llength $TYPE_OF_PACKAGE_LIST($j) ] - 1 ]} { incr i } {
	    set p [lindex $TYPE_OF_PACKAGE_LIST($j) $i]
	    wokcd $p
	    set LOCAL_UD [ wokcd ] 
	    set ERROR_FILE [ wokinfo -p stadmfile:objcompile.log $LOCAL_UD ]
            set ERROR_DIRECTORY [ file dirname $ERROR_FILE ] 
	    puts " $ERROR_FILE "
#
#  attention : verifier que la directory existe 
#
	    if { [ file isdirectory  $ERROR_DIRECTORY ] } {
		set FILE_DESCRIPTOR [ open $ERROR_FILE w ] 
#
#   on initialise avec un chaine null le fichier
#
		puts $FILE_DESCRIPTOR ""
#
#   on redirige les erreurs avec un dispatcheur
#
		msgsetcmd dispatch_compile_message $FILE_DESCRIPTOR
	    } 
	    
	    catch { umake  } 
#           puts " umake $p "
	    if { [ file isdirectory  $ERROR_DIRECTORY ] } {
		close $FILE_DESCRIPTOR
		msgunsetcmd 
	    }
	}
    }

    puts " *********   Obj ending at "
    puts " [ exec date ] " 
    msclear
}
###############################################################################
#
#
proc dispatch_compile_message { code message file } {
#
#
###############################################################################
    puts " $message "
    if { $code == "E" } {
	    puts $file " $message "
     } 
#
#  E les erreurs
#       
#
#  V verbose 
#
#
#  I les infos
#
#
#  W les warnings
#
    
     
}
puts " *****  loading  build_obj_log *****  "
###############################################################################
#
#
proc build_obj_log { factory ilot workbench } {
#
#
###############################################################################
    puts " Erreurs dans les compiles obj :"
    build_list $factory $ilot $workbench  TYPE_OF_PACKAGE_LIST(1) TYPE_OF_PACKAGE_LIST(2) TYPE_OF_PACKAGE_LIST(3) 
    for { set j 2 } { $j <= 3 } { incr j } {
	for { set i 0 } { $i <= [expr [ llength $TYPE_OF_PACKAGE_LIST($j) ] - 1 ]} { incr i } {
	    set p [lindex $TYPE_OF_PACKAGE_LIST($j) $i]
	    wokcd $p
	    set LOCAL_UD [ wokcd ] 
	    set ERROR_FILE [ wokinfo -p stadmfile:objcompile.log $LOCAL_UD ] 
	    if { [ file exists $ERROR_FILE ] } {
		set FILE_DESCRIPTOR [ open $ERROR_FILE r ]
		set ERROR_HAPPENED 0 
		while { [ gets $FILE_DESCRIPTOR LINE ] >= 0 && $ERROR_HAPPENED == 0  } {
		    if { [ regexp Error $LINE ] } {
   		        puts "$LOCAL_UD"
			set ERROR_HAPPENED 1
		    }
		}
		close $FILE_DESCRIPTOR
	    }
        }
    }
}
puts " *****  loading   build_cdl_log ******  "
###############################################################################
#
#
proc build_cdl_log { factory ilot workbench } {
#
#
###############################################################################
    puts "Erreurs dans les compiles cdl :"
    build_list $factory $ilot $workbench  TYPE_OF_PACKAGE_LIST(1) TYPE_OF_PACKAGE_LIST(2) TYPE_OF_PACKAGE_LIST(3) 
    for { set i 0 } { $i <= [expr [ llength $TYPE_OF_PACKAGE_LIST(3) ] - 1 ]} { incr i } {
	    set p [lindex $TYPE_OF_PACKAGE_LIST(3) $i]
	    wokcd $p
	    set LOCAL_UD [ wokcd ] 
	    set ERROR_FILE [ wokinfo -p admfile:cdlcompile.log $LOCAL_UD ] 
	    if { [ file exists $ERROR_FILE ] } {
		set FILE_DESCRIPTOR [ open $ERROR_FILE r ] 
		set ERROR_HAPPENED  0
		while { [ gets $FILE_DESCRIPTOR LINE ] >= 0 && $ERROR_HAPPENED == 0} {
		    if { [ regexp Error $LINE ] } {
			puts "$LOCAL_UD "
			set ERROR_HAPPENED 1 
		    }
		}
		close $FILE_DESCRIPTOR
	    }
   }
}