System.Data.SQLite
Check-in [3fc667f990]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:More tweaks to the Eagle script library in externals.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | netStandard20
Files: files | file ages | folders
SHA1: 3fc667f990888e73889b92935044b141447a6a0a
User & Date: mistachkin 2018-04-06 14:34:36
Context
2018-04-06
16:32
Attempt to fix an issue with the native library pre-loader when running on .NET Core under POSIX. check-in: a3c8ee12fc user: mistachkin tags: netStandard20
14:34
More tweaks to the Eagle script library in externals. check-in: 3fc667f990 user: mistachkin tags: netStandard20
14:24
Fix typo in the previous check-in. check-in: c98cb01b99 user: mistachkin tags: netStandard20
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Externals/Eagle/lib/Eagle1.0/csharp.eagle.

104
105
106
107
108
109
110
111
112
113



114
115
116
117
118
119
120
...
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
...
168
169
170
171
172
173
174





175
176
177
178
179
180




181
182
183
184
185
186
187
...
391
392
393
394
395
396
397

398
399
400
401
402
403
404
405
...
532
533
534
535
536
537
538






539
540
541
542
543
544
545
546
547
548
549
550
551

552
553
554
555
556
557

558
559
560
561
562
563

564
565
566
567
568
569
570
...
589
590
591
592
593
594
595








596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
...
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
 
  #
  # NOTE: This procedure is used to translate a name/value pair into zero or
  #       more options to the C# compiler.  This procedure should not raise
  #       script errors.
  #
  proc compilerParameterToArguments { name {value ""} } {
    switch -exact -- $name {
      WarningLevel {
        set name -warn



      }
      ReferencedAssemblies.Add {
        set name -reference

        if {[file pathtype $value] ne "absolute"} then {
          set value [file nativename [file normalize \
              [file join [getDotNetStandardReferencePath] \
................................................................................
  #
  # NOTE: This procedure is used to obtain the base command line options for
  #       the C# compiler, including those that may be enabled by default.
  #       An empty string may be returned.  This procedure should not raise
  #       script errors.
  #
  proc getCSharpCompilerOptions { parameters library csharp prefix } {
    #
    # NOTE: Start out with no compiler options.
    #
    set result ""

    #
    # NOTE: Make sure that the "standard" preprocessor defines match those
    #       for the platform (i.e. the ones used to compile the Eagle core
    #       library assembly).  This caller may disable this handling.
    #
    if {$library} then {
      set libraryOptions [expr { \
................................................................................
          [info exists ::eagle_platform(csharpOptions)] ? \
          $::eagle_platform(csharpOptions) : [list] \
      }]
    } else {
      set csharpOptions ""
    }






    #
    # NOTE: Grab the existing compiler options, if any.  This caller may
    #       disable this handling (e.g. by specifying an invalid opaque
    #       object handle for the "parameters" argument).
    #
    if {[isNonNullObjectHandle $parameters]} then {




      append result [$parameters CompilerOptions]
    }

    #
    # NOTE: Are there any Eagle core library options to check?
    #
    if {[llength $libraryOptions] > 0} then {
................................................................................
    set errors [$results -alias Errors]

    #
    # NOTE: It is assumed that no assembly was generated if there were
    #       any compiler errors.  Ignore all compiler warnings unless
    #       we are in strict mode.
    #

    if {[$errors HasErrors] || ($strict && [$errors HasWarnings])} then {
      #
      # NOTE: Compilation of the assembly failed.
      #
      set code Error

      #
      # NOTE: Prepare to transfer error messages to the caller.
................................................................................
      #
      # NOTE: Make the compiler output a little quieter.  This is needed
      #       to maintain compatibility with the results generated by the
      #       [compileViaCSharpCodeProvider] procedure.
      #
      lappend command -nologo







      #
      # NOTE: If symbols are enabled, add the necessary command line
      #       argument.
      #
      if {$symbols} then {lappend command -debug}

      #
      # NOTE: As of this writing (2018-04-06), the current version of the
      #       .NET Core SDK (2.1.101) uses the "netstandard.dll" assembly
      #       to enable use of the .NET Standard 2.0 library.
      #
      lappend command [appendArgs \"-reference: [file join \
          [getDotNetStandardReferencePath] netstandard.dll] \"]


      #
      # NOTE: Set the output assembly file name to the temporary output
      #       file name we obtained from [file tempname] above.
      #
      lappend command [appendArgs \"-out: $outputFileName \"]


      #
      # NOTE: Set the source code file name to the temporary source code
      #       file name we obtained from [file tempname] above.
      #
      lappend command [appendArgs \" $sourceFileName \"]


      #
      # NOTE: First, write the specified string (containing C# code) to
      #       the temporary source code file.
      #
      writeFile $sourceFileName $string

................................................................................
      #
      # NOTE: Prepare to transfer the "results" to the caller.
      #
      if {[string length $resultsVarName] > 0} then {
        upvar 1 $resultsVarName results
      }









      #
      # NOTE: It is assumed that no assembly was generated if there were
      #       any compiler errors.  Ignore all compiler warnings unless
      #       we are in strict mode.
      #
      if {[llength $errors] > 0 || \
          ($strict && [llength $warnings] > 0)} then {
        #
        # NOTE: Set the results to an empty string because we failed and
        #       this will not look like a valid opaque object handle.
        #
        set results ""

        #
        # NOTE: Compilation of the assembly failed.
        #
        set code Error

        #
        # NOTE: Prepare to transfer error messages to the caller.
................................................................................
        #
        # NOTE: If there are compiler warnings, add them to the list now.
        #
        if {[llength $warnings] > 0} then {
          eval lappend local_errors $warnings
        }
      } else {
        #
        # HACK: For backward compatibility with the results generated by
        #       the [compileViaCSharpCodeProvider] procedure, we must now
        #       set the results to an obviously fake opaque object handle
        #       that still matches the normal pattern.
        #
        set results System#CodeDom#Compiler#CompilerResults#0

        #
        # NOTE: If the generated assembly was supposed to be loaded into
        #       memory, try to do that now.
        #
        if {$memory} then {
          object load -loadtype File $outputFileName
        }







|


>
>
>







 







<
<
<
<
<







 







>
>
>
>
>






>
>
>
>







 







>
|







 







>
>
>
>
>
>











|
|
>





|
>





|
>







 







>
>
>
>
>
>
>
>







<
<
<
<
<
<







 







<
<
<
<
<
<
<
<







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
138
139
140
141
142
143
144





145
146
147
148
149
150
151
...
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
...
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
...
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
...
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627






628
629
630
631
632
633
634
...
647
648
649
650
651
652
653








654
655
656
657
658
659
660
 
  #
  # NOTE: This procedure is used to translate a name/value pair into zero or
  #       more options to the C# compiler.  This procedure should not raise
  #       script errors.
  #
  proc compilerParameterToArguments { name {value ""} } {
    switch -exact -nocase -- $name {
      WarningLevel {
        set name -warn
      }
      TreatWarningsAsErrors {
        set name -warnaserror
      }
      ReferencedAssemblies.Add {
        set name -reference

        if {[file pathtype $value] ne "absolute"} then {
          set value [file nativename [file normalize \
              [file join [getDotNetStandardReferencePath] \
................................................................................
  #
  # NOTE: This procedure is used to obtain the base command line options for
  #       the C# compiler, including those that may be enabled by default.
  #       An empty string may be returned.  This procedure should not raise
  #       script errors.
  #
  proc getCSharpCompilerOptions { parameters library csharp prefix } {





    #
    # NOTE: Make sure that the "standard" preprocessor defines match those
    #       for the platform (i.e. the ones used to compile the Eagle core
    #       library assembly).  This caller may disable this handling.
    #
    if {$library} then {
      set libraryOptions [expr { \
................................................................................
          [info exists ::eagle_platform(csharpOptions)] ? \
          $::eagle_platform(csharpOptions) : [list] \
      }]
    } else {
      set csharpOptions ""
    }

    #
    # NOTE: Start out with no compiler options.
    #
    set result ""

    #
    # NOTE: Grab the existing compiler options, if any.  This caller may
    #       disable this handling (e.g. by specifying an invalid opaque
    #       object handle for the "parameters" argument).
    #
    if {[isNonNullObjectHandle $parameters]} then {
      if {[string length $result] > 0} then {
        append result " "
      }

      append result [$parameters CompilerOptions]
    }

    #
    # NOTE: Are there any Eagle core library options to check?
    #
    if {[llength $libraryOptions] > 0} then {
................................................................................
    set errors [$results -alias Errors]

    #
    # NOTE: It is assumed that no assembly was generated if there were
    #       any compiler errors.  Ignore all compiler warnings unless
    #       we are in strict mode.
    #
    if {[$errors HasErrors] || \
        ($strict && [$errors HasWarnings])} then {
      #
      # NOTE: Compilation of the assembly failed.
      #
      set code Error

      #
      # NOTE: Prepare to transfer error messages to the caller.
................................................................................
      #
      # NOTE: Make the compiler output a little quieter.  This is needed
      #       to maintain compatibility with the results generated by the
      #       [compileViaCSharpCodeProvider] procedure.
      #
      lappend command -nologo

      #
      # NOTE: Always build as a library so that we do not require a static
      #       Main method.
      #
      lappend command -target:library

      #
      # NOTE: If symbols are enabled, add the necessary command line
      #       argument.
      #
      if {$symbols} then {lappend command -debug}

      #
      # NOTE: As of this writing (2018-04-06), the current version of the
      #       .NET Core SDK (2.1.101) uses the "netstandard.dll" assembly
      #       to enable use of the .NET Standard 2.0 library.
      #
      lappend command [appendArgs \"-reference: [file nativename \
          [file normalize [file join [getDotNetStandardReferencePath] \
          netstandard.dll]]] \"]

      #
      # NOTE: Set the output assembly file name to the temporary output
      #       file name we obtained from [file tempname] above.
      #
      lappend command [appendArgs \"-out: [file nativename [file \
          normalize $outputFileName]] \"]

      #
      # NOTE: Set the source code file name to the temporary source code
      #       file name we obtained from [file tempname] above.
      #
      lappend command [appendArgs \" [file nativename [file normalize \
          $sourceFileName]] \"]

      #
      # NOTE: First, write the specified string (containing C# code) to
      #       the temporary source code file.
      #
      writeFile $sourceFileName $string

................................................................................
      #
      # NOTE: Prepare to transfer the "results" to the caller.
      #
      if {[string length $resultsVarName] > 0} then {
        upvar 1 $resultsVarName results
      }

      #
      # HACK: For backward compatibility with the results generated by
      #       the [compileViaCSharpCodeProvider] procedure, we must now
      #       set the results to an obviously fake opaque object handle
      #       that still matches the normal pattern.
      #
      set results System#CodeDom#Compiler#CompilerResults#0

      #
      # NOTE: It is assumed that no assembly was generated if there were
      #       any compiler errors.  Ignore all compiler warnings unless
      #       we are in strict mode.
      #
      if {[llength $errors] > 0 || \
          ($strict && [llength $warnings] > 0)} then {






        #
        # NOTE: Compilation of the assembly failed.
        #
        set code Error

        #
        # NOTE: Prepare to transfer error messages to the caller.
................................................................................
        #
        # NOTE: If there are compiler warnings, add them to the list now.
        #
        if {[llength $warnings] > 0} then {
          eval lappend local_errors $warnings
        }
      } else {








        #
        # NOTE: If the generated assembly was supposed to be loaded into
        #       memory, try to do that now.
        #
        if {$memory} then {
          object load -loadtype File $outputFileName
        }