• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ put_word函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: segtracker_startup

/* main entry of SegmentTracker for each Amiga run: setting up AutoConf area...
   if tracker is enabled then install a dummy resident that does the
   function patching in its init function */
uaecptr segtracker_startup (uaecptr resaddr)
{
    /* reset dos patching and clear seglist */
    dos_base = 0;
    del_all_seglists();

    if(!segtracker_enabled) {
        return resaddr;
    }

    write_log("segtracker: startup\n");

    /* setup a fake resident resident */
    put_word (resaddr + 0x0, 0x4AFC);
    put_long (resaddr + 0x2, resaddr);
    put_long (resaddr + 0x6, resaddr + 0x1A); /* Continue scan here */
    put_word (resaddr + 0xA, 0x0101); /* RTF_COLDSTART; Version 1 */
    put_word (resaddr + 0xC, 0x0078); /* NT_UNKNOWN; pri 05 */
    put_long (resaddr + 0xE, 0); /* no name */
    put_long (resaddr + 0x12, 0); /* no id */
    put_long (resaddr + 0x16, init_addr);
    resaddr += 0x1A;

    return resaddr;
}
开发者ID:alpine9000,项目名称:fs-uae,代码行数:28,代码来源:segtracker.cpp


示例2: dev_do_io

static int dev_do_io (struct s2devstruct *dev, uaecptr request, int quick)
{
	uae_u32 command = get_word (request + 28);
	struct priv_s2devstruct *pdev = getps2devstruct (request);
	uaecptr data = get_long (request + 32 + 4 + 4 + SANA2_MAX_ADDR_BYTES * 2 + 4);

	put_byte (request + 31, 0);
	if (!pdev) {
		write_log (_T("%s unknown iorequest %08x\n"), getdevname (), request);
		return 0;
	}
	if (command == NSCMD_DEVICEQUERY) {
		uae_u32 data = get_long (request + 40); /* io_data */
		put_long (data + 0, 0);
		put_long (data + 4, 16); /* size */
		put_word (data + 8, 7); /* NSDEVTYPE_SANA2 */
		put_word (data + 10, 0);
		put_long (data + 12, nscmd_cmd);
		put_long (request + 32, 16); /* io_actual */
		return 0;
	} else if (get_word (request + 0x12) < SANA2_IOREQSIZE) {
		put_byte (request + 31, IOERR_BADLENGTH);
		return 0;
	}
	return dev_do_io_2 (dev, request, quick);
}
开发者ID:sunfirefox,项目名称:WinUAE,代码行数:26,代码来源:sana2.cpp


示例3: set_vec

int set_vec(u16 vector, u16 addr)
{
    u16 location,cs;
    location = vector << 2;
    put_word(addr, 0, location);
    put_word(0x1000,0,location+2);
}
开发者ID:tymicruz,项目名称:CuatroSeisZero,代码行数:7,代码来源:t.c


示例4: hop

int hop(u32 newsegment)
{
    // Variables
    int j, i;
    u16 segment;
        
    // set it up to load umode properly!
    segment = (newsegment + 1) * MTXSEG; // calculate the newsegment
    kcopy(running->uss, segment, 32 * 1024);
    //load("/bin/u1", segment);
    for (i = 1; i <= 8; i++)
        put_word(j, segment, -2 * i);
    
    put_word(0x0200, segment, segment - 2);
    put_word(segment, segment, segment - 4);
    put_word(segment, segment, segment - 14);
    put_word(segment, segment, segment - 16);

    running->uss = segment;
    running->usp = segment - 16; //was 24

    printf("Proc[%d] hopped to segment 0x%x!\n", running->pid, segment);
    // return the proc!!!
    return (running->pid);
}
开发者ID:vonderborch,项目名称:CS460,代码行数:25,代码来源:int.c


示例5: put_wchar_string

static inline AVP_dword DATA_PARAM put_wchar_string( Serialize* sz, wchar_t * string ) {
	AVP_dword total_size;

	if ( string ) {
		AVP_dword psize = (AVP_dword)wcslen (string) * sizeof(AVP_wchar);
		AVP_word wsize = (AVP_word)psize;
		
		if ( psize >= USHRT_MAX ) {
			_RPT0( _CRT_ASSERT, "String is too long" );
			return 0;
		}
		
		if ( sizeof(AVP_word) != put_word (sz, &wsize) )
			return 0;
	
		for ( ; *string; string++ ) {
			if ( put_word(sz, string) != sizeof(AVP_word) )
				return 0;
		}

		total_size = sizeof(AVP_word) + psize;
	}
	else {
		AVP_word dummy = USHRT_MAX;
		if ( sizeof(AVP_word) == put_word(sz,&dummy) )
			total_size = sizeof(AVP_word);
		else
			total_size = 0;
	}

	return total_size;
}
开发者ID:hackshields,项目名称:antivirus,代码行数:32,代码来源:d_ser.c


示例6: exec

int exec(char *filename){
	// basically do the same initialization as kfork but with different path
	char name[128];
	int i, child;
	u16 segment = (running->pid +1) * 0x1000;
	// get the filename from umode
	for (i = 0; i < 128; i++) {
		name[i] = get_byte(segment, filename + i);
		if (name[i] == '\0')
			break;
	}
	// load the file
	load(name, segment);
	// clear registers except flag, uDS uES and uCS
	for (i = 1; i < 13; i++) {
		switch(i){
			case 1:		child = 0x0200;		break;
			case 2:
			case 11:
			case 12:	child = segment;	break;
			case 10:	put_word(0, segment, 0x1000-i*2); continue;
			default:	child = 0;			break;
		}
		put_word(child, segment, 0x1000-i*2);
	}
	// set uss to file position and set usp ustack top position
	running->uss = segment;
	running->usp = 0x1000-24;
	put_word(0, segment, running->usp + 8*2);
	return 1;
}
开发者ID:bhanderson,项目名称:cpts460,代码行数:31,代码来源:t.c


示例7: scroll

/*************************************************************************
 scroll(): scroll UP one line
**************************************************************************/
int scroll()
{
  int i;
  u16 w, bytes;  

  // test offset = org + ONE screen + ONE more line
  offset = org + SCR_BYTES + 2*LINE_WIDTH;
  if (offset <= vid_mask){   // offset still within vRAM area
    org += 2*LINE_WIDTH;     // just advance org by ONE line
  }
  else{  // offset exceeds vRAM area ==> reset to vRAM beginning by    
         // copy current rows 1-24 to BASE, then reset org to 0
    for (i=0; i<24*80; i++){
      w = get_word(base, org+160+2*i);
      put_word(w, base, 0+2*i);
    }  
    org = 0;
  }
  // org has been set up correctly
  offset = org + 2*24*80;   // offset = beginning of row 24

  // copy a line of BLANKs to row 24
  w = 0x0C00;  // HRGB=1100 ==> HighLight RED, Null char
  for (i=0; i<80; i++)                  
    put_word(w, base, offset + 2*i);
  set_VDC(VID_ORG, org >> 1);   // set VID_ORG to org     
}
开发者ID:vternal3,项目名称:OSkernal,代码行数:30,代码来源:vid.c


示例8: fpu_op_illg

static void fpu_op_illg (uae_u32 opcode, int pcoffset)
{
    if ((currprefs.cpu_model == 68060 && (currprefs.fpu_model == 0 || (regs.pcr & 2)))
	|| (currprefs.cpu_model == 68040 && currprefs.fpu_model == 0)) {
	/* 68040 unimplemented/68060 FPU disabled exception.
	 * Line F exception with different stack frame.. */
	uaecptr newpc = m68k_getpc ();
	uaecptr oldpc = newpc - pcoffset;
	MakeSR ();
	if (!regs.s) {
	    regs.usp = m68k_areg (regs, 7);
	    m68k_areg (regs, 7) = regs.isp;
	}
	regs.s = 1;
	m68k_areg (regs, 7) -= 4;
	put_long (m68k_areg (regs, 7), oldpc);
	m68k_areg (regs, 7) -= 4;
	put_long (m68k_areg (regs, 7), oldpc);
	m68k_areg (regs, 7) -= 2;
	put_word (m68k_areg (regs, 7), 0x4000 + 11 * 4);
	m68k_areg (regs, 7) -= 4;
	put_long (m68k_areg (regs, 7), newpc);
	m68k_areg (regs, 7) -= 2;
	put_word (m68k_areg (regs, 7), regs.sr);
	write_log ("68040/060 FPU disabled exception PC=%x\n", newpc);
	newpc = get_long (regs.vbr + 11 * 4);
	m68k_setpc (newpc);
	return;
    }
    op_illg (opcode);
}
开发者ID:bernds,项目名称:UAE,代码行数:31,代码来源:fpp.c


示例9: output_bin_data

static void output_bin_data( lan_blk_t *lbp )
{
    unsigned int offs = 4 * (lbp->nblk * 3 + 1);
    int i, j, k;

    put_dword( lbp->nblk );  /* NBlocks */
    for (i = 0; i < lbp->nblk; i++)
    {
        put_dword( lbp->blks[i].idlo );  /* Lo */
        put_dword( lbp->blks[i].idhi );  /* Hi */
        put_dword( offs );               /* Offs */
        offs += lbp->blks[i].size;
    }
    for (i = 0; i < lbp->nblk; i++)
    {
        block_t *blk = &lbp->blks[i];
        for (j = 0; j < blk->nmsg; j++)
        {
            int len = (2 * blk->msgs[j]->len + 3) & ~3;
            put_word( len + 4 );
            put_word( 1 );
            for (k = 0; k < blk->msgs[j]->len; k++) put_word( blk->msgs[j]->msg[k] );
            align_output( 4 );
        }
    }
}
开发者ID:AlexSteel,项目名称:wine,代码行数:26,代码来源:write.c


示例10: makeUimage

/********************************************************************
Copyright 2010-2015 K.C. Wang, <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
********************************************************************/
int makeUimage(char *filename, PROC *p)
{
   u16 i, segment;

  // make Umode image by loading /u1 into segment
  segment = (p->pid + 1)*0x1000;
  load(filename, segment);

  /***** Fill in U mode information in proc *****/
  /**************************************************
    We know segment=0x2000 + index*0x1000 ====>
    ustack is at the high end of this segment, say TOP.
    We must make ustak contain:
          1   2   3  4  5  6  7  8  9 10 11 12
       flag uCS uPC ax bx cx dx bp si di es ds
     0x0200 seg  0  0  0  0  0  0  0  0 seg seg
  
    So, first a loop to set all to 0, then
    put_word(seg, segment, -2*i); i=2,11,12;
   **************************************************/
 
   for (i=1; i<=12; i++){
       put_word(0, segment, -2*i);
   }

   put_word(0x0200,  segment, -2*1);   /* flag */  
   put_word(segment, segment, -2*2);   /* uCS */
   put_word(segment, segment, -2*11);  /* uES */
   put_word(segment, segment, -2*12);  /* uDS */

   /* initial USP relative to USS */
   p->usp = -2*12; 
   p->uss = segment;
   return 0;
}
开发者ID:tymicruz,项目名称:CuatroSeisZero,代码行数:50,代码来源:fe.c


示例11: target_write_block

/* tell the target to write a block of memory */
void target_write_block(unsigned addr, const char *buf,
			unsigned size, unsigned progress)
{
	assert(portfd >= 0);
	while (size > 0) {
		char checksum = 0;
		int step = min(size, SERIAL_BLOCKSIZE);
		
		put_char('W');
		put_word(addr);
		put_word(step);
		xawrite(portfd, buf, step);
		addr += step;
		size -= step;
		progress += step;
		while (step-- > 0) {
			checksum += *buf++;
		}
		if (checksum != (char)get_char()) {
			printf("\nSerial checksum error\n");
			exit(1);
		}
		printf("0x%08x\r", progress);
		fflush(NULL);
	}
}
开发者ID:korneliuszo,项目名称:shoehorn,代码行数:27,代码来源:serial.c


示例12: kexec

//execs a given file path
int kexec(int path)
{
        
    PROC *p;
    int  i, child,j;
    u16  segment;
    char file_path[32];
    
    p = running;
    /*** get a PROC for child process: ***/

    /* initialize the new proc and its stack */

    /******* write C code to to do THIS YOURSELF ********************
      Initialize p's kstack AS IF it had called tswitch() 
      from the entry address of body():

      HI   -1  -2    -3  -4   -5   -6   -7   -8    -9                LOW
      -------------------------------------------------------------
      |body| ax | bx | cx | dx | bp | si | di |flag|
      ------------------------------------------------------------
      ^
      PROC.ksp ---|

     ******************************************************************/
    for (j=1; j<10;j++)
        p->kstack[SSIZE-j];
    p->kstack[SSIZE-1]=(int)goUmode;
    p->ksp = &(p->kstack[SSIZE-9]);
    enqueue(&readyQueue, p);

    // make Umode image by loading the file designated
    segment = (p->pid + 1)*0x2000;    
    for (i = 0;i<32;i++)
    {
        file_path[i]=get_byte(running->uss,path+i);
        if (get_byte(running->uss,path+i)==0)
            break;
    }
    printf("\nloading %s\n",file_path);
    load(file_path,segment);



    //gotta fix that segment to make sure it doesnt reference wrong stuff
    p->uss = segment;
    p->usp = 0x2000 - 24;
    put_word(0x0200,segment,0x2000-2);
    put_word(segment,segment,0x2000-4);
    for (j=3;j<11;j++)
        put_word(0,segment,0x2000-2*j);
    put_word(segment,segment,0x2000-22);
    put_word(segment,segment,0x2000-24);


    return p->pid;


}
开发者ID:B-Rich,项目名称:CptS460,代码行数:60,代码来源:t.c


示例13: ufork

int ufork(){
	PROC *p;
	int  i, child;
	u16  segment;

	/*** get a PROC for child process: **/
	if ( (p = get_proc(&freeList)) == NULL){
		printf("no more proc\n");
		return(-1);
	}
	printf("ufork\n");
	/* set procs values to running and ready so we can use it */
	p->status = READY;
	p->next = NULL;
	p->ppid = running->pid;
	p->parent = running;
	p->priority = running->priority;

	/* zero out kstack registers*/
	for (i = 1; i < 10; i++) {
		p->kstack[SSIZE -i] = 0;
	}
	// set address to resume to
	p->kstack[SSIZE -1] =(int)goUmode;
	p->ksp = &(p->kstack[SSIZE-9]);

	// set segment to processes data position
	segment = (p->pid + 1)*0x1000;
	// copy the segment
	copy_image(segment);
	printf("loaded at %u\n", segment);
	// clean the registers and set flag and uCs and uDs to runnings values
	for (i = 1; i < 13; i++) {
		child = 0x1000 - i*2;
		switch(i){
			case 1: put_word(segment, segment, child); break;
			case 2: put_word(segment, segment, child); break;
			case 3:
			case 4:
			case 5:
			case 6:
			case 7:
			case 8:
			case 9:
			case 10: put_word(0,segment, child); break;
			case 11:
			case 12: put_word(segment, segment, child); break;
		}
	}
	// same as kfork
	p->uss = segment;
	p->usp = 0x1000 - 24;
	put_word(0, segment, p->usp + 8*2);

	printf("Proc%d forked a child %d segment=%x\n", running->pid,p->pid,segment);
	enqueue(&readyQueue, p);
	nproc++;
	return(p->pid);
}
开发者ID:bhanderson,项目名称:cpts460,代码行数:59,代码来源:t.c


示例14: ConvertMenu32To16

/**********************************************************************
 *	    ConvertMenu32To16   (KERNEL.616)
 */
VOID WINAPI ConvertMenu32To16( LPVOID menu32, DWORD size, LPVOID menu16 )
{
    WORD version, headersize, flags, level = 1;

    version = get_word( &menu32 );
    headersize = get_word( &menu32 );
    put_word( &menu16, version );
    put_word( &menu16, headersize );
    if ( headersize )
    {
        memcpy( menu16, menu32, headersize );
        menu16 = (BYTE *)menu16 + headersize;
        menu32 = (BYTE *)menu32 + headersize;
    }

    while ( level )
        if ( version == 0 )  /* standard */
        {
            flags = get_word( &menu32 );
            put_word( &menu16, flags );
            if ( !(flags & MF_POPUP) )
                put_word( &menu16, get_word( &menu32 ) );  /* ID */
            else
                level++;

            WideCharToMultiByte( CP_ACP, 0, (LPWSTR)menu32, -1, (LPSTR)menu16, 0x7fffffff, NULL, NULL );
            menu16 = (LPSTR)menu16 + strlen( (LPSTR)menu16 ) + 1;
            menu32 = (LPWSTR)menu32 + strlenW( (LPWSTR)menu32 ) + 1;

            if ( flags & MF_END )
                level--;
        }
        else  /* extended */
        {
            put_dword( &menu16, get_dword( &menu32 ) );  /* fType */
            put_dword( &menu16, get_dword( &menu32 ) );  /* fState */
            put_word( &menu16, get_dword( &menu32 ) );   /* ID */
            flags = get_word( &menu32 );
            put_byte(&menu16,flags);

            WideCharToMultiByte( CP_ACP, 0, (LPWSTR)menu32, -1, (LPSTR)menu16, 0x7fffffff, NULL, NULL );
            menu16 = (LPSTR)menu16 + strlen( (LPSTR)menu16 ) + 1;
            menu32 = (LPWSTR)menu32 + strlenW( (LPWSTR)menu32 ) + 1;

            /* align on DWORD boundary (32-bit only) */
            menu32 = (LPVOID)(((UINT_PTR)menu32 + 3) & ~3);

            /* If popup, transfer helpid */
            if ( flags & 1)
            {
                put_dword( &menu16, get_dword( &menu32 ) );
                level++;
            }

            if ( flags & MF_END )
                level--;
        }
}
开发者ID:howard5888,项目名称:wineT,代码行数:61,代码来源:resource16.c


示例15: prot_login_send_info

void prot_login_send_info( struct qqclient* qq )
{
    static uchar unknown5[] = {0x00,0x00,0x00,0x00,0x00,0x00,0x00,
                               0x00,0x00,0x00
                              };
    static uchar unknown6[] = {0xE9,0xC4,0xD6,0x5C,0x4D,0x9D,
                               0xA0,0x17,0xE5,0x24,0x6B,0x55,0x57,0xD3,0xAB,0xF1
                              };
    static uchar unknown7[] = {0xCB,0x8D,0xA4,0xE2,0x61,0xC2,
                               0xDD,0x27,0x39,0xEC,0x8A,0xCA,0xA6,0x98,0xF8,0x9B
                              };

    qqpacket* p = packetmgr_new_send( qq, QQ_CMD_LOGIN_SEND_INFO );
    if( !p ) return;
    bytebuffer *buf = p->buf;
    //prepare sth.
    randkey( unknown6 );
    randkey( unknown7 );

    put_word( buf, 0x0001 );
    put_data( buf, qq->data.version_spec, sizeof(qq->data.version_spec) );
    put_int( buf, qq->data.login_info_unknown2 );
    put_int( buf, qq->server_time );
    put_int( buf, qq->client_ip );
    put_int( buf, 00000000 );
    put_word( buf, qq->data.login_info_large.len );
    put_data( buf, qq->data.login_info_large.data, qq->data.login_info_large.len );
    buf->pos += 35;
    put_data( buf, qq->data.exe_hash, sizeof(qq->data.exe_hash) );
    put_byte( buf, rand2() );	//unknown important byte
    put_byte( buf, qq->mode );
    put_data( buf, unknown5, sizeof(unknown5) );
    put_data( buf, qq->data.server_data, sizeof(qq->data.server_data) );
    put_data( buf, qq->data.locale, sizeof(qq->data.locale) );
    buf->pos += 16; //16 zeros
    put_word( buf, qq->data.token_c.len );
    put_data( buf, qq->data.token_c.data, qq->data.token_c.len );
    put_int( buf, 0x00000007 );
    put_int( buf, 0x00000000 );
    put_int( buf, 0x08041801 );
    put_byte( buf, 0x40 );	//length of the following
    put_byte( buf, 0x01 );
    put_int( buf, rand2()  );
//	put_int( buf, 0x0741E9748  );
    put_word( buf, sizeof(unknown6) );
    put_data( buf, unknown6, sizeof(unknown6) );
    put_data( buf, unknown5, sizeof(unknown5) );
    put_data( buf, qq->data.server_data, sizeof(qq->data.server_data) );
    put_byte( buf, 0x02 );
    put_int( buf, rand2()  );
//	put_int( buf, 0x8BED382E  );
    put_word( buf, sizeof(unknown7) );
    put_data( buf, unknown7, sizeof(unknown7) );
    buf->pos += 249;	//all zeros
    memcpy( p->key, qq->data.login_info_key1, sizeof(qq->data.login_info_key1) );
    post_packet( qq, p, RANDOM_KEY );
}
开发者ID:luobailiang,项目名称:c,代码行数:57,代码来源:prot_login.c


示例16: __attribute__

static __attribute__((always_inline)) void patch_CXNCAS_4_2_0_532_extra(void) {
    #if NDLESS
    write_ndless3x_loader(0, 4);
    #else
    put_word(0x100C5F24, 0xE12FFF1E);
    #endif
    put_byte(0x1008DB8B, 0xEA);
    put_word(0x1014E008, 0xE12FFF1E);
}
开发者ID:Excale,项目名称:nLaunchy,代码行数:9,代码来源:patch_other.c


示例17: output_bin_res_dir

/* output a resource directory in binary format */
static inline void output_bin_res_dir( unsigned int nb_names, unsigned int nb_ids )
{
    put_dword( 0 );        /* Characteristics */
    put_dword( 0 );        /* TimeDateStamp */
    put_word( 0 );         /* MajorVersion */
    put_word( 0 );         /* MinorVersion */
    put_word( nb_names );  /* NumberOfNamedEntries */
    put_word( nb_ids );    /* NumberOfIdEntries */
}
开发者ID:bilboed,项目名称:wine,代码行数:10,代码来源:res32.c


示例18: set_vector

int set_vector(u16 vector, u16 addr)
{
     // put_word(word, segment, offset)
     /*put_word(handler, 0, vector*4); // set PC = _int80h
     put_word(0x1000,  0,(vector*4) + 2); // set CS = 0x1000*/
     u16 location,cs;
     location = vector << 2;
     put_word(addr, 0, location);
     put_word(0x1000,0,location+2);
}
开发者ID:jakeknott,项目名称:cs460,代码行数:10,代码来源:t.c


示例19: fork

int fork()
{
	PROC *p;  int i, child, pid;  u16 segment;

	pid = kfork(0);   // kfork() but do NOT load any Umode image for child
	if (pid < 0){     // kfork failed
		return -1;
	}
	p = &proc[pid];   // we can do this because of static pid

	for (i=0; i<NFD; i++){
		p->fd[i] = running->fd[i];

		if (p->fd[i] != 0){
			p->fd[i]->refCount++;

			if (p->fd[i]->mode == READ_PIPE)
				p->fd[i]->pipe_ptr->nreader++;

			if (p->fd[i]->mode == WRITE_PIPE){
				p->fd[i]->pipe_ptr->nwriter++;
			}
		}
	}

	segment = (pid+1)*0x2000;
	copyImage(running->uss, segment, 32*1024);
	p->uss = segment;
	p->usp = 0x2000 - 24;

	// YOUR CODE to make the child runnable in User mode
	p->kstack[SSIZE -1] =(int)goUmode;
	/**** ADD these : copy file descriptors ****/

	// clean the registers and set flag and uCs and uDs to runnings values
	for (i = 1; i < 13; i++) {
		child = 0x2000 - i*2;
		switch(i){
			case 1: put_word(segment, segment, child); break;
			case 2: put_word(segment, segment, child); break;
			case 3:
			case 4:
			case 5:
			case 6:
			case 7:
			case 8:
			case 9:
			case 10: put_word(0,segment, child); break;
			case 11:
			case 12: put_word(segment, segment, child); break;
		}
	}

	return(p->pid);
}
开发者ID:bhanderson,项目名称:cpts460,代码行数:55,代码来源:forkexec.c


示例20: emit_header

LOCAL void
emit_header (gif_dest_ptr dinfo, int num_colors, JSAMPARRAY colormap)
/* Output the GIF file header, including color map */
/* If colormap==NULL, synthesize a gray-scale colormap */
{
  int BitsPerPixel, ColorMapSize, InitCodeSize, FlagByte;
  int cshift = dinfo->cinfo->data_precision - 8;
  int i;

  if (num_colors > 256)
    ERREXIT1(dinfo->cinfo, JERR_TOO_MANY_COLORS, num_colors);
  /* Compute bits/pixel and related values */
  BitsPerPixel = 1;
  while (num_colors > (1 << BitsPerPixel))
    BitsPerPixel++;
  ColorMapSize = 1 << BitsPerPixel;
  if (BitsPerPixel <= 1)
    InitCodeSize = 2;
  else
    InitCodeSize = BitsPerPixel;
  /*
   * Write the GIF header.
   * Note that we generate a plain GIF87 header for maximum compatibility.
   */
  putc('G', dinfo->pub.output_file);
  putc('I', dinfo->pub.output_file);
  putc('F', dinfo->pub.output_file);
  putc('8', dinfo->pub.output_file);
  putc('7', dinfo->pub.output_file);
  putc('a', dinfo->pub.output_file);
  /* Write the Logical Screen Descriptor */
  put_word(dinfo, (unsigned int) dinfo->cinfo->output_width);
  put_word(dinfo, (unsigned int) dinfo->cinfo->output_height);
  FlagByte = 0x80;		/* Yes, there is a global color table */
  FlagByte |= (BitsPerPixel-1) << 4; /* color resolution */
  FlagByte |= (BitsPerPixel-1);	/* size of global color table */
  putc(FlagByte, dinfo->pub.output_file);
  putc(0, dinfo->pub.output_file); /* Background color index */
  putc(0, dinfo->pub.output_file); /* Reserved (aspect ratio in GIF89) */
  /* Write the Global Color Map */
  /* If the color map is more than 8 bits precision, */
  /* we reduce it to 8 bits by shifting */
  for (i=0; i < ColorMapSize; i++) {
    if (i < num_colors) {
      if (colormap != NULL) {
	if (dinfo->cinfo->out_color_space == JCS_RGB) {
	  /* Normal case: RGB color map */
	  putc(GETJSAMPLE(colormap[0][i]) >> cshift, dinfo->pub.output_file);
	  putc(GETJSAMPLE(colormap[1][i]) >> cshift, dinfo->pub.output_file);
	  putc(GETJSAMPLE(colormap[2][i]) >> cshift, dinfo->pub.output_file);
	} else {
	  /* Grayscale "color map": possible if quantizing grayscale image */
	  put_3bytes(dinfo, GETJSAMPLE(colormap[0][i]) >> cshift);
	}
      } else {
开发者ID:F5000,项目名称:spree,代码行数:55,代码来源:wrgif.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ putback函数代码示例发布时间:2022-05-30
下一篇:
C++ put_user函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap