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.sddmset(ios#DM_USER) 'u-marker setzen
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.print(@strNoNetwork)
ios.stop 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
@ -461,7 +467,7 @@ DAT ' Locale
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
@ -509,7 +515,7 @@ DAT ' Locale
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

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.sddmset(ios#DM_USER) 'u-marker setzen
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.print(@strNoNetwork)
ios.stop 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"
@ -71,7 +75,6 @@ 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,8 +1338,11 @@ 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...
ircGetLine 'Meldungen vom Server empfangen
if ios.keystat > 0 'wenn Taste gedrückt
n := ios.key
case n case n
$0d: quit 'Enter, Eingabe beenden $0d: quit 'Enter, Eingabe beenden
ios#CHAR_BS: if i > 0 'Zurück ios#CHAR_BS: if i > 0 'Zurück
@ -1338,6 +1356,7 @@ PUB input(strdesc, strdef, input_len) | i,n
byte[@input_str][i] := 0 byte[@input_str][i] := 0
ios.curoff ios.curoff
nooutput := FALSE 'Ausgabe wieder freigeben
PRI readLine(timeout) : ch PRI readLine(timeout) : ch