#{{{}}} #{{{ comments/syntax description # Format for the sources # ( AMIGA # start amiga stuff # ( AREXX name f ) # AREXX function name calls OCL function f # TERMINAL .... # ... will used as terminal description in the bindings # ( MODES name .. ) # all names are known as mode # ( IFMODES tag name ... ) # all names are known as mode, if OCL-Tag tag is set # ( MENU header of the menu # item : command # item : ( command mode ) .. # ) # define a menu with all items. The first version of item has to be used, # if no modes are defined. # ) # end AMIGA stuff #}}} #{{{ init, not in statements BEGIN { modes_used=0;menu="";DQ=sprintf("%c",34);menu_top=0;first_code=48;terminal="default" } #}}} #{{{ skip comments /^ *;/ { next } #}}} #{{{ (AMIGA: switch on amiga handling /^ *\( +AMIGA *$/ { amiga_handle=1;next } #}}} #{{{ skip non AMIGA parts amiga_handle!=1 { next } #}}} #{{{ ): switch off AMIGA /^ *\) *$/ && menu=="" { amiga_handle=0;next } #}}} #{{{ AREX /^ *\( +AREXX +[^ ()]+ +[^ ()]+ +\) *$/ && menu=="" { txt="" for (i=1;i<=length($3);i++) txt=txt" "DQ substr($3,i,1)" " print("( os-extension ( "DQ"AREXX "txt" "DQ", "$4" ) )") next } #}}} #{{{ TERMINAL: specify terminal string for bindings /^ *TERMINAL.*/ { for (terminal=$0;substr(terminal,1,1)==" ";terminal=substr(terminal,2)); terminal=substr(terminal,9) next } #}}} #{{{ (MODES ): define modes for menu-keybinds / *\( +MODES( +[^ " ()]+)+ +\) *$/ { modes_used=1 for ( i=3 ; i < NF ; i++ ) modes[$i]=1 next } #}}} #{{{ (IFMODES ): define modes for menu-keybinds, depending on ifdefs / *\( +IFMODES +[^ ()]+( +[^ " ()]+)+ +\) *$/ { modes_used=1 for ( i=4 ; i < NF ; i++ ) { modes[$i]=1 ifuse[$i]=$3 } next } #}}} #{{{ (MENU: start menu definition /^ *\( +MENU( +[^ ()]+)+ *$/ { menu=$3 for (i=4;i<=NF;i++) menu=menu" "$i menues[menu]=1 txt="( os-extension ( "DQ"MENU "DQ" " for (i=1;i<=length(menu);i++) txt=txt" "DQ substr(menu,i,1) txt=txt" "DQ"," menu_sub=0 next } #}}} #{{{ ) and menu_handling: end menu handling /^ *\) *$/ && menu!="" { menu="";menu_top++;next } #}}} #{{{ menu command line /^.+:(( +[^ ()]+)|( +\( +[^ ()]+ +[^ ()]+ +\))+) *$/ { line=txt for (sf=1;$sf!=":";sf++) { for (j=1;j<=length($sf);j++) line=line" "DQ substr($sf,j,1) line=line" "DQ" " } print(line" ) )") if (NF==sf+1 && modes_used==0) { printf("( terminal ( %s )\n ( keybind %s ( $menu "DQ"%c "DQ"%c ) )\n)\n",terminal,$3,menu_top+first_code,menu_sub+first_code) menu_sub++ next } else if (NF>sf+1 && modes_used==1) { for (i=sf+2;sf"$0"<") exit } END { if (amiga_handle==1) print("@error missing end of amiga extensions!") }