v8js_methods.cc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2017 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | http://www.opensource.org/licenses/mit-license.php MIT License |
  8. +----------------------------------------------------------------------+
  9. | Author: Jani Taskinen <[email protected]> |
  10. | Author: Patrick Reilly <[email protected]> |
  11. | Author: Stefan Siegl <[email protected]> |
  12. +----------------------------------------------------------------------+
  13. */
  14. #ifdef HAVE_CONFIG_H
  15. #include "config.h"
  16. #endif
  17. #include "php_v8js_macros.h"
  18. #include "v8js_commonjs.h"
  19. #include "v8js_exceptions.h"
  20. extern "C" {
  21. #include "zend_exceptions.h"
  22. }
  23. /* global.exit - terminate execution */
  24. V8JS_METHOD(exit) /* {{{ */
  25. {
  26. v8::Isolate *isolate = info.GetIsolate();
  27. v8js_terminate_execution(isolate);
  28. }
  29. /* }}} */
  30. /* global.sleep - sleep for passed seconds */
  31. V8JS_METHOD(sleep) /* {{{ */
  32. {
  33. v8::Isolate *isolate = info.GetIsolate();
  34. v8js_ctx *c = (v8js_ctx *) isolate->GetData(0);
  35. v8::Maybe<int32_t> t = info[0]->Int32Value(v8::Local<v8::Context>::New(isolate, c->context));
  36. if (t.IsJust()) {
  37. php_sleep(t.FromJust());
  38. }
  39. }
  40. /* }}} */
  41. /* global.print - php print() */
  42. V8JS_METHOD(print) /* {{{ */
  43. {
  44. v8::Isolate *isolate = info.GetIsolate();
  45. zend_long ret = 0;
  46. for (int i = 0; i < info.Length(); i++) {
  47. v8::String::Utf8Value str(isolate, info[i]);
  48. const char *cstr = ToCString(str);
  49. ret = PHPWRITE(cstr, strlen(cstr));
  50. }
  51. info.GetReturnValue().Set(zend_long_to_v8js(ret, isolate));
  52. }
  53. /* }}} */
  54. static void v8js_dumper(v8::Isolate *isolate, v8::Local<v8::Value> var, int level) /* {{{ */
  55. {
  56. v8js_ctx *c = (v8js_ctx *) isolate->GetData(0);
  57. v8::Local<v8::Context> v8_context = v8::Local<v8::Context>::New(isolate, c->context);
  58. if (level > 1) {
  59. php_printf("%*c", (level - 1) * 2, ' ');
  60. }
  61. if (var.IsEmpty())
  62. {
  63. php_printf("<empty>\n");
  64. return;
  65. }
  66. if (var->IsNull() || var->IsUndefined() /* PHP compat */)
  67. {
  68. php_printf("NULL\n");
  69. return;
  70. }
  71. if (var->IsInt32())
  72. {
  73. v8::Maybe<int64_t> value = var->IntegerValue(v8_context);
  74. if (value.IsNothing())
  75. {
  76. php_printf("<empty>\n");
  77. }
  78. else
  79. {
  80. php_printf("int(%ld)\n", (long) value.FromJust());
  81. }
  82. return;
  83. }
  84. if (var->IsUint32())
  85. {
  86. v8::Maybe<uint32_t> value = var->Uint32Value(v8_context);
  87. if (value.IsNothing())
  88. {
  89. php_printf("<empty>\n");
  90. }
  91. else
  92. {
  93. php_printf("int(%lu)\n", (unsigned long) value.FromJust());
  94. }
  95. return;
  96. }
  97. if (var->IsNumber())
  98. {
  99. v8::Maybe<double> value = var->NumberValue(v8_context);
  100. if (value.IsNothing())
  101. {
  102. php_printf("<empty>\n");
  103. }
  104. else
  105. {
  106. php_printf("float(%f)\n", value.FromJust());
  107. }
  108. return;
  109. }
  110. if (var->IsBoolean())
  111. {
  112. bool value = var->BooleanValue(isolate);
  113. php_printf("bool(%s)\n", value ? "true" : "false");
  114. return;
  115. }
  116. v8::TryCatch try_catch(isolate); /* object.toString() can throw an exception */
  117. v8::Local<v8::String> details;
  118. if(var->IsRegExp()) {
  119. v8::RegExp *re = v8::RegExp::Cast(*var);
  120. details = re->GetSource();
  121. }
  122. else {
  123. details = var->ToDetailString(v8_context).FromMaybe(v8::Local<v8::String>());
  124. if (try_catch.HasCaught()) {
  125. details = V8JS_SYM("<toString threw exception>");
  126. }
  127. }
  128. v8::String::Utf8Value str(isolate, details);
  129. const char *valstr = ToCString(str);
  130. size_t valstr_len = str.length();
  131. if (var->IsString())
  132. {
  133. php_printf("string(%zu) \"", valstr_len);
  134. PHPWRITE(valstr, valstr_len);
  135. php_printf("\"\n");
  136. }
  137. else if (var->IsDate())
  138. {
  139. // fake the fields of a PHP DateTime
  140. php_printf("Date(%s)\n", valstr);
  141. }
  142. else if (var->IsRegExp())
  143. {
  144. php_printf("regexp(/%s/)\n", valstr);
  145. }
  146. else if (var->IsArray())
  147. {
  148. v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(var);
  149. uint32_t length = array->Length();
  150. php_printf("array(%d) {\n", length);
  151. for (unsigned i = 0; i < length; i++) {
  152. php_printf("%*c[%d] =>\n", level * 2, ' ', i);
  153. v8::MaybeLocal<v8::Value> value = array->Get(v8_context, i);
  154. if (value.IsEmpty())
  155. {
  156. php_printf("<empty>\n");
  157. }
  158. else
  159. {
  160. v8js_dumper(isolate, value.ToLocalChecked(), level + 1);
  161. }
  162. }
  163. if (level > 1) {
  164. php_printf("%*c", (level - 1) * 2, ' ');
  165. }
  166. ZEND_PUTS("}\n");
  167. }
  168. else if (var->IsObject())
  169. {
  170. v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(var);
  171. v8::String::Utf8Value cname(isolate, object->GetConstructorName());
  172. int hash = object->GetIdentityHash();
  173. if (var->IsFunction() && strcmp(ToCString(cname), "Closure") != 0)
  174. {
  175. php_printf("object(Closure)#%d {\n%*c", hash, level * 2 + 2, ' ');
  176. v8::Local<v8::String> source;
  177. if (object->ToString(v8_context).ToLocal(&source))
  178. {
  179. v8::String::Utf8Value csource(isolate, source);
  180. php_printf("%s\n", ToCString(csource));
  181. }
  182. else
  183. {
  184. php_printf("<empty>\n");
  185. }
  186. }
  187. else
  188. {
  189. v8::MaybeLocal<v8::Array> keys = object->GetOwnPropertyNames(v8_context);
  190. uint32_t length = keys.IsEmpty() ? 0 : keys.ToLocalChecked()->Length();
  191. if (strcmp(ToCString(cname), "Array") == 0 ||
  192. strcmp(ToCString(cname), "V8Object") == 0) {
  193. php_printf("array");
  194. } else {
  195. php_printf("object(%s)#%d", ToCString(cname), hash);
  196. }
  197. php_printf(" (%d) {\n", length);
  198. for (unsigned i = 0; i < length; i++) {
  199. v8::MaybeLocal<v8::Value> key_slot = keys.ToLocalChecked()->Get(v8_context, i);
  200. v8::Local<v8::String> key;
  201. if (key_slot.IsEmpty() || !key_slot.ToLocalChecked()->ToString(v8_context).ToLocal(&key))
  202. {
  203. key = V8JS_SYM("<empty>");
  204. }
  205. v8::String::Utf8Value key_name(isolate, key);
  206. php_printf("%*c[\"%s\"] =>\n", level * 2, ' ', ToCString(key_name));
  207. v8::MaybeLocal<v8::Value> value = object->Get(v8_context, key);
  208. if (value.IsEmpty())
  209. {
  210. php_printf("<empty>\n");
  211. }
  212. else
  213. {
  214. v8js_dumper(isolate, value.ToLocalChecked(), level + 1);
  215. }
  216. }
  217. }
  218. if (level > 1) {
  219. php_printf("%*c", (level - 1) * 2, ' ');
  220. }
  221. ZEND_PUTS("}\n");
  222. }
  223. else /* null, undefined, etc. */
  224. {
  225. php_printf("<%s>\n", valstr);
  226. }
  227. }
  228. /* }}} */
  229. /* global.var_dump - Dump JS values */
  230. V8JS_METHOD(var_dump) /* {{{ */
  231. {
  232. v8::Isolate *isolate = info.GetIsolate();
  233. for (int i = 0; i < info.Length(); i++) {
  234. v8js_dumper(isolate, info[i], 1);
  235. }
  236. info.GetReturnValue().Set(V8JS_NULL);
  237. }
  238. /* }}} */
  239. V8JS_METHOD(require)
  240. {
  241. v8::Isolate *isolate = info.GetIsolate();
  242. v8js_ctx *c = (v8js_ctx *) isolate->GetData(0);
  243. v8::String::Utf8Value module_base(isolate, info.Data());
  244. const char *module_base_cstr = ToCString(module_base);
  245. // Check that we have a module loader
  246. if(Z_TYPE(c->module_loader) == IS_NULL) {
  247. info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("No module loader")));
  248. return;
  249. }
  250. v8::String::Utf8Value module_id_v8(isolate, info[0]);
  251. const char *module_id = ToCString(module_id_v8);
  252. char *normalised_path, *module_name;
  253. if (Z_TYPE(c->module_normaliser) == IS_NULL) {
  254. // No custom normalisation routine registered, use internal one
  255. normalised_path = (char *)emalloc(PATH_MAX);
  256. module_name = (char *)emalloc(PATH_MAX);
  257. v8js_commonjs_normalise_identifier(module_base_cstr, module_id, normalised_path, module_name);
  258. }
  259. else {
  260. // Call custom normaliser
  261. int call_result;
  262. zval params[2];
  263. zval normaliser_result;
  264. zend_try {
  265. {
  266. isolate->Exit();
  267. v8::Unlocker unlocker(isolate);
  268. ZVAL_STRING(&params[0], module_base_cstr);
  269. ZVAL_STRING(&params[1], module_id);
  270. call_result = call_user_function(EG(function_table), NULL, &c->module_normaliser,
  271. &normaliser_result, 2, params);
  272. }
  273. isolate->Enter();
  274. if (call_result == FAILURE) {
  275. info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module normaliser callback failed")));
  276. }
  277. }
  278. zend_catch {
  279. v8js_terminate_execution(isolate);
  280. V8JSG(fatal_error_abort) = 1;
  281. call_result = FAILURE;
  282. }
  283. zend_end_try();
  284. zval_ptr_dtor(&params[0]);
  285. zval_ptr_dtor(&params[1]);
  286. if(call_result == FAILURE) {
  287. return;
  288. }
  289. // Check if an exception was thrown
  290. if (EG(exception)) {
  291. if (c->flags & V8JS_FLAG_PROPAGATE_PHP_EXCEPTIONS) {
  292. zval tmp_zv;
  293. ZVAL_OBJ(&tmp_zv, EG(exception));
  294. info.GetReturnValue().Set(isolate->ThrowException(zval_to_v8js(&tmp_zv, isolate)));
  295. zend_clear_exception();
  296. } else {
  297. v8js_terminate_execution(isolate);
  298. }
  299. return;
  300. }
  301. if (Z_TYPE(normaliser_result) != IS_ARRAY) {
  302. zval_ptr_dtor(&normaliser_result);
  303. info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module normaliser didn't return an array")));
  304. return;
  305. }
  306. HashTable *ht = HASH_OF(&normaliser_result);
  307. int num_elements = zend_hash_num_elements(ht);
  308. if(num_elements != 2) {
  309. zval_ptr_dtor(&normaliser_result);
  310. info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module normaliser expected to return array of 2 strings")));
  311. return;
  312. }
  313. zval *data;
  314. zend_ulong index = 0;
  315. ZEND_HASH_FOREACH_VAL(ht, data) {
  316. if (Z_TYPE_P(data) != IS_STRING) {
  317. convert_to_string(data);
  318. }
  319. switch(index++) {
  320. case 0: // normalised path
  321. normalised_path = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
  322. break;
  323. case 1: // normalised module id
  324. module_name = estrndup(Z_STRVAL_P(data), Z_STRLEN_P(data));
  325. break;
  326. }
  327. }
  328. ZEND_HASH_FOREACH_END();
  329. zval_ptr_dtor(&normaliser_result);
  330. }
  331. char *normalised_module_id = (char *)emalloc(strlen(normalised_path)+1+strlen(module_name)+1);
  332. *normalised_module_id = 0;
  333. if (strlen(normalised_path) > 0) {
  334. strcat(normalised_module_id, normalised_path);
  335. strcat(normalised_module_id, "/");
  336. }
  337. strcat(normalised_module_id, module_name);
  338. efree(module_name);
  339. // Check for module cyclic dependencies
  340. for (std::vector<char *>::iterator it = c->modules_stack.begin(); it != c->modules_stack.end(); ++it)
  341. {
  342. if (!strcmp(*it, normalised_module_id)) {
  343. efree(normalised_module_id);
  344. efree(normalised_path);
  345. info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module cyclic dependency")));
  346. return;
  347. }
  348. }
  349. // If we have already loaded and cached this module then use it
  350. if (c->modules_loaded.count(normalised_module_id) > 0) {
  351. v8::Persistent<v8::Value> newobj;
  352. newobj.Reset(isolate, c->modules_loaded[normalised_module_id]);
  353. // TODO store v8::Global in c->modules_loaded directly!?
  354. info.GetReturnValue().Set(v8::Global<v8::Value>(isolate, newobj));
  355. efree(normalised_module_id);
  356. efree(normalised_path);
  357. return;
  358. }
  359. // Callback to PHP to load the module code
  360. zval module_code;
  361. int call_result;
  362. zval params[1];
  363. {
  364. isolate->Exit();
  365. v8::Unlocker unlocker(isolate);
  366. zend_try {
  367. ZVAL_STRING(&params[0], normalised_module_id);
  368. call_result = call_user_function(EG(function_table), NULL, &c->module_loader, &module_code, 1, params);
  369. }
  370. zend_catch {
  371. v8js_terminate_execution(isolate);
  372. V8JSG(fatal_error_abort) = 1;
  373. }
  374. zend_end_try();
  375. }
  376. isolate->Enter();
  377. if (V8JSG(fatal_error_abort)) {
  378. call_result = FAILURE;
  379. }
  380. else if (call_result == FAILURE) {
  381. info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module loader callback failed")));
  382. }
  383. zval_ptr_dtor(&params[0]);
  384. if (call_result == FAILURE) {
  385. efree(normalised_module_id);
  386. efree(normalised_path);
  387. return;
  388. }
  389. // Check if an exception was thrown
  390. if (EG(exception)) {
  391. efree(normalised_module_id);
  392. efree(normalised_path);
  393. if (c->flags & V8JS_FLAG_PROPAGATE_PHP_EXCEPTIONS) {
  394. zval tmp_zv;
  395. ZVAL_OBJ(&tmp_zv, EG(exception));
  396. info.GetReturnValue().Set(isolate->ThrowException(zval_to_v8js(&tmp_zv, isolate)));
  397. zend_clear_exception();
  398. } else {
  399. v8js_terminate_execution(isolate);
  400. }
  401. return;
  402. }
  403. if(Z_TYPE(module_code) == IS_ARRAY) {
  404. v8::Local<v8::Value> newarray = zval_to_v8js(&module_code, isolate);
  405. c->modules_loaded[normalised_module_id].Reset(isolate, newarray);
  406. info.GetReturnValue().Set(newarray);
  407. efree(normalised_path);
  408. return;
  409. }
  410. if(Z_TYPE(module_code) == IS_OBJECT) {
  411. v8::Local<v8::Object> newobj = zval_to_v8js(&module_code, isolate)->ToObject(isolate->GetEnteredOrMicrotaskContext()).ToLocalChecked();
  412. c->modules_loaded[normalised_module_id].Reset(isolate, newobj);
  413. info.GetReturnValue().Set(newobj);
  414. efree(normalised_path);
  415. return;
  416. }
  417. // Convert the return value to string
  418. if (Z_TYPE(module_code) != IS_STRING) {
  419. convert_to_string(&module_code);
  420. }
  421. v8::Local<v8::Context> context = v8::Local<v8::Context>::New(isolate, c->context);
  422. // Catch JS exceptions
  423. v8::TryCatch try_catch(isolate);
  424. v8::Locker locker(isolate);
  425. v8::Isolate::Scope isolate_scope(isolate);
  426. v8::HandleScope handle_scope(isolate);
  427. // Enter the module context
  428. v8::Context::Scope scope(context);
  429. // Set script identifier
  430. v8::Local<v8::String> sname = V8JS_STR(normalised_module_id);
  431. v8::ScriptOrigin origin(sname);
  432. if (Z_STRLEN(module_code) > std::numeric_limits<int>::max()) {
  433. zend_throw_exception(php_ce_v8js_exception,
  434. "Module code size exceeds maximum supported length", 0);
  435. return;
  436. }
  437. v8::Local<v8::String> source = V8JS_ZSTR(Z_STR(module_code));
  438. zval_ptr_dtor(&module_code);
  439. source = v8::String::Concat(isolate, V8JS_SYM("(function (exports, module, require) {"), source);
  440. source = v8::String::Concat(isolate, source, V8JS_SYM("\n});"));
  441. // Create and compile script
  442. v8::MaybeLocal<v8::Script> script = v8::Script::Compile(context, source, &origin);
  443. // The script will be empty if there are compile errors
  444. if (script.IsEmpty()) {
  445. efree(normalised_module_id);
  446. efree(normalised_path);
  447. info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module script compile failed")));
  448. return;
  449. }
  450. v8::Local<v8::String> base_path = V8JS_STR(normalised_path);
  451. v8::MaybeLocal<v8::Function> require_fn = v8::FunctionTemplate::New(isolate, V8JS_MN(require), base_path)->GetFunction(context);
  452. if (require_fn.IsEmpty()) {
  453. efree(normalised_path);
  454. efree(normalised_module_id);
  455. info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Failed to create require method")));
  456. return;
  457. }
  458. // Add this module and path to the stack
  459. c->modules_stack.push_back(normalised_module_id);
  460. // Run script to evaluate closure
  461. v8::MaybeLocal<v8::Value> module_function = script.ToLocalChecked()->Run(context);
  462. // Prepare exports & module object
  463. v8::Local<v8::Object> exports = v8::Object::New(isolate);
  464. v8::Local<v8::Object> module = v8::Object::New(isolate);
  465. module->Set(context, V8JS_SYM("id"), V8JS_STR(normalised_module_id));
  466. module->Set(context, V8JS_SYM("exports"), exports);
  467. if (!module_function.IsEmpty() && module_function.ToLocalChecked()->IsFunction()) {
  468. v8::Local<v8::Value> *jsArgv = static_cast<v8::Local<v8::Value> *>(alloca(3 * sizeof(v8::Local<v8::Value>)));
  469. new(&jsArgv[0]) v8::Local<v8::Value>;
  470. jsArgv[0] = exports;
  471. new(&jsArgv[1]) v8::Local<v8::Value>;
  472. jsArgv[1] = module;
  473. new(&jsArgv[2]) v8::Local<v8::Value>;
  474. jsArgv[2] = require_fn.ToLocalChecked();
  475. // actually call the module
  476. v8::Local<v8::Function>::Cast(module_function.ToLocalChecked())->Call(context, exports, 3, jsArgv);
  477. }
  478. // Remove this module and path from the stack
  479. c->modules_stack.pop_back();
  480. efree(normalised_path);
  481. if (module_function.IsEmpty() || !module_function.ToLocalChecked()->IsFunction()) {
  482. info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Wrapped module script failed to return function")));
  483. efree(normalised_module_id);
  484. return;
  485. }
  486. // Script possibly terminated, return immediately
  487. if (!try_catch.CanContinue()) {
  488. info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module script compile failed")));
  489. efree(normalised_module_id);
  490. return;
  491. }
  492. // Handle runtime JS exceptions
  493. if (try_catch.HasCaught()) {
  494. // Rethrow the exception back to JS
  495. info.GetReturnValue().Set(try_catch.ReThrow());
  496. efree(normalised_module_id);
  497. return;
  498. }
  499. v8::Local<v8::Value> newobj;
  500. // Cache the module so it doesn't need to be compiled and run again
  501. // Ensure compatibility with CommonJS implementations such as NodeJS by playing nicely with module.exports and exports
  502. v8::Local<v8::String> sym_exports = V8JS_SYM("exports");
  503. if (module->Has(context, sym_exports).FromMaybe(false))
  504. {
  505. module->Get(context, sym_exports).ToLocal(&newobj);
  506. }
  507. c->modules_loaded[normalised_module_id].Reset(isolate, newobj);
  508. info.GetReturnValue().Set(newobj);
  509. }
  510. void v8js_register_methods(v8::Local<v8::ObjectTemplate> global, v8js_ctx *c) /* {{{ */
  511. {
  512. v8::Isolate *isolate = c->isolate;
  513. global->Set(V8JS_SYM("exit"), v8::FunctionTemplate::New(isolate, V8JS_MN(exit)), v8::ReadOnly);
  514. global->Set(V8JS_SYM("sleep"), v8::FunctionTemplate::New(isolate, V8JS_MN(sleep)), v8::ReadOnly);
  515. global->Set(V8JS_SYM("print"), v8::FunctionTemplate::New(isolate, V8JS_MN(print)), v8::ReadOnly);
  516. global->Set(V8JS_SYM("var_dump"), v8::FunctionTemplate::New(isolate, V8JS_MN(var_dump)), v8::ReadOnly);
  517. v8::Local<v8::String> base_path = V8JS_STRL("", 0);
  518. global->Set(V8JS_SYM("require"), v8::FunctionTemplate::New(isolate, V8JS_MN(require), base_path), v8::ReadOnly);
  519. }
  520. /* }}} */
  521. /*
  522. * Local variables:
  523. * tab-width: 4
  524. * c-basic-offset: 4
  525. * indent-tabs-mode: t
  526. * End:
  527. * vim600: noet sw=4 ts=4 fdm=marker
  528. * vim<600: noet sw=4 ts=4
  529. */