Skip to content

Commit

Permalink
Move the code-generation files to a "tools" subdirectory.
Browse files Browse the repository at this point in the history
  • Loading branch information
efiring committed Apr 1, 2017
1 parent 3f94e07 commit a751cb9
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 120 deletions.
1 change: 0 additions & 1 deletion _utilities.py

This file was deleted.

226 changes: 113 additions & 113 deletions src/_ufuncs.c

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion c_header_parser.py → tools/c_header_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
"""

import re
import os

basedir = os.path.join(os.path.dirname(__file__), '../')

def get_signatures(strip_extern=True):
"""
Return a list of C function declarations.
"""
fname = "src/c_gsw/gswteos-10.h"
fname = os.path.join(basedir, "src/c_gsw/gswteos-10.h")

with open(fname) as f:
for line in f:
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 5 additions & 2 deletions make_ufuncs.py → tools/make_ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
into numpy ufuncs. Also writes ufuncs.list as a record of the
ufunc names.
"""
import os

from c_header_parser import (get_simple_sig_dict,
get_complex_scalar_dict_by_nargs_nreturns)

blacklist = ['add_barrier']

modfile_name = 'src/_ufuncs.c'
basedir = os.path.join(os.path.dirname(__file__), '../')

modfile_name = os.path.join(basedir, 'src/_ufuncs.c')

modfile_head_top = """
/*
Expand All @@ -27,7 +30,7 @@
/* possible hack for MSVC: */
#ifndef NAN
# static double NAN = 0.0/0.0;
static double NAN = 0.0/0.0;
#endif
#ifndef isnan
Expand Down
8 changes: 6 additions & 2 deletions make_wrapped_ufuncs.py → tools/make_wrapped_ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
of make_ufuncs.py.
"""

import os
import re

from _utilities import Bunch
Expand All @@ -14,9 +15,12 @@
fix_outputs_doc,
docstring_from_sections)

wrapmod = 'gsw/_wrapped_ufuncs.py'
basedir = os.path.join(os.path.dirname(__file__), '../')

# Functions that are Matlab subroutines; we don't need to expose them.
wrapmod = os.path.join(basedir, 'gsw/_wrapped_ufuncs.py')

# Functions that are Matlab subroutines, or exclusive to
# the C and not needed; we don't need to expose them.
blacklist = {'ct_freezing_exact',
'pt0_cold_ice_poly',
'pt_from_pot_enthalpy_ice_poly_dh',
Expand Down
8 changes: 7 additions & 1 deletion matlab_parser.py → tools/matlab_parser.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
"""
It may be necessary to edit the location of the GSW-Matlab directory.
"""

import os
import glob
import re

gsw_matlab_dir = '../GSW-Matlab/Toolbox'
basedir = os.path.join(os.path.dirname(__file__), '../')

gsw_matlab_dir = os.path.join(basedir, '../GSW-Matlab/Toolbox')
gsw_matlab_subdirs = ['library', 'thermodynamics_from_t']

# pattern for functions returning one variable
Expand Down

0 comments on commit a751cb9

Please sign in to comment.