fix latex dictionary format, embed latex equations into executable
This commit is contained in:
parent
e9c61bf48c
commit
3bc3fbe8fb
4 changed files with 61 additions and 12 deletions
|
|
@ -164,9 +164,9 @@ def test(terms_raw, report=False, latex=False):
|
|||
elif latex:
|
||||
print "{"
|
||||
for avg in ir4.averaged.values():
|
||||
print "'{}' : ".format(avg.name)
|
||||
print '"{}" : '.format(avg.name)
|
||||
# print r"\begin{equation}"
|
||||
print "'${}$' ,".format(avg.latex)
|
||||
print 'r"${}$" ,'.format(avg.latex)
|
||||
# print r"\end{equation}"
|
||||
print "}"
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -36,10 +36,13 @@ MODULES += \
|
|||
# Objects
|
||||
OBJ = post_dns.o
|
||||
|
||||
# Data Objects
|
||||
ODATA = build_info.odata latex_equations.odata
|
||||
|
||||
Post_Cbar_FSD_Incomp : x-edge-cold-bc-uPrime-hybrid
|
||||
|
||||
x-edge-cold-bc-uPrime-hybrid : ${MODULES} ${OBJ} print_build_info.o build_info.o
|
||||
${compiler} -o x-edge-cold-bc-uPrime-hybrid ${flags} ${MODULES} ${OBJ} print_build_info.o build_info.o
|
||||
x-edge-cold-bc-uPrime-hybrid : ${MODULES} ${OBJ} print_build_info.o ${ODATA}
|
||||
${compiler} -o x-edge-cold-bc-uPrime-hybrid ${flags} ${MODULES} ${OBJ} print_build_info.o ${ODATA}
|
||||
|
||||
${OBJ} : ${MODULES}
|
||||
|
||||
|
|
@ -53,7 +56,7 @@ cleanAll: clean
|
|||
rm -f m_terms.f90
|
||||
|
||||
clean:
|
||||
rm -f *.o *.mod x-edge-cold-bc-uPrime-hybrid test_calculate test_compact build_info.txt
|
||||
rm -f *.o *.odata *.mod x-edge-cold-bc-uPrime-hybrid test_calculate test_compact build_info.txt latex_equations.txt
|
||||
|
||||
test : test_calculate
|
||||
./test_calculate
|
||||
|
|
@ -71,8 +74,11 @@ test_compact.o : Compact.o
|
|||
print_build_info.o : print_build_info.c
|
||||
gcc -c print_build_info.c
|
||||
|
||||
build_info.o : build_info.txt
|
||||
ld -r -b binary -o build_info.o build_info.txt
|
||||
%.odata : %.txt
|
||||
ld -r -b binary -o $@ $<
|
||||
|
||||
build_info.txt : ${TERMSPEC}
|
||||
python code_gen/code_gen.py -b ${TERMSPEC} > build_info.txt
|
||||
build_info.txt : ${TEMSPEC}
|
||||
python code_gen/code_gen.py -b ${TERMSPEC} > $@
|
||||
|
||||
latex_equations.txt : ${TEMSPEC}
|
||||
python code_gen/code_gen.py -x ${TERMSPEC} > $@
|
||||
|
|
|
|||
|
|
@ -7,12 +7,28 @@
|
|||
USE post
|
||||
USE Compact
|
||||
|
||||
interface
|
||||
|
||||
function build_info_length()
|
||||
integer :: build_info_length
|
||||
end function build_info_length
|
||||
|
||||
function latex_length()
|
||||
integer :: latex_length
|
||||
end function latex_length
|
||||
|
||||
end interface
|
||||
|
||||
CHARACTER(100) :: num1char = ""
|
||||
|
||||
character (len=8000) :: input_string = ""
|
||||
|
||||
character (len=8000) :: latex_string = ""
|
||||
|
||||
call cstr(input_string)
|
||||
|
||||
call eqnstr(latex_string)
|
||||
|
||||
|
||||
!First, make sure the right number of inputs have been provided
|
||||
IF(COMMAND_ARGUMENT_COUNT() > 0) THEN
|
||||
|
|
@ -25,8 +41,11 @@
|
|||
WRITE(*,*) "optional arguments:"
|
||||
WRITE(*,*) " -h show this help message and exit"
|
||||
WRITE(*,*) " -v print version information"
|
||||
WRITE(*,*) " -x print latex equations"
|
||||
ELSE IF(num1char=="-v") THEN
|
||||
WRITE(*,*) input_string(1:lnblnk(input_string))
|
||||
ELSE IF(num1char=="-x") THEN
|
||||
WRITE(*,*) latex_string(1:lnblnk(latex_string))
|
||||
ELSE
|
||||
WRITE(*,*) 'ERROR, OPTION NOT SUPPORTED ', num1char
|
||||
END IF
|
||||
|
|
|
|||
|
|
@ -2,12 +2,26 @@ extern const char _binary_build_info_txt_start [];
|
|||
extern const char _binary_build_info_txt_end [];
|
||||
extern const char _binary_build_info_txt_size [];
|
||||
|
||||
void cstr_( char *s, unsigned long b )
|
||||
extern const char _binary_latex_equations_txt_start [];
|
||||
extern const char _binary_latex_equations_txt_end [];
|
||||
extern const char _binary_latex_equations_txt_size [];
|
||||
|
||||
int build_info_length_()
|
||||
{
|
||||
return ((char*)&_binary_build_info_txt_end - (char*)&_binary_build_info_txt_start);
|
||||
}
|
||||
|
||||
int latex_length_()
|
||||
{
|
||||
return ((char*)&_binary_latex_equations_txt_end - (char*)&_binary_latex_equations_txt_start);
|
||||
}
|
||||
|
||||
void string_copy ( char *s, unsigned long b, const char *p_start , const char *p_end )
|
||||
{
|
||||
int count = 0;
|
||||
char* p = &_binary_build_info_txt_start;
|
||||
const char* p = p_start;
|
||||
|
||||
while ( p != &_binary_build_info_txt_end && count < b )
|
||||
while ( p != p_end && count < b )
|
||||
{
|
||||
s[count++] = *p++;
|
||||
}
|
||||
|
|
@ -17,3 +31,13 @@ void cstr_( char *s, unsigned long b )
|
|||
s[count++] = ' ';
|
||||
}
|
||||
}
|
||||
|
||||
void cstr_( char *s, unsigned long b )
|
||||
{
|
||||
string_copy(s, b, &_binary_build_info_txt_start, &_binary_build_info_txt_end);
|
||||
}
|
||||
|
||||
void eqnstr_( char *s, unsigned long b )
|
||||
{
|
||||
string_copy(s, b, &_binary_latex_equations_txt_start, &_binary_latex_equations_txt_end);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue