示例#1
0
文件: buffer.cpp 项目: BertiniM2/M2
void buffer::put(int n)
{
  char s[100];
  sprintf(s, "%d", n);
  put(s, strlen(s));
}
示例#2
0
void
print(struct termios *tp, struct winsize *wp, int ldisc, enum FMT fmt)
{
	struct cchar *p;
	long tmp;
	u_char *cc;
	int cnt, ispeed, ospeed;
	char buf1[100], buf2[100];

	cnt = 0;

	/* Line discipline. */
	if (ldisc != TTYDISC) {
		switch(ldisc) {
		case SLIPDISC:
			cnt += printf("slip disc; ");
			break;
		case PPPDISC:
			cnt += printf("ppp disc; ");
			break;
		default:
			cnt += printf("#%d disc; ", ldisc);
			break;
		}
	}

	/* Line speed. */
	ispeed = cfgetispeed(tp);
	ospeed = cfgetospeed(tp);
	if (ispeed != ospeed)
		cnt +=
		    printf("ispeed %d baud; ospeed %d baud;", ispeed, ospeed);
	else
		cnt += printf("speed %d baud;", ispeed);
	if (fmt >= BSD)
		cnt += printf(" %d rows; %d columns;", wp->ws_row, wp->ws_col);
	if (cnt)
		(void)printf("\n");

#define	on(f)	((tmp & (f)) != 0)
#define put(n, f, d) \
	if (fmt >= BSD || on(f) != (d)) \
		bput((n) + on(f));

	/* "local" flags */
	tmp = tp->c_lflag;
	binit("lflags");
	put("-icanon", ICANON, 1);
	put("-isig", ISIG, 1);
	put("-iexten", IEXTEN, 1);
	put("-echo", ECHO, 1);
	put("-echoe", ECHOE, 0);
	put("-echok", ECHOK, 0);
	put("-echoke", ECHOKE, 0);
	put("-echonl", ECHONL, 0);
	put("-echoctl", ECHOCTL, 0);
	put("-echoprt", ECHOPRT, 0);
	put("-altwerase", ALTWERASE, 0);
	put("-noflsh", NOFLSH, 0);
	put("-tostop", TOSTOP, 0);
	put("-flusho", FLUSHO, 0);
	put("-pendin", PENDIN, 0);
	put("-nokerninfo", NOKERNINFO, 0);
	put("-extproc", EXTPROC, 0);

	/* input flags */
	tmp = tp->c_iflag;
	binit("iflags");
	put("-istrip", ISTRIP, 0);
	put("-icrnl", ICRNL, 1);
	put("-inlcr", INLCR, 0);
	put("-igncr", IGNCR, 0);
	put("-ixon", IXON, 1);
	put("-ixoff", IXOFF, 0);
	put("-ixany", IXANY, 1);
	put("-imaxbel", IMAXBEL, 1);
	put("-ignbrk", IGNBRK, 0);
	put("-brkint", BRKINT, 1);
	put("-inpck", INPCK, 0);
	put("-ignpar", IGNPAR, 0);
	put("-parmrk", PARMRK, 0);

	/* output flags */
	tmp = tp->c_oflag;
	binit("oflags");
	put("-opost", OPOST, 1);
	put("-onlcr", ONLCR, 1);
	put("-ocrnl", OCRNL, 0);
	switch(tmp&TABDLY) {
	case TAB0:
		bput("tab0");
		break;
	case TAB3:
		bput("tab3");
		break;
	}
	put("-onocr", ONOCR, 0);
	put("-onlret", ONLRET, 0);

	/* control flags (hardware state) */
	tmp = tp->c_cflag;
	binit("cflags");
	put("-cread", CREAD, 1);
	switch(tmp&CSIZE) {
	case CS5:
		bput("cs5");
		break;
	case CS6:
		bput("cs6");
		break;
	case CS7:
		bput("cs7");
		break;
	case CS8:
		bput("cs8");
		break;
	}
	bput("-parenb" + on(PARENB));
	put("-parodd", PARODD, 0);
	put("-hupcl", HUPCL, 1);
	put("-clocal", CLOCAL, 0);
	put("-cstopb", CSTOPB, 0);
	switch(tmp & (CCTS_OFLOW | CRTS_IFLOW)) {
	case CCTS_OFLOW:
		bput("ctsflow");
		break;
	case CRTS_IFLOW:
		bput("rtsflow");
		break;
	default:
		put("-crtscts", CCTS_OFLOW | CRTS_IFLOW, 0);
		break;
	}
	put("-dsrflow", CDSR_OFLOW, 0);
	put("-dtrflow", CDTR_IFLOW, 0);
	put("-mdmbuf", MDMBUF, 0);	/* XXX mdmbuf ==  dtrflow */

	/* special control characters */
	cc = tp->c_cc;
	if (fmt == POSIX) {
		binit("cchars");
		for (p = cchars1; p->name; ++p) {
			(void)snprintf(buf1, sizeof(buf1), "%s = %s;",
			    p->name, ccval(p, cc[p->sub]));
			bput(buf1);
		}
		binit(NULL);
	} else {
		binit(NULL);
		for (p = cchars1, cnt = 0; p->name; ++p) {
			if (fmt != BSD && cc[p->sub] == p->def)
				continue;
#define	WD	"%-8s"
			(void)snprintf(buf1 + cnt * 8, sizeof(buf1) - cnt * 8,
			    WD, p->name);
			(void)snprintf(buf2 + cnt * 8, sizeof(buf2) - cnt * 8,
			    WD, ccval(p, cc[p->sub]));
			if (++cnt == LINELENGTH / 8) {
				cnt = 0;
				(void)printf("%s\n", buf1);
				(void)printf("%s\n", buf2);
			}
		}
		if (cnt) {
			(void)printf("%s\n", buf1);
			(void)printf("%s\n", buf2);
		}
	}
}
示例#3
0
void NCASink::put(const GroebnerRule& x) {
  put(x.LHS());
  d_ofs << " -> ";
  put(x.RHS());
};
示例#4
0
 /**
  * Perform a PUT request.
  *
  * @param[in] request The request including the URI and headers.
  * @param[in] callback If provided, the function to call for parts of the
  *   response's body as they come in.
  * @param[in] body_generator The function to call to generate part of the body
  *   while the request is being performed.
  * @returns A response object.
  * @throws std::exception May throw exceptions derived from std::exception in
  *   case of errors.
  */
 response put(request const& request, body_callback_function_type callback,
              body_generator_function_type body_generator =
                  body_generator_function_type()) {
   return put(request, string_type(), string_type(), callback, body_generator);
 }
示例#5
0
void* handle_req(void* p)
{
    conn_t * pConn = (conn_t*)p;
    // Network state
	// FIXME cuda_bridge_request_t == cuda_packet_t == rpkt_t, this is rediculous
	strm_hdr_t *hdr         = NULL;
	rpkt_t *rpkts           = NULL; // array of cuda packets

        
        // CLOSE the listen connection
        //    conn_close(pConnListen);
        
        // Connection-related structures
        hdr = &pConn->strm.hdr;
        rpkts = pConn->strm.rpkts;   // an array of packets (MAX_REMOTE_BATCH_SIZE)
        // these are buffers for extra data transferred as
        pConn->pReqBuffer = NULL;
        pConn->pRspBuffer = NULL;
        
        while(1) {
            
            p_debug("------------------New RPC--------------------\n");
            
            memset(hdr, 0, sizeof(strm_hdr_t));
            memset(rpkts, 0, MAX_REMOTE_BATCH_SIZE * sizeof(rpkt_t));
            pConn->request_data_size = 0;
            pConn->response_data_size = 0;
            
            pConn->pReqBuffer = freeBuffer(pConn->pReqBuffer);
            pConn->pRspBuffer = freeBuffer(pConn->pRspBuffer);
            
            //recv the header describing the batch of remote requests
            if (1 != get(pConn, hdr, sizeof(strm_hdr_t))) {
                break;
            }
            p_debug(" received request header. Expecting  %d packets. And extra request buffer of data size %d\n",
                    hdr->num_cuda_pkts, hdr->data_size);
            
            if (hdr->num_cuda_pkts <= 0) {
                p_warn("Received header specifying zero packets, ignoring\n");
                continue;
            }
            
            // Receive the entire batch.
            // first the packets, then the extra data (reqbuf)
            //
            // let's assume that we have enough space. otherwise we have a problem
            // pConn allocates the buffers for incoming cuda packets
            // so we should be fine
            if(1 != get(pConn, rpkts, hdr->num_cuda_pkts * sizeof(rpkt_t))) {
                break;
            }
            p_info("Received %d packets, each of size of (%lu) bytes\n",
                   hdr->num_cuda_pkts, sizeof(rpkt_t));
            
            p_info( "Received method %s (method_id %d) from Thr_id: %lu.\n",
                   methodIdToString(rpkts[0].method_id), rpkts[0].method_id, rpkts[0].thr_id);
            
            // receiving the request buffer if any
            if(hdr->data_size > 0){
                p_info("Expecting data size/Buffer: %u, %d.\n",
                       hdr->data_size, pConn->request_data_size);
                // let's assume that the expected amount of data will fit into
                // the buffer we have (size of pConn->request_data_buffer
                
                // allocate the right amount of memory for the request buffer
                pConn->pReqBuffer = malloc(hdr->data_size);
                if( mallocCheck(pConn->pReqBuffer, __FUNCTION__, NULL) == ERROR ){
                    break;
                }
                
                //assert(hdr->data_size <= TOTAL_XFER_MAX);
                if(1 != get(pConn, pConn->pReqBuffer, hdr->data_size)){
                    pConn->pReqBuffer = freeBuffer(pConn->pReqBuffer);
                    break;
                }
                pConn->request_data_size = hdr->data_size;
                p_info( "Received request buffer (%d bytes)\n", pConn->request_data_size);
            }
            
            // execute the request
            pkt_execute(&rpkts[0], pConn);
            
            // we need to send the one response packet + response_buffer if any
            
            // @todo you need to check if he method needs to send
            // and extended response - you need to provide the right
            // data_size
            
            if( strm_expects_response(&pConn->strm) ){
                
                // send the header about response
                p_debug( "pConn->response_data_size %d\n", pConn->response_data_size);
                if (conn_sendCudaPktHdr(&*pConn, 1, pConn->response_data_size) == ERROR) {
                    p_info( "__ERROR__ after : Sending the CUDA packet response header: Quitting ... \n");
                    break;
                }
                
                // send the standard response (with cuda_error_t, and simple arguments etc)
                if (1 != put(pConn, rpkts, sizeof(rpkt_t))) {
                    p_info("__ERROR__ after : Sending CUDA response packet: Quitting ... \n");
                    break;
                }
                p_info("Response packet sent.\n");
                
                // send the extra data if you have anything to send
                if( pConn->response_data_size > 0 ){
                    if (1 != put(pConn, pConn->pRspBuffer, pConn->response_data_size)) {
                        p_info("__ERROR__ after: Sending accompanying response buffer: Quitting ... \n"
                               );
                        break;
                    }
                    p_info( "Response buffer sent (%d) bytes.\n", pConn->response_data_size);
                }
            }
        }//while(1)
        
        freeBuffer(pConn->pReqBuffer);
        freeBuffer(pConn->pRspBuffer);
        //conn_close(pConnListen);
        conn_close(pConn);
        
        //free(pConnListen);
        free(pConn);
        
        return NULL;
        
    
}
示例#6
0
void ConfigParam::configTraceList(string s) {
	put(CONFIG_PARAM_TRACE_LIST, s);
}
示例#7
0
void ConfigParam::configMeasumentTask(string s){
	put(CONFIG_PARAM_MEASUREMENT, s);
}
示例#8
0
int main(int argc,char *argv[])
{
	
	int sk;
	int err;
	unsigned char *buff = NULL;
	unsigned short port = PORT;
	unsigned char bufftail[256];
        char str[20];

	struct sockaddr_in addr;
	char cmd[2][256];
	
	
	strcpy(str,ADDR);

	if (argc == 1)
	{
	  printf("you use default server IP:192.167.3.77 and PORT:3757\n");
	}
	else if (argc == 2 || argc == 3)
	{
	    port = (unsigned short )atoi(argv[1]);
	}


	if (argc == 3)
	{
		strcpy(str,argv[2]);
	}
	
	sk = socket(AF_INET,SOCK_STREAM,0);
	assert (sk != -1);
	

	signal(SIGINT,sighandler);                  // ctrl+c   show all online client
	signal(SIGQUIT,sighandler);                 // ctrl+\   quit app

	addr.sin_family = AF_INET;
	addr.sin_port = htons(port);
	addr.sin_addr.s_addr = inet_addr(str);

	err = connect(sk,(struct sockaddr *)&addr,sizeof(struct sockaddr));
	if ( err == -1)
	{
		printf("connect server fail\n");
		return -1;	
	}
	else 
	{
		printf("connect server succeed\n");	
	}
	
	printf("***connected server %s port: %u***\n",str,port);

	buff = (unsigned char *)malloc(MEMSIZE);           //分配一个堆区域,用于socket通信存储信息
	assert (buff != NULL);
	
	printf("Whether the anonymous login(yes or no):");  //是否匿名登录
	memset(buff,0,sizeof(char)*MEMSIZE);
	scanf("%s",buff);
	
	if (strcmp(buff,"yes"))    //如果不匿名登录,则执行下列语句
		{
			  send(sk,"no_anonymous",strlen("no_anonymous"),0);  //告诉客户端不匿名登录
				for (err=0; err<3; err++)   // 客户端有三次登录验证的机会
				{
					if (!login(sk,buff))	
					break;
					printf("\nlogin incorrect\n\n");
				}
	
				if ( 3 == err)
			 {
				printf("more than 3 times,client exit\n");
				return -1;
			 }	
		}
	else 
	{
		send(sk,"anonymous",strlen("anonymous"),0);  //匿名登录	
		if (!strcmp(buff,"no"))
		{
			printf("you don't say no,but i think the word is no\n");
			printf("you will anonymous login,some command will can't execute\n");
		}
	}
		sigsk = sk;
	while (1)
	{
		memset(buff,0,MEMSIZE);
		printf("FTP>");
		scanf("%s",cmd);
		strcpy(buff,cmd[0]);
		strcpy(bufftail,cmd[1]);
		switch(buff[0])
		{
			case 'l':
				{
					ls(buff,sk);
				}
				break;

			case 'h':
				{
					help(buff);
				}
				break;
			case 'p':
				{
					put(buff,sk,bufftail);
				}
				break;
			case 'g':
				{
					get(buff,sk,bufftail);
				}
				break;
			case 'q':
				{
					if ( !quit(buff,sk) )
					goto END;
				}
				break;
			case 'e':
				{
					if ( !quit(buff,sk) )
					goto END;
				}
				break;
			case 'c':
				{
					clear(buff);
				}
				break;
			default :
				{
					printf("***Invalid command***\n");
				}
				break;
		}
	}
	END:
	return 0;
}
示例#9
0
 int put(const char *str, int count=1) {
   return put((AzByte *)str, Az64::cstrlen(str), count);     
 }
示例#10
0
文件: buffer.cpp 项目: BertiniM2/M2
void buffer::put(unsigned long long n)
{
  char s[100];
  sprintf(s, "%llu", n);
  put(s, strlen(s));
}
示例#11
0
文件: buffer.cpp 项目: BertiniM2/M2
void buffer::put(unsigned long n, int width)
{
  char s[100];
  sprintf(s, "%*lu", width, n);
  put(s, strlen(s));
}
示例#12
0
文件: buffer.cpp 项目: BertiniM2/M2
void buffer::put(unsigned int n)
{
  char s[100];
  sprintf(s, "%u", n);
  put(s, strlen(s));
}
示例#13
0
文件: buffer.cpp 项目: BertiniM2/M2
void buffer::put(long n)
{
  char s[100];
  sprintf(s, "%ld", n);
  put(s, strlen(s));
}
示例#14
0
文件: buffer.cpp 项目: BertiniM2/M2
void buffer::put(int n, int width)
{
  char s[100];
  sprintf(s, "%*d", width, n);
  put(s, strlen(s));
}
示例#15
0
void put(int ith){
	if (ith == n*n){
		max = (max > count ? max : count);
		return ;
	}

	int i, j;
	for (i = ith; i < n*n; ++i){
		int r = i / n ;
		int c = i % n ;
		if (board[r][c] == -1){
			board[r][c] = i;
			count++;
			// mark
			// up
		
			for (j = r-1; j >= 0; j--){
			
				if(board[j][c] == -2)
					break;
				else if (board[j][c] == -1)
					board[j][c] = i;
			}
			// down
			for (j = r + 1; j < n; ++j){
				if(board[j][c] == -2)
					break;
				else if (board[j][c] == -1)
					board[j][c] = i;
			}

			// left
			for (j = c-1; j >= 0; j--){
				if (board[r][j] == -2)
					break;
				else if (board[r][j] == -1)
					board[r][j] = i;
			}

			// right
			for (j = c + 1; j < n; ++j){
				if (board[r][j] == -2)
					break;
				else if (board[r][j] == -1)
					board[r][j] = i;
			}

			put(i + 1);
			count--;

			board[r][c] = -1;
			// up
			for (j = r-1; j >= 0; j--){
				if(board[j][c] == -2)
					break;
				else if (board[j][c] == i)
					board[j][c] = -1;
			}
			// down
			for (j = r + 1; j < n; ++j){
				if(board[j][c] == -2)
					break;
				else if (board[j][c] == i)
					board[j][c] = -1;
			}

			// left
			for (j = c-1; j >= 0; j--){
				if (board[r][j] == -2)
					break;
				else if (board[r][j] == i)
					board[r][j] = -1;
			}

			// right
			for (j = c + 1; j < n; ++j){
				if (board[r][j] == -2)
					break;
				else if (board[r][j] == i)
					board[r][j] = -1;
			}

		} else {
			put(i + 1);
		}
	}
}
示例#16
0
 int put(const AzBytArr *byteq, int count=1) {
   return put(byteq->point(), byteq->getLen(), count); 
 }
示例#17
0
void ConfigParam::configContextType(string s) {
	put(CONFIG_PARAM_CONTEXT, s);
}
示例#18
0
 inline int putv(const AzBytArr *bq, int value) {
   int count = 1; 
   return put(bq->point(), bq->getLen(), count, value); 
 }        
示例#19
0
void ConfigParam::configTraceType(string s) {
	put(CONFIG_PARAM_TRACE, s);
}
示例#20
0
 inline int putv(const char *str, int value) {
   int count = 1; 
   return put((AzByte *)str, Az64::cstrlen(str), count, value); 
 }  
示例#21
0
int ByteBuffer::putInt(int in){
    byte *pointer = (byte *)&in;
	put(pointer[1]);
	put(pointer[0]);
	return in;
}
示例#22
0
void letter(char l)
{
	//int i;
	switch (l)
	{
	case 'A':
		put(0);
		break;
	case 'B':
		put(5);
		break;
	case 'C':
		put(10);
		break;
	case 'D':
		put(15);
		break;
	case 'E':
		put(20);
		break;
	case 'F':
		put(25);
		break;
	case 'G':
		put(30);
		break;
	case 'H':
		put(35);
		break;
	case 'I':
		put(40);
		break;
	case 'J':
		put(45);
		break;
	case 'K':
		put(50);
		break;
	case 'L':
		put(55);
		break;
	case 'M':
		put(60);
		break;
	case 'N':
		put(65);
		break;
	case 'O':
		put(70);
		break;
	case 'P':
		put(75);
		break;
	case 'Q':
		put(80);
		break;
	case 'R':
		put(85);
		break;
	case 'S':
		put(90);
		break;
	case 'T':
		put(95);
		break;
	case 'U':
		put(100);
		break;
	case 'V':
		put(105);
		break;
	case 'W':
		put(110);
		break;
	case 'X':
		put(115);
		break;
	case 'Y':
		put(120);
		break;
	case 'Z':
		put(125);
		break;
	case ' ':
		put(130);
		break;
	case '0':
		put(135);
		break;
	case '1':
		put(140);
		break;
	case '2':
		put(145);
		break;
	case '3':
		put(150);
		break;
	case '4':
		put(155);
		break;
	case '5':
		put(160);
		break;
	case '6':
		put(165);
		break;
	case '7':
		put(170);
		break;
	case '8':
		put(175);
		break;
	case '9':
		put(180);
		break;
	case ',':
		put(185);
		break;
	case ':':
		put(190);
		break;
	case '\'':
		put(195);
		break;
	case '-':
		put(200);
		break;
	case '.':
		put(205);
		break;
	}
}
示例#23
0
 /**
  * Perform a POST request.
  *
  * @param[in] request The request object including the URI and headers.
  * @param[in] body The whole contents of the body.
  * @param[in] body_handler The callback invoked for parts of the response body
  *   as they come in.
  * @param[in] body_generator If provided, is invoked to generate parts of the
  *   request's body as it is being sent.
  * @returns A response object.
  * @throws std::exception May throw exceptions on errors, derived from
  *   `std::exception`.
  */
 response put(request const& request, string_type body,
              body_callback_function_type body_handler,
              body_generator_function_type body_generator = {}) {
   return put(request, body, string_type(), body_handler, body_generator);
 }
示例#24
0
void TiObject::put(TiExcState* exec, unsigned propertyName, TiValue value)
{
    PutPropertySlot slot;
    put(exec, Identifier::from(exec, propertyName), value, slot);
}
示例#25
0
int main(int argc, char** argv)
{
    put(argv[1], argv[2]);
    return 0;
}
示例#26
0
bool TiObject::defineOwnProperty(TiExcState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor, bool throwException)
{
    // If we have a new property we can just put it on normally
    PropertyDescriptor current;
    if (!getOwnPropertyDescriptor(exec, propertyName, current))
        return putDescriptor(exec, this, propertyName, descriptor, descriptor.attributes(), jsUndefined());

    if (descriptor.isEmpty())
        return true;

    if (current.equalTo(descriptor))
        return true;

    // Filter out invalid changes
    if (!current.configurable()) {
        if (descriptor.configurable()) {
            if (throwException)
                throwError(exec, TypeError, "Attempting to configurable attribute of unconfigurable property.");
            return false;
        }
        if (descriptor.enumerablePresent() && descriptor.enumerable() != current.enumerable()) {
            if (throwException)
                throwError(exec, TypeError, "Attempting to change enumerable attribute of unconfigurable property.");
            return false;
        }
    }

    // A generic descriptor is simply changing the attributes of an existing property
    if (descriptor.isGenericDescriptor()) {
        if (!current.attributesEqual(descriptor)) {
            deleteProperty(exec, propertyName);
            putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value());
        }
        return true;
    }

    // Changing between a normal property or an accessor property
    if (descriptor.isDataDescriptor() != current.isDataDescriptor()) {
        if (!current.configurable()) {
            if (throwException)
                throwError(exec, TypeError, "Attempting to change access mechanism for an unconfigurable property.");
            return false;
        }
        deleteProperty(exec, propertyName);
        return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value() ? current.value() : jsUndefined());
    }

    // Changing the value and attributes of an existing property
    if (descriptor.isDataDescriptor()) {
        if (!current.configurable()) {
            if (!current.writable() && descriptor.writable()) {
                if (throwException)
                    throwError(exec, TypeError, "Attempting to change writable attribute of unconfigurable property.");
                return false;
            }
            if (!current.writable()) {
                if (descriptor.value() || !TiValue::strictEqual(current.value(), descriptor.value())) {
                    if (throwException)
                        throwError(exec, TypeError, "Attempting to change value of a readonly property.");
                    return false;
                }
            }
        } else if (current.attributesEqual(descriptor)) {
            if (!descriptor.value())
                return true;
            PutPropertySlot slot;
            put(exec, propertyName, descriptor.value(), slot);
            if (exec->hadException())
                return false;
            return true;
        }
        deleteProperty(exec, propertyName);
        return putDescriptor(exec, this, propertyName, descriptor, current.attributesWithOverride(descriptor), current.value());
    }

    // Changing the accessor functions of an existing accessor property
    ASSERT(descriptor.isAccessorDescriptor());
    if (!current.configurable()) {
        if (descriptor.setterPresent() && !(current.setter() && TiValue::strictEqual(current.setter(), descriptor.setter()))) {
            if (throwException)
                throwError(exec, TypeError, "Attempting to change the setter of an unconfigurable property.");
            return false;
        }
        if (descriptor.getterPresent() && !(current.getter() && TiValue::strictEqual(current.getter(), descriptor.getter()))) {
            if (throwException)
                throwError(exec, TypeError, "Attempting to change the getter of an unconfigurable property.");
            return false;
        }
    }
    TiValue accessor = getDirect(propertyName);
    if (!accessor)
        return false;
    GetterSetter* getterSetter = asGetterSetter(accessor);
    if (current.attributesEqual(descriptor)) {
        if (descriptor.setter())
            getterSetter->setSetter(asObject(descriptor.setter()));
        if (descriptor.getter())
            getterSetter->setGetter(asObject(descriptor.getter()));
        return true;
    }
    deleteProperty(exec, propertyName);
    unsigned attrs = current.attributesWithOverride(descriptor);
    if (descriptor.setter())
        attrs |= Setter;
    if (descriptor.getter())
        attrs |= Getter;
    putDirect(propertyName, getterSetter, attrs);
    return true;
}
示例#27
0
int
main(void)
{
init();
#if 0
put(24, 24);
put(72, 72);
put(1, 1);
put(39, 39);
put(53, 53);
put(63, 63);
put(90, 90);
put(88, 88);
put(15, 15);
put(10, 10);
put(44, 44);
put(68, 68);
put(74, 74);
bplus_tree_dump(bplus_tree);
#endif
#if 0
put(10, 10);
put(15, 15);
put(18, 18);
put(22, 22);
put(27, 27);
put(34, 34);
put(40, 40);
put(44, 44);
put(47, 47);
put(54, 54);
put(67, 67);
put(72, 72);
put(74, 74);
put(78, 78);
put(81, 81);
put(84, 84);
bplus_tree_dump(bplus_tree);
#endif
#if 0
printf("key:24 data:%d\n", get(24));
printf("key:72 data:%d\n", get(72));
printf("key:01 data:%d\n", get(1));
printf("key:39 data:%d\n", get(39));
printf("key:53 data:%d\n", get(53));
printf("key:63 data:%d\n", get(63));
printf("key:90 data:%d\n", get(90));
printf("key:88 data:%d\n", get(88));
printf("key:15 data:%d\n", get(15));
printf("key:10 data:%d\n", get(10));
printf("key:44 data:%d\n", get(44));
printf("key:68 data:%d\n", get(68));
printf("key:74 data:%d\n", get(74));
printf("key:44 data:%d\n", get(44));
printf("key:45 data:%d\n", get(45));
printf("key:46 data:%d\n", get(46));
printf("key:47 data:%d\n", get(47));
printf("key:48 data:%d\n", get(48));
#endif
#if 0
put(90, 0);
bplus_tree_dump(bplus_tree);
put(88, 0);
bplus_tree_dump(bplus_tree);
put(74, 0);
bplus_tree_dump(bplus_tree);
put(72, 0);
bplus_tree_dump(bplus_tree);
put(68, 0);
bplus_tree_dump(bplus_tree);
put(63, 0);
bplus_tree_dump(bplus_tree);
put(53, 0);
bplus_tree_dump(bplus_tree);
put(44, 0);
bplus_tree_dump(bplus_tree);
put(39, 0);
bplus_tree_dump(bplus_tree);
put(24, 0);
bplus_tree_dump(bplus_tree);
put(15, 0);
bplus_tree_dump(bplus_tree);
put(10, 0);
bplus_tree_dump(bplus_tree);
put(1, 0);
bplus_tree_dump(bplus_tree);
#endif
#define MAX_KEY 100
int i;
for (i = 1; i <= MAX_KEY; i++) {
put(i, i);
}
bplus_tree_dump(bplus_tree);
while (--i > 0) {
put(i, 0);
}
bplus_tree_dump(bplus_tree);
for (i = MAX_KEY; i > 0; i--) {
put(i, i);
}
bplus_tree_dump(bplus_tree);
for (i = 1; i <= MAX_KEY; i++) {
put(i, 0);
}
bplus_tree_dump(bplus_tree);
return 0;
}
示例#28
0
文件: JSCell.cpp 项目: 1833183060/wke
void JSCell::putVirtual(ExecState* exec, const Identifier& identifier, JSValue value, PutPropertySlot& slot)
{
    put(this, exec, identifier, value, slot);
}
示例#29
0
bx_extfpuirq_c::bx_extfpuirq_c(void)
{
  put("EFIRQ");
  settype(EXTFPUIRQLOG);
}
示例#30
0
文件: buffer.cpp 项目: BertiniM2/M2
void buffer::put(const char *s) { put(s, strlen(s)); }