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

📄 protect.h

📁 这是TSVQ的经典实现
💻 H
字号:
/* protect.h: This is the header file for protect.c. */#ifndef _PROTECT_H#define _PROTECT_H#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <string.h>#include <errno.h>              /* this declares "errno" */#define NOF -1                  /* this is used to tell pr_alloc not to fill                                   the memory that it allocates */extern void pr_error(char *fmt, ...);extern void print_debug(double V, char *fmt, ...);extern void *pr_alloc(const size_t sz, const int fill_val);extern void pr_free(void *p);extern void *pr_realloc(void *p, const size_t sz);extern void pr_fwrite(const void *ptr, size_t size, size_t nobj, FILE *stream);extern void pr_fread(void *ptr, size_t size, size_t nobj, FILE *stream);extern char *prog_name;extern double verbosity_level;/* -------------------------------------------------- *//* Macros which open and close files.   Note: Do NOT put quotes around the mode argument. They are added   automatically. */#define OPEN(ptr, file, mode)   if ((ptr = fopen(file, #mode)) == 0)  \  				 pr_error("trouble opening " #file);#define CLOSE(ptr)  if (fclose(ptr) != 0) \  			pr_error("Trouble closing " #ptr);/* -------------------------------------------------- *//* Correctly cast the argmuments to the memcpy and memset routines: */#define PR_MEMCPY(s,ct,n)  memcpy((void *)(s), (const void *)(ct), (size_t)(n))#define PR_MEMSET(s,c,n)   memset((void *)(s), (int)(c), (size_t)(n))/* -------------------------------------------------- *//* To print strings that might possibly be null strings, use: */#define STR_VAL(x) ((x) == 0 ? "(NULL)" : (x))#define PR_ALLOC(A,B)       pr_alloc(A, B, __FILE__, __LINE__)#define PR_REALLOC(A,B)     pr_realloc(A, B, __FILE__, __LINE__)#define PR_FWRITE(A,B,C,D)  pr_fwrite(A, B, C, D,__FILE__, __LINE__)#define PR_FREAD(A,B,C,D)   pr_fread(A, B, C, D, __FILE__, __LINE__)#endif

⌨️ 快捷键说明

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