software/drivers/sd8887/src/wlan/mapp/mlanconfig/mlanconfig.c
/**
 *  @brief str2bin, convert RPN string to binary format
 *
 *  @param str			A pointer to rpn string
 *  @param stack		A pointer to mstack_t structure
 *  @return			MLAN_STATUS_SUCCESS--success, otherwise--fail
 */
@brief str2bin, convert RPN string to binary format
@param str                  A pointer to rpn string
@param stack                A pointer to mstack_t structure
@return                     MLAN_STATUS_SUCCESS--success, otherwise--fail
@brief str2bin convert RPN string to binary format @param str A pointer to rpn string @param stack A pointer to mstack_t structure @return MLAN_STATUS_SUCCESS -- success otherwise -- fail
static int
str2bin(char *str, mstack_t * stack)
{
	int first_time;
	char *opstr;
	op_t op;		
	int dnum;
	int ret = MLAN_STATUS_SUCCESS;
	memset(stack, 0, sizeof(mstack_t));
	first_time = TRUE;
	while ((opstr = getop(str, &first_time)) != NULL) {
		if (isdigit(*opstr)) {
			op.type = TYPE_DNUM;
			dnum = cpu_to_le32(atoi(opstr));
			memcpy((t_u8 *)op.val, &dnum, sizeof(dnum));
			if (!push(stack, &op)) {
				printf("push decimal number failed\n");
				ret = MLAN_STATUS_FAILURE;
				break;
			}
		} else if (*opstr == 'h') {
			op.type = TYPE_BYTESEQ;
			parse_hex(opstr, op.val);
			if (!push(stack, &op)) {
				printf("push byte sequence failed\n");
				ret = MLAN_STATUS_FAILURE;
				break;
			}
		} else if (!strcmp(opstr, "==")) {
			op.type = TYPE_EQ;
			if (!push(stack, &op)) {
				printf("push byte cmp operator failed\n");
				ret = MLAN_STATUS_FAILURE;
				break;
			}
		} else if (!strcmp(opstr, "=d")) {
			op.type = TYPE_EQ_DNUM;
			if (!push(stack, &op)) {
				printf("push decimal cmp operator failed\n");
				ret = MLAN_STATUS_FAILURE;
				break;
			}
		} else if (!strcmp(opstr, "=b")) {
			op.type = TYPE_EQ_BIT;
			if (!push(stack, &op)) {
				printf("push bit cmp operator failed\n");
				ret = MLAN_STATUS_FAILURE;
				break;
			}
		} else if (!strcmp(opstr, "&&")) {
			op.type = TYPE_AND;
			if (!push(stack, &op)) {
				printf("push AND operator failed\n");
				ret = MLAN_STATUS_FAILURE;
				break;
			}
		} else if (!strcmp(opstr, "||")) {
			op.type = TYPE_OR;
			if (!push(stack, &op)) {
				printf("push OR operator failed\n");
				ret = MLAN_STATUS_FAILURE;
				break;
			}
		} else {
			printf("Unknown operand\n");
			ret = MLAN_STATUS_FAILURE;
			break;
		}
	}
	return ret;
}
static int str2bin ( char * str , mstack_t * stack ) { int first_time ; char * opstr ; op_t op ; int dnum ; int ret = MLAN_STATUS_SUCCESS ; memset ( stack , 0 , sizeof ( mstack_t ) ) ; first_time = TRUE ; while ( ( opstr = getop ( str , & first_time ) ) != NULL ) { if ( isdigit ( * opstr ) ) { op . type = TYPE_DNUM ; dnum = cpu_to_le32 ( atoi ( opstr ) ) ; memcpy ( ( t_u8 * ) op . val , & dnum , sizeof ( dnum ) ) ; if ( ! push ( stack , & op ) ) { printf ( " \n " ) ; ret = MLAN_STATUS_FAILURE ; break ; } } else if ( * opstr == ' ' ) { op . type = TYPE_BYTESEQ ; parse_hex ( opstr , op . val ) ; if ( ! push ( stack , & op ) ) { printf ( " \n " ) ; ret = MLAN_STATUS_FAILURE ; break ; } } else if ( ! strcmp ( opstr , " " ) ) { op . type = TYPE_EQ ; if ( ! push ( stack , & op ) ) { printf ( " \n " ) ; ret = MLAN_STATUS_FAILURE ; break ; } } else if ( ! strcmp ( opstr , " " ) ) { op . type = TYPE_EQ_DNUM ; if ( ! push ( stack , & op ) ) { printf ( " \n " ) ; ret = MLAN_STATUS_FAILURE ; break ; } } else if ( ! strcmp ( opstr , " " ) ) { op . type = TYPE_EQ_BIT ; if ( ! push ( stack , & op ) ) { printf ( " \n " ) ; ret = MLAN_STATUS_FAILURE ; break ; } } else if ( ! strcmp ( opstr , " " ) ) { op . type = TYPE_AND ; if ( ! push ( stack , & op ) ) { printf ( " \n " ) ; ret = MLAN_STATUS_FAILURE ; break ; } } else if ( ! strcmp ( opstr , " " ) ) { op . type = TYPE_OR ; if ( ! push ( stack , & op ) ) { printf ( " \n " ) ; ret = MLAN_STATUS_FAILURE ; break ; } } else { printf ( " \n " ) ; ret = MLAN_STATUS_FAILURE ; break ; } } return ret ; }
@brief str2bin, convert RPN string to binary format
  @param str                  A pointer to rpn string
  @param stack                A pointer to mstack_t structure
  @return                     MLAN_STATUS_SUCCESS--success, otherwise--fail
@brief str2bin convert RPN string to binary format @param str A pointer to rpn string @param stack A pointer to mstack_t structure @return MLAN_STATUS_SUCCESS -- success otherwise -- fail
/* operator/operand */