| 1 |
# |
| 2 |
# Parse README.md and copy the source files |
| 3 |
# |
| 4 |
|
| 5 |
set fp [open $source_directory/README.md r] |
| 6 |
set data [read $fp] |
| 7 |
set start_sign "\[." |
| 8 |
set end_sign "\]" |
| 9 |
set start_path_index 0 |
| 10 |
set end_path_index 1 |
| 11 |
set index 1 |
| 12 |
|
| 13 |
while {1} { |
| 14 |
if {[string first $start_sign $data $end_path_index] != -1 } { |
| 15 |
set start_path_index [string first $start_sign $data $end_path_index] |
| 16 |
incr start_path_index 1 |
| 17 |
while {1} { |
| 18 |
if {[string first $end_sign $data $start_path_index] != -1 } { |
| 19 |
set end_path_index [string first $end_sign $data $start_path_index] |
| 20 |
incr end_path_index -1 |
| 21 |
set path($index) [string range $data $start_path_index $end_path_index] |
| 22 |
incr index 1 |
| 23 |
break |
| 24 |
} else { |
| 25 |
puts "ERROR IN PARSING README FILE" |
| 26 |
exit |
| 27 |
} |
| 28 |
} |
| 29 |
} break |
| 30 |
} |
| 31 |
close $fp |
| 32 |
|
| 33 |
for { set i 1 } { $i < $index} { incr i 1 } { |
| 34 |
puts $path($i) |
| 35 |
if {$path($i)=="./"} { |
| 36 |
eval file copy -force -- [glob $source_directory/$path($i)*.c] $project_destination |
| 37 |
if { [catch {eval file copy -force -- [glob $source_directory/$path($i)*.h] $project_destination} fid] } { |
| 38 |
puts "no header file in $source_directory/$path($i)" |
| 39 |
} |
| 40 |
} else { |
| 41 |
eval file copy -force -- [glob $source_directory/$path($i)/*.c] $project_destination |
| 42 |
eval file copy -force -- [glob $source_directory/$path($i)/*.h] $project_destination |
| 43 |
} |
| 44 |
} |