Skip to content

Commit 72753ed

Browse files
committed
CFILE: add more commands
1 parent 324cf93 commit 72753ed

File tree

2 files changed

+377
-2
lines changed

2 files changed

+377
-2
lines changed

chc/cmdline/c_file/cfiletableutil.py

Lines changed: 153 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ def get_cfun_access(
128128
exit(1)
129129

130130

131+
# Tables from CDictionary
132+
131133
def cfile_attrparam_table(args: argparse.Namespace) -> NoReturn:
132134
"""Shows a list of indexed attribute parameters in a c-file."""
133135

@@ -145,7 +147,6 @@ def cfile_attribute_table(args: argparse.Namespace) -> NoReturn:
145147

146148
exit(0)
147149

148-
# Tables from CDictionary
149150

150151
def cfile_attributes_table(args: argparse.Namespace) -> NoReturn:
151152
"""Shows a list of indexed attribute lists in a c-file."""
@@ -428,9 +429,159 @@ def cfile_predicate_table(args: argparse.Namespace) -> NoReturn:
428429
# Function tables in CFunXprDictionary
429430

430431
def cfile_numerical_table(args: argparse.Namespace) -> NoReturn:
431-
"""Shows a list of indexed numerical terms in a function."""
432+
"""Shows a list of indexed CHIF numerical terms in a function."""
432433

433434
cfun = get_cfun_access(args, "function-table", "numerical")
434435
print(cfun.vardictionary.xd.objectmap_to_string("numerical"))
435436

436437
exit(0)
438+
439+
440+
def cfile_symbol_table(args: argparse.Namespace) -> NoReturn:
441+
"""Shows a list of indexed CHIF symbols in a function."""
442+
443+
cfun = get_cfun_access(args, "function-table", "symbol")
444+
print(cfun.vardictionary.xd.objectmap_to_string("symbol"))
445+
446+
exit(0)
447+
448+
449+
def cfile_variable_table(args: argparse.Namespace) -> NoReturn:
450+
"""Shows a list of indexed CHIF variables in a function."""
451+
452+
cfun = get_cfun_access(args, "function-table", "variable")
453+
print(cfun.vardictionary.xd.objectmap_to_string("variable"))
454+
455+
exit(0)
456+
457+
458+
def cfile_xcst_table(args: argparse.Namespace) -> NoReturn:
459+
"""Shows a list of indexed xconstants in a function."""
460+
461+
cfun = get_cfun_access(args, "function-table", "xconstant")
462+
print(cfun.vardictionary.xd.objectmap_to_string("xcst"))
463+
464+
exit(0)
465+
466+
467+
def cfile_xpr_table(args: argparse.Namespace) -> NoReturn:
468+
"""Shows a list of indexed xexpression in a function."""
469+
470+
cfun = get_cfun_access(args, "function-table", "xpr")
471+
print(cfun.vardictionary.xd.objectmap_to_string("xpr"))
472+
473+
exit(0)
474+
475+
476+
def cfile_xprlist_table(args: argparse.Namespace) -> NoReturn:
477+
"""Shows a list of indexed xexpression lists in a function."""
478+
479+
cfun = get_cfun_access(args, "function-table", "xpr-list")
480+
print(cfun.vardictionary.xd.objectmap_to_string("xprlist"))
481+
482+
exit(0)
483+
484+
485+
def cfile_xprlistlist_table(args: argparse.Namespace) -> NoReturn:
486+
"""Shows a list of indexed lists of xexpression lists in a function."""
487+
488+
cfun = get_cfun_access(args, "function-table", "xpr-list-list")
489+
print(cfun.vardictionary.xd.objectmap_to_string("xprlistlist"))
490+
491+
exit(0)
492+
493+
494+
# Function tables in CFunVarDictionary
495+
496+
def cfile_membase_table(args: argparse.Namespace) -> NoReturn:
497+
"""Shows a list of indexed memory bases in a function."""
498+
499+
cfun = get_cfun_access(args, "function-table", "memory-base")
500+
print(cfun.vardictionary.objectmap_to_string("membase"))
501+
502+
exit(0)
503+
504+
505+
def cfile_memref_table(args: argparse.Namespace) -> NoReturn:
506+
"""Shows a list of indexed memory references in a function."""
507+
508+
cfun = get_cfun_access(args, "function-table", "memory-reference")
509+
print(cfun.vardictionary.objectmap_to_string("memref"))
510+
511+
exit(0)
512+
513+
514+
def cfile_cvv_table(args: argparse.Namespace) -> NoReturn:
515+
"""Shows a list of indexed constant-value variables in a function."""
516+
517+
cfun = get_cfun_access(args, "function-table", "constant-value-variable")
518+
print(cfun.vardictionary.objectmap_to_string("cvv"))
519+
520+
exit(0)
521+
522+
523+
def cfile_cvd_table(args: argparse.Namespace) -> NoReturn:
524+
"""Shows a list of indexed variable-denotations in a function."""
525+
526+
cfun = get_cfun_access(args, "function-table", "variable-denotation")
527+
print(cfun.vardictionary.objectmap_to_string("cvd"))
528+
529+
exit(0)
530+
531+
532+
def cfile_fnvarinfo_table(args: argparse.Namespace) -> NoReturn:
533+
"""Shows a list of local function varinfos."""
534+
535+
cfun = get_cfun_access(args, "function-table", "varinfo")
536+
print(cfun.cfundecls.objectmap_to_string("local-varinfo"))
537+
538+
exit(0)
539+
540+
541+
# Function tables in CFunPODictionary
542+
543+
def cfile_ppotype_table(args: argparse.Namespace) -> NoReturn:
544+
"""Shows a list of primary proof obligations for a function."""
545+
546+
cfun = get_cfun_access(args, "function-table", "ppo-type")
547+
print(cfun.podictionary.objectmap_to_string("ppo"))
548+
549+
exit(0)
550+
551+
552+
def cfile_spotype_table(args: argparse.Namespace) -> NoReturn:
553+
"""Shows a list of supporting proof obligations for a function."""
554+
555+
cfun = get_cfun_access(args, "function-table", "spo-type")
556+
print(cfun.podictionary.objectmap_to_string("spo"))
557+
558+
exit(0)
559+
560+
561+
def cfile_assumption_table(args: argparse.Namespace) -> NoReturn:
562+
"""Shows a list of supporting proof obligations for a function."""
563+
564+
cfun = get_cfun_access(args, "function-table", "assumption")
565+
print(cfun.podictionary.objectmap_to_string("assumption"))
566+
567+
exit(0)
568+
569+
570+
# Tables in CFunInvDictionary
571+
572+
def cfile_nrv_table(args: argparse.Namespace) -> NoReturn:
573+
"""Shows a list of supporting proof obligations for a function."""
574+
575+
cfun = get_cfun_access(args, "function-table", "non-relational-value")
576+
print(cfun.invdictionary.objectmap_to_string("nrv"))
577+
578+
exit(0)
579+
580+
581+
def cfile_invfact_table(args: argparse.Namespace) -> NoReturn:
582+
"""Shows a list of supporting proof obligations for a function."""
583+
584+
cfun = get_cfun_access(args, "function-table", "invariant-fact")
585+
print(cfun.invdictionary.objectmap_to_string("invfact"))
586+
587+
exit(0)

0 commit comments

Comments
 (0)