#!/bin/sh # gen_formats - generate file format listing for the doc # Copyright (C) 2017 Tibor 'Igor2' Palinkas # # 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 # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # http://repo.hu/projects/librnd #configuration: # $APP name of the application # $PLUGINS relative path to plugins, e.g. ../../../../src_plugins echo ' '$APP' - list of file formats

'$APP' User Manual: Appendix

File format support

plugin native state reads formats writes formats ' files_io=`ls $PLUGINS/io_*/*.pup | sort` files_e=`ls $PLUGINS/export_*/*.pup | sort` files_i=`ls $PLUGINS/import_*/*.pup | sort` for n in $files_io $files_i $files_e do bn=`basename $n` bn=${bn%%.pup} sed ' /^[$]fmt[-]/ { s@^@'$bn' @; p } /^[$]state/ { s@^@'$bn' @; p } { d } ' $n done | awk ' BEGIN { plgs = 0 } { if ($1 != last) { PLG[plgs] = $1 last = $1 plgs++ } p=$1 f=$2 text=$0 sub("^[^ \t]+[ \t]+[^ \t]+[ \t]+", "", text) DATA[p, f] = DATA[p, f] SUBSEP text } function col(mask ,n,v,i,A) { print " " v = split(DATA[mask], A, "[" SUBSEP "]") if (v == 0) { print "n/a" return } i = 0; for(n = 1; n <= v; n++) { if (A[n] == "") continue; if (i) print "
" print " " A[n] i++ } } function strip(s) { gsub("[" SUBSEP "]", " ", s) sub("^[ \t]*", "", s) sub("[ \t]*$", "", s) return s } function row(plg) { print "
" plg print "" strip(DATA[plg, "$fmt-native"]) print "" strip(DATA[plg, "$state"]) col(plg SUBSEP "$fmt-feature-r") col(plg SUBSEP "$fmt-feature-w") } END { for(p=0; p < plgs; p++) if (DATA[PLG[p], "$fmt-native"] ~ "yes") row(PLG[p]) for(p=0; p < plgs; p++) if (!(DATA[PLG[p], "$fmt-native"] ~ "yes")) row(PLG[p]) } ' echo '
'