Пример #1
0
void aml_append(Aml *parent_ctx, Aml *child)
{
    GArray *buf = build_alloc_array();
    build_append_array(buf, child->buf);

    switch (child->block_flags) {
    case AML_OPCODE:
        build_append_byte(parent_ctx->buf, child->op);
        break;
    case AML_EXT_PACKAGE:
        build_extop_package(buf, child->op);
        break;
    case AML_PACKAGE:
        build_package(buf, child->op);
        break;
    case AML_RES_TEMPLATE:
        build_append_byte(buf, 0x79); /* EndTag */
        /*
         * checksum operations are treated as succeeded if checksum
         * field is zero. [ACPI Spec 1.0b, 6.4.2.8 End Tag]
         */
        build_append_byte(buf, 0);
        /* fall through, to pack resources in buffer */
    case AML_BUFFER:
        build_buffer(buf, child->op);
        break;
    case AML_NO_OPCODE:
        break;
    default:
        assert(0);
        break;
    }
    build_append_array(parent_ctx->buf, buf);
    build_free_array(buf);
}
Пример #2
0
// ------------------------------------------------------------------- quit ---
void reset( void )
{ 
    p_family    = VERA;
    p_size      = 12.0;
    p_invert    = 0;
    p_kerning   = 1;
    p_hinting   = 1;
    p_lcd_filtering = 1;
    p_gamma     = 1.0;
    p_interval  = 0.0;
    p_weight    = 0.33;
    p_width     = 1.0;
    p_faux_weight = 0.0;
    p_faux_italic = 0.0;

    // FT_LCD_FILTER_LIGHT
    p_primary   = 1.0/3.0;
    p_secondary = 1.0/3.0;
    p_tertiary  = 0.0/3.0;

    // FT_LCD_FILTER_DEFAULT
    // p_primary   = 3.0/9.0;
    // p_secondary = 2.0/9.0;
    // p_tertiary  = 1.0/9.0;

    if( !p_lcd_filtering )
    {
        atlas = atlas_gray;
    }
    else
    {
        atlas = atlas_rgb;
    }
    build_buffer();
}
Пример #3
0
// -------------------------------------------------- get/set lcd_filtering ---
void TW_CALL set_lcd_filtering( const void *value, void *data )
{
    p_lcd_filtering = *(const int *) value;
    if( p_lcd_filtering )
    {
        atlas = atlas_rgb;
    }
    else
    {
        atlas = atlas_gray;
    }
    build_buffer();
}
Пример #4
0
// -------------------------------------------------- get/set lcd_filtering ---
void TW_CALL set_lcd_filtering( const void *value, void *data )
{
    p_lcd_filtering = *(const int *) value;
    if( p_lcd_filtering )
    {
        font_manager = font_manager_rgb;
    }
    else
    {
        font_manager = font_manager_a;
    }
    build_buffer();
}
Пример #5
0
std::string IEServer::GetStatus() {
  SYSTEM_INFO system_info;
  ::ZeroMemory(&system_info, sizeof(SYSTEM_INFO));
  ::GetNativeSystemInfo(&system_info);

  OSVERSIONINFO os_version_info;
  ::ZeroMemory(&os_version_info, sizeof(OSVERSIONINFO));
  os_version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
  ::GetVersionEx(&os_version_info);

  // Allocate only 2 characters for the major and minor versions
  // and 5 characters for the build number (+1 for null char)
  vector<char> major_buffer(3);
  _itoa_s(os_version_info.dwMajorVersion, &major_buffer[0], 3, 10);
  vector<char> minor_buffer(3);
  _itoa_s(os_version_info.dwMinorVersion, &minor_buffer[0], 3, 10);
  vector<char> build_buffer(6);
  _itoa_s(os_version_info.dwBuildNumber, &build_buffer[0], 6, 10);

  std::string major_version(&major_buffer[0]);
  std::string minor_version(&minor_buffer[0]);
  std::string build_version(&build_buffer[0]);
  std::string os_version = major_version + "." + minor_version + "." + build_version;

  std::string arch = "x86";
  if (system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) {
    arch = "x64";
  }

  Json::Value build;
  build["version"] = "2.21.0";

  Json::Value os;
  os["arch"] = arch;
  os["name"] = "windows";
  os["version"] = os_version;
    
  Json::Value status;
  status["build"] = build;
  status["os"] = os;
  Response response;
  response.SetSuccessResponse(status);
  return response.Serialize();
}
Пример #6
0
int main(){
int n,i=0;
char *com;
scanf("%d",&n);
if(n==0)return 0;
build_buffer(n);

while(1){
 com=(char*)malloc(sizeof(char)*10);
scanf("%[^\n]s",com);
command_exec(com);



}
 return 0;


}
Пример #7
0
int queryTag(int argc, char **argv) {
	unsigned int tag;
	unsigned int length = 4;
	if(argc == 0) {
		printf("%s: invalid arguments\r\n", argv[0]);
		return -1;
	} else {
		tag = strtol(argv[1], 0, 16);
	}
	if(argc >= 2) length = strtol(argv[2], 0, 10);
	volatile unsigned int *buffer = build_buffer(tag, length);
	for(int i=0; i+3 <= argc; i++) {
		buffer[i+5] = strtol(argv[i+3], 0, 16);
		buffer[4] += 4;
	}
	sendTagBuffer(buffer);

	if (buffer[1] == 0x80000000 && (buffer[4] & 0x7fffffff) == 4) {
		printf("%08x\r\n", buffer[5]); // pretty printing for single int replies
	} else {
		dump((unsigned char *) buffer, buffer[0]);
	}
	return 0;
}
Пример #8
0
// --------------------------------------------------------- get/set family ---
void TW_CALL set_family( const void *value, void *data )
{
    p_family = *(const font_family_e *) value;
    build_buffer();
}
Пример #9
0
// ----------------------------------------------------------- get/set tertiary ---
void TW_CALL set_tertiary( const void *value, void *data )
{
    p_tertiary = *(const float *) value;
    build_buffer();

}
Пример #10
0
// ---------------------------------------------------- get/set faux_italic ---
void TW_CALL set_faux_italic( const void *value, void *data )
{
    p_faux_italic = *(const float *) value;
    build_buffer();
}
Пример #11
0
// ----------------------------------------------------------- get/set size ---
void TW_CALL set_size( const void *value, void *data )
{
    p_size = *(const float *) value;
    build_buffer();

}
Пример #12
0
// ---------------------------------------------------------- get/set width ---
void TW_CALL set_width( const void *value, void *data )
{
    p_width = *(const float *) value;
    build_buffer();
}
Пример #13
0
// ------------------------------------------------------- get/set interval ---
void TW_CALL set_interval( const void *value, void *data )
{
    p_interval = *(const float *) value;
    build_buffer();
}
Пример #14
0
// --------------------------------------------------------- get/set invert ---
void TW_CALL set_invert( const void *value, void *data )
{
    p_invert = *(const int *) value;
    build_buffer();
}
Пример #15
0
// ---------------------------------------------------------- get/set gamma ---
void TW_CALL set_gamma( const void *value, void *data )
{
    p_gamma = *(const float *) value;
    build_buffer();
}
Пример #16
0
// ------------------------------------------------------------ get/set int ---
void TW_CALL set_int( const void *value, void *data )
{
    *(int *)data = *(const int *) value;
    build_buffer();
}
Пример #17
0
// ----------------------------------------------------------- build_buffer ---
void
build_buffer( void )
{
    vec2 pen;
    texture_font_t *font;
    vec4 black  = {{0.0, 0.0, 0.0, 1.0}};
    vec4 white  = {{1.0, 1.0, 1.0, 1.0}};
    vec4 none   = {{1.0, 1.0, 1.0, 0.0}};
    vec4 color = white;
    if( p_invert )
    {
        color = black;
    }

    markup_t markup = {
        .family  = "Source Sans Pro",
        .size    = 10.0,
        .bold    = 0,
        .italic  = 0,
        .spacing = p_interval,
        .gamma   = p_gamma,
        .foreground_color    = color,
        .background_color    = none,
        .underline           = 0,
        .underline_color     = color,
        .overline            = 0,
        .overline_color      = color,
        .strikethrough       = 0,
        .strikethrough_color = color,
        .font = 0,
    };

    text_buffer_clear( text_buffer );
    texture_atlas_t * atlas = font_manager->atlas;
    texture_atlas_clear( atlas );

    if( p_family == VERA)
    {
        font = texture_font_new_from_file( atlas, p_size, "fonts/Vera.ttf" );
    }
    else if( p_family == VERA_MONO)
    {
        font = texture_font_new_from_file( atlas, p_size, "fonts/VeraMono.ttf" );
    }
    else if( p_family == LUCKIEST_GUY)
    {
        font = texture_font_new_from_file( atlas, p_size, "fonts/LuckiestGuy.ttf" );
    }
    else if( p_family == SOURCE_SANS )
    {
        font = texture_font_new_from_file( atlas, p_size, "fonts/SourceSansPro-Regular.ttf" );
    }
    else if( p_family == SOURCE_CODE )
    {
        font = texture_font_new_from_file( atlas, p_size, "fonts/SourceCodePro-Regular.ttf" );
    }
    else if( p_family == OLD_STANDARD )
    {
        font = texture_font_new_from_file( atlas, p_size, "fonts/OldStandard-Regular.ttf" );
    }
    else if( p_family == LOBSTER )
    {
        font = texture_font_new_from_file( atlas, p_size, "fonts/Lobster-Regular.ttf" );
    }
    else
    {
        fprintf( stderr, "Error : Unknown family type\n" );
        return;
    }

	if (!font)
		return;

    markup.font = font;
    font->hinting = p_hinting;
    font->kerning = p_kerning;
    font->filtering = 1;
    float norm = 1.0/(p_primary + 2*p_secondary + 2*p_tertiary);
    font->lcd_weights[0] = (unsigned char)(p_tertiary*norm*255);
    font->lcd_weights[1] = (unsigned char)(p_secondary*norm*255);
    font->lcd_weights[2] = (unsigned char)(p_primary*norm*255);
    font->lcd_weights[3] = (unsigned char)(p_secondary*norm*255);
    font->lcd_weights[4] = (unsigned char)(p_tertiary*norm*255);
    pen.x = 10;
    pen.y = 600 - font->height - 10;
    text_buffer_printf( text_buffer, &pen, &markup, text, NULL );

    // Post-processing for width and orientation
    vertex_buffer_t * vbuffer = text_buffer->buffer;
    size_t i;
    for( i=0; i < vector_size( vbuffer->items ); ++i )
    {
        ivec4 *item = (ivec4 *) vector_get( vbuffer->items, i);
        glyph_vertex_t * v0 = /* x0,y0 */
            (glyph_vertex_t *) vector_get( vbuffer->vertices, item->vstart+0 );
        //glyph_vertex_t * v1 = /* x0,y1 */
        //    (glyph_vertex_t *) vector_get( vbuffer->vertices, item->vstart+1 );
        glyph_vertex_t * v2 = /* x1,y1 */
            (glyph_vertex_t *) vector_get( vbuffer->vertices, item->vstart+2 );
        glyph_vertex_t * v3 = /* x1,y0 */
            (glyph_vertex_t *) vector_get( vbuffer->vertices, item->vstart+3 );

        float x0 = v0->x, y0 = v0->y;
        float x1 = v2->x, y1 = v2->y;
        v2->x = v3->x = x0 + (x1-x0)*p_width;

        float dy = fabs(y1-y0);
        float dx = tan(p_faux_italic/180.0 * M_PI) * dy;
        v0->x += dx;
        v0->shift = fmod(v0->shift + dx-(int)(dx),1.0);
        v3->x += dx;
        v3->shift = fmod(v3->shift + dx-(int)(dx),1.0);
    }

    glBindTexture( GL_TEXTURE_2D, font_manager->atlas->id );
    GLenum gl_format = (font_manager->atlas->depth == LCD_FILTERING_OFF) ?
        GL_RED : GL_RGB;
    glTexImage2D( GL_TEXTURE_2D, 0, gl_format, font_manager->atlas->width,
        font_manager->atlas->height, 0, gl_format, GL_UNSIGNED_BYTE,
        font_manager->atlas->data );

    texture_font_delete( font );
}


// ------------------------------------------------------------------- quit ---
void reset( void )
{
    p_family    = VERA;
    p_size      = 12.0;
    p_invert    = 0;
    p_kerning   = 1;
    p_hinting   = 1;
    p_lcd_filtering = 1;
    p_gamma     = 1.75;
    p_interval  = 0.0;
    p_weight    = 0.33;
    p_width     = 1.0;
    p_faux_weight = 0.0;
    p_faux_italic = 0.0;

    // FT_LCD_FILTER_LIGHT
    p_primary   = 1.0/3.0;
    p_secondary = 1.0/3.0;
    p_tertiary  = 0.0/3.0;

    // FT_LCD_FILTER_DEFAULT
    // p_primary   = 3.0/9.0;
    // p_secondary = 2.0/9.0;
    // p_tertiary  = 1.0/9.0;

    build_buffer();
}
Пример #18
0
// ---------------------------------------------------------- get/set float ---
void TW_CALL set_float( const void *value, void *data )
{
    *(float *) data = *(const float *) value;
    build_buffer();
}
Пример #19
0
// -------------------------------------------------------- get/set hinting ---
void TW_CALL set_hinting( const void *value, void *data )
{
    p_hinting = *(const int *) value;
    build_buffer();
}
Пример #20
0
main()
	{
	double t,wps;
	int str;
	ui count,buflen;
	int i,pcount=0;
	char strbuf[10];

	/* Open our log file */
	for(i=1; i<32; ++i)
	   {
	   sprintf(strbuf,"cache.%d",i);
	   if (access(strbuf,0)) break;
	   }
	record=fopen(strbuf,"w");
	if (record==NULL) printf("Could not open record file %s. No record kept\n",strbuf);
	else printf("\t\tA copy of this run will be kept in %s\n\n",strbuf);

	printf("Memory tester v1.0\n");
	printf("Author: [email protected], January 1996\n\n");
	printf("On this machine, one word = %d bytes\n",sizeof(ui *));
	printf("Reported access times are in nS per word.\n\n");
	if (record!=NULL)
	   {
	   fprintf(record,"On this machine, one word = %d bytes\n",sizeof(ui *));
	   fprintf(record,"Reported access times are in nS per word.\n\n");
	   }

	/* Start with a block of 256 words, each word is of type (ui *) */
	build_buffer(256,1);
	count=8;
	do
	   {
	   count *= 2;
	   t = read_test(count);
	   }
	while(t < 2);

	fflush(stdout);

	print_header();
	count = (ui)((double)count * LOOPTIME / t);
	for(buflen=256; buflen<=MAXBSIZE; buflen*=2)
	   {
	   if (buflen<256*1024) sprintf(strbuf,"%uk",buflen/256);
	   else sprintf(strbuf,"%uM",buflen/(256*1024));

	   printf("%-5.5s|",strbuf); fflush(stdout);
	   if (record!=NULL) fprintf(record,"%-5.5s|",strbuf);

	   for(str=1; str<buflen; str*=2)
	   	{
	   	build_buffer(buflen,str);

	   	while(1)
	      	   {
	      	   t = read_test(count);
	      	   if (t<1.0) count*=3; else break;
	      	   }
	
	   	wps = (double)(count) / t;
	  	wps = 1.0e9 / wps;
		if (wps>=1000)
		   {
	    	   printf("1k+ ");
	    	   if (record!=NULL) fprintf(record,"1k+ ");
		   }
		else 
		   {
		   printf("%-3d ", (int)wps);
		   if (record!=NULL) fprintf(record,"%-3d ", (int)wps);
		   }

		fflush(stdout); if (record!=NULL) fflush(record);

	   	count = (ui)((double)count * LOOPTIME / t);
	   	}
	   putchar('\n');
	   if (record!=NULL) putc('\n',record);
	   }

	if (record!=NULL) fclose(record);
	}