mirror of https://github.com/lumapu/ahoy.git
lumapu
10 months ago
35 changed files with 1037 additions and 216 deletions
@ -0,0 +1,40 @@ |
|||
import re |
|||
import os |
|||
import queue |
|||
|
|||
def error(msg): |
|||
print("ERROR: " + msg) |
|||
exit() |
|||
|
|||
def check(inp, lst, pattern): |
|||
q = queue.LifoQueue() |
|||
out = [] |
|||
keep = True |
|||
for line in inp: |
|||
x = re.findall(pattern, line) |
|||
if len(x) > 0: |
|||
if line.find("ENDIF_") != -1: |
|||
if not q.empty(): |
|||
e = q.get() |
|||
if e[0] == x[0]: |
|||
keep = e[1] |
|||
elif line.find("IF_") != -1: |
|||
q.put((x[0], keep)) |
|||
if keep is True: |
|||
keep = x[0] in lst |
|||
elif line.find("E") != -1: |
|||
if q.empty(): |
|||
error("(ELSE) missing open statement!") |
|||
e = q.get() |
|||
q.put(e) |
|||
if e[1] is True: |
|||
keep = not keep |
|||
else: |
|||
if keep is True: |
|||
out.append(line) |
|||
return out |
|||
|
|||
def conv(inp, lst): |
|||
#print(lst) |
|||
out = check(inp, lst, r'\/\*(?:IF_|ELS|ENDIF_)([A-Z0-9\-_]+)?\*\/') |
|||
return check(out, lst, r'\<\!\-\-(?:IF_|ELS|ENDIF_)([A-Z0-9\-_]+)?\-\-\>') |
@ -0,0 +1,44 @@ |
|||
//-----------------------------------------------------------------------------
|
|||
// 2024 Ahoy, https://ahoydtu.de
|
|||
// Creative Commons - http://creativecommons.org/licenses/by-nc-sa/4.0/deed
|
|||
//-----------------------------------------------------------------------------
|
|||
|
|||
#ifndef __PLUGIN_LANG_H__ |
|||
#define __PLUGIN_LANG_H__ |
|||
|
|||
#ifdef LANG_DE |
|||
#define STR_MONTHNAME_3_CHAR_LIST "ErrJanFebMrzAprMaiJunJulAugSepOktNovDez" |
|||
#define STR_DAYNAME_3_CHAR_LIST "ErrSonMonDieMitDonFreSam" |
|||
#define STR_OFFLINE "aus" |
|||
#define STR_ONLINE "aktiv" |
|||
#define STR_NO_INVERTER "kein inverter" |
|||
#define STR_NO_WIFI "WLAN nicht verbunden" |
|||
#define STR_VERSION "Version" |
|||
#define STR_ACTIVE_INVERTERS "aktive WR" |
|||
#define STR_TODAY "heute" |
|||
#define STR_TOTAL "Gesamt" |
|||
#elif LANG_FR |
|||
#define STR_MONTHNAME_3_CHAR_LIST "ErrJanFevMarAvrMaiJunJulAouSepOctNovDec" |
|||
#define STR_DAYNAME_3_CHAR_LIST "ErrDimLunMarMerJeuVenSam" |
|||
#define STR_OFFLINE "eteint" |
|||
#define STR_ONLINE "online" |
|||
#define STR_NO_INVERTER "pas d'onduleur" |
|||
#define STR_NO_WIFI "WiFi not connected" |
|||
#define STR_VERSION "Version" |
|||
#define STR_ACTIVE_INVERTERS "active Inv" |
|||
#define STR_TODAY "today" |
|||
#define STR_TOTAL "total" |
|||
#else |
|||
#define STR_MONTHNAME_3_CHAR_LIST "ErrJanFebMarAprMayJunJulAugSepOctNovDec" |
|||
#define STR_DAYNAME_3_CHAR_LIST "ErrSunMonTueWedThuFriSat" |
|||
#define STR_OFFLINE "offline" |
|||
#define STR_ONLINE "online" |
|||
#define STR_NO_INVERTER "no inverter" |
|||
#define STR_NO_WIFI "WiFi not connected" |
|||
#define STR_VERSION "Version" |
|||
#define STR_ACTIVE_INVERTERS "active Inv" |
|||
#define STR_TODAY "today" |
|||
#define STR_TOTAL "total" |
|||
#endif |
|||
|
|||
#endif /*__PLUGIN_LANG_H__*/ |
Loading…
Reference in new issue