From a12247003460494ba23de7e6b6936ca499397912 Mon Sep 17 00:00:00 2001 From: Stefan Date: Sun, 5 May 2019 14:51:02 +0200 Subject: AmigaOS4: Activate syntax highlighting in GitHub --- dists/amiga/RM2AG.rexx | 165 +++++++++++++++++++++++++++++++++++++++++++++++++ dists/amiga/RM2AG.rx | 165 ------------------------------------------------- 2 files changed, 165 insertions(+), 165 deletions(-) create mode 100644 dists/amiga/RM2AG.rexx delete mode 100644 dists/amiga/RM2AG.rx (limited to 'dists') diff --git a/dists/amiga/RM2AG.rexx b/dists/amiga/RM2AG.rexx new file mode 100644 index 0000000000..a9b7e9673d --- /dev/null +++ b/dists/amiga/RM2AG.rexx @@ -0,0 +1,165 @@ +/* +README to .guide converter $VER: RM2AG.rexx 0.15 (25.01.2018) + +This script converts the pure ASCII-text based README file of ScummVM to a +basic Amiga guide file. + +More AmigaGuide features being added in the process if feasible. +*/ + +PARSE ARG readme_txt + +/* Check if the given file is really the readme */ +/* If a given filename has spaces in it's name, AmigaDOS/AmigaCLI will add extra quotation marks +to secure a sane working path. We get rid of them to make AREXX find the file */ +readme_txt=COMPRESS(readme_txt,'"') +OPEN(check_readme,readme_txt,'R') +IF READCH(check_readme,14) = 'ScummVM README' THEN + CLOSE(check_readme) +ELSE DO + SAY "Not the README file. Aborting!" + CLOSE(readme_read) + EXIT 20 +END + +/* If it's the proper file, lets start converting */ +OPEN(readme_read,readme_txt,'R') +OPEN(guide_write,'README.guide','W') + +/* Prepare the Amiga guide file, add the intro and fixed text */ +WRITELN(guide_write,'@DATABASE ScummVM README.guide') +WRITELN(guide_write,'@WORDWRAP') +WRITELN(guide_write,'@NODE "main" "ScummVM README Guide"') +WRITELN(guide_write,' ') +WRITELN(guide_write,'@{b}') +WRITELN(guide_write,READLN(readme_read)) +WRITELN(guide_write,'@{ub}') + +/* Creating the main link nodes */ +x=1 + +DO WHILE EOF(readme_read) = 0 + /* Read in the line */ + working_line=READLN(readme_read) + + /* Checking if the sub links have been reached and leave the loop, if met */ + IF POS('<>1.0<>',working_line) = 1 & x > 1 THEN + LEAVE + + /* If no chapter has been found, simply write the line */ + IF POS('<>',working_line) = 0 THEN + WRITELN(guide_write,working_line) + + /* Fix the empty chapters - two chapters (1.0 and 7.8) are empty and consist of only the headlines. + We add them to the following chapter and link both of them to the empty one */ + + /* If chapter 1.1 is found add a link node to 1.0 (as chapter 1.0 is empty) */ + IF POS(' * <>1.1<>',working_line) = 1 THEN DO + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*<>') + WRITELN(guide_write,' @{" 1.1 " Link "1.0"} 'working_line) + END + + /* If chapter 7.8.1 is found add a link node to 7.8 (as chapter 7.8 is empty) */ + IF POS(' * * <>7.8.1<>',working_line) = 1 THEN DO + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*<>') + WRITELN(guide_write,' @{" 7.8.1 " Link "7.8"} 'working_line) + END + + /* If a single number main chapter is found 1.0 upto 9.0), prepare and write the link node */ + IF POS('.0',working_line) = 4 THEN DO + WRITELN(guide_write,' ') + WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2) '" Link "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'"} 'COMPRESS(working_line,'*<>')) + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*<>') + x=x+1 + END + + /* If a double number main chapter is found (10.0 ff), prepare and write the link node */ + IF POS('.0',working_line) = 5 THEN DO + WRITELN(guide_write,' ') + WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2) '" Link "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'"} 'COMPRESS(working_line,'*<>')) + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*<>') + END + + /* If a level one sub chapter is found (i.e. 1.1), prepare and write the link node */ + IF POS(' * <>',working_line) = 1 THEN DO + WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2) '" Link "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'"} 'COMPRESS(working_line,'*<>')) + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*<>') + END + + /* If a level two sub chapter is found (i.e. 1.1.1), prepare and write the link node */ + IF POS(' * * <>',working_line) = 1 THEN DO + WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2) '" Link "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'"} 'COMPRESS(working_line,'*<>')) + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'*<>') + END +END + +/* Finish the TOC, hardcoded due the outro text getting read in last, but needs to be read/written after the TOC creation */ +WRITELN(guide_write,'------------------------------------------------------------------------') +WRITELN(guide_write,'Good Luck and Happy Adventuring!') +WRITELN(guide_write,'The ScummVM team.') +WRITELN(guide_write,'@{"https://www.scummvm.org/" System "URLOpen https://www.scummvm.org/"}') +WRITELN(guide_write,'------------------------------------------------------------------------') + +/* Creating the sub links nodes */ +DO WHILE EOF(readme_read) = 0 + /* If no chapter has been found, simply write the line */ + IF POS('<>',working_line) = 0 THEN + WRITELN(guide_write,working_line) + + /* Fix the empty chapters - two chapters (1.0 and 7.8) are empty and consist of only the Headlines. + We don't close the NODE, rather add the following chapter to the former empty one */ + + /* If chapter 1.1 is found don't close the NODE, just write the line */ + IF POS('<>1.1<>',working_line) = 1 THEN DO + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'<>') + WRITELN(guide_write,working_line) + END + + /* If chapter 7.8.1 is found don't close the NODE, just write the line */ + IF POS('<>7.8.1<>',working_line) = 1 THEN DO + /* Get rid of the markers so the following loops doesn't process them again */ + working_line=COMPRESS(working_line,'<>') + WRITELN(guide_write,working_line) + END + + IF POS('<>',working_line) > 0 THEN DO + /* Check for link references inside the text and create link nodes for them */ + IF POS('section <>',working_line) > 0 THEN DO + working_line=SUBSTR(working_line,1,POS('<>',working_line)-1)'@{"'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'" Link "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'"}'SUBSTR(working_line,LASTPOS('<>',working_line)+2) + /* Get rid of the markers so the following loops doesn't process them again */ + WRITELN(guide_write,COMPRESS(working_line,'<>')) + END + ELSE DO + /* If a chapter has been found, prepare and write the link */ + WRITELN(guide_write,'@ENDNODE') + WRITELN(guide_write,'@NODE "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'" "'COMPRESS(working_line,'<>')'"') + WRITELN(guide_write,' ') + /* Get rid of the markers so the following loops doesn't process them again */ + WRITELN(guide_write,COMPRESS(working_line,'<>')) + END + END + + /* Read in the line at the end of the second loop, as the first line to work with was already read in on the end of the first loop */ + working_line=READLN(readme_read) + + /* If the outtro text is found, leave the loop and prepare for closing */ + IF POS('------------------------------------------------------------------------',working_line) > 0 THEN + LEAVE +END + +WRITELN(guide_write,'@ENDNODE') + +/* Closing the guide and cleaning up */ +WRITELN(guide_write,'@ENDNODE') + +CLOSE(readme_read) +CLOSE(guide_write) + +EXIT 0 diff --git a/dists/amiga/RM2AG.rx b/dists/amiga/RM2AG.rx deleted file mode 100644 index a4e92b7893..0000000000 --- a/dists/amiga/RM2AG.rx +++ /dev/null @@ -1,165 +0,0 @@ -/* -README to .guide converter $VER: RM2AG.rx 0.15 (25.01.2018) - -This script converts the pure ASCII-text based README file of ScummVM to a -basic Amiga guide file. - -More AmigaGuide features being added in the process if feasible. -*/ - -PARSE ARG readme_txt - -/* Check if the given file is really the readme */ -/* If a given filename has spaces in it's name, AmigaDOS/AmigaCLI will add extra quotation marks -to secure a sane working path. We get rid of them to make AREXX find the file */ -readme_txt=COMPRESS(readme_txt,'"') -OPEN(check_readme,readme_txt,'R') -IF READCH(check_readme,14) = 'ScummVM README' THEN - CLOSE(check_readme) -ELSE DO - SAY "Not the README file. Aborting!" - CLOSE(readme_read) - EXIT 0 -END - -/* If it's the proper file, lets start converting */ -OPEN(readme_read,readme_txt,'R') -OPEN(guide_write,'README.guide','W') - -/* Prepare the Amiga guide file, add the intro and fixed text */ -WRITELN(guide_write,'@DATABASE ScummVM README.guide') -WRITELN(guide_write,'@WORDWRAP') -WRITELN(guide_write,'@NODE "main" "ScummVM README Guide"') -WRITELN(guide_write,' ') -WRITELN(guide_write,'@{b}') -WRITELN(guide_write,READLN(readme_read)) -WRITELN(guide_write,'@{ub}') - -/* Creating the main link nodes */ -x=1 - -DO WHILE EOF(readme_read) = 0 - /* Read in the line */ - working_line=READLN(readme_read) - - /* Checking if the sub links have been reached and leave the loop, if met */ - IF POS('<>1.0<>',working_line) = 1 & x > 1 THEN - LEAVE - - /* If no chapter has been found, simply write the line */ - IF POS('<>',working_line) = 0 THEN - WRITELN(guide_write,working_line) - - /* Fix the empty chapters - two chapters (1.0 and 7.8) are empty and consist of only the headlines. - We add them to the following chapter and link both of them to the empty one */ - - /* If chapter 1.1 is found add a link node to 1.0 (as chapter 1.0 is empty) */ - IF POS(' * <>1.1<>',working_line) = 1 THEN DO - /* Get rid of the markers so the following loops doesn't process them again */ - working_line=COMPRESS(working_line,'*<>') - WRITELN(guide_write,' @{" 1.1 " Link "1.0"} 'working_line) - END - - /* If chapter 7.8.1 is found add a link node to 7.8 (as chapter 7.8 is empty) */ - IF POS(' * * <>7.8.1<>',working_line) = 1 THEN DO - /* Get rid of the markers so the following loops doesn't process them again */ - working_line=COMPRESS(working_line,'*<>') - WRITELN(guide_write,' @{" 7.8.1 " Link "7.8"} 'working_line) - END - - /* If a single number main chapter is found 1.0 upto 9.0), prepare and write the link node */ - IF POS('.0',working_line) = 4 THEN DO - WRITELN(guide_write,' ') - WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2) '" Link "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'"} 'COMPRESS(working_line,'*<>')) - /* Get rid of the markers so the following loops doesn't process them again */ - working_line=COMPRESS(working_line,'*<>') - x=x+1 - END - - /* If a double number main chapter is found (10.0 ff), prepare and write the link node */ - IF POS('.0',working_line) = 5 THEN DO - WRITELN(guide_write,' ') - WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2) '" Link "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'"} 'COMPRESS(working_line,'*<>')) - /* Get rid of the markers so the following loops doesn't process them again */ - working_line=COMPRESS(working_line,'*<>') - END - - /* If a level one sub chapter is found (i.e. 1.1), prepare and write the link node */ - IF POS(' * <>',working_line) = 1 THEN DO - WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2) '" Link "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'"} 'COMPRESS(working_line,'*<>')) - /* Get rid of the markers so the following loops doesn't process them again */ - working_line=COMPRESS(working_line,'*<>') - END - - /* If a level two sub chapter is found (i.e. 1.1.1), prepare and write the link node */ - IF POS(' * * <>',working_line) = 1 THEN DO - WRITELN(guide_write,' @{" 'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2) '" Link "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'"} 'COMPRESS(working_line,'*<>')) - /* Get rid of the markers so the following loops doesn't process them again */ - working_line=COMPRESS(working_line,'*<>') - END -END - -/* Finish the TOC, hardcoded due the outro text getting read in last, but needs to be read/written after the TOC creation */ -WRITELN(guide_write,'------------------------------------------------------------------------') -WRITELN(guide_write,'Good Luck and Happy Adventuring!') -WRITELN(guide_write,'The ScummVM team.') -WRITELN(guide_write,'@{"https://www.scummvm.org/" System "URLOpen https://www.scummvm.org/"}') -WRITELN(guide_write,'------------------------------------------------------------------------') - -/* Creating the sub links nodes */ -DO WHILE EOF(readme_read) = 0 - /* If no chapter has been found, simply write the line */ - IF POS('<>',working_line) = 0 THEN - WRITELN(guide_write,working_line) - - /* Fix the empty chapters - two chapters (1.0 and 7.8) are empty and consist of only the Headlines. - We don't close the NODE, rather add the following chapter to the former empty one */ - - /* If chapter 1.1 is found don't close the NODE, just write the line */ - IF POS('<>1.1<>',working_line) = 1 THEN DO - /* Get rid of the markers so the following loops doesn't process them again */ - working_line=COMPRESS(working_line,'<>') - WRITELN(guide_write,working_line) - END - - /* If chapter 7.8.1 is found don't close the NODE, just write the line */ - IF POS('<>7.8.1<>',working_line) = 1 THEN DO - /* Get rid of the markers so the following loops doesn't process them again */ - working_line=COMPRESS(working_line,'<>') - WRITELN(guide_write,working_line) - END - - IF POS('<>',working_line) > 0 THEN DO - /* Check for link references inside the text and create link nodes for them */ - IF POS('section <>',working_line) > 0 THEN DO - working_line=SUBSTR(working_line,1,POS('<>',working_line)-1)'@{"'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'" Link "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'"}'SUBSTR(working_line,LASTPOS('<>',working_line)+2) - /* Get rid of the markers so the following loops doesn't process them again */ - WRITELN(guide_write,COMPRESS(working_line,'<>')) - END - ELSE DO - /* If a chapter has been found, prepare and write the link */ - WRITELN(guide_write,'@ENDNODE') - WRITELN(guide_write,'@NODE "'SUBSTR(working_line,POS('<>',working_line)+2,LASTPOS('<>',working_line)-POS('<>',working_line)-2)'" "'COMPRESS(working_line,'<>')'"') - WRITELN(guide_write,' ') - /* Get rid of the markers so the following loops doesn't process them again */ - WRITELN(guide_write,COMPRESS(working_line,'<>')) - END - END - - /* Read in the line at the end of the second loop, as the first line to work with was already read in on the end of the first loop */ - working_line=READLN(readme_read) - - /* If the outtro text is found, leave the loop and prepare for closing */ - IF POS('------------------------------------------------------------------------',working_line) > 0 THEN - LEAVE -END - -WRITELN(guide_write,'@ENDNODE') - -/* Closing the guide and cleaning up */ -WRITELN(guide_write,'@ENDNODE') - -CLOSE(readme_read) -CLOSE(guide_write) - -EXIT 0 -- cgit v1.2.3