Back to index

texmacs  1.0.7.15
Defines | Functions
dpxfile.h File Reference
#include "mfileio.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define DPX_CONFIG_FILE   "dvipdfmx.cfg"
#define DPX_RES_TYPE_FONTMAP   0x00
#define DPX_RES_TYPE_T1FONT   0x10
#define DPX_RES_TYPE_TTFONT   0x11
#define DPX_RES_TYPE_OTFONT   0x12
#define DPX_RES_TYPE_PKFONT   0x13
#define DPX_RES_TYPE_DFONT   0x14
#define DPX_RES_TYPE_ENC   0x20
#define DPX_RES_TYPE_CMAP   0x21
#define DPX_RES_TYPE_SFD   0x22
#define DPX_RES_TYPE_AGL   0x23
#define DPX_RES_TYPE_ICCPROFILE   0x30
#define DPX_RES_TYPE_BINARY   0x40
#define DPX_RES_TYPE_TEXT   0x41
#define DPXFOPEN(n, t)   dpx_open_file((const char *)(n),(t))
#define DPXFCLOSE(f)   MFCLOSE((f))

Functions

FILE * dpx_open_file (const char *filename, int type)
void dpx_file_set_verbose (void)
int dpx_file_apply_filter (const char *cmdtmpl, const char *input, const char *output, unsigned short version)
char * dpx_create_temp_file (void)
void dpx_delete_temp_file (char *tmp)

Define Documentation

#define DPX_CONFIG_FILE   "dvipdfmx.cfg"

Definition at line 28 of file dpxfile.h.

#define DPX_RES_TYPE_AGL   0x23

Definition at line 41 of file dpxfile.h.

#define DPX_RES_TYPE_BINARY   0x40

Definition at line 45 of file dpxfile.h.

#define DPX_RES_TYPE_CMAP   0x21

Definition at line 39 of file dpxfile.h.

#define DPX_RES_TYPE_DFONT   0x14

Definition at line 36 of file dpxfile.h.

#define DPX_RES_TYPE_ENC   0x20

Definition at line 38 of file dpxfile.h.

#define DPX_RES_TYPE_FONTMAP   0x00

Definition at line 30 of file dpxfile.h.

#define DPX_RES_TYPE_ICCPROFILE   0x30

Definition at line 43 of file dpxfile.h.

#define DPX_RES_TYPE_OTFONT   0x12

Definition at line 34 of file dpxfile.h.

#define DPX_RES_TYPE_PKFONT   0x13

Definition at line 35 of file dpxfile.h.

#define DPX_RES_TYPE_SFD   0x22

Definition at line 40 of file dpxfile.h.

#define DPX_RES_TYPE_T1FONT   0x10

Definition at line 32 of file dpxfile.h.

#define DPX_RES_TYPE_TEXT   0x41

Definition at line 46 of file dpxfile.h.

#define DPX_RES_TYPE_TTFONT   0x11

Definition at line 33 of file dpxfile.h.

#define DPXFCLOSE (   f)    MFCLOSE((f))

Definition at line 52 of file dpxfile.h.

#define DPXFOPEN (   n,
 
)    dpx_open_file((const char *)(n),(t))

Definition at line 51 of file dpxfile.h.


Function Documentation

char* dpx_create_temp_file ( void  )

Definition at line 678 of file dpxfile.c.

{
  char  *tmp = NULL;

#if   defined(MIKTEX)
  {
    tmp = NEW(_MAX_PATH + 1, char);
    miktex_create_temp_file_name(tmp); /* FIXME_FIXME */
  }
#elif defined(HAVE_MKSTEMP)
#  define __TMPDIR     "/tmp"
#  define TEMPLATE     "/dvipdfmx.XXXXXX"
  {
    char *_tmpd;
    int   _fd = -1;
#  ifdef  HAVE_GETENV
    _tmpd = getenv("TMPDIR");
    if (!_tmpd)
      _tmpd = (char *) __TMPDIR;
#  else
    _tmpd = (char *) __TMPDIR;
#  endif /* HAVE_GETENV */
    tmp = NEW(strlen(_tmpd) + strlen(TEMPLATE) + 1, char);
    strcpy(tmp, _tmpd);
    strcat(tmp, TEMPLATE);
    _fd  = mkstemp(tmp);
    if (_fd != -1)
#ifdef WIN32
      _close(_fd);
#else
      close(_fd);
#endif /* WIN32 */
    else {
      RELEASE(tmp);
      tmp = NULL;
    }
  }
#else /* use tmpnam */
  {
    char *_tmpa = NEW(L_tmpnam + 1, char);
    tmp = tmpnam(_tmpa);
    if (!tmp)
      RELEASE(_tmpa);
  }
#endif /* MIKTEX */

  return  tmp;
}

Here is the caller graph for this function:

void dpx_delete_temp_file ( char *  tmp)

Definition at line 728 of file dpxfile.c.

{
  if (!tmp)
    return;
  remove (tmp);
  RELEASE(tmp);

  return;
}

Here is the caller graph for this function:

int dpx_file_apply_filter ( const char *  cmdtmpl,
const char *  input,
const char *  output,
unsigned short  version 
)

Definition at line 748 of file dpxfile.c.

{
  char   *cmd = NULL;
  char   *p, *q;
  size_t  n, size;
  int     error = 0;

  if (!cmdtmpl)
    return -1;
  else if (!input || !output)
    return -1;

  size = strlen(cmdtmpl) + strlen(input) + strlen(output) + 3;
  cmd  = NEW(size, char);
  memset(cmd, 0, size);
  for (n = 0, p = (char *) cmdtmpl; *p != 0; p++) {
#define need(s,l,m,n) \
if ((l) + (n) >= (m)) { \
  (m) += (n) + 128; \
  (s)  = RENEW((s), (m), char); \
}
    if (p[0] == '%') {
      p++;
      switch (p[0]) {
      case 'o': /* Output file name */
        need(cmd, n, size, strlen(output));
        strcpy(cmd + n, output); n += strlen(output);
        break;
      case 'i': /* Input filename */
        need(cmd, n, size, strlen(input));
        strcpy(cmd + n, input);  n += strlen(input);
        break;
      case 'b':
        need(cmd, n, size, strlen(input));
        q = strrchr(input, '.'); /* wrong */
        if (q) {
          memcpy(cmd + n, input, (int) (q - input));
          n += (int) (q - input);
        } else {
          strcpy(cmd + n, input); n += strlen(input);
        }
      case  'v': /* Version number, e.g. 1.4 */ {
       char buf[16];
       sprintf(buf, "1.%hu", version);
       need(cmd, n, size, strlen(buf));
       strcpy(cmd + n, buf);  n += strlen(buf);
       break;
      }
      case  0:
        break;
      case '%':
        need(cmd, n, size, 1);
        cmd[n] = '%'; n++;
        break;
      }
    } else {
      need(cmd, n, size, 1);
      cmd[n] = p[0]; n++;
    }
  }
  need(cmd, n, size, 1);
  cmd[n] = '\0';
  if (strlen(cmd) == 0) {
    RELEASE(cmd);
    return -1;
  }

  error = system(cmd);
  if (error)
    WARN("Filtering file via command -->%s<-- failed.", cmd);
  RELEASE(cmd);

  return  error;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void dpx_file_set_verbose ( void  )

Definition at line 43 of file dpxfile.c.

{
  verbose++;
}
FILE* dpx_open_file ( const char *  filename,
int  type 
)

Definition at line 280 of file dpxfile.c.

{
#ifdef NOKPSE
  FILE  *fp   = NULL;
  char  *fqpn = NULL;

  switch (type) {
  case DPX_RES_TYPE_FONTMAP:
    fqpn = dpx_find_fontmap_file(filename);
    break;
  case DPX_RES_TYPE_T1FONT:
    fqpn = dpx_find_type1_file(filename);
    break;
  case DPX_RES_TYPE_TTFONT:
    fqpn = dpx_find_truetype_file(filename);
    break;
  case DPX_RES_TYPE_OTFONT:
    fqpn = dpx_find_opentype_file(filename);
    break;
  case DPX_RES_TYPE_PKFONT:
    break;
  case DPX_RES_TYPE_CMAP:
    fqpn = dpx_find_cmap_file(filename);
    break;
  case DPX_RES_TYPE_ENC:
    fqpn = dpx_find_enc_file(filename);
    break;
  case DPX_RES_TYPE_SFD:
    fqpn = dpx_find_sfd_file(filename);
    break;
  case DPX_RES_TYPE_AGL:
    fqpn = dpx_find_agl_file(filename);
    break;
  case DPX_RES_TYPE_ICCPROFILE:
    fqpn = dpx_find_iccp_file(filename);
    break;
  case DPX_RES_TYPE_DFONT:
    fqpn = dpx_find_dfont_file(filename);
    break;
  case DPX_RES_TYPE_BINARY:
    fqpn = dpx_find__app__xyz(filename, "", 0);
    break;
  case DPX_RES_TYPE_TEXT:
    fqpn = dpx_find__app__xyz(filename, "", 1);
    break;
  default:
    ERROR("Unknown resource type: %d", type);
    break;
  }
  if (fqpn) {
    fp = MFOPEN(fqpn, FOPEN_RBIN_MODE);
    RELEASE(fqpn);
  }

  return  fp;
#else
  return NULL;
#endif
}

Here is the call graph for this function: