Esempio n. 1
0
File: define.c Progetto: juddy/edcde
int
do_finddef(
        int argc,
        char **argv )
{
   unsigned long found;
   struct symarray dummy;
   char * errmsg;

   if (argc < 2) 
      XK_USAGE(argv[0]);

   if (fdef(argv[1], &found)) 
   {
      if (argc >= 3) 
      {
         char buf[50];

         sprintf(buf, use2, argv[2], found);
         env_set(buf);
      }
      else 
      {
         sprintf(xk_ret_buffer, use, found);
         xk_ret_buf = xk_ret_buffer;
      }
      return(SH_SUCC);
   }
   errmsg = strdup(GETMESSAGE(3, 2, "Unable to locate the define '%s'"));
   printerrf(argv[0], errmsg, argv[1], NULL, NULL, NULL,
             NULL, NULL, NULL, NULL);
   free(errmsg);
   return(SH_FAIL);
}
Esempio n. 2
0
File: a.c Progetto: zeotrope/j7-src
F1(bool){A b,h;I j,*v;
 RZ(w);
 if(VERB&AT(w))R ADERIV(CBOOL, basis1,0L, 0L,0L,0L);
 RZ(w=vi(w));
 v=AV(w);
 DO(AN(w), j=*v++; ASSERT(-16<=j&&j<16,EVINDEX));
 GA(b,BOOL,64,2,0); *AS(b)=16; *(1+AS(b))=4; MC(AV(b),booltab,64L);
 RZ(h=cant2(apv(AR(w),0L,1L),from(w,b)));
 R fdef(CBOOL,VERB, bool1,bool2, w,0L,h, 0L, RMAXL,0L,0L);
}
Esempio n. 3
0
MStatus HesperisCmd::deformSelected()
{
    H5FieldIn t;
    if(!t.open(m_fileName.asChar())) {
        MGlobal::displayInfo(MString("cannot open file")
                             + m_fileName);
        return MS::kFailure;
    }
    
    MGlobal::displayInfo(MString("hesperis add field deformer from file")
                         +m_fileName);
						 
	int minFrame = t.FirstFrame;
    int maxFrame = t.LastFrame;
    
    HFlt3AttributeEntry transgrp(".translate");
    Vector3F fieldT;
    transgrp.load(&fieldT);
    AHelper::Info<Vector3F>("field translate is ", fieldT);
	t.close();
	
    MGlobal::displayInfo(MString("hesperis field deform frame range (")
                         +minFrame
                         +MString(",")
                         +maxFrame
                         +MString(")"));
	
    MStringArray deformerName;
    MGlobal::executeCommand("deformer -type hesperisDeformer", deformerName);
    MGlobal::displayInfo(MString("node ")+deformerName[0]);
    MGlobal::executeCommand(MString("setAttr -type \"string\" ")
                            + deformerName[0]
                            + MString(".cachePath \"")
                            + m_fileName
                            + "\"");
							
	MObject odef;
	if( !ASearchHelper::FirstDepNodeByName(odef, deformerName[0], MFn::kPluginDeformerNode) ) {
		MGlobal::displayInfo(MString("cannot find node by name ")
							+ deformerName[0]);
		return MS::kFailure;
	}
	
	MFnDependencyNode fdef(odef);
	fdef.findPlug("minFrame").setValue(minFrame);
	fdef.findPlug("maxFrame").setValue(maxFrame);
	AHelper::SimpleAnimation(fdef.findPlug("currentTime"), minFrame, maxFrame);
	
	if(m_growMeshName == "") {
		MGlobal::displayInfo(" no grow mesh is set");
		return MS::kSuccess;
	}
	return attachSelected(fieldT);
}
Esempio n. 4
0
int
do_symbolic(
        int argc,
        char **argv )
{
	int i, nsyms, isflag;
	unsigned long j;
	struct symarray syms[50];
	struct memtbl *tbl;
	char *p;
	char *type = NULL;
        char * errmsg;

	nsyms = 0;
	isflag = 0;
	for (i = 1; (i < argc) && argv[i]; i++) {
		if (argv[i][0] == '-') {
			for (j = 1; argv[i][j]; j++) {
				switch(argv[i][j]) {
				case 'm':
					isflag = 1;
					break;
				case 't':
					if (argv[i][j + 1])
						type = argv[i] + j + 1;
					else
						type = argv[++i];
					j = strlen(argv[i]) - 1;
					break;
				}
			}
		}
		else {
			syms[nsyms++].str = argv[i];
			if (nsyms == 50)
				break;
		}
	}
	if ((type == NULL) || (!nsyms)) {
		XK_USAGE(argv[0]);
	}
	if (p = strchr(type, '.')) {
		*p = '\0';
		if ((tbl = all_tbl_search(type, 0)) == NULL) {
			*p = '.';
                        errmsg = strdup(GetSharedMsg(DT_UNDEF_TYPE));
			printerrf(argv[0], errmsg, type, NULL, NULL,
                                  NULL, NULL, NULL, NULL, NULL);
                        free(errmsg);
			return(SH_FAIL);
		}
		if ((tbl = ffind(tbl, p + 1, NULL)) == NULL) {
                        errmsg=strdup(GETMESSAGE(13,1, 
                           "Unable to locate a field named '%s' for the type '%s'"));
			printerrf(argv[0], errmsg, p + 1, type, NULL,
                                  NULL, NULL, NULL, NULL, NULL);
                        free(errmsg);
			*p = '.';
			return(SH_FAIL);
		}
		*p = '.';
	}
	else if ((tbl = all_tbl_search(type, 0)) == NULL) {
                errmsg = strdup(GetSharedMsg(DT_UNDEF_TYPE));
		printerrf(argv[0], errmsg, type, NULL, NULL,
                          NULL, NULL, NULL, NULL, NULL);
                free(errmsg);
		return(SH_FAIL);
	}
		
	for (i = 0; i < nsyms; i++) {
		if (!fdef(syms[i].str, &j)) {
                        errmsg=strdup(GETMESSAGE(13,2, 
                               "The name '%s' has not been defined"));
			printerrf(argv[0], errmsg, syms[i].str,
                                  NULL, NULL, NULL, NULL, NULL, NULL, NULL);
                        free(errmsg);
			return(SH_FAIL);
		}
		syms[i].str = strdup(syms[i].str);
		syms[i].addr = j;
	}
	add_symbolic(isflag, tbl, syms, nsyms);
	return(SH_SUCC);
}
Esempio n. 5
0
         def(name,     -1, format,          -1, wide_format, flags)
#endif

PRODUCT_CONST Bytecodes::BytecodeData Bytecodes::data[] = {
  def(nop                       , 1, "b"    , 0, ""      , None),
  def(aconst_null               , 1, "b"    , 0, ""      , None),
  def(iconst_m1                 , 1, "b"    , 0, ""      , None),
  def(iconst_0                  , 1, "b"    , 0, ""      , None),
  def(iconst_1                  , 1, "b"    , 0, ""      , None),
  def(iconst_2                  , 1, "b"    , 0, ""      , None),
  def(iconst_3                  , 1, "b"    , 0, ""      , None),
  def(iconst_4                  , 1, "b"    , 0, ""      , None),
  def(iconst_5                  , 1, "b"    , 0, ""      , None),
  def(lconst_0                  , 1, "b"    , 0, ""      , None),
  def(lconst_1                  , 1, "b"    , 0, ""      , None),
 fdef(fconst_0                  , 1, "b"    , 0, ""      , None),
 fdef(fconst_1                  , 1, "b"    , 0, ""      , None),
 fdef(fconst_2                  , 1, "b"    , 0, ""      , None),
 fdef(dconst_0                  , 1, "b"    , 0, ""      , None),
 fdef(dconst_1                  , 1, "b"    , 0, ""      , None),
  def(bipush                    , 2, "bc"   , 0, ""      , None),
  def(sipush                    , 3, "bcc"  , 0, ""      , None),
  def(ldc                       , 2, "bi"   , 0, ""      , None),
  def(ldc_w                     , 3, "bii"  , 0, ""      , None),
  def(ldc2_w                    , 3, "bii"  , 0, ""      , None),
  def(iload                     , 2, "bi"   , 4, "wbii"  , None),
  def(lload                     , 2, "bi"   , 4, "wbii"  , None),
 fdef(fload                     , 2, "bi"   , 4, "wbii"  , None),
 fdef(dload                     , 2, "bi"   , 4, "wbii"  , None),
  def(aload                     , 2, "bi"   , 4, "wbii"  , None),
  def(iload_0                   , 1, "b"    , 0, ""      , None),
Esempio n. 6
0
// Create the derived verb for a fork.  Insert in-placeable flags based on routine, and asgsafe based on fgh
A jtfolk(J jt,A f,A g,A h){A p,q,x,y;AF f1=jtfolk1,f2=jtfolk2;B b;C c,fi,gi,hi;I flag,j,m=-1;V*fv,*gv,*hv,*v;
 RZ(f&&g&&h);
 gv=VAV(g); gi=gv->id;
 hv=VAV(h); hi=hv->id;
 // Start flags with ASGSAFE (if g and h are safe), and with INPLACEOK to match the setting of f1,f2
 flag=(VINPLACEOK1|VINPLACEOK2)+((gv->flag&hv->flag)&VASGSAFE);  // We accumulate the flags for the derived verb.  Start with ASGSAFE if all descendants are.
 if(NOUN&AT(f)){  /* y {~ x i. ] */
  // Temporarily raise the usecount of the noun.  Because we are in the same tstack frame as the parser, the usecount will stay
  // raised until any inplace decision has been made regarding this derived verb, protecting the derived verb if the
  // assigned name is the same as a name appearing here.  If the derived verb is used in another sentence, it must first be
  // assigned to a name, which will protects values inside it.
  rat1s(f);  // This justifies keeping the result ASGSAFE
  f1=jtnvv1;
  if(LIT&AT(f)&&1==AR(f)&&gi==CTILDE&&CFROM==ID(gv->f)&&hi==CFORK){
   x=hv->f;
   if(LIT&AT(x)&&1==AR(x)&&CIOTA==ID(hv->g)&&CRIGHT==ID(hv->h)){f1=jtcharmapa;  flag &=~(VINPLACEOK1);}
  }
  R fdef(CFORK,VERB, f1,jtnvv2, f,g,h, flag, RMAX,RMAX,RMAX);
 }
 fv=VAV(f); fi=fv->id; if(fi!=CCAP)flag &= fv->flag|~VASGSAFE;  // remove ASGSAFE if f is unsafe
 switch(fi){
  case CCAP:                      f1=jtcork1; f2=jtcork2;  break; /* [: g h */
  case CTILDE: if(NAME&AT(fv->f)){f1=jtcorx1; f2=jtcorx2;}  break; /* name g h */
  case CSLASH: if(gi==CDIV&&hi==CPOUND&&CPLUS==ID(fv->f)){f1=jtmean; flag|=VIRS1; flag &=~(VINPLACEOK1);} break;  /* +/%# */
  case CAMP:   /* x&i.     { y"_ */
  case CFORK:  /* (x i. ]) { y"_ */
   if(hi==CQQ&&(y=hv->f,LIT&AT(y)&&1==AR(y))&&equ(ainf,hv->g)&&
       (x=fv->f,LIT&AT(x)&&1==AR(x))&&CIOTA==ID(fv->g)&&
       (fi==CAMP||CRIGHT==ID(fv->h))){f1=jtcharmapb; flag &=~(VINPLACEOK1);} break;
  case CAT:    /* <"1@[ { ] */
   if(gi==CLBRACE&&hi==CRIGHT){                                   
    p=fv->f; q=fv->g; 
    if(CLEFT==ID(q)&&CQQ==ID(p)&&(v=VAV(p),x=v->f,CLT==ID(x)&&equ(one,v->g))){f2=jtsfrom; flag &=~(VINPLACEOK2);}
 }}
 switch(fi==CCAP?gi:hi){
  case CQUERY:  if(hi==CDOLLAR||hi==CPOUND){f2=jtrollk; flag &=~(VINPLACEOK2);}  break;
  case CQRYDOT: if(hi==CDOLLAR||hi==CPOUND){f2=jtrollkx; flag &=~(VINPLACEOK2);} break;
  case CICAP:   m=7; if(fi==CCAP){if(hi==CNE)f1=jtnubind; else if(FIT0(CNE,hv)){f1=jtnubind0; flag &=~(VINPLACEOK1);}} break;
  case CSLASH:  c=ID(gv->f); m=c==CPLUS?4:c==CPLUSDOT?5:c==CSTARDOT?6:-1; 
                if(fi==CCAP&&vaid(gv->f)&&vaid(h)){f2=jtfslashatg; flag &=~(VINPLACEOK2);}
                break;
  case CFCONS:  if(hi==CFCONS){x=hv->h; j=*BAV(x); m=B01&AT(x)?(gi==CIOTA?j:gi==CICO?2+j:-1):-1;} break;
  case CRAZE:   if(hi==CLBRACE){f2=jtrazefrom; flag &=~(VINPLACEOK2);}
                else if(hi==CCUT){
                 j=i0(hv->g);
                 if(CBOX==ID(hv->f)&&!j){f2=jtrazecut0; flag &=~(VINPLACEOK2);}
                 else if(boxatop(h)&&j&&-2<=j&&j<=2){f1=jtrazecut1; f2=jtrazecut2; flag &=~(VINPLACEOK1|VINPLACEOK2);}
 }}
 if(0<=m){
  v=4<=m?hv:fv; b=CFIT==v->id&&equ(zero,v->g);
  switch(b?ID(v->f):v->id){
   case CEQ:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=0+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CNE:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=1+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CLT:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=2+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CLE:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=3+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CGE:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=4+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CGT:   f2=b?jtfolkcomp0:jtfolkcomp; flag|=5+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CEBAR: f2=b?jtfolkcomp0:jtfolkcomp; flag|=6+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
   case CEPS:  f2=b?jtfolkcomp0:jtfolkcomp; flag|=7+8*m; flag &=~(VINPLACEOK1|VINPLACEOK2); break;
 }}
 // If this fork is not a special form, set the flags to indicate whether the f verb does not use an
 // argument.  In that case h can inplace the unused aegument.
 if(f1==jtfolk1 && f2==jtfolk2) flag |= atoplr(f);
 R fdef(CFORK,VERB, f1,f2, f,g,h, flag, RMAX,RMAX,RMAX);
}
void CDrawContext::SelectFont( LPCTSTR pcszFontNames, int nSizePixels, int nWeight, bool bItalic, bool bUnderline, bool bStrike, BYTE cCharSet )
{
	//	we set the current font to be an invalid font because we don't know what this font may be,
	FontDef fdef( pcszFontNames, nSizePixels, nWeight, bUnderline, bItalic, bStrike, cCharSet );
	SelectFont( fdef );
}
bool CppFlagsEnumerationGenerator::generate()
{
    includeHeaders(declarationStream, Dependency::global_section);

    std::string guard = frm->headerGuard("core/flags_enumeration.hpp");

    line()  << "#ifndef "
            << guard;
    eol(declarationStream);
    line()  << "#define "
            << guard;
    eol(declarationStream);
    eol(declarationStream);

    includeHeaders(declarationStream, Dependency::private_section);

    cf::TypeSPtr decoratedType = T;
    cf::TypeSPtr decoratedInherit = F;
    cf::TypeSPtr decoratedInheritRef = cstFRef;

    cf::ConstructorNameSPtr class_name = cf::constructorNameRef("flags_enumeration");
    cf::VariableNameSPtr memberValue = frm->memberVariableName(value);
    cf::ArgumentSPtr argMask = cf::argumentRef() << decoratedInheritRef
                                                 << cf::variableNameRef("mask");
    cf::ArgumentSPtr argValue = cf::argumentRef() << decoratedInheritRef
                                                  << value;

    line()  << "template<class "
            << T->name()->value()
            << ", class "
            << F->name()->value()
            << ">";
    eol(declarationStream);

    line()  << "class "
            << class_name;
    openBlock(declarationStream);

    line()  << "public:";
    eol(declarationStream, -1);

    line()  << "// Default constructor - sets the value to invalid";
    eol(declarationStream);
    fdef()  << (cf::constructorRef() << class_name);
    eofd(declarationStream);
    line()  << ": "
            << (cf::initializationRef() << memberValue
                                        << cf::parameterValueRef("0"));
    openBlock(declarationStream, 1);
    closeBlock(declarationStream);
    eol(declarationStream);

    fdef()  << (cf::constructorRef() << class_name
                                     << (cf::argumentRef() << decoratedType
                                                           << value));
    eofd(declarationStream);
    line()  << ": "
            << (cf::initializationRef() << memberValue
                                        << frm->parameterValue(value));
    openBlock(declarationStream, 1);
    closeBlock(declarationStream);
    eol(declarationStream);

    fdef()  << (cf::methodRef() << decoratedType
                                << fnValue
                                << cf::EMethodDeclaration::const_());
    openBlock(declarationStream);
    line()  << "return "
            << memberValue
            << ";";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                  "Resets the flags included in the mask to the state in value");
    fdef()  << (cf::methodRef() << vd
                                << fnReset
                                << argMask
                                << argValue);
    openBlock(declarationStream);
    line()  << memberValue
            << " = value.value() | (this->value() & ~mask.value());";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                  "Sets the flags included in the mask. Equivalent to reset(mask, all).");
    fdef()  << (cf::methodRef() << vd
                                << fnSet
                                << argMask);
    openBlock(declarationStream);
    line()  << memberValue
            << " |= mask.value();";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                   "Clears the flags included in the mask. Equivalent to reset(mask, nil).");
    fdef()  << (cf::methodRef() << vd
                                << fnClear
                                << argMask);
    openBlock(declarationStream);
    line()  << memberValue
            << " &= ~mask.value();";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                   "Turns the flags included in the mask.");
    fdef()  << (cf::methodRef() << vd
                                << fnTurn
                                << argMask);
    openBlock(declarationStream);
    line()  << memberValue
            << " ^= mask.value();";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                  "Returns assemble of the current flags with the flags from the mask to "
                  "the state in value. This is immutable version of reset.");
    fdef()  << (cf::methodRef() << decoratedInherit
                                << fnAssemble
                                << argMask
                                << argValue
                                << cf::EMethodDeclaration::const_());
    openBlock(declarationStream);
    line()  << "return "
            << F->name()->value()
            << "(value.value() | (this->value() & ~mask.value()));";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                  "Returns combination of the flags included in the mask. "
                  "This is immutable version of set.");
    fdef()  << (cf::methodRef() << decoratedInherit
                                << fnCombine
                                << argMask
                                << cf::EMethodDeclaration::const_());
    openBlock(declarationStream);
    line()  << "return "
            << F->name()->value()
            << "(value() | mask.value());";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                  "Returns intersection of the flags included in the mask. "
                  "This is immutable version of clear.");
    fdef()  << (cf::methodRef() << decoratedInherit
                                << fnIntersect
                                << argMask
                                << cf::EMethodDeclaration::const_());
    openBlock(declarationStream);
    line()  << "return "
            << F->name()->value()
            << "(value() & ~mask.value());";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                  "Returns flipped the flags included in the mask. "
                  "This is immutable version of turn.");
    fdef()  << (cf::methodRef() << decoratedInherit
                                << fnFlip
                                << argMask
                                << cf::EMethodDeclaration::const_());
    openBlock(declarationStream);
    line()  << "return "
            << F->name()->value()
            << "(value() ^ mask.value());";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                  "Tests if the flags included in the mask are the same state as state in value");
    fdef()  << (cf::methodRef() << bl
                                << fnTest
                                << argMask
                                << argValue
                                << cf::EMethodDeclaration::const_());
    openBlock(declarationStream);
    line()  << "return (this->value() & mask.value()) == value.value();";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                  "Tests if the flags included in the mask are set. Equivalent to test(mask, all).");
    fdef()  << (cf::methodRef() << bl
                                << fnIsSet
                                << argMask
                                << cf::EMethodDeclaration::const_());
    openBlock(declarationStream);
    line()  << "return (value() & mask.value()) == mask.value();";
    closeBlock(declarationStream);
    eol(declarationStream);

    commentInLine(declarationStream,
                  "Tests if the flags included in the mask are clear. Equivalent to test(mask, nil).");
    fdef()  << (cf::methodRef() << bl
                                << fnIsClear
                                << argMask
                                << cf::EMethodDeclaration::const_());
    openBlock(declarationStream);
    line()  << "return (value() & mask.value()) == 0;";
    closeBlock(declarationStream);
    eol(declarationStream);

    line()  << "protected:";
    eol(declarationStream, -1);

    line()  << T->name()->value()
            << " "
            << memberValue
            << ";";
    eol(declarationStream);

    closeBlock(declarationStream, "};");
    eol(declarationStream);

    line()  << "#endif // "
            << guard;
    eol(declarationStream);
    eol(declarationStream);

	return serializeStreams();
}