static void PrintHeader(const Proto* f)
{
 printf("\n%s <%s:%d> (%d instruction%s, %d bytes at %p)\n",
 	IsMain(f)?"main":"function",Source(f),f->lineDefined,
	S(f->sizecode),f->sizecode*Sizeof(Instruction),VOID(f));
 printf("%d%s param%s, %d stack%s, %d upvalue%s, ",
	f->numparams,f->is_vararg?"+":"",SS(f->numparams),S(f->maxstacksize),
	S(f->nups));
 printf("%d local%s, %d constant%s, %d function%s\n",
	S(f->sizelocvars),S(f->sizek),S(f->sizep));
}
Exemple #2
0
CString GetError(_com_error &e)
{	
	CString MsgBug;
	_bstr_t Source(e.Source());
	_bstr_t Description(e.Description());
	MsgBug.Format( "Ups!!! \nSource = %s\nDescription= %s\n",(LPCSTR)Source, (LPCSTR)Description );
	#ifdef _DEBUG
		AfxMessageBox( MsgBug, MB_OK | MB_ICONERROR );
	#endif	
	return MsgBug;
}
Exemple #3
0
void Nym::DisplayStatistics(String& strOutput) const
{
    sLock lock(shared_lock_);
    strOutput.Concatenate("Source for ID:\n%s\n", Source().asString()->Get());
    strOutput.Concatenate("Description: %s\n\n", m_strDescription->Get());
    strOutput.Concatenate("%s", "\n");
    strOutput.Concatenate("==>      Name: %s\n", Alias().c_str());
    strOutput.Concatenate("      Version: %s\n", m_strVersion->Get());
    auto theStringID = String::Factory(ID());
    strOutput.Concatenate("Nym ID: %s\n", theStringID->Get());
}
Exemple #4
0
status_t
AVFormatReader::Sniff(int32* _streamCount)
{
	TRACE("AVFormatReader::Sniff\n");

	BPositionIO* source = dynamic_cast<BPositionIO*>(Source());
	if (source == NULL) {
		TRACE("  not a BPositionIO, but we need it to be one.\n");
		return B_NOT_SUPPORTED;
	}

	Stream* stream = new(std::nothrow) Stream(source,
		&fSourceLock);
	if (stream == NULL) {
		ERROR("AVFormatReader::Sniff() - failed to allocate Stream\n");
		return B_NO_MEMORY;
	}

	ObjectDeleter<Stream> streamDeleter(stream);

	status_t ret = stream->Open();
	if (ret != B_OK) {
		TRACE("  failed to detect stream: %s\n", strerror(ret));
		return ret;
	}

	delete[] fStreams;
	fStreams = NULL;

	int32 streamCount = stream->CountStreams();
	if (streamCount == 0) {
		TRACE("  failed to detect any streams: %s\n", strerror(ret));
		return B_ERROR;
	}

	fStreams = new(std::nothrow) Stream*[streamCount];
	if (fStreams == NULL) {
		ERROR("AVFormatReader::Sniff() - failed to allocate streams\n");
		return B_NO_MEMORY;
	}

	memset(fStreams, 0, sizeof(Stream*) * streamCount);
	fStreams[0] = stream;
	streamDeleter.Detach();

	#ifdef TRACE_AVFORMAT_READER
	dump_format(const_cast<AVFormatContext*>(stream->Context()), 0, "", 0);
	#endif

	if (_streamCount != NULL)
		*_streamCount = streamCount;

	return B_OK;
}
Exemple #5
0
status_t
AVFormatReader::AllocateCookie(int32 streamIndex, void** _cookie)
{
	TRACE("AVFormatReader::AllocateCookie(%ld)\n", streamIndex);

	BAutolock _(fSourceLock);

	if (fStreams == NULL)
		return B_NO_INIT;

	if (streamIndex < 0 || streamIndex >= fStreams[0]->CountStreams())
		return B_BAD_INDEX;

	if (_cookie == NULL)
		return B_BAD_VALUE;

	Stream* cookie = fStreams[streamIndex];
	if (cookie == NULL) {
		// Allocate the cookie
		BPositionIO* source = dynamic_cast<BPositionIO*>(Source());
		if (source == NULL) {
			TRACE("  not a BPositionIO, but we need it to be one.\n");
			return B_NOT_SUPPORTED;
		}

		cookie = new(std::nothrow) Stream(source, &fSourceLock);
		if (cookie == NULL) {
			ERROR("AVFormatReader::Sniff() - failed to allocate "
				"Stream\n");
			return B_NO_MEMORY;
		}

		status_t ret = cookie->Open();
		if (ret != B_OK) {
			TRACE("  stream failed to open: %s\n", strerror(ret));
			delete cookie;
			return ret;
		}
	}

	status_t ret = cookie->Init(streamIndex);
	if (ret != B_OK) {
		TRACE("  stream failed to initialize: %s\n", strerror(ret));
		// NOTE: Never delete the first stream!
		if (streamIndex != 0)
			delete cookie;
		return ret;
	}

	fStreams[streamIndex] = cookie;
	*_cookie = cookie;

	return B_OK;
}
Exemple #6
0
/*
 * srcHook - run a specified source hook
 */
static vi_rc srcHook( hooktype num, vi_rc lastrc )
{
    vars        *v;
    srcline     sline;
    vi_rc       rc;

    if( hookRun & num ) {
        return( lastrc );
    }

    /*
     * check script type
     */
    v = GetHookVar( num );
    /*
     * run script, if we have one
     */
    if( v != NULL ) {
        if( num == SRC_HOOK_COMMAND ) {
            VarAddGlobalStr( "Com", CommandBuffer );
        }
//        if( num == SRC_HOOK_MODIFIED ) {
//            lastrc = LastEvent;
//        }

        /*
         * set up for and run script
         */
        hookRun |= num;
        LastRetCode = lastrc;
        rc = Source( v->value, srcHookData, &sline );

        /*
         * if we had a command hook, look for replacement variable
         */
        if( num == SRC_HOOK_COMMAND ) {
            v = VarFind( "Com", NULL );
            if( v != NULL ) {
                strcpy( CommandBuffer, v->value );
            }
        }

        /*
         * we are done now, reset and go back
         */
        LastRetCode = ERR_NO_ERR;
        hookRun &= ~num;
        DCUpdateAll();
        return( rc );

    }
    return( lastrc );

} /* srcHook */
const Source Skin::source(std::string ParamName)	const
{
	for(uint i=0; i< this->NrSources(); i++) {
		const Source& src = this->source(i);
		std::string Name = 
			src.technique_common().accessor().param(0).name();
		if(Name == ParamName) return src;
	}

	return Source();
}
void ShadowView::ConstrainCamera()
{
    if( mPointLight && mShadowPlane )
    {
        // Constrain camera to look directly at center of shadow plane. (mPointLight position
        // is under control of application, can't use transform inheritance)

        Constraint cameraOrientationConstraint =
            Constraint::New<Quaternion> ( Actor::ROTATION,
                                          Source( mShadowPlane, Actor::WORLD_POSITION ),
                                          Source( mPointLight,  Actor::WORLD_POSITION ),
                                          Source( mShadowPlane, Actor::WORLD_ROTATION ),
                                          &LookAt );

        mCameraActor.ApplyConstraint( cameraOrientationConstraint );

        Constraint pointLightPositionConstraint = Constraint::New<Vector3>( Actor::POSITION, Source( mPointLight, Actor::WORLD_POSITION ), EqualToConstraint() );

        mCameraActor.ApplyConstraint( pointLightPositionConstraint );
    }
}
void CObjectImageArray::GenerateGlowImage (int iRotation) const

//	GenerateGlowImage
//
//	Generates a mask that looks like a glow. The mask is 0 for all image pixels
//	and for all pixels where there is no glow (thus we can optimize painting
//	of the glow by ignoring 0 values)

	{
	ASSERT(iRotation >= 0 && iRotation < m_iRotationCount);

	//	Source

	if (m_pImage == NULL)
		return;

	CG16bitImage &Source(*m_pImage->GetImage());

	//	Allocate the array of images (if not already allocated)

	if (m_pGlowImages == NULL)
		m_pGlowImages = new CG16bitImage[m_iRotationCount];

	//	If the image for this rotation has already been initialized, then
	//	we're done

	if (!m_pGlowImages[iRotation].IsEmpty())
		return;

	//	Otherwise we need to create the glow mask. The glow image is larger
	//	than the object image (by GLOW_SIZE)

	int cxSrcWidth = RectWidth(m_rcImage);
	int cySrcHeight = RectHeight(m_rcImage);
	int cxGlowWidth = cxSrcWidth + 2 * GLOW_SIZE;
	int cyGlowHeight = cySrcHeight + 2 * GLOW_SIZE;

	if (m_pGlowImages[iRotation].Create(cxGlowWidth, cyGlowHeight, 8) != NOERROR)
		{
		m_pGlowImages[iRotation].DiscardSurface();
		kernelDebugLogMessage("Unable to create image");
		return;
		}

	RECT rcSrc;
	rcSrc.left = ComputeSourceX(0);
	rcSrc.top = m_rcImage.top + (iRotation * cySrcHeight);
	rcSrc.right = rcSrc.left + cxSrcWidth;
	rcSrc.bottom = rcSrc.top + cySrcHeight;

	m_pGlowImages[iRotation].DrawGlowImage(0, 0, Source, rcSrc.left,
			rcSrc.top, rcSrc.right, rcSrc.bottom, 4);
	}
// -----------------------------------------------------------------------------
// CMceSrvStream::IsEqual
// -----------------------------------------------------------------------------
//
TBool CMceSrvStream::IsEqual( const CMceSrvStream& aStream ) const
    {
    TBool equal = EFalse;
    if ( &aStream )
        {
        equal = Codec().Id() == aStream.Codec().Id() &&
               Source().Data().Id() == aStream.Source().Data().Id() &&
               Sink().Data().Id() == aStream.Sink().Data().Id();
        }
    
    return equal;
            
    }
Exemple #11
0
int alternate_import_constructor_test(Epetra_Comm& Comm) {
  int rv=0;
  int nodes_per_proc=10;
  int numprocs = Comm.NumProc();
  int mypid    = Comm.MyPID();

  // Only run if we have multiple procs & MPI
  if(numprocs==0) return 0;
#ifndef HAVE_MPI
  return 0;
#endif

  // Build Map 1 - linear
  Epetra_Map Map1((long long)-1,nodes_per_proc,(long long)0,Comm);

  // Build Map 2 - mod striped
  std::vector<long long> MyGIDs(nodes_per_proc);
  for(int i=0; i<nodes_per_proc; i++)
    MyGIDs[i] = (mypid*nodes_per_proc + i) % numprocs;
  Epetra_Map Map2((long long)-1,nodes_per_proc,&MyGIDs[0],(long long)0,Comm);

  // For testing
  Epetra_LongLongVector Source(Map1), Target(Map2);


  // Build Import 1 - normal
  Epetra_Import Import1(Map2,Map1);
  rv = rv|| test_import_gid("Alt test: 2 map constructor",Source,Target, Import1);

  // Build Import 2 - no-comm constructor
  int Nremote=Import1.NumRemoteIDs();
  const int * RemoteLIDs = Import1.RemoteLIDs();
  std::vector<int> RemotePIDs(Nremote+1); // I hate you, stl vector....
  std::vector<int> AllPIDs;
  Epetra_Util::GetPids(Import1,AllPIDs,true);

  for(int i=0; i<Nremote; i++) {
    RemotePIDs[i]=AllPIDs[RemoteLIDs[i]];
  }
  Epetra_Import Import2(Import1.TargetMap(),Import1.SourceMap(),Nremote,&RemotePIDs[0],Import1.NumExportIDs(),Import1.ExportLIDs(),Import1.ExportPIDs());

  rv = rv || test_import_gid("Alt test: no comm constructor",Source,Target,Import2);


  // Build Import 3 - Remotes only
  Epetra_Import Import3(Import1.TargetMap(),Import1.SourceMap(),Nremote,&RemotePIDs[0]);
  rv = rv || test_import_gid("Alt test: remote only constructor",Source,Target, Import3);


  return rv;
}
Exemple #12
0
/** This is the place where speech, poses, and \@emits by thing should be
 *  heard. For things and players, it's the loc; for rooms, it's the room
 *  itself; for exits, it's the source.
 */
dbref
speech_loc(dbref thing)
{
  if (!RealGoodObject(thing))
    return NOTHING;
  switch (Typeof(thing)) {
  case TYPE_ROOM:
    return thing;
  case TYPE_EXIT:
    return Source(thing);
  default:
    return Location(thing);
  }
}
Exemple #13
0
int NetworkConstraints::getNetworkConstraints(string resFile)
{
	try
    {
        sae::io::MappedGraph* g = sae::io::MappedGraph::Open(graphFile.c_str());
        for (auto e = g->Edges(); e->Alive(); e->Next()) 
        {
            EData ed = sae::serialization::convert_from_string<EData>(e->Data());
            ed.value = 0;
            for(auto es = e->Source()->OutEdges(); es->Alive(); es->Next())
            {
                for(auto ee = es->Target()->OutEdges(); ee->Alive(); ee->Next())
                {
                    if (ee->Target()->GlobalId() == e->Target()->GlobalId())
                    {
                        ed.value += sae::serialization::convert_from_string<EData>(es->Data()).attribute[0] * 
                        sae::serialization::convert_from_string<EData>(ee->Data()).attribute[0];
                        break;
                    }
                }
            }
            e->Data() = sae::serialization::convert_to_string<EData>(ed);     
        }
        ofstream outfile(resFile);
        for (auto v = g->Vertices(); v->Alive(); v->Next()) 
        {
            double value = 0;
            VData vd = sae::serialization::convert_from_string<VData>(v->Data());
            for(auto e = v->OutEdges(); e->Alive(); e->Next())
            {
                value += sae::serialization::convert_from_string<EData>(e->Data()).value;
            }
            if(v->OutEdgeCount() > 0)
            {
                outfile << vd.name << "\t" << value / v->OutEdgeCount() <<"\n";
            }
            else
            {
                outfile << vd.name << "\t" << 0 <<"\n";
            }
        }
        cout<<"compute Network Constraints done."<<endl;
    }
    catch(...)
    {
        cout << "Network Constraints parameter error" << endl;
        return -1;
    }
    return 0;
}
void ShadowView::SetShadowPlane(Actor shadowPlane)
{
    mShadowPlaneBg = shadowPlane;

    mShadowPlane = ImageActor::New();
    mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
    mShadowPlane.SetAnchorPoint(AnchorPoint::CENTER);

    mShadowPlane.SetImage(mOutputImage);
    mShadowPlane.SetShaderEffect(mShadowRenderShader);

    // Rather than parent the shadow plane drawable and have constraints to move it to the same
    // position, instead parent the shadow plane drawable on the shadow plane passed in.
    mShadowPlaneBg.Add(mShadowPlane);
    mShadowPlane.SetParentOrigin(ParentOrigin::CENTER);
    mShadowPlane.SetZ(1.0f);

    ConstrainCamera();

    mShadowPlane.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlaneBg, Actor::SIZE ), EqualToConstraint() ) );

    mBlurRootActor.ApplyConstraint( Constraint::New<Vector3>( Actor::SIZE, Source( mShadowPlane, Actor::SIZE ), EqualToConstraint() ) );
}
Exemple #15
0
status_t
TAPEReader::Sniff(int32* oStreamCount)
{
	Unset();
	// prepare about file
	mSrcPIO = dynamic_cast<BPositionIO*>(Source());
	if (mSrcPIO == NULL)
		return B_ERROR;

	BMediaIO* mediaIO = dynamic_cast<BMediaIO*>(Source());
	if (mediaIO != NULL) {
		int32 flags = 0;
		mediaIO->GetFlags(&flags);
		// This plugin doesn't support streamed data.
		// The APEHeader::FindDescriptor function always
		// analyze the whole file to find the APE_DESCRIPTOR.
		if ((flags & B_MEDIA_STREAMING) == true)
			return B_ERROR;
	}

	int nFunctionRetVal = ERROR_SUCCESS;
	mPositionBridgeIO.SetPositionIO(mSrcPIO);

	mDecomp = CreateIAPEDecompressEx(&mPositionBridgeIO, &nFunctionRetVal);
	if (mDecomp == NULL || nFunctionRetVal != ERROR_SUCCESS)
		return B_ERROR;

	// prepare about data
	mDataSize = static_cast<int64>(mDecomp->GetInfo(APE_DECOMPRESS_TOTAL_BLOCKS))
			*mDecomp->GetInfo(APE_INFO_BLOCK_ALIGN);
	mDecodedData = new char [max_c(BUFFER_SIZE*mDecomp->GetInfo(APE_INFO_CHANNELS),
			BLOCK_COUNT*mDecomp->GetInfo(APE_INFO_BLOCK_ALIGN))];
	mLoadAPECheck = B_OK;
	*oStreamCount = 1;
	return B_OK;
}
// public Fuse.Drawing.Polygon get_Output() [instance] :185
::g::Fuse::Drawing::Polygon* Stroke::Output()
{
    uStackFrame __("Fuse.Entities.Processing.Stroke", "get_Output()");
    ::g::Fuse::Drawing::Polygon* ret2;
    ::g::Fuse::Drawing::Polygon* ret3;

    if (_output != NULL)
        return _output;

    if ((_source == NULL) || ((::g::Fuse::IOutput::get_Output_ex(uInterface(uPtr(_source), ::TYPES[2/*Fuse.IOutput<Fuse.Drawing.Polygon>*/]), &ret2), ret2) == NULL))
        return NULL;

    _output = uPtr((::g::Fuse::IOutput::get_Output_ex(uInterface(uPtr(Source()), ::TYPES[2/*Fuse.IOutput<Fuse.Drawing.Polygon>*/]), &ret3), ret3))->Stroke(::g::Uno::Math::Max1(0.1f, Width()), Offset(), StartCap(), EndCap());
    return _output;
}
MotionStretchEffect MotionStretchEffect::Apply( Actor handle )
{
  MotionStretchEffect newEffect = New();
  handle.SetShaderEffect( newEffect );

  Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_STRETCH_MODELVIEW_LASTFRAME );

  Constraint constraint = Constraint::New<Matrix>( uModelProperty,
                                                   Source( handle, Actor::WORLD_MATRIX ),
                                                   EqualToConstraint() );

  // and set up constraint.
  newEffect.ApplyConstraint(constraint);
  return newEffect;
}
void QCAD::PoissonResid<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
  typedef Intrepid::FunctionSpaceTools FST;

  // Scale gradient into a flux, reusing same memory
  FST::scalarMultiplyDataData<ScalarT> (PhiFlux, Permittivity, PhiGrad);

  FST::integrate<ScalarT>(PhiResidual, PhiFlux, wGradBF, Intrepid::COMP_CPP, false); // "false" overwrites

  if (haveSource) {
    for (int i=0; i<Source.dimension(0); i++)
      for (int j=0; j<Source.dimension(1); j++)
        Source(i,j) *= -1.0;
    FST::integrate<ScalarT>(PhiResidual, Source, wBF, Intrepid::COMP_CPP, true); // "true" sums into
  }
}
Exemple #19
0
    Source::Source(LanguagePool *languagePool, const path &sourceFilePath) throw(LanguageException, SourceException)
    {
        //variable
        Language *sourceLanguage = nullptr;
        
        //vérification de l'existence du fichier
        if (!exists(sourceFilePath))
        {
            throw SourceException(tr("Le fichier source \"%0\" n'existe pas.", sourceFilePath.native()));
        }

        //récupération du langage en fonction de l'extension de la source
        sourceLanguage = languagePool->getLanguageWithExtension(sourceFilePath.extension().native());

        //parsage de la source
        Source(sourceLanguage, sourceFilePath);
    }
std::unique_ptr<ZipFileCollection> ZipFileCollection::create(const StringPiece& path,
                                                             std::string* outError) {
    constexpr static const int32_t kEmptyArchive = -6;

    std::unique_ptr<ZipFileCollection> collection = std::unique_ptr<ZipFileCollection>(
            new ZipFileCollection());

    int32_t result = OpenArchive(path.data(), &collection->mHandle);
    if (result != 0) {
        // If a zip is empty, result will be an error code. This is fine and we should
        // return an empty ZipFileCollection.
        if (result == kEmptyArchive) {
            return collection;
        }

        if (outError) *outError = ErrorCodeString(result);
        return {};
    }

    void* cookie = nullptr;
    result = StartIteration(collection->mHandle, &cookie, nullptr, nullptr);
    if (result != 0) {
        if (outError) *outError = ErrorCodeString(result);
        return {};
    }

    using IterationEnder = std::unique_ptr<void, decltype(EndIteration)*>;
    IterationEnder iterationEnder(cookie, EndIteration);

    ZipString zipEntryName;
    ZipEntry zipData;
    while ((result = Next(cookie, &zipData, &zipEntryName)) == 0) {
        std::string zipEntryPath = std::string(reinterpret_cast<const char*>(zipEntryName.name),
                                               zipEntryName.name_length);
        std::string nestedPath = path.toString() + "@" + zipEntryPath;
        collection->mFiles[zipEntryPath] = util::make_unique<ZipFile>(collection->mHandle,
                                                                      zipData,
                                                                      Source(nestedPath));
    }

    if (result != -1) {
        if (outError) *outError = ErrorCodeString(result);
        return {};
    }
    return collection;
}
bool CObjectImageArray::PointInImage (int x, int y, int iTick, int iRotation) const

//	PointInImage
//
//	Returns TRUE if the given point is inside the masked part of the image
//	x, y is relative to the center of the image (GDI directions)

	{
	if (m_pImage)
		{
		CG16bitImage &Source(*m_pImage->GetImage());

		//	Compute the position of the frame

		int cxWidth = RectWidth(m_rcImage);
		int cyHeight = RectHeight(m_rcImage);
		int xSrc = ComputeSourceX(iTick);
		int ySrc = m_rcImage.top + (iRotation * cyHeight);

		//	Adjust the point so that it is relative to the
		//	frame origin (upper left)

		x = xSrc + x + (cxWidth / 2);
		y = ySrc + y + (cyHeight / 2);

		//	Adjust for rotation

		if (m_pRotationOffset)
			{
			x -= m_pRotationOffset[iRotation % m_iRotationCount].x;
			y += m_pRotationOffset[iRotation % m_iRotationCount].y;
			}

		//	Check bounds

		if (x < xSrc || y < ySrc || x >= (xSrc + cxWidth) || y >= (ySrc + cyHeight))
			return false;

		//	Check to see if the point is inside or outside the mask

		return (CGImage::AlphaColor(Source.GetPixel(x, y)) != 0);
		}
	else
		return false;
	}
void VideoInput::Open(
    const std::string& input_uri,
    const std::string& output_uri
    ) 
{
    str_uri_input = input_uri;
    uri_input = ParseUri(input_uri);
    uri_output = ParseUri(output_uri);

    if (uri_output.scheme == "file") {
        // Default to pango output
        uri_output.scheme = "pango";
    }

    // Start off playing from video_src
    video_src = OpenVideo(input_uri);
    Source();
}
void CObjectImageArray::CopyImage (CG16bitImage &Dest, int x, int y, int iFrame, int iRotation) const

//	CopyImage
//
//	Copies entire image to the destination

	{
	if (m_pImage)
		{
		CG16bitImage &Source(*m_pImage->GetImage());

		int xSrc = m_rcImage.left + (iFrame * RectWidth(m_rcImage));
		int ySrc = m_rcImage.top + (iRotation * RectHeight(m_rcImage));

		Dest.Blt(x, y, Source, xSrc, ySrc, xSrc + RectWidth(m_rcImage),
				ySrc + RectHeight(m_rcImage), false);
		}
	}
Exemple #24
0
long FileVarsParse(Scanner_p in, FileVars_p vars)
{
   char*     name;
   StrTree_p cell, test;
   long      res = 0;
   DStr_p    value = DStrAlloc();

   assert(!PStackEmpty(vars->names));
   assert(strcmp(PStackTopP(vars->names), DStrView(Source(in))) == 0);
   
   while(!TestInpTok(in, NoToken))
   {
      CheckInpTok(in, Identifier);
      name = DStrCopy(AktToken(in)->literal);
      cell = StrTreeFind(&(vars->vars), name);
      if(cell)
      {
	 FREE(cell->val1.p_val);
      }
      else
      {
	 cell = StrTreeCellAllocEmpty();
	 cell->key = name;
	 cell->val2.p_val = PStackTopP(vars->names);
	 test = StrTreeInsert(&(vars->vars), cell);
	 assert(test == NULL);
      }
      NextToken(in);
      AcceptInpTok(in, EqualSign);

      DStrReset(value);
      while(!TestInpTok(in, Semicolon))
      {
	 DStrAppendDStr(value, AktToken(in)->literal);
	 NextToken(in);
      }
      AcceptInpTok(in, Semicolon);
      cell->val1.p_val = DStrCopy(value);
      res++;
   }
   DStrFree(value);
   return res;
}
Exemple #25
0
// Any Transact-SQL statement can be followed by ; and GO, any combination of them or nothing at all
void SqlParser::SqlServerDelimiter()
{
	if(Source(SQL_SQL_SERVER, SQL_SYBASE) == false || Target(SQL_SQL_SERVER, SQL_SYBASE) == true)
		return;

	Token *last = GetLastToken();

	// Optional ; can go before GO
	Token *semi = GetNextCharToken(';', L';');

	// Optional GO to terminate the batch
	Token *go = GetNextWordToken("GO", L"GO", 2);

	// No ; delimiter
	if(semi == NULL)
		AppendNoFormat(last, ";", L";", 1);

	Token::Remove(go);
}
TEST_F(TableMergerTest, MergeFile) {
    ResourceTable finalTable;
    TableMergerOptions options;
    options.autoAddOverlay = false;
    TableMerger merger(mContext.get(), &finalTable, options);

    ResourceFile fileDesc;
    fileDesc.config = test::parseConfigOrDie("hdpi-v4");
    fileDesc.name = test::parseNameOrDie(u"@layout/main");
    fileDesc.source = Source("res/layout-hdpi/main.xml");
    test::TestFile testFile("path/to/res/layout-hdpi/main.xml.flat");

    ASSERT_TRUE(merger.mergeFile(fileDesc, &testFile));

    FileReference* file = test::getValueForConfig<FileReference>(&finalTable,
                                                                 u"@com.app.a:layout/main",
                                                                 test::parseConfigOrDie("hdpi-v4"));
    ASSERT_NE(nullptr, file);
    EXPECT_EQ(std::u16string(u"res/layout-hdpi-v4/main.xml"), *file->path);
}
void NSNeutronEqResid<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
  typedef Intrepid::FunctionSpaceTools FST;

  FST::scalarMultiplyDataData<ScalarT> (flux, NeutronDiff, NGrad);

  FST::integrate<ScalarT>(NResidual, flux, wGradBF, Intrepid::COMP_CPP, false); // "false" overwrites
  
  for (std::size_t cell=0; cell < workset.numCells; ++cell) {
    for (std::size_t qp=0; qp < numQPs; ++qp) {
      abscoeff(cell,qp) = 
	(Absorp(cell,qp) - nu(cell,qp)*Fission(cell,qp)) * Neutron(cell,qp);
      if (haveNeutSource) abscoeff(cell,qp) -= Source(cell,qp);
    }
  }

  FST::integrate<ScalarT>(NResidual, abscoeff, wBF, Intrepid::COMP_CPP, true); // "true" sums into

}
Exemple #28
0
// because the debugger can be attached at any time, and also because other
// methods will be called on this debugger for sources that have already been
// detached, we make fake entries for unknown source entries as they are
// encountered, and we retain old sourceID entries until they are replaced
// by new data.  fake entries are handled by the Source constructor.
void DebuggerShell::sourceParsed(ExecState* execState,
                                 SourceProvider* sourceProvider,
                                 int errorLineNumber,
                                 const WTF::String& errorMessage) {
  intptr_t sourceID = sourceProvider->asID();
  Source source = Source(fromWTFString(sourceProvider->url()));
  source.parseID = nextParseID_++;
  source_map_[sourceID] = source;

  // The URL map is used in setting breakpoints.
  // Therefore, it's okay if we overwrite one entry with another.
  // This might happen if we parse both http://a.tld/foo.js and http://b.tld/foo.js ,
  // both of which would clobber the spot occupied by the filename foo.js .
  // This means if you want to break on one or the other, you'll have to
  // specify the full URL.  The convenient mapping for filename won't be useful.
  // But for the common case, filename is very very useful.
  url_map_[source.url] = sourceID;
  url_map_[source.filename] = sourceID;
  parse_id_map_[source.parseID] = sourceID;

  if (errorLineNumber >= 0) {
    WTF::CString error = errorMessage.ascii();
    WTF::CString f = WTF::String::format("Parse failed in %s on line %d: %s",
        source.url.c_str(), errorLineNumber, error.data()).ascii();
    dumpToTTY(f);
  } else {
    if (tracing_ || dumping_source_) {
      WTF::CString f = WTF::String::format("Parsed %s", source.url.c_str()).ascii();
      dumpToTTY(f);
    }
    if (dumping_source_) {
      // NOTE: We only dump first 100 bytes of source.  The point is to know
      // more or less what's in it, not to see all 2MB of JavaScript.
      // It's really most useful for seeing the source of evals full of JSON.
      WTF::CString code = sourceProvider->source().ascii();
      WTF::CString code_clipped(code.data(), code.length() > 100 ? 100 : code.length());
      WTF::CString f = WTF::String::format("Source of %s[%d]: %s", source.url.c_str(), source.parseID, code_clipped.data()).ascii();
      dumpToTTY(f);
    }
  }
}
void NSThermalEqResid<EvalT, Traits>::
evaluateFields(typename Traits::EvalData workset)
{
  typedef Intrepid2::FunctionSpaceTools FST;

  FST::scalarMultiplyDataData<ScalarT> (flux, ThermalCond, TGrad);

  FST::integrate<ScalarT>(TResidual, flux, wGradBF, Intrepid2::COMP_CPP, false); // "false" overwrites
  
  for (std::size_t cell=0; cell < workset.numCells; ++cell) {
    for (std::size_t qp=0; qp < numQPs; ++qp) {
      convection(cell,qp) = 0.0;
      if (haveSource) convection(cell,qp) -= Source(cell,qp);
      if (workset.transientTerms && enableTransient) 
	convection(cell,qp) += rho(cell,qp) * Cp(cell,qp) * Tdot(cell,qp);
      if (haveFlow) {
	for (std::size_t i=0; i < numDims; ++i) { 
	  convection(cell,qp) += 
	    rho(cell,qp) * Cp(cell,qp) * V(cell,qp,i) * TGrad(cell,qp,i);
	}
      }
    }
  }

  FST::integrate<ScalarT>(TResidual, convection, wBF, Intrepid2::COMP_CPP, true); // "true" sums into

  if (haveSUPG) {
    for (std::size_t cell=0; cell < workset.numCells; ++cell) {
      for (std::size_t node=0; node < numNodes; ++node) {          
	for (std::size_t qp=0; qp < numQPs; ++qp) {               
	  for (std::size_t j=0; j < numDims; ++j) { 
	    TResidual(cell,node) += 
	      rho(cell,qp) * Cp(cell,qp) * TauT(cell,qp) * convection(cell,qp) *
	      V(cell,qp,j) * wGradBF(cell,node,qp,j);
	  }  
	}
      }
    }
  }

}
Exemple #30
0
// If in immediate mode, quickly add a vertex.
// If building an action list, call pSource.
void PContextActions_t::Vertex(const pVec &pos, const long data)
{
    if(PS->in_new_list) {
        Source(1, PDPoint(pos));
        return;
    }

    // Immediate mode. Quickly add the vertex.
    pVec posB, siz, up, vel, rvel, col, alpha;

    posB = PS->SrcSt.vertexB_tracks ? pos : PS->SrcSt.VertexB->Generate();
    siz = PS->SrcSt.Size->Generate();
    up = PS->SrcSt.Up->Generate();
    vel = PS->SrcSt.Vel->Generate();
    rvel = PS->SrcSt.RotVel->Generate();
    col = PS->SrcSt.Color->Generate();
    alpha = PS->SrcSt.Alpha->Generate();
    float ag = PS->SrcSt.Age + pNRandf(PS->SrcSt.AgeSigma);

    PS->PGroups[PS->pgroup_id].Add(pos, posB, up, vel, rvel, siz, col, alpha.x(), ag, PS->SrcSt.Mass, data);
}