示例#1
0
文件: A88.C 项目: ALANGUAGE/A2011
int expr() { int mode; int id1; int ixarr; int ids;
  if (istoken(T_CONST)) {doconst(); return 1; }
  mode=typeName(); /*0=V,1=*,2=&*/
  if (token=='(')  {docall1(); goto e1; }
  if (isreg()) goto e1;
  id1=searchname(); gettypes(id1); ids=signi;
  ixarr=0;
  if (istoken('[')) { ixarr=searchname(); expect(T_NAME); expect(']');  
    gettypes(ixarr);
    if (widthi==0) error1("Arrayindex muss int sein"); } 
  if (istoken(T_PLUSPLUS  )) {if(mode)error1("Nur var erlaubt");doinc();goto e1;}
  if (istoken(T_MINUSMINUS)) {if(mode)error1("Nur var erlaubt");dodec();goto e1;}
  if (istoken(T_PLUSASS   )) {compoundass("add", mode); goto e1;}
  if (istoken(T_MINUSASS  )) {compoundass("sub", mode); goto e1;}
  if (istoken(T_ANDASS    )) {compoundass("and", mode); goto e1;}
  if (istoken(T_ORASS     )) {compoundass("or" , mode); goto e1;}    
  if (istoken(T_MULASS    )) {error1("nicht implementiert");}
  if (istoken(T_DIVASS    )) {error1("nicht implementiert");}      
  if (istoken('=')) { isconst=expr(); 
     if (isconst) { if(mode==0) {prs("\n;++++ mov  "); printName(id1); 
       prs(", "); prnum(lexval);  } }
     doassign(mode, id1, ixarr); goto e1;} 
  dovar1(mode, "mov", ixarr, id1);
e1:    if (istoken('+')) rterm("add");
  else if (istoken('-')) rterm("sub" );
  else if (istoken('&')) rterm("and" );
  else if (istoken('|')) rterm("or" );  
  else if (istoken(T_LESSLESS)) rterm("shl");
  else if (istoken(T_GREATGREAT)) rterm("shr");  
  else if (istoken('*')) domul (ids);
  else if (istoken('/')) doidiv(ids);
  else if (istoken('%')) domod (ids);
  if (isrelational()) { rterm("cmp"); cmpneg(ids);}
  return 0;
}
示例#2
0
文件: dna.c 项目: DimondTheCat/xray
static void meshedit( void )
{
   double pt[ 3 ];
   LWPntID id[ 57 ], vid[ 2 ];
   int i, j, k, n, v[ 9 ], snum;


   csMeshBegin( 0, 0, OPSEL_GLOBAL );

   if ( bond_type == BTYPE_LINE ) {
      mgMonitorBegin( "Line Bonds", NULL, seqlen );

      for ( j = 0; j < seqlen; j++ ) {
         n = point_count( seq[ j ] );
         for ( i = 0; i < n; i++ ) {
            vert_coords( seq[ j ], i, pt );
            transform_point( j * 3.4, j * 36.0, pt );
            id[ i ] = meAddPoint( pt );
         }
         n = bond_count( seq[ j ] );
         for ( i = 0; i < n; i++ ) {
            bond_info( seq[ j ], i, &v[ 0 ], &v[ 1 ], &snum );
            vid[ 0 ] = id[ v[ 0 ]];
            vid[ 1 ] = id[ v[ 1 ]];
            meAddPoly( LWPOLTYPE_FACE, NULL, surface_name( snum ), 2, vid );
         }
         if ( userabort = mgMonitorStep( 1 ))
            break;
      }
      mgMonitorDone();
   }

   if ( atom_type == ATYPE_POINT && !userabort ) {
      mgMonitorBegin( "Point Atoms", NULL, seqlen );

      for ( j = 0; j < seqlen; j++ ) {
         n = atom_count( seq[ j ] );
         for ( i = 0; i < n; i++ ) {
            atom_info( seq[ j ], i, &v[ 0 ], &snum );
            vert_coords( seq[ j ], v[ 0 ], pt );
            transform_point( j * 3.4, j * 36.0, pt );
            id[ 0 ] = meAddPoint(  pt );
            meAddPoly( LWPOLTYPE_FACE, NULL, surface_name( snum ), 1, &id[ 0 ] );
         }
         if ( userabort = mgMonitorStep( 1 ))
            break;
      }
      mgMonitorDone();
   }

   else if ( atom_type == ATYPE_DODEC && !userabort ) {
      mgMonitorBegin( "Dodecahedron Atoms", NULL, seqlen );

      for ( j = 0; j < seqlen; j++ ) {
         n = atom_count( seq[ j ] );
         for ( i = 0; i < n; i++ ) {
            atom_info( seq[ j ], i, &v[ 0 ], &snum );
            vert_coords( seq[ j ], v[ 0 ], pt );
            transform_point( j * 3.4, j * 36.0, pt );
            dodec( pt, atom_radius[ snum ], surface_name( snum ));
         }
         if ( userabort = mgMonitorStep( 1 ))
            break;
      }
      mgMonitorDone();
   }

   if ( do_plates && !userabort ) {
      mgMonitorBegin( "Base Plates", NULL, seqlen );

      for ( j = 0; j < seqlen; j++ ) {
         for ( i = 0; i < 2; i++ ) {
            plate_info( seq[ j ], i, &n, v, &snum );
            for ( k = 0; k < n; k++ ) {
               vert_coords( seq[ j ], v[ k ], pt );
               transform_point( j * 3.4, j * 36.0, pt );
               id[ k ] = meAddPoint( pt );
            }
            meAddPoly( LWPOLTYPE_FACE, NULL, surface_name( snum ), n, id );
         }
         if ( userabort = mgMonitorStep( 1 ))
            break;
      }
      mgMonitorDone();
   }

   csMeshDone( EDERR_NONE, 0 );
}