~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to routines/tksci/LAB_findobj.c

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright INRIA */
 
2
#include "C-LAB_Interf.h"
 
3
#include "TK_uicontrol.h"
 
4
#include "TK_ScilabCallback.h"
 
5
#include "tksci.h"
 
6
#include <stdio.h>
 
7
 
 
8
 
 
9
void LAB_findobj()
 
10
 
 
11
 
 
12
{
 
13
 
 
14
 
 
15
  
 
16
  Matrix *Mfield;
 
17
  char *field;
 
18
 
 
19
  Matrix *Mvalue;
 
20
  char *value;
 
21
 
 
22
  Matrix *MOutputHandle;
 
23
  double *OutputHandle;
 
24
 
 
25
  char MyCommand[2000];
 
26
  char *StrHandle;
 
27
  int Handle;
 
28
 
 
29
 
 
30
  Mfield  = (Matrix *)Interf.Param[0];
 
31
  field = MatrixReadString(Mfield);
 
32
  nocase(field);
 
33
 
 
34
  Mvalue  = (Matrix *)Interf.Param[1];
 
35
  value = MatrixReadString(Mvalue);
 
36
  nocase(value);
 
37
  sprintf(MyCommand, "set MyTmpBertrand [FindObj \"%s\" \"%s\"];", field, value);
 
38
  
 
39
  Tcl_Eval(TKinterp,MyCommand);
 
40
  StrHandle = Tcl_GetVar(TKinterp, "MyTmpBertrand", 0);
 
41
  Handle = (int)atoi(StrHandle);
 
42
  if (Handle == -1)  
 
43
    /* object not found */
 
44
    MOutputHandle = (Matrix *)MatrixCreate(0,0,"real");
 
45
  else
 
46
    {
 
47
      /* objet found */
 
48
      MOutputHandle = (Matrix *)MatrixCreate(1,1,"real");
 
49
      OutputHandle = (double *)MatrixGetPr(MOutputHandle);
 
50
      *OutputHandle = (double)Handle;
 
51
    }
 
52
  ReturnParam(MOutputHandle);
 
53
  
 
54
}