OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [perl_gui/] [lib/] [perl/] [software_editor.pl] - Blame information for rev 35

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 alirezamon
#!/usr/bin/perl
2
 
3
use strict;
4
use warnings;
5
 
6
use Glib qw(TRUE FALSE);
7
use Gtk2 '-init';
8
use Gtk2::SourceView2;
9
use Data::Dumper;
10
 
11
 
12
use base 'Class::Accessor::Fast';
13
require "widget.pl";
14
 
15
 
16
__PACKAGE__->mk_accessors(qw{
17
        window
18
        sourceview
19
        buffer
20
        filename
21
        search_regexp
22
        search_case
23
        search_entry
24
        regexp
25
        highlighted
26
});
27
 
28
my $NAME = 'Otec';
29
 
30
 
31
exit main() unless caller;
32
 
33
 
34
sub software_main {
35
        my ($sw,$file) = @_;
36
 
37
 
38
 
39
        my $app = __PACKAGE__->new();
40
        my ($table,$tview,$window)=$app->build_gui($sw);
41
        my $main_c=(defined $file)? "$sw/$file" : "$sw/main.c";
42
        $app->load_source($main_c) if (-f $main_c );
43
 
44
        #Gtk2->main();
45
 
46
        return ($app,$table,$tview,$window);
47
}
48
 
49
 
50
sub build_gui {
51
        my ($self,$sw) = @_;
52
 
53 35 alirezamon
        my $window = def_popwin_size (75,75,'Source Editor','percent');
54 34 alirezamon
        my $table= def_table(2,10,FALSE);
55
 
56
 
57
 
58
 
59
        my $hpaned = Gtk2::HPaned -> new;
60
        my $vpaned = Gtk2::VPaned -> new;
61
        $table->attach_defaults ($vpaned,0, 10, 0,1);
62
        #my $make = def_image_button('icons/run.png','Compile');
63
        #$table->attach ($make,9, 10, 1,2,'shrink','shrink',0,0);
64
        #$make -> signal_connect("clicked" => sub{
65
                #$self->do_save();
66
                #run_make_file($sw,$tview);     
67
 
68
        #});
69
 
70
        $window -> add ( $table);
71
 
72
        my($width,$hight)=max_win_size();
73
 
74
        my $scwin_dirs = Gtk2::ScrolledWindow -> new;
75
        $scwin_dirs -> set_policy ('automatic', 'automatic');
76
        $hpaned -> pack1 ($scwin_dirs, TRUE, TRUE);
77
        $hpaned ->set_position ($width*.15);
78
 
79
        my $scwin_text = Gtk2::ScrolledWindow -> new;
80
        $scwin_text -> set_policy ('automatic', 'automatic');
81
        $hpaned -> pack2 ($scwin_text, TRUE, TRUE);
82
 
83
 
84
        my ($scwin_info,$tview)= create_text();
85
        add_colored_tag($tview,'red');
86
        add_colored_tag($tview,'blue');
87
        $vpaned-> pack1 ($hpaned, TRUE, TRUE);
88
        $vpaned ->set_position ($hight*.5);
89
        $vpaned-> pack2 ($scwin_info, TRUE, TRUE);
90
 
91
 
92
 
93
 
94
# Directory name, full path
95
my $tree_store = Gtk2::TreeStore->new('Glib::String', 'Glib::String');
96
my $tree_view = Gtk2::TreeView->new($tree_store);
97
my $column = Gtk2::TreeViewColumn->new_with_attributes('', Gtk2::CellRendererText->new(), text => "0");
98
$tree_view->append_column($column);
99
$tree_view->set_headers_visible(FALSE);
100
$tree_view->signal_connect (button_release_event => sub{
101
        my $tree_model = $tree_view->get_model();
102
        my $selection = $tree_view->get_selection();
103
        my $iter = $selection->get_selected();
104
        if(defined $iter){
105
                my $path = $tree_model->get($iter, 1) ;
106
                $path= substr $path, 0, -1;
107
 
108
                 $self->load_source($path) if(-f $path);
109
        }
110
         return;
111
});
112
 
113
 
114
$tree_view->signal_connect ('row-expanded' => sub {
115
        my ($tree_view, $iter, $tree_path) = @_;
116
        my $tree_model = $tree_view->get_model();
117
        my ($dir, $path) = $tree_model->get($iter);
118
 
119
        # for each of $iter's children add any subdirectories
120
        my $child = $tree_model->iter_children ($iter);
121
        while ($child) {
122
                my ($dir, $path) = $tree_model->get($child, 0, 1);
123
                add_to_tree($tree_view,$tree_store, $child, $dir, $path);
124
                $child = $tree_model->iter_next ($child);
125
        }
126
         return;
127
});
128
 
129
 
130
$scwin_dirs -> add($tree_view);
131
 
132
 
133
 
134
my $child = $tree_store->append(undef);
135
$tree_store->set($child, 0, $sw, 1, '/');
136
add_to_tree($tree_view,$tree_store, $child, '/', "$sw/");
137
#print "$sw/\n";
138
 
139
        #my $window = Gtk2::Window->new();
140
        #$window->set_size_request(480, 360);
141
        #$window->set_title($NAME);
142
        $self->window($window);
143
 
144
        my $vbox = Gtk2::VBox->new(FALSE, 0);
145
        $scwin_text->add_with_viewport($vbox);
146
 
147
        $vbox->pack_start($self->build_menu, FALSE, FALSE, 0);
148
        $vbox->pack_start($self->build_search_box, FALSE, FALSE, 0);
149
 
150
        my $scroll = Gtk2::ScrolledWindow->new();
151
        $scroll->set_policy('automatic', 'automatic');
152
        $scroll->set_shadow_type('in');
153
        $vbox->pack_start($scroll, TRUE, TRUE, 0);
154
 
155
        my $buffer = $self->create_buffer();
156
        my $sourceview = Gtk2::SourceView2::View->new_with_buffer($buffer);
157
        $sourceview->set_show_line_numbers(TRUE);
158
        $sourceview->set_tab_width(2);
159
        $sourceview->set_indent_on_tab(TRUE);
160
        $sourceview->set_highlight_current_line(TRUE);
161
#       $sourceview->set_draw_spaces(['tab', 'newline']);
162
 
163
        #
164
        # Fix Gtk2::TextView's annoying paste behaviour when pasting with the mouse
165
        # (middle button click). By default gtk will scroll the text view to the
166
        # original place where the cursor is.
167
        #
168
        $sourceview->signal_connect(button_press_event => sub {
169
                my ($view, $event) = @_;
170
 
171
                # We're only interested on middle mouse clicks (mouse-paste)
172
                return FALSE unless $event->button == 2;
173
 
174
                # Remember the position of the paste
175
                my (@coords) = $sourceview->window_to_buffer_coords('text', $event->x, $event->y);
176
                my ($iter) = $sourceview->get_iter_at_position(@coords);
177
                $self->{paste_mark} = $buffer->create_mark('paste', $iter, FALSE);
178
 
179
                return FALSE;
180
        });
181
 
182
 
183
        #
184
        # If a paste is done through the middle click then place the cursor at the end
185
        # of the pasted text.
186
        #
187
        $buffer->signal_connect('paste-done' => sub {
188
                my $mark = delete $self->{paste_mark} or return;
189
 
190
                my $iter = $buffer->get_iter_at_mark($mark);
191
                $buffer->place_cursor($iter);
192
 
193
                $self->sourceview->scroll_to_mark(
194
                        $mark,
195
                        0.0,
196
                        FALSE,
197
                        0.0, 0.5
198
                );
199
                $buffer->delete_mark($mark);
200
        });
201
 
202
 
203
        $scroll->add($sourceview);
204
        $self->sourceview($sourceview);
205
        $self->buffer($sourceview->get_buffer);
206
 
207
        $window->signal_connect(delete_event => sub {
208
                Gtk2->main_quit();
209
                return TRUE;
210
        });
211
 
212
        $window->show_all();
213
        return ($table,$tview,$window);
214
}
215
 
216
 
217
sub build_search_box {
218
        my $self = shift;
219
 
220
        # Elements of the search box
221
        my $hbox = Gtk2::HBox->new(FALSE, 0);
222
 
223
        my $search_entry = Gtk2::Entry->new();
224
        $search_entry->signal_connect(activate => sub {$self->do_search()});
225
        $search_entry->signal_connect(icon_release => sub {$self->do_search()});
226
        $self->search_entry($search_entry);
227
 
228
        my $search_regexp = Gtk2::CheckButton->new('RegExp');
229
        $search_regexp->signal_connect(toggled => sub {
230
                $self->search_regexp($search_regexp->get_active);
231
        });
232
 
233
        my $search_case = Gtk2::CheckButton->new('Case');
234
        $search_case->signal_connect(toggled => sub {
235
                $self->search_case($search_case->get_active);
236
        });
237
 
238
        my $search_icon = Gtk2::Button->new_from_stock('gtk-find');
239
        $search_entry->set_icon_from_stock(primary => 'gtk-find');
240
 
241
        $hbox->pack_start($search_entry, TRUE, TRUE , 0);
242
        $hbox->pack_start($search_regexp, FALSE, FALSE, 0);
243
        $hbox->pack_start($search_case, FALSE, FALSE, 0);
244
 
245
        return $hbox;
246
}
247
 
248
 
249
sub create_buffer {
250
        my $self = shift;
251
        my $tags = Gtk2::TextTagTable->new();
252
 
253
        add_tag($tags, search => {
254
                        background => 'yellow',
255
        });
256
        add_tag($tags, goto_line => {
257
                        'paragraph-background' => 'orange',
258
        });
259
 
260
        my $buffer = Gtk2::SourceView2::Buffer->new($tags);
261
        $buffer->signal_connect('notify::cursor-position' => sub {
262
                $self->clear_highlighted();
263
        });
264
 
265
        return $buffer;
266
}
267
 
268
 
269
sub add_tag {
270
        my ($tags, $name, $properties) = @_;
271
 
272
        my $tag = Gtk2::TextTag->new($name);
273
        $tag->set(%{ $properties });
274
        $tags->add($tag);
275
}
276
 
277
 
278
sub detect_language {
279
        my $self = shift;
280
        my ($filename) = @_;
281
 
282
        # Guess the programming language of the file
283
        my $manager = Gtk2::SourceView2::LanguageManager->get_default;
284
        my $language = $manager->guess_language($filename);
285
        $self->buffer->set_language($language);
286
}
287
 
288
 
289
sub load_source {
290
        my $self = shift;
291
        my ($filename) = @_;
292
        my $buffer = $self->buffer;
293
 
294
        # Guess the programming language of the file
295
        $self->detect_language($filename);
296
 
297
        # Loading a file should not be undoable.
298
        my $content;
299
        do {
300
                open my $handle, $filename or die "Can't read file $filename because $!";
301
                local $/;
302
                $content = <$handle>;
303
                close $handle;
304
        };
305
        $buffer->begin_not_undoable_action();
306
        $buffer->set_text($content);
307
        $buffer->end_not_undoable_action();
308
 
309
        $buffer->set_modified(FALSE);
310
        $buffer->place_cursor($buffer->get_start_iter);
311
 
312
        $self->filename($filename);
313
        $self->window->set_title("$filename - $NAME");
314
}
315
 
316
 
317
sub clear_highlighted {
318
        my $self = shift;
319
 
320
        my $highlighted = delete $self->{highlighted} or return;
321
 
322
        my $buffer = $self->buffer;
323
 
324
        my @iters;
325
        foreach my $mark (@{ $highlighted->{marks} }) {
326
                my $iter = $buffer->get_iter_at_mark($mark);
327
                push @iters, $iter;
328
                $buffer->delete_mark($mark);
329
        }
330
 
331
        $buffer->remove_tag_by_name($highlighted->{name}, @iters);
332
}
333
 
334
 
335
sub get_text {
336
        my $self = shift;
337
        my $buffer = $self->buffer;
338
        return $buffer->get_text($buffer->get_start_iter, $buffer->get_end_iter, FALSE);
339
}
340
 
341
 
342
sub do_search {
343
        my $self = shift;
344
        my $criteria = $self->search_entry->get_text;
345
        if ($criteria eq '') {return;}
346
 
347
        my $case = $self->search_case;
348
        my $buffer = $self->buffer;
349
 
350
 
351
        # Start the search at the last search result or from the current cursor's
352
        # position. As a fall back we also add the beginning of the document. Once we
353
        # have the start position we can erase the previous search results.
354
        my @start;
355
        if (my $highlighted = $self->highlighted) {
356
                # Search from the last match
357
                push @start, $buffer->get_iter_at_mark($highlighted->{marks}[1]);
358
                $self->clear_highlighted();
359
        }
360
        else {
361
                # Search from the cursor
362
                push @start, $buffer->get_iter_at_offset(
363
                        $buffer->get_property('cursor-position')
364
                );
365
        }
366
        push @start, $buffer->get_start_iter;
367
 
368
        my @iters;
369
        if ($self->search_regexp) {
370
                # Gtk2::SourceView2 nor Gtk2::SourceView support regular expressions so we
371
                # have to do the search by hand!
372
 
373
                my $text = $self->get_text;
374
                my $regexp = $case ? qr/$criteria/m : qr/$criteria/im;
375
 
376
                foreach my $iter (@start) {
377
                        # Tell Perl where to start the regexp lookup
378
                        pos($text) = $iter->get_offset;
379
 
380
                        if ($text =~ /($regexp)/g) {
381
                                my $word = $1;
382
                                my $pos = pos($text);
383
                                @iters = (
384
                                        $buffer->get_iter_at_offset($pos - length($word)),
385
                                        $buffer->get_iter_at_offset($pos),
386
                                );
387
                                last;
388
                        }
389
                }
390
        }
391
        else {
392
                # Use the builtin search mechanism
393
                my $flags = $case ? [ ] : [ 'case-insensitive' ];
394
                foreach my $iter (@start) {
395
                        @iters = Gtk2::SourceView2::Iter->forward_search($iter, $criteria, $flags);
396
                        last if @iters;
397
                }
398
        }
399
 
400
        $self->show_highlighted(search => @iters) if @iters;
401
}
402
 
403
 
404
sub show_highlighted {
405
        my $self = shift;
406
        my ($tag_name, $start, $end) = @_;
407
        my $buffer = $self->buffer;
408
 
409
        # Highlight the region, remember it and scroll to it
410
        my $match_start = $buffer->create_mark('match-start', $start, TRUE);
411
        my $match_end = $buffer->create_mark('match-end', $end, FALSE);
412
 
413
        $buffer->apply_tag_by_name($tag_name, $start, $end);
414
 
415
        # We have a callback that listens to when the cursor is placed and we don't
416
        # want it to undo our work! So let's unhighlight the previous entry.
417
        delete $self->{highlighted};
418
        $buffer->place_cursor($end);
419
 
420
        $self->sourceview->scroll_to_mark(
421
                $match_start,
422
                0.2,
423
                FALSE,
424
                0.0, 0.5
425
        );
426
 
427
        # Keep a reference to the markers once they have been added to the buffer.
428
        # Using them before can be catastrophic (segmenation fault).
429
        #
430
        $self->highlighted({
431
                name  => $tag_name,
432
                marks => [$match_start, $match_end],
433
        });
434
}
435
 
436
 
437
sub do_file_new {
438
        my $self = shift;
439
        my $buffer = $self->buffer;
440
 
441
        # Set no language
442
        $buffer->set_language(undef);
443
 
444
        # Showing a blank editor should not be undoable.
445
        $buffer->begin_not_undoable_action();
446
        $buffer->set_text('');
447
        $buffer->end_not_undoable_action();
448
 
449
        $buffer->set_modified(FALSE);
450
        $buffer->place_cursor($buffer->get_start_iter);
451
 
452
        $self->filename('');
453
        $self->window->set_title("Untitled - $NAME");
454
}
455
 
456
 
457
sub do_file_open {
458
        my $self = shift;
459
        my ($window, $action, $menu_item) = @_;
460
 
461
        my $dialog = Gtk2::FileSelection->new("Open file...");
462
        $dialog->signal_connect(response => sub {
463
                my ($dialog, $response) = @_;
464
 
465
                if ($response eq 'ok') {
466
                        my $file = $dialog->get_filename;
467
                        return if -d $file;
468
                        $self->load_source($file);
469
                }
470
 
471
                $dialog->destroy();
472
        });
473
        $dialog->show();
474
}
475
 
476
 
477
sub do_show_about_dialog {
478
        my $self = shift;
479
 
480
        my $dialog = Gtk2::AboutDialog->new();
481
        $dialog->set_authors("Emmanuel Rodriguez");
482
        $dialog->set_comments("Gtk2::SourceView2 Demo");
483
        $dialog->signal_connect(response => sub {
484
                my ($dialog, $response) = @_;
485
                $dialog->destroy();
486
        });
487
        $dialog->show();
488
}
489
 
490
 
491
sub do_ask_goto_line {
492
        my $self = shift;
493
 
494
        my $dialog = Gtk2::Dialog->new_with_buttons(
495
                "Goto to line",
496
                $self->window,
497
                [ 'modal' ],
498
                'gtk-cancel' => 'cancel',
499
                'gtk-ok'     => 'ok',
500
        );
501
 
502
        my $hbox = Gtk2::HBox->new(FALSE, 0);
503
        $hbox->pack_start(
504
                Gtk2::Label->new("Line number: "),
505
                FALSE, FALSE, 0
506
        );
507
        my $entry = Gtk2::Entry->new();
508
        $hbox->pack_start($entry, TRUE, TRUE, 0);
509
 
510
        $dialog->get_content_area->add($hbox);
511
        $dialog->show_all();
512
 
513
 
514
        # Signal handlers
515
        $entry->signal_connect(activate => sub {
516
                if ($entry->get_text =~ /(\d+)/) {
517
                        $dialog->response('ok');
518
                }
519
        });
520
 
521
        # Run the dialog
522
        my $response = $dialog->run();
523
        $dialog->destroy();
524
        return unless $response eq 'ok';
525
 
526
        return unless my ($line) = ($entry->get_text =~ /(\d+)/);
527
        my $buffer = $self->buffer;
528
        my $start = $buffer->get_iter_at_line($line - 1);
529
        my $end = $start->copy;
530
        $end->forward_to_line_end;
531
 
532
        $self->clear_highlighted();
533
        $self->show_highlighted(goto_line => $start, $end);
534
}
535
 
536
 
537
sub do_quit {
538
        my $self = shift;
539
        Gtk2->main_quit();
540
}
541
 
542
 
543
sub do_save_as {
544
        my $self = shift;
545
 
546
        # If no file is associated with the editor then ask the user for a file where
547
        # to save the contents of the buffer.
548
        my $dialog = Gtk2::FileChooserDialog->new(
549
                "Save file", $self->window, 'save',
550
                'gtk-cancel' => 'cancel',
551
                'gtk-save'   => 'ok',
552
        );
553
 
554
        my $response = $dialog->run();
555
        if ($response eq 'ok') {
556
                $self->filename($dialog->get_filename);
557
                $self->do_save();
558
        }
559
        $dialog->destroy();
560
}
561
 
562
 
563
sub do_save {
564
        my $self = shift;
565
 
566
        my $filename = $self->filename;
567
 
568
        # If there's no file then do a save as...
569
        if (! $filename) {
570
                $self->do_save_as();
571
                return;
572
        }
573
 
574
        my $buffer = $self->buffer;
575
        open my $handle, '>:encoding(UTF-8)', $filename or die "Can't write to $filename: $!";
576
        print $handle $self->get_text;
577
        close $handle;
578
 
579
        if (! $buffer->get_language) {
580
                $self->detect_language($filename);
581
        }
582
}
583
 
584
 
585
sub build_menu {
586
        my $self = shift;
587
 
588
        my $entries = [
589
                # name, stock id, label
590
                [ "FileMenu",  undef, "_File" ],
591
                [ "SearchMenu",  undef, "_Search" ],
592
                [ "HelpMenu",  undef, "_Help" ],
593
 
594
                # name, stock id, label, accelerator, tooltip, method
595
                [
596
                        "New",
597
                        'gtk-new',
598
                        "_New",
599
                        "<control>N",
600
                        "Create a new file",
601
                        sub { $self->do_file_new(@_) }
602
                ],
603
                [
604
                        "Open",
605
                        'gtk-open',
606
                        "_Open",
607
                        "<control>O",
608
                        "Open a file",
609
                        sub { $self->do_file_open(@_) }
610
                ],
611
                [
612
                        "Save",
613
                        'gtk-save',
614
                        "_Save",
615
                        "<control>S",
616
                        "Save current file",
617
                        sub { $self->do_save(@_) }
618
                ],
619
                [
620
                        "SaveAs",
621
                        'gtk-save',
622
                        "Save _As...",
623
                        "<control><shift>S",
624
                        "Save to a file",
625
                        sub { $self->do_save_as(@_) }
626
                ],
627
                [
628
                        "Quit",
629
                        'gtk-quit',
630
                        "_Quit",
631
                        "<control>Q",
632
                        "Quit",
633
                        sub { $self->do_quit() }
634
                ],
635
                [
636
                        "About",
637
                        'gtk-about',
638
                        "_About",
639
                        undef,
640
                        "About",
641
                        sub { $self->do_show_about_dialog(@_) }
642
                ],
643
                [
644
                        "GotoLine",
645
                        undef,
646
                        "Goto to _Line",
647
                        "<control>L",
648
                        "Go to line",
649
                        sub { $self->do_ask_goto_line(@_) }
650
                ],
651
        ];
652
 
653
        my $actions = Gtk2::ActionGroup->new("Actions");
654
        $actions->add_actions($entries, undef);
655
 
656
        my $ui = Gtk2::UIManager->new();
657
        $ui->insert_action_group($actions, 0);
658
        $ui->add_ui_from_string(<<'__UI__');
659
<ui>
660
        <menubar name='MenuBar'>
661
                <menu action='FileMenu'>
662
                        <menuitem action='New'/>
663
                        <menuitem action='Open'/>
664
                        <separator/>
665
                        <menuitem action='Save'/>
666
                        <menuitem action='SaveAs'/>
667
                        <separator/>
668
                        <menuitem action='Quit'/>
669
                </menu>
670
                <menu action='SearchMenu'>
671
                        <menuitem action='GotoLine'/>
672
                </menu>
673
                <menu action='HelpMenu'>
674
                        <menuitem action='About'/>
675
                </menu>
676
        </menubar>
677
</ui>
678
__UI__
679
 
680
        $self->window->add_accel_group($ui->get_accel_group);
681
 
682
        return $ui->get_widget('/MenuBar');
683
}
684
 
685
 
686
 
687
sub add_to_tree {
688
 my ($tree_view,$tree_store, $parent, $dir, $path) = @_;
689
my $tree_model = $tree_view->get_model();
690
 
691
# If $parent already has children, then remove them first
692
 my $child = $tree_model->iter_children ($parent);
693
 while ($child) {
694
  $tree_store->remove ($child);
695
  $child = $tree_model->iter_children ($parent);
696
 }
697
 
698
# Add children from directory listing
699
 opendir(DIRHANDLE, $path) || return ; #die "Cannot open directory:$path $!\n";
700
 foreach my $subdir (sort readdir(DIRHANDLE)) {
701
  if ($subdir ne '.' and $subdir ne '..'
702
                                   # and -d $path.$subdir and -r $path.$subdir
703
) {
704
   my $child = $tree_store->append($parent);
705
   $tree_store->set($child, 0, $subdir, 1, "$path$subdir/");
706
  }
707
 }
708
 closedir(DIRHANDLE);
709
}
710
 
711
 
712
# Directory expanded. Populate subdirectories in readiness.
713
 
714
sub populate_tree {
715
 
716
# $iter has been expanded
717
 my ($tree_view,$tree_store, $iter, $tree_path) = @_;
718
 my $tree_model = $tree_view->get_model();
719
 my ($dir, $path) = $tree_model->get($iter);
720
 
721
# for each of $iter's children add any subdirectories
722
 my $child = $tree_model->iter_children ($iter);
723
 while ($child) {
724
  my ($dir, $path) = $tree_model->get($child, 0, 1);
725
  add_to_tree($tree_view,$tree_store, $child, $dir, $path);
726
  $child = $tree_model->iter_next ($child);
727
 }
728
 return;
729
}
730
 
731
 
732
sub run_make_file {
733
        my ($dir,$outtext)=@_;
734
        my $cmd =       "cd \"$dir/\" \n  make ";
735
        my $error=0;
736
        show_info(\$outtext,"$cmd\n");
737
 
738
        my ($stdout,$exit,$stderr)=run_cmd_in_back_ground_get_stdout( $cmd);
739
 
740
 
741
 
742
        if($stderr){
743
                $stderr=~ s/[‘,’]//g;
744
                add_info(\$outtext,"$stdout\n");
745
                add_colored_info(\$outtext,"$stderr\n","red");
746
                add_colored_info(\$outtext,"Compilation failed.\n",'red');
747
 
748
        }else{
749
 
750
                add_info(\$outtext,"$stdout\n");
751
                add_colored_info(\$outtext,"Compilation finished successfully.\n",'blue');
752
        }
753
 
754
        #add_info(\$outtext,"**********Quartus compilation is done successfully in $target_dir!*************\n") if($error==0);
755
 
756
 
757
 
758
}
759
 
760
 
761
 
762
 
763
1;
764
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.