Пример #1
0
bool ProcUtils::Shell()
{
	wxString cmd;
#ifdef __WXMSW__
	wxChar *shell = wxGetenv(wxT("COMSPEC"));
	if ( !shell ) {
		shell = (wxChar*) wxT("\\COMMAND.COM");
	}

	// just the shell
	cmd = shell;
#elif defined(__WXMAC__)
	wxString path = wxGetCwd();
	cmd = wxString( wxT("osascript -e 'tell application \"Terminal\"' -e 'activate' -e 'do script with command \"cd ") + path + wxT("\"' -e 'end tell'") );
#else //non-windows
	//try to locate the default terminal
	wxString terminal;
	wxString where;
	if (Locate(wxT("gnome-terminal"), where)) {
		terminal = where;
	} else if (Locate(wxT("konsole"), where)) {
		terminal = where;
	} else if (Locate(wxT("xterm"), where)) {
		terminal = where;
	}
	cmd = terminal;
#endif
	return wxExecute(cmd, wxEXEC_ASYNC) != 0;
}
Пример #2
0
double BiLinear(int Na, double *a_table, double a,
		int Nb, double *b_table, double b,
		double **f, bool_t hunt)
{
  static int i = 0, j = 0;

  double fa, fb;

  /* --- Bi-linear interpolation of function f[][] given on 
         rectangular grid (a_table, b_table) --        -------------- */

  if (hunt) {
    Hunt(Na, a_table, a, &i);
    Hunt(Nb, b_table, b, &j);
  } else {
    Locate(Na, a_table, a, &i);
    Locate(Nb, b_table, b, &j);
  }
  fa = (a_table[i+1] - a) / (a_table[i+1] - a_table[i]);
  fb = (b_table[j+1] - b) / (b_table[j+1] - b_table[j]);

  return                 fa*fb * f[i][j] +
                 fa*(1.0 - fb) * f[i][j+1] +
                 (1.0 - fa)*fb * f[i+1][j] +
         (1.0 - fa)*(1.0 - fb) * f[i+1][j+1];
}
Пример #3
0
void CreateDG (MGraph *G)
{
	G->kind = DG;

	int i, j, k, cost;
	VertexData v1, v2;
	printf ("Enter vernum and arcnum:(<%d): ", MAX);
	scanf ("%d %d", &(G->vernum), &(G->arcnum));
	getchar ();
	printf ("Enter the vertex: ");
	for (i = 0; i < G->vernum; i++)
		scanf ("%c", &(G->vertex[i]));
	for (i = 0; i < G->vernum; i++)
		for (j = 0; j < G->vernum; j++)
			G->arcs[i][j] = INFINITY;
	for (k = 0; k < G->arcnum; k++)
	{
		printf ("Enter v1 v2 and cost: ");
		getchar ();
		scanf ("%c %c %d", &v1, &v2, &cost);
		i = Locate (G, v1);
		j = Locate (G, v2);
		G->arcs[i][j] = cost;	
	}
}
Пример #4
0
/**
*
* _cd(debug, path);
*
* Change current working directory.
*
**/
PUBLIC void _cd(DEBUG *debug, char *path)
{
    Object *cwd;

    if (path == NULL)
        if ((path = getvar(debug->env.Envv, "HOME")) == NULL)
            cmderr(debug, "No home directory");

#ifdef OLDCODE
    if ((cwd = Locate(debug->env.Objv[0], path)) == NULL)
#endif
        /*
        -- crf : 12/08/91 - clean up use of Environment Objv
        */
        if ((cwd = Locate(debug->env.Objv[OV_Cdir], path)) == NULL)
            cmderr(debug, "No such directory");
#ifdef OLDCODE
    Close(debug->env.Objv[0]);
    debug->env.Objv[0] = cwd;
#endif
    /*
    -- crf : 12/08/91 - clean up use of Environment Objv
    */
    Close(debug->env.Objv[OV_Cdir]);
    debug->env.Objv[OV_Cdir] = cwd;

    cmdmsg( debug, "Current directory is now '%s'", path );

    return;
}
Пример #5
0
void CreateALGraph(ALGraph *G)
     {/*建立有向图的邻接表存储*/
       int i,j,k;
       char vex1[3],vex2[3];
       EdgeNode * s;
       printf("输入图的顶点数和边数(用逗号分隔):\n");
       scanf("%d,%d",&(G->n),&(G->e));  /*保存输入的顶点数和边数*/
       printf("输入顶点信息(不超过2个字符):\n");
       for (i=0;i<G->n;i++)              /*建立n个顶点的顶点数组*/
      {scanf("\n%s",G->adjlist[i].vertex);    /*输入每个顶点的标识信息*/
      G->adjlist[i].firstedge=NULL;       /*顶点的邻接表头指针设为空*/
       }
       printf("\n输入图中每条边所依附的两个顶点的的标识信息: ");
       for (k=0;k<G->e;k++)         /*输入e条边建立邻接表*/
        {
        printf("\n输入第%d条边的第1个顶点:",k+1);
        scanf("%s",vex1);
        printf("输入第%d条边的第2个顶点:",k+1);
        scanf("%s",vex2);
        i=Locate(G,vex1);j=Locate(G,vex2); /*i,j为顶点在顶点数组中的下标  */

      s=(EdgeNode*)malloc(sizeof(EdgeNode));  /*生成新的边结点s*/
      s->adjvex=j;                          /*邻接点序号为j*/
      s->next=G->adjlist[i].firstedge;           /*将新的边结点s插入到顶点Vi的邻接表头部*/
      G->adjlist[i].firstedge=s;
       }
}
Пример #6
0
void CreateOLG(OLGraph *G) /*采用十字链表表示,构造有向图G*/
{  
int i,j,k;
char vex1[3],vex2[3];
ArcNode * s;
printf("输入有向图的顶点数和弧数(用逗号分隔:)\n");
scanf ("%d,%d",&(G->vexnum),&(G->arcnum)); 
        printf("输入顶点信息(不超过2个字符):\n");
for (i=0;i<G->vexnum;i++)                       /*建立顶点表*/
        { 
scanf("\n%s",G->vlist[i].vertex);                 /*输入每个顶点的标识信息*/
     G->vlist[i].firstin=NULL;G->vlist[i].firstout =NULL;  /*初始化指针*/
        }
       for(k=0;k<G->arcnum; k++)                        /*输入e条弧,构造十字链表*/
        {
         printf("\n输入第%d条边的第1个顶点:",k+1);
        scanf("%s",vex1);
        printf("输入第%d条边的第2个顶点:",k+1);
        scanf("%s",vex2);
        i=Locate(G,vex1);j=Locate(G,vex2); /*i,j为弧<Vi,Vj>的顶点对应的数组下标 */

         s=(ArcNode*) malloc (sizeof(ArcNode));            /*生成新的弧结点s */
         s->tailvex=i;s->headvex=j;
         s->hlink=G->vlist[j].firstin;
         s->tlink=G->vlist[i].firstout;
         /*
         *s={ i,j,G->vlist[j].firstin,G->vlist[i].firstout};        对弧结点进行赋值*/
                                                     /*{tailvex,headvex,hlink,tlink}*/
         G->vlist[j].firstin=G->vlist[i].firstout=s;             /*完成在入弧和出弧链表链头的插入*/
        }
}
Пример #7
0
boolean TextManip::Manipulating (Event& e) {
    boolean manipulating = true;

    if (e.eventType == KeyEvent) {
        manipulating = HandleKey(e);

    } else if (e.eventType == MotionEvent && _selecting) {
        SelectMore(Locate(e.x, e.y));

    } else if (e.eventType == DownEvent) {
        if (e.shift) {
            SelectMore(Locate(e.x, e.y));
            _selecting = true;

        } else if (Contains(e.x, e.y)) {
            Select(Locate(e.x, e.y));
            _selecting = true;

        } else {
            manipulating = false;
        }

    } else if (e.eventType == UpEvent) {
        _selecting = false;
    }
    return manipulating;
}
Пример #8
0
Файл: barklem.c Проект: kouui/rh
bool_t getBarklemcross(Barklemstruct *bs, RLK_Line *rlk)
{
  const char routineName[] = "getBarklemcross";

  int index;
  double Z, neff1, neff2, findex1, findex2, reducedmass, meanvelocity,
         crossmean, E_Rydberg, deltaEi, deltaEj;
  Element *element;

  element = &atmos.elements[rlk->pt_index - 1];

  /* --- Note: ABO tabulations are valid only for neutral atoms -- -- */

  if (rlk->stage > 0)
    return FALSE;

  if ((deltaEi = element->ionpot[rlk->stage] - rlk->Ei) <= 0.0)
    return FALSE;
  if ((deltaEj = element->ionpot[rlk->stage] - rlk->Ej) <= 0.0)
    return FALSE;

  Z = (double) (rlk->stage + 1);
  E_Rydberg = E_RYDBERG / (1.0 + M_ELECTRON / (element->weight * AMU));
  neff1 = Z * sqrt(E_Rydberg / deltaEi);
  neff2 = Z * sqrt(E_Rydberg / deltaEj);

  if (rlk->Li > rlk->Lj) SWAPDOUBLE(neff1, neff2);

  if (neff1 < bs->neff1[0] || neff1 > bs->neff1[bs->N1-1])
    return FALSE;
  Locate(bs->N1, bs->neff1, neff1, &index);
  findex1 =
    (double) index + (neff1 - bs->neff1[index]) / BARKLEM_DELTA_NEFF;

  if (neff2 < bs->neff2[0] || neff2 > bs->neff2[bs->N2-1])
    return FALSE;
  Locate(bs->N2, bs->neff2, neff2, &index);
  findex2 =
    (double) index + (neff2 - bs->neff2[index]) / BARKLEM_DELTA_NEFF;

  /* --- Find interpolation in table --                -------------- */

  rlk->cross = cubeconvol(bs->N2, bs->N1,
			  bs->cross[0], findex2, findex1);
  rlk->alpha = cubeconvol(bs->N2, bs->N1,
			  bs->alpha[0], findex2, findex1);


  reducedmass  = AMU / (1.0/atmos.H->weight + 1.0/element->weight);
  meanvelocity = sqrt(8.0 * KBOLTZMANN / (PI * reducedmass));
  crossmean    = SQ(RBOHR) * pow(meanvelocity / 1.0E4, -rlk->alpha);

  rlk->cross *= 2.0 * pow(4.0/PI, rlk->alpha/2.0) *
    exp(gammln((4.0 - rlk->alpha)/2.0)) * meanvelocity * crossmean;

  rlk->vdwaals = BARKLEM;
  return TRUE;
}
Пример #9
0
void rm (char   *name )
{
	int no_entries;
	word dirsize;
	Stream *s;
	int     isdir;

	Object *o = Locate(CurrentDir,name);

	if( o == Null(Object) )
	{	fprintf(stderr,"Cannot find %s : %lx\n",name, Result2(CurrentDir));
		errors++;
		return;
	}

	isdir = (int)(o->Type & Type_Directory);

    	if (!isdir) 
	{ 	fprintf(stderr,"%s: %s is not a directory\n", progname, name);
		errors++;
		return;
		}
		
	Close (o);
	del(name); 
	
	while ( pflag && ( strcmp ( ( name = dirname (name) ) , "." ) != 0 ) ) {
		o = Locate(CurrentDir,name);
		if( o == Null(Object) )
		{	fprintf(stderr,"Cannot find %s : %lx\n",name, Result2(CurrentDir));
			errors++;
			return;
		}
		
		s = Open(o,NULL,O_ReadOnly);
			
		if( s == Null(Stream) )
		{
			fprintf(stderr,"Cannot open %s : %lx\n",name,Result2(o));
			errors++;
			return;
		}
		
		dirsize = GetFileSize(s);
		
		Close(s);
		Close(o);
					
		no_entries = (int)dirsize/sizeof(DirEntry);
		if (no_entries == 2)
			del (name);
			/* Having only two entries namely . and .. the directory 'name' will be deleted */
			/* without complaint from 'delete'. 						*/
		}	
	return;
}
Пример #10
0
int run(Object *w,string program, string *argv, bool wait)
{
	Object *code;
	Object *prog, *objv[2];
	Stream *s, *strv[4];
        char   *dummy = Null(char);
	word e;
	Environ env;
	char mcname[50];

	code = Locate(NULL,program);

	prog = Execute(NULL,code);

	if( prog == Null(Object)) return false;

	s = Open(prog,NULL,O_WriteOnly);

	if( s == Null(Stream) ) return false;

	MachineName(mcname);

	objv[0] = Locate(NULL,"/helios");
	objv[1] = Null(Object);

	strv[0] = Open(w,NULL,O_ReadOnly);
	strv[1] = Open(w,NULL,O_WriteOnly);
	strv[2] = Open(w,NULL,O_WriteOnly);
	strv[3] = Null(Stream);

	env.Argv = argv;
	env.Envv = &dummy; 
	env.Objv = &objv[0];
	env.Strv = &strv[0];
	
	e = SendEnv(s->Server,&env);

	if( wait )
	{
		MCB m;

		InitMCB(&m,0,prog->Reply,NullPort,0);
		m.Timeout = MaxInt;
		while((e = GetMsg(&m)) == EK_Timeout);
	}

	Close(code);
	Close(prog);
	Close(s);
	Close(objv[0]);
	Close(strv[0]);
	Close(strv[1]);
	Close(strv[2]);
	
	return true;
}
Пример #11
0
bool isExist (MGraph G, VertexData v1, VertexData v2)
{
	int i, j;
	i = Locate (&G, v1);
	j = Locate (&G, v2);
	if (G.arcs[i][j] == INFINITY)
		return false;
	else
		return true;
}
Пример #12
0
void CreateGraph(MGraph *g)
{
	int i ,j,k,w;
	char v1,v2;
	char temp;
	printf("输入顶点数目:Vexnum = ");
	scanf("%d",&(g->Vexnum));
	printf("\n输入边的数目:Edgenum = ");
	scanf("%d",&(g->Edgenum));

#ifdef DEBUG
	printf("Vexnum =%d ,edgenum = %d\n",g->Vexnum,g->Edgenum);
#endif
	i = 0;
	printf("请输入顶点Vex元素%d个字符:",g->Vexnum);
	while(i < g->Vexnum)
	{
		temp = getchar();
		if(temp != '\n')
			g->Vex[i++] = temp;	
	}

	while(getchar() != '\n');   //消耗掉多余的getchar(),防止过多输入;

#ifdef DEBUG
	i = 0;
	while(i < g->Vexnum)
	{
		printf("Vex[%d] = %c\n",i,g->Vex[i++]);
	}
#endif
	
	//初始化
	for(i = 0 ; i < g->Vexnum ; i++)
		for( j = 0 ; j < g->Vexnum ; j ++)
			g->Edge[i][j] = 0;
	
	for(k = 0 ; k < g->Edgenum ; k++)
	{
		printf("请输入第%d边的依附的顶点vx,vy,以及<vx,vy>的权值w,格式x,y,w:\n",k);
		v1 = getchar();
		v2 = getchar();
		scanf("%d",&w);
		while(getchar() != '\n');
#ifdef DEBUG
		printf("输入为%c %c %d \n",v1 ,v2 , w);
#endif

		i = Locate(g,v1);
		j = Locate(g,v2);
		g->Edge[i][j] = w;   //弧<v1,v2>
		g->Edge[j][i] = w;  //对称弧<v2,v1>
	}

}
Пример #13
0
void ClassEditor::ScrollBy (int lines) {
    TextEditor::ScrollBy(0, -lines*shape->vunits); 
        // explicit TextEditor:: works around cfront 1.2 bug

    int line = text->LineNumber(Dot());
    Coord b = display->Base(line);
    Coord t = display->Top(line);

    if (b < 0) {
        Select(Locate(0, 0));
    } else if (t > ymax) {
        Select(Locate(0, ymax));
    }
}
Пример #14
0
void main()
{
    int i;
    ElemType e;
    DLink *L;
    InitList(L);        /*初始化双链表L*/
    InsElem(L, 'a', 1); /*插入元素*/
    InsElem(L, 'c', 2);
    InsElem(L, 'a', 3);
    InsElem(L, 'e', 4);
    InsElem(L, 'd', 5);
    InsElem(L, 'b', 6);
    printf("线性表:");
    DispList(L);
    printf("长度:%d\n", GetLength(L));
    i = 3;
    GetElem(L, i, e);
    printf("第%d个元素:%c\n", i, e);
    e = 'a';
    printf("元素%c是第%d个元素\n", e, Locate(L, e));
    i = 4;
    printf("删除第%d个元素\n", i);
    DelElem(L, i);
    printf("线性表:");
    DispList(L);
}
Пример #15
0
void groupsearch(PEO *h)                //查询函数定义
{
    char temp;                //定义单字符temp
    char find[20];              //定义字符串find[]
    int n=0;
    PEO *p,*p0;                //定义节点p,p0
    if(h==NULL)
    {
        printf("\n\a对不起,无信息可查询!\n");
        return;
    }
    else
    {
        printf("\n请输入您要查询的群组:");
        scanf("%s",find);
        p=Locate(h,find,"group");   //调用Locate 函数,按群组名进行查找匹配
    }//else if
    if(p)
    {
        printf("\n                    ==============>查询结果<==============\n");
        menu4();
        while(p)
        {
            p0=p;
            data2(p0,find);                //输出按群组名查找的结果

            p=p->next;                //节点后移
            if((strcmp(find,p0->group)==0))    //当有重复群组名时,n加1
                n++;
        }//while
        printf("该群组有  %d 个联系人。 \n",n);
        menu4();
    }//if
    else    printf("\n\a对不起,无信息可查询!\n");
}
Пример #16
0
	DNALength Locate(T_DNASequence &seq, std::vector<DNALength> &positions, 
        DNALength maxCount =0) {
    PB_UNUSED(maxCount);
		DNALength ep, sp;
		Count(seq, sp, ep);
		return Locate(sp, ep, positions);
	}
Пример #17
0
void main()
{
    
    int i;
    ElemType e;
    struct node *L;
    struct node *L1,*L2;
	ElemType a[5]={'a','b','c','d','e'},b[5]={'f','g','h','i','j'};
    InitList(L);					//初始化
    InsElem(L,'a',1);
    InsElem(L,'c',2);
    InsElem(L,'a',3);
    InsElem(L,'e',4);
    InsElem(L,'d',5);
    InsElem(L,'b',6);
    printf("线性表L:");DispList(L);
    printf("长度:%d\n",GetLength(L));
    i=3;GetElem(L,i,e);
    printf("第%d个元素:%c\n",i,e);
    e='a';
    printf("元素%c是第%d个元素\n",e,Locate(L,e));
    i=4;printf("删除第%d个元素\n",i);
    DelElem(L,i);
    printf("线性表:");DispList(L);   //
	CreateListF(L1,a,5);
    printf("线性表L1:");
    DispList(L1);
    CreateListR(L2,b,5);
    printf("线性表L2:");
    DispList(L2);
}
Пример #18
0
int Insert(ZGGZ tp[], int n)
{
  if (n == 0) return -1;
  int count = n;
  int i;
  Disp(tp,count);
  while(1){
    int k;
    stringinput(tp[count].num, 10, "编号");
    k = Locate(tp, count, tp[count].num, 1);
    if (k < 0) continue;
    for (i = count; i > k; --i) {
      tp[i] = tp[i-1];
    }
    stringinput(tp[k].num, 10, "新编号");
    stringinput(tp[k].name, 15, "新姓名");
    tp[k].jbgz = numberinput("新基本工资");
    tp[k].jj = numberinput("新奖金");
    tp[k].kk = numberinput("新扣款");
    //完成相关计算
    tp[k].yfgz = tp[k].jbgz + tp[k].jj - tp[k].kk;
    tp[k].sk = tp[k].yfgz * 0.4;
    tp[k].sfgz = tp[k].yfgz - tp[k].sk;
    count++;
    saveflag = 1;
    Disp(tp, count);
    return count;
  }
}
Пример #19
0
int main()
{
	struct SqList L;
	InitList(&L);
	printf("ListEmpty(L) = %d\n", ListEmpty(L));
	printSqList(L);
	
	int e;
	int index = 7;
	GetElem(L, index, &e);
	printf("the %d th number is e : %d\n", index, e);
	printf("Find %d at index %d\n", e, Locate(L, e));


	int insertNum = 100;
	ListInsert(&L, index, 100);
	printf("Insert %d at index %d  into SqList\n", insertNum, index);
	printSqList(L);

	ListDelete(&L, index, &e); 
	printf("Delete %d at index %d from SqlList\n", e, index);
	printSqList(L);
	
	printf("ListLength(L) = %d\n", ListLength(L));

    ClearList(&L);
	printf("ListEmpty(L) = %d\n", ListEmpty(L));
	printSqList(L);

	return 0;
}
Пример #20
0
void TextManip::Grasp (Event& e) {
    _grasp_e = e;

    Viewer* v = GetViewer();
    Selection* s = v->GetSelection();
    v->Constrain(e.x, e.y);

    _selecting = true;
    if (!_prepositioned) {
        _xpos = e.x;
        _ypos = e.y;
    }

    PlaceTextDisplay(_xpos, _ypos);
    Coord l, b, r, t;
    _display->CaretStyle(BarCaret);
    _display->Bounds(l, b, r, t);
    _display->Redraw(l, b, r, t);

    _selection = new Selection(s);
    s->Clear();

    if (_prepositioned) {
        Select(Locate(e.x, e.y));
    }
}
Пример #21
0
int main(void)
{ ObjInfo info;
  Object  *o;
  time_t  now;
  word    uptime, hours, minutes, seconds;
  
  now = time((time_t *) NULL);
  
  o = Locate(Null(Object), "/logger");
  if (o == Null(Object))
   { fprintf(stderr, "Error : failed to locate /logger.\n");
     return(1);
   }
   
  ObjectInfo(o, Null(char), (byte *) &info);
  
  uptime  = (word) now - info.Dates.Creation;
  seconds = uptime % 60; uptime /= 60;
  minutes = uptime % 60; uptime /= 60;
  hours   = uptime % 24; uptime /= 24;

  printf("%.24s : up %ld days, %2ld:%02ld.%02ld.\n", ctime(&now),
         uptime, hours, minutes, seconds);
  return(0);	
}
/* ------------------------------------------------------------------------------------ */
bool CPersistentAttributes::Has(const char *szTag)
{
	if(Locate(szTag) != NULL)
		return true;
	else
		return false;
}
Пример #23
0
void main()
{
    int i;
    ElemType e;
    SqList sq;
    InitList(sq);       /*初始化顺序表sq*/
    InsElem(sq, 'a', 1); /*插入元素*/
    InsElem(sq, 'c', 2);
    InsElem(sq, 'a', 3);
    InsElem(sq, 'e', 4);
    InsElem(sq, 'd', 5);
    InsElem(sq, 'b', 6);
    printf("线性表:");
    DispList(sq);
    printf("长度:%d\n", GetLength(sq));
    i = 3;
    GetElem(sq, i, e);
    printf("第%d个元素:%c\n", i, e);
    e = 'a';
    printf("元素%c是第%d个元素\n", e, Locate(sq, e));
    i = 4;
    printf("删除第%d个元素\n", i);
    DelElem(sq, i);
    printf("线性表:");
    DispList(sq);
}
Пример #24
0
void Linear(int Ntable, double *xtable, double *ytable,
	    int N, double *x, double *y, bool_t hunt)
{
  register int n;

  bool_t ascend;
  int    j = 0;
  double xmin, xmax, fx;

  ascend = (xtable[1] > xtable[0]) ? TRUE : FALSE;
  xmin = (ascend) ? xtable[0] : xtable[Ntable-1];
  xmax = (ascend) ? xtable[Ntable-1] : xtable[0];

  for (n = 0;  n < N;  n++) {
    if (x[n] <= xmin)
      y[n] = (ascend) ? ytable[0] : ytable[Ntable-1];
    else if (x[n] >= xmax)
      y[n] = (ascend) ? ytable[Ntable-1] : ytable[0];
    else {
      if (hunt) 
	Hunt(Ntable, xtable, x[n], &j);
      else
	Locate(Ntable, xtable, x[n], &j);

      fx = (xtable[j+1] - x[n]) / (xtable[j+1] - xtable[j]);
      y[n] = fx*ytable[j] + (1 - fx)*ytable[j+1];
    }
  }
}
int main() 
{
    char buf[1024];
    char c;
    int i;
	printf("请输入字符串:\n");
    gets(buf);
    for(i = 0;i < strlen(buf);i++) 
	{
		if(!isupper(buf[i]) && !islower(buf[i])) 
		{
			perror("字符串只可以包含大小写字母!\n");
			exit(1);
		}
    }
    LoadHashTable(buf);
    if(Locate(buf, c)) 
	{
		printf("第一个只出现一次的字符为:");
		putchar(c);
	}
	else 
		perror("没有出现一次的字母!");
    printf("\n");
	return 0;
}
Пример #26
0
int main(int argc, char **argv)
{ WORD buffer[IOCDataMax/sizeof(word)], result;
  Object *drive;
  int i;

  printf("          Size(Kb)      Used(Kb)     Available(Kb)\n");

  if (argc == 1)
    { if ((result = ServerInfo(cdobj(), (BYTE *) buffer)) < 0)
	{ printf("ServerInfo failed : %lx\n", result);
	  exit(1);
        }    
      printf("      %10ld    %10ld      %10ld\n", buffer[1] / 1024, 
             (buffer[1] - buffer[2]) / 1024, buffer[2] / 1024);
    }

  for (i = 1; i < argc; i++)
    { if ((drive = Locate(cdobj(), argv[i])) == (Object *) NULL)
        { printf("Unable to locate %s.\n", argv[i]);
          continue;
        }
      if ((result = ServerInfo(drive, (BYTE *) buffer)) < 0)
        { printf("ServerInfo failed : %lx\n", result);
          continue;
        }

      printf("      %10ld    %10ld      %10ld\n", buffer[1] / 1024, 
             (buffer[1] - buffer[2]) / 1024, buffer[2] / 1024);
    }
return 0;
}
Пример #27
0
boolean StringBrowser::LeftButtonDown (Event& e) {
    boolean status = false;

    if (DoubleClicked(e)) {
        subject->SetValue(done[0]);
        status = true;

    } else if (uniqueSel) {
        if (Selections() == 0) {
            Select(Locate(e.x, e.y));
        } else {
            Unselect(Selection());
            if (!e.shift) {
                Select(Locate(e.x, e.y));
            }
        }

    } else {
        lastdot = lastmark = Locate(e.x, e.y);

        if (Selected(lastdot) && e.shift) {
            Unselect(lastdot);
            do {
                ScrollToView(e.x, e.y);
                UpdateSelection(lastdot, Locate(e.x, e.y), Plain);
                Poll(e);
            } while (e.leftmouse);

        } else {
            if (!e.shift) {
                UnselectAll();
            }
            Select(lastdot);
            do {
                ScrollToView(e.x, e.y);
                UpdateSelection(lastdot, Locate(e.x, e.y), highlight);
                Poll(e);
            } while (e.leftmouse);
        }
    }
    Note(e);
    if (singleClick) {
        subject->SetValue(done[0]);
        status = true;
    }
    return status;
}
/* ------------------------------------------------------------------------------------ */
int CPersistentAttributes::Count(const char *szTag)
{
	PersistAttribute *pAttr = Locate(szTag);

	if(pAttr == NULL)
		return 0;
	else
		return pAttr->Count;
}
/* ------------------------------------------------------------------------------------ */
int CPersistentAttributes::High(const char *szTag)
{
	PersistAttribute *pAttr = Locate(szTag);

	if(pAttr == NULL)
		return 0;
	else
		return pAttr->ValueHighLimit;
}
/* ------------------------------------------------------------------------------------ */
unsigned char *CPersistentAttributes::UserData(const char *szTag)
{
	PersistAttribute *pAttr = Locate(szTag);

	if(pAttr == NULL)
		return NULL;								// Attribute not found

	return pAttr->UserData;
}