"Fossies" - the Fresh Open Source Software Archive

Member "gamgi0.17.5x/src/io/gamgi_io.h" (25 Feb 2022, 10447 Bytes) of package /linux/misc/gamgi-all-0.17.5x.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "gamgi_io.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 0.17.4x_vs_0.17.5x.

    1 /*******************************************
    2  *
    3  * $GAMGI/src/io/gamgi_io.h
    4  *
    5  * Copyright (C) 2001, 2004 Carlos Pereira
    6  *
    7  * Distributed under the terms of the GNU
    8  * General Public License: $GAMGI/LICENSE
    9  *
   10  */
   11 
   12 #ifndef GAMGI_IO
   13 #define GAMGI_IO
   14 
   15 /******** libraries *******
   16  **************************/
   17 
   18 #include <unistd.h>
   19 #include <ft2build.h>
   20 #include FT_GLYPH_H
   21 #include FT_OUTLINE_H
   22 
   23 /********************************************
   24  * This type defines pointers to functions  *
   25  * used to parse files, one for each format *
   26  *********************************************/
   27 
   28 typedef gamgi_bool (* gamgi_parser) (int fd,
   29 char *body, int size, void *data);
   30 
   31 /**************************************
   32  * structure used to import xyz files *
   33  **************************************/
   34 
   35 typedef struct _gamgi_xyz {
   36 gamgi_window *window;
   37 char *filename;
   38 int fileline;
   39 gamgi_molecule *molecule;
   40 int count;
   41 } gamgi_xyz;
   42 
   43 /**************************************************
   44  * structure used to render extruded fonts:       *
   45  * dynamic arrays cannot be used to save vertices *
   46  * and extra, because addresses must be preserved *
   47  **************************************************/
   48 
   49 typedef struct _gamgi_extruded {
   50 FT_Outline_Funcs horizontal, vertical;
   51 GLUtesselator* tesselator;
   52 
   53 gamgi_slist *vertices, *extra;
   54 gamgi_darray *contour, *normals;
   55 
   56 double last[3];
   57 double delta1, delta2, delta3, scale;
   58 int normal_x, normal_y;
   59 gamgi_bool open; } gamgi_extruded;
   60 
   61 /********** enumerations **********
   62  **********************************/
   63 
   64 /************************************************************
   65  * All GAMGI enumerations start at 1 and share FALSE for 0. *
   66  ************************************************************/
   67 
   68 /*******************************************************************
   69  * Extruded (Solid) and Stroked (Wired) fonts implemented in GAMGI *
   70  *******************************************************************/
   71 
   72 enum { GAMGI_IO_SUN_ROMAN = 1, GAMGI_IO_SUN_ROMAN_MONO,
   73 GAMGI_IO_HERSHEY_SANS, GAMGI_IO_HERSHEY_SANS_BOLD,
   74 GAMGI_IO_HERSHEY_SERIF, GAMGI_IO_HERSHEY_SERIF_BOLD,
   75 GAMGI_IO_HERSHEY_SCRIPT, GAMGI_IO_HERSHEY_SCRIPT_BOLD, 
   76 GAMGI_IO_HERSHEY_GOTHIC_ENGLISH, GAMGI_IO_HERSHEY_GOTHIC_GERMAN, 
   77 GAMGI_IO_HERSHEY_GOTHIC_ITALIAN, GAMGI_IO_HERSHEY_SYMBOL_SANS,
   78 GAMGI_IO_HERSHEY_SYMBOL_SERIF, GAMGI_IO_HERSHEY_SYMBOL_SERIF_BOLD,
   79 
   80 GAMGI_IO_DEJAVU_SANS, GAMGI_IO_DEJAVU_SANS_BOLD,
   81 GAMGI_IO_DEJAVU_SANS_ITALIC, GAMGI_IO_DEJAVU_SANS_BOLD_ITALIC,
   82 GAMGI_IO_DEJAVU_SERIF, GAMGI_IO_DEJAVU_SERIF_BOLD,
   83 GAMGI_IO_DEJAVU_SERIF_ITALIC, GAMGI_IO_DEJAVU_SERIF_BOLD_ITALIC,
   84 GAMGI_IO_DEJAVU_MONO, GAMGI_IO_DEJAVU_MONO_BOLD,
   85 GAMGI_IO_DEJAVU_MONO_ITALIC, GAMGI_IO_DEJAVU_MONO_BOLD_ITALIC };
   86 
   87 /************* macros ************
   88  *********************************/
   89 
   90 /*****************************************
   91  * BUFSIZ is a standard buffer size,     *
   92  * often 8192, mentioned for example     *
   93  * by Dennis Ritchie and Brian Kernighan *
   94  * in "The ANSI C Programming Language." *
   95  *****************************************/
   96 
   97 #define GAMGI_IO_BUFFER BUFSIZ
   98 
   99 /*******************************
  100  * this is the data shown in   *
  101  * the Gamgi->About GUI dialog *
  102  *******************************/
  103 
  104 #define GAMGI_IO_DATE "25th February 2022"
  105 #define GAMGI_IO_VERSION "0.17.5x"
  106 #define GAMGI_IO_AUTHORS "Carlos Pereira et al."
  107 #define GAMGI_IO_LICENSE "GPL"
  108 #define GAMGI_IO_WEBSITE "http://www.gamgi.org/"
  109 
  110 /*****************************************
  111  * used to build local,remote Help paths *
  112  *****************************************/
  113 
  114 #define GAMGI_IO_PATH_LOCAL ""
  115 #define GAMGI_IO_PATH_REMOTE GAMGI_IO_WEBSITE
  116 
  117 /***************************
  118  * current GML identifiers *
  119  ***************************/
  120 
  121 #define GAMGI_IO_GML_SYSTEM "http://www.gamgi.org/dtd/gamgi.dtd"
  122 #define GAMGI_IO_GML_PUBLIC ""
  123 #define GAMGI_IO_GML_GMLNS ""
  124 
  125 /********************************
  126  * Strict XHTML 1.0 identifiers *
  127  ********************************/
  128 
  129 #define GAMGI_IO_HTML_PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  130 #define GAMGI_IO_HTML_SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
  131 #define GAMGI_IO_HTML_XMLNS "http://www.w3.org/1999/xhtml"
  132 
  133 /***********************
  134  * X3D 3.1 identifiers *
  135  ***********************/
  136 
  137 #define GAMGI_IO_X3D_PUBLIC "ISO//Web3D//DTD X3D 3.1//EN"
  138 #define GAMGI_IO_X3D_SYSTEM "http://www.web3d.org/specifications/x3d-3.1.dtd"
  139 #define GAMGI_IO_X3D_PROFILE "Immersive"
  140 #define GAMGI_IO_X3D_VERSION "3.1"
  141 
  142 /********************************
  143  * These are the maximum number *
  144  * of characters that can be    *
  145  * used to designate files:     *
  146  * 1) the fullname, including   *
  147  *   protocol, hostname,        *
  148  *   pathname and filename;     *
  149  * 2) the filename only;        *
  150  * 3) the pathname used in:     *
  151  *    gamgi->help->local,       *
  152  *    gamgi->help->remote,      *
  153  *    gamgi->help->browser      *
  154  ********************************/
  155 
  156 #define GAMGI_IO_FULLNAME 150
  157 #define GAMGI_IO_SHORTNAME 50
  158 #define GAMGI_IO_PATHNAME 100
  159 
  160 #define GAMGI_IO_TITLE_FONT "-misc-fixed-medium-r-*-*-*-140-*-*-*-*-*-*"
  161 
  162 /**************************************************************************
  163  * valid characters in alphanumeric tokens in GAMGI dialogs and GML files *
  164  **************************************************************************/
  165 
  166 #define GAMGI_IO_TEXT \
  167 "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()[]{}<>_.+-"
  168 
  169 /******************************************
  170  * valid characters in GAMGI text objects *
  171  ******************************************/
  172 
  173 #define GAMGI_IO_FONT_ASCII \
  174 "\t\n !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
  175 
  176 /***************************************
  177  * valid characters in HTML Help files *
  178  ***************************************/
  179 
  180 #define GAMGI_IO_FONT_88591 \
  181 "\t\n !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
  182 
  183 /********************************************
  184  * valid characters in cell occupancy rules *
  185  ********************************************/
  186 
  187 #define GAMGI_IO_RULES "0123456789*_"
  188 
  189 /*********************************************************
  190  * valid separators in GAMGI dialogs and HTML Help files *
  191  *********************************************************/
  192 
  193 #define GAMGI_IO_DELIMITERS "\t\n "
  194 
  195 /**************************************
  196  * marks used in font data, to signal *
  197  * stroke and character termination.  *
  198  **************************************/
  199 
  200 #define GAMGI_IO_STROKE 500.0
  201 #define GAMGI_IO_CHAR 1000.0
  202 
  203 /******************************
  204  * Currently GAMGI supports   *
  205  * stroked characters with    *
  206  * ascii codes from 32 to 126 *
  207  ******************************/
  208 
  209 #define GAMGI_IO_ASCII_START 32
  210 #define GAMGI_IO_ASCII_RANGE 95
  211 
  212 /**********************************************************
  213  * number of fonts: Wired (stroked), Solid (extruded) and *
  214    Total (Wired + Solid - Common). Four fonts are common  *
  215    to both styles: Sans, Sans_Bold, Serif, Serif_Bold     *
  216  **********************************************************/
  217 
  218 #define GAMGI_IO_FONTS_WIRED 14
  219 #define GAMGI_IO_FONTS_SOLID 12
  220 #define GAMGI_IO_FONTS_TOTAL 22
  221 
  222 /*****************************************
  223  * text defaults: wired font, solid font *
  224  *****************************************/
  225 
  226 #define GAMGI_IO_TEXT_WIRED GAMGI_IO_SUN_ROMAN
  227 #define GAMGI_IO_TEXT_SOLID GAMGI_IO_DEJAVU_SANS
  228 
  229 /**********************************************
  230  * Truetype fonts: default path and filenames *
  231  **********************************************/
  232 
  233 #define GAMGI_IO_PATH_TRUETYPE "/usr/share/fonts/truetype/ttf-dejavu/"
  234 
  235 #define GAMGI_IO_FILENAME_DEJAVU_SANS "DejaVuSans.ttf"
  236 #define GAMGI_IO_FILENAME_DEJAVU_SANS_BOLD "DejaVuSans-Bold.ttf"
  237 #define GAMGI_IO_FILENAME_DEJAVU_SANS_ITALIC "DejaVuSans-Oblique.ttf"
  238 #define GAMGI_IO_FILENAME_DEJAVU_SANS_BOLD_ITALIC "DejaVuSans-BoldOblique.ttf"
  239 #define GAMGI_IO_FILENAME_DEJAVU_SERIF "DejaVuSerif.ttf"
  240 #define GAMGI_IO_FILENAME_DEJAVU_SERIF_BOLD "DejaVuSerif-Bold.ttf"
  241 #define GAMGI_IO_FILENAME_DEJAVU_SERIF_ITALIC "DejaVuSerif-Italic.ttf"
  242 #define GAMGI_IO_FILENAME_DEJAVU_SERIF_BOLD_ITALIC "DejaVuSerif-BoldItalic.ttf"
  243 #define GAMGI_IO_FILENAME_DEJAVU_MONO "DejaVuSansMono.ttf"
  244 #define GAMGI_IO_FILENAME_DEJAVU_MONO_BOLD "DejaVuSansMono-Bold.ttf"
  245 #define GAMGI_IO_FILENAME_DEJAVU_MONO_ITALIC "DejaVuSansMono-Oblique.ttf"
  246 #define GAMGI_IO_FILENAME_DEJAVU_MONO_BOLD_ITALIC "DejaVuSansMono-BoldOblique.ttf"
  247 
  248 /*******************************
  249  * Size of the font arrays     *
  250  * in gamgi_io_font_sun.c      *
  251  * and gamgi_io_font_hershey.c *
  252  *******************************/
  253 
  254 #define GAMGI_IO_POINTS_ROMAN 2418
  255 #define GAMGI_IO_POINTS_ROMAN_MONO 2418
  256 #define GAMGI_IO_POINTS_SANS 2357
  257 #define GAMGI_IO_POINTS_SANS_BOLD 5029
  258 #define GAMGI_IO_POINTS_SERIF 4359
  259 #define GAMGI_IO_POINTS_SERIF_BOLD 7537
  260 #define GAMGI_IO_POINTS_SCRIPT 3845
  261 #define GAMGI_IO_POINTS_SCRIPT_BOLD 5423
  262 #define GAMGI_IO_POINTS_GOTHIC_ENGLISH 8667
  263 #define GAMGI_IO_POINTS_GOTHIC_GERMAN 9199
  264 #define GAMGI_IO_POINTS_GOTHIC_ITALIAN 7390
  265 #define GAMGI_IO_POINTS_SYMBOL_SANS 2629
  266 #define GAMGI_IO_POINTS_SYMBOL_SERIF 4599
  267 #define GAMGI_IO_POINTS_SYMBOL_SERIF_BOLD 7484
  268 
  269 /**********************************
  270  * codes used in the FTP protocol *
  271  * to determine if the server is  *
  272  * accepting the client requests  *
  273  **********************************/
  274 
  275 #define GAMGI_IO_FTP_GREETINGS 220
  276 #define GAMGI_IO_FTP_USER 331
  277 #define GAMGI_IO_FTP_PASSWORD 230
  278 #define GAMGI_IO_FTP_TYPE 200
  279 #define GAMGI_IO_FTP_PASSIVE 227
  280 #define GAMGI_IO_FTP_FILE 150
  281 #define GAMGI_IO_FTP_READ 226
  282 
  283 /**********************************
  284  * code used in the HTTP protocol *
  285  * to determine if the server is  *
  286  * accepting the client request   *
  287  **********************************/
  288 
  289 #define GAMGI_IO_HTTP_OK 200
  290 
  291 /************************************************
  292  * maximum color number in a ppm file: 255 (for *
  293  * 8 bits depth) or 65535 (for 16 bits depth)   *
  294  ************************************************/
  295 
  296 #define GAMGI_IO_PPM_MAX 255
  297 
  298 /********************************************
  299  * by default pnmtopng uses -compression 6  *
  300  * by default pnmtojpeg uses -quality 75    *
  301  * by default pnmtotiff uses no compression *
  302  ********************************************/
  303 
  304 #define GAMGI_IO_PNMTOPNG "pnmtopng -compression 6"
  305 #define GAMGI_IO_PNMTOJPEG "pnmtojpeg -quality 75"
  306 #define GAMGI_IO_PNMTOTIFF "pnmtotiff"
  307 
  308 #endif