Ignore:
Timestamp:
Jul 31, 2018 2:36:52 AM (6 years ago)
Author:
Torin Cooper-Bennun <torin.cooper-bennun@…>
Branches:
ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
d9b7197
Parents:
3067196
git-author:
Torin Cooper-Bennun <torin.cooper-bennun@…> (07/30/18 08:35:02)
git-committer:
Torin Cooper-Bennun <torin.cooper-bennun@…> (07/31/18 02:36:52)
Message:

Cherry-pick changes from master for tinycc compatibility (note: tinycc compilation not yet supported fully):

144e032af2 tinycc doesn't return structures, so must pass return structure as pointer
a1daf86c0d hack around broken isfinite/isnan in tinycc
7e82256ecb declare all variables at the start of the block so C89 compilers don't complain

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sascalc/calculator/c_extensions/sld2i_module.c

    r3010f68 rf54e82cf  
    44#include <Python.h> 
    55#include <stdio.h> 
    6 #include <sld2i.h> 
     6#include "sld2i.h" 
    77 
    88#if PY_MAJOR_VERSION < 3 
     
    6868        double outspin; 
    6969        double stheta; 
     70        GenI *sld2i; 
    7071 
    7172        if (!PyArg_ParseTuple(args, "iOOOOOOOOddd", &n_pix, &x_val_obj, &y_val_obj, &z_val_obj, &sldn_val_obj, &mx_val_obj, &my_val_obj, &mz_val_obj, &vol_pix_obj, &inspin, &outspin, &stheta)) return NULL; 
     
    7879        OUTVECTOR(mz_val_obj, mz_val, n_x); 
    7980        OUTVECTOR(vol_pix_obj, vol_pix, n_x); 
    80         GenI* sld2i =  PyMem_Malloc(sizeof(GenI)); 
     81        sld2i =  PyMem_Malloc(sizeof(GenI)); 
    8182        if (sld2i != NULL) { 
    8283                initGenI(sld2i, n_pix,x_val,y_val,z_val,sldn_val,mx_val,my_val,mz_val,vol_pix,inspin,outspin,stheta); 
     
    9899        double *I_out; 
    99100        PyObject *gen_obj; 
     101        GenI *sld2i; 
    100102 
    101103        if (!PyArg_ParseTuple(args, "OiOOO",  &gen_obj, &npoints, &qx_obj, &qy_obj, &I_out_obj)) return NULL; 
     
    108110 
    109111        // Set the array pointers 
    110         GenI* sld2i = (GenI *)PyCapsule_GetPointer(gen_obj, "GenI"); 
     112        sld2i = (GenI *)PyCapsule_GetPointer(gen_obj, "GenI"); 
    111113 
    112114        genicomXY(sld2i, npoints, qx, qy, I_out); 
     
    126128        double *I_out; 
    127129        PyObject *gen_obj; 
     130        GenI *sld2i; 
    128131 
    129132        if (!PyArg_ParseTuple(args, "OiOO",  &gen_obj, &npoints, &q_obj, &I_out_obj)) return NULL; 
     
    135138 
    136139        // Set the array pointers 
    137         GenI *sld2i = (GenI *)PyCapsule_GetPointer(gen_obj, "GenI"); 
     140        sld2i = (GenI *)PyCapsule_GetPointer(gen_obj, "GenI"); 
    138141 
    139142        genicom(sld2i, npoints, q, I_out); 
Note: See TracChangeset for help on using the changeset viewer.