Example #1
0
inline DmNode* dm_create_node(enum dm_node_type type, DM_USHORT lineno)
{
   //Currently, just alloc memory directly, use macro for further changes.
   DmNode* node = DM_MALLOC(sizeof(DmNode));
   set_node_type(node, type);
   set_node_lineno(node, lineno);
   return node;
}
Example #2
0
// get new temp
temp_var * new_temp(ast_node root) {
    if (!root)
        return NULL;

    // get root's scope table temp list
    temp_list * t_list = ((symhashtable_t *)root->scope_table)->t_list;

    // get a new temp from the list
    temp_var * new_var = (temp_var *)calloc(1,sizeof(temp_var));
    assert(new_var);

    // give unique id
    new_var->id = t_list->count;

    // make new name -- not yet
    char * name = make_temp_name(new_var->id);

    // put new temp in list
    t_list->list[t_list->count] = new_var;

    // if list is full, expand!
    t_list->count++;
    if (t_list->count == t_list->size) {
        t_list->size *= 2;
        t_list->list = realloc(t_list->list, t_list->size * sizeof(temp_var *));
        assert(t_list->list);
    }

    // add that new temp to local table under the name
    symnode_t * new_node = insert_into_symhashtable(root->scope_table,name, NULL);

    // attach temp to created symnode
    new_var->temp_symnode = new_node;

    // set node type
    set_node_type(new_node, VAR_SYM);

    // set node characteristics
    var_symbol node_model;
    node_model.name = name;
    node_model.type = INT_TS;
    node_model.modifier = SINGLE_DT;
    node_model.specie = TEMP_VAR;
    node_model.byte_size = TYPE_SIZE(INT_TS);

    // save to symbol table
    set_node_var(new_node, &node_model);

    // return newly created temp
    return new_var;
}
Example #3
0
/*
 *
 *      query_node_info - collect information from a batch_status and
 *                        put it in a node_info struct for easier access
 *
 *   node - a node returned from a pbs_statnode() call
 *
 * returns a node_info filled with information from node
 *
 */
node_info *query_node_info(struct batch_status *node, server_info *sinfo)
  {
  node_info *ninfo;  /* the new node_info */

  struct attrl *attrp;  /* used to cycle though attribute list */

  if ((ninfo = new_node_info()) == NULL)
    return NULL;

  attrp = node -> attribs;

  ninfo -> name = string_dup(node -> name);

  ninfo -> server = sinfo;

  while (attrp != NULL)
    {
    /* Node State... i.e. offline down free etc */
    if (!strcmp(attrp -> name, ATTR_NODE_state))
      set_node_state(ninfo, attrp -> value);

    /* properties from the servers nodes file */
    else if (!strcmp(attrp -> name, ATTR_NODE_properties))
      ninfo -> properties = break_comma_list(attrp -> value);

    /* the jobs running on the node */
    else if (!strcmp(attrp -> name, ATTR_NODE_jobs))
      ninfo -> jobs = break_comma_list(attrp -> value);

    /* the node type... i.e. timesharing or cluster */
    else if (!strcmp(attrp -> name, ATTR_NODE_ntype))
      set_node_type(ninfo, attrp -> value);

    attrp = attrp -> next;
    }

  return ninfo;
  }
Example #4
0
Camera::Camera()
{
	camera_matrix.reset_identity();
    set_node_type(NODE_CAMERA);
}