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

📄 fops.c

📁 这是一个C的源代码
💻 C
字号:
#include <assert.h>#include <stdio.h>#include "pbc_fops.h"#include "pbc_tracker.h"static int getc_from_buf (void *ctx);static int ungetc_into_buf (int c, void *ctx);static int getc_from_str (void *ctx);static int ungetc_into_str (int c, void *ctx);struct fetch_ops_s fops_buf = { getc_from_buf, ungetc_into_buf };struct fetch_ops_s fops_str = { getc_from_str, ungetc_into_str };static intgetc_from_buf (void *ctx){   assert (ctx);   tracker_t *t = (tracker_t *) ctx;   if (t->p == t->end) { return EOF; }   return *t->p++;}static intungetc_into_buf (int c, void *ctx){   assert (ctx);   tracker_t *t = (tracker_t *) ctx;   if (c == EOF) { return EOF; }   if (t->base == t->p) { return EOF; }   t->p--;   return c;}static intgetc_from_str (void *ctx){   assert (ctx);   return fgetc ((FILE *) ctx);}static intungetc_into_str (int c, void *ctx){   assert (ctx);   return ungetc (c, (FILE *) ctx);}

⌨️ 快捷键说明

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