本文整理汇总了C++中determine_type函数的典型用法代码示例。如果您正苦于以下问题:C++ determine_type函数的具体用法?C++ determine_type怎么用?C++ determine_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了determine_type函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ACE_Addr
ACE_INET_Addr::ACE_INET_Addr (const wchar_t address[], int address_family)
: ACE_Addr (determine_type (), sizeof (inet_addr_))
{
ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr");
this->reset ();
this->set (address, address_family);
}
示例2: ACE_Addr
ACE_INET_Addr::ACE_INET_Addr (u_short port_number,
ACE_UINT32 inet_address)
: ACE_Addr (determine_type (), sizeof (inet_addr_))
{
ACE_TRACE ("ACE_INET_Addr::ACE_INET_Addr");
if (this->set (port_number, inet_address) == -1)
ACELIB_ERROR ((LM_ERROR,
ACE_TEXT ("%p\n"),
ACE_TEXT ("ACE_INET_Addr::ACE_INET_Addr")));
}
示例3: while
/* ret 0 or -err */
int
ReaddirOp::do_op(const char *path, unsigned char /* isfile */, IOStore *store)
{
int ret;
IOSDirHandle *dir;
struct dirent entstore, *ent;
dir = store->Opendir(path,ret);
if (dir == NULL) {
return ret;
}
while ((ret = dir->Readdir_r(&entstore, &ent)) == 0 && ent != NULL) {
if (skip_dots && (!strcmp(ent->d_name,".")||
!strcmp(ent->d_name,".."))) {
continue; // skip the dots
}
if (filters.size()) {
bool match = false;
set<string>::iterator itr;
for(itr=filters.begin(); itr!=filters.end(); itr++) {
mlog(FOP_DCOMMON, "%s checking first %lu of filter %s on %s",
__FUNCTION__, (unsigned long)itr->length(),
itr->c_str(), ent->d_name);
// don't know why itr->compare isn't working. driving me nuts.
//if(itr->compare(0,itr->length()-1,ent->d_name)==0) {
if(strncmp(itr->c_str(),ent->d_name,itr->length()-1)==0) {
match = true;
break;
}
}
if(!match) {
continue; // else, it passed the filters so descend
}
}
string file;
if (expand) {
file = path;
file += "/";
file += ent->d_name;
} else {
file = ent->d_name;
}
mlog(FOP_DCOMMON, "%s inserting %s", __FUNCTION__, file.c_str());
if (entries) (*entries)[file] = (ent->d_type != DT_UNKNOWN) ?
ent->d_type :
determine_type(store, path, ent->d_name);
if (names) {
names->insert(file);
}
}
store->Closedir(dir);
return ret;
}
示例4: nodes_file_load
/* Function to load in all the nodes read from the file supplied (probably named "nodes.txt"). */
int nodes_file_load(event_ptr event, char* file_name) {
FILE *nodes_file; /* File pointer. */
int load_status;
char type_input[3];
int number;
node *new_node;
event->node_head = NULL;
if ((nodes_file = fopen(file_name, "r")) == NULL) { /* Open file with read permissions only and check file opened. */
printf("Please enter in a valid file path and name.\n");
return FAILURE;
}
while ((load_status = fscanf(nodes_file, " %d %2s", &number, type_input)) != EOF && load_status == 2) {
if (event->number_of_nodes == 0) {
new_node = malloc(sizeof (struct node)); /* Allocates memory for a new node. */
} else {
new_node->next_node = malloc(sizeof (struct node)); /* Allocates memory for the next node. */
new_node = new_node->next_node;
}
/* Initialises new node: */
new_node->number = number;
new_node->type = determine_type(type_input);
new_node->next_node = NULL;
/*-----------------------------------------------------------------------*/
/* Adds new node to linked list: */
if (event->node_head == NULL) {
event->node_head = new_node;
printf("Head Node: Number: %d, Type: %d = %2s\n", new_node->number,
new_node->type, type_input);
} else {
printf("Node: Number: %d, Type: %d = %2s\n", new_node->number,
new_node->type, type_input);
}
/*-----------------------------------------------------------------------*/
event->number_of_nodes++;
}
if (load_status == EOF) {
printf("\nNodes file loaded in successfully.\n");
fclose(nodes_file); /* Closes file as no longer needed. */
return SUCCESS;
} else if (load_status != 2) { /* Expected 2 inputs. */
printf("Error loading in file, possible pattern mismatch.\n");
fclose(nodes_file); /* Closes file as no longer needed. */
return FAILURE;
}
}
示例5: compile_assignment
expr_val * compile_assignment(binary_op_node * ass, scope * scope, str_list * lines) {
expr_val * name = compile_statement(ass->left, scope, lines);
expr_val * val = compile_statement(ass->right, scope, lines);
if (!determine_type(ass->op, name->type, val->type)) return NULL;
char * name_value = name->val;
char * right_value = val->val;
int len = strlen(name_value) + strlen(right_value) + 5;
char * output = (char *) malloc(len);
snprintf(output, len, "%s = %s;", name_value, right_value);
insert_array(lines, output);
return new_expr_val(name_value, val->type);
}
示例6: compile_addition
expr_val * compile_addition(binary_op_node * node, scope * scope, str_list * lines) {
int op = node->op;
expr_val * left = compile_statement(node->left, scope, lines);
expr_val * right = compile_statement(node->right, scope, lines);
// Determine if types are compatible
expr_type type;
if(!(type = determine_type(op, left->type, right->type))) return NULL;
expr_val * var = get_new_var(type, scope, lines);
// Extracting values
char * var_val = var->val;
char * left_val = left->val;
char * right_val = right->val;
int len = strlen(var_val) + strlen(left_val) + strlen(right_val) + 8;
char * output = (char *) malloc(len);
snprintf(output, len, "%s = %s + %s;", var_val, left_val, right_val);
insert_array(lines, output);
return new_expr_val(var_val, INT_TYPE);
}
示例7: parse
/* Parse one line of text */
void parse (char string[]) {
struct node *list_ptr /*, *node_ptr */;
static int vartype = NOP, state = NOP;
char *ptr = string, *title_ptr, *temp;
if (((string[0] == ' ') && (strlen(string) > 6)) ||
((string[0] == '\t') && (strlen(string) > 2))) {
/* The current line is not a comment */
if (string[0] == '\t') ptr++;
else ptr += 5;
if ((isspace (*ptr)) || ((state != COMMON_CONTINUE) && (state != REGISTER_CONTINUE))) {
ptr = skip_blanks (ptr);
vartype = determine_type (ptr);
state = vartype;
if (strncmp_i("double precision", ptr, 16) == 0)
ptr = skip_blanks (skip_nonblanks (ptr));
}
if ((vartype != NOP) && (vartype != PARAMETER) && (vartype != EQUIV)) {
/* The current line is a list of variables */
if (state == COMMON_CONTINUE) {
/* The current line is the continuation of a common block */
list_ptr = common_start;
ptr++;
}
else if (state == COMMON) {
/* The current line is a common block */
list_ptr = common_start;
ptr = find_char (find_char (ptr, '/'), '/');
state = COMMON_CONTINUE;
}
else if (state == REGISTER_CONTINUE) {
/* The current line is the continuation of a register statement */
list_ptr = register_start;
ptr++;
}
else {
/* The current line contains variables to be registered */
list_ptr = register_start;
ptr = skip_nonblanks (ptr);
state = REGISTER_CONTINUE;
}
ptr = skip_blanks (ptr);
/* Obtain the title string */
title_ptr = string;
if (find_char (ptr, ',') > find_char (ptr, '!')) {
while (*title_ptr != '!') title_ptr++;
title_ptr = skip_blanks (title_ptr+1);
if (*title_ptr == '\0') title_ptr = NULL;
}
else title_ptr = NULL;
/* Convert ' to '' in title string */
if (title_ptr != NULL) {
temp = title_ptr;
while (*temp != '\0') {
if (*temp == '\'') shift_left (temp++);
temp++;
}
}
/* Add each variable to the linked list */
while ((ptr < find_char (string, '!')) && (*ptr != '!')) {
if ((find_char (ptr, '(') < find_char (ptr, ',')) &&
(find_char (ptr, '(') < find_char (ptr, '!'))) {
/* The variable is an array */
create (list_ptr, vartype, ptr, title_ptr);
if (vartype >= 0) array_flags[current_calltype][vartype] = 1;
ptr = skip_blanks (find_char (find_char (ptr, ')'), ','));
}
else {
/* The variable is not an array */
create (list_ptr, vartype, ptr, title_ptr);
if (vartype >=0) variable_flags[current_calltype][vartype] = 1;
ptr = skip_blanks (find_char (ptr, ','));
}
}
}
if (vartype == PARAMETER)
/* If the line is a parameter statement, then ignore the variable */
mark_node (register_start, skip_blanks(find_char (ptr, '(')), IGNORE);
if (vartype == EQUIV) {
/* If the line is an equivalence statement, then skip the variables */
ptr = skip_blanks (find_char (ptr, '('));
mark_node (register_start, ptr, SKIP);
if (find_char(ptr,'(') < find_char(ptr,',')) ptr = find_char(ptr,')');
ptr = skip_blanks (find_char (ptr, ','));
mark_node (register_start, ptr, SKIP);
}
}
}
示例8: quote
// Initialization
void DispValue::init(DispValue *parent, int depth, string& value,
DispValueType given_type)
{
#if LOG_CREATE_VALUES
std::clog << "Building value from " << quote(value) << "\n";
#endif
// Be sure the value is not changed in memory
value.consuming(true);
const char *initial_value = value.chars();
static const DispValueArray empty(0);
_children = empty;
if (background(value.length()))
{
clear();
mytype = Simple;
_value = "(Aborted)";
value = "Aborted\n";
return;
}
mytype = given_type;
if (mytype == UnknownType &&
(parent == 0 || parent->type() == List) && print_name.empty())
mytype = Text;
if (mytype == UnknownType && parent == 0 && is_user_command(print_name))
mytype = List;
if (mytype == UnknownType)
mytype = determine_type(value);
bool ignore_repeats = (parent != 0 && parent->type() == Array);
char perl_type = '\0';
switch (mytype)
{
case Simple:
{
_value = read_simple_value(value, depth, ignore_repeats);
#if LOG_CREATE_VALUES
std::clog << mytype << ": " << quote(_value) << "\n";
#endif
perl_type = '$';
break;
}
case Text:
{
// Read in a line of text
if (value.contains('\n'))
_value = value.through('\n');
else
_value = value;
value = value.after('\n');
#if LOG_CREATE_VALUES
std::clog << mytype << ": " << quote(_value) << "\n";
#endif
perl_type = '$';
break;
}
case Pointer:
{
_value = read_pointer_value(value, ignore_repeats);
_dereferenced = false;
#if LOG_CREATE_VALUES
std::clog << mytype << ": " << quote(_value) << "\n";
#endif
// Hide vtable pointers.
if (_value.contains("virtual table") || _value.contains("vtable"))
myexpanded = false;
perl_type = '$';
// In Perl, pointers may be followed by indented `pointed to'
// info. Skip this.
if (gdb->type() == PERL)
{
while (value.contains("\n ", 0))
{
value = value.after("\n ");
value = value.from("\n");
}
}
break;
}
case Array:
{
string base = normalize_base(myfull_name);
_orientation = app_data.array_orientation;
#if LOG_CREATE_VALUES
//.........这里部分代码省略.........