Changeset 327 for devel/5.X/pbs_wrap.c


Ignore:
Timestamp:
03/09/15 16:28:14 (9 years ago)
Author:
bas
Message:

some small improvements but no working rm interface

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/5.X/pbs_wrap.c

    r324 r327  
    30143014    and fill in the next fields so it also works for the C-library
    30153015  */
    3016   printf("basje \n");
     3016
     3017  if (SARA_DEBUG)
     3018  {
     3019     printf("new_attrl \n");
     3020  }
    30173021  ptr = (struct attrl *) malloc(number * sizeof(struct attrl));
    30183022
     
    30213025  for (i=0; i < number; i++)
    30223026  {
    3023     printf("constructor called\n");
     3027    // printf("constructor called\n");
    30243028    current->name     = (char *) malloc(MAXNAMLEN * sizeof(char));
    30253029    current->resource = (char *) malloc(MAXNAMLEN * sizeof(char));
     
    30583062  for (i=0; i < number; i++)
    30593063  {
    3060     printf("constructor called\n");
     3064    // printf("constructor called\n");
    30613065    current->name     = (char *) malloc(MAXNAMLEN * sizeof(char));
    30623066    current->resource = (char *) malloc(MAXNAMLEN * sizeof(char));
     
    55505554  char *buf4 = 0 ;
    55515555  int alloc4 = 0 ;
    5552   void *argp5 = 0 ;
    5553   int res5 = 0 ;
    55545556  int res6 ;
    55555557  char *buf6 = 0 ;
     
    55845586  }
    55855587  arg4 = (char *)(buf4);
    5586   res5 = SWIG_ConvertPtr(obj4, &argp5,SWIGTYPE_p_attropl, 0 |  0 );
    5587   if (!SWIG_IsOK(res5)) {
    5588     SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "pbs_manager" "', argument " "5"" of type '" "struct attropl *""'");
    5589   }
    5590   arg5 = (struct attropl *)(argp5);
     5588  {
     5589    PyObject          *py_obj;
     5590    struct attropl    *ptr, *prev;
     5591    char              s[255];
     5592    int               i=0, size=0;
     5593   
     5594    // printf("Python --> C\n");
     5595   
     5596    if (SARA_DEBUG) printf("Converteren python -> c (struct attropl *):\n");
     5597   
     5598    size = Get_List_Size(obj4);
     5599   
     5600    if (SARA_DEBUG) printf("\tSize attropl List: %d\n", size);
     5601   
     5602    if ( size == -1 ) {
     5603      PyErr_SetString(PyExc_TypeError, "not a list");
     5604      return NULL;
     5605    }
     5606    //printf("Size = %d\n", size);
     5607   
     5608    if (SARA_DEBUG) printf("\t<Contents>\n");
     5609   
     5610    arg5 = prev = NULL;
     5611    for ( i=0; i < size; i++ ) {
     5612      py_obj = PyList_GetItem(obj4, i);
     5613      if (SWIG_ConvertPtr(py_obj, (void **) &ptr, SWIGTYPE_p_attropl, 1)) {
     5614        sprintf(s,"list item %d has wrong type", i);
     5615        PyErr_SetString(PyExc_TypeError, s);
     5616        return NULL;
     5617       
     5618        // This will skipp the wrong entry
     5619        // continue;
     5620      }
     5621     
     5622      /*
     5623           * Make first entry head of C linked list
     5624          */
     5625      if ( i == 0) {
     5626        arg5 = ptr;
     5627        ptr->next = prev;
     5628      }
     5629      else {
     5630        prev->next = ptr;
     5631        ptr->next = NULL;
     5632      }
     5633      prev = ptr;
     5634     
     5635    } // end for
     5636    if (SARA_DEBUG) printf("\t</Contents>\n");
     5637  }
    55915638  res6 = SWIG_AsCharPtrAndSize(obj5, &buf6, NULL, &alloc6);
    55925639  if (!SWIG_IsOK(res6)) {
     
    63096356  PyObject *resultobj = 0;
    63106357  struct batch_status *arg1 = (struct batch_status *) 0 ;
    6311   void *argp1 = 0 ;
    6312   int res1 = 0 ;
    63136358  PyObject * obj0 = 0 ;
    63146359 
    63156360  if (!PyArg_ParseTuple(args,(char *)"O:pbs_statfree",&obj0)) SWIG_fail;
    6316   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_batch_status, 0 |  0 );
    6317   if (!SWIG_IsOK(res1)) {
    6318     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pbs_statfree" "', argument " "1"" of type '" "struct batch_status *""'");
    6319   }
    6320   arg1 = (struct batch_status *)(argp1);
     6361  {
     6362    PyObject              *py_obj;
     6363    struct batch_status   *ptr, *prev;
     6364    char                  s[255];
     6365    int                   i=0, size=0;
     6366   
     6367    // printf("Python --> C\n");
     6368   
     6369    if (SARA_DEBUG) printf("Converteren python -> c (struct batch_status *):\n");
     6370   
     6371    size = Get_List_Size(obj0);
     6372    if (SARA_DEBUG) printf("\tSize of batch_status list: %d\n", size);
     6373   
     6374    if ( size == -1 ) {
     6375      PyErr_SetString(PyExc_TypeError, "not a list");
     6376      return NULL;
     6377    }
     6378    // printf("Size = %d\n", size);
     6379   
     6380    if (SARA_DEBUG) printf("\t<Contents>\n");
     6381   
     6382    arg1 = prev = NULL;
     6383    for ( i=0; i < size; i++ ) {
     6384      py_obj = PyList_GetItem(obj0, i);
     6385      if (SWIG_ConvertPtr(py_obj, (void **) &ptr, SWIGTYPE_p_batch_status, 1)) {
     6386        sprintf(s,"list item %d has wrong type", i);
     6387        PyErr_SetString(PyExc_TypeError, s);
     6388        return NULL;
     6389       
     6390        // This will skipp the wrong entry
     6391        // continue;
     6392      }
     6393     
     6394      /*
     6395           * Make first entry head of C linked list
     6396          */
     6397      if ( i == 0) {
     6398        arg1 = ptr;
     6399        ptr->next = prev;
     6400      }
     6401      else {
     6402        prev->next = ptr;
     6403        ptr->next = NULL;
     6404      }
     6405     
     6406      if (SARA_DEBUG) printf("\t\t- %s\n", ptr->name);
     6407      prev = ptr;
     6408     
     6409    } // end for
     6410   
     6411    if (SARA_DEBUG) printf("\t</Contents>\n");
     6412  }
    63216413  pbs_statfree(arg1);
    63226414  resultobj = SWIG_Py_Void();
     
    69297021  int val1 ;
    69307022  int ecode1 = 0 ;
    6931   void *argp2 = 0 ;
    6932   int res2 = 0 ;
    69337023  int res3 ;
    69347024  char *buf3 = 0 ;
     
    69537043  }
    69547044  arg1 = (int)(val1);
    6955   res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_attropl, 0 |  0 );
    6956   if (!SWIG_IsOK(res2)) {
    6957     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pbs_submit" "', argument " "2"" of type '" "struct attropl *""'");
    6958   }
    6959   arg2 = (struct attropl *)(argp2);
     7045  {
     7046    PyObject          *py_obj;
     7047    struct attropl    *ptr, *prev;
     7048    char              s[255];
     7049    int               i=0, size=0;
     7050   
     7051    // printf("Python --> C\n");
     7052   
     7053    if (SARA_DEBUG) printf("Converteren python -> c (struct attropl *):\n");
     7054   
     7055    size = Get_List_Size(obj1);
     7056   
     7057    if (SARA_DEBUG) printf("\tSize attropl List: %d\n", size);
     7058   
     7059    if ( size == -1 ) {
     7060      PyErr_SetString(PyExc_TypeError, "not a list");
     7061      return NULL;
     7062    }
     7063    //printf("Size = %d\n", size);
     7064   
     7065    if (SARA_DEBUG) printf("\t<Contents>\n");
     7066   
     7067    arg2 = prev = NULL;
     7068    for ( i=0; i < size; i++ ) {
     7069      py_obj = PyList_GetItem(obj1, i);
     7070      if (SWIG_ConvertPtr(py_obj, (void **) &ptr, SWIGTYPE_p_attropl, 1)) {
     7071        sprintf(s,"list item %d has wrong type", i);
     7072        PyErr_SetString(PyExc_TypeError, s);
     7073        return NULL;
     7074       
     7075        // This will skipp the wrong entry
     7076        // continue;
     7077      }
     7078     
     7079      /*
     7080           * Make first entry head of C linked list
     7081          */
     7082      if ( i == 0) {
     7083        arg2 = ptr;
     7084        ptr->next = prev;
     7085      }
     7086      else {
     7087        prev->next = ptr;
     7088        ptr->next = NULL;
     7089      }
     7090      prev = ptr;
     7091     
     7092    } // end for
     7093    if (SARA_DEBUG) printf("\t</Contents>\n");
     7094  }
    69607095  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
    69617096  if (!SWIG_IsOK(res3)) {
     
    75227657  int val1 ;
    75237658  int ecode1 = 0 ;
    7524   void *argp2 = 0 ;
     7659  int temp2 ;
    75257660  int res2 = 0 ;
    75267661  int res3 ;
     
    75387673  }
    75397674  arg1 = (int)(val1);
    7540   res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_int, 0 |  0 );
    7541   if (!SWIG_IsOK(res2)) {
    7542     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "addreq_err" "', argument " "2"" of type '" "int *""'");
    7543   }
    7544   arg2 = (int *)(argp2);
     7675  if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
     7676    int val;
     7677    int ecode = SWIG_AsVal_int(obj1, &val);
     7678    if (!SWIG_IsOK(ecode)) {
     7679      SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "addreq_err" "', argument " "2"" of type '" "int""'");
     7680    }
     7681    temp2 = (int)(val);
     7682    arg2 = &temp2;
     7683    res2 = SWIG_AddTmpMask(ecode);
     7684  }
    75457685  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
    75467686  if (!SWIG_IsOK(res3)) {
     
    75507690  result = (int)addreq_err(arg1,arg2,arg3);
    75517691  resultobj = SWIG_From_int((int)(result));
     7692  if (SWIG_IsTmpObj(res2)) {
     7693    resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg2)));
     7694  } else {
     7695    int new_flags = SWIG_IsNewObj(res2) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
     7696    resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg2), SWIGTYPE_p_int, new_flags));
     7697  }
    75527698  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
    75537699  return resultobj;
     
    76617807  int *arg1 = (int *) 0 ;
    76627808  int arg2 ;
    7663   void *argp1 = 0 ;
     7809  int temp1 ;
    76647810  int res1 = 0 ;
    76657811  int val2 ;
     
    76707816 
    76717817  if (!PyArg_ParseTuple(args,(char *)"OO:getreq_err",&obj0,&obj1)) SWIG_fail;
    7672   res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_int, 0 |  0 );
    7673   if (!SWIG_IsOK(res1)) {
    7674     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "getreq_err" "', argument " "1"" of type '" "int *""'");
    7675   }
    7676   arg1 = (int *)(argp1);
     7818  if (!(SWIG_IsOK((res1 = SWIG_ConvertPtr(obj0,SWIG_as_voidptrptr(&arg1),SWIGTYPE_p_int,0))))) {
     7819    int val;
     7820    int ecode = SWIG_AsVal_int(obj0, &val);
     7821    if (!SWIG_IsOK(ecode)) {
     7822      SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "getreq_err" "', argument " "1"" of type '" "int""'");
     7823    }
     7824    temp1 = (int)(val);
     7825    arg1 = &temp1;
     7826    res1 = SWIG_AddTmpMask(ecode);
     7827  }
    76777828  ecode2 = SWIG_AsVal_int(obj1, &val2);
    76787829  if (!SWIG_IsOK(ecode2)) {
     
    76827833  result = (char *)getreq_err(arg1,arg2);
    76837834  resultobj = SWIG_FromCharPtr((const char *)result);
     7835  if (SWIG_IsTmpObj(res1)) {
     7836    resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg1)));
     7837  } else {
     7838    int new_flags = SWIG_IsNewObj(res1) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
     7839    resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg1), SWIGTYPE_p_int, new_flags));
     7840  }
    76847841  return resultobj;
    76857842fail:
Note: See TracChangeset for help on using the changeset viewer.