Hello API users and Andrew A bash script, which searches for depreciated API names in C/C++ code, is appended. It may be of use to API users wishing to check and/or upgrade their code.
As a suggestion to Andrew, it could be worth listing depreciated calls (starting version 4.13?), together with their current replacements, in the API manual. Either as a stand-alone table in a new appendix. Or provided within the documentation proper, for example: Supersedes This function replaced 'lpx_stale' in release 4.36. If need be, I can draft some texinfo (or latex) markup. Just let me know. with best regards Robbie --- #! /bin/bash # Purpose : match depreciated glpk APIs using hardcoded list # Author : Robbie Morrison <[email protected]> # Commenced : 03-Apr-2009 # Tested : Ubuntu 6.10 / Linux 2.6.17-12-generic / grep (GNU grep) 2.5.1 # Status : working # License: This work is in the Public Domain. To view # a copy of the public domain certification, visit # http://creativecommons.org/licenses/publicdomain/ # Version: $Id: show-stale-glpk-apis,v 1.9 2009/04/09 05:16:39 robbie Exp $ # TYPICAL USAGE # # $ show-stale-glpk-apis *.{h,c} # $ show-stale-glpk-apis *.{h,cc} # $ show-stale-glpk-apis *.{hpp,cpp} # $ show-stale-glpk-apis * # # ISSUES # # - filenames containing space chars must be escaped: space\ char\ name.c # - C++ exclusive comment lines are filtered out, that is, all lines beginning // # # NOTES # # - any lines ending \ must NOT contain trailing white-space # - execute permission must be set: $ chmod u+x show-stale-glpk-apis # 'STALE_APIS' is a newline-separated list of # depreciated GLPK APIs taken from the release notes # for versions 4.29 thru 4.37. You can add to this # list as needed. STALE_APIS="\ lpx_read_mps lpx_read_freemps lpx_write_mps lpx_write_freemps lpx_read_cpxlp lpx_write_cpxlp lpx_scale_prob lpx_std_basis lpx_adv_basis lpx_cpx_basis lpx_integer lpx_intopt lpx_exact lpx_get_ray_info lpx_interior lpx_read_model lpx_print_sol lpx_print_ips lpx_print_mip lpx_print_prob" # --------------------------------- # preamble # --------------------------------- SCRIPT=$(basename "$0") # name of this script, used in reporting files="$*" # grab command-line arguments as single string if [ -z "$files" ] # empty string then echo "$SCRIPT: must supply at least one filename" exit 1 fi # --------------------------------- # function 'stale_apis' # --------------------------------- function stale_apis { local file="$1" # rename for convenience echo "$file" if [ -f "$file" ] # file exists and is regular then cat "$file" | \ grep --invert-match "^[[:space:]]*//" | \ grep --line-number --color --fixed-strings "$STALE_APIS" ret3=${PIPESTATUS[2]} # return from third call in call chain test $ret3 -eq 1 && echo " no stale APIs found" echo return 0 else echo " file either not regular or not found" echo return 1 fi } # --------------------------------- # main loop # --------------------------------- for file in $files do stale_apis "$file" done # --------------------------------- # housekeeping # --------------------------------- echo "$SCRIPT: script complete" exit 0 # end of file --- Robbie Morrison PhD student -- policy-oriented energy system simulation Technical University of Berlin (TU-Berlin), Germany Webmail (preferred) : [email protected] [from IMAP client] _______________________________________________ Help-glpk mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-glpk
