From 8b46ee6648a462aa782f2471e5f263cd80b97c35 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sun, 4 Mar 2012 19:49:28 +0100 Subject: [PATCH] Adapt script to changed name. --- scripts/python/nasal_api_doc.py | 56 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/scripts/python/nasal_api_doc.py b/scripts/python/nasal_api_doc.py index 51b82ce9b..947b722f9 100755 --- a/scripts/python/nasal_api_doc.py +++ b/scripts/python/nasal_api_doc.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2012 Adrian Musceac -# +# Copyright (C) 2012 Adrian Musceac +# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or @@ -23,13 +23,13 @@ import re, string """Script which generates an API documentation file for Nasal libraries located inside $FGROOT/Nasal/ -Usage: nasal_api.py parse [path to $FGROOT/Nasal/] +Usage: nasal_api_doc.py parse [path to $FGROOT/Nasal/] Or configure the local path below, and ommit the path in the console. The API doc in HTML format is generated in the current working directory""" ########### Local $FGROOT/Nasal/ path ########## NASAL_PATH="../fgfs/fgdata/Nasal/" - + def get_files(nasal_dir): if nasal_dir[-1]!='/': @@ -68,12 +68,12 @@ def get_files(nasal_dir): for f in files: functions=parse_file(f) top_namespaces.append([m,functions]) - + output_text(top_namespaces,modules,version) - - + + def output_text(top_namespaces,modules,version): - fw=open('./nasal_api.html','wb') + fw=open('./nasal_api_doc.html','wb') buf='\ Nasal API\ \n\ ' - + buf+='

\ Nasal $FGROOT Library
Flightgear version: '+version+'\ -
This file is generated automatically by scripts/python/nasal_api.py\ +
This file is generated automatically by scripts/python/nasal_api_doc.py\

\
Nasal documentation  \ Flightgear Nasal documentation\n
 ' @@ -138,11 +138,11 @@ def output_text(top_namespaces,modules,version): buf+= '
'+comment.replace('#','').replace('<','<').replace('>','>')+'

\n' buf+='
\n' if namespace[0] not in done2: - buf+='\n' + buf+='\n' buf+='' fw.write(buf) - fw.close() - + fw.close() + def parse_file(filename): fr=open(filename,'rb') content=fr.readlines() @@ -176,17 +176,17 @@ def parse_file(filename): else: break if(len(comments)>1): - comments.reverse() + comments.reverse() retval.append((func_name, param,comments)) i+=1 continue - + match3=re.search('^var\s*([A-Za-z0-9_-]+)\s*=\s*{\s*(\n|})',line) if match3!=None: classname=match3.group(1) - + comments=[] - + j=i-1 count=0 while ( j>i-35 and j>-1): @@ -202,11 +202,11 @@ def parse_file(filename): else: break if(len(comments)>1): - comments.reverse() + comments.reverse() retval.append((classname+'.', '',comments)) i+=1 continue - + match2=re.search('^\s*([A-Za-z0-9_-]+)\s*:\s*func\s*\(?([A-Za-z0-9_\s,=.\n-]*)\)?',line) if match2!=None: func_name=match2.group(1) @@ -216,7 +216,7 @@ def parse_file(filename): k=i+1 while(content[k].find(')')==-1): param+=content[k].rstrip('\n') - k+=1 + k+=1 param+=content[k].split(')')[0] j=i-1 count=0 @@ -233,13 +233,13 @@ def parse_file(filename): else: break if(len(comments)>1): - comments.reverse() + comments.reverse() if classname =='': continue retval.append((classname+'.'+func_name, param,comments)) i+=1 continue - + match4=re.search('^([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)\s*=\s*func\s*\(?([A-Za-z0-9_\s,=\n.-]*)\)?',line) if match4!=None: classname=match4.group(1) @@ -267,19 +267,19 @@ def parse_file(filename): else: break if(len(comments)>1): - comments.reverse() + comments.reverse() retval.append((classname+'.'+func_name, param,comments)) i+=1 continue - + i+=1 return retval - - + + if __name__ == "__main__": if len(sys.argv) <2: - print 'Usage: nasal_api.py parse [path to $FGROOT/Nasal/]' + print 'Usage: nasal_api_doc.py parse [path to $FGROOT/Nasal/]' sys.exit() else: if sys.argv[1]=='parse': @@ -289,5 +289,5 @@ if __name__ == "__main__": nasal_path=sys.argv[2] get_files(nasal_path) else: - print 'Usage: nasal_api.py parse [path to $FGROOT/Nasal/]' + print 'Usage: nasal_api_doc.py parse [path to $FGROOT/Nasal/]' sys.exit() -- 2.39.5