Skip to content

Commit

Permalink
Fix documentation generation script
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@16150 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed May 29, 2013
1 parent 2a7233f commit c10048c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Compiler/FrontEnd/MetaModelicaBuiltin.mo
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ external "builtin";
<p>This is a very fast comparison of two values which only checks if the pointers are equal.</p>
<p>The intended way of using the function is to speed up comparisons.</p>
<p>If you know that all occurances of REC(1.5) are the same pointer (e.g. if you made a pass on your datastructure that replaced all occurances with a single one),
you can use referenceEq instead of structural equality (<a href=\"modelica://valueEq\">valueEq</a> or a user-provided comparison).</p>
you can use referenceEq instead of structural equality (<a href=\"modelica://MetaModelica.valueEq\">valueEq</a> or a user-provided comparison).</p>
<p>You can also use the function to speed up comparsions if the rate of success is expected to be high or the cost of structural equality is high. But then you need to do a structural equality check after to make sure nothing is wrong.</p>
<p>You can use the function to avoid reconstructing an identical datastructure on traversals, which saves memory and time spent on garbage collection: case rec as REC(x) equation nx = f(x); then if referenceEq(x,nx) then rec else REC(nx);</p>
</html>"));
Expand Down
23 changes: 13 additions & 10 deletions Examples/GenerateDoc.mos
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if genMetaModelica then
end if;

echo(false);
allClassNames:=getClassNames(builtin=genBuiltin,recursive=true,sort=true);
allClassNames:=getClassNames(Modelica.Mechanics.MultiBody.Examples.Loops.Engine1b,builtin=genBuiltin,recursive=true,sort=true);
system("date -u +%FT%TZ > tmp");
genTimeStamp := readFile("tmp");
version := "<hr />Generated at " + genTimeStamp + " by <a href=\"http://openmodelica.org\">OpenModelica</a>" + getVersion() + " using <a href=\"GenerateDoc.mos\">GenerateDoc.mos</a>";
Expand Down Expand Up @@ -244,10 +244,11 @@ import sys
repls = ["+replaceCommands+"
(re.compile(r'.*/omlibrary/'), ''),
(re.compile(r' '), r'%20'),
(re.compile(r'[Mm][Oo][Dd][Ee][Ll][Ii][Cc][Aa]://([A-Za-z0-9.\\'()_]*#)'), r'\\1.html#'),
(re.compile(r'[Mm][Oo][Dd][Ee][Ll][Ii][Cc][Aa]://([A-Za-z0-9.\\'()_]*)#'), r'\\1.html#'),
(re.compile(r'[Mm][Oo][Dd][Ee][Ll][Ii][Cc][Aa]://([A-Za-z0-9.\\'()_]*)'), r'\\1.html'),
]
rehttp = re.compile(r'https?://',flags=re.IGNORECASE)
ignorebookmark = re.compile(r'^([^#]*)#.*')
links = open('tidy.links','w')

def linkreplace(link,filepath):
Expand All @@ -258,7 +259,7 @@ def linkreplace(link,filepath):
except:
pass
if result <> link and not rehttp.match(result):
links.write('%s§%s\\n' % (result,filepath))
links.write('%s!%s\\n' % (filepath,ignorebookmark.sub(r'\\1',result)))
return result

for filepath in sorted(glob.glob('*.html')):
Expand Down Expand Up @@ -289,15 +290,17 @@ writeFile("FindFiles.sh","#!/bin/bash
rm -f *.png *.pdf FindFiles.log
touch FindFiles.log
OMLIBRARY=\""+getInstallationDirectoryPath()+"/lib/omlibrary\"
for f in `uniq tidy.links`; do
f=`echo $f | cut -d§ -f1 | sed 's/%20/ /'`
if test -f \"$OMLIBRARY/$f\"; then
d=`dirname \"$f\"`
for f in `sort -u tidy.links`; do
link=`echo $f | cut '-d!' -f2- | sed 's/%20/ /'`
if test -f \"$OMLIBRARY/$link\"; then
d=`dirname \"$link\"`
mkdir -p \"$d\"
cp \"$OMLIBRARY/$f\" \"$f\"
cp \"$OMLIBRARY/$link\" \"$link\"
elif test -f \"$link\"; then
true
else
inFile=`echo $f | cut -d§ -f2`
echo \"$inFile: Not found: $f\" | tee -a FindFiles.log
inFile=`echo $f | cut '-d!' -f1`
echo \"$inFile: Not found: $link\" | tee -a FindFiles.log
fi
done
rm -f tmp
Expand Down

0 comments on commit c10048c

Please sign in to comment.