File: scipad.sci

package info (click to toggle)
scilab 4.0-12
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 100,640 kB
  • ctags: 57,333
  • sloc: ansic: 377,889; fortran: 242,862; xml: 179,819; tcl: 42,062; sh: 10,593; ml: 9,441; makefile: 4,377; cpp: 1,354; java: 621; csh: 260; yacc: 247; perl: 130; lex: 126; asm: 72; lisp: 30
file content (77 lines) | stat: -rw-r--r-- 3,189 bytes parent folder | download
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
function scipad(varargin)
// start Scipad editor
global LANGUAGE
global TMPDIR
  if with_tk() then
    if ~TCL_ExistInterp("scipad") then    
      TCL_EvalStr("interp create scipad")
      TCL_EvalStr("load {'+gettklib()+'} Tk scipad")
      TCL_EvalStr("wm withdraw .","scipad")
      TCL_EvalStr("scipad alias ScilabEval ScilabEval")
    end
    if exists("SCIHOME") then
      if MSDOS then
        TCL_EvalStr("set env(SCIHOME) """+strsubst(SCIHOME,"\","/")+"""","scipad")
      else
        TCL_EvalStr("set env(SCIHOME) """+pathconvert(SCIHOME,%f,%t)+"""","scipad")
      end
    end
    if MSDOS then
      TCL_EvalStr("set tmpdir """+strsubst(TMPDIR,"\","/")+"""","scipad")
    else
      TCL_EvalStr("set tmpdir """+pathconvert(TMPDIR,%f,%t)+"""","scipad")
    end
    // Although the following line might seem to be a bit too much it is
    // designed to take advantage of the ScilabEval sequential mode in
    // order to prevent flushing of events by Scilab to Tcl during the
    // launch of Scipad
//    TCL_EvalStr("ScilabEval {TCL_EvalStr(""scipad eval {source """""+SCI+ ..
//                  "/tcl/scipadsources/scipad.tcl""""}"")} ""seq"" ")
    TCL_EvalStr("source """+SCI+"/tcl/scipadsources/scipad.tcl""","scipad")
    nfiles=argn(2)
    if nfiles>0 then
      for i=1:nfiles
        validfile=%f;
        f=varargin(i)
        select type(f)        
          case 1 then filetoopen=string(f); validfile=%t;
          case 8 then filetoopen=string(f); validfile=%t;
          case 10 then filetoopen=f; validfile=%t;
////nice try, but can't be done. The assignement to the argument
//// overrides the original function name, and this is correct.
//          case 13 then
//            b=macr2tree(f); funname=b(2) //DOESN'T WORK. How else?
//            libmacro=whereis(funname)
//                 disp(libmacro,funname)
//            if libmacro<>[] & funname<>[] then
//              a=string(eval(libmacro));libpath=a(1)
//              if libpath<>[] then
//                 validfile=%t;
//          //the correspondance between function and file name it is tacitly assumed
//                 filetoopen=pathconvert(libpath+funname+".sci",%f)
//              else
//                 warning("Function "+funname+"is not contained in a loaded library, "..
//                         +"Scipad doesn''t know where to find its source")
//              end
//            end
          else
            warning("Scipad cannot open a "+typeof(f)+" object!")
        end
        if validfile then 
          filetoopen=pathconvert(filetoopen,%f,%t);
          if MSDOS then 
            filetoopen=strsubst(filetoopen,"\","/"); 
          end
//  Given that scipad is open via a ScilabEval as is done above, the initial
//  opening of files has to be done in the same way, so that the command is sequenced
//  after scipad is really open
//          TCL_EvalStr("ScilabEval {TCL_EvalStr(""scipad eval {openfile {"+..
//                        filetoopen +"}}"")} ""seq"" ")     
            TCL_EvalStr("openfile """+filetoopen+"""","scipad")
        end
      end
    end
  else
    error(" Scilab has not been built with tk: Scipad unavailable")
  end
endfunction