filename
stringlengths
3
67
data
stringlengths
0
58.3M
license
stringlengths
0
19.5k
clang__bindings.ml
(* This file is auto-generated by stubgen tool. It should not be modified by hand and it should not be versioned (except by continuous integration on the dedicated bootstrap branch). *) external get_build_session_timestamp : unit -> int = "clang_getBuildSessionTimestamp_wrapper"[@@ocaml.doc "Return the timestamp for use with Clang's -fbuild-session-timestamp= option."] type cxvirtualfileoverlay external virtual_file_overlay_create : int -> cxvirtualfileoverlay = "clang_VirtualFileOverlay_create_wrapper" [@@ocaml.doc "Create a CXVirtualFileOverlay object. Must be disposed with clang_VirtualFileOverlay_dispose()."] type cxerrorcode = | Failure [@ocaml.doc "A generic error code, no further details are available."] | Crashed [@ocaml.doc "libclang crashed while performing the requested operation."] | InvalidArguments [@ocaml.doc "The function detected that the arguments violate the function contract."] | ASTReadError [@ocaml.doc "An AST deserialization error has occurred."] [@@deriving refl][@@ocaml.doc "Error codes returned by libclang routines."] external virtual_file_overlay_add_file_mapping : cxvirtualfileoverlay -> virtual_path:string -> real_path:string -> (unit, cxerrorcode) result = "clang_VirtualFileOverlay_addFileMapping_wrapper"[@@ocaml.doc "Map an absolute virtual file path to an absolute real one. The virtual path must be canonicalized (not contain \".\"/\"..\")."] external virtual_file_overlay_set_case_sensitivity : cxvirtualfileoverlay -> int -> (unit, cxerrorcode) result = "clang_VirtualFileOverlay_setCaseSensitivity_wrapper"[@@ocaml.doc "Set the case sensitivity for the CXVirtualFileOverlay object. The CXVirtualFileOverlay object is case-sensitive by default, this option can be used to override the default."] external virtual_file_overlay_write_to_buffer : cxvirtualfileoverlay -> int -> (string, cxerrorcode) result = "clang_VirtualFileOverlay_writeToBuffer_wrapper"[@@ocaml.doc "Write out the CXVirtualFileOverlay object to a char buffer."] type cxmodulemapdescriptor external module_map_descriptor_create : int -> cxmodulemapdescriptor = "clang_ModuleMapDescriptor_create_wrapper" [@@ocaml.doc "Create a CXModuleMapDescriptor object. Must be disposed with clang_ModuleMapDescriptor_dispose()."] external module_map_descriptor_set_framework_module_name : cxmodulemapdescriptor -> string -> (unit, cxerrorcode) result = "clang_ModuleMapDescriptor_setFrameworkModuleName_wrapper"[@@ocaml.doc "Sets the framework module name that the module.map describes."] external module_map_descriptor_set_umbrella_header : cxmodulemapdescriptor -> string -> (unit, cxerrorcode) result = "clang_ModuleMapDescriptor_setUmbrellaHeader_wrapper"[@@ocaml.doc "Sets the umbrealla header name that the module.map describes."] external module_map_descriptor_write_to_buffer : cxmodulemapdescriptor -> int -> (string, cxerrorcode) result = "clang_ModuleMapDescriptor_writeToBuffer_wrapper"[@@ocaml.doc "Write out the CXModuleMapDescriptor object to a char buffer."] type cxindex external create_index : exclude_declarations_from_pch:bool -> display_diagnostics:bool -> cxindex = "clang_createIndex_wrapper"[@@ocaml.doc "Provides a shared context for creating translation units."] module Cxglobaloptflags = struct type t = int external (+) : t -> t -> t = "%orint" let (-) x y = x land (lnot y) external (&) : t -> t -> t = "%andint" external ( * ) : t -> t -> t = "%xorint" let subset x y = (y - x) = 0 let none = 0 let thread_background_priority_for_indexing = 1 let thread_background_priority_for_editing = 2 let thread_background_priority_for_all = 3 end external cxindex_set_global_options : cxindex -> Cxglobaloptflags.t -> unit = "clang_CXIndex_setGlobalOptions_wrapper"[@@ocaml.doc "Sets general options associated with a CXIndex."] external cxindex_get_global_options : cxindex -> Cxglobaloptflags.t = "clang_CXIndex_getGlobalOptions_wrapper" [@@ocaml.doc "Gets the general options associated with a CXIndex."] type cxfile external get_file_name : cxfile -> string = "clang_getFileName_wrapper" [@@ocaml.doc "Retrieve the complete file and path name of the given file."] external get_file_time : cxfile -> int = "clang_getFileTime_wrapper"[@@ocaml.doc "Retrieve the last modification time of the given file."] type cxfileuniqueid = (int * int * int)[@@ocaml.doc "Uniquely identifies a CXFile, that refers to the same underlying file, across an indexing session."] external get_file_unique_id : cxfile -> cxfileuniqueid option = "clang_getFileUniqueID_wrapper"[@@ocaml.doc "Retrieve the unique ID for the given file."] type cxtranslationunit external is_file_multiple_include_guarded : cxtranslationunit -> cxfile -> bool = "clang_isFileMultipleIncludeGuarded_wrapper"[@@ocaml.doc "Determine whether the given header is guarded against multiple inclusions, either with the conventional #ifndef/#define/#endif macro guards or with #pragma once."] external get_file : cxtranslationunit -> string -> cxfile = "clang_getFile_wrapper"[@@ocaml.doc "Retrieve a file handle within the given translation unit."] type cxsourcelocation[@@ocaml.doc "Identifies a specific source location within a translation unit."] external get_null_location : unit -> cxsourcelocation = "clang_getNullLocation_wrapper"[@@ocaml.doc "Retrieve a NULL (invalid) source location."] external equal_locations : cxsourcelocation -> cxsourcelocation -> bool = "clang_equalLocations_wrapper"[@@ocaml.doc "Determine whether two source locations, which must refer into the same translation unit, refer to exactly the same point in the source code."] external get_location : cxtranslationunit -> cxfile -> line:int -> column:int -> cxsourcelocation = "clang_getLocation_wrapper"[@@ocaml.doc "Retrieves the source location associated with a given file/line/column in a particular translation unit."] external get_location_for_offset : cxtranslationunit -> cxfile -> int -> cxsourcelocation = "clang_getLocationForOffset_wrapper"[@@ocaml.doc "Retrieves the source location associated with a given character offset in a particular translation unit."] external location_is_in_system_header : cxsourcelocation -> bool = "clang_Location_isInSystemHeader_wrapper" [@@ocaml.doc "Returns non-zero if the given source location is in a system header."] external location_is_from_main_file : cxsourcelocation -> bool = "clang_Location_isFromMainFile_wrapper"[@@ocaml.doc "Returns non-zero if the given source location is in the main file of the corresponding translation unit."] type cxsourcerange[@@ocaml.doc "Identifies a half-open character range in the source code."] external get_null_range : unit -> cxsourcerange = "clang_getNullRange_wrapper"[@@ocaml.doc "Retrieve a NULL (invalid) source range."] external get_range : cxsourcelocation -> cxsourcelocation -> cxsourcerange = "clang_getRange_wrapper"[@@ocaml.doc "Retrieve a source range given the beginning and ending source locations."] external equal_ranges : cxsourcerange -> cxsourcerange -> bool = "clang_equalRanges_wrapper" [@@ocaml.doc "Determine whether two ranges are equivalent."] external range_is_null : cxsourcerange -> bool = "clang_Range_isNull_wrapper" [@@ocaml.doc "Returns non-zero if range is null."] external get_expansion_location : cxsourcelocation -> (cxfile * int * int * int) = "clang_getExpansionLocation_wrapper"[@@ocaml.doc "Retrieve the file, line, column, and offset represented by the given source location."] external get_presumed_location : cxsourcelocation -> (string * int * int) = "clang_getPresumedLocation_wrapper"[@@ocaml.doc "Retrieve the file, line, column, and offset represented by the given source location, as specified in a # line directive."] external get_instantiation_location : cxsourcelocation -> (cxfile * int * int * int) = "clang_getInstantiationLocation_wrapper"[@@ocaml.doc "Legacy API to retrieve the file, line, column, and offset represented by the given source location."] external get_spelling_location : cxsourcelocation -> (cxfile * int * int * int) = "clang_getSpellingLocation_wrapper"[@@ocaml.doc "Retrieve the file, line, column, and offset represented by the given source location."] external get_file_location : cxsourcelocation -> (cxfile * int * int * int) = "clang_getFileLocation_wrapper"[@@ocaml.doc "Retrieve the file, line, column, and offset represented by the given source location."] external get_range_start : cxsourcerange -> cxsourcelocation = "clang_getRangeStart_wrapper"[@@ocaml.doc "Retrieve a source location representing the first character within a source range."] external get_range_end : cxsourcerange -> cxsourcelocation = "clang_getRangeEnd_wrapper"[@@ocaml.doc "Retrieve a source location representing the last character within a source range."] external get_skipped_ranges : cxtranslationunit -> cxfile -> cxsourcerange array = "clang_getSkippedRanges_wrapper"[@@ocaml.doc "Retrieve all ranges that were skipped by the preprocessor."] type cxdiagnosticset external get_num_diagnostics_in_set : cxdiagnosticset -> int = "clang_getNumDiagnosticsInSet_wrapper"[@@ocaml.doc "Determine the number of diagnostics in a CXDiagnosticSet."] type cxdiagnostic external get_diagnostic_in_set : cxdiagnosticset -> int -> cxdiagnostic = "clang_getDiagnosticInSet_wrapper" [@@ocaml.doc "Retrieve a diagnostic associated with the given CXDiagnosticSet."] type cxloaddiag_error = | Unknown [@ocaml.doc "Indicates that an unknown error occurred while attempting to deserialize diagnostics."] | CannotLoad [@ocaml.doc "Indicates that the file containing the serialized diagnostics could not be opened."] | InvalidFile [@ocaml.doc "Indicates that the serialized diagnostics file is invalid or corrupt."] [@@deriving refl][@@ocaml.doc "Describes the kind of error that occurred (if any) in a call to clang_loadDiagnostics."] external load_diagnostics : string -> (cxdiagnosticset, (cxloaddiag_error * string)) result = "clang_loadDiagnostics_wrapper"[@@ocaml.doc "Deserialize a set of diagnostics from a Clang diagnostics bitcode file."] external get_child_diagnostics : cxdiagnostic -> cxdiagnosticset = "clang_getChildDiagnostics_wrapper" [@@ocaml.doc "Retrieve the child diagnostics of a CXDiagnostic."] external get_num_diagnostics : cxtranslationunit -> int = "clang_getNumDiagnostics_wrapper"[@@ocaml.doc "Determine the number of diagnostics produced for the given translation unit."] external get_diagnostic : cxtranslationunit -> int -> cxdiagnostic = "clang_getDiagnostic_wrapper" [@@ocaml.doc "Retrieve a diagnostic associated with the given translation unit."] external get_diagnostic_set_from_tu : cxtranslationunit -> cxdiagnosticset = "clang_getDiagnosticSetFromTU_wrapper"[@@ocaml.doc "Retrieve the complete set of diagnostics associated with a translation unit."] module Cxdiagnosticdisplayoptions = struct type t = int external (+) : t -> t -> t = "%orint" let (-) x y = x land (lnot y) external (&) : t -> t -> t = "%andint" external ( * ) : t -> t -> t = "%xorint" let subset x y = (y - x) = 0 let zero = 0 let display_source_location = 1 let display_column = 2 let display_source_ranges = 4 let display_option = 8 let display_category_id = 16 let display_category_name = 32 end external format_diagnostic : cxdiagnostic -> Cxdiagnosticdisplayoptions.t -> string = "clang_formatDiagnostic_wrapper"[@@ocaml.doc "Format the given diagnostic in a manner that is suitable for display."] external default_diagnostic_display_options : unit -> Cxdiagnosticdisplayoptions.t = "clang_defaultDiagnosticDisplayOptions_wrapper"[@@ocaml.doc "Retrieve the set of display options most similar to the default behavior of the clang compiler."] type cxdiagnosticseverity = | Ignored [@ocaml.doc "A diagnostic that has been suppressed, e.g., by a command-line option."] | Note [@ocaml.doc "This diagnostic is a note that should be attached to the previous (non-note) diagnostic."] | Warning [@ocaml.doc "This diagnostic indicates suspicious code that may not be wrong."] | Error [@ocaml.doc "This diagnostic indicates that the code is ill-formed."] | Fatal [@ocaml.doc "This diagnostic indicates that the code is ill-formed such that future parser recovery is unlikely to produce useful results."] [@@deriving refl][@@ocaml.doc "Describes the severity of a particular diagnostic."] external get_diagnostic_severity : cxdiagnostic -> cxdiagnosticseverity = "clang_getDiagnosticSeverity_wrapper"[@@ocaml.doc "Determine the severity of the given diagnostic."] external get_diagnostic_location : cxdiagnostic -> cxsourcelocation = "clang_getDiagnosticLocation_wrapper" [@@ocaml.doc "Retrieve the source location of the given diagnostic."] external get_diagnostic_spelling : cxdiagnostic -> string = "clang_getDiagnosticSpelling_wrapper"[@@ocaml.doc "Retrieve the text of the given diagnostic."] external get_diagnostic_option : cxdiagnostic -> (string * string) = "clang_getDiagnosticOption_wrapper" [@@ocaml.doc "Retrieve the name of the command-line option that enabled this diagnostic."] external get_diagnostic_category : cxdiagnostic -> int = "clang_getDiagnosticCategory_wrapper"[@@ocaml.doc "Retrieve the category number for this diagnostic."] external get_diagnostic_category_text : cxdiagnostic -> string = "clang_getDiagnosticCategoryText_wrapper"[@@ocaml.doc "Retrieve the diagnostic category text for a given diagnostic."] external get_diagnostic_num_ranges : cxdiagnostic -> int = "clang_getDiagnosticNumRanges_wrapper"[@@ocaml.doc "Determine the number of source ranges associated with the given diagnostic."] external get_diagnostic_range : cxdiagnostic -> int -> cxsourcerange = "clang_getDiagnosticRange_wrapper" [@@ocaml.doc "Retrieve a source range associated with the diagnostic."] external get_diagnostic_num_fix_its : cxdiagnostic -> int = "clang_getDiagnosticNumFixIts_wrapper"[@@ocaml.doc "Determine the number of fix-it hints associated with the given diagnostic."] external get_diagnostic_fix_it : cxdiagnostic -> int -> cxsourcerange -> (string * cxsourcerange) = "clang_getDiagnosticFixIt_wrapper"[@@ocaml.doc "Retrieve the replacement information for a given fix-it."] external get_translation_unit_spelling : cxtranslationunit -> string = "clang_getTranslationUnitSpelling_wrapper" [@@ocaml.doc "Get the original translation unit source file name."] type cxunsavedfile = { filename: string [@ocaml.doc "The file whose contents have not yet been saved."]; contents: string [@ocaml.doc "A buffer containing the unsaved contents of this file."]} [@@deriving refl][@@ocaml.doc "Provides the contents of a file that has not yet been saved to disk."] external create_translation_unit_from_source_file : cxindex -> string -> string array -> cxunsavedfile array -> cxtranslationunit = "clang_createTranslationUnitFromSourceFile_wrapper"[@@ocaml.doc "Return the CXTranslationUnit for a given source file and the provided command line arguments one would pass to the compiler."] external create_translation_unit : cxindex -> string -> cxtranslationunit = "clang_createTranslationUnit_wrapper"[@@ocaml.doc "Same as clang_createTranslationUnit2, but returns the CXTranslationUnit instead of an error code. In case of an error this routine returns a NULL CXTranslationUnit, without further detailed error codes."] external create_translation_unit2 : cxindex -> string -> (cxtranslationunit, cxerrorcode) result = "clang_createTranslationUnit2_wrapper"[@@ocaml.doc "Create a translation unit from an AST file ( -emit-ast)."] module Cxtranslationunit_flags = struct type t = int external (+) : t -> t -> t = "%orint" let (-) x y = x land (lnot y) external (&) : t -> t -> t = "%andint" external ( * ) : t -> t -> t = "%xorint" let subset x y = (y - x) = 0 let none = 0 let detailed_preprocessing_record = 1 let incomplete = 2 let precompiled_preamble = 4 let cache_completion_results = 8 let for_serialization = 16 let cxxchained_pch = 32 let skip_function_bodies = 64 let include_brief_comments_in_code_completion = 128 end external default_editing_translation_unit_options : unit -> Cxtranslationunit_flags.t = "clang_defaultEditingTranslationUnitOptions_wrapper"[@@ocaml.doc "Returns the set of flags that is suitable for parsing a translation unit that is being edited."] external parse_translation_unit : cxindex -> string -> string array -> cxunsavedfile array -> Cxtranslationunit_flags.t -> cxtranslationunit option = "clang_parseTranslationUnit_wrapper"[@@ocaml.doc "Same as clang_parseTranslationUnit2, but returns the CXTranslationUnit instead of an error code. In case of an error this routine returns a NULL CXTranslationUnit, without further detailed error codes."] external parse_translation_unit2 : cxindex -> string -> string array -> cxunsavedfile array -> Cxtranslationunit_flags.t -> (cxtranslationunit, cxerrorcode) result = "clang_parseTranslationUnit2_wrapper"[@@ocaml.doc "Parse the given source file and the translation unit corresponding to that file."] external default_save_options : cxtranslationunit -> int = "clang_defaultSaveOptions_wrapper"[@@ocaml.doc "Returns the set of flags that is suitable for saving a translation unit."] type cxsaveerror = | Unknown [@ocaml.doc "Indicates that an unknown error occurred while attempting to save the file."] | TranslationErrors [@ocaml.doc "Indicates that errors during translation prevented this attempt to save the translation unit."] | InvalidTU [@ocaml.doc "Indicates that the translation unit to be saved was somehow invalid (e.g., NULL)."] [@@deriving refl][@@ocaml.doc "Describes the kind of error that occurred (if any) in a call to clang_saveTranslationUnit()."] module Cxsavetranslationunit_flags = struct type t = int external (+) : t -> t -> t = "%orint" let (-) x y = x land (lnot y) external (&) : t -> t -> t = "%andint" external ( * ) : t -> t -> t = "%xorint" let subset x y = (y - x) = 0 let none = 0 end external save_translation_unit : cxtranslationunit -> string -> Cxsavetranslationunit_flags.t -> (unit, cxsaveerror) result = "clang_saveTranslationUnit_wrapper"[@@ocaml.doc "Saves a translation unit into a serialized representation of that translation unit on disk."] module Cxreparse_flags = struct type t = int external (+) : t -> t -> t = "%orint" let (-) x y = x land (lnot y) external (&) : t -> t -> t = "%andint" external ( * ) : t -> t -> t = "%xorint" let subset x y = (y - x) = 0 let none = 0 end external default_reparse_options : cxtranslationunit -> Cxreparse_flags.t = "clang_defaultReparseOptions_wrapper"[@@ocaml.doc "Returns the set of flags that is suitable for reparsing a translation unit."] external reparse_translation_unit : cxtranslationunit -> cxunsavedfile array -> Cxreparse_flags.t -> (unit, cxerrorcode) result = "clang_reparseTranslationUnit_wrapper"[@@ocaml.doc "Reparse the source files that produced this translation unit."] type cxturesourceusagekind = | AST | Identifiers | Selectors | GlobalCompletionResults | SourceManagerContentCache | AST_SideTables | SourceManager_Membuffer_Malloc | SourceManager_Membuffer_MMap | ExternalASTSource_Membuffer_Malloc | ExternalASTSource_Membuffer_MMap | Preprocessor | PreprocessingRecord | SourceManager_DataStructures | Preprocessor_HeaderSearch [@@deriving refl][@@ocaml.doc "Categorizes how memory is being used by a translation unit."] external get_turesource_usage_name : cxturesourceusagekind -> string = "clang_getTUResourceUsageName_wrapper" [@@ocaml.doc "Returns the human-readable null-terminated C string that represents the name of the memory category. This string should never be freed."] type cxturesourceusage[@@ocaml.doc "The memory usage of a CXTranslationUnit, broken into categories."] external get_cxturesource_usage : cxtranslationunit -> cxturesourceusage = "clang_getCXTUResourceUsage_wrapper"[@@ocaml.doc "Return the memory usage of a translation unit. This object should be released with clang_disposeCXTUResourceUsage()."] type cxcursorkind = | UnexposedDecl [@ocaml.doc "A declaration whose specific kind is not exposed via this interface."] | StructDecl [@ocaml.doc "A C or C++ struct."] | UnionDecl [@ocaml.doc "A C or C++ union."] | ClassDecl [@ocaml.doc "A C++ class."] | EnumDecl [@ocaml.doc "An enumeration."] | FieldDecl [@ocaml.doc "A field (in C) or non-static data member (in C++) in a struct, union, or C++ class."] | EnumConstantDecl [@ocaml.doc "An enumerator constant."] | FunctionDecl [@ocaml.doc "A function."] | VarDecl [@ocaml.doc "A variable."] | ParmDecl [@ocaml.doc "A function or method parameter."] | ObjCInterfaceDecl [@ocaml.doc "An Objective-C \\@interface."] | ObjCCategoryDecl [@ocaml.doc "An Objective-C \\@interface for a category."] | ObjCProtocolDecl [@ocaml.doc "An Objective-C \\@protocol declaration."] | ObjCPropertyDecl [@ocaml.doc "An Objective-C \\@property declaration."] | ObjCIvarDecl [@ocaml.doc "An Objective-C instance variable."] | ObjCInstanceMethodDecl [@ocaml.doc "An Objective-C instance method."] | ObjCClassMethodDecl [@ocaml.doc "An Objective-C class method."] | ObjCImplementationDecl [@ocaml.doc "An Objective-C \\@implementation."] | ObjCCategoryImplDecl [@ocaml.doc "An Objective-C \\@implementation for a category."] | TypedefDecl [@ocaml.doc "A typedef"] | CXXMethod [@ocaml.doc "A C++ class method."] | Namespace [@ocaml.doc "A C++ namespace."] | LinkageSpec [@ocaml.doc "A linkage specification, e.g. 'extern \"C\"'."] | Constructor [@ocaml.doc "A C++ constructor."] | Destructor [@ocaml.doc "A C++ destructor."] | ConversionFunction [@ocaml.doc "A C++ conversion function."] | TemplateTypeParameter [@ocaml.doc "A C++ template type parameter."] | NonTypeTemplateParameter [@ocaml.doc "A C++ non-type template parameter."] | TemplateTemplateParameter [@ocaml.doc "A C++ template template parameter."] | FunctionTemplate [@ocaml.doc "A C++ function template."] | ClassTemplate [@ocaml.doc "A C++ class template."] | ClassTemplatePartialSpecialization [@ocaml.doc "A C++ class template partial specialization."] | NamespaceAlias [@ocaml.doc "A C++ namespace alias declaration."] | UsingDirective [@ocaml.doc "A C++ using directive."] | UsingDeclaration [@ocaml.doc "A C++ using declaration."] | TypeAliasDecl [@ocaml.doc "A C++ alias declaration"] | ObjCSynthesizeDecl [@ocaml.doc "An Objective-C \\@synthesize definition."] | ObjCDynamicDecl [@ocaml.doc "An Objective-C \\@dynamic definition."] | CXXAccessSpecifier [@ocaml.doc "An access specifier."] | ObjCSuperClassRef [@ocaml.doc "An access specifier."] | ObjCProtocolRef [@ocaml.doc "An access specifier."] | ObjCClassRef [@ocaml.doc "An access specifier."] | TypeRef [@ocaml.doc "A reference to a type declaration."] | CXXBaseSpecifier [@ocaml.doc "A reference to a type declaration."] | TemplateRef [@ocaml.doc "A reference to a class template, function template, template template parameter, or class template partial specialization."] | NamespaceRef [@ocaml.doc "A reference to a namespace or namespace alias."] | MemberRef [@ocaml.doc "A reference to a member of a struct, union, or class that occurs in some non-expression context, e.g., a designated initializer."] | LabelRef [@ocaml.doc "A reference to a labeled statement."] | OverloadedDeclRef [@ocaml.doc "A reference to a set of overloaded functions or function templates that has not yet been resolved to a specific function or function template."] | VariableRef [@ocaml.doc "A reference to a variable that occurs in some non-expression context, e.g., a C++ lambda capture list."] | InvalidFile [@ocaml.doc "A reference to a variable that occurs in some non-expression context, e.g., a C++ lambda capture list."] | NoDeclFound [@ocaml.doc "A reference to a variable that occurs in some non-expression context, e.g., a C++ lambda capture list."] | NotImplemented [@ocaml.doc "A reference to a variable that occurs in some non-expression context, e.g., a C++ lambda capture list."] | InvalidCode [@ocaml.doc "A reference to a variable that occurs in some non-expression context, e.g., a C++ lambda capture list."] | UnexposedExpr [@ocaml.doc "An expression whose specific kind is not exposed via this interface."] | DeclRefExpr [@ocaml.doc "An expression that refers to some value declaration, such as a function, variable, or enumerator."] | MemberRefExpr [@ocaml.doc "An expression that refers to a member of a struct, union, class, Objective-C class, etc."] | CallExpr [@ocaml.doc "An expression that calls a function."] | ObjCMessageExpr [@ocaml.doc "An expression that sends a message to an Objective-C object or class."] | BlockExpr [@ocaml.doc "An expression that represents a block literal."] | IntegerLiteral [@ocaml.doc "An integer literal."] | FloatingLiteral [@ocaml.doc "A floating point number literal."] | ImaginaryLiteral [@ocaml.doc "An imaginary number literal."] | StringLiteral [@ocaml.doc "A string literal."] | CharacterLiteral [@ocaml.doc "A character literal."] | ParenExpr [@ocaml.doc "A parenthesized expression, e.g. \"(1)\"."] | UnaryOperator [@ocaml.doc "This represents the unary-expression's (except sizeof and alignof)."] | ArraySubscriptExpr [@ocaml.doc "\\[C99 6.5.2.1\\] Array Subscripting."] | BinaryOperator [@ocaml.doc "A builtin binary operation expression such as \"x + y\" or \"x <= y\"."] | CompoundAssignOperator [@ocaml.doc "Compound assignment such as \"+=\"."] | ConditionalOperator [@ocaml.doc "The ?: ternary operator."] | CStyleCastExpr [@ocaml.doc "An explicit cast in C (C99 6.5.4) or a C-style cast in C++ (C++ \\[expr.cast\\]), which uses the syntax (Type)expr."] | CompoundLiteralExpr [@ocaml.doc "\\[C99 6.5.2.5\\]"] | InitListExpr [@ocaml.doc "Describes an C or C++ initializer list."] | AddrLabelExpr [@ocaml.doc "The GNU address of label extension, representing &&label."] | StmtExpr [@ocaml.doc "This is the GNU Statement Expression extension: (\\{int X=4; X;\\})"] | GenericSelectionExpr [@ocaml.doc "Represents a C11 generic selection."] | GNUNullExpr [@ocaml.doc "Implements the GNU __null extension, which is a name for a null pointer constant that has integral type (e.g., int or long) and is the same size and alignment as a pointer."] | CXXStaticCastExpr [@ocaml.doc "C++'s static_cast<> expression."] | CXXDynamicCastExpr [@ocaml.doc "C++'s dynamic_cast<> expression."] | CXXReinterpretCastExpr [@ocaml.doc "C++'s reinterpret_cast<> expression."] | CXXConstCastExpr [@ocaml.doc "C++'s const_cast<> expression."] | CXXFunctionalCastExpr [@ocaml.doc "Represents an explicit C++ type conversion that uses \"functional\" notion (C++ \\[expr.type.conv\\])."] | CXXTypeidExpr [@ocaml.doc "A C++ typeid expression (C++ \\[expr.typeid\\])."] | CXXBoolLiteralExpr [@ocaml.doc "\\[C++ 2.13.5\\] C++ Boolean Literal."] | CXXNullPtrLiteralExpr [@ocaml.doc "\\[C++0x 2.14.7\\] C++ Pointer Literal."] | CXXThisExpr [@ocaml.doc "Represents the \"this\" expression in C++"] | CXXThrowExpr [@ocaml.doc "\\[C++ 15\\] C++ Throw Expression."] | CXXNewExpr [@ocaml.doc "A new expression for memory allocation and constructor calls, e.g: \"new CXXNewExpr(foo)\"."] | CXXDeleteExpr [@ocaml.doc "A delete expression for memory deallocation and destructor calls, e.g. \"delete\\[\\] pArray\"."] | UnaryExpr [@ocaml.doc "A unary expression."] | ObjCStringLiteral [@ocaml.doc "An Objective-C string literal i.e. \"foo\"."] | ObjCEncodeExpr [@ocaml.doc "An Objective-C \\@encode expression."] | ObjCSelectorExpr [@ocaml.doc "An Objective-C \\@selector expression."] | ObjCProtocolExpr [@ocaml.doc "An Objective-C \\@protocol expression."] | ObjCBridgedCastExpr [@ocaml.doc "An Objective-C \"bridged\" cast expression, which casts between Objective-C pointers and C pointers, transferring ownership in the process."] | PackExpansionExpr [@ocaml.doc "Represents a C++0x pack expansion that produces a sequence of expressions."] | SizeOfPackExpr [@ocaml.doc "Represents an expression that computes the length of a parameter pack."] | LambdaExpr | ObjCBoolLiteralExpr [@ocaml.doc "Objective-c Boolean Literal."] | ObjCSelfExpr [@ocaml.doc "Represents the \"self\" expression in an Objective-C method."] | UnexposedStmt [@ocaml.doc "A statement whose specific kind is not exposed via this interface."] | LabelStmt [@ocaml.doc "A labelled statement in a function."] | CompoundStmt [@ocaml.doc "A group of statements like \\{ stmt stmt \\}."] | CaseStmt [@ocaml.doc "A case statement."] | DefaultStmt [@ocaml.doc "A default statement."] | IfStmt [@ocaml.doc "An if statement"] | SwitchStmt [@ocaml.doc "A switch statement."] | WhileStmt [@ocaml.doc "A while statement."] | DoStmt [@ocaml.doc "A do statement."] | ForStmt [@ocaml.doc "A for statement."] | GotoStmt [@ocaml.doc "A goto statement."] | IndirectGotoStmt [@ocaml.doc "An indirect goto statement."] | ContinueStmt [@ocaml.doc "A continue statement."] | BreakStmt [@ocaml.doc "A break statement."] | ReturnStmt [@ocaml.doc "A return statement."] | GCCAsmStmt [@ocaml.doc "A GCC inline assembly statement extension."] | ObjCAtTryStmt [@ocaml.doc "Objective-C's overall \\@try-\\@catch-\\@finally statement."] | ObjCAtCatchStmt [@ocaml.doc "Objective-C's \\@catch statement."] | ObjCAtFinallyStmt [@ocaml.doc "Objective-C's \\@finally statement."] | ObjCAtThrowStmt [@ocaml.doc "Objective-C's \\@throw statement."] | ObjCAtSynchronizedStmt [@ocaml.doc "Objective-C's \\@synchronized statement."] | ObjCAutoreleasePoolStmt [@ocaml.doc "Objective-C's autorelease pool statement."] | ObjCForCollectionStmt [@ocaml.doc "Objective-C's collection statement."] | CXXCatchStmt [@ocaml.doc "C++'s catch statement."] | CXXTryStmt [@ocaml.doc "C++'s try statement."] | CXXForRangeStmt [@ocaml.doc "C++'s for (* : *) statement."] | SEHTryStmt [@ocaml.doc "Windows Structured Exception Handling's try statement."] | SEHExceptStmt [@ocaml.doc "Windows Structured Exception Handling's except statement."] | SEHFinallyStmt [@ocaml.doc "Windows Structured Exception Handling's finally statement."] | MSAsmStmt [@ocaml.doc "A MS inline assembly statement extension."] | NullStmt [@ocaml.doc "The null satement \";\": C99 6.8.3p3."] | DeclStmt [@ocaml.doc "Adaptor class for mixing declarations with statements and expressions."] | OMPParallelDirective [@ocaml.doc "OpenMP parallel directive."] | OMPSimdDirective [@ocaml.doc "OpenMP simd directive."] | OMPForDirective [@ocaml.doc "OpenMP for directive."] | OMPSectionsDirective [@ocaml.doc "OpenMP sections directive."] | OMPSectionDirective [@ocaml.doc "OpenMP section directive."] | OMPSingleDirective [@ocaml.doc "OpenMP single directive."] | OMPParallelForDirective [@ocaml.doc "OpenMP parallel for directive."] | OMPParallelSectionsDirective [@ocaml.doc "OpenMP parallel sections directive."] | OMPTaskDirective [@ocaml.doc "OpenMP task directive."] | OMPMasterDirective [@ocaml.doc "OpenMP master directive."] | OMPCriticalDirective [@ocaml.doc "OpenMP critical directive."] | OMPTaskyieldDirective [@ocaml.doc "OpenMP taskyield directive."] | OMPBarrierDirective [@ocaml.doc "OpenMP barrier directive."] | OMPTaskwaitDirective [@ocaml.doc "OpenMP taskwait directive."] | OMPFlushDirective [@ocaml.doc "OpenMP flush directive."] | SEHLeaveStmt [@ocaml.doc "Windows Structured Exception Handling's leave statement."] | TranslationUnit [@ocaml.doc "Cursor that represents the translation unit itself."] | UnexposedAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | IBActionAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | IBOutletAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | IBOutletCollectionAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | CXXFinalAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | CXXOverrideAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | AnnotateAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | AsmLabelAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | PackedAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | PureAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | ConstAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | NoDuplicateAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | CUDAConstantAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | CUDADeviceAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | CUDAGlobalAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | CUDAHostAttr [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | PreprocessingDirective [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | MacroDefinition [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | MacroExpansion [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | InclusionDirective [@ocaml.doc "An attribute whose specific kind is not exposed via this interface."] | ModuleImportDecl [@ocaml.doc "A module import declaration."][@@deriving refl] [@@ocaml.doc "Describes the kind of entity that a cursor refers to."] type cxcursor[@@ocaml.doc "A cursor representing some element in the abstract syntax tree for a translation unit."] external get_null_cursor : unit -> cxcursor = "clang_getNullCursor_wrapper" [@@ocaml.doc "Retrieve the NULL cursor, which represents no entity."] external get_translation_unit_cursor : cxtranslationunit -> cxcursor = "clang_getTranslationUnitCursor_wrapper" [@@ocaml.doc "Retrieve the cursor that represents the given translation unit."] external equal_cursors : cxcursor -> cxcursor -> bool = "clang_equalCursors_wrapper"[@@ocaml.doc "Determine whether two cursors are equivalent."] external cursor_is_null : cxcursor -> bool = "clang_Cursor_isNull_wrapper" [@@ocaml.doc "Returns non-zero if cursor is null."] external hash_cursor : cxcursor -> int = "clang_hashCursor_wrapper"[@@ocaml.doc "Compute a hash value for the given cursor."] external get_cursor_kind : cxcursor -> cxcursorkind = "clang_getCursorKind_wrapper"[@@ocaml.doc "Retrieve the kind of the given cursor."] external is_declaration : cxcursorkind -> bool = "clang_isDeclaration_wrapper"[@@ocaml.doc "Determine whether the given cursor kind represents a declaration."] external is_reference : cxcursorkind -> bool = "clang_isReference_wrapper" [@@ocaml.doc "Determine whether the given cursor kind represents a simple reference."] external is_expression : cxcursorkind -> bool = "clang_isExpression_wrapper" [@@ocaml.doc "Determine whether the given cursor kind represents an expression."] external is_statement : cxcursorkind -> bool = "clang_isStatement_wrapper" [@@ocaml.doc "Determine whether the given cursor kind represents a statement."] external is_attribute : cxcursorkind -> bool = "clang_isAttribute_wrapper" [@@ocaml.doc "Determine whether the given cursor kind represents an attribute."] external is_invalid : cxcursorkind -> bool = "clang_isInvalid_wrapper" [@@ocaml.doc "Determine whether the given cursor kind represents an invalid cursor."] external is_translation_unit : cxcursorkind -> bool = "clang_isTranslationUnit_wrapper"[@@ocaml.doc "Determine whether the given cursor kind represents a translation unit."] external is_preprocessing : cxcursorkind -> bool = "clang_isPreprocessing_wrapper"[@@ocaml.doc "Determine whether the given cursor represents a preprocessing element, such as a preprocessor directive or macro instantiation."] external is_unexposed : cxcursorkind -> bool = "clang_isUnexposed_wrapper" [@@ocaml.doc "Determine whether the given cursor represents a currently unexposed piece of the AST (e.g., CXCursor_UnexposedStmt)."] type cxlinkagekind = | Invalid [@ocaml.doc "This value indicates that no linkage information is available for a provided CXCursor."] | NoLinkage [@ocaml.doc "This is the linkage for variables, parameters, and so on that have automatic storage. This covers normal (non-extern) local variables."] | Internal [@ocaml.doc "This is the linkage for static variables and static functions."] | UniqueExternal [@ocaml.doc "This is the linkage for entities with external linkage that live in C++ anonymous namespaces."] | External [@ocaml.doc "This is the linkage for entities with true, external linkage."][@@deriving refl] [@@ocaml.doc "Describe the linkage of the entity referred to by a cursor."] external get_cursor_linkage : cxcursor -> cxlinkagekind = "clang_getCursorLinkage_wrapper"[@@ocaml.doc "Determine the linkage of the entity referred to by a given cursor."] type cxavailabilitykind = | Available [@ocaml.doc "The entity is available."] | Deprecated [@ocaml.doc "The entity is available, but has been deprecated (and its use is not recommended)."] | NotAvailable [@ocaml.doc "The entity is not available; any use of it will be an error."] | NotAccessible [@ocaml.doc "The entity is available, but not accessible; any use of it will be an error."] [@@deriving refl][@@ocaml.doc "Describes the availability of a particular entity, which indicates whether the use of this entity will result in a warning or error due to it being deprecated or unavailable."] external get_cursor_availability : cxcursor -> cxavailabilitykind = "clang_getCursorAvailability_wrapper" [@@ocaml.doc "Determine the availability of the entity that this cursor refers to, taking the current target platform into account."] type cxlanguagekind = | Invalid | C | ObjC | CPlusPlus [@@deriving refl][@@ocaml.doc "Describe the \"language\" of the entity referred to by a cursor."] external get_cursor_language : cxcursor -> cxlanguagekind = "clang_getCursorLanguage_wrapper"[@@ocaml.doc "Determine the \"language\" of the entity referred to by a given cursor."] type cxcursorset external create_cxcursor_set : unit -> cxcursorset = "clang_createCXCursorSet_wrapper"[@@ocaml.doc "Creates an empty CXCursorSet."] external cxcursor_set_contains : cxcursorset -> cxcursor -> int = "clang_CXCursorSet_contains_wrapper" [@@ocaml.doc "Queries a CXCursorSet to see if it contains a specific CXCursor."] external cxcursor_set_insert : cxcursorset -> cxcursor -> int = "clang_CXCursorSet_insert_wrapper" [@@ocaml.doc "Inserts a CXCursor into a CXCursorSet."] external get_cursor_semantic_parent : cxcursor -> cxcursor = "clang_getCursorSemanticParent_wrapper"[@@ocaml.doc "Determine the semantic parent of the given cursor."] external get_cursor_lexical_parent : cxcursor -> cxcursor = "clang_getCursorLexicalParent_wrapper"[@@ocaml.doc "Determine the lexical parent of the given cursor."] external get_overridden_cursors : cxcursor -> cxcursor array = "clang_getOverriddenCursors_wrapper"[@@ocaml.doc "Determine the set of methods that are overridden by the given method."] external get_included_file : cxcursor -> cxfile = "clang_getIncludedFile_wrapper"[@@ocaml.doc "Retrieve the file that is included by the given inclusion directive cursor."] external get_cursor : cxtranslationunit -> cxsourcelocation -> cxcursor = "clang_getCursor_wrapper"[@@ocaml.doc "Map a source location to the cursor that describes the entity at that location in the source code."] external get_cursor_location : cxcursor -> cxsourcelocation = "clang_getCursorLocation_wrapper"[@@ocaml.doc "Retrieve the physical location of the source constructor referenced by the given cursor."] external get_cursor_extent : cxcursor -> cxsourcerange = "clang_getCursorExtent_wrapper"[@@ocaml.doc "Retrieve the physical extent of the source construct referenced by the given cursor."] type cxtypekind = | Invalid [@ocaml.doc "Represents an invalid type (e.g., where no type is available)."] | Unexposed [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Void [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Bool [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Char_U [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | UChar [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Char16 [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Char32 [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | UShort [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | UInt [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | ULong [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | ULongLong [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | UInt128 [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Char_S [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | SChar [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | WChar [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Short [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Int [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Long [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | LongLong [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Int128 [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Float [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Double [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | LongDouble [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | NullPtr [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Overload [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Dependent [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | ObjCId [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | ObjCClass [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | ObjCSel [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Complex [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Pointer [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | BlockPointer [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | LValueReference [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | RValueReference [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Record [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Enum [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Typedef [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | ObjCInterface [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | ObjCObjectPointer [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | FunctionNoProto [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | FunctionProto [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | ConstantArray [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | Vector [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | IncompleteArray [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | VariableArray [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | DependentSizedArray [@ocaml.doc "A type whose specific kind is not exposed via this interface."] | MemberPointer [@ocaml.doc "A type whose specific kind is not exposed via this interface."][@@deriving refl] [@@ocaml.doc "Describes the kind of type"] type cxtype[@@ocaml.doc "The type of an element in the abstract syntax tree."] external get_type_kind : cxtype -> cxtypekind = "clang_getTypeKind_wrapper" external get_cursor_type : cxcursor -> cxtype = "clang_getCursorType_wrapper" [@@ocaml.doc "Retrieve the type of a CXCursor (if any)."] external get_type_spelling : cxtype -> string = "clang_getTypeSpelling_wrapper"[@@ocaml.doc "Pretty-print the underlying type using the rules of the language of the translation unit from which it came."] external get_typedef_decl_underlying_type : cxcursor -> cxtype = "clang_getTypedefDeclUnderlyingType_wrapper"[@@ocaml.doc "Retrieve the underlying type of a typedef declaration."] external get_enum_decl_integer_type : cxcursor -> cxtype = "clang_getEnumDeclIntegerType_wrapper"[@@ocaml.doc "Retrieve the integer type of an enum declaration."] external get_enum_constant_decl_value : cxcursor -> int = "clang_getEnumConstantDeclValue_wrapper"[@@ocaml.doc "Retrieve the integer value of an enum constant declaration as a signed long long."] external get_enum_constant_decl_unsigned_value : cxcursor -> int = "clang_getEnumConstantDeclUnsignedValue_wrapper"[@@ocaml.doc "Retrieve the integer value of an enum constant declaration as an unsigned long long."] external get_field_decl_bit_width : cxcursor -> int = "clang_getFieldDeclBitWidth_wrapper"[@@ocaml.doc "Retrieve the bit width of a bit field declaration as an integer."] external cursor_get_num_arguments : cxcursor -> int = "clang_Cursor_getNumArguments_wrapper"[@@ocaml.doc "Retrieve the number of non-variadic arguments associated with a given cursor."] external cursor_get_argument : cxcursor -> int -> cxcursor = "clang_Cursor_getArgument_wrapper"[@@ocaml.doc "Retrieve the argument cursor of a function or method."] external equal_types : cxtype -> cxtype -> bool = "clang_equalTypes_wrapper" [@@ocaml.doc "Determine whether two CXTypes represent the same type."] external get_canonical_type : cxtype -> cxtype = "clang_getCanonicalType_wrapper"[@@ocaml.doc "Return the canonical type for a CXType."] external is_const_qualified_type : cxtype -> bool = "clang_isConstQualifiedType_wrapper"[@@ocaml.doc "Determine whether a CXType has the \"const\" qualifier set, without looking through typedefs that may have added \"const\" at a different level."] external is_volatile_qualified_type : cxtype -> bool = "clang_isVolatileQualifiedType_wrapper"[@@ocaml.doc "Determine whether a CXType has the \"volatile\" qualifier set, without looking through typedefs that may have added \"volatile\" at a different level."] external is_restrict_qualified_type : cxtype -> bool = "clang_isRestrictQualifiedType_wrapper"[@@ocaml.doc "Determine whether a CXType has the \"restrict\" qualifier set, without looking through typedefs that may have added \"restrict\" at a different level."] external get_pointee_type : cxtype -> cxtype = "clang_getPointeeType_wrapper" [@@ocaml.doc "For pointer types, returns the type of the pointee."] external get_type_declaration : cxtype -> cxcursor = "clang_getTypeDeclaration_wrapper"[@@ocaml.doc "Return the cursor for the declaration of the given type."] external get_decl_obj_ctype_encoding : cxcursor -> string = "clang_getDeclObjCTypeEncoding_wrapper"[@@ocaml.doc "Returns the Objective-C type encoding for the specified declaration."] external get_type_kind_spelling : cxtypekind -> string = "clang_getTypeKindSpelling_wrapper"[@@ocaml.doc "Retrieve the spelling of a given CXTypeKind."] type cxcallingconv = | Default | C | X86StdCall | X86FastCall | X86ThisCall | X86Pascal | AAPCS | AAPCS_VFP | PnaclCall | IntelOclBicc | X86_64Win64 | X86_64SysV | Invalid | Unexposed [@@deriving refl][@@ocaml.doc "Describes the calling convention of a function type"] external get_function_type_calling_conv : cxtype -> cxcallingconv = "clang_getFunctionTypeCallingConv_wrapper" [@@ocaml.doc "Retrieve the calling convention associated with a function type."] external get_result_type : cxtype -> cxtype = "clang_getResultType_wrapper" [@@ocaml.doc "Retrieve the return type associated with a function type."] external get_num_arg_types : cxtype -> int = "clang_getNumArgTypes_wrapper" [@@ocaml.doc "Retrieve the number of non-variadic parameters associated with a function type."] external get_arg_type : cxtype -> int -> cxtype = "clang_getArgType_wrapper" [@@ocaml.doc "Retrieve the type of a parameter of a function type."] external is_function_type_variadic : cxtype -> bool = "clang_isFunctionTypeVariadic_wrapper"[@@ocaml.doc "Return 1 if the CXType is a variadic function type, and 0 otherwise."] external get_cursor_result_type : cxcursor -> cxtype = "clang_getCursorResultType_wrapper"[@@ocaml.doc "Retrieve the return type associated with a given cursor."] external is_podtype : cxtype -> bool = "clang_isPODType_wrapper"[@@ocaml.doc "Return 1 if the CXType is a POD (plain old data) type, and 0 otherwise."] external get_element_type : cxtype -> cxtype = "clang_getElementType_wrapper" [@@ocaml.doc "Return the element type of an array, complex, or vector type."] external get_num_elements : cxtype -> int = "clang_getNumElements_wrapper" [@@ocaml.doc "Return the number of elements of an array or vector type."] external get_array_element_type : cxtype -> cxtype = "clang_getArrayElementType_wrapper"[@@ocaml.doc "Return the element type of an array type."] external get_array_size : cxtype -> int = "clang_getArraySize_wrapper" [@@ocaml.doc "Return the array size of a constant array."] external type_get_align_of : cxtype -> int = "clang_Type_getAlignOf_wrapper" [@@ocaml.doc "Return the alignment of a type in bytes as per C++\\[expr.alignof\\] standard."] external type_get_class_type : cxtype -> cxtype = "clang_Type_getClassType_wrapper"[@@ocaml.doc "Return the class type of an member pointer type."] external type_get_size_of : cxtype -> int = "clang_Type_getSizeOf_wrapper" [@@ocaml.doc "Return the size of a type in bytes as per C++\\[expr.sizeof\\] standard."] external type_get_offset_of : cxtype -> string -> int = "clang_Type_getOffsetOf_wrapper"[@@ocaml.doc "Return the offset of a field named S in a record of type T in bits as it would be returned by __offsetof__ as per C++11\\[18.2p4\\]"] external type_get_num_template_arguments : cxtype -> int = "clang_Type_getNumTemplateArguments_wrapper"[@@ocaml.doc "Returns the number of template arguments for given class template specialization, or -1 if type T is not a class template specialization."] external type_get_template_argument_as_type : cxtype -> int -> cxtype = "clang_Type_getTemplateArgumentAsType_wrapper" [@@ocaml.doc "Returns the type template argument of a template class specialization at given index."] type cxrefqualifierkind = | None [@ocaml.doc "No ref-qualifier was provided."] | LValue [@ocaml.doc "An lvalue ref-qualifier was provided ( &)."] | RValue [@ocaml.doc "An rvalue ref-qualifier was provided ( &&)."] [@@deriving refl] external type_get_cxxref_qualifier : cxtype -> cxrefqualifierkind = "clang_Type_getCXXRefQualifier_wrapper" [@@ocaml.doc "Retrieve the ref-qualifier kind of a function or method."] external cursor_is_bit_field : cxcursor -> bool = "clang_Cursor_isBitField_wrapper"[@@ocaml.doc "Returns non-zero if the cursor specifies a Record member that is a bitfield."] external is_virtual_base : cxcursor -> bool = "clang_isVirtualBase_wrapper" [@@ocaml.doc "Returns 1 if the base class specified by the cursor with kind CX_CXXBaseSpecifier is virtual."] type cx_cxxaccessspecifier = | CXXInvalidAccessSpecifier | CXXPublic | CXXProtected | CXXPrivate [@@deriving refl][@@ocaml.doc "Represents the C++ access control level to a base class for a cursor with kind CX_CXXBaseSpecifier."] external get_cxxaccess_specifier : cxcursor -> cx_cxxaccessspecifier = "clang_getCXXAccessSpecifier_wrapper" [@@ocaml.doc "Returns the access control level for the referenced object."] external get_num_overloaded_decls : cxcursor -> int = "clang_getNumOverloadedDecls_wrapper"[@@ocaml.doc "Determine the number of overloaded declarations referenced by a CXCursor_OverloadedDeclRef cursor."] external get_overloaded_decl : cxcursor -> int -> cxcursor = "clang_getOverloadedDecl_wrapper"[@@ocaml.doc "Retrieve a cursor for one of the overloaded declarations referenced by a CXCursor_OverloadedDeclRef cursor."] external get_iboutlet_collection_type : cxcursor -> cxtype = "clang_getIBOutletCollectionType_wrapper"[@@ocaml.doc "For cursors representing an iboutletcollection attribute, this function returns the collection element type."] type cxchildvisitresult = | Break [@ocaml.doc "Terminates the cursor traversal."] | Continue [@ocaml.doc "Continues the cursor traversal with the next sibling of the cursor just visited, without visiting its children."] | Recurse [@ocaml.doc "Recursively traverse the children of this cursor, using the same visitor and client data."] [@@deriving refl][@@ocaml.doc "Describes how the traversal of the children of a particular cursor should proceed after visiting a particular child cursor."] external visit_children : cxcursor -> (cxcursor -> cxcursor -> cxchildvisitresult) -> bool = "clang_visitChildren_wrapper"[@@ocaml.doc "Visit the children of a particular cursor."] external get_cursor_usr : cxcursor -> string = "clang_getCursorUSR_wrapper" [@@ocaml.doc "Retrieve a Unified Symbol Resolution (USR) for the entity referenced by the given cursor."] external get_cursor_spelling : cxcursor -> string = "clang_getCursorSpelling_wrapper"[@@ocaml.doc "Retrieve a name for the entity referenced by this cursor."] external cursor_get_spelling_name_range : cxcursor -> piece_index:int -> options:int -> cxsourcerange = "clang_Cursor_getSpellingNameRange_wrapper"[@@ocaml.doc "Retrieve a range for a piece that forms the cursors spelling name. Most of the times there is only one range for the complete spelling but for Objective-C methods and Objective-C message expressions, there are multiple pieces for each selector identifier."] external get_cursor_display_name : cxcursor -> string = "clang_getCursorDisplayName_wrapper"[@@ocaml.doc "Retrieve the display name for the entity referenced by this cursor."] external get_cursor_referenced : cxcursor -> cxcursor = "clang_getCursorReferenced_wrapper"[@@ocaml.doc "For a cursor that is a reference, retrieve a cursor representing the entity that it references."] external get_cursor_definition : cxcursor -> cxcursor = "clang_getCursorDefinition_wrapper"[@@ocaml.doc "For a cursor that is either a reference to or a declaration of some entity, retrieve a cursor that describes the definition of that entity."] external is_cursor_definition : cxcursor -> bool = "clang_isCursorDefinition_wrapper"[@@ocaml.doc "Determine whether the declaration pointed to by this cursor is also a definition of that entity."] external get_canonical_cursor : cxcursor -> cxcursor = "clang_getCanonicalCursor_wrapper"[@@ocaml.doc "Retrieve the canonical cursor corresponding to the given cursor."] external cursor_get_obj_cselector_index : cxcursor -> int = "clang_Cursor_getObjCSelectorIndex_wrapper"[@@ocaml.doc "If the cursor points to a selector identifier in an Objective-C method or message expression, this returns the selector index."] external cursor_is_dynamic_call : cxcursor -> bool = "clang_Cursor_isDynamicCall_wrapper"[@@ocaml.doc "Given a cursor pointing to a C++ method call or an Objective-C message, returns non-zero if the method/message is \"dynamic\", meaning:"] external cursor_get_receiver_type : cxcursor -> cxtype = "clang_Cursor_getReceiverType_wrapper"[@@ocaml.doc "Given a cursor pointing to an Objective-C message, returns the CXType of the receiver."] external cursor_get_obj_cproperty_attributes : cxcursor -> int -> int = "clang_Cursor_getObjCPropertyAttributes_wrapper" [@@ocaml.doc "Given a cursor that represents a property declaration, return the associated property attributes. The bits are formed from CXObjCPropertyAttrKind."] external cursor_get_obj_cdecl_qualifiers : cxcursor -> int = "clang_Cursor_getObjCDeclQualifiers_wrapper"[@@ocaml.doc "Given a cursor that represents an Objective-C method or parameter declaration, return the associated Objective-C qualifiers for the return type or the parameter respectively. The bits are formed from CXObjCDeclQualifierKind."] external cursor_is_obj_coptional : cxcursor -> bool = "clang_Cursor_isObjCOptional_wrapper"[@@ocaml.doc "\nGiven a cursor that represents an ObjC method or property declaration,\nreturn non-zero if the declaration was affected by \"\\@optional\".\nReturns zero if the cursor is not such a declaration or it is \"\\@required\". "] external cursor_is_variadic : cxcursor -> bool = "clang_Cursor_isVariadic_wrapper"[@@ocaml.doc "Returns non-zero if the given cursor is a variadic function or method."] external cursor_get_comment_range : cxcursor -> cxsourcerange = "clang_Cursor_getCommentRange_wrapper"[@@ocaml.doc "Given a cursor that represents a declaration, return the associated comment's source range. The range may include multiple consecutive comments with whitespace in between."] external cursor_get_raw_comment_text : cxcursor -> string = "clang_Cursor_getRawCommentText_wrapper"[@@ocaml.doc "Given a cursor that represents a declaration, return the associated comment text, including comment markers."] external cursor_get_brief_comment_text : cxcursor -> string option = "clang_Cursor_getBriefCommentText_wrapper" [@@ocaml.doc "Given a cursor that represents a documentable entity (e.g., declaration), return the associated \\brief paragraph; otherwise return the first paragraph."] type cxmodule external cursor_get_module : cxcursor -> cxmodule = "clang_Cursor_getModule_wrapper"[@@ocaml.doc "Given a CXCursor_ModuleImportDecl cursor, return the associated module."] external get_module_for_file : cxtranslationunit -> cxfile -> cxmodule = "clang_getModuleForFile_wrapper" [@@ocaml.doc "Given a CXFile header file, return the module that contains it, if one exists."] external module_get_astfile : cxmodule -> cxfile = "clang_Module_getASTFile_wrapper"[@@ocaml.doc "Returns the module file where the provided module object came from."] external module_get_parent : cxmodule -> cxmodule = "clang_Module_getParent_wrapper"[@@ocaml.doc "Returns the parent of a sub-module or NULL if the given module is top-level, e.g. for 'std.vector' it will return the 'std' module."] external module_get_name : cxmodule -> string = "clang_Module_getName_wrapper"[@@ocaml.doc "Returns the name of the module, e.g. for the 'std.vector' sub-module it will return \"vector\"."] external module_get_full_name : cxmodule -> string = "clang_Module_getFullName_wrapper"[@@ocaml.doc "Returns the full name of the module, e.g. \"std.vector\"."] external module_is_system : cxmodule -> bool = "clang_Module_isSystem_wrapper"[@@ocaml.doc "Returns non-zero if the module is a system one."] external module_get_num_top_level_headers : cxtranslationunit -> cxmodule -> int = "clang_Module_getNumTopLevelHeaders_wrapper"[@@ocaml.doc "Returns the number of top level headers associated with this module."] external module_get_top_level_header : cxtranslationunit -> cxmodule -> int -> cxfile = "clang_Module_getTopLevelHeader_wrapper"[@@ocaml.doc "Returns the specified top level header associated with the module."] external cxxmethod_is_pure_virtual : cxcursor -> bool = "clang_CXXMethod_isPureVirtual_wrapper"[@@ocaml.doc "Determine if a C++ member function or member function template is pure virtual."] external cxxmethod_is_static : cxcursor -> bool = "clang_CXXMethod_isStatic_wrapper"[@@ocaml.doc "Determine if a C++ member function or member function template is declared 'static'."] external cxxmethod_is_virtual : cxcursor -> bool = "clang_CXXMethod_isVirtual_wrapper"[@@ocaml.doc "Determine if a C++ member function or member function template is explicitly declared 'virtual' or if it overrides a virtual method from one of the base classes."] external cxxmethod_is_const : cxcursor -> bool = "clang_CXXMethod_isConst_wrapper"[@@ocaml.doc "Determine if a C++ member function or member function template is declared 'const'."] external get_template_cursor_kind : cxcursor -> cxcursorkind = "clang_getTemplateCursorKind_wrapper"[@@ocaml.doc "Given a cursor that represents a template, determine the cursor kind of the specializations would be generated by instantiating the template."] external get_specialized_cursor_template : cxcursor -> cxcursor = "clang_getSpecializedCursorTemplate_wrapper" [@@ocaml.doc "Given a cursor that may represent a specialization or instantiation of a template, retrieve the cursor that represents the template that it specializes or from which it was instantiated."] external get_cursor_reference_name_range : cxcursor -> name_flags:int -> piece_index:int -> cxsourcerange = "clang_getCursorReferenceNameRange_wrapper"[@@ocaml.doc "Given a cursor that references something else, return the source range covering that reference."] type cxtokenkind = | Punctuation [@ocaml.doc "A token that contains some kind of punctuation."] | Keyword [@ocaml.doc "A language keyword."] | Identifier [@ocaml.doc "An identifier (that is not a keyword)."] | Literal [@ocaml.doc "A numeric, string, or character literal."] | Comment [@ocaml.doc "A comment."][@@deriving refl][@@ocaml.doc "Describes a kind of token."] type cxtoken[@@ocaml.doc "Describes a single preprocessing token."] external get_token_kind : cxtoken -> cxtokenkind = "clang_getTokenKind_wrapper"[@@ocaml.doc "Determine the kind of the given token."] external get_token_spelling : cxtranslationunit -> cxtoken -> string = "clang_getTokenSpelling_wrapper" [@@ocaml.doc "Determine the spelling of the given token."] external get_token_location : cxtranslationunit -> cxtoken -> cxsourcelocation = "clang_getTokenLocation_wrapper"[@@ocaml.doc "Retrieve the source location of the given token."] external get_token_extent : cxtranslationunit -> cxtoken -> cxsourcerange = "clang_getTokenExtent_wrapper"[@@ocaml.doc "Retrieve a source range that covers the given token."] external get_cursor_kind_spelling : cxcursorkind -> string = "clang_getCursorKindSpelling_wrapper"[@@ocaml.doc "These routines are used for testing and debugging, only, and should not be relied upon."] external enable_stack_traces : unit -> unit = "clang_enableStackTraces_wrapper" type cxcompletionchunkkind = | Optional [@ocaml.doc "A code-completion string that describes \"optional\" text that could be a part of the template (but is not required)."] | TypedText [@ocaml.doc "Text that a user would be expected to type to get this code-completion result."] | Text [@ocaml.doc "Text that should be inserted as part of a code-completion result."] | Placeholder [@ocaml.doc "Placeholder text that should be replaced by the user."] | Informative [@ocaml.doc "Informative text that should be displayed but never inserted as part of the template."] | CurrentParameter [@ocaml.doc "Text that describes the current parameter when code-completion is referring to function call, message send, or template specialization."] | LeftParen [@ocaml.doc "A left parenthesis ('('), used to initiate a function call or signal the beginning of a function parameter list."] | RightParen [@ocaml.doc "A right parenthesis (')'), used to finish a function call or signal the end of a function parameter list."] | LeftBracket [@ocaml.doc "A left bracket ('\\[')."] | RightBracket [@ocaml.doc "A right bracket ('\\]')."] | LeftBrace [@ocaml.doc "A left brace ('\\{')."] | RightBrace [@ocaml.doc "A right brace ('\\}')."] | LeftAngle [@ocaml.doc "A left angle bracket ('<')."] | RightAngle [@ocaml.doc "A right angle bracket ('>')."] | Comma [@ocaml.doc "A comma separator (',')."] | ResultType [@ocaml.doc "Text that specifies the result type of a given result."] | Colon [@ocaml.doc "A colon (':')."] | SemiColon [@ocaml.doc "A semicolon (';')."] | Equal [@ocaml.doc "An '=' sign."] | HorizontalSpace [@ocaml.doc "Horizontal space (' ')."] | VerticalSpace [@ocaml.doc "Vertical space (''), after which it is generally a good idea to perform indentation."] [@@deriving refl][@@ocaml.doc "Describes a single piece of text within a code-completion string."] type cxcompletionstring external get_completion_chunk_kind : cxcompletionstring -> int -> cxcompletionchunkkind = "clang_getCompletionChunkKind_wrapper"[@@ocaml.doc "Determine the kind of a particular chunk within a completion string."] external get_completion_chunk_text : cxcompletionstring -> int -> string = "clang_getCompletionChunkText_wrapper"[@@ocaml.doc "Retrieve the text associated with a particular chunk within a completion string."] external get_completion_chunk_completion_string : cxcompletionstring -> int -> cxcompletionstring = "clang_getCompletionChunkCompletionString_wrapper"[@@ocaml.doc "Retrieve the completion string associated with a particular chunk within a completion string."] external get_num_completion_chunks : cxcompletionstring -> int = "clang_getNumCompletionChunks_wrapper"[@@ocaml.doc "Retrieve the number of chunks in the given code-completion string."] external get_completion_priority : cxcompletionstring -> int = "clang_getCompletionPriority_wrapper"[@@ocaml.doc "Determine the priority of this code completion."] external get_completion_availability : cxcompletionstring -> cxavailabilitykind = "clang_getCompletionAvailability_wrapper"[@@ocaml.doc "Determine the availability of the entity that this code-completion string refers to."] external get_completion_num_annotations : cxcompletionstring -> int = "clang_getCompletionNumAnnotations_wrapper" [@@ocaml.doc "Retrieve the number of annotations associated with the given completion string."] external get_completion_annotation : cxcompletionstring -> int -> string = "clang_getCompletionAnnotation_wrapper"[@@ocaml.doc "Retrieve the annotation associated with the given completion string."] external get_completion_parent : cxcompletionstring -> string = "clang_getCompletionParent_wrapper"[@@ocaml.doc "Retrieve the parent context of the given completion string."] external get_completion_brief_comment : cxcompletionstring -> string = "clang_getCompletionBriefComment_wrapper" [@@ocaml.doc "Retrieve the brief documentation comment attached to the declaration that corresponds to the given completion string."] external get_cursor_completion_string : cxcursor -> cxcompletionstring = "clang_getCursorCompletionString_wrapper" [@@ocaml.doc "Retrieve a completion string for an arbitrary declaration or macro definition cursor."] external default_code_complete_options : unit -> int = "clang_defaultCodeCompleteOptions_wrapper"[@@ocaml.doc "Returns a default set of code-completion options that can be passed to clang_codeCompleteAt()."] external get_clang_version : unit -> string = "clang_getClangVersion_wrapper" [@@ocaml.doc "Return a version string, suitable for showing to a user, but not intended to be parsed (the format is not guaranteed to be stable)."] external toggle_crash_recovery : int -> unit = "clang_toggleCrashRecovery_wrapper"[@@ocaml.doc "Enable/disable crash recovery."] type cxremapping external get_remappings : string -> cxremapping = "clang_getRemappings_wrapper"[@@ocaml.doc "Retrieve a remapping."] external get_remappings_from_file_list : string array -> cxremapping = "clang_getRemappingsFromFileList_wrapper" [@@ocaml.doc "Retrieve a remapping."] external remap_get_num_files : cxremapping -> int = "clang_remap_getNumFiles_wrapper"[@@ocaml.doc "Determine the number of remappings."] type cxindexaction external index_action_create : cxindex -> cxindexaction = "clang_IndexAction_create_wrapper"[@@ocaml.doc "An indexing action/session, to be applied to one or multiple translation units."] type cxcomment[@@ocaml.doc "A parsed comment."] external cursor_get_parsed_comment : cxcursor -> cxcomment = "clang_Cursor_getParsedComment_wrapper"[@@ocaml.doc "Given a cursor that represents a documentable entity (e.g., declaration), return the associated parsed comment as a CXComment_FullComment AST node."] type cxcommentkind = | Null [@ocaml.doc "Null comment. No AST node is constructed at the requested location because there is no text or a syntax error."] | Text [@ocaml.doc "Plain text. Inline content."] | InlineCommand [@ocaml.doc "A command with word-like arguments that is considered inline content."] | HTMLStartTag [@ocaml.doc "HTML start tag with attributes (name-value pairs). Considered inline content."] | HTMLEndTag [@ocaml.doc "HTML end tag. Considered inline content."] | Paragraph [@ocaml.doc "A paragraph, contains inline comment. The paragraph itself is block content."] | BlockCommand [@ocaml.doc "A command that has zero or more word-like arguments (number of word-like arguments depends on command name) and a paragraph as an argument. Block command is block content."] | ParamCommand [@ocaml.doc "A \\param or \\arg command that describes the function parameter (name, passing direction, description)."] | TParamCommand [@ocaml.doc "A \\tparam command that describes a template parameter (name and description)."] | VerbatimBlockCommand [@ocaml.doc "A verbatim block command (e. g., preformatted code). Verbatim block has an opening and a closing command and contains multiple lines of text ( CXComment_VerbatimBlockLine child nodes)."] | VerbatimBlockLine [@ocaml.doc "A line of text that is contained within a CXComment_VerbatimBlockCommand node."] | VerbatimLine [@ocaml.doc "A verbatim line command. Verbatim line has an opening command, a single line of text (up to the newline after the opening command) and has no closing command."] | FullComment [@ocaml.doc "A full comment attached to a declaration, contains block content."] [@@deriving refl][@@ocaml.doc "Describes the type of the comment AST node ( CXComment). A comment node can be considered block content (e. g., paragraph), inline content (plain text) or neither (the root AST node)."] external comment_get_kind : cxcomment -> cxcommentkind = "clang_Comment_getKind_wrapper"[@@ocaml.doc "Returns the type of the AST node."] external comment_get_num_children : cxcomment -> int = "clang_Comment_getNumChildren_wrapper"[@@ocaml.doc "Returns number of children of the AST node."] external comment_get_child : cxcomment -> int -> cxcomment = "clang_Comment_getChild_wrapper"[@@ocaml.doc "Returns the specified child of the AST node."] external comment_is_whitespace : cxcomment -> bool = "clang_Comment_isWhitespace_wrapper"[@@ocaml.doc "A CXComment_Paragraph node is considered whitespace if it contains only CXComment_Text nodes that are empty or whitespace."] external inline_content_comment_has_trailing_newline : cxcomment -> int = "clang_InlineContentComment_hasTrailingNewline_wrapper" [@@ocaml.doc "Returns non-zero if Comment is inline content and has a newline immediately following it in the comment text. Newlines between paragraphs do not count."] external text_comment_get_text : cxcomment -> string = "clang_TextComment_getText_wrapper"[@@ocaml.doc "Returns text contained in the AST node."] external inline_command_comment_get_command_name : cxcomment -> string = "clang_InlineCommandComment_getCommandName_wrapper" [@@ocaml.doc "Returns name of the inline command."] type cxcommentinlinecommandrenderkind = | Normal [@ocaml.doc "Command argument should be rendered in a normal font."] | Bold [@ocaml.doc "Command argument should be rendered in a bold font."] | Monospaced [@ocaml.doc "Command argument should be rendered in a monospaced font."] | Emphasized [@ocaml.doc "Command argument should be rendered emphasized (typically italic font)."] [@@deriving refl][@@ocaml.doc "The most appropriate rendering mode for an inline command, chosen on command semantics in Doxygen."] external inline_command_comment_get_render_kind : cxcomment -> cxcommentinlinecommandrenderkind = "clang_InlineCommandComment_getRenderKind_wrapper"[@@ocaml.doc "Returns the most appropriate rendering mode, chosen on command semantics in Doxygen."] external inline_command_comment_get_num_args : cxcomment -> int = "clang_InlineCommandComment_getNumArgs_wrapper"[@@ocaml.doc "Returns number of command arguments."] external inline_command_comment_get_arg_text : cxcomment -> int -> string = "clang_InlineCommandComment_getArgText_wrapper"[@@ocaml.doc "Returns text of the specified argument."] external htmltag_comment_get_tag_name : cxcomment -> string = "clang_HTMLTagComment_getTagName_wrapper"[@@ocaml.doc "Returns HTML tag name."] external htmlstart_tag_comment_is_self_closing : cxcomment -> bool = "clang_HTMLStartTagComment_isSelfClosing_wrapper" [@@ocaml.doc "Returns non-zero if tag is self-closing (for example, <br />)."] external htmlstart_tag_get_num_attrs : cxcomment -> int = "clang_HTMLStartTag_getNumAttrs_wrapper"[@@ocaml.doc "Returns number of attributes (name-value pairs) attached to the start tag."] external htmlstart_tag_get_attr_name : cxcomment -> int -> string = "clang_HTMLStartTag_getAttrName_wrapper" [@@ocaml.doc "Returns name of the specified attribute."] external htmlstart_tag_get_attr_value : cxcomment -> int -> string = "clang_HTMLStartTag_getAttrValue_wrapper" [@@ocaml.doc "Returns value of the specified attribute."] external block_command_comment_get_command_name : cxcomment -> string = "clang_BlockCommandComment_getCommandName_wrapper" [@@ocaml.doc "Returns name of the block command."] external block_command_comment_get_num_args : cxcomment -> int = "clang_BlockCommandComment_getNumArgs_wrapper"[@@ocaml.doc "Returns number of word-like arguments."] external block_command_comment_get_arg_text : cxcomment -> int -> string = "clang_BlockCommandComment_getArgText_wrapper" [@@ocaml.doc "Returns text of the specified word-like argument."] external block_command_comment_get_paragraph : cxcomment -> cxcomment = "clang_BlockCommandComment_getParagraph_wrapper" [@@ocaml.doc "Returns paragraph argument of the block command."] external param_command_comment_get_param_name : cxcomment -> string = "clang_ParamCommandComment_getParamName_wrapper" [@@ocaml.doc "Returns parameter name."] external param_command_comment_is_param_index_valid : cxcomment -> bool = "clang_ParamCommandComment_isParamIndexValid_wrapper" [@@ocaml.doc "Returns non-zero if the parameter that this AST node represents was found in the function prototype and clang_ParamCommandComment_getParamIndex function will return a meaningful value."] external param_command_comment_get_param_index : cxcomment -> int = "clang_ParamCommandComment_getParamIndex_wrapper" [@@ocaml.doc "Returns zero-based parameter index in function prototype."] external param_command_comment_is_direction_explicit : cxcomment -> bool = "clang_ParamCommandComment_isDirectionExplicit_wrapper" [@@ocaml.doc "Returns non-zero if parameter passing direction was specified explicitly in the comment."] type cxcommentparampassdirection = | In [@ocaml.doc "The parameter is an input parameter."] | Out [@ocaml.doc "The parameter is an output parameter."] | InOut [@ocaml.doc "The parameter is an input and output parameter."] [@@deriving refl][@@ocaml.doc "Describes parameter passing direction for \\param or \\arg command."] external param_command_comment_get_direction : cxcomment -> cxcommentparampassdirection = "clang_ParamCommandComment_getDirection_wrapper"[@@ocaml.doc "Returns parameter passing direction."] external tparam_command_comment_get_param_name : cxcomment -> string = "clang_TParamCommandComment_getParamName_wrapper" [@@ocaml.doc "Returns template parameter name."] external tparam_command_comment_is_param_position_valid : cxcomment -> bool = "clang_TParamCommandComment_isParamPositionValid_wrapper"[@@ocaml.doc "Returns non-zero if the parameter that this AST node represents was found in the template parameter list and clang_TParamCommandComment_getDepth and clang_TParamCommandComment_getIndex functions will return a meaningful value."] external tparam_command_comment_get_depth : cxcomment -> int = "clang_TParamCommandComment_getDepth_wrapper"[@@ocaml.doc "Returns zero-based nesting depth of this parameter in the template parameter list."] external tparam_command_comment_get_index : cxcomment -> int -> int = "clang_TParamCommandComment_getIndex_wrapper" [@@ocaml.doc "Returns zero-based parameter index in the template parameter list at a given nesting depth."] external verbatim_block_line_comment_get_text : cxcomment -> string = "clang_VerbatimBlockLineComment_getText_wrapper" [@@ocaml.doc "Returns text contained in the AST node."] external verbatim_line_comment_get_text : cxcomment -> string = "clang_VerbatimLineComment_getText_wrapper"[@@ocaml.doc "Returns text contained in the AST node."] external htmltag_comment_get_as_string : cxcomment -> string = "clang_HTMLTagComment_getAsString_wrapper"[@@ocaml.doc "Convert an HTML tag AST node to string."] external full_comment_get_as_html : cxcomment -> string = "clang_FullComment_getAsHTML_wrapper"[@@ocaml.doc "Convert a given full parsed comment to an HTML fragment."] external full_comment_get_as_xml : cxcomment -> string = "clang_FullComment_getAsXML_wrapper"[@@ocaml.doc "Convert a given full parsed comment to an XML document."] type cxversion = { major: int [@ocaml.doc "The major version number, e.g., the '10' in '10.7.3'. A negative value indicates that there is no version number at all."]; minor: int [@ocaml.doc "The minor version number, e.g., the '7' in '10.7.3'. This value will be negative if no minor version number was provided, e.g., for version '10'."]; subminor: int [@ocaml.doc "The subminor version number, e.g., the '3' in '10.7.3'. This value will be negative if no minor or subminor version number was provided, e.g., in version '10' or '10.7'."]} [@@deriving refl][@@ocaml.doc "Describes a version number of the form major.minor.subminor."] external ext_get_version : unit -> cxversion = "clang_ext_getVersion_wrapper" type cxint external equal_cxint : cxint -> cxint -> bool = "clang_equal_cxint_wrapper" external compare_cxint : cxint -> cxint -> int = "clang_compare_cxint_wrapper" external ext_integer_literal_get_value : cxcursor -> cxint = "clang_ext_IntegerLiteral_getValue_wrapper" external ext_int_is_valid : cxint -> bool = "clang_ext_Int_isValid_wrapper" external ext_int_to_string : cxint -> int -> bool -> string = "clang_ext_Int_toString_wrapper" external ext_int_round_to_double : cxint -> bool -> float = "clang_ext_Int_roundToDouble_wrapper" external ext_int_bits_to_float : cxint -> float = "clang_ext_Int_bitsToFloat_wrapper" external ext_int_get_bit_width : cxint -> int = "clang_ext_Int_getBitWidth_wrapper" external ext_int_get_active_bits : cxint -> int = "clang_ext_Int_getActiveBits_wrapper" external ext_int_get_min_signed_bits : cxint -> int = "clang_ext_Int_getMinSignedBits_wrapper" external ext_int_get_bool_value : cxint -> bool = "clang_ext_Int_getBoolValue_wrapper" external ext_int_get_zext_value : cxint -> int = "clang_ext_Int_getZExtValue_wrapper" external ext_int_get_sext_value : cxint -> int = "clang_ext_Int_getSExtValue_wrapper" external ext_int_get_zext_value64 : cxint -> Int64.t = "clang_ext_Int_getZExtValue64_wrapper" external ext_int_get_sext_value64 : cxint -> Int64.t = "clang_ext_Int_getSExtValue64_wrapper" type cxfloat external equal_cxfloat : cxfloat -> cxfloat -> bool = "clang_equal_cxfloat_wrapper" external compare_cxfloat : cxfloat -> cxfloat -> int = "clang_compare_cxfloat_wrapper" external ext_floating_literal_get_value : cxcursor -> cxfloat = "clang_ext_FloatingLiteral_getValue_wrapper" external ext_float_is_valid : cxfloat -> bool = "clang_ext_Float_isValid_wrapper" external ext_float_to_string : cxfloat -> string = "clang_ext_Float_toString_wrapper" type clang_ext_fltsemantics = | IEEEhalf | IEEEsingle | IEEEdouble | IEEEquad | PPCDoubleDouble | X87DoubleExtended | Bogus | Invalid [@@deriving refl] external ext_float_get_semantics : cxfloat -> clang_ext_fltsemantics = "clang_ext_Float_getSemantics_wrapper" external ext_float_convert_to_float : cxfloat -> float = "clang_ext_Float_convertToFloat_wrapper" external ext_float_convert_to_double : cxfloat -> float = "clang_ext_Float_convertToDouble_wrapper" external ext_string_literal_get_string : cxcursor -> string = "clang_ext_StringLiteral_GetString_wrapper" external ext_string_literal_get_bytes : cxcursor -> string = "clang_ext_StringLiteral_getBytes_wrapper" external ext_string_literal_get_byte_length : cxcursor -> int = "clang_ext_StringLiteral_getByteLength_wrapper" external ext_string_literal_get_char_byte_width : cxcursor -> int = "clang_ext_StringLiteral_getCharByteWidth_wrapper" type clang_ext_stringkind = | Ordinary | Wide | UTF8 | UTF16 | UTF32 | InvalidStringKind [@@deriving refl] external ext_string_literal_get_kind : cxcursor -> clang_ext_stringkind = "clang_ext_StringLiteral_getKind_wrapper" type clang_ext_unaryoperatorkind = | PostInc | PostDec | PreInc | PreDec | AddrOf | Deref | Plus | Minus | Not | LNot | Real | Imag | Extension | Invalid [@@deriving refl] external ext_unary_operator_get_opcode : cxcursor -> clang_ext_unaryoperatorkind = "clang_ext_UnaryOperator_getOpcode_wrapper" external ext_unary_operator_get_opcode_spelling : clang_ext_unaryoperatorkind -> string = "clang_ext_UnaryOperator_getOpcodeSpelling_wrapper" type clang_ext_binaryoperatorkind = | PtrMemD | PtrMemI | Mul | Div | Rem | Add | Sub | Shl | Shr | LT | GT | LE | GE | EQ | NE | And | Xor | Or | LAnd | LOr | Assign | MulAssign | DivAssign | RemAssign | AddAssign | SubAssign | ShlAssign | ShrAssign | AndAssign | XorAssign | OrAssign | Comma | Invalid [@@deriving refl] external ext_binary_operator_get_opcode : cxcursor -> clang_ext_binaryoperatorkind = "clang_ext_BinaryOperator_getOpcode_wrapper" external ext_binary_operator_get_opcode_spelling : clang_ext_binaryoperatorkind -> string = "clang_ext_BinaryOperator_getOpcodeSpelling_wrapper" external ext_for_stmt_get_children_set : cxcursor -> int = "clang_ext_ForStmt_getChildrenSet_wrapper" external ext_if_stmt_get_children_set : cxcursor -> int = "clang_ext_IfStmt_getChildrenSet_wrapper" external ext_if_stmt_get_init : cxcursor -> cxcursor = "clang_ext_IfStmt_getInit_wrapper" external ext_if_stmt_get_condition_variable : cxcursor -> cxcursor = "clang_ext_IfStmt_getConditionVariable_wrapper" external ext_if_stmt_get_cond : cxcursor -> cxcursor = "clang_ext_IfStmt_getCond_wrapper" external ext_if_stmt_get_then : cxcursor -> cxcursor = "clang_ext_IfStmt_getThen_wrapper" external ext_if_stmt_get_else : cxcursor -> cxcursor = "clang_ext_IfStmt_getElse_wrapper" external ext_switch_stmt_get_children_set : cxcursor -> int = "clang_ext_SwitchStmt_getChildrenSet_wrapper" external ext_switch_stmt_get_init : cxcursor -> cxcursor = "clang_ext_SwitchStmt_getInit_wrapper" external ext_while_stmt_get_children_set : cxcursor -> int = "clang_ext_WhileStmt_getChildrenSet_wrapper" type clang_ext_elaboratedtypekeyword = | Struct | Interface | Union | Class | Enum | Typename | NoKeyword [@@deriving refl] external ext_elaborated_type_get_keyword : cxtype -> clang_ext_elaboratedtypekeyword = "clang_ext_ElaboratedType_getKeyword_wrapper" external ext_elaborated_type_get_keyword_spelling : clang_ext_elaboratedtypekeyword -> string = "clang_ext_ElaboratedType_getKeywordSpelling_wrapper" external ext_var_decl_has_init : cxcursor -> bool = "clang_ext_VarDecl_hasInit_wrapper" external ext_var_decl_is_constexpr : cxcursor -> bool = "clang_ext_VarDecl_isConstexpr_wrapper" external ext_member_ref_expr_is_arrow : cxcursor -> bool = "clang_ext_MemberRefExpr_isArrow_wrapper" external ext_stmt_get_class_name : cxcursor -> string = "clang_ext_Stmt_GetClassName_wrapper" external ext_stmt_get_class_kind : cxcursor -> int = "clang_ext_Stmt_GetClassKind_wrapper" type clang_ext_cursorkind = | ImplicitCastExpr | BinaryConditionalOperator | UnaryExprOrTypeTraitExpr | EmptyDecl | LinkageSpecDecl | Unknown [@@deriving refl] external ext_get_cursor_kind : cxcursor -> clang_ext_cursorkind = "clang_ext_GetCursorKind_wrapper" type clang_ext_declkind = | InvalidDecl | AccessSpec | Block | Captured | ClassScopeFunctionSpecialization | Empty | FileScopeAsm | Friend | FriendTemplate | Import | LinkageSpec | Label | Namespace | NamespaceAlias | ObjCCompatibleAlias | ObjCCategory | ObjCCategoryImpl | ObjCImplementation | ObjCInterface | ObjCProtocol | ObjCMethod | ObjCProperty | ClassTemplate | FunctionTemplate | TypeAliasTemplate | VarTemplate | TemplateTemplateParm | Enum | Record | CXXRecord | ClassTemplateSpecialization | ClassTemplatePartialSpecialization | TemplateTypeParm | TypeAlias | Typedef | UnresolvedUsingTypename | Using | UsingDirective | UsingShadow | Field | ObjCAtDefsField | ObjCIvar | Function | CXXMethod | CXXConstructor | CXXConversion | CXXDestructor | MSProperty | NonTypeTemplateParm | Var | ImplicitParam | ParmVar | VarTemplateSpecialization | VarTemplatePartialSpecialization | EnumConstant | IndirectField | UnresolvedUsingValue | OMPThreadPrivate | ObjCPropertyImpl | StaticAssert | TranslationUnit | UnknownDecl [@@deriving refl] external ext_decl_get_kind : cxcursor -> clang_ext_declkind = "clang_ext_Decl_GetKind_wrapper" external ext_decl_visit_attributes : cxcursor -> (cxcursor -> cxcursor -> cxchildvisitresult) -> bool = "clang_ext_Decl_visitAttributes_wrapper" external ext_decl_is_implicit : cxcursor -> bool = "clang_ext_Decl_isImplicit_wrapper" external ext_record_decl_is_injected_class_name : cxcursor -> bool = "clang_ext_RecordDecl_isInjectedClassName_wrapper" external ext_cxxrecord_decl_visit_bases : cxcursor -> (cxcursor -> cxcursor -> cxchildvisitresult) -> bool = "clang_ext_CXXRecordDecl_visitBases_wrapper" type clang_ext_stmtkind = | InvalidStmt | GCCAsmStmt | MSAsmStmt | AttributedStmt | BreakStmt | CXXCatchStmt | CXXForRangeStmt | CXXTryStmt | CapturedStmt | CompoundStmt | ContinueStmt | DeclStmt | DoStmt | BinaryConditionalOperator | ConditionalOperator | AddrLabelExpr | ArraySubscriptExpr | ArrayTypeTraitExpr | AsTypeExpr | AtomicExpr | BinaryOperator | CompoundAssignOperator | BlockExpr | CXXBindTemporaryExpr | CXXBoolLiteralExpr | CXXConstructExpr | CXXTemporaryObjectExpr | CXXDefaultArgExpr | CXXDefaultInitExpr | CXXDeleteExpr | CXXDependentScopeMemberExpr | CXXNewExpr | CXXNoexceptExpr | CXXNullPtrLiteralExpr | CXXPseudoDestructorExpr | CXXScalarValueInitExpr | CXXStdInitializerListExpr | CXXThisExpr | CXXThrowExpr | CXXTypeidExpr | CXXUnresolvedConstructExpr | CXXUuidofExpr | CallExpr | CUDAKernelCallExpr | CXXMemberCallExpr | CXXOperatorCallExpr | UserDefinedLiteral | CStyleCastExpr | CXXFunctionalCastExpr | CXXConstCastExpr | CXXDynamicCastExpr | CXXReinterpretCastExpr | CXXStaticCastExpr | ObjCBridgedCastExpr | ImplicitCastExpr | CharacterLiteral | ChooseExpr | CompoundLiteralExpr | ConvertVectorExpr | DeclRefExpr | DependentScopeDeclRefExpr | DesignatedInitExpr | ExprWithCleanups | ExpressionTraitExpr | ExtVectorElementExpr | FloatingLiteral | FunctionParmPackExpr | GNUNullExpr | GenericSelectionExpr | ImaginaryLiteral | ImplicitValueInitExpr | InitListExpr | IntegerLiteral | LambdaExpr | MSPropertyRefExpr | MaterializeTemporaryExpr | MemberExpr | ObjCArrayLiteral | ObjCBoolLiteralExpr | ObjCBoxedExpr | ObjCDictionaryLiteral | ObjCEncodeExpr | ObjCIndirectCopyRestoreExpr | ObjCIsaExpr | ObjCIvarRefExpr | ObjCMessageExpr | ObjCPropertyRefExpr | ObjCProtocolExpr | ObjCSelectorExpr | ObjCStringLiteral | ObjCSubscriptRefExpr | OffsetOfExpr | OpaqueValueExpr | UnresolvedLookupExpr | UnresolvedMemberExpr | PackExpansionExpr | ParenExpr | ParenListExpr | PredefinedExpr | PseudoObjectExpr | ShuffleVectorExpr | SizeOfPackExpr | StmtExpr | StringLiteral | SubstNonTypeTemplateParmExpr | SubstNonTypeTemplateParmPackExpr | TypeTraitExpr | UnaryExprOrTypeTraitExpr | UnaryOperator | VAArgExpr | ForStmt | GotoStmt | IfStmt | IndirectGotoStmt | LabelStmt | MSDependentExistsStmt | NullStmt | OMPBarrierDirective | OMPCriticalDirective | OMPFlushDirective | OMPForDirective | OMPMasterDirective | OMPParallelDirective | OMPParallelForDirective | OMPParallelSectionsDirective | OMPSectionDirective | OMPSectionsDirective | OMPSimdDirective | OMPSingleDirective | OMPTaskDirective | OMPTaskwaitDirective | OMPTaskyieldDirective | ObjCAtCatchStmt | ObjCAtFinallyStmt | ObjCAtSynchronizedStmt | ObjCAtThrowStmt | ObjCAtTryStmt | ObjCAutoreleasePoolStmt | ObjCForCollectionStmt | ReturnStmt | SEHExceptStmt | SEHFinallyStmt | SEHLeaveStmt | SEHTryStmt | CaseStmt | DefaultStmt | SwitchStmt | WhileStmt | UnknownStmt [@@deriving refl] external ext_stmt_get_kind : cxcursor -> clang_ext_stmtkind = "clang_ext_Stmt_GetKind_wrapper" type clang_ext_typekind = | InvalidType | Builtin | Complex | Pointer | BlockPointer | LValueReference | RValueReference | MemberPointer | ConstantArray | IncompleteArray | VariableArray | DependentSizedArray | DependentSizedExtVector | Vector | ExtVector | FunctionProto | FunctionNoProto | UnresolvedUsing | Paren | Typedef | Adjusted | Decayed | TypeOfExpr | TypeOf | Decltype | UnaryTransform | Record | Enum | Elaborated | Attributed | TemplateTypeParm | SubstTemplateTypeParm | SubstTemplateTypeParmPack | TemplateSpecialization | Auto | InjectedClassName | DependentName | DependentTemplateSpecialization | PackExpansion | ObjCObject | ObjCInterface | ObjCObjectPointer | Atomic | UnknownType [@@deriving refl] external ext_type_get_kind : cxtype -> clang_ext_typekind = "clang_ext_Type_GetKind_wrapper" external ext_get_type_kind : cxtype -> clang_ext_typekind = "clang_ext_GetTypeKind_wrapper" external ext_get_inner_type : cxtype -> cxtype = "clang_ext_GetInnerType_wrapper" external ext_declarator_decl_get_size_expr : cxcursor -> cxcursor = "clang_ext_DeclaratorDecl_GetSizeExpr_wrapper" external ext_variable_array_type_get_size_expr : cxtype -> cxcursor = "clang_ext_VariableArrayType_GetSizeExpr_wrapper" type clang_ext_characterkind = | Ascii | Wide | UTF8 | UTF16 | UTF32 | InvalidCharacterKind [@@deriving refl] external ext_character_literal_get_character_kind : cxcursor -> clang_ext_characterkind = "clang_ext_CharacterLiteral_GetCharacterKind_wrapper" external ext_character_literal_get_value : cxcursor -> int = "clang_ext_CharacterLiteral_GetValue_wrapper" type clang_ext_unaryexpr = | SizeOf | AlignOf | VecStep | OpenMPRequiredSimdAlign | PreferredAlignOf [@@deriving refl] external ext_unary_expr_get_kind : cxcursor -> clang_ext_unaryexpr = "clang_ext_UnaryExpr_GetKind_wrapper" external ext_unary_expr_is_argument_type : cxcursor -> bool = "clang_ext_UnaryExpr_isArgumentType_wrapper" type clang_ext_typeloc external ext_unary_expr_get_argument_type_loc : cxcursor -> clang_ext_typeloc = "clang_ext_UnaryExpr_getArgumentTypeLoc_wrapper" external ext_type_get_named_type : cxtype -> cxtype = "clang_ext_Type_getNamedType_wrapper" type clang_ext_attrkind = | NoAttr | Annotate | CFConsumed | CarriesDependency | NSConsumed | ARMInterrupt | AcquireCapability | AcquiredAfter | AcquiredBefore | AlignMac68k | Aligned | AlwaysInline | AnalyzerNoReturn | ArcWeakrefUnavailable | ArgumentWithTypeTag | AsmLabel | AssertCapability | AssertExclusiveLock | AssertSharedLock | Availability | Blocks | C11NoReturn | CDecl | CFAuditedTransfer | CFReturnsNotRetained | CFReturnsRetained | CFUnknownTransfer | CUDAConstant | CUDADevice | CUDAGlobal | CUDAHost | CUDALaunchBounds | CUDAShared | CXX11NoReturn | CallableWhen | Capability | Cleanup | Cold | Common | Const | Constructor | Consumable | ConsumableAutoCast | ConsumableSetOnRead | DLLExport | DLLImport | Deprecated | Destructor | EnableIf | ExclusiveTrylockFunction | FastCall | Final | Flatten | Format | FormatArg | GNUInline | GuardedBy | GuardedVar | Hot | IBAction | IBOutlet | IBOutletCollection | InitPriority | IntelOclBicc | LockReturned | LocksExcluded | MSABI | MSInheritance | MSP430Interrupt | MSVtorDisp | Malloc | MaxFieldAlignment | MayAlias | MinSize | Mips16 | MsStruct | NSConsumesSelf | NSReturnsAutoreleased | NSReturnsNotRetained | NSReturnsRetained | Naked | NoCommon | NoDebug | NoDuplicate | NoInline | NoInstrumentFunction | NoMips16 | NoReturn | NoSanitizeAddress | NoSanitizeMemory | NoSanitizeThread | NoSplitStack | NoThreadSafetyAnalysis | NoThrow | NonNull | ObjCBridge | ObjCBridgeMutable | ObjCBridgeRelated | ObjCException | ObjCExplicitProtocolImpl | ObjCMethodFamily | ObjCNSObject | ObjCPreciseLifetime | ObjCRequiresPropertyDefs | ObjCRequiresSuper | ObjCReturnsInnerPointer | ObjCRootClass | OpenCLKernel | OptimizeNone | Override | Ownership | Packed | ParamTypestate | Pascal | Pcs | PnaclCall | PtGuardedBy | PtGuardedVar | Pure | ReleaseCapability | ReqdWorkGroupSize | RequiresCapability | ReturnTypestate | ReturnsNonNull | ReturnsTwice | ScopedLockable | Section | SelectAny | Sentinel | SetTypestate | SharedTrylockFunction | StdCall | SysVABI | TLSModel | TestTypestate | ThisCall | TransparentUnion | TryAcquireCapability | TypeTagForDatatype | TypeVisibility | Unavailable | Unused | Used | Uuid | VecReturn | VecTypeHint | Visibility | WarnUnused | WarnUnusedResult | Weak | WeakImport | WeakRef | WorkGroupSizeHint | X86ForceAlignArgPointer | Alias | FallThrough | InitSeg | LoopHint | Mode | ObjCDesignatedInitializer | ObjCRuntimeName | OpenCLImageAccess | Overloadable | Thread [@@deriving refl] external ext_attr_kind_get_spelling : clang_ext_attrkind -> string = "clang_ext_AttrKind_GetSpelling_wrapper" external ext_cxxmethod_is_defaulted : cxcursor -> bool = "clang_ext_CXXMethod_isDefaulted_wrapper" external ext_cxxmethod_is_const : cxcursor -> bool = "clang_ext_CXXMethod_isConst_wrapper" external ext_cxxconstructor_is_explicit : cxcursor -> bool = "clang_ext_CXXConstructor_isExplicit_wrapper" external ext_function_decl_is_deleted : cxcursor -> bool = "clang_ext_FunctionDecl_isDeleted_wrapper" external ext_function_decl_get_num_params : cxcursor -> int = "clang_ext_FunctionDecl_getNumParams_wrapper" external ext_function_decl_get_param_decl : cxcursor -> int -> cxcursor = "clang_ext_FunctionDecl_getParamDecl_wrapper" external ext_function_decl_is_constexpr : cxcursor -> bool = "clang_ext_FunctionDecl_isConstexpr_wrapper" external ext_function_decl_has_written_prototype : cxcursor -> bool = "clang_ext_FunctionDecl_hasWrittenPrototype_wrapper" external ext_function_decl_does_this_declaration_have_abody : cxcursor -> bool = "clang_ext_FunctionDecl_doesThisDeclarationHaveABody_wrapper" external ext_function_decl_get_body : cxcursor -> cxcursor = "clang_ext_FunctionDecl_getBody_wrapper" module Clang_ext_languageids = struct type t = int external (+) : t -> t -> t = "%orint" let (-) x y = x land (lnot y) external (&) : t -> t -> t = "%andint" external ( * ) : t -> t -> t = "%xorint" let subset x y = (y - x) = 0 let zero = 0 let c = 2 let cxx = 4 end external ext_linkage_spec_decl_get_language_ids : cxcursor -> Clang_ext_languageids.t = "clang_ext_LinkageSpecDecl_getLanguageIDs_wrapper" external ext_template_type_parm_decl_get_default_argument : cxcursor -> cxtype = "clang_ext_TemplateTypeParmDecl_getDefaultArgument_wrapper" external ext_non_type_template_parm_decl_get_default_argument : cxcursor -> cxcursor = "clang_ext_NonTypeTemplateParmDecl_getDefaultArgument_wrapper" type clang_ext_templatename_namekind = | Template | OverloadedTemplate | AssumedTemplate | QualifiedTemplate | DependentTemplate | SubstTemplateTemplateParm | SubstTemplateTemplateParmPack | InvalidNameKind [@@deriving refl] type clang_ext_templatename external ext_template_name_get_kind : clang_ext_templatename -> clang_ext_templatename_namekind = "clang_ext_TemplateName_getKind_wrapper" external ext_template_name_get_as_template_decl : clang_ext_templatename -> cxcursor = "clang_ext_TemplateName_getAsTemplateDecl_wrapper" type cxtemplateargumentkind = | Null | Type | Declaration | NullPtr | Integral | Template | TemplateExpansion | Expression | Pack | Invalid [@@deriving refl] type clang_ext_templateargument external ext_template_argument_get_kind : clang_ext_templateargument -> cxtemplateargumentkind = "clang_ext_TemplateArgument_getKind_wrapper" external ext_template_argument_get_as_type : clang_ext_templateargument -> cxtype = "clang_ext_TemplateArgument_getAsType_wrapper" external ext_template_argument_get_as_decl : clang_ext_templateargument -> cxcursor = "clang_ext_TemplateArgument_getAsDecl_wrapper" external ext_template_argument_get_null_ptr_type : clang_ext_templateargument -> cxtype = "clang_ext_TemplateArgument_getNullPtrType_wrapper" external ext_template_argument_get_as_template_or_template_pattern : clang_ext_templateargument -> clang_ext_templatename = "clang_ext_TemplateArgument_getAsTemplateOrTemplatePattern_wrapper" external ext_template_argument_get_as_integral : clang_ext_templateargument -> cxint = "clang_ext_TemplateArgument_getAsIntegral_wrapper" external ext_template_argument_get_integral_type : clang_ext_templateargument -> cxtype = "clang_ext_TemplateArgument_getIntegralType_wrapper" external ext_template_argument_get_as_expr : clang_ext_templateargument -> cxcursor = "clang_ext_TemplateArgument_getAsExpr_wrapper" external ext_template_argument_get_pack_size : clang_ext_templateargument -> int = "clang_ext_TemplateArgument_getPackSize_wrapper" external ext_template_argument_get_pack_argument : clang_ext_templateargument -> int -> clang_ext_templateargument = "clang_ext_TemplateArgument_getPackArgument_wrapper" external ext_template_argument_get_pack_expansion_pattern : clang_ext_templateargument -> clang_ext_templateargument = "clang_ext_TemplateArgument_getPackExpansionPattern_wrapper" external ext_template_specialization_type_get_template_name : cxtype -> clang_ext_templatename = "clang_ext_TemplateSpecializationType_getTemplateName_wrapper" external ext_template_specialization_type_get_num_args : cxtype -> int = "clang_ext_TemplateSpecializationType_getNumArgs_wrapper" external ext_template_specialization_type_get_argument : cxtype -> int -> clang_ext_templateargument = "clang_ext_TemplateSpecializationType_getArgument_wrapper" external ext_friend_decl_get_friend_decl : cxcursor -> cxcursor = "clang_ext_FriendDecl_getFriendDecl_wrapper" external ext_friend_decl_get_friend_type : cxcursor -> cxtype = "clang_ext_FriendDecl_getFriendType_wrapper" external ext_field_decl_get_in_class_initializer : cxcursor -> cxcursor = "clang_ext_FieldDecl_getInClassInitializer_wrapper" external ext_generic_selection_expr_get_assoc_type : cxcursor -> int -> cxtype = "clang_ext_GenericSelectionExpr_getAssocType_wrapper" external ext_template_parm_is_parameter_pack : cxcursor -> bool = "clang_ext_TemplateParm_isParameterPack_wrapper" external ext_template_decl_get_templated_decl : cxcursor -> cxcursor = "clang_ext_TemplateDecl_getTemplatedDecl_wrapper" type clang_ext_predefinedexpr_identkind = | Func | Function | LFunction | FuncDName | FuncSig | LFuncSig | PrettyFunction | PrettyFunctionNoVirtual | InvalidPredefinedExpr [@@deriving refl] external ext_predefined_expr_get_ident_kind : cxcursor -> clang_ext_predefinedexpr_identkind = "clang_ext_PredefinedExpr_getIdentKind_wrapper" external ext_predefined_expr_compute_name : clang_ext_predefinedexpr_identkind -> cxcursor -> string = "clang_ext_PredefinedExpr_ComputeName_wrapper" external ext_lambda_expr_is_mutable : cxcursor -> bool = "clang_ext_LambdaExpr_isMutable_wrapper" external ext_lambda_expr_has_explicit_parameters : cxcursor -> bool = "clang_ext_LambdaExpr_hasExplicitParameters_wrapper" external ext_lambda_expr_has_explicit_result_type : cxcursor -> bool = "clang_ext_LambdaExpr_hasExplicitResultType_wrapper" type clang_ext_lambdacapturedefault = | CaptureNone | ByCopy | ByRef [@@deriving refl] external ext_lambda_expr_get_capture_default : cxcursor -> clang_ext_lambdacapturedefault = "clang_ext_LambdaExpr_getCaptureDefault_wrapper" type clang_ext_lambdacapture external ext_lambda_expr_get_captures : cxcursor -> (clang_ext_lambdacapture -> unit) -> unit = "clang_ext_LambdaExpr_getCaptures_wrapper" external ext_lambda_expr_get_call_operator : cxcursor -> cxcursor = "clang_ext_LambdaExpr_getCallOperator_wrapper" type clang_ext_lambdacapturekind = | This | StarThis | ByCopy | ByRef | VLAType [@@deriving refl] external ext_lambda_capture_get_kind : clang_ext_lambdacapture -> clang_ext_lambdacapturekind = "clang_ext_LambdaCapture_getKind_wrapper" external ext_lambda_capture_get_captured_var : clang_ext_lambdacapture -> cxcursor = "clang_ext_LambdaCapture_getCapturedVar_wrapper" external ext_lambda_capture_is_implicit : clang_ext_lambdacapture -> bool = "clang_ext_LambdaCapture_isImplicit_wrapper" external ext_lambda_capture_is_pack_expansion : clang_ext_lambdacapture -> bool = "clang_ext_LambdaCapture_isPackExpansion_wrapper" external ext_cxxnew_expr_get_allocated_type_loc : cxcursor -> clang_ext_typeloc = "clang_ext_CXXNewExpr_getAllocatedTypeLoc_wrapper" external ext_cxxnew_expr_get_array_size : cxcursor -> cxcursor = "clang_ext_CXXNewExpr_getArraySize_wrapper" external ext_cxxnew_expr_get_num_placement_args : cxcursor -> int = "clang_ext_CXXNewExpr_getNumPlacementArgs_wrapper" external ext_cxxnew_expr_get_placement_arg : cxcursor -> int -> cxcursor = "clang_ext_CXXNewExpr_getPlacementArg_wrapper" external ext_cxxnew_expr_get_initializer : cxcursor -> cxcursor = "clang_ext_CXXNewExpr_getInitializer_wrapper" external ext_cxxdelete_expr_is_global_delete : cxcursor -> bool = "clang_ext_CXXDeleteExpr_isGlobalDelete_wrapper" external ext_cxxdelete_expr_is_array_form : cxcursor -> bool = "clang_ext_CXXDeleteExpr_isArrayForm_wrapper" external ext_cxxtypeid_expr_is_type_operand : cxcursor -> bool = "clang_ext_CXXTypeidExpr_isTypeOperand_wrapper" external ext_cxxtypeid_expr_get_type_operand : cxcursor -> clang_ext_typeloc = "clang_ext_CXXTypeidExpr_getTypeOperand_wrapper" external ext_cxxtypeid_expr_get_expr_operand : cxcursor -> cxcursor = "clang_ext_CXXTypeidExpr_getExprOperand_wrapper" type clang_ext_langstandards = | C89 | C90 | Iso9899_1990 | C94 | Gnu89 | Gnu90 | C99 | C9x | Iso9899_1999 | Iso9899_199x | Gnu99 | Gnu9x | C11 | C1x | Iso9899_2011 | Iso9899_201x | Gnu11 | Gnu1x | Cxx98 | Cxx03 | Gnucxx98 | Cxx0x | Cxx11 | Gnucxx0x | Gnucxx11 | Cxx1y | Cxx14 | Gnucxx1y | Gnucxx14 | Cxx1z | Gnucxx1z | Opencl | Opencl11 | Opencl12 | Cuda | InvalidLang [@@deriving refl] external ext_lang_standard_get_name : clang_ext_langstandards -> string = "clang_ext_LangStandard_getName_wrapper" external ext_lang_standard_of_name : string -> clang_ext_langstandards = "clang_ext_LangStandard_ofName_wrapper" external ext_pack_expansion_get_pattern : cxtype -> cxtype = "clang_ext_PackExpansion_getPattern_wrapper" external ext_cxxfold_expr_is_right_fold : cxcursor -> bool = "clang_ext_CXXFoldExpr_isRightFold_wrapper" external ext_cxxfold_expr_get_operator : cxcursor -> clang_ext_binaryoperatorkind = "clang_ext_CXXFoldExpr_getOperator_wrapper" external ext_cxxbool_literal_expr_get_value : cxcursor -> bool = "clang_ext_CXXBoolLiteralExpr_getValue_wrapper" external ext_call_expr_get_callee : cxcursor -> cxcursor = "clang_ext_CallExpr_getCallee_wrapper" external ext_call_expr_get_num_args : cxcursor -> int = "clang_ext_CallExpr_getNumArgs_wrapper" external ext_call_expr_get_arg : cxcursor -> int -> cxcursor = "clang_ext_CallExpr_getArg_wrapper" external ext_size_of_pack_expr_get_pack : cxcursor -> cxcursor = "clang_ext_SizeOfPackExpr_getPack_wrapper" external ext_decltype_type_get_underlying_expr : cxtype -> cxcursor = "clang_ext_DecltypeType_getUnderlyingExpr_wrapper" external ext_namespace_decl_is_inline : cxcursor -> bool = "clang_ext_NamespaceDecl_isInline_wrapper" type clang_ext_overloadedoperatorkind = | InvalidOverloadedOperator | New | Delete | Array_New | Array_Delete | Plus | Minus | Star | Slash | Percent | Caret | Amp | Pipe | Tilde | Exclaim | Equal | Less | Greater | PlusEqual | MinusEqual | StarEqual | SlashEqual | PercentEqual | CaretEqual | AmpEqual | PipeEqual | LessLess | GreaterGreater | LessLessEqual | GreaterGreaterEqual | EqualEqual | ExclaimEqual | LessEqual | GreaterEqual | AmpAmp | PipePipe | PlusPlus | MinusMinus | Comma | ArrowStar | Arrow | Call | Subscript | Conditional [@@deriving refl] external ext_overloaded_operator_get_spelling : clang_ext_overloadedoperatorkind -> string = "clang_ext_OverloadedOperator_getSpelling_wrapper" type clang_ext_declarationnamekind = | Identifier | ObjCZeroArgSelector | ObjCOneArgSelector | ObjCMultiArgSelector | CXXConstructorName | CXXDestructorName | CXXConversionFunctionName | CXXDeductionGuideName | CXXOperatorName | CXXLiteralOperatorName | CXXUsingDirective | InvalidDeclarationName [@@deriving refl] type clang_ext_declarationname external ext_declaration_name_get_kind : clang_ext_declarationname -> clang_ext_declarationnamekind = "clang_ext_DeclarationName_getKind_wrapper" external ext_declaration_name_get_cxxoverloaded_operator : clang_ext_declarationname -> clang_ext_overloadedoperatorkind = "clang_ext_DeclarationName_getCXXOverloadedOperator_wrapper" external ext_declaration_name_get_cxxname_type : clang_ext_declarationname -> cxtype = "clang_ext_DeclarationName_getCXXNameType_wrapper" external ext_declaration_name_get_as_identifier : clang_ext_declarationname -> string = "clang_ext_DeclarationName_getAsIdentifier_wrapper" external ext_declaration_name_get_cxxdeduction_guide_template : clang_ext_declarationname -> cxcursor = "clang_ext_DeclarationName_getCXXDeductionGuideTemplate_wrapper" external ext_declaration_name_get_cxxliteral_identifier : clang_ext_declarationname -> string = "clang_ext_DeclarationName_getCXXLiteralIdentifier_wrapper" external ext_decl_get_name : cxcursor -> clang_ext_declarationname = "clang_ext_Decl_getName_wrapper" external ext_using_directive_decl_get_nominated_namespace : cxcursor -> cxcursor = "clang_ext_UsingDirectiveDecl_getNominatedNamespace_wrapper" type clang_ext_nestednamespecifierkind = | InvalidNestedNameSpecifier | Identifier | Namespace | NamespaceAlias | TypeSpec | TypeSpecWithTemplate | Global | Super [@@deriving refl] type clang_ext_nestednamespecifier external ext_nested_name_specifier_get_kind : clang_ext_nestednamespecifier -> clang_ext_nestednamespecifierkind = "clang_ext_NestedNameSpecifier_getKind_wrapper" external ext_nested_name_specifier_get_prefix : clang_ext_nestednamespecifier -> clang_ext_nestednamespecifier = "clang_ext_NestedNameSpecifier_getPrefix_wrapper" external ext_nested_name_specifier_get_as_identifier : clang_ext_nestednamespecifier -> string = "clang_ext_NestedNameSpecifier_getAsIdentifier_wrapper" external ext_nested_name_specifier_get_as_namespace : clang_ext_nestednamespecifier -> cxcursor = "clang_ext_NestedNameSpecifier_getAsNamespace_wrapper" external ext_nested_name_specifier_get_as_type : clang_ext_nestednamespecifier -> cxtype = "clang_ext_NestedNameSpecifier_getAsType_wrapper" type clang_ext_nestednamespecifierloc external ext_nested_name_specifier_loc_get_nested_name_specifier : clang_ext_nestednamespecifierloc -> clang_ext_nestednamespecifier = "clang_ext_NestedNameSpecifierLoc_getNestedNameSpecifier_wrapper" external ext_nested_name_specifier_loc_get_prefix : clang_ext_nestednamespecifierloc -> clang_ext_nestednamespecifierloc = "clang_ext_NestedNameSpecifierLoc_getPrefix_wrapper" external ext_nested_name_specifier_loc_get_as_type_loc : clang_ext_nestednamespecifierloc -> clang_ext_typeloc = "clang_ext_NestedNameSpecifierLoc_getAsTypeLoc_wrapper" external ext_decl_get_nested_name_specifier_loc : cxcursor -> clang_ext_nestednamespecifierloc = "clang_ext_Decl_getNestedNameSpecifierLoc_wrapper" external ext_type_loc_get_qualifier_loc : clang_ext_typeloc -> clang_ext_nestednamespecifierloc = "clang_ext_TypeLoc_getQualifierLoc_wrapper" external ext_type_get_qualifier : cxtype -> clang_ext_nestednamespecifier = "clang_ext_Type_getQualifier_wrapper" external ext_tag_decl_is_complete_definition : cxcursor -> bool = "clang_ext_TagDecl_isCompleteDefinition_wrapper" external ext_cxxpseudo_destructor_expr_get_destroyed_type_loc : cxcursor -> clang_ext_typeloc = "clang_ext_CXXPseudoDestructorExpr_getDestroyedTypeLoc_wrapper" external ext_cursor_get_num_template_args : cxcursor -> int = "clang_ext_Cursor_getNumTemplateArgs_wrapper" external ext_cursor_get_template_arg : cxcursor -> int -> clang_ext_templateargument = "clang_ext_Cursor_getTemplateArg_wrapper" type clang_ext_templateparameterlist external ext_template_parameter_list_size : clang_ext_templateparameterlist -> int = "clang_ext_TemplateParameterList_size_wrapper" external ext_template_parameter_list_get_param : clang_ext_templateparameterlist -> int -> cxcursor = "clang_ext_TemplateParameterList_getParam_wrapper" external ext_template_parameter_list_get_requires_clause : clang_ext_templateparameterlist -> cxcursor = "clang_ext_TemplateParameterList_getRequiresClause_wrapper" external ext_template_decl_get_template_parameters : cxcursor -> clang_ext_templateparameterlist = "clang_ext_TemplateDecl_getTemplateParameters_wrapper" external ext_template_decl_get_parameter_count : cxcursor -> int = "clang_ext_TemplateDecl_getParameterCount_wrapper" external ext_template_decl_get_parameter : cxcursor -> int -> cxcursor = "clang_ext_TemplateDecl_getParameter_wrapper" external ext_subst_non_type_template_parm_expr_get_replacement : cxcursor -> cxcursor = "clang_ext_SubstNonTypeTemplateParmExpr_getReplacement_wrapper" external ext_attributed_stmt_get_attribute_count : cxcursor -> int = "clang_ext_AttributedStmt_GetAttributeCount_wrapper" external ext_attributed_stmt_get_attribute_kind : cxcursor -> int -> clang_ext_attrkind = "clang_ext_AttributedStmt_GetAttributeKind_wrapper" external ext_attributed_stmt_get_attrs : cxcursor -> (cxcursor -> unit) -> unit = "clang_ext_AttributedStmt_getAttrs_wrapper" external ext_decomposition_decl_get_bindings_count : cxcursor -> int = "clang_ext_DecompositionDecl_GetBindingsCount_wrapper" external ext_decomposition_decl_get_bindings : cxcursor -> int -> cxcursor = "clang_ext_DecompositionDecl_GetBindings_wrapper" external ext_attr_get_kind : cxcursor -> clang_ext_attrkind = "clang_ext_Attr_GetKind_wrapper" type clang_ext_exceptionspecificationtype = | NoExceptionSpecification | DynamicNone | Dynamic | MSAny | NoThrow | BasicNoexcept | DependentNoexcept | NoexceptFalse | NoexceptTrue | Unevaluated | Uninstantiated | Unparsed [@@deriving refl] external ext_function_proto_type_get_exception_spec_type : cxtype -> clang_ext_exceptionspecificationtype = "clang_ext_FunctionProtoType_getExceptionSpecType_wrapper" external ext_function_proto_type_get_num_exceptions : cxtype -> int = "clang_ext_FunctionProtoType_getNumExceptions_wrapper" external ext_function_proto_type_get_exception_type : cxtype -> int -> cxtype = "clang_ext_FunctionProtoType_getExceptionType_wrapper" external ext_function_proto_type_get_noexcept_expr : cxtype -> cxcursor = "clang_ext_FunctionProtoType_getNoexceptExpr_wrapper" external ext_asm_stmt_get_asm_string : cxcursor -> string = "clang_ext_AsmStmt_GetAsmString_wrapper" external ext_asm_stmt_get_num_outputs : cxcursor -> int = "clang_ext_AsmStmt_getNumOutputs_wrapper" external ext_asm_stmt_get_output_constraint : cxcursor -> int -> string = "clang_ext_AsmStmt_getOutputConstraint_wrapper" external ext_asm_stmt_get_output_expr : cxcursor -> int -> cxcursor = "clang_ext_AsmStmt_getOutputExpr_wrapper" external ext_asm_stmt_get_num_inputs : cxcursor -> int = "clang_ext_AsmStmt_getNumInputs_wrapper" external ext_asm_stmt_get_input_constraint : cxcursor -> int -> string = "clang_ext_AsmStmt_getInputConstraint_wrapper" external ext_asm_stmt_get_input_expr : cxcursor -> int -> cxcursor = "clang_ext_AsmStmt_getInputExpr_wrapper" external ext_declarator_decl_get_type_loc : cxcursor -> clang_ext_typeloc = "clang_ext_DeclaratorDecl_getTypeLoc_wrapper" type clang_ext_typeloc_class = | Qualified | Builtin | Complex | Pointer | BlockPointer | LValueReference | RValueReference | MemberPointer | ConstantArray | IncompleteArray | VariableArray | DependentSizedArray | DependentSizedExtVector | Vector | ExtVector | FunctionProto | FunctionNoProto | UnresolvedUsing | Paren | Typedef | Adjusted | Decayed | TypeOfExpr | TypeOf | Decltype | UnaryTransform | Record | Enum | Elaborated | Attributed | TemplateTypeParm | SubstTemplateTypeParm | SubstTemplateTypeParmPack | TemplateSpecialization | Auto | InjectedClassName | DependentName | DependentTemplateSpecialization | PackExpansion | ObjCObject | ObjCInterface | ObjCObjectPointer | Atomic | InvalidTypeLoc [@@deriving refl] external ext_type_loc_get_class : clang_ext_typeloc -> clang_ext_typeloc_class = "clang_ext_TypeLoc_getClass_wrapper" external ext_type_loc_get_type : clang_ext_typeloc -> cxtype = "clang_ext_TypeLoc_getType_wrapper" external ext_array_type_loc_get_size_expr : clang_ext_typeloc -> cxcursor = "clang_ext_ArrayTypeLoc_getSizeExpr_wrapper" external ext_array_type_loc_get_element_loc : clang_ext_typeloc -> clang_ext_typeloc = "clang_ext_ArrayTypeLoc_getElementLoc_wrapper" external ext_paren_type_loc_get_inner_loc : clang_ext_typeloc -> clang_ext_typeloc = "clang_ext_ParenTypeLoc_getInnerLoc_wrapper" external ext_pointer_like_type_loc_get_pointee_loc : clang_ext_typeloc -> clang_ext_typeloc = "clang_ext_PointerLikeTypeLoc_getPointeeLoc_wrapper" external ext_member_pointer_type_loc_get_class_loc : clang_ext_typeloc -> clang_ext_typeloc = "clang_ext_MemberPointerTypeLoc_getClassLoc_wrapper" external ext_qualified_type_loc_get_unqualified_loc : clang_ext_typeloc -> clang_ext_typeloc = "clang_ext_QualifiedTypeLoc_getUnqualifiedLoc_wrapper" external ext_function_type_loc_get_return_loc : clang_ext_typeloc -> clang_ext_typeloc = "clang_ext_FunctionTypeLoc_getReturnLoc_wrapper" external ext_function_type_loc_get_num_params : clang_ext_typeloc -> int = "clang_ext_FunctionTypeLoc_getNumParams_wrapper" external ext_function_type_loc_get_param : clang_ext_typeloc -> int -> cxcursor = "clang_ext_FunctionTypeLoc_getParam_wrapper" external ext_init_list_expr_get_syntactic_form : cxcursor -> cxcursor = "clang_ext_InitListExpr_getSyntacticForm_wrapper" external ext_init_list_expr_get_semantic_form : cxcursor -> cxcursor = "clang_ext_InitListExpr_getSemanticForm_wrapper" external ext_init_list_expr_get_num_inits : cxcursor -> int = "clang_ext_InitListExpr_getNumInits_wrapper" external ext_init_list_expr_get_init : cxcursor -> int -> cxcursor = "clang_ext_InitListExpr_getInit_wrapper" external ext_designated_init_expr_size : cxcursor -> int = "clang_ext_DesignatedInitExpr_size_wrapper" type clang_ext_designatedinitexpr_designatorkind = | FieldDesignator | ArrayDesignator | ArrayRangeDesignator [@@deriving refl] external ext_designated_init_expr_get_kind : cxcursor -> int -> clang_ext_designatedinitexpr_designatorkind = "clang_ext_DesignatedInitExpr_getKind_wrapper" external ext_designated_init_expr_get_field : cxcursor -> int -> cxcursor = "clang_ext_DesignatedInitExpr_getField_wrapper" external ext_designated_init_expr_get_array_index : cxcursor -> int -> cxcursor = "clang_ext_DesignatedInitExpr_getArrayIndex_wrapper" external ext_designated_init_expr_get_array_range_start : cxcursor -> int -> cxcursor = "clang_ext_DesignatedInitExpr_getArrayRangeStart_wrapper" external ext_designated_init_expr_get_array_range_end : cxcursor -> int -> cxcursor = "clang_ext_DesignatedInitExpr_getArrayRangeEnd_wrapper" external ext_designated_init_expr_get_init : cxcursor -> cxcursor = "clang_ext_DesignatedInitExpr_getInit_wrapper" external ext_concept_decl_get_constraint_expr : cxcursor -> cxcursor = "clang_ext_ConceptDecl_getConstraintExpr_wrapper" type clang_ext_requirementkind = | Type | Simple | Compound | Nested [@@deriving refl] type clang_ext_requirement external ext_requirement_get_kind : clang_ext_requirement -> clang_ext_requirementkind = "clang_ext_Requirement_getKind_wrapper" external ext_type_requirement_get_type : clang_ext_requirement -> clang_ext_typeloc = "clang_ext_TypeRequirement_getType_wrapper" external ext_expr_requirement_get_expr : clang_ext_requirement -> cxcursor = "clang_ext_ExprRequirement_getExpr_wrapper" external ext_expr_requirement_return_type_get_type_constraint_template_parameter_list : clang_ext_requirement -> clang_ext_templateparameterlist = "clang_ext_ExprRequirement_ReturnType_getTypeConstraintTemplateParameterList_wrapper" external ext_expr_requirement_return_type_get_type_constraint : clang_ext_requirement -> cxcursor = "clang_ext_ExprRequirement_ReturnType_getTypeConstraint_wrapper" external ext_nested_requirement_get_constraint_expr : clang_ext_requirement -> cxcursor = "clang_ext_NestedRequirement_getConstraintExpr_wrapper" external ext_requires_expr_get_local_parameter_count : cxcursor -> int = "clang_ext_RequiresExpr_getLocalParameterCount_wrapper" external ext_requires_expr_get_local_parameter : cxcursor -> int -> cxcursor = "clang_ext_RequiresExpr_getLocalParameter_wrapper" external ext_requires_expr_get_requirement_count : cxcursor -> int = "clang_ext_RequiresExpr_getRequirementCount_wrapper" external ext_requires_expr_get_requirement : cxcursor -> int -> clang_ext_requirement = "clang_ext_RequiresExpr_getRequirement_wrapper" external ext_decl_context_visit_decls : cxcursor -> (cxcursor -> cxcursor -> cxchildvisitresult) -> bool = "clang_ext_DeclContext_visitDecls_wrapper" external ext_indirect_field_decl_visit_chain : cxcursor -> (cxcursor -> cxcursor -> cxchildvisitresult) -> bool = "clang_ext_IndirectFieldDecl_visitChain_wrapper" external ext_tag_decl_get_tag_kind : cxcursor -> clang_ext_elaboratedtypekeyword = "clang_ext_TagDecl_getTagKind_wrapper" external ext_decl_has_attrs : cxcursor -> bool = "clang_ext_Decl_hasAttrs_wrapper" external ext_decl_get_attr_count : cxcursor -> int = "clang_ext_Decl_getAttrCount_wrapper" external ext_decl_get_attr : cxcursor -> int -> cxcursor = "clang_ext_Decl_getAttr_wrapper" external ext_cursor_kind_is_attr : cxcursorkind -> bool = "clang_ext_CursorKind_isAttr_wrapper" external ext_function_decl_is_inline_specified : cxcursor -> bool = "clang_ext_FunctionDecl_isInlineSpecified_wrapper" external ext_function_decl_is_inlined : cxcursor -> bool = "clang_ext_FunctionDecl_isInlined_wrapper" external ext_cursor_get_type_loc : cxcursor -> clang_ext_typeloc = "clang_ext_Cursor_getTypeLoc_wrapper" external ext_cxxfor_range_stmt_get_loop_variable : cxcursor -> cxcursor = "clang_ext_CXXForRangeStmt_getLoopVariable_wrapper" external ext_cxxfor_range_stmt_get_range_init : cxcursor -> cxcursor = "clang_ext_CXXForRangeStmt_getRangeInit_wrapper" external ext_cxxfor_range_stmt_get_body : cxcursor -> cxcursor = "clang_ext_CXXForRangeStmt_getBody_wrapper" external ext_attributed_type_loc_get_modified_loc : clang_ext_typeloc -> clang_ext_typeloc = "clang_ext_AttributedTypeLoc_getModifiedLoc_wrapper" external ext_attributed_type_loc_get_attr : clang_ext_typeloc -> cxcursor = "clang_ext_AttributedTypeLoc_getAttr_wrapper" external ext_attributed_type_get_modified_type : cxtype -> cxtype = "clang_ext_AttributedType_getModifiedType_wrapper" external ext_attributed_type_get_attr_kind : cxtype -> clang_ext_attrkind = "clang_ext_AttributedType_getAttrKind_wrapper" external ext_elaborated_type_loc_get_named_type_loc : clang_ext_typeloc -> clang_ext_typeloc = "clang_ext_ElaboratedTypeLoc_getNamedTypeLoc_wrapper" external ext_pack_expansion_type_loc_get_pattern_loc : clang_ext_typeloc -> clang_ext_typeloc = "clang_ext_PackExpansionTypeLoc_getPatternLoc_wrapper" external ext_typedef_decl_get_underlying_type_loc : cxcursor -> clang_ext_typeloc = "clang_ext_TypedefDecl_getUnderlyingTypeLoc_wrapper" external ext_cxxmethod_decl_get_parent : cxcursor -> cxcursor = "clang_ext_CXXMethodDecl_getParent_wrapper" external ext_injected_class_name_type_get_injected_specialization_type : cxtype -> cxtype = "clang_ext_InjectedClassNameType_getInjectedSpecializationType_wrapper" external ext_type_get_unqualified_type : cxtype -> cxtype = "clang_ext_Type_getUnqualifiedType_wrapper" external ext_type_is_sugared : cxtype -> bool = "clang_ext_Type_isSugared_wrapper" external ext_type_desugar : cxtype -> cxtype = "clang_ext_Type_desugar_wrapper" type cxvisitorresult = | Break | Continue [@@deriving refl][@@ocaml.doc "\\@\\{"] type clang_ext_cxxctorinitializer external ext_cxxconstructor_decl_visit_initializers : cxcursor -> (clang_ext_cxxctorinitializer -> cxvisitorresult) -> bool = "clang_ext_CXXConstructorDecl_visitInitializers_wrapper" external ext_cxxctor_initializer_is_base_initializer : clang_ext_cxxctorinitializer -> bool = "clang_ext_CXXCtorInitializer_isBaseInitializer_wrapper" external ext_cxxctor_initializer_is_pack_expansion : clang_ext_cxxctorinitializer -> bool = "clang_ext_CXXCtorInitializer_isPackExpansion_wrapper" external ext_cxxctor_initializer_is_member_initializer : clang_ext_cxxctorinitializer -> bool = "clang_ext_CXXCtorInitializer_isMemberInitializer_wrapper" external ext_cxxctor_initializer_is_indirect_member_initializer : clang_ext_cxxctorinitializer -> bool = "clang_ext_CXXCtorInitializer_isIndirectMemberInitializer_wrapper" external ext_cxxctor_initializer_is_delegating_initializer : clang_ext_cxxctorinitializer -> bool = "clang_ext_CXXCtorInitializer_isDelegatingInitializer_wrapper" external ext_cxxctor_initializer_get_type_source_info : clang_ext_cxxctorinitializer -> clang_ext_typeloc = "clang_ext_CXXCtorInitializer_getTypeSourceInfo_wrapper" external ext_cxxctor_initializer_get_member : clang_ext_cxxctorinitializer -> cxcursor = "clang_ext_CXXCtorInitializer_getMember_wrapper" external ext_cxxctor_initializer_get_any_member : clang_ext_cxxctorinitializer -> cxcursor = "clang_ext_CXXCtorInitializer_getAnyMember_wrapper" external ext_cxxctor_initializer_get_init : clang_ext_cxxctorinitializer -> cxcursor = "clang_ext_CXXCtorInitializer_getInit_wrapper" external ext_function_decl_get_num_template_parameter_lists : cxcursor -> int = "clang_ext_FunctionDecl_getNumTemplateParameterLists_wrapper" external ext_function_decl_get_template_parameter_list : cxcursor -> int -> clang_ext_templateparameterlist = "clang_ext_FunctionDecl_getTemplateParameterList_wrapper" external ext_atomic_type_get_value_type : cxtype -> cxtype = "clang_ext_AtomicType_getValueType_wrapper" type clang_expr_atomicop = | Invalid | C11_atomic_init | C11_atomic_load | C11_atomic_store | C11_atomic_exchange | C11_atomic_compare_exchange_strong | C11_atomic_compare_exchange_weak | C11_atomic_fetch_add | C11_atomic_fetch_sub | C11_atomic_fetch_and | C11_atomic_fetch_or | C11_atomic_fetch_xor | Atomic_load | Atomic_load_n | Atomic_store | Atomic_store_n | Atomic_exchange | Atomic_exchange_n | Atomic_compare_exchange | Atomic_compare_exchange_n | Atomic_fetch_add | Atomic_fetch_sub | Atomic_fetch_and | Atomic_fetch_or | Atomic_fetch_xor | Atomic_fetch_nand | Atomic_add_fetch | Atomic_sub_fetch | Atomic_and_fetch | Atomic_or_fetch | Atomic_xor_fetch | Atomic_nand_fetch [@@deriving refl] external ext_atomic_expr_get_op : cxcursor -> clang_expr_atomicop = "clang_ext_AtomicExpr_getOp_wrapper" external ext_type_of_expr_type_get_underlying_expr : cxtype -> cxcursor = "clang_ext_TypeOfExprType_getUnderlyingExpr_wrapper" external ext_type_of_type_get_underlying_type : cxtype -> cxtype = "clang_ext_TypeOfType_getUnderlyingType_wrapper" external ext_type_of_type_loc_get_underlying_type : clang_ext_typeloc -> clang_ext_typeloc = "clang_ext_TypeOfTypeLoc_getUnderlyingType_wrapper" type clang_ext_storageclass = | None | Extern | Static | PrivateExtern | OpenCLWorkGroupLocal | Auto | Register [@@deriving refl] external ext_decl_get_storage_class : cxcursor -> clang_ext_storageclass = "clang_ext_Decl_getStorageClass_wrapper" type clang_ext_aarch64svepcs_spelling = | GNU_aarch64_sve_pcs | CXX11_clang_aarch64_sve_pcs | C2x_clang_aarch64_sve_pcs | SpellingNotCalculated [@@deriving refl] external ext_aarch64_svepcs_get_spelling : cxcursor -> clang_ext_aarch64svepcs_spelling = "clang_ext_AArch64SVEPcs_getSpelling_wrapper" type clang_ext_aarch64vectorpcs_spelling = | GNU_aarch64_vector_pcs | CXX11_clang_aarch64_vector_pcs | C2x_clang_aarch64_vector_pcs | SpellingNotCalculated [@@deriving refl] external ext_aarch64_vector_pcs_get_spelling : cxcursor -> clang_ext_aarch64vectorpcs_spelling = "clang_ext_AArch64VectorPcs_getSpelling_wrapper" type clang_ext_amdgpuflatworkgroupsize_spelling = | GNU_amdgpu_flat_work_group_size | CXX11_clang_amdgpu_flat_work_group_size | SpellingNotCalculated [@@deriving refl] external ext_amdgpuflat_work_group_size_get_spelling : cxcursor -> clang_ext_amdgpuflatworkgroupsize_spelling = "clang_ext_AMDGPUFlatWorkGroupSize_getSpelling_wrapper" type clang_ext_amdgpukernelcall_spelling = | GNU_amdgpu_kernel | CXX11_clang_amdgpu_kernel | C2x_clang_amdgpu_kernel | SpellingNotCalculated [@@deriving refl] external ext_amdgpukernel_call_get_spelling : cxcursor -> clang_ext_amdgpukernelcall_spelling = "clang_ext_AMDGPUKernelCall_getSpelling_wrapper" type clang_ext_amdgpunumsgpr_spelling = | GNU_amdgpu_num_sgpr | CXX11_clang_amdgpu_num_sgpr | SpellingNotCalculated [@@deriving refl] external ext_amdgpunum_sgpr_get_spelling : cxcursor -> clang_ext_amdgpunumsgpr_spelling = "clang_ext_AMDGPUNumSGPR_getSpelling_wrapper" type clang_ext_amdgpunumvgpr_spelling = | GNU_amdgpu_num_vgpr | CXX11_clang_amdgpu_num_vgpr | SpellingNotCalculated [@@deriving refl] external ext_amdgpunum_vgpr_get_spelling : cxcursor -> clang_ext_amdgpunumvgpr_spelling = "clang_ext_AMDGPUNumVGPR_getSpelling_wrapper" type clang_ext_amdgpuwavespereu_spelling = | GNU_amdgpu_waves_per_eu | CXX11_clang_amdgpu_waves_per_eu | SpellingNotCalculated [@@deriving refl] external ext_amdgpuwaves_per_eu_get_spelling : cxcursor -> clang_ext_amdgpuwavespereu_spelling = "clang_ext_AMDGPUWavesPerEU_getSpelling_wrapper" type clang_ext_arminterrupt_spelling = | GNU_interrupt | CXX11_gnu_interrupt | C2x_gnu_interrupt | SpellingNotCalculated [@@deriving refl] external ext_arminterrupt_get_spelling : cxcursor -> clang_ext_arminterrupt_spelling = "clang_ext_ARMInterrupt_getSpelling_wrapper" type clang_ext_avrinterrupt_spelling = | GNU_interrupt | CXX11_gnu_interrupt | C2x_gnu_interrupt | SpellingNotCalculated [@@deriving refl] external ext_avrinterrupt_get_spelling : cxcursor -> clang_ext_avrinterrupt_spelling = "clang_ext_AVRInterrupt_getSpelling_wrapper" type clang_ext_avrsignal_spelling = | GNU_signal | CXX11_gnu_signal | C2x_gnu_signal | SpellingNotCalculated [@@deriving refl] external ext_avrsignal_get_spelling : cxcursor -> clang_ext_avrsignal_spelling = "clang_ext_AVRSignal_getSpelling_wrapper" type clang_ext_abitag_spelling = | GNU_abi_tag | CXX11_gnu_abi_tag | SpellingNotCalculated [@@deriving refl] external ext_abi_tag_get_spelling : cxcursor -> clang_ext_abitag_spelling = "clang_ext_AbiTag_getSpelling_wrapper" type clang_ext_acquirecapability_spelling = | GNU_acquire_capability | CXX11_clang_acquire_capability | GNU_acquire_shared_capability | CXX11_clang_acquire_shared_capability | GNU_exclusive_lock_function | GNU_shared_lock_function | SpellingNotCalculated [@@deriving refl] external ext_acquire_capability_get_spelling : cxcursor -> clang_ext_acquirecapability_spelling = "clang_ext_AcquireCapability_getSpelling_wrapper" type clang_ext_acquirehandle_spelling = | GNU_acquire_handle | CXX11_clang_acquire_handle | C2x_clang_acquire_handle | SpellingNotCalculated [@@deriving refl] external ext_acquire_handle_get_spelling : cxcursor -> clang_ext_acquirehandle_spelling = "clang_ext_AcquireHandle_getSpelling_wrapper" type clang_ext_addressspace_spelling = | GNU_address_space | CXX11_clang_address_space | C2x_clang_address_space | SpellingNotCalculated [@@deriving refl] external ext_address_space_get_spelling : cxcursor -> clang_ext_addressspace_spelling = "clang_ext_AddressSpace_getSpelling_wrapper" type clang_ext_alias_spelling = | GNU_alias | CXX11_gnu_alias | C2x_gnu_alias | SpellingNotCalculated [@@deriving refl] external ext_alias_get_spelling : cxcursor -> clang_ext_alias_spelling = "clang_ext_Alias_getSpelling_wrapper" type clang_ext_aligned_spelling = | GNU_aligned | CXX11_gnu_aligned | C2x_gnu_aligned | Declspec_align | Keyword_alignas | Keyword_Alignas | SpellingNotCalculated [@@deriving refl] external ext_aligned_get_spelling : cxcursor -> clang_ext_aligned_spelling = "clang_ext_Aligned_getSpelling_wrapper" type clang_ext_allocalign_spelling = | GNU_alloc_align | CXX11_gnu_alloc_align | C2x_gnu_alloc_align | SpellingNotCalculated [@@deriving refl] external ext_alloc_align_get_spelling : cxcursor -> clang_ext_allocalign_spelling = "clang_ext_AllocAlign_getSpelling_wrapper" type clang_ext_allocsize_spelling = | GNU_alloc_size | CXX11_gnu_alloc_size | C2x_gnu_alloc_size | SpellingNotCalculated [@@deriving refl] external ext_alloc_size_get_spelling : cxcursor -> clang_ext_allocsize_spelling = "clang_ext_AllocSize_getSpelling_wrapper" type clang_ext_alwaysdestroy_spelling = | GNU_always_destroy | CXX11_clang_always_destroy | SpellingNotCalculated [@@deriving refl] external ext_always_destroy_get_spelling : cxcursor -> clang_ext_alwaysdestroy_spelling = "clang_ext_AlwaysDestroy_getSpelling_wrapper" type clang_ext_alwaysinline_spelling = | GNU_always_inline | CXX11_gnu_always_inline | C2x_gnu_always_inline | CXX11_clang_always_inline | C2x_clang_always_inline | Keyword_forceinline | SpellingNotCalculated [@@deriving refl] external ext_always_inline_get_spelling : cxcursor -> clang_ext_alwaysinline_spelling = "clang_ext_AlwaysInline_getSpelling_wrapper" type clang_ext_annotate_spelling = | GNU_annotate | CXX11_clang_annotate | C2x_clang_annotate | SpellingNotCalculated [@@deriving refl] external ext_annotate_get_spelling : cxcursor -> clang_ext_annotate_spelling = "clang_ext_Annotate_getSpelling_wrapper" type clang_ext_annotatetype_spelling = | CXX11_clang_annotate_type | C2x_clang_annotate_type | SpellingNotCalculated [@@deriving refl] external ext_annotate_type_get_spelling : cxcursor -> clang_ext_annotatetype_spelling = "clang_ext_AnnotateType_getSpelling_wrapper" type clang_ext_anyx86interrupt_spelling = | GNU_interrupt | CXX11_gnu_interrupt | C2x_gnu_interrupt | SpellingNotCalculated [@@deriving refl] external ext_any_x86_interrupt_get_spelling : cxcursor -> clang_ext_anyx86interrupt_spelling = "clang_ext_AnyX86Interrupt_getSpelling_wrapper" type clang_ext_anyx86nocallersavedregisters_spelling = | GNU_no_caller_saved_registers | CXX11_gnu_no_caller_saved_registers | C2x_gnu_no_caller_saved_registers | SpellingNotCalculated [@@deriving refl] external ext_any_x86_no_caller_saved_registers_get_spelling : cxcursor -> clang_ext_anyx86nocallersavedregisters_spelling = "clang_ext_AnyX86NoCallerSavedRegisters_getSpelling_wrapper" type clang_ext_anyx86nocfcheck_spelling = | GNU_nocf_check | CXX11_gnu_nocf_check | C2x_gnu_nocf_check | SpellingNotCalculated [@@deriving refl] external ext_any_x86_no_cf_check_get_spelling : cxcursor -> clang_ext_anyx86nocfcheck_spelling = "clang_ext_AnyX86NoCfCheck_getSpelling_wrapper" type clang_ext_arcweakrefunavailable_spelling = | GNU_objc_arc_weak_reference_unavailable | CXX11_clang_objc_arc_weak_reference_unavailable | C2x_clang_objc_arc_weak_reference_unavailable | SpellingNotCalculated [@@deriving refl] external ext_arc_weakref_unavailable_get_spelling : cxcursor -> clang_ext_arcweakrefunavailable_spelling = "clang_ext_ArcWeakrefUnavailable_getSpelling_wrapper" type clang_ext_argumentwithtypetag_spelling = | GNU_argument_with_type_tag | CXX11_clang_argument_with_type_tag | C2x_clang_argument_with_type_tag | GNU_pointer_with_type_tag | CXX11_clang_pointer_with_type_tag | C2x_clang_pointer_with_type_tag | SpellingNotCalculated [@@deriving refl] external ext_argument_with_type_tag_get_spelling : cxcursor -> clang_ext_argumentwithtypetag_spelling = "clang_ext_ArgumentWithTypeTag_getSpelling_wrapper" type clang_ext_armbuiltinalias_spelling = | GNU_clang_arm_builtin_alias | CXX11_clang_clang_arm_builtin_alias | C2x_clang_clang_arm_builtin_alias | SpellingNotCalculated [@@deriving refl] external ext_arm_builtin_alias_get_spelling : cxcursor -> clang_ext_armbuiltinalias_spelling = "clang_ext_ArmBuiltinAlias_getSpelling_wrapper" type clang_ext_armmvestrictpolymorphism_spelling = | GNU_clang_arm_mve_strict_polymorphism | CXX11_clang_clang_arm_mve_strict_polymorphism | C2x_clang_clang_arm_mve_strict_polymorphism | SpellingNotCalculated [@@deriving refl] external ext_arm_mve_strict_polymorphism_get_spelling : cxcursor -> clang_ext_armmvestrictpolymorphism_spelling = "clang_ext_ArmMveStrictPolymorphism_getSpelling_wrapper" type clang_ext_artificial_spelling = | GNU_artificial | CXX11_gnu_artificial | C2x_gnu_artificial | SpellingNotCalculated [@@deriving refl] external ext_artificial_get_spelling : cxcursor -> clang_ext_artificial_spelling = "clang_ext_Artificial_getSpelling_wrapper" type clang_ext_asmlabel_spelling = | Keyword_asm | SpellingNotCalculated [@@deriving refl] external ext_asm_label_get_spelling : cxcursor -> clang_ext_asmlabel_spelling = "clang_ext_AsmLabel_getSpelling_wrapper" type clang_ext_assertcapability_spelling = | GNU_assert_capability | CXX11_clang_assert_capability | GNU_assert_shared_capability | CXX11_clang_assert_shared_capability | SpellingNotCalculated [@@deriving refl] external ext_assert_capability_get_spelling : cxcursor -> clang_ext_assertcapability_spelling = "clang_ext_AssertCapability_getSpelling_wrapper" type clang_ext_assumealigned_spelling = | GNU_assume_aligned | CXX11_gnu_assume_aligned | C2x_gnu_assume_aligned | SpellingNotCalculated [@@deriving refl] external ext_assume_aligned_get_spelling : cxcursor -> clang_ext_assumealigned_spelling = "clang_ext_AssumeAligned_getSpelling_wrapper" type clang_ext_assumption_spelling = | GNU_assume | CXX11_clang_assume | C2x_clang_assume | SpellingNotCalculated [@@deriving refl] external ext_assumption_get_spelling : cxcursor -> clang_ext_assumption_spelling = "clang_ext_Assumption_getSpelling_wrapper" type clang_ext_availability_spelling = | GNU_availability | CXX11_clang_availability | C2x_clang_availability | SpellingNotCalculated [@@deriving refl] external ext_availability_get_spelling : cxcursor -> clang_ext_availability_spelling = "clang_ext_Availability_getSpelling_wrapper" type clang_ext_bpfpreserveaccessindex_spelling = | GNU_preserve_access_index | CXX11_clang_preserve_access_index | C2x_clang_preserve_access_index | SpellingNotCalculated [@@deriving refl] external ext_bpfpreserve_access_index_get_spelling : cxcursor -> clang_ext_bpfpreserveaccessindex_spelling = "clang_ext_BPFPreserveAccessIndex_getSpelling_wrapper" type clang_ext_btfdecltag_spelling = | GNU_btf_decl_tag | CXX11_clang_btf_decl_tag | C2x_clang_btf_decl_tag | SpellingNotCalculated [@@deriving refl] external ext_btfdecl_tag_get_spelling : cxcursor -> clang_ext_btfdecltag_spelling = "clang_ext_BTFDeclTag_getSpelling_wrapper" type clang_ext_btftypetag_spelling = | GNU_btf_type_tag | CXX11_clang_btf_type_tag | C2x_clang_btf_type_tag | SpellingNotCalculated [@@deriving refl] external ext_btftype_tag_get_spelling : cxcursor -> clang_ext_btftypetag_spelling = "clang_ext_BTFTypeTag_getSpelling_wrapper" type clang_ext_blocks_spelling = | GNU_blocks | CXX11_clang_blocks | C2x_clang_blocks | SpellingNotCalculated [@@deriving refl] external ext_blocks_get_spelling : cxcursor -> clang_ext_blocks_spelling = "clang_ext_Blocks_getSpelling_wrapper" type clang_ext_builtinalias_spelling = | CXX11_clang_builtin_alias | C2x_clang_builtin_alias | GNU_clang_builtin_alias | SpellingNotCalculated [@@deriving refl] external ext_builtin_alias_get_spelling : cxcursor -> clang_ext_builtinalias_spelling = "clang_ext_BuiltinAlias_getSpelling_wrapper" type clang_ext_cdecl_spelling = | GNU_cdecl | CXX11_gnu_cdecl | C2x_gnu_cdecl | Keyword_cdecl | SpellingNotCalculated [@@deriving refl] external ext_cdecl_get_spelling : cxcursor -> clang_ext_cdecl_spelling = "clang_ext_CDecl_getSpelling_wrapper" type clang_ext_cfauditedtransfer_spelling = | GNU_cf_audited_transfer | CXX11_clang_cf_audited_transfer | C2x_clang_cf_audited_transfer | SpellingNotCalculated [@@deriving refl] external ext_cfaudited_transfer_get_spelling : cxcursor -> clang_ext_cfauditedtransfer_spelling = "clang_ext_CFAuditedTransfer_getSpelling_wrapper" type clang_ext_cfconsumed_spelling = | GNU_cf_consumed | CXX11_clang_cf_consumed | C2x_clang_cf_consumed | SpellingNotCalculated [@@deriving refl] external ext_cfconsumed_get_spelling : cxcursor -> clang_ext_cfconsumed_spelling = "clang_ext_CFConsumed_getSpelling_wrapper" type clang_ext_cficanonicaljumptable_spelling = | GNU_cfi_canonical_jump_table | CXX11_clang_cfi_canonical_jump_table | C2x_clang_cfi_canonical_jump_table | SpellingNotCalculated [@@deriving refl] external ext_cficanonical_jump_table_get_spelling : cxcursor -> clang_ext_cficanonicaljumptable_spelling = "clang_ext_CFICanonicalJumpTable_getSpelling_wrapper" type clang_ext_cfreturnsnotretained_spelling = | GNU_cf_returns_not_retained | CXX11_clang_cf_returns_not_retained | C2x_clang_cf_returns_not_retained | SpellingNotCalculated [@@deriving refl] external ext_cfreturns_not_retained_get_spelling : cxcursor -> clang_ext_cfreturnsnotretained_spelling = "clang_ext_CFReturnsNotRetained_getSpelling_wrapper" type clang_ext_cfreturnsretained_spelling = | GNU_cf_returns_retained | CXX11_clang_cf_returns_retained | C2x_clang_cf_returns_retained | SpellingNotCalculated [@@deriving refl] external ext_cfreturns_retained_get_spelling : cxcursor -> clang_ext_cfreturnsretained_spelling = "clang_ext_CFReturnsRetained_getSpelling_wrapper" type clang_ext_cfunknowntransfer_spelling = | GNU_cf_unknown_transfer | CXX11_clang_cf_unknown_transfer | C2x_clang_cf_unknown_transfer | SpellingNotCalculated [@@deriving refl] external ext_cfunknown_transfer_get_spelling : cxcursor -> clang_ext_cfunknowntransfer_spelling = "clang_ext_CFUnknownTransfer_getSpelling_wrapper" type clang_ext_cpudispatch_spelling = | GNU_cpu_dispatch | CXX11_clang_cpu_dispatch | C2x_clang_cpu_dispatch | Declspec_cpu_dispatch | SpellingNotCalculated [@@deriving refl] external ext_cpudispatch_get_spelling : cxcursor -> clang_ext_cpudispatch_spelling = "clang_ext_CPUDispatch_getSpelling_wrapper" type clang_ext_cpuspecific_spelling = | GNU_cpu_specific | CXX11_clang_cpu_specific | C2x_clang_cpu_specific | Declspec_cpu_specific | SpellingNotCalculated [@@deriving refl] external ext_cpuspecific_get_spelling : cxcursor -> clang_ext_cpuspecific_spelling = "clang_ext_CPUSpecific_getSpelling_wrapper" type clang_ext_cudaconstant_spelling = | GNU_constant | Declspec_constant | SpellingNotCalculated [@@deriving refl] external ext_cudaconstant_get_spelling : cxcursor -> clang_ext_cudaconstant_spelling = "clang_ext_CUDAConstant_getSpelling_wrapper" type clang_ext_cudadevice_spelling = | GNU_device | Declspec_device | SpellingNotCalculated [@@deriving refl] external ext_cudadevice_get_spelling : cxcursor -> clang_ext_cudadevice_spelling = "clang_ext_CUDADevice_getSpelling_wrapper" type clang_ext_cudadevicebuiltinsurfacetype_spelling = | GNU_device_builtin_surface_type | Declspec_device_builtin_surface_type | SpellingNotCalculated [@@deriving refl] external ext_cudadevice_builtin_surface_type_get_spelling : cxcursor -> clang_ext_cudadevicebuiltinsurfacetype_spelling = "clang_ext_CUDADeviceBuiltinSurfaceType_getSpelling_wrapper" type clang_ext_cudadevicebuiltintexturetype_spelling = | GNU_device_builtin_texture_type | Declspec_device_builtin_texture_type | SpellingNotCalculated [@@deriving refl] external ext_cudadevice_builtin_texture_type_get_spelling : cxcursor -> clang_ext_cudadevicebuiltintexturetype_spelling = "clang_ext_CUDADeviceBuiltinTextureType_getSpelling_wrapper" type clang_ext_cudaglobal_spelling = | GNU_global | Declspec_global | SpellingNotCalculated [@@deriving refl] external ext_cudaglobal_get_spelling : cxcursor -> clang_ext_cudaglobal_spelling = "clang_ext_CUDAGlobal_getSpelling_wrapper" type clang_ext_cudahost_spelling = | GNU_host | Declspec_host | SpellingNotCalculated [@@deriving refl] external ext_cudahost_get_spelling : cxcursor -> clang_ext_cudahost_spelling = "clang_ext_CUDAHost_getSpelling_wrapper" type clang_ext_cudalaunchbounds_spelling = | GNU_launch_bounds | Declspec_launch_bounds | SpellingNotCalculated [@@deriving refl] external ext_cudalaunch_bounds_get_spelling : cxcursor -> clang_ext_cudalaunchbounds_spelling = "clang_ext_CUDALaunchBounds_getSpelling_wrapper" type clang_ext_cudashared_spelling = | GNU_shared | Declspec_shared | SpellingNotCalculated [@@deriving refl] external ext_cudashared_get_spelling : cxcursor -> clang_ext_cudashared_spelling = "clang_ext_CUDAShared_getSpelling_wrapper" type clang_ext_cxx11noreturn_spelling = | CXX11_noreturn | C2x_noreturn | C2x_Noreturn | SpellingNotCalculated [@@deriving refl] external ext_cxx11_no_return_get_spelling : cxcursor -> clang_ext_cxx11noreturn_spelling = "clang_ext_CXX11NoReturn_getSpelling_wrapper" type clang_ext_callablewhen_spelling = | GNU_callable_when | CXX11_clang_callable_when | SpellingNotCalculated [@@deriving refl] external ext_callable_when_get_spelling : cxcursor -> clang_ext_callablewhen_spelling = "clang_ext_CallableWhen_getSpelling_wrapper" type clang_ext_callback_spelling = | GNU_callback | CXX11_clang_callback | C2x_clang_callback | SpellingNotCalculated [@@deriving refl] external ext_callback_get_spelling : cxcursor -> clang_ext_callback_spelling = "clang_ext_Callback_getSpelling_wrapper" type clang_ext_calledonce_spelling = | GNU_called_once | CXX11_clang_called_once | C2x_clang_called_once | SpellingNotCalculated [@@deriving refl] external ext_called_once_get_spelling : cxcursor -> clang_ext_calledonce_spelling = "clang_ext_CalledOnce_getSpelling_wrapper" type clang_ext_capability_spelling = | GNU_capability | CXX11_clang_capability | GNU_shared_capability | CXX11_clang_shared_capability | SpellingNotCalculated [@@deriving refl] external ext_capability_get_spelling : cxcursor -> clang_ext_capability_spelling = "clang_ext_Capability_getSpelling_wrapper" type clang_ext_carriesdependency_spelling = | GNU_carries_dependency | CXX11_carries_dependency | SpellingNotCalculated [@@deriving refl] external ext_carries_dependency_get_spelling : cxcursor -> clang_ext_carriesdependency_spelling = "clang_ext_CarriesDependency_getSpelling_wrapper" type clang_ext_cleanup_spelling = | GNU_cleanup | CXX11_gnu_cleanup | C2x_gnu_cleanup | SpellingNotCalculated [@@deriving refl] external ext_cleanup_get_spelling : cxcursor -> clang_ext_cleanup_spelling = "clang_ext_Cleanup_getSpelling_wrapper" type clang_ext_cold_spelling = | GNU_cold | CXX11_gnu_cold | C2x_gnu_cold | SpellingNotCalculated [@@deriving refl] external ext_cold_get_spelling : cxcursor -> clang_ext_cold_spelling = "clang_ext_Cold_getSpelling_wrapper" type clang_ext_common_spelling = | GNU_common | CXX11_gnu_common | C2x_gnu_common | SpellingNotCalculated [@@deriving refl] external ext_common_get_spelling : cxcursor -> clang_ext_common_spelling = "clang_ext_Common_getSpelling_wrapper" type clang_ext_const_spelling = | GNU_const | CXX11_gnu_const | C2x_gnu_const | SpellingNotCalculated [@@deriving refl] external ext_const_get_spelling : cxcursor -> clang_ext_const_spelling = "clang_ext_Const_getSpelling_wrapper" type clang_ext_constinit_spelling = | Keyword_constinit | GNU_require_constant_initialization | CXX11_clang_require_constant_initialization | SpellingNotCalculated [@@deriving refl] external ext_const_init_get_spelling : cxcursor -> clang_ext_constinit_spelling = "clang_ext_ConstInit_getSpelling_wrapper" type clang_ext_constructor_spelling = | GNU_constructor | CXX11_gnu_constructor | C2x_gnu_constructor | SpellingNotCalculated [@@deriving refl] external ext_constructor_get_spelling : cxcursor -> clang_ext_constructor_spelling = "clang_ext_Constructor_getSpelling_wrapper" type clang_ext_consumable_spelling = | GNU_consumable | CXX11_clang_consumable | SpellingNotCalculated [@@deriving refl] external ext_consumable_get_spelling : cxcursor -> clang_ext_consumable_spelling = "clang_ext_Consumable_getSpelling_wrapper" type clang_ext_consumableautocast_spelling = | GNU_consumable_auto_cast_state | CXX11_clang_consumable_auto_cast_state | SpellingNotCalculated [@@deriving refl] external ext_consumable_auto_cast_get_spelling : cxcursor -> clang_ext_consumableautocast_spelling = "clang_ext_ConsumableAutoCast_getSpelling_wrapper" type clang_ext_consumablesetonread_spelling = | GNU_consumable_set_state_on_read | CXX11_clang_consumable_set_state_on_read | SpellingNotCalculated [@@deriving refl] external ext_consumable_set_on_read_get_spelling : cxcursor -> clang_ext_consumablesetonread_spelling = "clang_ext_ConsumableSetOnRead_getSpelling_wrapper" type clang_ext_convergent_spelling = | GNU_convergent | CXX11_clang_convergent | C2x_clang_convergent | SpellingNotCalculated [@@deriving refl] external ext_convergent_get_spelling : cxcursor -> clang_ext_convergent_spelling = "clang_ext_Convergent_getSpelling_wrapper" type clang_ext_dllexport_spelling = | Declspec_dllexport | GNU_dllexport | CXX11_gnu_dllexport | C2x_gnu_dllexport | SpellingNotCalculated [@@deriving refl] external ext_dllexport_get_spelling : cxcursor -> clang_ext_dllexport_spelling = "clang_ext_DLLExport_getSpelling_wrapper" type clang_ext_dllimport_spelling = | Declspec_dllimport | GNU_dllimport | CXX11_gnu_dllimport | C2x_gnu_dllimport | SpellingNotCalculated [@@deriving refl] external ext_dllimport_get_spelling : cxcursor -> clang_ext_dllimport_spelling = "clang_ext_DLLImport_getSpelling_wrapper" type clang_ext_deprecated_spelling = | GNU_deprecated | CXX11_gnu_deprecated | C2x_gnu_deprecated | Declspec_deprecated | CXX11_deprecated | C2x_deprecated | SpellingNotCalculated [@@deriving refl] external ext_deprecated_get_spelling : cxcursor -> clang_ext_deprecated_spelling = "clang_ext_Deprecated_getSpelling_wrapper" type clang_ext_destructor_spelling = | GNU_destructor | CXX11_gnu_destructor | C2x_gnu_destructor | SpellingNotCalculated [@@deriving refl] external ext_destructor_get_spelling : cxcursor -> clang_ext_destructor_spelling = "clang_ext_Destructor_getSpelling_wrapper" type clang_ext_diagnoseasbuiltin_spelling = | GNU_diagnose_as_builtin | CXX11_clang_diagnose_as_builtin | C2x_clang_diagnose_as_builtin | SpellingNotCalculated [@@deriving refl] external ext_diagnose_as_builtin_get_spelling : cxcursor -> clang_ext_diagnoseasbuiltin_spelling = "clang_ext_DiagnoseAsBuiltin_getSpelling_wrapper" type clang_ext_disablesanitizerinstrumentation_spelling = | GNU_disable_sanitizer_instrumentation | CXX11_clang_disable_sanitizer_instrumentation | C2x_clang_disable_sanitizer_instrumentation | SpellingNotCalculated [@@deriving refl] external ext_disable_sanitizer_instrumentation_get_spelling : cxcursor -> clang_ext_disablesanitizerinstrumentation_spelling = "clang_ext_DisableSanitizerInstrumentation_getSpelling_wrapper" type clang_ext_disabletailcalls_spelling = | GNU_disable_tail_calls | CXX11_clang_disable_tail_calls | C2x_clang_disable_tail_calls | SpellingNotCalculated [@@deriving refl] external ext_disable_tail_calls_get_spelling : cxcursor -> clang_ext_disabletailcalls_spelling = "clang_ext_DisableTailCalls_getSpelling_wrapper" type clang_ext_enforcetcb_spelling = | GNU_enforce_tcb | CXX11_clang_enforce_tcb | C2x_clang_enforce_tcb | SpellingNotCalculated [@@deriving refl] external ext_enforce_tcb_get_spelling : cxcursor -> clang_ext_enforcetcb_spelling = "clang_ext_EnforceTCB_getSpelling_wrapper" type clang_ext_enforcetcbleaf_spelling = | GNU_enforce_tcb_leaf | CXX11_clang_enforce_tcb_leaf | C2x_clang_enforce_tcb_leaf | SpellingNotCalculated [@@deriving refl] external ext_enforce_tcbleaf_get_spelling : cxcursor -> clang_ext_enforcetcbleaf_spelling = "clang_ext_EnforceTCBLeaf_getSpelling_wrapper" type clang_ext_enumextensibility_spelling = | GNU_enum_extensibility | CXX11_clang_enum_extensibility | C2x_clang_enum_extensibility | SpellingNotCalculated [@@deriving refl] external ext_enum_extensibility_get_spelling : cxcursor -> clang_ext_enumextensibility_spelling = "clang_ext_EnumExtensibility_getSpelling_wrapper" type clang_ext_error_spelling = | GNU_error | CXX11_gnu_error | C2x_gnu_error | GNU_warning | CXX11_gnu_warning | C2x_gnu_warning | SpellingNotCalculated [@@deriving refl] external ext_error_get_spelling : cxcursor -> clang_ext_error_spelling = "clang_ext_Error_getSpelling_wrapper" type clang_ext_excludefromexplicitinstantiation_spelling = | GNU_exclude_from_explicit_instantiation | CXX11_clang_exclude_from_explicit_instantiation | C2x_clang_exclude_from_explicit_instantiation | SpellingNotCalculated [@@deriving refl] external ext_exclude_from_explicit_instantiation_get_spelling : cxcursor -> clang_ext_excludefromexplicitinstantiation_spelling = "clang_ext_ExcludeFromExplicitInstantiation_getSpelling_wrapper" type clang_ext_externalsourcesymbol_spelling = | GNU_external_source_symbol | CXX11_clang_external_source_symbol | C2x_clang_external_source_symbol | SpellingNotCalculated [@@deriving refl] external ext_external_source_symbol_get_spelling : cxcursor -> clang_ext_externalsourcesymbol_spelling = "clang_ext_ExternalSourceSymbol_getSpelling_wrapper" type clang_ext_fallthrough_spelling = | CXX11_fallthrough | C2x_fallthrough | CXX11_clang_fallthrough | GNU_fallthrough | CXX11_gnu_fallthrough | C2x_gnu_fallthrough | SpellingNotCalculated [@@deriving refl] external ext_fall_through_get_spelling : cxcursor -> clang_ext_fallthrough_spelling = "clang_ext_FallThrough_getSpelling_wrapper" type clang_ext_fastcall_spelling = | GNU_fastcall | CXX11_gnu_fastcall | C2x_gnu_fastcall | Keyword_fastcall | SpellingNotCalculated [@@deriving refl] external ext_fast_call_get_spelling : cxcursor -> clang_ext_fastcall_spelling = "clang_ext_FastCall_getSpelling_wrapper" type clang_ext_final_spelling = | Keyword_final | Keyword_sealed | SpellingNotCalculated [@@deriving refl] external ext_final_get_spelling : cxcursor -> clang_ext_final_spelling = "clang_ext_Final_getSpelling_wrapper" type clang_ext_flagenum_spelling = | GNU_flag_enum | CXX11_clang_flag_enum | C2x_clang_flag_enum | SpellingNotCalculated [@@deriving refl] external ext_flag_enum_get_spelling : cxcursor -> clang_ext_flagenum_spelling = "clang_ext_FlagEnum_getSpelling_wrapper" type clang_ext_flatten_spelling = | GNU_flatten | CXX11_gnu_flatten | C2x_gnu_flatten | SpellingNotCalculated [@@deriving refl] external ext_flatten_get_spelling : cxcursor -> clang_ext_flatten_spelling = "clang_ext_Flatten_getSpelling_wrapper" type clang_ext_format_spelling = | GNU_format | CXX11_gnu_format | C2x_gnu_format | SpellingNotCalculated [@@deriving refl] external ext_format_get_spelling : cxcursor -> clang_ext_format_spelling = "clang_ext_Format_getSpelling_wrapper" type clang_ext_formatarg_spelling = | GNU_format_arg | CXX11_gnu_format_arg | C2x_gnu_format_arg | SpellingNotCalculated [@@deriving refl] external ext_format_arg_get_spelling : cxcursor -> clang_ext_formatarg_spelling = "clang_ext_FormatArg_getSpelling_wrapper" type clang_ext_functionreturnthunks_spelling = | GNU_function_return | CXX11_gnu_function_return | C2x_gnu_function_return | SpellingNotCalculated [@@deriving refl] external ext_function_return_thunks_get_spelling : cxcursor -> clang_ext_functionreturnthunks_spelling = "clang_ext_FunctionReturnThunks_getSpelling_wrapper" type clang_ext_gnuinline_spelling = | GNU_gnu_inline | CXX11_gnu_gnu_inline | C2x_gnu_gnu_inline | SpellingNotCalculated [@@deriving refl] external ext_gnuinline_get_spelling : cxcursor -> clang_ext_gnuinline_spelling = "clang_ext_GNUInline_getSpelling_wrapper" type clang_ext_guardedvar_spelling = | GNU_guarded_var | CXX11_clang_guarded_var | SpellingNotCalculated [@@deriving refl] external ext_guarded_var_get_spelling : cxcursor -> clang_ext_guardedvar_spelling = "clang_ext_GuardedVar_getSpelling_wrapper" type clang_ext_hipmanaged_spelling = | GNU_managed | Declspec_managed | SpellingNotCalculated [@@deriving refl] external ext_hipmanaged_get_spelling : cxcursor -> clang_ext_hipmanaged_spelling = "clang_ext_HIPManaged_getSpelling_wrapper" type clang_ext_hot_spelling = | GNU_hot | CXX11_gnu_hot | C2x_gnu_hot | SpellingNotCalculated [@@deriving refl] external ext_hot_get_spelling : cxcursor -> clang_ext_hot_spelling = "clang_ext_Hot_getSpelling_wrapper" type clang_ext_ibaction_spelling = | GNU_ibaction | CXX11_clang_ibaction | C2x_clang_ibaction | SpellingNotCalculated [@@deriving refl] external ext_ibaction_get_spelling : cxcursor -> clang_ext_ibaction_spelling = "clang_ext_IBAction_getSpelling_wrapper" type clang_ext_iboutlet_spelling = | GNU_iboutlet | CXX11_clang_iboutlet | C2x_clang_iboutlet | SpellingNotCalculated [@@deriving refl] external ext_iboutlet_get_spelling : cxcursor -> clang_ext_iboutlet_spelling = "clang_ext_IBOutlet_getSpelling_wrapper" type clang_ext_iboutletcollection_spelling = | GNU_iboutletcollection | CXX11_clang_iboutletcollection | C2x_clang_iboutletcollection | SpellingNotCalculated [@@deriving refl] external ext_iboutlet_collection_get_spelling : cxcursor -> clang_ext_iboutletcollection_spelling = "clang_ext_IBOutletCollection_getSpelling_wrapper" type clang_ext_ifunc_spelling = | GNU_ifunc | CXX11_gnu_ifunc | C2x_gnu_ifunc | SpellingNotCalculated [@@deriving refl] external ext_ifunc_get_spelling : cxcursor -> clang_ext_ifunc_spelling = "clang_ext_IFunc_getSpelling_wrapper" type clang_ext_initpriority_spelling = | GNU_init_priority | CXX11_gnu_init_priority | SpellingNotCalculated [@@deriving refl] external ext_init_priority_get_spelling : cxcursor -> clang_ext_initpriority_spelling = "clang_ext_InitPriority_getSpelling_wrapper" type clang_ext_inteloclbicc_spelling = | GNU_intel_ocl_bicc | CXX11_clang_intel_ocl_bicc | SpellingNotCalculated [@@deriving refl] external ext_intel_ocl_bicc_get_spelling : cxcursor -> clang_ext_inteloclbicc_spelling = "clang_ext_IntelOclBicc_getSpelling_wrapper" type clang_ext_internallinkage_spelling = | GNU_internal_linkage | CXX11_clang_internal_linkage | C2x_clang_internal_linkage | SpellingNotCalculated [@@deriving refl] external ext_internal_linkage_get_spelling : cxcursor -> clang_ext_internallinkage_spelling = "clang_ext_InternalLinkage_getSpelling_wrapper" type clang_ext_ltovisibilitypublic_spelling = | GNU_lto_visibility_public | CXX11_clang_lto_visibility_public | C2x_clang_lto_visibility_public | SpellingNotCalculated [@@deriving refl] external ext_ltovisibility_public_get_spelling : cxcursor -> clang_ext_ltovisibilitypublic_spelling = "clang_ext_LTOVisibilityPublic_getSpelling_wrapper" type clang_ext_leaf_spelling = | GNU_leaf | CXX11_gnu_leaf | C2x_gnu_leaf | SpellingNotCalculated [@@deriving refl] external ext_leaf_get_spelling : cxcursor -> clang_ext_leaf_spelling = "clang_ext_Leaf_getSpelling_wrapper" type clang_ext_lifetimebound_spelling = | GNU_lifetimebound | CXX11_clang_lifetimebound | SpellingNotCalculated [@@deriving refl] external ext_lifetime_bound_get_spelling : cxcursor -> clang_ext_lifetimebound_spelling = "clang_ext_LifetimeBound_getSpelling_wrapper" type clang_ext_likely_spelling = | CXX11_likely | C2x_clang_likely | SpellingNotCalculated [@@deriving refl] external ext_likely_get_spelling : cxcursor -> clang_ext_likely_spelling = "clang_ext_Likely_getSpelling_wrapper" type clang_ext_loaderuninitialized_spelling = | GNU_loader_uninitialized | CXX11_clang_loader_uninitialized | C2x_clang_loader_uninitialized | SpellingNotCalculated [@@deriving refl] external ext_loader_uninitialized_get_spelling : cxcursor -> clang_ext_loaderuninitialized_spelling = "clang_ext_LoaderUninitialized_getSpelling_wrapper" type clang_ext_loophint_spelling = | Pragma_clang_loop | Pragma_unroll | Pragma_nounroll | Pragma_unroll_and_jam | Pragma_nounroll_and_jam | SpellingNotCalculated [@@deriving refl] external ext_loop_hint_get_spelling : cxcursor -> clang_ext_loophint_spelling = "clang_ext_LoopHint_getSpelling_wrapper" type clang_ext_migserverroutine_spelling = | GNU_mig_server_routine | CXX11_clang_mig_server_routine | C2x_clang_mig_server_routine | SpellingNotCalculated [@@deriving refl] external ext_migserver_routine_get_spelling : cxcursor -> clang_ext_migserverroutine_spelling = "clang_ext_MIGServerRoutine_getSpelling_wrapper" type clang_ext_msabi_spelling = | GNU_ms_abi | CXX11_gnu_ms_abi | C2x_gnu_ms_abi | SpellingNotCalculated [@@deriving refl] external ext_msabi_get_spelling : cxcursor -> clang_ext_msabi_spelling = "clang_ext_MSABI_getSpelling_wrapper" type clang_ext_msinheritance_spelling = | Keyword_single_inheritance | Keyword_multiple_inheritance | Keyword_virtual_inheritance | Keyword_unspecified_inheritance | SpellingNotCalculated [@@deriving refl] external ext_msinheritance_get_spelling : cxcursor -> clang_ext_msinheritance_spelling = "clang_ext_MSInheritance_getSpelling_wrapper" type clang_ext_msp430interrupt_spelling = | GNU_interrupt | CXX11_gnu_interrupt | C2x_gnu_interrupt | SpellingNotCalculated [@@deriving refl] external ext_msp430_interrupt_get_spelling : cxcursor -> clang_ext_msp430interrupt_spelling = "clang_ext_MSP430Interrupt_getSpelling_wrapper" type clang_ext_msstruct_spelling = | GNU_ms_struct | CXX11_gnu_ms_struct | C2x_gnu_ms_struct | SpellingNotCalculated [@@deriving refl] external ext_msstruct_get_spelling : cxcursor -> clang_ext_msstruct_spelling = "clang_ext_MSStruct_getSpelling_wrapper" type clang_ext_mayalias_spelling = | GNU_may_alias | CXX11_gnu_may_alias | C2x_gnu_may_alias | SpellingNotCalculated [@@deriving refl] external ext_may_alias_get_spelling : cxcursor -> clang_ext_mayalias_spelling = "clang_ext_MayAlias_getSpelling_wrapper" type clang_ext_micromips_spelling = | GNU_micromips | CXX11_gnu_micromips | C2x_gnu_micromips | SpellingNotCalculated [@@deriving refl] external ext_micro_mips_get_spelling : cxcursor -> clang_ext_micromips_spelling = "clang_ext_MicroMips_getSpelling_wrapper" type clang_ext_minsize_spelling = | GNU_minsize | CXX11_clang_minsize | C2x_clang_minsize | SpellingNotCalculated [@@deriving refl] external ext_min_size_get_spelling : cxcursor -> clang_ext_minsize_spelling = "clang_ext_MinSize_getSpelling_wrapper" type clang_ext_minvectorwidth_spelling = | GNU_min_vector_width | CXX11_clang_min_vector_width | C2x_clang_min_vector_width | SpellingNotCalculated [@@deriving refl] external ext_min_vector_width_get_spelling : cxcursor -> clang_ext_minvectorwidth_spelling = "clang_ext_MinVectorWidth_getSpelling_wrapper" type clang_ext_mips16_spelling = | GNU_mips16 | CXX11_gnu_mips16 | C2x_gnu_mips16 | SpellingNotCalculated [@@deriving refl] external ext_mips16_get_spelling : cxcursor -> clang_ext_mips16_spelling = "clang_ext_Mips16_getSpelling_wrapper" type clang_ext_mipsinterrupt_spelling = | GNU_interrupt | CXX11_gnu_interrupt | C2x_gnu_interrupt | SpellingNotCalculated [@@deriving refl] external ext_mips_interrupt_get_spelling : cxcursor -> clang_ext_mipsinterrupt_spelling = "clang_ext_MipsInterrupt_getSpelling_wrapper" type clang_ext_mipslongcall_spelling = | GNU_long_call | CXX11_gnu_long_call | C2x_gnu_long_call | GNU_far | CXX11_gnu_far | C2x_gnu_far | SpellingNotCalculated [@@deriving refl] external ext_mips_long_call_get_spelling : cxcursor -> clang_ext_mipslongcall_spelling = "clang_ext_MipsLongCall_getSpelling_wrapper" type clang_ext_mipsshortcall_spelling = | GNU_short_call | CXX11_gnu_short_call | C2x_gnu_short_call | GNU_near | CXX11_gnu_near | C2x_gnu_near | SpellingNotCalculated [@@deriving refl] external ext_mips_short_call_get_spelling : cxcursor -> clang_ext_mipsshortcall_spelling = "clang_ext_MipsShortCall_getSpelling_wrapper" type clang_ext_mode_spelling = | GNU_mode | CXX11_gnu_mode | C2x_gnu_mode | SpellingNotCalculated [@@deriving refl] external ext_mode_get_spelling : cxcursor -> clang_ext_mode_spelling = "clang_ext_Mode_getSpelling_wrapper" type clang_ext_musttail_spelling = | GNU_musttail | CXX11_clang_musttail | C2x_clang_musttail | SpellingNotCalculated [@@deriving refl] external ext_must_tail_get_spelling : cxcursor -> clang_ext_musttail_spelling = "clang_ext_MustTail_getSpelling_wrapper" type clang_ext_nsconsumed_spelling = | GNU_ns_consumed | CXX11_clang_ns_consumed | C2x_clang_ns_consumed | SpellingNotCalculated [@@deriving refl] external ext_nsconsumed_get_spelling : cxcursor -> clang_ext_nsconsumed_spelling = "clang_ext_NSConsumed_getSpelling_wrapper" type clang_ext_nsconsumesself_spelling = | GNU_ns_consumes_self | CXX11_clang_ns_consumes_self | C2x_clang_ns_consumes_self | SpellingNotCalculated [@@deriving refl] external ext_nsconsumes_self_get_spelling : cxcursor -> clang_ext_nsconsumesself_spelling = "clang_ext_NSConsumesSelf_getSpelling_wrapper" type clang_ext_nsreturnsautoreleased_spelling = | GNU_ns_returns_autoreleased | CXX11_clang_ns_returns_autoreleased | C2x_clang_ns_returns_autoreleased | SpellingNotCalculated [@@deriving refl] external ext_nsreturns_autoreleased_get_spelling : cxcursor -> clang_ext_nsreturnsautoreleased_spelling = "clang_ext_NSReturnsAutoreleased_getSpelling_wrapper" type clang_ext_nsreturnsnotretained_spelling = | GNU_ns_returns_not_retained | CXX11_clang_ns_returns_not_retained | C2x_clang_ns_returns_not_retained | SpellingNotCalculated [@@deriving refl] external ext_nsreturns_not_retained_get_spelling : cxcursor -> clang_ext_nsreturnsnotretained_spelling = "clang_ext_NSReturnsNotRetained_getSpelling_wrapper" type clang_ext_nsreturnsretained_spelling = | GNU_ns_returns_retained | CXX11_clang_ns_returns_retained | C2x_clang_ns_returns_retained | SpellingNotCalculated [@@deriving refl] external ext_nsreturns_retained_get_spelling : cxcursor -> clang_ext_nsreturnsretained_spelling = "clang_ext_NSReturnsRetained_getSpelling_wrapper" type clang_ext_naked_spelling = | GNU_naked | CXX11_gnu_naked | C2x_gnu_naked | Declspec_naked | SpellingNotCalculated [@@deriving refl] external ext_naked_get_spelling : cxcursor -> clang_ext_naked_spelling = "clang_ext_Naked_getSpelling_wrapper" type clang_ext_nobuiltin_spelling = | GNU_no_builtin | CXX11_clang_no_builtin | C2x_clang_no_builtin | SpellingNotCalculated [@@deriving refl] external ext_no_builtin_get_spelling : cxcursor -> clang_ext_nobuiltin_spelling = "clang_ext_NoBuiltin_getSpelling_wrapper" type clang_ext_nocommon_spelling = | GNU_nocommon | CXX11_gnu_nocommon | C2x_gnu_nocommon | SpellingNotCalculated [@@deriving refl] external ext_no_common_get_spelling : cxcursor -> clang_ext_nocommon_spelling = "clang_ext_NoCommon_getSpelling_wrapper" type clang_ext_nodebug_spelling = | GNU_nodebug | CXX11_gnu_nodebug | C2x_gnu_nodebug | SpellingNotCalculated [@@deriving refl] external ext_no_debug_get_spelling : cxcursor -> clang_ext_nodebug_spelling = "clang_ext_NoDebug_getSpelling_wrapper" type clang_ext_noderef_spelling = | GNU_noderef | CXX11_clang_noderef | C2x_clang_noderef | SpellingNotCalculated [@@deriving refl] external ext_no_deref_get_spelling : cxcursor -> clang_ext_noderef_spelling = "clang_ext_NoDeref_getSpelling_wrapper" type clang_ext_nodestroy_spelling = | GNU_no_destroy | CXX11_clang_no_destroy | SpellingNotCalculated [@@deriving refl] external ext_no_destroy_get_spelling : cxcursor -> clang_ext_nodestroy_spelling = "clang_ext_NoDestroy_getSpelling_wrapper" type clang_ext_noduplicate_spelling = | GNU_noduplicate | CXX11_clang_noduplicate | C2x_clang_noduplicate | SpellingNotCalculated [@@deriving refl] external ext_no_duplicate_get_spelling : cxcursor -> clang_ext_noduplicate_spelling = "clang_ext_NoDuplicate_getSpelling_wrapper" type clang_ext_noescape_spelling = | GNU_noescape | CXX11_clang_noescape | C2x_clang_noescape | SpellingNotCalculated [@@deriving refl] external ext_no_escape_get_spelling : cxcursor -> clang_ext_noescape_spelling = "clang_ext_NoEscape_getSpelling_wrapper" type clang_ext_noinline_spelling = | Keyword_noinline | GNU_noinline | CXX11_gnu_noinline | C2x_gnu_noinline | CXX11_clang_noinline | C2x_clang_noinline | Declspec_noinline | SpellingNotCalculated [@@deriving refl] external ext_no_inline_get_spelling : cxcursor -> clang_ext_noinline_spelling = "clang_ext_NoInline_getSpelling_wrapper" type clang_ext_noinstrumentfunction_spelling = | GNU_no_instrument_function | CXX11_gnu_no_instrument_function | C2x_gnu_no_instrument_function | SpellingNotCalculated [@@deriving refl] external ext_no_instrument_function_get_spelling : cxcursor -> clang_ext_noinstrumentfunction_spelling = "clang_ext_NoInstrumentFunction_getSpelling_wrapper" type clang_ext_nomerge_spelling = | GNU_nomerge | CXX11_clang_nomerge | C2x_clang_nomerge | SpellingNotCalculated [@@deriving refl] external ext_no_merge_get_spelling : cxcursor -> clang_ext_nomerge_spelling = "clang_ext_NoMerge_getSpelling_wrapper" type clang_ext_nomicromips_spelling = | GNU_nomicromips | CXX11_gnu_nomicromips | C2x_gnu_nomicromips | SpellingNotCalculated [@@deriving refl] external ext_no_micro_mips_get_spelling : cxcursor -> clang_ext_nomicromips_spelling = "clang_ext_NoMicroMips_getSpelling_wrapper" type clang_ext_nomips16_spelling = | GNU_nomips16 | CXX11_gnu_nomips16 | C2x_gnu_nomips16 | SpellingNotCalculated [@@deriving refl] external ext_no_mips16_get_spelling : cxcursor -> clang_ext_nomips16_spelling = "clang_ext_NoMips16_getSpelling_wrapper" type clang_ext_noprofilefunction_spelling = | GNU_no_profile_instrument_function | CXX11_gnu_no_profile_instrument_function | C2x_gnu_no_profile_instrument_function | SpellingNotCalculated [@@deriving refl] external ext_no_profile_function_get_spelling : cxcursor -> clang_ext_noprofilefunction_spelling = "clang_ext_NoProfileFunction_getSpelling_wrapper" type clang_ext_norandomizelayout_spelling = | GNU_no_randomize_layout | CXX11_gnu_no_randomize_layout | C2x_gnu_no_randomize_layout | SpellingNotCalculated [@@deriving refl] external ext_no_randomize_layout_get_spelling : cxcursor -> clang_ext_norandomizelayout_spelling = "clang_ext_NoRandomizeLayout_getSpelling_wrapper" type clang_ext_noreturn_spelling = | GNU_noreturn | CXX11_gnu_noreturn | C2x_gnu_noreturn | Declspec_noreturn | SpellingNotCalculated [@@deriving refl] external ext_no_return_get_spelling : cxcursor -> clang_ext_noreturn_spelling = "clang_ext_NoReturn_getSpelling_wrapper" type clang_ext_nosanitize_spelling = | GNU_no_sanitize | CXX11_clang_no_sanitize | C2x_clang_no_sanitize | SpellingNotCalculated [@@deriving refl] external ext_no_sanitize_get_spelling : cxcursor -> clang_ext_nosanitize_spelling = "clang_ext_NoSanitize_getSpelling_wrapper" type clang_ext_nospeculativeloadhardening_spelling = | GNU_no_speculative_load_hardening | CXX11_clang_no_speculative_load_hardening | C2x_clang_no_speculative_load_hardening | SpellingNotCalculated [@@deriving refl] external ext_no_speculative_load_hardening_get_spelling : cxcursor -> clang_ext_nospeculativeloadhardening_spelling = "clang_ext_NoSpeculativeLoadHardening_getSpelling_wrapper" type clang_ext_nosplitstack_spelling = | GNU_no_split_stack | CXX11_gnu_no_split_stack | C2x_gnu_no_split_stack | SpellingNotCalculated [@@deriving refl] external ext_no_split_stack_get_spelling : cxcursor -> clang_ext_nosplitstack_spelling = "clang_ext_NoSplitStack_getSpelling_wrapper" type clang_ext_nostackprotector_spelling = | GNU_no_stack_protector | CXX11_clang_no_stack_protector | C2x_clang_no_stack_protector | SpellingNotCalculated [@@deriving refl] external ext_no_stack_protector_get_spelling : cxcursor -> clang_ext_nostackprotector_spelling = "clang_ext_NoStackProtector_getSpelling_wrapper" type clang_ext_nothreadsafetyanalysis_spelling = | GNU_no_thread_safety_analysis | CXX11_clang_no_thread_safety_analysis | C2x_clang_no_thread_safety_analysis | SpellingNotCalculated [@@deriving refl] external ext_no_thread_safety_analysis_get_spelling : cxcursor -> clang_ext_nothreadsafetyanalysis_spelling = "clang_ext_NoThreadSafetyAnalysis_getSpelling_wrapper" type clang_ext_nothrow_spelling = | GNU_nothrow | CXX11_gnu_nothrow | C2x_gnu_nothrow | Declspec_nothrow | SpellingNotCalculated [@@deriving refl] external ext_no_throw_get_spelling : cxcursor -> clang_ext_nothrow_spelling = "clang_ext_NoThrow_getSpelling_wrapper" type clang_ext_nonnull_spelling = | GNU_nonnull | CXX11_gnu_nonnull | C2x_gnu_nonnull | SpellingNotCalculated [@@deriving refl] external ext_non_null_get_spelling : cxcursor -> clang_ext_nonnull_spelling = "clang_ext_NonNull_getSpelling_wrapper" type clang_ext_nottailcalled_spelling = | GNU_not_tail_called | CXX11_clang_not_tail_called | C2x_clang_not_tail_called | SpellingNotCalculated [@@deriving refl] external ext_not_tail_called_get_spelling : cxcursor -> clang_ext_nottailcalled_spelling = "clang_ext_NotTailCalled_getSpelling_wrapper" type clang_ext_osconsumed_spelling = | GNU_os_consumed | CXX11_clang_os_consumed | C2x_clang_os_consumed | SpellingNotCalculated [@@deriving refl] external ext_osconsumed_get_spelling : cxcursor -> clang_ext_osconsumed_spelling = "clang_ext_OSConsumed_getSpelling_wrapper" type clang_ext_osconsumesthis_spelling = | GNU_os_consumes_this | CXX11_clang_os_consumes_this | C2x_clang_os_consumes_this | SpellingNotCalculated [@@deriving refl] external ext_osconsumes_this_get_spelling : cxcursor -> clang_ext_osconsumesthis_spelling = "clang_ext_OSConsumesThis_getSpelling_wrapper" type clang_ext_osreturnsnotretained_spelling = | GNU_os_returns_not_retained | CXX11_clang_os_returns_not_retained | C2x_clang_os_returns_not_retained | SpellingNotCalculated [@@deriving refl] external ext_osreturns_not_retained_get_spelling : cxcursor -> clang_ext_osreturnsnotretained_spelling = "clang_ext_OSReturnsNotRetained_getSpelling_wrapper" type clang_ext_osreturnsretained_spelling = | GNU_os_returns_retained | CXX11_clang_os_returns_retained | C2x_clang_os_returns_retained | SpellingNotCalculated [@@deriving refl] external ext_osreturns_retained_get_spelling : cxcursor -> clang_ext_osreturnsretained_spelling = "clang_ext_OSReturnsRetained_getSpelling_wrapper" type clang_ext_osreturnsretainedonnonzero_spelling = | GNU_os_returns_retained_on_non_zero | CXX11_clang_os_returns_retained_on_non_zero | C2x_clang_os_returns_retained_on_non_zero | SpellingNotCalculated [@@deriving refl] external ext_osreturns_retained_on_non_zero_get_spelling : cxcursor -> clang_ext_osreturnsretainedonnonzero_spelling = "clang_ext_OSReturnsRetainedOnNonZero_getSpelling_wrapper" type clang_ext_osreturnsretainedonzero_spelling = | GNU_os_returns_retained_on_zero | CXX11_clang_os_returns_retained_on_zero | C2x_clang_os_returns_retained_on_zero | SpellingNotCalculated [@@deriving refl] external ext_osreturns_retained_on_zero_get_spelling : cxcursor -> clang_ext_osreturnsretainedonzero_spelling = "clang_ext_OSReturnsRetainedOnZero_getSpelling_wrapper" type clang_ext_objcboxable_spelling = | GNU_objc_boxable | CXX11_clang_objc_boxable | C2x_clang_objc_boxable | SpellingNotCalculated [@@deriving refl] external ext_obj_cboxable_get_spelling : cxcursor -> clang_ext_objcboxable_spelling = "clang_ext_ObjCBoxable_getSpelling_wrapper" type clang_ext_objcbridge_spelling = | GNU_objc_bridge | CXX11_clang_objc_bridge | C2x_clang_objc_bridge | SpellingNotCalculated [@@deriving refl] external ext_obj_cbridge_get_spelling : cxcursor -> clang_ext_objcbridge_spelling = "clang_ext_ObjCBridge_getSpelling_wrapper" type clang_ext_objcbridgemutable_spelling = | GNU_objc_bridge_mutable | CXX11_clang_objc_bridge_mutable | C2x_clang_objc_bridge_mutable | SpellingNotCalculated [@@deriving refl] external ext_obj_cbridge_mutable_get_spelling : cxcursor -> clang_ext_objcbridgemutable_spelling = "clang_ext_ObjCBridgeMutable_getSpelling_wrapper" type clang_ext_objcbridgerelated_spelling = | GNU_objc_bridge_related | CXX11_clang_objc_bridge_related | C2x_clang_objc_bridge_related | SpellingNotCalculated [@@deriving refl] external ext_obj_cbridge_related_get_spelling : cxcursor -> clang_ext_objcbridgerelated_spelling = "clang_ext_ObjCBridgeRelated_getSpelling_wrapper" type clang_ext_objcclassstub_spelling = | GNU_objc_class_stub | CXX11_clang_objc_class_stub | C2x_clang_objc_class_stub | SpellingNotCalculated [@@deriving refl] external ext_obj_cclass_stub_get_spelling : cxcursor -> clang_ext_objcclassstub_spelling = "clang_ext_ObjCClassStub_getSpelling_wrapper" type clang_ext_objcdesignatedinitializer_spelling = | GNU_objc_designated_initializer | CXX11_clang_objc_designated_initializer | C2x_clang_objc_designated_initializer | SpellingNotCalculated [@@deriving refl] external ext_obj_cdesignated_initializer_get_spelling : cxcursor -> clang_ext_objcdesignatedinitializer_spelling = "clang_ext_ObjCDesignatedInitializer_getSpelling_wrapper" type clang_ext_objcdirect_spelling = | GNU_objc_direct | CXX11_clang_objc_direct | C2x_clang_objc_direct | SpellingNotCalculated [@@deriving refl] external ext_obj_cdirect_get_spelling : cxcursor -> clang_ext_objcdirect_spelling = "clang_ext_ObjCDirect_getSpelling_wrapper" type clang_ext_objcdirectmembers_spelling = | GNU_objc_direct_members | CXX11_clang_objc_direct_members | C2x_clang_objc_direct_members | SpellingNotCalculated [@@deriving refl] external ext_obj_cdirect_members_get_spelling : cxcursor -> clang_ext_objcdirectmembers_spelling = "clang_ext_ObjCDirectMembers_getSpelling_wrapper" type clang_ext_objcexception_spelling = | GNU_objc_exception | CXX11_clang_objc_exception | C2x_clang_objc_exception | SpellingNotCalculated [@@deriving refl] external ext_obj_cexception_get_spelling : cxcursor -> clang_ext_objcexception_spelling = "clang_ext_ObjCException_getSpelling_wrapper" type clang_ext_objcexplicitprotocolimpl_spelling = | GNU_objc_protocol_requires_explicit_implementation | CXX11_clang_objc_protocol_requires_explicit_implementation | C2x_clang_objc_protocol_requires_explicit_implementation | SpellingNotCalculated [@@deriving refl] external ext_obj_cexplicit_protocol_impl_get_spelling : cxcursor -> clang_ext_objcexplicitprotocolimpl_spelling = "clang_ext_ObjCExplicitProtocolImpl_getSpelling_wrapper" type clang_ext_objcexternallyretained_spelling = | GNU_objc_externally_retained | CXX11_clang_objc_externally_retained | C2x_clang_objc_externally_retained | SpellingNotCalculated [@@deriving refl] external ext_obj_cexternally_retained_get_spelling : cxcursor -> clang_ext_objcexternallyretained_spelling = "clang_ext_ObjCExternallyRetained_getSpelling_wrapper" type clang_ext_objcgc_spelling = | GNU_objc_gc | CXX11_clang_objc_gc | C2x_clang_objc_gc | SpellingNotCalculated [@@deriving refl] external ext_obj_cgc_get_spelling : cxcursor -> clang_ext_objcgc_spelling = "clang_ext_ObjCGC_getSpelling_wrapper" type clang_ext_objcindependentclass_spelling = | GNU_objc_independent_class | CXX11_clang_objc_independent_class | C2x_clang_objc_independent_class | SpellingNotCalculated [@@deriving refl] external ext_obj_cindependent_class_get_spelling : cxcursor -> clang_ext_objcindependentclass_spelling = "clang_ext_ObjCIndependentClass_getSpelling_wrapper" type clang_ext_objcmethodfamily_spelling = | GNU_objc_method_family | CXX11_clang_objc_method_family | C2x_clang_objc_method_family | SpellingNotCalculated [@@deriving refl] external ext_obj_cmethod_family_get_spelling : cxcursor -> clang_ext_objcmethodfamily_spelling = "clang_ext_ObjCMethodFamily_getSpelling_wrapper" type clang_ext_objcnsobject_spelling = | GNU_NSObject | CXX11_clang_NSObject | C2x_clang_NSObject | SpellingNotCalculated [@@deriving refl] external ext_obj_cnsobject_get_spelling : cxcursor -> clang_ext_objcnsobject_spelling = "clang_ext_ObjCNSObject_getSpelling_wrapper" type clang_ext_objcnonlazyclass_spelling = | GNU_objc_nonlazy_class | CXX11_clang_objc_nonlazy_class | C2x_clang_objc_nonlazy_class | SpellingNotCalculated [@@deriving refl] external ext_obj_cnon_lazy_class_get_spelling : cxcursor -> clang_ext_objcnonlazyclass_spelling = "clang_ext_ObjCNonLazyClass_getSpelling_wrapper" type clang_ext_objcnonruntimeprotocol_spelling = | GNU_objc_non_runtime_protocol | CXX11_clang_objc_non_runtime_protocol | C2x_clang_objc_non_runtime_protocol | SpellingNotCalculated [@@deriving refl] external ext_obj_cnon_runtime_protocol_get_spelling : cxcursor -> clang_ext_objcnonruntimeprotocol_spelling = "clang_ext_ObjCNonRuntimeProtocol_getSpelling_wrapper" type clang_ext_objcownership_spelling = | GNU_objc_ownership | CXX11_clang_objc_ownership | C2x_clang_objc_ownership | SpellingNotCalculated [@@deriving refl] external ext_obj_cownership_get_spelling : cxcursor -> clang_ext_objcownership_spelling = "clang_ext_ObjCOwnership_getSpelling_wrapper" type clang_ext_objcpreciselifetime_spelling = | GNU_objc_precise_lifetime | CXX11_clang_objc_precise_lifetime | C2x_clang_objc_precise_lifetime | SpellingNotCalculated [@@deriving refl] external ext_obj_cprecise_lifetime_get_spelling : cxcursor -> clang_ext_objcpreciselifetime_spelling = "clang_ext_ObjCPreciseLifetime_getSpelling_wrapper" type clang_ext_objcrequirespropertydefs_spelling = | GNU_objc_requires_property_definitions | CXX11_clang_objc_requires_property_definitions | C2x_clang_objc_requires_property_definitions | SpellingNotCalculated [@@deriving refl] external ext_obj_crequires_property_defs_get_spelling : cxcursor -> clang_ext_objcrequirespropertydefs_spelling = "clang_ext_ObjCRequiresPropertyDefs_getSpelling_wrapper" type clang_ext_objcrequiressuper_spelling = | GNU_objc_requires_super | CXX11_clang_objc_requires_super | C2x_clang_objc_requires_super | SpellingNotCalculated [@@deriving refl] external ext_obj_crequires_super_get_spelling : cxcursor -> clang_ext_objcrequiressuper_spelling = "clang_ext_ObjCRequiresSuper_getSpelling_wrapper" type clang_ext_objcreturnsinnerpointer_spelling = | GNU_objc_returns_inner_pointer | CXX11_clang_objc_returns_inner_pointer | C2x_clang_objc_returns_inner_pointer | SpellingNotCalculated [@@deriving refl] external ext_obj_creturns_inner_pointer_get_spelling : cxcursor -> clang_ext_objcreturnsinnerpointer_spelling = "clang_ext_ObjCReturnsInnerPointer_getSpelling_wrapper" type clang_ext_objcrootclass_spelling = | GNU_objc_root_class | CXX11_clang_objc_root_class | C2x_clang_objc_root_class | SpellingNotCalculated [@@deriving refl] external ext_obj_croot_class_get_spelling : cxcursor -> clang_ext_objcrootclass_spelling = "clang_ext_ObjCRootClass_getSpelling_wrapper" type clang_ext_objcruntimename_spelling = | GNU_objc_runtime_name | CXX11_clang_objc_runtime_name | C2x_clang_objc_runtime_name | SpellingNotCalculated [@@deriving refl] external ext_obj_cruntime_name_get_spelling : cxcursor -> clang_ext_objcruntimename_spelling = "clang_ext_ObjCRuntimeName_getSpelling_wrapper" type clang_ext_objcruntimevisible_spelling = | GNU_objc_runtime_visible | CXX11_clang_objc_runtime_visible | C2x_clang_objc_runtime_visible | SpellingNotCalculated [@@deriving refl] external ext_obj_cruntime_visible_get_spelling : cxcursor -> clang_ext_objcruntimevisible_spelling = "clang_ext_ObjCRuntimeVisible_getSpelling_wrapper" type clang_ext_objcsubclassingrestricted_spelling = | GNU_objc_subclassing_restricted | CXX11_clang_objc_subclassing_restricted | C2x_clang_objc_subclassing_restricted | SpellingNotCalculated [@@deriving refl] external ext_obj_csubclassing_restricted_get_spelling : cxcursor -> clang_ext_objcsubclassingrestricted_spelling = "clang_ext_ObjCSubclassingRestricted_getSpelling_wrapper" type clang_ext_openclaccess_spelling = | Keyword_read_only | Keyword_write_only | Keyword_read_write | SpellingNotCalculated [@@deriving refl] external ext_open_claccess_get_spelling : cxcursor -> clang_ext_openclaccess_spelling = "clang_ext_OpenCLAccess_getSpelling_wrapper" type clang_ext_openclconstantaddressspace_spelling = | Keyword_constant | GNU_opencl_constant | CXX11_clang_opencl_constant | C2x_clang_opencl_constant | SpellingNotCalculated [@@deriving refl] external ext_open_clconstant_address_space_get_spelling : cxcursor -> clang_ext_openclconstantaddressspace_spelling = "clang_ext_OpenCLConstantAddressSpace_getSpelling_wrapper" type clang_ext_openclgenericaddressspace_spelling = | Keyword_generic | GNU_opencl_generic | CXX11_clang_opencl_generic | C2x_clang_opencl_generic | SpellingNotCalculated [@@deriving refl] external ext_open_clgeneric_address_space_get_spelling : cxcursor -> clang_ext_openclgenericaddressspace_spelling = "clang_ext_OpenCLGenericAddressSpace_getSpelling_wrapper" type clang_ext_openclglobaladdressspace_spelling = | Keyword_global | GNU_opencl_global | CXX11_clang_opencl_global | C2x_clang_opencl_global | SpellingNotCalculated [@@deriving refl] external ext_open_clglobal_address_space_get_spelling : cxcursor -> clang_ext_openclglobaladdressspace_spelling = "clang_ext_OpenCLGlobalAddressSpace_getSpelling_wrapper" type clang_ext_openclglobaldeviceaddressspace_spelling = | GNU_opencl_global_device | CXX11_clang_opencl_global_device | C2x_clang_opencl_global_device | SpellingNotCalculated [@@deriving refl] external ext_open_clglobal_device_address_space_get_spelling : cxcursor -> clang_ext_openclglobaldeviceaddressspace_spelling = "clang_ext_OpenCLGlobalDeviceAddressSpace_getSpelling_wrapper" type clang_ext_openclglobalhostaddressspace_spelling = | GNU_opencl_global_host | CXX11_clang_opencl_global_host | C2x_clang_opencl_global_host | SpellingNotCalculated [@@deriving refl] external ext_open_clglobal_host_address_space_get_spelling : cxcursor -> clang_ext_openclglobalhostaddressspace_spelling = "clang_ext_OpenCLGlobalHostAddressSpace_getSpelling_wrapper" type clang_ext_openclkernel_spelling = | Keyword_kernel | SpellingNotCalculated [@@deriving refl] external ext_open_clkernel_get_spelling : cxcursor -> clang_ext_openclkernel_spelling = "clang_ext_OpenCLKernel_getSpelling_wrapper" type clang_ext_opencllocaladdressspace_spelling = | Keyword_local | GNU_opencl_local | CXX11_clang_opencl_local | C2x_clang_opencl_local | SpellingNotCalculated [@@deriving refl] external ext_open_cllocal_address_space_get_spelling : cxcursor -> clang_ext_opencllocaladdressspace_spelling = "clang_ext_OpenCLLocalAddressSpace_getSpelling_wrapper" type clang_ext_openclprivateaddressspace_spelling = | Keyword_private | GNU_opencl_private | CXX11_clang_opencl_private | C2x_clang_opencl_private | SpellingNotCalculated [@@deriving refl] external ext_open_clprivate_address_space_get_spelling : cxcursor -> clang_ext_openclprivateaddressspace_spelling = "clang_ext_OpenCLPrivateAddressSpace_getSpelling_wrapper" type clang_ext_optimizenone_spelling = | GNU_optnone | CXX11_clang_optnone | C2x_clang_optnone | SpellingNotCalculated [@@deriving refl] external ext_optimize_none_get_spelling : cxcursor -> clang_ext_optimizenone_spelling = "clang_ext_OptimizeNone_getSpelling_wrapper" type clang_ext_overloadable_spelling = | GNU_overloadable | CXX11_clang_overloadable | C2x_clang_overloadable | SpellingNotCalculated [@@deriving refl] external ext_overloadable_get_spelling : cxcursor -> clang_ext_overloadable_spelling = "clang_ext_Overloadable_getSpelling_wrapper" type clang_ext_ownership_spelling = | GNU_ownership_holds | CXX11_clang_ownership_holds | C2x_clang_ownership_holds | GNU_ownership_returns | CXX11_clang_ownership_returns | C2x_clang_ownership_returns | GNU_ownership_takes | CXX11_clang_ownership_takes | C2x_clang_ownership_takes | SpellingNotCalculated [@@deriving refl] external ext_ownership_get_spelling : cxcursor -> clang_ext_ownership_spelling = "clang_ext_Ownership_getSpelling_wrapper" type clang_ext_packed_spelling = | GNU_packed | CXX11_gnu_packed | C2x_gnu_packed | SpellingNotCalculated [@@deriving refl] external ext_packed_get_spelling : cxcursor -> clang_ext_packed_spelling = "clang_ext_Packed_getSpelling_wrapper" type clang_ext_paramtypestate_spelling = | GNU_param_typestate | CXX11_clang_param_typestate | SpellingNotCalculated [@@deriving refl] external ext_param_typestate_get_spelling : cxcursor -> clang_ext_paramtypestate_spelling = "clang_ext_ParamTypestate_getSpelling_wrapper" type clang_ext_pascal_spelling = | GNU_pascal | CXX11_clang_pascal | C2x_clang_pascal | Keyword_pascal | SpellingNotCalculated [@@deriving refl] external ext_pascal_get_spelling : cxcursor -> clang_ext_pascal_spelling = "clang_ext_Pascal_getSpelling_wrapper" type clang_ext_passobjectsize_spelling = | GNU_pass_object_size | CXX11_clang_pass_object_size | C2x_clang_pass_object_size | GNU_pass_dynamic_object_size | CXX11_clang_pass_dynamic_object_size | C2x_clang_pass_dynamic_object_size | SpellingNotCalculated [@@deriving refl] external ext_pass_object_size_get_spelling : cxcursor -> clang_ext_passobjectsize_spelling = "clang_ext_PassObjectSize_getSpelling_wrapper" type clang_ext_patchablefunctionentry_spelling = | GNU_patchable_function_entry | CXX11_gnu_patchable_function_entry | C2x_gnu_patchable_function_entry | SpellingNotCalculated [@@deriving refl] external ext_patchable_function_entry_get_spelling : cxcursor -> clang_ext_patchablefunctionentry_spelling = "clang_ext_PatchableFunctionEntry_getSpelling_wrapper" type clang_ext_pcs_spelling = | GNU_pcs | CXX11_gnu_pcs | C2x_gnu_pcs | SpellingNotCalculated [@@deriving refl] external ext_pcs_get_spelling : cxcursor -> clang_ext_pcs_spelling = "clang_ext_Pcs_getSpelling_wrapper" type clang_ext_preferredname_spelling = | GNU_preferred_name | CXX11_clang_preferred_name | SpellingNotCalculated [@@deriving refl] external ext_preferred_name_get_spelling : cxcursor -> clang_ext_preferredname_spelling = "clang_ext_PreferredName_getSpelling_wrapper" type clang_ext_preserveall_spelling = | GNU_preserve_all | CXX11_clang_preserve_all | C2x_clang_preserve_all | SpellingNotCalculated [@@deriving refl] external ext_preserve_all_get_spelling : cxcursor -> clang_ext_preserveall_spelling = "clang_ext_PreserveAll_getSpelling_wrapper" type clang_ext_preservemost_spelling = | GNU_preserve_most | CXX11_clang_preserve_most | C2x_clang_preserve_most | SpellingNotCalculated [@@deriving refl] external ext_preserve_most_get_spelling : cxcursor -> clang_ext_preservemost_spelling = "clang_ext_PreserveMost_getSpelling_wrapper" type clang_ext_ptguardedvar_spelling = | GNU_pt_guarded_var | CXX11_clang_pt_guarded_var | SpellingNotCalculated [@@deriving refl] external ext_pt_guarded_var_get_spelling : cxcursor -> clang_ext_ptguardedvar_spelling = "clang_ext_PtGuardedVar_getSpelling_wrapper" type clang_ext_pure_spelling = | GNU_pure | CXX11_gnu_pure | C2x_gnu_pure | SpellingNotCalculated [@@deriving refl] external ext_pure_get_spelling : cxcursor -> clang_ext_pure_spelling = "clang_ext_Pure_getSpelling_wrapper" type clang_ext_riscvinterrupt_spelling = | GNU_interrupt | CXX11_gnu_interrupt | C2x_gnu_interrupt | SpellingNotCalculated [@@deriving refl] external ext_riscvinterrupt_get_spelling : cxcursor -> clang_ext_riscvinterrupt_spelling = "clang_ext_RISCVInterrupt_getSpelling_wrapper" type clang_ext_randomizelayout_spelling = | GNU_randomize_layout | CXX11_gnu_randomize_layout | C2x_gnu_randomize_layout | SpellingNotCalculated [@@deriving refl] external ext_randomize_layout_get_spelling : cxcursor -> clang_ext_randomizelayout_spelling = "clang_ext_RandomizeLayout_getSpelling_wrapper" type clang_ext_regcall_spelling = | GNU_regcall | CXX11_gnu_regcall | C2x_gnu_regcall | Keyword_regcall | SpellingNotCalculated [@@deriving refl] external ext_reg_call_get_spelling : cxcursor -> clang_ext_regcall_spelling = "clang_ext_RegCall_getSpelling_wrapper" type clang_ext_reinitializes_spelling = | GNU_reinitializes | CXX11_clang_reinitializes | SpellingNotCalculated [@@deriving refl] external ext_reinitializes_get_spelling : cxcursor -> clang_ext_reinitializes_spelling = "clang_ext_Reinitializes_getSpelling_wrapper" type clang_ext_releasecapability_spelling = | GNU_release_capability | CXX11_clang_release_capability | GNU_release_shared_capability | CXX11_clang_release_shared_capability | GNU_release_generic_capability | CXX11_clang_release_generic_capability | GNU_unlock_function | CXX11_clang_unlock_function | SpellingNotCalculated [@@deriving refl] external ext_release_capability_get_spelling : cxcursor -> clang_ext_releasecapability_spelling = "clang_ext_ReleaseCapability_getSpelling_wrapper" type clang_ext_releasehandle_spelling = | GNU_release_handle | CXX11_clang_release_handle | C2x_clang_release_handle | SpellingNotCalculated [@@deriving refl] external ext_release_handle_get_spelling : cxcursor -> clang_ext_releasehandle_spelling = "clang_ext_ReleaseHandle_getSpelling_wrapper" type clang_ext_requirescapability_spelling = | GNU_requires_capability | CXX11_clang_requires_capability | GNU_exclusive_locks_required | CXX11_clang_exclusive_locks_required | GNU_requires_shared_capability | CXX11_clang_requires_shared_capability | GNU_shared_locks_required | CXX11_clang_shared_locks_required | SpellingNotCalculated [@@deriving refl] external ext_requires_capability_get_spelling : cxcursor -> clang_ext_requirescapability_spelling = "clang_ext_RequiresCapability_getSpelling_wrapper" type clang_ext_restrict_spelling = | Declspec_restrict | GNU_malloc | CXX11_gnu_malloc | C2x_gnu_malloc | SpellingNotCalculated [@@deriving refl] external ext_restrict_get_spelling : cxcursor -> clang_ext_restrict_spelling = "clang_ext_Restrict_getSpelling_wrapper" type clang_ext_retain_spelling = | GNU_retain | CXX11_gnu_retain | C2x_gnu_retain | SpellingNotCalculated [@@deriving refl] external ext_retain_get_spelling : cxcursor -> clang_ext_retain_spelling = "clang_ext_Retain_getSpelling_wrapper" type clang_ext_returntypestate_spelling = | GNU_return_typestate | CXX11_clang_return_typestate | SpellingNotCalculated [@@deriving refl] external ext_return_typestate_get_spelling : cxcursor -> clang_ext_returntypestate_spelling = "clang_ext_ReturnTypestate_getSpelling_wrapper" type clang_ext_returnsnonnull_spelling = | GNU_returns_nonnull | CXX11_gnu_returns_nonnull | C2x_gnu_returns_nonnull | SpellingNotCalculated [@@deriving refl] external ext_returns_non_null_get_spelling : cxcursor -> clang_ext_returnsnonnull_spelling = "clang_ext_ReturnsNonNull_getSpelling_wrapper" type clang_ext_returnstwice_spelling = | GNU_returns_twice | CXX11_gnu_returns_twice | C2x_gnu_returns_twice | SpellingNotCalculated [@@deriving refl] external ext_returns_twice_get_spelling : cxcursor -> clang_ext_returnstwice_spelling = "clang_ext_ReturnsTwice_getSpelling_wrapper" type clang_ext_syclkernel_spelling = | GNU_sycl_kernel | CXX11_clang_sycl_kernel | C2x_clang_sycl_kernel | SpellingNotCalculated [@@deriving refl] external ext_syclkernel_get_spelling : cxcursor -> clang_ext_syclkernel_spelling = "clang_ext_SYCLKernel_getSpelling_wrapper" type clang_ext_syclspecialclass_spelling = | GNU_sycl_special_class | CXX11_clang_sycl_special_class | C2x_clang_sycl_special_class | SpellingNotCalculated [@@deriving refl] external ext_syclspecial_class_get_spelling : cxcursor -> clang_ext_syclspecialclass_spelling = "clang_ext_SYCLSpecialClass_getSpelling_wrapper" type clang_ext_scopedlockable_spelling = | GNU_scoped_lockable | CXX11_clang_scoped_lockable | SpellingNotCalculated [@@deriving refl] external ext_scoped_lockable_get_spelling : cxcursor -> clang_ext_scopedlockable_spelling = "clang_ext_ScopedLockable_getSpelling_wrapper" type clang_ext_section_spelling = | GNU_section | CXX11_gnu_section | C2x_gnu_section | Declspec_allocate | SpellingNotCalculated [@@deriving refl] external ext_section_get_spelling : cxcursor -> clang_ext_section_spelling = "clang_ext_Section_getSpelling_wrapper" type clang_ext_selectany_spelling = | Declspec_selectany | GNU_selectany | CXX11_gnu_selectany | C2x_gnu_selectany | SpellingNotCalculated [@@deriving refl] external ext_select_any_get_spelling : cxcursor -> clang_ext_selectany_spelling = "clang_ext_SelectAny_getSpelling_wrapper" type clang_ext_sentinel_spelling = | GNU_sentinel | CXX11_gnu_sentinel | C2x_gnu_sentinel | SpellingNotCalculated [@@deriving refl] external ext_sentinel_get_spelling : cxcursor -> clang_ext_sentinel_spelling = "clang_ext_Sentinel_getSpelling_wrapper" type clang_ext_settypestate_spelling = | GNU_set_typestate | CXX11_clang_set_typestate | SpellingNotCalculated [@@deriving refl] external ext_set_typestate_get_spelling : cxcursor -> clang_ext_settypestate_spelling = "clang_ext_SetTypestate_getSpelling_wrapper" type clang_ext_speculativeloadhardening_spelling = | GNU_speculative_load_hardening | CXX11_clang_speculative_load_hardening | C2x_clang_speculative_load_hardening | SpellingNotCalculated [@@deriving refl] external ext_speculative_load_hardening_get_spelling : cxcursor -> clang_ext_speculativeloadhardening_spelling = "clang_ext_SpeculativeLoadHardening_getSpelling_wrapper" type clang_ext_standalonedebug_spelling = | GNU_standalone_debug | CXX11_clang_standalone_debug | SpellingNotCalculated [@@deriving refl] external ext_standalone_debug_get_spelling : cxcursor -> clang_ext_standalonedebug_spelling = "clang_ext_StandaloneDebug_getSpelling_wrapper" type clang_ext_stdcall_spelling = | GNU_stdcall | CXX11_gnu_stdcall | C2x_gnu_stdcall | Keyword_stdcall | SpellingNotCalculated [@@deriving refl] external ext_std_call_get_spelling : cxcursor -> clang_ext_stdcall_spelling = "clang_ext_StdCall_getSpelling_wrapper" type clang_ext_swiftasync_spelling = | GNU_swift_async | CXX11_clang_swift_async | C2x_clang_swift_async | SpellingNotCalculated [@@deriving refl] external ext_swift_async_get_spelling : cxcursor -> clang_ext_swiftasync_spelling = "clang_ext_SwiftAsync_getSpelling_wrapper" type clang_ext_swiftasynccall_spelling = | GNU_swiftasynccall | CXX11_clang_swiftasynccall | C2x_clang_swiftasynccall | SpellingNotCalculated [@@deriving refl] external ext_swift_async_call_get_spelling : cxcursor -> clang_ext_swiftasynccall_spelling = "clang_ext_SwiftAsyncCall_getSpelling_wrapper" type clang_ext_swiftasynccontext_spelling = | GNU_swift_async_context | CXX11_clang_swift_async_context | C2x_clang_swift_async_context | SpellingNotCalculated [@@deriving refl] external ext_swift_async_context_get_spelling : cxcursor -> clang_ext_swiftasynccontext_spelling = "clang_ext_SwiftAsyncContext_getSpelling_wrapper" type clang_ext_swiftasyncerror_spelling = | GNU_swift_async_error | CXX11_clang_swift_async_error | C2x_clang_swift_async_error | SpellingNotCalculated [@@deriving refl] external ext_swift_async_error_get_spelling : cxcursor -> clang_ext_swiftasyncerror_spelling = "clang_ext_SwiftAsyncError_getSpelling_wrapper" type clang_ext_swiftcall_spelling = | GNU_swiftcall | CXX11_clang_swiftcall | C2x_clang_swiftcall | SpellingNotCalculated [@@deriving refl] external ext_swift_call_get_spelling : cxcursor -> clang_ext_swiftcall_spelling = "clang_ext_SwiftCall_getSpelling_wrapper" type clang_ext_swiftcontext_spelling = | GNU_swift_context | CXX11_clang_swift_context | C2x_clang_swift_context | SpellingNotCalculated [@@deriving refl] external ext_swift_context_get_spelling : cxcursor -> clang_ext_swiftcontext_spelling = "clang_ext_SwiftContext_getSpelling_wrapper" type clang_ext_swifterrorresult_spelling = | GNU_swift_error_result | CXX11_clang_swift_error_result | C2x_clang_swift_error_result | SpellingNotCalculated [@@deriving refl] external ext_swift_error_result_get_spelling : cxcursor -> clang_ext_swifterrorresult_spelling = "clang_ext_SwiftErrorResult_getSpelling_wrapper" type clang_ext_swiftindirectresult_spelling = | GNU_swift_indirect_result | CXX11_clang_swift_indirect_result | C2x_clang_swift_indirect_result | SpellingNotCalculated [@@deriving refl] external ext_swift_indirect_result_get_spelling : cxcursor -> clang_ext_swiftindirectresult_spelling = "clang_ext_SwiftIndirectResult_getSpelling_wrapper" type clang_ext_swiftnewtype_spelling = | GNU_swift_newtype | GNU_swift_wrapper | SpellingNotCalculated [@@deriving refl] external ext_swift_new_type_get_spelling : cxcursor -> clang_ext_swiftnewtype_spelling = "clang_ext_SwiftNewType_getSpelling_wrapper" type clang_ext_sysvabi_spelling = | GNU_sysv_abi | CXX11_gnu_sysv_abi | C2x_gnu_sysv_abi | SpellingNotCalculated [@@deriving refl] external ext_sys_vabi_get_spelling : cxcursor -> clang_ext_sysvabi_spelling = "clang_ext_SysVABI_getSpelling_wrapper" type clang_ext_tlsmodel_spelling = | GNU_tls_model | CXX11_gnu_tls_model | C2x_gnu_tls_model | SpellingNotCalculated [@@deriving refl] external ext_tlsmodel_get_spelling : cxcursor -> clang_ext_tlsmodel_spelling = "clang_ext_TLSModel_getSpelling_wrapper" type clang_ext_target_spelling = | GNU_target | CXX11_gnu_target | C2x_gnu_target | SpellingNotCalculated [@@deriving refl] external ext_target_get_spelling : cxcursor -> clang_ext_target_spelling = "clang_ext_Target_getSpelling_wrapper" type clang_ext_targetclones_spelling = | GNU_target_clones | CXX11_gnu_target_clones | C2x_gnu_target_clones | SpellingNotCalculated [@@deriving refl] external ext_target_clones_get_spelling : cxcursor -> clang_ext_targetclones_spelling = "clang_ext_TargetClones_getSpelling_wrapper" type clang_ext_testtypestate_spelling = | GNU_test_typestate | CXX11_clang_test_typestate | SpellingNotCalculated [@@deriving refl] external ext_test_typestate_get_spelling : cxcursor -> clang_ext_testtypestate_spelling = "clang_ext_TestTypestate_getSpelling_wrapper" type clang_ext_thiscall_spelling = | GNU_thiscall | CXX11_gnu_thiscall | C2x_gnu_thiscall | Keyword_thiscall | SpellingNotCalculated [@@deriving refl] external ext_this_call_get_spelling : cxcursor -> clang_ext_thiscall_spelling = "clang_ext_ThisCall_getSpelling_wrapper" type clang_ext_transparentunion_spelling = | GNU_transparent_union | CXX11_gnu_transparent_union | C2x_gnu_transparent_union | SpellingNotCalculated [@@deriving refl] external ext_transparent_union_get_spelling : cxcursor -> clang_ext_transparentunion_spelling = "clang_ext_TransparentUnion_getSpelling_wrapper" type clang_ext_trivialabi_spelling = | GNU_trivial_abi | CXX11_clang_trivial_abi | SpellingNotCalculated [@@deriving refl] external ext_trivial_abi_get_spelling : cxcursor -> clang_ext_trivialabi_spelling = "clang_ext_TrivialABI_getSpelling_wrapper" type clang_ext_tryacquirecapability_spelling = | GNU_try_acquire_capability | CXX11_clang_try_acquire_capability | GNU_try_acquire_shared_capability | CXX11_clang_try_acquire_shared_capability | SpellingNotCalculated [@@deriving refl] external ext_try_acquire_capability_get_spelling : cxcursor -> clang_ext_tryacquirecapability_spelling = "clang_ext_TryAcquireCapability_getSpelling_wrapper" type clang_ext_typetagfordatatype_spelling = | GNU_type_tag_for_datatype | CXX11_clang_type_tag_for_datatype | C2x_clang_type_tag_for_datatype | SpellingNotCalculated [@@deriving refl] external ext_type_tag_for_datatype_get_spelling : cxcursor -> clang_ext_typetagfordatatype_spelling = "clang_ext_TypeTagForDatatype_getSpelling_wrapper" type clang_ext_typevisibility_spelling = | GNU_type_visibility | CXX11_clang_type_visibility | C2x_clang_type_visibility | SpellingNotCalculated [@@deriving refl] external ext_type_visibility_get_spelling : cxcursor -> clang_ext_typevisibility_spelling = "clang_ext_TypeVisibility_getSpelling_wrapper" type clang_ext_unavailable_spelling = | GNU_unavailable | CXX11_clang_unavailable | C2x_clang_unavailable | SpellingNotCalculated [@@deriving refl] external ext_unavailable_get_spelling : cxcursor -> clang_ext_unavailable_spelling = "clang_ext_Unavailable_getSpelling_wrapper" type clang_ext_uninitialized_spelling = | GNU_uninitialized | CXX11_clang_uninitialized | SpellingNotCalculated [@@deriving refl] external ext_uninitialized_get_spelling : cxcursor -> clang_ext_uninitialized_spelling = "clang_ext_Uninitialized_getSpelling_wrapper" type clang_ext_unlikely_spelling = | CXX11_unlikely | C2x_clang_unlikely | SpellingNotCalculated [@@deriving refl] external ext_unlikely_get_spelling : cxcursor -> clang_ext_unlikely_spelling = "clang_ext_Unlikely_getSpelling_wrapper" type clang_ext_unused_spelling = | CXX11_maybe_unused | GNU_unused | CXX11_gnu_unused | C2x_gnu_unused | C2x_maybe_unused | SpellingNotCalculated [@@deriving refl] external ext_unused_get_spelling : cxcursor -> clang_ext_unused_spelling = "clang_ext_Unused_getSpelling_wrapper" type clang_ext_usehandle_spelling = | GNU_use_handle | CXX11_clang_use_handle | C2x_clang_use_handle | SpellingNotCalculated [@@deriving refl] external ext_use_handle_get_spelling : cxcursor -> clang_ext_usehandle_spelling = "clang_ext_UseHandle_getSpelling_wrapper" type clang_ext_used_spelling = | GNU_used | CXX11_gnu_used | C2x_gnu_used | SpellingNotCalculated [@@deriving refl] external ext_used_get_spelling : cxcursor -> clang_ext_used_spelling = "clang_ext_Used_getSpelling_wrapper" type clang_ext_usingifexists_spelling = | GNU_using_if_exists | CXX11_clang_using_if_exists | SpellingNotCalculated [@@deriving refl] external ext_using_if_exists_get_spelling : cxcursor -> clang_ext_usingifexists_spelling = "clang_ext_UsingIfExists_getSpelling_wrapper" type clang_ext_uuid_spelling = | Declspec_uuid | Microsoft_uuid | SpellingNotCalculated [@@deriving refl] external ext_uuid_get_spelling : cxcursor -> clang_ext_uuid_spelling = "clang_ext_Uuid_getSpelling_wrapper" type clang_ext_vecreturn_spelling = | GNU_vecreturn | CXX11_clang_vecreturn | SpellingNotCalculated [@@deriving refl] external ext_vec_return_get_spelling : cxcursor -> clang_ext_vecreturn_spelling = "clang_ext_VecReturn_getSpelling_wrapper" type clang_ext_vectorcall_spelling = | GNU_vectorcall | CXX11_clang_vectorcall | C2x_clang_vectorcall | Keyword_vectorcall | SpellingNotCalculated [@@deriving refl] external ext_vector_call_get_spelling : cxcursor -> clang_ext_vectorcall_spelling = "clang_ext_VectorCall_getSpelling_wrapper" type clang_ext_visibility_spelling = | GNU_visibility | CXX11_gnu_visibility | C2x_gnu_visibility | SpellingNotCalculated [@@deriving refl] external ext_visibility_get_spelling : cxcursor -> clang_ext_visibility_spelling = "clang_ext_Visibility_getSpelling_wrapper" type clang_ext_warnunused_spelling = | GNU_warn_unused | CXX11_gnu_warn_unused | C2x_gnu_warn_unused | SpellingNotCalculated [@@deriving refl] external ext_warn_unused_get_spelling : cxcursor -> clang_ext_warnunused_spelling = "clang_ext_WarnUnused_getSpelling_wrapper" type clang_ext_warnunusedresult_spelling = | CXX11_nodiscard | C2x_nodiscard | CXX11_clang_warn_unused_result | GNU_warn_unused_result | CXX11_gnu_warn_unused_result | C2x_gnu_warn_unused_result | SpellingNotCalculated [@@deriving refl] external ext_warn_unused_result_get_spelling : cxcursor -> clang_ext_warnunusedresult_spelling = "clang_ext_WarnUnusedResult_getSpelling_wrapper" type clang_ext_weak_spelling = | GNU_weak | CXX11_gnu_weak | C2x_gnu_weak | SpellingNotCalculated [@@deriving refl] external ext_weak_get_spelling : cxcursor -> clang_ext_weak_spelling = "clang_ext_Weak_getSpelling_wrapper" type clang_ext_weakimport_spelling = | GNU_weak_import | CXX11_clang_weak_import | C2x_clang_weak_import | SpellingNotCalculated [@@deriving refl] external ext_weak_import_get_spelling : cxcursor -> clang_ext_weakimport_spelling = "clang_ext_WeakImport_getSpelling_wrapper" type clang_ext_weakref_spelling = | GNU_weakref | CXX11_gnu_weakref | C2x_gnu_weakref | SpellingNotCalculated [@@deriving refl] external ext_weak_ref_get_spelling : cxcursor -> clang_ext_weakref_spelling = "clang_ext_WeakRef_getSpelling_wrapper" type clang_ext_webassemblyexportname_spelling = | GNU_export_name | CXX11_clang_export_name | C2x_clang_export_name | SpellingNotCalculated [@@deriving refl] external ext_web_assembly_export_name_get_spelling : cxcursor -> clang_ext_webassemblyexportname_spelling = "clang_ext_WebAssemblyExportName_getSpelling_wrapper" type clang_ext_webassemblyimportmodule_spelling = | GNU_import_module | CXX11_clang_import_module | C2x_clang_import_module | SpellingNotCalculated [@@deriving refl] external ext_web_assembly_import_module_get_spelling : cxcursor -> clang_ext_webassemblyimportmodule_spelling = "clang_ext_WebAssemblyImportModule_getSpelling_wrapper" type clang_ext_webassemblyimportname_spelling = | GNU_import_name | CXX11_clang_import_name | C2x_clang_import_name | SpellingNotCalculated [@@deriving refl] external ext_web_assembly_import_name_get_spelling : cxcursor -> clang_ext_webassemblyimportname_spelling = "clang_ext_WebAssemblyImportName_getSpelling_wrapper" type clang_ext_x86forcealignargpointer_spelling = | GNU_force_align_arg_pointer | CXX11_gnu_force_align_arg_pointer | C2x_gnu_force_align_arg_pointer | SpellingNotCalculated [@@deriving refl] external ext_x86_force_align_arg_pointer_get_spelling : cxcursor -> clang_ext_x86forcealignargpointer_spelling = "clang_ext_X86ForceAlignArgPointer_getSpelling_wrapper" type clang_ext_xrayinstrument_spelling = | GNU_xray_always_instrument | CXX11_clang_xray_always_instrument | C2x_clang_xray_always_instrument | GNU_xray_never_instrument | CXX11_clang_xray_never_instrument | C2x_clang_xray_never_instrument | SpellingNotCalculated [@@deriving refl] external ext_xray_instrument_get_spelling : cxcursor -> clang_ext_xrayinstrument_spelling = "clang_ext_XRayInstrument_getSpelling_wrapper" type clang_ext_xraylogargs_spelling = | GNU_xray_log_args | CXX11_clang_xray_log_args | C2x_clang_xray_log_args | SpellingNotCalculated [@@deriving refl] external ext_xray_log_args_get_spelling : cxcursor -> clang_ext_xraylogargs_spelling = "clang_ext_XRayLogArgs_getSpelling_wrapper" type clang_ext_zerocallusedregs_spelling = | GNU_zero_call_used_regs | CXX11_gnu_zero_call_used_regs | C2x_gnu_zero_call_used_regs | SpellingNotCalculated [@@deriving refl] external ext_zero_call_used_regs_get_spelling : cxcursor -> clang_ext_zerocallusedregs_spelling = "clang_ext_ZeroCallUsedRegs_getSpelling_wrapper" external ext_ompdeclare_simd_decl_attr_get_uniforms_size : cxcursor -> int = "clang_ext_OMPDeclareSimdDeclAttr_getUniforms_Size_wrapper" type clang_ext_returntypestateattr_consumedstate = | Unknown | Consumed | Unconsumed [@@deriving refl] external ext_return_typestate_attr_get_state : cxcursor -> clang_ext_returntypestateattr_consumedstate = "clang_ext_ReturnTypestateAttr_getState_wrapper" external ext_attrs_get_aliasee_length : cxcursor -> int = "clang_ext_Attrs_getAliaseeLength_wrapper" external ext_obj_cruntime_name_attr_get_metadata_name : cxcursor -> string = "clang_ext_ObjCRuntimeNameAttr_getMetadataName_wrapper" type clang_ext_swifterrorattr_conventionkind = | None | NonNullError | NullResult | ZeroResult | NonZeroResult [@@deriving refl] external ext_swift_error_attr_get_convention : cxcursor -> clang_ext_swifterrorattr_conventionkind = "clang_ext_SwiftErrorAttr_getConvention_wrapper" type clang_ext_swiftasyncerrorattr_conventionkind = | None | NonNullError | ZeroArgument | NonZeroArgument [@@deriving refl] external ext_swift_async_error_attr_get_convention : cxcursor -> clang_ext_swiftasyncerrorattr_conventionkind = "clang_ext_SwiftAsyncErrorAttr_getConvention_wrapper" external ext_attrs_get_delayed_args : cxcursor -> (cxcursor -> unit) -> unit = "clang_ext_Attrs_getDelayedArgs_wrapper" external ext_ifunc_attr_get_resolver : cxcursor -> string = "clang_ext_IFuncAttr_getResolver_wrapper" external ext_patchable_function_entry_attr_get_offset : cxcursor -> int = "clang_ext_PatchableFunctionEntryAttr_getOffset_wrapper" external ext_assume_aligned_attr_get_offset : cxcursor -> cxcursor = "clang_ext_AssumeAlignedAttr_getOffset_wrapper" external ext_btftype_tag_attr_get_btftype_tag_length : cxcursor -> int = "clang_ext_BTFTypeTagAttr_getBTFTypeTagLength_wrapper" external ext_web_assembly_import_name_attr_get_import_name_length : cxcursor -> int = "clang_ext_WebAssemblyImportNameAttr_getImportNameLength_wrapper" external ext_sentinel_attr_get_sentinel : cxcursor -> int = "clang_ext_SentinelAttr_getSentinel_wrapper" external ext_attrs_get_success_value : cxcursor -> cxcursor = "clang_ext_Attrs_getSuccessValue_wrapper" external ext_attrs_get_cpus_size : cxcursor -> int = "clang_ext_Attrs_getCpus_Size_wrapper" external ext_tlsmodel_attr_get_model_length : cxcursor -> int = "clang_ext_TLSModelAttr_getModelLength_wrapper" type clang_ext_paramtypestateattr_consumedstate = | Unknown | Consumed | Unconsumed [@@deriving refl] external ext_param_typestate_attr_get_param_state : cxcursor -> clang_ext_paramtypestateattr_consumedstate = "clang_ext_ParamTypestateAttr_getParamState_wrapper" external ext_external_source_symbol_attr_get_generated_declaration : cxcursor -> bool = "clang_ext_ExternalSourceSymbolAttr_getGeneratedDeclaration_wrapper" external ext_suppress_attr_get_diagnostic_identifiers : cxcursor -> (string -> unit) -> unit = "clang_ext_SuppressAttr_getDiagnosticIdentifiers_wrapper" external ext_attrs_get_deref_type : cxcursor -> clang_ext_typeloc = "clang_ext_Attrs_getDerefType_wrapper" type clang_ext_functionreturnthunksattr_kind = | Keep | Extern [@@deriving refl] external ext_function_return_thunks_attr_get_thunk_type : cxcursor -> clang_ext_functionreturnthunksattr_kind = "clang_ext_FunctionReturnThunksAttr_getThunkType_wrapper" external ext_ompdeclare_variant_attr_get_adjust_args_need_device_ptr_size : cxcursor -> int = "clang_ext_OMPDeclareVariantAttr_getAdjustArgsNeedDevicePtr_Size_wrapper" external ext_type_tag_for_datatype_attr_get_matching_ctype : cxcursor -> clang_ext_typeloc = "clang_ext_TypeTagForDatatypeAttr_getMatchingCType_wrapper" external ext_attrs_get_annotation_length : cxcursor -> int = "clang_ext_Attrs_getAnnotationLength_wrapper" external ext_layout_version_attr_get_version : cxcursor -> int = "clang_ext_LayoutVersionAttr_getVersion_wrapper" external ext_sentinel_attr_get_null_pos : cxcursor -> int = "clang_ext_SentinelAttr_getNullPos_wrapper" external ext_ompdeclare_simd_decl_attr_get_aligneds : cxcursor -> (cxcursor -> unit) -> unit = "clang_ext_OMPDeclareSimdDeclAttr_getAligneds_wrapper" external ext_swift_async_attr_get_completion_handler_index : cxcursor -> int = "clang_ext_SwiftAsyncAttr_getCompletionHandlerIndex_wrapper" external ext_attrs_get_args_size : cxcursor -> int = "clang_ext_Attrs_getArgs_Size_wrapper" external ext_cudalaunch_bounds_attr_get_min_blocks : cxcursor -> cxcursor = "clang_ext_CUDALaunchBoundsAttr_getMinBlocks_wrapper" external ext_btfdecl_tag_attr_get_btfdecl_tag_length : cxcursor -> int = "clang_ext_BTFDeclTagAttr_getBTFDeclTagLength_wrapper" external ext_swift_bridge_attr_get_swift_type_length : cxcursor -> int = "clang_ext_SwiftBridgeAttr_getSwiftTypeLength_wrapper" external ext_external_source_symbol_attr_get_defined_in_length : cxcursor -> int = "clang_ext_ExternalSourceSymbolAttr_getDefinedInLength_wrapper" type clang_ext_hlslshaderattr_shadertype = | Pixel | Vertex | Geometry | Hull | Domain | Compute | RayGeneration | Intersection | AnyHit | ClosestHit | Miss | Callable | Mesh | Amplification [@@deriving refl] external ext_hlslshader_attr_get_type : cxcursor -> clang_ext_hlslshaderattr_shadertype = "clang_ext_HLSLShaderAttr_getType_wrapper" external ext_format_attr_get_type : cxcursor -> string = "clang_ext_FormatAttr_getType_wrapper" external ext_pass_object_size_attr_get_type : cxcursor -> int = "clang_ext_PassObjectSizeAttr_getType_wrapper" type clang_ext_blocksattr_blocktype = | ByRef [@@deriving refl] external ext_blocks_attr_get_type : cxcursor -> clang_ext_blocksattr_blocktype = "clang_ext_BlocksAttr_getType_wrapper" external ext_assumption_attr_get_assumption_length : cxcursor -> int = "clang_ext_AssumptionAttr_getAssumptionLength_wrapper" external ext_asm_label_attr_get_label : cxcursor -> string = "clang_ext_AsmLabelAttr_getLabel_wrapper" external ext_swift_attr_attr_get_attribute : cxcursor -> string = "clang_ext_SwiftAttrAttr_getAttribute_wrapper" external ext_availability_attr_get_platform : cxcursor -> string = "clang_ext_AvailabilityAttr_getPlatform_wrapper" external ext_attrs_get_max : cxcursor -> cxcursor = "clang_ext_Attrs_getMax_wrapper" external ext_target_attr_get_features_str : cxcursor -> string = "clang_ext_TargetAttr_getFeaturesStr_wrapper" external ext_callable_when_attr_get_callable_states_size : cxcursor -> int = "clang_ext_CallableWhenAttr_getCallableStates_Size_wrapper" type clang_ext_testtypestateattr_consumedstate = | Consumed | Unconsumed [@@deriving refl] external ext_test_typestate_attr_get_test_state : cxcursor -> clang_ext_testtypestateattr_consumedstate = "clang_ext_TestTypestateAttr_getTestState_wrapper" external ext_ompcapture_kind_attr_get_capture_kind_val : cxcursor -> int = "clang_ext_OMPCaptureKindAttr_getCaptureKindVal_wrapper" external ext_init_priority_attr_get_priority : cxcursor -> int = "clang_ext_InitPriorityAttr_getPriority_wrapper" external ext_attrs_get_priority : cxcursor -> int = "clang_ext_Attrs_getPriority_wrapper" type clang_ext_ompdeclaretargetdeclattr_maptypety = | To | Link [@@deriving refl] external ext_ompdeclare_target_decl_attr_get_map_type : cxcursor -> clang_ext_ompdeclaretargetdeclattr_maptypety = "clang_ext_OMPDeclareTargetDeclAttr_getMapType_wrapper" external ext_attrs_get_ydim : cxcursor -> int = "clang_ext_Attrs_getYDim_wrapper" external ext_cleanup_attr_get_function_decl : cxcursor -> clang_ext_declarationname = "clang_ext_CleanupAttr_getFunctionDecl_wrapper" type clang_ext_versiontuple = { major: int ; minor: int ; subminor: int ; build: int }[@@deriving refl] external ext_availability_attr_get_obsoleted : cxcursor -> clang_ext_versiontuple = "clang_ext_AvailabilityAttr_getObsoleted_wrapper" external ext_init_seg_attr_get_section : cxcursor -> string = "clang_ext_InitSegAttr_getSection_wrapper" external ext_btfdecl_tag_attr_get_btfdecl_tag : cxcursor -> string = "clang_ext_BTFDeclTagAttr_getBTFDeclTag_wrapper" external ext_external_source_symbol_attr_get_defined_in : cxcursor -> string = "clang_ext_ExternalSourceSymbolAttr_getDefinedIn_wrapper" external ext_alloc_size_attr_get_num_elems_param : cxcursor -> int = "clang_ext_AllocSizeAttr_getNumElemsParam_wrapper" external ext_ifunc_attr_get_resolver_length : cxcursor -> int = "clang_ext_IFuncAttr_getResolverLength_wrapper" external ext_asm_label_attr_get_label_length : cxcursor -> int = "clang_ext_AsmLabelAttr_getLabelLength_wrapper" external ext_abi_tag_attr_get_tags_size : cxcursor -> int = "clang_ext_AbiTagAttr_getTags_Size_wrapper" external ext_cudalaunch_bounds_attr_get_max_threads : cxcursor -> cxcursor = "clang_ext_CUDALaunchBoundsAttr_getMaxThreads_wrapper" external ext_attrs_get_builtin_name : cxcursor -> string = "clang_ext_Attrs_getBuiltinName_wrapper" external ext_web_assembly_import_module_attr_get_import_module : cxcursor -> string = "clang_ext_WebAssemblyImportModuleAttr_getImportModule_wrapper" type clang_ext_swiftnewtypeattr_newtypekind = | Struct | Enum [@@deriving refl] external ext_swift_new_type_attr_get_newtype_kind : cxcursor -> clang_ext_swiftnewtypeattr_newtypekind = "clang_ext_SwiftNewTypeAttr_getNewtypeKind_wrapper" external ext_hlslnum_threads_attr_get_z : cxcursor -> int = "clang_ext_HLSLNumThreadsAttr_getZ_wrapper" external ext_no_sanitize_attr_get_sanitizers_size : cxcursor -> int = "clang_ext_NoSanitizeAttr_getSanitizers_Size_wrapper" external ext_callback_attr_get_encoding_size : cxcursor -> int = "clang_ext_CallbackAttr_getEncoding_Size_wrapper" external ext_attrs_get_xdim : cxcursor -> int = "clang_ext_Attrs_getXDim_wrapper" external ext_uuid_attr_get_guid_decl : cxcursor -> cxcursor = "clang_ext_UuidAttr_getGuidDecl_wrapper" external ext_attrs_get_aliasee : cxcursor -> string = "clang_ext_Attrs_getAliasee_wrapper" external ext_attrs_get_handle_type : cxcursor -> string = "clang_ext_Attrs_getHandleType_wrapper" external ext_web_assembly_import_module_attr_get_import_module_length : cxcursor -> int = "clang_ext_WebAssemblyImportModuleAttr_getImportModuleLength_wrapper" external ext_ompdeclare_simd_decl_attr_get_linears : cxcursor -> (cxcursor -> unit) -> unit = "clang_ext_OMPDeclareSimdDeclAttr_getLinears_wrapper" external ext_availability_attr_get_deprecated : cxcursor -> clang_ext_versiontuple = "clang_ext_AvailabilityAttr_getDeprecated_wrapper" external ext_preferred_name_attr_get_typedef_type : cxcursor -> clang_ext_typeloc = "clang_ext_PreferredNameAttr_getTypedefType_wrapper" external ext_diagnose_as_builtin_attr_get_arg_indices : cxcursor -> (int -> unit) -> unit = "clang_ext_DiagnoseAsBuiltinAttr_getArgIndices_wrapper" external ext_target_clones_attr_get_features_strs_size : cxcursor -> int = "clang_ext_TargetClonesAttr_getFeaturesStrs_Size_wrapper" external ext_error_attr_get_user_diagnostic_length : cxcursor -> int = "clang_ext_ErrorAttr_getUserDiagnosticLength_wrapper" external ext_web_assembly_export_name_attr_get_export_name : cxcursor -> string = "clang_ext_WebAssemblyExportNameAttr_getExportName_wrapper" external ext_argument_with_type_tag_attr_get_is_pointer : cxcursor -> bool = "clang_ext_ArgumentWithTypeTagAttr_getIsPointer_wrapper" external ext_uuid_attr_get_guid_length : cxcursor -> int = "clang_ext_UuidAttr_getGuidLength_wrapper" external ext_ompdeclare_simd_decl_attr_get_aligneds_size : cxcursor -> int = "clang_ext_OMPDeclareSimdDeclAttr_getAligneds_Size_wrapper" external ext_attrs_get_message_length : cxcursor -> int = "clang_ext_Attrs_getMessageLength_wrapper" type clang_ext_pcsattr_pcstype = | AAPCS | AAPCS_VFP [@@deriving refl] external ext_pcs_attr_get_pcs : cxcursor -> clang_ext_pcsattr_pcstype = "clang_ext_PcsAttr_getPCS_wrapper" external ext_callback_attr_get_encoding : cxcursor -> (int -> unit) -> unit = "clang_ext_CallbackAttr_getEncoding_wrapper" external ext_attrs_get_argument_kind : cxcursor -> string = "clang_ext_Attrs_getArgumentKind_wrapper" external ext_availability_attr_get_unavailable : cxcursor -> bool = "clang_ext_AvailabilityAttr_getUnavailable_wrapper" type clang_ext_omptraitinfo external ext_ompdeclare_variant_attr_get_trait_infos : cxcursor -> clang_ext_omptraitinfo = "clang_ext_OMPDeclareVariantAttr_getTraitInfos_wrapper" external ext_ompallocate_decl_attr_get_allocator : cxcursor -> cxcursor = "clang_ext_OMPAllocateDeclAttr_getAllocator_wrapper" external ext_hlslnum_threads_attr_get_y : cxcursor -> int = "clang_ext_HLSLNumThreadsAttr_getY_wrapper" external ext_attrs_get_annotation : cxcursor -> string = "clang_ext_Attrs_getAnnotation_wrapper" external ext_ompdeclare_variant_attr_get_variant_func_ref : cxcursor -> cxcursor = "clang_ext_OMPDeclareVariantAttr_getVariantFuncRef_wrapper" external ext_no_builtin_attr_get_builtin_names_size : cxcursor -> int = "clang_ext_NoBuiltinAttr_getBuiltinNames_Size_wrapper" external ext_target_clones_attr_get_features_strs : cxcursor -> (string -> unit) -> unit = "clang_ext_TargetClonesAttr_getFeaturesStrs_wrapper" external ext_attrs_get_replacement : cxcursor -> string = "clang_ext_Attrs_getReplacement_wrapper" external ext_amdgpunum_sgprattr_get_num_sgpr : cxcursor -> int = "clang_ext_AMDGPUNumSGPRAttr_getNumSGPR_wrapper" external ext_obj_cbridge_related_attr_get_instance_method : cxcursor -> string = "clang_ext_ObjCBridgeRelatedAttr_getInstanceMethod_wrapper" external ext_ompdeclare_variant_attr_get_adjust_args_need_device_ptr : cxcursor -> (cxcursor -> unit) -> unit = "clang_ext_OMPDeclareVariantAttr_getAdjustArgsNeedDevicePtr_wrapper" external ext_ompdeclare_simd_decl_attr_get_simdlen : cxcursor -> cxcursor = "clang_ext_OMPDeclareSimdDeclAttr_getSimdlen_wrapper" external ext_target_attr_get_features_str_length : cxcursor -> int = "clang_ext_TargetAttr_getFeaturesStrLength_wrapper" external ext_aligned_attr_get_alignment_expr : cxcursor -> cxcursor = "clang_ext_AlignedAttr_getAlignmentExpr_wrapper" type clang_ext_zerocallusedregsattr_zerocallusedregskind = | Skip | UsedGPRArg | UsedGPR | UsedArg | Used | AllGPRArg | AllGPR | AllArg | All [@@deriving refl] external ext_zero_call_used_regs_attr_get_zero_call_used_regs : cxcursor -> clang_ext_zerocallusedregsattr_zerocallusedregskind = "clang_ext_ZeroCallUsedRegsAttr_getZeroCallUsedRegs_wrapper" external ext_ompdeclare_simd_decl_attr_get_steps : cxcursor -> (cxcursor -> unit) -> unit = "clang_ext_OMPDeclareSimdDeclAttr_getSteps_wrapper" external ext_tlsmodel_attr_get_model : cxcursor -> string = "clang_ext_TLSModelAttr_getModel_wrapper" external ext_ompdeclare_simd_decl_attr_get_modifiers : cxcursor -> (int -> unit) -> unit = "clang_ext_OMPDeclareSimdDeclAttr_getModifiers_wrapper" external ext_format_attr_get_first_arg : cxcursor -> int = "clang_ext_FormatAttr_getFirstArg_wrapper" external ext_amdgpunum_vgprattr_get_num_vgpr : cxcursor -> int = "clang_ext_AMDGPUNumVGPRAttr_getNumVGPR_wrapper" type clang_ext_mipsinterruptattr_interrupttype = | Sw0 | Sw1 | Hw0 | Hw1 | Hw2 | Hw3 | Hw4 | Hw5 | Eic [@@deriving refl] external ext_mips_interrupt_attr_get_interrupt : cxcursor -> clang_ext_mipsinterruptattr_interrupttype = "clang_ext_MipsInterruptAttr_getInterrupt_wrapper" type clang_ext_arminterruptattr_interrupttype = | IRQ | FIQ | SWI | ABORT | UNDEF | Generic [@@deriving refl] external ext_arminterrupt_attr_get_interrupt : cxcursor -> clang_ext_arminterruptattr_interrupttype = "clang_ext_ARMInterruptAttr_getInterrupt_wrapper" type clang_ext_riscvinterruptattr_interrupttype = | User | Supervisor | Machine [@@deriving refl] external ext_riscvinterrupt_attr_get_interrupt : cxcursor -> clang_ext_riscvinterruptattr_interrupttype = "clang_ext_RISCVInterruptAttr_getInterrupt_wrapper" external ext_attrs_get_min : cxcursor -> cxcursor = "clang_ext_Attrs_getMin_wrapper" type clang_ext_enumextensibilityattr_kind = | Closed | Open [@@deriving refl] external ext_enum_extensibility_attr_get_extensibility : cxcursor -> clang_ext_enumextensibilityattr_kind = "clang_ext_EnumExtensibilityAttr_getExtensibility_wrapper" external ext_alloc_align_attr_get_param_index : cxcursor -> int = "clang_ext_AllocAlignAttr_getParamIndex_wrapper" external ext_diagnose_as_builtin_attr_get_arg_indices_size : cxcursor -> int = "clang_ext_DiagnoseAsBuiltinAttr_getArgIndices_Size_wrapper" external ext_availability_attr_get_introduced : cxcursor -> clang_ext_versiontuple = "clang_ext_AvailabilityAttr_getIntroduced_wrapper" external ext_max_field_alignment_attr_get_alignment : cxcursor -> int = "clang_ext_MaxFieldAlignmentAttr_getAlignment_wrapper" external ext_attrs_get_alignment : cxcursor -> cxcursor = "clang_ext_Attrs_getAlignment_wrapper" external ext_address_space_attr_get_address_space : cxcursor -> int = "clang_ext_AddressSpaceAttr_getAddressSpace_wrapper" external ext_mode_attr_get_mode : cxcursor -> string = "clang_ext_ModeAttr_getMode_wrapper" external ext_attrs_get_arg : cxcursor -> cxcursor = "clang_ext_Attrs_getArg_wrapper" external ext_attrs_get_cpus : cxcursor -> (string -> unit) -> unit = "clang_ext_Attrs_getCpus_wrapper" external ext_btftype_tag_attr_get_btftype_tag : cxcursor -> string = "clang_ext_BTFTypeTagAttr_getBTFTypeTag_wrapper" external ext_open_clintel_reqd_sub_group_size_attr_get_sub_group_size : cxcursor -> int = "clang_ext_OpenCLIntelReqdSubGroupSizeAttr_getSubGroupSize_wrapper" external ext_argument_with_type_tag_attr_get_argument_idx : cxcursor -> int = "clang_ext_ArgumentWithTypeTagAttr_getArgumentIdx_wrapper" external ext_availability_attr_get_strict : cxcursor -> bool = "clang_ext_AvailabilityAttr_getStrict_wrapper" type clang_ext_cfguardattr_guardarg = | Nocf [@@deriving refl] external ext_cfguard_attr_get_guard : cxcursor -> clang_ext_cfguardattr_guardarg = "clang_ext_CFGuardAttr_getGuard_wrapper" external ext_ownership_attr_get_module : cxcursor -> string = "clang_ext_OwnershipAttr_getModule_wrapper" external ext_min_vector_width_attr_get_vector_width : cxcursor -> int = "clang_ext_MinVectorWidthAttr_getVectorWidth_wrapper" external ext_type_tag_for_datatype_attr_get_layout_compatible : cxcursor -> bool = "clang_ext_TypeTagForDatatypeAttr_getLayoutCompatible_wrapper" external ext_ompdeclare_variant_attr_get_adjust_args_nothing : cxcursor -> (cxcursor -> unit) -> unit = "clang_ext_OMPDeclareVariantAttr_getAdjustArgsNothing_wrapper" external ext_init_seg_attr_get_section_length : cxcursor -> int = "clang_ext_InitSegAttr_getSectionLength_wrapper" external ext_vec_type_hint_attr_get_type_hint : cxcursor -> clang_ext_typeloc = "clang_ext_VecTypeHintAttr_getTypeHint_wrapper" external ext_attrs_get_tcbname_length : cxcursor -> int = "clang_ext_Attrs_getTCBNameLength_wrapper" external ext_ompdeclare_variant_attr_get_adjust_args_nothing_size : cxcursor -> int = "clang_ext_OMPDeclareVariantAttr_getAdjustArgsNothing_Size_wrapper" external ext_external_source_symbol_attr_get_language_length : cxcursor -> int = "clang_ext_ExternalSourceSymbolAttr_getLanguageLength_wrapper" external ext_obj_cruntime_name_attr_get_metadata_name_length : cxcursor -> int = "clang_ext_ObjCRuntimeNameAttr_getMetadataNameLength_wrapper" type clang_ext_consumableattr_consumedstate = | Unknown | Consumed | Unconsumed [@@deriving refl] external ext_consumable_attr_get_default_state : cxcursor -> clang_ext_consumableattr_consumedstate = "clang_ext_ConsumableAttr_getDefaultState_wrapper" external ext_builtin_attr_get_id : cxcursor -> int = "clang_ext_BuiltinAttr_getID_wrapper" external ext_assumption_attr_get_assumption : cxcursor -> string = "clang_ext_AssumptionAttr_getAssumption_wrapper" external ext_attrs_get_bridged_type : cxcursor -> string = "clang_ext_Attrs_getBridgedType_wrapper" external ext_ompdeclare_simd_decl_attr_get_modifiers_size : cxcursor -> int = "clang_ext_OMPDeclareSimdDeclAttr_getModifiers_Size_wrapper" external ext_swift_attr_attr_get_attribute_length : cxcursor -> int = "clang_ext_SwiftAttrAttr_getAttributeLength_wrapper" type clang_ext_settypestateattr_consumedstate = | Unknown | Consumed | Unconsumed [@@deriving refl] external ext_set_typestate_attr_get_new_state : cxcursor -> clang_ext_settypestateattr_consumedstate = "clang_ext_SetTypestateAttr_getNewState_wrapper" external ext_obj_cbridge_related_attr_get_class_method : cxcursor -> string = "clang_ext_ObjCBridgeRelatedAttr_getClassMethod_wrapper" external ext_ompreferenced_var_attr_get_ref : cxcursor -> cxcursor = "clang_ext_OMPReferencedVarAttr_getRef_wrapper" external ext_alloc_size_attr_get_elem_size_param : cxcursor -> int = "clang_ext_AllocSizeAttr_getElemSizeParam_wrapper" type clang_ext_visibilityattr_visibilitytype = | Default | Hidden | Protected [@@deriving refl] external ext_visibility_attr_get_visibility : cxcursor -> clang_ext_visibilityattr_visibilitytype = "clang_ext_VisibilityAttr_getVisibility_wrapper" type clang_ext_typevisibilityattr_visibilitytype = | Default | Hidden | Protected [@@deriving refl] external ext_type_visibility_attr_get_visibility : cxcursor -> clang_ext_typevisibilityattr_visibilitytype = "clang_ext_TypeVisibilityAttr_getVisibility_wrapper" external ext_external_source_symbol_attr_get_language : cxcursor -> string = "clang_ext_ExternalSourceSymbolAttr_getLanguage_wrapper" external ext_attrs_get_replacement_length : cxcursor -> int = "clang_ext_Attrs_getReplacementLength_wrapper" external ext_ompdeclare_simd_decl_attr_get_alignments_size : cxcursor -> int = "clang_ext_OMPDeclareSimdDeclAttr_getAlignments_Size_wrapper" external ext_ompdeclare_simd_decl_attr_get_linears_size : cxcursor -> int = "clang_ext_OMPDeclareSimdDeclAttr_getLinears_Size_wrapper" external ext_nserror_domain_attr_get_error_domain : cxcursor -> cxcursor = "clang_ext_NSErrorDomainAttr_getErrorDomain_wrapper" external ext_error_attr_get_user_diagnostic : cxcursor -> string = "clang_ext_ErrorAttr_getUserDiagnostic_wrapper" external ext_xray_log_args_attr_get_argument_count : cxcursor -> int = "clang_ext_XRayLogArgsAttr_getArgumentCount_wrapper" external ext_attrs_get_message : cxcursor -> string = "clang_ext_Attrs_getMessage_wrapper" external ext_argument_with_type_tag_attr_get_type_tag_idx : cxcursor -> int = "clang_ext_ArgumentWithTypeTagAttr_getTypeTagIdx_wrapper" external ext_uuid_attr_get_guid : cxcursor -> string = "clang_ext_UuidAttr_getGuid_wrapper" external ext_attrs_get_zdim : cxcursor -> int = "clang_ext_Attrs_getZDim_wrapper" external ext_attrs_get_handle_type_length : cxcursor -> int = "clang_ext_Attrs_getHandleTypeLength_wrapper" external ext_ompdeclare_simd_decl_attr_get_uniforms : cxcursor -> (cxcursor -> unit) -> unit = "clang_ext_OMPDeclareSimdDeclAttr_getUniforms_wrapper" type clang_ext_loophintattr_optiontype = | Vectorize | VectorizeWidth | Interleave | InterleaveCount | Unroll | UnrollCount | UnrollAndJam | UnrollAndJamCount | PipelineDisabled | PipelineInitiationInterval | Distribute | VectorizePredicate [@@deriving refl] external ext_loop_hint_attr_get_option : cxcursor -> clang_ext_loophintattr_optiontype = "clang_ext_LoopHintAttr_getOption_wrapper" external ext_obj_cbridge_related_attr_get_related_class : cxcursor -> string = "clang_ext_ObjCBridgeRelatedAttr_getRelatedClass_wrapper" external ext_web_assembly_import_name_attr_get_import_name : cxcursor -> string = "clang_ext_WebAssemblyImportNameAttr_getImportName_wrapper" external ext_no_sanitize_attr_get_sanitizers : cxcursor -> (string -> unit) -> unit = "clang_ext_NoSanitizeAttr_getSanitizers_wrapper" type clang_ext_callablewhenattr_consumedstate = | Unknown | Consumed | Unconsumed [@@deriving refl] external ext_callable_when_attr_get_callable_states : cxcursor -> (clang_ext_callablewhenattr_consumedstate -> unit) -> unit = "clang_ext_CallableWhenAttr_getCallableStates_wrapper" type clang_ext_ompdeclaresimddeclattr_branchstatety = | Undefined | Inbranch | Notinbranch [@@deriving refl] external ext_ompdeclare_simd_decl_attr_get_branch_state : cxcursor -> clang_ext_ompdeclaresimddeclattr_branchstatety = "clang_ext_OMPDeclareSimdDeclAttr_getBranchState_wrapper" external ext_asm_label_attr_get_is_literal_label : cxcursor -> bool = "clang_ext_AsmLabelAttr_getIsLiteralLabel_wrapper" external ext_swift_bridge_attr_get_swift_type : cxcursor -> string = "clang_ext_SwiftBridgeAttr_getSwiftType_wrapper" external ext_format_arg_attr_get_format_idx : cxcursor -> int = "clang_ext_FormatArgAttr_getFormatIdx_wrapper" external ext_format_attr_get_format_idx : cxcursor -> int = "clang_ext_FormatAttr_getFormatIdx_wrapper" external ext_type_tag_for_datatype_attr_get_must_be_null : cxcursor -> bool = "clang_ext_TypeTagForDatatypeAttr_getMustBeNull_wrapper" type clang_ext_ompallocatedeclattr_allocatortypety = | OMPNullMemAlloc | OMPDefaultMemAlloc | OMPLargeCapMemAlloc | OMPConstMemAlloc | OMPHighBWMemAlloc | OMPLowLatMemAlloc | OMPCGroupMemAlloc | OMPPTeamMemAlloc | OMPThreadMemAlloc | OMPUserDefinedMemAlloc [@@deriving refl] external ext_ompallocate_decl_attr_get_allocator_type : cxcursor -> clang_ext_ompallocatedeclattr_allocatortypety = "clang_ext_OMPAllocateDeclAttr_getAllocatorType_wrapper" external ext_attrs_get_name_length : cxcursor -> int = "clang_ext_Attrs_getNameLength_wrapper" external ext_attrs_get_name : cxcursor -> string = "clang_ext_Attrs_getName_wrapper" external ext_suppress_attr_get_diagnostic_identifiers_size : cxcursor -> int = "clang_ext_SuppressAttr_getDiagnosticIdentifiers_Size_wrapper" external ext_ompdeclare_simd_decl_attr_get_steps_size : cxcursor -> int = "clang_ext_OMPDeclareSimdDeclAttr_getSteps_Size_wrapper" external ext_web_assembly_export_name_attr_get_export_name_length : cxcursor -> int = "clang_ext_WebAssemblyExportNameAttr_getExportNameLength_wrapper" external ext_ompdeclare_simd_decl_attr_get_alignments : cxcursor -> (cxcursor -> unit) -> unit = "clang_ext_OMPDeclareSimdDeclAttr_getAlignments_wrapper" external ext_msvtor_disp_attr_get_vdm : cxcursor -> int = "clang_ext_MSVtorDispAttr_getVdm_wrapper" external ext_attrs_get_cond : cxcursor -> cxcursor = "clang_ext_Attrs_getCond_wrapper" external ext_iboutlet_collection_attr_get_interface : cxcursor -> clang_ext_typeloc = "clang_ext_IBOutletCollectionAttr_getInterface_wrapper" type clang_ext_objcmethodfamilyattr_familykind = | None | Alloc | Copy | Init | MutableCopy | New [@@deriving refl] external ext_obj_cmethod_family_attr_get_family : cxcursor -> clang_ext_objcmethodfamilyattr_familykind = "clang_ext_ObjCMethodFamilyAttr_getFamily_wrapper" external ext_swift_async_error_attr_get_handler_param_idx : cxcursor -> int = "clang_ext_SwiftAsyncErrorAttr_getHandlerParamIdx_wrapper" type clang_ext_swiftasyncattr_kind = | None | SwiftPrivate | NotSwiftPrivate [@@deriving refl] external ext_swift_async_attr_get_kind : cxcursor -> clang_ext_swiftasyncattr_kind = "clang_ext_SwiftAsyncAttr_getKind_wrapper" external ext_attrs_get_kind : cxcursor -> string = "clang_ext_Attrs_getKind_wrapper" external ext_hlslnum_threads_attr_get_x : cxcursor -> int = "clang_ext_HLSLNumThreadsAttr_getX_wrapper" external ext_patchable_function_entry_attr_get_count : cxcursor -> int = "clang_ext_PatchableFunctionEntryAttr_getCount_wrapper" external ext_diagnose_as_builtin_attr_get_function : cxcursor -> clang_ext_declarationname = "clang_ext_DiagnoseAsBuiltinAttr_getFunction_wrapper" external ext_attrs_get_delayed_args_size : cxcursor -> int = "clang_ext_Attrs_getDelayedArgs_Size_wrapper" external ext_abi_tag_attr_get_tags : cxcursor -> (string -> unit) -> unit = "clang_ext_AbiTagAttr_getTags_wrapper" external ext_attrs_get_number : cxcursor -> int = "clang_ext_Attrs_getNumber_wrapper" external ext_attrs_get_tcbname : cxcursor -> string = "clang_ext_Attrs_getTCBName_wrapper" external ext_open_clunroll_hint_attr_get_unroll_hint : cxcursor -> int = "clang_ext_OpenCLUnrollHintAttr_getUnrollHint_wrapper" external ext_no_builtin_attr_get_builtin_names : cxcursor -> (string -> unit) -> unit = "clang_ext_NoBuiltinAttr_getBuiltinNames_wrapper" external ext_msinheritance_attr_get_best_case : cxcursor -> bool = "clang_ext_MSInheritanceAttr_getBestCase_wrapper" external ext_non_null_attr_get_args : cxcursor -> (int -> unit) -> unit = "clang_ext_NonNullAttr_getArgs_wrapper" external ext_acquire_capability_attr_get_args : cxcursor -> (cxcursor -> unit) -> unit = "clang_ext_AcquireCapabilityAttr_getArgs_wrapper"
(* This file is auto-generated by stubgen tool. It should not be modified by hand and it should not be versioned (except by continuous integration on the dedicated bootstrap branch). *)
t-cmp_ui.c
#include <stdio.h> #include <stdlib.h> #include <gmp.h> #include "flint.h" #include "ulong_extras.h" #include "fmpz.h" int main(void) { int i, result; FLINT_TEST_INIT(state); flint_printf("cmp_ui...."); fflush(stdout); /* Compare with fmpz_cmp */ for (i = 0; i < 10000 * flint_test_multiplier(); i++) { fmpz_t a, b; ulong n; int lhs, rhs; fmpz_init(a); fmpz_init(b); fmpz_randtest(a, state, 200); n = n_randtest(state); fmpz_set_ui(b, n); lhs = fmpz_cmp(a, b); rhs = fmpz_cmp_ui(a, n); result = (lhs < 0) ? (rhs < 0) : ((lhs > 0) ? (rhs > 0) : (rhs == 0)); if (result == 0) { flint_printf("FAIL:\n"); flint_printf("a = "), fmpz_print(a), flint_printf("\n"); flint_printf("b = "), fmpz_print(b), flint_printf("\n"); flint_printf("n = %wu\n", n); flint_printf("cmp(a, b) = %d\n", fmpz_cmp(a, b)); flint_printf("cmp_ui(a, n) = %d\n", fmpz_cmp_ui(a, n)); fflush(stdout); flint_abort(); } fmpz_clear(a); fmpz_clear(b); } FLINT_TEST_CLEANUP(state); flint_printf("PASS\n"); return EXIT_SUCCESS; }
/* Copyright (C) 2010 Sebastian Pancratz This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */
test_ctz.ml
[%%import "config.h"] open Base open Stdio let test ~op ~op_name ~to_string x = printf "%s %s = %d\n" op_name (to_string x) (op x) let numbers = [ 0 (* Int.num_bits *); 1; 7; 2; 4; 12; 18; -1 ] let%expect_test "ctz int64" = let open Int64 in let numbers = List.map numbers ~f:of_int in let f = test ~op:Ocaml_intrinsics.Int64.count_trailing_zeros ~op_name:"ctz" ~to_string:Hex.to_string_hum in List.iter ~f (max_value :: min_value :: numbers); [%expect {| ctz 0x7fff_ffff_ffff_ffff = 0 ctz -0x8000_0000_0000_0000 = 63 ctz 0x0 = 64 ctz 0x1 = 0 ctz 0x7 = 0 ctz 0x2 = 1 ctz 0x4 = 2 ctz 0xc = 2 ctz 0x12 = 1 ctz -0x1 = 0 |}] ;; let%expect_test "ctz int32" = let open Int32 in let numbers = List.map numbers ~f:of_int_trunc in let f = test ~op:Ocaml_intrinsics.Int32.count_trailing_zeros ~op_name:"ctz" ~to_string:Hex.to_string_hum in List.iter ~f (max_value :: min_value :: numbers); [%expect {| ctz 0x7fff_ffff = 0 ctz -0x8000_0000 = 31 ctz 0x0 = 32 ctz 0x1 = 0 ctz 0x7 = 0 ctz 0x2 = 1 ctz 0x4 = 2 ctz 0xc = 2 ctz 0x12 = 1 ctz -0x1 = 0 |}] ;; [%%ifdef JSC_ARCH_SIXTYFOUR] let%expect_test "ctz int" = let open Int in let f = test ~op:Ocaml_intrinsics.Int.count_trailing_zeros ~op_name:"ctz" ~to_string:Hex.to_string_hum in List.iter ~f (max_value :: min_value :: numbers); [%expect {| ctz 0x3fff_ffff_ffff_ffff = 0 ctz -0x4000_0000_0000_0000 = 62 ctz 0x0 = 63 ctz 0x1 = 0 ctz 0x7 = 0 ctz 0x2 = 1 ctz 0x4 = 2 ctz 0xc = 2 ctz 0x12 = 1 ctz -0x1 = 0 |}] ;; let%expect_test "ctz nativeint" = let open Nativeint in let numbers = List.map numbers ~f:of_int in let f = test ~op:Ocaml_intrinsics.Nativeint.count_trailing_zeros ~op_name:"ctz" ~to_string:Hex.to_string_hum in List.iter ~f (max_value :: min_value :: numbers); [%expect {| ctz 0x7fff_ffff_ffff_ffff = 0 ctz -0x8000_0000_0000_0000 = 63 ctz 0x0 = 64 ctz 0x1 = 0 ctz 0x7 = 0 ctz 0x2 = 1 ctz 0x4 = 2 ctz 0xc = 2 ctz 0x12 = 1 ctz -0x1 = 0 |}] ;; [%%else] let%expect_test "ctz int" = let open Int in let f = test ~op:Ocaml_intrinsics.Int.count_trailing_zeros ~op_name:"ctz" ~to_string:Hex.to_string_hum in List.iter ~f (max_value :: min_value :: numbers); [%expect {| ctz 0x3fff_ffff = 0 ctz -0x4000_0000 = 30 ctz 0x0 = 31 ctz 0x1 = 0 ctz 0x7 = 0 ctz 0x2 = 1 ctz 0x4 = 2 ctz 0xc = 2 ctz 0x12 = 1 ctz -0x1 = 0 |}] ;; let%expect_test "ctz nativeint" = let open Nativeint in let numbers = List.map numbers ~f:of_int in let f = test ~op:Ocaml_intrinsics.Nativeint.count_trailing_zeros ~op_name:"ctz" ~to_string:Hex.to_string_hum in List.iter ~f (max_value :: min_value :: numbers); [%expect {| ctz 0x7fff_ffff = 0 ctz -0x8000_0000 = 31 ctz 0x0 = 32 ctz 0x1 = 0 ctz 0x7 = 0 ctz 0x2 = 1 ctz 0x4 = 2 ctz 0xc = 2 ctz 0x12 = 1 ctz -0x1 = 0 |}] ;; [%%endif]
t-print_read.c
/* try to get fdopen declared */ #if defined __STRICT_ANSI__ #undef __STRICT_ANSI__ #endif #include <sys/types.h> #if (!defined (__WIN32) || defined(__CYGWIN__)) && !defined(_MSC_VER) #include <unistd.h> #endif #include <stdio.h> #include <stdlib.h> #include <gmp.h> #include "flint.h" #include "fmpz.h" #include "fmpz_poly.h" #include "fmpq_poly.h" #if (!defined (__WIN32) || defined(__CYGWIN__)) && !defined(_MSC_VER) int main(void) { int i, j, n = 1000, result; FILE *in, *out; int fd[2]; pid_t childpid; FLINT_TEST_INIT(state); flint_printf("print/ read...."); fflush(stdout); /* Randomise n polynomials, write to and read from a pipe */ { fmpq_poly_t *a; a = flint_malloc(n * sizeof(fmpq_poly_t)); for (i = 0; i < n; i++) { fmpq_poly_init(a[i]); fmpq_poly_randtest(a[i], state, 100, 100); } if (pipe(fd)) { flint_printf("FAIL:\n"); flint_printf("Failed to set-up the pipe.\n"); fflush(stdout); flint_abort(); } if((childpid = fork()) == -1) { flint_printf("FAIL:\n"); flint_printf("Failed to fork the process.\n"); fflush(stdout); flint_abort(); } if(childpid == 0) /* Child process */ { int r; close(fd[0]); out = fdopen(fd[1], "w"); if (out == NULL) { flint_printf("FAIL:\n"); flint_printf("Could not open output file at the pipe.\n"); fflush(stdout); flint_abort(); } for (j = 0; j < n; j++) { r = fmpq_poly_fprint(out, a[j]); if ((j < n - 1) && (r > 0)) r = flint_fprintf(out, "\n"); if (r <= 0) { flint_printf("FAIL:\n"); flint_printf("Write error.\n"); fflush(stdout); flint_abort(); } } fclose(out); for (i = 0; i < n; ++i) fmpq_poly_clear(a[i]); flint_free(a); exit(0); } else /* Parent process */ { int r; fmpq_poly_t t; close(fd[1]); in = fdopen(fd[0], "r"); if (in == NULL) { flint_printf("FAIL:\n"); flint_printf("Could not open input file at the pipe.\n"); fflush(stdout); flint_abort(); } fmpq_poly_init(t); i = 0; while (!feof(in)) { r = fmpq_poly_fread(in, t); if (r <= 0) { flint_printf("FAIL:\n"); flint_printf("Read error.\n"); fflush(stdout); flint_abort(); } result = fmpq_poly_equal(t, a[i]); if (!result) { flint_printf("FAIL:\n"); flint_printf("a[i] = "), fmpq_poly_debug(a[i]), flint_printf("\n"); flint_printf("t = "), fmpq_poly_debug(t), flint_printf("\n"); fflush(stdout); flint_abort(); } ++i; } fmpq_poly_clear(t); fclose(in); } if (i != n) { flint_printf("FAIL:\n"); flint_printf("Only %d out of %d objects were processed.\n", i, n); fflush(stdout); flint_abort(); } for (i = 0; i < n; i++) fmpq_poly_clear(a[i]); flint_free(a); } /* Write bad data to a pipe and read it */ { char str[5] = {'b', 'l', 'a', 'h', '\0'}; if (pipe(fd)) { flint_printf("FAIL:\n"); flint_printf("Failed to set-up the pipe.\n"); fflush(stdout); flint_abort(); } if((childpid = fork()) == -1) { flint_printf("FAIL:\n"); flint_printf("Failed to fork the process.\n"); fflush(stdout); flint_abort(); } if(childpid == 0) /* Child process */ { int r; close(fd[0]); out = fdopen(fd[1], "w"); if (out == NULL) { flint_printf("FAIL:\n"); flint_printf("Could not open output file at the pipe.\n"); fflush(stdout); flint_abort(); } r = flint_fprintf(out, "blah"); if (r <= 0) { flint_printf("FAIL:\n"); flint_printf("Write error.\n"); fflush(stdout); flint_abort(); } fclose(out); exit(0); } else /* Parent process */ { int r; fmpq_poly_t t; close(fd[1]); in = fdopen(fd[0], "r"); if (in == NULL) { flint_printf("FAIL:\n"); flint_printf("Could not open input file at the pipe.\n"); fflush(stdout); flint_abort(); } fmpq_poly_init(t); i = 0; while (!feof(in)) { r = fmpq_poly_fread(in, t); if (r > 0) { flint_printf("FAIL:\n"); flint_printf("r = %d\n", r); fflush(stdout); flint_abort(); } ++i; } fmpq_poly_clear(t); fclose(in); } /* For {'b','l','a','h','\0'} we expect 5 reads */ if (i != 5) { flint_printf("FAIL:\n"); flint_printf("Carried out %d reads, but \"%s\" has only 4 characters.\n", i, str); fflush(stdout); flint_abort(); } } FLINT_TEST_CLEANUP(state); flint_printf("PASS\n"); return EXIT_SUCCESS; } #else int main(void) { flint_printf("print/ read...."); fflush(stdout); flint_printf("SKIPPED\n"); return EXIT_SUCCESS; } #endif
/* Copyright (C) 2010 Sebastian Pancratz This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */
sexp_index.ml
open! Core open Or_error.Let_syntax type t = int list [@@deriving compare, equal, sexp_of] let traverse t sexp ~on_dst ~on_list = let invalid = lazy (error_s [%message "Invalid index." ~_:(t : t) ~_:(sexp : Sexp.t)]) in let rec zoom_out x ~context = match context with | [] -> Ok x | (before, after) :: context -> on_list ~before ~after x >>= zoom_out ~context in let rec zoom_in t (sexp : Sexp.t) ~context = match t with | [] -> on_dst sexp >>= zoom_out ~context | head :: tail -> (match sexp with | Atom _ -> force invalid | List sexps -> (match List.split_n sexps head with | _, [] -> force invalid | before, at :: after -> zoom_in tail at ~context:((before, after) :: context))) in zoom_in t sexp ~context:[] ;; let get = traverse ~on_dst:Or_error.return ~on_list:(fun ~before:_ ~after:_ sexp -> Ok sexp) ;; let remove t sexp = let on_dst _ = Ok None in let on_list ~before ~after sexp = Ok (Some (Sexp.List (List.concat [ before; Option.to_list sexp; after ]))) in match%bind traverse t sexp ~on_dst ~on_list with | Some sexp -> Ok sexp | None -> error_s [%message "Cannot remove entire sexp."] ;; let update t sexp ~f = traverse t sexp ~on_dst:f ~on_list:(fun ~before ~after sexp -> Ok (Sexp.List (List.concat [ before; [ sexp ]; after ]))) ;; let set t sexp ~to_ = update t sexp ~f:(fun _ -> Ok to_) let rec enumerate sexp : t list = let non_empty = match (sexp : Sexp.t) with | Atom _ -> [] | List sexps -> List.concat_mapi sexps ~f:(fun i sexp -> List.map (enumerate sexp) ~f:(fun t -> i :: t)) in [] :: non_empty ;; let parent t = match List.drop_last t with | None -> error_s [%message "No parent." ~_:(t : t)] | Some t -> Ok t ;;
bool.mli
type t = bool = | false | true val not : bool -> bool external (&&) : bool -> bool -> bool = "%sequand" external (||) : bool -> bool -> bool = "%sequor" val equal : bool -> bool -> bool val compare : bool -> bool -> int val to_int : bool -> int val to_float : bool -> float val to_string : bool -> string
nosem.c
int main() { // nosem: rules.test-nosem test_nosem_func(); test_nosem_func(); // nosem: rules.test-nosem test_nosem_func(); return 0; }
nativeint.ml
open! Import open! Caml.Nativeint include Nativeint_replace_polymorphic_compare module T = struct type t = nativeint [@@deriving_inline hash, sexp, sexp_grammar] let (hash_fold_t : Ppx_hash_lib.Std.Hash.state -> t -> Ppx_hash_lib.Std.Hash.state) = hash_fold_nativeint and (hash : t -> Ppx_hash_lib.Std.Hash.hash_value) = let func = hash_nativeint in fun x -> func x ;; let t_of_sexp = (nativeint_of_sexp : Sexplib0.Sexp.t -> t) let sexp_of_t = (sexp_of_nativeint : t -> Sexplib0.Sexp.t) let (t_sexp_grammar : t Sexplib0.Sexp_grammar.t) = nativeint_sexp_grammar [@@@end] let hashable : t Hashable.t = { hash; compare; sexp_of_t } let compare = Nativeint_replace_polymorphic_compare.compare let to_string = to_string let of_string = of_string end include T include Comparator.Make (T) include Comparable.With_zero (struct include T let zero = zero end) module Conv = Int_conversions include Conv.Make (T) include Conv.Make_hex (struct open Nativeint_replace_polymorphic_compare type t = nativeint [@@deriving_inline compare, hash] let compare = (compare_nativeint : t -> t -> int) let (hash_fold_t : Ppx_hash_lib.Std.Hash.state -> t -> Ppx_hash_lib.Std.Hash.state) = hash_fold_nativeint and (hash : t -> Ppx_hash_lib.Std.Hash.hash_value) = let func = hash_nativeint in fun x -> func x ;; [@@@end] let zero = zero let neg = neg let ( < ) = ( < ) let to_string i = Printf.sprintf "%nx" i let of_string s = Caml.Scanf.sscanf s "%nx" Fn.id let module_name = "Base.Nativeint.Hex" end) include Pretty_printer.Register (struct type nonrec t = t let to_string = to_string let module_name = "Base.Nativeint" end) (* Open replace_polymorphic_compare after including functor instantiations so they do not shadow its definitions. This is here so that efficient versions of the comparison functions are available within this module. *) open! Nativeint_replace_polymorphic_compare let invariant (_ : t) = () let num_bits = Word_size.num_bits Word_size.word_size let float_lower_bound = Float0.lower_bound_for_int num_bits let float_upper_bound = Float0.upper_bound_for_int num_bits let shift_right_logical = shift_right_logical let shift_right = shift_right let shift_left = shift_left let bit_not = lognot let bit_xor = logxor let bit_or = logor let bit_and = logand let min_value = min_int let max_value = max_int let abs = abs let pred = pred let succ = succ let rem = rem let neg = neg let minus_one = minus_one let one = one let zero = zero let to_float = to_float let of_float_unchecked = of_float let of_float f = if Float_replace_polymorphic_compare.( >= ) f float_lower_bound && Float_replace_polymorphic_compare.( <= ) f float_upper_bound then of_float f else Printf.invalid_argf "Nativeint.of_float: argument (%f) is out of range or NaN" (Float0.box f) () ;; module Pow2 = struct open! Import open Nativeint_replace_polymorphic_compare let raise_s = Error.raise_s let non_positive_argument () = Printf.invalid_argf "argument must be strictly positive" () ;; let ( lor ) = Caml.Nativeint.logor let ( lsr ) = Caml.Nativeint.shift_right_logical let ( land ) = Caml.Nativeint.logand (** "ceiling power of 2" - Least power of 2 greater than or equal to x. *) let ceil_pow2 (x : nativeint) = if x <= 0n then non_positive_argument (); let x = Caml.Nativeint.pred x in let x = x lor (x lsr 1) in let x = x lor (x lsr 2) in let x = x lor (x lsr 4) in let x = x lor (x lsr 8) in let x = x lor (x lsr 16) in (* The next line is superfluous on 32-bit architectures, but it's faster to do it anyway than to branch *) let x = x lor (x lsr 32) in Caml.Nativeint.succ x ;; (** "floor power of 2" - Largest power of 2 less than or equal to x. *) let floor_pow2 x = if x <= 0n then non_positive_argument (); let x = x lor (x lsr 1) in let x = x lor (x lsr 2) in let x = x lor (x lsr 4) in let x = x lor (x lsr 8) in let x = x lor (x lsr 16) in let x = x lor (x lsr 32) in Caml.Nativeint.sub x (x lsr 1) ;; let is_pow2 x = if x <= 0n then non_positive_argument (); x land Caml.Nativeint.pred x = 0n ;; (* C stubs for nativeint clz and ctz to use the CLZ/BSR/CTZ/BSF instruction where possible *) external clz : (nativeint[@unboxed]) -> (int[@untagged]) = "Base_int_math_nativeint_clz" "Base_int_math_nativeint_clz_unboxed" [@@noalloc] external ctz : (nativeint[@unboxed]) -> (int[@untagged]) = "Base_int_math_nativeint_ctz" "Base_int_math_nativeint_ctz_unboxed" [@@noalloc] (** Hacker's Delight Second Edition p106 *) let floor_log2 i = if Poly.( <= ) i Caml.Nativeint.zero then raise_s (Sexp.message "[Nativeint.floor_log2] got invalid input" [ "", sexp_of_nativeint i ]); num_bits - 1 - clz i ;; (** Hacker's Delight Second Edition p106 *) let ceil_log2 i = if Poly.( <= ) i Caml.Nativeint.zero then raise_s (Sexp.message "[Nativeint.ceil_log2] got invalid input" [ "", sexp_of_nativeint i ]); if Caml.Nativeint.equal i Caml.Nativeint.one then 0 else num_bits - clz (Caml.Nativeint.pred i) ;; end include Pow2 let between t ~low ~high = low <= t && t <= high let clamp_unchecked t ~min ~max = if t < min then min else if t <= max then t else max let clamp_exn t ~min ~max = assert (min <= max); clamp_unchecked t ~min ~max ;; let clamp t ~min ~max = if min > max then Or_error.error_s (Sexp.message "clamp requires [min <= max]" [ "min", T.sexp_of_t min; "max", T.sexp_of_t max ]) else Ok (clamp_unchecked t ~min ~max) ;; let ( / ) = div let ( * ) = mul let ( - ) = sub let ( + ) = add let ( ~- ) = neg let incr r = r := !r + one let decr r = r := !r - one let of_nativeint t = t let of_nativeint_exn = of_nativeint let to_nativeint t = t let to_nativeint_exn = to_nativeint let popcount = Popcount.nativeint_popcount let of_int = Conv.int_to_nativeint let of_int_exn = of_int let to_int = Conv.nativeint_to_int let to_int_exn = Conv.nativeint_to_int_exn let to_int_trunc = Conv.nativeint_to_int_trunc let of_int32 = Conv.int32_to_nativeint let of_int32_exn = of_int32 let to_int32 = Conv.nativeint_to_int32 let to_int32_exn = Conv.nativeint_to_int32_exn let to_int32_trunc = Conv.nativeint_to_int32_trunc let of_int64 = Conv.int64_to_nativeint let of_int64_exn = Conv.int64_to_nativeint_exn let of_int64_trunc = Conv.int64_to_nativeint_trunc let to_int64 = Conv.nativeint_to_int64 let pow b e = of_int_exn (Int_math.Private.int_pow (to_int_exn b) (to_int_exn e)) let ( ** ) b e = pow b e module Pre_O = struct let ( + ) = ( + ) let ( - ) = ( - ) let ( * ) = ( * ) let ( / ) = ( / ) let ( ~- ) = ( ~- ) let ( ** ) = ( ** ) include (Nativeint_replace_polymorphic_compare : Comparisons.Infix with type t := t) let abs = abs let neg = neg let zero = zero let of_int_exn = of_int_exn end module O = struct include Pre_O include Int_math.Make (struct type nonrec t = t include Pre_O let rem = rem let to_float = to_float let of_float = of_float let of_string = T.of_string let to_string = T.to_string end) let ( land ) = bit_and let ( lor ) = bit_or let ( lxor ) = bit_xor let lnot = bit_not let ( lsl ) = shift_left let ( asr ) = shift_right let ( lsr ) = shift_right_logical end include O (* [Nativeint] and [Nativeint.O] agree value-wise *) (* Include type-specific [Replace_polymorphic_compare] at the end, after including functor application that could shadow its definitions. This is here so that efficient versions of the comparison functions are exported by this module. *) include Nativeint_replace_polymorphic_compare external bswap : t -> t = "%bswap_native"
warnings.ml
(* When you change this, you need to update: - the list 'description' at the bottom of this file - man/ocamlc.m *) type loc = { loc_start: Lexing.position; loc_end: Lexing.position; loc_ghost: bool; } type t = | Comment_start (* 1 *) | Comment_not_end (* 2 *) (*| Deprecated --> alert "deprecated" *) (* 3 *) | Fragile_match of string (* 4 *) | Partial_application (* 5 *) | Labels_omitted of string list (* 6 *) | Method_override of string list (* 7 *) | Partial_match of string (* 8 *) | Non_closed_record_pattern of string (* 9 *) | Statement_type (* 10 *) | Unused_match (* 11 *) | Unused_pat (* 12 *) | Instance_variable_override of string list (* 13 *) | Illegal_backslash (* 14 *) | Implicit_public_methods of string list (* 15 *) | Unerasable_optional_argument (* 16 *) | Undeclared_virtual_method of string (* 17 *) | Not_principal of string (* 18 *) | Without_principality of string (* 19 *) | Unused_argument (* 20 *) | Nonreturning_statement (* 21 *) | Preprocessor of string (* 22 *) | Useless_record_with (* 23 *) | Bad_module_name of string (* 24 *) | All_clauses_guarded (* 8, used to be 25 *) | Unused_var of string (* 26 *) | Unused_var_strict of string (* 27 *) | Wildcard_arg_to_constant_constr (* 28 *) | Eol_in_string (* 29 *) | Duplicate_definitions of string * string * string * string (*30 *) | Multiple_definition of string * string * string (* 31 *) | Unused_value_declaration of string (* 32 *) | Unused_open of string (* 33 *) | Unused_type_declaration of string (* 34 *) | Unused_for_index of string (* 35 *) | Unused_ancestor of string (* 36 *) | Unused_constructor of string * bool * bool (* 37 *) | Unused_extension of string * bool * bool * bool (* 38 *) | Unused_rec_flag (* 39 *) | Name_out_of_scope of string * string list * bool (* 40 *) | Ambiguous_name of string list * string list * bool * string (* 41 *) | Disambiguated_name of string (* 42 *) | Nonoptional_label of string (* 43 *) | Open_shadow_identifier of string * string (* 44 *) | Open_shadow_label_constructor of string * string (* 45 *) | Bad_env_variable of string * string (* 46 *) | Attribute_payload of string * string (* 47 *) | Eliminated_optional_arguments of string list (* 48 *) | No_cmi_file of string * string option (* 49 *) | Bad_docstring of bool (* 50 *) | Expect_tailcall (* 51 *) | Fragile_literal_pattern (* 52 *) | Misplaced_attribute of string (* 53 *) | Duplicated_attribute of string (* 54 *) | Inlining_impossible of string (* 55 *) | Unreachable_case (* 56 *) | Ambiguous_pattern of string list (* 57 *) | No_cmx_file of string (* 58 *) | Assignment_to_non_mutable_value (* 59 *) | Unused_module of string (* 60 *) | Unboxable_type_in_prim_decl of string (* 61 *) | Constraint_on_gadt (* 62 *) | Erroneous_printed_signature of string (* 63 *) | Unsafe_without_parsing (* 64 *) | Redefining_unit of string (* 65 *) | Unused_open_bang of string (* 66 *) ;; (* If you remove a warning, leave a hole in the numbering. NEVER change the numbers of existing warnings. If you add a new warning, add it at the end with a new number; do NOT reuse one of the holes. *) type alert = {kind:string; message:string; def:loc; use:loc} let number = function | Comment_start -> 1 | Comment_not_end -> 2 | Fragile_match _ -> 4 | Partial_application -> 5 | Labels_omitted _ -> 6 | Method_override _ -> 7 | Partial_match _ -> 8 | Non_closed_record_pattern _ -> 9 | Statement_type -> 10 | Unused_match -> 11 | Unused_pat -> 12 | Instance_variable_override _ -> 13 | Illegal_backslash -> 14 | Implicit_public_methods _ -> 15 | Unerasable_optional_argument -> 16 | Undeclared_virtual_method _ -> 17 | Not_principal _ -> 18 | Without_principality _ -> 19 | Unused_argument -> 20 | Nonreturning_statement -> 21 | Preprocessor _ -> 22 | Useless_record_with -> 23 | Bad_module_name _ -> 24 | All_clauses_guarded -> 8 (* used to be 25 *) | Unused_var _ -> 26 | Unused_var_strict _ -> 27 | Wildcard_arg_to_constant_constr -> 28 | Eol_in_string -> 29 | Duplicate_definitions _ -> 30 | Multiple_definition _ -> 31 | Unused_value_declaration _ -> 32 | Unused_open _ -> 33 | Unused_type_declaration _ -> 34 | Unused_for_index _ -> 35 | Unused_ancestor _ -> 36 | Unused_constructor _ -> 37 | Unused_extension _ -> 38 | Unused_rec_flag -> 39 | Name_out_of_scope _ -> 40 | Ambiguous_name _ -> 41 | Disambiguated_name _ -> 42 | Nonoptional_label _ -> 43 | Open_shadow_identifier _ -> 44 | Open_shadow_label_constructor _ -> 45 | Bad_env_variable _ -> 46 | Attribute_payload _ -> 47 | Eliminated_optional_arguments _ -> 48 | No_cmi_file _ -> 49 | Bad_docstring _ -> 50 | Expect_tailcall -> 51 | Fragile_literal_pattern -> 52 | Misplaced_attribute _ -> 53 | Duplicated_attribute _ -> 54 | Inlining_impossible _ -> 55 | Unreachable_case -> 56 | Ambiguous_pattern _ -> 57 | No_cmx_file _ -> 58 | Assignment_to_non_mutable_value -> 59 | Unused_module _ -> 60 | Unboxable_type_in_prim_decl _ -> 61 | Constraint_on_gadt -> 62 | Erroneous_printed_signature _ -> 63 | Unsafe_without_parsing -> 64 | Redefining_unit _ -> 65 | Unused_open_bang _ -> 66 ;; let last_warning_number = 66 ;; (* Must be the max number returned by the [number] function. *) let letter = function | 'a' -> let rec loop i = if i = 0 then [] else i :: loop (i - 1) in loop last_warning_number | 'b' -> [] | 'c' -> [1; 2] | 'd' -> [3] | 'e' -> [4] | 'f' -> [5] | 'g' -> [] | 'h' -> [] | 'i' -> [] | 'j' -> [] | 'k' -> [32; 33; 34; 35; 36; 37; 38; 39] | 'l' -> [6] | 'm' -> [7] | 'n' -> [] | 'o' -> [] | 'p' -> [8] | 'q' -> [] | 'r' -> [9] | 's' -> [10] | 't' -> [] | 'u' -> [11; 12] | 'v' -> [13] | 'w' -> [] | 'x' -> [14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 30] | 'y' -> [26] | 'z' -> [27] | _ -> assert false ;; type state = { active: bool array; error: bool array; alerts: (Misc.Stdlib.String.Set.t * bool); (* false:set complement *) alert_errors: (Misc.Stdlib.String.Set.t * bool); (* false:set complement *) } let current = ref { active = Array.make (last_warning_number + 1) true; error = Array.make (last_warning_number + 1) false; alerts = (Misc.Stdlib.String.Set.empty, false); (* all enabled *) alert_errors = (Misc.Stdlib.String.Set.empty, true); (* all soft *) } let disabled = ref false let without_warnings f = Misc.protect_refs [Misc.R(disabled, true)] f let backup () = !current let restore x = current := x let is_active x = not !disabled && (!current).active.(number x) let is_error x = not !disabled && (!current).error.(number x) let alert_is_active {kind; _} = not !disabled && let (set, pos) = (!current).alerts in Misc.Stdlib.String.Set.mem kind set = pos let alert_is_error {kind; _} = not !disabled && let (set, pos) = (!current).alert_errors in Misc.Stdlib.String.Set.mem kind set = pos let mk_lazy f = let state = backup () in lazy ( let prev = backup () in restore state; try let r = f () in restore prev; r with exn -> restore prev; raise exn ) let set_alert ~error ~enable s = let upd = match s with | "all" -> (Misc.Stdlib.String.Set.empty, not enable) | s -> let (set, pos) = if error then (!current).alert_errors else (!current).alerts in let f = if enable = pos then Misc.Stdlib.String.Set.add else Misc.Stdlib.String.Set.remove in (f s set, pos) in if error then current := {(!current) with alert_errors=upd} else current := {(!current) with alerts=upd} let parse_alert_option s = let n = String.length s in let id_char = function | 'a'..'z' | 'A'..'Z' | '_' | '\'' | '0'..'9' -> true | _ -> false in let rec parse_id i = if i < n && id_char s.[i] then parse_id (i + 1) else i in let rec scan i = if i = n then () else if i + 1 = n then raise (Arg.Bad "Ill-formed list of alert settings") else match s.[i], s.[i+1] with | '+', '+' -> id (set_alert ~error:true ~enable:true) (i + 2) | '+', _ -> id (set_alert ~error:false ~enable:true) (i + 1) | '-', '-' -> id (set_alert ~error:true ~enable:false) (i + 2) | '-', _ -> id (set_alert ~error:false ~enable:false) (i + 1) | '@', _ -> id (fun s -> set_alert ~error:true ~enable:true s; set_alert ~error:false ~enable:true s) (i + 1) | _ -> raise (Arg.Bad "Ill-formed list of alert settings") and id f i = let j = parse_id i in if j = i then raise (Arg.Bad "Ill-formed list of alert settings"); let id = String.sub s i (j - i) in f id; scan j in scan 0 let parse_opt error active errflag s = let flags = if errflag then error else active in let set i = if i = 3 then set_alert ~error:errflag ~enable:true "deprecated" else flags.(i) <- true in let clear i = if i = 3 then set_alert ~error:errflag ~enable:false "deprecated" else flags.(i) <- false in let set_all i = if i = 3 then begin set_alert ~error:false ~enable:true "deprecated"; set_alert ~error:true ~enable:true "deprecated" end else begin active.(i) <- true; error.(i) <- true end in let error () = raise (Arg.Bad "Ill-formed list of warnings") in let rec get_num n i = if i >= String.length s then i, n else match s.[i] with | '0'..'9' -> get_num (10 * n + Char.code s.[i] - Char.code '0') (i + 1) | _ -> i, n in let get_range i = let i, n1 = get_num 0 i in if i + 2 < String.length s && s.[i] = '.' && s.[i + 1] = '.' then let i, n2 = get_num 0 (i + 2) in if n2 < n1 then error (); i, n1, n2 else i, n1, n1 in let rec loop i = if i >= String.length s then () else match s.[i] with | 'A' .. 'Z' -> List.iter set (letter (Char.lowercase_ascii s.[i])); loop (i+1) | 'a' .. 'z' -> List.iter clear (letter s.[i]); loop (i+1) | '+' -> loop_letter_num set (i+1) | '-' -> loop_letter_num clear (i+1) | '@' -> loop_letter_num set_all (i+1) | _ -> error () and loop_letter_num myset i = if i >= String.length s then error () else match s.[i] with | '0' .. '9' -> let i, n1, n2 = get_range i in for n = n1 to min n2 last_warning_number do myset n done; loop i | 'A' .. 'Z' -> List.iter myset (letter (Char.lowercase_ascii s.[i])); loop (i+1) | 'a' .. 'z' -> List.iter myset (letter s.[i]); loop (i+1) | _ -> error () in loop 0 ;; let parse_options errflag s = let error = Array.copy (!current).error in let active = Array.copy (!current).active in parse_opt error active errflag s; current := {(!current) with error; active} (* If you change these, don't forget to change them in man/ocamlc.m *) let defaults_w = "+a-4-6-7-9-27-29-32..42-44-45-48-50-60-66";; let defaults_warn_error = "-a+31";; let () = parse_options false defaults_w;; let () = parse_options true defaults_warn_error;; let ref_manual_explanation () = (* manual references are checked a posteriori by the manual cross-reference consistency check in manual/tests*) let[@manual.ref "s:comp-warnings"] chapter, section = 9, 5 in Printf.sprintf "(See manual section %d.%d)" chapter section let message = function | Comment_start -> "this `(*' is the start of a comment.\n\ Hint: Did you forget spaces when writing the infix operator `( * )'?" | Comment_not_end -> "this is not the end of a comment." | Fragile_match "" -> "this pattern-matching is fragile." | Fragile_match s -> "this pattern-matching is fragile.\n\ It will remain exhaustive when constructors are added to type " ^ s ^ "." | Partial_application -> "this function application is partial,\n\ maybe some arguments are missing." | Labels_omitted [] -> assert false | Labels_omitted [l] -> "label " ^ l ^ " was omitted in the application of this function." | Labels_omitted ls -> "labels " ^ String.concat ", " ls ^ " were omitted in the application of this function." | Method_override [lab] -> "the method " ^ lab ^ " is overridden." | Method_override (cname :: slist) -> String.concat " " ("the following methods are overridden by the class" :: cname :: ":\n " :: slist) | Method_override [] -> assert false | Partial_match "" -> "this pattern-matching is not exhaustive." | Partial_match s -> "this pattern-matching is not exhaustive.\n\ Here is an example of a case that is not matched:\n" ^ s | Non_closed_record_pattern s -> "the following labels are not bound in this record pattern:\n" ^ s ^ "\nEither bind these labels explicitly or add '; _' to the pattern." | Statement_type -> "this expression should have type unit." | Unused_match -> "this match case is unused." | Unused_pat -> "this sub-pattern is unused." | Instance_variable_override [lab] -> "the instance variable " ^ lab ^ " is overridden.\n" ^ "The behaviour changed in ocaml 3.10 (previous behaviour was hiding.)" | Instance_variable_override (cname :: slist) -> String.concat " " ("the following instance variables are overridden by the class" :: cname :: ":\n " :: slist) ^ "\nThe behaviour changed in ocaml 3.10 (previous behaviour was hiding.)" | Instance_variable_override [] -> assert false | Illegal_backslash -> "illegal backslash escape in string." | Implicit_public_methods l -> "the following private methods were made public implicitly:\n " ^ String.concat " " l ^ "." | Unerasable_optional_argument -> "this optional argument cannot be erased." | Undeclared_virtual_method m -> "the virtual method "^m^" is not declared." | Not_principal s -> s^" is not principal." | Without_principality s -> s^" without principality." | Unused_argument -> "this argument will not be used by the function." | Nonreturning_statement -> "this statement never returns (or has an unsound type.)" | Preprocessor s -> s | Useless_record_with -> "all the fields are explicitly listed in this record:\n\ the 'with' clause is useless." | Bad_module_name (modname) -> "bad source file name: \"" ^ modname ^ "\" is not a valid module name." | All_clauses_guarded -> "this pattern-matching is not exhaustive.\n\ All clauses in this pattern-matching are guarded." | Unused_var v | Unused_var_strict v -> "unused variable " ^ v ^ "." | Wildcard_arg_to_constant_constr -> "wildcard pattern given as argument to a constant constructor" | Eol_in_string -> "unescaped end-of-line in a string constant (non-portable code)" | Duplicate_definitions (kind, cname, tc1, tc2) -> Printf.sprintf "the %s %s is defined in both types %s and %s." kind cname tc1 tc2 | Multiple_definition(modname, file1, file2) -> Printf.sprintf "files %s and %s both define a module named %s" file1 file2 modname | Unused_value_declaration v -> "unused value " ^ v ^ "." | Unused_open s -> "unused open " ^ s ^ "." | Unused_open_bang s -> "unused open! " ^ s ^ "." | Unused_type_declaration s -> "unused type " ^ s ^ "." | Unused_for_index s -> "unused for-loop index " ^ s ^ "." | Unused_ancestor s -> "unused ancestor variable " ^ s ^ "." | Unused_constructor (s, false, false) -> "unused constructor " ^ s ^ "." | Unused_constructor (s, true, _) -> "constructor " ^ s ^ " is never used to build values.\n\ (However, this constructor appears in patterns.)" | Unused_constructor (s, false, true) -> "constructor " ^ s ^ " is never used to build values.\n\ Its type is exported as a private type." | Unused_extension (s, is_exception, cu_pattern, cu_privatize) -> let kind = if is_exception then "exception" else "extension constructor" in let name = kind ^ " " ^ s in begin match cu_pattern, cu_privatize with | false, false -> "unused " ^ name | true, _ -> name ^ " is never used to build values.\n\ (However, this constructor appears in patterns.)" | false, true -> name ^ " is never used to build values.\n\ It is exported or rebound as a private extension." end | Unused_rec_flag -> "unused rec flag." | Name_out_of_scope (ty, [nm], false) -> nm ^ " was selected from type " ^ ty ^ ".\nIt is not visible in the current scope, and will not \n\ be selected if the type becomes unknown." | Name_out_of_scope (_, _, false) -> assert false | Name_out_of_scope (ty, slist, true) -> "this record of type "^ ty ^" contains fields that are \n\ not visible in the current scope: " ^ String.concat " " slist ^ ".\n\ They will not be selected if the type becomes unknown." | Ambiguous_name ([s], tl, false, expansion) -> s ^ " belongs to several types: " ^ String.concat " " tl ^ "\nThe first one was selected. Please disambiguate if this is wrong." ^ expansion | Ambiguous_name (_, _, false, _ ) -> assert false | Ambiguous_name (_slist, tl, true, expansion) -> "these field labels belong to several types: " ^ String.concat " " tl ^ "\nThe first one was selected. Please disambiguate if this is wrong." ^ expansion | Disambiguated_name s -> "this use of " ^ s ^ " relies on type-directed disambiguation,\n\ it will not compile with OCaml 4.00 or earlier." | Nonoptional_label s -> "the label " ^ s ^ " is not optional." | Open_shadow_identifier (kind, s) -> Printf.sprintf "this open statement shadows the %s identifier %s (which is later used)" kind s | Open_shadow_label_constructor (kind, s) -> Printf.sprintf "this open statement shadows the %s %s (which is later used)" kind s | Bad_env_variable (var, s) -> Printf.sprintf "illegal environment variable %s : %s" var s | Attribute_payload (a, s) -> Printf.sprintf "illegal payload for attribute '%s'.\n%s" a s | Eliminated_optional_arguments sl -> Printf.sprintf "implicit elimination of optional argument%s %s" (if List.length sl = 1 then "" else "s") (String.concat ", " sl) | No_cmi_file(name, None) -> "no cmi file was found in path for module " ^ name | No_cmi_file(name, Some msg) -> Printf.sprintf "no valid cmi file was found in path for module %s. %s" name msg | Bad_docstring unattached -> if unattached then "unattached documentation comment (ignored)" else "ambiguous documentation comment" | Expect_tailcall -> Printf.sprintf "expected tailcall" | Fragile_literal_pattern -> Printf.sprintf "Code should not depend on the actual values of\n\ this constructor's arguments. They are only for information\n\ and may change in future versions. %t" ref_manual_explanation | Unreachable_case -> "this match case is unreachable.\n\ Consider replacing it with a refutation case '<pat> -> .'" | Misplaced_attribute attr_name -> Printf.sprintf "the %S attribute cannot appear in this context" attr_name | Duplicated_attribute attr_name -> Printf.sprintf "the %S attribute is used more than once on this \ expression" attr_name | Inlining_impossible reason -> Printf.sprintf "Cannot inline: %s" reason | Ambiguous_pattern vars -> let msg = let vars = List.sort String.compare vars in match vars with | [] -> assert false | [x] -> "variable " ^ x | _::_ -> "variables " ^ String.concat "," vars in Printf.sprintf "Ambiguous or-pattern variables under guard;\n\ %s may match different arguments. %t" msg ref_manual_explanation | No_cmx_file name -> Printf.sprintf "no cmx file was found in path for module %s, \ and its interface was not compiled with -opaque" name | Assignment_to_non_mutable_value -> "A potential assignment to a non-mutable value was detected \n\ in this source file. Such assignments may generate incorrect code \n\ when using Flambda." | Unused_module s -> "unused module " ^ s ^ "." | Unboxable_type_in_prim_decl t -> Printf.sprintf "This primitive declaration uses type %s, which is unannotated and\n\ unboxable. The representation of such types may change in future\n\ versions. You should annotate the declaration of %s with [@@boxed]\n\ or [@@unboxed]." t t | Constraint_on_gadt -> "Type constraints do not apply to GADT cases of variant types." | Erroneous_printed_signature s -> "The printed interface differs from the inferred interface.\n\ The inferred interface contained items which could not be printed\n\ properly due to name collisions between identifiers." ^ s ^ "\nBeware that this warning is purely informational and will not catch\n\ all instances of erroneous printed interface." | Unsafe_without_parsing -> "option -unsafe used with a preprocessor returning a syntax tree" | Redefining_unit name -> Printf.sprintf "This type declaration is defining a new '()' constructor\n\ which shadows the existing one.\n\ Hint: Did you mean 'type %s = unit'?" name ;; let nerrors = ref 0;; type reporting_information = { id : string ; message : string ; is_error : bool ; sub_locs : (loc * string) list; } let report w = match is_active w with | false -> `Inactive | true -> if is_error w then incr nerrors; `Active { id = string_of_int (number w); message = message w; is_error = is_error w; sub_locs = []; } let report_alert (alert : alert) = match alert_is_active alert with | false -> `Inactive | true -> let is_error = alert_is_error alert in if is_error then incr nerrors; let message = Misc.normalise_eol alert.message in (* Reduce \r\n to \n: - Prevents any \r characters being printed on Unix when processing Windows sources - Prevents \r\r\n being generated on Windows, which affects the testsuite *) let sub_locs = if not alert.def.loc_ghost && not alert.use.loc_ghost then [ alert.def, "Definition"; alert.use, "Expected signature"; ] else [] in `Active { id = alert.kind; message; is_error; sub_locs; } exception Errors;; let reset_fatal () = nerrors := 0 let check_fatal () = if !nerrors > 0 then begin nerrors := 0; raise Errors; end; ;; let descriptions = [ 1, "Suspicious-looking start-of-comment mark."; 2, "Suspicious-looking end-of-comment mark."; 3, "Deprecated synonym for the 'deprecated' alert"; 4, "Fragile pattern matching: matching that will remain complete even\n\ \ if additional constructors are added to one of the variant types\n\ \ matched."; 5, "Partially applied function: expression whose result has function\n\ \ type and is ignored."; 6, "Label omitted in function application."; 7, "Method overridden."; 8, "Partial match: missing cases in pattern-matching."; 9, "Missing fields in a record pattern."; 10, "Expression on the left-hand side of a sequence that doesn't have \ type\n\ \ \"unit\" (and that is not a function, see warning number 5)."; 11, "Redundant case in a pattern matching (unused match case)."; 12, "Redundant sub-pattern in a pattern-matching."; 13, "Instance variable overridden."; 14, "Illegal backslash escape in a string constant."; 15, "Private method made public implicitly."; 16, "Unerasable optional argument."; 17, "Undeclared virtual method."; 18, "Non-principal type."; 19, "Type without principality."; 20, "Unused function argument."; 21, "Non-returning statement."; 22, "Preprocessor warning."; 23, "Useless record \"with\" clause."; 24, "Bad module name: the source file name is not a valid OCaml module \ name."; 25, "Deprecated: now part of warning 8."; 26, "Suspicious unused variable: unused variable that is bound\n\ \ with \"let\" or \"as\", and doesn't start with an underscore (\"_\")\n\ \ character."; 27, "Innocuous unused variable: unused variable that is not bound with\n\ \ \"let\" nor \"as\", and doesn't start with an underscore (\"_\")\n\ \ character."; 28, "Wildcard pattern given as argument to a constant constructor."; 29, "Unescaped end-of-line in a string constant (non-portable code)."; 30, "Two labels or constructors of the same name are defined in two\n\ \ mutually recursive types."; 31, "A module is linked twice in the same executable."; 32, "Unused value declaration."; 33, "Unused open statement."; 34, "Unused type declaration."; 35, "Unused for-loop index."; 36, "Unused ancestor variable."; 37, "Unused constructor."; 38, "Unused extension constructor."; 39, "Unused rec flag."; 40, "Constructor or label name used out of scope."; 41, "Ambiguous constructor or label name."; 42, "Disambiguated constructor or label name (compatibility warning)."; 43, "Nonoptional label applied as optional."; 44, "Open statement shadows an already defined identifier."; 45, "Open statement shadows an already defined label or constructor."; 46, "Error in environment variable."; 47, "Illegal attribute payload."; 48, "Implicit elimination of optional arguments."; 49, "Absent cmi file when looking up module alias."; 50, "Unexpected documentation comment."; 51, "Warning on non-tail calls if @tailcall present."; 52, "Fragile constant pattern."; 53, "Attribute cannot appear in this context"; 54, "Attribute used more than once on an expression"; 55, "Inlining impossible"; 56, "Unreachable case in a pattern-matching (based on type information)."; 57, "Ambiguous or-pattern variables under guard"; 58, "Missing cmx file"; 59, "Assignment to non-mutable value"; 60, "Unused module declaration"; 61, "Unboxable type in primitive declaration"; 62, "Type constraint on GADT type declaration"; 63, "Erroneous printed signature"; 64, "-unsafe used with a preprocessor returning a syntax tree"; 65, "Type declaration defining a new '()' constructor"; 66, "Unused open! statement"; ] ;; let help_warnings () = List.iter (fun (i, s) -> Printf.printf "%3i %s\n" i s) descriptions; print_endline " A all warnings"; for i = Char.code 'b' to Char.code 'z' do let c = Char.chr i in match letter c with | [] -> () | [n] -> Printf.printf " %c Alias for warning %i.\n" (Char.uppercase_ascii c) n | l -> Printf.printf " %c warnings %s.\n" (Char.uppercase_ascii c) (String.concat ", " (List.map Int.to_string l)) done; exit 0 ;;
(**************************************************************************) (* *) (* OCaml *) (* *) (* Pierre Weis && Damien Doligez, INRIA Rocquencourt *) (* *) (* Copyright 1998 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************)
gamma_upper_sum_rs.c
#include "arb_hypgeom.h" static slong asymp_prec(slong k, double logdz, slong prec) { double gain; if (prec <= 128) return prec; if (k <= 5) return prec; gain = (k * logdz - (k * (log(k) - 1.0))) * 1.4426950408889634 - 4; gain = FLINT_MAX(gain, 0); prec = prec - gain; prec = FLINT_MAX(prec, 32); return prec; } void _arb_hypgeom_gamma_upper_sum_rs_1(arb_t res, ulong p, ulong q, const arb_t z, slong N, slong prec) { slong m, i, j, k, jlen, jbot, jtop, wp; double dz, logdz; mp_limb_t c, chi, clo; arb_t s, t; arb_ptr zpow; mp_ptr cs; m = n_sqrt(N); m = FLINT_MAX(m, 2); k = N - 1; j = k % m; jlen = 0; jbot = j; if (arf_cmpabs_2exp_si(arb_midref(z), prec) >= 0) { logdz = ARF_EXP(arb_midref(z)) * log(2); } else if (arf_cmpabs_2exp_si(arb_midref(z), -32) >= 0) { dz = arf_get_d(arb_midref(z), ARF_RND_UP); dz = fabs(dz); logdz = log(dz); } else if (arf_cmpabs_2exp_si(arb_midref(z), -prec) <= 0) { logdz = -prec * log(2); } else { logdz = ARF_EXP(arb_midref(z)) * log(2); } arb_init(s); arb_init(t); zpow = _arb_vec_init(m + 1); cs = flint_malloc(sizeof(mp_limb_t) * (m + 1)); arb_mul_ui(zpow + m, z, q, prec); arb_inv(zpow + m, zpow + m, prec); _arb_vec_set_powers(zpow, zpow + m, m + 1, prec); while (k >= 0) { /* Find run of coefficients whose product fits in a limb */ jlen = 1; jtop = jbot = k; if (jtop > 0) { c = p + q * (jtop - 1); while (jlen <= j) { if (jbot >= 2) { umul_ppmm(chi, clo, c, p + q * (jbot - 2)); if (chi != 0) break; c = clo; } jbot--; jlen++; } } if (jbot != jtop - jlen + 1) abort(); /* Factors between jbot and jtop inclusive */ if (jbot == 0) cs[0] = 1; else cs[0] = p + q * (jbot - 1); for (i = 1; i < jlen; i++) cs[i] = cs[i - 1] * (p + q * (jbot + i - 1)); wp = asymp_prec(k - jlen, logdz, prec); /* todo: special case jlen == 1 */ arb_add(t, s, zpow + j, wp); arb_swap(zpow + j, t); arb_dot_ui(s, NULL, 0, zpow + j - jlen + 1, 1, cs, 1, jlen, wp); arb_swap(zpow + j, t); k -= jlen; j -= (jlen - 1); if (j == 0 && k >= 1) { arb_mul(s, s, zpow + m, wp); j = m - 1; } else { j--; } } arb_swap(res, s); _arb_vec_clear(zpow, m + 1); arb_clear(s); arb_clear(t); flint_free(cs); }
/* Copyright (C) 2021 Fredrik Johansson This file is part of Arb. Arb is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */
pow_multinomial.c
#include <stdlib.h> #include <gmp.h> #include "flint.h" #include "fmpz.h" #include "fmpz_vec.h" #include "fmpz_poly.h" void _fmpz_poly_pow_multinomial(fmpz * res, const fmpz * poly, slong len, ulong e) { slong k, low, rlen; fmpz_t d, t; fmpz * P; rlen = (slong) e * (len - WORD(1)) + WORD(1); _fmpz_vec_zero(res, rlen); for (low = WORD(0); poly[low] == WORD(0); low++) ; if (low == WORD(0)) { P = (fmpz *) poly; } else { P = (fmpz *) poly + low; len -= low; res += (slong) e * low; rlen -= (slong) e * low; } fmpz_init(d); fmpz_init(t); fmpz_pow_ui(res, P, e); for (k = 1; k < rlen; k++) { slong i, u = -k; for (i = 1; i <= FLINT_MIN(k, len - 1); i++) { fmpz_mul(t, P + i, res + (k - i)); u += (slong) e + 1; if (u >= 0) fmpz_addmul_ui(res + k, t, (ulong) u); else fmpz_submul_ui(res + k, t, - ((ulong) u)); } fmpz_add(d, d, P); fmpz_divexact(res + k, res + k, d); } fmpz_clear(d); fmpz_clear(t); } void fmpz_poly_pow_multinomial(fmpz_poly_t res, const fmpz_poly_t poly, ulong e) { const slong len = poly->length; slong rlen; if ((len < 2) | (e < UWORD(3))) { if (e == UWORD(0)) fmpz_poly_set_ui(res, 1); else if (len == 0) fmpz_poly_zero(res); else if (len == 1) { fmpz_poly_fit_length(res, 1); fmpz_pow_ui(res->coeffs, poly->coeffs, e); _fmpz_poly_set_length(res, 1); } else if (e == UWORD(1)) fmpz_poly_set(res, poly); else /* e == UWORD(2) */ fmpz_poly_sqr(res, poly); return; } rlen = (slong) e * (len - 1) + 1; if (res != poly) { fmpz_poly_fit_length(res, rlen); _fmpz_poly_pow_multinomial(res->coeffs, poly->coeffs, len, e); _fmpz_poly_set_length(res, rlen); } else { fmpz_poly_t t; fmpz_poly_init2(t, rlen); _fmpz_poly_pow_multinomial(t->coeffs, poly->coeffs, len, e); _fmpz_poly_set_length(t, rlen); fmpz_poly_swap(res, t); fmpz_poly_clear(t); } }
/* Copyright (C) 2010 Sebastian Pancratz This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */
import.ml
open! Core
tuple.mli
module T2 : sig type ('a, 'b) t = 'a * 'b val to_dyn : ('a -> Dyn.t) -> ('b -> Dyn.t) -> ('a, 'b) t -> Dyn.t val hash : ('a -> int) -> ('b -> int) -> ('a, 'b) t -> int val equal : ('a -> 'a -> bool) -> ('b -> 'b -> bool) -> ('a, 'b) t -> ('a, 'b) t -> bool val compare : ('a -> 'a -> Ordering.t) -> ('b -> 'b -> Ordering.t) -> ('a, 'b) t -> ('a, 'b) t -> Ordering.t val swap : 'a * 'b -> 'b * 'a end module T3 : sig type ('a, 'b, 'c) t = 'a * 'b * 'c val to_dyn : ('a -> Dyn.t) -> ('b -> Dyn.t) -> ('c -> Dyn.t) -> ('a, 'b, 'c) t -> Dyn.t val hash : ('a -> int) -> ('b -> int) -> ('c -> int) -> ('a, 'b, 'c) t -> int val equal : ('a -> 'a -> bool) -> ('b -> 'b -> bool) -> ('c -> 'c -> bool) -> ('a, 'b, 'c) t -> ('a, 'b, 'c) t -> bool end
lib_config.ml
open Import type t = { has_native : bool ; ext_lib : string ; ext_obj : string ; os_type : Ocaml_config.Os_type.t ; architecture : string ; system : string ; model : string ; natdynlink_supported : Dynlink_supported.By_the_os.t ; ext_dll : string ; stdlib_dir : Path.t ; ccomp_type : Ocaml_config.Ccomp_type.t ; profile : Profile.t ; ocaml_version_string : string ; ocaml_version : Ocaml.Version.t ; instrument_with : Lib_name.t list ; context_name : Context_name.t } let allowed_in_enabled_if = [ ("architecture", (1, 0)) ; ("system", (1, 0)) ; ("model", (1, 0)) ; ("os_type", (1, 0)) ; ("ccomp_type", (2, 0)) ; ("profile", (2, 5)) ; ("ocaml_version", (2, 5)) ; ("context_name", (2, 8)) ] let get_for_enabled_if t (pform : Pform.t) = match pform with | Var Architecture -> t.architecture | Var System -> t.system | Var Model -> t.model | Var Os_type -> Ocaml_config.Os_type.to_string t.os_type | Var Ccomp_type -> Ocaml_config.Ccomp_type.to_string t.ccomp_type | Var Profile -> Profile.to_string t.profile | Var Ocaml_version -> t.ocaml_version_string | Var Context_name -> Context_name.to_string t.context_name | _ -> Code_error.raise "Lib_config.get_for_enabled_if: var not allowed" [ ("var", Pform.to_dyn pform) ] let linker_can_create_empty_archives t = match t.ccomp_type with | Msvc -> false | Other _ -> true let hash = Poly.hash let equal = Poly.equal let to_dyn = Dyn.opaque
gradient.h
#ifndef __GRADIENT_H #define __GRADIENT_H #include <stdbool.h> #include "object.h" #include "color.h" #include "transform.h" typedef struct gradient_t gradient_t; DECLARE_OBJECT_METHODS(gradient_t, gradient) gradient_t * gradient_create_linear( double pos1_x, double pos1_y, double pos2_x, double pos2_y); gradient_t * gradient_create_radial( double center1_x, double center1_y, double rad1, double center2_x, double center2_y, double rad2); gradient_t * gradient_create_conic( double center_x, double center_y, double angle); bool gradient_add_color_stop( gradient_t *gradient, color_t_ color, double pos); color_t_ gradient_evaluate_pos( const gradient_t *gradient, double pos_x, double pos_y, const transform_t *inverse); void gradient_set_destroy_callback( void (*callback_function)(gradient_t *)); #endif /* __GRADIENT_H */
/**************************************************************************/ /* */ /* Copyright 2022 OCamlPro */ /* */ /* All rights reserved. This file is distributed under the terms of the */ /* GNU Lesser General Public License version 2.1, with the special */ /* exception on linking described in the file LICENSE. */ /* */ /**************************************************************************/
int_array_sort2.c
/* * SORT AN INTEGER ARRAY WITH A USER-SUPPLIED ORDERING */ #include "utils/int_array_sort2.h" #include "utils/prng.h" static void qsort_int_array2(int32_t *a, uint32_t n, void *data, int_cmp_fun_t cmp); // insertion sort static void isort_int_array2(int32_t *a, uint32_t n, void *data, int_cmp_fun_t cmp) { uint32_t i, j; int32_t x, y; for (i=1; i<n; i++) { x = a[i]; j = 0; while (cmp(data, a[j], x)) j ++; // while (a[j] < x) j++; while (j < i) { y = a[j]; a[j] = x; x = y; j ++; } a[j] = x; } } static inline void sort_array2(int32_t *a, uint32_t n, void *data, int_cmp_fun_t cmp) { if (n < 10) { isort_int_array2(a, n, data, cmp); } else { qsort_int_array2(a, n, data, cmp); } } // quick sort: requires n > 1 static void qsort_int_array2(int32_t *a, uint32_t n, void *data, int_cmp_fun_t cmp) { uint32_t i, j; int32_t x, y; // x = random pivot i = random_uint(n); x = a[i]; // swap x and a[0] a[i] = a[0]; a[0] = x; i = 0; j = n; do { j--; } while (cmp(data, x, a[j])); // do { j--; } while (x < a[j]); do { i++; } while (i <= j && cmp(data, a[i], x)); // do { i++; } while (a[i] < x); while (i < j) { y = a[i]; a[i] = a[j]; a[j] = y; do { j--; } while (cmp(data, x, a[j])); // do { j--; } while (x < a[j]); do { i++; } while (cmp(data, a[i], x)); // do { j++; } while (a[i] < x); } // the pivot goes into a[j] a[0] = a[j]; a[j] = x; // sort a[0...j-1] and a[j+1 .. n-1] sort_array2(a, j, data, cmp); j++; sort_array2(a + j, n - j, data, cmp); } /* * External call */ void int_array_sort2(int32_t *a, uint32_t n, void *data, int_cmp_fun_t cmp) { sort_array2(a, n, data, cmp); }
/* * The Yices SMT Solver. Copyright 2014 SRI International. * * This program may only be used subject to the noncommercial end user * license agreement which is downloadable along with this program. */
t-mul_fmpz.c
#include <stdio.h> #include <stdlib.h> #include <gmp.h> #include "flint.h" #include "fmpz.h" #include "fmpq.h" int main(void) { int i, result; FLINT_TEST_INIT(state); flint_printf("mul_fmpz...."); fflush(stdout); /* Aliasing x = x*z */ for (i = 0; i < 10000; i++) { fmpq_t x, y; fmpz_t z; fmpq_init(x); fmpq_init(y); fmpz_init(z); fmpq_randtest(x, state, 200); fmpz_randtest(z, state, 200); fmpq_mul_fmpz(y, x, z); fmpq_mul_fmpz(x, x, z); result = (fmpq_is_canonical(x) && fmpq_is_canonical(y) && fmpq_equal(x, y)); if (!result) { flint_printf("FAIL (alias):\n"); flint_printf("x = "), fmpq_print(x), flint_printf("\n"); flint_printf("y = "), fmpq_print(y), flint_printf("\n"); flint_printf("z = "), fmpz_print(z), flint_printf("\n"); fflush(stdout); flint_abort(); } fmpq_clear(x); fmpq_clear(y); fmpz_clear(z); } /* Compare with fmpq_mul */ for (i = 0; i < 10000; i++) { fmpq_t x, y, z; fmpq_init(x); fmpq_init(y); fmpq_init(z); fmpq_randtest(x, state, 200); fmpz_randtest(fmpq_numref(z), state, 200); fmpq_mul_fmpz(y, x, fmpq_numref(z)); fmpq_mul(x, x, z); result = (fmpq_is_canonical(x) && fmpq_is_canonical(y) && fmpq_equal(x, y)); if (!result) { flint_printf("FAIL (cmp):\n"); flint_printf("x = "), fmpq_print(x), flint_printf("\n"); flint_printf("y = "), fmpq_print(y), flint_printf("\n"); flint_printf("z = "), fmpq_print(z), flint_printf("\n"); fflush(stdout); flint_abort(); } fmpq_clear(x); fmpq_clear(y); fmpq_clear(z); } FLINT_TEST_CLEANUP(state); flint_printf("PASS\n"); return EXIT_SUCCESS; }
/* Copyright (C) 2011 Sebastian Pancratz This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */
measure.ml
type time = float let get_time = Sys.time let time f = let open Lwt_syntax in let before = get_time () in let* res = f () in let time = get_time () -. before in return (time, res) let time_and_tick get_tick f arg = let open Lwt_syntax in let* before_tick = get_tick arg in let* time, res = time (fun () -> f arg) in let* after_tick = get_tick res in return (time, Z.(after_tick - before_tick), res) let zero = 0.0 let to_seconds t = t
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2022 Marigold <contact@marigold.dev> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************)
dune
(library (libraries fmlib js_of_ocaml js_of_ocaml-ppx) ;(js_of_ocaml ; (flags (--disable genprim ; --disable=debugger))) (preprocess (pps js_of_ocaml-ppx)) (public_name alba.fmlib_js) (name fmlib_js))
unity_zp_sqr5.c
#include "aprcl.h" /* Computes f = g * g for p = 5. g must be reduced by F_5 cyclotomic polynomial. t is the memory for fmpz_t; size of t must be > 14. Resulting f reduced by F_5 cyclotomic polynomial. */ void unity_zp_sqr5(unity_zp f, const unity_zp g, fmpz_t * t) { /* g = (x0, x1, x2, x3); f = (y0, y1, y2, y3); x0 = t[0]; x1 = t[1]; x2 = t[2]; x3 = t[3]; m1 = t[4]; m2 = t[5]; m3 = t[6]; m4 = t[7]; m5 = t[8]; m6 = t[9]; m7 = t[10]; m8 = t[11]; d1 = t[12]; d2 = t[13]; d3 = t[14]; d4 = t[15]. */ /* set xi */ fmpz_mod_poly_get_coeff_fmpz(t[0], g->poly, 0, g->ctx); fmpz_mod_poly_get_coeff_fmpz(t[1], g->poly, 1, g->ctx); fmpz_mod_poly_get_coeff_fmpz(t[2], g->poly, 2, g->ctx); fmpz_mod_poly_get_coeff_fmpz(t[3], g->poly, 3, g->ctx); fmpz_sub(t[4], t[0], t[2]); /* m1 = x0 - x2 */ fmpz_add(t[5], t[0], t[2]); /* m2 = x0 + x2 */ fmpz_sub(t[6], t[2], t[1]); /* m3 = x2 - x1 */ fmpz_sub(t[7], t[0], t[3]); /* m4 = x0 - x3 */ fmpz_sub(t[8], t[1], t[0]); /* m5 = x1 - x0 */ fmpz_sub(t[9], t[2], t[3]); /* m6 = x2 - x3 */ fmpz_sub(t[10], t[1], t[3]); /* m7 = x1 - x3 */ fmpz_add(t[11], t[3], t[3]); /* m8 = x3 + x3 */ fmpz_mul(t[12], t[4], t[5]); /* d1 = m1 * m2 */ fmpz_mul(t[13], t[6], t[11]); /* d2 = m3 * m8 */ fmpz_add(t[14], t[12], t[13]); /* d3 = d1 + d2 */ unity_zp_coeff_set_fmpz(f, 0, t[14]); /* y0 = d3 mod n */ fmpz_add(t[11], t[8], t[10]); /* m8 = m5 + m7 */ fmpz_mul(t[13], t[7], t[11]); /* d2 = m4 * m8 */ fmpz_add(t[15], t[12], t[13]); /* d4 = d1 + d2 */ unity_zp_coeff_set_fmpz(f, 1, t[15]); /* y1 = d4 mod n */ fmpz_add(t[6], t[4], t[0]); /* m3 = m1 + x0 */ fmpz_mul(t[12], t[2], t[6]); /* d1 = x2 * m3 */ fmpz_sub(t[5], t[10], t[3]); /* m2 = m7 - x3 */ fmpz_mul(t[13], t[5], t[1]); /* d2 = m2 * x1 */ fmpz_add(t[14], t[12], t[13]); /* d3 = d1 + d2 */ unity_zp_coeff_set_fmpz(f, 2, t[14]); /* y2 = d3 mod n */ fmpz_add(t[10], t[9], t[9]); /* m7 = m6 + m6 */ fmpz_mul(t[13], t[10], t[8]); /* d2 = m7 * m5 */ fmpz_add(t[14], t[12], t[13]); /* d3 = d1 + d2 */ unity_zp_coeff_set_fmpz(f, 3, t[14]); /* y3 = d3 mod n */ }
/* Copyright (C) 2015 Vladimir Glazachev This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */
feed.ml
(** Parsing feeds *) open Support open Support.Common module Q = Support.Qdom module U = Support.Utils open Constants module AttrMap = Support.Qdom.AttrMap type t = { url : Feed_url.non_distro_feed; root : [`Feed] Element.t; name : string; implementations : 'a. ([> `Cache_impl of Impl.cache_impl | `Local_impl of filepath] as 'a) Impl.t XString.Map.t; imported_feeds : Feed_import.t list; (* The URI of the interface that replaced the one with the URI of this feed's URL. This is the value of the feed's <replaced-by interface'...'/> element. *) replacement : string option; package_implementations : ([`Package_impl] Element.t * Impl.properties) list; } let create_impl system ~local_dir state node = let open Impl in let s = ref state in let set_attr name value = let new_attrs = AttrMap.add_no_ns name value !s.Impl.attrs in s := {!s with Impl.attrs = new_attrs} in let get_required_attr name = AttrMap.get_no_ns name !s.attrs |? lazy (Element.raise_elem "Missing attribute '%s' on" name node) in let id = Element.id node in let () = match local_dir with | None -> if AttrMap.mem ("", FeedAttr.local_path) !s.attrs then Element.raise_elem "local-path in non-local feed! " node; | Some dir -> let use rel_path = if Filename.is_relative rel_path then set_attr FeedAttr.local_path @@ Support.Utils.abspath system @@ dir +/ rel_path else set_attr FeedAttr.local_path rel_path in match AttrMap.get_no_ns FeedAttr.local_path !s.attrs with | Some path -> use path | None -> if XString.starts_with id "/" || XString.starts_with id "." then use id in (* version-modifier *) AttrMap.get_no_ns FeedAttr.version_modifier !s.attrs |> if_some (fun modifier -> let real_version = get_required_attr FeedAttr.version ^ modifier in let new_attrs = AttrMap.add_no_ns FeedAttr.version real_version (AttrMap.remove ("", FeedAttr.version_modifier) !s.attrs) in s := {!s with attrs = new_attrs} ); let get_prop key = AttrMap.get_no_ns key !s.attrs |? lazy (Element.raise_elem "Missing attribute '%s' on" key node) in let (os, machine) = try Arch.parse_arch @@ default "*-*" @@ AttrMap.get_no_ns "arch" !s.attrs with Safe_exn.T _ as ex -> Safe_exn.reraise_with ex "... processing %a" Element.pp node in let stability = match AttrMap.get_no_ns FeedAttr.stability !s.attrs with | None -> Stability.Testing | Some s -> Stability.of_string ~from_user:false s in let impl_type = match AttrMap.get_no_ns FeedAttr.local_path !s.attrs with | Some local_path -> assert (local_dir <> None); `Local_impl local_path | None -> let retrieval_methods = Element.retrieval_methods node in `Cache_impl { digests = Stores.get_digests node; retrieval_methods; } in let impl = Impl.make ~elem:node ~props:{!s with requires = List.rev !s.requires} ~os ~machine ~stability ~version:(Version.parse (get_prop FeedAttr.version)) impl_type in (id, impl) let process_group_properties ~local_dir state item = let open Impl in let s = ref state in (* We've found a group or implementation. Scan for dependencies, bindings and commands. Doing this here means that: - We can share the code for groups and implementations here. - The order doesn't matter, because these get processed first. A side-effect is that the document root cannot contain these. *) (* Upgrade main='...' to <command name='run' path='...'> etc *) let add_command ?path ?shell_command name = let new_command = Element.make_command ~source_hint:(Some item) ?path ?shell_command name |> Impl.parse_command local_dir in s := {!s with commands = XString.Map.add name new_command !s.commands} in Element.main item |> if_some (fun path -> add_command ~path "run"); Element.self_test item |> if_some (fun path -> add_command ~path "test"); Element.compile_command item |> if_some (fun shell_command -> add_command ~shell_command "compile"); let new_bindings = ref [] in Element.deps_and_bindings item |> List.iter (function | `Requires child | `Restricts child -> let req = Impl.parse_dep local_dir child in s := {!s with requires = req :: !s.requires} | `Command child -> let command_name = Element.command_name child in s := {!s with commands = XString.Map.add command_name (Impl.parse_command local_dir child) !s.commands} | #Element.binding as child -> new_bindings := Element.element_of_binding child :: !new_bindings | _ -> () ); if !new_bindings <> [] then s := {!s with bindings = !s.bindings @ (List.rev !new_bindings)}; let new_attrs = !s.attrs |> AttrMap.add_all (Element.as_xml item).Q.attrs in {!s with attrs = new_attrs; requires = !s.requires; } let default_attrs ~url = AttrMap.empty |> AttrMap.add_no_ns FeedAttr.stability FeedAttr.value_testing |> AttrMap.add_no_ns FeedAttr.from_feed url let parse_implementations (system:#filesystem) root_attrs root local_dir = let open Impl in let implementations = ref XString.Map.empty in let package_implementations = ref [] in let process_impl node (state:Impl.properties) = let (id, impl) = create_impl system ~local_dir state node in if XString.Map.mem id !implementations then Element.raise_elem "Duplicate ID '%s' in:" id node; implementations := XString.Map.add id impl !implementations in let rec process_group state group = Element.group_children group |> List.iter (function | `Group item -> process_group (process_group_properties ~local_dir state item) (item :> [`Feed | `Group] Element.t) | `Implementation item -> process_impl item (process_group_properties ~local_dir state item) | `Package_impl item -> package_implementations := (item, (process_group_properties ~local_dir state item)) :: !package_implementations ) in (* 'main' on the <interface> (deprecated) *) let root_commands = match Element.main root with | None -> XString.Map.empty | Some path -> let new_command = Element.make_command ~source_hint:(Some root) ~path "run" |> Impl.parse_command local_dir in XString.Map.singleton "run" new_command in let root_state = { attrs = root_attrs; bindings = []; commands = root_commands; requires = []; } in process_group root_state (root :> [`Feed | `Group] Element.t); (!implementations, !package_implementations) let parse system root feed_local_path = let url = match feed_local_path with | None -> Element.uri root |? lazy (Element.raise_elem "Missing 'uri' attribute on non-local feed:" root) | Some path -> path in let local_dir = match feed_local_path with | None -> None | Some path -> Some (Filename.dirname path) in (* For local feeds, make relative paths absolute. For cached feeds, reject paths. *) let normalise_url raw_url elem = if XString.starts_with raw_url "http://" || XString.starts_with raw_url "https://" then raw_url else ( match local_dir with | Some dir -> U.normpath @@ dir +/ raw_url | None -> Element.raise_elem "Relative URI '%s' in non-local feed" raw_url elem ) in let parse_feed_import node = let (feed_os, feed_machine) = match Element.arch node with | None -> (None, None) | Some arch -> Arch.parse_arch arch in let feed_langs = match Element.langs node with | None -> None | Some langs -> Some (Str.split XString.re_space langs) in { Feed_import. src = Feed_url.parse_non_distro @@ normalise_url (Element.src node) node; os = feed_os; machine = feed_machine; langs = feed_langs; ty = Feed_import; } in let name = ref None in let replacement = ref None in let imported_feeds = ref [] in Element.feed_metadata root |> List.iter (function | `Name node -> name := Some (Element.simple_content node) | `Feed_import import -> imported_feeds := parse_feed_import import :: !imported_feeds | `Replaced_by node -> if !replacement = None then replacement := Some (normalise_url (Element.interface node) node) else Element.raise_elem "Multiple replacements!" node | `Feed_for _ | `Category _ | `Needs_terminal _ | `Icon _ | `Homepage _ -> () ); let implementations, package_implementations = parse_implementations system (default_attrs ~url) root local_dir in { url = Feed_url.parse_non_distro url; name = ( match !name with | None -> Element.raise_elem "Missing <name> in" root | Some name -> name ); root; replacement = !replacement; implementations = implementations; package_implementations = package_implementations; imported_feeds = !imported_feeds; } let get_feed_targets feed = Element.feed_metadata feed.root |> List.filter_map (function | `Feed_for f -> Some (Element.interface f) | _ -> None ) let get_category feed = Element.feed_metadata feed.root |> U.first_match (function | `Category c -> Some (Element.simple_content c) | _ -> None ) let needs_terminal feed = Element.feed_metadata feed.root |> List.exists (function | `Needs_terminal _ -> true | _ -> false ) let icons feed = Element.feed_metadata feed.root |> List.filter_map (function | `Icon icon -> Some icon | _ -> None ) let get_summary langs feed = Element.get_summary langs feed.root let get_description langs feed = Element.get_description langs feed.root let url t = t.url let zi_implementations t = t.implementations let package_implementations t = t.package_implementations let replacement t = t.replacement let imported_feeds t = t.imported_feeds let name t = t.name let pp_url f t = Feed_url.pp f t.url let root t = t.root
(* Copyright (C) 2013, Thomas Leonard * See the README file for details, or visit http://0install.net. *)
egraph_types.h
/* * E-GRAPH DATA STRUCTURES * * Initial egraph module started in August 2007. * Functional version completed by October 2007 and integrated to * QF_UF prototype solver (yices_smt) * * 2008-02-08: started main revision * - need to adapt the egraph data structures to interface with the smt_core module * - need to provide better API for communication with sub_solvers (other theories) * - added support for egraph atoms here (rather than in an external solver module) * - removed lazy clause support (for now) to simplify the implementation * - removed support for disequality propagation (did not seem to provide any performance * improvement on our benchmarks) * - revert to implementing the dynamic ackermann trick as in Yices 1 (i.e., by * creating lemmas in the smt_core) * * 2008-12-30: modified term creation interface * * 2009-01-22: cleaned up interface with subsolvers * * 2012-09-06: added lambda terms * * 2013-11-11: changed model construction to use fresh_val_maker. */ /* * Terms * ----- * Terms are represented by 32 bit signed integers (eterm_t) between 0 * and nterms - 1. Negative indices are used as special markers. * * For each term t, * - body[t] is either a composite or a special marker. * * Atomic terms are constants or variables * - if t is a constant, body[t] = mk_constant(id) where id is a constant index. * id is used during model construction. * - if t is a variable, body[t] = VARIABLE_BODY * The difference is that all constants are assumed distinct, whereas * variables are not. Term 0 is the boolean constant (true). * * Non-atomic terms are of one of the following forms: * (apply f t_1 ... t_n) * (update f t_1 ... t_n v) * (tuple t_1 ... t_n) * (eq t1 t2) * (distinct t1 ... t_n) * (ite t1 t2 t3) * (or t1 .... t_n) * (lambda t1 tag) * where f, t_i, v are occurrences of terms. These are stored as * composite_t objects. * * Lambda terms are of the form (lambda t1 tag) where tag is an integer index * that identifies the term domain. There's an associate lambda descriptor * table and lambda_desc[tag] stores: * n = arity of the term * dom[0] ... dom[n-1] = types * For example, we may have * u = (lambda (x::int) (y::int) t) & v = (lambda (x::real) t) * Then the egraph will contain * u = (lambda t i) * v = (lambda t j) * and the descriptor table will store * i --> arity = 2, dom[0] = int, dom[1] = int * j --> arity = 1, dom[0] = real. * * * To deal with boolean terms, we distinguish between positive and * negative occurrences of t. If t is boolean, a positive occurrence * denotes t, a negative occurrence denotes (not t). If t is * non-boolean, all its occurrences are positive. Occurrences are * represented by 32 bit signed integers (occ_t) and consist * of an eterm_t + a polarity bit. The polarity bit is the low-order bit. * * A term may have a theory variable attached: it's stored in thvar[t]. * * 2009-01-23: For model construction, we also store the type of every * term (as an index in the generic type table = egraph->types). * * * Equivalence classes * ------------------- * - an equivalence class is a set of term occurrences stored as a circular list * - for every term t, * - label[t] = class identifier + polarity * label is extended to term occurrence by setting label[t+] = label[t], * and label[t-] = opposite of label[t] * - next[t] = successor of t in the circular list * Polarities are always positive for non-boolean terms. * For a boolean class, there's an (implicit) complementary class that * contains the same terms with opposite polarities. * * Example: if t, (not u), and (not v) are in the same class, then we would have * next[t] = u- label[t] = C+ * next[u] = v+ label[u] = C- * next[v] = t- label[v] = C- * this defines two complementary classes: * C+ = { t+, u-, v- } = { t, (not u), (not v) } * C- = { t-, u+, v+ } = { (not t), u, v } * * Classes are identified by an index from 0 to nclasses - 1. * * For every class c, we store * - parents[c] = vectors of composites that contain a term in class c * - root[c] = class representative = root of the explanation tree for c * - dmask[c] = bitmask for distinct predicates * - bit 0 of dmask[c] is 1 if c contains a constant term * - bit i of dmask[c] is 1 if predicate (distinct t_1 ... t_n) is asserted * and t_j is in the class of c (i is an index attached to distinct ...) * - for boolean classes, only bit 0 matters. Distinct predicates with boolean * arguments can be eliminated: * (distinct t1 ... t_n) = false if n >= 3 * (distinct t1 t2) = (not (eq t1 t2)) * so if c is a class of boolean terms, then either dmask[c] == 1 if c is the * class of true or dmask[c] == 0. * * The merge algorithm ensures that root[c] is fixed. When a term t is created, * it's initially assigned to a fresh class c_0 and root[c_0] is set to t. This * root term is never modified. * (TODO: check whether root[c] can be removed. Since roots and terms are created * together, we could ensure that root term and class have the same integer index). * * * Atoms * ----- * An egraph atom is a term t of the form (eq t1 t2) or (distinct t1 ... t_n). * Each such atom is mapped to a boolean variable v in the core. The mapping * from t to v is stored by setting thvar[t] = v. More generally, there can * be a core variable v attached to any boolean term t in the egraph. * * In addition, the egraph store atom objects. Each atom object is a * pair atm=<t, v> where t is a boolean term and v is a boolean variable * in the core. The core keeps the mapping from v to atm in its * internal atom table. If t1 ... t_n are boolean terms in the same class c * then their respective atoms are stored in a circular list: * <t1, v1> --> ... <t_n,v_n> --> back to <t1, v1> * This is used to propagate implied literals to the core. * * * Additional data for classes * --------------------------- * For a class c, the egraph maintains: * - etype[c] = its type (either bool, nat, int, bitvector, tuple, array, or none) * - thvar[c] = an attached theory variable (or null_thvar) * = a 32 bit integers, whose interpretation depends on type[c] * * The algorithms maintain the following invariant: * - if no term in class c has a theory variable then thvar[c] is null * - otherwise thvar[c] is equal to thvar[t] for some term t in c * * Initially, thvar[c] is the same as thvar[root[c]]. But thvar[c] is dynamically * updated as the classes are merged. If classes c2 is merged into class c1, and * c1 has no theory variable, then it inherits the theory variable of c2 (if any). * If both classes have theory variables v1 and v2, then a theory solver is notified * that v1 and v2 are now equal. * * * Special tricks: the egraph deals internally with boolean and tuple classes. * There is no theory solver involved for them: * * If etype[c] = ETYPE_TUPLE: then thvar[c] is a tuple-term that belongs to c. * - this is used to implement the propagation rule * (tuple t_1 ... t_n) == (tuple u_1 ... u_n) ==> u_i == t_i * * If etype[c] = ETYPE_BOOL, thvar[c] is a boolean variable in the core * - for class 0 == class of true/false, we use thvar[c] = bool_const (bvar 0) * - for other boolean class, thvar[c] is a boolean variable v such that * 1) there is a term t in c with thvar[c] = t * 2) there is an egraph atom of the form <t, v> in the atom table * * * Propagation queue * ----------------- * - all assertions are written in the form t1 == t2, where t1 and t2 are term occurrences. * - in particular, asserting an atom <t, v> is translated to (t == true), and asserting its * negation is turned into (t == false) * - a propagation queue stores all these assertions, and the equalities implied by congruence * closure or other propagation mechanisms * - this is stored in a global queue: each element in the queue is a pair <t1, t2> representing * the equality (t1 == t2) * - every pair <t1, t2> has an explanation * * * Explanations * ------------ * - an explanation contains enough information for explaining how an equality (t1 == t2) * was derived. * - explanations can be * - axiom: empty antecedent * - assertion: literal * - congruence: means that t1 and t2 are equal by congruence * or special codes and data encoding simplification and propagation rules * * * Distinct predicates * ------------------- * - there can be no more than 31 terms of the form (distinct ....) * - when (distinct t_1 ... t_n) := true is asserted, a bit-index k is assigned and * the composite (distinct ... ) is stored in distinct[k] * - then bit k of dmask[class[t1] ... class[t_n]] is set to 1 * - bit 0 is reserved and distinct[0] = NULL: * bit 0 of dmask[c] is 1 iff c contains a constant term * * * Merge graph/explanation tree * ---------------------------- * - with every class c is associated an explanation tree * - nodes in the tree are the terms in c * - the root of the tree is root[c] * - edges are of the form t1 ---> t2 where (t1 = t2) is an asserted or implied equality * - an edge of origin t1 is represented by storing edge[t1] = k where k is an index * in the propagation queue (that contains <t1, t2> + an explanation) * */ #ifndef __EGRAPH_TYPES_H #define __EGRAPH_TYPES_H #include <stdint.h> #include <stdbool.h> #include <assert.h> #include "model/abstract_values.h" #include "model/concrete_values.h" #include "model/fresh_value_maker.h" #include "model/fun_maps.h" #include "solvers/cdcl/smt_core.h" #include "solvers/egraph/egraph_base_types.h" #include "utils/arena.h" #include "utils/cache.h" #include "utils/int_hash_map.h" #include "utils/int_hash_tables.h" #include "utils/int_partitions.h" #include "utils/int_stack.h" #include "utils/int_vectors.h" #include "utils/object_stores.h" #include "utils/ptr_partitions.h" #include "utils/ptr_vectors.h" #include "utils/use_vectors.h" /***************** * CLASS TABLE * ****************/ /* * For each equivalence class c: * - root[c] = a term occurrence (used as class representative) * - dmask[c] = bitvector encoding distinct assertions * - parents[c] = composites that contain a term t whose class is c * - etype[c] = type of terms in class c * - thvar[c] = theory variable for class c */ typedef struct class_table_s { uint32_t size; // size of all arrays uint32_t nclasses; // number of classes occ_t *root; uint32_t *dmask; use_vector_t *parents; unsigned char *etype; thvar_t *thvar; } class_table_t; // max size: based on size of use_vector_t #define DEFAULT_CLASS_TABLE_SIZE 200 #define MAX_CLASS_TABLE_SIZE (UINT32_MAX>>4) /* * Deletion threshold for parent vectors: When a class c is deleted, * its parent vector parent[c] is reset. In addition, if parent[c] has * size >= PARENT_DELETION_SIZE then the memory used by parent[c] is freed. */ #define PARENT_DELETION_SIZE 100 /**************** * TERM TABLE * ***************/ /* * For each term t: * - body[t] = descriptor (composite or special pointers) * - next[t] = next element in the same class * - edge[t] = edge id, used for constructing explanations * (or if t is not active, edge[t] = etype of t) * - thvar[t] = theory variable attached to t * - mark[t] = 1/0 bit, used for constructing explanations * - real_type[t] = type of t (this is necessary for constructing models) */ typedef struct eterm_table_s { uint32_t size; uint32_t nterms; composite_t **body; elabel_t *label; occ_t *next; int32_t *edge; thvar_t *thvar; byte_t *mark; type_t *real_type; } eterm_table_t; #define DEFAULT_ETERM_TABLE_SIZE 200 #define MAX_ETERM_TABLE_SIZE ((uint32_t)(MAX_ETERMS)) /****************** * EXPLANATIONS * *****************/ /* * Every equality (t1 == t2) in the propagation queue has an * antecedent that explains how (t1 == t2) was derived. * * An explanation is encoded in two parts: * - an 8bit tag defines its type * - extra data depending on the tag is stored in a union * * Explanation types: * - axiom: (t1 == t2) needs no explanation * - assert(l): (t1 == t2) was asserted (by setting l to true) * - eq(u, v): (u == v) implies (t1 == t2) * - distinct0(u, v): (u != v) implies (t1 == t2) * where u != v is obtained via constants (bit 0 of dmask) * - distinct[i](u, v): (u != v) implies (t1 == t2) * where u != v is obtained via dmask (bit i of dmask) * - simp_or is used in two cases: * (or u_1 ... u_n) == false (for all i, u_i == false) * (or u_1 ... u_n) == v (for all i, u_i == false or u_i == v) * * For equalities implied by congruence, we must be careful to * preserve causality: the explanation for (t1 == t2) must use only * equalities asserted before. To ensure causality, we use different * tags depending on the congruence rule applied: * * - basic_congruence: t1 and t2 are apply/update/tuple terms * * - eq_congruence1: (t1 == u1), (t2 == u2) implies (eq t1 t2) == (eq u1 u2) * - eq_congruence2: (t1 == u2), (t2 == u1) implies (eq t1 t2) == (eq u1 u2) * * - ite_congruence1: (t1 == u1), (t2 == u2), (t3 == u3) implies * (ite t1 t2 t3) == (ite u1 u2 u3) * - ite_congruence2: (t1 == (not u1)), (t2 == u3), (t3 == u2) * implies (ite t1 t2 t3) == (ite u1 u2 u3) * * - or_congruence(v) where v is an array of term occurrences * - distinct_congruence(v) where v is an array of term occurrences * * When (or t_1 ... t_n) == (or u_1 ... u_m) is implied by congruence, * we have to match each t_i to a u_j (and conversely) to produce an explanation. * To preserve causality, we compute the mapping t_i --> u_j at the time * the congruence is detected. The mapping is stored as an array v of n + m elements * v_1 ... v_n, v_n+1 ... v_{n+m} and it encodes the conjunction * (t_1 == v1 ... t_n == v_n) and (u_1 == v_{n+1} ... u_m == v_{n+m}). * * The same thing is done when (distinct t1 ... t_n) == (distinct u_1 ... u_n) is * implied by congruence. * * Other explanations: * - Propagation via pseudo-clauses and Ackermann propagation are not used anymore. * - Equalities propagated from a satellite solver: the antecedent is a pointer * The tag identifies the solver */ typedef enum expl_tag { EXPL_AXIOM, EXPL_ASSERT, EXPL_EQ, // Hackish: for EXPL_DISTINCT, we need to keep track of which bit of dmask // caused the propagation (i.e., the composite in egraph->dtable.distinct[i]) // We use 32 tags since there are at most 32bits EXPL_DISTINCT0, EXPL_DISTINCT1, EXPL_DISTINCT2, EXPL_DISTINCT3, EXPL_DISTINCT4, EXPL_DISTINCT5, EXPL_DISTINCT6, EXPL_DISTINCT7, EXPL_DISTINCT8, EXPL_DISTINCT9, EXPL_DISTINCT10, EXPL_DISTINCT11, EXPL_DISTINCT12, EXPL_DISTINCT13, EXPL_DISTINCT14, EXPL_DISTINCT15, EXPL_DISTINCT16, EXPL_DISTINCT17, EXPL_DISTINCT18, EXPL_DISTINCT19, EXPL_DISTINCT20, EXPL_DISTINCT21, EXPL_DISTINCT22, EXPL_DISTINCT23, EXPL_DISTINCT24, EXPL_DISTINCT25, EXPL_DISTINCT26, EXPL_DISTINCT27, EXPL_DISTINCT28, EXPL_DISTINCT29, EXPL_DISTINCT30, EXPL_DISTINCT31, EXPL_SIMP_OR, // congruence rules EXPL_BASIC_CONGRUENCE, EXPL_EQ_CONGRUENCE1, EXPL_EQ_CONGRUENCE2, EXPL_ITE_CONGRUENCE1, EXPL_ITE_CONGRUENCE2, EXPL_OR_CONGRUENCE, EXPL_DISTINCT_CONGRUENCE, // equality propagated from a satellite theory // we just use a hardcoded index to identify the satellite solver for now EXPL_ARITH_PROPAGATION, EXPL_BV_PROPAGATION, EXPL_FUN_PROPAGATION, // attempt to reconcile models EXPL_RECONCILE, } expl_tag_t; typedef union expl_data_u { literal_t lit; // for EXPL_ASSERT occ_t t[2]; // for EXPL_EQ, EXPL_DISTINCT, EXPL_DISTINCT0 void *ptr; // for EXPL_DISTINCT_CONGRUENCE, EXPL_OR_CONGRUENCE, theory propagation } expl_data_t; /******************************* * DISTINCT ASSERTION TABLE * ******************************/ /* * - npreds = number of assertions so far * - distinct[k] = composite (distinct ....) * (the explanation is always (distinct ... ) == true). * * There's an implicit (distinct t_1 .... t_n) of index 0 where * t_1 ... t_n are the constant terms. * - index 0 is reserved (so npreds >= 1) * - distinct[0] = NULL */ #define NDISTINCTS 32 #define MAX_DISTINCT_TERMS (NDISTINCTS-1) typedef struct distinct_table_s { uint32_t npreds; composite_t *distinct[NDISTINCTS]; } distinct_table_t; /********************************* * LAMBDA TAGS AND DESCRIPTORS * ********************************/ /* * There are ntags descriptors. * * For each lambda tag we store: * - arity + domain */ typedef struct ltag_desc_s { uint32_t arity; type_t dom[0]; // real size = arity } ltag_desc_t; #define MAX_LTAG_DESC_ARITY ((UINT32_MAX-sizeof(ltag_desc_t))/sizeof(type_t)) typedef struct ltag_table_s { uint32_t size; uint32_t ntags; ltag_desc_t **data; } ltag_table_t; #define DEF_LTAG_TABLE_SIZE 8 #define MAX_LTAG_TABLE_SIZE (UINT32_MAX/sizeof(ltag_desc_t *)) /****************** * UPDATE GRAPH * *****************/ /* * To replace the fun_solver satellite. * The egraph has an optional 'update graph' component to * deal with lambda terms, updates, and extensionality. * * The data structure is defined in update_graph.h. */ typedef struct update_graph_s update_graph_t; /***************************** * PROPAGATION QUEUE/STACK * ****************************/ /* * Each element i in the queue encodes an assertion * - eq[i] of the from (t1 == t2) * - with explanation defined by the pair <etag[i], edata[i]> * * When the assertion is processed, it's turned into an edge * t1 ---> t2 in an explanation tree (i.e., edge[t1] is set to i). * * Other components: * - top = top of the stack * - prop_ptr = index of the first equality to process * so eq[prop_ptr ... top-1] = all assertions not yet processed. * - size = size of arrays eq, expl, saved_class * - mark = bitvector for constructing explanations * * Assertions are organized in levels: * - level_index[k] = index of the first assertion added at level k * - level_index[0] = 0 * - nlevels = size of the level_index array */ typedef struct equeue_elem_s { occ_t lhs; occ_t rhs; } equeue_elem_t; typedef struct egraph_stack_s { equeue_elem_t *eq; unsigned char *etag; expl_data_t *edata; byte_t *mark; uint32_t top; uint32_t prop_ptr; uint32_t size; uint32_t *level_index; uint32_t nlevels; } egraph_stack_t; // Marker for edge[t] when t is a root enum { null_edge = -1, }; #define DEFAULT_EGRAPH_STACK_SIZE 200 #define MAX_EGRAPH_STACK_SIZE (UINT32_MAX/8) #define DEFAULT_EGRAPH_NLEVELS 100 #define MAX_EGRAPH_STACK_LEVELS (UINT32_MAX/8) /**************** * UNDO STACK * ***************/ /* * Data for backtracking. Some of the undo data is already in * the propagation queue, but it's simpler to use a special undo stack. * TODO: check cost and revise this if needed. * * Operations that can be undone: * - merge classes of t1 and t2 * - assertion of a distinct atom * - simplification of a composite when dmask change * * Other operations that require processing after backtracking * are also recorded in the trail_stack: * - a composite term created during the search needs to * be reanalyzed after backtracking * */ typedef enum undo_tag { // undo operations UNDO_MERGE, UNDO_DISTINCT, UNDO_SIMPLIFY, // reanalyze operations: two variants REANALYZE_CONGRUENCE_ROOT, REANALYZE_COMPOSITE, } undo_tag_t; typedef struct { occ_t saved_occ; elabel_t saved_label; } undo_merge_t; typedef union undo_u { undo_merge_t merge; void *ptr; } undo_t; /* * Undo stack: * - each trail object consists of an 8bit tag (tag[i]) + a union (data[i]) * Other components: * - top = top of the stack * - size = size of arrays tag and data * * Levels as in egraph_stack: * - level_index[k] = first trail object of level k * - nlevels = size of level_index array */ typedef struct undo_stack_s { unsigned char *tag; undo_t *data; uint32_t top; uint32_t size; uint32_t *level_index; uint32_t nlevels; } undo_stack_t; /********************** * SIGNATURE BUFFERS * *********************/ /* * The signature (sigma c) of a composite term c is derived from * label[t[0]] ... label[t[n-1]] where t[0] ... t[n-1] are c's children. * - two composites c1 and c2 are congruent iff they have equal signature * - signature computation also includes normalization * * A signature is a pair tag + array of class labels, stored in a signature * buffer. size = size of the array sigma */ typedef struct signature_s { uint32_t size; uint32_t tag; // encodes kind + arity elabel_t *sigma; } signature_t; /*********************** * CONGRUENCE TABLE * **********************/ /* * Hash-table of composites: stores a unique representative * (congruence root) per signature. It's similar to int_hash_table. */ typedef struct congruence_table_s { composite_t **data; // the hash table proper uint32_t size; // its size (must be a power of 2) uint32_t nelems; // number of elements uint32_t ndeleted; // deleted elements uint32_t resize_threshold; uint32_t cleanup_threshold; signature_t buffer; // for internal use } congruence_table_t; /* * Marker for deleted elements in the congruence table * Empty slots contain the NULL pointer */ #define DELETED_COMPOSITE ((composite_t *) 1) #define NULL_COMPOSITE ((composite_t *) 0) #define DEFAULT_CONGRUENCE_TBL_SIZE 256 #define MAX_CONGRUENCE_TBL_SIZE (UINT32_MAX/sizeof(composite_t*)) #define CONGRUENCE_TBL_RESIZE_RATIO 0.6 #define CONGRUENCE_TBL_CLEANUP_RATIO 0.2 /******************************* * TRAIL STACK FOR PUSH/POP * ******************************/ /* * At every push we save the number of terms * + the current propagation pointer */ typedef struct egraph_trail_s { uint32_t nterms; uint32_t prop_ptr; } egraph_trail_t; typedef struct egraph_trail_stack_s { uint32_t size; uint32_t top; egraph_trail_t *data; } egraph_trail_stack_t; #define DEFAULT_EGRAPH_TRAIL_SIZE 20 #define MAX_EGRAPH_TRAIL_SIZE (UINT32_MAX/sizeof(egraph_trail_t)) /********************************************* * COMMUNICATION WITH OTHER THEORY SOLVERS * ********************************************/ /* * The egraph can be used standalone or as a central solver * connected to the core and communicating with other solvers. * * Two kinds of solvers can be attached to the egraph: * - full solvers: right now, this means arithmetic and bitvector solver, * a full solver is one that has its own atoms (and could be attached * directly to the core). * - subsolvers are theory solvers that cannot work without the egraph, * a subsolver can deal only with equalities and disequalities. * * Full solvers must implement the th_ctrl and th_smt interfaces * (defined in smt_core.h) and the th_egraph interface defined * below. * * Sub-solvers must implement the th_ctrl and th_egraph interfaces. * * The egraph does the following: * - forward commands it gets from the core to all attached solvers * - forward atom-processing commands to the full solvers * - propagate equalities and disequalities to all sub-solvers * Satellite solvers may propagate equalities to the egraph. * * * GENERIC EGRAPH INTERFACE * ======================== * * A set of functions common to all satellite solvers is used by the * egraph during the search. To propagate equalities and disequalities * to a satellite solver, the egraph calls one of the following * functions (in the th_egraph interface). * * 1) void assert_equality(void *solver, thvar_t x1, thvar_t x2, int32_t id) * notify solver that x1 and x2 are equal (after merging classes c1 and c2, * with thvar[c1] = x1 and thvar[c2] = x2). * id is the egraph edge that caused c1 and c2 to be merged. * * 2) void assert_disequality(void *solver, thvar_t x1, thvar_t x2, composite_t *cmp) * notify solver that x1 != x2 holds. * cmp is an explanation hint. It allows the egraph to correctly generate an * explanation for x1 != x2 if that's needed later. * * 3) void assert_distinct(void *solver, uint32_t n, thvar_t *a, composite_t *cmp) * notify solver that a[0] ... a[n-1] are all distinct * as above, cmp is an explanation hint. * * For all three assert functions above, the satellite solver must * store the assertions internally and process them when propagate is * called. * * 4) bool check_diseq(void *solver, thvar_t x1 thvar_t x2) * return true if (x1 != x2) holds in the solver at the base level. * (don't need to be complete: may return false) * * 4a) bool is_constant(void *solver, thvar_t x) * return true if x is a constant in the theory solver (optional) * return false otherwise * * Optional function: if the solver propagates equalities to the egraph, * it must implement the following function. * * * 5) void expand_th_explanation(void *solver, thvar_t x1, thvar_t x2, void *expl, th_explanation_t *result) * * When the solver propagates an equality t1 == t2, it must provide an opaque explanation * object expl (a void * pointer). The egraph calls the function expand_th_explanation * when it needs to expand expl to a set of antecedent atoms. The parameters passed to * the function are x1 --> theory variable of t1 and x2 --> theory variable of t2. * The function must construct a conjunction of constraints that imply t1 == t2. * Each constraint may be of the following forms: * - atom(l): an atom from the satellite solver, attached to literal l * - eq(u, v): an equality (u==v) that was propagated by egraph to the solver * via a call to assert_equality. * - diseq(u, v): a disequality (u!=v) that was propagated by egraph to the solver, * via a call to assert_disequality or assert_distinct. This must be given * as a pre_expl object. * The set of constraints is stored in a th_explanation data structure that maintains * three resizable vectors, for atoms, equalities, and diseq constraints. * * * Theory conflict and explanations * -------------------------------- * * To construct theory conflicts, a satellite solver can * query the egraph for explanations using functions * - egraph_explain_term_eq * - egraph_store_diseq_pre_expl * - egraph_expand_diseq_pre_expl * These functions are defined in egraph_explanation.c. * * Another function 'egraph_explain_term_diseq' is defined in * egraph_explanation.c but it cannot be used reliably to * lazily build an explanation for (x1 != x2). It may generate an * incorrect (non-causal) explanation. The hint passed to * assert_distinct and assert_disequality is not enough to rebuild the * correct explanation in all cases (cf. egraph_explanation.c). * * If the satellite solver performs an inference or theory propagation * with (x1 != x2) as antecedent, it must use an intermediate * 'pre_expl' object that keeps enough information to build an * explanation for (x1 != x2) if it is needed later. At the time of * the inference: the satellite must record the pre_expl data using * function * * egraph_store_diseq_pre_expl(egraph, t1, t2, hint, pre_expl) where * - t1 must be the egraph term attached to x1 * - t2 must be the egraph term attached to x2 * - hint is the composite provided by the egraph in * assert_disequality or assert_distinct * - pre_expl is a pointer to a pre_expl_t structure * * If the explanation for (x1 != x2) is needed later on (i.e., must be expanded to a list of * literal), then the satellite solver must call * * egraph_expand_diseq_pre_expl(egraph, pre_expl, ..) * * at that time. * * * Interface equalities (2010/01/13) * --------------------------------- * * In final check, the egraph and satellite solver attempt to build consistent * models. If that fails, interface equalities must be generated. The egraph * currently supports to variant implementations of final_check, that use * different functions provided by the satellite solvers. * * * Baseline final_check: for this variant, a satellite solver must implement * the following function. * * 6) uint32_t reconcile_model(void *solver, uint32_t max_eq) * * This function is called in final_check by the egraph to enforce consistency * between the egraph and the solver's internal model. There's a conflict * between egraph and solver if there are two terms t1 and t2 in the egraph, * and two theory variables x1 and x2 in the solver such that: * - t1 and t2 are in different classes in the egraph * - x1 and x2 are equal in the solver's model * - x1 is t1's theory variable and x2 is t2's theory variable. * * The solver should attempt to resolve such conflicts by changing the * values of x1 and x2 if that's possible. Otherwise, it must construct * the interface equality (eq t1 t2) in the egraph (by calling egraph_make_simple_eq). * - max_eq is a bound on the number of interface equalities the solver is * allowed to generate * - the function must return the number of interface equalities actually created * (0 means that the egraph and solver model are consistent). * * * Experimental final_check: this variant implements a more flexible * interface generation algorithms. The egraph attempts to resolve * conflict by merging classes. If that fails, it asks the satellite * solver to generate interface lemmas. To support this, the * satellite solvers must implement the following functions: * * 6a) void prepare_model(void *solver) * * This function is called in final_check before the egraph generates interface lemmas. * The solver must build a local model at this point (enough to be able to check * whether two variables x1 and x2 have the same or different values in the local model). * * 6b) bool equal_in_model(void *solver, thvar_t x1, thvar_t x2) * * Must return true if x1 and x2 have the same value in the model and false if * they have different values. (So the model must assign a value to all theory variables). * * 6c) void gen_interface_lemma(void *solver, literal_t l, thvar_t x1, thvar_t x2, bool equiv) * * Ask the theory solver to create a lemmas of the form (l => x1 /= x2). * If equiv is true, then the solver can also create the reverse implication: (x1 /= x2 => l). * * 6d) void release_model(void *solver) * * Called at the end of final_check. This means that the local model built by prepare_model * is no longer needed. The solver can free whatever internal data structures it used for * the local model, or do other cleanup. * * * 6e) ipart_t *build_model_partition(void *solver) * * Called after prepare_model and before release model. The solver * must construct a partition of its variables: two variables are * in the same class if they have the same value in the model. This * can be restricted so that the partition uses one theory variable * per Egraph class. * * The solver should use 'int_partition.h' to build this. * * 6f) void release_model_partition(void *solver, ipart_t *partition) * * Called by the egraph when the partition is no longer needed. * * * In addition, all satellite solvers must implement the following functions * to link egraph terms and theory variables. * * 7) void attach_eterm(void *solver, thvar_t x, eterm_t u): attach u as term for variable x * in solver. This must be the same function as used by the context. * * 8) eterm_t eterm_of_var(void *solver, thvar_t v) * return the eterm t attached to v (or null_eterm if v has no eterm attached). * This must be the same function as used by the context. * * * New function for theory branching (2010/10/27) * ---------------------------------------------- * * If theory branching is enabled, the egraph must decide whether an atom l := (eq u1 u2) * must be assigned true or false when l is selected as decision literal. If u1 and u2 are both * attached to two theory variables x1 and x2, then the egraph can delegate the decision to * the theory solver. For this purpose, it calls the function * * 9) literal_t select_eq_polarity(void *solver, thvar_t x1, thvar_t x2, literal_t l) * - l is a decision literal attached to an egraph atom (eq u1 u2) * - x1 and x2 are the theory variables for u1 and u2, respectively * - the theory solver must decide between assigning l true or false * - the function must return l to set l := true or (not l) to set l := false * * * * THEORY-SPECIFIC INTERFACES * ========================== * * In addition to the common egraph interface defined above, the egraph needs theory-specific * functions to create terms and theory variables, and to build a global model. These are * grouped in interface descriptors that are distinct for each theory. * * Support for term creation * ------------------------- * * For new terms of arithmetic, bitvector, or function types, the egraph may create a theory variable * and attach it to the new term. For this purpose, the theory solver must provide functions for * creating theory variables. These functions are the same as the ones used in the context: * * For arithmetic variables: * - thvar_t create_arith_var(void *arith_solver, bool is_int): create a new arithmetic variable. * If is_int is true, the variable is integer, otherwise it's real. * * For bitvector variables * - thvar_t create_bv_var(void *bv_solver, uint32_t n): create a new bitvector variable. * n = number of bits * * For function variables * - thvar_t create_fun_var(void *fun_solver, type_t tau): create a new function/array variable * tau = its type (in the global type table) * * * Support for model construction (global model) * --------------------------------------------- * * An egraph model maps term occurrences to objects (defined in * concrete_values.h). To build the model, the egraph must query the * satellite solvers for rational/integer or bitvector values assigned * to theory variables. * * For this, we use the following functions: * * a) arithmetic solver * ---------------- * bool value_in_model(void *arith_solver, thvar_t x, rational_t *v) * * Must return true if the arithmetic solver has a value for x in its current model * and that value is rational (or integer). It must then copy that value in v. * The function must return false otherwise. * * This function should be identical to the function of the same name in * the arithmetic solver arith_interface (used by the context). * * * b) bitvector solver * ---------------- * bool value_in_model(void *bv_solver, thvar_t x, bvconstant_t *b) * * Must return true if the bitvector solver has a value for x in its current model. * It must then copy that value in b. It must return false otherwise. * * This function should be identical to the function of the same name in the * bvsolver_interface used by the context. * * * c) function-theory solver * ---------------------- * * A function subsolver cannot be used without the egraph. So model * construction requires close coordination between the egraph and * the subsolver. We use a two-step approach: * * - First the function solver constructs an abstract model (via * fun_maps/abstract_values). This may introduce new objects * (fresh particles) that are not currently present in the * egraph. The only requirement is that all fresh particles must be * distinct from each other and from any existing egraph term. * * - Then the egraph converts the abstract model into a concrete * model by mapping the abstract particles to concrete values. * * To support this, the function solver must implement the following functions: * * 1) void build_model(void *solver, pstore_t *store): * Build a model that maps theory variables to abstract maps (map_t). * Abstract values (particles) necessary for this model must be allocated in store. * * 2) map_t *value_in_model(void *solver, thvar_t x): * Return the value assigned to theory variable x in the model. * Return NULL if the value of x is not available. * * 3) void free_model(void *solver): * Notify the solver that the model is no longer needed. * */ /* * THEORY EXPLANATION OBJECT */ /* * Disequality pre-explanation object: * This store enough data to encode the antecedents of a derived * disequality. A disequality is derived by one of the following * inference rules: * Rule 1) (eq u1 u2) = false, u1 == t1, u2 == t2 IMPLIES (t1 != t2) * Rule 2) (distinct ... u2 ... u1 ,...) == true, * u1 == t1, u2 == t2 IMPLIES (t1 != t2) * To reliably reconstruct the explanation for (t1 != t2) later on, * we must store * - the composite involved (either (eq u1 u2) or (distinct ....)) * - the terms involved, namely, u1, u2, t1, and t2. */ typedef struct diseq_pre_expl_s { composite_t *hint; eterm_t t1, u1; eterm_t t2, u2; } diseq_pre_expl_t; // equality constraint in a theory explanation typedef struct th_eq_s { eterm_t lhs; eterm_t rhs; } th_eq_t; // explanation object = three vectors (with hidden headers) // see theory_explanations.h and theory_explanations.c typedef struct th_explanation_s { literal_t *atoms; th_eq_t *eqs; diseq_pre_expl_t *diseqs; } th_explanation_t; /* * GENERIC EGRAPH INTERFACE */ typedef void (*assert_eq_fun_t)(void *satellite, thvar_t x1, thvar_t x2, int32_t id); typedef void (*assert_diseq_fun_t)(void *satellite, thvar_t x1, thvar_t x2, composite_t *hint); typedef bool (*assert_distinct_fun_t)(void *satellite, uint32_t n, thvar_t *a, composite_t *hint); typedef bool (*check_diseq_fun_t)(void *satellite, thvar_t x1, thvar_t x2); typedef bool (*is_constant_fun_t)(void *satellite, thvar_t x); typedef void (*expand_eq_exp_fun_t)(void *satellite, thvar_t x1, thvar_t x2, void *expl, th_explanation_t *result); typedef uint32_t (*reconcile_model_fun_t)(void *satellite, uint32_t max_eq); typedef void (*prepare_model_fun_t)(void *satellite); typedef bool (*equal_in_model_fun_t)(void *satellite, thvar_t x1, thvar_t x2); typedef void (*gen_inter_lemma_fun_t)(void *satellite, literal_t l, thvar_t x1, thvar_t x2, bool equiv); typedef void (*release_model_fun_t)(void *satellite); typedef ipart_t *(*build_partition_fun_t)(void *satellite); typedef void (*free_partition_fun_t)(void *satellite, ipart_t *partition); typedef void (*attach_to_var_fun_t)(void *satellite, thvar_t x, eterm_t t); typedef eterm_t (*get_eterm_fun_t)(void *satellite, thvar_t x); typedef literal_t (*select_eq_polarity_fun_t)(void *satellite, thvar_t x, thvar_t y, literal_t l); typedef struct th_egraph_interface_s { assert_eq_fun_t assert_equality; assert_diseq_fun_t assert_disequality; assert_distinct_fun_t assert_distinct; check_diseq_fun_t check_diseq; is_constant_fun_t is_constant; expand_eq_exp_fun_t expand_th_explanation; reconcile_model_fun_t reconcile_model; prepare_model_fun_t prepare_model; equal_in_model_fun_t equal_in_model; gen_inter_lemma_fun_t gen_interface_lemma; release_model_fun_t release_model; build_partition_fun_t build_model_partition; free_partition_fun_t release_model_partition; attach_to_var_fun_t attach_eterm; get_eterm_fun_t eterm_of_var; select_eq_polarity_fun_t select_eq_polarity; } th_egraph_interface_t; /* * ARITHMETIC-SPECIFIC INTERFACE */ typedef thvar_t (*make_arith_var_fun_t)(void *solver, bool is_int); typedef bool (*arith_val_fun_t)(void *arith_solver, thvar_t x, rational_t *v); typedef struct arith_egraph_interface_s { make_arith_var_fun_t create_arith_var; arith_val_fun_t value_in_model; } arith_egraph_interface_t; /* * BITVECTOR-SPECIFIC INTERFACE */ typedef thvar_t (*make_bv_var_fun_t)(void *solver, uint32_t n); typedef bool (*bv_val_fun_t)(void *solver, thvar_t x, bvconstant_t *v); typedef struct bv_egraph_interface_s { make_bv_var_fun_t create_bv_var; bv_val_fun_t value_in_model; } bv_egraph_interface_t; /* * FUNCTION-SOLVER INTERFACE */ typedef thvar_t (*make_fun_var_fun_t)(void *solver, type_t tau); typedef void (*fun_build_model_fun_t)(void *fun_solver, pstore_t *store); typedef map_t *(*fun_val_fun_t)(void *fun_solver, thvar_t x); typedef void (*fun_free_model_fun_t)(void *fun_solver); typedef struct fun_egraph_interface_s { make_fun_var_fun_t create_fun_var; fun_build_model_fun_t build_model; fun_val_fun_t value_in_model; fun_free_model_fun_t free_model; } fun_egraph_interface_t; /*********** * MODEL * **********/ /* * Auxiliary structures used in model construction. We now use a * global fresh_value_maker to construct fresh values. For this to * work properly, we must assign a value to all classes of type tau * before attempting to create fresh values of type tau. To do this, * we sort the classes by rank when rank c = depth of c's type: * - all atomic types have depth 0 * - a function or tuple type has positive depth equal to 1 + max depth * of the types it depends on. * Then we assign values to classes in increasing order of type depth. * This works since fresh values of type tau are used to construct * arrays/functions of some function type that contains tau. * * * Model components: * - value = maps classes to concrete values (if c is not a root class * then value[c] = null_value). * - root_classes = vector of all root classes * - rank_ctr = vector of counters for sorting the root classes by rank * - pstore = auxiliary particle store used by the function solver * - fval_maker = data structure to create fresh values * - internal buffers for rational and bitvector values * */ typedef struct egraph_model_s { value_t *value; pstore_t *pstore; fresh_val_maker_t *fval_maker; ivector_t root_classes; ivector_t rank_ctr; rational_t arith_buffer; bvconstant_t bv_buffer; } egraph_model_t; /****************** * CACHED DATA * *****************/ /* * Lemmas can be added to the core by the egraph: * * 1) Expansion of a (distinct ...) atom. When * "not (distinct t1 ... t_n)" is asserted, then the clause * "(distinct t1 ... t_n) or (eq t1 t2) or (eq t1 t3) ... or (eq t_n-1 t_n)" * is added to the core * * 2) Ackermann clause. A heuristic may create clauses of the form * "(eq t1 u1) and (eq t2 u2) ... (eq t_n u_n) implies * (eq (f t_1 ... t_n) (f u_1 ... u_n))" * * An internal cache stores data about which lemmas have been created (to * prevents multiple generation of the same lemma). * - for a distinct-expansion, the cache stores <DISTINCT_LEMMA, u> where u = term id of * the (distinct ...) term * - for an Ackermann clause, the cache stores <ACKERMANN_LEMMA, u, v> where u and v are * the term ids of (f t_1 ... t_n) and (f u_1 ... u_n), respectively. */ typedef enum elemma_tag { DISTINCT_LEMMA = 0, ACKERMANN_LEMMA = 1, } elemma_tag_t; /**************** * STATISTICS * ***************/ // search statistics typedef struct egraph_stats_s { uint32_t app_reductions; uint32_t eq_props; // equalities propagated by satellite solvers (simplex) uint32_t th_props; // propagations from egraph to core uint32_t th_conflicts; // conflicts detected by egraph uint32_t nd_lemmas; // number of non-distinct lemmas // counters related to ackermann clauses uint32_t aux_eqs; // number of equality terms created uint32_t boolack_lemmas; // number of boolean ackermann instances created uint32_t ack_lemmas; // number of non-boolean ackermann instances created // statistics on interface equalities uint32_t final_checks; // number of calls to final check uint32_t interface_eqs; // number of interface equalities generated } egraph_stats_t; /************** * EGRAPH * *************/ typedef struct egraph_s egraph_t; struct egraph_s { /* * Attached smt_core + type table */ smt_core_t *core; type_table_t *types; /* * base_level and decision_level mirror the same counters * in the attached core. * - base_level keeps track of the number of calls to push * - decision_level is incremented during the search, decremented * during backtracking */ uint32_t base_level; uint32_t decision_level; /* * Presearch flag: set on call to start_internalization * Cleared on call to start_search. */ bool presearch; /* * Number of (distinct ...) terms allocated */ uint32_t ndistincts; /* * Number of atoms */ uint32_t natoms; /* * True if the egraph contains high-order terms */ bool is_high_order; /* * Statistics */ egraph_stats_t stats; /* * Option flag and search parameters * each option is a single bit in the option flag */ uint32_t options; /* * Limits on ackermann clause generation * - max_ackermann = bound on the number of non-boolean Ackermann lemmas * - max_boolackermann = bound on the number of boolean Ackermann lemmas * - aux_eq_quota = bound on the number of auxiliary equalities created * by Ackermann lemmas */ uint32_t max_ackermann; uint32_t max_boolackermann; uint32_t aux_eq_quota; /* * Thresholds to trigger the generation of Ackermann/Boolean Ackermann * lemmas: when a candidate pair (t1 == t2) is selected, a counter * is increased. When that counter reaches the threshold, a lemma * is generated. */ uint16_t ackermann_threshold; uint16_t boolack_threshold; /* * Two candidates for the next Ackermann lemma: * when the egraph detects a conflict while processing (t1 == t2) * then it stores t1 in ack_left and t2 in ack_right if * (t1 == t2) was propagated by BASIC_CONGRUENCE. */ occ_t ack_left, ack_right; /* * Limit on the number of interface equalities created * in each call to final_check */ uint32_t max_interface_eqs; /* * Main components */ class_table_t classes; eterm_table_t terms; egraph_stack_t stack; undo_stack_t undo; distinct_table_t dtable; congruence_table_t ctable; ltag_table_t tag_table; update_graph_t *update_graph; // optional /* * Push/pop stack */ egraph_trail_stack_t trail_stack; /* * Auxiliary buffers and structures */ int_htbl_t *const_htbl; // for hash-consing of constants (allocated on demand) int_htbl_t htbl; // for hash-consing of composite terms object_store_t atom_store; // for creating atoms cache_t cache; // for creating lemmas int_hmap_t *imap; // for or-congruence explanations signature_t sgn; // auxiliary buffer for congruence closure arena_t arena; // stack-based allocation ivector_t expl_queue; // vector used as a queue of edges (explanation queue) ivector_t expl_vector; // vector of literals for conflict/explanations pvector_t cmp_vector; // generic vector to store composites ivector_t aux_buffer; // generic buffer used in term construction int_stack_t istack; // generic stack for recursive processing /* * Experimental: attempt to produce better equality explanation * - when the egraph knows (t1 == t2) it can propagate a literal l := true * where l is attached to (eq t1 t2). * - by default, we explore the egraph merge trees to construct an * explanation for (t1 == t2) * - if short_cuts is true, we try to just use l as the explanation for (t1 == t2), * but we have to make sure this does not introduce circularities. * - top_id is intended to prevent circular explanation */ bool short_cuts; // enable/disable short cuts in explanations int32_t top_id; // used when building explanations /* * Support for model reconciliation */ ivector_t interface_eqs; // pairs of term occurrences (for interface lemmas) uint32_t reconcile_top; // top of the undo stack when reconcile started uint32_t reconcile_neqs; // number of equalities when reconcile started bool reconcile_mode; // true if the egraph has some edges for model reconciliation /* * Support for on-the-fly creation of composite terms. * Composites created at decision_level > base_level * may need to be reactivated after backtracking. They * are stored in reanalyze_vector. */ pvector_t reanalyze_vector; /* * Theory explanation object: for building explanation of equalities * propagated by a subsolver */ th_explanation_t th_expl; /* * Helper for the array theory solver * allocated on demand */ ppart_t *app_partition; /* * Satellite solvers and interface descriptors * * Generic: * - th[i] = solver for theory i * - ctrl[i] = its control interface * - eg[i] = its egraph interface * * Theory specific descriptors * - arith_smt: core interface for arith solver * - bv_smt: core interface for bitvector solver * - arith_eg: egraph interface for arith solver * - bv_eg: egraph interface for the bitvector solver * - fun_eg: egraph interface for the array/function solver */ void *th[NUM_SATELLITES]; th_ctrl_interface_t *ctrl[NUM_SATELLITES]; th_egraph_interface_t *eg[NUM_SATELLITES]; th_smt_interface_t *arith_smt; th_smt_interface_t *bv_smt; arith_egraph_interface_t *arith_eg; bv_egraph_interface_t *bv_eg; fun_egraph_interface_t *fun_eg; /* * Model structure */ egraph_model_t mdl; }; #define DEFAULT_EXPL_VECTOR_SIZE 20 #define DEFAULT_CMP_VECTOR_SIZE 20 /* * Option flags: * - each mask selects a bit in the option word * - bit == 1 means option enabled, 0 means option disabled * * DYNAMIC_ACKERMANN enables generation of ackermann lemmas for non-boolean terms. * If it's enabled, max_ackermann is a bound on the number of lemmas generated. * * DYNAMIC_BOOLACKERMANN enables the generation of ackermann lemmas for boolean terms. * If that's enabled, max_boolackermann is a bound on the number of lemmas generated. * * OPTIMISTIC_FCHECK selects the experimental version of final_check instead of the * baseline version. * * In addition, aux_eq_quota is a bound on the total number of new equalities allowed * for ackermann lemmas. * * MAX_INTERFACE_EQS is a bound on the number of interface equalities created * in each call to final_check. */ #define EGRAPH_DYNAMIC_ACKERMANN 0x1 #define EGRAPH_DYNAMIC_BOOLACKERMANN 0x2 #define EGRAPH_OPTIMISTIC_FCHECK 0x4 #define EGRAPH_DISABLE_ALL_OPTIONS 0x0 #define DEFAULT_MAX_ACKERMANN 1000 #define DEFAULT_MAX_BOOLACKERMANN 600000 // unlimited #define DEFAULT_AUX_EQ_QUOTA 100 #define DEFAULT_ACKERMANN_THRESHOLD 8 #define DEFAULT_BOOLACK_THRESHOLD 8 #define DEFAULT_MAX_INTERFACE_EQS 200 // disable boolean and non-boolean ackermann #define EGRAPH_DEFAULT_OPTIONS EGRAPH_DISABLE_ALL_OPTIONS #endif /* __EGRAPH_TYPES_H */
/* * The Yices SMT Solver. Copyright 2014 SRI International. * * This program may only be used subject to the noncommercial end user * license agreement which is downloadable along with this program. */
reveal.ml
open Js_of_ocaml let doc = Dom_html.document let _s = Js.string type configuration = { controls : bool; progress : bool; slide_number : bool; history : bool; keyboard : bool; overview : bool; center : bool; touch : bool; loop : bool; rtl : bool; fragments : bool; embedded : bool; help : bool; show_notes : bool; auto_slide : float; auto_slide_stoppable : bool; mouse_wheel : bool; hide_address_bar : bool; preview_links : bool; transition : Slides.transition; transition_speed : Slides.speed; background_transition : Slides.transition; view_distance : int; remote : bool; } class type math = object method config : Js.js_string Js.t Js.prop end class type dependencies = object method src : Js.js_string Js.t Js.prop method condition : unit -> bool Js.t Js.prop method callback : unit -> bool Js.t Js.prop method async : bool Js.t Js.prop end class type reveal = object method controls: bool Js.t Js.prop method progress: bool Js.t Js.prop method slideNumber: bool Js.t Js.prop method history: bool Js.t Js.prop method keyboard: bool Js.t Js.prop method overview: bool Js.t Js.prop method center: bool Js.t Js.prop method touch: bool Js.t Js.prop method loop: bool Js.t Js.prop method rtl: bool Js.t Js.prop method fragments: bool Js.t Js.prop method embedded: bool Js.t Js.prop method help: bool Js.t Js.prop method showNotes: bool Js.t Js.prop method autoSlide: float Js.prop method autoSlideStoppable : bool Js.t Js.prop method mouseWheel: bool Js.t Js.prop method hideAddressBar: bool Js.t Js.prop method previewLinks: bool Js.t Js.prop method transition: Js.js_string Js.t Js.prop method transitionSpeed: Js.js_string Js.t Js.prop method backgroundTransition: Js.js_string Js.t Js.prop method viewDistance: int Js.prop method remote: bool Js.t Js.prop method math: math Js.t Js.prop method dependencies: dependencies Js.t Js.js_array Js.t Js.prop end let default_global_config = { controls = true; progress = true; slide_number = true; history = false; keyboard = true; overview = true; center = true; touch = true; loop = false; rtl = false; fragments = true; embedded = false; help = true; show_notes= false; auto_slide= 0.; auto_slide_stoppable = true; mouse_wheel = false; hide_address_bar = true; preview_links = false; transition = Slides.None; transition_speed = Slides.Default; background_transition = Slides.None; view_distance = 3; remote = true; } let dep ?(async=None) ?(condition=None) ?(callback=None) src = let obj = Js.Unsafe.obj [||] in obj##.src := _s src; begin match async with | None -> () | Some async -> obj##.async := async end; begin match condition with | None -> () | Some condition -> obj##.condition := condition end; begin match callback with | None -> () | Some callback -> obj##.callback := callback end; obj let initialize ?configuration:(c=default_global_config) () = let open External_js in (* Interpret latex math with MathJax *) let math : math Js.t = Js.Unsafe.obj [||] in math##.config := _s "TeX-AMS_HTML-full"; let deps = Js.array [| (** Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/ *) dep ~async:None ~condition:(Some (fun () -> doc##.body##.classList##.length <> 0)) classList_js; (** Interpret Markdown in <section> elements. *) dep ~condition:(Some (fun () -> doc##querySelector (_s "[data-markdown]"))) marked_js; dep ~async:None ~condition:(Some (fun () -> doc##querySelector (_s "[data-markdown]"))) markdown_js; (** Syntax highlight for <code> elements. *) dep ~callback:(Some (fun () -> (Js.Unsafe.global##.hljs)##initHighlighting())) highlight_js; (** Speaker notes. *) dep note_js; (** MathJax : math equations (cf latex syntax) *) dep math_js; (** Zoom in and out with Alt+click *) dep ~async:(Some Js._true) zoom_js |] in let reveal : reveal Js.t = Js.Unsafe.obj [||] in reveal##.controls := Js.bool c.controls; reveal##.progress := Js.bool c.progress; reveal##.slideNumber := Js.bool c.slide_number; reveal##.history := Js.bool c.history; reveal##.keyboard := Js.bool c.keyboard; reveal##.overview := Js.bool c.overview; reveal##.center := Js.bool c.center; reveal##.touch := Js.bool c.touch; reveal##.loop := Js.bool c.loop; reveal##.rtl := Js.bool c.rtl; reveal##.fragments := Js.bool c.fragments; reveal##.embedded := Js.bool c.embedded; reveal##.help := Js.bool c.help; reveal##.showNotes := Js.bool c.show_notes; reveal##.autoSlide := c.auto_slide; reveal##.autoSlideStoppable := Js.bool c.auto_slide_stoppable; reveal##.mouseWheel := Js.bool c.mouse_wheel; reveal##.hideAddressBar := Js.bool c.hide_address_bar; reveal##.previewLinks := Js.bool c.preview_links; reveal##.transition := _s @@ Slides.string_of_transition c.transition; reveal##.transitionSpeed := _s @@ Slides.string_of_speed c.transition_speed; reveal##.backgroundTransition := _s @@ Slides.string_of_transition c.background_transition; reveal##.viewDistance := c.view_distance; reveal##.remote := Js.bool c.remote; reveal##.math := math; reveal##.dependencies := deps; (* We have to wait until all initialization scripts are correctly loaded. *) Dom_html.window##.onload := Dom_html.handler (fun _ -> ignore (Js.Unsafe.global##.Reveal##initialize reveal); Js.bool true);
(*****************************************************************************) (* *) (* Copyright 2015 OCamlPro *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the Lesser GNU Public License version 3.0. *) (* *) (* This software is distributed in the hope that it will be useful, *) (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) (* Lesser GNU General Public License for more details. *) (* *) (*****************************************************************************)
helpers_services.mli
open Alpha_context type error += Cannot_parse_operation (* `Branch *) type error += Cannot_serialize_log val current_level : 'a #RPC_context.simple -> ?offset:int32 -> 'a -> Level.compat_t shell_tzresult Lwt.t val levels_in_current_cycle : 'a #RPC_context.simple -> ?offset:int32 -> 'a -> (Raw_level.t * Raw_level.t) shell_tzresult Lwt.t module Scripts : sig val run_code : 'a #RPC_context.simple -> 'a -> ?unparsing_mode:Script_ir_translator.unparsing_mode -> ?gas:Gas.Arith.integral -> ?entrypoint:string -> script:Script.expr -> storage:Script.expr -> input:Script.expr -> amount:Tez.t -> balance:Tez.t -> chain_id:Chain_id.t -> source:Contract.t option -> payer:Contract.t option -> (Script.expr * packed_internal_operation list * Lazy_storage.diffs option) shell_tzresult Lwt.t val trace_code : 'a #RPC_context.simple -> 'a -> ?unparsing_mode:Script_ir_translator.unparsing_mode -> ?gas:Gas.Arith.integral -> ?entrypoint:string -> script:Script.expr -> storage:Script.expr -> input:Script.expr -> amount:Tez.t -> balance:Tez.t -> chain_id:Chain_id.t -> source:Contract.t option -> payer:Contract.t option -> ( Script.expr * packed_internal_operation list * Script_interpreter.execution_trace * Lazy_storage.diffs option ) shell_tzresult Lwt.t val typecheck_code : 'a #RPC_context.simple -> 'a -> ?gas:Gas.Arith.integral -> ?legacy:bool -> script:Script.expr -> (Script_tc_errors.type_map * Gas.t) shell_tzresult Lwt.t val typecheck_data : 'a #RPC_context.simple -> 'a -> ?gas:Gas.Arith.integral -> ?legacy:bool -> data:Script.expr -> ty:Script.expr -> Gas.t shell_tzresult Lwt.t val pack_data : 'a #RPC_context.simple -> 'a -> ?gas:Gas.Arith.integral -> data:Script.expr -> ty:Script.expr -> (bytes * Gas.t) shell_tzresult Lwt.t val normalize_data : 'a #RPC_context.simple -> 'a -> ?legacy:bool -> data:Script.expr -> ty:Script.expr -> unparsing_mode:Script_ir_translator.unparsing_mode -> Script.expr shell_tzresult Lwt.t val normalize_script : 'a #RPC_context.simple -> 'a -> script:Script.expr -> unparsing_mode:Script_ir_translator.unparsing_mode -> Script.expr shell_tzresult Lwt.t val run_operation : 'a #RPC_context.simple -> 'a -> op:packed_operation -> chain_id:Chain_id.t -> (packed_protocol_data * Apply_results.packed_operation_metadata) shell_tzresult Lwt.t val entrypoint_type : 'a #RPC_context.simple -> 'a -> script:Script.expr -> entrypoint:string -> Script.expr shell_tzresult Lwt.t val list_entrypoints : 'a #RPC_context.simple -> 'a -> script:Script.expr -> (Michelson_v1_primitives.prim list list * (string * Script.expr) list) shell_tzresult Lwt.t end module Forge : sig module Manager : sig val operations : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> source:public_key_hash -> ?sourcePubKey:public_key -> counter:counter -> fee:Tez.t -> gas_limit:Gas.Arith.integral -> storage_limit:Z.t -> packed_manager_operation list -> bytes shell_tzresult Lwt.t val reveal : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> source:public_key_hash -> sourcePubKey:public_key -> counter:counter -> fee:Tez.t -> unit -> bytes shell_tzresult Lwt.t val transaction : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> source:public_key_hash -> ?sourcePubKey:public_key -> counter:counter -> amount:Tez.t -> destination:Contract.t -> ?entrypoint:string -> ?parameters:Script.expr -> gas_limit:Gas.Arith.integral -> storage_limit:Z.t -> fee:Tez.t -> unit -> bytes shell_tzresult Lwt.t val origination : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> source:public_key_hash -> ?sourcePubKey:public_key -> counter:counter -> balance:Tez.t -> ?delegatePubKey:public_key_hash -> script:Script.t -> gas_limit:Gas.Arith.integral -> storage_limit:Z.t -> fee:Tez.t -> unit -> bytes shell_tzresult Lwt.t val delegation : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> source:public_key_hash -> ?sourcePubKey:public_key -> counter:counter -> fee:Tez.t -> public_key_hash option -> bytes shell_tzresult Lwt.t end val endorsement : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> level:Raw_level.t -> unit -> bytes shell_tzresult Lwt.t val proposals : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> source:public_key_hash -> period:int32 -> proposals:Protocol_hash.t list -> unit -> bytes shell_tzresult Lwt.t val ballot : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> source:public_key_hash -> period:int32 -> proposal:Protocol_hash.t -> ballot:Vote.ballot -> unit -> bytes shell_tzresult Lwt.t val failing_noop : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> message:string -> unit -> Bytes.t shell_tzresult Lwt.t val seed_nonce_revelation : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> level:Raw_level.t -> nonce:Nonce.t -> unit -> bytes shell_tzresult Lwt.t val double_baking_evidence : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> bh1:Block_header.t -> bh2:Block_header.t -> unit -> bytes shell_tzresult Lwt.t val double_endorsement_evidence : 'a #RPC_context.simple -> 'a -> branch:Block_hash.t -> op1:Kind.endorsement operation -> op2:Kind.endorsement operation -> slot:int -> unit -> bytes shell_tzresult Lwt.t val protocol_data : 'a #RPC_context.simple -> 'a -> priority:int -> ?seed_nonce_hash:Nonce_hash.t -> ?proof_of_work_nonce:bytes -> unit -> bytes shell_tzresult Lwt.t end module Parse : sig val operations : 'a #RPC_context.simple -> 'a -> ?check:bool -> Operation.raw list -> Operation.packed list shell_tzresult Lwt.t val block : 'a #RPC_context.simple -> 'a -> Block_header.shell_header -> bytes -> Block_header.protocol_data shell_tzresult Lwt.t end val register : unit -> unit
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************)
sepcomp5.ml
let u = {| type x int. type y int. main :- p x. |} ;; let () = let open Sepcomp.Sepcomp_template in let elpi = init () in let flags = Elpi.API.Compile.default_flags in let u = cc ~elpi ~flags 0 u in Marshal.to_channel (open_out_bin "_log/sepcomp5.unit") u []; exit 0
dune
(executable (name main) (public_name opam-0install) (package opam-0install) (libraries opam-0install opam-state fmt cmdliner))
prettym.ml
include Fancy let io_buffer_size = 65536 (* XXX(dinosaure): if [margin] is set to [io_buffer_size], we should never add an [FWS] token. *) let create = Pretty.create let is_empty = Pretty.is_empty let flush = Pretty.flush let kflush = Pretty.kflush let to_string ?(margin = 78) ?(new_line = "\r\n") gen value = let buf = Buffer.create 0x100 in let emitter = let write a x = let open Enclosure.IOVec in let open Enclosure.Buffer in match x with | { buffer = String x; off; len } -> Buffer.add_substring buf x off len; a + len | { buffer = Bytes x; off; len } -> Buffer.add_subbytes buf x off len; a + len | { buffer = Bigstring x; off; len } -> let x = Bigstringaf.substring x ~off ~len in Buffer.add_string buf x; a + len in List.fold_left write 0 in let encoder = Pretty.create ~emitter ~margin ~new_line 0x100 in let kend encoder = if Pretty.is_empty encoder then () else Fmt.failwith "Leave a non-empty encoder" in let encoder = eval encoder Fancy.[ !!gen ] value in let () = Pretty.kflush kend encoder in Buffer.contents buf let to_stream ?(margin = 78) ?(new_line = "\r\n") gen value = let queue = Queue.create () in let line = Buffer.create 4096 in let emitter iovecs = let write a x = let open Enclosure.IOVec in let open Enclosure.Buffer in match x with | { buffer = String x; off; len } -> Buffer.add_substring line x off len; a + len | { buffer = Bytes x; off; len } -> Buffer.add_subbytes line x off len; a + len | { buffer = Bigstring x; off; len } -> let x = Bigstringaf.substring x ~off ~len in Buffer.add_string line x; a + len in let len = List.fold_left write 0 iovecs in let res = Buffer.contents line in if String.length res > 0 then Queue.add res queue; Buffer.clear line; len in let consumer () = match Queue.pop queue with x -> Some x | exception Queue.Empty -> None in let encoder = Pretty.create ~emitter ~margin ~new_line 4096 in let kend encoder = if Pretty.is_empty encoder then () else Fmt.failwith "Leave with a non-empty encoder" in let () = keval (Pretty.kflush kend) encoder Fancy.[ !!gen ] value in consumer module IOVec = Enclosure.IOVec module Buffer = Enclosure.Buffer
java_to_generic.ml
open Common open Ast_java module G = AST_generic module H = AST_generic_helpers module PI = Parse_info (*****************************************************************************) (* Prelude *) (*****************************************************************************) (* Ast_java to AST_generic. * * See ast_generic.ml for more information. *) (*****************************************************************************) (* Helpers *) (*****************************************************************************) let id x = x let option = Option.map let list = Common.map let (string : string -> string) = id let (bool : bool -> bool) = id let (int : int -> int) = id let error = AST_generic.error let fake tok s = Parse_info.fake_info tok s let unsafe_fake s = Parse_info.unsafe_fake_info s (* todo: to remove at some point when Ast_java includes them directly *) let fb = PI.unsafe_fake_bracket let id_of_entname = function | G.EN (Id (id, idinfo)) -> (id, idinfo) | G.EN _ | G.EDynamic _ | EPattern _ | OtherEntity _ -> raise Impossible let entity_to_param { G.name; attrs; tparams = _unused } t = let id, info = id_of_entname name in { G.pname = Some id; ptype = t; pattrs = attrs; pinfo = info; pdefault = None; } (*****************************************************************************) (* Entry point *) (*****************************************************************************) let info x = x let tok v = info v let wrap _of_a (v1, v2) = let v1 = _of_a v1 and v2 = info v2 in (v1, v2) let bracket of_a (t1, x, t2) = (info t1, of_a x, info t2) let list1 _of_a = list _of_a let ident v = wrap string v let qualified_ident v = list ident v let rec typ = function | TBasic v1 -> let v1 = wrap string v1 in G.ty_builtin v1 | TClass v1 -> class_type v1 | TArray (t1, v1, t2) -> let v1 = typ v1 in G.TyArray ((t1, None, t2), v1) |> G.t | TVar t -> let t = info t in G.TyAny t |> G.t and type_arguments v = bracket (list type_argument) v and class_type v = let res = list1 (fun (v1, v2) -> let v1 = ident v1 and v2 = option type_arguments v2 in (v1, v2)) v in (* TODO: would like simply * G.TyN (H.name_of_ids_with_opt_typeargs res) * but got regressions on aliasing_type.java and misc_generic.java *) match List.rev res with | [] -> raise Impossible (* list1 *) | [ (id, None) ] -> G.TyN (G.Id (id, G.empty_id_info ())) |> G.t | [ (id, Some ts) ] -> G.TyApply (G.TyN (H.name_of_ids [ id ]) |> G.t, ts) |> G.t | (id, None) :: xs -> G.TyN (G.IdQualified { G.name_last = (id, None); name_top = None; name_middle = Some (G.QDots (List.rev xs)); name_info = G.empty_id_info (); }) |> G.t | (id, Some ts) :: xs -> G.TyApply (G.TyN (H.name_of_ids (List.rev (id :: Common.map fst xs))) |> G.t, ts) |> G.t and type_argument = function | TArgument v1 -> let v1 = ref_type v1 in G.TA v1 | TWildCard (v1, v2) -> let v2 = option (fun (v1, v2) -> let v1 = wrap bool v1 and v2 = ref_type v2 in (v1, v2)) v2 in G.TAWildcard (v1, v2) and ref_type v = typ v let type_parameter = function | TParamEllipsis v1 -> G.TParamEllipsis v1 | TParam (v1, v2) -> let v1 = ident v1 and v2 = list ref_type v2 in G.tparam_of_id v1 ~tp_bounds:v2 let rec modifier (x, tok) = let s = Parse_info.str_of_info tok in match x with | Public -> G.attr G.Public tok | Protected -> G.attr G.Protected tok | Private -> G.attr G.Private tok | Abstract -> G.attr G.Abstract tok | Static -> G.attr G.Static tok | Final -> G.attr G.Final tok | StrictFP -> G.unhandled_keywordattr (s, tok) | Transient -> G.unhandled_keywordattr (s, tok) | Volatile -> G.attr G.Volatile tok | Synchronized -> G.unhandled_keywordattr (s, tok) | Native -> G.unhandled_keywordattr (s, tok) | DefaultModifier -> G.unhandled_keywordattr (s, tok) | Sealed -> G.attr G.SealedClass tok | NonSealed -> G.unhandled_keywordattr (s, tok) | Annotation v1 -> annotation v1 and modifiers v = list modifier v and annotation (t, v1, v2) = let v1 = qualified_ident v1 in let xs = match v2 with | None -> fb [] | Some x -> bracket annotation_element x in let name = H.name_of_ids v1 in G.NamedAttr (t, name, xs) and annotation_element = function | AnnotArgValue v1 -> let v1 = element_value v1 in [ G.Arg v1 ] | AnnotArgPairInit v1 -> list annotation_pair v1 | EmptyAnnotArg -> [] and element_value = function | AnnotExprInit v1 -> let v1 = expr v1 in v1 | AnnotNestedAnnot v1 -> let v1 = annotation v1 in G.OtherExpr (("Annot", unsafe_fake ""), [ G.At v1 ]) |> G.e | AnnotArrayInit (t1, v1, t2) -> let v1 = list element_value v1 in G.Container (G.List, (t1, v1, t2)) |> G.e and annotation_pair = function | AnnotPair (v1, v2) -> let v1 = ident v1 and v2 = element_value v2 in G.ArgKwd (v1, v2) | AnnotPairEllipsis v1 -> G.Arg (G.Ellipsis v1 |> G.e) (* id_or_name_of_qualified_ident *) and name v = let v = ident v in G.Id (v, G.empty_id_info ()) (* let res = list1 (fun (v1, v2) -> let _v1TODO = list type_argument v1 and v2 = ident v2 in (v2)) v in (match List.rev res with | [] -> raise Impossible (* list1 *) | [name] -> G.Id (name, G.empty_id_info()) | name::y::xs -> let name_info = { G. name_typeargs = None; (* could be v1TODO above *) name_qualifier = Some (G.QDots (List.rev (y::xs))); } in G.IdQualified ((name, name_info), G.empty_id_info()) ) *) and literal = function | Int v1 -> let v1 = wrap id v1 in G.Int v1 | Float v1 -> let v1 = wrap id v1 in G.Float v1 | String v1 -> let v1 = wrap string v1 in G.String v1 | TextBlock v1 -> (* TODO: remove enclosing triple quotes? or do that in ast_java.ml? *) let v1 = wrap string v1 in G.String v1 | Char v1 -> let v1 = wrap string v1 in G.Char v1 | Null v1 -> let v1 = tok v1 in G.Null v1 | Bool v1 -> let v1 = wrap bool v1 in G.Bool v1 and expr e = (match e with | This t -> G.IdSpecial (G.This, t) | ObjAccessEllipsis (v1, v2) -> let v1 = expr v1 in G.DotAccessEllipsis (v1, v2) | Ellipsis v1 -> let v1 = tok v1 in G.Ellipsis v1 | DeepEllipsis v1 -> let v1 = bracket expr v1 in G.DeepEllipsis v1 | NameId v1 -> G.N (name v1) | NameOrClassType _v1 -> let ii = Lib_parsing_java.ii_of_any (AExpr e) in error (List.hd ii) "NameOrClassType should only appear in (ignored) annotations" | Literal v1 -> let v1 = literal v1 in G.L v1 | ClassLiteral (v1, v2) -> let v1 = typ v1 in G.OtherExpr (("ClassLiteral", v2), [ G.T v1 ]) | NewClass (v0, v1, (lp, v2, rp), v3) -> ( let v1 = typ v1 and v2 = list argument v2 and v3 = option (bracket decls) v3 in match v3 with | None -> G.New (v0, v1, (lp, v2, rp)) | Some decls -> let anonclass = G.AnonClass { G.ckind = (G.Class, v0); cextends = [ (v1, None) ]; cimplements = []; cmixins = []; cparams = []; cbody = decls |> bracket (Common.map (fun x -> G.F x)); } |> G.e in G.Call (anonclass, (lp, v2, rp))) | NewArray (v0, v1, v2, v3, v4) -> ( let v1 = typ v1 and v2 = list argument v2 and v3 = int v3 and v4 = option init v4 in let rec mk_array n = if n < 1 then raise Impossible; (* see parser_java.mly dims | dim_exprs rules *) if n =|= 1 then G.TyArray (fb None, v1) |> G.t else G.TyArray (fb None, mk_array (n - 1)) |> G.t in let t = mk_array (v3 + List.length v2) in match v4 with | None -> G.New (v0, t, fb v2) | Some e -> G.New (v0, t, fb (G.Arg e :: v2))) (* x.new Y(...) {...} *) | NewQualifiedClass (v0, _tok1, tok2, v2, v3, v4) -> let v0 = expr v0 and v2 = typ v2 and v3 = arguments v3 and v4 = option (bracket decls) v4 in let anys = [ G.E v0; G.T v2 ] @ (v3 |> PI.unbracket |> Common.map (fun arg -> G.Ar arg)) @ (Option.to_list v4 |> Common.map PI.unbracket |> List.flatten |> Common.map (fun st -> G.S st)) in G.OtherExpr (("NewQualifiedClass", tok2), anys) | MethodRef (v1, v2, v3, v4) -> let v1 = expr_or_type v1 in let v2 = tok v2 in let _v3TODO = option type_arguments v3 in let v4 = ident v4 in (* TODO? use G.GetRef? *) G.OtherExpr (("MethodRef", v2), [ v1; G.I v4 ]) | Call (v1, v2) -> let v1 = expr v1 and v2 = arguments v2 in G.Call (v1, v2) | Dot (v1, t, v2) -> let v1 = expr v1 and t = info t and v2 = ident v2 in G.DotAccess (v1, t, G.FN (G.Id (v2, G.empty_id_info ()))) | ArrayAccess (v1, v2) -> let v1 = expr v1 and v2 = bracket expr v2 in G.ArrayAccess (v1, v2) | Postfix (v1, (v2, tok)) -> let v1 = expr v1 and v2 = fix_op v2 in G.Call (G.IdSpecial (G.IncrDecr (v2, G.Postfix), tok) |> G.e, fb [ G.Arg v1 ]) | Prefix ((v1, tok), v2) -> let v1 = fix_op v1 and v2 = expr v2 in G.Call (G.IdSpecial (G.IncrDecr (v1, G.Prefix), tok) |> G.e, fb [ G.Arg v2 ]) | Unary (v1, v2) -> let v1, tok = v1 and v2 = expr v2 in G.Call (G.IdSpecial (G.Op v1, tok) |> G.e, fb [ G.Arg v2 ]) | Infix (v1, (v2, tok), v3) -> let v1 = expr v1 and v2 = v2 and v3 = expr v3 in G.Call (G.IdSpecial (G.Op v2, tok) |> G.e, fb [ G.Arg v1; G.Arg v3 ]) | Cast ((l, v1, _), v2) -> let v1 = list typ v1 and v2 = expr v2 in let t = Common2.foldl1 (fun acc e -> G.TyAnd (acc, fake l "&", e) |> G.t) v1 in G.Cast (t, l, v2) | InstanceOf (v1, v2) -> let v1 = expr v1 and v2 = ref_type v2 in G.Call ( G.IdSpecial (G.Instanceof, unsafe_fake "instanceof") |> G.e, fb [ G.Arg v1; G.ArgType v2 ] ) | Conditional (v1, v2, v3) -> let v1 = expr v1 and v2 = expr v2 and v3 = expr v3 in G.Conditional (v1, v2, v3) | Assign (v1, v2, v3) -> let v1 = expr v1 and v2 = info v2 and v3 = expr v3 in G.Assign (v1, v2, v3) | AssignOp (v1, (v2, tok), v3) -> let v1 = expr v1 and v3 = expr v3 in G.AssignOp (v1, (v2, tok), v3) | TypedMetavar (v1, v2) -> let v1 = ident v1 in let v2 = typ v2 in G.TypedMetavar (v1, Parse_info.fake_info (snd v1) " ", v2) | Lambda (v1, t, v2) -> let v1 = parameters v1 in let v2 = stmt v2 in G.Lambda { G.fparams = v1; frettype = None; fbody = G.FBStmt v2; fkind = (G.Arrow, t); } | SwitchE (v0, v1, v2) -> let v0 = info v0 in let v1 = expr v1 and v2 = list (fun (v1, v2) -> let v1 = cases v1 and v2 = stmts v2 in (v1, G.stmt1 v2)) v2 |> Common.map (fun x -> G.CasesAndBody x) in let x = G.stmt_to_expr (G.Switch (v0, Some (Cond v1), v2) |> G.s) in x.G.e) |> G.e and class_parent v : G.class_parent = let v = ref_type v in (v, None) and expr_or_type = function | Left e -> G.E (expr e) | Right t -> G.T (typ t) and argument v = let v = expr v in G.Arg v and arguments v : G.argument list G.bracket = bracket (list argument) v and fix_op v = v and resource t (v : resource) : G.stmt = match v with | Left v -> let ent, v = var_with_init v in G.DefStmt (ent, G.VarDef v) |> G.s | Right e -> G.ExprStmt (expr e, t) |> G.s and resources (_t1, v, t2) = list (resource t2) v and stmt st = match stmt_aux st with | [] -> G.s (Block (PI.unsafe_fake_bracket [])) | [ st ] -> st | xs -> (* This should never happen in a context where we want a single statement. In Java, Blocks correspond with a new scope, so in `stmt_aux` we should explicitly create a Block when we want one. This means that if we reach this case, we do not want a new scope, and should not create a new Block. To avoid giving users errors when we don't need to (e.g. they just want to match) we'll create one anyway, but a good way to debug scoping issues is to put a failwith here. If you run into this, you probably instead want to flatten the statements *) let warning = "this-should-never-happen-and-could-be-a-scoping-problem" in G.s (Block (G.fake warning, xs, G.fake warning)) and stmt_aux st = match st with | EmptyStmt t -> [ G.Block (t, [], t) |> G.s ] | Block v1 -> let v1 = bracket stmts v1 in [ G.Block v1 |> G.s ] | Expr (v1, t) -> let v1 = expr v1 in [ G.ExprStmt (v1, t) |> G.s ] | If (t, v1, v2, v3) -> let v1 = expr v1 and v2 = stmt v2 and v3 = option stmt v3 in [ G.If (t, G.Cond v1, v2, v3) |> G.s ] | Switch (v0, v1, v2) -> let v0 = info v0 in let v1 = expr v1 and v2 = list (fun (v1, v2) -> let v1 = cases v1 and v2 = stmts v2 in (v1, G.stmt1 v2)) v2 |> Common.map (fun x -> G.CasesAndBody x) in [ G.Switch (v0, Some (G.Cond v1), v2) |> G.s ] | While (t, v1, v2) -> let v1 = expr v1 and v2 = stmt v2 in [ G.While (t, G.Cond v1, v2) |> G.s ] | Do (t, v1, v2) -> let v1 = stmt v1 and v2 = expr v2 in [ G.DoWhile (t, v1, v2) |> G.s ] | For (t, v1, v2) -> let v1 = for_control t v1 and v2 = stmt v2 in [ G.For (t, v1, v2) |> G.s ] | Break (t, v1) -> let v1 = H.opt_to_label_ident v1 in [ G.Break (t, v1, G.sc) |> G.s ] | Continue (t, v1) -> let v1 = H.opt_to_label_ident v1 in [ G.Continue (t, v1, G.sc) |> G.s ] | Return (t, v1) -> let v1 = option expr v1 in [ G.Return (t, v1, G.sc) |> G.s ] | Label (v1, v2) -> let v1 = ident v1 and v2 = stmt v2 in [ G.Label (v1, v2) |> G.s ] | Sync (v0, v1, v2) -> let v1 = expr v1 and v2 = stmt v2 in [ G.OtherStmtWithStmt (G.OSWS_Block ("Sync", v0), [ G.E v1 ], v2) |> G.s ] | Try (t, v0, v1, v2, v3) -> ( let v1 = stmt v1 and v2 = catches v2 and v3 = option tok_and_stmt v3 in let try_stmt = G.Try (t, v1, v2, v3) |> G.s in match v0 with | None -> [ try_stmt ] | Some r -> [ G.WithUsingResource (t, resources r, try_stmt) |> G.s ]) | Throw (t, v1) -> let v1 = expr v1 in [ G.Throw (t, v1, G.sc) |> G.s ] | LocalVarList vs -> Common.map (fun v1 -> let ent, v = var_with_init v1 in G.DefStmt (ent, G.VarDef v) |> G.s) vs | DeclStmt v1 -> [ decl v1 ] | DirectiveStmt v1 -> [ directive v1 ] | Assert (t, v1, v2) -> let v1 = expr v1 and v2 = option expr v2 in let es = v1 :: Option.to_list v2 in let args = es |> Common.map G.arg in [ G.Assert (t, fb args, G.sc) |> G.s ] and tok_and_stmt (t, v) = let v = stmt v in (t, v) and stmts v = list stmt_aux v |> List.flatten and case = function | Case (t, v1) -> let v1 = expr v1 in G.Case (t, H.expr_to_pattern v1) | Default t -> G.Default t and cases v = list case v and list_to_opt_seq = function | [] -> None | [ e ] -> Some e | xs -> Some (G.Seq xs |> G.e) and for_control tok = function | ForEllipsis t -> G.ForEllipsis t | ForClassic (v1, v2, v3) -> let v1 = for_init v1 and v2 = list expr v2 and v3 = list expr v3 in G.ForClassic (v1, list_to_opt_seq v2, list_to_opt_seq v3) | Foreach (v1, v2) -> let ent, typ = var v1 and v2 = expr v2 in let id, _idinfo = id_of_entname ent.G.name in let patid = G.PatId (id, G.empty_id_info ()) in let pat = match typ with | Some t -> G.PatTyped (patid, t) | None -> error tok "TODO: Foreach without a type" in G.ForEach (pat, fake (snd id) "in", v2) and for_init = function | ForInitVars v1 -> let v1 = list var_with_init v1 in v1 |> Common.map (fun (ent, v) -> G.ForInitVar (ent, v)) | ForInitExprs v1 -> let v1 = list expr v1 in v1 |> Common.map (fun e -> G.ForInitExpr e) and var { name; mods; type_ = xtyp } = let v1 = ident name in let v2 = modifiers mods in let v3 = option typ xtyp in (G.basic_entity v1 ~attrs:v2, v3) and catch (tok, catch_exn, v2) = let v2 = stmt v2 in let exn = match catch_exn with | CatchParam (v1, _union_types) -> ( let ent, typ = var v1 in let id, _idinfo = id_of_entname ent.G.name in match typ with | Some t -> G.CatchParam (G.param_of_type t ~pname:(Some id)) | None -> error tok "TODO: Catch without a type") | CatchEllipsis t -> G.CatchPattern (G.PatEllipsis t) in (tok, exn, v2) and catches v = list catch v and var_with_init { f_var; f_init } = let ent, t = var f_var in let init = option init f_init in (ent, { G.vinit = init; vtype = t }) and init = function | ExprInit v1 -> let v1 = expr v1 in v1 | ArrayInit v1 -> let v1 = bracket (list init) v1 in G.Container (G.Array, v1) |> G.e and parameters v = Common.map parameter_binding v and parameter_binding = function | ParamClassic v | ParamReceiver v -> let ent, t = var v in G.Param (entity_to_param ent t) | ParamSpread (tk, v) -> let ent, t = var v in let p = entity_to_param ent t in G.ParamRest (tk, p) | ParamEllipsis t -> G.ParamEllipsis t and method_decl ?(cl_kind = None) { m_var; m_formals; m_throws; m_body } = let ent, rett = var m_var in let v2 = parameters m_formals in let v3 = list typ m_throws in let v4 = stmt m_body in (* TODO: use fthrow field instead *) let throws = v3 |> Common.map (fun t -> G.OtherAttribute (("Throw", G.fake ""), [ G.T t ])) in let fbody = match (cl_kind, v4) with | Some (Interface, _), { s = G.Block (_, [], _); _ } -> G.FBNothing | _ -> FBStmt v4 in ( { ent with G.attrs = ent.G.attrs @ throws }, { G.fparams = v2; frettype = rett; fbody; fkind = (G.Method, G.fake "") } ) and field v = var_with_init v and enum_decl { en_name; en_mods; en_impls; en_body } = let v1 = ident en_name in let v2 = modifiers en_mods in let v3 = list class_parent en_impls in let v4, v5 = en_body in let v4 = list enum_constant v4 |> Common.map G.fld in let v5 = decls v5 |> Common.map (fun st -> G.F st) in let ent = G.basic_entity v1 ~attrs:(G.attr EnumClass (snd v1) :: v2) in let cbody = fb (v4 @ v5) in let cdef = { G.ckind = (G.Class, snd v1); cextends = v3; cmixins = []; cimplements = []; cparams = []; cbody; } in (ent, cdef) and enum_constant (v1, v2, v3) = let id = ident v1 in let v2 = option arguments v2 in let v3 = option class_body v3 in let ent = G.basic_entity id in let def = { G.ee_args = v2; ee_body = v3 } in (ent, G.EnumEntryDef def) and class_body ?(cl_kind = None) (l, xs, r) : G.field list G.bracket = let xs = decls ~cl_kind xs |> Common.map (fun x -> G.F x) in (l, xs, r) and class_decl { cl_name; cl_kind; cl_tparams; cl_mods; cl_extends; cl_impls; cl_body; cl_formals; } = let v1 = ident cl_name in let v2, more_attrs = class_kind_and_more cl_kind in let v3 = list type_parameter cl_tparams in let v4 = modifiers cl_mods in let v5 = option class_parent cl_extends in let v6 = list ref_type cl_impls in let cparams = parameters cl_formals in let fields = class_body ~cl_kind:(Some cl_kind) cl_body in let ent = G.basic_entity v1 ~attrs:(more_attrs @ v4) ~tparams:v3 in let cdef = { G.ckind = v2; cextends = Option.to_list v5; cimplements = v6; cmixins = []; cparams; cbody = fields; } in (ent, cdef) and class_kind_and_more (x, t) = match x with | ClassRegular -> ((G.Class, t), []) | Interface -> ((G.Interface, t), []) | AtInterface -> ((G.Interface, t), [ G.attr AnnotationClass t ]) | Record -> ((G.Class, t), [ G.attr RecordClass t ]) and decl ?(cl_kind = None) decl : G.stmt = match decl with | Class v1 -> let ent, def = class_decl v1 in G.DefStmt (ent, G.ClassDef def) |> G.s | Method v1 -> let ent, def = method_decl ~cl_kind v1 in G.DefStmt (ent, G.FuncDef def) |> G.s | Field v1 -> let ent, def = field v1 in G.DefStmt (ent, G.VarDef def) |> G.s | Enum v1 -> let ent, def = enum_decl v1 in G.DefStmt (ent, G.ClassDef def) |> G.s | Init (v1, v2) -> ( let st = stmt v2 in match v1 with | Some tstatic -> G.OtherStmtWithStmt (G.OSWS_Block ("Static", tstatic), [], st) |> G.s | None -> st) | DeclEllipsis v1 -> G.ExprStmt (G.Ellipsis v1 |> G.e, G.sc) |> G.s | EmptyDecl t -> G.Block (t, [], t) |> G.s | AnnotationTypeElementTodo t -> G.OtherStmt (G.OS_Todo, [ G.Tk t ]) |> G.s and decls ?(cl_kind = None) v : G.stmt list = list (decl ~cl_kind) v and import = function | ImportAll (t, xs, tok) -> G.ImportAll (t, G.DottedName xs, tok) | ImportFrom (t, xs, id) -> let id = ident id in G.ImportFrom (t, G.DottedName xs, [ (id, None) ]) and directive = function | Import (static, v2) -> let d_attrs = match static with | None -> [] | Some t -> [ G.attr G.Static t ] in G.DirectiveStmt { G.d = import v2; d_attrs } |> G.s | Package (t, qu, _t2) -> let qu = qualified_ident qu in G.DirectiveStmt (G.Package (t, qu) |> G.d) |> G.s | ModuleTodo t -> G.OtherStmt (G.OS_Todo, [ G.Tk t ]) |> G.s let program v = stmts v let partial = function | PartialDecl x -> ( let x = decl x in match x.G.s with | G.DefStmt def -> G.PartialDef def | _ -> failwith "unsupported PartialDecl") | PartialIf (v1, v2) -> let v2 = expr v2 in G.PartialIf (v1, v2) | PartialTry (v1, v2) -> let v2 = stmt v2 in G.PartialTry (v1, v2) | PartialFinally (v1, v2) -> let v2 = stmt v2 in G.PartialFinally (v1, v2) | PartialCatch v1 -> let v1 = catch v1 in G.PartialCatch v1 let any = function | AMod v1 -> let v1 = modifier v1 in G.At v1 | Partial v1 -> let v1 = partial v1 in G.Partial v1 | AIdent v1 -> let v1 = ident v1 in G.I v1 | AExpr v1 -> let v1 = expr v1 in G.E v1 | AStmt v1 -> let v1 = stmt v1 in G.S v1 | AStmts v1 -> let v1 = Common.map stmt v1 in G.Ss v1 | ATyp v1 -> let v1 = typ v1 in G.T v1 | AVar v1 -> let ent, t = var v1 in G.Def (ent, G.VarDef { G.vtype = t; vinit = None }) | AInit v1 -> let v1 = init v1 in G.E v1 | AMethod v1 -> let ent, def = method_decl v1 in G.Def (ent, G.FuncDef def) | AField v1 -> let ent, def = field v1 in G.Def (ent, G.VarDef def) | AClass v1 -> let ent, def = class_decl v1 in G.Def (ent, G.ClassDef def) | AProgram v1 -> let v1 = program v1 in G.Pr v1
(* Yoann Padioleau * * Copyright (C) 2019 r2c * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * version 2.1 as published by the Free Software Foundation, with the * special exception on linking described in file LICENSE. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file * LICENSE for more details. *)
script_list.ml
open Script_typed_ir let empty : 'a boxed_list = {elements = []; length = 0} let cons : 'a -> 'a boxed_list -> 'a boxed_list = fun elt l -> {length = 1 + l.length; elements = elt :: l.elements}
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* Copyright (c) 2020 Metastate AG <hello@metastate.dev> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************)
stock_data.mli
open Core val data : (Date.t * float * float) list
coq_mode.ml
(* This file is licensed under The MIT License *) (* (c) MINES ParisTech 2018-2019 *) (* (c) INRIA 2020 *) (* Written by: Emilio Jesús Gallego Arias *) (* Legacy is used to signal that we are in a mode prior to Coq syntax 0.3 , where mode was not supported, this allows us support older Coq compiler versions with coq-lang < 0.3 *) type t = | Legacy | VoOnly | Native let decode = Dune_lang.Decoder.(enum [ ("vo", VoOnly); ("native", Native) ])
(* This file is licensed under The MIT License *) (* (c) MINES ParisTech 2018-2019 *) (* (c) INRIA 2020 *) (* Written by: Emilio Jesús Gallego Arias *)
unit_parsing_js.mli
(* Test suite for this folder. *) val tests : Testutil.test list
(* Test suite for this folder. *) val tests : Testutil.test list
foo.ml
let () = prerr_endline X.x
dune
(library (name albatross) (public_name albatross) (instrumentation (backend bisect_ppx)) (wrapped false) (modules vmm_core vmm_commands vmm_compress vmm_trie vmm_trie vmm_ring vmm_asn vmm_resources) (libraries logs ipaddr ptime duration cstruct bigstringaf decompress.de decompress.zl asn1-combinators fpath metrics mirage-crypto hex)) (library (name albatross_unix) (public_name albatross.unix) (wrapped false) (modules vmm_unix vmm_lwt vmm_vmmd) (libraries albatross ipaddr.unix bos solo5-elftool lwt lwt.unix))
cache_compute.c
#include "bernoulli.h" TLS_PREFIX slong bernoulli_cache_num = 0; TLS_PREFIX fmpq * bernoulli_cache = NULL; void bernoulli_cleanup(void) { slong i; for (i = 0; i < bernoulli_cache_num; i++) fmpq_clear(bernoulli_cache + i); flint_free(bernoulli_cache); bernoulli_cache = NULL; bernoulli_cache_num = 0; } void bernoulli_cache_compute(slong n) { slong old_num = bernoulli_cache_num; if (old_num < n) { slong i, new_num; if (old_num == 0) { flint_register_cleanup_function(bernoulli_cleanup); } if (n <= 128) new_num = FLINT_MAX(old_num + 32, n); else new_num = FLINT_MAX(old_num + 128, n); bernoulli_cache = flint_realloc(bernoulli_cache, new_num * sizeof(fmpq)); for (i = old_num; i < new_num; i++) fmpq_init(bernoulli_cache + i); if (new_num <= 128) { /* todo: use recursion, but only compute new entries */ arith_bernoulli_number_vec(bernoulli_cache, new_num); } else { bernoulli_fmpq_vec_no_cache(bernoulli_cache + old_num, old_num, new_num - old_num); } bernoulli_cache_num = new_num; } }
/* Copyright (C) 2012 Fredrik Johansson This file is part of Arb. Arb is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <http://www.gnu.org/licenses/>. */
dune
(library (name caramel_typing) (public_name caramel.typing) (instrumentation (backend bisect_ppx)) (libraries erlang caramel.compiler.erlang_to_native caramel.compiler.ocaml_archive caramel.compiler.misc compiler-libs.common compiler-libs.optcomp sexplib))
local_gas_counter.mli
(** This module exposes an API for local gas counting. It provides a set of functions for updating a gas counter without applying it on an an [Alpha_context.context]. *) (** A [local_gas_counter] is a wrapped [int]. *) type local_gas_counter = Local_gas_counter of int [@@ocaml.unboxed] (** A type for describing a context that is not up to date with respect to gas consumption. *) type outdated_context (*** [update_context gas_counter outdated_ctxt] returns a regular context, extracted from [outdated_ctxt] with [gas_counter] applied. *) val update_context : local_gas_counter -> outdated_context -> Alpha_context.context (** [local_gas_counter_and_outdated_context ctxt] returns the gas counter value corresponding to the remaining gas in the given context [ctxt] along with an [outdated_context] value. *) val local_gas_counter_and_outdated_context : Alpha_context.context -> local_gas_counter * outdated_context (** [use_gas_counter_in_context outdated_ctxt gas_counter f] first applies the [gas_counter] on the outdated context [outdated_ctxt], then invokes [f] on the resulting context, and returns a new [outdated_context] and a [local_gas_counter] value. *) val use_gas_counter_in_context : outdated_context -> local_gas_counter -> (Alpha_context.context -> ('a * Alpha_context.context) tzresult Lwt.t) -> ('a * outdated_context * local_gas_counter) tzresult Lwt.t (** [consume_opt amt cost] attempts to consume an [amt] of gas and returns the new remaining value wrapped in [Some]. If the resulting gas is negative [None] is returned. *) val consume_opt : local_gas_counter -> Alpha_context.Gas.cost -> local_gas_counter option (** [consume amt cost] attempts to consume an [amt] of gas and returns the new remaining value as a result. If the resulting gas is negative, an error [Gas.Operation_quota_exceeded] is instead returned. *) val consume : local_gas_counter -> Alpha_context.Gas.cost -> local_gas_counter tzresult
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2022 Trili Tech, <contact@trili.tech> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************)
sdlkeymod_stub.h
#ifndef _CAML_SDL_KEYMOD_ #define _CAML_SDL_KEYMOD_ value Val_SDL_Keymod(SDL_Keymod kmod_mask); #endif /* _CAML_SDL_KEYMOD_ */
cond_probes.ml
let g x = Printf.printf "g:%d\n" (x-1) let f x = if x > 0 then [%probe "foo" (g x)]; Printf.printf "f:%d\n" x let () = f (Sys.opaque_identity 10)
test.ml
open Format open Vector let () = let v = make 0 ~dummy:42 in push v 17; push v 2; assert (length v = 2); append v v; assert (length v = 4); assert (get v 2 = 17) let () = let n = 20 in let v = make 1 ~dummy:0 in push v 1; for i = 2 to n do push v (get v (i-2) + get v (i-1)) done; assert (length v = n+1); iter (fun x -> printf "%d " x) v; printf "@."; assert (get v n = 6765) (* stack *) let () = let s = create ~dummy:42 in push s 1; assert (top s = 1); push s 2; push s 3; assert (top s = 3); assert (pop s = 3); assert (top s = 2); assert (pop s = 2); assert (top s = 1); assert (pop s = 1); assert (length s = 0); assert (try ignore (top s); false with Empty -> true); assert (try ignore (pop s); false with Empty -> true); () let () = let v = make 12 ~dummy:() in for i = 0 to 1000 do resize v i done; for i = 1000 downto 0 do resize v i done; for _ = 1 to 1000 do resize v (Random.int 10_000) done; ()
subst.mli
open Import val command : unit Cmd.t
atpanic.ml
open Lua_api;; let (|>) x f = f x;; Random.self_init ();; let opt_get o = match o with | Some v -> v | None -> raise Not_found exception Test_exception let counter = ref 0;; let panicf1 _ = Printf.printf "panicf1: %d\n%!" !counter; raise Test_exception ;; let push_get_call_c_function ls f = Lua.pushocamlfunction ls f; let f' = Lua.tocfunction ls (-1) in Lua.pop ls 1; match f' with | None -> failwith "This should be a function, something went wrong!" | Some f -> begin Printf.printf "Calling an OCaml function obtained from Lua: %!"; f ls |> ignore; end ;; let test_loop () = let simple_ocaml_function _ = let () = Test_common.allocate ~random:false 479 99733 |> ignore in Printf.printf "OCaml function called from Lua!!!:-)\n%!"; 0 in let l1 = LuaL.newstate () in let l2 = LuaL.newstate () in try let str_list = Test_common.allocate ~random:false 479 99733 in let panicf2 ls = ignore str_list; push_get_call_c_function ls simple_ocaml_function; Printf.printf "panicf2: %d\n%!" !counter; raise Test_exception in let n = Random.int 2 in let f = match n with | 0 -> panicf1 | 1 -> panicf2 | _ -> failwith "IMPOSSIBILE" in (* TODO TODO TODO * ATTENZIONE, ELIMINARE QUESTI TEST DA QUI E CREARE UN TEST SPECIFICO. * SONO IMPORTANTI, MA QUI NON C'ENTRANO NULLA! (* Light userdata test *) for i = 1 to 50 do let something = Test_common.allocate_many_small () in Lua.pushlightuserdata l1 something; let something' : string list = match Lua.touserdata l1 (-1) with | Some `Userdata v -> failwith "USERDATA" | Some `Light_userdata v -> v | None -> failwith "NOT A USER DATUM" in Lua.pop l1 1; List.iter2 (fun s s' -> if s <> s' then failwith (Printf.sprintf "\"%s\" <> \"%s\"" s s')) something something' done; (* Userdata test *) for i = 1 to 50 do let something = Test_common.allocate_many_small () in Lua.newuserdata l2 something; let something' : string list = match Lua.touserdata l2 (-1) with | Some `Userdata v -> v | Some `Light_userdata v -> failwith "LIGHT USERDATA" | None -> failwith "NOT A USER DATUM" in Lua.pop l2 1; List.iter2 (fun s s' -> if s <> s' then failwith (Printf.sprintf "\"%s\" <> \"%s\"" s s')) something something' done; ***************************************************************************) let def_panic1 = Lua.atpanic l1 f in let def_panic2 = Lua.atpanic l2 f in Lua.pushfstring l1 "Custom message on %s%d stack" "L" 1 |> ignore; Lua.pushstring l2 "Custom message on L2 stack"; let my_panic1 = Lua.atpanic l1 def_panic1 in let my_panic2 = Lua.atpanic l2 def_panic2 in let def_panic1 = Lua.atpanic l1 my_panic1 in let def_panic2 = Lua.atpanic l2 my_panic2 in ignore(def_panic1, def_panic2); ignore (Lua.pushocamlfunction l1 simple_ocaml_function); Lua.setglobal l1 "simple_ocaml_function"; LuaL.openlibs l1; LuaL.openlibs l2; LuaL.loadbuffer l1 "simple_ocaml_function()\n" "line" |> ignore; LuaL.loadbuffer l2 "a = 42\nb = 43\nc = a + b\n-- print(c)" "line" |> ignore; let () = match Lua.pcall l1 0 0 0 with | Lua.LUA_OK -> () | err -> raise (Lua.Error err) in let () = match Lua.pcall l2 0 0 0 with | Lua.LUA_OK -> () | err -> raise (Lua.Error err) in let n = Random.int 2 in match n with | 0 -> Lua.error l1 | 1 -> Lua.error l2 | _ -> failwith "IMPOSSIBILE" with | Lua.Error _ -> begin Printf.printf "%s\n%!" ((Lua.tostring l1 (-1)) |> opt_get); Lua.pop l1 1; failwith "FATAL ERROR" end; ;; let main () = let open Test_common in let time_start = Unix.gettimeofday () in while Unix.gettimeofday () < time_start +. 10.0 do sleep_float 0.1; Gc.compact (); done; let test_duration = 60.0 *. 1.0 in let time_start = Unix.gettimeofday () in while Unix.gettimeofday () < time_start +. test_duration do let () = try test_loop () with Test_exception -> () in counter := !counter + 1; done; Gc.compact (); let time_start = Unix.gettimeofday () in while Unix.gettimeofday () < time_start +. 30.0 do sleep_float 1.0; Gc.compact (); done; ;; Test_common.run main ()
vgg16.ml
#!/usr/bin/env owl (* This example demonstrates how to use Owl to implement VGG16 (https://arxiv.org/abs/1409.1556). Note that only the network structure of VGG16 is defined. If you want to use VGG16 for inference, please use Zoo system to pull in the gist: f5409c44d6444921a8ceec00e33c42c4 which includes both the definition of network structure and URL of pre-trained weights. *) open Owl open Neural.S open Neural.S.Graph let make_network img_size = input [|img_size;img_size;3|] (* block 1 *) |> conv2d [|3;3;3;64|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> conv2d [|3;3;64;64|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> max_pool2d [|2;2|] [|2;2|] ~padding:VALID (* block 2 *) |> conv2d [|3;3;64;128|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> conv2d [|3;3;128;128|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> max_pool2d [|2;2|] [|2;2|] ~padding:VALID (* block 3 *) |> conv2d [|3;3;128;256|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> conv2d [|3;3;256;256|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> conv2d [|3;3;256;256|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> max_pool2d [|2;2|] [|2;2|] ~padding:VALID (* block 4 *) |> conv2d [|3;3;256;512|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> conv2d [|3;3;512;512|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> conv2d [|3;3;512;512|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> max_pool2d [|2;2|] [|2;2|] ~padding:VALID (* block 5 *) |> conv2d [|3;3;512;512|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> conv2d [|3;3;512;512|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> conv2d [|3;3;512;512|] [|1;1|] ~act_typ:Activation.Relu ~padding:SAME |> max_pool2d [|2;2|] [|2;2|] ~padding:VALID (* classification block *) |> flatten |> fully_connected ~act_typ:Activation.Relu 4096 |> fully_connected ~act_typ:Activation.Relu 4096 |> fully_connected ~act_typ:Activation.(Softmax 1) 1000 |> get_network let _ = make_network 224 |> print
newton.ml
let iter dx f x0 = let y = f x0 in let dy= (f(x0 +. dx) -. y) in x0 -. dx *. y /. dy let phi_iter x0 = (x0 *. x0 +. 1.0) /. (2.0 *. x0 -. 1.0)
(* Newton -- Newton's method BSD Owl Scripts (https://github.com/michipili/bsdowl) This file is part of BSD Owl Scripts Copyright © 2005–2014 Michael Grünewald This file must be used under the terms of the CeCILL-B. This source file is licensed as described in the file COPYING, which you should have received as part of this distribution. The terms are also available at http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.txt *)
cmathmodule.c.h
/*[clinic input] preserve [clinic start generated code]*/ PyDoc_STRVAR(cmath_acos__doc__, "acos($module, z, /)\n" "--\n" "\n" "Return the arc cosine of z."); #define CMATH_ACOS_METHODDEF \ {"acos", (PyCFunction)cmath_acos, METH_O, cmath_acos__doc__}, static Py_complex cmath_acos_impl(PyObject *module, Py_complex z); static PyObject * cmath_acos(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_acos_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_acosh__doc__, "acosh($module, z, /)\n" "--\n" "\n" "Return the inverse hyperbolic cosine of z."); #define CMATH_ACOSH_METHODDEF \ {"acosh", (PyCFunction)cmath_acosh, METH_O, cmath_acosh__doc__}, static Py_complex cmath_acosh_impl(PyObject *module, Py_complex z); static PyObject * cmath_acosh(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_acosh_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_asin__doc__, "asin($module, z, /)\n" "--\n" "\n" "Return the arc sine of z."); #define CMATH_ASIN_METHODDEF \ {"asin", (PyCFunction)cmath_asin, METH_O, cmath_asin__doc__}, static Py_complex cmath_asin_impl(PyObject *module, Py_complex z); static PyObject * cmath_asin(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_asin_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_asinh__doc__, "asinh($module, z, /)\n" "--\n" "\n" "Return the inverse hyperbolic sine of z."); #define CMATH_ASINH_METHODDEF \ {"asinh", (PyCFunction)cmath_asinh, METH_O, cmath_asinh__doc__}, static Py_complex cmath_asinh_impl(PyObject *module, Py_complex z); static PyObject * cmath_asinh(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_asinh_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_atan__doc__, "atan($module, z, /)\n" "--\n" "\n" "Return the arc tangent of z."); #define CMATH_ATAN_METHODDEF \ {"atan", (PyCFunction)cmath_atan, METH_O, cmath_atan__doc__}, static Py_complex cmath_atan_impl(PyObject *module, Py_complex z); static PyObject * cmath_atan(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_atan_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_atanh__doc__, "atanh($module, z, /)\n" "--\n" "\n" "Return the inverse hyperbolic tangent of z."); #define CMATH_ATANH_METHODDEF \ {"atanh", (PyCFunction)cmath_atanh, METH_O, cmath_atanh__doc__}, static Py_complex cmath_atanh_impl(PyObject *module, Py_complex z); static PyObject * cmath_atanh(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_atanh_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_cos__doc__, "cos($module, z, /)\n" "--\n" "\n" "Return the cosine of z."); #define CMATH_COS_METHODDEF \ {"cos", (PyCFunction)cmath_cos, METH_O, cmath_cos__doc__}, static Py_complex cmath_cos_impl(PyObject *module, Py_complex z); static PyObject * cmath_cos(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_cos_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_cosh__doc__, "cosh($module, z, /)\n" "--\n" "\n" "Return the hyperbolic cosine of z."); #define CMATH_COSH_METHODDEF \ {"cosh", (PyCFunction)cmath_cosh, METH_O, cmath_cosh__doc__}, static Py_complex cmath_cosh_impl(PyObject *module, Py_complex z); static PyObject * cmath_cosh(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_cosh_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_exp__doc__, "exp($module, z, /)\n" "--\n" "\n" "Return the exponential value e**z."); #define CMATH_EXP_METHODDEF \ {"exp", (PyCFunction)cmath_exp, METH_O, cmath_exp__doc__}, static Py_complex cmath_exp_impl(PyObject *module, Py_complex z); static PyObject * cmath_exp(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_exp_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_log10__doc__, "log10($module, z, /)\n" "--\n" "\n" "Return the base-10 logarithm of z."); #define CMATH_LOG10_METHODDEF \ {"log10", (PyCFunction)cmath_log10, METH_O, cmath_log10__doc__}, static Py_complex cmath_log10_impl(PyObject *module, Py_complex z); static PyObject * cmath_log10(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_log10_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_sin__doc__, "sin($module, z, /)\n" "--\n" "\n" "Return the sine of z."); #define CMATH_SIN_METHODDEF \ {"sin", (PyCFunction)cmath_sin, METH_O, cmath_sin__doc__}, static Py_complex cmath_sin_impl(PyObject *module, Py_complex z); static PyObject * cmath_sin(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_sin_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_sinh__doc__, "sinh($module, z, /)\n" "--\n" "\n" "Return the hyperbolic sine of z."); #define CMATH_SINH_METHODDEF \ {"sinh", (PyCFunction)cmath_sinh, METH_O, cmath_sinh__doc__}, static Py_complex cmath_sinh_impl(PyObject *module, Py_complex z); static PyObject * cmath_sinh(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_sinh_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_sqrt__doc__, "sqrt($module, z, /)\n" "--\n" "\n" "Return the square root of z."); #define CMATH_SQRT_METHODDEF \ {"sqrt", (PyCFunction)cmath_sqrt, METH_O, cmath_sqrt__doc__}, static Py_complex cmath_sqrt_impl(PyObject *module, Py_complex z); static PyObject * cmath_sqrt(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_sqrt_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_tan__doc__, "tan($module, z, /)\n" "--\n" "\n" "Return the tangent of z."); #define CMATH_TAN_METHODDEF \ {"tan", (PyCFunction)cmath_tan, METH_O, cmath_tan__doc__}, static Py_complex cmath_tan_impl(PyObject *module, Py_complex z); static PyObject * cmath_tan(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_tan_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_tanh__doc__, "tanh($module, z, /)\n" "--\n" "\n" "Return the hyperbolic tangent of z."); #define CMATH_TANH_METHODDEF \ {"tanh", (PyCFunction)cmath_tanh, METH_O, cmath_tanh__doc__}, static Py_complex cmath_tanh_impl(PyObject *module, Py_complex z); static PyObject * cmath_tanh(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; Py_complex _return_value; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } /* modifications for z */ errno = 0; _return_value = cmath_tanh_impl(module, z); if (errno == EDOM) { PyErr_SetString(PyExc_ValueError, "math domain error"); goto exit; } else if (errno == ERANGE) { PyErr_SetString(PyExc_OverflowError, "math range error"); goto exit; } else { return_value = PyComplex_FromCComplex(_return_value); } exit: return return_value; } PyDoc_STRVAR(cmath_log__doc__, "log($module, z, base=<unrepresentable>, /)\n" "--\n" "\n" "log(z[, base]) -> the logarithm of z to the given base.\n" "\n" "If the base not specified, returns the natural logarithm (base e) of z."); #define CMATH_LOG_METHODDEF \ {"log", _PyCFunction_CAST(cmath_log), METH_FASTCALL, cmath_log__doc__}, static PyObject * cmath_log_impl(PyObject *module, Py_complex x, PyObject *y_obj); static PyObject * cmath_log(PyObject *module, PyObject *const *args, Py_ssize_t nargs) { PyObject *return_value = NULL; Py_complex x; PyObject *y_obj = NULL; if (!_PyArg_CheckPositional("log", nargs, 1, 2)) { goto exit; } x = PyComplex_AsCComplex(args[0]); if (PyErr_Occurred()) { goto exit; } if (nargs < 2) { goto skip_optional; } y_obj = args[1]; skip_optional: return_value = cmath_log_impl(module, x, y_obj); exit: return return_value; } PyDoc_STRVAR(cmath_phase__doc__, "phase($module, z, /)\n" "--\n" "\n" "Return argument, also known as the phase angle, of a complex."); #define CMATH_PHASE_METHODDEF \ {"phase", (PyCFunction)cmath_phase, METH_O, cmath_phase__doc__}, static PyObject * cmath_phase_impl(PyObject *module, Py_complex z); static PyObject * cmath_phase(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } return_value = cmath_phase_impl(module, z); exit: return return_value; } PyDoc_STRVAR(cmath_polar__doc__, "polar($module, z, /)\n" "--\n" "\n" "Convert a complex from rectangular coordinates to polar coordinates.\n" "\n" "r is the distance from 0 and phi the phase angle."); #define CMATH_POLAR_METHODDEF \ {"polar", (PyCFunction)cmath_polar, METH_O, cmath_polar__doc__}, static PyObject * cmath_polar_impl(PyObject *module, Py_complex z); static PyObject * cmath_polar(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } return_value = cmath_polar_impl(module, z); exit: return return_value; } PyDoc_STRVAR(cmath_rect__doc__, "rect($module, r, phi, /)\n" "--\n" "\n" "Convert from polar coordinates to rectangular coordinates."); #define CMATH_RECT_METHODDEF \ {"rect", _PyCFunction_CAST(cmath_rect), METH_FASTCALL, cmath_rect__doc__}, static PyObject * cmath_rect_impl(PyObject *module, double r, double phi); static PyObject * cmath_rect(PyObject *module, PyObject *const *args, Py_ssize_t nargs) { PyObject *return_value = NULL; double r; double phi; if (!_PyArg_CheckPositional("rect", nargs, 2, 2)) { goto exit; } if (PyFloat_CheckExact(args[0])) { r = PyFloat_AS_DOUBLE(args[0]); } else { r = PyFloat_AsDouble(args[0]); if (r == -1.0 && PyErr_Occurred()) { goto exit; } } if (PyFloat_CheckExact(args[1])) { phi = PyFloat_AS_DOUBLE(args[1]); } else { phi = PyFloat_AsDouble(args[1]); if (phi == -1.0 && PyErr_Occurred()) { goto exit; } } return_value = cmath_rect_impl(module, r, phi); exit: return return_value; } PyDoc_STRVAR(cmath_isfinite__doc__, "isfinite($module, z, /)\n" "--\n" "\n" "Return True if both the real and imaginary parts of z are finite, else False."); #define CMATH_ISFINITE_METHODDEF \ {"isfinite", (PyCFunction)cmath_isfinite, METH_O, cmath_isfinite__doc__}, static PyObject * cmath_isfinite_impl(PyObject *module, Py_complex z); static PyObject * cmath_isfinite(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } return_value = cmath_isfinite_impl(module, z); exit: return return_value; } PyDoc_STRVAR(cmath_isnan__doc__, "isnan($module, z, /)\n" "--\n" "\n" "Checks if the real or imaginary part of z not a number (NaN)."); #define CMATH_ISNAN_METHODDEF \ {"isnan", (PyCFunction)cmath_isnan, METH_O, cmath_isnan__doc__}, static PyObject * cmath_isnan_impl(PyObject *module, Py_complex z); static PyObject * cmath_isnan(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } return_value = cmath_isnan_impl(module, z); exit: return return_value; } PyDoc_STRVAR(cmath_isinf__doc__, "isinf($module, z, /)\n" "--\n" "\n" "Checks if the real or imaginary part of z is infinite."); #define CMATH_ISINF_METHODDEF \ {"isinf", (PyCFunction)cmath_isinf, METH_O, cmath_isinf__doc__}, static PyObject * cmath_isinf_impl(PyObject *module, Py_complex z); static PyObject * cmath_isinf(PyObject *module, PyObject *arg) { PyObject *return_value = NULL; Py_complex z; z = PyComplex_AsCComplex(arg); if (PyErr_Occurred()) { goto exit; } return_value = cmath_isinf_impl(module, z); exit: return return_value; } PyDoc_STRVAR(cmath_isclose__doc__, "isclose($module, /, a, b, *, rel_tol=1e-09, abs_tol=0.0)\n" "--\n" "\n" "Determine whether two complex numbers are close in value.\n" "\n" " rel_tol\n" " maximum difference for being considered \"close\", relative to the\n" " magnitude of the input values\n" " abs_tol\n" " maximum difference for being considered \"close\", regardless of the\n" " magnitude of the input values\n" "\n" "Return True if a is close in value to b, and False otherwise.\n" "\n" "For the values to be considered close, the difference between them must be\n" "smaller than at least one of the tolerances.\n" "\n" "-inf, inf and NaN behave similarly to the IEEE 754 Standard. That is, NaN is\n" "not close to anything, even itself. inf and -inf are only close to themselves."); #define CMATH_ISCLOSE_METHODDEF \ {"isclose", _PyCFunction_CAST(cmath_isclose), METH_FASTCALL|METH_KEYWORDS, cmath_isclose__doc__}, static int cmath_isclose_impl(PyObject *module, Py_complex a, Py_complex b, double rel_tol, double abs_tol); static PyObject * cmath_isclose(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"a", "b", "rel_tol", "abs_tol", NULL}; static _PyArg_Parser _parser = {NULL, _keywords, "isclose", 0}; PyObject *argsbuf[4]; Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 2; Py_complex a; Py_complex b; double rel_tol = 1e-09; double abs_tol = 0.0; int _return_value; args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf); if (!args) { goto exit; } a = PyComplex_AsCComplex(args[0]); if (PyErr_Occurred()) { goto exit; } b = PyComplex_AsCComplex(args[1]); if (PyErr_Occurred()) { goto exit; } if (!noptargs) { goto skip_optional_kwonly; } if (args[2]) { if (PyFloat_CheckExact(args[2])) { rel_tol = PyFloat_AS_DOUBLE(args[2]); } else { rel_tol = PyFloat_AsDouble(args[2]); if (rel_tol == -1.0 && PyErr_Occurred()) { goto exit; } } if (!--noptargs) { goto skip_optional_kwonly; } } if (PyFloat_CheckExact(args[3])) { abs_tol = PyFloat_AS_DOUBLE(args[3]); } else { abs_tol = PyFloat_AsDouble(args[3]); if (abs_tol == -1.0 && PyErr_Occurred()) { goto exit; } } skip_optional_kwonly: _return_value = cmath_isclose_impl(module, a, b, rel_tol, abs_tol); if ((_return_value == -1) && PyErr_Occurred()) { goto exit; } return_value = PyBool_FromLong((long)_return_value); exit: return return_value; } /*[clinic end generated code: output=b8e445fcd2a3da65 input=a9049054013a1b77]*/
/*[clinic input] preserve [clinic start generated code]*/
test.ml
let () = let job = Builder.{ name = "test" ; platform = "none" ; script = "# nothing to do here" } in let uuid = Uuidm.v4_gen (Random.State.make_self_init ()) () in let out = [ (0, "hello") ; (3, "world") ; (10, "end") ] in let now = Ptime_clock.now () in let finished = match Ptime.add_span now (Ptime.Span.of_int_s 300) with Some t -> t | None -> assert false in let res = Builder.Exited 0 in let data = [ (Fpath.v "hello", "world") ; (Fpath.v "bin/hello.hvt", "random data, this is supposed to be an ELF file") ] in let cs = Builder.Asn.exec_to_cs (job, uuid, out, now, finished, res, data) in let encoded = Base64.encode_string (Cstruct.to_string cs) in print_endline encoded
capability.ml
type t = [ `Multi_ack | `Multi_ack_detailed | `No_done | `Thin_pack | `Side_band | `Side_band_64k | `Ofs_delta | `Agent of string | `Shallow | `Deepen_since | `Deepen_not | `No_progress | `Include_tag | `Report_status | `Delete_refs | `Quiet | `Atomic | `Push_options | `Allow_tip_sha1_in_want | `Allow_reachable_sha1_in_want | `Push_cert of string | `Symref of string * string | `Other of string | `Parameter of string * string ] let to_string = function | `Multi_ack -> "multi_ack" | `Multi_ack_detailed -> "multi_ack_detailed" | `No_done -> "no-done" | `Thin_pack -> "thin-pack" | `Side_band -> "side-band" | `Side_band_64k -> "side-band-64k" | `Ofs_delta -> "ofs-delta" | `Agent agent -> Fmt.str "agent=%s" agent | `Shallow -> "shallow" | `Deepen_since -> "deepen-since" | `Deepen_not -> "deepen-not" | `No_progress -> "no-progress" | `Include_tag -> "include-tag" | `Report_status -> "report-status" | `Delete_refs -> "delete-refs" | `Quiet -> "quiet" | `Atomic -> "atomic" | `Push_options -> "push-options" | `Allow_tip_sha1_in_want -> "allow-tip-sha1-in-want" | `Allow_reachable_sha1_in_want -> "allow-reachable-sha1-in-want" | `Push_cert cert -> Fmt.str "push-cert=%s" cert | `Symref (ref0, ref1) -> Fmt.str "symref=%s:%s" ref0 ref1 | `Other capability -> capability | `Parameter (key, value) -> Fmt.str "%s=%s" key value exception Capability_expect_value of string let of_string ?value = function | "multi_ack" -> `Multi_ack | "multi_ack_detailed" -> `Multi_ack_detailed | "no-done" -> `No_done | "thin-pack" -> `Thin_pack | "side-band" -> `Side_band | "side-band-64k" -> `Side_band_64k | "ofs-delta" -> `Ofs_delta | "shallow" -> `Shallow | "deepen-since" -> `Deepen_since | "deepen-not" -> `Deepen_not | "no-progress" -> `No_progress | "include-tag" -> `Include_tag | "report-status" -> `Report_status | "delete-refs" -> `Delete_refs | "quiet" -> `Quiet | "atomic" -> `Atomic | "push-options" -> `Push_options | "allow-tip-sha1-in-want" -> `Allow_tip_sha1_in_want | "allow-reachable-sha1-in-want" -> `Allow_reachable_sha1_in_want | "push-cert" -> ( match value with | Some value -> `Push_cert value | None -> raise (Capability_expect_value "push-cert")) | "agent" -> ( match value with | Some value -> `Agent value | None -> raise (Capability_expect_value "agent")) | "symref" -> ( match Option.bind value (Astring.String.cut ~sep:":") with | Some (ref0, ref1) -> `Symref (ref0, ref1) | None -> raise (Capability_expect_value "symref")) | capability -> ( match value with | Some value -> `Parameter (capability, value) | None -> ( match Astring.String.cut ~sep:"=" capability with | Some ("push-cert", v) -> `Push_cert v | Some ("agent", v) -> `Agent v | Some (k, v) -> `Parameter (k, v) | None -> `Other capability)) let pp ppf = function | `Multi_ack -> Fmt.pf ppf "Multi-ACK" | `Multi_ack_detailed -> Fmt.pf ppf "Multi-ACK-detailed" | `No_done -> Fmt.pf ppf "No-done" | `Thin_pack -> Fmt.pf ppf "Thin-PACK" | `Side_band -> Fmt.pf ppf "Side-Band" | `Side_band_64k -> Fmt.pf ppf "Side-Band-64K" | `Ofs_delta -> Fmt.pf ppf "Offset-delta" | `Agent agent -> Fmt.pf ppf "(Agent %s)" agent | `Shallow -> Fmt.pf ppf "Shallow" | `Deepen_since -> Fmt.pf ppf "Deepen-Since" | `Deepen_not -> Fmt.pf ppf "Deepen-Not" | `No_progress -> Fmt.pf ppf "No-Progress" | `Include_tag -> Fmt.pf ppf "Include-Tag" | `Report_status -> Fmt.pf ppf "Report-Status" | `Delete_refs -> Fmt.pf ppf "Delete-Refs" | `Quiet -> Fmt.pf ppf "Quiet" | `Atomic -> Fmt.pf ppf "Atomic" | `Push_options -> Fmt.pf ppf "Push-Options" | `Allow_tip_sha1_in_want -> Fmt.pf ppf "Allow-Tip-SHA1-in-Want" | `Allow_reachable_sha1_in_want -> Fmt.pf ppf "Allow-Reachable-SHA1-in-Want" | `Push_cert cert -> Fmt.pf ppf "(Push Cert %s)" cert | `Symref (ref0, ref1) -> Fmt.pf ppf "(Symref (%s, %s))" ref0 ref1 | `Other capability -> Fmt.pf ppf "(other %s)" capability | `Parameter (key, value) -> Fmt.pf ppf "(%s %s)" key value let compare a b = match a, b with | `Multi_ack, `Multi_ack | `Multi_ack_detailed, `Multi_ack_detailed | `No_done, `No_done | `Thin_pack, `Thin_pack | `Side_band, `Side_band | `Side_band_64k, `Side_band_64k | `Ofs_delta, `Ofs_delta | `Shallow, `Shallow | `Deepen_since, `Deepen_since | `Deepen_not, `Deepen_not | `No_progress, `No_progress | `Include_tag, `Include_tag | `Report_status, `Report_status | `Delete_refs, `Delete_refs | `Quiet, `Quiet | `Atomic, `Atomic | `Push_options, `Push_options | `Allow_tip_sha1_in_want, `Allow_tip_sha1_in_want | `Allow_reachable_sha1_in_want, `Allow_reachable_sha1_in_want -> 0 | `Push_cert a, `Push_cert b | `Agent a, `Agent b | `Other a, `Other b -> String.compare a b | `Symref (refa0, refa1), `Symref (refb0, refb1) -> let res = String.compare refa0 refb0 in if res = 0 then String.compare refa1 refb1 else res | `Parameter (ka, va), `Parameter (kb, vb) -> let res = String.compare ka kb in if res = 0 then String.compare va vb else res | a, b -> if a > b then 1 else -1 let equal a b = compare a b = 0
from_a_pattern.ml
module Blah = struct type t = | A | B end let f = function | Blah.Q -> ()
test_temp_big_maps.ml
(** Testing ------- Component: Protocol (temporary big maps) Invocation: cd src/proto_alpha/lib_protocol/test/integration/michelson \ && dune exec ./main.exe -- test "^temp big maps$" Subject: On temporary big maps. *) open Protocol let to_raw_context (b : Block.t) = Raw_context.prepare b.context ~level:b.header.shell.level ~predecessor_timestamp:b.header.shell.timestamp ~timestamp:b.header.shell.timestamp >|= Environment.wrap_tzresult let check_no_dangling_temp_big_map b = to_raw_context b >>=? fun ctxt -> Storage.Big_map.fold ctxt ~init:() ~order:`Sorted ~f:(fun id () -> assert (not (Lazy_storage_kind.Big_map.Id.is_temp id)) ; Lwt.return_unit) >>= fun () -> Storage.Big_map.fold ctxt ~init:() ~order:`Undefined ~f:(fun id () -> assert (not (Lazy_storage_kind.Big_map.Id.is_temp id)) ; Lwt.return_unit) >>= fun () -> return_unit let call_the_contract b ~baker ~src contract param_left param_right = let fee = Alpha_context.Tez.one in let amount = Alpha_context.Tez.zero in let param = Printf.sprintf "Pair (%s) %s" param_left param_right in let parameters = Alpha_context.Script.lazy_expr (Expr.from_string param) in Op.transaction ~fee (B b) src contract amount ~parameters >>=? fun operation -> Incremental.begin_construction ~policy:Block.(By_account baker) b >>=? fun incr -> Incremental.add_operation incr operation >>=? fun incr -> Incremental.finalize_block incr (** Originates the contract at contracts/temp_big_maps.tz and calls it with the pair [(param_left, param_right)]. An action (originating, storing, passing, passing twice) is done on a big map (either fresh, passed, or stored). All combinations are exercised. *) let test_temp_big_maps_contract param_left param_right () = Contract_helpers.init () >>=? fun (b, baker, src, _src2) -> Contract_helpers.originate_contract "contracts/temp_big_maps.tz" "{}" src b baker >>=? fun (contract, b) -> check_no_dangling_temp_big_map b >>=? fun () -> call_the_contract b ~baker ~src contract param_left param_right >>=? fun b -> check_no_dangling_temp_big_map b let param_left_values = ["Left True"; "Left False"; "Right {}"] let param_right_values = ["-1"; "0"; "1"; "2"] let tests = List.flatten (List.map (fun param_left -> List.map (fun param_right -> Tztest.tztest (Printf.sprintf "temp_big_maps(%s, %s)" param_left param_right) `Quick (test_temp_big_maps_contract param_left param_right)) param_right_values) param_left_values)
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2021 Nomadic Labs, <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************)
Parse_solidity_tree_sitter.mli
val parse : Common.filename -> AST_generic.program Tree_sitter_run.Parsing_result.t val parse_pattern : string -> AST_generic.any Tree_sitter_run.Parsing_result.t
michelson_v1_error_reporter.mli
val report_errors : details:bool -> show_source:bool -> ?parsed:Michelson_v1_parser.parsed -> Format.formatter -> Error_monad.error list -> unit
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************)
omake_shell_lex.mli
(* * Lex a shell line. *) open Lm_glob open Omake_shell_type open Omake_command_type open! Omake_value_type (* * Commands with a leading \ are quoted. *) val parse_command_string : string -> simple_exe (* * Construct the pipe from the value. *) val pipe_of_value : Omake_env.t -> (Omake_env.t -> pos -> Lm_location.t -> string -> (Lm_symbol.t * Omake_env.apply) option) -> glob_options -> pos -> Lm_location.t -> Omake_value_type.t -> command_flag list * Omake_env.arg_pipe
(* * Lex a shell line. *)
test_ref.ml
type t = | Init | Set_by_inline_test [@@deriving sexp, compare] let inner = ref Init let%expect_test _ = let module _ = struct let () = inner := Set_by_inline_test end in () ;; let%test_unit _ = inner := Set_by_inline_test let value () = !inner
Zaux.mli
type radix = Farith_Big.big_int (* singleton inductive, whose constructor was Build_radix *) val radix_val : radix -> Farith_Big.big_int val radix2 : radix
printing_functions.mli
open Interp_utilities;; open Interp_ast ;; open Sail_impl_base ;; open Interp_interface ;; (*Functions to translate values, registers, or locations strings *) (*Takes a location to a formatted string*) val loc_to_string : l -> string (*Returns the result of above for the exp's location *) val get_loc : tannot exp -> string (*interp_interface.value to string*) val reg_value_to_string : register_value -> string (*(*Force all representations to hex strings instead of a mixture of hex and binary strings*) val val_to_hex_string : value0 -> string*) (* format one register *) val reg_name_to_string : reg_name -> string (* format the register dependencies *) val dependencies_to_string : reg_name list -> string (* formats an expression, using interp_pretty *) val exp_to_string : Interp.lenv -> Interp.lmem -> bool -> tannot exp -> string (* Functions to set the color of parts of the output *) type ppmode = | Interp_latex | Interp_ascii | Interp_html val set_interp_ppmode : ppmode -> unit val set_color_enabled : bool -> unit val red : string -> string val blue : string -> string val green : string -> string val yellow : string -> string val grey : string -> string (*Functions to modify the instruction state and expression used in printing and in run_model*) val compact_exp : tannot exp -> tannot exp val top_frame_exp_state : interpreter_state -> (tannot exp * (Interp.lenv*Interp.lmem)) (*functions to format events and instruction_states to strings *) (*Create one large string of all of the events (indents automatically) *) val format_events : event list -> string (*format a portion of the instruction state for easy viewing *) val instruction_state_to_string : instruction_state -> string (*format a the cull instruction call stack*) val instruction_stack_to_string : instruction_state -> string (*format just the top of the call stack*) val top_instruction_state_to_string : instruction_state -> string val local_variables_to_string : instruction_state -> string val instruction_to_string : instruction -> string (*Functions to take a print function and cause a print event for the above functions *) val print_exp : (string-> unit) -> Interp.lenv -> Interp.lmem -> bool -> tannot exp -> unit val print_backtrace_compact : (string -> unit) -> instruction_state -> unit val print_continuation : (string -> unit) -> instruction_state -> unit val print_instruction : (string -> unit) -> instruction -> unit val print_stack : (string -> unit) -> instruction_state -> unit val register_value_to_string : register_value -> string val memory_value_to_string : end_flag -> memory_value -> string val logfile_register_value_to_string : register_value -> string val logfile_memory_value_to_string : end_flag -> memory_value -> string val logfile_address_to_string : address -> string val byte_list_to_string : byte list -> string val bit_lifted_to_string : bit_lifted -> string val pp_instruction_state : instruction_state -> unit -> (string * string)
thread.c
#include <assert.h> #include <limits.h> #include <stdlib.h> #if defined(__MINGW64_VERSION_MAJOR) /* MemoryBarrier expands to __mm_mfence in some cases (x86+sse2), which may * require this header in some versions of mingw64. */ #include <intrin.h> #endif #include "uv.h" #include "internal.h" static void uv__once_inner(uv_once_t* guard, void (*callback)(void)) { DWORD result; HANDLE existing_event, created_event; created_event = CreateEvent(NULL, 1, 0, NULL); if (created_event == 0) { /* Could fail in a low-memory situation? */ uv_fatal_error(GetLastError(), "CreateEvent"); } existing_event = InterlockedCompareExchangePointer(&guard->event, created_event, NULL); if (existing_event == NULL) { /* We won the race */ callback(); result = SetEvent(created_event); assert(result); guard->ran = 1; } else { /* We lost the race. Destroy the event we created and wait for the existing * one to become signaled. */ CloseHandle(created_event); result = WaitForSingleObject(existing_event, INFINITE); assert(result == WAIT_OBJECT_0); } } void uv_once(uv_once_t* guard, void (*callback)(void)) { /* Fast case - avoid WaitForSingleObject. */ if (guard->ran) { return; } uv__once_inner(guard, callback); } /* Verify that uv_thread_t can be stored in a TLS slot. */ STATIC_ASSERT(sizeof(uv_thread_t) <= sizeof(void*)); static uv_key_t uv__current_thread_key; static uv_once_t uv__current_thread_init_guard = UV_ONCE_INIT; static void uv__init_current_thread_key(void) { if (uv_key_create(&uv__current_thread_key)) abort(); } struct thread_ctx { void (*entry)(void* arg); void* arg; uv_thread_t self; }; static UINT __stdcall uv__thread_start(void* arg) { struct thread_ctx *ctx_p; struct thread_ctx ctx; ctx_p = arg; ctx = *ctx_p; uv__free(ctx_p); uv_once(&uv__current_thread_init_guard, uv__init_current_thread_key); uv_key_set(&uv__current_thread_key, ctx.self); ctx.entry(ctx.arg); return 0; } int uv_thread_create(uv_thread_t *tid, void (*entry)(void *arg), void *arg) { uv_thread_options_t params; params.flags = UV_THREAD_NO_FLAGS; return uv_thread_create_ex(tid, &params, entry, arg); } int uv_thread_create_ex(uv_thread_t* tid, const uv_thread_options_t* params, void (*entry)(void *arg), void *arg) { struct thread_ctx* ctx; int err; HANDLE thread; SYSTEM_INFO sysinfo; size_t stack_size; size_t pagesize; stack_size = params->flags & UV_THREAD_HAS_STACK_SIZE ? params->stack_size : 0; if (stack_size != 0) { GetNativeSystemInfo(&sysinfo); pagesize = (size_t)sysinfo.dwPageSize; /* Round up to the nearest page boundary. */ stack_size = (stack_size + pagesize - 1) &~ (pagesize - 1); if ((unsigned)stack_size != stack_size) return UV_EINVAL; } ctx = uv__malloc(sizeof(*ctx)); if (ctx == NULL) return UV_ENOMEM; ctx->entry = entry; ctx->arg = arg; /* Create the thread in suspended state so we have a chance to pass * its own creation handle to it */ thread = (HANDLE) _beginthreadex(NULL, (unsigned)stack_size, uv__thread_start, ctx, CREATE_SUSPENDED, NULL); if (thread == NULL) { err = errno; uv__free(ctx); } else { err = 0; *tid = thread; ctx->self = thread; ResumeThread(thread); } switch (err) { case 0: return 0; case EACCES: return UV_EACCES; case EAGAIN: return UV_EAGAIN; case EINVAL: return UV_EINVAL; } return UV_EIO; } uv_thread_t uv_thread_self(void) { uv_thread_t key; uv_once(&uv__current_thread_init_guard, uv__init_current_thread_key); key = uv_key_get(&uv__current_thread_key); if (key == NULL) { /* If the thread wasn't started by uv_thread_create (such as the main * thread), we assign an id to it now. */ if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &key, 0, FALSE, DUPLICATE_SAME_ACCESS)) { uv_fatal_error(GetLastError(), "DuplicateHandle"); } uv_key_set(&uv__current_thread_key, key); } return key; } int uv_thread_join(uv_thread_t *tid) { if (WaitForSingleObject(*tid, INFINITE)) return uv_translate_sys_error(GetLastError()); else { CloseHandle(*tid); *tid = 0; MemoryBarrier(); /* For feature parity with pthread_join(). */ return 0; } } int uv_thread_equal(const uv_thread_t* t1, const uv_thread_t* t2) { return *t1 == *t2; } int uv_mutex_init(uv_mutex_t* mutex) { InitializeCriticalSection(mutex); return 0; } int uv_mutex_init_recursive(uv_mutex_t* mutex) { return uv_mutex_init(mutex); } void uv_mutex_destroy(uv_mutex_t* mutex) { DeleteCriticalSection(mutex); } void uv_mutex_lock(uv_mutex_t* mutex) { EnterCriticalSection(mutex); } int uv_mutex_trylock(uv_mutex_t* mutex) { if (TryEnterCriticalSection(mutex)) return 0; else return UV_EBUSY; } void uv_mutex_unlock(uv_mutex_t* mutex) { LeaveCriticalSection(mutex); } /* Ensure that the ABI for this type remains stable in v1.x */ #ifdef _WIN64 STATIC_ASSERT(sizeof(uv_rwlock_t) == 80); #else STATIC_ASSERT(sizeof(uv_rwlock_t) == 48); #endif int uv_rwlock_init(uv_rwlock_t* rwlock) { memset(rwlock, 0, sizeof(*rwlock)); InitializeSRWLock(&rwlock->read_write_lock_); return 0; } void uv_rwlock_destroy(uv_rwlock_t* rwlock) { /* SRWLock does not need explicit destruction so long as there are no waiting threads See: https://docs.microsoft.com/windows/win32/api/synchapi/nf-synchapi-initializesrwlock#remarks */ } void uv_rwlock_rdlock(uv_rwlock_t* rwlock) { AcquireSRWLockShared(&rwlock->read_write_lock_); } int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock) { if (!TryAcquireSRWLockShared(&rwlock->read_write_lock_)) return UV_EBUSY; return 0; } void uv_rwlock_rdunlock(uv_rwlock_t* rwlock) { ReleaseSRWLockShared(&rwlock->read_write_lock_); } void uv_rwlock_wrlock(uv_rwlock_t* rwlock) { AcquireSRWLockExclusive(&rwlock->read_write_lock_); } int uv_rwlock_trywrlock(uv_rwlock_t* rwlock) { if (!TryAcquireSRWLockExclusive(&rwlock->read_write_lock_)) return UV_EBUSY; return 0; } void uv_rwlock_wrunlock(uv_rwlock_t* rwlock) { ReleaseSRWLockExclusive(&rwlock->read_write_lock_); } int uv_sem_init(uv_sem_t* sem, unsigned int value) { *sem = CreateSemaphore(NULL, value, INT_MAX, NULL); if (*sem == NULL) return uv_translate_sys_error(GetLastError()); else return 0; } void uv_sem_destroy(uv_sem_t* sem) { if (!CloseHandle(*sem)) abort(); } void uv_sem_post(uv_sem_t* sem) { if (!ReleaseSemaphore(*sem, 1, NULL)) abort(); } void uv_sem_wait(uv_sem_t* sem) { if (WaitForSingleObject(*sem, INFINITE) != WAIT_OBJECT_0) abort(); } int uv_sem_trywait(uv_sem_t* sem) { DWORD r = WaitForSingleObject(*sem, 0); if (r == WAIT_OBJECT_0) return 0; if (r == WAIT_TIMEOUT) return UV_EAGAIN; abort(); return -1; /* Satisfy the compiler. */ } int uv_cond_init(uv_cond_t* cond) { InitializeConditionVariable(&cond->cond_var); return 0; } void uv_cond_destroy(uv_cond_t* cond) { /* nothing to do */ (void) &cond; } void uv_cond_signal(uv_cond_t* cond) { WakeConditionVariable(&cond->cond_var); } void uv_cond_broadcast(uv_cond_t* cond) { WakeAllConditionVariable(&cond->cond_var); } void uv_cond_wait(uv_cond_t* cond, uv_mutex_t* mutex) { if (!SleepConditionVariableCS(&cond->cond_var, mutex, INFINITE)) abort(); } int uv_cond_timedwait(uv_cond_t* cond, uv_mutex_t* mutex, uint64_t timeout) { if (SleepConditionVariableCS(&cond->cond_var, mutex, (DWORD)(timeout / 1e6))) return 0; if (GetLastError() != ERROR_TIMEOUT) abort(); return UV_ETIMEDOUT; } int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) { int err; barrier->n = count; barrier->count = 0; err = uv_mutex_init(&barrier->mutex); if (err) return err; err = uv_sem_init(&barrier->turnstile1, 0); if (err) goto error2; err = uv_sem_init(&barrier->turnstile2, 1); if (err) goto error; return 0; error: uv_sem_destroy(&barrier->turnstile1); error2: uv_mutex_destroy(&barrier->mutex); return err; } void uv_barrier_destroy(uv_barrier_t* barrier) { uv_sem_destroy(&barrier->turnstile2); uv_sem_destroy(&barrier->turnstile1); uv_mutex_destroy(&barrier->mutex); } int uv_barrier_wait(uv_barrier_t* barrier) { int serial_thread; uv_mutex_lock(&barrier->mutex); if (++barrier->count == barrier->n) { uv_sem_wait(&barrier->turnstile2); uv_sem_post(&barrier->turnstile1); } uv_mutex_unlock(&barrier->mutex); uv_sem_wait(&barrier->turnstile1); uv_sem_post(&barrier->turnstile1); uv_mutex_lock(&barrier->mutex); serial_thread = (--barrier->count == 0); if (serial_thread) { uv_sem_wait(&barrier->turnstile1); uv_sem_post(&barrier->turnstile2); } uv_mutex_unlock(&barrier->mutex); uv_sem_wait(&barrier->turnstile2); uv_sem_post(&barrier->turnstile2); return serial_thread; } int uv_key_create(uv_key_t* key) { key->tls_index = TlsAlloc(); if (key->tls_index == TLS_OUT_OF_INDEXES) return UV_ENOMEM; return 0; } void uv_key_delete(uv_key_t* key) { if (TlsFree(key->tls_index) == FALSE) abort(); key->tls_index = TLS_OUT_OF_INDEXES; } void* uv_key_get(uv_key_t* key) { void* value; value = TlsGetValue(key->tls_index); if (value == NULL) if (GetLastError() != ERROR_SUCCESS) abort(); return value; } void uv_key_set(uv_key_t* key, void* value) { if (TlsSetValue(key->tls_index, value) == FALSE) abort(); }
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */
dune
(library (public_name packstream) (name packstream) (libraries bitstring core) (preprocess (pps ppx_bitstring ppx_deriving.show)))
yojsonable_intf.ml
module type S = sig type t val t_of_yojson : Yojson.Safe.t -> t val yojson_of_t : t -> Yojson.Safe.t end module type S1 = sig type 'a t val t_of_yojson : (Yojson.Safe.t -> 'a) -> Yojson.Safe.t -> 'a t val yojson_of_t : ('a -> Yojson.Safe.t) -> 'a t -> Yojson.Safe.t end module type S2 = sig type ('a, 'b) t val t_of_yojson : (Yojson.Safe.t -> 'a) -> (Yojson.Safe.t -> 'b) -> Yojson.Safe.t -> ('a, 'b) t val yojson_of_t : ('a -> Yojson.Safe.t) -> ('b -> Yojson.Safe.t) -> ('a, 'b) t -> Yojson.Safe.t end module type S3 = sig type ('a, 'b, 'c) t val t_of_yojson : (Yojson.Safe.t -> 'a) -> (Yojson.Safe.t -> 'b) -> (Yojson.Safe.t -> 'c) -> Yojson.Safe.t -> ('a, 'b, 'c) t val yojson_of_t : ('a -> Yojson.Safe.t) -> ('b -> Yojson.Safe.t) -> ('c -> Yojson.Safe.t) -> ('a, 'b, 'c) t -> Yojson.Safe.t end
eqaf_bigstring.ml
type bigstring = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t let length x = Bigarray.Array1.dim x [@@inline] let get x i = Bigarray.Array1.unsafe_get x i |> Char.code [@@inline] external unsafe_get_int16 : bigstring -> int -> int = "%caml_bigstring_get16u" [@@noalloc] let get16 x i = unsafe_get_int16 x i [@@inline] let equal ~ln a b = let l1 = ln asr 1 in let r = ref 0 in for i = 0 to pred l1 do r := !r lor (get16 a (i * 2) lxor get16 b (i * 2)) done ; for _ = 1 to ln land 1 do r := !r lor (get a (ln - 1) lxor get b (ln - 1)) done ; !r = 0 let equal a b = let al = length a in let bl = length b in if al <> bl then false else equal ~ln:al a b let[@inline always] compare (a:int) b = a - b let[@inline always] sixteen_if_minus_one_or_less n = (n asr Sys.int_size) land 16 let[@inline always] eight_if_one_or_more n = ((-n) asr Sys.int_size) land 8 let compare_le ~ln a b = let r = ref 0 in let i = ref (pred ln) in while !i >= 0 do let xa = get a !i and xb = get b !i in let c = compare xa xb in r := !r lor ((sixteen_if_minus_one_or_less c + eight_if_one_or_more c) lsr !r) ; decr i ; done ; (!r land 8) - (!r land 16) let compare_le_with_len ~len:ln a b = let al = length a in let bl = length b in if ln = 0 then 0 else if (al lxor ln) lor (bl lxor ln) <> 0 then invalid_arg "compare_le_with_len" else compare_le ~ln a b let compare_le a b = let al = length a in let bl = length b in if al < bl then 1 else if al > bl then (-1) else compare_le ~ln:al (* = bl *) a b let compare_be ~ln a b = let r = ref 0 in let i = ref 0 in while !i < ln do let xa = get a !i and xb = get b !i in let c = compare xa xb in r := !r lor ((sixteen_if_minus_one_or_less c + eight_if_one_or_more c) lsr !r) ; incr i ; done ; (!r land 8) - (!r land 16) let compare_be_with_len ~len:ln a b = let al = length a in let bl = length b in if ln = 0 then 0 else if (al lxor ln) lor (bl lxor ln) <> 0 then invalid_arg "compare_be_with_len" else compare_be ~ln a b let compare_be a b = let al = length a in let bl = length b in if al < bl then 1 else if al > bl then (-1) else compare_be ~ln:al (* = bl *) a b (* XXX(dinosaure): see [eqaf.ml] for this part. *) external int_of_bool : bool -> int = "%identity" external unsafe_bool_of_int : int -> bool = "%identity" let[@inline always] find_uint8 ~off ~len ~f str = let i = ref (len - 1) in let a = ref (lnot 0) in while !i >= off do let byte = get str !i in let pred = int_of_bool (f byte) in a := Eqaf.select_int (((!i - off) land min_int) lor pred) !a !i ; decr i ; done ; !a let find_uint8 ?(off= 0) ~f str = let len = length str in find_uint8 ~off ~len ~f str let exists_uint8 ?off ~f str = let v = find_uint8 ?off ~f str in let r = Eqaf.select_int (v + 1) 0 1 in unsafe_bool_of_int r
dune
(library (public_name hyper.logic) (name hyper__logic) (libraries dream-pure uri ) (preprocess (pps lwt_ppx)))
sha3.c
// sha3.c // 19-Nov-11 Markku-Juhani O. Saarinen <mjos@iki.fi> // Revised 07-Aug-15 to match with official release of FIPS PUB 202 "SHA3" // Revised 03-Sep-15 for portability + OpenSSL - style API #include "sha3.h" // update the state with given number of rounds static void sha3_keccakf(uint64_t st[25]) { // constants const uint64_t keccakf_rndc[24] = { 0x0000000000000001, 0x0000000000008082, 0x800000000000808a, 0x8000000080008000, 0x000000000000808b, 0x0000000080000001, 0x8000000080008081, 0x8000000000008009, 0x000000000000008a, 0x0000000000000088, 0x0000000080008009, 0x000000008000000a, 0x000000008000808b, 0x800000000000008b, 0x8000000000008089, 0x8000000000008003, 0x8000000000008002, 0x8000000000000080, 0x000000000000800a, 0x800000008000000a, 0x8000000080008081, 0x8000000000008080, 0x0000000080000001, 0x8000000080008008 }; const int keccakf_rotc[24] = { 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 }; const int keccakf_piln[24] = { 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 }; // variables int i, j, r; uint64_t t, bc[5]; #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ uint8_t *v; // endianess conversion. this is redundant on little-endian targets for (i = 0; i < 25; i++) { v = (uint8_t *) &st[i]; st[i] = ((uint64_t) v[0]) | (((uint64_t) v[1]) << 8) | (((uint64_t) v[2]) << 16) | (((uint64_t) v[3]) << 24) | (((uint64_t) v[4]) << 32) | (((uint64_t) v[5]) << 40) | (((uint64_t) v[6]) << 48) | (((uint64_t) v[7]) << 56); } #endif // actual iteration for (r = 0; r < KECCAKF_ROUNDS; r++) { // Theta for (i = 0; i < 5; i++) bc[i] = st[i] ^ st[i + 5] ^ st[i + 10] ^ st[i + 15] ^ st[i + 20]; for (i = 0; i < 5; i++) { t = bc[(i + 4) % 5] ^ ROTL64(bc[(i + 1) % 5], 1); for (j = 0; j < 25; j += 5) st[j + i] ^= t; } // Rho Pi t = st[1]; for (i = 0; i < 24; i++) { j = keccakf_piln[i]; bc[0] = st[j]; st[j] = ROTL64(t, keccakf_rotc[i]); t = bc[0]; } // Chi for (j = 0; j < 25; j += 5) { for (i = 0; i < 5; i++) bc[i] = st[j + i]; for (i = 0; i < 5; i++) st[j + i] ^= (~bc[(i + 1) % 5]) & bc[(i + 2) % 5]; } // Iota st[0] ^= keccakf_rndc[r]; } #if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__ // endianess conversion. this is redundant on little-endian targets for (i = 0; i < 25; i++) { v = (uint8_t *) &st[i]; t = st[i]; v[0] = t & 0xFF; v[1] = (t >> 8) & 0xFF; v[2] = (t >> 16) & 0xFF; v[3] = (t >> 24) & 0xFF; v[4] = (t >> 32) & 0xFF; v[5] = (t >> 40) & 0xFF; v[6] = (t >> 48) & 0xFF; v[7] = (t >> 56) & 0xFF; } #endif } // Initialize the context for SHA3 static int sha3_init(sha3_ctx_t *c, int mdlen) { int i; for (i = 0; i < 25; i++) c->st.q[i] = 0; c->mdlen = mdlen; c->rsiz = 200 - 2 * mdlen; c->pt = 0; return 1; } // update state with more data static int sha3_update(sha3_ctx_t *c, const void *data, size_t len) { size_t i; int j; j = c->pt; for (i = 0; i < len; i++) { c->st.b[j++] ^= ((const uint8_t *) data)[i]; if (j >= c->rsiz) { sha3_keccakf(c->st.q); j = 0; } } c->pt = j; return 1; } // finalize and output a hash static int sha3_final(void *md, sha3_ctx_t *c) { int i; c->st.b[c->pt] ^= 0x06; c->st.b[c->rsiz - 1] ^= 0x80; sha3_keccakf(c->st.q); for (i = 0; i < c->mdlen; i++) { ((uint8_t *) md)[i] = c->st.b[i]; } return 1; } #if 0 // compute a SHA-3 hash (md) of given byte length from "in" void *sha3(const void *in, size_t inlen, void *md, int mdlen) { sha3_ctx_t sha3; sha3_init(&sha3, mdlen); sha3_update(&sha3, in, inlen); sha3_final(md, &sha3); return md; } #endif // SHAKE128 and SHAKE256 extensible-output functionality static void shake_xof(sha3_ctx_t *c) { c->st.b[c->pt] ^= 0x1F; c->st.b[c->rsiz - 1] ^= 0x80; sha3_keccakf(c->st.q); c->pt = 0; } static void shake_out(sha3_ctx_t *c, void *out, size_t len) { size_t i; int j; j = c->pt; for (i = 0; i < len; i++) { if (j >= c->rsiz) { sha3_keccakf(c->st.q); j = 0; } ((uint8_t *) out)[i] = c->st.b[j++]; } c->pt = j; }
report_errors_config.ml
(** Controls when the errors are reported. - [Early] - report errors as soon as they are discovered. This means the ordering of errors can depend on build scheduling. - [Deterministic] - report errors at the end of the build in a deterministic order. - [Twice] - report each error twice: once as soon as the error is discovered and then again at the end of the build, in a deterministic order. *) type t = | Early | Deterministic (* CR-someday aalekseyev: The deterministic mode is not entirely deterministic as far as error stack traces are concerned, since we're choosing an arbitrary stack trace to display, and the choice can be affected by scheduling. *) | Twice let default : t = match Dune_util.Config.inside_dune with | true -> Deterministic | false -> Early
(** Controls when the errors are reported. - [Early] - report errors as soon as they are discovered. This means the ordering of errors can depend on build scheduling. - [Deterministic] - report errors at the end of the build in a deterministic order. - [Twice] - report each error twice: once as soon as the error is discovered and then again at the end of the build, in a deterministic order. *)
ocaml.mli
(*_ This signature is deliberately empty. *)
(*_ This signature is deliberately empty. *)
circuit_bus_map.ml
open Base module Bit = Netlist.Bit module Bus = Netlist.Bus module Bus_names = Netlist.Bus_names module Cell = Netlist.Cell module Port = Netlist.Port (* Operations we require from this data structure 1. add module inputs - signals are provided by the environment 2. add cell outputs - signal wires are created 3. construct a signal from above - for module outputs and cell inputs 4. get wire for cell output so it can be assign on instantiation 5. perform bus naming *) (* A [Select.t] represents a range of bits, taken from a [wire]. A bit vector is represented as a list of [Select.t]s (with the MSB at head of list). A bit can be concatented at the msb of the select list, and will be merged if possible. This allows us to recover busses from the netlist. *) module Select = struct type t = { signal : Hardcaml.Signal.t ; high : int ; low : int } [@@deriving sexp_of] (* [t] is sorted with the msb at the head of the list. *) let concat_top_bit t ~top = match t with | [] -> [ top ] | h :: t -> (* If the next bit is the next consequetive bit from the same signal, then merge into a larger select *) if Hardcaml.Signal.Uid.equal (Hardcaml.Signal.uid h.signal) (Hardcaml.Signal.uid top.signal) && top.low = h.high + 1 then { h with high = top.low } :: t else top :: h :: t ;; let vdd = { signal = Hardcaml.Signal.vdd; high = 0; low = 0 } let gnd = { signal = Hardcaml.Signal.gnd; high = 0; low = 0 } let to_signal selects = try let selects = List.map selects ~f:(fun select -> Hardcaml.Signal.select select.signal select.high select.low) in Ok (Hardcaml.Signal.concat_msb selects) with | e -> Or_error.error_s [%message "Unable to form signal from selects" (selects : t list) (e : exn)] ;; end module Module_input = struct type t = { input_signal : Hardcaml.Signal.t ; bus : Bus.t } [@@deriving sexp_of] end (* Associate circuit inputs (from the environment) with netlist module inputs. *) module Module_inputs = struct type t = Module_input.t Port.t list let circuit_input_map (circuit_inputs : Hardcaml.Signal.t Port.t list) = List.fold circuit_inputs ~init:(Ok (Map.empty (module String))) ~f:(fun map input -> let%bind.Or_error map = map in match Map.add map ~key:input.name ~data:input.value with | `Ok map -> Ok map | `Duplicate -> Or_error.error_s [%message "Duplicate circuit inputs provided" (circuit_inputs : Hardcaml.Signal.t Port.t list)]) ;; let module_input_ports (circuit_input_map : Hardcaml.Signal.t Map.M(String).t) (module_ports : Bus.t Port.t list) = List.map module_ports ~f:(fun port -> match Map.find circuit_input_map port.name with | Some input_signal -> Ok { port with value = { Module_input.input_signal; bus = port.value } } | None -> Or_error.error_s [%message "Unable to associate module port with supplied inputs" (port : Bus.t Port.t) (circuit_input_map : Hardcaml.Signal.t Map.M(String).t)]) |> Or_error.all ;; let create (circuit_inputs : Hardcaml.Signal.t Port.t list) (module_ports : Bus.t Port.t list) : t Or_error.t = let%bind.Or_error circuit_input_map = circuit_input_map circuit_inputs in module_input_ports circuit_input_map module_ports ;; end (* Key to map from a cell output port to it's signal *) module Cell_port = struct module T = struct type t = { cell_instance_name : string ; port_name : string } [@@deriving sexp_of, compare] end include T include Comparator.Make (T) end type t = { bit_to_select : Select.t Map.M(Int).t (* Map net indices to a single bit [Select.t] of the corresponding signal (input or cell output). *) ; cell_port_to_wire : Hardcaml.Signal.t Map.M(Cell_port).t (* Cell outputs indexed by port name and cell instantiation name *) ; bus_names : Bus_names.t (* Netlist bus names for recoving signal naming. *) } let add_bus_to_select_map map signal (port : Bus.t Port.t) = let rec f bit_index map (bits : Bus.t) = match bits with | [] -> Ok map | bit :: bits -> (match bit with | Vdd | Gnd | X -> Or_error.error_s [%message "Gnd, Vdd and X are not valid driver signals" (port : Bus.t Port.t)] | Index index -> (match Map.add map ~key:index ~data:Select.{ signal; high = bit_index; low = bit_index } with | `Ok map -> f (bit_index + 1) map bits | `Duplicate -> Or_error.error_s [%message "Driver bit already defined" (index : int)])) in f 0 map port.value ;; let apply_names t signal bus = if List.is_empty (Hardcaml.Signal.names signal) then ( let names = Bus_names.find t.bus_names bus in List.fold names ~init:signal ~f:Hardcaml.Signal.( -- )) else signal ;; let add_module_input t input_signal (port : Bus.t Port.t) = let input_signal = apply_names t (Hardcaml.Signal.wireof input_signal) port.value in let%bind.Or_error bit_to_select = add_bus_to_select_map t.bit_to_select input_signal port in Ok { t with bit_to_select } ;; let add_cell_port map signal (cell : Cell.t) (port : _ Port.t) = match Map.add map ~key:Cell_port.{ cell_instance_name = cell.instance_name; port_name = port.name } ~data:signal with | `Ok map -> Ok map | `Duplicate -> Or_error.error_s [%message "Cell output port is duplicated" (port : Bus.t Port.t) (cell : Cell.t)] ;; let add_cell_output t (cell : Cell.t) (port : Bus.t Port.t) = match port.value with | [] -> Ok t | _ -> let cell_output_signal = apply_names t (Hardcaml.Signal.wire (List.length port.value)) port.value in let%bind.Or_error bit_to_select = add_bus_to_select_map t.bit_to_select cell_output_signal port in let%bind.Or_error cell_port_to_wire = add_cell_port t.cell_port_to_wire cell_output_signal cell port in Ok { t with bit_to_select; cell_port_to_wire } ;; let find_and_concat_bus_bit map selects (bit : Bit.t) = let%bind.Or_error selects = selects in match bit with | Vdd -> Ok (Select.vdd :: selects) | Gnd -> Ok (Select.gnd :: selects) | X -> Ok (Select.gnd :: selects) | Index i -> (match Map.find map i with | None -> Or_error.error_s [%message "Failed to find net in bus map" (i : int)] | Some select -> Ok (Select.concat_top_bit selects ~top:select)) ;; let signal_of_bus t (bus : Bus.t Port.t) = let%bind.Or_error selects = List.fold bus.value ~init:(Ok []) ~f:(fun bus -> find_and_concat_bus_bit t.bit_to_select bus) in let%bind.Or_error signal = Select.to_signal selects in Ok { Port.name = bus.name; value = apply_names t signal bus.value } ;; let signal_of_bus_if_not_empty t (bus : Bus.t Port.t) = if List.is_empty bus.value then None else Some (signal_of_bus t bus) ;; let wire_of_cell_output t (cell : Cell.t) (port : Bus.t Port.t) = match port.value with | [] -> None | _ -> (match Map.find t.cell_port_to_wire Cell_port.{ cell_instance_name = cell.instance_name; port_name = port.name } with | Some signal -> Some (Ok { Port.name = port.name; value = signal }) | None -> Some (Or_error.error_s [%message "failed to find cell output port" (port : Bus.t Port.t) (cell : Cell.t)])) ;; let empty bus_names = { bit_to_select = Map.empty (module Int) ; cell_port_to_wire = Map.empty (module Cell_port) ; bus_names } ;; let create (module_ : Netlist.Module.t) ~circuit_inputs = let%bind.Or_error inputs = Module_inputs.create circuit_inputs module_.inputs in let bus_map = empty module_.bus_names in let%bind.Or_error bus_map = List.fold inputs ~init:(Ok bus_map) ~f:(fun map port -> let%bind.Or_error map = map in add_module_input map port.value.input_signal { port with value = port.value.bus }) in let%bind.Or_error bus_map = List.fold module_.cells ~init:(Ok bus_map) ~f:(fun map cell -> List.fold cell.outputs ~init:map ~f:(fun map output -> let%bind.Or_error map = map in add_cell_output map cell output)) in Ok bus_map ;;
expcompare.ml
open Cil open Cilint module E = Errormsg (**************************************************************************) (* Helpers *) let isConstType (t: typ) : bool = hasAttribute "const" (typeAttrs t) (**************************************************************************) (* Expression/type comparison *) let rec compareExp (e1: exp) (e2: exp) : bool = (*log "CompareExp %a and %a.\n" d_plainexp e1 d_plainexp e2; *) e1 == e2 || match e1, e2 with | Lval lv1, Lval lv2 | StartOf lv1, StartOf lv2 | AddrOf lv1, AddrOf lv2 -> compareLval lv1 lv2 | BinOp(bop1, l1, r1, _), BinOp(bop2, l2, r2, _) -> bop1 = bop2 && compareExp l1 l2 && compareExp r1 r2 | CastE(t1, e1), CastE(t2, e2) -> t1 == t2 && compareExp e1 e2 | _ -> begin match getInteger (constFold true e1), getInteger (constFold true e2) with Some i1, Some i2 -> compare_cilint i1 i2 = 0 | _ -> false end and compareLval (lv1: lval) (lv2: lval) : bool = let rec compareOffset (off1: offset) (off2: offset) : bool = match off1, off2 with | Field (fld1, off1'), Field (fld2, off2') -> fld1 == fld2 && compareOffset off1' off2' | Index (e1, off1'), Index (e2, off2') -> compareExp e1 e2 && compareOffset off1' off2' | NoOffset, NoOffset -> true | _ -> false in lv1 == lv2 || match lv1, lv2 with | (Var vi1, off1), (Var vi2, off2) -> vi1 == vi2 && compareOffset off1 off2 | (Mem e1, off1), (Mem e2, off2) -> compareExp e1 e2 && compareOffset off1 off2 | _ -> false (* Remove casts that do not effect the value of the expression, such as casts between different pointer types. Of course, these casts change the type, so don't use this within e.g. an arithmetic expression. We remove casts from pointer types to unsigned int or unsigned long. We also prune casts between equivalent integer types, such as a difference in sign or int vs long. But we keep other arithmetic casts, since they actually change the value of the expression. *) let rec stripNopCasts (e:exp): exp = match e with CastE(t, e') -> begin match unrollType (typeOf e'), unrollType t with TPtr (bt1, a1), TPtr (bt2, a2) when isConstType bt1 = isConstType bt2 -> stripNopCasts e' (* strip casts from pointers to unsigned int/long*) | (TPtr _ as t1), (TInt(ik,_) as t2) when bitsSizeOf t1 = bitsSizeOf t2 && not (isSigned ik) -> stripNopCasts e' | (TInt(ik1,_) as t1), (TInt(ik2,_) as t2) (* promotion when signedness is the same doesn't change value *) (* promotion of unsigned to signed of larger bitsize doesn't change value *) when bitsSizeOf t1 = bitsSizeOf t2 || (isSigned ik1 = isSigned ik2 && bitsSizeOf t1 < bitsSizeOf t2) || (not(isSigned ik1) && bitsSizeOf t1 < bitsSizeOf t2) -> (* Okay to strip.*) stripNopCasts e' | _ -> e end | _ -> e let compareExpStripCasts (e1: exp) (e2: exp) : bool = compareExp (stripNopCasts e1) (stripNopCasts e2) (* A more conservative form of stripNopCasts. Here, we only strip pointer casts if the base types have the same width. Using this on the left operand of pointer arithmetic shouldn't change the resulting value. *) let rec stripCastsForPtrArith (e:exp): exp = match e with | CastE(t, e') -> begin match unrollType (typeOf e'), unrollType t with (* Keep casts from void to something else. Among other things, we keep casts from void* to char* that would otherwise be eliminated. *) | TPtr (TVoid _, _), TPtr (bt2, _) when not (isVoidType bt2) -> e (* Remove casts between pointers with equal-sized base types. *) | TPtr (bt1, a1), TPtr (bt2, a2) -> begin try if bitsSizeOf bt1 = bitsSizeOf bt2 && isConstType bt1 = isConstType bt2 then stripCastsForPtrArith e' else e with SizeOfError _ -> (* bt1 or bt2 is abstract; don't strip. *) e end (* strip casts from pointers to unsigned int/long*) | (TPtr _ as t1), (TInt(ik,_) as t2) when bitsSizeOf t1 = bitsSizeOf t2 && not (isSigned ik) -> stripCastsForPtrArith e' | (TInt(ik1,_) as t1), (TInt(ik2,_) as t2) (*when bitsSizeOf t1 = bitsSizeOf t2 ->*) (* Okay to strip.*) when bitsSizeOf t1 = bitsSizeOf t2 || (isSigned ik1 = isSigned ik2 && bitsSizeOf t1 < bitsSizeOf t2) || (not(isSigned ik1) && bitsSizeOf t1 < bitsSizeOf t2) -> (* Okay to strip.*) stripCastsForPtrArith e' | _ -> e end | _ -> e let compareTypes ?(ignoreSign=true) ?(importantAttr : attribute -> bool = (fun _ -> true)) (t1 : typ) (t2 : typ) : bool = let typeSigNC (t : typ) : typsig = let attrFilter (attr : attribute) : bool = match attr with | Attr ("poly", _) (* TODO: hack hack! *) | Attr ("assumeconst", _) | Attr ("_ptrnode", _) | Attr ("missing_annot", _) | Attr ("const", []) | Attr ("aligned", _) | Attr ("volatile", []) | Attr ("deprecated", []) | Attr ("always_inline", []) -> false | _ -> importantAttr attr in typeSigWithAttrs ~ignoreSign (List.filter attrFilter) t in (typeSigNC t1) = (typeSigNC t2) let compareTypesNoAttributes ?(ignoreSign=true) (t1 : typ) (t2 : typ) : bool = let typSig = typeSigWithAttrs ~ignoreSign:ignoreSign (fun _ -> []) in Util.equals (typSig t1) (typSig t2) class volatileFinderClass br = object(self) inherit nopCilVisitor method! vtype (t : typ) = if hasAttribute "volatile" (typeAttrs t) then begin br := true; SkipChildren end else DoChildren end let isTypeVolatile t = let br = ref false in let vis = new volatileFinderClass br in ignore(visitCilType vis t); !br (* strip every cast between equal pointer types *) let rec stripCastsDeepForPtrArith (e:exp): exp = match e with | CastE(t, e') when not(isTypeVolatile t) -> begin let e' = stripCastsDeepForPtrArith e' in match unrollType (typeOf e'), unrollType t with (* Keep casts from void to something else. Among other things, we keep casts from void* to char* that would otherwise be eliminated. *) | TPtr (TVoid _, _), TPtr (bt2, _) when not (isVoidType bt2) -> e (* Remove casts between pointers with equal-sized base types. *) | TPtr (bt1, a1), TPtr (bt2, a2) -> begin try if bitsSizeOf bt1 = bitsSizeOf bt2 && isConstType bt1 = isConstType bt2 then e' else CastE(t,e') with SizeOfError _ -> (* bt1 or bt2 is abstract; don't strip. *) CastE(t,e') end | _, _ -> CastE(t,e') end | UnOp(op,e,t) -> let e = stripCastsDeepForPtrArith e in UnOp(op, e, t) | BinOp(MinusPP,e1,e2,t) -> let e1 = stripCastsDeepForPtrArith e1 in let e2 = stripCastsDeepForPtrArith e2 in if not(compareTypesNoAttributes ~ignoreSign:false (typeOf e1) (typeOf e2)) then BinOp(MinusPP, mkCast ~e:e1 ~newt:(typeOf e2), e2, t) else BinOp(MinusPP, e1, e2, t) | BinOp(op,e1,e2,t) -> let e1 = stripCastsDeepForPtrArith e1 in let e2 = stripCastsDeepForPtrArith e2 in BinOp(op,e1,e2,t) | Lval lv -> Lval(stripCastsForPtrArithLval lv) | AddrOf lv -> AddrOf(stripCastsForPtrArithLval lv) | StartOf lv -> StartOf(stripCastsForPtrArithLval lv) | _ -> e and stripCastsForPtrArithLval (lv : lval) : lval = match lv with | (Var vi, off) -> (Var vi, stripCastsForPtrArithOff off) | (Mem e, off) -> let e = stripCastsDeepForPtrArith e in let off = stripCastsForPtrArithOff off in (Mem e, off) and stripCastsForPtrArithOff (off : offset ) : offset = match off with | NoOffset -> NoOffset | Field(fi, off) -> Field(fi, stripCastsForPtrArithOff off) | Index(e, off) -> let e = stripCastsDeepForPtrArith e in let off = stripCastsForPtrArithOff off in Index(e, off) let compareExpDeepStripCasts (e1 : exp) (e2 : exp) : bool = compareExp (stripCastsDeepForPtrArith e1) (stripCastsDeepForPtrArith e2) let rec compareAttrParam (ap1 : attrparam) (ap2 : attrparam) : bool = ap1 == ap2 || match ap1, ap2 with | AInt i1, AInt i2 -> i1 = i2 | AStr s1, AStr s2 -> s1 = s2 | ACons(s1,apl1), ACons(s2,apl2) -> s1 = s2 && List.length apl1 = List.length apl2 && not(List.exists2 (fun ap1 ap2 -> not(compareAttrParam ap1 ap2)) apl1 apl2) | ASizeOf t1, ASizeOf t2 -> compareTypes t1 t2 | ASizeOfE ap1, ASizeOfE ap2 -> compareAttrParam ap1 ap2 | ASizeOfS ts1, ASizeOfS ts2 -> Util.equals ts1 ts2 | AAlignOf t1, AAlignOf t2 -> compareTypes t1 t2 | AAlignOfE ap1, AAlignOfE ap2 -> compareAttrParam ap1 ap2 | AAlignOfS ts1, AAlignOfS ts2 -> Util.equals ts1 ts2 | AUnOp(uop1,ap1), AUnOp(uop2,ap2) -> uop1 = uop2 && compareAttrParam ap1 ap2 | ABinOp(bop1,ap11,ap12), ABinOp(bop2,ap21,ap22) -> bop1 = bop2 && compareAttrParam ap11 ap21 && compareAttrParam ap12 ap22 | ADot(ap1,s1), ADot(ap2,s2) -> compareAttrParam ap1 ap2 && s1 = s2 | AStar ap1, AStar ap2 -> compareAttrParam ap1 ap2 | AAddrOf ap1, AAddrOf ap2 -> compareAttrParam ap1 ap2 | AIndex(ap11,ap12), AIndex(ap21,ap22) -> compareAttrParam ap11 ap21 && compareAttrParam ap12 ap22 | AQuestion(ap11,ap12,ap13), AQuestion(ap21,ap22,ap23) -> compareAttrParam ap11 ap21 && compareAttrParam ap12 ap22 && compareAttrParam ap13 ap23 | _, _ -> false
(* Copyright (c) 2004, Jeremy Condit <jcondit@cs.berkeley.edu> George C. Necula <necula@cs.berkeley.edu> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *)
log_info.ml
let get () = let log_file, sections = match String.split_on_char ',' (Sys.getenv "MERLIN_LOG") with | (value :: sections) -> (Some value, sections) | [] -> (None, []) | exception Not_found -> (None, []) in `Log_file_path log_file, `Log_sections sections
b.ml
module C = struct end
parse.mli
val run : syntax:Syntax.t -> f:(last_text_block:int * int -> code_start:Lexing.position -> code:string -> unit) -> file_name:string -> file_contents:string -> copy_input:(int -> int -> unit) -> unit exception Error of { pos : Lexing.position ; msg : string } val raisef : pos:Lexing.position -> ('a, unit, string, _) format4 -> 'a
dune
test.ml
open Common open Lwt.Infix type concrete = Store.Tree.concrete let members keys json = List.fold_left (fun key json -> Yojson.Safe.Util.member json key) json keys let assert_ok : type a. (a, [ `Msg of string ]) result -> a = function | Ok x -> x | Error (`Msg msg) -> Alcotest.fail msg module Alcotest = struct include Alcotest let yojson = testable Yojson.Safe.pp Yojson.Safe.equal end (** Helpers for constructing data *) (** Tree with a single child *) let stree only_key only_child = `Tree [ (only_key, only_child) ] (** Sequence of nested trees each with exactly one child *) let strees : string list -> concrete -> concrete = List.fold_right stree let contents v = `Contents (v, ()) type test_case = set_tree:(concrete -> unit Lwt.t) -> unit -> unit Lwt.t (** Test cases consume a setter for updating the server state *) let test_get_contents_list : test_case = fun ~set_tree () -> let data = strees [ "a"; "b"; "c" ] (contents "data") and query = {|{ master { tree { get_contents(key: "/a/b/c") { key __typename } } } }|} in set_tree data >>= fun () -> send_query query >|= assert_ok >|= Yojson.Safe.from_string >|= fun result -> let result : (string * Yojson.Safe.t) list = let open Yojson.Safe.Util in result |> members [ "data"; "master"; "tree"; "get_contents" ] |> to_assoc in Alcotest.(check (list (pair string yojson))) "Returned entry data is valid" [ ("key", `String "/a/b/c"); ("__typename", `String "Contents") ] result; () let test_get_tree_list : test_case = fun ~set_tree () -> let data = strees [ "a"; "b"; "c" ] (`Tree [ ("leaf", contents "data1"); ("branch", stree "f" (contents "data2")) ]) and query = {|{ master { tree { get_tree(key: "/a/b/c") { list { key __typename } } } } }|} in set_tree data >>= fun () -> send_query query >|= assert_ok >|= Yojson.Safe.from_string >|= fun result -> let key_data : (string * Yojson.Safe.t) list list = let open Yojson.Safe.Util in result |> members [ "data"; "master"; "tree"; "get_tree"; "list" ] |> to_list |> List.map to_assoc in Alcotest.(check (list (list (pair string yojson)))) "Returned entry data is valid" [ [ ("key", `String "/a/b/c/branch"); ("__typename", `String "Tree") ]; [ ("key", `String "/a/b/c/leaf"); ("__typename", `String "Contents") ]; ] key_data; () let suite ~set_tree = let test_case : string -> test_case -> unit Alcotest_lwt.test_case = fun name f -> Alcotest_lwt.test_case name `Quick (fun _ () -> f ~set_tree ()) in [ ( "GRAPHQL", [ test_case "get_contents-list" test_get_contents_list; test_case "get_tree-list" test_get_tree_list; ] ); ] let () = Random.self_init (); let main = spawn_graphql_server () >>= fun { event_loop; set_tree } -> Lwt.pick [ event_loop; Alcotest_lwt.run "irmin-graphql" (suite ~set_tree) ] in Lwt_main.run main
t-embed.c
#include "fq_zech_embed.h" #include "fq_zech_poly.h" #ifdef T #undef T #endif #ifdef B #undef B #endif #define T fq_zech #define CAP_T FQ_ZECH #define B nmod #include "fq_embed_templates/test/t-embed.c" #undef B #undef CAP_T #undef T
/* Copyright (C) 2017 Luca De Feo This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */
opamClientConfig.ml
module E = struct type OpamStd.Config.E.t += | ASSUMEDEPEXTS of bool option | AUTOREMOVE of bool option | CLI of string option | DROPWORKINGDIR of bool option | EDITOR of string option | FAKE of bool option | IGNOREPINDEPENDS of bool option | INPLACEBUILD of bool option | JSON of string option | KEEPBUILDDIR of bool option | NOAGGREGATE of bool option | NOAUTOUPGRADE of bool option | NOSELFUPGRADE of string option | PINKINDAUTO of bool option | REUSEBUILDDIR of bool option | ROOTISOK of bool option | SHOW of bool option | SKIPUPDATE of bool option | STATS of bool option | WORKINGDIR of bool option open OpamStd.Config.E let assumedepexts = value (function ASSUMEDEPEXTS b -> b | _ -> None) let autoremove = value (function AUTOREMOVE b -> b | _ -> None) let cli = value (function CLI s -> s | _ -> None) let dropworkingdir = value (function DROPWORKINGDIR b -> b | _ -> None) let editor = value (function EDITOR s -> s | _ -> None) let fake = value (function FAKE b -> b | _ -> None) let ignorepindepends = value (function IGNOREPINDEPENDS b -> b | _ -> None) let inplacebuild = value (function INPLACEBUILD b -> b | _ -> None) let json = value (function JSON s -> s | _ -> None) let keepbuilddir = value (function KEEPBUILDDIR b -> b | _ -> None) let noaggregate = value (function NOAGGREGATE b -> b | _ -> None) let noautoupgrade = value (function NOAUTOUPGRADE b -> b | _ -> None) let noselfupgrade = value (function NOSELFUPGRADE s -> s | _ -> None) let pinkindauto = value (function PINKINDAUTO b -> b | _ -> None) let reusebuilddir = value (function REUSEBUILDDIR b -> b | _ -> None) let rootisok = value (function ROOTISOK b -> b | _ -> None) let show = value (function SHOW b -> b | _ -> None) let skipupdate = value (function SKIPUPDATE b -> b | _ -> None) let stats = value (function STATS b -> b | _ -> None) let workingdir = value (function WORKINGDIR b -> b | _ -> None) end type t = { print_stats: bool; pin_kind_auto: bool; autoremove: bool; editor: string; keep_build_dir: bool; reuse_build_dir: bool; inplace_build: bool; working_dir: bool; drop_working_dir: bool; ignore_pin_depends: bool; show: bool; fake: bool; skip_dev_update: bool; json_out: string option; root_is_ok: bool; no_auto_upgrade: bool; assume_depexts: bool; cli: OpamCLIVersion.t; scrubbed_environment_variables: string list; } let default = { print_stats = false; pin_kind_auto = true; autoremove = false; editor = "nano"; keep_build_dir = false; reuse_build_dir = false; inplace_build = false; working_dir = false; drop_working_dir = false; ignore_pin_depends = false; show = false; fake = false; skip_dev_update = false; json_out = None; root_is_ok = false; no_auto_upgrade = false; assume_depexts = false; cli = OpamCLIVersion.current; scrubbed_environment_variables = []; } type 'a options_fun = ?print_stats:bool -> ?pin_kind_auto:bool -> ?autoremove:bool -> ?editor:string -> ?keep_build_dir:bool -> ?reuse_build_dir:bool -> ?inplace_build:bool -> ?working_dir:bool -> ?drop_working_dir:bool -> ?ignore_pin_depends:bool -> ?show:bool -> ?fake:bool -> ?skip_dev_update:bool -> ?json_out:string option -> ?root_is_ok:bool -> ?no_auto_upgrade:bool -> ?assume_depexts:bool -> ?cli:OpamCLIVersion.t -> ?scrubbed_environment_variables:string list -> 'a let setk k t ?print_stats ?pin_kind_auto ?autoremove ?editor ?keep_build_dir ?reuse_build_dir ?inplace_build ?working_dir ?drop_working_dir ?ignore_pin_depends ?show ?fake ?skip_dev_update ?json_out ?root_is_ok ?no_auto_upgrade ?assume_depexts ?cli ?scrubbed_environment_variables = let (+) x opt = match opt with Some x -> x | None -> x in k { print_stats = t.print_stats + print_stats; pin_kind_auto = t.pin_kind_auto + pin_kind_auto; autoremove = t.autoremove + autoremove; editor = t.editor + editor; keep_build_dir = t.keep_build_dir + keep_build_dir; reuse_build_dir = t.reuse_build_dir + reuse_build_dir; inplace_build = t.inplace_build + inplace_build; working_dir = t.working_dir + working_dir; drop_working_dir = t.drop_working_dir + drop_working_dir; ignore_pin_depends = t.ignore_pin_depends + ignore_pin_depends; show = t.show + show; fake = t.fake + fake; skip_dev_update = t.skip_dev_update + skip_dev_update; json_out = t.json_out + json_out; root_is_ok = t.root_is_ok + root_is_ok; no_auto_upgrade = t.no_auto_upgrade + no_auto_upgrade; assume_depexts = t.assume_depexts + assume_depexts; cli = t.cli + cli; scrubbed_environment_variables = t.scrubbed_environment_variables + scrubbed_environment_variables } let set t = setk (fun x () -> x) t let r = ref default let update ?noop:_ = setk (fun cfg () -> r := cfg) !r let initk k = let open OpamStd.Option.Op in Random.self_init (); let editor = E.editor () ++ OpamStd.Env.(getopt "VISUAL" ++ getopt "EDITOR") in setk (setk (fun c -> r := c; k)) !r ?print_stats:(E.stats ()) ?pin_kind_auto:(E.pinkindauto ()) ?autoremove:(E.autoremove ()) ?editor ?keep_build_dir:(E.keepbuilddir ()) ?reuse_build_dir:(E.reusebuilddir ()) ?inplace_build:(E.inplacebuild ()) ?working_dir:(E.workingdir ()) ?drop_working_dir:(E.dropworkingdir ()) ?ignore_pin_depends:(E.ignorepindepends ()) ?show:(E.show ()) ?fake:(E.fake ()) ?skip_dev_update:(E.skipupdate ()) ?json_out:(E.json () >>| function "" -> None | s -> Some s) ?root_is_ok:(E.rootisok ()) ?no_auto_upgrade:(E.noautoupgrade ()) ?assume_depexts:(E.assumedepexts ()) ?cli:None ?scrubbed_environment_variables:None let init ?noop:_ = initk (fun () -> ()) let search_files = ["findlib"] open OpamStd.Op let opam_init ?root_dir ?strict ?solver = let open OpamStd.Option.Op in (* (i) get root dir *) let root = OpamStateConfig.opamroot ?root_dir () in (* (ii) load conf file and set defaults *) (* the init for OpamFormat is done in advance since (a) it has an effect on loading the global config (b) the global config has no effect on it *) OpamFormatConfig.initk ?strict @@ fun ?log_dir -> let config = OpamStateConfig.load_defaults ~lock_kind:`Lock_read root in let initialised = config <> None in (* !X fixme: don't drop the loaded config file to reload it afterwards (when loading the global_state) like that... *) let solver = if solver = None && OpamSolverConfig.E.externalsolver () = None then (* fixme: in order to not revert config file solver value, we need to check it here *) (config >>= OpamFile.Config.solver >>| fun s -> lazy (OpamCudfSolver.custom_solver s)) else solver in begin match config with | None -> () | Some conf -> let criteria kind = let c = OpamFile.Config.criteria conf in try Some (List.assoc kind c) with Not_found -> None in OpamSolverConfig.update ?solver ?solver_preferences_default:(criteria `Default >>| fun s-> lazy(Some s)) ?solver_preferences_upgrade:(criteria `Upgrade >>| fun s-> lazy(Some s)) ?solver_preferences_fixup:(criteria `Fixup >>| fun s -> lazy (Some s)) ?solver_preferences_best_effort_prefix: (OpamFile.Config.best_effort_prefix conf >>| fun s -> lazy (Some s)) (); OpamStateConfig.update () end; (* (iii) load from env and options using OpamXxxConfig.init *) let log_dir = OpamStd.Option.map OpamFilename.Dir.to_string @@ if log_dir = None && initialised && OpamCoreConfig.E.logs () = None then (* fixme: in order to not revert [OPAMLOGS] value, we need to check it here *) Some (OpamPath.log root) else log_dir in (fun () -> ()) |> OpamCoreConfig.initk ?log_dir |> OpamRepositoryConfig.initk |> OpamSolverConfig.initk ?solver |> OpamStateConfig.initk ~root_dir:root |> initk
(**************************************************************************) (* *) (* Copyright 2015-2020 OCamlPro *) (* *) (* All rights reserved. This file is distributed under the terms of the *) (* GNU Lesser General Public License version 2.1, with the special *) (* exception on linking described in the file LICENSE. *) (* *) (**************************************************************************)
coq.ml
open Import let doc = "Command group related to Coq." let sub_commands_synopsis = Common.command_synopsis [ "coq top FILE -- ARGS" ] let man = [ `Blocks sub_commands_synopsis ] let info = Cmd.info ~doc ~man "coq" let group = Cmd.group info [ Coqtop.command ]
main.ml
(* SPDX-License-Identifier: MIT *) module Term = Cmdliner.Term module Arg = Cmdliner.Arg module Manpage = Cmdliner.Manpage module Cmd = Cmdliner.Cmd let ( $ ) = Cmdliner.Term.( $ ) let ( & ) = Cmdliner.Arg.( & ) let main repos depends_on regexp_arg main_regexp = match regexp_arg, main_regexp with | Some _, Some _ -> `Error (true, "Two regexps given. This is not supported yet") (* TODO *) | None, None -> `Error (true, "No regexp given. This is required") | Some regexp, None | None, Some regexp -> `Ok (fun () -> Grep.search ~repos ~depends_on ~regexp) let repos_arg = let doc = "" in (* TODO *) Arg.value & Arg.opt (Arg.some Arg.string) None & Arg.info ["repos"] ~docv:"REPOS" ~doc let depends_on_arg = let doc = "" in (* TODO *) Arg.value & Arg.opt (Arg.some Arg.string) None & Arg.info ["depends-on"] ~docv:"PACKAGES" ~doc let regexp_arg = let doc = "" in (* TODO *) Arg.value & Arg.opt (Arg.some Arg.string) None & Arg.info ["regexp"] ~docv:"REGEXP" ~doc let main_regexp = let doc = "" in (* TODO *) Arg.value & Arg.pos ~rev:true 0 (Arg.some Arg.string) None & Arg.info [] ~docv:"REGEXP" ~doc let cmd = let doc = "greps anything in the sources of the latest version of every opam packages" in let sdocs = Manpage.s_common_options in let exits = Cmd.Exit.defaults in let man = [] in (* TODO *) let term = Term.ret (Term.const main $ repos_arg $ depends_on_arg $ regexp_arg $ main_regexp) in let info = Cmd.info "opam-grep" ~version:Config.version ~doc ~sdocs ~exits ~man in Cmd.v info term let () = exit @@ match Cmd.eval_value cmd with | Ok (`Ok f) -> begin try f (); 0 with | Grep.OpamGrepError msg -> prerr_endline ("Error: "^msg); 1 end | Ok (`Version | `Help) -> 0 | Error _ -> 1
(* SPDX-License-Identifier: MIT *)
appendix_b.ml
let abcd1 = ("abcd1.ics", "\"fffff-abcd1\"", {|BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Example Corp.//CalDAV Client//EN BEGIN:VTIMEZONE LAST-MODIFIED:20040110T032845Z TZID:US/Eastern BEGIN:DAYLIGHT DTSTART:20000404T020000 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 TZNAME:EDT TZOFFSETFROM:-0500 TZOFFSETTO:-0400 END:DAYLIGHT BEGIN:STANDARD DTSTART:20001026T020000 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 TZNAME:EST TZOFFSETFROM:-0400 TZOFFSETTO:-0500 END:STANDARD END:VTIMEZONE BEGIN:VEVENT DTSTAMP:20060206T001102Z DTSTART;TZID=US/Eastern:20060102T100000 DURATION:PT1H SUMMARY:Event #1 Description:Go Steelers! UID:74855313FA803DA593CD579A@example.com END:VEVENT END:VCALENDAR |}) let abcd2 = ("abcd2.ics", "\"fffff-abcd2\"", {|BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Example Corp.//CalDAV Client//EN BEGIN:VTIMEZONE LAST-MODIFIED:20040110T032845Z TZID:US/Eastern BEGIN:DAYLIGHT DTSTART:20000404T020000 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 TZNAME:EDT TZOFFSETFROM:-0500 TZOFFSETTO:-0400 END:DAYLIGHT BEGIN:STANDARD DTSTART:20001026T020000 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 TZNAME:EST TZOFFSETFROM:-0400 TZOFFSETTO:-0500 END:STANDARD END:VTIMEZONE BEGIN:VEVENT DTSTAMP:20060206T001121Z DTSTART;TZID=US/Eastern:20060102T120000 DURATION:PT1H RRULE:FREQ=DAILY;COUNT=5 SUMMARY:Event #2 UID:00959BC664CA650E933C892C@example.com END:VEVENT BEGIN:VEVENT DTSTAMP:20060206T001121Z DTSTART;TZID=US/Eastern:20060104T140000 DURATION:PT1H RECURRENCE-ID;TZID=US/Eastern:20060104T120000 SUMMARY:Event #2 bis UID:00959BC664CA650E933C892C@example.com END:VEVENT BEGIN:VEVENT DTSTAMP:20060206T001121Z DTSTART;TZID=US/Eastern:20060106T140000 DURATION:PT1H RECURRENCE-ID;TZID=US/Eastern:20060106T120000 SUMMARY:Event #2 bis bis UID:00959BC664CA650E933C892C@example.com END:VEVENT END:VCALENDAR |}) let abcd3 = ("abcd3.ics", "\"fffff-abcd3\"", {|BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Example Corp.//CalDAV Client//EN BEGIN:VTIMEZONE LAST-MODIFIED:20040110T032845Z TZID:US/Eastern BEGIN:DAYLIGHT DTSTART:20000404T020000 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 TZNAME:EDT TZOFFSETFROM:-0500 TZOFFSETTO:-0400 END:DAYLIGHT BEGIN:STANDARD DTSTART:20001026T020000 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 TZNAME:EST TZOFFSETFROM:-0400 TZOFFSETTO:-0500 END:STANDARD END:VTIMEZONE BEGIN:VEVENT ATTENDEE;PARTSTAT=ACCEPTED;ROLE=CHAIR:mailto:cyrus@example.com ATTENDEE;PARTSTAT=NEEDS-ACTION:mailto:lisa@example.com DTSTAMP:20060206T001220Z DTSTART;TZID=US/Eastern:20060104T100000 DURATION:PT1H LAST-MODIFIED:20060206T001330Z ORGANIZER:mailto:cyrus@example.com SEQUENCE:1 STATUS:TENTATIVE SUMMARY:Event #3 UID:DC6C50A017428C5216A2F1CD@example.com X-ABC-GUID:E1CX5Dr-0007ym-Hz@example.com END:VEVENT END:VCALENDAR |}) let abcd4 = ("abcd4.ics", "\"fffff-abcd4\"", {|BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Example Corp.//CalDAV Client//EN BEGIN:VTODO DTSTAMP:20060205T235335Z DUE;VALUE=DATE:20060104 STATUS:NEEDS-ACTION SUMMARY:Task #1 UID:DDDEEB7915FA61233B861457@example.com BEGIN:VALARM ACTION:AUDIO TRIGGER;RELATED=END:-PT10M END:VALARM END:VTODO END:VCALENDAR |}) let abcd5 = ("abcd5.ics", "\"fffff-abcd5\"", {|BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Example Corp.//CalDAV Client//EN BEGIN:VTIMEZONE LAST-MODIFIED:20040110T032845Z TZID:US/Eastern BEGIN:DAYLIGHT DTSTART:20000404T020000 RRULE:FREQ=YEARLY;BYDAY=1SU;BYMONTH=4 TZNAME:EDT TZOFFSETFROM:-0500 TZOFFSETTO:-0400 END:DAYLIGHT BEGIN:STANDARD DTSTART:20001026T020000 RRULE:FREQ=YEARLY;BYDAY=-1SU;BYMONTH=10 TZNAME:EST TZOFFSETFROM:-0400 TZOFFSETTO:-0500 END:STANDARD END:VTIMEZONE BEGIN:VTODO DTSTAMP:20060205T235300Z DUE;TZID=US/Eastern:20060106T120000 LAST-MODIFIED:20060205T235308Z SEQUENCE:1 STATUS:NEEDS-ACTION SUMMARY:Task #2 UID:E10BA47467C5C69BB74E8720@example.com BEGIN:VALARM ACTION:AUDIO TRIGGER;RELATED=END:-PT10M END:VALARM END:VTODO END:VCALENDAR |}) let abcd6 = ("abcd6.ics", "\"fffff-abcd6\"", {|BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Example Corp.//CalDAV Client//EN BEGIN:VTODO COMPLETED:20051223T122322Z DTSTAMP:20060205T235400Z DUE;VALUE=DATE:20051225 LAST-MODIFIED:20060205T235308Z SEQUENCE:1 STATUS:COMPLETED SUMMARY:Task #3 UID:E10BA47467C5C69BB74E8722@example.com END:VTODO END:VCALENDAR |}) let abcd7 = ("abcd7.ics", "\"fffff-abcd7\"", {|BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Example Corp.//CalDAV Client//EN BEGIN:VTODO DTSTAMP:20060205T235600Z DUE;VALUE=DATE:20060101 LAST-MODIFIED:20060205T235308Z SEQUENCE:1 STATUS:CANCELLED SUMMARY:Task #4 UID:E10BA47467C5C69BB74E8725@example.com END:VTODO END:VCALENDAR |}) let abcd8 = ("abcd8.ics", "\"fffff-abcd8\"", {|BEGIN:VCALENDAR VERSION:2.0 PRODID:-//Example Corp.//CalDAV Client//EN BEGIN:VFREEBUSY ORGANIZER;CN="Bernard Desruisseaux":mailto:bernard@example.com UID:76ef34-54a3d2@example.com DTSTAMP:20050530T123421Z DTSTART:20060101T000000Z DTEND:20060108T000000Z FREEBUSY:20050531T230000Z/20050601T010000Z FREEBUSY;FBTYPE=BUSY-TENTATIVE:20060102T100000Z/20060102T120000Z FREEBUSY:20060103T100000Z/20060103T120000Z FREEBUSY:20060104T100000Z/20060104T120000Z FREEBUSY;FBTYPE=BUSY-UNAVAILABLE:20060105T100000Z/20060105T120000Z FREEBUSY:20060106T100000Z/20060106T120000Z END:VFREEBUSY END:VCALENDAR |}) let all = [ abcd1 ; abcd2 ; abcd3 ; abcd4 ; abcd5 ; abcd6 ; abcd7 ; abcd8 ] let base_url = "http://cal.example.com/bernard/work/"
monads.ml
(* Widely used module types. *) module type S = sig type 'a t val ( >>= ) : 'a t -> ('a -> 'b t) -> 'b t val return : 'a -> 'a t val run : 'a t -> 'a end (* Signature of a state monad. *) module type State_sig = sig type state type key type value include S with type 'a t = state -> 'a * state val empty : unit -> state val set : key -> value -> unit t val get : key -> value option t val iter_list : ('a -> unit t) -> 'a list -> unit t end module Make_state_monad (X : Stores.S) : State_sig with type state = X.state and type key = X.key and type value = X.value and type 'a t = X.state -> 'a * X.state = struct include X type 'a t = state -> 'a * state let ( >>= ) m f s = let x, s = m s in f x s let return x s = (x, s) let run m = fst (m (empty ())) let set k v s = ((), set k v s) let get k s = (get k s, s) let rec iter_list (f : 'a -> unit t) (l : 'a list) = match l with | [] -> return () | elt :: tl -> f elt >>= fun () -> iter_list f tl end
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2021 Nomadic Labs, <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************)
test_sync.ml
module Sync : Test_common.IO with type 'a io = 'a = struct include Plist_xml type s = Markup.sync type 'a io = 'a let opendir = Unix.opendir let readdir = Unix.readdir let closedir = Unix.closedir let bind x f = f x let return x = x let with_stream str f = let chan = open_in str in Fun.protect (fun () -> f (Markup.channel chan)) ~finally:(fun () -> close_in chan) let catch f handle = try f () with exn -> handle exn let protect = Fun.protect let prerr_endline = prerr_endline let to_stderr = Markup.to_channel stderr end open Test_common.Make(Sync) let () = prerr_endline "Test pass..."; test_pass (); prerr_endline "Test fail..."; test_fail ()
bar.ml
let bar_foo = 42
dune
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; OCamlFormat ; ; ; ; Copyright (c) Facebook, Inc. and its affiliates. ; ; ; ; This source code is licensed under the MIT license found in ; ; the LICENSE file in the root directory of this source tree. ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (rule (target source_bench.ml) (deps source.ml) (alias runbench) (action (with-stdout-to %{target} (run %{bin:cat} %{deps} %{deps} %{deps} %{deps} %{deps}))))
divrem_preinv.c
#include <gmp.h> #include "flint.h" #include "fmpz.h" #include "fmpz_poly.h" void _fmpz_poly_divrem_preinv(fmpz * Q, fmpz * A, slong len1, const fmpz * B, const fmpz * B_inv, slong len2) { slong n = len1 - len2 + 1; fmpz * P = _fmpz_vec_init(len2 - 1); _fmpz_poly_div_preinv(Q, A, len1, B, B_inv, len2); if (len2 - 1 > n) _fmpz_poly_mullow(P, B, len2 - 1, Q, n, len2 - 1); else _fmpz_poly_mullow(P, Q, n, B, len2 - 1, len2 - 1); _fmpz_poly_sub(A, A, len2 - 1, P, len2 - 1); _fmpz_vec_clear(P, len2 - 1); } void fmpz_poly_divrem_preinv(fmpz_poly_t Q, fmpz_poly_t R, const fmpz_poly_t A, const fmpz_poly_t B, const fmpz_poly_t B_inv) { fmpz_poly_t tQ, tR; fmpz *q, *r; slong len1 = A->length, len2 = B->length; slong qlen = len1 - len2 + 1; if (len1 < len2) { fmpz_poly_zero(Q); fmpz_poly_set(R, A); return; } if (Q == A || Q == B || Q == B_inv) { fmpz_poly_init2(tQ, qlen); q = tQ->coeffs; } else { fmpz_poly_fit_length(Q, qlen); q = Q->coeffs; } if (R == B || R == B_inv) { fmpz_poly_init2(tR, len1); r = tR->coeffs; } else { fmpz_poly_fit_length(R, len1); r = R->coeffs; } if (R == B || R == B_inv || R != A) _fmpz_vec_set(r, A->coeffs, A->length); _fmpz_poly_divrem_preinv(q, r, len1, B->coeffs, B_inv->coeffs, len2); if (Q == A || Q == B || Q == B_inv) { _fmpz_poly_set_length(tQ, qlen); fmpz_poly_swap(tQ, Q); fmpz_poly_clear(tQ); } else _fmpz_poly_set_length(Q, qlen); if (R == B || R == B_inv) { _fmpz_poly_set_length(tR, len2 - 1); fmpz_poly_swap(tR, R); fmpz_poly_clear(tR); } else _fmpz_poly_set_length(R, len2 - 1); /* no need to normalise Q */ _fmpz_poly_normalise(R); }
/* Copyright (C) 2013 William Hart This file is part of FLINT. FLINT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. See <https://www.gnu.org/licenses/>. */
jProgram.mli
(** Defines high level OCaml representation of a Java bytecode program. *) open! Javalib_pack open JBasics open Javalib (** {2 Navigable hierarchy.} *) (** To be able to navigate more easily in bytecode program, class names are replaced by pointers to class_file structures (for super_class, implemented interfaces and sub-classes or sub-interfaces). *) type 'a class_node = private { c_info : 'a jclass; c_super : 'a class_node option; c_interfaces : 'a interface_node ClassMap.t; mutable c_children : 'a class_node list; } and 'a interface_node = private { i_info : 'a jinterface; i_super : 'a class_node; (** must be java.lang.Object. But note that interfaces are not considered as children of java.lang.Object.*) i_interfaces : 'a interface_node ClassMap.t; mutable i_children_interfaces : 'a interface_node list; mutable i_children_classes : 'a class_node list } and 'a node = | Interface of 'a interface_node | Class of 'a class_node (** [make_class_node c super interfaces] builds a class node given a jclass [c], a super class node [super] and a map of implemented interfaces [interfaces]. This function adds the class [c] to the children of [super] and to the children classes of each interface in [interfaces]. *) val make_class_node : 'a jclass -> 'a class_node option -> 'a interface_node ClassMap.t -> 'a class_node (** [make_interface_node i super interfaces] builds an interface node given a jinterface [i], a super class node [c] (which is always [java.lang.Object]) and a map of super interfaces [interfaces]. This function adds the interface [i] to the children interfaces of each interface in [interfaces]. *) val make_interface_node : 'a jinterface -> 'a class_node -> 'a interface_node ClassMap.t -> 'a interface_node (** {2 The [program] structure.} *) type 'a static_lookup_method = class_name -> method_signature -> int -> ClassMethodSet.t (** A program is a record containing a map of class files identified by their name, the a super-set of the reachable methods (which have been parsed, but other method may have been parsed and may not be in the set [parsed_methods]), and a efficient function which allow to compute the methods that may be called for a given program point (the algorithm for this function depends on the algorithm that have been chosen to load the program). *) type 'a program = { classes : 'a node ClassMap.t; parsed_methods : ('a node * 'a concrete_method) ClassMethodMap.t; static_lookup_method : 'a static_lookup_method (** [static_lookup_method cni msi pc] returns the set of methods that may be called from the program point identified by [(cni,msi,pc)]. *) } (** {2 Iterators.}*) val iter : ('a node -> unit) -> 'a program -> unit val fold : ('b -> 'a node -> 'b) -> 'b -> 'a program -> 'b val cf_iter : (class_field -> unit) -> 'a node -> unit val if_iter : (interface_field -> unit) -> 'a node -> unit val f_iter : (any_field -> unit) -> 'a node -> unit val cf_fold : (class_field -> 'b -> 'b) -> 'a node -> 'b -> 'b val if_fold : (interface_field -> 'b -> 'b) -> 'a node -> 'b -> 'b val f_fold : (any_field -> 'b -> 'b) -> 'a node -> 'b -> 'b val cm_iter : ('a concrete_method -> unit) -> 'a node -> unit val am_iter : (abstract_method -> unit) -> 'a node -> unit val m_iter : ('a jmethod -> unit) -> 'a node -> unit val cm_fold : ('a concrete_method -> 'b -> 'b) -> 'a node -> 'b -> 'b val am_fold : (abstract_method -> 'b -> 'b) -> 'a node -> 'b -> 'b val m_fold : ('a jmethod -> 'b -> 'b) -> 'a node -> 'b -> 'b (** {2 Classes access functions.}*) (** [get_node p cn] returns the class named [cn] in program [p], if any. @raise Not_found if [p] does not contain a class named [cn]. *) val get_node : 'a program -> class_name -> 'a node val get_name : 'a node -> class_name val get_consts : 'a node -> constant array val get_interfaces : 'a node -> 'a interface_node ClassMap.t val get_all_children_classes : 'a class_node -> 'a class_node list val i_equal : 'a interface_node -> 'a interface_node -> bool val c_equal : 'a class_node -> 'a class_node -> bool val node_equal : 'a node -> 'a node -> bool val to_ioc : 'a node -> 'a interface_or_class (** {2 Methods access functions.}*) val main_signature : method_signature (** [get_method c ms] returns the method with signature [ms] in class [c], if any. @raise Not_found if [c] does not contain a method with signature [ms]. *) val get_method : 'a node -> method_signature -> 'a jmethod (** [get_concrete_method c ms] returns the method with signature [ms] in class [c], if any. @raise Not_found if [c] does not contain a method with signature [ms] or if the method is not concrete. *) val get_concrete_method : 'a node -> method_signature -> 'a concrete_method val get_methods : 'a node -> 'a jmethod MethodMap.t val get_concrete_methods : 'a node -> 'a concrete_method MethodMap.t val defines_method : 'a node -> method_signature -> bool (** {2 Fields access functions.}*) (** [get_field c fs] returns the field with signature [fs] in class [c], if any. @raise Not_found if [c] does not contain a field with signature [fs]. *) val get_field : 'a node -> field_signature -> any_field val get_fields : 'a node -> any_field FieldMap.t val defines_field : 'a node -> field_signature -> bool (** {2 Access to the hierarchy} *) (** [extends_class c1 c2] returns [true] if [c2] is a super-class of [c1]. A class extends itself. *) val extends_class : 'a class_node -> 'a class_node -> bool (** [extends_interface i1 i2] returns true if [i2] is a super-interface of [i1]. An interface extends itself. *) val extends_interface : 'a interface_node -> 'a interface_node -> bool (** [extends ioc1 ioc2] returns true if [ioc2] is a super-class or super-interface of [ioc1]. This is a combination of [extends_class] and [extends_interface] which take into account that [java.lang.Object] is a super-class of any interface. *) val extends : 'a node -> 'a node -> bool (** [implements c1 i2] returns true if [i2] is a super-interface of [c1]. *) val implements : 'a class_node -> 'a interface_node -> bool (** [super_class cn] returns the super class of cn. *) val super_class : 'a node -> 'a class_node option (** [implemented_interfaces cn] returns the interfaces implemented by [cn], super-classes of [cn], or extended by those super-interfaces. *) val implemented_interfaces : 'a class_node -> 'a interface_node list (** [directly_implements cn] returns the interfaces directly implemented by [cn]. *) val directly_implemented_interfaces: 'a class_node -> 'a interface_node list (** [super_interfaces iname] returns the explicit and implicit super-interfaces of [iname].*) val super_interfaces : 'a interface_node -> 'a interface_node list val first_common_super_class : 'a class_node -> 'a class_node -> 'a class_node (** {2 Building a hierarchy from simple classes.} *) (** [build_hierarchy cmap] builds the hierarchy of classes given the map of {interface_or_class}. @raise Not_found if a needed super class is not in the given ClassMap. *) val build_hierarchy : 'a interface_or_class ClassMap.t -> 'a node ClassMap.t (** {2 Transforming code representation in a program.} *) (** [map_program f fpp p] lazily applies [f] to all non-native implementations (cf. {!Javalib_pack.Javalib.implementation}) of the program [p]. [map_program] passes to [f] the class name and method signature corresponding to the method being converted. The application is {b lazy}: [f] is not applied until [Lazy.force] is called on the implementation. [fpp] is the optional function that, given the transformed code and one of its call sites program points, returns the corresponding call site program point in old code representation. Function [fpp] is used to transform the {!static_lookup_method} for the new representation, if no changes are needed just use None value. *) val map_program : (class_name -> method_signature -> 'a -> 'b) -> ('b -> int -> int) option -> 'a program -> 'b program (** [map_program2 f fpp p] is similar to [map_program] but instead of the class name and method signature, [f] receives the actual class node and concrete method being converted. The implementation of [map_program] is based on [map_program2].*) val map_program2 : ('a node -> 'a concrete_method -> 'a -> 'b) -> ('b -> int -> int) option -> 'a program -> 'b program (** {3 Alternative transforming functions} *) (** [map_program_with_native f fpp p] is equivalent to {!map_program} but allows to transform not only the code representation but also the implementation type. It provides a way to modify the nature of implementation to [Native] if the code could not be transformed or conversly to provide a generated code for [Native] implementation. *) val map_program_with_native : (class_name -> method_signature -> 'a implementation -> 'b implementation) -> ('b -> int -> int) option -> 'a program -> 'b program (** [map_program_with_native2 f fpp p] is equivalent to {!map_program2} but allows to transform not only the code representation but also the implementation type. It provides a way to modify the nature of implementation to [Native] if the code could not be transformed or conversly to provide a generated code for [Native] implementation.*) val map_program_with_native2 : ('a node -> 'a concrete_method -> 'a implementation -> 'b implementation) -> ('b -> int -> int) option -> 'a program -> 'b program (** {2 Callgraph.} *) type callgraph = ((class_name * method_signature * int) * (class_name * method_signature)) list (** [get_callgraph prog] : Get a callgraph including every call of every method of every class .*) val get_callgraph : JCode.jcode program -> callgraph (** [get_callgraph_from_entries prog entries] Get a callgraph only considering * code reachable from the given entrypoints. *) val get_callgraph_from_entries : JCode.jcode program -> class_method_signature list -> callgraph val store_callgraph : callgraph -> string -> unit (** {2 Exceptions.} *) (** @see <http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html> The JVM Specification *) exception IncompatibleClassChangeError (** @see <http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html> The JVM Specification *) exception NoSuchMethodError (** @see <http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html> The JVM Specification *) exception NoSuchFieldError (** @see <http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html> The JVM Specification *) exception NoClassDefFoundError (** @see <http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html> The JVM Specification *) exception AbstractMethodError (** @see <http://java.sun.com/docs/books/jvms/second_edition/html/VMSpecTOC.doc.html> The JVM Specification *) exception IllegalAccessError
(* * This file is part of SAWJA * Copyright (c)2007, 2008 Tiphaine Turpin (Université de Rennes 1) * Copyright (c)2007, 2008, 2009 Laurent Hubert (CNRS) * Copyright (c)2009 Nicolas Barre (INRIA) * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program. If not, see * <http://www.gnu.org/licenses/>. *)
repo_inmemory.ml
module Map = Map.Make (String) let lifecycles = [] let state = ref Map.empty let ordered_ids = ref [] let register_cleaner () = let cleaner ?ctx:_ _ = state := Map.empty; ordered_ids := []; Lwt.return () in Sihl.Cleaner.register_cleaner cleaner ;; let register_migration () = () let enqueue ?ctx:_ job_instance = let open Sihl.Contract.Queue in let id = job_instance.id in ordered_ids := List.cons id !ordered_ids; state := Map.add id job_instance !state; Lwt.return () ;; let enqueue_all ?ctx:_ job_instances = job_instances |> List.fold_left (fun res job -> Lwt.bind res (fun _ -> enqueue job)) (Lwt.return ()) ;; let update ?ctx:_ job_instance = let open Sihl.Contract.Queue in let id = job_instance.id in state := Map.add id job_instance !state; Lwt.return () ;; let find_workable ?ctx:_ () = let all_job_instances = List.map (fun id -> Map.find_opt id !state) !ordered_ids in let now = Ptime_clock.now () in let rec filter_pending all_job_instances result = match all_job_instances with | Some job_instance :: job_instances -> if Sihl.Contract.Queue.should_run job_instance now then filter_pending job_instances (List.cons job_instance result) else filter_pending job_instances result | None :: job_instances -> filter_pending job_instances result | [] -> result in Lwt.return @@ filter_pending all_job_instances [] ;; let query ?ctx:_ () = Lwt.return @@ List.map (fun id -> Map.find id !state) !ordered_ids ;; let find ?ctx:_ id = Lwt.return @@ Map.find_opt id !state let delete ?ctx:_ (job : Sihl.Contract.Queue.instance) = state := Map.remove job.id !state; Lwt.return () ;;
hashtbl.ml
module Make (Monad : Traced_sigs.Monad.S) (Seq : Traced_sigs.Seq.S with type 'error trace := 'error Monad.trace) = struct let hash = Stdlib.Hashtbl.hash let seeded_hash = Stdlib.Hashtbl.seeded_hash let hash_param ~meaningful ~total v = Stdlib.Hashtbl.hash_param meaningful total v let seeded_hash_param ~meaningful ~total seed v = Stdlib.Hashtbl.seeded_hash_param meaningful total seed v module type S = Traced_functor_outputs.Hashtbl.S with type 'error trace := 'error Monad.trace module Make (H : Stdlib.Hashtbl.HashedType) : S with type key = H.t = struct include Bare_structs.Hashtbl.Make (H) let iter_ep f t = Seq.iter_ep (fun (k, v) -> f k v) (to_seq t) end module type SeededS = Traced_functor_outputs.Hashtbl.SeededS with type 'error trace := 'error Monad.trace module MakeSeeded (H : Stdlib.Hashtbl.SeededHashedType) : SeededS with type key = H.t = struct include Bare_structs.Hashtbl.MakeSeeded (H) let iter_ep f t = Seq.iter_ep (fun (k, v) -> f k v) (to_seq t) end module type S_ES = Traced_functor_outputs.Hashtbl.S_ES with type 'error trace := 'error Monad.trace module Make_es (H : Stdlib.Hashtbl.HashedType) : S_ES with type key = H.t = struct include Bare_structs.Hashtbl.Make_es (H) let iter_with_waiting_ep f t = let open Monad.Lwt_traced_result_syntax in join @@ fold_promises (fun k p acc -> let promise = Lwt.try_bind (fun () -> p) (function Error _ -> return_unit | Ok v -> f k v) (fun _ -> return_unit) in promise :: acc) t [] end end
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2020 Nomadic Labs <contact@nomadic-labs.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************)
faked_daemon.ml
module Baker = struct let run ~(cctxt : #Protocol_client_context.full) ~stop_on_event ~chain_id ~(context_index : Abstract_context_index.t) ~delegates = let chain = `Hash chain_id in let baking_configuration = let open Baking_configuration in { default_config with validation = ContextIndex context_index; state_recorder = Disabled; } in (* By default errors are simply printed but the baker won't stop because of them. This is not what we want for testing. Here we force the baker to terminate unsuccessfully if an error occurs. *) let canceler = Lwt_canceler.create () in let on_error (err : error trace) = Lwt_canceler.cancel canceler >>= fun _ -> failwith "%a" Error_monad.pp_print_trace err in Baking_scheduling.run cctxt ~canceler ~stop_on_event ~on_error ~chain baking_configuration delegates end
types.h
#ifndef _SYS_TYPES_H #define _SYS_TYPES_H #include <inttypes.h> #include <stddef.h> #include <sys/cdefs.h> __BEGIN_DECLS typedef unsigned long int blkcnt_t; /* Used for file block counts */ typedef unsigned long int blksize_t; /* Used for block sizes */ typedef unsigned long int clock_t; /* Used for system times in clock ticks or CLOCKS_PER_SEC (see <time.h>). */ typedef uint64_t fsblkcnt_t; typedef uint64_t fsfilcnt_t; /* TODO: pthread_attr_t Used to identify a thread attribute object. pthread_cond_t Used for condition variables. pthread_condattr_t Used to identify a condition attribute object. pthread_key_t Used for thread-specific data keys. pthread_mutex_t Used for mutexes. pthread_mutexattr_t Used to identify a mutex attribute object. pthread_once_t Used for dynamic package initialisation. pthread_rwlock_t Used for read-write locks. pthread_rwlockattr_t Used for read-write lock attributes. pthread_t Used to identify a thread. */ #if defined(__alpha__) || defined(__ia64__) || defined(__sparc64__) || defined(__s390x__) typedef uint32_t dev_t; /* Used for device IDs. */ typedef uint32_t gid_t; /* Used for group IDs. */ typedef uint32_t mode_t; /* Used for some file attributes. */ typedef uint32_t nlink_t; /* Used for link counts. */ typedef uint32_t uid_t; /* Used for user IDs. */ #elif defined(__arm__) || defined(__i386__) || defined(__sparc__) || defined(__s390__) /* make sure __s390x__ hits before __s390__ */ typedef uint16_t dev_t; typedef uint16_t gid_t; typedef uint16_t mode_t; typedef uint16_t nlink_t; typedef uint16_t uid_t; #elif defined(__hppa__) typedef uint32_t dev_t; typedef uint32_t gid_t; typedef uint16_t mode_t; typedef uint16_t nlink_t; typedef uint32_t uid_t; #elif defined(__mips__) typedef uint32_t dev_t; typedef int32_t gid_t; typedef uint32_t mode_t; typedef int32_t nlink_t; typedef int32_t uid_t; #elif defined(__powerpc__) && !defined(__powerpc64__) typedef uint32_t dev_t; typedef uint32_t gid_t; typedef uint32_t mode_t; typedef uint16_t nlink_t; typedef uint32_t uid_t; #elif defined(__powerpc64__) || defined(__x86_64__) typedef unsigned long dev_t; typedef uint32_t gid_t; typedef uint32_t mode_t; typedef unsigned long nlink_t; typedef uint32_t uid_t; #endif typedef int32_t id_t; /* Used as a general identifier; can be used to contain at least a pid_t, uid_t or a gid_t. */ typedef unsigned long ino_t; /* Used for file serial numbers. */ typedef int32_t key_t; /* Used for interprocess communication. */ typedef int32_t pid_t; /* Used for process IDs and process group IDs. */ typedef signed long ssize_t; /* Used for a count of bytes or an error indication. */ typedef signed long suseconds_t; /* Used for time in microseconds. */ typedef signed long time_t; /* Used for time in seconds. */ typedef signed long useconds_t; /* Used for time in microseconds. */ /* non-susv2 types: */ __extension__ typedef signed long long loff_t; /* 64-bit offset */ __extension__ typedef int64_t off64_t; typedef off64_t off_t; __extension__ typedef unsigned long long ino64_t; __extension__ typedef signed long long blkcnt64_t; typedef uint32_t uid32_t; typedef uint32_t gid32_t; typedef int32_t clockid_t; typedef int32_t timer_t; typedef long int fpos_t; #define __socklen_t_defined typedef uint32_t socklen_t; typedef uint16_t sa_family_t; #ifdef _BSD_SOURCE /* die, BSD, die! */ typedef char* caddr_t __attribute_dontuse__; typedef unsigned char u_char __attribute_dontuse__; typedef unsigned short u_short __attribute_dontuse__; typedef unsigned int u_int __attribute_dontuse__; typedef unsigned char uchar __attribute_dontuse__; typedef unsigned short ushort __attribute_dontuse__; typedef unsigned int uint __attribute_dontuse__; typedef uint32_t u_long __attribute_dontuse__; typedef uint32_t n_long __attribute_dontuse__; typedef uint32_t n_time __attribute_dontuse__; typedef uint16_t n_short __attribute_dontuse__; typedef uint32_t ulong __attribute_dontuse__; typedef uint32_t nlong __attribute_dontuse__; typedef uint32_t ntime __attribute_dontuse__; typedef uint16_t nshort __attribute_dontuse__; /* never heard of these two, but dump uses them */ #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L typedef int64_t quad_t __attribute_dontuse__; typedef uint64_t u_quad_t __attribute_dontuse__; #endif typedef long daddr_t __attribute_dontuse__; typedef daddr_t __daddr_t __attribute_dontuse__; #endif #ifdef _GNU_SOURCE typedef uint8_t u_int8_t __attribute_dontuse__; typedef uint16_t u_int16_t __attribute_dontuse__; typedef uint32_t u_int32_t __attribute_dontuse__; #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L typedef uint64_t u_int64_t __attribute_dontuse__; #endif #endif __END_DECLS #endif
canvas-primitives.ml
(**************************************************************************) (* Lablgtk - Examples *) (* *) (* This code is in the public domain. *) (* You may freely copy parts of it in your application. *) (* *) (**************************************************************************) let zoom_changed canvas adj () = canvas#set_pixels_per_unit adj#value type 'p item_state = { item : 'p GnoCanvas.item ; mutable dragging : bool ; mutable x : float ; mutable y : float ; } let affine_rotate angle = let rad_angle = angle /. 180. *. acos (-1.) in let cos_a = cos rad_angle in let sin_a = sin rad_angle in [| cos_a ; sin_a ; ~-. sin_a ; cos_a ; 0. ; 0. |] let affine_apply a x y = ( a.(0) *. x +. a.(2) *. y +. a.(4) , a.(1) *. x +. a.(3) *. y +. a.(5) ) let affine_compose a1 a2 = [| a1.(0) *. a2.(0) +. a1.(1) *. a2.(2) ; a1.(0) *. a2.(1) +. a1.(1) *. a2.(3) ; a1.(2) *. a2.(0) +. a1.(3) *. a2.(2) ; a1.(2) *. a2.(1) +. a1.(3) *. a2.(3) ; a1.(4) *. a2.(0) +. a1.(5) *. a2.(2) +. a2.(4) ; a1.(4) *. a2.(1) +. a1.(5) *. a2.(3) +. a2.(5) ; |] let affine_invert a = let r_det = 1. /. (a.(0) *. a.(3) -. a.(1) *. a.(2)) in [| a.(3) *. r_det ; ~-. (a.(1)) *. r_det ; ~-. (a.(2)) *. r_det ; a.(0) *. r_det ; (a.(2) *. a.(5) -. a.(3) *. a.(4)) *. r_det ; (a.(1) *. a.(4) -. a.(0) *. a.(5)) *. r_det ; |] let affine_transl x y = [| 1. ; 0. ; 0. ; 1. ; x ; y |] let affine_rotate_around_point x y angle = affine_compose (affine_compose (affine_transl (~-. x) (~-. y)) (affine_rotate angle)) (affine_transl x y) let d_theta = 15. let item_event_button_press config ev = let state = GdkEvent.Button.state ev in match GdkEvent.Button.button ev with | 1 when Gdk.Convert.test_modifier `SHIFT state -> config.item#destroy () | 1 when Gdk.Convert.test_modifier `CONTROL state -> let (x, y) = config.item#w2i (GdkEvent.Button.x ev) (GdkEvent.Button.y ev) in config.item#affine_relative (affine_rotate_around_point x y d_theta) ; | 3 when Gdk.Convert.test_modifier `CONTROL state -> let (x, y) = config.item#w2i (GdkEvent.Button.x ev) (GdkEvent.Button.y ev) in config.item#affine_relative (affine_rotate_around_point x y (~-. d_theta)) ; | 1 -> let x = GdkEvent.Button.x ev in let y = GdkEvent.Button.y ev in let (p_x, p_y) = config.item#parent#w2i x y in config.x <- p_x ; config.y <- p_y ; config.dragging <- true | 2 when Gdk.Convert.test_modifier `SHIFT state -> config.item#lower_to_bottom () | 2 -> config.item#lower 1 | 3 when Gdk.Convert.test_modifier `SHIFT state -> config.item#raise_to_top () | 3 -> config.item#raise 1 | _ -> () let item_event_motion config ev = if config.dragging && Gdk.Convert.test_modifier `BUTTON1 (GdkEvent.Motion.state ev) then let x = GdkEvent.Motion.x ev in let y = GdkEvent.Motion.y ev in let (p_x, p_y) = config.item#parent#w2i x y in let aff = affine_invert ( match config.item#xform with | `AFFINE a -> a | `IDENTITY -> affine_transl 0. 0. | `TRANSL a -> affine_transl a.(0) a.(1) ) in let (apx, apy) = affine_apply aff p_x p_y in let (acx, acy) = affine_apply aff config.x config.y in config.item#move (apx -. acx) (apy -. acy) ; config.x <- p_x ; config.y <- p_y let item_event config ev = begin match ev with | `BUTTON_PRESS ev -> item_event_button_press config ev | `BUTTON_RELEASE _ -> config.dragging <- false | `MOTION_NOTIFY ev -> item_event_motion config ev | _ -> () end ; false let setup_item (it : 'a #GnoCanvas.item) = let config = { item = (it : 'a #GnoCanvas.item :> 'a GnoCanvas.item) ; dragging = false ; x = 0. ; y = 0. } in it#connect#event (item_event config) let setup_div root = let grp = GnoCanvas.group root ~x:0. ~y:0. in GnoCanvas.rect grp ~props:[ `X1 0.; `Y1 0.; `X2 600.; `Y2 450. ; `OUTLINE_COLOR "black" ; `WIDTH_UNITS 4. ] ; List.map (fun p -> GnoCanvas.line grp ~props:[ `FILL_COLOR "black"; `WIDTH_UNITS 4. ; `POINTS p ]) [ [| 0.; 150.; 600.; 150. |] ; [| 0.; 300.; 600.; 300. |] ; [| 200.; 0.; 200.; 450. |] ; [| 400.; 0.; 400.; 450. |] ; ] ; List.map (fun (text, pos) -> GnoCanvas.text grp ~props:[ `TEXT text ; `X (float (pos mod 3 * 200 + 100)) ; `Y (float (pos / 3 * 150 + 5)) ; `FONT "Sans 12" ; `ANCHOR `NORTH ; `FILL_COLOR "black" ]) [ ("Rectangles", 0); ("Ellipses", 1); ("Texts", 2); ("Images", 3); ("Lines", 4); ("Curves", 5); ("Arcs", 6); ("Polygons", 7); ("Widgets", 8); ] ; () let setup_rectangles root = setup_item (GnoCanvas.rect root ~props:[ `X1 20.; `Y1 30.; `X2 70.; `Y2 60.; `OUTLINE_COLOR "red" ; `WIDTH_PIXELS 8 ]) ; setup_item (GnoCanvas.rect root ~props:( [ `X1 90.; `Y1 40.; `X2 180.; `Y2 100.; `OUTLINE_COLOR "black" ; `WIDTH_UNITS 4. ] @ if root#canvas#aa then [ `FILL_COLOR_RGBA (Int32.of_int 0x3cb37180) ] else [ `FILL_COLOR "mediumseagreen" ; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001") ] )) ; setup_item (GnoCanvas.rect root ~props:[ `X1 10.; `Y1 80.; `X2 80.; `Y2 140.; `FILL_COLOR "steelblue" ]) let setup_ellipses root = setup_item (GnoCanvas.ellipse root ~props:[ `X1 220.; `Y1 30.; `X2 270.; `Y2 60. ; `OUTLINE_COLOR "goldenrod" ; `WIDTH_PIXELS 8 ]) ; setup_item (GnoCanvas.ellipse root ~props:[ `X1 290.; `Y1 40.; `X2 380.; `Y2 100. ; `FILL_COLOR "wheat" ; `OUTLINE_COLOR "midnightblue" ; `WIDTH_UNITS 4. ]) ; setup_item (GnoCanvas.ellipse root ~props:( [ `X1 210.; `Y1 80.; `X2 280.; `Y2 140.; `OUTLINE_COLOR "black" ; `WIDTH_PIXELS 0 ] @ if root#canvas#aa then [ `FILL_COLOR_RGBA (Int32.of_int 0x5f9ea080) ] else [ `FILL_COLOR "cadetblue" ; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001") ] )) let make_anchor root ~x ~y = let grp = GnoCanvas.group ~x ~y root in setup_item grp ; GnoCanvas.rect grp ~props:[ `X1 (-2.); `Y1 (-2.); `X2 2.; `Y2 2. ; `OUTLINE_COLOR "black" ; `WIDTH_PIXELS 0 ] ; grp let setup_texts root = GnoCanvas.text (make_anchor root ~x:420. ~y:20.) ~props:([ `TEXT "Anchor NW" ;`ANCHOR `NW ; `X 0. ; `Y 0. ; `FONT "Sans Bold 24" ; ] @ if root#canvas#aa then [ `FILL_COLOR_RGBA (Int32.of_int 0x0000ff80) ] else [ `FILL_COLOR "blue" ; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001") ] ) ; GnoCanvas.text (make_anchor root ~x:470. ~y:75.) ~props:[ `TEXT "Anchor center\nJustify center\nMultiline text" ; `X 0. ; `Y 0. ; `FONT "Sans monospace bold 14" ; `ANCHOR `CENTER ; `JUSTIFICATION `CENTER ; `FILL_COLOR "firebrick" ] ; GnoCanvas.text (make_anchor root ~x:590. ~y:140.) ~props:[ `TEXT "Clipped text\nClipped text\nClipped text\nClipped text\nClipped text\nClipped text" ; `X 0. ; `Y 0. ; `FONT "Sans 12" ; `ANCHOR `SE ; `CLIP true ; `CLIP_WIDTH 50. ; `CLIP_HEIGHT 55. ; `X_OFFSET 10. ; `FILL_COLOR "darkgreen" ] ; () let plant_flower root x y = let im = GdkPixbuf.from_file "flower.png" in setup_item (GnoCanvas.pixbuf root ~pixbuf:im ~x ~y ~props:[ `ANCHOR `CENTER] ) ; () let setup_images root = let im = GdkPixbuf.from_file "toroid.png" in setup_item (GnoCanvas.pixbuf ~x:100. ~y:225. ~pixbuf:im ~props:[ `ANCHOR `CENTER ] root) ; plant_flower root 20. 170. ; plant_flower root 180. 170. ; plant_flower root 20. 280. ; plant_flower root 180. 280. let polish_diamond root = let grp = GnoCanvas.group ~x:270. ~y:230. root in setup_item grp ; let p = Array.make 4 0. in let vertices, radius = (10, 60.) in for i=0 to pred vertices do let a = 8. *. atan 1. *. (float i) /. (float vertices) in p.(0) <- radius *. cos a ; p.(1) <- radius *. sin a ; for j=i+1 to pred vertices do let a = 8. *. atan 1. *. (float j) /. (float vertices) in p.(2) <- radius *. cos a ; p.(3) <- radius *. sin a ; GnoCanvas.line grp ~props:[ `POINTS p; `FILL_COLOR "black" ; `WIDTH_UNITS 1. ; `CAP_STYLE `ROUND ] ; () done done let make_hilbert root = let scale = 7. in let hilbert = "urdrrulurulldluuruluurdrurddldrrruluurdrurddldrddlulldrdldrrurd" in let points = Array.make (2 * (String.length hilbert + 1)) 0. in points.(0) <- 340. ; points.(1) <- 290. ; for i=1 to String.length hilbert do let (dx, dy) = match hilbert.[pred i] with | 'd' -> (0., scale) | 'u' -> (0., ~-. scale) | 'l' -> (~-. scale, 0.) | 'r' -> (scale, 0.) | _ -> failwith "pb" in points.(2 * i) <- points.(2 * (pred i)) +. dx ; points.(2 * i + 1) <- points.(2 * (pred i) + 1) +. dy done ; setup_item (GnoCanvas.line root ~props:( [ `POINTS points ; `WIDTH_UNITS 4. ; `CAP_STYLE `PROJECTING ; `JOIN_STYLE `MITER ] @ if root#canvas#aa then [ `FILL_COLOR_RGBA 0xff000080l ] else [ `FILL_COLOR "red" ; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001") ] ) ) ; () let setup_lines root = polish_diamond root ; make_hilbert root ; let points = [| 340.; 170.; 340.; 230.; 390.; 230.; 390.; 170. |] in setup_item (GnoCanvas.line root ~props:[ `POINTS points ; `FILL_COLOR "midnightblue" ; `WIDTH_UNITS 3. ; `FIRST_ARROWHEAD true ; `LAST_ARROWHEAD true ; `ARROW_SHAPE_A 8. ; `ARROW_SHAPE_B 12. ; `ARROW_SHAPE_C 4. ]) ; let points = [| 356.; 180.; 374.; 220.; |] in setup_item (GnoCanvas.line root ~props:[ `POINTS points ; `FILL_COLOR "blue" ; `WIDTH_PIXELS 0 ; `FIRST_ARROWHEAD true ; `LAST_ARROWHEAD true ; `ARROW_SHAPE_A 6. ; `ARROW_SHAPE_B 6. ; `ARROW_SHAPE_C 4. ]) ; let points = [| 356.; 220.; 374.; 180.; |] in setup_item (GnoCanvas.line root ~props:[ `POINTS points ; `FILL_COLOR "blue" ; `WIDTH_PIXELS 0 ; `FIRST_ARROWHEAD true ; `LAST_ARROWHEAD true ; `ARROW_SHAPE_A 6. ; `ARROW_SHAPE_B 6. ; `ARROW_SHAPE_C 4. ]) ; () let setup_curves root = let p = GnomeCanvas.PathDef.new_path () in GnomeCanvas.PathDef.moveto p 500. 175. ; GnomeCanvas.PathDef.curveto p 550. 175. 550. 275. 500. 275. ; setup_item (GnoCanvas.bpath root ~props:[ `BPATH p ; `OUTLINE_COLOR "black" ; `WIDTH_PIXELS 4 ]) ; () let setup_polygons root = let points = [| 210. ; 320.; 210.; 380.; 260.; 350.; |] in setup_item (GnoCanvas.polygon ~points root ~props:( (`OUTLINE_COLOR "black") :: if root#canvas#aa then [ `FILL_COLOR_RGBA (Int32.of_int 0x0000ff80) ] else [ `FILL_COLOR "blue" ; `FILL_STIPPLE (Gdk.Bitmap.create_from_data ~width:2 ~height:2 "\002\001") ] )) ; let points = [| 270.0; 330.0; 270.0; 430.0; 390.0; 430.0; 390.0; 330.0; 310.0; 330.0; 310.0; 390.0; 350.0; 390.0; 350.0; 370.0; 330.0; 370.0; 330.0; 350.0; 370.0; 350.0; 370.0; 410.0; 290.0; 410.0; 290.0; 330.0; |] in setup_item (GnoCanvas.polygon ~points root ~props:[ `FILL_COLOR "tan" ; `OUTLINE_COLOR "black" ; `WIDTH_UNITS 3. ]) ; () let setup_widgets root = let w = GButton.button ~label:"Hello world!" () in setup_item (GnoCanvas.widget root ~widget:w ~x:420. ~y:330. ~props:[ `ANCHOR `NW ; `SIZE_PIXELS false ; `WIDTH 100. ; `HEIGHT 40. ]) ; () let key_press (canvas : GnoCanvas.canvas) ev = let (x, y) = canvas#get_scroll_offsets in match GdkEvent.Key.keyval ev with | k when k = GdkKeysyms._Up -> canvas#scroll_to x (y-20) ; true | k when k = GdkKeysyms._Down -> canvas#scroll_to x (y+20) ; true | k when k = GdkKeysyms._Left -> canvas#scroll_to (x-10) y ; true | k when k = GdkKeysyms._Right -> canvas#scroll_to (x+10) y ; true | _ -> false let focus canvas ev = if GdkEvent.Focus.focus_in ev then prerr_endline "focus in" else prerr_endline "focus out" ; false let create_canvas_primitives window ~aa = let vbox = GPack.vbox ~border_width:4 ~spacing:4 ~packing:window#add () in GMisc.label ~text:"Drag an item with button 1. Click button 2 on an item to lower it,\n\ or button 3 to raise it. Shift+click with buttons 2 or 3 to send\n\ an item to the bottom or top, respectively. Control+click with \n\ button 1 or button 3 to rotate an item." ~packing:vbox#pack () ; let hbox = GPack.hbox ~spacing:4 ~packing:vbox#pack () in GtkBase.Widget.push_colormap (Gdk.Rgb.get_cmap ()) ; let canvas = GnoCanvas.canvas ~aa ~width:600 ~height:450 () in canvas#set_center_scroll_region false ; let root = canvas#root in setup_div root ; setup_rectangles root ; setup_ellipses root ; setup_texts root ; setup_images root ; setup_lines root ; setup_polygons root ; setup_curves root ; setup_widgets root ; (* root#affine_relative [| 1.5; 0.; 0.; 0.7; 0.; 0.; |] ; *) GtkBase.Widget.pop_colormap () ; GMisc.label ~text:"Zoom:" ~packing:hbox#pack () ; let adj = GData.adjustment ~value:1. ~lower:0.05 ~upper:5. ~step_incr:0.05 ~page_incr:0.5 ~page_size:0.5 () in adj#connect#value_changed (zoom_changed canvas adj) ; let w = GEdit.spin_button ~adjustment:adj ~rate:0. ~digits:2 ~width:50 ~packing:hbox#pack () in let table = GPack.table ~rows:2 ~columns:2 ~row_spacings:4 ~col_spacings:4 ~packing:vbox#pack () in let frame = GBin.frame ~shadow_type:`IN () in table#attach ~left:0 ~right:1 ~top:0 ~bottom:1 ~expand:`BOTH ~fill:`BOTH ~shrink:`BOTH ~xpadding:0 ~ypadding:0 frame#coerce ; canvas#set_scroll_region 0. 0. 600. 450. ; frame#add canvas#coerce ; canvas#event#connect#after#key_press (key_press canvas) ; canvas#event#connect#enter_notify (fun _ -> canvas#misc#grab_focus () ; false) ; let w = GRange.scrollbar `HORIZONTAL ~adjustment:canvas#hadjustment () in table#attach ~left:0 ~right:1 ~top:1 ~bottom:2 ~expand:`X ~fill:`BOTH ~shrink:`X ~xpadding:0 ~ypadding:0 w#coerce ; let w = GRange.scrollbar `VERTICAL ~adjustment:canvas#vadjustment () in table#attach ~left:1 ~right:2 ~top:0 ~bottom:1 ~expand:`Y ~fill:`BOTH ~shrink:`Y ~xpadding:0 ~ypadding:0 w#coerce ; canvas#misc#set_can_focus true ; canvas#misc#grab_focus () let main_1 () = let aa = if Array.length Sys.argv > 1 then try bool_of_string Sys.argv.(1) with Invalid_argument _ -> false else false in let window = GWindow.window () in create_canvas_primitives window ~aa ; window#connect#destroy ~callback:GMain.Main.quit ; window#show () ; GMain.Main.main () let _ = main_1 () (* Local Variables: *) (* compile-command: "ocamlopt -w s -i -I ../../src lablgtk.cmxa gtkInit.cmx lablgnomecanvas.cmxa canvas-primitives.ml" *) (* End: *)
(**************************************************************************) (* Lablgtk - Examples *) (* *) (* This code is in the public domain. *) (* You may freely copy parts of it in your application. *) (* *) (**************************************************************************)
dune
(cram (applies_to :whole_subtree) (deps %{bin:caramelc}))
unit_of_time.ml
open! Import type t = | Nanosecond | Microsecond | Millisecond | Second | Minute | Hour | Day [@@deriving sexp, compare, enumerate, hash]
ast_412.ml
module Asttypes = struct type constant (*IF_CURRENT = Asttypes.constant *) = Const_int of int | Const_char of char | Const_string of string * Location.t * string option | Const_float of string | Const_int32 of int32 | Const_int64 of int64 | Const_nativeint of nativeint type rec_flag (*IF_CURRENT = Asttypes.rec_flag *) = Nonrecursive | Recursive type direction_flag (*IF_CURRENT = Asttypes.direction_flag *) = Upto | Downto (* Order matters, used in polymorphic comparison *) type private_flag (*IF_CURRENT = Asttypes.private_flag *) = Private | Public type mutable_flag (*IF_CURRENT = Asttypes.mutable_flag *) = Immutable | Mutable type virtual_flag (*IF_CURRENT = Asttypes.virtual_flag *) = Virtual | Concrete type override_flag (*IF_CURRENT = Asttypes.override_flag *) = Override | Fresh type closed_flag (*IF_CURRENT = Asttypes.closed_flag *) = Closed | Open type label = string type arg_label (*IF_CURRENT = Asttypes.arg_label *) = Nolabel | Labelled of string (* label:T -> ... *) | Optional of string (* ?label:T -> ... *) type 'a loc = 'a Location.loc = { txt : 'a; loc : Location.t; } type variance (*IF_CURRENT = Asttypes.variance *) = | Covariant | Contravariant | NoVariance type injectivity (*IF_CURRENT = Asttypes.injectivity *) = | Injective | NoInjectivity end module Parsetree = struct open Asttypes type constant (*IF_CURRENT = Parsetree.constant *) = Pconst_integer of string * char option (* 3 3l 3L 3n Suffixes [g-z][G-Z] are accepted by the parser. Suffixes except 'l', 'L' and 'n' are rejected by the typechecker *) | Pconst_char of char (* 'c' *) | Pconst_string of string * Location.t * string option (* "constant" {delim|other constant|delim} The location span the content of the string, without the delimiters. *) | Pconst_float of string * char option (* 3.4 2e5 1.4e-4 Suffixes [g-z][G-Z] are accepted by the parser. Suffixes are rejected by the typechecker. *) type location_stack = Location.t list (** {1 Extension points} *) type attribute (*IF_CURRENT = Parsetree.attribute *) = { attr_name : string loc; attr_payload : payload; attr_loc : Location.t; } (* [@id ARG] [@@id ARG] Metadata containers passed around within the AST. The compiler ignores unknown attributes. *) and extension = string loc * payload (* [%id ARG] [%%id ARG] Sub-language placeholder -- rejected by the typechecker. *) and attributes = attribute list and payload (*IF_CURRENT = Parsetree.payload *) = | PStr of structure | PSig of signature (* : SIG *) | PTyp of core_type (* : T *) | PPat of pattern * expression option (* ? P or ? P when E *) (** {1 Core language} *) (* Type expressions *) and core_type (*IF_CURRENT = Parsetree.core_type *) = { ptyp_desc: core_type_desc; ptyp_loc: Location.t; ptyp_loc_stack: location_stack; ptyp_attributes: attributes; (* ... [@id1] [@id2] *) } and core_type_desc (*IF_CURRENT = Parsetree.core_type_desc *) = | Ptyp_any (* _ *) | Ptyp_var of string (* 'a *) | Ptyp_arrow of arg_label * core_type * core_type (* T1 -> T2 Simple ~l:T1 -> T2 Labelled ?l:T1 -> T2 Optional *) | Ptyp_tuple of core_type list (* T1 * ... * Tn Invariant: n >= 2 *) | Ptyp_constr of Longident.t loc * core_type list (* tconstr T tconstr (T1, ..., Tn) tconstr *) | Ptyp_object of object_field list * closed_flag (* < l1:T1; ...; ln:Tn > (flag = Closed) < l1:T1; ...; ln:Tn; .. > (flag = Open) *) | Ptyp_class of Longident.t loc * core_type list (* #tconstr T #tconstr (T1, ..., Tn) #tconstr *) | Ptyp_alias of core_type * string (* T as 'a *) | Ptyp_variant of row_field list * closed_flag * label list option (* [ `A|`B ] (flag = Closed; labels = None) [> `A|`B ] (flag = Open; labels = None) [< `A|`B ] (flag = Closed; labels = Some []) [< `A|`B > `X `Y ](flag = Closed; labels = Some ["X";"Y"]) *) | Ptyp_poly of string loc list * core_type (* 'a1 ... 'an. T Can only appear in the following context: - As the core_type of a Ppat_constraint node corresponding to a constraint on a let-binding: let x : 'a1 ... 'an. T = e ... - Under Cfk_virtual for methods (not values). - As the core_type of a Pctf_method node. - As the core_type of a Pexp_poly node. - As the pld_type field of a label_declaration. - As a core_type of a Ptyp_object node. *) | Ptyp_package of package_type (* (module S) *) | Ptyp_extension of extension (* [%id] *) and package_type = Longident.t loc * (Longident.t loc * core_type) list (* (module S) (module S with type t1 = T1 and ... and tn = Tn) *) and row_field (*IF_CURRENT = Parsetree.row_field *) = { prf_desc : row_field_desc; prf_loc : Location.t; prf_attributes : attributes; } and row_field_desc (*IF_CURRENT = Parsetree.row_field_desc *) = | Rtag of label loc * bool * core_type list (* [`A] ( true, [] ) [`A of T] ( false, [T] ) [`A of T1 & .. & Tn] ( false, [T1;...Tn] ) [`A of & T1 & .. & Tn] ( true, [T1;...Tn] ) - The 'bool' field is true if the tag contains a constant (empty) constructor. - '&' occurs when several types are used for the same constructor (see 4.2 in the manual) *) | Rinherit of core_type (* [ T ] *) and object_field (*IF_CURRENT = Parsetree.object_field *) = { pof_desc : object_field_desc; pof_loc : Location.t; pof_attributes : attributes; } and object_field_desc (*IF_CURRENT = Parsetree.object_field_desc *) = | Otag of label loc * core_type | Oinherit of core_type (* Patterns *) and pattern (*IF_CURRENT = Parsetree.pattern *) = { ppat_desc: pattern_desc; ppat_loc: Location.t; ppat_loc_stack: location_stack; ppat_attributes: attributes; (* ... [@id1] [@id2] *) } and pattern_desc (*IF_CURRENT = Parsetree.pattern_desc *) = | Ppat_any (* _ *) | Ppat_var of string loc (* x *) | Ppat_alias of pattern * string loc (* P as 'a *) | Ppat_constant of constant (* 1, 'a', "true", 1.0, 1l, 1L, 1n *) | Ppat_interval of constant * constant (* 'a'..'z' Other forms of interval are recognized by the parser but rejected by the type-checker. *) | Ppat_tuple of pattern list (* (P1, ..., Pn) Invariant: n >= 2 *) | Ppat_construct of Longident.t loc * pattern option (* C None C P Some P C (P1, ..., Pn) Some (Ppat_tuple [P1; ...; Pn]) *) | Ppat_variant of label * pattern option (* `A (None) `A P (Some P) *) | Ppat_record of (Longident.t loc * pattern) list * closed_flag (* { l1=P1; ...; ln=Pn } (flag = Closed) { l1=P1; ...; ln=Pn; _} (flag = Open) Invariant: n > 0 *) | Ppat_array of pattern list (* [| P1; ...; Pn |] *) | Ppat_or of pattern * pattern (* P1 | P2 *) | Ppat_constraint of pattern * core_type (* (P : T) *) | Ppat_type of Longident.t loc (* #tconst *) | Ppat_lazy of pattern (* lazy P *) | Ppat_unpack of string option loc (* (module P) Some "P" (module _) None Note: (module P : S) is represented as Ppat_constraint(Ppat_unpack, Ptyp_package) *) | Ppat_exception of pattern (* exception P *) | Ppat_extension of extension (* [%id] *) | Ppat_open of Longident.t loc * pattern (* M.(P) *) (* Value expressions *) and expression (*IF_CURRENT = Parsetree.expression *) = { pexp_desc: expression_desc; pexp_loc: Location.t; pexp_loc_stack: location_stack; pexp_attributes: attributes; (* ... [@id1] [@id2] *) } and expression_desc (*IF_CURRENT = Parsetree.expression_desc *) = | Pexp_ident of Longident.t loc (* x M.x *) | Pexp_constant of constant (* 1, 'a', "true", 1.0, 1l, 1L, 1n *) | Pexp_let of rec_flag * value_binding list * expression (* let P1 = E1 and ... and Pn = EN in E (flag = Nonrecursive) let rec P1 = E1 and ... and Pn = EN in E (flag = Recursive) *) | Pexp_function of case list (* function P1 -> E1 | ... | Pn -> En *) | Pexp_fun of arg_label * expression option * pattern * expression (* fun P -> E1 (Simple, None) fun ~l:P -> E1 (Labelled l, None) fun ?l:P -> E1 (Optional l, None) fun ?l:(P = E0) -> E1 (Optional l, Some E0) Notes: - If E0 is provided, only Optional is allowed. - "fun P1 P2 .. Pn -> E1" is represented as nested Pexp_fun. - "let f P = E" is represented using Pexp_fun. *) | Pexp_apply of expression * (arg_label * expression) list (* E0 ~l1:E1 ... ~ln:En li can be empty (non labeled argument) or start with '?' (optional argument). Invariant: n > 0 *) | Pexp_match of expression * case list (* match E0 with P1 -> E1 | ... | Pn -> En *) | Pexp_try of expression * case list (* try E0 with P1 -> E1 | ... | Pn -> En *) | Pexp_tuple of expression list (* (E1, ..., En) Invariant: n >= 2 *) | Pexp_construct of Longident.t loc * expression option (* C None C E Some E C (E1, ..., En) Some (Pexp_tuple[E1;...;En]) *) | Pexp_variant of label * expression option (* `A (None) `A E (Some E) *) | Pexp_record of (Longident.t loc * expression) list * expression option (* { l1=P1; ...; ln=Pn } (None) { E0 with l1=P1; ...; ln=Pn } (Some E0) Invariant: n > 0 *) | Pexp_field of expression * Longident.t loc (* E.l *) | Pexp_setfield of expression * Longident.t loc * expression (* E1.l <- E2 *) | Pexp_array of expression list (* [| E1; ...; En |] *) | Pexp_ifthenelse of expression * expression * expression option (* if E1 then E2 else E3 *) | Pexp_sequence of expression * expression (* E1; E2 *) | Pexp_while of expression * expression (* while E1 do E2 done *) | Pexp_for of pattern * expression * expression * direction_flag * expression (* for i = E1 to E2 do E3 done (flag = Upto) for i = E1 downto E2 do E3 done (flag = Downto) *) | Pexp_constraint of expression * core_type (* (E : T) *) | Pexp_coerce of expression * core_type option * core_type (* (E :> T) (None, T) (E : T0 :> T) (Some T0, T) *) | Pexp_send of expression * label loc (* E # m *) | Pexp_new of Longident.t loc (* new M.c *) | Pexp_setinstvar of label loc * expression (* x <- 2 *) | Pexp_override of (label loc * expression) list (* {< x1 = E1; ...; Xn = En >} *) | Pexp_letmodule of string option loc * module_expr * expression (* let module M = ME in E *) | Pexp_letexception of extension_constructor * expression (* let exception C in E *) | Pexp_assert of expression (* assert E Note: "assert false" is treated in a special way by the type-checker. *) | Pexp_lazy of expression (* lazy E *) | Pexp_poly of expression * core_type option (* Used for method bodies. Can only be used as the expression under Cfk_concrete for methods (not values). *) | Pexp_object of class_structure (* object ... end *) | Pexp_newtype of string loc * expression (* fun (type t) -> E *) | Pexp_pack of module_expr (* (module ME) (module ME : S) is represented as Pexp_constraint(Pexp_pack, Ptyp_package S) *) | Pexp_open of open_declaration * expression (* M.(E) let open M in E let! open M in E *) | Pexp_letop of letop (* let* P = E in E let* P = E and* P = E in E *) | Pexp_extension of extension (* [%id] *) | Pexp_unreachable (* . *) and case (*IF_CURRENT = Parsetree.case *) = (* (P -> E) or (P when E0 -> E) *) { pc_lhs: pattern; pc_guard: expression option; pc_rhs: expression; } and letop (*IF_CURRENT = Parsetree.letop *) = { let_ : binding_op; ands : binding_op list; body : expression; } and binding_op (*IF_CURRENT = Parsetree.binding_op *) = { pbop_op : string loc; pbop_pat : pattern; pbop_exp : expression; pbop_loc : Location.t; } (* Value descriptions *) and value_description (*IF_CURRENT = Parsetree.value_description *) = { pval_name: string loc; pval_type: core_type; pval_prim: string list; pval_attributes: attributes; (* ... [@@id1] [@@id2] *) pval_loc: Location.t; } (* val x: T (prim = []) external x: T = "s1" ... "sn" (prim = ["s1";..."sn"]) *) (* Type declarations *) and type_declaration (*IF_CURRENT = Parsetree.type_declaration *) = { ptype_name: string loc; ptype_params: (core_type * (variance * injectivity)) list; (* ('a1,...'an) t; None represents _*) ptype_cstrs: (core_type * core_type * Location.t) list; (* ... constraint T1=T1' ... constraint Tn=Tn' *) ptype_kind: type_kind; ptype_private: private_flag; (* = private ... *) ptype_manifest: core_type option; (* = T *) ptype_attributes: attributes; (* ... [@@id1] [@@id2] *) ptype_loc: Location.t; } (* type t (abstract, no manifest) type t = T0 (abstract, manifest=T0) type t = C of T | ... (variant, no manifest) type t = T0 = C of T | ... (variant, manifest=T0) type t = {l: T; ...} (record, no manifest) type t = T0 = {l : T; ...} (record, manifest=T0) type t = .. (open, no manifest) *) and type_kind (*IF_CURRENT = Parsetree.type_kind *) = | Ptype_abstract | Ptype_variant of constructor_declaration list | Ptype_record of label_declaration list (* Invariant: non-empty list *) | Ptype_open and label_declaration (*IF_CURRENT = Parsetree.label_declaration *) = { pld_name: string loc; pld_mutable: mutable_flag; pld_type: core_type; pld_loc: Location.t; pld_attributes: attributes; (* l : T [@id1] [@id2] *) } (* { ...; l: T; ... } (mutable=Immutable) { ...; mutable l: T; ... } (mutable=Mutable) Note: T can be a Ptyp_poly. *) and constructor_declaration (*IF_CURRENT = Parsetree.constructor_declaration *) = { pcd_name: string loc; pcd_args: constructor_arguments; pcd_res: core_type option; pcd_loc: Location.t; pcd_attributes: attributes; (* C of ... [@id1] [@id2] *) } and constructor_arguments (*IF_CURRENT = Parsetree.constructor_arguments *) = | Pcstr_tuple of core_type list | Pcstr_record of label_declaration list (* | C of T1 * ... * Tn (res = None, args = Pcstr_tuple []) | C: T0 (res = Some T0, args = []) | C: T1 * ... * Tn -> T0 (res = Some T0, args = Pcstr_tuple) | C of {...} (res = None, args = Pcstr_record) | C: {...} -> T0 (res = Some T0, args = Pcstr_record) | C of {...} as t (res = None, args = Pcstr_record) *) and type_extension (*IF_CURRENT = Parsetree.type_extension *) = { ptyext_path: Longident.t loc; ptyext_params: (core_type * (variance * injectivity)) list; ptyext_constructors: extension_constructor list; ptyext_private: private_flag; ptyext_loc: Location.t; ptyext_attributes: attributes; (* ... [@@id1] [@@id2] *) } (* type t += ... *) and extension_constructor (*IF_CURRENT = Parsetree.extension_constructor *) = { pext_name: string loc; pext_kind : extension_constructor_kind; pext_loc : Location.t; pext_attributes: attributes; (* C of ... [@id1] [@id2] *) } (* exception E *) and type_exception (*IF_CURRENT = Parsetree.type_exception *) = { ptyexn_constructor: extension_constructor; ptyexn_loc: Location.t; ptyexn_attributes: attributes; (* ... [@@id1] [@@id2] *) } and extension_constructor_kind (*IF_CURRENT = Parsetree.extension_constructor_kind *) = Pext_decl of constructor_arguments * core_type option (* | C of T1 * ... * Tn ([T1; ...; Tn], None) | C: T0 ([], Some T0) | C: T1 * ... * Tn -> T0 ([T1; ...; Tn], Some T0) *) | Pext_rebind of Longident.t loc (* | C = D *) (** {1 Class language} *) (* Type expressions for the class language *) and class_type (*IF_CURRENT = Parsetree.class_type *) = { pcty_desc: class_type_desc; pcty_loc: Location.t; pcty_attributes: attributes; (* ... [@id1] [@id2] *) } and class_type_desc (*IF_CURRENT = Parsetree.class_type_desc *) = | Pcty_constr of Longident.t loc * core_type list (* c ['a1, ..., 'an] c *) | Pcty_signature of class_signature (* object ... end *) | Pcty_arrow of arg_label * core_type * class_type (* T -> CT Simple ~l:T -> CT Labelled l ?l:T -> CT Optional l *) | Pcty_extension of extension (* [%id] *) | Pcty_open of open_description * class_type (* let open M in CT *) and class_signature (*IF_CURRENT = Parsetree.class_signature *) = { pcsig_self: core_type; pcsig_fields: class_type_field list; } (* object('selfpat) ... end object ... end (self = Ptyp_any) *) and class_type_field (*IF_CURRENT = Parsetree.class_type_field *) = { pctf_desc: class_type_field_desc; pctf_loc: Location.t; pctf_attributes: attributes; (* ... [@@id1] [@@id2] *) } and class_type_field_desc (*IF_CURRENT = Parsetree.class_type_field_desc *) = | Pctf_inherit of class_type (* inherit CT *) | Pctf_val of (label loc * mutable_flag * virtual_flag * core_type) (* val x: T *) | Pctf_method of (label loc * private_flag * virtual_flag * core_type) (* method x: T Note: T can be a Ptyp_poly. *) | Pctf_constraint of (core_type * core_type) (* constraint T1 = T2 *) | Pctf_attribute of attribute (* [@@@id] *) | Pctf_extension of extension (* [%%id] *) and 'a class_infos (*IF_CURRENT = 'a Parsetree.class_infos *) = { pci_virt: virtual_flag; pci_params: (core_type * (variance * injectivity)) list; pci_name: string loc; pci_expr: 'a; pci_loc: Location.t; pci_attributes: attributes; (* ... [@@id1] [@@id2] *) } (* class c = ... class ['a1,...,'an] c = ... class virtual c = ... Also used for "class type" declaration. *) and class_description = class_type class_infos and class_type_declaration = class_type class_infos (* Value expressions for the class language *) and class_expr (*IF_CURRENT = Parsetree.class_expr *) = { pcl_desc: class_expr_desc; pcl_loc: Location.t; pcl_attributes: attributes; (* ... [@id1] [@id2] *) } and class_expr_desc (*IF_CURRENT = Parsetree.class_expr_desc *) = | Pcl_constr of Longident.t loc * core_type list (* c ['a1, ..., 'an] c *) | Pcl_structure of class_structure (* object ... end *) | Pcl_fun of arg_label * expression option * pattern * class_expr (* fun P -> CE (Simple, None) fun ~l:P -> CE (Labelled l, None) fun ?l:P -> CE (Optional l, None) fun ?l:(P = E0) -> CE (Optional l, Some E0) *) | Pcl_apply of class_expr * (arg_label * expression) list (* CE ~l1:E1 ... ~ln:En li can be empty (non labeled argument) or start with '?' (optional argument). Invariant: n > 0 *) | Pcl_let of rec_flag * value_binding list * class_expr (* let P1 = E1 and ... and Pn = EN in CE (flag = Nonrecursive) let rec P1 = E1 and ... and Pn = EN in CE (flag = Recursive) *) | Pcl_constraint of class_expr * class_type (* (CE : CT) *) | Pcl_extension of extension (* [%id] *) | Pcl_open of open_description * class_expr (* let open M in CE *) and class_structure (*IF_CURRENT = Parsetree.class_structure *) = { pcstr_self: pattern; pcstr_fields: class_field list; } (* object(selfpat) ... end object ... end (self = Ppat_any) *) and class_field (*IF_CURRENT = Parsetree.class_field *) = { pcf_desc: class_field_desc; pcf_loc: Location.t; pcf_attributes: attributes; (* ... [@@id1] [@@id2] *) } and class_field_desc (*IF_CURRENT = Parsetree.class_field_desc *) = | Pcf_inherit of override_flag * class_expr * string loc option (* inherit CE inherit CE as x inherit! CE inherit! CE as x *) | Pcf_val of (label loc * mutable_flag * class_field_kind) (* val x = E val virtual x: T *) | Pcf_method of (label loc * private_flag * class_field_kind) (* method x = E (E can be a Pexp_poly) method virtual x: T (T can be a Ptyp_poly) *) | Pcf_constraint of (core_type * core_type) (* constraint T1 = T2 *) | Pcf_initializer of expression (* initializer E *) | Pcf_attribute of attribute (* [@@@id] *) | Pcf_extension of extension (* [%%id] *) and class_field_kind (*IF_CURRENT = Parsetree.class_field_kind *) = | Cfk_virtual of core_type | Cfk_concrete of override_flag * expression and class_declaration = class_expr class_infos (** {1 Module language} *) (* Type expressions for the module language *) and module_type (*IF_CURRENT = Parsetree.module_type *) = { pmty_desc: module_type_desc; pmty_loc: Location.t; pmty_attributes: attributes; (* ... [@id1] [@id2] *) } and module_type_desc (*IF_CURRENT = Parsetree.module_type_desc *) = | Pmty_ident of Longident.t loc (* S *) | Pmty_signature of signature (* sig ... end *) | Pmty_functor of functor_parameter * module_type (* functor(X : MT1) -> MT2 *) | Pmty_with of module_type * with_constraint list (* MT with ... *) | Pmty_typeof of module_expr (* module type of ME *) | Pmty_extension of extension (* [%id] *) | Pmty_alias of Longident.t loc (* (module M) *) and functor_parameter (*IF_CURRENT = Parsetree.functor_parameter *) = | Unit (* () *) | Named of string option loc * module_type (* (X : MT) Some X, MT (_ : MT) None, MT *) and signature = signature_item list and signature_item (*IF_CURRENT = Parsetree.signature_item *) = { psig_desc: signature_item_desc; psig_loc: Location.t; } and signature_item_desc (*IF_CURRENT = Parsetree.signature_item_desc *) = | Psig_value of value_description (* val x: T external x: T = "s1" ... "sn" *) | Psig_type of rec_flag * type_declaration list (* type t1 = ... and ... and tn = ... *) | Psig_typesubst of type_declaration list (* type t1 := ... and ... and tn := ... *) | Psig_typext of type_extension (* type t1 += ... *) | Psig_exception of type_exception (* exception C of T *) | Psig_module of module_declaration (* module X = M module X : MT *) | Psig_modsubst of module_substitution (* module X := M *) | Psig_recmodule of module_declaration list (* module rec X1 : MT1 and ... and Xn : MTn *) | Psig_modtype of module_type_declaration (* module type S = MT module type S *) | Psig_open of open_description (* open X *) | Psig_include of include_description (* include MT *) | Psig_class of class_description list (* class c1 : ... and ... and cn : ... *) | Psig_class_type of class_type_declaration list (* class type ct1 = ... and ... and ctn = ... *) | Psig_attribute of attribute (* [@@@id] *) | Psig_extension of extension * attributes (* [%%id] *) and module_declaration (*IF_CURRENT = Parsetree.module_declaration *) = { pmd_name: string option loc; pmd_type: module_type; pmd_attributes: attributes; (* ... [@@id1] [@@id2] *) pmd_loc: Location.t; } (* S : MT *) and module_substitution (*IF_CURRENT = Parsetree.module_substitution *) = { pms_name: string loc; pms_manifest: Longident.t loc; pms_attributes: attributes; (* ... [@@id1] [@@id2] *) pms_loc: Location.t; } and module_type_declaration (*IF_CURRENT = Parsetree.module_type_declaration *) = { pmtd_name: string loc; pmtd_type: module_type option; pmtd_attributes: attributes; (* ... [@@id1] [@@id2] *) pmtd_loc: Location.t; } (* S = MT S (abstract module type declaration, pmtd_type = None) *) and 'a open_infos (*IF_CURRENT = 'a Parsetree.open_infos *) = { popen_expr: 'a; popen_override: override_flag; popen_loc: Location.t; popen_attributes: attributes; } (* open! X - popen_override = Override (silences the 'used identifier shadowing' warning) open X - popen_override = Fresh *) and open_description = Longident.t loc open_infos (* open M.N open M(N).O *) and open_declaration = module_expr open_infos (* open M.N open M(N).O open struct ... end *) and 'a include_infos (*IF_CURRENT = 'a Parsetree.include_infos *) = { pincl_mod: 'a; pincl_loc: Location.t; pincl_attributes: attributes; } and include_description = module_type include_infos (* include MT *) and include_declaration = module_expr include_infos (* include ME *) and with_constraint (*IF_CURRENT = Parsetree.with_constraint *) = | Pwith_type of Longident.t loc * type_declaration (* with type X.t = ... Note: the last component of the longident must match the name of the type_declaration. *) | Pwith_module of Longident.t loc * Longident.t loc (* with module X.Y = Z *) | Pwith_typesubst of Longident.t loc * type_declaration (* with type X.t := ..., same format as [Pwith_type] *) | Pwith_modsubst of Longident.t loc * Longident.t loc (* with module X.Y := Z *) (* Value expressions for the module language *) and module_expr (*IF_CURRENT = Parsetree.module_expr *) = { pmod_desc: module_expr_desc; pmod_loc: Location.t; pmod_attributes: attributes; (* ... [@id1] [@id2] *) } and module_expr_desc (*IF_CURRENT = Parsetree.module_expr_desc *) = | Pmod_ident of Longident.t loc (* X *) | Pmod_structure of structure (* struct ... end *) | Pmod_functor of functor_parameter * module_expr (* functor(X : MT1) -> ME *) | Pmod_apply of module_expr * module_expr (* ME1(ME2) *) | Pmod_constraint of module_expr * module_type (* (ME : MT) *) | Pmod_unpack of expression (* (val E) *) | Pmod_extension of extension (* [%id] *) and structure = structure_item list and structure_item (*IF_CURRENT = Parsetree.structure_item *) = { pstr_desc: structure_item_desc; pstr_loc: Location.t; } and structure_item_desc (*IF_CURRENT = Parsetree.structure_item_desc *) = | Pstr_eval of expression * attributes (* E *) | Pstr_value of rec_flag * value_binding list (* let P1 = E1 and ... and Pn = EN (flag = Nonrecursive) let rec P1 = E1 and ... and Pn = EN (flag = Recursive) *) | Pstr_primitive of value_description (* val x: T external x: T = "s1" ... "sn" *) | Pstr_type of rec_flag * type_declaration list (* type t1 = ... and ... and tn = ... *) | Pstr_typext of type_extension (* type t1 += ... *) | Pstr_exception of type_exception (* exception C of T exception C = M.X *) | Pstr_module of module_binding (* module X = ME *) | Pstr_recmodule of module_binding list (* module rec X1 = ME1 and ... and Xn = MEn *) | Pstr_modtype of module_type_declaration (* module type S = MT *) | Pstr_open of open_declaration (* open X *) | Pstr_class of class_declaration list (* class c1 = ... and ... and cn = ... *) | Pstr_class_type of class_type_declaration list (* class type ct1 = ... and ... and ctn = ... *) | Pstr_include of include_declaration (* include ME *) | Pstr_attribute of attribute (* [@@@id] *) | Pstr_extension of extension * attributes (* [%%id] *) and value_binding (*IF_CURRENT = Parsetree.value_binding *) = { pvb_pat: pattern; pvb_expr: expression; pvb_attributes: attributes; pvb_loc: Location.t; } and module_binding (*IF_CURRENT = Parsetree.module_binding *) = { pmb_name: string option loc; pmb_expr: module_expr; pmb_attributes: attributes; pmb_loc: Location.t; } (* X = ME *) (** {1 Toplevel} *) (* Toplevel phrases *) type toplevel_phrase (*IF_CURRENT = Parsetree.toplevel_phrase *) = | Ptop_def of structure | Ptop_dir of toplevel_directive (* #use, #load ... *) and toplevel_directive (*IF_CURRENT = Parsetree.toplevel_directive *) = { pdir_name : string loc; pdir_arg : directive_argument option; pdir_loc : Location.t; } and directive_argument (*IF_CURRENT = Parsetree.directive_argument *) = { pdira_desc : directive_argument_desc; pdira_loc : Location.t; } and directive_argument_desc (*IF_CURRENT = Parsetree.directive_argument_desc *) = | Pdir_string of string | Pdir_int of string * char option | Pdir_ident of Longident.t | Pdir_bool of bool end module Config = struct let ast_impl_magic_number = "Caml1999M029" let ast_intf_magic_number = "Caml1999N029" end
(**************************************************************************) (* *) (* OCaml Migrate Parsetree *) (* *) (* Frédéric Bour, Facebook *) (* Jérémie Dimino and Leo White, Jane Street Europe *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* Alain Frisch, LexiFi *) (* Daniel de Rauglaudre, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 2018 Institut National de Recherche en Informatique et *) (* en Automatique (INRIA). *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************)
getgroups.c
#include <caml/mlvalues.h> #include <caml/alloc.h> #include <caml/fail.h> #ifdef HAS_GETGROUPS #include <sys/types.h> #ifdef HAS_UNISTD #include <unistd.h> #endif #include <limits.h> #include "unixsupport.h" CAMLprim value unix_getgroups(value unit) { gid_t gidset[NGROUPS_MAX]; int n; value res; int i; n = getgroups(NGROUPS_MAX, gidset); if (n == -1) uerror("getgroups", Nothing); res = caml_alloc_tuple(n); for (i = 0; i < n; i++) Field(res, i) = Val_int(gidset[i]); return res; } #else CAMLprim value unix_getgroups(value unit) { caml_invalid_argument("getgroups not implemented"); } #endif
/**************************************************************************/ /* */ /* OCaml */ /* */ /* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ /* */ /* Copyright 1996 Institut National de Recherche en Informatique et */ /* en Automatique. */ /* */ /* All rights reserved. This file is distributed under the terms of */ /* the GNU Lesser General Public License version 2.1, with the */ /* special exception on linking described in the file LICENSE. */ /* */ /**************************************************************************/
mpalloc.h
#ifndef LIBMPDEC_MPALLOC_H_ #define LIBMPDEC_MPALLOC_H_ #include "mpdecimal.h" #include <stdint.h> /* Internal header file: all symbols have local scope in the DSO */ MPD_PRAGMA(MPD_HIDE_SYMBOLS_START) int mpd_switch_to_dyn(mpd_t *result, mpd_ssize_t nwords, uint32_t *status); int mpd_switch_to_dyn_zero(mpd_t *result, mpd_ssize_t nwords, uint32_t *status); int mpd_realloc_dyn(mpd_t *result, mpd_ssize_t nwords, uint32_t *status); int mpd_switch_to_dyn_cxx(mpd_t *result, mpd_ssize_t nwords); int mpd_realloc_dyn_cxx(mpd_t *result, mpd_ssize_t nwords); MPD_PRAGMA(MPD_HIDE_SYMBOLS_END) /* restore previous scope rules */ #endif /* LIBMPDEC_MPALLOC_H_ */
/* * Copyright (c) 2008-2020 Stefan Krah. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */
opamSysPoll.mli
(** This module polls various aspects of the host, to define the [arch], [os], etc. variables *) val arch: unit -> string option val os: unit -> string option val os_distribution: unit -> string option val os_version: unit -> string option val os_family: unit -> string option val variables: (OpamVariable.t * OpamTypes.variable_contents option Lazy.t) list (** The function used internally to get our canonical names for architectures (returns its input lowercased if not a recognised arch). This is typically called on the output of [uname -m] *) val normalise_arch: string -> string (** The function used internally to get our canonical names for OSes (returns its input lowercased if not a recognised OS). This is typically called on the output of [uname -s] *) val normalise_os: string -> string (* Number of cores *) val cores: unit -> int (** Returns a string containing arch, os, os-distribution & os-version values, unknown if they are not available *) val to_string: unit -> string
(**************************************************************************) (* *) (* Copyright 2017-2019 OCamlPro *) (* *) (* All rights reserved. This file is distributed under the terms of the *) (* GNU Lesser General Public License version 2.1, with the special *) (* exception on linking described in the file LICENSE. *) (* *) (**************************************************************************)
pervasives.mli
(** The OCaml Standard library. This module is automatically opened at the beginning of each compilation. All components of this module can therefore be referred by their short name, without prefixing them by [Stdlib]. It particular, it provides the basic operations over the built-in types (numbers, booleans, byte sequences, strings, exceptions, references, lists, arrays, input-output channels, ...) and the {{!modules}standard library modules}. *) (** {1 Exceptions} *) external raise : exn -> 'a = "%raise" (** Raise the given exception value *) external raise_notrace : exn -> 'a = "%raise_notrace" (** A faster version [raise] which does not record the backtrace. @since 4.02.0 *) val invalid_arg : string -> 'a (** Raise exception [Invalid_argument] with the given string. *) val failwith : string -> 'a (** Raise exception [Failure] with the given string. *) exception Exit (** The [Exit] exception is not raised by any library function. It is provided for use in your programs. *) (** {1 Boolean operations} *) external not : bool -> bool = "%boolnot" (** The boolean negation. *) external ( && ) : bool -> bool -> bool = "%sequand" (** The boolean 'and'. Evaluation is sequential, left-to-right: in [e1 && e2], [e1] is evaluated first, and if it returns [false], [e2] is not evaluated at all. Right-associative operator, see {!Ocaml_operators} for more information. *) external ( || ) : bool -> bool -> bool = "%sequor" (** The boolean 'or'. Evaluation is sequential, left-to-right: in [e1 || e2], [e1] is evaluated first, and if it returns [true], [e2] is not evaluated at all. Right-associative operator, see {!Ocaml_operators} for more information. *) (** {1 Debugging} *) external __LOC__ : string = "%loc_LOC" (** [__LOC__] returns the location at which this expression appears in the file currently being parsed by the compiler, with the standard error format of OCaml: "File %S, line %d, characters %d-%d". @since 4.02.0 *) external __FILE__ : string = "%loc_FILE" (** [__FILE__] returns the name of the file currently being parsed by the compiler. @since 4.02.0 *) external __LINE__ : int = "%loc_LINE" (** [__LINE__] returns the line number at which this expression appears in the file currently being parsed by the compiler. @since 4.02.0 *) external __MODULE__ : string = "%loc_MODULE" (** [__MODULE__] returns the module name of the file being parsed by the compiler. @since 4.02.0 *) external __POS__ : string * int * int * int = "%loc_POS" (** [__POS__] returns a tuple [(file,lnum,cnum,enum)], corresponding to the location at which this expression appears in the file currently being parsed by the compiler. [file] is the current filename, [lnum] the line number, [cnum] the character position in the line and [enum] the last character position in the line. @since 4.02.0 *) external __LOC_OF__ : 'a -> string * 'a = "%loc_LOC" (** [__LOC_OF__ expr] returns a pair [(loc, expr)] where [loc] is the location of [expr] in the file currently being parsed by the compiler, with the standard error format of OCaml: "File %S, line %d, characters %d-%d". @since 4.02.0 *) external __LINE_OF__ : 'a -> int * 'a = "%loc_LINE" (** [__LINE_OF__ expr] returns a pair [(line, expr)], where [line] is the line number at which the expression [expr] appears in the file currently being parsed by the compiler. @since 4.02.0 *) external __POS_OF__ : 'a -> (string * int * int * int) * 'a = "%loc_POS" (** [__POS_OF__ expr] returns a pair [(loc,expr)], where [loc] is a tuple [(file,lnum,cnum,enum)] corresponding to the location at which the expression [expr] appears in the file currently being parsed by the compiler. [file] is the current filename, [lnum] the line number, [cnum] the character position in the line and [enum] the last character position in the line. @since 4.02.0 *) (** {1 Composition operators} *) external ( |> ) : 'a -> ('a -> 'b) -> 'b = "%revapply" (** Reverse-application operator: [x |> f |> g] is exactly equivalent to [g (f (x))]. Left-associative operator, see {!Ocaml_operators} for more information. @since 4.01 *) external ( @@ ) : ('a -> 'b) -> 'a -> 'b = "%apply" (** Application operator: [g @@ f @@ x] is exactly equivalent to [g (f (x))]. Right-associative operator, see {!Ocaml_operators} for more information. @since 4.01 *) (** {1 Integer arithmetic} *) (** Integers are [Sys.int_size] bits wide. All operations are taken modulo 2{^[Sys.int_size]}. They do not fail on overflow. *) external ( ~- ) : int -> int = "%negint" (** Unary negation. You can also write [- e] instead of [~- e]. Unary operator, see {!Ocaml_operators} for more information. *) external ( ~+ ) : int -> int = "%identity" (** Unary addition. You can also write [+ e] instead of [~+ e]. Unary operator, see {!Ocaml_operators} for more information. @since 3.12.0 *) external succ : int -> int = "%succint" (** [succ x] is [x + 1]. *) external pred : int -> int = "%predint" (** [pred x] is [x - 1]. *) external ( + ) : int -> int -> int = "%addint" (** Integer addition. Left-associative operator, see {!Ocaml_operators} for more information. *) external ( - ) : int -> int -> int = "%subint" (** Integer subtraction. Left-associative operator, , see {!Ocaml_operators} for more information. *) external ( * ) : int -> int -> int = "%mulint" (** Integer multiplication. Left-associative operator, see {!Ocaml_operators} for more information. *) external ( / ) : int -> int -> int = "%divint" (** Integer division. Raise [Division_by_zero] if the second argument is 0. Integer division rounds the real quotient of its arguments towards zero. More precisely, if [x >= 0] and [y > 0], [x / y] is the greatest integer less than or equal to the real quotient of [x] by [y]. Moreover, [(- x) / y = x / (- y) = - (x / y)]. Left-associative operator, see {!Ocaml_operators} for more information. *) external ( mod ) : int -> int -> int = "%modint" (** Integer remainder. If [y] is not zero, the result of [x mod y] satisfies the following properties: [x = (x / y) * y + x mod y] and [abs(x mod y) <= abs(y) - 1]. If [y = 0], [x mod y] raises [Division_by_zero]. Note that [x mod y] is negative only if [x < 0]. Raise [Division_by_zero] if [y] is zero. Left-associative operator, see {!Ocaml_operators} for more information. *) val abs : int -> int (** Return the absolute value of the argument. Note that this may be negative if the argument is [min_int]. *) val max_int : int (** The greatest representable integer. *) val min_int : int (** The smallest representable integer. *) (** {2 Bitwise operations} *) external ( land ) : int -> int -> int = "%andint" (** Bitwise logical and. Left-associative operator, see {!Ocaml_operators} for more information. *) external ( lor ) : int -> int -> int = "%orint" (** Bitwise logical or. Left-associative operator, see {!Ocaml_operators} for more information. *) external ( lxor ) : int -> int -> int = "%xorint" (** Bitwise logical exclusive or. Left-associative operator, see {!Ocaml_operators} for more information. *) val lnot : int -> int (** Bitwise logical negation. *) external ( lsl ) : int -> int -> int = "%lslint" (** [n lsl m] shifts [n] to the left by [m] bits. The result is unspecified if [m < 0] or [m > Sys.int_size]. Right-associative operator, see {!Ocaml_operators} for more information. *) external ( lsr ) : int -> int -> int = "%lsrint" (** [n lsr m] shifts [n] to the right by [m] bits. This is a logical shift: zeroes are inserted regardless of the sign of [n]. The result is unspecified if [m < 0] or [m > Sys.int_size]. Right-associative operator, see {!Ocaml_operators} for more information. *) external ( asr ) : int -> int -> int = "%asrint" (** [n asr m] shifts [n] to the right by [m] bits. This is an arithmetic shift: the sign bit of [n] is replicated. The result is unspecified if [m < 0] or [m > Sys.int_size]. Right-associative operator, see {!Ocaml_operators} for more information. *) (** {1 String operations} More string operations are provided in module {!String}. *) val ( ^ ) : string -> string -> string (** String concatenation. Right-associative operator, see {!Ocaml_operators} for more information. *) (** {1 Character operations} More character operations are provided in module {!Char}. *) external int_of_char : char -> int = "%identity" (** Return the ASCII code of the argument. *) val char_of_int : int -> char (** Return the character with the given ASCII code. Raise [Invalid_argument "char_of_int"] if the argument is outside the range 0--255. *) (** {1 Unit operations} *) external ignore : 'a -> unit = "%ignore" (** Discard the value of its argument and return [()]. For instance, [ignore(f x)] discards the result of the side-effecting function [f]. It is equivalent to [f x; ()], except that the latter may generate a compiler warning; writing [ignore(f x)] instead avoids the warning. *) (** {1 String conversion functions} *) val string_of_bool : bool -> string (** Return the string representation of a boolean. As the returned values may be shared, the user should not modify them directly. *) val bool_of_string_opt: string -> bool option (** Convert the given string to a boolean. Return [None] if the string is not ["true"] or ["false"]. @since 4.05 *) val string_of_int : int -> string (** Return the string representation of an integer, in decimal. *) val int_of_string_opt: string -> int option (** Convert the given string to an integer. The string is read in decimal (by default, or if the string begins with [0u]), in hexadecimal (if it begins with [0x] or [0X]), in octal (if it begins with [0o] or [0O]), or in binary (if it begins with [0b] or [0B]). The [0u] prefix reads the input as an unsigned integer in the range [[0, 2*max_int+1]]. If the input exceeds {!max_int} it is converted to the signed integer [min_int + input - max_int - 1]. The [_] (underscore) character can appear anywhere in the string and is ignored. Return [None] if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type [int]. @since 4.05 *) (** {1 Pair operations} *) external fst : 'a * 'b -> 'a = "%field0" (** Return the first component of a pair. *) external snd : 'a * 'b -> 'b = "%field1" (** Return the second component of a pair. *) (** {1 List operations} More list operations are provided in module {!List}. *) val ( @ ) : 'a list -> 'a list -> 'a list (** List concatenation. Not tail-recursive (length of the first argument). Right-associative operator, see {!Ocaml_operators} for more information. *) (** {1 References} *) type 'a ref = { mutable contents : 'a } (** The type of references (mutable indirection cells) containing a value of type ['a]. *) external ref : 'a -> 'a ref = "%makemutable" (** Return a fresh reference containing the given value. *) external ( ! ) : 'a ref -> 'a = "%field0" (** [!r] returns the current contents of reference [r]. Equivalent to [fun r -> r.contents]. Unary operator, see {!Ocaml_operators} for more information. *) external ( := ) : 'a ref -> 'a -> unit = "%setfield0" (** [r := a] stores the value of [a] in reference [r]. Equivalent to [fun r v -> r.contents <- v]. Right-associative operator, see {!Ocaml_operators} for more information. *) external incr : int ref -> unit = "%incr" (** Increment the integer contained in the given reference. Equivalent to [fun r -> r := succ !r]. *) external decr : int ref -> unit = "%decr" (** Decrement the integer contained in the given reference. Equivalent to [fun r -> r := pred !r]. *) (** {1 Result type} *) (** @since 4.03.0 *) type ('a,'b) result = Ok of 'a | Error of 'b (** {1 Operations on format strings} *) (** Format strings are character strings with special lexical conventions that defines the functionality of formatted input/output functions. Format strings are used to read data with formatted input functions from module {!Scanf} and to print data with formatted output functions from modules {!Printf} and {!Format}. Format strings are made of three kinds of entities: - {e conversions specifications}, introduced by the special character ['%'] followed by one or more characters specifying what kind of argument to read or print, - {e formatting indications}, introduced by the special character ['@'] followed by one or more characters specifying how to read or print the argument, - {e plain characters} that are regular characters with usual lexical conventions. Plain characters specify string literals to be read in the input or printed in the output. There is an additional lexical rule to escape the special characters ['%'] and ['@'] in format strings: if a special character follows a ['%'] character, it is treated as a plain character. In other words, ["%%"] is considered as a plain ['%'] and ["%@"] as a plain ['@']. For more information about conversion specifications and formatting indications available, read the documentation of modules {!Scanf}, {!Printf} and {!Format}. *) (** Format strings have a general and highly polymorphic type [('a, 'b, 'c, 'd, 'e, 'f) format6]. The two simplified types, [format] and [format4] below are included for backward compatibility with earlier releases of OCaml. The meaning of format string type parameters is as follows: - ['a] is the type of the parameters of the format for formatted output functions ([printf]-style functions); ['a] is the type of the values read by the format for formatted input functions ([scanf]-style functions). - ['b] is the type of input source for formatted input functions and the type of output target for formatted output functions. For [printf]-style functions from module {!Printf}, ['b] is typically [out_channel]; for [printf]-style functions from module {!Format}, ['b] is typically {!Format.formatter}; for [scanf]-style functions from module {!Scanf}, ['b] is typically {!Scanf.Scanning.in_channel}. Type argument ['b] is also the type of the first argument given to user's defined printing functions for [%a] and [%t] conversions, and user's defined reading functions for [%r] conversion. - ['c] is the type of the result of the [%a] and [%t] printing functions, and also the type of the argument transmitted to the first argument of [kprintf]-style functions or to the [kscanf]-style functions. - ['d] is the type of parameters for the [scanf]-style functions. - ['e] is the type of the receiver function for the [scanf]-style functions. - ['f] is the final result type of a formatted input/output function invocation: for the [printf]-style functions, it is typically [unit]; for the [scanf]-style functions, it is typically the result type of the receiver function. *) type ('a, 'b, 'c, 'd, 'e, 'f) format6 = ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6 type ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'c, 'c, 'd) format6 type ('a, 'b, 'c) format = ('a, 'b, 'c, 'c) format4 val string_of_format : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string (** Converts a format string into a string. *) external format_of_string : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6 = "%identity" (** [format_of_string s] returns a format string read from the string literal [s]. Note: [format_of_string] can not convert a string argument that is not a literal. If you need this functionality, use the more general {!Scanf.format_from_string} function. *) val ( ^^ ) : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('f, 'b, 'c, 'e, 'g, 'h) format6 -> ('a, 'b, 'c, 'd, 'g, 'h) format6 (** [f1 ^^ f2] catenates format strings [f1] and [f2]. The result is a format string that behaves as the concatenation of format strings [f1] and [f2]: in case of formatted output, it accepts arguments from [f1], then arguments from [f2]; in case of formatted input, it returns results from [f1], then results from [f2]. Right-associative operator, see {!Ocaml_operators} for more information. *)
(**************************************************************************) (* *) (* OCaml *) (* *) (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *) (* *) (* Copyright 1996 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************)
src_backend_nodes_equalfuncs.c
/*-------------------------------------------------------------------- * Symbols referenced in this file: * - equal * - _equalAlias * - _equalRangeVar * - _equalTableFunc * - _equalIntoClause * - _equalVar * - _equalConst * - _equalParam * - _equalAggref * - _equalGroupingFunc * - _equalWindowFunc * - _equalSubscriptingRef * - _equalFuncExpr * - _equalNamedArgExpr * - _equalOpExpr * - _equalDistinctExpr * - _equalNullIfExpr * - _equalScalarArrayOpExpr * - _equalBoolExpr * - _equalSubLink * - _equalSubPlan * - _equalAlternativeSubPlan * - _equalFieldSelect * - _equalFieldStore * - _equalRelabelType * - _equalCoerceViaIO * - _equalArrayCoerceExpr * - _equalConvertRowtypeExpr * - _equalCollateExpr * - _equalCaseExpr * - _equalCaseWhen * - _equalCaseTestExpr * - _equalArrayExpr * - _equalRowExpr * - _equalRowCompareExpr * - _equalCoalesceExpr * - _equalMinMaxExpr * - _equalSQLValueFunction * - _equalXmlExpr * - _equalNullTest * - _equalBooleanTest * - _equalCoerceToDomain * - _equalCoerceToDomainValue * - _equalSetToDefault * - _equalCurrentOfExpr * - _equalNextValueExpr * - _equalInferenceElem * - _equalTargetEntry * - _equalRangeTblRef * - _equalFromExpr * - _equalOnConflictExpr * - _equalJoinExpr * - _equalPathKey * - _equalRestrictInfo * - _equalPlaceHolderVar * - _equalSpecialJoinInfo * - _equalAppendRelInfo * - _equalPlaceHolderInfo * - _equalList * - _equalValue * - _equalExtensibleNode * - _equalQuery * - _equalRawStmt * - _equalInsertStmt * - _equalDeleteStmt * - _equalUpdateStmt * - _equalSelectStmt * - _equalSetOperationStmt * - _equalAlterTableStmt * - _equalAlterTableCmd * - _equalAlterCollationStmt * - _equalAlterDomainStmt * - _equalGrantStmt * - _equalGrantRoleStmt * - _equalAlterDefaultPrivilegesStmt * - _equalDeclareCursorStmt * - _equalClosePortalStmt * - _equalCallStmt * - _equalClusterStmt * - _equalCopyStmt * - _equalCreateStmt * - _equalTableLikeClause * - _equalDefineStmt * - _equalDropStmt * - _equalTruncateStmt * - _equalCommentStmt * - _equalSecLabelStmt * - _equalFetchStmt * - _equalIndexStmt * - _equalCreateStatsStmt * - _equalAlterStatsStmt * - _equalCreateFunctionStmt * - _equalFunctionParameter * - _equalAlterFunctionStmt * - _equalDoStmt * - _equalRenameStmt * - _equalAlterObjectDependsStmt * - _equalAlterObjectSchemaStmt * - _equalAlterOwnerStmt * - _equalAlterOperatorStmt * - _equalAlterTypeStmt * - _equalRuleStmt * - _equalNotifyStmt * - _equalListenStmt * - _equalUnlistenStmt * - _equalTransactionStmt * - _equalCompositeTypeStmt * - _equalCreateEnumStmt * - _equalCreateRangeStmt * - _equalAlterEnumStmt * - _equalViewStmt * - _equalLoadStmt * - _equalCreateDomainStmt * - _equalCreateOpClassStmt * - _equalCreateOpClassItem * - _equalCreateOpFamilyStmt * - _equalAlterOpFamilyStmt * - _equalCreatedbStmt * - _equalAlterDatabaseStmt * - _equalAlterDatabaseSetStmt * - _equalDropdbStmt * - _equalVacuumStmt * - _equalVacuumRelation * - _equalExplainStmt * - _equalCreateTableAsStmt * - _equalRefreshMatViewStmt * - _equalReplicaIdentityStmt * - _equalAlterSystemStmt * - _equalCreateSeqStmt * - _equalAlterSeqStmt * - _equalVariableSetStmt * - _equalVariableShowStmt * - _equalDiscardStmt * - _equalCreateTableSpaceStmt * - _equalDropTableSpaceStmt * - _equalAlterTableSpaceOptionsStmt * - _equalAlterTableMoveAllStmt * - _equalCreateExtensionStmt * - _equalAlterExtensionStmt * - _equalAlterExtensionContentsStmt * - _equalCreateFdwStmt * - _equalAlterFdwStmt * - _equalCreateForeignServerStmt * - _equalAlterForeignServerStmt * - _equalCreateUserMappingStmt * - _equalAlterUserMappingStmt * - _equalDropUserMappingStmt * - _equalCreateForeignTableStmt * - _equalImportForeignSchemaStmt * - _equalCreateTransformStmt * - _equalCreateAmStmt * - _equalCreateTrigStmt * - _equalCreateEventTrigStmt * - _equalAlterEventTrigStmt * - _equalCreatePLangStmt * - _equalCreateRoleStmt * - _equalAlterRoleStmt * - _equalAlterRoleSetStmt * - _equalDropRoleStmt * - _equalLockStmt * - _equalConstraintsSetStmt * - _equalReindexStmt * - _equalCreateSchemaStmt * - _equalCreateConversionStmt * - _equalCreateCastStmt * - _equalPrepareStmt * - _equalExecuteStmt * - _equalDeallocateStmt * - _equalDropOwnedStmt * - _equalReassignOwnedStmt * - _equalAlterTSDictionaryStmt * - _equalAlterTSConfigurationStmt * - _equalCreatePolicyStmt * - _equalAlterPolicyStmt * - _equalCreatePublicationStmt * - _equalAlterPublicationStmt * - _equalCreateSubscriptionStmt * - _equalAlterSubscriptionStmt * - _equalDropSubscriptionStmt * - _equalAExpr * - _equalColumnRef * - _equalParamRef * - _equalAConst * - _equalFuncCall * - _equalAStar * - _equalAIndices * - _equalA_Indirection * - _equalA_ArrayExpr * - _equalResTarget * - _equalMultiAssignRef * - _equalTypeCast * - _equalCollateClause * - _equalSortBy * - _equalWindowDef * - _equalRangeSubselect * - _equalRangeFunction * - _equalRangeTableSample * - _equalRangeTableFunc * - _equalRangeTableFuncCol * - _equalTypeName * - _equalIndexElem * - _equalColumnDef * - _equalConstraint * - _equalDefElem * - _equalLockingClause * - _equalRangeTblEntry * - _equalRangeTblFunction * - _equalTableSampleClause * - _equalWithCheckOption * - _equalSortGroupClause * - _equalGroupingSet * - _equalWindowClause * - _equalRowMarkClause * - _equalWithClause * - _equalInferClause * - _equalOnConflictClause * - _equalCommonTableExpr * - _equalObjectWithArgs * - _equalAccessPriv * - _equalXmlSerialize * - _equalRoleSpec * - _equalTriggerTransition * - _equalPartitionElem * - _equalPartitionSpec * - _equalPartitionBoundSpec * - _equalPartitionRangeDatum * - _equalPartitionCmd *-------------------------------------------------------------------- */ /*------------------------------------------------------------------------- * * equalfuncs.c * Equality functions to compare node trees. * * NOTE: we currently support comparing all node types found in parse * trees. We do not support comparing executor state trees; there * is no need for that, and no point in maintaining all the code that * would be needed. We also do not support comparing Path trees, mainly * because the circular linkages between RelOptInfo and Path nodes can't * be handled easily in a simple depth-first traversal. * * Currently, in fact, equal() doesn't know how to compare Plan trees * either. This might need to be fixed someday. * * NOTE: it is intentional that parse location fields (in nodes that have * one) are not compared. This is because we want, for example, a variable * "x" to be considered equal() to another reference to "x" in the query. * * * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION * src/backend/nodes/equalfuncs.c * *------------------------------------------------------------------------- */ #include "postgres.h" #include "miscadmin.h" #include "nodes/extensible.h" #include "nodes/pathnodes.h" #include "utils/datum.h" /* * Macros to simplify comparison of different kinds of fields. Use these * wherever possible to reduce the chance for silly typos. Note that these * hard-wire the convention that the local variables in an Equal routine are * named 'a' and 'b'. */ /* Compare a simple scalar field (int, float, bool, enum, etc) */ #define COMPARE_SCALAR_FIELD(fldname) \ do { \ if (a->fldname != b->fldname) \ return false; \ } while (0) /* Compare a field that is a pointer to some kind of Node or Node tree */ #define COMPARE_NODE_FIELD(fldname) \ do { \ if (!equal(a->fldname, b->fldname)) \ return false; \ } while (0) /* Compare a field that is a pointer to a Bitmapset */ #define COMPARE_BITMAPSET_FIELD(fldname) \ do { \ if (!bms_equal(a->fldname, b->fldname)) \ return false; \ } while (0) /* Compare a field that is a pointer to a C string, or perhaps NULL */ #define COMPARE_STRING_FIELD(fldname) \ do { \ if (!equalstr(a->fldname, b->fldname)) \ return false; \ } while (0) /* Macro for comparing string fields that might be NULL */ #define equalstr(a, b) \ (((a) != NULL && (b) != NULL) ? (strcmp(a, b) == 0) : (a) == (b)) /* Compare a field that is a pointer to a simple palloc'd object of size sz */ #define COMPARE_POINTER_FIELD(fldname, sz) \ do { \ if (memcmp(a->fldname, b->fldname, (sz)) != 0) \ return false; \ } while (0) /* Compare a parse location field (this is a no-op, per note above) */ #define COMPARE_LOCATION_FIELD(fldname) \ ((void) 0) /* Compare a CoercionForm field (also a no-op, per comment in primnodes.h) */ #define COMPARE_COERCIONFORM_FIELD(fldname) \ ((void) 0) /* * Stuff from primnodes.h */ static bool _equalAlias(const Alias *a, const Alias *b) { COMPARE_STRING_FIELD(aliasname); COMPARE_NODE_FIELD(colnames); return true; } static bool _equalRangeVar(const RangeVar *a, const RangeVar *b) { COMPARE_STRING_FIELD(catalogname); COMPARE_STRING_FIELD(schemaname); COMPARE_STRING_FIELD(relname); COMPARE_SCALAR_FIELD(inh); COMPARE_SCALAR_FIELD(relpersistence); COMPARE_NODE_FIELD(alias); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalTableFunc(const TableFunc *a, const TableFunc *b) { COMPARE_NODE_FIELD(ns_uris); COMPARE_NODE_FIELD(ns_names); COMPARE_NODE_FIELD(docexpr); COMPARE_NODE_FIELD(rowexpr); COMPARE_NODE_FIELD(colnames); COMPARE_NODE_FIELD(coltypes); COMPARE_NODE_FIELD(coltypmods); COMPARE_NODE_FIELD(colcollations); COMPARE_NODE_FIELD(colexprs); COMPARE_NODE_FIELD(coldefexprs); COMPARE_BITMAPSET_FIELD(notnulls); COMPARE_SCALAR_FIELD(ordinalitycol); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalIntoClause(const IntoClause *a, const IntoClause *b) { COMPARE_NODE_FIELD(rel); COMPARE_NODE_FIELD(colNames); COMPARE_STRING_FIELD(accessMethod); COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(onCommit); COMPARE_STRING_FIELD(tableSpaceName); COMPARE_NODE_FIELD(viewQuery); COMPARE_SCALAR_FIELD(skipData); return true; } /* * We don't need an _equalExpr because Expr is an abstract supertype which * should never actually get instantiated. Also, since it has no common * fields except NodeTag, there's no need for a helper routine to factor * out comparing the common fields... */ static bool _equalVar(const Var *a, const Var *b) { COMPARE_SCALAR_FIELD(varno); COMPARE_SCALAR_FIELD(varattno); COMPARE_SCALAR_FIELD(vartype); COMPARE_SCALAR_FIELD(vartypmod); COMPARE_SCALAR_FIELD(varcollid); COMPARE_SCALAR_FIELD(varlevelsup); /* * varnosyn/varattnosyn are intentionally ignored here, because Vars with * different syntactic identifiers are semantically the same as long as * their varno/varattno match. */ COMPARE_LOCATION_FIELD(location); return true; } static bool _equalConst(const Const *a, const Const *b) { COMPARE_SCALAR_FIELD(consttype); COMPARE_SCALAR_FIELD(consttypmod); COMPARE_SCALAR_FIELD(constcollid); COMPARE_SCALAR_FIELD(constlen); COMPARE_SCALAR_FIELD(constisnull); COMPARE_SCALAR_FIELD(constbyval); COMPARE_LOCATION_FIELD(location); /* * We treat all NULL constants of the same type as equal. Someday this * might need to change? But datumIsEqual doesn't work on nulls, so... */ if (a->constisnull) return true; return datumIsEqual(a->constvalue, b->constvalue, a->constbyval, a->constlen); } static bool _equalParam(const Param *a, const Param *b) { COMPARE_SCALAR_FIELD(paramkind); COMPARE_SCALAR_FIELD(paramid); COMPARE_SCALAR_FIELD(paramtype); COMPARE_SCALAR_FIELD(paramtypmod); COMPARE_SCALAR_FIELD(paramcollid); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalAggref(const Aggref *a, const Aggref *b) { COMPARE_SCALAR_FIELD(aggfnoid); COMPARE_SCALAR_FIELD(aggtype); COMPARE_SCALAR_FIELD(aggcollid); COMPARE_SCALAR_FIELD(inputcollid); /* ignore aggtranstype since it might not be set yet */ COMPARE_NODE_FIELD(aggargtypes); COMPARE_NODE_FIELD(aggdirectargs); COMPARE_NODE_FIELD(args); COMPARE_NODE_FIELD(aggorder); COMPARE_NODE_FIELD(aggdistinct); COMPARE_NODE_FIELD(aggfilter); COMPARE_SCALAR_FIELD(aggstar); COMPARE_SCALAR_FIELD(aggvariadic); COMPARE_SCALAR_FIELD(aggkind); COMPARE_SCALAR_FIELD(agglevelsup); COMPARE_SCALAR_FIELD(aggsplit); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalGroupingFunc(const GroupingFunc *a, const GroupingFunc *b) { COMPARE_NODE_FIELD(args); /* * We must not compare the refs or cols field */ COMPARE_SCALAR_FIELD(agglevelsup); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalWindowFunc(const WindowFunc *a, const WindowFunc *b) { COMPARE_SCALAR_FIELD(winfnoid); COMPARE_SCALAR_FIELD(wintype); COMPARE_SCALAR_FIELD(wincollid); COMPARE_SCALAR_FIELD(inputcollid); COMPARE_NODE_FIELD(args); COMPARE_NODE_FIELD(aggfilter); COMPARE_SCALAR_FIELD(winref); COMPARE_SCALAR_FIELD(winstar); COMPARE_SCALAR_FIELD(winagg); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalSubscriptingRef(const SubscriptingRef *a, const SubscriptingRef *b) { COMPARE_SCALAR_FIELD(refcontainertype); COMPARE_SCALAR_FIELD(refelemtype); COMPARE_SCALAR_FIELD(reftypmod); COMPARE_SCALAR_FIELD(refcollid); COMPARE_NODE_FIELD(refupperindexpr); COMPARE_NODE_FIELD(reflowerindexpr); COMPARE_NODE_FIELD(refexpr); COMPARE_NODE_FIELD(refassgnexpr); return true; } static bool _equalFuncExpr(const FuncExpr *a, const FuncExpr *b) { COMPARE_SCALAR_FIELD(funcid); COMPARE_SCALAR_FIELD(funcresulttype); COMPARE_SCALAR_FIELD(funcretset); COMPARE_SCALAR_FIELD(funcvariadic); COMPARE_COERCIONFORM_FIELD(funcformat); COMPARE_SCALAR_FIELD(funccollid); COMPARE_SCALAR_FIELD(inputcollid); COMPARE_NODE_FIELD(args); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalNamedArgExpr(const NamedArgExpr *a, const NamedArgExpr *b) { COMPARE_NODE_FIELD(arg); COMPARE_STRING_FIELD(name); COMPARE_SCALAR_FIELD(argnumber); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalOpExpr(const OpExpr *a, const OpExpr *b) { COMPARE_SCALAR_FIELD(opno); /* * Special-case opfuncid: it is allowable for it to differ if one node * contains zero and the other doesn't. This just means that the one node * isn't as far along in the parse/plan pipeline and hasn't had the * opfuncid cache filled yet. */ if (a->opfuncid != b->opfuncid && a->opfuncid != 0 && b->opfuncid != 0) return false; COMPARE_SCALAR_FIELD(opresulttype); COMPARE_SCALAR_FIELD(opretset); COMPARE_SCALAR_FIELD(opcollid); COMPARE_SCALAR_FIELD(inputcollid); COMPARE_NODE_FIELD(args); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalDistinctExpr(const DistinctExpr *a, const DistinctExpr *b) { COMPARE_SCALAR_FIELD(opno); /* * Special-case opfuncid: it is allowable for it to differ if one node * contains zero and the other doesn't. This just means that the one node * isn't as far along in the parse/plan pipeline and hasn't had the * opfuncid cache filled yet. */ if (a->opfuncid != b->opfuncid && a->opfuncid != 0 && b->opfuncid != 0) return false; COMPARE_SCALAR_FIELD(opresulttype); COMPARE_SCALAR_FIELD(opretset); COMPARE_SCALAR_FIELD(opcollid); COMPARE_SCALAR_FIELD(inputcollid); COMPARE_NODE_FIELD(args); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalNullIfExpr(const NullIfExpr *a, const NullIfExpr *b) { COMPARE_SCALAR_FIELD(opno); /* * Special-case opfuncid: it is allowable for it to differ if one node * contains zero and the other doesn't. This just means that the one node * isn't as far along in the parse/plan pipeline and hasn't had the * opfuncid cache filled yet. */ if (a->opfuncid != b->opfuncid && a->opfuncid != 0 && b->opfuncid != 0) return false; COMPARE_SCALAR_FIELD(opresulttype); COMPARE_SCALAR_FIELD(opretset); COMPARE_SCALAR_FIELD(opcollid); COMPARE_SCALAR_FIELD(inputcollid); COMPARE_NODE_FIELD(args); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalScalarArrayOpExpr(const ScalarArrayOpExpr *a, const ScalarArrayOpExpr *b) { COMPARE_SCALAR_FIELD(opno); /* * Special-case opfuncid: it is allowable for it to differ if one node * contains zero and the other doesn't. This just means that the one node * isn't as far along in the parse/plan pipeline and hasn't had the * opfuncid cache filled yet. */ if (a->opfuncid != b->opfuncid && a->opfuncid != 0 && b->opfuncid != 0) return false; COMPARE_SCALAR_FIELD(useOr); COMPARE_SCALAR_FIELD(inputcollid); COMPARE_NODE_FIELD(args); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalBoolExpr(const BoolExpr *a, const BoolExpr *b) { COMPARE_SCALAR_FIELD(boolop); COMPARE_NODE_FIELD(args); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalSubLink(const SubLink *a, const SubLink *b) { COMPARE_SCALAR_FIELD(subLinkType); COMPARE_SCALAR_FIELD(subLinkId); COMPARE_NODE_FIELD(testexpr); COMPARE_NODE_FIELD(operName); COMPARE_NODE_FIELD(subselect); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalSubPlan(const SubPlan *a, const SubPlan *b) { COMPARE_SCALAR_FIELD(subLinkType); COMPARE_NODE_FIELD(testexpr); COMPARE_NODE_FIELD(paramIds); COMPARE_SCALAR_FIELD(plan_id); COMPARE_STRING_FIELD(plan_name); COMPARE_SCALAR_FIELD(firstColType); COMPARE_SCALAR_FIELD(firstColTypmod); COMPARE_SCALAR_FIELD(firstColCollation); COMPARE_SCALAR_FIELD(useHashTable); COMPARE_SCALAR_FIELD(unknownEqFalse); COMPARE_SCALAR_FIELD(parallel_safe); COMPARE_NODE_FIELD(setParam); COMPARE_NODE_FIELD(parParam); COMPARE_NODE_FIELD(args); COMPARE_SCALAR_FIELD(startup_cost); COMPARE_SCALAR_FIELD(per_call_cost); return true; } static bool _equalAlternativeSubPlan(const AlternativeSubPlan *a, const AlternativeSubPlan *b) { COMPARE_NODE_FIELD(subplans); return true; } static bool _equalFieldSelect(const FieldSelect *a, const FieldSelect *b) { COMPARE_NODE_FIELD(arg); COMPARE_SCALAR_FIELD(fieldnum); COMPARE_SCALAR_FIELD(resulttype); COMPARE_SCALAR_FIELD(resulttypmod); COMPARE_SCALAR_FIELD(resultcollid); return true; } static bool _equalFieldStore(const FieldStore *a, const FieldStore *b) { COMPARE_NODE_FIELD(arg); COMPARE_NODE_FIELD(newvals); COMPARE_NODE_FIELD(fieldnums); COMPARE_SCALAR_FIELD(resulttype); return true; } static bool _equalRelabelType(const RelabelType *a, const RelabelType *b) { COMPARE_NODE_FIELD(arg); COMPARE_SCALAR_FIELD(resulttype); COMPARE_SCALAR_FIELD(resulttypmod); COMPARE_SCALAR_FIELD(resultcollid); COMPARE_COERCIONFORM_FIELD(relabelformat); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalCoerceViaIO(const CoerceViaIO *a, const CoerceViaIO *b) { COMPARE_NODE_FIELD(arg); COMPARE_SCALAR_FIELD(resulttype); COMPARE_SCALAR_FIELD(resultcollid); COMPARE_COERCIONFORM_FIELD(coerceformat); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalArrayCoerceExpr(const ArrayCoerceExpr *a, const ArrayCoerceExpr *b) { COMPARE_NODE_FIELD(arg); COMPARE_NODE_FIELD(elemexpr); COMPARE_SCALAR_FIELD(resulttype); COMPARE_SCALAR_FIELD(resulttypmod); COMPARE_SCALAR_FIELD(resultcollid); COMPARE_COERCIONFORM_FIELD(coerceformat); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalConvertRowtypeExpr(const ConvertRowtypeExpr *a, const ConvertRowtypeExpr *b) { COMPARE_NODE_FIELD(arg); COMPARE_SCALAR_FIELD(resulttype); COMPARE_COERCIONFORM_FIELD(convertformat); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalCollateExpr(const CollateExpr *a, const CollateExpr *b) { COMPARE_NODE_FIELD(arg); COMPARE_SCALAR_FIELD(collOid); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalCaseExpr(const CaseExpr *a, const CaseExpr *b) { COMPARE_SCALAR_FIELD(casetype); COMPARE_SCALAR_FIELD(casecollid); COMPARE_NODE_FIELD(arg); COMPARE_NODE_FIELD(args); COMPARE_NODE_FIELD(defresult); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalCaseWhen(const CaseWhen *a, const CaseWhen *b) { COMPARE_NODE_FIELD(expr); COMPARE_NODE_FIELD(result); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalCaseTestExpr(const CaseTestExpr *a, const CaseTestExpr *b) { COMPARE_SCALAR_FIELD(typeId); COMPARE_SCALAR_FIELD(typeMod); COMPARE_SCALAR_FIELD(collation); return true; } static bool _equalArrayExpr(const ArrayExpr *a, const ArrayExpr *b) { COMPARE_SCALAR_FIELD(array_typeid); COMPARE_SCALAR_FIELD(array_collid); COMPARE_SCALAR_FIELD(element_typeid); COMPARE_NODE_FIELD(elements); COMPARE_SCALAR_FIELD(multidims); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalRowExpr(const RowExpr *a, const RowExpr *b) { COMPARE_NODE_FIELD(args); COMPARE_SCALAR_FIELD(row_typeid); COMPARE_COERCIONFORM_FIELD(row_format); COMPARE_NODE_FIELD(colnames); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalRowCompareExpr(const RowCompareExpr *a, const RowCompareExpr *b) { COMPARE_SCALAR_FIELD(rctype); COMPARE_NODE_FIELD(opnos); COMPARE_NODE_FIELD(opfamilies); COMPARE_NODE_FIELD(inputcollids); COMPARE_NODE_FIELD(largs); COMPARE_NODE_FIELD(rargs); return true; } static bool _equalCoalesceExpr(const CoalesceExpr *a, const CoalesceExpr *b) { COMPARE_SCALAR_FIELD(coalescetype); COMPARE_SCALAR_FIELD(coalescecollid); COMPARE_NODE_FIELD(args); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalMinMaxExpr(const MinMaxExpr *a, const MinMaxExpr *b) { COMPARE_SCALAR_FIELD(minmaxtype); COMPARE_SCALAR_FIELD(minmaxcollid); COMPARE_SCALAR_FIELD(inputcollid); COMPARE_SCALAR_FIELD(op); COMPARE_NODE_FIELD(args); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalSQLValueFunction(const SQLValueFunction *a, const SQLValueFunction *b) { COMPARE_SCALAR_FIELD(op); COMPARE_SCALAR_FIELD(type); COMPARE_SCALAR_FIELD(typmod); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalXmlExpr(const XmlExpr *a, const XmlExpr *b) { COMPARE_SCALAR_FIELD(op); COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(named_args); COMPARE_NODE_FIELD(arg_names); COMPARE_NODE_FIELD(args); COMPARE_SCALAR_FIELD(xmloption); COMPARE_SCALAR_FIELD(type); COMPARE_SCALAR_FIELD(typmod); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalNullTest(const NullTest *a, const NullTest *b) { COMPARE_NODE_FIELD(arg); COMPARE_SCALAR_FIELD(nulltesttype); COMPARE_SCALAR_FIELD(argisrow); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalBooleanTest(const BooleanTest *a, const BooleanTest *b) { COMPARE_NODE_FIELD(arg); COMPARE_SCALAR_FIELD(booltesttype); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalCoerceToDomain(const CoerceToDomain *a, const CoerceToDomain *b) { COMPARE_NODE_FIELD(arg); COMPARE_SCALAR_FIELD(resulttype); COMPARE_SCALAR_FIELD(resulttypmod); COMPARE_SCALAR_FIELD(resultcollid); COMPARE_COERCIONFORM_FIELD(coercionformat); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalCoerceToDomainValue(const CoerceToDomainValue *a, const CoerceToDomainValue *b) { COMPARE_SCALAR_FIELD(typeId); COMPARE_SCALAR_FIELD(typeMod); COMPARE_SCALAR_FIELD(collation); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalSetToDefault(const SetToDefault *a, const SetToDefault *b) { COMPARE_SCALAR_FIELD(typeId); COMPARE_SCALAR_FIELD(typeMod); COMPARE_SCALAR_FIELD(collation); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalCurrentOfExpr(const CurrentOfExpr *a, const CurrentOfExpr *b) { COMPARE_SCALAR_FIELD(cvarno); COMPARE_STRING_FIELD(cursor_name); COMPARE_SCALAR_FIELD(cursor_param); return true; } static bool _equalNextValueExpr(const NextValueExpr *a, const NextValueExpr *b) { COMPARE_SCALAR_FIELD(seqid); COMPARE_SCALAR_FIELD(typeId); return true; } static bool _equalInferenceElem(const InferenceElem *a, const InferenceElem *b) { COMPARE_NODE_FIELD(expr); COMPARE_SCALAR_FIELD(infercollid); COMPARE_SCALAR_FIELD(inferopclass); return true; } static bool _equalTargetEntry(const TargetEntry *a, const TargetEntry *b) { COMPARE_NODE_FIELD(expr); COMPARE_SCALAR_FIELD(resno); COMPARE_STRING_FIELD(resname); COMPARE_SCALAR_FIELD(ressortgroupref); COMPARE_SCALAR_FIELD(resorigtbl); COMPARE_SCALAR_FIELD(resorigcol); COMPARE_SCALAR_FIELD(resjunk); return true; } static bool _equalRangeTblRef(const RangeTblRef *a, const RangeTblRef *b) { COMPARE_SCALAR_FIELD(rtindex); return true; } static bool _equalJoinExpr(const JoinExpr *a, const JoinExpr *b) { COMPARE_SCALAR_FIELD(jointype); COMPARE_SCALAR_FIELD(isNatural); COMPARE_NODE_FIELD(larg); COMPARE_NODE_FIELD(rarg); COMPARE_NODE_FIELD(usingClause); COMPARE_NODE_FIELD(quals); COMPARE_NODE_FIELD(alias); COMPARE_SCALAR_FIELD(rtindex); return true; } static bool _equalFromExpr(const FromExpr *a, const FromExpr *b) { COMPARE_NODE_FIELD(fromlist); COMPARE_NODE_FIELD(quals); return true; } static bool _equalOnConflictExpr(const OnConflictExpr *a, const OnConflictExpr *b) { COMPARE_SCALAR_FIELD(action); COMPARE_NODE_FIELD(arbiterElems); COMPARE_NODE_FIELD(arbiterWhere); COMPARE_SCALAR_FIELD(constraint); COMPARE_NODE_FIELD(onConflictSet); COMPARE_NODE_FIELD(onConflictWhere); COMPARE_SCALAR_FIELD(exclRelIndex); COMPARE_NODE_FIELD(exclRelTlist); return true; } /* * Stuff from pathnodes.h */ static bool _equalPathKey(const PathKey *a, const PathKey *b) { /* We assume pointer equality is sufficient to compare the eclasses */ COMPARE_SCALAR_FIELD(pk_eclass); COMPARE_SCALAR_FIELD(pk_opfamily); COMPARE_SCALAR_FIELD(pk_strategy); COMPARE_SCALAR_FIELD(pk_nulls_first); return true; } static bool _equalRestrictInfo(const RestrictInfo *a, const RestrictInfo *b) { COMPARE_NODE_FIELD(clause); COMPARE_SCALAR_FIELD(is_pushed_down); COMPARE_SCALAR_FIELD(outerjoin_delayed); COMPARE_SCALAR_FIELD(security_level); COMPARE_BITMAPSET_FIELD(required_relids); COMPARE_BITMAPSET_FIELD(outer_relids); COMPARE_BITMAPSET_FIELD(nullable_relids); /* * We ignore all the remaining fields, since they may not be set yet, and * should be derivable from the clause anyway. */ return true; } static bool _equalPlaceHolderVar(const PlaceHolderVar *a, const PlaceHolderVar *b) { /* * We intentionally do not compare phexpr. Two PlaceHolderVars with the * same ID and levelsup should be considered equal even if the contained * expressions have managed to mutate to different states. This will * happen during final plan construction when there are nested PHVs, since * the inner PHV will get replaced by a Param in some copies of the outer * PHV. Another way in which it can happen is that initplan sublinks * could get replaced by differently-numbered Params when sublink folding * is done. (The end result of such a situation would be some * unreferenced initplans, which is annoying but not really a problem.) On * the same reasoning, there is no need to examine phrels. * * COMPARE_NODE_FIELD(phexpr); * * COMPARE_BITMAPSET_FIELD(phrels); */ COMPARE_SCALAR_FIELD(phid); COMPARE_SCALAR_FIELD(phlevelsup); return true; } static bool _equalSpecialJoinInfo(const SpecialJoinInfo *a, const SpecialJoinInfo *b) { COMPARE_BITMAPSET_FIELD(min_lefthand); COMPARE_BITMAPSET_FIELD(min_righthand); COMPARE_BITMAPSET_FIELD(syn_lefthand); COMPARE_BITMAPSET_FIELD(syn_righthand); COMPARE_SCALAR_FIELD(jointype); COMPARE_SCALAR_FIELD(lhs_strict); COMPARE_SCALAR_FIELD(delay_upper_joins); COMPARE_SCALAR_FIELD(semi_can_btree); COMPARE_SCALAR_FIELD(semi_can_hash); COMPARE_NODE_FIELD(semi_operators); COMPARE_NODE_FIELD(semi_rhs_exprs); return true; } static bool _equalAppendRelInfo(const AppendRelInfo *a, const AppendRelInfo *b) { COMPARE_SCALAR_FIELD(parent_relid); COMPARE_SCALAR_FIELD(child_relid); COMPARE_SCALAR_FIELD(parent_reltype); COMPARE_SCALAR_FIELD(child_reltype); COMPARE_NODE_FIELD(translated_vars); COMPARE_SCALAR_FIELD(num_child_cols); COMPARE_POINTER_FIELD(parent_colnos, a->num_child_cols * sizeof(AttrNumber)); COMPARE_SCALAR_FIELD(parent_reloid); return true; } static bool _equalPlaceHolderInfo(const PlaceHolderInfo *a, const PlaceHolderInfo *b) { COMPARE_SCALAR_FIELD(phid); COMPARE_NODE_FIELD(ph_var); /* should be redundant */ COMPARE_BITMAPSET_FIELD(ph_eval_at); COMPARE_BITMAPSET_FIELD(ph_lateral); COMPARE_BITMAPSET_FIELD(ph_needed); COMPARE_SCALAR_FIELD(ph_width); return true; } /* * Stuff from extensible.h */ static bool _equalExtensibleNode(const ExtensibleNode *a, const ExtensibleNode *b) { const ExtensibleNodeMethods *methods; COMPARE_STRING_FIELD(extnodename); /* At this point, we know extnodename is the same for both nodes. */ methods = GetExtensibleNodeMethods(a->extnodename, false); /* compare the private fields */ if (!methods->nodeEqual(a, b)) return false; return true; } /* * Stuff from parsenodes.h */ static bool _equalQuery(const Query *a, const Query *b) { COMPARE_SCALAR_FIELD(commandType); COMPARE_SCALAR_FIELD(querySource); /* we intentionally ignore queryId, since it might not be set */ COMPARE_SCALAR_FIELD(canSetTag); COMPARE_NODE_FIELD(utilityStmt); COMPARE_SCALAR_FIELD(resultRelation); COMPARE_SCALAR_FIELD(hasAggs); COMPARE_SCALAR_FIELD(hasWindowFuncs); COMPARE_SCALAR_FIELD(hasTargetSRFs); COMPARE_SCALAR_FIELD(hasSubLinks); COMPARE_SCALAR_FIELD(hasDistinctOn); COMPARE_SCALAR_FIELD(hasRecursive); COMPARE_SCALAR_FIELD(hasModifyingCTE); COMPARE_SCALAR_FIELD(hasForUpdate); COMPARE_SCALAR_FIELD(hasRowSecurity); COMPARE_NODE_FIELD(cteList); COMPARE_NODE_FIELD(rtable); COMPARE_NODE_FIELD(jointree); COMPARE_NODE_FIELD(targetList); COMPARE_SCALAR_FIELD(override); COMPARE_NODE_FIELD(onConflict); COMPARE_NODE_FIELD(returningList); COMPARE_NODE_FIELD(groupClause); COMPARE_NODE_FIELD(groupingSets); COMPARE_NODE_FIELD(havingQual); COMPARE_NODE_FIELD(windowClause); COMPARE_NODE_FIELD(distinctClause); COMPARE_NODE_FIELD(sortClause); COMPARE_NODE_FIELD(limitOffset); COMPARE_NODE_FIELD(limitCount); COMPARE_SCALAR_FIELD(limitOption); COMPARE_NODE_FIELD(rowMarks); COMPARE_NODE_FIELD(setOperations); COMPARE_NODE_FIELD(constraintDeps); COMPARE_NODE_FIELD(withCheckOptions); COMPARE_LOCATION_FIELD(stmt_location); COMPARE_SCALAR_FIELD(stmt_len); return true; } static bool _equalRawStmt(const RawStmt *a, const RawStmt *b) { COMPARE_NODE_FIELD(stmt); COMPARE_LOCATION_FIELD(stmt_location); COMPARE_SCALAR_FIELD(stmt_len); return true; } static bool _equalInsertStmt(const InsertStmt *a, const InsertStmt *b) { COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(cols); COMPARE_NODE_FIELD(selectStmt); COMPARE_NODE_FIELD(onConflictClause); COMPARE_NODE_FIELD(returningList); COMPARE_NODE_FIELD(withClause); COMPARE_SCALAR_FIELD(override); return true; } static bool _equalDeleteStmt(const DeleteStmt *a, const DeleteStmt *b) { COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(usingClause); COMPARE_NODE_FIELD(whereClause); COMPARE_NODE_FIELD(returningList); COMPARE_NODE_FIELD(withClause); return true; } static bool _equalUpdateStmt(const UpdateStmt *a, const UpdateStmt *b) { COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(targetList); COMPARE_NODE_FIELD(whereClause); COMPARE_NODE_FIELD(fromClause); COMPARE_NODE_FIELD(returningList); COMPARE_NODE_FIELD(withClause); return true; } static bool _equalSelectStmt(const SelectStmt *a, const SelectStmt *b) { COMPARE_NODE_FIELD(distinctClause); COMPARE_NODE_FIELD(intoClause); COMPARE_NODE_FIELD(targetList); COMPARE_NODE_FIELD(fromClause); COMPARE_NODE_FIELD(whereClause); COMPARE_NODE_FIELD(groupClause); COMPARE_NODE_FIELD(havingClause); COMPARE_NODE_FIELD(windowClause); COMPARE_NODE_FIELD(valuesLists); COMPARE_NODE_FIELD(sortClause); COMPARE_NODE_FIELD(limitOffset); COMPARE_NODE_FIELD(limitCount); COMPARE_SCALAR_FIELD(limitOption); COMPARE_NODE_FIELD(lockingClause); COMPARE_NODE_FIELD(withClause); COMPARE_SCALAR_FIELD(op); COMPARE_SCALAR_FIELD(all); COMPARE_NODE_FIELD(larg); COMPARE_NODE_FIELD(rarg); return true; } static bool _equalSetOperationStmt(const SetOperationStmt *a, const SetOperationStmt *b) { COMPARE_SCALAR_FIELD(op); COMPARE_SCALAR_FIELD(all); COMPARE_NODE_FIELD(larg); COMPARE_NODE_FIELD(rarg); COMPARE_NODE_FIELD(colTypes); COMPARE_NODE_FIELD(colTypmods); COMPARE_NODE_FIELD(colCollations); COMPARE_NODE_FIELD(groupClauses); return true; } static bool _equalAlterTableStmt(const AlterTableStmt *a, const AlterTableStmt *b) { COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(cmds); COMPARE_SCALAR_FIELD(relkind); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalAlterTableCmd(const AlterTableCmd *a, const AlterTableCmd *b) { COMPARE_SCALAR_FIELD(subtype); COMPARE_STRING_FIELD(name); COMPARE_SCALAR_FIELD(num); COMPARE_NODE_FIELD(newowner); COMPARE_NODE_FIELD(def); COMPARE_SCALAR_FIELD(behavior); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalAlterCollationStmt(const AlterCollationStmt *a, const AlterCollationStmt *b) { COMPARE_NODE_FIELD(collname); return true; } static bool _equalAlterDomainStmt(const AlterDomainStmt *a, const AlterDomainStmt *b) { COMPARE_SCALAR_FIELD(subtype); COMPARE_NODE_FIELD(typeName); COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(def); COMPARE_SCALAR_FIELD(behavior); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalGrantStmt(const GrantStmt *a, const GrantStmt *b) { COMPARE_SCALAR_FIELD(is_grant); COMPARE_SCALAR_FIELD(targtype); COMPARE_SCALAR_FIELD(objtype); COMPARE_NODE_FIELD(objects); COMPARE_NODE_FIELD(privileges); COMPARE_NODE_FIELD(grantees); COMPARE_SCALAR_FIELD(grant_option); COMPARE_SCALAR_FIELD(behavior); return true; } static bool _equalObjectWithArgs(const ObjectWithArgs *a, const ObjectWithArgs *b) { COMPARE_NODE_FIELD(objname); COMPARE_NODE_FIELD(objargs); COMPARE_SCALAR_FIELD(args_unspecified); return true; } static bool _equalAccessPriv(const AccessPriv *a, const AccessPriv *b) { COMPARE_STRING_FIELD(priv_name); COMPARE_NODE_FIELD(cols); return true; } static bool _equalGrantRoleStmt(const GrantRoleStmt *a, const GrantRoleStmt *b) { COMPARE_NODE_FIELD(granted_roles); COMPARE_NODE_FIELD(grantee_roles); COMPARE_SCALAR_FIELD(is_grant); COMPARE_SCALAR_FIELD(admin_opt); COMPARE_NODE_FIELD(grantor); COMPARE_SCALAR_FIELD(behavior); return true; } static bool _equalAlterDefaultPrivilegesStmt(const AlterDefaultPrivilegesStmt *a, const AlterDefaultPrivilegesStmt *b) { COMPARE_NODE_FIELD(options); COMPARE_NODE_FIELD(action); return true; } static bool _equalDeclareCursorStmt(const DeclareCursorStmt *a, const DeclareCursorStmt *b) { COMPARE_STRING_FIELD(portalname); COMPARE_SCALAR_FIELD(options); COMPARE_NODE_FIELD(query); return true; } static bool _equalClosePortalStmt(const ClosePortalStmt *a, const ClosePortalStmt *b) { COMPARE_STRING_FIELD(portalname); return true; } static bool _equalCallStmt(const CallStmt *a, const CallStmt *b) { COMPARE_NODE_FIELD(funccall); COMPARE_NODE_FIELD(funcexpr); return true; } static bool _equalClusterStmt(const ClusterStmt *a, const ClusterStmt *b) { COMPARE_NODE_FIELD(relation); COMPARE_STRING_FIELD(indexname); COMPARE_SCALAR_FIELD(options); return true; } static bool _equalCopyStmt(const CopyStmt *a, const CopyStmt *b) { COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(query); COMPARE_NODE_FIELD(attlist); COMPARE_SCALAR_FIELD(is_from); COMPARE_SCALAR_FIELD(is_program); COMPARE_STRING_FIELD(filename); COMPARE_NODE_FIELD(options); COMPARE_NODE_FIELD(whereClause); return true; } static bool _equalCreateStmt(const CreateStmt *a, const CreateStmt *b) { COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(tableElts); COMPARE_NODE_FIELD(inhRelations); COMPARE_NODE_FIELD(partbound); COMPARE_NODE_FIELD(partspec); COMPARE_NODE_FIELD(ofTypename); COMPARE_NODE_FIELD(constraints); COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(oncommit); COMPARE_STRING_FIELD(tablespacename); COMPARE_STRING_FIELD(accessMethod); COMPARE_SCALAR_FIELD(if_not_exists); return true; } static bool _equalTableLikeClause(const TableLikeClause *a, const TableLikeClause *b) { COMPARE_NODE_FIELD(relation); COMPARE_SCALAR_FIELD(options); COMPARE_SCALAR_FIELD(relationOid); return true; } static bool _equalDefineStmt(const DefineStmt *a, const DefineStmt *b) { COMPARE_SCALAR_FIELD(kind); COMPARE_SCALAR_FIELD(oldstyle); COMPARE_NODE_FIELD(defnames); COMPARE_NODE_FIELD(args); COMPARE_NODE_FIELD(definition); COMPARE_SCALAR_FIELD(if_not_exists); COMPARE_SCALAR_FIELD(replace); return true; } static bool _equalDropStmt(const DropStmt *a, const DropStmt *b) { COMPARE_NODE_FIELD(objects); COMPARE_SCALAR_FIELD(removeType); COMPARE_SCALAR_FIELD(behavior); COMPARE_SCALAR_FIELD(missing_ok); COMPARE_SCALAR_FIELD(concurrent); return true; } static bool _equalTruncateStmt(const TruncateStmt *a, const TruncateStmt *b) { COMPARE_NODE_FIELD(relations); COMPARE_SCALAR_FIELD(restart_seqs); COMPARE_SCALAR_FIELD(behavior); return true; } static bool _equalCommentStmt(const CommentStmt *a, const CommentStmt *b) { COMPARE_SCALAR_FIELD(objtype); COMPARE_NODE_FIELD(object); COMPARE_STRING_FIELD(comment); return true; } static bool _equalSecLabelStmt(const SecLabelStmt *a, const SecLabelStmt *b) { COMPARE_SCALAR_FIELD(objtype); COMPARE_NODE_FIELD(object); COMPARE_STRING_FIELD(provider); COMPARE_STRING_FIELD(label); return true; } static bool _equalFetchStmt(const FetchStmt *a, const FetchStmt *b) { COMPARE_SCALAR_FIELD(direction); COMPARE_SCALAR_FIELD(howMany); COMPARE_STRING_FIELD(portalname); COMPARE_SCALAR_FIELD(ismove); return true; } static bool _equalIndexStmt(const IndexStmt *a, const IndexStmt *b) { COMPARE_STRING_FIELD(idxname); COMPARE_NODE_FIELD(relation); COMPARE_STRING_FIELD(accessMethod); COMPARE_STRING_FIELD(tableSpace); COMPARE_NODE_FIELD(indexParams); COMPARE_NODE_FIELD(indexIncludingParams); COMPARE_NODE_FIELD(options); COMPARE_NODE_FIELD(whereClause); COMPARE_NODE_FIELD(excludeOpNames); COMPARE_STRING_FIELD(idxcomment); COMPARE_SCALAR_FIELD(indexOid); COMPARE_SCALAR_FIELD(oldNode); COMPARE_SCALAR_FIELD(oldCreateSubid); COMPARE_SCALAR_FIELD(oldFirstRelfilenodeSubid); COMPARE_SCALAR_FIELD(unique); COMPARE_SCALAR_FIELD(primary); COMPARE_SCALAR_FIELD(isconstraint); COMPARE_SCALAR_FIELD(deferrable); COMPARE_SCALAR_FIELD(initdeferred); COMPARE_SCALAR_FIELD(transformed); COMPARE_SCALAR_FIELD(concurrent); COMPARE_SCALAR_FIELD(if_not_exists); COMPARE_SCALAR_FIELD(reset_default_tblspc); return true; } static bool _equalCreateStatsStmt(const CreateStatsStmt *a, const CreateStatsStmt *b) { COMPARE_NODE_FIELD(defnames); COMPARE_NODE_FIELD(stat_types); COMPARE_NODE_FIELD(exprs); COMPARE_NODE_FIELD(relations); COMPARE_STRING_FIELD(stxcomment); COMPARE_SCALAR_FIELD(if_not_exists); return true; } static bool _equalAlterStatsStmt(const AlterStatsStmt *a, const AlterStatsStmt *b) { COMPARE_NODE_FIELD(defnames); COMPARE_SCALAR_FIELD(stxstattarget); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalCreateFunctionStmt(const CreateFunctionStmt *a, const CreateFunctionStmt *b) { COMPARE_SCALAR_FIELD(is_procedure); COMPARE_SCALAR_FIELD(replace); COMPARE_NODE_FIELD(funcname); COMPARE_NODE_FIELD(parameters); COMPARE_NODE_FIELD(returnType); COMPARE_NODE_FIELD(options); return true; } static bool _equalFunctionParameter(const FunctionParameter *a, const FunctionParameter *b) { COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(argType); COMPARE_SCALAR_FIELD(mode); COMPARE_NODE_FIELD(defexpr); return true; } static bool _equalAlterFunctionStmt(const AlterFunctionStmt *a, const AlterFunctionStmt *b) { COMPARE_SCALAR_FIELD(objtype); COMPARE_NODE_FIELD(func); COMPARE_NODE_FIELD(actions); return true; } static bool _equalDoStmt(const DoStmt *a, const DoStmt *b) { COMPARE_NODE_FIELD(args); return true; } static bool _equalRenameStmt(const RenameStmt *a, const RenameStmt *b) { COMPARE_SCALAR_FIELD(renameType); COMPARE_SCALAR_FIELD(relationType); COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(object); COMPARE_STRING_FIELD(subname); COMPARE_STRING_FIELD(newname); COMPARE_SCALAR_FIELD(behavior); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalAlterObjectDependsStmt(const AlterObjectDependsStmt *a, const AlterObjectDependsStmt *b) { COMPARE_SCALAR_FIELD(objectType); COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(object); COMPARE_NODE_FIELD(extname); COMPARE_SCALAR_FIELD(remove); return true; } static bool _equalAlterObjectSchemaStmt(const AlterObjectSchemaStmt *a, const AlterObjectSchemaStmt *b) { COMPARE_SCALAR_FIELD(objectType); COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(object); COMPARE_STRING_FIELD(newschema); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalAlterOwnerStmt(const AlterOwnerStmt *a, const AlterOwnerStmt *b) { COMPARE_SCALAR_FIELD(objectType); COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(object); COMPARE_NODE_FIELD(newowner); return true; } static bool _equalAlterOperatorStmt(const AlterOperatorStmt *a, const AlterOperatorStmt *b) { COMPARE_NODE_FIELD(opername); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterTypeStmt(const AlterTypeStmt *a, const AlterTypeStmt *b) { COMPARE_NODE_FIELD(typeName); COMPARE_NODE_FIELD(options); return true; } static bool _equalRuleStmt(const RuleStmt *a, const RuleStmt *b) { COMPARE_NODE_FIELD(relation); COMPARE_STRING_FIELD(rulename); COMPARE_NODE_FIELD(whereClause); COMPARE_SCALAR_FIELD(event); COMPARE_SCALAR_FIELD(instead); COMPARE_NODE_FIELD(actions); COMPARE_SCALAR_FIELD(replace); return true; } static bool _equalNotifyStmt(const NotifyStmt *a, const NotifyStmt *b) { COMPARE_STRING_FIELD(conditionname); COMPARE_STRING_FIELD(payload); return true; } static bool _equalListenStmt(const ListenStmt *a, const ListenStmt *b) { COMPARE_STRING_FIELD(conditionname); return true; } static bool _equalUnlistenStmt(const UnlistenStmt *a, const UnlistenStmt *b) { COMPARE_STRING_FIELD(conditionname); return true; } static bool _equalTransactionStmt(const TransactionStmt *a, const TransactionStmt *b) { COMPARE_SCALAR_FIELD(kind); COMPARE_NODE_FIELD(options); COMPARE_STRING_FIELD(savepoint_name); COMPARE_STRING_FIELD(gid); COMPARE_SCALAR_FIELD(chain); return true; } static bool _equalCompositeTypeStmt(const CompositeTypeStmt *a, const CompositeTypeStmt *b) { COMPARE_NODE_FIELD(typevar); COMPARE_NODE_FIELD(coldeflist); return true; } static bool _equalCreateEnumStmt(const CreateEnumStmt *a, const CreateEnumStmt *b) { COMPARE_NODE_FIELD(typeName); COMPARE_NODE_FIELD(vals); return true; } static bool _equalCreateRangeStmt(const CreateRangeStmt *a, const CreateRangeStmt *b) { COMPARE_NODE_FIELD(typeName); COMPARE_NODE_FIELD(params); return true; } static bool _equalAlterEnumStmt(const AlterEnumStmt *a, const AlterEnumStmt *b) { COMPARE_NODE_FIELD(typeName); COMPARE_STRING_FIELD(oldVal); COMPARE_STRING_FIELD(newVal); COMPARE_STRING_FIELD(newValNeighbor); COMPARE_SCALAR_FIELD(newValIsAfter); COMPARE_SCALAR_FIELD(skipIfNewValExists); return true; } static bool _equalViewStmt(const ViewStmt *a, const ViewStmt *b) { COMPARE_NODE_FIELD(view); COMPARE_NODE_FIELD(aliases); COMPARE_NODE_FIELD(query); COMPARE_SCALAR_FIELD(replace); COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(withCheckOption); return true; } static bool _equalLoadStmt(const LoadStmt *a, const LoadStmt *b) { COMPARE_STRING_FIELD(filename); return true; } static bool _equalCreateDomainStmt(const CreateDomainStmt *a, const CreateDomainStmt *b) { COMPARE_NODE_FIELD(domainname); COMPARE_NODE_FIELD(typeName); COMPARE_NODE_FIELD(collClause); COMPARE_NODE_FIELD(constraints); return true; } static bool _equalCreateOpClassStmt(const CreateOpClassStmt *a, const CreateOpClassStmt *b) { COMPARE_NODE_FIELD(opclassname); COMPARE_NODE_FIELD(opfamilyname); COMPARE_STRING_FIELD(amname); COMPARE_NODE_FIELD(datatype); COMPARE_NODE_FIELD(items); COMPARE_SCALAR_FIELD(isDefault); return true; } static bool _equalCreateOpClassItem(const CreateOpClassItem *a, const CreateOpClassItem *b) { COMPARE_SCALAR_FIELD(itemtype); COMPARE_NODE_FIELD(name); COMPARE_SCALAR_FIELD(number); COMPARE_NODE_FIELD(order_family); COMPARE_NODE_FIELD(class_args); COMPARE_NODE_FIELD(storedtype); return true; } static bool _equalCreateOpFamilyStmt(const CreateOpFamilyStmt *a, const CreateOpFamilyStmt *b) { COMPARE_NODE_FIELD(opfamilyname); COMPARE_STRING_FIELD(amname); return true; } static bool _equalAlterOpFamilyStmt(const AlterOpFamilyStmt *a, const AlterOpFamilyStmt *b) { COMPARE_NODE_FIELD(opfamilyname); COMPARE_STRING_FIELD(amname); COMPARE_SCALAR_FIELD(isDrop); COMPARE_NODE_FIELD(items); return true; } static bool _equalCreatedbStmt(const CreatedbStmt *a, const CreatedbStmt *b) { COMPARE_STRING_FIELD(dbname); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterDatabaseStmt(const AlterDatabaseStmt *a, const AlterDatabaseStmt *b) { COMPARE_STRING_FIELD(dbname); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterDatabaseSetStmt(const AlterDatabaseSetStmt *a, const AlterDatabaseSetStmt *b) { COMPARE_STRING_FIELD(dbname); COMPARE_NODE_FIELD(setstmt); return true; } static bool _equalDropdbStmt(const DropdbStmt *a, const DropdbStmt *b) { COMPARE_STRING_FIELD(dbname); COMPARE_SCALAR_FIELD(missing_ok); COMPARE_NODE_FIELD(options); return true; } static bool _equalVacuumStmt(const VacuumStmt *a, const VacuumStmt *b) { COMPARE_NODE_FIELD(options); COMPARE_NODE_FIELD(rels); COMPARE_SCALAR_FIELD(is_vacuumcmd); return true; } static bool _equalVacuumRelation(const VacuumRelation *a, const VacuumRelation *b) { COMPARE_NODE_FIELD(relation); COMPARE_SCALAR_FIELD(oid); COMPARE_NODE_FIELD(va_cols); return true; } static bool _equalExplainStmt(const ExplainStmt *a, const ExplainStmt *b) { COMPARE_NODE_FIELD(query); COMPARE_NODE_FIELD(options); return true; } static bool _equalCreateTableAsStmt(const CreateTableAsStmt *a, const CreateTableAsStmt *b) { COMPARE_NODE_FIELD(query); COMPARE_NODE_FIELD(into); COMPARE_SCALAR_FIELD(relkind); COMPARE_SCALAR_FIELD(is_select_into); COMPARE_SCALAR_FIELD(if_not_exists); return true; } static bool _equalRefreshMatViewStmt(const RefreshMatViewStmt *a, const RefreshMatViewStmt *b) { COMPARE_SCALAR_FIELD(concurrent); COMPARE_SCALAR_FIELD(skipData); COMPARE_NODE_FIELD(relation); return true; } static bool _equalReplicaIdentityStmt(const ReplicaIdentityStmt *a, const ReplicaIdentityStmt *b) { COMPARE_SCALAR_FIELD(identity_type); COMPARE_STRING_FIELD(name); return true; } static bool _equalAlterSystemStmt(const AlterSystemStmt *a, const AlterSystemStmt *b) { COMPARE_NODE_FIELD(setstmt); return true; } static bool _equalCreateSeqStmt(const CreateSeqStmt *a, const CreateSeqStmt *b) { COMPARE_NODE_FIELD(sequence); COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(ownerId); COMPARE_SCALAR_FIELD(for_identity); COMPARE_SCALAR_FIELD(if_not_exists); return true; } static bool _equalAlterSeqStmt(const AlterSeqStmt *a, const AlterSeqStmt *b) { COMPARE_NODE_FIELD(sequence); COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(for_identity); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalVariableSetStmt(const VariableSetStmt *a, const VariableSetStmt *b) { COMPARE_SCALAR_FIELD(kind); COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(args); COMPARE_SCALAR_FIELD(is_local); return true; } static bool _equalVariableShowStmt(const VariableShowStmt *a, const VariableShowStmt *b) { COMPARE_STRING_FIELD(name); return true; } static bool _equalDiscardStmt(const DiscardStmt *a, const DiscardStmt *b) { COMPARE_SCALAR_FIELD(target); return true; } static bool _equalCreateTableSpaceStmt(const CreateTableSpaceStmt *a, const CreateTableSpaceStmt *b) { COMPARE_STRING_FIELD(tablespacename); COMPARE_NODE_FIELD(owner); COMPARE_STRING_FIELD(location); COMPARE_NODE_FIELD(options); return true; } static bool _equalDropTableSpaceStmt(const DropTableSpaceStmt *a, const DropTableSpaceStmt *b) { COMPARE_STRING_FIELD(tablespacename); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalAlterTableSpaceOptionsStmt(const AlterTableSpaceOptionsStmt *a, const AlterTableSpaceOptionsStmt *b) { COMPARE_STRING_FIELD(tablespacename); COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(isReset); return true; } static bool _equalAlterTableMoveAllStmt(const AlterTableMoveAllStmt *a, const AlterTableMoveAllStmt *b) { COMPARE_STRING_FIELD(orig_tablespacename); COMPARE_SCALAR_FIELD(objtype); COMPARE_NODE_FIELD(roles); COMPARE_STRING_FIELD(new_tablespacename); COMPARE_SCALAR_FIELD(nowait); return true; } static bool _equalCreateExtensionStmt(const CreateExtensionStmt *a, const CreateExtensionStmt *b) { COMPARE_STRING_FIELD(extname); COMPARE_SCALAR_FIELD(if_not_exists); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterExtensionStmt(const AlterExtensionStmt *a, const AlterExtensionStmt *b) { COMPARE_STRING_FIELD(extname); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterExtensionContentsStmt(const AlterExtensionContentsStmt *a, const AlterExtensionContentsStmt *b) { COMPARE_STRING_FIELD(extname); COMPARE_SCALAR_FIELD(action); COMPARE_SCALAR_FIELD(objtype); COMPARE_NODE_FIELD(object); return true; } static bool _equalCreateFdwStmt(const CreateFdwStmt *a, const CreateFdwStmt *b) { COMPARE_STRING_FIELD(fdwname); COMPARE_NODE_FIELD(func_options); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterFdwStmt(const AlterFdwStmt *a, const AlterFdwStmt *b) { COMPARE_STRING_FIELD(fdwname); COMPARE_NODE_FIELD(func_options); COMPARE_NODE_FIELD(options); return true; } static bool _equalCreateForeignServerStmt(const CreateForeignServerStmt *a, const CreateForeignServerStmt *b) { COMPARE_STRING_FIELD(servername); COMPARE_STRING_FIELD(servertype); COMPARE_STRING_FIELD(version); COMPARE_STRING_FIELD(fdwname); COMPARE_SCALAR_FIELD(if_not_exists); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterForeignServerStmt(const AlterForeignServerStmt *a, const AlterForeignServerStmt *b) { COMPARE_STRING_FIELD(servername); COMPARE_STRING_FIELD(version); COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(has_version); return true; } static bool _equalCreateUserMappingStmt(const CreateUserMappingStmt *a, const CreateUserMappingStmt *b) { COMPARE_NODE_FIELD(user); COMPARE_STRING_FIELD(servername); COMPARE_SCALAR_FIELD(if_not_exists); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterUserMappingStmt(const AlterUserMappingStmt *a, const AlterUserMappingStmt *b) { COMPARE_NODE_FIELD(user); COMPARE_STRING_FIELD(servername); COMPARE_NODE_FIELD(options); return true; } static bool _equalDropUserMappingStmt(const DropUserMappingStmt *a, const DropUserMappingStmt *b) { COMPARE_NODE_FIELD(user); COMPARE_STRING_FIELD(servername); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalCreateForeignTableStmt(const CreateForeignTableStmt *a, const CreateForeignTableStmt *b) { if (!_equalCreateStmt(&a->base, &b->base)) return false; COMPARE_STRING_FIELD(servername); COMPARE_NODE_FIELD(options); return true; } static bool _equalImportForeignSchemaStmt(const ImportForeignSchemaStmt *a, const ImportForeignSchemaStmt *b) { COMPARE_STRING_FIELD(server_name); COMPARE_STRING_FIELD(remote_schema); COMPARE_STRING_FIELD(local_schema); COMPARE_SCALAR_FIELD(list_type); COMPARE_NODE_FIELD(table_list); COMPARE_NODE_FIELD(options); return true; } static bool _equalCreateTransformStmt(const CreateTransformStmt *a, const CreateTransformStmt *b) { COMPARE_SCALAR_FIELD(replace); COMPARE_NODE_FIELD(type_name); COMPARE_STRING_FIELD(lang); COMPARE_NODE_FIELD(fromsql); COMPARE_NODE_FIELD(tosql); return true; } static bool _equalCreateAmStmt(const CreateAmStmt *a, const CreateAmStmt *b) { COMPARE_STRING_FIELD(amname); COMPARE_NODE_FIELD(handler_name); COMPARE_SCALAR_FIELD(amtype); return true; } static bool _equalCreateTrigStmt(const CreateTrigStmt *a, const CreateTrigStmt *b) { COMPARE_STRING_FIELD(trigname); COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(funcname); COMPARE_NODE_FIELD(args); COMPARE_SCALAR_FIELD(row); COMPARE_SCALAR_FIELD(timing); COMPARE_SCALAR_FIELD(events); COMPARE_NODE_FIELD(columns); COMPARE_NODE_FIELD(whenClause); COMPARE_SCALAR_FIELD(isconstraint); COMPARE_NODE_FIELD(transitionRels); COMPARE_SCALAR_FIELD(deferrable); COMPARE_SCALAR_FIELD(initdeferred); COMPARE_NODE_FIELD(constrrel); return true; } static bool _equalCreateEventTrigStmt(const CreateEventTrigStmt *a, const CreateEventTrigStmt *b) { COMPARE_STRING_FIELD(trigname); COMPARE_STRING_FIELD(eventname); COMPARE_NODE_FIELD(whenclause); COMPARE_NODE_FIELD(funcname); return true; } static bool _equalAlterEventTrigStmt(const AlterEventTrigStmt *a, const AlterEventTrigStmt *b) { COMPARE_STRING_FIELD(trigname); COMPARE_SCALAR_FIELD(tgenabled); return true; } static bool _equalCreatePLangStmt(const CreatePLangStmt *a, const CreatePLangStmt *b) { COMPARE_SCALAR_FIELD(replace); COMPARE_STRING_FIELD(plname); COMPARE_NODE_FIELD(plhandler); COMPARE_NODE_FIELD(plinline); COMPARE_NODE_FIELD(plvalidator); COMPARE_SCALAR_FIELD(pltrusted); return true; } static bool _equalCreateRoleStmt(const CreateRoleStmt *a, const CreateRoleStmt *b) { COMPARE_SCALAR_FIELD(stmt_type); COMPARE_STRING_FIELD(role); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterRoleStmt(const AlterRoleStmt *a, const AlterRoleStmt *b) { COMPARE_NODE_FIELD(role); COMPARE_NODE_FIELD(options); COMPARE_SCALAR_FIELD(action); return true; } static bool _equalAlterRoleSetStmt(const AlterRoleSetStmt *a, const AlterRoleSetStmt *b) { COMPARE_NODE_FIELD(role); COMPARE_STRING_FIELD(database); COMPARE_NODE_FIELD(setstmt); return true; } static bool _equalDropRoleStmt(const DropRoleStmt *a, const DropRoleStmt *b) { COMPARE_NODE_FIELD(roles); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalLockStmt(const LockStmt *a, const LockStmt *b) { COMPARE_NODE_FIELD(relations); COMPARE_SCALAR_FIELD(mode); COMPARE_SCALAR_FIELD(nowait); return true; } static bool _equalConstraintsSetStmt(const ConstraintsSetStmt *a, const ConstraintsSetStmt *b) { COMPARE_NODE_FIELD(constraints); COMPARE_SCALAR_FIELD(deferred); return true; } static bool _equalReindexStmt(const ReindexStmt *a, const ReindexStmt *b) { COMPARE_SCALAR_FIELD(kind); COMPARE_NODE_FIELD(relation); COMPARE_STRING_FIELD(name); COMPARE_SCALAR_FIELD(options); COMPARE_SCALAR_FIELD(concurrent); return true; } static bool _equalCreateSchemaStmt(const CreateSchemaStmt *a, const CreateSchemaStmt *b) { COMPARE_STRING_FIELD(schemaname); COMPARE_NODE_FIELD(authrole); COMPARE_NODE_FIELD(schemaElts); COMPARE_SCALAR_FIELD(if_not_exists); return true; } static bool _equalCreateConversionStmt(const CreateConversionStmt *a, const CreateConversionStmt *b) { COMPARE_NODE_FIELD(conversion_name); COMPARE_STRING_FIELD(for_encoding_name); COMPARE_STRING_FIELD(to_encoding_name); COMPARE_NODE_FIELD(func_name); COMPARE_SCALAR_FIELD(def); return true; } static bool _equalCreateCastStmt(const CreateCastStmt *a, const CreateCastStmt *b) { COMPARE_NODE_FIELD(sourcetype); COMPARE_NODE_FIELD(targettype); COMPARE_NODE_FIELD(func); COMPARE_SCALAR_FIELD(context); COMPARE_SCALAR_FIELD(inout); return true; } static bool _equalPrepareStmt(const PrepareStmt *a, const PrepareStmt *b) { COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(argtypes); COMPARE_NODE_FIELD(query); return true; } static bool _equalExecuteStmt(const ExecuteStmt *a, const ExecuteStmt *b) { COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(params); return true; } static bool _equalDeallocateStmt(const DeallocateStmt *a, const DeallocateStmt *b) { COMPARE_STRING_FIELD(name); return true; } static bool _equalDropOwnedStmt(const DropOwnedStmt *a, const DropOwnedStmt *b) { COMPARE_NODE_FIELD(roles); COMPARE_SCALAR_FIELD(behavior); return true; } static bool _equalReassignOwnedStmt(const ReassignOwnedStmt *a, const ReassignOwnedStmt *b) { COMPARE_NODE_FIELD(roles); COMPARE_NODE_FIELD(newrole); return true; } static bool _equalAlterTSDictionaryStmt(const AlterTSDictionaryStmt *a, const AlterTSDictionaryStmt *b) { COMPARE_NODE_FIELD(dictname); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterTSConfigurationStmt(const AlterTSConfigurationStmt *a, const AlterTSConfigurationStmt *b) { COMPARE_SCALAR_FIELD(kind); COMPARE_NODE_FIELD(cfgname); COMPARE_NODE_FIELD(tokentype); COMPARE_NODE_FIELD(dicts); COMPARE_SCALAR_FIELD(override); COMPARE_SCALAR_FIELD(replace); COMPARE_SCALAR_FIELD(missing_ok); return true; } static bool _equalCreatePublicationStmt(const CreatePublicationStmt *a, const CreatePublicationStmt *b) { COMPARE_STRING_FIELD(pubname); COMPARE_NODE_FIELD(options); COMPARE_NODE_FIELD(tables); COMPARE_SCALAR_FIELD(for_all_tables); return true; } static bool _equalAlterPublicationStmt(const AlterPublicationStmt *a, const AlterPublicationStmt *b) { COMPARE_STRING_FIELD(pubname); COMPARE_NODE_FIELD(options); COMPARE_NODE_FIELD(tables); COMPARE_SCALAR_FIELD(for_all_tables); COMPARE_SCALAR_FIELD(tableAction); return true; } static bool _equalCreateSubscriptionStmt(const CreateSubscriptionStmt *a, const CreateSubscriptionStmt *b) { COMPARE_STRING_FIELD(subname); COMPARE_STRING_FIELD(conninfo); COMPARE_NODE_FIELD(publication); COMPARE_NODE_FIELD(options); return true; } static bool _equalAlterSubscriptionStmt(const AlterSubscriptionStmt *a, const AlterSubscriptionStmt *b) { COMPARE_SCALAR_FIELD(kind); COMPARE_STRING_FIELD(subname); COMPARE_STRING_FIELD(conninfo); COMPARE_NODE_FIELD(publication); COMPARE_NODE_FIELD(options); return true; } static bool _equalDropSubscriptionStmt(const DropSubscriptionStmt *a, const DropSubscriptionStmt *b) { COMPARE_STRING_FIELD(subname); COMPARE_SCALAR_FIELD(missing_ok); COMPARE_SCALAR_FIELD(behavior); return true; } static bool _equalCreatePolicyStmt(const CreatePolicyStmt *a, const CreatePolicyStmt *b) { COMPARE_STRING_FIELD(policy_name); COMPARE_NODE_FIELD(table); COMPARE_STRING_FIELD(cmd_name); COMPARE_SCALAR_FIELD(permissive); COMPARE_NODE_FIELD(roles); COMPARE_NODE_FIELD(qual); COMPARE_NODE_FIELD(with_check); return true; } static bool _equalAlterPolicyStmt(const AlterPolicyStmt *a, const AlterPolicyStmt *b) { COMPARE_STRING_FIELD(policy_name); COMPARE_NODE_FIELD(table); COMPARE_NODE_FIELD(roles); COMPARE_NODE_FIELD(qual); COMPARE_NODE_FIELD(with_check); return true; } static bool _equalAExpr(const A_Expr *a, const A_Expr *b) { COMPARE_SCALAR_FIELD(kind); COMPARE_NODE_FIELD(name); COMPARE_NODE_FIELD(lexpr); COMPARE_NODE_FIELD(rexpr); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalColumnRef(const ColumnRef *a, const ColumnRef *b) { COMPARE_NODE_FIELD(fields); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalParamRef(const ParamRef *a, const ParamRef *b) { COMPARE_SCALAR_FIELD(number); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalAConst(const A_Const *a, const A_Const *b) { if (!equal(&a->val, &b->val)) /* hack for in-line Value field */ return false; COMPARE_LOCATION_FIELD(location); return true; } static bool _equalFuncCall(const FuncCall *a, const FuncCall *b) { COMPARE_NODE_FIELD(funcname); COMPARE_NODE_FIELD(args); COMPARE_NODE_FIELD(agg_order); COMPARE_NODE_FIELD(agg_filter); COMPARE_SCALAR_FIELD(agg_within_group); COMPARE_SCALAR_FIELD(agg_star); COMPARE_SCALAR_FIELD(agg_distinct); COMPARE_SCALAR_FIELD(func_variadic); COMPARE_NODE_FIELD(over); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalAStar(const A_Star *a, const A_Star *b) { return true; } static bool _equalAIndices(const A_Indices *a, const A_Indices *b) { COMPARE_SCALAR_FIELD(is_slice); COMPARE_NODE_FIELD(lidx); COMPARE_NODE_FIELD(uidx); return true; } static bool _equalA_Indirection(const A_Indirection *a, const A_Indirection *b) { COMPARE_NODE_FIELD(arg); COMPARE_NODE_FIELD(indirection); return true; } static bool _equalA_ArrayExpr(const A_ArrayExpr *a, const A_ArrayExpr *b) { COMPARE_NODE_FIELD(elements); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalResTarget(const ResTarget *a, const ResTarget *b) { COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(indirection); COMPARE_NODE_FIELD(val); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalMultiAssignRef(const MultiAssignRef *a, const MultiAssignRef *b) { COMPARE_NODE_FIELD(source); COMPARE_SCALAR_FIELD(colno); COMPARE_SCALAR_FIELD(ncolumns); return true; } static bool _equalTypeName(const TypeName *a, const TypeName *b) { COMPARE_NODE_FIELD(names); COMPARE_SCALAR_FIELD(typeOid); COMPARE_SCALAR_FIELD(setof); COMPARE_SCALAR_FIELD(pct_type); COMPARE_NODE_FIELD(typmods); COMPARE_SCALAR_FIELD(typemod); COMPARE_NODE_FIELD(arrayBounds); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalTypeCast(const TypeCast *a, const TypeCast *b) { COMPARE_NODE_FIELD(arg); COMPARE_NODE_FIELD(typeName); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalCollateClause(const CollateClause *a, const CollateClause *b) { COMPARE_NODE_FIELD(arg); COMPARE_NODE_FIELD(collname); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalSortBy(const SortBy *a, const SortBy *b) { COMPARE_NODE_FIELD(node); COMPARE_SCALAR_FIELD(sortby_dir); COMPARE_SCALAR_FIELD(sortby_nulls); COMPARE_NODE_FIELD(useOp); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalWindowDef(const WindowDef *a, const WindowDef *b) { COMPARE_STRING_FIELD(name); COMPARE_STRING_FIELD(refname); COMPARE_NODE_FIELD(partitionClause); COMPARE_NODE_FIELD(orderClause); COMPARE_SCALAR_FIELD(frameOptions); COMPARE_NODE_FIELD(startOffset); COMPARE_NODE_FIELD(endOffset); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalRangeSubselect(const RangeSubselect *a, const RangeSubselect *b) { COMPARE_SCALAR_FIELD(lateral); COMPARE_NODE_FIELD(subquery); COMPARE_NODE_FIELD(alias); return true; } static bool _equalRangeFunction(const RangeFunction *a, const RangeFunction *b) { COMPARE_SCALAR_FIELD(lateral); COMPARE_SCALAR_FIELD(ordinality); COMPARE_SCALAR_FIELD(is_rowsfrom); COMPARE_NODE_FIELD(functions); COMPARE_NODE_FIELD(alias); COMPARE_NODE_FIELD(coldeflist); return true; } static bool _equalRangeTableSample(const RangeTableSample *a, const RangeTableSample *b) { COMPARE_NODE_FIELD(relation); COMPARE_NODE_FIELD(method); COMPARE_NODE_FIELD(args); COMPARE_NODE_FIELD(repeatable); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalRangeTableFunc(const RangeTableFunc *a, const RangeTableFunc *b) { COMPARE_SCALAR_FIELD(lateral); COMPARE_NODE_FIELD(docexpr); COMPARE_NODE_FIELD(rowexpr); COMPARE_NODE_FIELD(namespaces); COMPARE_NODE_FIELD(columns); COMPARE_NODE_FIELD(alias); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalRangeTableFuncCol(const RangeTableFuncCol *a, const RangeTableFuncCol *b) { COMPARE_STRING_FIELD(colname); COMPARE_NODE_FIELD(typeName); COMPARE_SCALAR_FIELD(for_ordinality); COMPARE_SCALAR_FIELD(is_not_null); COMPARE_NODE_FIELD(colexpr); COMPARE_NODE_FIELD(coldefexpr); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalIndexElem(const IndexElem *a, const IndexElem *b) { COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(expr); COMPARE_STRING_FIELD(indexcolname); COMPARE_NODE_FIELD(collation); COMPARE_NODE_FIELD(opclass); COMPARE_NODE_FIELD(opclassopts); COMPARE_SCALAR_FIELD(ordering); COMPARE_SCALAR_FIELD(nulls_ordering); return true; } static bool _equalColumnDef(const ColumnDef *a, const ColumnDef *b) { COMPARE_STRING_FIELD(colname); COMPARE_NODE_FIELD(typeName); COMPARE_SCALAR_FIELD(inhcount); COMPARE_SCALAR_FIELD(is_local); COMPARE_SCALAR_FIELD(is_not_null); COMPARE_SCALAR_FIELD(is_from_type); COMPARE_SCALAR_FIELD(storage); COMPARE_NODE_FIELD(raw_default); COMPARE_NODE_FIELD(cooked_default); COMPARE_SCALAR_FIELD(identity); COMPARE_NODE_FIELD(identitySequence); COMPARE_SCALAR_FIELD(generated); COMPARE_NODE_FIELD(collClause); COMPARE_SCALAR_FIELD(collOid); COMPARE_NODE_FIELD(constraints); COMPARE_NODE_FIELD(fdwoptions); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalConstraint(const Constraint *a, const Constraint *b) { COMPARE_SCALAR_FIELD(contype); COMPARE_STRING_FIELD(conname); COMPARE_SCALAR_FIELD(deferrable); COMPARE_SCALAR_FIELD(initdeferred); COMPARE_LOCATION_FIELD(location); COMPARE_SCALAR_FIELD(is_no_inherit); COMPARE_NODE_FIELD(raw_expr); COMPARE_STRING_FIELD(cooked_expr); COMPARE_SCALAR_FIELD(generated_when); COMPARE_NODE_FIELD(keys); COMPARE_NODE_FIELD(including); COMPARE_NODE_FIELD(exclusions); COMPARE_NODE_FIELD(options); COMPARE_STRING_FIELD(indexname); COMPARE_STRING_FIELD(indexspace); COMPARE_SCALAR_FIELD(reset_default_tblspc); COMPARE_STRING_FIELD(access_method); COMPARE_NODE_FIELD(where_clause); COMPARE_NODE_FIELD(pktable); COMPARE_NODE_FIELD(fk_attrs); COMPARE_NODE_FIELD(pk_attrs); COMPARE_SCALAR_FIELD(fk_matchtype); COMPARE_SCALAR_FIELD(fk_upd_action); COMPARE_SCALAR_FIELD(fk_del_action); COMPARE_NODE_FIELD(old_conpfeqop); COMPARE_SCALAR_FIELD(old_pktable_oid); COMPARE_SCALAR_FIELD(skip_validation); COMPARE_SCALAR_FIELD(initially_valid); return true; } static bool _equalDefElem(const DefElem *a, const DefElem *b) { COMPARE_STRING_FIELD(defnamespace); COMPARE_STRING_FIELD(defname); COMPARE_NODE_FIELD(arg); COMPARE_SCALAR_FIELD(defaction); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalLockingClause(const LockingClause *a, const LockingClause *b) { COMPARE_NODE_FIELD(lockedRels); COMPARE_SCALAR_FIELD(strength); COMPARE_SCALAR_FIELD(waitPolicy); return true; } static bool _equalRangeTblEntry(const RangeTblEntry *a, const RangeTblEntry *b) { COMPARE_SCALAR_FIELD(rtekind); COMPARE_SCALAR_FIELD(relid); COMPARE_SCALAR_FIELD(relkind); COMPARE_SCALAR_FIELD(rellockmode); COMPARE_NODE_FIELD(tablesample); COMPARE_NODE_FIELD(subquery); COMPARE_SCALAR_FIELD(security_barrier); COMPARE_SCALAR_FIELD(jointype); COMPARE_SCALAR_FIELD(joinmergedcols); COMPARE_NODE_FIELD(joinaliasvars); COMPARE_NODE_FIELD(joinleftcols); COMPARE_NODE_FIELD(joinrightcols); COMPARE_NODE_FIELD(functions); COMPARE_SCALAR_FIELD(funcordinality); COMPARE_NODE_FIELD(tablefunc); COMPARE_NODE_FIELD(values_lists); COMPARE_STRING_FIELD(ctename); COMPARE_SCALAR_FIELD(ctelevelsup); COMPARE_SCALAR_FIELD(self_reference); COMPARE_NODE_FIELD(coltypes); COMPARE_NODE_FIELD(coltypmods); COMPARE_NODE_FIELD(colcollations); COMPARE_STRING_FIELD(enrname); COMPARE_SCALAR_FIELD(enrtuples); COMPARE_NODE_FIELD(alias); COMPARE_NODE_FIELD(eref); COMPARE_SCALAR_FIELD(lateral); COMPARE_SCALAR_FIELD(inh); COMPARE_SCALAR_FIELD(inFromCl); COMPARE_SCALAR_FIELD(requiredPerms); COMPARE_SCALAR_FIELD(checkAsUser); COMPARE_BITMAPSET_FIELD(selectedCols); COMPARE_BITMAPSET_FIELD(insertedCols); COMPARE_BITMAPSET_FIELD(updatedCols); COMPARE_BITMAPSET_FIELD(extraUpdatedCols); COMPARE_NODE_FIELD(securityQuals); return true; } static bool _equalRangeTblFunction(const RangeTblFunction *a, const RangeTblFunction *b) { COMPARE_NODE_FIELD(funcexpr); COMPARE_SCALAR_FIELD(funccolcount); COMPARE_NODE_FIELD(funccolnames); COMPARE_NODE_FIELD(funccoltypes); COMPARE_NODE_FIELD(funccoltypmods); COMPARE_NODE_FIELD(funccolcollations); COMPARE_BITMAPSET_FIELD(funcparams); return true; } static bool _equalTableSampleClause(const TableSampleClause *a, const TableSampleClause *b) { COMPARE_SCALAR_FIELD(tsmhandler); COMPARE_NODE_FIELD(args); COMPARE_NODE_FIELD(repeatable); return true; } static bool _equalWithCheckOption(const WithCheckOption *a, const WithCheckOption *b) { COMPARE_SCALAR_FIELD(kind); COMPARE_STRING_FIELD(relname); COMPARE_STRING_FIELD(polname); COMPARE_NODE_FIELD(qual); COMPARE_SCALAR_FIELD(cascaded); return true; } static bool _equalSortGroupClause(const SortGroupClause *a, const SortGroupClause *b) { COMPARE_SCALAR_FIELD(tleSortGroupRef); COMPARE_SCALAR_FIELD(eqop); COMPARE_SCALAR_FIELD(sortop); COMPARE_SCALAR_FIELD(nulls_first); COMPARE_SCALAR_FIELD(hashable); return true; } static bool _equalGroupingSet(const GroupingSet *a, const GroupingSet *b) { COMPARE_SCALAR_FIELD(kind); COMPARE_NODE_FIELD(content); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalWindowClause(const WindowClause *a, const WindowClause *b) { COMPARE_STRING_FIELD(name); COMPARE_STRING_FIELD(refname); COMPARE_NODE_FIELD(partitionClause); COMPARE_NODE_FIELD(orderClause); COMPARE_SCALAR_FIELD(frameOptions); COMPARE_NODE_FIELD(startOffset); COMPARE_NODE_FIELD(endOffset); COMPARE_SCALAR_FIELD(startInRangeFunc); COMPARE_SCALAR_FIELD(endInRangeFunc); COMPARE_SCALAR_FIELD(inRangeColl); COMPARE_SCALAR_FIELD(inRangeAsc); COMPARE_SCALAR_FIELD(inRangeNullsFirst); COMPARE_SCALAR_FIELD(winref); COMPARE_SCALAR_FIELD(copiedOrder); return true; } static bool _equalRowMarkClause(const RowMarkClause *a, const RowMarkClause *b) { COMPARE_SCALAR_FIELD(rti); COMPARE_SCALAR_FIELD(strength); COMPARE_SCALAR_FIELD(waitPolicy); COMPARE_SCALAR_FIELD(pushedDown); return true; } static bool _equalWithClause(const WithClause *a, const WithClause *b) { COMPARE_NODE_FIELD(ctes); COMPARE_SCALAR_FIELD(recursive); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalInferClause(const InferClause *a, const InferClause *b) { COMPARE_NODE_FIELD(indexElems); COMPARE_NODE_FIELD(whereClause); COMPARE_STRING_FIELD(conname); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalOnConflictClause(const OnConflictClause *a, const OnConflictClause *b) { COMPARE_SCALAR_FIELD(action); COMPARE_NODE_FIELD(infer); COMPARE_NODE_FIELD(targetList); COMPARE_NODE_FIELD(whereClause); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalCommonTableExpr(const CommonTableExpr *a, const CommonTableExpr *b) { COMPARE_STRING_FIELD(ctename); COMPARE_NODE_FIELD(aliascolnames); COMPARE_SCALAR_FIELD(ctematerialized); COMPARE_NODE_FIELD(ctequery); COMPARE_LOCATION_FIELD(location); COMPARE_SCALAR_FIELD(cterecursive); COMPARE_SCALAR_FIELD(cterefcount); COMPARE_NODE_FIELD(ctecolnames); COMPARE_NODE_FIELD(ctecoltypes); COMPARE_NODE_FIELD(ctecoltypmods); COMPARE_NODE_FIELD(ctecolcollations); return true; } static bool _equalXmlSerialize(const XmlSerialize *a, const XmlSerialize *b) { COMPARE_SCALAR_FIELD(xmloption); COMPARE_NODE_FIELD(expr); COMPARE_NODE_FIELD(typeName); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalRoleSpec(const RoleSpec *a, const RoleSpec *b) { COMPARE_SCALAR_FIELD(roletype); COMPARE_STRING_FIELD(rolename); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalTriggerTransition(const TriggerTransition *a, const TriggerTransition *b) { COMPARE_STRING_FIELD(name); COMPARE_SCALAR_FIELD(isNew); COMPARE_SCALAR_FIELD(isTable); return true; } static bool _equalPartitionElem(const PartitionElem *a, const PartitionElem *b) { COMPARE_STRING_FIELD(name); COMPARE_NODE_FIELD(expr); COMPARE_NODE_FIELD(collation); COMPARE_NODE_FIELD(opclass); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalPartitionSpec(const PartitionSpec *a, const PartitionSpec *b) { COMPARE_STRING_FIELD(strategy); COMPARE_NODE_FIELD(partParams); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalPartitionBoundSpec(const PartitionBoundSpec *a, const PartitionBoundSpec *b) { COMPARE_SCALAR_FIELD(strategy); COMPARE_SCALAR_FIELD(is_default); COMPARE_SCALAR_FIELD(modulus); COMPARE_SCALAR_FIELD(remainder); COMPARE_NODE_FIELD(listdatums); COMPARE_NODE_FIELD(lowerdatums); COMPARE_NODE_FIELD(upperdatums); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalPartitionRangeDatum(const PartitionRangeDatum *a, const PartitionRangeDatum *b) { COMPARE_SCALAR_FIELD(kind); COMPARE_NODE_FIELD(value); COMPARE_LOCATION_FIELD(location); return true; } static bool _equalPartitionCmd(const PartitionCmd *a, const PartitionCmd *b) { COMPARE_NODE_FIELD(name); COMPARE_NODE_FIELD(bound); return true; } /* * Stuff from pg_list.h */ static bool _equalList(const List *a, const List *b) { const ListCell *item_a; const ListCell *item_b; /* * Try to reject by simple scalar checks before grovelling through all the * list elements... */ COMPARE_SCALAR_FIELD(type); COMPARE_SCALAR_FIELD(length); /* * We place the switch outside the loop for the sake of efficiency; this * may not be worth doing... */ switch (a->type) { case T_List: forboth(item_a, a, item_b, b) { if (!equal(lfirst(item_a), lfirst(item_b))) return false; } break; case T_IntList: forboth(item_a, a, item_b, b) { if (lfirst_int(item_a) != lfirst_int(item_b)) return false; } break; case T_OidList: forboth(item_a, a, item_b, b) { if (lfirst_oid(item_a) != lfirst_oid(item_b)) return false; } break; default: elog(ERROR, "unrecognized list node type: %d", (int) a->type); return false; /* keep compiler quiet */ } /* * If we got here, we should have run out of elements of both lists */ Assert(item_a == NULL); Assert(item_b == NULL); return true; } /* * Stuff from value.h */ static bool _equalValue(const Value *a, const Value *b) { COMPARE_SCALAR_FIELD(type); switch (a->type) { case T_Integer: COMPARE_SCALAR_FIELD(val.ival); break; case T_Float: case T_String: case T_BitString: COMPARE_STRING_FIELD(val.str); break; case T_Null: /* nothing to do */ break; default: elog(ERROR, "unrecognized node type: %d", (int) a->type); break; } return true; } /* * equal * returns whether two nodes are equal */ bool equal(const void *a, const void *b) { bool retval; if (a == b) return true; /* * note that a!=b, so only one of them can be NULL */ if (a == NULL || b == NULL) return false; /* * are they the same type of nodes? */ if (nodeTag(a) != nodeTag(b)) return false; /* Guard against stack overflow due to overly complex expressions */ check_stack_depth(); switch (nodeTag(a)) { /* * PRIMITIVE NODES */ case T_Alias: retval = _equalAlias(a, b); break; case T_RangeVar: retval = _equalRangeVar(a, b); break; case T_TableFunc: retval = _equalTableFunc(a, b); break; case T_IntoClause: retval = _equalIntoClause(a, b); break; case T_Var: retval = _equalVar(a, b); break; case T_Const: retval = _equalConst(a, b); break; case T_Param: retval = _equalParam(a, b); break; case T_Aggref: retval = _equalAggref(a, b); break; case T_GroupingFunc: retval = _equalGroupingFunc(a, b); break; case T_WindowFunc: retval = _equalWindowFunc(a, b); break; case T_SubscriptingRef: retval = _equalSubscriptingRef(a, b); break; case T_FuncExpr: retval = _equalFuncExpr(a, b); break; case T_NamedArgExpr: retval = _equalNamedArgExpr(a, b); break; case T_OpExpr: retval = _equalOpExpr(a, b); break; case T_DistinctExpr: retval = _equalDistinctExpr(a, b); break; case T_NullIfExpr: retval = _equalNullIfExpr(a, b); break; case T_ScalarArrayOpExpr: retval = _equalScalarArrayOpExpr(a, b); break; case T_BoolExpr: retval = _equalBoolExpr(a, b); break; case T_SubLink: retval = _equalSubLink(a, b); break; case T_SubPlan: retval = _equalSubPlan(a, b); break; case T_AlternativeSubPlan: retval = _equalAlternativeSubPlan(a, b); break; case T_FieldSelect: retval = _equalFieldSelect(a, b); break; case T_FieldStore: retval = _equalFieldStore(a, b); break; case T_RelabelType: retval = _equalRelabelType(a, b); break; case T_CoerceViaIO: retval = _equalCoerceViaIO(a, b); break; case T_ArrayCoerceExpr: retval = _equalArrayCoerceExpr(a, b); break; case T_ConvertRowtypeExpr: retval = _equalConvertRowtypeExpr(a, b); break; case T_CollateExpr: retval = _equalCollateExpr(a, b); break; case T_CaseExpr: retval = _equalCaseExpr(a, b); break; case T_CaseWhen: retval = _equalCaseWhen(a, b); break; case T_CaseTestExpr: retval = _equalCaseTestExpr(a, b); break; case T_ArrayExpr: retval = _equalArrayExpr(a, b); break; case T_RowExpr: retval = _equalRowExpr(a, b); break; case T_RowCompareExpr: retval = _equalRowCompareExpr(a, b); break; case T_CoalesceExpr: retval = _equalCoalesceExpr(a, b); break; case T_MinMaxExpr: retval = _equalMinMaxExpr(a, b); break; case T_SQLValueFunction: retval = _equalSQLValueFunction(a, b); break; case T_XmlExpr: retval = _equalXmlExpr(a, b); break; case T_NullTest: retval = _equalNullTest(a, b); break; case T_BooleanTest: retval = _equalBooleanTest(a, b); break; case T_CoerceToDomain: retval = _equalCoerceToDomain(a, b); break; case T_CoerceToDomainValue: retval = _equalCoerceToDomainValue(a, b); break; case T_SetToDefault: retval = _equalSetToDefault(a, b); break; case T_CurrentOfExpr: retval = _equalCurrentOfExpr(a, b); break; case T_NextValueExpr: retval = _equalNextValueExpr(a, b); break; case T_InferenceElem: retval = _equalInferenceElem(a, b); break; case T_TargetEntry: retval = _equalTargetEntry(a, b); break; case T_RangeTblRef: retval = _equalRangeTblRef(a, b); break; case T_FromExpr: retval = _equalFromExpr(a, b); break; case T_OnConflictExpr: retval = _equalOnConflictExpr(a, b); break; case T_JoinExpr: retval = _equalJoinExpr(a, b); break; /* * RELATION NODES */ case T_PathKey: retval = _equalPathKey(a, b); break; case T_RestrictInfo: retval = _equalRestrictInfo(a, b); break; case T_PlaceHolderVar: retval = _equalPlaceHolderVar(a, b); break; case T_SpecialJoinInfo: retval = _equalSpecialJoinInfo(a, b); break; case T_AppendRelInfo: retval = _equalAppendRelInfo(a, b); break; case T_PlaceHolderInfo: retval = _equalPlaceHolderInfo(a, b); break; case T_List: case T_IntList: case T_OidList: retval = _equalList(a, b); break; case T_Integer: case T_Float: case T_String: case T_BitString: case T_Null: retval = _equalValue(a, b); break; /* * EXTENSIBLE NODES */ case T_ExtensibleNode: retval = _equalExtensibleNode(a, b); break; /* * PARSE NODES */ case T_Query: retval = _equalQuery(a, b); break; case T_RawStmt: retval = _equalRawStmt(a, b); break; case T_InsertStmt: retval = _equalInsertStmt(a, b); break; case T_DeleteStmt: retval = _equalDeleteStmt(a, b); break; case T_UpdateStmt: retval = _equalUpdateStmt(a, b); break; case T_SelectStmt: retval = _equalSelectStmt(a, b); break; case T_SetOperationStmt: retval = _equalSetOperationStmt(a, b); break; case T_AlterTableStmt: retval = _equalAlterTableStmt(a, b); break; case T_AlterTableCmd: retval = _equalAlterTableCmd(a, b); break; case T_AlterCollationStmt: retval = _equalAlterCollationStmt(a, b); break; case T_AlterDomainStmt: retval = _equalAlterDomainStmt(a, b); break; case T_GrantStmt: retval = _equalGrantStmt(a, b); break; case T_GrantRoleStmt: retval = _equalGrantRoleStmt(a, b); break; case T_AlterDefaultPrivilegesStmt: retval = _equalAlterDefaultPrivilegesStmt(a, b); break; case T_DeclareCursorStmt: retval = _equalDeclareCursorStmt(a, b); break; case T_ClosePortalStmt: retval = _equalClosePortalStmt(a, b); break; case T_CallStmt: retval = _equalCallStmt(a, b); break; case T_ClusterStmt: retval = _equalClusterStmt(a, b); break; case T_CopyStmt: retval = _equalCopyStmt(a, b); break; case T_CreateStmt: retval = _equalCreateStmt(a, b); break; case T_TableLikeClause: retval = _equalTableLikeClause(a, b); break; case T_DefineStmt: retval = _equalDefineStmt(a, b); break; case T_DropStmt: retval = _equalDropStmt(a, b); break; case T_TruncateStmt: retval = _equalTruncateStmt(a, b); break; case T_CommentStmt: retval = _equalCommentStmt(a, b); break; case T_SecLabelStmt: retval = _equalSecLabelStmt(a, b); break; case T_FetchStmt: retval = _equalFetchStmt(a, b); break; case T_IndexStmt: retval = _equalIndexStmt(a, b); break; case T_CreateStatsStmt: retval = _equalCreateStatsStmt(a, b); break; case T_AlterStatsStmt: retval = _equalAlterStatsStmt(a, b); break; case T_CreateFunctionStmt: retval = _equalCreateFunctionStmt(a, b); break; case T_FunctionParameter: retval = _equalFunctionParameter(a, b); break; case T_AlterFunctionStmt: retval = _equalAlterFunctionStmt(a, b); break; case T_DoStmt: retval = _equalDoStmt(a, b); break; case T_RenameStmt: retval = _equalRenameStmt(a, b); break; case T_AlterObjectDependsStmt: retval = _equalAlterObjectDependsStmt(a, b); break; case T_AlterObjectSchemaStmt: retval = _equalAlterObjectSchemaStmt(a, b); break; case T_AlterOwnerStmt: retval = _equalAlterOwnerStmt(a, b); break; case T_AlterOperatorStmt: retval = _equalAlterOperatorStmt(a, b); break; case T_AlterTypeStmt: retval = _equalAlterTypeStmt(a, b); break; case T_RuleStmt: retval = _equalRuleStmt(a, b); break; case T_NotifyStmt: retval = _equalNotifyStmt(a, b); break; case T_ListenStmt: retval = _equalListenStmt(a, b); break; case T_UnlistenStmt: retval = _equalUnlistenStmt(a, b); break; case T_TransactionStmt: retval = _equalTransactionStmt(a, b); break; case T_CompositeTypeStmt: retval = _equalCompositeTypeStmt(a, b); break; case T_CreateEnumStmt: retval = _equalCreateEnumStmt(a, b); break; case T_CreateRangeStmt: retval = _equalCreateRangeStmt(a, b); break; case T_AlterEnumStmt: retval = _equalAlterEnumStmt(a, b); break; case T_ViewStmt: retval = _equalViewStmt(a, b); break; case T_LoadStmt: retval = _equalLoadStmt(a, b); break; case T_CreateDomainStmt: retval = _equalCreateDomainStmt(a, b); break; case T_CreateOpClassStmt: retval = _equalCreateOpClassStmt(a, b); break; case T_CreateOpClassItem: retval = _equalCreateOpClassItem(a, b); break; case T_CreateOpFamilyStmt: retval = _equalCreateOpFamilyStmt(a, b); break; case T_AlterOpFamilyStmt: retval = _equalAlterOpFamilyStmt(a, b); break; case T_CreatedbStmt: retval = _equalCreatedbStmt(a, b); break; case T_AlterDatabaseStmt: retval = _equalAlterDatabaseStmt(a, b); break; case T_AlterDatabaseSetStmt: retval = _equalAlterDatabaseSetStmt(a, b); break; case T_DropdbStmt: retval = _equalDropdbStmt(a, b); break; case T_VacuumStmt: retval = _equalVacuumStmt(a, b); break; case T_VacuumRelation: retval = _equalVacuumRelation(a, b); break; case T_ExplainStmt: retval = _equalExplainStmt(a, b); break; case T_CreateTableAsStmt: retval = _equalCreateTableAsStmt(a, b); break; case T_RefreshMatViewStmt: retval = _equalRefreshMatViewStmt(a, b); break; case T_ReplicaIdentityStmt: retval = _equalReplicaIdentityStmt(a, b); break; case T_AlterSystemStmt: retval = _equalAlterSystemStmt(a, b); break; case T_CreateSeqStmt: retval = _equalCreateSeqStmt(a, b); break; case T_AlterSeqStmt: retval = _equalAlterSeqStmt(a, b); break; case T_VariableSetStmt: retval = _equalVariableSetStmt(a, b); break; case T_VariableShowStmt: retval = _equalVariableShowStmt(a, b); break; case T_DiscardStmt: retval = _equalDiscardStmt(a, b); break; case T_CreateTableSpaceStmt: retval = _equalCreateTableSpaceStmt(a, b); break; case T_DropTableSpaceStmt: retval = _equalDropTableSpaceStmt(a, b); break; case T_AlterTableSpaceOptionsStmt: retval = _equalAlterTableSpaceOptionsStmt(a, b); break; case T_AlterTableMoveAllStmt: retval = _equalAlterTableMoveAllStmt(a, b); break; case T_CreateExtensionStmt: retval = _equalCreateExtensionStmt(a, b); break; case T_AlterExtensionStmt: retval = _equalAlterExtensionStmt(a, b); break; case T_AlterExtensionContentsStmt: retval = _equalAlterExtensionContentsStmt(a, b); break; case T_CreateFdwStmt: retval = _equalCreateFdwStmt(a, b); break; case T_AlterFdwStmt: retval = _equalAlterFdwStmt(a, b); break; case T_CreateForeignServerStmt: retval = _equalCreateForeignServerStmt(a, b); break; case T_AlterForeignServerStmt: retval = _equalAlterForeignServerStmt(a, b); break; case T_CreateUserMappingStmt: retval = _equalCreateUserMappingStmt(a, b); break; case T_AlterUserMappingStmt: retval = _equalAlterUserMappingStmt(a, b); break; case T_DropUserMappingStmt: retval = _equalDropUserMappingStmt(a, b); break; case T_CreateForeignTableStmt: retval = _equalCreateForeignTableStmt(a, b); break; case T_ImportForeignSchemaStmt: retval = _equalImportForeignSchemaStmt(a, b); break; case T_CreateTransformStmt: retval = _equalCreateTransformStmt(a, b); break; case T_CreateAmStmt: retval = _equalCreateAmStmt(a, b); break; case T_CreateTrigStmt: retval = _equalCreateTrigStmt(a, b); break; case T_CreateEventTrigStmt: retval = _equalCreateEventTrigStmt(a, b); break; case T_AlterEventTrigStmt: retval = _equalAlterEventTrigStmt(a, b); break; case T_CreatePLangStmt: retval = _equalCreatePLangStmt(a, b); break; case T_CreateRoleStmt: retval = _equalCreateRoleStmt(a, b); break; case T_AlterRoleStmt: retval = _equalAlterRoleStmt(a, b); break; case T_AlterRoleSetStmt: retval = _equalAlterRoleSetStmt(a, b); break; case T_DropRoleStmt: retval = _equalDropRoleStmt(a, b); break; case T_LockStmt: retval = _equalLockStmt(a, b); break; case T_ConstraintsSetStmt: retval = _equalConstraintsSetStmt(a, b); break; case T_ReindexStmt: retval = _equalReindexStmt(a, b); break; case T_CheckPointStmt: retval = true; break; case T_CreateSchemaStmt: retval = _equalCreateSchemaStmt(a, b); break; case T_CreateConversionStmt: retval = _equalCreateConversionStmt(a, b); break; case T_CreateCastStmt: retval = _equalCreateCastStmt(a, b); break; case T_PrepareStmt: retval = _equalPrepareStmt(a, b); break; case T_ExecuteStmt: retval = _equalExecuteStmt(a, b); break; case T_DeallocateStmt: retval = _equalDeallocateStmt(a, b); break; case T_DropOwnedStmt: retval = _equalDropOwnedStmt(a, b); break; case T_ReassignOwnedStmt: retval = _equalReassignOwnedStmt(a, b); break; case T_AlterTSDictionaryStmt: retval = _equalAlterTSDictionaryStmt(a, b); break; case T_AlterTSConfigurationStmt: retval = _equalAlterTSConfigurationStmt(a, b); break; case T_CreatePolicyStmt: retval = _equalCreatePolicyStmt(a, b); break; case T_AlterPolicyStmt: retval = _equalAlterPolicyStmt(a, b); break; case T_CreatePublicationStmt: retval = _equalCreatePublicationStmt(a, b); break; case T_AlterPublicationStmt: retval = _equalAlterPublicationStmt(a, b); break; case T_CreateSubscriptionStmt: retval = _equalCreateSubscriptionStmt(a, b); break; case T_AlterSubscriptionStmt: retval = _equalAlterSubscriptionStmt(a, b); break; case T_DropSubscriptionStmt: retval = _equalDropSubscriptionStmt(a, b); break; case T_A_Expr: retval = _equalAExpr(a, b); break; case T_ColumnRef: retval = _equalColumnRef(a, b); break; case T_ParamRef: retval = _equalParamRef(a, b); break; case T_A_Const: retval = _equalAConst(a, b); break; case T_FuncCall: retval = _equalFuncCall(a, b); break; case T_A_Star: retval = _equalAStar(a, b); break; case T_A_Indices: retval = _equalAIndices(a, b); break; case T_A_Indirection: retval = _equalA_Indirection(a, b); break; case T_A_ArrayExpr: retval = _equalA_ArrayExpr(a, b); break; case T_ResTarget: retval = _equalResTarget(a, b); break; case T_MultiAssignRef: retval = _equalMultiAssignRef(a, b); break; case T_TypeCast: retval = _equalTypeCast(a, b); break; case T_CollateClause: retval = _equalCollateClause(a, b); break; case T_SortBy: retval = _equalSortBy(a, b); break; case T_WindowDef: retval = _equalWindowDef(a, b); break; case T_RangeSubselect: retval = _equalRangeSubselect(a, b); break; case T_RangeFunction: retval = _equalRangeFunction(a, b); break; case T_RangeTableSample: retval = _equalRangeTableSample(a, b); break; case T_RangeTableFunc: retval = _equalRangeTableFunc(a, b); break; case T_RangeTableFuncCol: retval = _equalRangeTableFuncCol(a, b); break; case T_TypeName: retval = _equalTypeName(a, b); break; case T_IndexElem: retval = _equalIndexElem(a, b); break; case T_ColumnDef: retval = _equalColumnDef(a, b); break; case T_Constraint: retval = _equalConstraint(a, b); break; case T_DefElem: retval = _equalDefElem(a, b); break; case T_LockingClause: retval = _equalLockingClause(a, b); break; case T_RangeTblEntry: retval = _equalRangeTblEntry(a, b); break; case T_RangeTblFunction: retval = _equalRangeTblFunction(a, b); break; case T_TableSampleClause: retval = _equalTableSampleClause(a, b); break; case T_WithCheckOption: retval = _equalWithCheckOption(a, b); break; case T_SortGroupClause: retval = _equalSortGroupClause(a, b); break; case T_GroupingSet: retval = _equalGroupingSet(a, b); break; case T_WindowClause: retval = _equalWindowClause(a, b); break; case T_RowMarkClause: retval = _equalRowMarkClause(a, b); break; case T_WithClause: retval = _equalWithClause(a, b); break; case T_InferClause: retval = _equalInferClause(a, b); break; case T_OnConflictClause: retval = _equalOnConflictClause(a, b); break; case T_CommonTableExpr: retval = _equalCommonTableExpr(a, b); break; case T_ObjectWithArgs: retval = _equalObjectWithArgs(a, b); break; case T_AccessPriv: retval = _equalAccessPriv(a, b); break; case T_XmlSerialize: retval = _equalXmlSerialize(a, b); break; case T_RoleSpec: retval = _equalRoleSpec(a, b); break; case T_TriggerTransition: retval = _equalTriggerTransition(a, b); break; case T_PartitionElem: retval = _equalPartitionElem(a, b); break; case T_PartitionSpec: retval = _equalPartitionSpec(a, b); break; case T_PartitionBoundSpec: retval = _equalPartitionBoundSpec(a, b); break; case T_PartitionRangeDatum: retval = _equalPartitionRangeDatum(a, b); break; case T_PartitionCmd: retval = _equalPartitionCmd(a, b); break; default: elog(ERROR, "unrecognized node type: %d", (int) nodeTag(a)); retval = false; /* keep compiler quiet */ break; } return retval; }
/*-------------------------------------------------------------------- * Symbols referenced in this file: * - equal * - _equalAlias * - _equalRangeVar * - _equalTableFunc * - _equalIntoClause * - _equalVar * - _equalConst * - _equalParam * - _equalAggref * - _equalGroupingFunc * - _equalWindowFunc * - _equalSubscriptingRef * - _equalFuncExpr * - _equalNamedArgExpr * - _equalOpExpr * - _equalDistinctExpr * - _equalNullIfExpr * - _equalScalarArrayOpExpr * - _equalBoolExpr * - _equalSubLink * - _equalSubPlan * - _equalAlternativeSubPlan * - _equalFieldSelect * - _equalFieldStore * - _equalRelabelType * - _equalCoerceViaIO * - _equalArrayCoerceExpr * - _equalConvertRowtypeExpr * - _equalCollateExpr * - _equalCaseExpr * - _equalCaseWhen * - _equalCaseTestExpr * - _equalArrayExpr * - _equalRowExpr * - _equalRowCompareExpr * - _equalCoalesceExpr * - _equalMinMaxExpr * - _equalSQLValueFunction * - _equalXmlExpr * - _equalNullTest * - _equalBooleanTest * - _equalCoerceToDomain * - _equalCoerceToDomainValue * - _equalSetToDefault * - _equalCurrentOfExpr * - _equalNextValueExpr * - _equalInferenceElem * - _equalTargetEntry * - _equalRangeTblRef * - _equalFromExpr * - _equalOnConflictExpr * - _equalJoinExpr * - _equalPathKey * - _equalRestrictInfo * - _equalPlaceHolderVar * - _equalSpecialJoinInfo * - _equalAppendRelInfo * - _equalPlaceHolderInfo * - _equalList * - _equalValue * - _equalExtensibleNode * - _equalQuery * - _equalRawStmt * - _equalInsertStmt * - _equalDeleteStmt * - _equalUpdateStmt * - _equalSelectStmt * - _equalSetOperationStmt * - _equalAlterTableStmt * - _equalAlterTableCmd * - _equalAlterCollationStmt * - _equalAlterDomainStmt * - _equalGrantStmt * - _equalGrantRoleStmt * - _equalAlterDefaultPrivilegesStmt * - _equalDeclareCursorStmt * - _equalClosePortalStmt * - _equalCallStmt * - _equalClusterStmt * - _equalCopyStmt * - _equalCreateStmt * - _equalTableLikeClause * - _equalDefineStmt * - _equalDropStmt * - _equalTruncateStmt * - _equalCommentStmt * - _equalSecLabelStmt * - _equalFetchStmt * - _equalIndexStmt * - _equalCreateStatsStmt * - _equalAlterStatsStmt * - _equalCreateFunctionStmt * - _equalFunctionParameter * - _equalAlterFunctionStmt * - _equalDoStmt * - _equalRenameStmt * - _equalAlterObjectDependsStmt * - _equalAlterObjectSchemaStmt * - _equalAlterOwnerStmt * - _equalAlterOperatorStmt * - _equalAlterTypeStmt * - _equalRuleStmt * - _equalNotifyStmt * - _equalListenStmt * - _equalUnlistenStmt * - _equalTransactionStmt * - _equalCompositeTypeStmt * - _equalCreateEnumStmt * - _equalCreateRangeStmt * - _equalAlterEnumStmt * - _equalViewStmt * - _equalLoadStmt * - _equalCreateDomainStmt * - _equalCreateOpClassStmt * - _equalCreateOpClassItem * - _equalCreateOpFamilyStmt * - _equalAlterOpFamilyStmt * - _equalCreatedbStmt * - _equalAlterDatabaseStmt * - _equalAlterDatabaseSetStmt * - _equalDropdbStmt * - _equalVacuumStmt * - _equalVacuumRelation * - _equalExplainStmt * - _equalCreateTableAsStmt * - _equalRefreshMatViewStmt * - _equalReplicaIdentityStmt * - _equalAlterSystemStmt * - _equalCreateSeqStmt * - _equalAlterSeqStmt * - _equalVariableSetStmt * - _equalVariableShowStmt * - _equalDiscardStmt * - _equalCreateTableSpaceStmt * - _equalDropTableSpaceStmt * - _equalAlterTableSpaceOptionsStmt * - _equalAlterTableMoveAllStmt * - _equalCreateExtensionStmt * - _equalAlterExtensionStmt * - _equalAlterExtensionContentsStmt * - _equalCreateFdwStmt * - _equalAlterFdwStmt * - _equalCreateForeignServerStmt * - _equalAlterForeignServerStmt * - _equalCreateUserMappingStmt * - _equalAlterUserMappingStmt * - _equalDropUserMappingStmt * - _equalCreateForeignTableStmt * - _equalImportForeignSchemaStmt * - _equalCreateTransformStmt * - _equalCreateAmStmt * - _equalCreateTrigStmt * - _equalCreateEventTrigStmt * - _equalAlterEventTrigStmt * - _equalCreatePLangStmt * - _equalCreateRoleStmt * - _equalAlterRoleStmt * - _equalAlterRoleSetStmt * - _equalDropRoleStmt * - _equalLockStmt * - _equalConstraintsSetStmt * - _equalReindexStmt * - _equalCreateSchemaStmt * - _equalCreateConversionStmt * - _equalCreateCastStmt * - _equalPrepareStmt * - _equalExecuteStmt * - _equalDeallocateStmt * - _equalDropOwnedStmt * - _equalReassignOwnedStmt * - _equalAlterTSDictionaryStmt * - _equalAlterTSConfigurationStmt * - _equalCreatePolicyStmt * - _equalAlterPolicyStmt * - _equalCreatePublicationStmt * - _equalAlterPublicationStmt * - _equalCreateSubscriptionStmt * - _equalAlterSubscriptionStmt * - _equalDropSubscriptionStmt * - _equalAExpr * - _equalColumnRef * - _equalParamRef * - _equalAConst * - _equalFuncCall * - _equalAStar * - _equalAIndices * - _equalA_Indirection * - _equalA_ArrayExpr * - _equalResTarget * - _equalMultiAssignRef * - _equalTypeCast * - _equalCollateClause * - _equalSortBy * - _equalWindowDef * - _equalRangeSubselect * - _equalRangeFunction * - _equalRangeTableSample * - _equalRangeTableFunc * - _equalRangeTableFuncCol * - _equalTypeName * - _equalIndexElem * - _equalColumnDef * - _equalConstraint * - _equalDefElem * - _equalLockingClause * - _equalRangeTblEntry * - _equalRangeTblFunction * - _equalTableSampleClause * - _equalWithCheckOption * - _equalSortGroupClause * - _equalGroupingSet * - _equalWindowClause * - _equalRowMarkClause * - _equalWithClause * - _equalInferClause * - _equalOnConflictClause * - _equalCommonTableExpr * - _equalObjectWithArgs * - _equalAccessPriv * - _equalXmlSerialize * - _equalRoleSpec * - _equalTriggerTransition * - _equalPartitionElem * - _equalPartitionSpec * - _equalPartitionBoundSpec * - _equalPartitionRangeDatum * - _equalPartitionCmd *-------------------------------------------------------------------- */
react.ml
let err_max_rank = "maximal rank exceeded" let err_sig_undef = "signal value undefined yet" let err_fix = "trying to fix a delayed value" let err_retain_never = "E.never cannot retain a closure" let err_retain_cst_sig = "constant signals cannot retain a closure" let err_step_executed = "step already executed" let err_event_scheduled = "event already scheduled on a step" let err_signal_scheduled = "signal already scheduled on a step" module Wa = struct type 'a t = { mutable arr : 'a Weak.t; mutable len : int } (* The type for resizeable weak arrays. For now the arrays only grow. We could try to compact and downsize the array in scan_add if a threshold of empty slots is exceeded. *) let create size = { arr = Weak.create size; len = 0 } let length a = a.len let is_empty a = try for i = 0 to a.len - 1 do if Weak.check a.arr i then raise Exit; done; true with Exit -> false let clear a = a.arr <- Weak.create 0; a.len <- 0 let get a i = Weak.get a.arr i let set a i = Weak.set a.arr i let swap a i i' = let v = Weak.get a.arr i' in Weak.blit a.arr i a.arr i' 1; (* blit prevents i from becoming live. *) Weak.set a.arr i v let grow a = let arr' = Weak.create (2 * (a.len + 1)) in Weak.blit a.arr 0 arr' 0 a.len; a.arr <- arr' let add a v = (* adds v at the end of a. *) if a.len = Weak.length a.arr then grow a; Weak.set a.arr a.len (Some v); a.len <- a.len + 1 let scan_add a v = (* adds v to a, tries to find an empty slot, O(a.len). *) try for i = 0 to a.len - 1 do match Weak.get a.arr i with | None -> Weak.set a.arr i (Some v); raise Exit | Some _ -> () done; add a v with Exit -> () let rem_last a = let l = a.len - 1 in (a.len <- l; Weak.set a.arr l None) let rem a v = (* removes v from a, uses physical equality, O(a.len). *) try for i = 0 to a.len - 1 do match Weak.get a.arr i with | Some v' when v == v' -> Weak.set a.arr i None; raise Exit | _ -> () done with Exit -> () let iter f a = for i = 0 to a.len - 1 do match Weak.get a.arr i with Some v -> f v | None -> () done let fold f acc a = let acc = ref acc in for i = 0 to a.len - 1 do match Weak.get a.arr i with Some v -> acc := f !acc v | None -> () done; !acc end type node = { mutable rank : int; (* its rank (height) in the dataflow graph. *) mutable stamp : step; (* last step in which it was scheduled. *) mutable retain : unit -> unit; (* retained by the node, NEVER invoked. *) mutable producers : unit -> node list; (* nodes on which it depends. *) mutable update : step -> unit; (* update closure. *) deps : node Wa.t } (* weak references to dependent nodes. *) (* The type for nodes. Each event and (non-constant) signal has an associated node. The fields producers and update keep, in their closure environment, references to mutables (see later) on which the node depends. Defining their contents via a let rec allows the environment to be shared by the two closures. There are special nodes to represent infinitesimally delayed nodes (needed for recursive definitions). These nodes all have a rank of Node.delayed_rank and depend only on the node they delay. Since they have the highest rank possible they are updated only at the end of the step and treated specially at that point (see Step.execute). *) and step = { mutable over : bool; (* true when the step is over. *) mutable heap : heap; (* min-heap of nodes sorted by rank. *) mutable eops : (unit -> unit) list; (* end of step operations. *) mutable cops : (unit -> unit) list } (* cleanup step operations. *) (* The type for update steps. Note for historical reasons we use the variable names [c] and [c'] in the code for representing update steps. There are four successive phases in the execution of a step c (see Step.execute). 1. Nodes are updated in topological order until c.heap is empty or we reach a delayed node. 2. End of step operations are executed. This may add new dependencies (see S.diff and S.changes) and clear the occurence of delayed events from a previous step (but used in this step). 3. If there are delayed nodes in c.heap, we create a new step c'. Each delayed node is updated and its dependents are put in c'.heap. For delayed events, an end of step operation is added in c' to clear the occurence at step 2 of c'. Delayed nodes are updated in any order as a delayed node updating in a step cannot depend on a delayed node updating in the same step. 4. Cleanup operations are executed. This clears the event occurences of non-delayed event that occured in c. After this, if a step c' was created in 3. the step gets executed. *) and heap = node Wa.t (* The type for heaps. Weak min-heaps of nodes sorted according to their rank. Classic imperative implementation with a twist to accomodate the fact that nodes may disappear. The heap property we maintain is that for any node its descendents (vs. children) are either of no smaller rank or they are None. None nodes need to be treated specially in percolate up and down. The reason is that it blocks information about the rank of their descendents. In percolate down the solution is to systematically swap with None children. So do we in percolate up, however, in that case we may violate the property if we swap with a None node and stop right after (either because we got the root or we found a parent of smaller rank), the property can however be reestablished by percolating down from that point. *) type 'a emut = { ev : 'a option ref; (* during steps, holds a potential occurence. *) enode : node; } (* associated node. *) type 'a event = Never | Emut of 'a emut (* The type for events. An event is either the never occuring event Never or a mutable Emut. A mutable m has some value in m.v iff a step is being executed and m has an occurence in the step. m's dependents are scheduled for update iff m has a value in m.v. Mutables that occur in a step are set back to None when the step terminates with an cleanup step operation (see eupdate and Step.execute). To avoid a weak reference on m in the cleanup operation, the field m.v is a field on a reference instead of a mutable field. A new node n can be made dependent on a an event mutable m during a step. But when n is added to m's dependents, m may already have updated and scheduled its dependents. In that case n also need to be scheduled (see E.add_dep). If m only occurs later in the step, the n will be scheduled as usual with the others. *) type 'a smut = { mutable sv : 'a option; (* signal value (None only temporary). *) eq : 'a -> 'a -> bool; (* to detect signal value changes. *) snode : node } (* associated node. *) type 'a signal = Const of 'a | Smut of 'a smut (* The type for signals. A signal is either a constant signal Const or a mutable Smut. A mutable m has a value in m.v iff m.v initialized. m's dependents are scheduled for update iff m is initialized and m.v changed according to m.eq in the step. Signal initialization occurs as follows. If we have an init. value we set the signal's value to this value and then : 1. If the creation occurs outside a step, the signal's update function is invoked with Step.nil. This may overwrite the init. value, but no dependent will see this change as there cannot be any at that time. 2. If the creation occurs inside a step, the signal is scheduled for update. Here again this may overwrite the init. value. If the new value is equal to the init. value this will not schedule the signals' dependents. However this is not a problem since dependents are either new signals and will be scheduled via the init. process or a new dependency added by S.switch in which case this dependent is also be scheduled. Note that in both cases if we had no init. value, the call to the update function must unconditionaly write a concrete value for the signal. To find out whether the creation occurs in a step we walk back the signal's producers recursively looking for a node stamp with an unfinished step (see Step.find_unfinished). This is not in favor of static signal creation but this is the price we have to pay for not having global data structures. A new node n can be made dependent on a signal mutable m during a step. In contrast to events (see above) nothing special has to be done. Here's the rationale : 1. If n is the node of a new event then either the event cannot happen in the same step and thus the depency addition occurs at the end of the step (S.diff, S.changes) or the event cares only about having an up to date value if some other event occurs (S.sample, E.on) in the same step and the rank of n ensures this. 2. If n is the node of a new signal then n cares only about having m's up to date values whenever n will initialize and the rank of n ensures this. *) module H = struct let size = Wa.length let els h = Wa.fold (fun acc e -> e :: acc) [] h (* no particular order. *) let compare_down h i i' = match Wa.get h i, Wa.get h i' with | Some n, Some n' -> compare n.rank n'.rank | Some _, None -> 1 (* None is smaller than anything. *) | None, Some _ -> -1 (* None is smaller than anything. *) | None, None -> 0 let rec down h i = let last = size h - 1 in let start = 2 * i in let l = start + 1 in (* left child index. *) let r = start + 2 in (* right child index. *) if l > last then () (* no child, stop *) else let child = (* index of smallest child. *) if r > last then l else (if compare_down h l r < 0 then l else r) in if compare_down h i child > 0 then (Wa.swap h i child; down h child) let up h i = let rec aux h i last_none = if i = 0 then (if last_none then down h 0) else let p = (i - 1) / 2 in (* parent index. *) match Wa.get h i, Wa.get h p with | Some n, Some n' -> if compare n.rank n'.rank < 0 then (Wa.swap h i p; aux h p false) else (if last_none then down h i) | Some _, None -> Wa.swap h i p; aux h p true | None, _ -> () in aux h i false let rebuild h = for i = (size h - 2) / 2 downto 0 do down h i done let add h n = Wa.add h n; up h (size h - 1) let rec take h = let s = size h in if s = 0 then None else let v = Wa.get h 0 in begin if s > 1 then (Wa.set h 0 (Wa.get h (s - 1)); Wa.rem_last h; down h 0) else Wa.rem_last h end; match v with None -> take h | v -> v end let delayed_rank = max_int module Step = struct (* Update steps. *) type t = step let nil = { over = true; heap = Wa.create 0; eops = []; cops = []} let create () = let h = Wa.create 11 in { over = false; heap = h; eops = []; cops = []} let add c n = if n.stamp == c then () else (n.stamp <- c; H.add c.heap n) let add_deps c n = Wa.iter (add c) n.deps let add_eop c op = c.eops <- op :: c.eops let add_cop c op = c.cops <- op :: c.cops let allow_reschedule n = n.stamp <- nil let rebuild c = H.rebuild c.heap let rec execute c = let eops c = List.iter (fun op -> op ()) c.eops; c.eops <- [] in let cops c = List.iter (fun op -> op ()) c.cops; c.cops <- [] in let finish c = c.over <- true; c.heap <- Wa.create 0 in let rec update c = match H.take c.heap with | Some n when n.rank <> delayed_rank -> n.update c; update c | Some n -> let c' = create () in eops c; List.iter (fun n -> n.update c') (n :: H.els c.heap); cops c; finish c; execute c' | None -> eops c; cops c; finish c in update c let execute c = if c.over then invalid_arg err_step_executed else execute c let find_unfinished nl = (* find unfinished step in recursive producers. *) let rec aux next = function (* zig-zag breadth-first search. *) | [] -> if next = [] then nil else aux [] next | [] :: todo -> aux next todo | nl :: todo -> find next todo nl and find next todo = function | [] -> aux next todo | n :: nl -> if not n.stamp.over then n.stamp else find (n.producers () :: next) todo nl in aux [] [ nl ] end module Node = struct let delayed_rank = delayed_rank let min_rank = min_int let max_rank = delayed_rank - 1 let nop _ = () let no_producers () = [] let create r = { rank = r; stamp = Step.nil; update = nop; retain = nop; producers = no_producers; deps = Wa.create 0 } let rem_dep n n' = Wa.rem n.deps n' let add_dep n n' = Wa.scan_add n.deps n' let has_dep n = not (Wa.is_empty n.deps) let deps n = Wa.fold (fun acc d -> d :: acc) [] n.deps let bind n p u = n.producers <- p; n.update <- u let stop ?(strong = false) n = if not strong then begin n.producers <- no_producers; n.update <- nop; Wa.clear n.deps; end else begin let rec loop next to_rem = function | [] -> begin match next with | (to_rem, prods) :: next -> loop next to_rem prods | [] -> () end | n :: todo -> rem_dep n to_rem; (* N.B. rem_dep could be combined with has_dep *) if n.rank = min_rank (* is a primitive *) || has_dep n then loop next to_rem todo else begin let prods = n.producers () in n.producers <- no_producers; n.update <- nop; Wa.clear n.deps; loop ((n, prods) :: next) to_rem todo end in let producers = n.producers () in n.producers <- no_producers; n.update <- nop; Wa.clear n.deps; loop [] n producers end let set_rank n r = n.rank <- r let rmin = create min_rank let rmax n n' = if n.rank > n'.rank then n else n' let rsucc n = if n.rank = delayed_rank then min_rank else if n.rank < max_rank then n.rank + 1 else invalid_arg err_max_rank let rsucc2 n n' = let r = rsucc n in let r' = rsucc n' in if r > r' then r else r' (* Rank updates currently only increases ranks. If this is problematic udpate ranks orthodoxly by taking the succ of the max of n.producers. Note that rank update stops at delayed nodes (otherwise we would loop and blow the ranks). *) let update_rank n r = (* returns true iff n's rank increased. *) let rec aux = function | [] -> () | n :: todo -> let update todo d = if n.rank < d.rank || n.rank = delayed_rank then todo else (d.rank <- rsucc n; d :: todo) in aux (Wa.fold update todo n.deps) in if r > n.rank then (n.rank <- r; aux [ n ]; true) else false end (* Shortcuts *) let rsucc = Node.rsucc let rsucc2 = Node.rsucc2 let rmax = Node.rmax (* Event value, creation and update *) let eval m = match !(m.ev) with Some v -> v | None -> assert false let emut rank = { ev = ref None; enode = Node.create rank } let event m p u = Node.bind m.enode p u; Emut m let eupdate v m c = let clear v () = v := None in m.ev := Some v; Step.add_cop c (clear m.ev); Step.add_deps c m.enode (* Signal value, creation and update *) let sval m = match m.sv with Some v -> v | None -> assert false let smut rank eq = { sv = None; eq = eq; snode = Node.create rank } let signal ?i m p u = Node.bind m.snode p u; begin match i with Some _ as v -> m.sv <- v | None -> () end; begin match Step.find_unfinished (m.snode.producers ()) with | c when c == Step.nil -> m.snode.update Step.nil | c -> Step.add c m.snode end; Smut m let supdate v m c = match m.sv with | Some v' when (m.eq v v') -> () | Some _ -> m.sv <- Some v; if c != Step.nil then Step.add_deps c m.snode | None -> m.sv <- Some v (* init. without init value. *) module E = struct type 'a t = 'a event let add_dep m n = Node.add_dep m.enode n; if !(m.ev) <> None then Step.add m.enode.stamp n let send m ?step v = match step with (* sends an event occurence. *) | Some c -> if c.over then invalid_arg err_step_executed else if not m.enode.stamp.over then invalid_arg err_event_scheduled else m.enode.stamp <- c; eupdate v m c | None -> let c = Step.create () in m.enode.stamp <- c; eupdate v m c; Step.execute c (* Basics *) let never = Never let create () = let m = emut Node.min_rank in Emut m, send m let retain e c = match e with | Never -> invalid_arg err_retain_never | Emut m -> let c' = m.enode.retain in (m.enode.retain <- c); (`R c') let stop ?strong = function Never -> () | Emut m -> Node.stop ?strong m.enode let equal e e' = match e, e' with | Never, Never -> true | Never, _ | _, Never -> false | Emut m, Emut m' -> m == m' let trace ?(iff = Const true) t e = match iff with | Const false -> e | Const true -> begin match e with | Never -> e | Emut m -> let m' = emut (rsucc m.enode) in let rec p () = [ m.enode ] and u c = let v = eval m in t v; eupdate v m' c in add_dep m m'.enode; event m' p u end | Smut mc -> match e with | Never -> Never | Emut m -> let m' = emut (rsucc2 mc.snode m.enode) in let rec p () = [mc.snode; m.enode] and u c = match !(m.ev) with | None -> () (* mc updated. *) | Some v -> if (sval mc) then t v; eupdate v m' c in Node.add_dep mc.snode m'.enode; add_dep m m'.enode; event m' p u (* Transforming and filtering *) let once = function | Never -> Never | Emut m -> let m' = emut (rsucc m.enode) in let rec p () = [ m.enode ] and u c = Node.rem_dep m.enode m'.enode; eupdate (eval m) m' c; Node.stop m'.enode in add_dep m m'.enode; event m' p u let drop_once = function | Never -> Never | Emut m -> let m' = emut (rsucc m.enode) in let rec p () = [ m.enode ] and u c = (* first update. *) let u' c = eupdate (eval m) m' c in (* subsequent updates. *) Node.bind m'.enode p u' in add_dep m m'.enode; event m' p u let app ef = function | Never -> Never | Emut m -> match ef with | Never -> Never | Emut mf -> let m' = emut (rsucc2 m.enode mf.enode) in let rec p () = [ m.enode; mf.enode ] and u c = match !(mf.ev), !(m.ev) with | None, _ | _, None -> () | Some f, Some v -> eupdate (f v) m' c in add_dep m m'.enode; add_dep mf m'.enode; event m' p u let map f = function | Never -> Never | Emut m -> let m' = emut (rsucc m.enode) in let rec p () = [ m.enode ] and u c = eupdate (f (eval m)) m' c in add_dep m m'.enode; event m' p u let stamp e v = match e with | Never -> Never | Emut m -> let m' = emut (rsucc m.enode) in let rec p () = [ m.enode ] and u c = eupdate v m' c in add_dep m m'.enode; event m' p u let filter pred = function | Never -> Never | Emut m -> let m' = emut (rsucc m.enode) in let rec p () = [ m.enode ] and u c = let v = eval m in if pred v then eupdate v m' c else () in add_dep m m'.enode; event m' p u let fmap fm = function | Never -> Never | Emut m -> let m' = emut (rsucc m.enode) in let rec p () = [ m.enode ] and u c = match fm (eval m) with Some v -> eupdate v m' c | None -> () in add_dep m m'.enode; event m' p u let diff d = function | Never -> Never | Emut m -> let m' = emut (rsucc m.enode) in let last = ref None in let rec p () = [ m.enode ] and u c = let v = eval m in match !last with | None -> last := Some v | Some v' -> last := Some v; eupdate (d v v') m' c in add_dep m m'.enode; event m' p u let changes ?(eq = ( = )) = function | Never -> Never | Emut m -> let m' = emut (rsucc m.enode) in let last = ref None in let rec p () = [ m.enode ] and u c = let v = eval m in match !last with | None -> last := Some v; eupdate v m' c | Some v' -> last := Some v; if eq v v' then () else eupdate v m' c in add_dep m m'.enode; event m' p u let on c = function | Never -> Never | Emut m as e -> match c with | Const true -> e | Const false -> Never | Smut mc -> let m' = emut (rsucc2 m.enode mc.snode) in let rec p () = [ m.enode; mc.snode ] and u c = match !(m.ev) with | None -> () (* mc updated. *) | Some _ -> if (sval mc) then eupdate (eval m) m' c else () in add_dep m m'.enode; Node.add_dep mc.snode m'.enode; event m' p u let when_ = on let dismiss c = function | Never -> Never | Emut m as e -> match c with | Never -> e | Emut mc -> let m' = emut (rsucc2 mc.enode m.enode) in let rec p () = [ mc.enode; m.enode ] and u c = match !(mc.ev) with | Some _ -> () | None -> eupdate (eval m) m' c in add_dep mc m'.enode; add_dep m m'.enode; event m' p u let until c = function | Never -> Never | Emut m as e -> match c with | Never -> e | Emut mc -> let m' = emut (rsucc2 m.enode mc.enode) in let rec p () = [ m.enode; mc.enode] in let u c = match !(mc.ev) with | None -> eupdate (eval m) m' c | Some _ -> Node.rem_dep m.enode m'.enode; Node.rem_dep mc.enode m'.enode; Node.stop m'.enode in add_dep m m'.enode; add_dep mc m'.enode; event m' p u (* Accumulating *) let accum ef i = match ef with | Never -> Never | Emut m -> let m' = emut (rsucc m.enode) in let acc = ref i in let rec p () = [ m.enode ] and u c = acc := (eval m) !acc; eupdate !acc m' c in add_dep m m'.enode; event m' p u let fold f i = function | Never -> Never | Emut m -> let m' = emut (rsucc m.enode) in let acc = ref i in let rec p () = [ m.enode ] and u c = acc := f !acc (eval m); eupdate !acc m' c in add_dep m m'.enode; event m' p u (* Combining *) let occurs m = !(m.ev) <> None let find_muts_and_next_rank el = let rec aux acc max = function | [] -> List.rev acc, rsucc max | (Emut m) :: l -> aux (m :: acc) (rmax max m.enode) l | Never :: l -> aux acc max l in aux [] Node.rmin el let select el = let emuts, r = find_muts_and_next_rank el in let m' = emut r in let rec p () = List.rev_map (fun m -> m.enode) emuts and u c = try eupdate (eval (List.find occurs emuts)) m' c with | Not_found -> assert false in List.iter (fun m -> add_dep m m'.enode) emuts; event m' p u let merge f a el = let rec fold f acc = function | m :: l when occurs m -> fold f (f acc (eval m)) l | m :: l -> fold f acc l | [] -> acc in let emuts, r = find_muts_and_next_rank el in let m' = emut r in let rec p () = List.rev_map (fun m -> m.enode) emuts and u c = eupdate (fold f a emuts) m' c in List.iter (fun m -> add_dep m m'.enode) emuts; event m' p u let switch e = function | Never -> e | Emut ms -> let r = match e with | Emut m -> rsucc2 m.enode ms.enode | Never -> rsucc ms.enode in let m' = emut r in let src = ref e in (* current event source. *) let rec p () = match !src with | Emut m -> [ m.enode; ms.enode ] | Never -> [ ms.enode ] and u c = match !(ms.ev) with | None -> (match !src with (* only src occurs. *) | Emut m -> eupdate (eval m) m' c | Never -> assert false) | Some e -> begin match !src with | Emut m -> Node.rem_dep m.enode m'.enode | Never -> () end; src := e; match e with | Never -> ignore (Node.update_rank m'.enode (rsucc ms.enode)) | Emut m -> Node.add_dep m.enode m'.enode; if Node.update_rank m'.enode (rsucc2 m.enode ms.enode) then begin (* Rank increased because of m. Thus m may stil update and we may be rescheduled. If it happens we'll be in the other branch without any harm but some redundant computation. *) Step.allow_reschedule m'.enode; Step.rebuild c; end else (* No rank increase, m already updated if needed. *) (match !(m.ev) with Some v -> eupdate v m' c | None -> ()) in (match e with Emut m -> add_dep m m'.enode | Never -> ()); add_dep ms m'.enode; event m' p u let fix f = let m = emut Node.delayed_rank in let e = event m (fun () -> []) (fun _ -> assert false) in match f e with | Never, r -> r | Emut m', r -> if m'.enode.rank = Node.delayed_rank then invalid_arg err_fix; let rec p () = [ (* avoid cyclic dep. *) ] and u c = (* N.B. c is the next step. *) let clear v () = v := None in m.ev := Some (eval m'); Step.add_eop c (clear m.ev); (* vs. add_cop for regular events. *) Step.add_deps c m.enode in Node.bind m.enode p u; add_dep m' m.enode; r (* Lifting *) let l1 = map let l2 f e0 e1 = match e0, e1 with | Never, _ -> Never | _, Never -> Never | Emut m0, Emut m1 -> let r = rsucc2 m0.enode m1.enode in let m' = emut r in let rec p () = [ m0.enode; m1.enode ] in let u c = match !(m0.ev), !(m1.ev) with | None, _ | _, None -> () | Some v0, Some v1 -> eupdate (f v0 v1) m' c in add_dep m0 m'.enode; add_dep m1 m'.enode; event m' p u let l3 f e0 e1 e2 = match e0, e1, e2 with | Never, _, _ -> Never | _, Never, _ -> Never | _, _, Never -> Never | Emut m0, Emut m1, Emut m2 -> let r = rsucc (rmax (rmax m0.enode m1.enode) m2.enode) in let m' = emut r in let rec p () = [ m0.enode; m1.enode; m2.enode ] in let u c = match !(m0.ev), !(m1.ev), !(m2.ev) with | None, _, _ | _, None, _ | _, _, None -> () | Some v0, Some v1, Some v2 -> eupdate (f v0 v1 v2) m' c in add_dep m0 m'.enode; add_dep m1 m'.enode; add_dep m2 m'.enode; event m' p u let l4 f e0 e1 e2 e3 = match e0, e1, e2, e3 with | Never, _, _, _ -> Never | _, Never, _, _ -> Never | _, _, Never, _ -> Never | _, _, _, Never -> Never | Emut m0, Emut m1, Emut m2, Emut m3 -> let r = rsucc (rmax (rmax m0.enode m1.enode) (rmax m2.enode m3.enode)) in let m' = emut r in let rec p () = [ m0.enode; m1.enode; m2.enode; m3.enode ] in let u c = match !(m0.ev), !(m1.ev), !(m2.ev), !(m3.ev) with | None, _, _, _ | _, None, _, _ | _, _, None, _ | _, _, _, None -> () | Some v0, Some v1, Some v2, Some v3 -> eupdate (f v0 v1 v2 v3) m' c in add_dep m0 m'.enode; add_dep m1 m'.enode; add_dep m2 m'.enode; add_dep m3 m'.enode; event m' p u let l5 f e0 e1 e2 e3 e4 = match e0, e1, e2, e3, e4 with | Never, _, _, _, _ -> Never | _, Never, _, _, _ -> Never | _, _, Never, _, _ -> Never | _, _, _, Never, _ -> Never | _, _, _, _, Never -> Never | Emut m0, Emut m1, Emut m2, Emut m3, Emut m4 -> let r = rsucc (rmax (rmax (rmax m0.enode m1.enode) (rmax m2.enode m3.enode)) m4.enode) in let m' = emut r in let rec p () = [ m0.enode; m1.enode; m2.enode; m3.enode; m4.enode ] in let u c = match !(m0.ev), !(m1.ev), !(m2.ev), !(m3.ev), !(m4.ev) with | None, _, _, _, _ | _, None, _, _, _ | _, _, None, _, _ | _, _, _, None, _ | _, _, _, _, None -> () | Some v0, Some v1, Some v2, Some v3, Some v4 -> eupdate (f v0 v1 v2 v3 v4) m' c in add_dep m0 m'.enode; add_dep m1 m'.enode; add_dep m2 m'.enode; add_dep m3 m'.enode; add_dep m4 m'.enode; event m' p u let l6 f e0 e1 e2 e3 e4 e5 = match e0, e1, e2, e3, e4, e5 with | Never, _, _, _, _, _ -> Never | _, Never, _, _, _, _ -> Never | _, _, Never, _, _, _ -> Never | _, _, _, Never, _, _ -> Never | _, _, _, _, Never, _ -> Never | _, _, _, _, _, Never -> Never | Emut m0, Emut m1, Emut m2, Emut m3, Emut m4, Emut m5 -> let r = rsucc (rmax (rmax (rmax m0.enode m1.enode) (rmax m2.enode m3.enode)) (rmax m4.enode m5.enode)) in let m' = emut r in let rec p () = [ m0.enode; m1.enode; m2.enode; m3.enode; m4.enode; m5.enode; ] in let u c = match !(m0.ev), !(m1.ev), !(m2.ev), !(m3.ev), !(m4.ev), !(m5.ev) with | None, _, _, _, _, _ | _, None, _, _, _, _ | _, _, None, _, _, _ | _, _, _, None, _, _ | _, _, _, _, None, _ | _, _, _, _, _, None -> () | Some v0, Some v1, Some v2, Some v3, Some v4, Some v5 -> eupdate (f v0 v1 v2 v3 v4 v5) m' c in add_dep m0 m'.enode; add_dep m1 m'.enode; add_dep m2 m'.enode; add_dep m3 m'.enode; add_dep m4 m'.enode; add_dep m5 m'.enode; event m' p u (* Stdlib support *) module Option = struct let some e = map (fun v -> Some v) e let value ?default e = match default with | None -> fmap (fun v -> v) e | Some (Const dv) -> map (function None -> dv | Some v -> v) e | Some (Smut ms) -> match e with | Never -> Never | Emut m -> let m' = emut (rsucc2 m.enode ms.snode) in let rec p () = [ m.enode; ms.snode ] and u c = match !(m.ev) with | None -> () (* ms updated. *) | Some None -> eupdate (sval ms) m' c | Some Some v -> eupdate v m' c in add_dep m m'.enode; Node.add_dep ms.snode m'.enode; event m' p u end end module S = struct type 'a t = 'a signal let set_sval v m c = m.sv <- Some v; Step.add_deps c m.snode let set m ?step v = (* starts an update step. *) if m.eq (sval m) v then () else match step with | Some c -> if c.over then invalid_arg err_step_executed else if not m.snode.stamp.over then invalid_arg err_signal_scheduled else m.snode.stamp <- c; m.sv <- Some v; Step.add_deps c m.snode | None -> let c = Step.create () in m.snode.stamp <- c; m.sv <- Some v; Step.add_deps c m.snode; Step.execute c let end_of_step_add_dep ?(post_add_op = fun () -> ()) ~stop_if_stopped m m' = (* In some combinators, when the semantics of event m' is such that it should not occur in the (potential) step it is created, we add the dependency [m'] to signal [m] only via an end of step operation to avoid being scheduled in the step. *) match Step.find_unfinished (m.snode.producers ()) with | c when c == Step.nil -> Node.add_dep m.snode m'.enode; post_add_op (); | c -> let add_dep () = if m.snode.update == Node.nop then (* m stopped in step *) (if stop_if_stopped then Node.stop m'.enode) else begin ignore (Node.update_rank m'.enode (rsucc m.snode)); Node.add_dep m.snode m'.enode; post_add_op (); end in Step.add_eop c add_dep (* Basics *) let const v = Const v let create ?(eq = ( = )) v = let m = smut Node.min_rank eq in m.sv <- Some v; Smut m, set m let retain s c = match s with | Const _ -> invalid_arg err_retain_cst_sig | Smut m -> let c' = m.snode.retain in m.snode.retain <- c; (`R c') let eq_fun = function Const _ -> None | Smut m -> Some m.eq let value = function | Const v | Smut { sv = Some v } -> v | Smut { sv = None } -> failwith err_sig_undef let stop ?strong = function | Const _ -> () | Smut m -> match m.sv with | Some _ -> Node.stop ?strong m.snode | None -> (* The signal was dynamically created and didn't update yet. Add the stop as an end of step operation. *) match Step.find_unfinished (m.snode.producers ()) with | c when c == Step.nil -> assert false | c -> let stop () = Node.stop ?strong m.snode in Step.add_eop c stop let equal ?(eq = ( = )) s s' = match s, s' with | Const v, Const v' -> eq v v' | Const _, _ | _, Const _ -> false | Smut m, Smut m' -> m == m' let trace ?(iff = const true) t s = match iff with | Const false -> s | Const true -> begin match s with | Const v -> t v; s | Smut m -> let m' = smut (rsucc m.snode) m.eq in let rec p () = [ m.snode ] in let u c = let v = sval m in t v; supdate v m' c in Node.add_dep m.snode m'.snode; signal m' p u end | Smut mc -> match s with | Const v -> let m' = smut (rsucc mc.snode) ( = ) (* we don't care about eq *) in let rec p () = [ mc.snode ] and u c = if (sval mc) then t v; Node.rem_dep mc.snode m'.snode; Node.stop m'.snode; in Node.add_dep mc.snode m'.snode; signal ~i:v m' p u | Smut m -> let m' = smut (rsucc2 mc.snode m.snode) m.eq in let rec p () = [ mc.snode; m.snode ] and u c = let v = sval m in match m'.sv with | Some v' when m'.eq v v' -> () (* mc updated. *) | _ -> if (sval mc) then t v; supdate v m' c (* init or diff. *) in Node.add_dep mc.snode m'.snode; Node.add_dep m.snode m'.snode; signal m' p u (* From events *) let hold ?(eq = ( = )) i = function | Never -> Const i | Emut m -> let m' = smut (rsucc m.enode) eq in let rec p () = [ m.enode ] and u c = match !(m.ev) with | None -> () (* init. only. *) | Some v -> supdate v m' c in E.add_dep m m'.snode; signal ~i m' p u (* Filtering and transforming *) let map ?(eq = ( = )) f = function | Const v -> Const (f v) | Smut m -> let m' = smut (rsucc m.snode) eq in let rec p () = [ m.snode ] and u c = supdate (f (sval m)) m' c in Node.add_dep m.snode m'.snode; signal m' p u let app ?(eq = ( = )) sf sv = match sf, sv with | Smut mf, Smut mv -> let m' = smut (rsucc2 mf.snode mv.snode) eq in let rec p () = [ mf.snode; mv.snode ] and u c = supdate ((sval mf) (sval mv)) m' c in Node.add_dep mf.snode m'.snode; Node.add_dep mv.snode m'.snode; signal m' p u | Const f, Const v -> Const (f v) | Const f, sv -> map ~eq f sv | Smut mf, Const v -> let m' = smut (rsucc mf.snode) eq in let rec p () = [ mf.snode ] and u c = supdate ((sval mf) v) m' c in Node.add_dep mf.snode m'.snode; signal m' p u let filter ?(eq = ( = )) pred i = function | Const v as s -> if pred v then s else Const i | Smut m -> let m' = smut (rsucc m.snode) eq in let rec p () = [ m.snode ] and u c = let v = sval m in if pred v then supdate v m' c else () in Node.add_dep m.snode m'.snode; signal ~i m' p u let fmap ?(eq = ( = )) fm i = function | Const v -> (match fm v with Some v' -> Const v' | None -> Const i) | Smut m -> let m' = smut (rsucc m.snode) eq in let rec p () = [ m.snode ] and u c = match fm (sval m) with Some v -> supdate v m' c | None -> () in Node.add_dep m.snode m'.snode; signal ~i m' p u let diff d = function | Const _ -> Never | Smut m -> let m' = emut (rsucc m.snode) in let last = ref None in let rec p () = [ m.snode ] and u c = let v = sval m in match !last with | Some v' -> last := Some v; eupdate (d v v') m' c | None -> assert false in let post_add_op () = last := Some (sval m) in end_of_step_add_dep ~post_add_op ~stop_if_stopped:true m m'; event m' p u let changes = function | Const _ -> Never | Smut m -> let m' = emut (rsucc m.snode) in let rec p () = [ m.snode ] and u c = eupdate (sval m) m' c in end_of_step_add_dep ~stop_if_stopped:true m m'; event m' p u let sample f e = function | Const v -> E.map (fun ev -> f ev v) e | Smut ms -> match e with | Never -> Never | Emut me -> let m' = emut (rsucc2 me.enode ms.snode) in let rec p () = [ me.enode; ms.snode ] and u c = match !(me.ev) with | None -> () (* ms updated *) | Some v -> eupdate (f v (sval ms)) m' c in E.add_dep me m'.enode; Node.add_dep ms.snode m'.enode; event m' p u let on ?(eq = ( = )) c i s = match c with | Const true -> s | Const false -> Const i | Smut mc -> match s with | Const v -> let m' = smut (rsucc mc.snode) eq in let rec p () = [ mc.snode ] and u c = if (sval mc) then supdate v m' c else () in Node.add_dep mc.snode m'.snode; signal ~i m' p u | Smut ms -> let m' = smut (rsucc2 mc.snode ms.snode) eq in let rec p () = [ mc.snode; ms.snode ] and u c = if (sval mc) then supdate (sval ms) m' c else () in Node.add_dep mc.snode m'.snode; Node.add_dep ms.snode m'.snode; signal ~i m' p u let when_ = on let dismiss ?(eq = ( = )) c i s = match c with | Never -> s | Emut mc -> match s with | Const v -> let m' = smut (rsucc mc.enode) eq in let rec p () = [ mc.enode ] and u c = match !(mc.ev) with | Some _ -> () | None -> supdate v m' c in Node.add_dep mc.enode m'.snode; signal ~i m' p u | Smut ms -> let m' = smut (rsucc2 mc.enode ms.snode) eq in let rec p () = [ mc.enode; ms.snode ] and u c = match !(mc.ev) with | Some _ -> () | None -> supdate (sval ms) m' c in Node.add_dep mc.enode m'.snode; Node.add_dep ms.snode m'.snode; signal ~i m' p u (* Accumulating *) let accum ?(eq = ( = )) ef i = match ef with | Never -> Const i | Emut m -> let m' = smut (rsucc m.enode) eq in let rec p () = [ m.enode ] and u c = match !(m.ev) with | None -> () (* init only. *) | Some v -> supdate (v (sval m')) m' c in E.add_dep m m'.snode; signal ~i m' p u let fold ?(eq = ( = )) f i = function | Never -> Const i | Emut m -> let m' = smut (rsucc m.enode) eq in let rec p () = [ m.enode ] and u c = match !(m.ev) with | None -> () (* init only. *) | Some v -> supdate (f (sval m') v) m' c in E.add_dep m m'.snode; signal ~i m' p u (* Combining *) let merge ?(eq = ( = )) f a sl = let rmax' acc = function Const _ -> acc | Smut m -> rmax acc m.snode in let nodes acc = function Const _ -> acc | Smut m -> m.snode :: acc in let merger f a = function Const v -> f a v | Smut m -> f a (sval m) in let m' = smut (rsucc (List.fold_left rmax' Node.rmin sl)) eq in let rec p () = List.fold_left nodes [] sl and u c = supdate (List.fold_left (merger f) a sl) m' c in let dep = function Const _ -> ()| Smut m -> Node.add_dep m.snode m'.snode in List.iter dep sl; signal m' p u let switch ?(eq = ( = )) = function | Const s -> s | Smut mss -> let dummy = smut Node.min_rank eq in let src = ref (Smut dummy) in (* dummy is overwritten by sig. init *) let m' = smut (rsucc mss.snode) eq in let rec p () = match !src with | Smut m -> [ mss.snode; m.snode] | Const _ -> [ mss.snode ] and u c = if (sval mss) == !src then (* ss didn't change, !src did *) begin match !src with | Smut m -> supdate (sval m) m' c | Const _ -> () (* init only. *) end else (* ss changed *) begin begin match !src with | Smut m -> Node.rem_dep m.snode m'.snode | Const _ -> () end; let new_src = sval mss in src := new_src; match new_src with | Const v -> ignore (Node.update_rank m'.snode (rsucc mss.snode)); supdate v m' c | Smut m -> Node.add_dep m.snode m'.snode; if c == Step.nil then begin ignore (Node.update_rank m'.snode (rsucc2 m.snode mss.snode)); (* Check if the init src is in a step. *) match Step.find_unfinished [m.snode] with | c when c == Step.nil -> supdate (sval m) m' c | c -> Step.add c m'.snode end else if Node.update_rank m'.snode (rsucc2 m.snode mss.snode) then begin (* Rank increased because of m. Thus m may still update and we need to reschedule. Next time we will be in the other branch. *) Step.allow_reschedule m'.snode; Step.rebuild c; Step.add c m'.snode end else (* No rank increase. m already updated if needed, no need to reschedule and rebuild the queue. *) supdate (sval m) m' c end in Node.add_dep mss.snode m'.snode; (* We add a dep to dummy to avoid a long scan of Wa.rem when we remove the dep in the [u] function during static init. *) Node.add_dep dummy.snode m'.snode; signal m' p u let bind ?eq s sf = switch ?eq (map ~eq:( == ) sf s) let fix ?(eq = ( = )) i f = let update_delayed n p u nl = Node.bind n p u; match Step.find_unfinished nl with | c when c == Step.nil -> (* no pertinent occuring step, create a step for update. *) let c = Step.create () in n.update c; Step.execute c | c -> Step.add c n in let m = smut Node.delayed_rank eq in let s = signal ~i m (fun () -> []) (fun _ -> ()) in match f s with | Const v, r -> let rec p () = [] and u c = supdate v m c in update_delayed m.snode p u (Node.deps m.snode); r | Smut m', r -> if m'.snode.rank = Node.delayed_rank then invalid_arg err_fix; let rec p () = [ (* avoid cyclic dep. *) ] and u c = supdate (sval m') m c in (* N.B. c is the next step. *) Node.add_dep m'.snode m.snode; update_delayed m.snode p u (m'.snode :: Node.deps m.snode); r (* Lifting *) let l1 = map let l2 ?(eq = ( = )) f s s' = match s, s' with | Smut m0, Smut m1 -> let m' = smut (rsucc2 m0.snode m1.snode) eq in let rec p () = [ m0.snode; m1.snode ] and u c = supdate (f (sval m0) (sval m1)) m' c in Node.add_dep m0.snode m'.snode; Node.add_dep m1.snode m'.snode; signal m' p u | Const v, Const v' -> Const (f v v') | Const v, Smut m -> let m' = smut (rsucc m.snode) eq in let rec p () = [ m.snode ] and u c = supdate (f v (sval m)) m' c in Node.add_dep m.snode m'.snode; signal m' p u | Smut m, Const v -> let m' = smut (rsucc m.snode) eq in let rec p () = [ m.snode ] and u c = supdate (f (sval m) v) m' c in Node.add_dep m.snode m'.snode; signal m' p u let l3 ?(eq = ( = )) f s0 s1 s2 = match s0, s1, s2 with | Smut m0, Smut m1, Smut m2 -> let r = rsucc (rmax (rmax m0.snode m1.snode) m2.snode) in let m' = smut r eq in let rec p () = [ m0.snode; m1.snode; m2.snode ] and u c = supdate (f (sval m0) (sval m1) (sval m2)) m' c in Node.add_dep m0.snode m'.snode; Node.add_dep m1.snode m'.snode; Node.add_dep m2.snode m'.snode; signal m' p u | Const v0, Const v1, Const v2 -> Const (f v0 v1 v2) | s0, s1, s2 -> app ~eq (l2 ~eq:( == ) f s0 s1) s2 let l4 ?(eq = ( = )) f s0 s1 s2 s3 = match s0, s1, s2, s3 with | Smut m0, Smut m1, Smut m2, Smut m3 -> let r = rsucc (rmax (rmax m0.snode m1.snode) (rmax m2.snode m3.snode)) in let m' = smut r eq in let rec p () = [ m0.snode; m1.snode; m2.snode; m3.snode ] and u c = supdate (f (sval m0) (sval m1) (sval m2) (sval m3)) m' c in Node.add_dep m0.snode m'.snode; Node.add_dep m1.snode m'.snode; Node.add_dep m2.snode m'.snode; Node.add_dep m3.snode m'.snode; signal m' p u | Const v0, Const v1, Const v2, Const v3 -> Const (f v0 v1 v2 v3) | s0, s1, s2, s3 -> app ~eq (l3 ~eq:( == ) f s0 s1 s2) s3 let l5 ?(eq = ( = )) f s0 s1 s2 s3 s4 = match s0, s1, s2, s3, s4 with | Smut m0, Smut m1, Smut m2, Smut m3, Smut m4 -> let m = rmax in let r = rsucc (m (m m0.snode m1.snode) (m m2.snode (m m3.snode m4.snode))) in let m' = smut r eq in let rec p () = [ m0.snode; m1.snode; m2.snode; m3.snode; m4.snode ] and u c = let v = f (sval m0) (sval m1) (sval m2) (sval m3) (sval m4) in supdate v m' c in Node.add_dep m0.snode m'.snode; Node.add_dep m1.snode m'.snode; Node.add_dep m2.snode m'.snode; Node.add_dep m3.snode m'.snode; Node.add_dep m4.snode m'.snode; signal m' p u | Const v0, Const v1, Const v2, Const v3, Const v4 -> Const (f v0 v1 v2 v3 v4) | s0, s1, s2, s3, s4 -> app ~eq (l4 ~eq:( == ) f s0 s1 s2 s3) s4 let l6 ?(eq = ( = )) f s0 s1 s2 s3 s4 s5 = match s0, s1, s2, s3, s4, s5 with | Smut m0, Smut m1, Smut m2, Smut m3, Smut m4, Smut m5 -> let m = rmax in let m = m (m m0.snode (m m1.snode m2.snode)) (m m3.snode (m m4.snode m5.snode)) in let m' = smut (rsucc m) eq in let rec p () = [ m0.snode; m1.snode; m2.snode; m3.snode; m4.snode; m5.snode ] and u c = let v = f (sval m0) (sval m1) (sval m2) (sval m3) (sval m4) (sval m5) in supdate v m' c in Node.add_dep m0.snode m'.snode; Node.add_dep m1.snode m'.snode; Node.add_dep m2.snode m'.snode; Node.add_dep m3.snode m'.snode; Node.add_dep m4.snode m'.snode; Node.add_dep m5.snode m'.snode; signal m' p u | Const v0, Const v1, Const v2, Const v3, Const v4, Const v5-> Const (f v0 v1 v2 v3 v4 v5) | s0, s1, s2, s3, s4, s5 -> app ~eq (l5 ~eq:( == ) f s0 s1 s2 s3 s4) s5 module Bool = struct let stdlib_not = not let one = Const true let zero = Const false let eq : bool -> bool -> bool = ( = ) let not s = l1 ~eq stdlib_not s let ( && ) s s' = l2 ~eq ( && ) s s' let ( || ) s s' = l2 ~eq ( || ) s s' let edge s = changes s let edge_detect edge = function | Const _ -> Never | Smut m -> let m' = emut (rsucc m.snode) in let rec p () = [ m.snode ] and u c = if (sval m) = edge then eupdate () m' c in end_of_step_add_dep ~stop_if_stopped:true m m'; event m' p u let rise s = edge_detect true s let fall s = edge_detect false s let flip b = function | Never -> Const b | Emut m -> let m' = smut (rsucc m.enode) ( = ) in let rec p () = [ m.enode ] and u c = match !(m.ev) with | None -> () | Some _ -> supdate (stdlib_not (sval m')) m' c in E.add_dep m m'.snode; signal ~i:b m' p u end module Int = struct let zero = Const 0 let one = Const 1 let minus_one = Const (-1) let eq : int -> int -> bool = ( = ) let ( ~- ) s = l1 ~eq ( ~- ) s let succ s = l1 ~eq succ s let pred s = l1 ~eq pred s let ( + ) s s' = l2 ~eq ( + ) s s' let ( - ) s s' = l2 ~eq ( - ) s s' let ( * ) s s' = l2 ~eq ( * ) s s' let ( mod ) s s' = l2 ~eq ( mod ) s s' let abs s = l1 ~eq abs s let max_int = const max_int let min_int = const min_int let ( land ) s s' = l2 ~eq ( land ) s s' let ( lor ) s s' = l2 ~eq ( lor ) s s' let ( lxor ) s s' = l2 ~eq ( lxor ) s s' let lnot s = l1 ~eq lnot s let ( lsl ) s s' = l2 ~eq ( lsl ) s s' let ( lsr ) s s' = l2 ~eq ( lsr ) s s' let ( asr ) s s' = l2 ~eq ( asr ) s s' end module Float = struct let zero = Const 0. let one = Const 1. let minus_one = Const (-1.) let eq : float -> float -> bool = ( = ) let ( ~-. ) s = l1 ~eq ( ~-. ) s let ( +. ) s s' = l2 ~eq ( +. ) s s' let ( -. ) s s' = l2 ~eq ( -. ) s s' let ( *. ) s s' = l2 ~eq ( *. ) s s' let ( /. ) s s' = l2 ~eq ( /. ) s s' let ( ** ) s s' = l2 ~eq ( ** ) s s' let sqrt s = l1 ~eq sqrt s let exp s = l1 ~eq exp s let log s = l1 ~eq log s let log10 s = l1 ~eq log10 s let cos s = l1 ~eq cos s let sin s = l1 ~eq sin s let tan s = l1 ~eq tan s let acos s = l1 ~eq acos s let asin s = l1 ~eq asin s let atan s = l1 ~eq atan s let atan2 s s' = l2 ~eq atan2 s s' let cosh s = l1 ~eq cosh s let sinh s = l1 ~eq sinh s let tanh s = l1 ~eq tanh s let ceil s = l1 ~eq ceil s let floor s = l1 ~eq floor s let abs_float s = l1 ~eq abs_float s let mod_float s s' = l2 ~eq mod_float s s' let frexp s = l1 ~eq:( = ) frexp s let ldexp s s' = l2 ~eq ldexp s s' let modf s = l1 ~eq:( = ) modf s let float s = l1 ~eq float s let float_of_int s = l1 ~eq float_of_int s let truncate s = l1 ~eq:Int.eq truncate s let int_of_float s = l1 ~eq:Int.eq int_of_float s let infinity = const infinity let neg_infinity = const neg_infinity let nan = const nan let max_float = const max_float let min_float = const min_float let epsilon_float = const epsilon_float let classify_float s = l1 ~eq:( = ) classify_float s end module Pair = struct let pair ?eq s s' = l2 ?eq (fun x y -> x, y) s s' let fst ?eq s = l1 ?eq fst s let snd ?eq s = l1 ?eq snd s end module Option = struct let none = Const None let some s = let eq = match eq_fun s with | None -> None | Some eq -> let eq v v' = match v, v' with | Some v, Some v' -> eq v v' | _ -> assert false in Some eq in map ?eq (fun v -> Some v) s let value ?(eq = ( = )) ~default s = match s with | Const (Some v) -> Const v | Const None -> begin match default with | `Always d -> d | `Init d -> begin match d with | Const d -> Const d | Smut md -> match Step.find_unfinished [md.snode] with | c when c == Step.nil -> Const (sval md) | c -> let m' = smut (rsucc md.snode) eq in let rec p () = [ md.snode ] and u c = Node.rem_dep md.snode m'.snode; supdate (sval md) m' c; Node.stop m'.snode in Node.add_dep md.snode m'.snode; signal m' p u end end | Smut m -> match default with | `Init (Const d) -> fmap ~eq (fun v -> v) d s | `Always (Const d) -> map ~eq (function None -> d | Some v -> v) s | `Init (Smut md) -> begin match Step.find_unfinished [md.snode] with | c when c == Step.nil -> let m' = smut (rsucc m.snode) eq in let rec p () = [ m.snode ] and u c = match sval m with | Some v -> supdate v m' c | None -> () in Node.add_dep m.snode m'.snode; signal ~i:(sval md) m' p u | c -> let m' = smut (rsucc2 m.snode md.snode) eq in let rec p () = [ m.snode ] in (* subsequent updates *) let u c = match sval m with | Some v -> supdate v m' c | None -> () in let rec p_first () = [ m.snode; md.snode ] in (* first update *) let u_first c = Node.rem_dep md.snode m'.snode; begin match sval m with | None -> supdate (sval md) m' c | Some v -> supdate v m' c end; Node.bind m'.snode p u in Node.add_dep m.snode m'.snode; Node.add_dep md.snode m'.snode; signal m' p_first u_first end | `Always (Smut md) -> let m' = smut (rsucc2 m.snode md.snode) eq in let rec p () = [ m.snode; md.snode ] in let u c = match sval m with | Some v -> supdate v m' c | None -> supdate (sval md) m' c in Node.add_dep m.snode m'.snode; Node.add_dep md.snode m'.snode; signal m' p u end module Compare = struct let eq = Bool.eq let ( = ) s s' = l2 ~eq ( = ) s s' let ( <> ) s s' = l2 ~eq ( <> ) s s' let ( < ) s s' = l2 ~eq ( < ) s s' let ( > ) s s' = l2 ~eq ( > ) s s' let ( <= ) s s' = l2 ~eq ( <= ) s s' let ( >= ) s s' = l2 ~eq ( >= ) s s' let compare s s' = l2 ~eq:Int.eq compare s s' let ( == ) s s' = l2 ~eq ( == ) s s' let ( != ) s s' = l2 ~eq ( != ) s s' end (* Combinator specialization *) module type EqType = sig type 'a t val equal : 'a t -> 'a t -> bool end module type S = sig type 'a v val create : 'a v -> 'a v signal * (?step:step -> 'a v -> unit) val equal : 'a v signal -> 'a v signal -> bool val hold : 'a v -> 'a v event -> 'a v signal val app : ('a -> 'b v) signal -> 'a signal -> 'b v signal val map : ('a -> 'b v) -> 'a signal -> 'b v signal val filter : ('a v -> bool) -> 'a v -> 'a v signal -> 'a v signal val fmap : ('a -> 'b v option) -> 'b v -> 'a signal -> 'b v signal val when_ : bool signal -> 'a v -> 'a v signal -> 'a v signal val dismiss : 'b event -> 'a v -> 'a v signal -> 'a v signal val accum : ('a v -> 'a v) event -> 'a v -> 'a v signal val fold : ('a v -> 'b -> 'a v) -> 'a v -> 'b event -> 'a v signal val merge : ('a v -> 'b -> 'a v) -> 'a v -> 'b signal list -> 'a v signal val switch : 'a v signal signal -> 'a v signal val bind : 'b signal -> ('b -> 'a v signal) -> 'a v signal val fix : 'a v -> ('a v signal -> 'a v signal * 'b) -> 'b val l1 : ('a -> 'b v) -> ('a signal -> 'b v signal) val l2 : ('a -> 'b -> 'c v) -> ('a signal -> 'b signal -> 'c v signal) val l3 : ('a -> 'b -> 'c -> 'd v) -> ('a signal -> 'b signal -> 'c signal -> 'd v signal) val l4 : ('a -> 'b -> 'c -> 'd -> 'e v) -> ('a signal -> 'b signal -> 'c signal -> 'd signal -> 'e v signal) val l5 : ('a -> 'b -> 'c -> 'd -> 'e -> 'f v) -> ('a signal -> 'b signal -> 'c signal -> 'd signal -> 'e signal -> 'f v signal) val l6 : ('a -> 'b -> 'c -> 'd -> 'e -> 'f -> 'g v) -> ('a signal -> 'b signal -> 'c signal -> 'd signal -> 'e signal -> 'f signal -> 'g v signal) end module Make (Eq : EqType) = struct type 'a v = 'a Eq.t let eq = Eq.equal let create v = create ~eq v let equal s s' = equal ~eq s s' let hold v e = hold ~eq v e let app sf sv = app ~eq sf sv let map f s = map ~eq f s let filter pred i = filter ~eq pred i let fmap fm i = fmap ~eq fm i let when_ c i s = when_ ~eq c i s let dismiss c s = dismiss ~eq c s let accum ef i = accum ~eq ef i let fold f i = fold ~eq f i let merge f a sl = merge ~eq f a sl let switch s = switch ~eq s let bind s sf = bind ~eq s sf let fix f = fix ~eq f let l1 = map let l2 f s s' = l2 ~eq f s s' let l3 f s0 s1 s2 = l3 ~eq f s0 s1 s2 let l4 f s0 s1 s2 s3 = l4 ~eq f s0 s1 s2 s3 let l5 f s0 s1 s2 s3 s4 = l5 ~eq f s0 s1 s2 s3 s4 let l6 f s0 s1 s2 s3 s4 s5 = l6 ~eq f s0 s1 s2 s3 s4 s5 end module Special = struct module Sb = Make (struct type 'a t = bool let equal = Bool.eq end) module Si = Make (struct type 'a t = int let equal = Int.eq end) module Sf = Make (struct type 'a t = float let equal = Float.eq end) end end (*--------------------------------------------------------------------------- Copyright (c) 2009 The react programmers Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ---------------------------------------------------------------------------*)
(*--------------------------------------------------------------------------- Copyright (c) 2009 The react programmers. All rights reserved. Distributed under the ISC license, see terms at the end of the file. ---------------------------------------------------------------------------*)
dune
(rule (targets c_flags.sexp) (action (run configure/configure.exe -target %{targets})))
json.mli
(** In memory JSON data *) type json = [ `O of (string * json) list | `Bool of bool | `Float of float | `A of json list | `Null | `String of string ] (** Read a JSON document from a string. *) val from_string : string -> (json, string) result (** Write a JSON document to a string. This goes via an intermediate buffer and so may be slow on large documents. *) val to_string : json -> string (** Helpers for [Data_encoding] *) val cannot_destruct : ('a, Format.formatter, unit, 'b) format4 -> 'a val wrap_error : ('a -> 'b) -> 'a -> 'b
(*****************************************************************************) (* *) (* Open Source License *) (* Copyright (c) 2018 Dynamic Ledger Solutions, Inc. <contact@tezos.com> *) (* *) (* Permission is hereby granted, free of charge, to any person obtaining a *) (* copy of this software and associated documentation files (the "Software"),*) (* to deal in the Software without restriction, including without limitation *) (* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) (* and/or sell copies of the Software, and to permit persons to whom the *) (* Software is furnished to do so, subject to the following conditions: *) (* *) (* The above copyright notice and this permission notice shall be included *) (* in all copies or substantial portions of the Software. *) (* *) (* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) (* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) (* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) (* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) (* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) (* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) (* DEALINGS IN THE SOFTWARE. *) (* *) (*****************************************************************************)
pcl_positions.c
#include "pcl_positions.h" /*---------------------------------------------------------------------*/ /* Global Variables */ /*---------------------------------------------------------------------*/ /*---------------------------------------------------------------------*/ /* Forward Declarations */ /*---------------------------------------------------------------------*/ /*---------------------------------------------------------------------*/ /* Internal Functions */ /*---------------------------------------------------------------------*/ /*---------------------------------------------------------------------*/ /* Exported Functions */ /*---------------------------------------------------------------------*/ /*----------------------------------------------------------------------- // // Function: PCL2PosAlloc() // // Allocate an initialized PCL2 position data structure. // // Global Variables: - // // Side Effects : Memory operations // /----------------------------------------------------------------------*/ PCL2Pos_p PCL2PosAlloc(void) { PCL2Pos_p handle = PCL2PosCellAlloc(); handle->literal = -1; handle->side = NoSide; handle->termposlen = 0; handle->termpos = NULL; return handle; } /*----------------------------------------------------------------------- // // Function: PCL2PosFree() // // Free a PCL2 position. // // Global Variables: - // // Side Effects : Memory operations // /----------------------------------------------------------------------*/ void PCL2PosFree(PCL2Pos_p pos) { assert(pos); if(pos->termpos) { PDArrayFree(pos->termpos); } PCL2PosCellFree(pos); } /*----------------------------------------------------------------------- // // Function: PCL2PosParse() // // Parse a PCL2 position of the format // <pos-int> [. L|R [ .<pos-int> ]*]. // // Global Variables: - // // Side Effects : Input, memory operations // /----------------------------------------------------------------------*/ PCL2Pos_p PCL2PosParse(Scanner_p in) { PCL2Pos_p handle = PCL2PosAlloc(); long i; handle->literal = AktToken(in)->numval; AcceptInpTok(in, PosInt); if(TestInpTok(in, Fullstop)) { NextToken(in); CheckInpId(in, "L|R"); if(TestInpId(in, "L")) { handle->side = LeftSide; } else { handle->side = RightSide; } NextToken(in); if(TestInpTok(in, Fullstop)) { handle->termpos = PDArrayAlloc(5,10); } i=0; while(TestInpTok(in, Fullstop)) { NextToken(in); PDArrayAssignInt(handle->termpos,i++,AktToken(in)->numval); AcceptInpTok(in, PosInt); } handle->termposlen=i; } return handle; } /*----------------------------------------------------------------------- // // Function: PCL2PosPrint() // // Print a PCL2 position. // // Global Variables: - // // Side Effects : Output // /----------------------------------------------------------------------*/ void PCL2PosPrint(FILE* out, PCL2Pos_p pos) { long i; assert(pos); fprintf(out, "%ld", pos->literal); if(pos->side!=NoSide) { assert((pos->side==LeftSide) || (pos->side==RightSide)); fprintf(out, ".%c", (pos->side==LeftSide)?'L':'R'); i=0; while(i<pos->termposlen) { assert(pos->termpos); fprintf(out, "%ld", PDArrayElementInt(pos->termpos,i++)); } } } /*---------------------------------------------------------------------*/ /* End of File */ /*---------------------------------------------------------------------*/
/*----------------------------------------------------------------------- File : pcl_positions.c Author: Stephan Schulz Contents Positions in PCL2 clauses. Copyright 1998, 1999 by the author. This code is released under the GNU General Public Licence and the GNU Lesser General Public License. See the file COPYING in the main E directory for details.. Run "eprover -h" for contact information. Changes <1> Wed Mar 22 19:32:20 MET 2000 New -----------------------------------------------------------------------*/
Irc.ml
module Config = struct type t = { check_certificate: bool; proto: Ssl.protocol; } let default = { check_certificate=false; proto=Ssl.TLSv1_3; } end module Io_ssl = struct type 'a t = 'a let[@inline] (>>=) x f = f x let[@inline] (>|=) x f = f x let[@inline] return x = x type file_descr = { ssl: Ssl.context; sslsock: Ssl.socket; fd: Unix.file_descr; } type config = Config.t type inet_addr = Unix.inet_addr let open_socket ?(config=Config.default) addr port : file_descr t = let ssl = Ssl.create_context config.Config.proto Ssl.Client_context in if config.Config.check_certificate then begin (* from https://github.com/johnelse/ocaml-irc-client/pull/21 *) Ssl.set_verify_depth ssl 3; Ssl.set_verify ssl [Ssl.Verify_peer] (Some Ssl.client_verify_callback); Ssl.set_client_verify_callback_verbose true; end; let sock = Unix.socket Unix.PF_INET Unix.SOCK_STREAM 0 in let sockaddr = Unix.ADDR_INET (addr, port) in (* Printf.printf "connect socket…\n%!"; *) Unix.connect sock sockaddr; (* Printf.printf "Ssl.connect socket…\n%!"; *) let sslsock = Ssl.embed_socket sock ssl in Ssl.connect sslsock; {fd=sock; ssl; sslsock;} let close_socket {fd;sslsock=_;ssl=_} = Unix.close fd let read self i len = Ssl.read self.sslsock i len let write self s i len = Ssl.write self.sslsock s i len let read_with_timeout ~timeout:_ self buf off len = try Some (Ssl.read self.sslsock buf off len) with Unix.Unix_error (Unix.ETIMEDOUT, _, _) -> None let gethostbyname name = try let entry = Unix.gethostbyname name in let addrs = Array.to_list entry.Unix.h_addr_list in addrs with Not_found -> [] let iter = List.iter let sleep d = Unix.sleepf (float d) let catch f err = try f() with e -> err e let time = Unix.gettimeofday let pick = None end include Irc_client.Make(Io_ssl)
ccl_clausesets.h
#ifndef CCL_CLAUSESETS #define CCL_CLAUSESETS #include <ccl_inferencedoc.h> #include <ccl_derivation.h> #include <ccl_fcvindexing.h> #include <ccl_tautologies.h> #include <ccl_pdtrees.h> #include <clb_plist.h> #include <clb_objtrees.h> /*---------------------------------------------------------------------*/ /* Data type declarations */ /*---------------------------------------------------------------------*/ /* Clause sets are doubly linked lists of clauses with indices for the various potential evaluations. */ typedef struct clausesetcell { long members; /* How many clauses are there? */ long literals; /* And how many literals? */ Clause_p anchor; /* The clauses */ SysDate date; /* Age of the clause set, used for optimizing rewriting. The special date SysCreationDate() is used to indicate ignoring of dates when checking for irreducability. */ PDTree_p demod_index; /* If used for demodulators */ FVIAnchor_p fvindex; /* Used for non-unit subsumption */ PDArray_p eval_indices; long eval_no; DStr_p identifier; }ClauseSetCell, *ClauseSet_p; /*---------------------------------------------------------------------*/ /* Exported Functions and Variables */ /*---------------------------------------------------------------------*/ #define CLAUSECELL_DYN_MEM (CLAUSECELL_MEM+3*PTREE_CELL_MEM) #define ClauseSetCellAlloc() (ClauseSetCell*)SizeMalloc(sizeof(ClauseSetCell)) #define ClauseSetCellFree(junk) SizeFree(junk, sizeof(ClauseSetCell)) #define ClauseSetStorage(set)\ (((CLAUSECELL_DYN_MEM+EVAL_MEM((set)->eval_no))*(set)->members+\ EQN_CELL_MEM*(set)->literals)+\ PDTreeStorage(set->demod_index)+\ FVIndexStorage(set->fvindex)) ClauseSet_p ClauseSetAlloc(void); void ClauseSetFreeClauses(ClauseSet_p set); #define ClauseSetCardinality(set) ((set)->members) #define ClauseSetEmpty(set)\ ((set)->anchor->succ == (set)->anchor) long ClauseSetStackCardinality(PStack_p stack); void ClauseSetFree(ClauseSet_p junk); void ClauseSetGCMarkTerms(ClauseSet_p set); void ClauseSetInsert(ClauseSet_p set, Clause_p newclause); long ClauseSetInsertSet(ClauseSet_p set, ClauseSet_p from); void ClauseSetPDTIndexedInsert(ClauseSet_p set, Clause_p newclause); void ClauseSetIndexedInsert(ClauseSet_p set, FVPackedClause_p newclause); void ClauseSetIndexedInsertClause(ClauseSet_p set, Clause_p newclause); void ClauseSetIndexedInsertClauseSet(ClauseSet_p set, ClauseSet_p source); Clause_p ClauseSetExtractEntry(Clause_p clause); #define ClauseSetMoveClause(set, clause) \ ClauseSetExtractEntry(clause);ClauseSetInsert((set), (clause)) Clause_p ClauseSetExtractFirst(ClauseSet_p set); void ClauseSetDeleteEntry(Clause_p clause); Clause_p ClauseSetFindBest(ClauseSet_p set, int idx); void ClauseSetPrint(FILE* out, ClauseSet_p set, bool fullterms); void ClauseSetTSTPPrint(FILE* out, ClauseSet_p set, bool fullterms); void ClauseSetPrintPrefix(FILE* out, char* prefix, ClauseSet_p set); void ClauseSetSort(ClauseSet_p set, ComparisonFunctionType cmp_fun); void ClauseSetSetProp(ClauseSet_p set, FormulaProperties prop); void ClauseSetDelProp(ClauseSet_p set, FormulaProperties prop); void ClauseSetSetTPTPType(ClauseSet_p set, FormulaProperties type); long ClauseSetMarkCopies(ClauseSet_p set); long ClauseSetDeleteMarkedEntries(ClauseSet_p set); long ClauseSetDeleteCopies(ClauseSet_p set); long ClauseSetDeleteNonUnits(ClauseSet_p set); long ClauseSetGetTermNodes(ClauseSet_p set); long ClauseSetMarkSOS(ClauseSet_p set, bool tptp_types); void ClauseSetTermSetProp(ClauseSet_p set, TermProperties prop); long ClauseSetTBTermPropDelCount(ClauseSet_p set, TermProperties prop); long ClauseSetGetSharedTermNodes(ClauseSet_p set); long ClauseSetParseList(Scanner_p in, ClauseSet_p set, TB_p bank); void ClauseSetMarkMaximalTerms(OCB_p ocb, ClauseSet_p set); void ClauseSetSortLiterals(ClauseSet_p set, ComparisonFunctionType cmp_fun); SysDate ClauseSetListGetMaxDate(ClauseSet_p *demodulators, int limit); Clause_p ClauseSetFind(ClauseSet_p set, Clause_p clause); Clause_p ClauseSetFindById(ClauseSet_p set, long ident); void ClauseSetRemoveEvaluations(ClauseSet_p set); long ClauseSetFilterTrivial(ClauseSet_p set); long ClauseSetFilterTautologies(ClauseSet_p set, TB_p work_bank); Clause_p ClauseSetFindMaxStandardWeight(ClauseSet_p set); ClausePos_p ClauseSetFindEqDefinition(ClauseSet_p set, int min_arity, Clause_p start); void ClauseSetDocInital(FILE* out, long level, ClauseSet_p set); void ClauseSetDocQuote(FILE* out, long level, ClauseSet_p set, char* comment); void ClauseSetPropDocQuote(FILE* out, long level, FormulaProperties prop, ClauseSet_p set, char* comment); #define ClauseSetDocQuote(out, level, set, comment) \ ClauseSetPropDocQuote((out), (level),CPIgnoreProps, (set), (comment)) #ifndef NDBUG bool ClauseSetVerifyDemod(ClauseSet_p demods, ClausePos_p pos); bool PDTreeVerifyIndex(PDTree_p root, ClauseSet_p demods); #endif void EqAxiomsPrint(FILE* out, Sig_p sig, bool single_subst); void ClauseSetAddSymbolDistribution(ClauseSet_p set, long *dist_array); void ClauseSetAddTypeDistribution(ClauseSet_p set, long *type_array); void ClauseSetAddConjSymbolDistribution(ClauseSet_p set, long *dist_array); void ClauseSetAddAxiomSymbolDistribution(ClauseSet_p set, long *dist_array); void ClauseSetComputeFunctionRanks(ClauseSet_p set, long *rank_array, long* count); FunCode ClauseSetFindFreqSymbol(ClauseSet_p set, Sig_p sig, int arity, bool least); long ClauseSetMaxVarNumber(ClauseSet_p set); long ClauseSetFindCharFreqVectors(ClauseSet_p set, FreqVector_p fsum, FreqVector_p fmax, FreqVector_p fmin, FVCollect_p cspec); PermVector_p PermVectorCompute(ClauseSet_p set, FVCollect_p cspec, bool eliminate_uninformative); long ClauseSetFVIndexify(ClauseSet_p set); long ClauseSetNewTerms(ClauseSet_p set, TB_p terms); long ClauseSetSplitConjectures(ClauseSet_p set, PList_p conjectures, PList_p rest); long long ClauseSetStandardWeight(ClauseSet_p set); void ClauseSetDerivationStackStatistics(ClauseSet_p set); long ClauseSetPushClauses(PStack_p stack, ClauseSet_p set); void ClauseSetDefaultWeighClauses(ClauseSet_p set); long ClauseSetCountConjectures(ClauseSet_p set, long* hypos); bool ClauseSetIsUntyped(ClauseSet_p set); #endif /*---------------------------------------------------------------------*/ /* End of File */ /*---------------------------------------------------------------------*/
/*----------------------------------------------------------------------- File : ccl_clausesets.h Author: Stephan Schulz Contents Definitions dealing with collections of clauses Copyright 1998, 1999 by the author. This code is released under the GNU General Public Licence and the GNU Lesser General Public License. See the file COPYING in the main E directory for details.. Run "eprover -h" for contact information. Created: Sat Jul 5 02:28:25 MET DST 1997 -----------------------------------------------------------------------*/