当前位置: 首页>>代码示例>>C++>>正文


C++ Flush函数代码示例

本文整理汇总了C++中Flush函数的典型用法代码示例。如果您正苦于以下问题:C++ Flush函数的具体用法?C++ Flush怎么用?C++ Flush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Flush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dbg_assert

void CGraphics_OpenGL::QuadsEnd()
{
	dbg_assert(m_Drawing == DRAWING_QUADS, "called quads_end without begin");
	Flush();
	m_Drawing = 0;
}
开发者ID:949f45ac,项目名称:atwmodr3,代码行数:6,代码来源:graphics.cpp

示例2: EndByteCompression

// return 0 if error or no. of bytes writte if success
int Cvfgk::EndByteCompression(){
  if(Encode(fByteOut,ctEndChar)) return 0;
  if(Flush(fByteOut)) return 0;
  fByteOut = NULL;
  return iBytesWritten;
}
开发者ID:WenchaoLin,项目名称:JAMg,代码行数:7,代码来源:gcompress.cpp

示例3: Flush

void WriteFileStream::Put(char c)
{
    *current_++ = c;
    if (current_ == bufferLast_)
        Flush();
}
开发者ID:AlbrechtL,项目名称:anyrpc,代码行数:6,代码来源:stream.cpp

示例4: StreamFlush

static HRESULT StreamFlush( aout_stream_t *s )
{
    return Flush( s->sys );
}
开发者ID:videolan,项目名称:vlc,代码行数:4,代码来源:directsound.c

示例5: SPADES_MARK_FUNCTION

		void GLSoftSpriteRenderer::Render() {
			SPADES_MARK_FUNCTION();
			lastImage = NULL;
			program->Use();

			device->Enable(IGLDevice::Blend, true);
			device->BlendFunc(IGLDevice::One, IGLDevice::OneMinusSrcAlpha);

			projectionViewMatrix(program);
			rightVector(program);
			frontVector(program);
			viewOriginVector(program);
			upVector(program);
			texture(program);
			depthTexture(program);
			viewMatrix(program);
			fogDistance(program);
			fogColor(program);
			zNearFar(program);

			positionAttribute(program);
			spritePosAttribute(program);
			colorAttribute(program);

			projectionViewMatrix.SetValue(renderer->GetProjectionViewMatrix());
			viewMatrix.SetValue(renderer->GetViewMatrix());

			fogDistance.SetValue(renderer->GetFogDistance());

			Vector3 fogCol = renderer->GetFogColor();
			fogCol *= fogCol; // linearize
			fogColor.SetValue(fogCol.x, fogCol.y, fogCol.z);

			const client::SceneDefinition &def = renderer->GetSceneDef();
			rightVector.SetValue(def.viewAxis[0].x, def.viewAxis[0].y, def.viewAxis[0].z);
			upVector.SetValue(def.viewAxis[1].x, def.viewAxis[1].y, def.viewAxis[1].z);
			frontVector.SetValue(def.viewAxis[2].x, def.viewAxis[2].y, def.viewAxis[2].z);

			viewOriginVector.SetValue(def.viewOrigin.x, def.viewOrigin.y, def.viewOrigin.z);
			texture.SetValue(0);
			depthTexture.SetValue(1);
			zNearFar.SetValue(def.zNear, def.zFar);

			device->ActiveTexture(1);
			device->BindTexture(IGLDevice::Texture2D,
			                    renderer->GetFramebufferManager()->GetDepthTexture());
			device->ActiveTexture(0);

			device->EnableVertexAttribArray(positionAttribute(), true);
			device->EnableVertexAttribArray(spritePosAttribute(), true);
			device->EnableVertexAttribArray(colorAttribute(), true);

			thresLow = tanf(def.fovX * .5f) * tanf(def.fovY * .5f) * 1.8f;
			thresRange = thresLow * .5f;

			// full-resolution sprites
			{
				GLProfiler::Context measure(renderer->GetGLProfiler(), "Full Resolution");
				for (size_t i = 0; i < sprites.size(); i++) {
					Sprite &spr = sprites[i];
					float layer = LayerForSprite(spr);
					if (layer == 1.f)
						continue;
					if (spr.image != lastImage) {
						Flush();
						lastImage = spr.image;
						SPAssert(vertices.empty());
					}

					Vertex v;
					v.x = spr.center.x;
					v.y = spr.center.y;
					v.z = spr.center.z;
					v.radius = spr.radius;
					v.angle = spr.angle;
					v.r = spr.color.x;
					v.g = spr.color.y;
					v.b = spr.color.z;
					v.a = spr.color.w;

					float fade = 1.f - layer;
					v.r *= fade;
					v.g *= fade;
					v.b *= fade;
					v.a *= fade;

					uint32_t idx = (uint32_t)vertices.size();
					v.sx = -1;
					v.sy = -1;
					vertices.push_back(v);
					v.sx = 1;
					v.sy = -1;
					vertices.push_back(v);
					v.sx = -1;
					v.sy = 1;
					vertices.push_back(v);
					v.sx = 1;
					v.sy = 1;
					vertices.push_back(v);

//.........这里部分代码省略.........
开发者ID:Rootmars,项目名称:openspades,代码行数:101,代码来源:GLSoftSpriteRenderer.cpp

示例6: ENTER


//.........这里部分代码省略.........
                err = engine->Send(MSG_FLASH_SET_REGION, hbaTag);
                if (err.Success())
                {
                    // Send the command to the engine to read the flash memory.
                    engine->Reset();
                    engine->Insert((uLONG) 0);
                    engine->Insert((uLONG) region_size);
                    err = engine->Send(MSG_FLASH_READ, hbaTag);

                    // If the read succeeded then copy the data that was read from the flash
                    // memory into the caller's buffer.
                    if (err.Success())
                    {
                        engine->Extract(original, region_size);
#                       if (defined(DEBUG_RMWFlash))
                            {
                                int fd = creat ("before", 0777);
                                write (fd, original, (unsigned)region_size);
                                close (fd);
                            }
#                       endif
                        if (strcmp (data, "-") == 0)
                        {
                            char temp_Buf[ 256 ];
                            sprintf(temp_Buf, "%.*s\r\n", size, original + offset);
                            (**output).add_Item (temp_Buf);
                            continue;
                        }

                        engine->Reset();
                        engine->Insert((uLONG) region);
                        err = engine->Send(MSG_FLASH_SET_REGION, hbaTag);
                        if (err.Success())
                        {
                            /* Ideally we want the caller to specify the checksum handling, but for now ... */
                            switch (region) {
                            case 4:
                                if ((0x14 < offset) && (offset < 0x7F))
                                {
                                    break;
                                }
                                *((unsigned long *)(&original[0x10])) += CheckSum (data, size) - CheckSum (original + offset, size);
                            case 0:
                            case 1:
                            case 2:
                            case 3:
                                break;
                            }

                            memcpy (original + offset, data, size);
#                           if (defined(DEBUG_RMWFlash))
                                {
                                    int fd = creat ("after", 0777);
                                    write (fd, original, (unsigned)region_size);
                                    close (fd);
                                }
#                           endif
                            // Send the command to the engine to write the flash memory.
                            engine->Reset();
                            engine->Insert((void *)original, region_size);
                            err = engine->Send(MSG_FLASH_WR_NO_VERIFY, hbaTag);
                            if (err.Success())
                            {
                                // Send the command to the engine to stop writing flash memory.
                                engine->Reset();
                                err = engine->Send(MSG_FLASH_WRITE_DONE, hbaTag);
                                if (err.Success())
                                {
                                    (**output).add_Item(EventStrings[STR_FLASH_COMPLETE]);
                                }
                            }
                        }
                    }
                }
                delete [] original;
                if (err.Failure())
                {
                    extern void Flush( String_List * );
                    char temp_Buf[ 256 ];
                    sprintf(temp_Buf,
                      EventStrings[STR_FLASH_ERR_MSG],
                      0L, (int)err, (char *)err);

                    (**output).add_Item (temp_Buf);
                    Flush (*output);
                    // Send the command to the engine to stop writing flash memory.
                    engine->Reset();
                    engine->Insert((uCHAR) 1);
                    err = engine->Send(MSG_FLASH_WRITE_DONE, hbaTag);
                    break;
                }
            } else {
                err = Dpt_Error::DPT_ERR_NOT_ENOUGH_MEMORY;
                break;
            }
        }
    }
    (**output).add_Item("\n");
    return (err);
}
开发者ID:barak,项目名称:raidutils,代码行数:101,代码来源:rmwflash.cpp

示例7: size_t

// ProcessOne() takes a track, transforms it to bunch of buffer-blocks,
// and calls libsamplerate code on these blocks.
bool EffectChangeSpeed::ProcessOne(WaveTrack * track,
                           sampleCount start, sampleCount end)
{
   if (track == NULL)
      return false;

   // initialization, per examples of Mixer::Mixer and
   // EffectSoundTouch::ProcessOne

   auto outputTrack = mFactory->NewWaveTrack(track->GetSampleFormat(),
                                                    track->GetRate());

   //Get the length of the selection (as double). len is
   //used simple to calculate a progress meter, so it is easier
   //to make it a double now than it is to do it later
   auto len = (end - start).as_double();

   // Initiate processing buffers, most likely shorter than
   // the length of the selection being processed.
   auto inBufferSize = track->GetMaxBlockSize();

   Floats inBuffer{ inBufferSize };

   // mFactor is at most 100-fold so this shouldn't overflow size_t
   auto outBufferSize = size_t( mFactor * inBufferSize + 10 );
   Floats outBuffer{ outBufferSize };

   // Set up the resampling stuff for this track.
   Resample resample(true, mFactor, mFactor); // constant rate resampling

   //Go through the track one buffer at a time. samplePos counts which
   //sample the current buffer starts at.
   bool bResult = true;
   auto samplePos = start;
   while (samplePos < end) {
      //Get a blockSize of samples (smaller than the size of the buffer)
      auto blockSize = limitSampleBufferSize(
         track->GetBestBlockSize(samplePos),
         end - samplePos
      );

      //Get the samples from the track and put them in the buffer
      track->Get((samplePtr) inBuffer.get(), floatSample, samplePos, blockSize);

      const auto results = resample.Process(mFactor,
                                    inBuffer.get(),
                                    blockSize,
                                    ((samplePos + blockSize) >= end),
                                    outBuffer.get(),
                                    outBufferSize);
      const auto outgen = results.second;

      if (outgen > 0)
         outputTrack->Append((samplePtr)outBuffer.get(), floatSample,
                             outgen);

      // Increment samplePos
      samplePos += results.first;

      // Update the Progress meter
      if (TrackProgress(mCurTrackNum, (samplePos - start).as_double() / len)) {
         bResult = false;
         break;
      }
   }

   // Flush the output WaveTrack (since it's buffered, too)
   outputTrack->Flush();

   // Take the output track and insert it in place of the original
   // sample data
   double newLength = outputTrack->GetEndTime();
   if (bResult)
   {
      LinearTimeWarper warper { mCurT0, mCurT0, mCurT1, mCurT0 + newLength };
      bResult = track->ClearAndPaste(
         mCurT0, mCurT1, outputTrack.get(), true, false, &warper);
   }

   if (newLength > mMaxNewLength)
      mMaxNewLength = newLength;

   return bResult;
}
开发者ID:rbuj,项目名称:audacity,代码行数:86,代码来源:ChangeSpeed.cpp

示例8: PutByte


//.........这里部分代码省略.........

	PutByte(0); // ss, first AC
	PutByte(63); // se, last AC

	PutByte(0); // ah | al

	static float cosuv[8][8][8][8];

	// oh yeah, we don't need no fast dct :)
	for(int v = 0; v < 8; v++) 
		for(int u = 0; u < 8; u++)
			for(int j = 0; j < 8; j++) 
				for(int i = 0; i < 8; i++)
					cosuv[v][u][j][i] = (float)(cos((2*i+1)*u*PI/16) * cos((2*j+1)*v*PI/16));

	int prevDC[3] = {0, 0, 0};

	for(int y = 0; y < m_h; y += 8)
	{
		int jj = min(m_h - y, 8);

		for(int x = 0; x < m_w; x += 8)
		{
			int ii = min(m_w - x, 8);

			for(int c = 0; c < ColorComponents; c++)
			{
				int cc = !!c;

				int ACs = 0;

				static short block[64];

				for(int zigzag = 0; zigzag < 64; zigzag++) 
				{
					BYTE u = zigzagU[zigzag];
					BYTE v = zigzagV[zigzag];

					float F = 0;
/*
					for(int j = 0; j < jj; j++)
						for(int i = 0; i < ii; i++) 
							F += (signed char)m_p[((y+j)*m_w + (x+i))*4 + c] * cosuv[v][u][j][i];
*/
					for(int j = 0; j < jj; j++)
					{
						signed char* p = (signed char*)&m_p[((y+j)*m_w + x)*4 + c];
						for(int i = 0; i < ii; i++, p += 4) 
							F += *p * cosuv[v][u][j][i];
					}

					float cu = !u ? invsq2 : 1.0f;
					float cv = !v ? invsq2 : 1.0f;

					block[zigzag] = short(2.0 / 8.0 * cu * cv * F) / quanttbl[cc][zigzag];
				}

				short DC = block[0] - prevDC[c];
				prevDC[c] = block[0];

				int size = GetBitWidth(DC);
				PutBit(DCVLC[cc][size], DCVLC_Size[cc][size]);

				if(DC < 0) DC = DC - 1;
				PutBit(DC, size);

				int j;
				for(j = 64; j > 1 && !block[j-1]; j--);

				for(int i = 1; i < j; i++)
				{
					short AC = block[i];

					if(AC == 0)
					{
						if(++ACs == 16)
						{
							PutBit(ACVLC[cc][15][0], ACVLC_Size[cc][15][0]);
							ACs = 0;
						}
					}
					else
					{
						int size = GetBitWidth(AC);
						PutBit(ACVLC[cc][ACs][size], ACVLC_Size[cc][ACs][size]);
						
						if(AC < 0) AC--;
						PutBit(AC, size);

						ACs = 0;
					}
				}

				if(j < 64) PutBit(ACVLC[cc][0][0], ACVLC_Size[cc][0][0]);
			}
		}
	}

	Flush();
}
开发者ID:Strongc,项目名称:playasa,代码行数:101,代码来源:jpeg.cpp

示例9: while

void MainWindow::ShowData()
{
	// Default dropdownmenu entries 
	pcDevice->Clear();
	pcDefaultInput->Clear();
	pcDefaultAudioOut->Clear();
	pcDefaultVideoOut->Clear();
	
	// Add inputs
	os::MediaInput* pcInput;
	uint32 nIndex = 0;
	m_nInputStart = 0;

	while ( ( pcInput = os::MediaManager::GetInstance()->GetInput( nIndex ) ) != NULL )
	{
		pcDevice->AppendItem( pcInput->GetIdentifier() );
		
		if( !pcInput->FileNameRequired() )
		{
			pcDefaultInput->AppendItem( pcInput->GetIdentifier() );
			if( pcInput->GetIdentifier() == cCurrentInput )
				pcDefaultInput->SetSelection( pcDefaultInput->GetItemCount() - 1, false );
		}
		pcInput->Release();
		nIndex++;
	}
	
	// Add codecs
	os::MediaCodec* pcCodec;
	m_nCodecStart = m_nInputStart + nIndex;
	nIndex = 0;

	while ( ( pcCodec = os::MediaManager::GetInstance()->GetCodec( nIndex ) ) != NULL )
	{
		pcDevice->AppendItem( pcCodec->GetIdentifier() );
		pcCodec->Release();
		nIndex++;
	}
	
	// Add outputs
	os::MediaOutput * pcOutput;
	m_nOutputStart = m_nCodecStart + nIndex;
	nIndex = 0;

	while ( ( pcOutput = os::MediaManager::GetInstance()->GetOutput( nIndex ) ) != NULL )
	{
		if( !pcOutput->FileNameRequired() )
		{
			// Add to default dropdown menus 
			for( int i = 0; i < pcOutput->GetOutputFormatCount(); i++ )
			{
				os::MediaFormat_s sFormat = pcOutput->GetOutputFormat( i );
				if( sFormat.nType == os::MEDIA_TYPE_AUDIO ) {
					pcDefaultAudioOut->AppendItem( pcOutput->GetIdentifier() );
					if( pcOutput->GetIdentifier() == cCurrentAudio )
						pcDefaultAudioOut->SetSelection( pcDefaultAudioOut->GetItemCount() - 1, false );
					break;
				}
			}
			for( int i = 0; i < pcOutput->GetOutputFormatCount(); i++ )
			{
				os::MediaFormat_s sFormat = pcOutput->GetOutputFormat( i );
				if( sFormat.nType == os::MEDIA_TYPE_VIDEO ) {
					pcDefaultVideoOut->AppendItem( pcOutput->GetIdentifier() );
					if( pcOutput->GetIdentifier() == cCurrentVideo )
						pcDefaultVideoOut->SetSelection( pcDefaultVideoOut->GetItemCount() - 1, false );

					break;
				}
			}
		}
		pcDevice->AppendItem( pcOutput->GetIdentifier() );
		
		pcOutput->Release();
		nIndex++;
	}
	
	if( m_nDeviceSelect > -1 )
		pcDevice->SetSelection( m_nDeviceSelect, false );

	Flush();
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:82,代码来源:mainwindow.cpp

示例10: while

RTFStatus RTFReader::Parse(void)
{
	RTFStatus t_status;
	t_status = kRTFStatusSuccess;
			
	while(t_status == kRTFStatusSuccess)
	{
		RTFToken t_token;
		int4 t_value;
		
		if (m_input_skip_count > 0)
		{
			while(m_input_skip_count > 0)
			{
				t_status = ParseToken(t_token, t_value);
				if (t_status != kRTFStatusSuccess)
					break;

				if (t_token == kRTFTokenEnd || t_token == kRTFTokenBeginGroup || t_token == kRTFTokenEndGroup)
				{
					m_input_skip_count = 0;
					break;
				}

				if ((t_token & kRTFTokenMask) == kRTFTokenBin)
					m_input += t_value;

				m_input_skip_count -= 1;
			}
		}

		if (t_status == kRTFStatusSuccess)
			t_status = ParseToken(t_token, t_value);

		if (t_status != kRTFStatusSuccess)
			break;

		if (t_token == kRTFTokenEnd)
			break;
			
		if (t_token == kRTFTokenBeginGroup)
			t_status = m_state . Save();
		else if (t_token == kRTFTokenEndGroup)
		{
			// Take into account implementation of 'destinations'.
			bool t_was_list;
			t_was_list = m_state . GetDestination() == kRTFDestinationLegacyList;

			bool t_was_list_text;
			t_was_list_text = m_state . GetDestination() == kRTFDestinationListText;

			bool t_was_field;
			t_was_field = m_state . GetDestination() == kRTFDestinationFldInst;

			// MW-2014-01-08: [[ Bug 11627 ]] If the paragraph attributes have changed then
			//   force a flush so that a new paragraph with said attributes is created. [ This
			//   isn't 100% correct from my reading of the RTF Spec - really paragraph attrs
			//   should be set on the current paragraph as the paragraph is parsed, rather than
			//   before the first text is emitted - however due to the way LiveCode and Word Processors
			//   generate RTF, this at least makes things roundtrip ].
			if (m_state . HasParagraphChanged())
				Flush(true);

			t_status = m_state . Restore();

			if (t_was_list)
			{
				m_state . SetListStyle(m_list_style);
				m_state . SetListLevel(m_list_level);
			}
			else if (t_was_list_text)
			{
				if (m_list_skip)
					m_state . SetListStyle(kMCTextListStyleSkip);
			}
			else if (t_was_field && m_state . GetDestination() != kRTFDestinationFldInst)
			{
				ProcessField();
			}

			m_attributes_changed = true;
		}
		else if ((t_token & kRTFTokenMask) == kRTFTokenBin)
		{
			m_input_binary_count = t_value;
			m_input_state = kRTFInputStateBinary;
		}
		else switch(m_state . GetDestination())
		{
		case kRTFDestinationSkip:
			// If the skipped destination is in fact the 'list' destination then
			// handle it. We ignore 'pn' destinations if we have a listtable though.
			if (t_token == kRTFTokenLegacyList && m_lists . Count() == 0)
			{
				m_list_style = kMCTextListStyleNone;
				m_list_level = 0;
				m_state . SetDestination(kRTFDestinationLegacyList);
			}
			else if (t_token == kRTFTokenListTable)
				m_state . SetDestination(kRTFDestinationListTable);
//.........这里部分代码省略.........
开发者ID:soapdog,项目名称:livecode,代码行数:101,代码来源:rtf.cpp

示例11: switch

RTFStatus RTFReader::ParseDocument(RTFToken p_token, int4 p_value)
{
	RTFStatus t_status;
	t_status = kRTFStatusSuccess;

	RTFToken t_token;
	t_token = p_token & kRTFTokenMask;

	bool t_has_parameter;
	t_has_parameter = (p_token & kRTFTokenHasParameter) != 0;

	switch(t_token)
	{
	case kRTFTokenSkipDestination:
		m_state . SetDestination(kRTFDestinationSkip);
	break;
	
	case kRTFTokenFontTable:
		m_state . SetDestination(kRTFDestinationFontTable);
	break;
	
	case kRTFTokenColorTable:
		m_state . SetDestination(kRTFDestinationColorTable);
	break;
	
	case kRTFTokenListTable:
		m_state . SetDestination(kRTFDestinationListTable);
	break;

	case kRTFTokenListText:
		m_list_skip = true;
		m_state . SetDestination(kRTFDestinationListText);
	break;
			
	case kRTFTokenListOverrideTable:
		m_state . SetDestination(kRTFDestinationListOverrideTable);
	break;

	case kRTFTokenFldInst:
		m_state . SetDestination(kRTFDestinationFldInst);
	break;

	case kRTFTokenField:
	break;
			
	case kRTFTokenDefaultFont:
		if (t_has_parameter)
			m_default_font = p_value;
	break;

	case kRTFTokenAnsi:
		m_default_text_encoding = kMCTextEncodingWindows1252;
	break;

	case kRTFTokenMac:
		m_default_text_encoding = kMCTextEncodingMacRoman;
	break;

	case kRTFTokenPC:
		m_default_text_encoding = (MCTextEncoding)(kMCTextEncodingWindowsNative + 437);
	break;

	case kRTFTokenPCA:
		m_default_text_encoding = (MCTextEncoding)(kMCTextEncodingWindowsNative + 850);
	break;

	case kRTFTokenAnsiCodepage:
		if (t_has_parameter)
		{
			if (p_value < 0)
				p_value = 65536 + p_value;
			
			m_default_text_encoding = (MCTextEncoding)(kMCTextEncodingWindowsNative + p_value);
		}
	break;

	case kRTFTokenUnicodeSkip:
		if (t_has_parameter)
			m_state . SetUnicodeSkip(p_value);
	break;

	case kRTFTokenNewLine:
	case kRTFTokenParagraph:
		t_status = Flush(true);
		if (t_status == kRTFStatusSuccess)
		{
			if (m_needs_paragraph)
				Paragraph();
			m_needs_paragraph = true;
		}
	break;

	case kRTFTokenResetParagraphStyle:
		// MW-2012-03-14: [[ RtfParaStyles ]] Reset all the paragraph styles to defaults.
		m_state . SetListStyle(kMCTextListStyleNone);
		m_state . SetListLevel(0);
		m_state . SetListIndex(0);
		m_state . SetBorderWidth(0);
		m_state . SetPadding(0);
		m_state . SetFirstIndent(0);
//.........这里部分代码省略.........
开发者ID:soapdog,项目名称:livecode,代码行数:101,代码来源:rtf.cpp

示例12:

DSG:: RingBuffer::~RingBuffer(){Flush();}
开发者ID:zyvitski,项目名称:DSG,代码行数:1,代码来源:RingBuffer.cpp

示例13: Flush

void CSocketClient::ReleaseBuffers()
{
	Flush();
}
开发者ID:XeanoRRR,项目名称:mmo-resourse,代码行数:4,代码来源:SocketClient.cpp

示例14: Flush

void CGraphics_OpenGL::AddVertices(int Count)
{
	m_NumVertices += Count;
	if((m_NumVertices + Count) >= MAX_VERTICES)
		Flush();
}
开发者ID:949f45ac,项目名称:atwmodr3,代码行数:6,代码来源:graphics.cpp

示例15: _SHOWVALUE

void
_SHOWVALUE(
	unsigned long value,
	int size,
	const char *name,
	const char *file,
	int line)
{
	if(__debug_level >= DEBUGLEVEL_Reports)
	{
		char *fmt;

		switch(size)
		{
			case 1:

				fmt = "%s:%ld:%s = %ld, 0x%02lx";
				break;

			case 2:

				fmt = "%s:%ld:%s = %ld, 0x%04lx";
				break;

			default:

				fmt = "%s:%ld:%s = %ld, 0x%08lx";
				break;
		}

		_INDENT();

		if(debug_file == (BPTR)NULL)
			kprintf(fmt,file,line,name,value,value);
		else
			FPrintf(debug_file,fmt,file,line,name,value,value);

		if(size == 1 && value < 256)
		{
			if(debug_file == (BPTR)NULL)
			{
				if(value < ' ' || (value >= 127 && value < 160))
					kprintf(", '\\x%02lx'",value);
				else
					kprintf(", '%lc'",value);
			}
			else
			{
				if(value < ' ' || (value >= 127 && value < 160))
					FPrintf(debug_file,", '\\x%02lx'",value);
				else
					FPrintf(debug_file,", '%lc'",value);
			}
		}

		if(debug_file == (BPTR)NULL)
		{
			kprintf("\n");
		}
		else
		{
			FPrintf(debug_file,"\n");
			Flush(debug_file);
		}
	}
}
开发者ID:obarthel,项目名称:amiga-smbfs,代码行数:66,代码来源:assert.c


注:本文中的Flush函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。