ipconfig/ftp: auto-load admnet, ftp: /f optional, irc: dialogs not blocking

This commit is contained in:
Jörg Deckert 2014-02-21 16:40:30 +01:00
parent 6015961fab
commit 0723196cd5
3 changed files with 109 additions and 80 deletions

View File

@ -36,14 +36,13 @@ OBJ
ios: "reg-ios" ios: "reg-ios"
str: "glob-string" str: "glob-string"
num: "glob-numbers" 'Number Engine num: "glob-numbers" 'Number Engine
gc : "glob-con"
CON CON
_CLKMODE = XTAL1 + PLL16X _CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000 _XINFREQ = 5_000_000
LANMASK = %00000000_00000000_00000000_00100000
CON 'NVRAM Konstanten -------------------------------------------------------------------------- CON 'NVRAM Konstanten --------------------------------------------------------------------------
#4, NVRAM_IPADDR #4, NVRAM_IPADDR
@ -81,9 +80,14 @@ PUB main
password[0] := 0 password[0] := 0
ios.start ios.start
ifnot (ios.admgetspec & LANMASK) ifnot (ios.admgetspec & gc#A_LAN)
ios.print(@strNoNetwork) ios.sddmset(ios#DM_USER) 'u-marker setzen
ios.stop ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
ios.admload(string("admnet.adm")) 'versuche, admnet zu laden
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
ifnot (ios.admgetspec & gc#A_LAN) 'wenn Laden fehlgeschlagen
ios.print(@strNoNetwork)
ios.stop 'Ende
ios.printnl ios.printnl
ios.parastart 'parameterübergabe starten ios.parastart 'parameterübergabe starten
repeat while ios.paranext(@parastr) 'parameter einlesen repeat while ios.paranext(@parastr) 'parameter einlesen
@ -98,6 +102,8 @@ PUB main
"p": ios.paranext(@password) "p": ios.paranext(@password)
"s": save2card := TRUE "s": save2card := TRUE
other: ios.print(@help) other: ios.print(@help)
else
ByteMove(@filename, @parastr, strsize(@parastr))
ifnot byte[@filename][0] == 0 ifnot byte[@filename][0] == 0
ifnot ftpconnect ifnot ftpconnect
@ -358,7 +364,7 @@ PRI writeToSDCard | fnr, len, i
fnr := ios.rd_open(@filename) fnr := ios.rd_open(@filename)
ifnot fnr == -1 ifnot fnr == -1
len := ios.rd_len(fnr) len := ios.rd_len(fnr)
ios.sddel(@filename) 'falls alte Datei auf SD-Card vorhanden, diese löschen ios.sddel(@filename) 'falls alte Datei auf SD-Card vorhanden, diese löschen
ifnot ios.sdnewfile(@filename) ifnot ios.sdnewfile(@filename)
ifnot ios.sdopen("W",@filename) ifnot ios.sdopen("W",@filename)
i := 0 i := 0
@ -456,17 +462,17 @@ DAT ' Locale
strErrorRetrOK byte "Ftp server doesn't acknowledge sending of file (226).",13,0 strErrorRetrOK byte "Ftp server doesn't acknowledge sending of file (226).",13,0
strWrite2SD byte "Saving to sd card...",13,0 strWrite2SD byte "Saving to sd card...",13,0
help byte "/? : Help",13 help byte " /? : Help",13
byte "/h <a.b.c.d> : host ip address (ftp server)",13 byte " /h <a.b.c.d> : host ip address (ftp server)",13
byte " (default: boot server from ipconfig)",13 byte " (default: boot server from ipconfig)",13
byte "/d <directory>: change to remote directory",13 byte " /d <directory>: change to remote directory",13
byte " (default: /hive/sdcard/system)",13 byte " (default: /hive/sdcard/system)",13
byte "/f <filename> : download <filename>",13 byte "[/f] <filename> : download <filename>",13
byte "/u <username> : Username at ftp server",13 byte " /u <username> : Username at ftp server",13
byte " (default: anonymous)",13 byte " (default: anonymous)",13
byte "/p <password> : password at ftp server",13 byte " /p <password> : password at ftp server",13
byte " (default: anonymous@hive<hive id>)",13 byte " (default: anonymous@hive<hive id>)",13
byte "/s : save file to sd card",13 byte " /s : save file to sd card",13
byte 0 byte 0
#else #else
@ -504,17 +510,17 @@ DAT ' Locale
strErrorRetrOK byte "FTP-Server hat den Empfang durch den Client nicht bestätigt (226).",13,0 strErrorRetrOK byte "FTP-Server hat den Empfang durch den Client nicht bestätigt (226).",13,0
strWrite2SD byte "Speichere auf SD-Card...",13,0 strWrite2SD byte "Speichere auf SD-Card...",13,0
help byte "/? : Hilfe",13 help byte " /? : Hilfe",13
byte "/h <a.b.c.d> : FTP-Server-Adresse (Host)",13 byte " /h <a.b.c.d> : FTP-Server-Adresse (Host)",13
byte " (default: mit ipconfig gesetzter Boot-Server)",13 byte " (default: mit ipconfig gesetzter Boot-Server)",13
byte "/d <verzeichnis>: in entferntes Verzeichnis wechseln",13 byte " /d <verzeichnis>: in entferntes Verzeichnis wechseln",13
byte " (default: /hive/sdcard/system)",13 byte " (default: /hive/sdcard/system)",13
byte "/f <dateiname> : Download <dateiname>",13 byte "[/f] <dateiname> : Download <dateiname>",13
byte "/u <username> : Benutzername am FTP-Server",13 byte " /u <username> : Benutzername am FTP-Server",13
byte " (default: anonymous)",13 byte " (default: anonymous)",13
byte "/p <password> : Paßwort am FTP-Server",13 byte " /p <password> : Paßwort am FTP-Server",13
byte " (default: anonymous@hive<Hive-Id>)",13 byte " (default: anonymous@hive<Hive-Id>)",13
byte "/s : Datei auf SD-Card speichern",13 byte " /s : Datei auf SD-Card speichern",13
byte 0 byte 0
#endif #endif

View File

@ -34,14 +34,13 @@ OBJ
ios: "reg-ios" ios: "reg-ios"
str: "glob-string" str: "glob-string"
num: "glob-numbers" num: "glob-numbers"
gc : "glob-con"
CON CON
_CLKMODE = XTAL1 + PLL16X _CLKMODE = XTAL1 + PLL16X
_XINFREQ = 5_000_000 _XINFREQ = 5_000_000
LANMASK = %00000000_00000000_00000000_00100000
CON 'NVRAM Konstanten -------------------------------------------------------------------------- CON 'NVRAM Konstanten --------------------------------------------------------------------------
#4, NVRAM_IPADDR #4, NVRAM_IPADDR
@ -65,9 +64,14 @@ PUB main | i
ios.start 'ios initialisieren ios.start 'ios initialisieren
ios.printnl ios.printnl
ifnot (ios.admgetspec & LANMASK) ifnot (ios.admgetspec & gc#A_LAN)
ios.print(@strNoNetwork) ios.sddmset(ios#DM_USER) 'u-marker setzen
ios.stop ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
ios.admload(string("admnet.adm")) 'versuche, admnet zu laden
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
ifnot (ios.admgetspec & gc#A_LAN) 'wenn Laden fehlgeschlagen
ios.print(@strNoNetwork)
ios.stop 'Ende
if ios.rtcTest 'RTC chip available? if ios.rtcTest 'RTC chip available?
rtcAvailable := TRUE rtcAvailable := TRUE
else 'use configfile else 'use configfile

View File

@ -30,6 +30,10 @@ Notizen :
}} }}
DAT
strVersion byte "1.3.1",0
OBJ OBJ
ios: "reg-ios" ios: "reg-ios"
str: "glob-string" str: "glob-string"
@ -44,34 +48,33 @@ _XINFREQ = 5_000_000
CON CON
W0X_MENU = 8 W0X_MENU = 8
W0Y_MENU = 0 W0Y_MENU = 0
COL_DEFAULT = 0 'default Schriftfarbe (Mitteilungstext und Eingabe) COL_DEFAULT = 0 'default Schriftfarbe (Mitteilungstext und Eingabe)
COL_STDEFAULT = 0 'default Schriftfarbe im Statusfenster COL_STDEFAULT = 0 'default Schriftfarbe im Statusfenster
COL_FRAME = 0 'Fensterrahmen (nicht ausgewählt) COL_FRAME = 0 'Fensterrahmen (nicht ausgewählt)
COL_FOCUS = 3 'Fensterrahmen (ausgewählt/Fokus) COL_FOCUS = 3 'Fensterrahmen (ausgewählt/Fokus)
COL_HEAD = 8 'Titelzeile COL_HEAD = 8 'Titelzeile
COL_TIME = 8 'aktuelle Zeit in Message-Zeile COL_TIME = 8 'aktuelle Zeit in Message-Zeile
COL_STTIME = 8 'aktuelle Zeit im Status-Fenster COL_STTIME = 8 'aktuelle Zeit im Status-Fenster
COL_CHAN = 5 'Channel in Message-Zeile COL_CHAN = 5 'Channel in Message-Zeile
COL_NICK = 4 'Nickname in Message-Zeile COL_NICK = 4 'Nickname in Message-Zeile
COL_MYNICK = 2 'Nickname in selbst geschriebener Message-Zeile COL_MYNICK = 2 'Nickname in selbst geschriebener Message-Zeile
COL_PRIVNICK = 7 'Nickname in privater Message-Zeile COL_PRIVNICK = 7 'Nickname in privater Message-Zeile
COL_MSG = 0 'Text der Message-Zeile COL_MSG = 0 'Text der Message-Zeile
COL_MYMSG = 6 'Text in selbst geschriebener Message-Zeile COL_MYMSG = 6 'Text in selbst geschriebener Message-Zeile
COL_PRIVMSG = 7 'Text in privater Message-Zeile COL_PRIVMSG = 7 'Text in privater Message-Zeile
LEN_PASS = 32 LEN_PASS = 32
LEN_NICK = 32 LEN_NICK = 32
LEN_USER = 32 LEN_USER = 32
LEN_CHAN = 32 LEN_CHAN = 32
LEN_IRCLINE = 512 LEN_IRCLINE = 512
LEN_IRCSRV = 64 LEN_IRCSRV = 64
MAX_LINES_WIN1 = 1000 ' maximale Zeilenanzahl im Puffer für Fenster 1 (Chat) MAX_LINES_WIN1 = 1000 ' maximale Zeilenanzahl im Puffer für Fenster 1 (Chat)
MAX_LINES_WIN2 = 1000 ' maximale Zeilenanzahl im Puffer für Fenster 2 (Status) MAX_LINES_WIN2 = 1000 ' maximale Zeilenanzahl im Puffer für Fenster 2 (Status)
MAX_LINES_WIN3 = 100 ' maximale Zeilenanzahl im Puffer für Fenster 3 (Eingabe)
CON 'NVRAM Konstanten -------------------------------------------------------------------------- CON 'NVRAM Konstanten --------------------------------------------------------------------------
@ -114,6 +117,7 @@ VAR
byte receive_str[LEN_IRCLINE] byte receive_str[LEN_IRCLINE]
byte brightness byte brightness
byte newMsg byte newMsg
byte nooutput
PUB main | key, t PUB main | key, t
@ -177,6 +181,7 @@ PRI init
reconnect := FALSE reconnect := FALSE
joined := FALSE joined := FALSE
newMsg := FALSE newMsg := FALSE
nooutput := FALSE
ios.start 'ios initialisieren ios.start 'ios initialisieren
ifnot (ios.belgetspec & (gc#b_key|gc#b_txt|gc#b_win)) 'Wir brauchen Bellatrix mit Keyboard-, Text- und Fensterfunktionen ifnot (ios.belgetspec & (gc#b_key|gc#b_txt|gc#b_win)) 'Wir brauchen Bellatrix mit Keyboard-, Text- und Fensterfunktionen
@ -262,6 +267,7 @@ PRI f_scrolldown | lineAddr, lineNum, lineMax
PRI f_help PRI f_help
nooutput := TRUE 'solange Hilfe angezeigt wird, nichts ausgeben
ios.winset(5) ios.winset(5)
ios.printcls ios.printcls
ios.winoframe ios.winoframe
@ -269,9 +275,11 @@ PRI f_help
ios.curoff ios.curoff
ios.setcolor(COL_DEFAULT) ios.setcolor(COL_DEFAULT)
ios.print(@strHelp) ios.print(@strHelp)
repeat until ios.keystat > 0 repeat until ios.keystat > 0 'bis eine Taste gedrückt wird
waitcnt(cnt + clkfreq) '1sek warten ifnot handleidx == $FF 'bei bestehender Verbindung...
ios.key ircGetLine 'Meldungen vom Server empfangen
ios.key 'Taste "abholen" (dummy)
nooutput := FALSE 'Ausgabe wieder freigeben
win_redraw win_redraw
win_contentRefresh win_contentRefresh
@ -649,7 +657,9 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
if strcomp(msgstr, string("VERSION")) 'Versions-Anfrage if strcomp(msgstr, string("VERSION")) 'Versions-Anfrage
sendStr(string("NOTICE ")) sendStr(string("NOTICE "))
sendStr(nickstr) sendStr(nickstr)
sendStr(string(" :VERSION HiveIRC 1.0.0 [P8X32A/80MHz] <http://hive-project.de/>",13,10)) sendStr(string(" :VERSION HiveIRC "))
sendStr(@strVersion)
sendStr(string(" [P8X32A/80MHz] <http://hive-project.de/>",13,10))
else else
ifnot newMsg 'neue Mitteilung noch nicht signalisiert ifnot newMsg 'neue Mitteilung noch nicht signalisiert
newMsg := TRUE newMsg := TRUE
@ -880,6 +890,12 @@ PRI title_draw | spaces, i
if ircsrv[++i] == 0 'Ende Servername folgt if ircsrv[++i] == 0 'Ende Servername folgt
ios.printchar(")") ios.printchar(")")
else else
ios.print(string(" v"))
spaces -= 2
ios.print(@strVersion)
spaces -= strsize(@strVersion)
ios.print(string(" © Jörg Deckert"))
spaces -= 15
repeat spaces repeat spaces
ios.printchar(" ") ios.printchar(" ")
ios.printlogo(0,0) ios.printlogo(0,0)
@ -1029,10 +1045,6 @@ PRI setscreen | buflen[4], i
yn[3] := rows-2 yn[3] := rows-2
buflinenr[3] := 0 buflinenr[3] := 0
scrolllinenr[3] := 0 scrolllinenr[3] := 0
bufstart[3] := bufstart[2] + buflen[2]
buflen[3] := buflinelen * MAX_LINES_WIN3
repeat i from 0 to MAX_LINES_WIN3 - 1 'Fensterpuffer leeren
printStrBuf(3)
ios.winset(0) ios.winset(0)
ios.printcls ios.printcls
@ -1206,6 +1218,9 @@ PRI printStrWin(printStr) | i
'' │ Chat-Zeile in aktuellem Fenster zeigen │ '' │ Chat-Zeile in aktuellem Fenster zeigen │
'' └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ '' └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
if nooutput 'wenn Ausgabe gesterrt
return
i := 0 i := 0
repeat repeat
if byte[printStr][i] == 0 and byte[printStr][i+1] == 0 'nichts mehr anzuzeigen, Ende if byte[printStr][i] == 0 and byte[printStr][i+1] == 0 'nichts mehr anzuzeigen, Ende
@ -1225,7 +1240,6 @@ PRI printStrBuf(win) | lineAddr, lineMax, i
case win case win
1: lineMax := MAX_LINES_WIN1 1: lineMax := MAX_LINES_WIN1
2: lineMax := MAX_LINES_WIN2 2: lineMax := MAX_LINES_WIN2
3: lineMax := MAX_LINES_WIN3
lineAddr := bufstart[win] + (buflinenr[win]++ * buflinelen) 'Adresse Zeilenbeginn im eRAM (Usermode) lineAddr := bufstart[win] + (buflinenr[win]++ * buflinelen) 'Adresse Zeilenbeginn im eRAM (Usermode)
if buflinenr[win] == lineMax if buflinenr[win] == lineMax
@ -1299,6 +1313,7 @@ PRI IpPortToStr(ip, port) | i,n,x,stradr
PUB input(strdesc, strdef, input_len) | i,n PUB input(strdesc, strdef, input_len) | i,n
nooutput := TRUE 'solange Dialog angezeigt wird, nichts ausgeben
input_str[0] := 0 input_str[0] := 0
ios.winset(4) ios.winset(4)
ios.printcls ios.printcls
@ -1323,21 +1338,25 @@ PUB input(strdesc, strdef, input_len) | i,n
i++ i++
byte[@input_str][i] := 0 byte[@input_str][i] := 0
ios.curon ios.curon
repeat 'entspricht ab hier ios.input repeat
n := ios.keywait 'auf taste warten ifnot handleidx == $FF 'bei bestehender Verbindung...
case n ircGetLine 'Meldungen vom Server empfangen
$0d: quit 'Enter, Eingabe beenden if ios.keystat > 0 'wenn Taste gedrückt
ios#CHAR_BS: if i > 0 'Zurück n := ios.key
ios.printbs case n
i-- $0d: quit 'Enter, Eingabe beenden
byte[@input_str][i] := 0 ios#CHAR_BS: if i > 0 'Zurück
9 .. 13, 32 .. 255: if i < input_len 'normales zeichen ios.printbs
ios.printchar(n) i--
byte[@input_str][i] := n byte[@input_str][i] := 0
i++ 9 .. 13, 32 .. 255: if i < input_len 'normales zeichen
byte[@input_str][i] := 0 ios.printchar(n)
byte[@input_str][i] := n
i++
byte[@input_str][i] := 0
ios.curoff ios.curoff
nooutput := FALSE 'Ausgabe wieder freigeben
PRI readLine(timeout) : ch PRI readLine(timeout) : ch