c - 如何在 C 中调用 “@” at-symbol 引用?

标签 c language-features

看过 Fossil 的代码 [ https://fossil-scm.org/home/annotate?filename=src/schema.c&checkin=b03652382a327740 L27..]:

    /*
    ** The database schema for the ~/.fossil configuration database.
    */
    const char zConfigSchema[] =
    @ -- This file contains the schema for the database that is kept in the
    @ -- ~/.fossil file and that stores information about the users setup.
    @ --
    @ CREATE TABLE global_config(
    @   name TEXT PRIMARY KEY,
    @   value TEXT
    @ );
    @
    @ -- Identifier for this file type.
    @ -- The integer is the same as 'FSLG'.
    @ PRAGMA application_id=252006675;
    ;

我想知道 @... 语法的用途是什么。我以前从未见过它,也不知道如何调用它,在网上搜索它。 “C 中的字符串文字扩展”和各种改写都没有结果。

尽管这个问题很琐碎,但为了更好地被发现,请考虑留下它。谢谢。

最佳答案

来自项目的“BUILD.txt”:

  • Most *.c source files are preprocessed using a program called "translate". The sources to translate are found in src/translate.c. A header comment in src/translate.c explains in detail what it does.

更多信息可以直接在 referenced file 找到,但它似乎用于更好地处理 C 中的 CGI 功能,特别是在生成 HTML 方面。

“src/translate.c”中提供的概要如下:

** Input lines that begin with the "@" character are translated into
** either cgi_printf() statements or string literals and the
** translated code is written on standard output.
**
** The problem this program is attempt to solve is as follows: When
** writing CGI programs in C, we typically want to output a lot of HTML
** text to standard output. In pure C code, this involves doing a
** printf() with a big string containing all that text. But we have
** to insert special codes (ex: \n and \") for many common characters,
** which interferes with the readability of the HTML.
**
** This tool allows us to put raw HTML, without the special codes, in
** the middle of a C program. This program then translates the text
** into standard C by inserting all necessary backslashes and other
** punctuation.

关于c - 如何在 C 中调用 “@” at-symbol 引用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57183799/

相关文章:

c - 通过指向第一个元素的指针访问二维数组

c - 不使用指针返回多个值的函数

java - block 内的类 - 这在哪里有意义?

language-design - 为什么std.parallel中没有 'forall'?

c - 链表图实现中 Dijkstra 算法的大问题

c - 如果带有 char 的语句在 C 中不起作用

将Ascii代码文件转换为二进制文件

c# - C# 4.0 以后应该有哪些特性来鼓励从 Java 转换?

Python ? (条件/三元)赋值运算符

language-features - 对于年轻的初学者来说,编程语言中哪些特性很重要?