Esempio n. 1
0
/* Check unary operations */
void check_unary(ast_node root) {
  //assert(root->left_child != NULL);
  if(root->node_type == RETURN_N) {
    if(root->left_child != NULL && root->left_child->node_type == CALL_N) {
      if(root->left_child->left_child->return_type == VOID_TYPE_N){
        exprTypeError = 1;
        fprintf(stderr, "line: %d | Error: Returning wrong type\n", root->line_num);
        fprintf(stderr, "%s\n", NODE_NAME(root->node_type));

      }
    }
  }
  else if (root->left_child->return_type == VOID_TYPE_N) {
    fprintf(stderr, "line: %d | Error: Type disagreement of variable used with unary operator\n", root->line_num);
    fprintf(stderr, "%s\n", NODE_NAME(root->node_type));

    exprTypeError = 1;
  }
  else if(root->left_child->node_type == CALL_N) {
    if(root->left_child->left_child->return_type == VOID_TYPE_N){
      fprintf(stderr, "line: %d | Error: Type disagreement of variable used with unary operator\n", root->line_num);
      fprintf(stderr, "%s\n", NODE_NAME(root->node_type));

      exprTypeError = 1;
    }
  }

}
Esempio n. 2
0
LIST *txtGoKeyAndInsert(U32 textId, char *key, ...)
{
    va_list argument;
    LIST *txtList = CreateList(), *originList = NULL;
    NODE *node;

    va_start(argument, key);

    originList = txtGoKey(textId, key);

    for (node = LIST_HEAD(originList); NODE_SUCC(node); node = NODE_SUCC(node)) {
	U8 i;
	char originLine[256], txtLine[256];

	strcpy(originLine, NODE_NAME(node));
	strcpy(txtLine, NODE_NAME(node));

	for (i = 2; i < strlen(originLine); i++) {
	    if (originLine[i - 2] == '%') {
		sprintf(txtLine, originLine, va_arg(argument, U32));
		i = strlen(originLine) + 1;
	    }
	}

	CreateNode(txtList, 0, txtLine);
    }

    RemoveList(originList);

    return txtList;
}
Esempio n. 3
0
static node_t*
node_new (node_t* parent, const gchar* basename)
{
	node_t *f = NULL;

    g_assert (basename && basename[0]);

    if ((f = g_new0(node_t, 1)) != NULL) {
        if (parent) {
            NODE_NAME(f) = g_build_filename(NODE_NAME(parent), basename, NULL);
        } else {
            NODE_NAME(f) = g_strdup(G_DIR_SEPARATOR_S);
        }
        f->basename = g_strdup (basename);
        /* f->children = g_hash_table_new_full (g_str_hash, g_str_equal, */
        /*   NULL, (GDestroyNotify)node_delete); */
        f->children = g_hash_table_new_full (g_str_hash, g_str_equal,
          NULL, NULL);
#ifdef GIO_COMPILATION
        f->gfile = g_file_new_for_path (NODE_NAME(f));
#endif
        FN_W ("%s 0x%p %s\n", __func__, f, NODE_NAME(f));
    }
	return f;
}
Esempio n. 4
0
/* Check binary operations */
void check_binary(ast_node root) {
    assert(root->left_child != NULL);
    assert(root->left_child->right_sibling != NULL);
    // if (root->left_child->return_type != root->left_child->right_sibling->return_type) {
    //   exprTypeError = 1;
    // }
    if(root->left_child->return_type == VOID_TYPE_N || root->left_child->right_sibling->return_type == VOID_TYPE_N) {
      exprTypeError = 1;
      fprintf(stderr, "line: %d | Error: Type disagreement of variable(s) used with binary operator\n", root->line_num);
      fprintf(stderr, "%s\n", NODE_NAME(root->node_type));
    }

    if(root->left_child->node_type == CALL_N) {
      if(root->left_child->left_child->return_type == VOID_TYPE_N){
        exprTypeError = 1;
        fprintf(stderr, "line: %d | Error: Type disagreement of variable(s) used with binary operator\n", root->line_num);
        fprintf(stderr, "%s\n", NODE_NAME(root->node_type));
      }
    }
    if(root->left_child->right_sibling->node_type == CALL_N) {
      if(root->left_child->right_sibling->left_child->return_type == VOID_TYPE_N){
        exprTypeError = 1;
        fprintf(stderr, "line: %d | Error: Type disagreement of variable(s) used with binary operator\n", root->line_num);
        fprintf(stderr, "%s\n", NODE_NAME(root->node_type));
      }
    }
}
Esempio n. 5
0
void
node_create_children_snapshot(node_t *f, gint created_event, gboolean emit)
{
	GDir *dir;
	GError *err = NULL;
    
    FN_W ("%s %s [0x%p]\n", __func__, NODE_NAME(f), f);

    dir = g_dir_open (NODE_NAME(f), 0, &err);
    if (dir) {
        const char *basename;
        node_t *child = NULL;
        
        while ((basename = g_dir_read_name (dir))) {
            node_t* data;
            GList *idx;

            child = node_get_child (f, basename);
            if (child == NULL) {
                gchar *filename;
            
                child = node_new (f, basename);
                children_add (f, child);
            }

            if (f->dir_subs) {
                /* We need monitor the new children, or the existed child which
                 * is in the DELETED mode.
                 */
                if (!NODE_HAS_STATE(child, NODE_STATE_ASSOCIATED) &&
                  node_lstat(child) == 0 && port_add(child) == 0) {
                    if (emit) {
                        /* Emit the whatever event for the new found file. */
                        node_emit_one_event(child, child->dir_subs, NULL, created_event);
                        node_emit_one_event(child, child->subs, NULL, created_event);
                        node_emit_one_event(child, f->dir_subs, NULL, created_event);
                        node_emit_one_event(child, f->subs, NULL, created_event);
                    }
                }
                /* else ignore, because it may be deleted. */
            }
        }
        g_dir_close (dir);

        /* We have finished children snapshot. Any other new added subs should
         * directory iterate the snapshot instead of scan directory again.
         */
        NODE_SET_FLAG(f, NODE_FLAG_SNAPSHOT_UPDATED);

    } else {
        FN_W (err->message);
        g_error_free (err);
    }
}
Esempio n. 6
0
void Range::load(xmlNodePtr curNode) {
    xmlNodePtr childNode = curNode->children;

    while(childNode) {
             if(NODE_NAME(childNode, "Low")) low.load(childNode);
        else if(NODE_NAME(childNode, "High")) xml::copyToNum(high, childNode);

        childNode = childNode->next;
    }
    if(!high && low.id)
        high = low.id;
}
Esempio n. 7
0
U32 tcPersonWanted(U32 persId)
{
    U32 hours, i = 0, caught = 0;
    Person john = dbGetObject(Person_John_Gludo);
    Person miles = dbGetObject(Person_Miles_Chickenwing);
    LIST *bubble;
    LIST *jobs = txtGoKey(OBJECTS_ENUM_TXT, "enum_JobE");
    char line[TXT_KEY_LENGTH], name[TXT_KEY_LENGTH];

    dbGetObjectName(persId, name);

    bubble = txtGoKey(BUSINESS_TXT, "BURGLAR_RECOG");

    sprintf(line, "%s %s.", NODE_NAME(GetNthNode(bubble, 3)), name);

    RemoveNode(bubble, NODE_NAME(GetNthNode(bubble, 3)));
    CreateNode(bubble, 0L, line);

    SetPictID(john->PictID);
    Bubble(bubble, 0, 0L, 0L);
    RemoveList(bubble);

    Say(BUSINESS_TXT, 0, miles->PictID, "ARREST_HIM");
    livesInUnSet(London_London_1, persId);
    tcMoveAPerson(persId, Location_Nirvana);

    hours = CalcRandomNr(4L, 7L);

    while ((i++) < hours) {
	AddVTime(60);
	inpDelay(35);
	ShowTime(2);
    }

    if (tcGuyCanEscape(dbGetObject(persId)) > CalcRandomNr(100, 255)) {	/* Flucht gelingt */
	Say(BUSINESS_TXT, 0, john->PictID, "ESCAPED");

	livesInSet(London_Escape, persId);
    } else {			/* nicht */

	Say(BUSINESS_TXT, 0, john->PictID, "ARRESTED");

	livesInSet(London_Jail, persId);

	caught = tcPersonQuestioning(dbGetObject(persId));
    }

    RemoveList(jobs);

    return caught;
}
Esempio n. 8
0
/**
 * fen_add
 * 
 * Won't hold a ref, we have a timout callback to clean unused node_t.
 * If there is no value for a key, add it and return it; else return the old
 * one.
 */
void
fen_add (const gchar *filename, gpointer sub, gboolean is_mondir)
{
	node_t* f;

    g_assert (filename);
    g_assert (sub);

    G_LOCK (fen_lock);
	f = node_find(NULL, filename, TRUE);
    FH_W ("%s 0x%p sub[0x%p] %s\n", __func__, f, sub, filename);
    g_assert (f);

    /* Update timestamp, the events in global queue will compare itself to this
     * timestamp to decide if be emitted. TODO, timestamp should be per sub.
     */
    if (!NODE_IS_ACTIVE(f)) {
        g_get_current_time(&f->atv);
    }

    if (is_mondir) {
        f->dir_subs = g_list_prepend(f->dir_subs, sub);
    } else {
        f->subs = g_list_prepend(f->subs, sub);
    }
    
    if (NODE_HAS_STATE(f, NODE_STATE_ASSOCIATED) ||
      (node_lstat(f) == 0 && port_add(f) == 0)) {
#ifndef GIO_COMPILATION
        gam_server_emit_one_event (NODE_NAME(f),
          gam_subscription_is_dir (sub), GAMIN_EVENT_EXISTS, sub, 1);
#endif
        if (is_mondir) {
            scan_children_init (f, sub);
        }
    } else {
#ifndef GIO_COMPILATION
        gam_server_emit_one_event (NODE_NAME(f),
          gam_subscription_is_dir (sub), GAMIN_EVENT_DELETED, sub, 1);
#endif
        node_adjust_deleted (f);
    }
#ifndef GIO_COMPILATION
    gam_server_emit_one_event (NODE_NAME(f),
      gam_subscription_is_dir (sub), GAMIN_EVENT_ENDEXISTS, sub, 1);
#endif
    G_UNLOCK (fen_lock);
}
Esempio n. 9
0
static gboolean
port_events_process_cb(gpointer user_data)
{
    node_event_t *ev;
    
    G_LOCK (fen_lock);

	/* Processing g_eventq */
    while ((ev = (node_event_t*)g_queue_pop_head (g_eventq)) != NULL) {

        /* FK_W ("[%s] 0x%p %s\n", __func__, ev, _event_string (ev->e)); */

        {
            gchar *log = _event_strings(ev->e);
            FK_W ("%s %s %s\n", __func__, NODE_NAME(ev->user_data), log);
            g_free(log);
        }

#ifdef GIO_COMPILATION
        /* Use the parent node as a hash, because only the dir_subs in the
         * parent node should receive MOVE event.
         */
        if (NODE_PARENT(ev->user_data)) {
            if (ev->e == FILE_RENAME_TO) {
                g_hash_table_insert(renamed_hash, NODE_PARENT(ev->user_data), ev);
                g_time_val_add(&ev->rename_tv, RENAME_EVENTS_INTERVAL);
                continue;
            }
            if (ev->e == FILE_RENAME_FROM) {
                node_event_t *pair_ev;

                pair_ev = g_hash_table_lookup(renamed_hash, NODE_PARENT(ev->user_data));
                if (pair_ev && node_timeval_lt(&ev->ctv, &pair_ev->rename_tv)) {
                    g_hash_table_remove(renamed_hash, NODE_PARENT(ev->user_data));
                    pair_ev->pair_data = ev->user_data;
                    /* Free ev, exchange pair_ev and ev. */
                    node_event_delete(ev);
                    ev = pair_ev;
                }
            }
        }
#endif
    
#if 0
        node_add_event(ev->user_data, ev);
#else
        user_process_events_cb(ev->user_data, ev);
#endif
    }

    /* Processing the events in renamed_hash. TODO we should delay it and wait
     * for more possible pair.
     */
    g_hash_table_foreach_remove(renamed_hash, process_renamed_hash_cb, NULL);

    G_UNLOCK (fen_lock);

    process_port_event_id = 0;
    return FALSE;
}
void print_lst(FILE *fp, lst_node root, int depth) {
  /* Print two spaces for every level of depth. */
  int i;

  assert(root);
  
  /* Syntactic sugar */
  fprintf(fp, "| ");
  for (i = 0; i < depth; i++)
    fprintf(fp, "- ");

  /* Print the node type. */
  fprintf(fp, "%s ", NODE_NAME(root->node_type));

  if (root->value_string != NULL)
    fprintf(fp, "%s", root->value_string);

  fprintf(fp, "\n");

  /* Recurse on each child of the subtree root, with a depth one
     greater than the root's depth. */
  lst_node child;
  for (child = root->left_child; child != NULL; child = child->right_sib)
    print_lst(fp, child, depth + 1);
}  
Esempio n. 11
0
void txtPutCharacter(LIST * list, uword pos, U8 c)
{
    NODE *node;

    for (node = LIST_HEAD(list); NODE_SUCC(node); node = NODE_SUCC(node))
	NODE_NAME(node)[pos] = c;
}
Esempio n. 12
0
static void
children_add (node_t *p, node_t *f)
{
    FN_W ("%s %s %s\n", __func__, NODE_NAME(p), f->basename);
    g_hash_table_insert (p->children, f->basename, f);
    NODE_PARENT(f) = p;
}
Esempio n. 13
0
static void
children_remove (node_t *p, node_t *f)
{
    FN_W ("%s %s %s\n", __func__, NODE_NAME(p), f->basename);
    g_hash_table_steal (p->children, f->basename);
    NODE_PARENT(f) = NULL;
}
Esempio n. 14
0
Spell::Spell(xmlNodePtr rootNode) {
    xmlNodePtr curNode = rootNode->children;
    priority = 100;

    while(curNode) {
             if(NODE_NAME(curNode, "Name")) { 
                 xml::copyToBString(name, curNode);
                 parseName();
             }
        else if(NODE_NAME(curNode, "Script")) xml::copyToBString(script, curNode);
        else if(NODE_NAME(curNode, "Priority")) xml::copyToNum(priority, curNode);
        else if(NODE_NAME(curNode, "Description")) xml::copyToBString(description, curNode);

        curNode = curNode->next;
    }
}
Esempio n. 15
0
/*
 * Adjust self on failing to Port
 */
void
node_adjust_deleted(node_t* f)
{
    node_t *ancestor;

    FN_W ("%s %s\n", __func__, NODE_NAME(f));

    for (ancestor = NODE_PARENT(f);
         ancestor != NULL;
         ancestor = NODE_PARENT(ancestor)) {
        /* Stop if we find a node which been already associated or is existed
         * and can be associated.
         */
        if (NODE_HAS_STATE(ancestor, NODE_STATE_ASSOCIATED) ||
          (node_lstat(ancestor) == 0 && port_add(ancestor) == 0)) {
            break;
        }
    }

    /* We assume we shouldn't reach here, because Root is always existed and
     * associated. But given bugster#6955199, if PORT FS has problems on root,
     * we may reach here. So just return ROOT and the whole GIO fen backend will
     * fail.
     */
    /* g_assert(ancestor != NULL); */
}
Esempio n. 16
0
gboolean
node_try_delete(node_t* node)
{
    g_assert (node);

    FN_W ("%s 0x%p %s\n", __func__, node, NODE_NAME(node));

    /* Try clean children */
    if (node_children_num (node) > 0) {
        g_hash_table_foreach_remove(node->children, children_remove_cb, NULL);
    }
    if (!NODE_NEED_MONITOR(node)) {
        /* Clean some flags. */
        /* NODE_CLE_FLAG(node, NODE_FLAG_HAS_SNAPSHOT | NODE_FLAG_STAT_DONE); */
        node->flag = 0;

        /* Now we handle the state. */
        if (NODE_HAS_STATE(node, NODE_STATE_ASSOCIATED)) {
            port_remove(node);
        }
        /* Actually ignore the ROOT node. */
        if (node->state == 0 && NODE_PARENT(node)) {
            children_remove(NODE_PARENT(node), node);
            /* Do clean instead of returning TRUE. */
            node_delete (node);
        }
        /* else, we have events, clean event queue? */
    }
    return FALSE;
}
Esempio n. 17
0
/* Copy the replacement text of MACRO to DEST, which must be of
   sufficient size.  It is not NUL-terminated.  The next character is
   returned.  */
uchar *
_cpp_copy_replacement_text (const cpp_macro *macro, uchar *dest)
{
  if (macro->fun_like && (macro->paramc != 0))
    {
      const uchar *exp;

      for (exp = macro->exp.text;;)
	{
	  struct block *b = (struct block *) exp;
	  cpp_hashnode *param;

	  memcpy (dest, b->text, b->text_len);
	  dest += b->text_len;
	  if (b->arg_index == 0)
	    break;
	  param = macro->params[b->arg_index - 1];
	  memcpy (dest, NODE_NAME (param), NODE_LEN (param));
	  dest += NODE_LEN (param);
	  exp += BLOCK_LEN (b->text_len);
	}
    }
  else
    {
      memcpy (dest, macro->exp.text, macro->count);
      dest += macro->count;
    }

  return dest;
}
Esempio n. 18
0
static void
node_delete (node_t *f)
{
    FN_W ("%s 0x%p %s\n", __func__, f, NODE_NAME(f));
    g_assert(f->state == 0);
    g_assert(!NODE_IS_ACTIVE(f));
    g_assert(g_hash_table_size (f->children) == 0);
    g_assert(NODE_PARENT(f) == NULL);
    g_hash_table_unref(f->children);
#ifdef GIO_COMPILATION
    g_object_unref (f->gfile);
#endif
    g_free(f->basename);
    g_free(NODE_NAME(f));
    g_free (f);
}
Esempio n. 19
0
/* Utility routine:

   Compares, the token TOKEN to the NUL-terminated string STRING.
   TOKEN must be a CPP_NAME.  Returns 1 for equal, 0 for unequal.  */
int
cpp_ideq (const cpp_token *token, const char *string)
{
  if (token->type != CPP_NAME)
    return 0;

  return !ustrcmp (NODE_NAME (token->val.node), (const uchar *) string);
}
Esempio n. 20
0
/* #undef callback for DWARF and DWARF2 debug info.  */
static void
cb_undef (cpp_reader * ARG_UNUSED (pfile), source_location loc,
	  cpp_hashnode *node)
{
  const struct line_map *map = linemap_lookup (&line_table, loc);
  (*debug_hooks->undef) (SOURCE_LINE (map, loc),
			 (const char *) NODE_NAME (node));
}
Esempio n. 21
0
static void
node_emit_one_event(node_t *f, GList *subs, node_t *other, int event)
{
    GList* idx;
    
    FN_W ("%s %s %d\n", __func__, NODE_NAME(f), event);

#ifdef GIO_COMPILATION
    for (idx = subs; idx; idx = idx->next) {
        g_file_monitor_emit_event(G_FILE_MONITOR(idx->data), f->gfile,
          (other == NULL ? NULL : other->gfile), event);
    }
#else
    for (idx = subs; idx; idx = idx->next) {
        gam_server_emit_one_event(NODE_NAME(f), gam_subscription_is_dir(idx->data), event, idx->data, 1);
    }
#endif
}
Esempio n. 22
0
File: io.c Progetto: vcosta/derclou
LIST *plLoadTools(FILE * fh)
{
    register LIST *l = txtGoKey(PLAN_TXT, "SYSTEM_TOOLS_MISSING_1");
    register ubyte foundAll = 1, canGet = 2, toolsNr = 0;
    char buffer[64];
    U32 id;

    buffer[0] = '\0';

    if (fh) {
	while (dskGetLine(buffer, sizeof(buffer), fh)
	       && strcmp(buffer, PLANING_PLAN_TOOL_END_ID) != 0) {
	    if (sscanf(buffer, "%" SCNu32 "\r\n", &id) == 1) {
		toolsNr++;

		if (!has(Person_Matt_Stuvysunt, id)) {
		    if (has(Person_Mary_Bolton, id)) {
			canGet++;
			dbAddObjectNode(l, id, OLF_INCLUDE_NAME);
		    }

		    foundAll = 0;
		}
	    }
	}
    }

    if (foundAll) {
	RemoveList(l);
	l = NULL;
    } else {
	LIST *extList = NULL;
	NODE *n;

	if (canGet == 2)
	    extList = txtGoKey(PLAN_TXT, "SYSTEM_TOOLS_MISSING_3");
	else {
	    if ((toolsNr - canGet) > 1)
		extList =
		    txtGoKeyAndInsert(PLAN_TXT, "SYSTEM_TOOLS_MISSING_2",
				      (U32) (toolsNr - canGet));
	    else if (toolsNr - canGet)
		extList = txtGoKey(PLAN_TXT, "SYSTEM_TOOLS_MISSING_4");
	}

	if (extList) {
	    for (n = LIST_HEAD(extList); NODE_SUCC(n); n = NODE_SUCC(n))
		CreateNode(l, 0, NODE_NAME(n));

	    RemoveList(extList);
	}

    }

    return l;
}
Esempio n. 23
0
static value_t *
eppic_pval(node_t*n)
{
value_t *v=NODE_EXE(n);
char *name=NODE_NAME(n);

    eppic_ptype2(&v->type, v, 0, 1, name, 0, 0);
    eppic_free(name);
    eppic_freeval(v);
    return 0;
}
Esempio n. 24
0
void txtLoad(U32 textId)
{
    struct Text *txt = GetNthNode(txtBase->tc_Texts, textId);

    if (txt) {
	if (!txt->txt_Handle) {
	    char txtFile[DSK_PATH_MAX];
	    char txtPath[DSK_PATH_MAX];
	    U8 *ptr, *text;
	    size_t length;

            sprintf(txtFile, "%s%c%s",
                NODE_NAME(txt),
                txtBase->tc_Language,
                TXT_SUFFIX);

	    dskBuildPathName(DISK_CHECK_FILE, TEXT_DIRECTORY, txtFile, txtPath);

	    length = dskFileLength(txtPath);
            txt->length = length;

	    /* loading text into buffer */
	    text = dskLoad(txtPath);

	    /* correcting text */
	    for (ptr=text; length--; ptr++) {

		*ptr ^= TXT_XOR_VALUE;

                switch (*ptr) {
                case '\r':
                case '\n':
                    *ptr = '\0';
                    break;

                default:
                    break;
                }
	    }

	    /* save text into xms */
	    if (text) {
                txt->txt_Handle = malloc(txt->length+1);
                memcpy(txt->txt_Handle, text, txt->length);
                free(text);

		/* let's play safe here... */
		txt->txt_Handle[txt->length] = TXT_CHAR_EOF;
		txt->length++;
	    } else
		ErrorMsg(No_Mem, ERROR_MODULE_TXT, ERR_TXT_NO_MEM);
	}
    }
}
Esempio n. 25
0
gint
node_lstat(node_t *f)
{
    struct stat buf;

    g_assert(!NODE_HAS_STATE(f, NODE_STATE_ASSOCIATED));

    if (lstat(NODE_NAME(f), &buf) == 0) {
        FN_W ("%s %s\n", __func__, NODE_NAME(f));
        FILE_OBJECT(f)->fo_atime = buf.st_atim;
        FILE_OBJECT(f)->fo_mtime = buf.st_mtim;
        FILE_OBJECT(f)->fo_ctime = buf.st_ctim;
        NODE_SET_FLAG(f, NODE_FLAG_STAT_UPDATED |
          (S_ISDIR (buf.st_mode) ? NODE_FLAG_DIR : NODE_FLAG_NONE));
        return 0;
    } else {
        FN_W ("%s(lstat) %s %s\n", __func__, NODE_NAME(f), g_strerror (errno));
    }
    return errno;
}
Esempio n. 26
0
void
recognized_function (const cpp_token *fname, unsigned int line, int kind,
                     int have_arg_list)
{
    struct partial_proto *partial;
    int i;
    struct fn_decl *fn;

    fn = lookup_std_proto ((const char *) NODE_NAME (fname->val.node),
                           NODE_LEN (fname->val.node));

    /* Remove the function from the list of required function.  */
    if (fn)
    {
        if (REQUIRED (fn))
            required_unseen_count--;
        SET_SEEN (fn);
    }

    /* If we have a full prototype, we're done.  */
    if (have_arg_list)
        return;

    if (kind == 'I')  /* don't edit inline function */
        return;

    /* If the partial prototype was included from some other file,
       we don't need to patch it up (in this run).  */
    i = strlen (cur_file);
    if (i < inc_filename_length
            || strcmp (inc_filename, cur_file + (i - inc_filename_length)) != 0)
        return;

    if (fn == NULL)
        return;
    if (fn->params[0] == '\0')
        return;

    /* We only have a partial function declaration,
       so remember that we have to add a complete prototype.  */
    partial_count++;
    partial = obstack_alloc (&scan_file_obstack, sizeof (struct partial_proto));
    partial->line_seen = line;
    partial->fn = fn;
    fn->partial = partial;
    partial->next = partial_proto_list;
    partial_proto_list = partial;
    if (verbose)
    {
        fprintf (stderr, "(%s: %s non-prototype function declaration.)\n",
                 inc_filename, fn->fname);
    }
}
Esempio n. 27
0
File: pch.c Progetto: Lao16/gcc
static int
write_macdef (cpp_reader *pfile, cpp_hashnode *hn, void *file_p)
{
  FILE *f = (FILE *) file_p;
  switch (hn->type)
    {
    case NT_VOID:
      if (! (hn->flags & NODE_POISONED))
	return 1;

    case NT_MACRO:
      if ((hn->flags & NODE_BUILTIN)
	  && (!pfile->cb.user_builtin_macro
	      || !pfile->cb.user_builtin_macro (pfile, hn)))
	return 1;

      {
	struct macrodef_struct s;
	const unsigned char *defn;

	s.name_length = NODE_LEN (hn);
	s.flags = hn->flags & NODE_POISONED;

	if (hn->type == NT_MACRO)
	  {
	    defn = cpp_macro_definition (pfile, hn);
	    s.definition_length = ustrlen (defn);
	  }
	else
	  {
	    defn = NODE_NAME (hn);
	    s.definition_length = s.name_length;
	  }

	if (fwrite (&s, sizeof (s), 1, f) != 1
	    || fwrite (defn, 1, s.definition_length, f) != s.definition_length)
	  {
	    cpp_errno (pfile, CPP_DL_ERROR,
		       "while writing precompiled header");
	    return 0;
	  }
      }
      return 1;

    case NT_ASSERTION:
      /* Not currently implemented.  */
      return 1;

    default:
      abort ();
    }
}
Esempio n. 28
0
/* misc */
static void
scan_children_init(node_t *f, gpointer sub)
{
    gboolean emit;
    gint event;

    FH_W ("%s %s [0x%p]\n", __func__, NODE_NAME(f), f);

#ifdef GIO_COMPILATION
    emit = FALSE;
    event = G_FILE_MONITOR_EVENT_CREATED;
#else
    emit = TRUE;
    event = GAMIN_EVENT_EXISTS;
#endif

    if (!NODE_HAS_FLAG(f, NODE_FLAG_SNAPSHOT_UPDATED)) {
        /* TODO snapshot should also compare to the sub created timestamp. */
        /* GIO initially doesn't emit created/existed events. */
        node_create_children_snapshot(f, event, emit);
    } else {
        GHashTableIter iter;
        gpointer value;

        g_hash_table_iter_init (&iter, f->children);
        while (g_hash_table_iter_next (&iter, NULL, &value)) {
            node_t *child = (node_t *)value;

#ifdef GIO_COMPILATION
            /* GIO initially doesn't emit created/existed events. */
            /* g_file_monitor_emit_event(G_FILE_MONITOR(sub), child->gfile, NULL, event); */
#else
            gam_server_emit_one_event(NODE_NAME(child), gam_subscription_is_dir(sub), event, sub, 1);
#endif
        }
    }
}
Esempio n. 29
0
/* functions - STRING */
char *txtGetNthString(U32 textId, const char *key, U32 nth, char *dest)
{
    LIST *txtList = txtGoKey(textId, key);
    void *src;

    if ((src = GetNthNode(txtList, nth))) {
	strcpy(dest, NODE_NAME(src));
    } else {
	strcpy(dest, "");
    }

    RemoveList(txtList);

    return dest;
}
Esempio n. 30
0
static U32 tcATraitor(U32 traitorId)
{
    char name[TXT_KEY_LENGTH], line[TXT_KEY_LENGTH];
    LIST *bubble = txtGoKey(BUSINESS_TXT, "A_TRAITOR");
    LIST *newList = CreateList();
    Person john = dbGetObject(Person_John_Gludo);

    dbGetObjectName(traitorId, name);
    sprintf(line, NODE_NAME(LIST_HEAD(bubble)), name);

    CreateNode(newList, 0L, line);
    CreateNode(newList, 0L, NODE_NAME(GetNthNode(bubble, 1)));
    CreateNode(newList, 0L, NODE_NAME(GetNthNode(bubble, 2)));

    SetPictID(john->PictID);
    Bubble(newList, 0, 0L, 0L);

    RemoveList(bubble);
    RemoveList(newList);

    Say(BUSINESS_TXT, 0, john->PictID, "ARRESTED");

    return 1;			/* gefangen! */
}