summaryrefslogtreecommitdiff
path: root/context/perltk/texshow.pl
blob: db1ce778c34422e42718ff56d30da21aa5fb5f05 (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
eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
        if 0;

#D \module
#D   [       file=texshow.pl,
#D        version=1999.03.30,
#D          title=\TEXSHOW, 
#D       subtitle=showing \CONTEXT\ commands,
#D         author=Hans Hagen,
#D           date=\currentdate,
#D      copyright={PRAGMA / Hans Hagen \& Ton Otten},
#D    suggestions={Tobias Burnus \& Taco Hoekwater}]
#C
#C This module is part of the \CONTEXT\ macro||package and is
#C therefore copyrighted by \PRAGMA. See licen-en.pdf for 
#C details. 

#D We need to find the module path. We could have used: 
#D
#D \starttypen 
#D use FindBin ; 
#D use lib $FindBin::Bin ;  
#D \stoptypen
#D
#D But because we're sort of depending on \WEBC\ anyway, the
#D next few lines are more appropriate: 

BEGIN 
 { $cont_pm_path = `kpsewhich --format="other text files" --progname=context cont_mis.pm` ; 
   chomp($cont_pm_path) ; 
   $cont_pm_path =~ s/cont_mis\.pm.*// } 
   
use lib $cont_pm_path ; 

#D Now we can load some modules: 

use Getopt::Long ;

$Getopt::Long::passthrough = 1 ; # no error message
$Getopt::Long::autoabbrev  = 1 ; # partial switch accepted

&GetOptions
  (      "help" => \$ShowHelp , 
    "interface" => \$Interface ) ;

cont_mis::banner ('TeXShow 0.1 - ConTeXt', 'PRAGMA ADE 1999') ;

if ($ShowHelp) 
  { cont_mis::help ('--help', "print this help") ; 
    cont_mis::help ('--interface', "primary interface") ; 
    cont_mis::help ('string', "show info about command 'string'") ; 
    cont_mis::help ('string lg', "show info about 'string' in language 'lg'") ; 
    cont_mis::crlf () ;
    exit 0 } 

use cont_mis ; 
use cont_set ; 

use Tk ; 

#D This scripts is rather simple, because most of the action
#D takes place in the module \type {cont_set.pm}.  

cont_mis::status ('searching for setup files') ; 

if (cont_set::setups_found) 
  { cont_mis::status ('loading setups') ; 
    cont_set::load_setups ;
    cont_mis::status ('preparing display') ; 
    cont_set::show_setups ; 
    $command = $ARGV[0] ; 
    $interface = $ARGV[1] ; 
    if ($interface) 
      { $Interface = $interface } 
    if ($Interface) 
      { cont_set::set_setup_interface($Interface) ; 
        cont_mis::message ('primary interface', $Interface) } 
    if ($command) 
      { cont_mis::message ('searching command', $command) ; 
        cont_set::show_setup ($command) } 
    else 
      { cont_mis::warning ('no command specified') ;
        cont_set::set_setup_title('TeXShow : ConTeXt commands') }
    cont_mis::status ('entering main loop') ; 
    MainLoop () }
else 
  { cont_mis::error ('no setup files found') } 

END { cont_mis::crlf ;    
      cont_mis::status ('closing down') }