Compare View
Commits (8)
Showing
8 changed files
Show diff stats
anubis_dev/library/data_base/db_tools.anubis
... | ... | @@ -149,9 +149,10 @@ public define Int -> Float |
149 | 149 | Int -> DbDatum row |
150 | 150 | )= |
151 | 151 | (Int i) |-> |
152 | - if row(i) is db_float(f) then | |
152 | + with result = row(i), | |
153 | + if result is db_float(f) then | |
153 | 154 | f |
154 | - else if row(i) is db_integer(n) then | |
155 | + else if result is db_integer(n) then | |
155 | 156 | to_Float(n) |
156 | 157 | else |
157 | 158 | 0.0 | ... | ... |
anubis_dev/library/data_base/read_csv.anubis
... | ... | @@ -136,7 +136,7 @@ global define One |
136 | 136 | make_precompiled_lexer("csv_to_eol", to_eol_description, '#'). |
137 | 137 | |
138 | 138 | |
139 | -execute anbexec make_the_lexers | |
139 | +execute anbexec.1.19 make_the_lexers | |
140 | 140 | read generated/csv_c_begin_cell.anubis |
141 | 141 | read generated/csv_c_quoted_cell.anubis |
142 | 142 | read generated/csv_c_skip_cell.anubis | ... | ... |
anubis_dev/library/data_base/sqlite.anubis
... | ... | @@ -587,7 +587,7 @@ public define Result((SQLite3Error, Maybe($R)), $R) |
587 | 587 | success(fn) then fn |
588 | 588 | }, |
589 | 589 | protect |
590 | - println("BEGIN transaction for "+name); | |
590 | + //println("BEGIN transaction for "+name); | |
591 | 591 | if sql_query_timeout(db, "BEGIN", [], timeout, ms_retry_delay) is |
592 | 592 | { |
593 | 593 | error(err) then |
... | ... | @@ -608,7 +608,7 @@ public define Result((SQLite3Error, Maybe($R)), $R) |
608 | 608 | error((sqlite3(0, "User function failed during transaction"), failure)) |
609 | 609 | }, |
610 | 610 | success(result) then |
611 | - println("transaction OK for "+name); | |
611 | + //println("transaction OK for "+name); | |
612 | 612 | if sql_query_timeout(db, "COMMIT", [], timeout, ms_retry_delay) is |
613 | 613 | { |
614 | 614 | error(err) then log(err); |
... | ... | @@ -620,7 +620,7 @@ public define Result((SQLite3Error, Maybe($R)), $R) |
620 | 620 | }; |
621 | 621 | error((err, success(result))), //error in the SQL request |
622 | 622 | ok(_,_,_) then |
623 | - println("transaction COMMIT OK for "+name); | |
623 | + //println("transaction COMMIT OK for "+name); | |
624 | 624 | ok(result) |
625 | 625 | }, |
626 | 626 | } | ... | ... |
anubis_dev/library/locale/L3.anubis
... | ... | @@ -139,7 +139,9 @@ public type L3LangDicProperty: |
139 | 139 | l3LangDicProperty |
140 | 140 | ( String appName, //name of application |
141 | 141 | String appHash, //unique id of the application |
142 | - String lang_code, | |
142 | + String lang_code, //can be only language like 'fr' for french | |
143 | + //or 'fr-BE' which is a tuple of the language followed | |
144 | + //by the country here here this is a French in Belgium | |
143 | 145 | String userdef, |
144 | 146 | Int creation_date, |
145 | 147 | Int last_update | ... | ... |
anubis_dev/library/locale/L3LanguageInfo.anubis
1 | 1 | |
2 | 2 | read tools/basis.anubis |
3 | 3 | read system/string.anubis |
4 | -read locale/iso3166-1.anubis | |
4 | +transmit locale/iso3166-1.anubis | |
5 | 5 | |
6 | 6 | public type L3LanguageCode: |
7 | 7 | symbolic, |
8 | 8 | iso639_1(String), |
9 | 9 | iso639_2(String), |
10 | - vernacular(String). | |
10 | + vernacular(String). | |
11 | 11 | |
12 | 12 | public type L3LanguageInfo: |
13 | 13 | lang_info(List(L3LanguageCode) codes, // like "en", "fr", ... | ... | ... |
anubis_dev/library/locale/iso3166-1.anubis
... | ... | @@ -7,6 +7,8 @@ |
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | +read tools/function.anubis | |
11 | + | |
10 | 12 | This list states the country names (official short names in English) in alphabetical |
11 | 13 | order as given in ISO 3166-1 and the corresponding ISO 3166-1-alpha-2 code elements. |
12 | 14 | The list is updated whenever a change to the official code list in ISO 3166-1 is |
... | ... | @@ -20,28 +22,49 @@ public type L3CountryCode: |
20 | 22 | other(String). |
21 | 23 | |
22 | 24 | public type L3CountryInfo: |
23 | - country_info(List(L3CountryCode) codes, // like "en", "fr", ... | |
24 | - String english_name, | |
25 | - String self_name). // flag image | |
25 | + country_info(List(L3CountryCode) codes, // like "en", "fr", ... | |
26 | + String flag, | |
27 | + String english_name, | |
28 | + String self_name). // flag image | |
26 | 29 | |
27 | 30 | public define List(L3CountryInfo) |
28 | 31 | standard_countries = |
29 | 32 | [ |
30 | - country_info([iso3166_1("AF")], "Afghanistan", "Afğānistān افغانستان"), | |
31 | - country_info([iso3166_1("AX")], "Åland Islands", "Åland, Ahvenanmaan maakunta"), | |
32 | - country_info([iso3166_1("AL")], "Albania", "Republika e Shqipërisë"), | |
33 | - country_info([iso3166_1("DZ")], "Algeria", "Al-Jumhurīyah al-Jazā’irīyah, الجمهورية الجزائرية الديمقراطية الشعبي"), | |
34 | - country_info([iso3166_1("AD")], "Andorra", "Principat d'Andorra, Principauté d'Andorre, Principado de Andorra"), | |
35 | - country_info([iso3166_1("AS")], "American Samoa", "Amerika Samoa"), | |
36 | - country_info([iso3166_1("AS")], "American Samoa", "Amerika Samoa"), | |
37 | - country_info([iso3166_1("AS")], "American Samoa", "Amerika Samoa"), | |
38 | - country_info([iso3166_1("AS")], "American Samoa", "Amerika Samoa"), | |
39 | - country_info([iso3166_1("AS")], "American Samoa", "Amerika Samoa"), | |
40 | - country_info([iso3166_1("AS")], "American Samoa", "Amerika Samoa"), | |
41 | - country_info([iso3166_1("AS")], "American Samoa", "Amerika Samoa"), | |
33 | + country_info([iso3166_1("AF")], "af", "Afghanistan", "Afğānistān افغانستان"), | |
34 | + country_info([iso3166_1("AX")], "ax", "Åland Islands", "Åland, Ahvenanmaan maakunta"), | |
35 | + country_info([iso3166_1("AL")], "al", "Albania", "Republika e Shqipërisë"), | |
36 | + country_info([iso3166_1("DZ")], "dz", "Algeria", "Al-Jumhurīyah al-Jazā’irīyah, الجمهورية الجزائرية الديمقراطية الشعبي"), | |
37 | + country_info([iso3166_1("AD")], "ad", "Andorra", "Principat d'Andorra, Principauté d'Andorre, Principado de Andorra"), | |
38 | + country_info([iso3166_1("AS")], "as", "American Samoa", "Amerika Samoa"), | |
39 | + country_info([iso3166_1("FR")], "fr", "France", "France") | |
42 | 40 | |
43 | 41 | ]. |
44 | 42 | |
43 | +public define L3CountryInfo unknown_country_info = | |
44 | + country_info([other("unknown")], "unknown", "unknown", "unknown"). | |
45 | + | |
46 | +define L3CountryInfo | |
47 | + l3_get_country_info | |
48 | + ( | |
49 | + String country_code, | |
50 | + List(L3CountryInfo) l | |
51 | + ) = | |
52 | + if l is | |
53 | + { | |
54 | + [ ] then unknown_country_info, | |
55 | + [h . t] then | |
56 | + if (country_code = "symb") & member(h.codes, symbolic) then h | |
57 | + else if member(h.codes, iso3166_1(country_code)) then h | |
58 | + else l3_get_country_info(country_code, t) | |
59 | + }. | |
60 | + | |
61 | +public define L3CountryInfo | |
62 | + l3_get_country_info | |
63 | + ( | |
64 | + String country_code | |
65 | + ) = | |
66 | + l3_get_country_info(country_code, standard_countries) | |
67 | +. | |
45 | 68 | |
46 | 69 | ANGOLA;AO |
47 | 70 | ANGUILLA;AI | ... | ... |
anubis_dev/library/tools/buffered_connection.anubis
... | ... | @@ -80,7 +80,7 @@ define One |
80 | 80 | } |
81 | 81 | }. |
82 | 82 | |
83 | -define ReadResult | |
83 | +define Maybe(ByteArray) | |
84 | 84 | read_from_connexion |
85 | 85 | ( |
86 | 86 | Buffered_connection connection, |
... | ... | @@ -109,14 +109,13 @@ define ReadResult |
109 | 109 | // ok(ba) then ok(result + ba) |
110 | 110 | // } |
111 | 111 | else |
112 | - ok(result_buffer) | |
112 | + success(result_buffer) | |
113 | 113 | else |
114 | 114 | //if unow > dead_line then record_dubious_connection(connection,dead_line,dos) else |
115 | 115 | if read(connection.conn, 32768, time_out) is // the connection is closed after 10 minutes of inactivity |
116 | 116 | { |
117 | - error then /*println(pid + "read failed)");*/ error, | |
118 | - timeout then timeout, | |
119 | - ok(ba) then | |
117 | + failure then failure, | |
118 | + success(ba) then | |
120 | 119 | with size_read = length(ba), |
121 | 120 | //the needed read is higher than the |
122 | 121 | if size > size_read then |
... | ... | @@ -152,9 +151,8 @@ public define BC_Result |
152 | 151 | failure then |
153 | 152 | if read_from_connexion(connection, 1, t_out, constant_byte_array(1,0),0) is // the connection is closed after 10 minutes of inactivity |
154 | 153 | { |
155 | - error then failure, //error(cannot_read_from_connection), */ | |
156 | - timeout then timeout, //error(timeout(600)), */ | |
157 | - ok(ba) then if nth(0,ba) is | |
154 | + failure then failure, //error(cannot_read_from_connection), */ | |
155 | + success(ba) then if nth(0,ba) is | |
158 | 156 | { |
159 | 157 | failure then failure // error(cannot_read_from_connection), |
160 | 158 | success(c) then | ... | ... |
anubis_dev/library/tools/function.anubis
... | ... | @@ -254,7 +254,28 @@ public define List($C) |
254 | 254 | [x . map_parameter(f, p1, t)] |
255 | 255 | } |
256 | 256 | . |
257 | - | |
257 | + | |
258 | +public define $P | |
259 | +/** 'map' with a dynamic parameter. A new parameter is return as a result and | |
260 | + * pass through as parameter with next call iteration and finally returned as | |
261 | + * result of the map_parameter. This allows to make computation on the parameter | |
262 | + * like a sum | |
263 | + */ | |
264 | + map_compute | |
265 | + ( | |
266 | + ($P,$B) -> $P f, // | |
267 | + $P p, //initial parameter | |
268 | + List($B) l // | |
269 | + ) = | |
270 | + if l is | |
271 | + { | |
272 | + [ ] then p, | |
273 | + [h . t] then | |
274 | + with p1 = f(p, h), | |
275 | + map_compute(f, p1, t) | |
276 | + } | |
277 | +. | |
278 | + | |
258 | 279 | public define List($C) |
259 | 280 | /** 'map' with a dynamic parameter. A new parameter is return with the result and |
260 | 281 | * pass through as parameter with next call iteration |
... | ... | @@ -669,4 +690,4 @@ public define macro $T |
669 | 690 | (($T t) |-f-> if test(t) then f(step(t)) else t)(init). // terminal call ! |
670 | 691 | |
671 | 692 | |
672 | - | |
673 | 693 | \ No newline at end of file |
694 | + | ... | ... |