📄 level.c
字号:
/* Copyright (C) 2004,2005,2006 Bull S.A. * * 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.1 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 */#if HAVE_CONFIG_H#include <config.h>#endif#include <string.h>#include <stdio.h>#include "level.h"#define WARNING(str) { \ fprintf(stderr, "%s no matching level, ignoring\n", str); \ return PTT_LEVEL_NONE; \}int levelstr2int (char *str) { if (!strcmp ("LEVEL_NONE", str)) return PTT_LEVEL_NONE; if (!strcmp ("LEVEL_IO", str)) return PTT_LEVEL_IO; if (!strcmp ("LEVEL_ALL", str)) return PTT_LEVEL_ALL; if (!strncmp ("LEVEL_THREAD", str, strlen("LEVEL_THREAD"))) { if (!strcmp("LEVEL_THREAD_IO", str)) return PTT_LEVEL_THREAD_IO; else if (!strcmp ("LEVEL_THREAD_ALL", str)) return (PTT_LEVEL_THREAD | PTT_LEVEL_THREAD_IO); WARNING(str); } if (!strncmp ("LEVEL_BARRIER", str, strlen("LEVEL_BARRIER"))) { if (!strcmp("LEVEL_BARRIER_IO", str)) return PTT_LEVEL_BARRIER_IO; else if (!strcmp ("LEVEL_BARRIER_ALL", str)) return (PTT_LEVEL_BARRIER | PTT_LEVEL_BARRIER_IO); WARNING(str); } if (!strncmp ("LEVEL_MUTEX", str, strlen("LEVEL_MUTEX"))) { if (!strcmp("LEVEL_MUTEX_IO", str)) return PTT_LEVEL_MUTEX_IO; else if (!strcmp ("LEVEL_MUTEX_ALL", str)) return (PTT_LEVEL_MUTEX | PTT_LEVEL_MUTEX_IO); WARNING(str); } if (!strncmp ("LEVEL_COND", str, strlen("LEVEL_COND"))) { if (!strcmp("LEVEL_COND_IO", str)) return PTT_LEVEL_COND_IO; else if (!strcmp ("LEVEL_COND_ALL", str)) return (PTT_LEVEL_COND | PTT_LEVEL_COND_IO); WARNING(str); } if (!strncmp ("LEVEL_SEM", str, strlen("LEVEL_SEM"))) { if (!strcmp("LEVEL_SEM_IO", str)) return PTT_LEVEL_SEM_IO; else if (!strcmp ("LEVEL_SEM_ALL", str)) return (PTT_LEVEL_SEM | PTT_LEVEL_SEM_IO); WARNING(str); } WARNING(str);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -