⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fen-dump.c

📁 this is a glib for c language
💻 C
字号:
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- *//* vim:set expandtab ts=4 shiftwidth=4: *//*  * Copyright (C) 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General * Public License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307, USA. * * Authors: Lin Ma <lin.ma@sun.com> */#include "config.h"#include <glib.h>#include <glib/gprintf.h>#include "fen-node.h"#include "fen-data.h"#include "fen-kernel.h"#include "fen-missing.h"#include "fen-dump.h"G_LOCK_EXTERN (fen_lock);/*-------------------- node ------------------*/static voiddump_node (node_t* node, gpointer data){    if (data && node->user_data) {        return;    }    g_printf ("[%s] < 0x%p : 0x%p > %s\n", __func__, node, node->user_data, NODE_NAME(node));}static gbooleandump_node_tree (node_t* node, gpointer user_data){    node_op_t op = {dump_node, NULL, NULL, user_data};    GList* children;    GList* i;    if (G_TRYLOCK (fen_lock)) {        if (node) {            travel_nodes (node, &op);        }        G_UNLOCK (fen_lock);    }    return TRUE;}/* ------------------ fdata port hash --------------------*/voiddump_hash_cb (gpointer key,  gpointer value,  gpointer user_data){    g_printf ("[%s] < 0x%p : 0x%p >\n", __func__, key, value);}gbooleandump_hash (GHashTable* hash, gpointer user_data){    if (G_TRYLOCK (fen_lock)) {        if (g_hash_table_size (hash) > 0) {            g_hash_table_foreach (hash, dump_hash_cb, user_data);        }        G_UNLOCK (fen_lock);    }    return TRUE;}/* ------------------ event --------------------*/voiddump_event (fnode_event_t* ev, gpointer user_data){    fdata* data = ev->user_data;    g_printf ("[%s] < 0x%p : 0x%p > [ %10s ] %s\n", __func__, ev, ev->user_data, _event_string (ev->e), FN_NAME(data));}voiddump_event_queue (fdata* data, gpointer user_data){    if (G_TRYLOCK (fen_lock)) {        if (data->eventq) {            g_queue_foreach (data->eventq, (GFunc)dump_event, user_data);        }        G_UNLOCK (fen_lock);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -