-- LLVM back-end for ortho - Main subprogram. -- Copyright (C) 2014 Tristan Gingold -- -- GHDL 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 2, or (at your option) any later -- version. -- -- GHDL 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 GCC; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. with Ada.Command_Line; use Ada.Command_Line; with Ada.Unchecked_Deallocation; with Ada.Unchecked_Conversion; with Ada.Text_IO; use Ada.Text_IO; with Ortho_Front; use Ortho_Front; with LLVM.BitWriter; with LLVM.Core; use LLVM.Core; with LLVM.Target; use LLVM.Target; with LLVM.TargetMachine; use LLVM.TargetMachine; with LLVM.Analysis; with LLVM.Transforms.Scalar; with Ortho_LLVM; use Ortho_LLVM; with Interfaces; with Interfaces.C; use Interfaces.C; procedure Ortho_Code_Main is function GetDefaultNormalizedTargetTriple return Cstring; pragma Import (C, GetDefaultNormalizedTargetTriple, "LLVMGetDefaultNormalizedTargetTriple"); -- Name of the output filename (given by option '-o'). Output : String_Acc := null; type Output_Kind_Type is (Output_Llvm, Output_Bytecode, Output_Assembly, Output_Object); Output_Kind : Output_Kind_Type := Output_Object; -- True if the LLVM output must be displayed (set by '--dump-llvm') Flag_Dump_LLVM : Boolean := False; -- Verify generated LLVM code. Flag_Verify_LLVM : Boolean := False; -- Index of the first file argument. First_File : Natural; -- Current option index. Optind : Natural; -- Number of arguments. Argc : constant Natural := Argument_Count; -- Name of the module. Module_Name : String := "ortho" & Ascii.Nul; -- Target triple. Triple : Cstring := Empty_Cstring; Target : aliased TargetRef; CPU : constant Cstring := Empty_Cstring; Features : constant Cstring := Empty_Cstring; Reloc : RelocMode := RelocDefault; function To_String (C : Cstring) return String is function Strlen (C : Cstring) return Natural; pragma Import (C, Strlen); subtype Fat_String is String (Positive); type Fat_String_Acc is access Fat_String; function To_Fat_String_Acc is new Ada.Unchecked_Conversion (Cstring, Fat_String_Acc); begin return To_Fat_String_Acc (C)(1 .. Strlen (C)); end To_String; Codegen : CodeGenFileType := ObjectFile; Msg : aliased Cstring; begin Ortho_Front.Init; -- Decode options. First_File := Natural'Last; Optind := 1; while Optind <= Argc loop declare Arg : constant String := Argument (Optind); begin if Arg (1) = '-' then if Arg = "--dump-llvm" then Flag_Dump_LLVM := True; elsif Arg = "--verify-llvm" then Flag_Verify_LLVM := True; elsif Arg = "-o" then if Optind = Argc then Put_Line (Standard_Error, "error: missing filename to '-o'"); return; end if; Output := new String'(Argument (Optind + 1) & ASCII.Nul); Optind := Optind + 1; elsif Arg = "-quiet" then -- Skip silently. null; elsif Arg = "-S" then Output_Kind := Output_Assembly; Codegen := AssemblyFile; elsif Arg = "-c" then Output_Kind := Output_Object; Codegen := ObjectFile; elsif Arg = "-O0" then Optimization := CodeGenLevelNone; elsif Arg = "-O1" or else Arg = "-O" then Optimization := CodeGenLevelLess; elsif Arg = "-O2" then Optimization := CodeGe
# group `midi_device_setup_process` {#group__midi__device__setup__process}

These are method that you must use to initialize and run a device.

## Summary

 Members                        | Descriptions                                
--------------------------------|---------------------------------------------
`public void `[`midi_device_init`](#group__midi__device__setup__process_1gaf29deddc94ea98a59daa0bde1aefd9d9)`(`[`MidiDevice`](#struct__midi__device)` * device)`            | Initialize a device.
`public void `[`midi_device_process`](#group__midi__device__setup__process_1gaa3d5993d0e998a1b59bbf5ab9c7b492b)`(`[`MidiDevice`](#struct__midi__device)` * device)`            | Process input data.

## Members

#### `public void `[`midi_device_init`](#group__midi__device__setup__process_1gaf29deddc94ea98a59daa0bde1aefd9d9)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__midi__device__setup__process_1gaf29deddc94ea98a59daa0bde1aefd9d9}

Initialize a device.

You must call this before using the device in question.

#### Parameters
* `device` the device to initialize

#### `public void `[`midi_device_process`](#group__midi__device__setup__process_1gaa3d5993d0e998a1b59bbf5ab9c7b492b)`(`[`MidiDevice`](#struct__midi__device)` * device)` {#group__midi__device__setup__process_1gaa3d5993d0e998a1b59bbf5ab9c7b492b}

Process input data.

This method drives the input processing, you must call this method frequently if you expect to have your input callbacks called.

#### Parameters
* `device` the device to process