agrepy.i

来自「These files contain a port, to Python of」· I 代码 · 共 34 行

I
34
字号
%module agrepy%{#include "agrepy.h"%}%typemap(python, out) int_pair_list * {  int_pair_list *plist = $1;  PyObject *retlist, *temp_tuple, *pyint;  int i;  if(plist == NULL)    {    Py_INCREF(Py_None);    return Py_None;    }  retlist = PyList_New(plist -> npairs + 1);  for(i=0; i<= plist -> npairs; i++)    {    temp_tuple =  PyTuple_New(2);    PyTuple_SetItem(temp_tuple, 0, PyInt_FromLong(plist -> pairs[i].start));    PyTuple_SetItem(temp_tuple, 1, PyInt_FromLong(plist -> pairs[i].end));    PyList_SetItem(retlist, i, temp_tuple);    }  free(plist -> pairs);  free(plist);  return(retlist);}  param_struct *compile(char* Pattern, int patlen, int NErrors);int_pair_list *agrepy(char *pat, int patlen, char *text, int textlen, int gotoends, param_struct *parampt);

⌨️ 快捷键说明

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