Commit 91ff319644bfd793fc320ee1b97a623dce3a01ac

Authored by Alain Prouté
1 parent fa1d90f6

-

anubis_dev/library/examples/network/sokoban.anubis
... ... @@ -1336,7 +1336,7 @@ define HTML_Page
1336 1336 (
1337 1337 List(Web_arg) lwa
1338 1338 ) =
1339   - print("length web args: "+length(lwa)+"\n");
  1339 + //print("length web args: "+length(lwa)+"\n");
1340 1340 map_forget((Web_arg wa) |-> if wa is
1341 1341 {
1342 1342 web_arg(name,value) then print("["+name+"="+value+"]\n"),
... ... @@ -1345,15 +1345,16 @@ define HTML_Page
1345 1345 with numlevel = length(all_murase_grids),
1346 1346 with level = if web_arg_value(lwa,"level") is
1347 1347 {
1348   - not_found then print("level not found\n"); 0,
1349   - found(v) then print("level arg = "+v+"\n");
  1348 + not_found then //print("level not found\n");
  1349 + 0,
  1350 + found(v) then //print("level arg = "+v+"\n");
1350 1351 if decimal_scan(v) is
1351 1352 {
1352 1353 failure then 0,
1353 1354 success(n) then n
1354 1355 }
1355 1356 },
1356   - print(">>>> level = "+level+"\n");
  1357 + //print(">>>> level = "+level+"\n");
1357 1358 html_page("Sokoban",[],
1358 1359 body([],
1359 1360 center(table([],[
... ...
anubis_dev/library/mail/smtp_server.anubis
... ... @@ -21,10 +21,10 @@ public type SMTP_ServerDescription:
21 21 (
22 22 Word32 ip_address, // 0 is OK, meaning listen on all interfaces
23 23 Word32 ip_port, // Official value is 25
24   - String server_common_name, // for example "mail.our-business.com"
25   - // or "smtp.our-business.com"
26   - String server_directory, // where the SMTP server stores its data (and mail)
27   - Int max_mail_size // maximal size (bytes) of mail the server will accept
  24 + String server_common_name, // for example "mail.our-business.com"
  25 + // or "smtp.our-business.com"
  26 + String server_directory, // where the SMTP server stores its data (and mail)
  27 + Int max_mail_size // maximal size (bytes) of mail the server will accept
28 28 ).
29 29  
30 30  
... ... @@ -37,7 +37,17 @@ public define One
37 37 SMTP_ServerDescription description
38 38 ).
39 39  
40   -
  40 + or by:
  41 +
  42 +public define One
  43 + start_smtp_server
  44 + (
  45 + SMTP_ServerDescription description,
  46 + Var(Bool) shutdown
  47 + ).
  48 +
  49 + if you want to shutdown the server by putting the value 'true' into the boolean variable.
  50 +
41 51  
42 52 If you are impatient to test it, just create a directory for your SMTP server
43 53 ('/home/georges/smtp_server' in our example), customize the following function, compile
... ... @@ -947,13 +957,15 @@ define One
947 957 public define One
948 958 start_smtp_server
949 959 (
950   - SMTP_ServerDescription desc
  960 + SMTP_ServerDescription desc,
  961 + Var(Bool) shutdown
951 962 ) =
952 963 create_directories(desc);
953 964 if start_server(ip_address(desc),
954 965 ip_port(desc),
955 966 smtp_handler(desc),
956   - (One u) |-> unique) is
  967 + (One u) |-> unique,
  968 + shutdown) is
957 969 {
958 970 cannot_create_the_socket then print("Cannot create the listening socket.\n"),
959 971 cannot_bind_to_port then print("Cannot bind to port "+ip_port(desc)+".\n"),
... ... @@ -963,7 +975,14 @@ public define One
963 975 ":"+to_decimal(ip_port(desc))+".\n")
964 976 }.
965 977  
  978 +public define One
  979 + start_smtp_server
  980 + (
  981 + SMTP_ServerDescription desc
  982 + ) =
  983 + start_smtp_server(desc,var(false)).
966 984  
  985 +
967 986  
968 987 global define One
969 988 smtp_server
... ...
anubis_dev/library/tools/adm_autoreload.anubis
... ... @@ -147,7 +147,7 @@ public define One
147 147  
148 148 The command 'start_adm_loader_bubu' creates and starts the adm loader named
149 149 'bubu'. The reason why the adm loader must have a name is that you can launch
150   - several adm loaders (which have distinct types).
  150 + several adm loaders (which also have distinct types).
151 151  
152 152 In general, you call the above function only once. The variable 'shutdown_loader'
153 153 must contain 'false'. The adm loader (which is running in the backgound)
... ... @@ -163,7 +163,7 @@ public define One
163 163 the module contains a server, to shutdown the previous
164 164 version if there was one. The function 'start...' can start the new server.
165 165 The functions 'stop_...' are also used when the adm loader
166   - itself is shutdown, i.e. when the variable 'shutdown_required' receives the value
  166 + itself is shutdown, i.e. when the variable 'shutdown_loader' receives the value
167 167 'true'. In case of a family of modules, the 'stop_...' function is applied to all
168 168 the modules of the familly which are currently loaded.
169 169  
... ... @@ -305,8 +305,8 @@ public define One
305 305  
306 306 Now, consider that we have an actual, fully justified, secondary module. If it is
307 307 a specialized module, just load it from the module using it. On the contrary, if it
308   - is a general purpose module, you may want to load it when your program start and to
309   - transmit its content to any modules to be loaded next.
  308 + is a general purpose module, you may want to load it when your program starts and to
  309 + transmit its content to some modules to be loaded next.
310 310  
311 311 However, there is a problem, because if you have two general purpose modules, it may be
312 312 the case that one of them requires the content of the other one. You cannot load them
... ... @@ -325,7 +325,7 @@ public define One
325 325 of mod1 to mod2 when this start function is executed (by the second loader).
326 326  
327 327 All this needs a lot of organization, and we plan to propose a program for automating
328   - it in the future.
  328 + (at least partially) it in the future.
329 329  
330 330  
331 331  
... ... @@ -506,7 +506,7 @@ define String
506 506 " start_"+n+",\n"+
507 507 " stop_"+n+",\n"+
508 508 " "+n+"_v),\n"+
509   - " shutdown_required,\n"+
  509 + " shutdown_loader,\n"+
510 510 " warn,\n"+
511 511 " "+to_decimal(delay)+"),\n"+
512 512 make_delegates(t)
... ... @@ -549,7 +549,7 @@ public define One
549 549 print(target,
550 550  
551 551 "\n\n This file was automatically generated.\n"+
552   - " See 'library/tools/adm_autoreload.anubis' for more explanations.\n\n"+
  552 + " See 'library/tools/adm_autoreload.anubis' for explanations.\n\n"+
553 553  
554 554 "read tools/basis.anubis\n"+
555 555 "read tools/ISO-8601.anubis\n"+
... ... @@ -558,13 +558,13 @@ public define One
558 558  
559 559 "public type AdmLoader_"+loader_name+":... (an opaque type)\n\n"+
560 560 " 'start_adm_loader_"+loader_name+"' creates and starts your adm loader.\n"+
561   - " The dynamic variable 'shutdown_required' must contain 'false'.\n"+
  561 + " The dynamic variable 'shutdown_loader' must contain 'false'.\n"+
562 562 " The adm loader will shutdown as soon as this variable receives\n"+
563 563 " the value 'true'.\n\n"+
564 564  
565 565 "public define AdmLoader_"+loader_name+" start_adm_loader_"+loader_name+"\n"+
566 566 " (\n"+
567   - " Var(Bool) shutdown_required,\n"+
  567 + " Var(Bool) shutdown_loader,\n"+
568 568 " String -> One warn,\n"+
569 569 concat(map(make_start_stop_decl,l),",\n")+
570 570 "\n ).\n\n"+
... ... @@ -607,7 +607,7 @@ public define One
607 607  
608 608 "public define AdmLoader_"+loader_name+" start_adm_loader_"+loader_name+"\n"+
609 609 " (\n"+
610   - " Var(Bool) shutdown_required,\n"+
  610 + " Var(Bool) shutdown_loader,\n"+
611 611 " String -> One warn,\n"+
612 612 concat(map(make_start_stop_decl,l),",\n")+
613 613 "\n ) =\n"+
... ...