mini_modify.alc 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. include "primitives.alh"
  2. include "constructors.alh"
  3. include "object_operations.alh"
  4. include "library.alh"
  5. include "conformance_scd.alh"
  6. include "io.alh"
  7. include "metamodels.alh"
  8. include "modelling.alh"
  9. include "typing.alh"
  10. include "compiler.alh"
  11. include "utils.alh"
  12. Boolean verbose = True
  13. String function cmd_help_m(write : Boolean):
  14. String result
  15. result = ""
  16. result = result + "Allowed operations:\n"
  17. if (write):
  18. result = result + " == READ/WRITE ==\n"
  19. result = result + " instantiate_node -- Create a new model element (node)\n"
  20. result = result + " instantiate_edge -- Create a new model element (edge)\n"
  21. result = result + " delete -- Delete an existing element\n"
  22. result = result + " attr_add -- Add an attribute to an element\n"
  23. result = result + " attr_add_code -- Add a coded attribute to an element\n"
  24. result = result + " attr_del -- Delete an attribute of an element\n"
  25. result = result + " attr_modify -- Modify an attribute of an element\n"
  26. result = result + " retype -- Change the type of an element\n"
  27. result = result + " upload -- Upload a completely new model\n"
  28. else:
  29. result = result + " == READ-ONLY ==\n"
  30. result = result + " read_outgoing -- Prints the list of outgoing links of an element\n"
  31. result = result + " read_incoming -- Prints the list of incoming links to an element\n"
  32. result = result + " list -- Prints the list of elements in the model\n"
  33. result = result + " list_full -- Prints the list of all elements in the model\n"
  34. result = result + " types -- Prints the list of elements that can be instantiated\n"
  35. result = result + " read -- Prints the current state of a model element\n"
  36. result = result + " verify -- Check whether the model conforms to the metamodel\n"
  37. result = result + " exit -- Leave the modification interface\n"
  38. return result!
  39. String function cmd_instantiate_node(write : Boolean, model : Element, mm_type_name : String, element_name : String):
  40. if (write):
  41. if (dict_in(model["metamodel"]["model"], mm_type_name)):
  42. if (dict_in(model["model"], element_name)):
  43. return "Element exists: " + element_name!
  44. else:
  45. if (is_edge(model["metamodel"]["model"][mm_type_name])):
  46. return "Incorrect format: " + mm_type_name + " is an edge instead of a node"!
  47. element_name = instantiate_node(model, mm_type_name, element_name)
  48. return "Success: " + element_name!
  49. else:
  50. return "Element not found: " + mm_type_name!
  51. else:
  52. return "Write permission denied"!
  53. String function cmd_instantiate_edge(write : Boolean, model : Element, mm_type_name : String, element_name : String, source_name : String, target_name : String):
  54. if (write):
  55. if (dict_in(model["metamodel"]["model"], mm_type_name)):
  56. if (dict_in(model["model"], element_name)):
  57. return "Element exists: " + element_name!
  58. else:
  59. if (is_edge(model["metamodel"]["model"][mm_type_name])):
  60. if (dict_in(model["model"], source_name)):
  61. if (dict_in(model["model"], target_name)):
  62. element_name = instantiate_link(model, mm_type_name, element_name, source_name, target_name)
  63. return "Success: " + element_name!
  64. else:
  65. return "Element not found: " + target_name!
  66. else:
  67. return "Element not found: " + source_name!
  68. else:
  69. return "Incorrect format: " + mm_type_name + " is a node instead of an edge"!
  70. else:
  71. return "Element not found: " + mm_type_name!
  72. else:
  73. return "Write permission denied"!
  74. String function cmd_define_attribute(write : Boolean, model : Element, element_name : String, attr_name : String, type : String):
  75. if (write):
  76. if (dict_in(model["model"], element_name)):
  77. if (dict_in(model["model"], type)):
  78. //TODO automatically find name AttributeLink, as this might change with merging...
  79. if (dict_in(model["metamodel"]["model"], "AttributeLink")):
  80. Element attrs
  81. attrs = getInstantiatableAttributes(model, element_name, "AttributeLink")
  82. if (bool_not(set_in(dict_keys(attrs), attr_name))):
  83. model_define_attribute(model, element_name, attr_name, False, type)
  84. return "Success"!
  85. else:
  86. return "Attribute exists: " + attr_name!
  87. else:
  88. return "Not a SimpleClassDiagrams model!"!
  89. else:
  90. return "Element not found: " + type!
  91. else:
  92. return "Element not found: " + element_name!
  93. else:
  94. return "Write permission denied"!
  95. String function cmd_attr_add(write : Boolean, model : Element, element_name : String, attr_name : String, value : Element):
  96. if (write):
  97. if (dict_in(model["model"], element_name)):
  98. Element attrs
  99. attrs = getAttributeList(model, element_name)
  100. if (set_in(dict_keys(attrs), attr_name)):
  101. instantiate_attribute(model, element_name, attr_name, value)
  102. return "Success"!
  103. else:
  104. return "Attribute not found: " + attr_name!
  105. else:
  106. return "Element not found: " + element_name!
  107. else:
  108. return "Write permission denied"!
  109. String function cmd_attr_add_code(write : Boolean, model : Element, element_name : String, attr_name : String):
  110. if (write):
  111. if (dict_in(model["model"], element_name)):
  112. Element attrs
  113. attrs = getAttributeList(model, element_name)
  114. if (set_in(dict_keys(attrs), attr_name)):
  115. output("Waiting for code constructors...")
  116. Element compiled
  117. compiled = compile_code(input())
  118. if (is_physical_string(compiled)):
  119. return "Compilation error: " + cast_string(compiled)!
  120. instantiate_attribute_code(model, element_name, attr_name, compiled)
  121. return "Success"!
  122. else:
  123. return "Attribute not found: " + attr_name!
  124. else:
  125. return "Element not found: " + element_name!
  126. else:
  127. return "Write permission denied"!
  128. String function cmd_attr_del(write : Boolean, model : Element, element_name : String, attr_name : String):
  129. if (write):
  130. if (dict_in(model["model"], element_name)):
  131. Element attrs
  132. attrs = getAttributeList(model, element_name)
  133. if (set_in(dict_keys(attrs), attr_name)):
  134. unset_attribute(model, element_name, attr_name)
  135. return "Success"!
  136. else:
  137. return "Attribute not found: " + attr_name!
  138. else:
  139. return "Element not found: " + element_name!
  140. else:
  141. return "Write permission denied"!
  142. String function cmd_attr_name(write : Boolean, model : Element, element_name : String, attr_name : String, new_attr_name : String):
  143. if (write):
  144. if (dict_in(model["model"], element_name)):
  145. Element attrs
  146. // TODO automatically find AttributeLink name
  147. if (dict_in(model["metamodel"]["model"], "AttributeLink")):
  148. attrs = getInstantiatableAttributes(model, element_name, "AttributeLink")
  149. if (set_in(dict_keys(attrs), attr_name)):
  150. if (set_in(dict_keys(attrs), attr_name)):
  151. if (bool_not(set_in(dict_keys(attrs), new_attr_name))):
  152. if (dict_in(model["model"][element_name], attr_name)):
  153. Boolean optional
  154. String attr_edge
  155. attr_edge = reverseKeyLookup(model["model"], dict_read_edge(model["model"][element_name], attr_name))
  156. optional = read_attribute(model, attr_edge, "optional")
  157. model_undefine_attribute(model, element_name, attr_name)
  158. model_define_attribute_ID(model, element_name, new_attr_name, optional, attrs[attr_name], attr_edge)
  159. return "Success"!
  160. else:
  161. return "Attribute not defined here: " + new_attr_name!
  162. else:
  163. return "Attribute exists: " + new_attr_name!
  164. else:
  165. return "Attribute not found: " + attr_name!
  166. else:
  167. return "Attribute not found: " + attr_name!
  168. else:
  169. return "Not a SimpleClassDiagrams model!"!
  170. else:
  171. return "Element not found: " + element_name!
  172. else:
  173. return "Write permission denied"!
  174. String function cmd_attr_type(write : Boolean, model : Element, element_name : String, attr_name : String, new_attr_type : String):
  175. if (write):
  176. if (dict_in(model["model"], element_name)):
  177. if (dict_in(model["model"], new_attr_type)):
  178. Element attrs
  179. // TODO automatically find AttributeLink name
  180. if (dict_in(model["metamodel"]["model"], "AttributeLink")):
  181. attrs = getInstantiatableAttributes(model, element_name, "AttributeLink")
  182. if (set_in(dict_keys(attrs), attr_name)):
  183. if (dict_in(model["model"][element_name], attr_name)):
  184. Boolean optional
  185. String attr_edge
  186. attr_edge = reverseKeyLookup(model["model"], dict_read_edge(model["model"][element_name], attr_name))
  187. optional = read_attribute(model, attr_edge, "optional")
  188. model_undefine_attribute(model, element_name, attr_name)
  189. model_define_attribute_ID(model, element_name, attr_name, optional, new_attr_type, attr_edge)
  190. return "Success"!
  191. else:
  192. return "Attribute not defined here: " + attr_name!
  193. else:
  194. return "Attribute not found: " + attr_name!
  195. else:
  196. return "Not a SimpleClassDiagrams model!"!
  197. else:
  198. return "Element not found: " + new_attr_type!
  199. else:
  200. return "Element not found: " + element_name!
  201. else:
  202. return "Write permission denied"!
  203. String function cmd_attr_optional(write : Boolean, model : Element, element_name : String, attr_name : String, optional : Boolean):
  204. if (write):
  205. if (dict_in(model["model"], element_name)):
  206. Element attrs
  207. // TODO automatically find AttributeLink name
  208. if (dict_in(model["metamodel"]["model"], "AttributeLink")):
  209. attrs = getInstantiatableAttributes(model, element_name, "AttributeLink")
  210. if (set_in(dict_keys(attrs), attr_name)):
  211. if (set_in(dict_keys(attrs), attr_name)):
  212. if (dict_in(model["model"][element_name], attr_name)):
  213. String attr_edge
  214. attr_edge = reverseKeyLookup(model["model"], dict_read_edge(model["model"][element_name], attr_name))
  215. model_undefine_attribute(model, element_name, attr_name)
  216. model_define_attribute_ID(model, element_name, attr_name, optional, attrs[attr_name], attr_edge)
  217. return "Success"!
  218. else:
  219. return "Attribute not defined here: " + attr_name!
  220. else:
  221. return "Attribute not defined: " + attr_name!
  222. else:
  223. return "Attribute not found: " + attr_name!
  224. else:
  225. return "Not a SimpleClassDiagrams model!"!
  226. else:
  227. return "Element not found: " + element_name!
  228. else:
  229. return "Write permission denied"!
  230. String function cmd_undefine_attribute(write : Boolean, model : Element, element_name : String, attr_name : String):
  231. if (write):
  232. if (dict_in(model["model"], element_name)):
  233. //TODO automatically find name AttributeLink, as this might change with merging...
  234. if (dict_in(model["metamodel"]["model"], "AttributeLink")):
  235. Element attrs
  236. attrs = getInstantiatableAttributes(model, element_name, "AttributeLink")
  237. if (set_in(dict_keys(attrs), attr_name)):
  238. if (set_in(dict_keys(attrs), attr_name)):
  239. if (dict_in(model["model"][element_name], attr_name)):
  240. model_undefine_attribute(model, element_name, attr_name)
  241. return "Success"!
  242. else:
  243. return "Attribute not defined here: " + attr_name!
  244. else:
  245. return "Attribute not defined: " + attr_name!
  246. else:
  247. return "Attribute not found: " + attr_name!
  248. else:
  249. return "Not a SimpleClassDiagrams model!"!
  250. else:
  251. return "Element not found: " + element_name!
  252. else:
  253. return "Write permission denied"!
  254. String function cmd_delete(write : Boolean, model : Element, element_name : String):
  255. if (write):
  256. if (dict_in(model["model"], element_name)):
  257. model_delete_element(model, element_name)
  258. return "Success"!
  259. else:
  260. return "Element not found: " + element_name!
  261. else:
  262. return "Write permission denied"!
  263. String function cmd_list_full(model : Element):
  264. Element keys_m
  265. String v_m
  266. String result
  267. String typename
  268. result = "Success: "
  269. keys_m = dict_keys(model["model"])
  270. while (set_len(keys_m) > 0):
  271. v_m = set_pop(keys_m)
  272. // Filter out anonymous objects
  273. typename = read_type(model, v_m)
  274. result = result + " " + v_m + " : " + typename + "\n"
  275. return result!
  276. String function cmd_read_outgoing(model : Element, element_name : String, type : String):
  277. String result
  278. Element elems
  279. if (dict_in(model["model"], element_name)):
  280. if (bool_or(dict_in(model["metamodel"]["model"], type), type == "")):
  281. result = "Success: "
  282. elems = allOutgoingAssociationInstances(model, element_name, type)
  283. while (set_len(elems) > 0):
  284. result = string_join(result, set_pop(elems)) + "\n"
  285. return result!
  286. else:
  287. return "Element not found: " + type!
  288. else:
  289. return "Element not found: " + element_name!
  290. String function cmd_read_incoming(model : Element, element_name : String, type : String):
  291. String result
  292. Element elems
  293. if (dict_in(model["model"], element_name)):
  294. if (bool_or(dict_in(model["metamodel"]["model"], type), type == "")):
  295. result = "Success: "
  296. elems = allIncomingAssociationInstances(model, element_name, type)
  297. while (set_len(elems) > 0):
  298. result = string_join(result, set_pop(elems)) + "\n"
  299. return result!
  300. else:
  301. return "Element not found: " + type!
  302. else:
  303. return "Element not found: " + element_name!
  304. String function cmd_connections_between(model : Element, source_name : String, target_name : String):
  305. String result
  306. Element options
  307. if (dict_in(model["model"], source_name)):
  308. if (dict_in(model["model"], target_name)):
  309. result = "Success: "
  310. options = allowedAssociationsBetween(model, source_name, target_name)
  311. while (set_len(options) > 0):
  312. result = string_join(result, set_pop(options)) + "\n"
  313. return result!
  314. else:
  315. return ("Element not found: " + target_name)!
  316. else:
  317. return ("Element not found: " + source_name)!
  318. String function cmd_read(model : Element, element_name : String):
  319. String result
  320. Element attr_list
  321. Element attr_keys
  322. String attr_key
  323. result = "Success: "
  324. if (dict_in(model["model"], element_name)):
  325. result = result + "Type: " + read_type(model, element_name) + "\n"
  326. if (is_edge(model["model"][element_name])):
  327. result = result + "Source: " + reverseKeyLookup(model["model"], read_edge_src(model["model"][element_name])) + "\n"
  328. result = result + "Destination: " + reverseKeyLookup(model["model"], read_edge_dst(model["model"][element_name])) + "\n"
  329. if (has_value(model["model"][element_name])):
  330. result = result + "Value: " + cast_value(model["model"][element_name]) + "\n"
  331. return result!
  332. else:
  333. return "Element not found: " + element_name!
  334. String function cmd_read_attrs(model : Element, element_name : String):
  335. String result
  336. Element attr_list
  337. Element attr_keys
  338. String attr_key
  339. String attr
  340. result = "Success: "
  341. if (dict_in(model["model"], element_name)):
  342. attr_list = getAttributeList(model, element_name)
  343. attr_keys = dict_keys(attr_list)
  344. while (0 < set_len(attr_keys)):
  345. attr_key = set_pop(attr_keys)
  346. attr = read_attribute(model, element_name, attr_key)
  347. if (read_type(model["metamodel"], attr_list[attr_key]) == "ActionLanguage"):
  348. if (element_eq(attr, read_root())):
  349. result = result + attr_key + " : " + cast_value(attr_list[attr_key]) + " = {\"AL\": \"\"}\n"
  350. else:
  351. result = result + attr_key + " : " + cast_value(attr_list[attr_key]) + " = {\"AL\": " + cast_value(attr) + "}\n"
  352. else:
  353. result = result + attr_key + " : " + cast_value(attr_list[attr_key]) + " = " + cast_value(attr) + "\n"
  354. return result!
  355. else:
  356. return "Element not found: " + element_name!
  357. String function cmd_read_defined_attrs(model : Element, element_name : String):
  358. String result
  359. Element attr_list
  360. Element attr_keys
  361. String attr_key
  362. Element optionality
  363. result = "Success: "
  364. if (dict_in(model["model"], element_name)):
  365. //TODO automatically find name AttributeLink, as this might change with merging...
  366. if (dict_in(model["metamodel"]["model"], "AttributeLink")):
  367. attr_list = getInstantiatableAttributes(model, element_name, "AttributeLink")
  368. optionality = getAttributeOptionality(model, element_name, "AttributeLink")
  369. attr_keys = dict_keys(attr_list)
  370. while (0 < set_len(attr_keys)):
  371. attr_key = set_pop(attr_keys)
  372. if (optionality[attr_key]):
  373. result = string_join(result, attr_key) + " ?: " + cast_string(attr_list[attr_key]) + "\n"
  374. else:
  375. result = string_join(result, attr_key) + " : " + cast_string(attr_list[attr_key]) + "\n"
  376. return result!
  377. else:
  378. return "Not a SimpleClassDiagrams model!"!
  379. else:
  380. return "Element not found: " + element_name!
  381. String function cmd_types(model : Element):
  382. Element keys_t
  383. String v_t
  384. String result
  385. keys_t = dict_keys(model["metamodel"]["model"])
  386. result = "Success: "
  387. while (set_len(keys_t) > 0):
  388. v_t = set_pop(keys_t)
  389. result = result + string_join(" " + v_t + " : ", read_type(model["metamodel"], v_t)) + "\n"
  390. return result!
  391. String function cmd_retype(write : Boolean, model : Element, element_name : String, new_type : String):
  392. if (write):
  393. if (dict_in(model["model"], element_name)):
  394. if (dict_in(model["metamodel"]["model"], new_type)):
  395. retype(model, element_name, new_type)
  396. return "Success"!
  397. else:
  398. return "Element not found: " + new_type!
  399. else:
  400. return "Element not found: " + element_name!
  401. else:
  402. return "Write permission denied"!
  403. String function cmd_read_association_source(write : Boolean, model : Element, element_name : String):
  404. if (dict_in(model["model"], element_name)):
  405. if (is_edge(model["model"][element_name])):
  406. return "Success: " + readAssociationSource(model, element_name)!
  407. else:
  408. return "Not an association: " + element_name!
  409. else:
  410. return "Element not found: " + element_name!
  411. String function cmd_read_association_destination(write : Boolean, model : Element, element_name : String):
  412. if (dict_in(model["model"], element_name)):
  413. if (is_edge(model["model"][element_name])):
  414. return "Success: " + readAssociationDestination(model, element_name)!
  415. else:
  416. return "Not an association: " + element_name!
  417. else:
  418. return "Element not found: " + element_name!
  419. String function cmd_all_instances(model : Element, type : String):
  420. String result
  421. Element elems
  422. if (dict_in(model["metamodel"]["model"], type)):
  423. result = "Success: "
  424. elems = allInstances(model, type)
  425. while (set_len(elems) > 0):
  426. result = string_join(result, set_pop(elems)) + "\n"
  427. return result!
  428. else:
  429. return "Element not found: " + type!
  430. Boolean function modify(model : Element, write : Boolean):
  431. String cmd
  432. output("Model loaded, ready for commands!")
  433. while (True):
  434. cmd = input()
  435. if (cmd == "help"):
  436. output(cmd_help_m(write))
  437. elif (cmd == "exit"):
  438. return True!
  439. elif (cmd == "instantiate_node"):
  440. output(cmd_instantiate_node(write, model, single_input("Type?"), single_input("Name?")))
  441. elif (cmd == "instantiate_edge"):
  442. output(cmd_instantiate_edge(write, model, single_input("Type?"), single_input("Name?"), single_input("Source?"), single_input("Target?")))
  443. elif (cmd == "attr_add"):
  444. output(cmd_attr_add(write, model, single_input("Name?"), single_input("Attribute name?"), single_input("Value?")))
  445. elif (cmd == "attr_add_code"):
  446. output(cmd_attr_add_code(write, model, single_input("Name?"), single_input("Attribute name?")))
  447. elif (cmd == "attr_delete"):
  448. output(cmd_attr_del(write, model, single_input("Name?"), single_input("Attribute name?")))
  449. elif (cmd == "attr_name"):
  450. output(cmd_attr_name(write, model, single_input("Name?"), single_input("Attribute name?"), single_input("New name?")))
  451. elif (cmd == "attr_type"):
  452. output(cmd_attr_type(write, model, single_input("Name?"), single_input("Attribute name?"), single_input("Type name?")))
  453. elif (cmd == "attr_optional"):
  454. output(cmd_attr_optional(write, model, single_input("Name?"), single_input("Attribute name?"), input()))
  455. elif (cmd == "delete"):
  456. output(cmd_delete(write, model, single_input("Name?")))
  457. elif (cmd == "list_full"):
  458. output(cmd_list_full(model))
  459. elif (cmd == "JSON"):
  460. output("Success: " + JSON_print(model))
  461. elif (cmd == "read_outgoing"):
  462. output(cmd_read_outgoing(model, single_input("Name?"), single_input("Type?")))
  463. elif (cmd == "read_incoming"):
  464. output(cmd_read_incoming(model, single_input("Name?"), single_input("Type?")))
  465. elif (cmd == "read"):
  466. output(cmd_read(model, single_input("Name?")))
  467. elif (cmd == "read_attrs"):
  468. output(cmd_read_attrs(model, single_input("Name?")))
  469. elif (cmd == "read_defined_attrs"):
  470. output(cmd_read_defined_attrs(model, single_input("Name?")))
  471. elif (cmd == "types"):
  472. output(cmd_types(model))
  473. elif (cmd == "retype"):
  474. output(cmd_retype(write, model, single_input("Name?"), single_input("New type?")))
  475. elif (cmd == "read_association_source"):
  476. output(cmd_read_association_source(write, model, single_input("Name?")))
  477. elif (cmd == "read_association_destination"):
  478. output(cmd_read_association_destination(write, model, single_input("Name?")))
  479. elif (cmd == "connections_between"):
  480. output(cmd_connections_between(model, single_input("Source element?"), single_input("Target element?")))
  481. elif (cmd == "all_instances"):
  482. output(cmd_all_instances(model, single_input("Type?")))
  483. elif (cmd == "define_attribute"):
  484. output(cmd_define_attribute(write, model, single_input("On which element?"), single_input("Attribute name?"), single_input("Type?")))
  485. elif (cmd == "undefine_attribute"):
  486. output(cmd_undefine_attribute(write, model, single_input("On which element?"), single_input("Attribute name?")))
  487. else:
  488. output("Unknown command while modelling: " + cast_value(cmd))
  489. output("Use command 'help' to get a list of available commands")
  490. String function single_input(prompt : String):
  491. if (verbose):
  492. output(prompt)
  493. return input()!
  494. Element function set_input(prompt : String):
  495. Element result
  496. Element inp
  497. if (verbose):
  498. output(prompt)
  499. output("-- Set input: empty string to terminate set")
  500. result = set_create()
  501. while (True):
  502. inp = input()
  503. if (value_eq(inp, "")):
  504. return result!
  505. else:
  506. set_add(result, inp)
  507. Element function dict_input(prompt : String):
  508. Element result
  509. Element key
  510. if (verbose):
  511. output(prompt)
  512. output("-- Dict input: empty key to terminate dict")
  513. result = set_create()
  514. while (True):
  515. key = input()
  516. if (value_eq(key, "")):
  517. return result!
  518. else:
  519. dict_add(result, key, input())
  520. Void function set_verbose(v : Boolean):
  521. verbose = v
  522. return!