1 /* pykpathsea.c: Copyright 2003 Jörg Lehmann, André Wobst
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
20 #include <kpathsea/tex-file.h>
21 #include <kpathsea/progname.h>
23 static PyObject
*py_kpse_find_file(PyObject
*self
, PyObject
*args
)
27 char *completefilename
;
28 PyObject
*returnvalue
;
30 if (PyArg_ParseTuple(args
, "si", &filename
, &kpse_file_format
)) {
31 completefilename
= kpse_find_file(filename
, (kpse_file_format_type
) kpse_file_format
, 1);
33 returnvalue
= Py_BuildValue("s", completefilename
);
34 /* XXX: free(completefilename); */
42 /* exported methods */
44 static PyMethodDef pykpathsea_methods
[] = {
45 {"find_file", py_kpse_find_file
, METH_VARARGS
},
49 #define AddInt(x) PyDict_SetItemString(dict, #x, PyInt_FromLong(x))
51 void init_pykpathsea(void)
53 PyObject
*module
= Py_InitModule("_pykpathsea", pykpathsea_methods
);
54 PyObject
*dict
= PyModule_GetDict(module
);
55 kpse_set_program_name("dvips", "dvips");
57 AddInt(kpse_gf_format
);
58 AddInt(kpse_pk_format
);
59 AddInt(kpse_any_glyph_format
);
60 AddInt(kpse_tfm_format
);
61 AddInt(kpse_afm_format
);
62 AddInt(kpse_base_format
);
63 AddInt(kpse_bib_format
);
64 AddInt(kpse_bst_format
);
65 AddInt(kpse_cnf_format
);
66 AddInt(kpse_db_format
);
67 AddInt(kpse_fmt_format
);
68 AddInt(kpse_fontmap_format
);
69 AddInt(kpse_mem_format
);
70 AddInt(kpse_mf_format
);
71 AddInt(kpse_mfpool_format
);
72 AddInt(kpse_mft_format
);
73 AddInt(kpse_mp_format
);
74 AddInt(kpse_mppool_format
);
75 AddInt(kpse_mpsupport_format
);
76 AddInt(kpse_ocp_format
);
77 AddInt(kpse_ofm_format
);
78 AddInt(kpse_opl_format
);
79 AddInt(kpse_otp_format
);
80 AddInt(kpse_ovf_format
);
81 AddInt(kpse_ovp_format
);
82 AddInt(kpse_pict_format
);
83 AddInt(kpse_tex_format
);
84 AddInt(kpse_texdoc_format
);
85 AddInt(kpse_texpool_format
);
86 AddInt(kpse_texsource_format
);
87 AddInt(kpse_tex_ps_header_format
);
88 AddInt(kpse_troff_font_format
);
89 AddInt(kpse_type1_format
);
90 AddInt(kpse_vf_format
);
91 AddInt(kpse_dvips_config_format
);
92 AddInt(kpse_ist_format
);
93 AddInt(kpse_truetype_format
);
94 AddInt(kpse_type42_format
);
95 AddInt(kpse_web2c_format
);
96 AddInt(kpse_program_text_format
);
97 AddInt(kpse_program_binary_format
);
98 AddInt(kpse_miscfonts_format
);
100 AddInt(kpse_web_format);
101 AddInt(kpse_cweb_format);