Changeset 41160
- Timestamp:
- Nov 27, 2019, 11:06:01 AM (6 years ago)
- Location:
- trunk/Ohana/src/opihi/cmd.basic
- Files:
-
- 4 edited
-
init.c (modified) (1 diff)
-
memory.c (modified) (2 diffs)
-
test/if.sh (modified) (1 diff)
-
test/macro.sh (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.basic/init.c
r40522 r41160 73 73 {1, "??", list_vars, "list variables *"}, 74 74 {1, "#", nop, "a NOP function"}, 75 {1, "##", nop, "a NOP function"}, 76 {1, "###", nop, "a NOP function"}, 75 77 {1, "local", local, "define local variables"}, 76 78 {1, "macro", macro, "deal with the macros *"}, -
trunk/Ohana/src/opihi/cmd.basic/memory.c
r14177 r41160 5 5 6 6 if (argc < 2) goto usage; 7 8 if (!strcasecmp (argv[1], "max-lines")) { 9 if (argc != 3) goto usage; 10 int MaxLines = atoi(argv[2]); 11 ohana_memdump_set_maxlines (MaxLines); 12 return TRUE; 13 } 7 14 8 15 if (!strcasecmp (argv[1], "all")) { … … 43 50 } 44 51 52 if (!strncasecmp ("strings", argv[1], strlen(argv[1]))) { 53 ohana_memdump_strings_file (stderr, FALSE); 54 return (TRUE); 55 } 56 45 57 usage: 46 gprint (GP_ERR, "USAGE: memory (all/leaks)\n"); 58 gprint (GP_ERR, "USAGE: memory (mode) [-max-lines]\n"); 59 gprint (GP_ERR, "USAGE: memory (max-lines) (N)\n"); 60 gprint (GP_ERR, " mode options: all, leaks, check, checkfree, variables, vectors, buffers, macros, commands, strings\n"); 47 61 return (FALSE); 48 62 } -
trunk/Ohana/src/opihi/cmd.basic/test/if.sh
r16894 r41160 320 320 end 321 321 end 322 323 # check memleaks 324 macro memtest1 325 326 local a b i N 327 328 $i = 0 329 $a = 1 330 331 memory check 332 output /dev/null 333 for i 0 1000 334 if ($a == 1) 335 echo "run" 336 end 337 end 338 output stdout 339 memory check 340 end 341 342 # check memleaks 343 macro memtest2 344 345 local a b i N 346 347 $i = 0 348 $a = 1 349 $b = 2 350 351 memory check 352 output /dev/null 353 for i 0 1000 354 if (($a == 1) && ($b == 2)) 355 echo "run" 356 end 357 end 358 output stdout 359 memory check 360 end 361 362 # memory test using continue 363 macro memtest3 364 365 local a b i N 366 367 $i = 0 368 $a = 1 369 $b = 2 370 371 memory check 372 output /dev/null 373 for i 0 1000 374 if (($a == 1) && ($b == 2)) 375 continue 376 echo "run" 377 end 378 end 379 output stdout 380 memory check 381 end 382 383 # memory test using continue 384 macro memtest4 385 386 local a b i N bool 387 388 389 $i = 0 390 $a = 1 391 $b = 2 392 $bool = 0 393 394 memory check 395 output /dev/null 396 for i 0 1000 397 $bool = (($a == 1) && ($b == 2)) 398 end 399 output stdout 400 memory check 401 end -
trunk/Ohana/src/opihi/cmd.basic/test/macro.sh
r10311 r41160 7 7 # Is the macro working? 8 8 macro test_prep 9 $test_var1 = check1 10 $test_var2 = check2 11 $var_count = $0 12 end 13 14 # Is the macro working? 15 macro test_local 16 local test_var test_var2 var_count 17 9 18 $test_var1 = check1 10 19 $test_var2 = check2 … … 47 56 end 48 57 end 58 59 # Memory Test for macro 60 macro memtest2 61 62 $i = 0 63 test_prep 64 65 memory check 66 for i 0 10000 67 test_prep 68 end 69 memory check 70 71 end 72 73 # Memory Test for macro 74 macro memtest3 75 76 $i = 0 77 test_local 78 79 memory check 80 for i 0 10000 81 test_local 82 end 83 memory check 84 85 end
Note:
See TracChangeset
for help on using the changeset viewer.
