Changeset 6f91c91 in sasmodels


Ignore:
Timestamp:
Jan 17, 2018 4:10:27 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Children:
1662ebe
Parents:
5dd7cfb
Message:

track line number for c header

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/py2c.py

    r5dd7cfb r6f91c91  
    147147import ast 
    148148from ast import NodeVisitor 
     149from inspect import currentframe, getframeinfo 
     150 
    149151try: # for debugging, astor lets us print out the node as python 
    150152    import astor 
     
    12851287 
    12861288 
     1289C_HEADER_LINENO = getframeinfo(currentframe()).lineno + 2 
    12871290C_HEADER = """ 
     1291#line %d "%s" 
    12881292#include <stdio.h> 
    12891293#include <stdbool.h> 
     
    13401344 
    13411345    with open(fname_out, "w") as file_out: 
    1342         file_out.write(C_HEADER) 
     1346        file_out.write(C_HEADER%(C_HEADER_LINENO, __file__)) 
    13431347        file_out.write(c_code) 
    13441348 
Note: See TracChangeset for help on using the changeset viewer.