libs: bin
@[ -e bin/libs -o ! -d libs ] || echo Extracting sources from libs...
@[ -e bin/libs -o ! -d libs ] || (cd src && for lib in ../libs/*-sources.jar ../libs/*-sources.patch.jar; do \
- basename "$$lib"; \
- jar xf "$$lib"; \
+ if [ "$$lib" != '../libs/*-sources.jar' -a "$$lib" != '../libs/*-sources.patch.jar' ]; then \
+ basename "$$lib"; \
+ jar xf "$$lib"; \
+ fi \
done )
@[ ! -d libs ] || touch bin/libs
PREFIX=/usr/local
PROGS="java javac jar make sed"
+CLI=be/nikiroo/fanfix/reader/CliReader
+TUI=be/nikiroo/fanfix/reader/TuiReader
+GUI=be/nikiroo/fanfix/reader/LocalReader
+
valid=true
while [ "$*" != "" ]; do
- key=`echo "$1" | cut -c1-9`
- val=`echo "$1" | cut -c10-`
+ key=`echo "$1" | cut -f1 -d=`
+ val=`echo "$1" | cut -f2 -d=`
case "$key" in
- --prefix=)
+ --)
+ ;;
+ --help) # This help message
+ echo The following arguments can be used:
+ cat "$0" | grep '^\s*--' | grep '#' | while read ln; do
+ cmd=`echo "$ln" | cut -f1 -d')'`
+ msg=`echo "$ln" | cut -f2 -d'#'`
+ echo " $cmd$msg"
+ done
+ ;;
+ --prefix) #=PATH Change the prefix to the given path
PREFIX="$val"
;;
+ --cli) #=no Disable CLI support (System.out)
+ [ "$val" = no -o "$val" = false ] && CLI=
+ ;;
+ --tui) #=no Disable TUI support (Jexer)
+ [ "$val" = no -o "$val" = false ] && TUI=
+ ;;
+ --gui) #=no Disable GUI support (Swing)
+ [ "$val" = no -o "$val" = false ] && GUI=
+ ;;
*)
echo "Unsupported parameter: '$1'" >&2
+ echo >&2
+ sh "$0" --help >&2
valid=false
;;
esac
fi;
echo "MAIN = be/nikiroo/fanfix/Main" > Makefile
+echo "MORE = $CLI $TUI $GUI" >> Makefile
echo "TEST = be/nikiroo/fanfix/test/Test" >> Makefile
echo "TEST_PARAMS = $cols $ok $ko" >> Makefile
echo "NAME = fanfix" >> Makefile
import be.nikiroo.fanfix.supported.BasicSupport;
import be.nikiroo.utils.Progress;
import be.nikiroo.utils.ui.UIUtils;
+import be.nikiroo.utils.serial.SerialUtils;
/**
* The class that handles the different {@link Story} readers you can use.
GUI,
/** A text (UTF-8) reader with menu and text windows */
TUI,
+
+ ;
+
+ public String getTypeName() {
+ String pkg = "be.nikiroo.fanfix.reader.";
+ switch (this) {
+ case CLI: return pkg + "CliReader";
+ case TUI: return pkg + "TuiReader";
+ case GUI: return pkg + "LocalReader";
+ }
+
+ return null;
+ }
}
private static ReaderType defaultType = ReaderType.GUI;
public static BasicReader getReader() {
try {
if (defaultType != null) {
- switch (defaultType) {
- case GUI:
- UIUtils.setLookAndFeel();
- return new LocalReader().setType(ReaderType.GUI);
- case CLI:
- return new CliReader().setType(ReaderType.CLI);
- case TUI:
- return new TuiReader().setType(ReaderType.TUI);
- }
+ return ((BasicReader)SerialUtils.createObject
+ (defaultType.getTypeName())).setType(defaultType);
}
- } catch (IOException e) {
+ } catch (Exception e) {
Instance.syserr(new Exception("Cannot create a reader of type: "
- + defaultType, e));
+ + defaultType + " (Not compiled in?)", e));
}
return null;