📄 control.c
字号:
#include "str.h"#include "error.h"#include "hash.h"#include "nat.h"#include "control.h"int controlBfs = 0;static str dashBfs;int controlDfs = 0;static str dashDfs;int controlKeepDot = 0;static str dashDot;int controlKeepS = 0;static str dashS;static hash hashAll;static void neg (nat n);static void controlInit ();static void neg (nat n){ int *p = (int *) (natToInt (n)); switch (*p) { case 0: { *p = 1; break; }; case 1: { *p = 0; break; }; default: exception ("invalid argument: control.c\n"); } //return 0;}static void controlInit (){ hashAll = newHash (); dashBfs = newStr ("-bfs"); hashInsert (hashAll, dashBfs, newNat ((int)&controlBfs)); dashDfs = newStr ("-dfs"); hashInsert (hashAll, dashDfs, newNat ((int)&controlDfs)); dashDot = newStr ("-dot"); hashInsert (hashAll, dashDot, newNat ((int)&controlKeepDot)); dashS = newStr ("-S"); hashInsert (hashAll, dashS, newNat ((int)&controlKeepS)); return;}void controlArgs (int argc, char *argv[]){ controlInit (); for (int i=1; i<argc; i++) { str current = newStr (argv[i]); nat n = hashLookup (hashAll, current); if (!n) { strOutput (current); exception (": no this argument\n"); } neg (n); } return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -