瀏覽代碼

Rebase to revision 17306

git-svn-id: branches/svenbarth/classhelpers@17314 -
svenbarth 14 年之前
父節點
當前提交
35b47e491c
共有 100 個文件被更改,包括 6469 次插入1503 次删除
  1. 25 1
      .gitattributes
  2. 2 0
      compiler/aasmbase.pas
  3. 9 3
      compiler/aggas.pas
  4. 2 0
      compiler/arm/cgcpu.pas
  5. 16 1
      compiler/arm/cpuinfo.pas
  6. 3 0
      compiler/cclasses.pas
  7. 3 3
      compiler/comprsrc.pas
  8. 28 8
      compiler/cstreams.pas
  9. 8 2
      compiler/dbgdwarf.pas
  10. 14 1
      compiler/dbgstabs.pas
  11. 2 1
      compiler/defcmp.pas
  12. 22 23
      compiler/finput.pas
  13. 2 1
      compiler/globals.pas
  14. 5 2
      compiler/globtype.pas
  15. 1 1
      compiler/i386/ag386nsm.pas
  16. 10 28
      compiler/i386/cgcpu.pas
  17. 78 1
      compiler/i386/i386att.inc
  18. 78 1
      compiler/i386/i386atts.inc
  19. 78 1
      compiler/i386/i386int.inc
  20. 1 1
      compiler/i386/i386nop.inc
  21. 78 1
      compiler/i386/i386op.inc
  22. 77 0
      compiler/i386/i386prop.inc
  23. 1270 10
      compiler/i386/i386tab.inc
  24. 1 1
      compiler/link.pas
  25. 8 4
      compiler/msg/errore.msg
  26. 7 5
      compiler/msgidx.inc
  27. 383 378
      compiler/msgtxt.inc
  28. 2 1
      compiler/ncgrtti.pas
  29. 102 1
      compiler/ncgutil.pas
  30. 1 1
      compiler/nld.pas
  31. 0 16
      compiler/nset.pas
  32. 2 1
      compiler/ogbase.pas
  33. 22 16
      compiler/ogcoff.pas
  34. 29 23
      compiler/ogelf.pas
  35. 1 0
      compiler/ogmacho.pas
  36. 39 7
      compiler/ognlm.pas
  37. 2 2
      compiler/owar.pas
  38. 4 4
      compiler/owbase.pas
  39. 13 0
      compiler/pdecsub.pas
  40. 30 0
      compiler/pdecvar.pas
  41. 8 15
      compiler/pmodules.pas
  42. 1 0
      compiler/powerpc/agppcmpw.pas
  43. 70 41
      compiler/ppu.pas
  44. 2 1
      compiler/symconst.pas
  45. 7 0
      compiler/symdef.pas
  46. 5 0
      compiler/symsym.pas
  47. 17 0
      compiler/symtable.pas
  48. 2 0
      compiler/systems.pas
  49. 1 1
      compiler/systems/t_embed.pas
  50. 61 17
      compiler/systems/t_nwm.pas
  51. 2 0
      compiler/tokens.pas
  52. 3 3
      compiler/x86/agx86int.pas
  53. 431 4
      compiler/x86/x86ins.dat
  54. 7 2
      compiler/x86_64/cgcpu.pas
  55. 78 1
      compiler/x86_64/x8664ats.inc
  56. 78 1
      compiler/x86_64/x8664att.inc
  57. 78 1
      compiler/x86_64/x8664int.inc
  58. 1 1
      compiler/x86_64/x8664nop.inc
  59. 78 1
      compiler/x86_64/x8664op.inc
  60. 77 0
      compiler/x86_64/x8664pro.inc
  61. 1291 10
      compiler/x86_64/x8664tab.inc
  62. 0 2
      packages/fcl-db/src/base/fields.inc
  63. 41 16
      packages/fcl-db/src/memds/memds.pp
  64. 5 758
      packages/fcl-stl/Makefile
  65. 1 1
      packages/fcl-stl/Makefile.fpc
  66. 1 1
      packages/fcl-stl/doc/set.tex
  67. 27 0
      packages/fcl-stl/src/garrayutils.pp
  68. 216 0
      packages/fcl-stl/src/ghashmap.pp
  69. 186 0
      packages/fcl-stl/src/ghashset.pp
  70. 1 1
      packages/fcl-stl/src/gmap.pp
  71. 116 0
      packages/fcl-stl/tests/garrayutilstest.pp
  72. 99 0
      packages/fcl-stl/tests/ghashmaptest.pp
  73. 97 0
      packages/fcl-stl/tests/ghashsettest.pp
  74. 6 6
      packages/fcl-stl/tests/gpriorityqueuetest.pp
  75. 0 52
      packages/fcl-stl/tests/gsorttest.pp
  76. 2 2
      packages/fcl-stl/tests/run-all-tests
  77. 2 2
      packages/fcl-stl/tests/suiteconfig.pp
  78. 7 6
      packages/fcl-web/Makefile
  79. 6 5
      packages/fcl-web/Makefile.fpc
  80. 20 0
      packages/fcl-web/examples/combined/combined.html
  81. 二進制
      packages/fcl-web/examples/combined/combined.ico
  82. 4 0
      packages/fcl-web/examples/combined/combined.ini
  83. 116 0
      packages/fcl-web/examples/combined/combined.lpi
  84. 15 0
      packages/fcl-web/examples/combined/combined.lpr
  85. 二進制
      packages/fcl-web/examples/combined/combined.res
  86. 11 0
      packages/fcl-web/examples/combined/combined.sql
  87. 105 0
      packages/fcl-web/examples/combined/login.js
  88. 二進制
      packages/fcl-web/examples/combined/login.png
  89. 18 0
      packages/fcl-web/examples/combined/users.html
  90. 108 0
      packages/fcl-web/examples/combined/users.js
  91. 15 0
      packages/fcl-web/examples/combined/users.sql
  92. 76 0
      packages/fcl-web/examples/combined/wmlogin.lfm
  93. 129 0
      packages/fcl-web/examples/combined/wmlogin.pp
  94. 94 0
      packages/fcl-web/examples/combined/wmusers.lfm
  95. 35 0
      packages/fcl-web/examples/combined/wmusers.lrs
  96. 145 0
      packages/fcl-web/examples/combined/wmusers.pp
  97. 2 0
      packages/fcl-web/fpmake.pp
  98. 1 1
      packages/fcl-web/src/base/fphtml.pp
  99. 1 0
      packages/fcl-web/src/jsonrpc/fpextdirect.pp
  100. 5 1
      packages/fcl-web/src/jsonrpc/fpjsonrpc.pp

+ 25 - 1
.gitattributes

@@ -2318,6 +2318,8 @@ packages/fcl-stl/doc/vector.tex svneol=native#text/plain
 packages/fcl-stl/doc/vectorexample.pp svneol=native#text/plain
 packages/fcl-stl/src/garrayutils.pp svneol=native#text/plain
 packages/fcl-stl/src/gdeque.pp svneol=native#text/plain
+packages/fcl-stl/src/ghashmap.pp svneol=native#text/plain
+packages/fcl-stl/src/ghashset.pp svneol=native#text/plain
 packages/fcl-stl/src/gmap.pp svneol=native#text/plain
 packages/fcl-stl/src/gpriorityqueue.pp svneol=native#text/plain
 packages/fcl-stl/src/gqueue.pp svneol=native#text/plain
@@ -2326,14 +2328,16 @@ packages/fcl-stl/src/gstack.pp svneol=native#text/plain
 packages/fcl-stl/src/gutil.pp svneol=native#text/plain
 packages/fcl-stl/src/gvector.pp svneol=native#text/plain
 packages/fcl-stl/tests/clean svneol=native#text/plain
+packages/fcl-stl/tests/garrayutilstest.pp svneol=native#text/plain
 packages/fcl-stl/tests/gdequetest.pp svneol=native#text/plain
+packages/fcl-stl/tests/ghashmaptest.pp svneol=native#text/plain
+packages/fcl-stl/tests/ghashsettest.pp svneol=native#text/plain
 packages/fcl-stl/tests/gmaptest.pp svneol=native#text/plain
 packages/fcl-stl/tests/gmaptestzal.pp svneol=native#text/plain
 packages/fcl-stl/tests/gpriorityqueuetest.pp svneol=native#text/plain
 packages/fcl-stl/tests/gqueuetest.pp svneol=native#text/plain
 packages/fcl-stl/tests/gsetrefcounttest.pp svneol=native#text/plain
 packages/fcl-stl/tests/gsettest.pp svneol=native#text/plain
-packages/fcl-stl/tests/gsorttest.pp svneol=native#text/plain
 packages/fcl-stl/tests/gstacktest.pp svneol=native#text/plain
 packages/fcl-stl/tests/gvectortest.pp svneol=native#text/plain
 packages/fcl-stl/tests/run-all-tests svneol=native#text/plain
@@ -2343,6 +2347,23 @@ packages/fcl-web/Makefile svneol=native#text/plain
 packages/fcl-web/Makefile.fpc svneol=native#text/plain
 packages/fcl-web/Makefile.org svneol=native#text/plain
 packages/fcl-web/Makefile_fpmake.fpc svneol=native#text/plain
+packages/fcl-web/examples/combined/combined.html svneol=native#text/plain
+packages/fcl-web/examples/combined/combined.ico -text
+packages/fcl-web/examples/combined/combined.ini svneol=native#text/plain
+packages/fcl-web/examples/combined/combined.lpi svneol=native#text/plain
+packages/fcl-web/examples/combined/combined.lpr svneol=native#text/plain
+packages/fcl-web/examples/combined/combined.res -text
+packages/fcl-web/examples/combined/combined.sql svneol=native#text/plain
+packages/fcl-web/examples/combined/login.js svneol=native#text/plain
+packages/fcl-web/examples/combined/login.png -text svneol=unset#image/png
+packages/fcl-web/examples/combined/users.html svneol=native#text/plain
+packages/fcl-web/examples/combined/users.js svneol=native#text/plain
+packages/fcl-web/examples/combined/users.sql svneol=native#text/plain
+packages/fcl-web/examples/combined/wmlogin.lfm svneol=native#text/plain
+packages/fcl-web/examples/combined/wmlogin.pp svneol=native#text/plain
+packages/fcl-web/examples/combined/wmusers.lfm svneol=native#text/plain
+packages/fcl-web/examples/combined/wmusers.lrs svneol=native#text/plain
+packages/fcl-web/examples/combined/wmusers.pp svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/README.txt svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/demo.lpi svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/demo.lpr svneol=native#text/plain
@@ -9492,6 +9513,7 @@ tests/test/tabsvr3.pp svneol=native#text/plain
 tests/test/tabsvr4.pp svneol=native#text/plain
 tests/test/tabsvr5.pp svneol=native#text/plain
 tests/test/taddstr1.pp svneol=native#text/plain
+tests/test/taes1.pp svneol=native#text/plain
 tests/test/talign.pp svneol=native#text/plain
 tests/test/talign1.pp svneol=native#text/plain
 tests/test/talign2.pp svneol=native#text/plain
@@ -10158,6 +10180,7 @@ tests/test/tsealed3.pp svneol=native#text/pascal
 tests/test/tsealed4.pp svneol=native#text/pascal
 tests/test/tsealed5.pp svneol=native#text/pascal
 tests/test/tsealed6.pp svneol=native#text/pascal
+tests/test/tsec1.pp svneol=native#text/plain
 tests/test/tsel1.pp svneol=native#text/plain
 tests/test/tsel2.pp svneol=native#text/plain
 tests/test/tset1.pp svneol=native#text/plain
@@ -11412,6 +11435,7 @@ tests/webtbs/tw1896.pp svneol=native#text/plain
 tests/webtbs/tw1901.pp svneol=native#text/plain
 tests/webtbs/tw1902.pp svneol=native#text/plain
 tests/webtbs/tw1907.pp svneol=native#text/plain
+tests/webtbs/tw19077.pp svneol=native#text/pascal
 tests/webtbs/tw1908.pp svneol=native#text/plain
 tests/webtbs/tw1909.pp svneol=native#text/plain
 tests/webtbs/tw1910.pp svneol=native#text/plain

+ 2 - 0
compiler/aasmbase.pas

@@ -61,6 +61,8 @@ interface
 
     type
        TAsmSectiontype=(sec_none,
+         { this section type allows to define a user named section }
+         sec_user,
          sec_code,
          sec_data,
          { read-only, but may contain relocations }

+ 9 - 3
compiler/aggas.pas

@@ -246,7 +246,7 @@ implementation
 
     function TGNUAssembler.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
       const
-        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text',
           '.data',
 { why doesn't .rodata work? (FK) }
@@ -264,7 +264,7 @@ implementation
 {$if defined(m68k)} { Amiga/m68k GNU AS doesn't seem to like .rodata (KB) }
           '.data',
 {$else}
-    '.rodata',
+          '.rodata',
 {$endif}
           '.bss',
           '.threadvar',
@@ -318,7 +318,7 @@ implementation
           '.obcj_nlcatlist',
           '.objc_protolist'
         );
-        secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text',
           '.data.rel',
           '.data.rel',
@@ -406,6 +406,10 @@ implementation
           (target_info.system=system_i386_go32v2) then
           secname:='.data';
 
+        { section type user gives the user full controll on the section name }
+        if atype=sec_user then
+          secname:=aname;
+
         { For bss we need to set some flags that are target dependent,
           it is easier to disable it for smartlinking. It doesn't take up
           filespace }
@@ -413,6 +417,7 @@ implementation
            create_smartlink_sections and
            (aname<>'') and
            (atype<>sec_toc) and
+           (atype<>sec_user) and
            { on embedded systems every byte counts, so smartlink bss too }
            ((atype<>sec_bss) or (target_info.system in systems_embedded)) then
           begin
@@ -1466,6 +1471,7 @@ implementation
     const
 (* Translation table - replace unsupported section types with basic ones. *)
         SecXTable: array[TAsmSectionType] of TAsmSectionType = (
+         sec_none,
          sec_none,
          sec_code,
          sec_data,

+ 2 - 0
compiler/arm/cgcpu.pas

@@ -3480,6 +3480,8 @@ unit cgcpu;
               begin
                 { restore int registers and return }
                 list.concat(taicpu.op_reg_reg(A_MOV, NR_STACK_POINTER_REG, NR_FRAME_POINTER_REG));
+                { Add 4 to SP to make it point to an "imaginary PC" which the paramanager assumes is there(for normal ARM) }
+                list.concat(taicpu.op_reg_const(A_ADD, NR_STACK_POINTER_REG, 4));
 
                 reference_reset(ref,4);
                 ref.index:=NR_STACK_POINTER_REG;

+ 16 - 1
compiler/arm/cpuinfo.pas

@@ -99,7 +99,9 @@ Const
      pocall_softfloat,
      { same as stdcall (requires that all const records are passed by
        reference, but that's already done for stdcall) }
-     pocall_mwpascal
+     pocall_mwpascal,
+     { used for interrupt handling }
+     pocall_interrupt
    ];
 
    cputypestr : array[tcputype] of string[8] = ('',
@@ -147,6 +149,19 @@ Const
       'STELLARIS'
      );
 
+   interruptvectors : array[tcontrollertype] of longint =
+     (0,
+      8,
+      8,
+      8,
+      8,
+      8,
+      8,
+      8,
+      12+59, { XL-density }
+      12 { No model specified }
+     );
+
    vfp_scalar = [fpu_vfpv2,fpu_vfpv3];
 
    { Supported optimizations, only used for information }

+ 3 - 0
compiler/cclasses.pas

@@ -2208,6 +2208,9 @@ end;
     function TCmdStrListItem.GetCopy:TLinkedListItem;
       begin
         Result:=(inherited GetCopy);
+        { TLinkedListItem.GetCopy performs a "move" to copy all data -> reinit
+          the ansistring, so the refcount is properly increased }
+        Initialize(TCmdStrListItem(Result).FPStr);
         TCmdStrListItem(Result).FPStr:=FPstr;
       end;
 

+ 3 - 3
compiler/comprsrc.pas

@@ -377,18 +377,18 @@ end;
 
 function CopyResFile(inf,outf : TCmdStr) : boolean;
 var
-  src,dst : TCFileStream;
+  src,dst : TCCustomFileStream;
 begin
   { Copy .res file to units output dir. }
   Result:=false;
-  src:=TCFileStream.Create(inf,fmOpenRead or fmShareDenyNone);
+  src:=CFileStreamClass.Create(inf,fmOpenRead or fmShareDenyNone);
   if CStreamError<>0 then
     begin
       Message1(exec_e_cant_open_resource_file, src.FileName);
       Include(current_settings.globalswitches, cs_link_nolink);
       exit;
     end;
-  dst:=TCFileStream.Create(current_module.outputpath^+outf,fmCreate);
+  dst:=CFileStreamClass.Create(current_module.outputpath^+outf,fmCreate);
   if CStreamError<>0 then
     begin
       Message1(exec_e_cant_write_resource_file, dst.FileName);

+ 28 - 8
compiler/cstreams.pas

@@ -100,23 +100,38 @@ type
     property Size: Longint read GetSize write SetSize;
   end;
 
+{ TCCustomFileStream class }
+
+  TCCustomFileStream = class(TCStream)
+  protected
+    FFileName : String;
+  public
+    constructor Create(const AFileName: string;{shortstring!} Mode: Word); virtual; abstract;
+    function EOF: boolean; virtual; abstract;
+    property FileName : String Read FFilename;
+  end;
+
 { TFileStream class }
 
-  TCFileStream = class(TCStream)
+  TCFileStream = class(TCCustomFileStream)
   Private
-    FFileName : String;
     FHandle: File;
   protected
     procedure SetSize(NewSize: Longint); override;
   public
-    constructor Create(const AFileName: string; Mode: Word);
+    constructor Create(const AFileName: string; Mode: Word); override;
     destructor Destroy; override;
     function Read(var Buffer; Count: Longint): Longint; override;
     function Write(const Buffer; Count: Longint): Longint; override;
     function Seek(Offset: Longint; Origin: Word): Longint; override;
-    property FileName : String Read FFilename;
+    function EOF: boolean; override;
   end;
 
+  TCFileStreamClass = class of TCCustomFileStream;
+var
+  CFileStreamClass: TCFileStreamClass = TCFileStream;
+
+type
 { TCustomMemoryStream abstract class }
 
   TCCustomMemoryStream = class(TCStream)
@@ -441,6 +456,11 @@ begin
   Result:=l;
 end;
 
+function TCFileStream.EOF: boolean;
+begin
+  EOF:=system.eof(FHandle);
+end;
+
 
 {****************************************************************************}
 {*                             TCustomMemoryStream                          *}
@@ -489,11 +509,11 @@ end;
 
 procedure TCCustomMemoryStream.SaveToFile(const FileName: string);
 
-Var S : TCFileStream;
+Var S : TCCustomFileStream;
 
 begin
   Try
-    S:=TCFileStream.Create (FileName,fmCreate);
+    S:=CFileStreamClass.Create (FileName,fmCreate);
     SaveToStream(S);
   finally
     S.free;
@@ -574,11 +594,11 @@ end;
 
 procedure TCMemoryStream.LoadFromFile(const FileName: string);
 
-Var S : TCFileStream;
+Var S : TCCustomFileStream;
 
 begin
   Try
-    S:=TCFileStream.Create (FileName,fmOpenRead);
+    S:=CFileStreamClass.Create (FileName,fmOpenRead);
     LoadFromStream(S);
   finally
     S.free;

+ 8 - 2
compiler/dbgdwarf.pas

@@ -1000,6 +1000,8 @@ implementation
         loclist := tdynamicarray.Create(4096);
 
         AbbrevSearchTree:=AllocateNewAiSearchItem;
+
+        vardatadef := nil;
       end;
 
 
@@ -2993,6 +2995,7 @@ implementation
         i : longint;
         def: tdef;
         dbgname: string;
+        vardatatype: ttypesym;
       begin
         current_module.flags:=current_module.flags or uf_has_dwarf_debuginfo;
         storefilepos:=current_filepos;
@@ -3007,7 +3010,9 @@ implementation
             FILEREC
             TEXTREC
         }
-        vardatadef:=trecorddef(search_system_type('TVARDATA').typedef);
+        vardatatype:=try_search_system_type('TVARDATA');
+        if assigned(vardatatype) then
+          vardatadef:=trecorddef(vardatatype.typedef);
 
         { write start labels }
         new_section(current_asmdata.asmlists[al_dwarf_info],sec_debug_info,'',0);
@@ -3605,7 +3610,8 @@ implementation
     procedure TDebugInfoDwarf2.appenddef_variant(list:TAsmList;def: tvariantdef);
       begin
         { variants aren't known to dwarf2 but writting tvardata should be enough }
-        appenddef_record_named(list,trecorddef(vardatadef),'Variant');
+        if assigned(vardatadef) then
+          appenddef_record_named(list,trecorddef(vardatadef),'Variant');
       end;
 
     function TDebugInfoDwarf2.dwarf_version: Word;

+ 14 - 1
compiler/dbgstabs.pas

@@ -104,6 +104,8 @@ interface
         procedure insertmoduleinfo;override;
         procedure insertlineinfo(list:TAsmList);override;
         procedure referencesections(list:TAsmList);override;
+
+        constructor Create;override;
       end;
 
 
@@ -801,6 +803,9 @@ implementation
       var
         ss : ansistring;
       begin
+        if not assigned(vardatadef) then
+          exit;
+
         ss:='s'+tostr(vardatadef.size);
         vardatadef.symtable.SymList.ForEachCall(@field_add_stabstr,@ss);
         ss[length(ss)]:=';';
@@ -1503,6 +1508,7 @@ implementation
         stabstypelist : TAsmList;
         storefilepos  : tfileposinfo;
         i  : longint;
+        vardatatype : ttypesym;
       begin
         storefilepos:=current_filepos;
         current_filepos:=current_module.mainfilepos;
@@ -1513,7 +1519,9 @@ implementation
         stabsvarlist:=TAsmList.create;
         stabstypelist:=TAsmList.create;
 
-        vardatadef:=trecorddef(search_system_type('TVARDATA').typedef);
+        vardatatype:=try_search_system_type('TVARDATA');
+        if assigned(vardatatype) then
+          vardatadef:=trecorddef(vardatatype.typedef);
 
         { include symbol that will be referenced from the main to be sure to
           include this debuginfo .o file }
@@ -1710,6 +1718,11 @@ implementation
           end;
       end;
 
+    constructor TDebugInfoStabs.Create;
+      begin
+        inherited Create;
+        vardatadef:=nil;
+      end;
 
     const
       dbg_stabs_info : tdbginfo =

+ 2 - 1
compiler/defcmp.pas

@@ -564,7 +564,8 @@ implementation
                            begin
                              doconv:=tc_real_2_real;
                              { do we lose precision? }
-                             if def_to.size<def_from.size then
+                             if (def_to.size<def_from.size) or
+                               (is_currency(def_from) and (tfloatdef(def_to).floattype in [s32real,s64real])) then
                                eq:=te_convert_l2
                              else
                                eq:=te_convert_l1;

+ 22 - 23
compiler/finput.pas

@@ -26,7 +26,7 @@ unit finput;
 interface
 
     uses
-      cutils,cclasses;
+      cutils,cclasses,cstreams;
 
     const
        InputFileBufSize=32*1024+1;
@@ -91,7 +91,7 @@ interface
          function fileclose: boolean; override;
          procedure filegettime; override;
        private
-         f            : file;       { current file handle }
+         f            : TCCustomFileStream;       { current file handle }
        end;
 
        tinputfilemanager = class
@@ -457,47 +457,46 @@ uses
             exit;
           end;
         { Open file }
-        ofm:=filemode;
-        filemode:=0;
-        Assign(f,filename);
-        {$I-}
-         reset(f,1);
-        {$I+}
-        filemode:=ofm;
-        fileopen:=(ioresult=0);
+        fileopen:=false;
+        try
+          f:=CFileStreamClass.Create(filename,fmOpenRead);
+          fileopen:=true;
+        except
+        end;
       end;
 
 
     function tdosinputfile.fileseek(pos: longint): boolean;
       begin
-        {$I-}
-         seek(f,Pos);
-        {$I+}
-        fileseek:=(ioresult=0);
+        fileseek:=false;
+        try
+          f.position:=Pos;
+          fileseek:=true;
+        except
+        end;
       end;
 
 
     function tdosinputfile.fileread(var databuf; maxsize: longint): longint;
-      var
-        w : longint;
       begin
-        blockread(f,databuf,maxsize,w);
-        fileread:=w;
+        fileread:=f.Read(databuf,maxsize);
       end;
 
 
     function tdosinputfile.fileeof: boolean;
       begin
-        fileeof:=eof(f);
+        fileeof:=f.eof();
       end;
 
 
     function tdosinputfile.fileclose: boolean;
       begin
-        {$I-}
-         system.close(f);
-        {$I+}
-        fileclose:=(ioresult=0);
+        fileclose:=false;
+        try
+          f.Free;
+          fileclose:=true;
+        except
+        end;
       end;
 
 

+ 2 - 1
compiler/globals.pas

@@ -1007,7 +1007,8 @@ implementation
          'SAFECALL',
          'STDCALL',
          'SOFTFLOAT',
-         'MWPASCAL'
+         'MWPASCAL',
+         'INTERRUPT'
         );
       var
         t  : tproccalloption;

+ 5 - 2
compiler/globtype.pas

@@ -360,7 +360,9 @@ interface
          pocall_softfloat,
          { Metrowerks Pascal. Special case on Mac OS (X): passes all }
          { constant records by reference.                            }
-         pocall_mwpascal
+         pocall_mwpascal,
+         { Special interrupt handler for embedded systems }
+         pocall_interrupt
        );
        tproccalloptions = set of tproccalloption;
 
@@ -377,7 +379,8 @@ interface
            'SafeCall',
            'StdCall',
            'SoftFloat',
-           'MWPascal'
+           'MWPascal',
+           'Interrupt'
          );
 
        { Default calling convention }

+ 1 - 1
compiler/i386/ag386nsm.pas

@@ -445,7 +445,7 @@ interface
 
     procedure T386NasmAssembler.WriteSection(atype:TAsmSectiontype;const aname:string);
       const
-        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text',
           '.data',
           '.data',

+ 10 - 28
compiler/i386/cgcpu.pas

@@ -371,6 +371,9 @@ unit cgcpu;
         getcpuregister(list,NR_EDI);
         a_load_loc_reg(list,OS_INT,lenloc,NR_EDI);
         list.concat(Taicpu.op_reg(A_INC,S_L,NR_EDI));
+        { Now EDI contains (high+1). Copy it to ECX for later use. }
+        getcpuregister(list,NR_ECX);
+        list.concat(Taicpu.op_reg_reg(A_MOV,S_L,NR_EDI,NR_ECX));
         if (elesize<>1) then
          begin
            if ispowerof2(elesize, power) then
@@ -394,43 +397,22 @@ unit cgcpu;
              a_jmp_always(list,again);
 
              a_label(list,ok);
-             list.concat(Taicpu.op_reg_reg(A_SUB,S_L,NR_EDI,NR_ESP));
-             ungetcpuregister(list,NR_EDI);
-             { now reload EDI }
-             getcpuregister(list,NR_EDI);
-             a_load_loc_reg(list,OS_INT,lenloc,NR_EDI);
-             list.concat(Taicpu.op_reg(A_INC,S_L,NR_EDI));
-
-             if (elesize<>1) then
-              begin
-                if ispowerof2(elesize, power) then
-                  list.concat(Taicpu.op_const_reg(A_SHL,S_L,power,NR_EDI))
-                else
-                  list.concat(Taicpu.op_const_reg(A_IMUL,S_L,elesize,NR_EDI));
-              end;
-          end
-        else
+          end;
 {$endif __NOWINPECOFF__}
-          list.concat(Taicpu.op_reg_reg(A_SUB,S_L,NR_EDI,NR_ESP));
+        { If we were probing pages, EDI=(size mod pagesize) and ESP is decremented
+          by (size div pagesize)*pagesize, otherwise EDI=size.
+          Either way, subtracting EDI from ESP will set ESP to desired final value. }
+        list.concat(Taicpu.op_reg_reg(A_SUB,S_L,NR_EDI,NR_ESP));
         { align stack on 4 bytes }
         list.concat(Taicpu.op_const_reg(A_AND,S_L,aint($fffffff4),NR_ESP));
         { load destination, don't use a_load_reg_reg, that will add a move instruction
           that can confuse the reg allocator }
         list.concat(Taicpu.Op_reg_reg(A_MOV,S_L,NR_ESP,NR_EDI));
 
-        { Allocate other registers }
-        getcpuregister(list,NR_ECX);
+        { Allocate ESI and load it with source }
         getcpuregister(list,NR_ESI);
-
-        { load count }
-        a_load_loc_reg(list,OS_INT,lenloc,NR_ECX);
-
-        { load source }
         a_loadaddr_ref_reg(list,ref,NR_ESI);
 
-        { scheduled .... }
-        list.concat(Taicpu.op_reg(A_INC,S_L,NR_ECX));
-
         { calculate size }
         len:=elesize;
         opsize:=S_B;
@@ -446,7 +428,7 @@ unit cgcpu;
             len:=len shr 1;
           end;
 
-        if len<>0 then
+        if len>1 then
           begin
             if ispowerof2(len, power) then
               list.concat(Taicpu.op_const_reg(A_SHL,S_L,power,NR_ECX))

+ 78 - 1
compiler/i386/i386att.inc

@@ -602,5 +602,82 @@
 'insertq',
 'extrq',
 'lzcnt',
-'popcnt'
+'pabsb',
+'pabsw',
+'pabsd',
+'palignr',
+'phaddw',
+'phaddd',
+'phaddsw',
+'phsubw',
+'phsubd',
+'phsubsw',
+'pmaddubsw',
+'pmulhrsw',
+'pshufb',
+'psignb',
+'psignw',
+'psignd',
+'blendps',
+'blendpd',
+'blendvps',
+'blendvpd',
+'dpps',
+'dppd',
+'extractps',
+'insertps',
+'movntdqa',
+'mpsadbw',
+'packusdw',
+'pblendvb',
+'pblendw',
+'pcmpeqq',
+'pextrb',
+'pextrd',
+'pextrq',
+'phminposuw',
+'pinsrb',
+'pinsrd',
+'pinsrq',
+'pmaxsb',
+'pmaxsd',
+'pmaxud',
+'pmaxuw',
+'pminsb',
+'pminsd',
+'pminuw',
+'pminud',
+'pmovsxbw',
+'pmovsxbd',
+'pmovsxbq',
+'pmovsxwd',
+'pmovsxwq',
+'pmovsxdq',
+'pmovzxbw',
+'pmovzxbd',
+'pmovzxbq',
+'pmovzxwd',
+'pmovzxwq',
+'pmovzxdq',
+'pmuldq',
+'ptest',
+'roundps',
+'roundpd',
+'roundss',
+'roundsd',
+'pcmpestri',
+'pcmpestrm',
+'pcmpistri',
+'pcmpistrm',
+'pcmpgtq',
+'popcnt',
+'aesenc',
+'aesenclast',
+'aesdec',
+'aesdeclast',
+'aesimc',
+'aeskeygen',
+'stosq',
+'lodsq',
+'cmpsq'
 );

+ 78 - 1
compiler/i386/i386atts.inc

@@ -602,5 +602,82 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufINT,
-attsufINT
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufINT,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE
 );

+ 78 - 1
compiler/i386/i386int.inc

@@ -602,5 +602,82 @@
 'insertq',
 'extrq',
 'lzcnt',
-'popcnt'
+'pabsb',
+'pabsw',
+'pabsd',
+'palignr',
+'phaddw',
+'phaddd',
+'phaddsw',
+'phsubw',
+'phsubd',
+'phsubsw',
+'pmaddubsw',
+'pmulhrsw',
+'pshufb',
+'psignb',
+'psignw',
+'psignd',
+'blendps',
+'blendpd',
+'blendvps',
+'blendvpd',
+'dpps',
+'dppd',
+'extractps',
+'insertps',
+'movntdqa',
+'mpsadbw',
+'packusdw',
+'pblendvb',
+'pblendw',
+'pcmpeqq',
+'pextrb',
+'pextrd',
+'pextrq',
+'phminposuw',
+'pinsrb',
+'pinsrd',
+'pinsrq',
+'pmaxsb',
+'pmaxsd',
+'pmaxud',
+'pmaxuw',
+'pminsb',
+'pminsd',
+'pminuw',
+'pminud',
+'pmovsxbw',
+'pmovsxbd',
+'pmovsxbq',
+'pmovsxwd',
+'pmovsxwq',
+'pmovsxdq',
+'pmovzxbw',
+'pmovzxbd',
+'pmovzxbq',
+'pmovzxwd',
+'pmovzxwq',
+'pmovzxdq',
+'pmuldq',
+'ptest',
+'roundps',
+'roundpd',
+'roundss',
+'roundsd',
+'pcmpestri',
+'pcmpestrm',
+'pcmpistri',
+'pcmpistrm',
+'pcmpgtq',
+'popcnt',
+'aesenc',
+'aesenclast',
+'aesdec',
+'aesdeclast',
+'aesimc',
+'aeskeygen',
+'stosq',
+'lodsq',
+'cmpsq'
 );

+ 1 - 1
compiler/i386/i386nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-1380;
+1560;

+ 78 - 1
compiler/i386/i386op.inc

@@ -602,5 +602,82 @@ A_MOVNTSD,
 A_INSERTQ,
 A_EXTRQ,
 A_LZCNT,
-A_POPCNT
+A_PABSB,
+A_PABSW,
+A_PABSD,
+A_PALIGNR,
+A_PHADDW,
+A_PHADDD,
+A_PHADDSW,
+A_PHSUBW,
+A_PHSUBD,
+A_PHSUBSW,
+A_PMADDUBSW,
+A_PMULHRSW,
+A_PSHUFB,
+A_PSIGNB,
+A_PSIGNW,
+A_PSIGND,
+A_BLENDPS,
+A_BLENDPD,
+A_BLENDVPS,
+A_BLENDVPD,
+A_DPPS,
+A_DPPD,
+A_EXTRACTPS,
+A_INSERTPS,
+A_MOVNTDQA,
+A_MPSADBW,
+A_PACKUSDW,
+A_PBLENDVB,
+A_PBLENDW,
+A_PCMPEQQ,
+A_PEXTRB,
+A_PEXTRD,
+A_PEXTRQ,
+A_PHMINPOSUW,
+A_PINSRB,
+A_PINSRD,
+A_PINSRQ,
+A_PMAXSB,
+A_PMAXSD,
+A_PMAXUD,
+A_PMAXUW,
+A_PMINSB,
+A_PMINSD,
+A_PMINUW,
+A_PMINUD,
+A_PMOVSXBW,
+A_PMOVSXBD,
+A_PMOVSXBQ,
+A_PMOVSXWD,
+A_PMOVSXWQ,
+A_PMOVSXDQ,
+A_PMOVZXBW,
+A_PMOVZXBD,
+A_PMOVZXBQ,
+A_PMOVZXWD,
+A_PMOVZXWQ,
+A_PMOVZXDQ,
+A_PMULDQ,
+A_PTEST,
+A_ROUNDPS,
+A_ROUNDPD,
+A_ROUNDSS,
+A_ROUNDSD,
+A_PCMPESTRI,
+A_PCMPESTRM,
+A_PCMPISTRI,
+A_PCMPISTRM,
+A_PCMPGTQ,
+A_POPCNT,
+A_AESENC,
+A_AESENCLAST,
+A_AESDEC,
+A_AESDECLAST,
+A_AESIMC,
+A_AESKEYGEN,
+A_STOSQ,
+A_LODSQ,
+A_CMPSQ
 );

+ 77 - 0
compiler/i386/i386prop.inc

@@ -602,5 +602,82 @@
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_RRAX, Ch_WMemEDI, Ch_RWRDI)),
+(Ch: (Ch_WRAX, Ch_RWRSI, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None))
 );

+ 1270 - 10
compiler/i386/i386tab.inc

@@ -7796,7 +7796,14 @@
     ops     : 3;
     optypes : (ot_reg32,ot_xmmreg,ot_immediate);
     code    : #1#102#211#2#15#197#72#22;
-    flags   : if_willamette or if_sse2 or if_sb or if_ar2
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRW;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#21#65#22;
+    flags   : if_sse4
   ),
   (
     opcode  : A_PINSRW;
@@ -9608,7 +9615,7 @@
     opcode  : A_MOVNTSD;
     ops     : 2;
     optypes : (ot_memory,ot_xmmreg,ot_none);
-    code    : #192#220#213#211#2#15#43#0#65;
+    code    : #192#220#213#211#2#15#43#65;
     flags   : if_sse4
   ),
   (
@@ -9647,17 +9654,1270 @@
     flags   : if_386 or if_sm or if_sse4
   ),
   (
-    opcode  : A_POPCNT;
+    opcode  : A_PABSB;
     ops     : 2;
-    optypes : (ot_reg16,ot_regmem,ot_none);
-    code    : #208#219#193#211#2#15#184#72;
-    flags   : if_386 or if_sm or if_sse4
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#28#72;
+    flags   : if_sse4
   ),
   (
-    opcode  : A_POPCNT;
+    opcode  : A_PABSB;
     ops     : 2;
-    optypes : (ot_reg32 or ot_bits64,ot_regmem,ot_none);
-    code    : #209#219#193#211#2#15#184#72;
-    flags   : if_386 or if_sm or if_sse4
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_immediate);
+    code    : #217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_mmxreg,ot_memory,ot_immediate);
+    code    : #193#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg or ot_signed,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#12#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg or ot_signed,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#12#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#2#15#58#253#1#13#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#2#15#58#253#1#13#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#20#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#20#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#21#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#21#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#64#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#64#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#65#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#65#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_EXTRACTPS;
+    ops     : 3;
+    optypes : (ot_memory,ot_xmmreg,ot_immediate);
+    code    : #1#102#213#3#15#58#23#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_EXTRACTPS;
+    ops     : 3;
+    optypes : (ot_reg32 or ot_bits64,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#3#15#58#23#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_INSERTPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#33#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_INSERTPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#33#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MOVNTDQA;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#42#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MPSADBW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#66#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MPSADBW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#66#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PACKUSDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#43#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PACKUSDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#43#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDVB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#16#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDVB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#16#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate or ot_signed);
+    code    : #1#102#217#3#15#58#14#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate or ot_signed);
+    code    : #1#102#193#217#3#15#58#14#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPEQQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#41#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPEQQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#41#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRB;
+    ops     : 3;
+    optypes : (ot_reg32,ot_xmmreg,ot_immediate);
+    code    : #1#102#211#3#15#58#20#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRB;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits8,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#20#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRD;
+    ops     : 3;
+    optypes : (ot_reg32,ot_xmmreg,ot_immediate);
+    code    : #1#102#211#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRD;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRQ;
+    ops     : 3;
+    optypes : (ot_reg64,ot_xmmreg,ot_immediate);
+    code    : #1#102#214#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRQ;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits64,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#214#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHMINPOSUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#65#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHMINPOSUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#65#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRB;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg32,ot_immediate);
+    code    : #1#102#217#3#15#58#32#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRB;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits8,ot_immediate);
+    code    : #1#102#193#217#3#15#58#32#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg32,ot_immediate);
+    code    : #1#102#217#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits32,ot_immediate);
+    code    : #1#102#193#217#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRQ;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg64,ot_immediate);
+    code    : #1#102#214#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRQ;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits64,ot_immediate);
+    code    : #1#102#193#214#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#60#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#60#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#61#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#61#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#63#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#63#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#62#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#62#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#56#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#56#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#57#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#57#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#58#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#58#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#59#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#59#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#32#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#32#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#33#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#33#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#34#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#34#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#35#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#35#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#36#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#36#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#37#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#37#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#48#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#48#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#49#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#49#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#50#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#50#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#51#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#51#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#52#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#52#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#53#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#53#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#40#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#40#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PTEST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#23#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#8#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#8#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#9#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#9#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#10#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#10#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#11#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#11#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#97#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#97#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#96#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#96#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#99#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#99#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#98#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#98#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPGTQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#55#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPGTQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#55#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg16,ot_regmem or ot_bits16,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg32,ot_regmem or ot_bits32,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg64,ot_regmem or ot_bits64,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_AESENC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#220#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#220#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENCLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#221#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENCLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#221#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDEC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#222#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDEC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#222#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDECLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#223#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDECLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#223#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESIMC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#219#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESIMC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#219#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESKEYGEN;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#223#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESKEYGEN;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#223#72#22;
+    flags   : if_sse4
   )
 );

+ 1 - 1
compiler/link.pas

@@ -150,7 +150,7 @@ Implementation
       begin
         result:=0;
         bufsize:=64*1024;
-	      fs:=TCFileStream.Create(fn,fmOpenRead or fmShareDenyNone);
+	      fs:=CFileStreamClass.Create(fn,fmOpenRead or fmShareDenyNone);
 	      if CStreamError<>0 then
 	        begin
 	          fs.Free;

+ 8 - 4
compiler/msg/errore.msg

@@ -368,7 +368,7 @@ scanner_w_illegal_warn_identifier=02087_W_Illegal identifier "$1" for $WARN dire
 #
 # Parser
 #
-# 03307 is the last used one
+# 03309 is the last used one
 #
 % \section{Parser messages}
 % This section lists all parser messages. The parser takes care of the
@@ -1368,14 +1368,18 @@ parser_e_at_least_one_argument_must_be_of_type=03303_E_Either the result or at l
 parser_e_cant_use_type_parameters_here=03304_E_Type parameters may require initialization/finalization - can't be used in variant records
 % Type parameters may be specialized with types which (e.g. \var{ansistring}) need initialization/finalization
 % code which is implicitly generated by the compiler.
-parser_e_not_allowed_in_helper=03305_E_"$1" is not allowed in helper types
+parser_e_externals_no_section=03305_E_Variables being declared as external cannot be in a custom section
+% A section directive is not valid for variables being declared as external.
+parser_e_section_no_locals=03306_E_Non-static and non-global variables cannot have a section directive
+% A variable placed in a custom section is always statically allocated so it must be either a static or global variable.
+parser_e_not_allowed_in_helper=03307_E_"$1" is not allowed in helper types
 % Some directives and specifiers like "virtual", "dynamic", "override" aren't
 % allowed inside helper types in mode ObjFPC (they are ignored in mode Delphi),
 % because they have no meaning within helpers. Also "abstract" isn't allowed in
 % either mode.
-parser_e_no_class_constructor_in_helpers=03306_E_Class constructors aren't allowed in helpers
+parser_e_no_class_constructor_in_helpers=03308_E_Class constructors aren't allowed in helpers
 % Class constructor declarations aren't allowed in helpers.
-parser_e_inherited_not_in_record=03307_E_The use of "inherited" is not allowed in a record
+parser_e_inherited_not_in_record=03309_E_The use of "inherited" is not allowed in a record
 % As records don't suppport inheritance the use of "inherited" is prohibited for
 % these as well as for record helpers (in mode "Delphi" only).
 % \end{description}

+ 7 - 5
compiler/msgidx.inc

@@ -393,9 +393,11 @@ const
   parser_e_no_constructor_in_records=03302;
   parser_e_at_least_one_argument_must_be_of_type=03303;
   parser_e_cant_use_type_parameters_here=03304;
-  parser_e_not_allowed_in_helper=03305;
-  parser_e_no_class_constructor_in_helpers=03306;
-  parser_e_inherited_not_in_record=03307;
+  parser_e_externals_no_section=03305;
+  parser_e_section_no_locals=03306;
+  parser_e_not_allowed_in_helper=03307;
+  parser_e_no_class_constructor_in_helpers=03308;
+  parser_e_inherited_not_in_record=03309;
   type_e_mismatch=04000;
   type_e_incompatible_types=04001;
   type_e_not_equal_types=04002;
@@ -889,9 +891,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 59106;
+  MsgTxtSize = 59257;
 
   MsgIdxMax : array[1..20] of longint=(
-    24,88,308,103,84,54,111,22,202,63,
+    24,88,310,103,84,54,111,22,202,63,
     49,20,1,1,1,1,1,1,1,1
   );

+ 383 - 378
compiler/msgtxt.inc

@@ -478,583 +478,586 @@ const msgtxt : array[0..000246,1..240] of char=(
   '1"'#000+
   '03304_E_Type parameters',' may require initialization/finalization - ca'+
   'n'#039't be used in variant records'#000+
-  '03305_E_"$1" is not allowed in helper types'#000+
-  '03306_E_Class constructors aren'#039't allowed in helpers'#000+
-  '03307_E_The use of "inherited" is not allowed in a record'#000+
-  '04000_E_T','ype mismatch'#000+
+  '03305_E_Variables being declared as external cannot be in a custom sec'+
+  'tion'#000+
+  '03306_E_Non-static and non-global variables cannot have a section dire'+
+  'ctive'#000+
+  '03307_E_"$1" ','is not allowed in helper types'#000+
+  '03308_E_Class constructors aren'#039't allowed in helpers'#000+
+  '03309_E_The use of "inherited" is not allowed in a record'#000+
+  '04000_E_Type mismatch'#000+
   '04001_E_Incompatible types: got "$1" expected "$2"'#000+
-  '04002_E_Type mismatch between "$1" and "$2"'#000+
+  '04002_E_Type mismatch bet','ween "$1" and "$2"'#000+
   '04003_E_Type identifier expected'#000+
   '04004_E_Variable identifier expected'#000+
   '04005_E_Integer expression expected, but got "$1"'#000+
-  '04006_E_Bool','ean expression expected, but got "$1"'#000+
+  '04006_E_Boolean expression expected, but got "$1"'#000+
   '04007_E_Ordinal expression expected'#000+
-  '04008_E_pointer type expected, but got "$1"'#000+
+  '04008_E_pointer',' type expected, but got "$1"'#000+
   '04009_E_class type expected, but got "$1"'#000+
   '04011_E_Can'#039't evaluate constant expression'#000+
-  '04012_E_Set elements are not compatib','le'#000+
+  '04012_E_Set elements are not compatible'#000+
   '04013_E_Operation not implemented for sets'#000+
-  '04014_W_Automatic type conversion from floating type to COMP which is '+
-  'an integer type'#000+
+  '04014_W_Automatic type conversion from floa','ting type to COMP which i'+
+  's an integer type'#000+
   '04015_H_use DIV instead to get an integer result'#000+
   '04016_E_String types have to match exactly in $V+ mode'#000+
-  '0401','7_E_succ or pred on enums with assignments not possible'#000+
-  '04018_E_Can'#039't read or write variables of this type'#000+
+  '04017_E_succ or pred on enums with assignments not possible'#000+
+  '04018_E_Can'#039't read or write varia','bles of this type'#000+
   '04019_E_Can'#039't use readln or writeln on typed file'#000+
   '04020_E_Can'#039't use read or write on untyped file.'#000+
-  '04021_E_Type conflict between set ','elements'#000+
+  '04021_E_Type conflict between set elements'#000+
   '04022_W_lo/hi(dword/qword) returns the upper/lower word/dword'#000+
-  '04023_E_Integer or real expression expected'#000+
+  '04023_E_Integer or',' real expression expected'#000+
   '04024_E_Wrong type "$1" in array constructor'#000+
   '04025_E_Incompatible type for arg no. $1: Got "$2", expected "$3"'#000+
-  '04026_E_Method',' (variable) and Procedure (variable) are not compatibl'+
-  'e'#000+
-  '04027_E_Illegal constant passed to internal math function'#000+
+  '04026_E_Method (variable) and Procedure (variable) are not compatible'#000+
+  '04027_E_Illegal constant passed t','o internal math function'#000+
   '04028_E_Can'#039't take the address of constant expressions'#000+
   '04029_E_Argument can'#039't be assigned to'#000+
-  '04030_E_Can'#039't assign local proced','ure/function to procedure varia'+
-  'ble'#000+
+  '04030_E_Can'#039't assign local procedure/function to procedure variabl'+
+  'e'#000+
   '04031_E_Can'#039't assign values to an address'#000+
-  '04032_E_Can'#039't assign values to const variable'#000+
+  '04032_E_Can'#039,'t assign values to const variable'#000+
   '04033_E_Array type required'#000+
   '04034_E_interface type expected, but got "$1"'#000+
-  '04035_H_Mixing signed expressions and longw','ords gives a 64bit result'+
-  #000+
-  '04036_W_Mixing signed expressions and cardinals here may cause a range'+
-  ' check error'#000+
+  '04035_H_Mixing signed expressions and longwords gives a 64bit result'#000+
+  '04036_W_Mixing signed expressions and cardinals here may cause ','a ran'+
+  'ge check error'#000+
   '04037_E_Typecast has different size ($1 -> $2) in assignment'#000+
   '04038_E_enums with assignments can'#039't be used as array index'#000+
-  '04039_E_Cl','ass or Object types "$1" and "$2" are not related'#000+
-  '04040_W_Class types "$1" and "$2" are not related'#000+
+  '04039_E_Class or Object types "$1" and "$2" are not related'#000+
+  '04040_W_Class types "$1" and "$2" are n','ot related'#000+
   '04041_E_Class or interface type expected, but got "$1"'#000+
   '04042_E_Type "$1" is not completely defined'#000+
-  '04043_W_String literal has more character','s than short string length'#000+
+  '04043_W_String literal has more characters than short string length'#000+
   '04044_W_Comparison is always false due to range of values'#000+
-  '04045_W_Comparison is always true due to range of values'#000+
+  '0404','5_W_Comparison is always true due to range of values'#000+
   '04046_W_Constructing a class "$1" with abstract method "$2"'#000+
-  '04047_H_The left operand of the IN ope','rator should be byte sized'#000+
-  '04048_W_Type size mismatch, possible loss of data / range check error'#000+
+  '04047_H_The left operand of the IN operator should be byte sized'#000+
+  '04048_W_Type size mismatch, possible loss of data / range chec','k erro'+
+  'r'#000+
   '04049_H_Type size mismatch, possible loss of data / range check error'#000+
   '04050_E_The address of an abstract method can'#039't be taken'#000+
-  '04051_E_Assignme','nts to formal parameters and open arrays are not pos'+
-  'sible'#000+
-  '04052_E_Constant Expression expected'#000+
+  '04051_E_Assignments to formal parameters and open arrays are not possi'+
+  'ble'#000+
+  '04052_E_Constant Expression exp','ected'#000+
   '04053_E_Operation "$1" not supported for types "$2" and "$3"'#000+
   '04054_E_Illegal type conversion: "$1" to "$2"'#000+
-  '04055_H_Conversion between ordinals an','d pointers is not portable'#000+
-  '04056_W_Conversion between ordinals and pointers is not portable'#000+
+  '04055_H_Conversion between ordinals and pointers is not portable'#000+
+  '04056_W_Conversion between ordinals and pointers is not portab','le'#000+
   '04057_E_Can'#039't determine which overloaded function to call'#000+
   '04058_E_Illegal counter variable'#000+
-  '04059_W_Converting constant real value to double for C va','riable argu'+
-  'ment, add explicit typecast to prevent this.'#000+
-  '04060_E_Class or COM interface type expected, but got "$1"'#000+
+  '04059_W_Converting constant real value to double for C variable argume'+
+  'nt, add explicit typecast to prevent this.'#000+
+  '04060_E_Class or COM interface ty','pe expected, but got "$1"'#000+
   '04061_E_Constant packed arrays are not yet supported'#000+
   '04062_E_Incompatible type for arg no. $1: Got "$2" expected "(Bit)Pack'+
-  'ed',' Array"'#000+
+  'ed Array"'#000+
   '04063_E_Incompatible type for arg no. $1: Got "$2" expected "(not pack'+
-  'ed) Array"'#000+
+  'ed) Array"'#000,
   '04064_E_Elements of packed arrays cannot be of a type which need to be'+
   ' initialised'#000+
   '04065_E_Constant packed records and objects are not yet supported'#000+
-  '04','066_W_Arithmetic "$1" on untyped pointer is unportable to {$T+}, s'+
-  'uggest typecast'#000+
-  '04076_E_Can'#039't take address of a subroutine marked as local'#000+
+  '04066_W_Arithmetic "$1" on untyped pointer is unportable to {$T+}, sug'+
+  'gest typecast'#000+
+  '04076_E','_Can'#039't take address of a subroutine marked as local'#000+
   '04077_E_Can'#039't export subroutine marked as local from a unit'#000+
   '04078_E_Type is not automatable: "$1"'#000+
-  '0','4079_H_Converting the operands to "$1" before doing the add could p'+
-  'revent overflow errors.'#000+
+  '04079_H_Converting the operands to "$1" before doing the add could pre'+
+  'vent overflow errors','.'#000+
   '04080_H_Converting the operands to "$1" before doing the subtract coul'+
   'd prevent overflow errors.'#000+
-  '04081_H_Converting the operands to "$1" before doing',' the multiply co'+
-  'uld prevent overflow errors.'#000+
-  '04082_W_Converting pointers to signed integers may result in wrong com'+
-  'parison results and range errors, use an unsigned type instead.'#000+
+  '04081_H_Converting the operands to "$1" before doing the multiply coul'+
+  'd prevent overflow errors.'#000+
+  '04082_W_Converting pointers to signed intege','rs may result in wrong c'+
+  'omparison results and range errors, use an unsigned type instead.'#000+
   '04083_E_Interface type $1 has no valid GUID'#000+
-  '04084_E_Invalid s','elector name "$1"'#000+
+  '04084_E_Invalid selector name "$1"'#000+
   '04085_E_Expected Objective-C method, but got $1'#000+
-  '04086_E_Expected Objective-C method or constant method name'#000+
+  '04086_E_Expected Object','ive-C method or constant method name'#000+
   '04087_E_No type info available for this type'#000+
   '04088_E_Ordinal or string expression expected'#000+
-  '04089_E_String expressi','on expected'#000+
+  '04089_E_String expression expected'#000+
   '04090_W_Converting 0 to NIL'#000+
-  '04091_E_Objective-C protocol type expected, but got "$1"'#000+
+  '04091_E_Objective-C protocol type expected, but g','ot "$1"'#000+
   '04092_E_The type "$1" is not supported for interaction with the Object'+
   'ive-C runtime.'#000+
   '04093_E_Class or objcclass type expected, but got "$1"'#000+
-  '040','94_E_Objcclass type expected'#000+
-  '04095_W_Coerced univ parameter type in procedural variable may cause c'+
-  'rash or memory corruption: $1 to $2'#000+
+  '04094_E_Objcclass type expected'#000+
+  '04095_W_Coerced univ parameter type in procedural variable m','ay cause'+
+  ' crash or memory corruption: $1 to $2'#000+
   '04096_E_Type parameters of specializations of generics cannot referenc'+
   'e the currently specialized type'#000+
-  '04','097_E_Type parameters are not allowed on non-generic class/record/'+
-  'object procedure or function'#000+
+  '04097_E_Type parameters are not allowed on non-generic class/record/ob'+
+  'ject procedure or fun','ction'#000+
   '04098_E_Generic declaration of "$1" differs from previous declaration'#000+
   '04099_E_Helper type expected'#000+
   '04100_E_Record type expected'#000+
-  '04101_E_Derived c','lass helper must extend a subclass of "$1" or the c'+
-  'lass itself'#000+
-  '04102_E_Derived record helper must extend "$1"'#000+
+  '04101_E_Derived class helper must extend a subclass of "$1" or the cla'+
+  'ss itself'#000+
+  '04102_E_Derived record hel','per must extend "$1"'#000+
   '05000_E_Identifier not found "$1"'#000+
   '05001_F_Internal Error in SymTableStack()'#000+
   '05002_E_Duplicate identifier "$1"'#000+
-  '05003_H_Identifier a','lready defined in $1 at line $2'#000+
+  '05003_H_Identifier already defined in $1 at line $2'#000+
   '05004_E_Unknown identifier "$1"'#000+
-  '05005_E_Forward declaration not solved "$1"'#000+
+  '05005_E_Forward declarati','on not solved "$1"'#000+
   '05007_E_Error in type definition'#000+
   '05009_E_Forward type not resolved "$1"'#000+
-  '05010_E_Only static variables can be used in static methods ','or outsi'+
-  'de methods'#000+
+  '05010_E_Only static variables can be used in static methods or outside'+
+  ' methods'#000+
   '05012_F_record or class type expected'#000+
-  '05013_E_Instances of classes or objects with an abstract method are no'+
-  't allowed'#000+
+  '05013_E_Instances of classes or ','objects with an abstract method are '+
+  'not allowed'#000+
   '05014_W_Label not defined "$1"'#000+
   '05015_E_Label used but not defined "$1"'#000+
-  '05016_E_Illegal label declaratio','n'#000+
+  '05016_E_Illegal label declaration'#000+
   '05017_E_GOTO and LABEL are not supported (use switch -Sg)'#000+
   '05018_E_Label not found'#000+
-  '05019_E_identifier isn'#039't a label'#000+
+  '05019','_E_identifier isn'#039't a label'#000+
   '05020_E_label already defined'#000+
   '05021_E_illegal type declaration of set elements'#000+
-  '05022_E_Forward class definition not resolve','d "$1"'#000+
+  '05022_E_Forward class definition not resolved "$1"'#000+
   '05023_H_Unit "$1" not used in $2'#000+
   '05024_H_Parameter "$1" not used'#000+
-  '05025_N_Local variable "$1" not used'#000+
+  '05025_N_Local var','iable "$1" not used'#000+
   '05026_H_Value parameter "$1" is assigned but never used'#000+
   '05027_N_Local variable "$1" is assigned but never used'#000+
-  '05028_H_Local $1 "$2','" is not used'#000+
+  '05028_H_Local $1 "$2" is not used'#000+
   '05029_N_Private field "$1.$2" is never used'#000+
-  '05030_N_Private field "$1.$2" is assigned but never used'#000+
+  '05030_N_Private field "$1.$2" i','s assigned but never used'#000+
   '05031_N_Private method "$1.$2" never used'#000+
   '05032_E_Set type expected'#000+
   '05033_W_Function result does not seem to be set'#000+
-  '05034_W_T','ype "$1" is not aligned correctly in current record for C'#000+
-  '05035_E_Unknown record field identifier "$1"'#000+
+  '05034_W_Type "$1" is not aligned correctly in current record for C'#000+
+  '05035_E_Unknown record field id','entifier "$1"'#000+
   '05036_W_Local variable "$1" does not seem to be initialized'#000+
   '05037_W_Variable "$1" does not seem to be initialized'#000+
-  '05038_E_identifier iden','ts no member "$1"'#000+
+  '05038_E_identifier idents no member "$1"'#000+
   '05039_H_Found declaration: $1'#000+
   '05040_E_Data element too large'#000+
-  '05042_E_No matching implementation for interface method "$1" found'#000+
+  '05042_E_No',' matching implementation for interface method "$1" found'#000+
   '05043_W_Symbol "$1" is deprecated'#000+
   '05044_W_Symbol "$1" is not portable'#000+
-  '05055_W_Symbol "$1" is n','ot implemented'#000+
+  '05055_W_Symbol "$1" is not implemented'#000+
   '05056_E_Can'#039't create unique type from this type'#000+
-  '05057_H_Local variable "$1" does not seem to be initialized'#000+
+  '05057_H_Local variable "$1','" does not seem to be initialized'#000+
   '05058_H_Variable "$1" does not seem to be initialized'#000+
   '05059_W_Function result variable does not seem to initialized'#000+
-  '0','5060_H_Function result variable does not seem to be initialized'#000+
-  '05061_W_Variable "$1" read but nowhere assigned'#000+
+  '05060_H_Function result variable does not seem to be initialized'#000+
+  '05061_W_Variable "$1" rea','d but nowhere assigned'#000+
   '05062_H_Found abstract method: $1'#000+
   '05063_W_Symbol "$1" is experimental'#000+
-  '05064_W_Forward declaration "$1" not resolved, assumed ext','ernal'#000+
+  '05064_W_Forward declaration "$1" not resolved, assumed external'#000+
   '05065_W_Symbol "$1" is belongs to a library'#000+
-  '05066_W_Symbol "$1" is deprecated: "$2"'#000+
+  '05066_W_Symbol "$1" is deprecated: "$2"',#000+
   '05067_E_Cannot find an enumerator for the type "$1"'#000+
   '05068_E_Cannot find a "MoveNext" method in enumerator "$1"'#000+
-  '05069_E_Cannot find a "Current" propert','y in enumerator "$1"'#000+
-  '05070_E_Mismatch between number of declared parameters and number of c'+
-  'olons in message string.'#000+
+  '05069_E_Cannot find a "Current" property in enumerator "$1"'#000+
+  '05070_E_Mismatch between number of declared parameters and number of',' '+
+  'colons in message string.'#000+
   '05071_N_Private type "$1.$2" never used'#000+
   '05072_N_Private const "$1.$2" never used'#000+
-  '05073_N_Private property "$1.$2" never used',#000+
+  '05073_N_Private property "$1.$2" never used'#000+
   '05074_W_Unit "$1" is deprecated'#000+
   '05075_W_Unit "$1" is deprecated: "$2"'#000+
-  '05076_W_Unit "$1" is not portable'#000+
+  '05076_W_Unit "$1" ','is not portable'#000+
   '05077_W_Unit "$1" is belongs to a library'#000+
   '05078_W_Unit "$1" is not implemented'#000+
   '05079_W_Unit "$1" is experimental'#000+
-  '05080_E_No complete de','finition of the formally declared objcclass "$'+
-  '1" is in scope'#000+
-  '05081_E_Gotos into initialization or finalization blocks of units are '+
-  'not allowed'#000+
+  '05080_E_No complete definition of the formally declared objcclass "$1"'+
+  ' is in scope'#000+
+  '05081_E_Gotos into initializ','ation or finalization blocks of units ar'+
+  'e not allowed'#000+
   '05082=E_Invalid external name "$1" for formal class "$2"'#000+
-  '05083=E_Complete class definition with e','xternal name "$1" here'#000+
+  '05083=E_Complete class definition with external name "$1" here'#000+
   '06009_E_Parameter list size exceeds 65535 bytes'#000+
-  '06012_E_File types must be var parameters'#000+
+  '06012_E_File types',' must be var parameters'#000+
   '06013_E_The use of a far pointer isn'#039't allowed there'#000+
   '06015_E_EXPORT declared functions can'#039't be called'#000+
-  '06016_W_Possible illegal',' call of constructor or destructor'#000+
+  '06016_W_Possible illegal call of constructor or destructor'#000+
   '06017_N_Inefficient code'#000+
   '06018_W_unreachable code'#000+
-  '06020_E_Abstract methods can'#039't be called directly'#000+
+  '0602','0_E_Abstract methods can'#039't be called directly'#000+
   '06027_DL_Register $1 weight $2 $3'#000+
   '06029_DL_Stack frame is omitted'#000+
-  '06031_E_Object or class methods can'#039't b','e inline.'#000+
+  '06031_E_Object or class methods can'#039't be inline.'#000+
   '06032_E_Procvar calls cannot be inline.'#000+
-  '06033_E_No code for inline procedure stored'#000+
+  '06033_E_No code for inline procedure st','ored'#000+
   '06035_E_Element zero of an ansi/wide- or longstring can'#039't be acces'+
   'sed, use (set)length instead'#000+
-  '06037_E_Constructors or destructors cannot be calle','d inside a '#039'w'+
-  'ith'#039' clause'#000+
+  '06037_E_Constructors or destructors cannot be called inside a '#039'wit'+
+  'h'#039' clause'#000+
   '06038_E_Cannot call message handler methods directly'#000+
-  '06039_E_Jump in or outside of an exception block'#000+
+  '06039_E_Jum','p in or outside of an exception block'#000+
   '06040_E_Control flow statements aren'#039't allowed in a finally block'#000+
-  '06041_W_Parameters size exceeds limit for certa','in cpu'#039's'#000+
+  '06041_W_Parameters size exceeds limit for certain cpu'#039's'#000+
   '06042_W_Local variable size exceed limit for certain cpu'#039's'#000+
-  '06043_E_Local variables size exceeds supported limit'#000+
+  '06043_E_Local variabl','es size exceeds supported limit'#000+
   '06044_E_BREAK not allowed'#000+
   '06045_E_CONTINUE not allowed'#000+
-  '06046_F_Unknown compilerproc "$1". Check if you use the correct ','run '+
-  'time library.'#000+
+  '06046_F_Unknown compilerproc "$1". Check if you use the correct run ti'+
+  'me library.'#000+
   '06047_F_Cannot find system type "$1". Check if you use the correct run'+
-  ' time library.'#000+
+  ' ','time library.'#000+
   '06048_H_Inherited call to abstract method ignored'#000+
   '06049_E_Goto label "$1" not defined or optimized away'#000+
-  '06050_F_Cannot find type "$1" in ','unit "$2". Check if you use the cor'+
-  'rect run time library.'#000+
-  '06051_E_Interprocedural gotos are allowed only to outer subroutines'#000+
+  '06050_F_Cannot find type "$1" in unit "$2". Check if you use the corre'+
+  'ct run time library.'#000+
+  '06051_E_Interprocedural gotos a','re allowed only to outer subroutines'#000+
   '06052_E_Label must be defined in the same scope as it is declared'#000+
-  '06053_E_Leaving procedures containing explicit o','r implicit exception'+
-  's frames using goto is not allowed'#000+
-  '07000_DL_Starting $1 styled assembler parsing'#000+
+  '06053_E_Leaving procedures containing explicit or implicit exceptions '+
+  'frames using goto is not allowed'#000+
+  '07000_DL_Starting $1 styled assemb','ler parsing'#000+
   '07001_DL_Finished $1 styled assembler parsing'#000+
   '07002_E_Non-label pattern contains @'#000+
   '07004_E_Error building record offset'#000+
-  '07005_E_OFFSET used',' without identifier'#000+
+  '07005_E_OFFSET used without identifier'#000+
   '07006_E_TYPE used without identifier'#000+
-  '07007_E_Cannot use local variable or parameters here'#000+
+  '07007_E_Cannot use local variabl','e or parameters here'#000+
   '07008_E_need to use OFFSET here'#000+
   '07009_E_need to use $ here'#000+
   '07010_E_Cannot use multiple relocatable symbols'#000+
-  '07011_E_Relocatable sym','bol can only be added'#000+
+  '07011_E_Relocatable symbol can only be added'#000+
   '07012_E_Invalid constant expression'#000+
-  '07013_E_Relocatable symbol is not allowed'#000+
+  '07013_E_Relocatable symbol is n','ot allowed'#000+
   '07014_E_Invalid reference syntax'#000+
   '07015_E_You cannot reach $1 from that code'#000+
   '07016_E_Local symbols/labels aren'#039't allowed as references'#000+
-  '07017_','E_Invalid base and index register usage'#000+
+  '07017_E_Invalid base and index register usage'#000+
   '07018_W_Possible error in object field handling'#000+
-  '07019_E_Wrong scale factor specified'#000+
+  '0','7019_E_Wrong scale factor specified'#000+
   '07020_E_Multiple index register usage'#000+
   '07021_E_Invalid operand type'#000+
   '07022_E_Invalid string as opcode operand: $1'#000+
-  '070','23_W_@CODE and @DATA not supported'#000+
+  '07023_W_@CODE and @DATA not supported'#000+
   '07024_E_Null label references are not allowed'#000+
-  '07025_E_Divide by zero in asm evaluator'#000+
+  '07025_E_','Divide by zero in asm evaluator'#000+
   '07026_E_Illegal expression'#000+
   '07027_E_escape sequence ignored: $1'#000+
   '07028_E_Invalid symbol reference'#000+
-  '07029_W_Fwait can cause',' emulation problems with emu387'#000+
+  '07029_W_Fwait can cause emulation problems with emu387'#000+
   '07030_W_$1 without operand translated into $1P'#000+
-  '07031_W_ENTER instruction is not supported by Linux kernel'#000+
+  '07031_W_EN','TER instruction is not supported by Linux kernel'#000+
   '07032_W_Calling an overload function in assembler'#000+
   '07033_E_Unsupported symbol type for operand'#000+
-  '07034_E_','Constant value out of bounds'#000+
+  '07034_E_Constant value out of bounds'#000+
   '07035_E_Error converting decimal $1'#000+
-  '07036_E_Error converting octal $1'#000+
+  '07036_E_Error converting',' octal $1'#000+
   '07037_E_Error converting binary $1'#000+
   '07038_E_Error converting hexadecimal $1'#000+
   '07039_H_$1 translated to $2'#000+
-  '07040_W_$1 is associated to an overloa','ded function'#000+
+  '07040_W_$1 is associated to an overloaded function'#000+
   '07041_E_Cannot use SELF outside a method'#000+
-  '07042_E_Cannot use OLDEBP outside a nested procedure'#000+
+  '07042_E_Cannot use OLDEBP outside a',' nested procedure'#000+
   '07043_W_Procedures can'#039't return any value in asm code'#000+
   '07044_E_SEG not supported'#000+
-  '07045_E_Size suffix and destination or source size do',' not match'#000+
+  '07045_E_Size suffix and destination or source size do not match'#000+
   '07046_W_Size suffix and destination or source size do not match'#000+
-  '07047_E_Assembler syntax error'#000+
+  '07047_E_Assemb','ler syntax error'#000+
   '07048_E_Invalid combination of opcode and operands'#000+
   '07049_E_Assembler syntax error in operand'#000+
-  '07050_E_Assembler syntax error in constan','t'#000+
+  '07050_E_Assembler syntax error in constant'#000+
   '07051_E_Invalid String expression'#000+
-  '07052_W_constant with symbol $1 for address which is not on a pointer'#000+
+  '07052_W_constant with symbol $1 for address which is ','not on a pointe'+
+  'r'#000+
   '07053_E_Unrecognized opcode $1'#000+
   '07054_E_Invalid or missing opcode'#000+
   '07055_E_Invalid combination of prefix and opcode: $1'#000+
-  '07056_E_Invalid ','combination of override and opcode: $1'#000+
+  '07056_E_Invalid combination of override and opcode: $1'#000+
   '07057_E_Too many operands on line'#000+
-  '07058_W_NEAR ignored'#000+
+  '07058_W_NEAR ign','ored'#000+
   '07059_W_FAR ignored'#000+
   '07060_E_Duplicate local symbol $1'#000+
   '07061_E_Undefined local symbol $1'#000+
   '07062_E_Unknown label identifier $1'#000+
-  '07063_E_Invalid regist','er name'#000+
+  '07063_E_Invalid register name'#000+
   '07064_E_Invalid floating point register name'#000+
   '07066_W_Modulo not supported'#000+
-  '07067_E_Invalid floating point constant $1'#000+
+  '07067_E','_Invalid floating point constant $1'#000+
   '07068_E_Invalid floating point expression'#000+
   '07069_E_Wrong symbol type'#000+
-  '07070_E_Cannot index a local var or parameter w','ith a register'#000+
+  '07070_E_Cannot index a local var or parameter with a register'#000+
   '07071_E_Invalid segment override expression'#000+
-  '07072_W_Identifier $1 supposed external'#000+
+  '07072_W_Identifier $1 supposed',' external'#000+
   '07073_E_Strings not allowed as constants'#000+
   '07074_No type of variable specified'#000+
   '07075_E_assembler code not returned to text section'#000+
-  '07076_E_Not ','a directive or local symbol $1'#000+
+  '07076_E_Not a directive or local symbol $1'#000+
   '07077_E_Using a defined name as a local label'#000+
-  '07078_E_Dollar token is used without an identifier'#000+
+  '07078_E_Doll','ar token is used without an identifier'#000+
   '07079_W_32bit constant created for address'#000+
   '07080_N_.align is target specific, use .balign or .p2align'#000+
-  '07081_E_Ca','n'#039't access fields directly for parameters'#000+
-  '07082_E_Can'#039't access fields of objects/classes directly'#000+
+  '07081_E_Can'#039't access fields directly for parameters'#000+
+  '07082_E_Can'#039't access fields of objects/classes ','directly'#000+
   '07083_E_No size specified and unable to determine the size of the oper'+
   'ands'#000+
   '07084_E_Cannot use RESULT in this function'#000+
-  '07086_W_"$1" without ope','rand translated into "$1 %st,%st(1)"'#000+
-  '07087_W_"$1 %st(n)" translated into "$1 %st,%st(n)"'#000+
+  '07086_W_"$1" without operand translated into "$1 %st,%st(1)"'#000+
+  '07087_W_"$1 %st(n)" translated into "$1 %st,%st(n)"'#000,
   '07088_W_"$1 %st(n)" translated into "$1 %st(n),%st"'#000+
   '07089_E_Char < not allowed here'#000+
   '07090_E_Char > not allowed here'#000+
   '07093_W_ALIGN not supported'#000+
-  '07094_E','_Inc and Dec cannot be together'#000+
+  '07094_E_Inc and Dec cannot be together'#000+
   '07095_E_Invalid reglist for movem'#000+
-  '07096_E_Reglist invalid for opcode'#000+
+  '07096_E_Reglist invalid',' for opcode'#000+
   '07097_E_Higher cpu mode required ($1)'#000+
   '07098_W_No size specified and unable to determine the size of the oper'+
   'ands, using DWORD as default'#000+
-  '07','099_E_Syntax error while trying to parse a shifter operand'#000+
-  '07100_E_Address of packed component is not at a byte boundary'#000+
+  '07099_E_Syntax error while trying to parse a shifter operand'#000+
+  '07100_E_Address of packed comp','onent is not at a byte boundary'#000+
   '07101_W_No size specified and unable to determine the size of the oper'+
   'ands, using BYTE as default'#000+
-  '07102_W_Use of +offse','t(%ebp) for parameters invalid here'#000+
-  '07103_W_Use of +offset(%ebp) is not compatible with regcall convention'+
-  #000+
+  '07102_W_Use of +offset(%ebp) for parameters invalid here'#000+
+  '07103_W_Use of +offset(%ebp) is not compatible with r','egcall conventi'+
+  'on'#000+
   '07104_W_Use of -offset(%ebp) is not recommended for local variable acc'+
   'ess'#000+
-  '07105_W_Use of -offset(%esp), access may cause a crash or v','alue may '+
-  'be lost'#000+
+  '07105_W_Use of -offset(%esp), access may cause a crash or value may be'+
+  ' lost'#000+
   '07106_E_VMTOffset must be used in combination with a virtual method, a'+
-  'nd "$1" is not virtual'#000+
+  'nd',' "$1" is not virtual'#000+
   '07107_E_Generating PIC, but reference is not PIC-safe'#000+
   '07108_E_All registers in a register set must be of the same kind and w'+
   'idth'#000+
-  '0','7109_E_A register set cannot be empty'#000+
-  '07110_W_@GOTPCREL is useless and potentially dangereous for local symb'+
-  'ols'#000+
+  '07109_E_A register set cannot be empty'#000+
+  '07110_W_@GOTPCREL is useless and potentially danger','eous for local sy'+
+  'mbols'#000+
   '08000_F_Too many assembler files'#000+
   '08001_F_Selected assembler output not supported'#000+
   '08002_F_Comp not supported'#000+
-  '08003_F_Direct not s','upport for binary writers'#000+
+  '08003_F_Direct not support for binary writers'#000+
   '08004_E_Allocating of data is only allowed in bss section'#000+
-  '08005_F_No binary writer selected'#000+
+  '08005','_F_No binary writer selected'#000+
   '08006_E_Asm: Opcode $1 not in table'#000+
   '08007_E_Asm: $1 invalid combination of opcode and operands'#000+
-  '08008_E_Asm: 16 Bit referen','ces not supported'#000+
+  '08008_E_Asm: 16 Bit references not supported'#000+
   '08009_E_Asm: Invalid effective address'#000+
-  '08010_E_Asm: Immediate or reference expected'#000+
+  '08010_E_Asm: Immediate or refere','nce expected'#000+
   '08011_E_Asm: $1 value exceeds bounds $2'#000+
   '08012_E_Asm: Short jump is out of range $1'#000+
   '08013_E_Asm: Undefined label $1'#000+
-  '08014_E_Asm: Comp type ','not supported for this target'#000+
+  '08014_E_Asm: Comp type not supported for this target'#000+
   '08015_E_Asm: Extended type not supported for this target'#000+
-  '08016_E_Asm: Duplicate label $1'#000+
+  '08','016_E_Asm: Duplicate label $1'#000+
   '08017_E_Asm: Redefined label $1'#000+
   '08018_E_Asm: First defined here'#000+
   '08019_E_Asm: Invalid register $1'#000+
-  '08020_E_Asm: 16 or 32 Bi','t references not supported'#000+
+  '08020_E_Asm: 16 or 32 Bit references not supported'#000+
   '08021_E_Asm: 64 Bit operands not supported'#000+
-  '09000_W_Source operating system redefined'#000+
+  '09000_W_Source oper','ating system redefined'#000+
   '09001_I_Assembling (pipe) $1'#000+
   '09002_E_Can'#039't create assembler file: $1'#000+
   '09003_E_Can'#039't create object file: $1'#000+
-  '09004_E_Can'#039't create a','rchive file: $1'#000+
+  '09004_E_Can'#039't create archive file: $1'#000+
   '09005_E_Assembler $1 not found, switching to external assembling'#000+
-  '09006_T_Using assembler: $1'#000+
+  '09006_T_','Using assembler: $1'#000+
   '09007_E_Error while assembling exitcode $1'#000+
   '09008_E_Can'#039't call the assembler, error $1 switching to external a'+
   'ssembling'#000+
-  '09009_I_Asse','mbling $1'#000+
+  '09009_I_Assembling $1'#000+
   '09010_I_Assembling with smartlinking $1'#000+
-  '09011_W_Object $1 not found, Linking may fail !'#000+
+  '09011_W_Object $1 not found, Linking ma','y fail !'#000+
   '09012_W_Library $1 not found, Linking may fail !'#000+
   '09013_E_Error while linking'#000+
   '09014_E_Can'#039't call the linker, switching to external linking'#000+
-  '0901','5_I_Linking $1'#000+
+  '09015_I_Linking $1'#000+
   '09016_E_Util $1 not found, switching to external linking'#000+
-  '09017_T_Using util $1'#000+
+  '09017_T_Using uti','l $1'#000+
   '09018_E_Creation of Executables not supported'#000+
   '09019_E_Creation of Dynamic/Shared Libraries not supported'#000+
   '09020_I_Closing script $1'#000+
-  '09021_E_resourc','e compiler "$1" not found, switching to external mode'+
-  #000+
+  '09021_E_resource compiler "$1" not found, switching to external mode'#000+
   '09022_I_Compiling resource $1'#000+
-  '09023_T_unit $1 can'#039't be statically linked, switching to smart lin'+
-  'king'#000+
+  '09023','_T_unit $1 can'#039't be statically linked, switching to smart l'+
+  'inking'#000+
   '09024_T_unit $1 can'#039't be smart linked, switching to static linking'+
   #000+
-  '09025_T_unit $1 ca','n'#039't be shared linked, switching to static link'+
-  'ing'#000+
-  '09026_E_unit $1 can'#039't be smart or static linked'#000+
+  '09025_T_unit $1 can'#039't be shared linked, switching to static linkin'+
+  'g'#000+
+  '09026_E_unit $1 can'#039't be smart or stati','c linked'#000+
   '09027_E_unit $1 can'#039't be shared or static linked'#000+
   '09028_D_Calling resource compiler "$1" with "$2" as command line'#000+
-  '09029_E_Error while compilin','g resources'#000+
+  '09029_E_Error while compiling resources'#000+
   '09030_E_Can'#039't call the resource compiler "$1", switching to extern'+
   'al mode'#000+
-  '09031_E_Can'#039't open resource file "$1"'#000+
+  '090','31_E_Can'#039't open resource file "$1"'#000+
   '09032_E_Can'#039't write resource file "$1"'#000+
   '09128_F_Can'#039't post process executable $1'#000+
   '09129_F_Can'#039't open executable $1'#000+
-  '091','30_X_Size of Code: $1 bytes'#000+
+  '09130_X_Size of Code: $1 bytes'#000+
   '09131_X_Size of initialized data: $1 bytes'#000+
-  '09132_X_Size of uninitialized data: $1 bytes'#000+
+  '09132_X_Size of un','initialized data: $1 bytes'#000+
   '09133_X_Stack space reserved: $1 bytes'#000+
   '09134_X_Stack space committed: $1 bytes'#000+
-  '09200_F_Executable image size is too big for ','$1 target.'#000+
+  '09200_F_Executable image size is too big for $1 target.'#000+
   '09201_W_Object file "$1" contains 32-bit absolute relocation to symbol'+
   ' "$2".'#000+
-  '10000_T_Unitsearch: $1'#000+
+  '1','0000_T_Unitsearch: $1'#000+
   '10001_T_PPU Loading $1'#000+
   '10002_U_PPU Name: $1'#000+
   '10003_U_PPU Flags: $1'#000+
   '10004_U_PPU Crc: $1'#000+
   '10005_U_PPU Time: $1'#000+
-  '10006_U_PPU File too s','hort'#000+
+  '10006_U_PPU File too short'#000+
   '10007_U_PPU Invalid Header (no PPU at the begin)'#000+
   '10008_U_PPU Invalid Version $1'#000+
-  '10009_U_PPU is compiled for another processor'#000+
+  '1000','9_U_PPU is compiled for another processor'#000+
   '10010_U_PPU is compiled for another target'#000+
   '10011_U_PPU Source: $1'#000+
   '10012_U_Writing $1'#000+
-  '10013_F_Can'#039't Write PPU-','File'#000+
+  '10013_F_Can'#039't Write PPU-File'#000+
   '10014_F_Error reading PPU-File'#000+
   '10015_F_unexpected end of PPU-File'#000+
-  '10016_F_Invalid PPU-File entry: $1'#000+
+  '10016_F_Invalid PP','U-File entry: $1'#000+
   '10017_F_PPU Dbx count problem'#000+
   '10018_E_Illegal unit name: $1'#000+
   '10019_F_Too much units'#000+
   '10020_F_Circular unit reference between $1 and $2'#000+
-  '1','0021_F_Can'#039't compile unit $1, no sources available'#000+
-  '10022_F_Can'#039't find unit $1 used by $2'#000+
+  '10021_F_Can'#039't compile unit $1, no sources available'#000+
+  '10022_F_Can'#039't find unit $1 used by $2'#000,
   '10023_W_Unit $1 was not found but $2 exists'#000+
   '10024_F_Unit $1 searched but $2 found'#000+
   '10025_W_Compiling the system unit requires the -Us switch'#000+
-  '10026_F_The','re were $1 errors compiling module, stopping'#000+
+  '10026_F_There were $1 errors compiling module, stopping'#000+
   '10027_U_Load from $1 ($2) unit $3'#000+
-  '10028_U_Recompiling $1, checksum changed for $2'#000+
+  '10028_U_Re','compiling $1, checksum changed for $2'#000+
   '10029_U_Recompiling $1, source found only'#000+
   '10030_U_Recompiling unit, static lib is older than ppufile'#000+
-  '10031_U_Reco','mpiling unit, shared lib is older than ppufile'#000+
-  '10032_U_Recompiling unit, obj and asm are older than ppufile'#000+
+  '10031_U_Recompiling unit, shared lib is older than ppufile'#000+
+  '10032_U_Recompiling unit, obj and asm are ','older than ppufile'#000+
   '10033_U_Recompiling unit, obj is older than asm'#000+
   '10034_U_Parsing interface of $1'#000+
   '10035_U_Parsing implementation of $1'#000+
-  '10036_U_Second ','load for unit $1'#000+
+  '10036_U_Second load for unit $1'#000+
   '10037_U_PPU Check file $1 time $2'#000+
-  '10040_W_Can'#039't recompile unit $1, but found modifed include files'#000+
+  '10040_W_Can'#039't recompile unit $1, but f','ound modifed include files'+
+  #000+
   '10041_U_File $1 is newer than the one used for creating PPU file $2'#000+
-  '10042_U_Trying to use a unit which was compiled with a d','ifferent FPU'+
-  ' mode'#000+
+  '10042_U_Trying to use a unit which was compiled with a different FPU m'+
+  'ode'#000+
   '10043_U_Loading interface units from $1'#000+
-  '10044_U_Loading implementation units from $1'#000+
+  '10044_U_Loading implementation ','units from $1'#000+
   '10045_U_Interface CRC changed for unit $1'#000+
   '10046_U_Implementation CRC changed for unit $1'#000+
   '10047_U_Finished compiling unit $1'#000+
-  '10048_U_Addin','g dependency: $1 depends on $2'#000+
+  '10048_U_Adding dependency: $1 depends on $2'#000+
   '10049_U_No reload, is caller: $1'#000+
-  '10050_U_No reload, already in second compile: $1'#000+
+  '10050_U_No reload, alread','y in second compile: $1'#000+
   '10051_U_Flag for reload: $1'#000+
   '10052_U_Forced reloading'#000+
   '10053_U_Previous state of $1: $2'#000+
-  '10054_U_Already compiling $1, setting sec','ond compile'#000+
+  '10054_U_Already compiling $1, setting second compile'#000+
   '10055_U_Loading unit $1'#000+
   '10056_U_Finished loading unit $1'#000+
-  '10057_U_Registering new unit $1'#000+
+  '10057_U_Registering ','new unit $1'#000+
   '10058_U_Re-resolving unit $1'#000+
   '10059_U_Skipping re-resolving unit $1, still loading used units'#000+
-  '10060_U_Unloading resource unit $1 (not needed',')'#000+
+  '10060_U_Unloading resource unit $1 (not needed)'#000+
   '10061_E_Unit $1 was compiled using a different whole program optimizat'+
-  'ion feedback input ($2, $3); recompile it without wpo or use the same '+
-  'wpo feedback input file for this compilation invocation'#000+
-  '10062_U_Indirect interface (objects/classe','s) CRC changed for unit $1'+
-  #000+
+  'ion feedback inpu','t ($2, $3); recompile it without wpo or use the sam'+
+  'e wpo feedback input file for this compilation invocation'#000+
+  '10062_U_Indirect interface (objects/classes) CRC changed for unit $1'#000+
   '11000_O_$1 [options] <inputfile> [options]'#000+
-  '11001_W_Only one source file supported, changing source file to compil'+
-  'e from "$1" into "$2"'#000+
+  '11001_W_Only one so','urce file supported, changing source file to comp'+
+  'ile from "$1" into "$2"'#000+
   '11002_W_DEF file can be created only for OS/2'#000+
-  '11003_E_nested response files ar','e not supported'#000+
+  '11003_E_nested response files are not supported'#000+
   '11004_F_No source file name in command line'#000+
-  '11005_N_No option inside $1 config file'#000+
+  '11005_N_No option inside $1 c','onfig file'#000+
   '11006_E_Illegal parameter: $1'#000+
   '11007_H_-? writes help pages'#000+
   '11008_F_Too many config files nested'#000+
   '11009_F_Unable to open file $1'#000+
-  '11010_D_Readi','ng further options from $1'#000+
+  '11010_D_Reading further options from $1'#000+
   '11011_W_Target is already set to: $1'#000+
-  '11012_W_Shared libs not supported on DOS platform, reverting to static'+
-  #000+
+  '11012_W_Shared libs not s','upported on DOS platform, reverting to stat'+
+  'ic'#000+
   '11013_F_In options file $1 at line $2 too many \var{\#IF(N)DEFs} encou'+
   'ntered'#000+
-  '11014_F_In options file $1 a','t line $2 unexpected \var{\#ENDIFs} enco'+
-  'untered'#000+
-  '11015_F_Open conditional at the end of the options file'#000+
+  '11014_F_In options file $1 at line $2 unexpected \var{\#ENDIFs} encoun'+
+  'tered'#000+
+  '11015_F_Open conditional at the end of th','e options file'#000+
   '11016_W_Debug information generation is not supported by this executab'+
   'le'#000+
   '11017_H_Try recompiling with -dGDB'#000+
-  '11018_W_You are using the ob','solete switch $1'#000+
+  '11018_W_You are using the obsolete switch $1'#000+
   '11019_W_You are using the obsolete switch $1, please use $2'#000+
-  '11020_N_Switching assembler to default source writing assembler'#000+
+  '11020_N_Swit','ching assembler to default source writing assembler'#000+
   '11021_W_Assembler output selected "$1" is not compatible with "$2"'#000+
-  '11022_W_"$1" assembler use force','d'#000+
+  '11022_W_"$1" assembler use forced'#000+
   '11026_T_Reading options from file $1'#000+
   '11027_T_Reading options from environment $1'#000+
-  '11028_D_Handling option "$1"'#000+
+  '11028_','D_Handling option "$1"'#000+
   '11029_O_*** press enter ***'#000+
   '11030_H_Start of reading config file $1'#000+
   '11031_H_End of reading config file $1'#000+
-  '11032_D_interpreting o','ption "$1"'#000+
+  '11032_D_interpreting option "$1"'#000+
   '11036_D_interpreting firstpass option "$1"'#000+
-  '11033_D_interpreting file option "$1"'#000+
+  '11033_D_interpreting file option "$','1"'#000+
   '11034_D_Reading config file "$1"'#000+
   '11035_D_found source file name "$1"'#000+
   '11039_E_Unknown code page'#000+
   '11040_F_Config file $1 is a directory'#000+
-  '11041_W_Assembl','er output selected "$1" cannot generate debug info, d'+
-  'ebugging disabled'#000+
-  '11042_W_Use of ppc386.cfg is deprecated, please use fpc.cfg instead'#000+
+  '11041_W_Assembler output selected "$1" cannot generate debug info, deb'+
+  'ugging disabled'#000+
+  '11042_W_Use of ppc','386.cfg is deprecated, please use fpc.cfg instead'#000+
   '11043_F_In options file $1 at line $2 \var{\#ELSE} directive without \'+
   'var{\#IF(N)DEF} found'#000+
-  '11044_F_O','ption "$1" is not, or not yet, supported on the current tar'+
-  'get platform'#000+
-  '11045_F_The feature "$1" is not, or not yet, supported on the selected'+
-  ' target platform'#000+
+  '11044_F_Option "$1" is not, or not yet, supported on the current targe'+
+  't platform'#000+
+  '11045_F_The featu','re "$1" is not, or not yet, supported on the select'+
+  'ed target platform'#000+
   '11046_N_DWARF debug information cannot be used with smart linking on t'+
-  'his target,',' switching to static linking'#000+
-  '11047_W_Option "$1" is ignored for the current target platform.'#000+
+  'his target, switching to static linking'#000+
+  '11047_W_Option "$1" is ignored for the current target platfo','rm.'#000+
   '11048_W_Disabling external debug information because it is unsupported'+
   ' for the selected target/debug format combination.'#000+
-  '12000_F_Cannot open whole ','program optimization feedback file "$1"'#000+
-  '12001_D_Processing whole program optimization information in wpo feedb'+
-  'ack file "$1"'#000+
+  '12000_F_Cannot open whole program optimization feedback file "$1"'#000+
+  '12001_D_Processing whole program optimization inf','ormation in wpo fee'+
+  'dback file "$1"'#000+
   '12002_D_Finished processing the whole program optimization information'+
   ' in wpo feedback file "$1"'#000+
-  '12003_E_Expected se','ction header, but got "$2" at line $1 of wpo feed'+
-  'back file'#000+
-  '12004_W_No handler registered for whole program optimization section "'+
-  '$2" at line $1 of wpo feedback file, ignoring'#000+
-  '12005_D_Found whole program optimization section "$1" with inform','ati'+
-  'on about "$2"'#000+
+  '12003_E_Expected section header, but got "$2" at line $1 of wpo feedba'+
+  'ck file'#000+
+  '12004_W_No handler registered ','for whole program optimization section'+
+  ' "$2" at line $1 of wpo feedback file, ignoring'#000+
+  '12005_D_Found whole program optimization section "$1" with information'+
+  ' about "$2"'#000+
   '12006_F_The selected whole program optimizations require a previously '+
-  'generated feedback file (use -Fw to specify)'#000+
+  'ge','nerated feedback file (use -Fw to specify)'#000+
   '12007_E_No collected information necessary to perform "$1" whole progr'+
   'am optimization found'#000+
-  '12008_F_Specify ','a whole program optimization feedback file to store '+
-  'the generated info in (using -FW)'#000+
-  '12009_E_Not generating any whole program optimization information, yet'+
-  ' a feedback file was specified (using -FW)'#000+
-  '12010_E_Not performing any whole program ','optimizations, yet an input'+
-  ' feedback file was specified (using -Fw)'#000+
-  '12011_D_Skipping whole program optimization section "$1", because not '+
-  'needed by the requested optimizations'#000+
-  '12012_W_Overriding previously read information for "$1" from fee','dbac'+
-  'k input file using information in section "$2"'#000+
-  '12013_E_Cannot extract symbol liveness information from program when s'+
-  'tripping symbols, use -Xs-'#000+
+  '12008_F_Specify a whole program optimization feedback file to store th'+
+  'e generated info in (using -FW)'#000+
+  '120','09_E_Not generating any whole program optimization information, y'+
+  'et a feedback file was specified (using -FW)'#000+
+  '12010_E_Not performing any whole program optimizations, yet an input f'+
+  'eedback file was specified (using -Fw)'#000+
+  '12011_D_Skipping whol','e program optimization section "$1", because no'+
+  't needed by the requested optimizations'#000+
+  '12012_W_Overriding previously read information for "$1" from feedback '+
+  'input file using information in section "$2"'#000+
+  '12013_E_Cannot extract symbol liveness',' information from program when'+
+  ' stripping symbols, use -Xs-'#000+
   '12014_E_Cannot extract symbol liveness information from program when w'+
   'hen not linking'#000+
-  '12015_','F_Cannot find "$1" or "$2" to extract symbol liveness informat'+
-  'ion from linked program'#000+
-  '12016_E_Error during reading symbol liveness information produced by "'+
-  '$1"'#000+
+  '12015_F_Cannot find "$1" or "$2" to extract symbol liveness informatio'+
+  'n from linked program'#000+
+  '120','16_E_Error during reading symbol liveness information produced by'+
+  ' "$1"'#000+
   '12017_F_Error executing "$1" (exitcode: $2) to extract symbol informat'+
-  'ion from l','inked program'#000+
+  'ion from linked program'#000+
   '12018_E_Collection of symbol liveness information can only help when u'+
-  'sing smart linking, use -CX -XX'#000+
+  'sing ','smart linking, use -CX -XX'#000+
   '12019_E_Cannot create specified whole program optimisation feedback fi'+
   'le "$1"'#000+
-  '11023_Free Pascal Compiler version $FPCFULLVER','SION [$FPCDATE] for $F'+
-  'PCCPU'#010+
+  '11023_Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPC'+
+  'CPU'#010+
   'Copyright (c) 1993-2011 by Florian Klaempfl and others'#000+
-  '11024_Free Pascal Compiler version $FPCVERSION'#010+
+  '11024_','Free Pascal Compiler version $FPCVERSION'#010+
   #010+
   'Compiler Date      : $FPCDATE'#010+
   'Compiler CPU Target: $FPCCPU'#010+
@@ -1062,11 +1065,11 @@ const msgtxt : array[0..000246,1..240] of char=(
   'Supported targets:'#010+
   '  $OSTARGETS'#010+
   #010+
-  'Supported CPU in','struction sets:'#010+
+  'Supported CPU instruction sets:'#010+
   '  $INSTRUCTIONSETS'#010+
   #010+
   'Supported FPU instruction sets:'#010+
-  '  $FPUINSTRUCTIONSETS'#010+
+  '  $FPUINSTRUCTIONSETS',#010+
   #010+
   'Supported ABI targets:'#010+
   '  $ABITARGETS'#010+
@@ -1078,306 +1081,308 @@ const msgtxt : array[0..000246,1..240] of char=(
   '  All'#010+
   '  $WPOPTIMIZATIONS'#010+
   #010+
-  'Sup','ported Microcontroller types:'#010+
+  'Supported Microcontroller types:'#010+
   '  $CONTROLLERTYPES'#010+
   #010+
-  'This program comes under the GNU General Public Licence'#010+
+  'This program comes under the GNU Genera','l Public Licence'#010+
   'For more information read COPYING.FPC'#010+
   #010+
   'Report bugs, suggestions, etc. to:'#010+
   '                 http://bugs.freepascal.org'#010+
   'or'#010+
-  '             ','    [email protected]'#000+
-  '11025_**0*_Put + after a boolean switch option to enable it, - to disa'+
-  'ble it'#010+
+  '                 [email protected]'#000+
+  '11025_**0*_Put + after a boolean switch option to enable it, - to',' di'+
+  'sable it'#010+
   '**1a_The compiler doesn'#039't delete the generated assembler file'#010+
   '**2al_List sourcecode lines in assembler file'#010+
-  '**2an_List node info in assembl','er file'#010+
+  '**2an_List node info in assembler file'#010+
   '*L2ap_Use pipes instead of creating temporary assembler files'#010+
-  '**2ar_List register allocation/release info in assembler file'#010+
+  '**2ar_List register',' allocation/release info in assembler file'#010+
   '**2at_List temp allocation/release info in assembler file'#010+
   '**1A<x>_Output format:'#010+
-  '**2Adefault_Use default ass','embler'#010+
+  '**2Adefault_Use default assembler'#010+
   '3*2Aas_Assemble using GNU AS'#010+
-  '3*2Amacho_Mach-O (Darwin, Intel 32 bit) using internal writer'#010+
+  '3*2Amacho_Mach-O (Darwin, Intel 32 bit) using interna','l writer'#010+
   '3*2Anasmcoff_COFF (Go32v2) file using Nasm'#010+
   '3*2Anasmelf_ELF32 (Linux) file using Nasm'#010+
   '3*2Anasmwin32_Win32 object file using Nasm'#010+
-  '3*2Anasmwdosx_','Win32/WDOSX object file using Nasm'#010+
+  '3*2Anasmwdosx_Win32/WDOSX object file using Nasm'#010+
   '3*2Awasm_Obj file using Wasm (Watcom)'#010+
-  '3*2Anasmobj_Obj file using Nasm'#010+
+  '3*2Anasmobj_Obj ','file using Nasm'#010+
   '3*2Amasm_Obj file using Masm (Microsoft)'#010+
   '3*2Atasm_Obj file using Tasm (Borland)'#010+
   '3*2Aelf_ELF (Linux) using internal writer'#010+
-  '3*2Acoff_COFF',' (Go32v2) using internal writer'#010+
+  '3*2Acoff_COFF (Go32v2) using internal writer'#010+
   '3*2Apecoff_PE-COFF (Win32) using internal writer'#010+
-  '4*2Aas_Assemble using GNU AS'#010+
+  '4*2Aas_A','ssemble using GNU AS'#010+
   '6*2Aas_Unix o-file using GNU AS'#010+
   '6*2Agas_GNU Motorola assembler'#010+
   '6*2Amit_MIT Syntax (old GAS)'#010+
   '6*2Amot_Standard Motorola assembler'#010+
-  'A*','2Aas_Assemble using GNU AS'#010+
+  'A*2Aas_Assemble using GNU AS'#010+
   'P*2Aas_Assemble using GNU AS'#010+
   'S*2Aas_Assemble using GNU AS'#010+
-  '**1b_Generate browser info'#010+
+  '**1b','_Generate browser info'#010+
   '**2bl_Generate local symbol info'#010+
   '**1B_Build all modules'#010+
   '**1C<x>_Code generation options:'#010+
-  '**2C3<x>_Turn on ieee error checking fo','r constants'#010+
+  '**2C3<x>_Turn on ieee error checking for constants'#010+
   '**2Ca<x>_Select ABI, see fpc -i for possible values'#010+
-  '**2Cb_Generate big-endian code'#010+
+  '**2Cb_Generate big-endian',' code'#010+
   '**2Cc<x>_Set default calling convention to <x>'#010+
   '**2CD_Create also dynamic library (not supported)'#010+
-  '**2Ce_Compilation with emulated floating point o','pcodes'#010+
+  '**2Ce_Compilation with emulated floating point opcodes'#010+
   '**2Cf<x>_Select fpu instruction set to use, see fpc -i for possible va'+
   'lues'#010+
-  '**2CF<x>_Minimal floating point constant precision (default, 32, 64)'#010+
+  '**2CF<x','>_Minimal floating point constant precision (default, 32, 64)'+
+  #010+
   '**2Cg_Generate PIC code'#010+
   '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#010+
-  '**2Ci_IO-chec','king'#010+
+  '**2Ci_IO-checking'#010+
   '**2Cn_Omit linking stage'#010+
   '**2Co_Check overflow of integer operations'#010+
-  '**2CO_Check for possible overflow of integer operations'#010+
+  '**2CO_Check for ','possible overflow of integer operations'#010+
   '**2Cp<x>_Select instruction set, see fpc -i for possible values'#010+
   '**2CP<x>=<y>_ packing settings'#010+
-  '**3CPPACKSET=<y>','_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, '+
-  '4 and 8'#010+
+  '**3CPPACKSET=<y>_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 '+
+  'and 8'#010+
   '**2Cr_Range checking'#010+
-  '**2CR_Verify object method call validity'#010+
+  '**2CR_Ve','rify object method call validity'#010+
   '**2Cs<n>_Set stack checking size to <n>'#010+
   '**2Ct_Stack checking (for testing only, see manual)'#010+
-  '**2CX_Create also smartlin','ked library'#010+
+  '**2CX_Create also smartlinked library'#010+
   '**1d<x>_Defines the symbol <x>'#010+
   '**1D_Generate a DEF file'#010+
-  '**2Dd<x>_Set description to <x>'#010+
+  '**2Dd<x>_Set descript','ion to <x>'#010+
   '**2Dv<x>_Set DLL version to <x>'#010+
   '*O2Dw_PM application'#010+
   '**1e<x>_Set path to executable'#010+
   '**1E_Same as -Cn'#010+
   '**1fPIC_Same as -Cg'#010+
-  '**1F<x>_Set file na','mes and paths:'#010+
+  '**1F<x>_Set file names and paths:'#010+
   '**2Fa<x>[,y]_(for a program) load units <x> and [y] before uses is par'+
-  'sed'#010+
+  'sed'#010,
   '**2Fc<x>_Set input codepage to <x>'#010+
   '**2FC<x>_Set RC compiler binary name to <x>'#010+
   '**2Fd_Disable the compiler'#039's internal directory cache'#010+
-  '**2FD<x>_Set the d','irectory where to search for compiler utilities'#010+
+  '**2FD<x>_Set the directory where to search for compiler utilities'#010+
   '**2Fe<x>_Redirect error output to <x>'#010+
-  '**2Ff<x>_Add <x> to framework path (Darwin only)'#010+
+  '**2','Ff<x>_Add <x> to framework path (Darwin only)'#010+
   '**2FE<x>_Set exe/unit output path to <x>'#010+
   '**2Fi<x>_Add <x> to include path'#010+
-  '**2Fl<x>_Add <x> to library pat','h'#010+
+  '**2Fl<x>_Add <x> to library path'#010+
   '**2FL<x>_Use <x> as dynamic linker'#010+
-  '**2Fm<x>_Load unicode conversion table from <x>.txt in the compiler di'+
-  'r'#010+
+  '**2Fm<x>_Load unicode conversion table from <x>.txt ','in the compiler '+
+  'dir'#010+
   '**2Fo<x>_Add <x> to object path'#010+
   '**2Fr<x>_Load error message file <x>'#010+
   '**2FR<x>_Set resource (.res) linker to <x>'#010+
-  '**2Fu<x>_Add <x> to',' unit path'#010+
+  '**2Fu<x>_Add <x> to unit path'#010+
   '**2FU<x>_Set unit output path to <x>, overrides -FE'#010+
-  '**2FW<x>_Store generated whole-program optimization feedback in <x>'#010+
+  '**2FW<x>_Store generated w','hole-program optimization feedback in <x>'#010+
   '**2Fw<x>_Load previously stored whole-program optimization feedback fr'+
   'om <x>'#010+
-  '*g1g_Generate debug information ','(default format for target)'#010+
+  '*g1g_Generate debug information (default format for target)'#010+
   '*g2gc_Generate checks for pointers'#010+
-  '*g2gh_Use heaptrace unit (for memory leak/corruption debugging)'#010+
+  '*g2gh_Use heaptrace unit (','for memory leak/corruption debugging)'#010+
   '*g2gl_Use line info unit (show more info with backtraces)'#010+
   '*g2go<x>_Set debug information options'#010+
-  '*g3godwarfsets_ ','Enable DWARF '#039'set'#039' type debug information (b'+
-  'reaks gdb < 6.5)'#010+
-  '*g3gostabsabsincludes_ Store absolute/full include file paths in Stabs'+
-  #010+
+  '*g3godwarfsets_ Enable DWARF '#039'set'#039' type debug information (bre'+
+  'aks gdb < 6.5)'#010+
+  '*g3gostabsabsincludes_ Store',' absolute/full include file paths in Sta'+
+  'bs'#010+
   '*g3godwarfmethodclassprefix_ Prefix method names in DWARF with class n'+
   'ame'#010+
-  '*g2gp_Preserve case in stabs symbo','l names'#010+
+  '*g2gp_Preserve case in stabs symbol names'#010+
   '*g2gs_Generate Stabs debug information'#010+
-  '*g2gt_Trash local variables (to detect uninitialized uses)'#010+
+  '*g2gt_Trash local variables (to detect uni','nitialized uses)'#010+
   '*g2gv_Generates programs traceable with Valgrind'#010+
   '*g2gw_Generate DWARFv2 debug information (same as -gw2)'#010+
-  '*g2gw2_Generate DWARFv2 debug',' information'#010+
+  '*g2gw2_Generate DWARFv2 debug information'#010+
   '*g2gw3_Generate DWARFv3 debug information'#010+
-  '*g2gw4_Generate DWARFv4 debug information (experimental)'#010+
+  '*g2gw4_Generate DWARFv4 debug info','rmation (experimental)'#010+
   '**1i_Information'#010+
   '**2iD_Return compiler date'#010+
   '**2iV_Return short compiler version'#010+
   '**2iW_Return full compiler version'#010+
-  '**2iSO_Return',' compiler OS'#010+
+  '**2iSO_Return compiler OS'#010+
   '**2iSP_Return compiler host processor'#010+
   '**2iTO_Return target OS'#010+
-  '**2iTP_Return target processor'#010+
+  '**2iTP_Return ','target processor'#010+
   '**1I<x>_Add <x> to include path'#010+
   '**1k<x>_Pass <x> to the linker'#010+
   '**1l_Write logo'#010+
   '**1M<x>_Set language mode to <x>'#010+
-  '**2Mfpc_Free Pascal di','alect (default)'#010+
+  '**2Mfpc_Free Pascal dialect (default)'#010+
   '**2Mobjfpc_FPC mode with Object Pascal support'#010+
-  '**2Mdelphi_Delphi 7 compatibility mode'#010+
+  '**2Mdelphi_Delphi 7 compat','ibility mode'#010+
   '**2Mtp_TP/BP 7.0 compatibility mode'#010+
   '**2Mmacpas_Macintosh Pascal dialects compatibility mode'#010+
   '**1n_Do not read the default config files'#010+
-  '**1N','<x>_Node tree optimizations'#010+
+  '**1N<x>_Node tree optimizations'#010+
   '**2Nu_Unroll loops'#010+
-  '**1o<x>_Change the name of the executable produced to <x>'#010+
+  '**1o<x>_Change the name of the executable ','produced to <x>'#010+
   '**1O<x>_Optimizations:'#010+
   '**2O-_Disable optimizations'#010+
   '**2O1_Level 1 optimizations (quick and debugger friendly)'#010+
-  '**2O2_Level 2 optimization','s (-O1 + quick optimizations)'#010+
+  '**2O2_Level 2 optimizations (-O1 + quick optimizations)'#010+
   '**2O3_Level 3 optimizations (-O2 + slow optimizations)'#010+
-  '**2Oa<x>=<y>_Set alignment'#010+
+  '**2O','a<x>=<y>_Set alignment'#010+
   '**2Oo[NO]<x>_Enable or disable optimizations, see fpc -i for possible '+
   'values'#010+
-  '**2Op<x>_Set target cpu for optimizing, see fpc -i ','for possible valu'+
-  'es'#010+
-  '**2OW<x>_Generate whole-program optimization feedback for optimization'+
-  ' <x>, see fpc -i for possible values'#010+
+  '**2Op<x>_Set target cpu for optimizing, see fpc -i for possible values'+
+  #010+
+  '**2OW<x>_Generate whole-program optimization feedback for optimizatio',
+  'n <x>, see fpc -i for possible values'#010+
   '**2Ow<x>_Perform whole-program optimization <x>, see fpc -i for possib'+
   'le values'#010+
-  '**2Os_Optimize for size rather th','an speed'#010+
+  '**2Os_Optimize for size rather than speed'#010+
   '**1pg_Generate profile code for gprof (defines FPC_PROFILE)'#010+
-  '**1R<x>_Assembler reading style:'#010+
+  '**1R<x>_Assembler re','ading style:'#010+
   '**2Rdefault_Use default assembler for target'#010+
   '3*2Ratt_Read AT&T style assembler'#010+
   '3*2Rintel_Read Intel style assembler'#010+
-  '6*2RMOT_Read motorola ','style assembler'#010+
+  '6*2RMOT_Read motorola style assembler'#010+
   '**1S<x>_Syntax options:'#010+
   '**2S2_Same as -Mobjfpc'#010+
-  '**2Sc_Support operators like C (*=,+=,/= and -=)'#010+
+  '**2Sc_Support operators li','ke C (*=,+=,/= and -=)'#010+
   '**2Sa_Turn on assertions'#010+
   '**2Sd_Same as -Mdelphi'#010+
   '**2Se<x>_Error options. <x> is a combination of the following:'#010+
-  '**3*_<n> : Compil','er halts after the <n> errors (default is 1)'#010+
-  '**3*_w : Compiler also halts after warnings'#010+
+  '**3*_<n> : Compiler halts after the <n> errors (default is 1)'#010+
+  '**3*_w : Compiler also halts after warnings'#010,
   '**3*_n : Compiler also halts after notes'#010+
   '**3*_h : Compiler also halts after hints'#010+
   '**2Sg_Enable LABEL and GOTO (default in -Mtp and -Mdelphi)'#010+
-  '**2Sh_Use ','ansistrings by default instead of shortstrings'#010+
-  '**2Si_Turn on inlining of procedures/functions declared as "inline"'#010+
+  '**2Sh_Use ansistrings by default instead of shortstrings'#010+
+  '**2Si_Turn on inlining of procedures/funct','ions declared as "inline"'#010+
   '**2Sk_Load fpcylix unit'#010+
   '**2SI<x>_Set interface style to <x>'#010+
   '**3SIcom_COM compatible interface (default)'#010+
-  '**3SIcorba_CORBA comp','atible interface'#010+
+  '**3SIcorba_CORBA compatible interface'#010+
   '**2Sm_Support macros like C (global)'#010+
   '**2So_Same as -Mtp'#010+
-  '**2Ss_Constructor name must be init (destructor must be done)'#010+
+  '**2Ss_Constructo','r name must be init (destructor must be done)'#010+
   '**2Sx_Enable exception keywords (default in Delphi/ObjFPC modes)'#010+
   '**1s_Do not call assembler and linker'#010+
-  '**','2sh_Generate script to link on host'#010+
+  '**2sh_Generate script to link on host'#010+
   '**2st_Generate script to link on target'#010+
-  '**2sr_Skip register allocation phase (use with -alr)'#010+
+  '**2sr_Skip re','gister allocation phase (use with -alr)'#010+
   '**1T<x>_Target operating system:'#010+
   '3*2Tdarwin_Darwin/Mac OS X'#010+
   '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
-  '3','*2Tfreebsd_FreeBSD'#010+
+  '3*2Tfreebsd_FreeBSD'#010+
   '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
-  '3*2Tiphonesim_ iPhoneSimulator from iOS SDK 3.2+ (older versions: -Tda'+
-  'rwin)'#010+
+  '3*2Tiphonesim_ iPhoneS','imulator from iOS SDK 3.2+ (older versions: -T'+
+  'darwin)'#010+
   '3*2Tlinux_Linux'#010+
   '3*2Tnetbsd_NetBSD'#010+
   '3*2Tnetware_Novell Netware Module (clib)'#010+
-  '3*2Tnetwlibc_Novell Ne','tware Module (libc)'#010+
+  '3*2Tnetwlibc_Novell Netware Module (libc)'#010+
   '3*2Topenbsd_OpenBSD'#010+
   '3*2Tos2_OS/2 / eComStation'#010+
-  '3*2Tsunos_SunOS/Solaris'#010+
+  '3*2Tsunos_SunOS/Solari','s'#010+
   '3*2Tsymbian_Symbian OS'#010+
   '3*2Tsolaris_Solaris'#010+
   '3*2Twatcom_Watcom compatible DOS extender'#010+
   '3*2Twdosx_WDOSX DOS extender'#010+
   '3*2Twin32_Windows 32 Bit'#010+
-  '3*2Twince_','Windows CE'#010+
+  '3*2Twince_Windows CE'#010+
   '4*2Tdarwin_Darwin/Mac OS X'#010+
   '4*2Tlinux_Linux'#010+
-  '4*2Twin64_Win64 (64 bit Windows systems)'#010+
+  '4*2Twin64_Win64 (64 bit Windows sys','tems)'#010+
   '6*2Tamiga_Commodore Amiga'#010+
   '6*2Tatari_Atari ST/STe/TT'#010+
   '6*2Tlinux_Linux'#010+
   '6*2Tpalmos_PalmOS'#010+
   'A*2Tdarwin_Darwin/iPhoneOS/iOS'#010+
   'A*2Tlinux_Linux'#010+
-  'A*2Twince_Wi','ndows CE'#010+
+  'A*2Twince_Windows CE'#010+
   'P*2Tamiga_AmigaOS'#010+
   'P*2Tdarwin_Darwin/Mac OS X'#010+
   'P*2Tlinux_Linux'#010+
-  'P*2Tmacos_Mac OS (classic)'#010+
+  'P*2Tmacos_Mac OS (c','lassic)'#010+
   'P*2Tmorphos_MorphOS'#010+
   'S*2Tsolaris_Solaris'#010+
   'S*2Tlinux_Linux'#010+
   '**1u<x>_Undefines the symbol <x>'#010+
   '**1U_Unit options:'#010+
-  '**2Un_Do not check where the unit n','ame matches the file name'#010+
-  '**2Ur_Generate release unit files (never automatically recompiled)'#010+
+  '**2Un_Do not check where the unit name matches the file name'#010+
+  '**2Ur_Generate release unit files (never automatically recompil','ed)'#010+
   '**2Us_Compile a system unit'#010+
   '**1v<x>_Be verbose. <x> is a combination of the following letters:'#010+
-  '**2*_e : Show errors (default)       0 : Show nothin','g (except errors'+
-  ')'#010+
+  '**2*_e : Show errors (default)       0 : Show nothing (except errors)'#010+
   '**2*_w : Show warnings               u : Show unit info'#010+
-  '**2*_n : Show notes                  t : Show tried/used files'#010+
+  '**2*_n : Show n','otes                  t : Show tried/used files'#010+
   '**2*_h : Show hints                  c : Show conditionals'#010+
-  '**2*_i : Show general info           d : Sho','w debug info'#010+
+  '**2*_i : Show general info           d : Show debug info'#010+
   '**2*_l : Show linenumbers            r : Rhide/GCC compatibility mode'#010+
-  '**2*_s : Show time stamps            q : Show message numbers'#010+
+  '**2*_s',' : Show time stamps            q : Show message numbers'#010+
   '**2*_a : Show everything             x : Executable info (Win32 only)'#010+
-  '**2*_b : Write file names',' messages   p : Write tree.log with parse t'+
-  'ree'#010+
-  '**2*_    with full path              v : Write fpcdebug.txt with'#010+
+  '**2*_b : Write file names messages   p : Write tree.log with parse tre'+
+  'e'#010+
+  '**2*_    with full path              v : W','rite fpcdebug.txt with'#010+
   '**2*_                                    lots of debugging info'#010+
   '**2*_m<x>,<y> : Don'#039't show messages numbered <x> and <y>'#010+
-  '3*1W<x>','_Target-specific options (targets)'#010+
+  '3*1W<x>_Target-specific options (targets)'#010+
   'A*1W<x>_Target-specific options (targets)'#010+
-  'P*1W<x>_Target-specific options (targets)'#010+
+  'P*1W<x>_Targ','et-specific options (targets)'#010+
   'p*1W<x>_Target-specific options (targets)'#010+
   '3*2Wb_Create a bundle instead of a library (Darwin)'#010+
-  'P*2Wb_Create a bundle inste','ad of a library (Darwin)'#010+
+  'P*2Wb_Create a bundle instead of a library (Darwin)'#010+
   'p*2Wb_Create a bundle instead of a library (Darwin)'#010+
-  '3*2WB_Create a relocatable image (Windows)'#010+
+  '3*2WB_Create',' a relocatable image (Windows)'#010+
   'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
   '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
-  'A*2WC_Sp','ecify console type application (Windows)'#010+
-  'P*2WC_Specify console type application (Classic Mac OS)'#010+
+  'A*2WC_Specify console type application (Windows)'#010+
+  'P*2WC_Specify console type application (Classic ','Mac OS)'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
   'A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
-  '3*2We_Use external ','resources (Darwin)'#010+
+  '3*2We_Use external resources (Darwin)'#010+
   '4*2We_Use external resources (Darwin)'#010+
-  'A*2We_Use external resources (Darwin)'#010+
+  'A*2We_Use external resources (Da','rwin)'#010+
   'P*2We_Use external resources (Darwin)'#010+
   'p*2We_Use external resources (Darwin)'#010+
   '3*2WF_Specify full-screen type application (EMX, OS/2)'#010+
-  '3*2WG_Specify ','graphic type application (EMX, OS/2, Windows)'#010+
-  'A*2WG_Specify graphic type application (Windows)'#010+
+  '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
+  'A*2WG_Specify graphic type application (Win','dows)'#010+
   'P*2WG_Specify graphic type application (Classic Mac OS)'#010+
   '3*2Wi_Use internal resources (Darwin)'#010+
   'P*2Wi_Use internal resources (Darwin)'#010+
-  'p*2Wi_Use int','ernal resources (Darwin)'#010+
-  '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
+  'p*2Wi_Use internal resources (Darwin)'#010+
+  '3*2WN_Do not generate relocation code, needed for debugging (Win','dows'+
+  ')'#010+
   'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   '3*2WR_Generate relocation code (Windows)'#010+
-  'A*2WR_Generate relocation code (Wi','ndows)'#010+
+  'A*2WR_Generate relocation code (Windows)'#010+
   'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+
-  '3*2WX_Enable executable stack (Linux)'#010+
+  '3*2WX_Enable executable s','tack (Linux)'#010+
   'A*2WX_Enable executable stack (Linux)'#010+
   'p*2WX_Enable executable stack (Linux)'#010+
   'P*2WX_Enable executable stack (Linux)'#010+
-  '**1X_Executable options:',#010+
+  '**1X_Executable options:'#010+
   '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
   'ux)'#010+
-  '**2Xd_Do not use standard library search path (needed for cross compil'+
-  'e)'#010+
+  '**2Xd_Do not u','se standard library search path (needed for cross comp'+
+  'ile)'#010+
   '**2Xe_Use external linker'#010+
-  '**2Xg_Create debuginfo in a separate file and add a debuglink sect','io'+
-  'n to executable'#010+
+  '**2Xg_Create debuginfo in a separate file and add a debuglink section '+
+  'to executable'#010+
   '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
-  '**2Xi_Use internal linker'#010+
+  '**2','Xi_Use internal linker'#010+
   '**2Xm_Generate link map'#010+
   '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
   's '#039'main'#039')'#010+
-  '**2XP<x>_Prepend the binutils na','mes with the prefix <x>'#010+
-  '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+
-  'ile, see the ld manual for more information) (BeOS, Linux)'#010+
+  '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+
+  '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross com',
+  'pile, see the ld manual for more information) (BeOS, Linux)'#010+
   '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+
-  ', Linux, Mac OS, Sola','ris)'#010+
+  ', Linux, Mac OS, Solaris)'#010+
   '**2Xs_Strip all symbols from executable'#010+
-  '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+
+  '**2XS_Try to link units statically (default,',' defines FPC_LINK_STATIC'+
+  ')'#010+
   '**2Xt_Link with static libraries (-static is passed to linker)'#010+
-  '**2XX_Try to smartlink units             (defines FPC_LINK_SMA','RT)'#010+
+  '**2XX_Try to smartlink units             (defines FPC_LINK_SMART)'#010+
   '**1*_'#010+
   '**1?_Show this help'#010+
   '**1h_Shows this help without waiting'

+ 2 - 1
compiler/ncgrtti.pas

@@ -637,7 +637,8 @@ implementation
               { pocall_safecall   } 4,
               { pocall_stdcall    } 3,
               { pocall_softfloat  } 10,
-              { pocall_mwpascal   } 11
+              { pocall_mwpascal   } 11,
+              { pocall_interrupt  } 12
              );
 
            procedure write_para(parasym:tparavarsym);

+ 102 - 1
compiler/ncgutil.pas

@@ -161,6 +161,10 @@ interface
 
     procedure gen_pic_helpers(list : TAsmList);
 
+    procedure gen_fpc_dummy(list : TAsmList);
+
+    procedure InsertInterruptTable;
+
 implementation
 
   uses
@@ -2524,7 +2528,10 @@ implementation
             sectype:=sec_bss;
           end;
         maybe_new_object_file(list);
-        new_section(list,sectype,lower(sym.mangledname),varalign);
+        if sym.section<>'' then
+          new_section(list,sec_user,sym.section,varalign)
+        else
+         new_section(list,sectype,lower(sym.mangledname),varalign);
         if (sym.owner.symtabletype=globalsymtable) or
            create_smartlink or
            DLLSource or
@@ -3120,4 +3127,98 @@ implementation
 {$endif i386}
       end;
 
+
+    procedure gen_fpc_dummy(list : TAsmList);
+      begin
+{$ifdef i386}
+        { fix me! }
+        list.concat(Taicpu.Op_const_reg(A_MOV,S_L,1,NR_EAX));
+        list.concat(Taicpu.Op_const(A_RET,S_W,12));
+{$endif i386}
+      end;
+
+
+    procedure InsertInterruptTable;
+
+      procedure WriteVector(const name: string);
+        var
+          ai: taicpu;
+        begin
+{$IFDEF arm}
+          if current_settings.cputype in [cpu_armv7m, cpu_cortexm3] then
+            current_asmdata.asmlists[al_globals].concat(tai_const.Createname(name,0))
+          else
+            begin
+              ai:=taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(name));
+              ai.is_jmp:=true;
+              current_asmdata.asmlists[al_globals].concat(ai);
+            end;
+{$ENDIF arm}
+        end;
+
+      function GetInterruptTableLength: longint;
+        begin
+{$if defined(ARM)}
+          result:=interruptvectors[current_settings.controllertype];
+{$else}
+          result:=0;
+{$endif}
+        end;
+
+      var
+        hp: tused_unit;
+        sym: tsym;
+        i, i2: longint;
+        interruptTable: array of tprocdef;
+        pd: tprocdef;
+      begin
+        SetLength(interruptTable, GetInterruptTableLength);
+        FillChar(interruptTable[0], length(interruptTable)*sizeof(pointer), 0);
+
+        hp:=tused_unit(usedunits.first);
+        while assigned(hp) do
+          begin
+            for i := 0 to hp.u.symlist.Count-1 do
+              begin
+                sym:=tsym(hp.u.symlist[i]);
+                if not assigned(sym) then
+                  continue;
+                if sym.typ = procsym then
+                  begin
+                    for i2 := 0 to tprocsym(sym).ProcdefList.Count-1 do
+                      begin
+                        pd:=tprocdef(tprocsym(sym).ProcdefList[i2]);
+                        if pd.interruptvector >= 0 then
+                          begin
+                            if pd.interruptvector > high(interruptTable) then
+                              Internalerror(2011030602);
+                            if interruptTable[pd.interruptvector] <> nil then
+                              internalerror(2011030601);
+
+                            interruptTable[pd.interruptvector]:=pd;
+                            break;
+                          end;
+                      end;
+                  end;
+              end;
+            hp:=tused_unit(hp.next);
+          end;
+
+        new_section(current_asmdata.asmlists[al_globals],sec_init,'VECTORS',sizeof(pint));
+        current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('VECTORS',AT_DATA,0));
+{$IFDEF arm}
+        if current_settings.cputype in [cpu_armv7m, cpu_cortexm3] then
+          current_asmdata.asmlists[al_globals].concat(tai_const.Createname('_stack_top',0)); { ARMv7-M processors have the initial stack value at address 0 }
+{$ENDIF arm}
+
+        for i:=0 to high(interruptTable) do
+          begin
+            if interruptTable[i]<>nil then
+              writeVector(interruptTable[i].mangledname)
+            else
+              writeVector('DefaultHandler'); { Default handler name }
+          end;
+      end;
+
+
 end.

+ 1 - 1
compiler/nld.pas

@@ -1091,7 +1091,7 @@ implementation
            an error }
          if not allowed then
           Message(parser_e_no_type_not_allowed_here);
-         if not helperallowed then
+         if not helperallowed and is_objectpascal_helper(typedef) then
            Message(parser_e_no_category_as_types);
       end;
 

+ 0 - 16
compiler/nset.pas

@@ -229,22 +229,6 @@ implementation
              exit;
           end;
 
-         if (right.nodetype=typen) then
-           begin
-             if right.resultdef.typ<>setdef then
-               begin
-                 CGMessage(sym_e_set_expected);
-                 exit;
-               end;
-             { we need to create a setconstn }
-             pst:=createsetconst(tsetdef(ttypenode(right).resultdef));
-             t:=csetconstnode.create(pst,ttypenode(right).resultdef);
-             dispose(pst);
-             right.free;
-             right:=t;
-             typecheckpass(right);
-           end;
-
          typecheckpass(left);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          if codegenerror then

+ 2 - 1
compiler/ogbase.pas

@@ -824,7 +824,7 @@ implementation
 
     function TObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
       const
-        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           'code',
           'Data',
           'Data',
@@ -903,6 +903,7 @@ implementation
     function TObjData.sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;
       const
         secoptions : array[TAsmSectiontype] of TObjSectionOptions = ([],
+          {user} [oso_Data,oso_load,oso_write,oso_executable,oso_keep],
           {code} [oso_Data,oso_load,oso_readonly,oso_executable,oso_keep],
           {Data} [oso_Data,oso_load,oso_write,oso_keep],
 { TODO: Fix sec_rodata be read-only-with-relocs}

+ 22 - 16
compiler/ogcoff.pas

@@ -488,7 +488,7 @@ implementation
        SymbolMaxGrow = 200*sizeof(coffsymbol);
        StrsMaxGrow   = 8192;
 
-       coffsecnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+       coffsecnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text','.data','.data','.data','.bss','.tls',
           '.pdata',{pdata}
           '.text', {stub}
@@ -1031,22 +1031,28 @@ const pemagic : array[0..3] of byte = (
         sep     : string[3];
         secname : string;
       begin
-        secname:=coffsecnames[atype];
-        if create_smartlink_sections and
-           (aname<>'') then
-          begin
-            case aorder of
-              secorder_begin :
-                sep:='.b_';
-              secorder_end :
-                sep:='.z_';
-              else
-                sep:='.n_';
-            end;
-            result:=secname+sep+aname
-          end
+        { section type user gives the user full controll on the section name }
+        if atype=sec_user then
+          result:=aname
         else
-          result:=secname;
+          begin
+            secname:=coffsecnames[atype];
+            if create_smartlink_sections and
+               (aname<>'') then
+              begin
+                case aorder of
+                  secorder_begin :
+                    sep:='.b_';
+                  secorder_end :
+                    sep:='.z_';
+                  else
+                    sep:='.n_';
+                end;
+                result:=secname+sep+aname
+              end
+            else
+              result:=secname;
+          end;
       end;
 
 

+ 29 - 23
compiler/ogelf.pas

@@ -584,7 +584,7 @@ implementation
 
     function TElfObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
       const
-        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
 {$ifdef userodata}
           '.text','.data','.data','.rodata','.bss','.threadvar',
 {$else userodata}
@@ -639,7 +639,7 @@ implementation
           '.obcj_nlcatlist',
           '.objc_protolist'
         );
-        secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text',
           '.data.rel',
           '.data.rel',
@@ -700,30 +700,36 @@ implementation
         sep : string[3];
         secname : string;
       begin
-        if (cs_create_pic in current_settings.moduleswitches) and
-           not(target_info.system in systems_darwin) then
-          secname:=secnames_pic[atype]
+        { section type user gives the user full controll on the section name }
+        if atype=sec_user then
+          result:=aname
         else
-          secname:=secnames[atype];
-        if (atype=sec_fpc) and (Copy(aname,1,3)='res') then
           begin
-            result:=secname+'.'+aname;
-            exit;
+            if (cs_create_pic in current_settings.moduleswitches) and
+               not(target_info.system in systems_darwin) then
+              secname:=secnames_pic[atype]
+            else
+              secname:=secnames[atype];
+            if (atype=sec_fpc) and (Copy(aname,1,3)='res') then
+              begin
+                result:=secname+'.'+aname;
+                exit;
+              end;
+            if create_smartlink_sections and (aname<>'') then
+              begin
+                case aorder of
+                  secorder_begin :
+                    sep:='.b_';
+                  secorder_end :
+                    sep:='.z_';
+                  else
+                    sep:='.n_';
+                end;
+                result:=secname+sep+aname
+              end
+            else
+              result:=secname;
           end;
-        if create_smartlink_sections and (aname<>'') then
-          begin
-            case aorder of
-              secorder_begin :
-                sep:='.b_';
-              secorder_end :
-                sep:='.z_';
-              else
-                sep:='.n_';
-            end;
-            result:=secname+sep+aname
-          end
-        else
-          result:=secname;
       end;
 
 

+ 1 - 0
compiler/ogmacho.pas

@@ -180,6 +180,7 @@ implementation
         = ('sec_debug_frame','__debug_info','__debug_line','__debug_abbrev');
     begin
       case atype of
+        sec_user: Result:=aname;
         sec_bss:  Result:=MakeSectionName(seg_DATA, '__common');
         sec_stab: Result:='.stabs';
         sec_stabstr: Result:='.stabsstr';

+ 39 - 7
compiler/ognlm.pas

@@ -289,7 +289,12 @@ const NLM_MAX_DESCRIPTION_LENGTH = 127;
          procedure ParseScript (linkscript:TCmdStrList); override;
        end;
 
-
+    var
+      {for symbols defined in linker script. To generate a fixup we
+       need to know the segment (.text,.bss or .code) of the symbol
+       Pointer in list is used as TsecType
+       Filled by TInternalLinkerNetware.DefaultLinkScript }
+      nlmSpecialSymbols_Segments : TFPHashList;
 
     type
 
@@ -346,10 +351,19 @@ type
 
 function SectionType (aName : string) : TSecType;
 var s : string;
+    seg: ptruint;
 begin
   s := copy(aName,1,5);
   if s = '.text' then result := Section_text else
     if (s = '.data') or (copy(s,1,4)='.bss') then result := Section_data else
+      if s[1] <> '.' then
+        begin
+          seg := ptruint(nlmSpecialSymbols_Segments.Find(aName));
+          if seg <> 0 then
+            result := TSecType(seg)
+          else
+            result := Section_other;
+        end else
       result := Section_other;
 end;
 
@@ -514,7 +528,8 @@ function SecOpts(SecOptions:TObjSectionOptions):string;
     procedure TNLMexeoutput.ExeSectionList_write_Data(p:TObject;arg:pointer);
       var
         objsec : TObjSection;
-        i      : longint;
+        i,j    : longint;
+        b      : byte;
       begin
 
         with texesection(p) do
@@ -535,7 +550,8 @@ function SecOpts(SecOptions:TObjSectionOptions):string;
                     if oso_data in objsec.secoptions then
                       begin
                         if assigned(exemap) then
-                          exemap.Add(' nlm file offset $'+hexstr(objsec.DataPos,8)+': '+objsec.name);
+                          if objsec.data.size > 0 then
+                            exemap.Add('  0x'+hexstr(objsec.DataPos,8)+': '+objsec.name);
                         //writeln ('   ',objsec.name,'  size:',objsec.size,'  relocs:',objsec.ObjRelocations.count,'  DataPos:',objsec.DataPos,' MemPos:',objsec.MemPos);
                         {for j := 0 to objsec.ObjRelocations.count-1 do
                           begin
@@ -550,7 +566,14 @@ function SecOpts(SecOptions:TObjSectionOptions):string;
                           end;}
                         if not assigned(objsec.data) then
                           internalerror(200603042);
-                        FWriter.writezeros(objsec.dataalignbytes);
+                        if copy (objsec.Name,1,5) = '.text' then
+                          begin        // write NOP's instead of zero's for .text, makes disassemble possible
+                            b := $90;  // NOP
+                            if objsec.DataAlignBytes > 0 then
+                              for j := 1 to objsec.DataAlignBytes do
+                                FWriter.write(b,1);
+                          end else
+                            FWriter.writezeros(objsec.dataalignbytes);
                         //if objsec.dataalignbytes>0 then
                         //  writeln ('  ',name,'  alignbytes: ',objsec.dataalignbytes);
                         if objsec.DataPos<>FWriter.Size then
@@ -874,6 +897,11 @@ function SecOpts(SecOptions:TObjSectionOptions):string;
         if FWriter.Size<>totalheadersize+ExeSecsListSize+headerAlignBytes then
           internalerror(201103062);
         { Section data }
+        if assigned(exemap) then
+          begin
+            exemap.Add('');
+            exemap.Add('NLM file offsets:');
+          end;
         ExeSectionList.ForEachCall(@ExeSectionList_write_data,nil);
 
         if hassymbols then
@@ -1046,7 +1074,8 @@ function SecOpts(SecOptions:TObjSectionOptions):string;
 
                       k := objsec.MemPos + objreloc.DataOffset;
                       k := k or $40000000;
-                      // TODO: data|code
+                      // TODO: data|code if we support importing data symbols
+                      //       i do not know if this is possible with netware
                       internalobjdata.writebytes(k,sizeof(k));    // address
 
                       // the netware loader requires an offset at the import address
@@ -1169,8 +1198,11 @@ function SecOpts(SecOptions:TObjSectionOptions):string;
                     targetSectionName := '';
                     if objreloc.symbol <> nil then
                     begin
-                      //writeln ('  MemPos',objsec.MemPos,' dataOfs:',objreloc.dataoffset,' ',objsec.name,'   objreloc.symbol: ',objreloc.symbol.name,'  objreloc.symbol.objsection.name: ',objreloc.symbol.objsection.name,' ',objreloc.symbol.Typ,' ',objreloc.symbol.bind,' ',objreloc.Typ);
-                      targetSectionName := copy(objreloc.symbol.objsection.name,1,5);
+                      // writeln ('  MemPos',objsec.MemPos,' dataOfs:',objreloc.dataoffset,' ',objsec.name,'   objreloc.symbol: ',objreloc.symbol.name,'  objreloc.symbol.objsection.name: ',objreloc.symbol.objsection.name,' ',objreloc.symbol.Typ,' ',objreloc.symbol.bind,' ',objreloc.Typ);
+                      if objreloc.symbol.objsection.name[1] <> '.' then
+                        targetSectionName := objreloc.symbol.name                       // specials like __bss_start__
+                      else                                                              // dont use objsection.name because it begins with *
+                        targetSectionName := copy(objreloc.symbol.objsection.name,1,5); // all others begin with .segment, we only have to check for .text, .data or .bss
                     end else
                       internalerror(2011030603);
 

+ 2 - 2
compiler/owar.pas

@@ -262,11 +262,11 @@ implementation
 
     procedure tarobjectwriter.writear;
       var
-        arf      : TCFileStream;
+        arf      : TCCustomFileStream;
         fixup,l,
         relocs,i : longint;
       begin
-        arf:=TCFileStream.Create(arfn,fmCreate);
+        arf:=CFileStreamClass.Create(arfn,fmCreate);
         if CStreamError<>0 then
           begin
              Message1(exec_e_cant_create_archivefile,arfn);

+ 4 - 4
compiler/owbase.pas

@@ -31,7 +31,7 @@ uses
 type
   tobjectwriter=class
   private
-    f      : TCFileStream;
+    f      : TCCustomFileStream;
     opened : boolean;
     buf    : pchar;
     bufidx : longword;
@@ -54,7 +54,7 @@ type
 
   tobjectreader=class
   private
-    f      : TCFileStream;
+    f      : TCCustomFileStream;
     opened : boolean;
     buf    : pchar;
     ffilename : string;
@@ -108,7 +108,7 @@ end;
 function tobjectwriter.createfile(const fn:string):boolean;
 begin
   createfile:=false;
-  f:=TCFileStream.Create(fn,fmCreate);
+  f:=CFileStreamClass.Create(fn,fmCreate);
   if CStreamError<>0 then
     begin
        Message1(exec_e_cant_create_objectfile,fn);
@@ -233,7 +233,7 @@ end;
 function tobjectreader.openfile(const fn:string):boolean;
 begin
   openfile:=false;
-  f:=TCFileStream.Create(fn,fmOpenRead);
+  f:=CFileStreamClass.Create(fn,fmOpenRead);
   if CStreamError<>0 then
     begin
        Comment(V_Error,'Can''t open object file: '+fn);

+ 13 - 0
compiler/pdecsub.pas

@@ -1619,9 +1619,22 @@ begin
 end;
 
 procedure pd_interrupt(pd:tabstractprocdef);
+
+var v: Tconstexprint;
+
 begin
   if pd.parast.symtablelevel>normal_function_level then
     Message(parser_e_dont_nest_interrupt);
+
+  if target_info.system in systems_interrupt_table then
+    begin
+      if token<>_SEMICOLON then
+        begin
+          pd.proccalloption:=pocall_interrupt;
+          v:=get_intconst;
+          Tprocdef(pd).interruptvector:=v.uvalue;
+        end;
+    end;
 end;
 
 procedure pd_abstract(pd:tabstractprocdef);

+ 30 - 0
compiler/pdecvar.pas

@@ -1042,6 +1042,17 @@ implementation
     end;
 
 
+    procedure try_consume_sectiondirective(var asection: ansistring);
+      begin
+        if idtoken=_SECTION then
+          begin
+            consume(_ID);
+            asection:=get_stringconst;
+            consume(_SEMICOLON);
+          end;
+      end;
+
+
     procedure read_var_decls(options:Tvar_dec_options);
 
         procedure read_default_value(sc : TFPObjectList);
@@ -1254,6 +1265,7 @@ implementation
          hintsymoptions  : tsymoptions;
          deprecatedmsg   : pshortstring;
          old_block_type  : tblock_type;
+         section : ansistring;
       begin
          old_block_type:=block_type;
          block_type:=bt_var;
@@ -1395,6 +1407,24 @@ implementation
                 ) then
                read_public_and_external_sc(sc);
 
+             { try to parse a section directive }
+             if (target_info.system in systems_embedded) and (idtoken=_SECTION) then
+               begin
+                 try_consume_sectiondirective(section);
+                 if section<>'' then
+                   begin
+                     for i:=0 to sc.count-1 do
+                       begin
+                         vs:=tabstractvarsym(sc[i]);
+                         if (vs.varoptions *[vo_is_external,vo_is_weak_external])<>[] then
+                           Message(parser_e_externals_no_section);
+                         if vs.typ<>staticvarsym then
+                           Message(parser_e_section_no_locals);
+                         tstaticvarsym(vs).section:=section;
+                       end;
+                   end;
+               end;
+
              { allocate normal variable (non-external and non-typed-const) staticvarsyms }
              for i:=0 to sc.count-1 do
                begin

+ 8 - 15
compiler/pmodules.pas

@@ -29,7 +29,6 @@ interface
     procedure proc_package;
     procedure proc_program(islibrary : boolean);
 
-
 implementation
 
     uses
@@ -47,13 +46,8 @@ implementation
        pexports,
        objcgutl,
        wpobase,
-       scanner,pbase,pexpr,psystem,psub,pdecsub,ptype
-       ,cpuinfo
-{$ifdef i386}
-       { fix me! }
-       ,cpubase
-{$endif i386}
-       ;
+       scanner,pbase,pexpr,psystem,psub,pdecsub,ptype,
+       cpuinfo;
 
 
     procedure create_objectfile;
@@ -715,7 +709,7 @@ implementation
           end;
 
         { CPU targets with microcontroller support can add a controller specific unit }
-{$if defined(ARM)}
+{$if defined(ARM) or defined(AVR)}
         if (target_info.system in systems_embedded) and (current_settings.controllertype<>ct_none) then
           AddUnit(controllerunitstr[current_settings.controllertype]);
 {$endif ARM}
@@ -1908,11 +1902,7 @@ implementation
 
          new_section(current_asmdata.asmlists[al_procedures],sec_code,'',0);
          current_asmdata.asmlists[al_procedures].concat(tai_symbol.createname_global('_DLLMainCRTStartup',AT_FUNCTION,0));
-{$ifdef i386}
-         { fix me! }
-         current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_const_reg(A_MOV,S_L,1,NR_EAX));
-         current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_const(A_RET,S_W,12));
-{$endif i386}
+         gen_fpc_dummy(current_asmdata.asmlists[al_procedures]);
          current_asmdata.asmlists[al_procedures].concat(tai_const.createname('_FPCDummy',0));
 
          { leave when we got an error }
@@ -2174,7 +2164,7 @@ implementation
 
          { Insert _GLOBAL_OFFSET_TABLE_ symbol if system uses it }
          maybe_load_got;
-  
+
          { create whole program optimisation information }
          current_module.wpoinfo:=tunitwpoinfo.create;
 
@@ -2363,6 +2353,9 @@ implementation
          InsertWideInitsTablesTable;
          InsertMemorySizes;
 
+         if target_info.system in systems_interrupt_table then
+           InsertInterruptTable;
+
          { Insert symbol to resource info }
          InsertResourceInfo(resources_used);
 

+ 1 - 0
compiler/powerpc/agppcmpw.pas

@@ -70,6 +70,7 @@ interface
 
       secnames : array[TAsmSectiontype] of string[10] = (
         '',      {none}
+        '',      {user}
         'csect', {code}
         'csect', {data}
         'csect', {read only data}

+ 70 - 41
compiler/ppu.pas

@@ -26,7 +26,7 @@ unit ppu;
 interface
 
   uses
-    globtype,constexp;
+    globtype,constexp,cstreams;
 
 { Also write the ppu if only crc if done, this can be used with ppudump to
   see the differences between the intf and implementation }
@@ -187,9 +187,11 @@ type
     nr   : byte;
   end;
 
+  { tppufile }
+
   tppufile=class
   private
-    f        : file;
+    f        : TCCustomFileStream;
     mode     : byte; {0 - Closed, 1 - Reading, 2 - Writing}
     fname    : string;
     fsize    : integer;
@@ -261,6 +263,7 @@ type
     function getaword:aword;
     function  getreal:ppureal;
     function  getstring:string;
+    function  getansistring:ansistring;
     procedure getnormalset(var b);
     procedure getsmallset(var b);
     function  skipuntilentry(untilb:byte):boolean;
@@ -281,10 +284,11 @@ type
     procedure putaword(i:aword);
     procedure putreal(d:ppureal);
     procedure putstring(const s:string);
+    procedure putansistring(const s:ansistring);
     procedure putnormalset(const b);
     procedure putsmallset(const b);
-    procedure tempclose;
-    function  tempopen:boolean;
+    procedure tempclose;        // MG: not used, obsolete?
+    function  tempopen:boolean; // MG: not used, obsolete?
   end;
 
 implementation
@@ -357,10 +361,7 @@ begin
   if Mode<>0 then
    begin
      Flush;
-     {$I-}
-      system.close(f);
-     {$I+}
-     if ioresult<>0 then;
+     f.Free;
      Mode:=0;
      closed:=true;
    end;
@@ -416,21 +417,17 @@ var
   i      : integer;
 begin
   openfile:=false;
-  assign(f,fname);
-  ofmode:=filemode;
-  filemode:=$0;
-  {$I-}
-   reset(f,1);
-  {$I+}
-  filemode:=ofmode;
-  if ioresult<>0 then
-   exit;
+  try
+    f:=CFileStreamClass.Create(fname,fmOpenRead)
+  except
+    exit;
+  end;
   closed:=false;
 {read ppuheader}
-  fsize:=filesize(f);
+  fsize:=f.Size;
   if fsize<sizeof(tppuheader) then
    exit;
-  blockread(f,header,sizeof(tppuheader),i);
+  i:=f.Read(header,sizeof(tppuheader));
   { The header is always stored in little endian order }
   { therefore swap if on a big endian machine          }
 {$IFDEF ENDIAN_BIG}
@@ -479,7 +476,7 @@ end;
 procedure tppufile.reloadbuf;
 begin
   inc(bufstart,bufsize);
-  blockread(f,buf^,ppubufsize,bufsize);
+  bufsize:=f.Read(buf^,ppubufsize);
   bufidx:=0;
 end;
 
@@ -790,6 +787,22 @@ begin
 end;
 
 
+function tppufile.getansistring: ansistring;
+var
+  l : longint;
+begin
+  l:=getlongint;
+  if entryidx+l>entry.size then
+   begin
+     error:=true;
+     exit;
+   end;
+  SetLength(Result,l);
+  ReadData(result[1],l);
+  inc(entryidx,l);
+end;
+
+
 procedure tppufile.getsmallset(var b);
 var
   i : longint;
@@ -828,6 +841,8 @@ end;
 *****************************************************************************}
 
 function tppufile.createfile:boolean;
+var
+  ok: boolean;
 begin
   createfile:=false;
 {$ifdef INTFPPU}
@@ -839,24 +854,26 @@ begin
 {$endif}
   if not crc_only then
     begin
-      assign(f,fname);
       {$ifdef MACOS}
       {FPas is FreePascal's creator code on MacOS. See systems/mac_crea.txt}
       SetDefaultMacOSCreator('FPas');
       SetDefaultMacOSFiletype('FPPU');
       {$endif}
-      {$I-}
-      rewrite(f,1);
-      {$I+}
+      ok:=false;
+      try
+        f:=CFileStreamClass.Create(fname,fmCreate);
+        ok:=true;
+      except
+      end;
       {$ifdef MACOS}
       SetDefaultMacOSCreator('MPS ');
       SetDefaultMacOSFiletype('TEXT');
       {$endif}
-      if ioresult<>0 then
+      if not ok then
        exit;
       Mode:=2;
     {write header for sure}
-      blockwrite(f,header,sizeof(tppuheader));
+      f.Write(header,sizeof(tppuheader));
     end;
   bufsize:=ppubufsize;
   bufstart:=sizeof(tppuheader);
@@ -905,10 +922,10 @@ begin
     header.symlistsize:=swapendian(header.symlistsize);
 {$endif not FPC_BIG_ENDIAN}
 { write header and restore filepos after it }
-  opos:=filepos(f);
-  seek(f,0);
-  blockwrite(f,header,sizeof(tppuheader));
-  seek(f,opos);
+  opos:=f.Position;
+  f.Position:=0;
+  f.Write(header,sizeof(tppuheader));
+  f.Position:=opos;
 end;
 
 
@@ -916,7 +933,7 @@ procedure tppufile.writebuf;
 begin
   if not crc_only and
      (bufidx <> 0) then
-    blockwrite(f,buf^,bufidx);
+    f.Write(buf^,bufidx);
   inc(bufstart,bufidx);
   bufidx:=0;
 end;
@@ -986,10 +1003,10 @@ begin
       {flush to be sure}
         WriteBuf;
       {write entry}
-        opos:=filepos(f);
-        seek(f,entrystart);
-        blockwrite(f,entry,sizeof(tppuentry));
-        seek(f,opos);
+        opos:=f.Position;
+        f.Position:=entrystart;
+        f.write(entry,sizeof(tppuentry));
+        f.Position:=opos;
       end;
      entrybufstart:=bufstart;
    end
@@ -1132,6 +1149,16 @@ procedure tppufile.putstring(const s:string);
   end;
 
 
+procedure tppufile.putansistring(const s: ansistring);
+  var
+    l : longint;
+  begin
+    l:=length(s);
+    putdata(l,4);
+    putdata(s[1],l);
+  end;
+
+
 procedure tppufile.putsmallset(const b);
   var
     l : longint;
@@ -1153,11 +1180,8 @@ procedure tppufile.tempclose;
   begin
     if not closed then
      begin
-       closepos:=filepos(f);
-       {$I-}
-        system.close(f);
-       {$I+}
-       if ioresult<>0 then;
+       closepos:=f.Position;
+       f.Free;
        closed:=true;
        tempclosed:=true;
      end;
@@ -1171,6 +1195,10 @@ function tppufile.tempopen:boolean;
     tempopen:=false;
     if not closed or not tempclosed then
      exit;
+    // MG: not sure, if this is correct
+
+    f.Position:=0;
+    (*
     ofm:=filemode;
     filemode:=0;
     {$I-}
@@ -1179,11 +1207,12 @@ function tppufile.tempopen:boolean;
     filemode:=ofm;
     if ioresult<>0 then
      exit;
+    *)
     closed:=false;
     tempclosed:=false;
 
   { restore state }
-    seek(f,closepos);
+    f.Position:=closepos;
     tempopen:=true;
   end;
 

+ 2 - 1
compiler/symconst.pas

@@ -431,7 +431,8 @@ type
     vo_is_msgsel,
     { first field of variant part of a record }
     vo_is_first_field,
-    vo_volatile
+    vo_volatile,
+    vo_has_section
   );
   tvaroptions=set of tvaroption;
 

+ 7 - 0
compiler/symdef.pas

@@ -554,6 +554,8 @@ interface
           interfacedef : boolean;
           { true if the procedure has a forward declaration }
           hasforward  : boolean;
+          { interrupt vector }
+          interruptvector : longint;
           constructor create(level:byte);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor  destroy;override;
@@ -3435,6 +3437,7 @@ implementation
 {$ifdef i386}
           fpu_used:=maxfpuregs;
 {$endif i386}
+         interruptvector:=-1;
       end;
 
 
@@ -3473,6 +3476,8 @@ implementation
          else
            import_name:=nil;
          import_nr:=ppufile.getword;
+         if target_info.system in systems_interrupt_table then
+           interruptvector:=ppufile.getlongint;
          if (po_msgint in procoptions) then
            messageinf.i:=ppufile.getlongint;
          if (po_msgstr in procoptions) then
@@ -3609,6 +3614,8 @@ implementation
          if po_has_importname in procoptions then
            ppufile.putstring(import_name^);
          ppufile.putword(import_nr);
+         if target_info.system in systems_interrupt_table then
+           ppufile.putlongint(interruptvector);
          if (po_msgint in procoptions) then
            ppufile.putlongint(messageinf.i);
          if (po_msgstr in procoptions) then

+ 5 - 0
compiler/symsym.pas

@@ -200,6 +200,7 @@ interface
       private
           _mangledname : pshortstring;
       public
+          section : ansistring;
           constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
           constructor create_dll(const n : string;vsp:tvarspez;def:tdef);
           constructor create_C(const n,mangled : string;vsp:tvarspez;def:tdef);
@@ -1312,6 +1313,8 @@ implementation
            _mangledname:=stringdup(ppufile.getstring)
          else
            _mangledname:=nil;
+         if vo_has_section in varoptions then
+           section:=ppufile.getansistring;
       end;
 
 
@@ -1336,6 +1339,8 @@ implementation
          inherited ppuwrite(ppufile);
          if vo_has_mangledname in varoptions then
            ppufile.putstring(_mangledname^);
+         if vo_has_section in varoptions then
+           ppufile.putansistring(section);
          ppufile.writeentry(ibstaticvarsym);
       end;
 

+ 17 - 0
compiler/symtable.pas

@@ -227,6 +227,7 @@ interface
     { searches symbols inside of a helper's implementation }
     function  searchsym_in_helper(classh,contextclassh:tobjectdef;const s: TIDString;out srsym:tsym;out srsymtable:TSymtable;aHasInherited:boolean):boolean;
     function  search_system_type(const s: TIDString): ttypesym;
+    function  try_search_system_type(const s: TIDString): ttypesym;
     function  search_named_unit_globaltype(const unitname, typename: TIDString; throwerror: boolean): ttypesym;
     function  search_struct_member(pd : tabstractrecorddef;const s : string):tsym;
     function  search_assignment_operator(from_def,to_def:Tdef;explicit:boolean):Tprocdef;
@@ -2516,6 +2517,22 @@ implementation
       end;
 
 
+    function try_search_system_type(const s: TIDString): ttypesym;
+      var
+        sym : tsym;
+      begin
+        sym:=tsym(systemunit.Find(s));
+        if not assigned(sym) then
+          result:=nil
+        else
+          begin
+            if sym.typ<>typesym then
+              cgmessage1(cg_f_unknown_system_type,s);
+            result:=ttypesym(sym);
+          end;
+      end;
+
+
     function search_named_unit_globaltype(const unitname, typename: TIDString; throwerror: boolean): ttypesym;
       var
         srsymtable: tsymtable;

+ 2 - 0
compiler/systems.pas

@@ -449,6 +449,8 @@ interface
 
        systems_internal_sysinit = [system_i386_linux,system_i386_win32];
 
+       systems_interrupt_table = [{system_arm_embedded}];
+
        { all symbian systems }
        systems_symbian = [system_i386_symbian,system_arm_symbian];
 

+ 1 - 1
compiler/systems/t_embed.pas

@@ -267,7 +267,7 @@ begin
       Add('{');
       Add('     .text :');
       Add('    {');
-      Add('    *(.init, .init.*)');
+      Add('    KEEP(*(.init, .init.*))');
       Add('    *(.text, .text.*)');
       Add('    *(.strings)');
       Add('    *(.rodata, .rodata.*)');

+ 61 - 17
compiler/systems/t_nwm.pas

@@ -97,7 +97,7 @@ implementation
     verbose,systems,globtype,globals,
     symconst,script,
     fmodule,aasmbase,aasmtai,aasmdata,aasmcpu,cpubase,symsym,symdef,
-    import,export,link,i_nwm,ogbase, ogcoff, ognlm
+    import,export,link,i_nwm,ogbase, ogcoff, ognlm, cclasses
     {$ifdef netware} ,dos {$endif}
     ;
 
@@ -126,6 +126,7 @@ implementation
     TInternalLinkerNetware = class(TInternalLinker)
         prelude : string;
         constructor create;override;
+        destructor destroy;override;
         procedure DefaultLinkScript;override;
         procedure InitSysInitUnitName;override;
         procedure ConcatEntryName; virtual;
@@ -339,10 +340,26 @@ begin
 
   { add objectfiles, start with nwpre always }
   LinkRes.Add ('INPUT(');
-  s2 := FindObjectFile('nwpre','',false);
+  if target_info.system = system_i386_netwlibc then
+   begin
+     s2 := FindObjectFile('nwplibc','',false);
+     if s2 = '' then
+       s2 := FindObjectFile('libcpre.gcc','',false);
+   end else
+     s2 := FindObjectFile('nwpre','',false);
   Comment (V_Debug,'adding Object File '+s2);
   {$ifndef netware} LinkRes.Add (s2); {$else} LinkRes.Add (FExpand(s2)); {$endif}
 
+  if target_info.system = system_i386_netwlibc then
+   begin
+     if isDll then  {needed to provide main}
+       s2 := FindObjectFile('nwl_dlle','',false)
+     else
+       s2 := FindObjectFile('nwl_main','',false);
+     Comment (V_Debug,'adding Object File '+s2);
+     {$ifndef netware} LinkRes.Add (s2); {$else} LinkRes.Add (FExpand(s2)); {$endif}
+    end;
+
   { main objectfiles, add to linker input }
   while not ObjectFiles.Empty do
   begin
@@ -364,9 +381,20 @@ begin
   {$endif}
 
   { start and stop-procedures }
-  NLMConvLinkFile.Add ('START _Prelude');  { defined in rtl/netware/nwpre.as }
-  NLMConvLinkFile.Add ('EXIT _Stop');                             { nwpre.as }
-  NLMConvLinkFile.Add ('CHECK FPC_NW_CHECKFUNCTION');            { system.pp }
+
+  if target_info.system = system_i386_netwlibc then
+    begin
+      NLMConvLinkFile.Add ('START _LibCPrelude');
+      NLMConvLinkFile.Add ('EXIT _LibCPostlude');
+      NLMConvLinkFile.Add ('CHECK _LibCCheckUnload');
+      NLMConvLinkFile.Add ('REENTRANT');            { needed by older libc versions }
+    end else
+    begin
+      NLMConvLinkFile.Add ('START _Prelude');  { defined in rtl/netware/nwpre.as }
+      NLMConvLinkFile.Add ('EXIT _Stop');                             { nwpre.as }
+      NLMConvLinkFile.Add ('CHECK FPC_NW_CHECKFUNCTION');            { system.pp }
+    end;
+
 
   if not (cs_link_strip in current_settings.globalswitches) then
   begin
@@ -567,8 +595,18 @@ end;
         inherited Create;
         CExeoutput:=TNLMexeoutput;
         CObjInput:=TNLMCoffObjInput;
+        nlmSpecialSymbols_Segments := TFPHashList.create;
       end;
 
+    destructor TInternalLinkerNetware.destroy;
+      begin
+        if assigned(nlmSpecialSymbols_Segments) then
+          begin
+            nlmSpecialSymbols_Segments.Free;
+            nlmSpecialSymbols_Segments := nil;
+          end;
+        inherited destroy;
+      end;
 
     procedure TInternalLinkerNetware.DefaultLinkScript;
       var
@@ -704,7 +742,10 @@ end;
             end;
             option := GetToken(s,';');
           end;
-          result := 'nwpre';
+          if target_info.system = system_i386_netwlibc then
+            result := 'libcpre'
+          else
+            result := 'nwpre';
         end;
 
       begin
@@ -750,32 +791,33 @@ end;
             Concat('IMAGEBASE $' + hexStr(0, SizeOf(imagebase)*2));
             Concat('HEADER');
             Concat('EXESECTION .text');
-            Concat('  SYMBOL __text_start__');
+            Concat('  SYMBOL __text_start__');  nlmSpecialSymbols_Segments.Add('__text_start__',pointer(ptruint(Section_text)));
             Concat('  OBJSECTION .text*');
-            Concat('  SYMBOL ___CTOR_LIST__');
-            Concat('  SYMBOL __CTOR_LIST__');
+            Concat('  SYMBOL ___CTOR_LIST__');  nlmSpecialSymbols_Segments.Add('___CTOR_LIST__',pointer(ptruint(Section_text)));
+            Concat('  SYMBOL __CTOR_LIST__');   nlmSpecialSymbols_Segments.Add('__CTOR_LIST__',pointer(ptruint(Section_text)));
             Concat('  LONG -1');
             Concat('  OBJSECTION .ctor*');
             Concat('  LONG 0');
-            Concat('  SYMBOL ___DTOR_LIST__');
-            Concat('  SYMBOL __DTOR_LIST__');
+            Concat('  SYMBOL ___DTOR_LIST__');  nlmSpecialSymbols_Segments.Add('___DTOR_LIST__',pointer(ptruint(Section_text)));
+            Concat('  SYMBOL __DTOR_LIST__');   nlmSpecialSymbols_Segments.Add('__DTOR_LIST__',pointer(ptruint(Section_text)));
             Concat('  LONG -1');
             Concat('  OBJSECTION .dtor*');
             Concat('  LONG 0');
-            Concat('  SYMBOL etext');
+            Concat('  SYMBOL etext');           nlmSpecialSymbols_Segments.Add('etext',pointer(ptruint(Section_text)));
             Concat('ENDEXESECTION');
+
             Concat('EXESECTION .data');
-            Concat('  SYMBOL __data_start__');
+            Concat('  SYMBOL __data_start__');  nlmSpecialSymbols_Segments.Add('__data_start__',pointer(ptruint(Section_data)));
             Concat('  OBJSECTION .data*');
             Concat('  OBJSECTION .fpc*');
-            Concat('  SYMBOL edata');
-            Concat('  SYMBOL __data_end__');
+            Concat('  SYMBOL edata');           nlmSpecialSymbols_Segments.Add('edata',pointer(ptruint(Section_data)));
+            Concat('  SYMBOL __data_end__');    nlmSpecialSymbols_Segments.Add('__data_end__',pointer(ptruint(Section_data)));
             Concat('ENDEXESECTION');
 
             Concat('EXESECTION .bss');
-            Concat('  SYMBOL __bss_start__');
+            Concat('  SYMBOL __bss_start__');   nlmSpecialSymbols_Segments.Add('__bss_start__',pointer(ptruint(Section_data)));
             Concat('  OBJSECTION .bss*');
-            Concat('  SYMBOL __bss_end__');
+            Concat('  SYMBOL __bss_end__');     nlmSpecialSymbols_Segments.Add('__bss_end__',pointer(ptruint(Section_data)));
             Concat('ENDEXESECTION');
 
             Concat('EXESECTION .imports');
@@ -880,6 +922,8 @@ end;
                 Concat ('STACKSIZE '+tostr(stacksize));
               end else
                 Concat ('STACKSIZE '+tostr(minStackSize));
+              if target_info.system = system_i386_netwlibc then
+                Concat ('REENTRANT');            { needed by older libc versions }
           end;
 
         // add symbols needed by nwpre. We have not loaded the ppu,

+ 2 - 0
compiler/tokens.pas

@@ -204,6 +204,7 @@ type
     _PRIVATE,
     _PROGRAM,
     _R12BASE,
+    _SECTION,
     _STDCALL,
     _SYSCALL,
     _VARARGS,
@@ -499,6 +500,7 @@ const
       (str:'PRIVATE'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'PROGRAM'       ;special:false;keyword:m_all;op:NOTOKEN),
       (str:'R12BASE'       ;special:false;keyword:m_none;op:NOTOKEN),   { Syscall variation on MorphOS }
+      (str:'SECTION'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'STDCALL'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'SYSCALL'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'VARARGS'       ;special:false;keyword:m_none;op:NOTOKEN),

+ 3 - 3
compiler/x86/agx86int.pas

@@ -59,7 +59,7 @@ implementation
     const
       line_length = 70;
 
-      secnames : array[TAsmSectiontype] of string[4] = ('',
+      secnames : array[TAsmSectiontype] of string[4] = ('','',
         'CODE','DATA','DATA','DATA','BSS','',
         '','','','','','',
         '','','','',
@@ -109,7 +109,7 @@ implementation
         ''
       );
 
-      secnamesml64 : array[TAsmSectiontype] of string[7] = ('',
+      secnamesml64 : array[TAsmSectiontype] of string[7] = ('','',
         '_TEXT','_DATE','_DATA','_DATA','_BSS','',
         '','','','',
         'idata$2','idata$4','idata$5','idata$6','idata$7','edata',
@@ -978,7 +978,7 @@ implementation
 
       { better do this at end of WriteTree, but then there comes a trouble with
         al_const which does not have leading ait_section and thus goes out of segment }
-        
+
       { TODO: probably ml64 needs 'closing' last section, too }
       if LastSecType <> sec_none then
         AsmWriteLn('_'+secnames[LasTSecType]+#9#9'ENDS');

+ 431 - 4
compiler/x86/x86ins.dat

@@ -2557,7 +2557,9 @@ xmmreg,mem            \1\x66\301\323\2\x0F\xE3\110          WILLAMETTE,SSE2,SM
 [PEXTRW]
 (Ch_All, Ch_None, Ch_None)
 reg32,mmxreg,imm      \2\x0F\xC5\110\22               KATMAI,MMX,SB,AR2
-reg32,xmmreg,imm      \1\x66\323\2\x0F\xC5\110\26       WILLAMETTE,SSE2,SB,AR2
+reg32,xmmreg,imm      \1\x66\323\2\x0F\xC5\110\26                    SSE4
+mem32,xmmreg,imm      \1\x66\300\323\3\x0F\x3A\x15\101\26            SSE4
+
 
 [PINSRW]
 (Ch_All, Ch_None, Ch_None)
@@ -3269,7 +3271,7 @@ mem,xmmreg              \333\300\323\2\x0F\x2B\101                   SSE4,SD
 
 [MOVNTSD]
 (Ch_All, Ch_None, Ch_None)
-mem,xmmreg              \300\334\325\323\2\x0F\x2B\\101                SSE4 ;,SQ
+mem,xmmreg              \300\334\325\323\2\x0F\x2B\101                SSE4 ;,SQ
 
 [INSERTQ]
 (Ch_All, Ch_None, Ch_None)
@@ -3287,7 +3289,432 @@ xmmreg,xmmreg           \336\323\2\x0F\x79\110                        SSE4
 reg16,regmem            \320\333\301\323\2\x0F\xBD\110                386,SM,SSE4
 reg32|64,regmem         \321\333\301\323\2\x0F\xBD\110                386,SM,SSE4
 
+;*******************************************************************************
+;**********SSSE3****************************************************************
+;*******************************************************************************
+;Use SSE4, but need special flag for SSSE3 insructions set
+[PABSB]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x1C\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x1C\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x1C\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x1C\110               SSE4
+
+[PABSW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x1D\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x1D\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x1D\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x1D\110               SSE4
+
+[PABSD]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x1E\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x1E\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x1E\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x1E\110               SSE4
+
+[PALIGNR]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg,imm     \331\3\x0F\x3A\x0F\110\26                      SSE4
+mmxreg,mem,imm        \301\331\3\x0F\x3A\x0F\110\26                  SSE4
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x0F\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x0F\110\26            SSE4
+
+[PHADDW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x01\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x01\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x01\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x01\110               SSE4
+
+[PHADDD]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x02\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x02\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x02\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x02\110               SSE4
+
+[PHADDSW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x03\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x03\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x03\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x03\110               SSE4
+
+[PHSUBW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x05\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x05\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x05\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x05\110               SSE4
+
+[PHSUBD]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x06\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x06\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x06\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x06\110               SSE4
+
+[PHSUBSW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x07\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x07\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x07\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x07\110               SSE4
+
+[PMADDUBSW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x04\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x04\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x04\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x04\110               SSE4
+
+[PMULHRSW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x0B\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x0B\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x0B\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x0B\110               SSE4
+
+[PSHUFB]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x00\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x00\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x00\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x00\110               SSE4
+
+[PSIGNB]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x08\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x08\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x08\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x08\110               SSE4
+
+[PSIGNW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x09\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x09\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x09\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x09\110               SSE4
+
+[PSIGND]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x0A\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x0A\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x0A\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x0A\110               SSE4
+;*******************************************************************************
+;**********SSE4.1***************************************************************
+;*******************************************************************************
+[BLENDPS] ;By hands delete 'or ot_signed' from i386tab.inc or x8664tab.inc
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x0C\110\26          SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x0C\110\26      SSE4
+
+[BLENDPD] ;By hands delete 'or ot_signed' from i386tab.inc or x8664tab.inc 
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\2\x0F\x3A\375\1\x0D\110\26          SSE4
+xmmreg,mem,imm        \1\x66\301\331\2\x0F\x3A\375\1\x0D\110\26      SSE4
+
+[BLENDVPS]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x14\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x14\110               SSE4
+
+[BLENDVPD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x15\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x15\110               SSE4
+
+[DPPS]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x40\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x40\110\26            SSE4
+
+[DPPD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x41\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x41\110\26            SSE4
+
+[EXTRACTPS]
+(Ch_All, Ch_None, Ch_None)
+mem,xmmreg,imm       \1\x66\325\3\x0F\x3A\x17\101\26    SSE4
+reg32|64,xmmreg,imm  \1\x66\300\3\x0F\x3A\x17\101\26    SSE4
+
+[INSERTPS]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x21\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x21\110\26            SSE4
+
+[MOVNTDQA]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x2A\110               SSE4
+
+[MPSADBW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x42\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x42\110\26            SSE4
+
+[PACKUSDW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x2B\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x2B\110               SSE4
+
+[PBLENDVB]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x10\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x10\110               SSE4
+
+[PBLENDW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x0E\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x0E\110\26            SSE4
+
+[PCMPEQQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x29\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x29\110               SSE4
+
+[PEXTRB]
+(Ch_All, Ch_None, Ch_None)
+reg32,xmmreg,imm      \1\x66\323\3\x0F\x3A\x14\101\26                SSE4
+mem8,xmmreg,imm       \1\x66\300\323\3\x0F\x3A\x14\101\26            SSE4
+
+;PEXTRW - Look is prev. implementation
+
+[PEXTRD]
+(Ch_All, Ch_None, Ch_None)
+reg32,xmmreg,imm      \1\x66\323\3\x0F\x3A\x16\101\26                SSE4
+mem32,xmmreg,imm      \1\x66\300\323\3\x0F\x3A\x16\101\26            SSE4
+
+[PEXTRQ]
+(Ch_All, Ch_None, Ch_None)
+reg64,xmmreg,imm      \1\x66\326\3\x0F\x3A\x16\101\26                SSE4
+mem64,xmmreg,imm      \1\x66\300\326\3\x0F\x3A\x16\101\26            SSE4
+
+[PHMINPOSUW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x41\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x41\110               SSE4
+
+[PINSRB]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,reg32,imm      \1\x66\331\3\x0F\x3A\x20\110\26                SSE4
+xmmreg,mem8,imm       \1\x66\301\331\3\x0F\x3A\x20\110\26            SSE4
+
+[PINSRD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,reg32,imm      \1\x66\331\3\x0F\x3A\x22\110\26                SSE4
+xmmreg,mem32,imm      \1\x66\301\331\3\x0F\x3A\x22\110\26            SSE4
+
+[PINSRQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,reg64,imm      \1\x66\326\3\x0F\x3A\x22\110\26                SSE4
+xmmreg,mem64,imm      \1\x66\301\326\3\x0F\x3A\x22\110\26            SSE4
+
+[PMAXSB]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3C\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3C\110               SSE4
+
+[PMAXSD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3D\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3D\110               SSE4
+
+[PMAXUD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3F\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3F\110               SSE4
+
+[PMAXUW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3E\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3E\110               SSE4
+
+[PMINSB]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x38\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x38\110               SSE4
+
+[PMINSD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x39\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x39\110               SSE4
+
+[PMINUW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3A\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3A\110               SSE4
+
+[PMINUD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3B\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3B\110               SSE4
+
+[PMOVSXBW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x20\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x20\110               SSE4
+
+[PMOVSXBD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x21\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x21\110               SSE4
+
+[PMOVSXBQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x22\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x22\110               SSE4
+
+[PMOVSXWD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x23\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x23\110               SSE4
+
+[PMOVSXWQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x24\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x24\110               SSE4
+
+[PMOVSXDQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x25\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x25\110               SSE4
+
+[PMOVZXBW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x30\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x30\110               SSE4
+
+[PMOVZXBD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x31\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x31\110               SSE4
+
+[PMOVZXBQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x32\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x32\110               SSE4
+
+[PMOVZXWD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x33\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x33\110               SSE4
+
+[PMOVZXWQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x34\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x34\110               SSE4
+
+[PMOVZXDQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x35\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x35\110               SSE4
+
+[PMULDQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x28\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x28\110               SSE4
+
+[PTEST]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x17\110                   SSE4
+
+[ROUNDPS]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x08\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x08\110\26            SSE4
+
+[ROUNDPD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x09\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x09\110\26            SSE4
+
+[ROUNDSS]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x0A\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x0A\110\26            SSE4
+
+[ROUNDSD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x0B\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x0B\110\26            SSE4
+;*******************************************************************************
+;**********SSE4.2***************************************************************
+;*******************************************************************************
+[PCMPESTRI]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm      \1\x66\331\3\x0F\x3A\x61\110\26               SSE4
+xmmreg,mem,imm         \1\x66\301\331\3\x0F\x3A\x61\110\26           SSE4
+[PCMPESTRM]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm      \1\x66\331\3\x0F\x3A\x60\110\26               SSE4
+xmmreg,mem,imm         \1\x66\301\331\3\x0F\x3A\x60\110\26           SSE4
+[PCMPISTRI]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm      \1\x66\331\3\x0F\x3A\x63\110\26               SSE4
+xmmreg,mem,imm         \1\x66\301\331\3\x0F\x3A\x63\110\26           SSE4
+[PCMPISTRM]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm      \1\x66\331\3\x0F\x3A\x62\110\26               SSE4
+xmmreg,mem,imm         \1\x66\301\331\3\x0F\x3A\x62\110\26           SSE4
+[PCMPGTQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x37\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x37\110               SSE4
+;   CRC32
 [POPCNT,popcntX]
 (Ch_All, Ch_None, Ch_None)
-reg16,regmem            \320\333\301\323\2\x0F\xB8\110                386,SM,SSE4
-reg32|64,regmem         \321\333\301\323\2\x0F\xB8\110                386,SM,SSE4
+reg16,rm16             \1\xF3\301\320\2\x0F\xB8\110                  386,SM,SSE4
+reg32,rm32             \1\xF3\301\320\2\x0F\xB8\110                  386,SM,SSE4
+reg64,rm64             \1\xF3\301\320\2\x0F\xB8\110                  386,SM,SSE4
+;*******************************************************************************
+;**********AES******************************************************************
+;*******************************************************************************
+;Use SSE4, but need special flag for AES insructions set
+
+[AESENC]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\xDC\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\xDC\110               SSE4
+
+[AESENCLAST]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\xDD\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\xDD\110               SSE4
+
+[AESDEC]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\xDE\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\xDE\110               SSE4
+
+[AESDECLAST]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\xDF\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\xDF\110               SSE4
+
+[AESIMC]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\xDB\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\xDB\110               SSE4
+
+[AESKEYGEN] ;AESKEYGENASIST
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\xDF\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\xDF\110\26            SSE4
+;*******************************************************************************
+;*******************************************************************************
+;*******************************************************************************
+[STOSQ]
+(Ch_RRAX, Ch_WMemEDI, Ch_RWRDI)
+void                   \2\x48\xAB                                    X86_64  
+
+[LODSQ]
+(Ch_WRAX, Ch_RWRSI, Ch_None)
+void                   \2\x48\xAD                                    X86_64    
+
+[CMPSQ]
+(Ch_All, Ch_None, Ch_None)
+void                   \2\x48\xA7                                    X86_64

+ 7 - 2
compiler/x86_64/cgcpu.pas

@@ -90,8 +90,13 @@ unit cgcpu;
         else
           { in intf. wrapper code generation }
           framepointer:=RS_FRAME_POINTER_REG;
-        rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_RBX,RS_RSI,RS_RDI,
-          RS_R8,RS_R9,RS_R10,RS_R11,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[framepointer]);
+        if target_info.system=system_x86_64_win64 then
+          rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_R8,RS_R9,RS_R10,
+            RS_R11,RS_RBX,RS_RSI,RS_RDI,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[framepointer])
+        else
+          rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_RSI,RS_RDI,RS_R8,
+            RS_R9,RS_R10,RS_R11,RS_RBX,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[framepointer]);
+
         rg[R_MMREGISTER]:=trgcpu.create(R_MMREGISTER,R_SUBWHOLE,[RS_XMM0,RS_XMM1,RS_XMM2,RS_XMM3,RS_XMM4,RS_XMM5,RS_XMM6,RS_XMM7,
           RS_XMM8,RS_XMM9,RS_XMM10,RS_XMM11,RS_XMM12,RS_XMM13,RS_XMM14,RS_XMM15],first_mm_imreg,[]);
         rgfpu:=Trgx86fpu.create;

+ 78 - 1
compiler/x86_64/x8664ats.inc

@@ -602,5 +602,82 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufINT,
-attsufINT
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufINT,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE
 );

+ 78 - 1
compiler/x86_64/x8664att.inc

@@ -602,5 +602,82 @@
 'insertq',
 'extrq',
 'lzcnt',
-'popcnt'
+'pabsb',
+'pabsw',
+'pabsd',
+'palignr',
+'phaddw',
+'phaddd',
+'phaddsw',
+'phsubw',
+'phsubd',
+'phsubsw',
+'pmaddubsw',
+'pmulhrsw',
+'pshufb',
+'psignb',
+'psignw',
+'psignd',
+'blendps',
+'blendpd',
+'blendvps',
+'blendvpd',
+'dpps',
+'dppd',
+'extractps',
+'insertps',
+'movntdqa',
+'mpsadbw',
+'packusdw',
+'pblendvb',
+'pblendw',
+'pcmpeqq',
+'pextrb',
+'pextrd',
+'pextrq',
+'phminposuw',
+'pinsrb',
+'pinsrd',
+'pinsrq',
+'pmaxsb',
+'pmaxsd',
+'pmaxud',
+'pmaxuw',
+'pminsb',
+'pminsd',
+'pminuw',
+'pminud',
+'pmovsxbw',
+'pmovsxbd',
+'pmovsxbq',
+'pmovsxwd',
+'pmovsxwq',
+'pmovsxdq',
+'pmovzxbw',
+'pmovzxbd',
+'pmovzxbq',
+'pmovzxwd',
+'pmovzxwq',
+'pmovzxdq',
+'pmuldq',
+'ptest',
+'roundps',
+'roundpd',
+'roundss',
+'roundsd',
+'pcmpestri',
+'pcmpestrm',
+'pcmpistri',
+'pcmpistrm',
+'pcmpgtq',
+'popcnt',
+'aesenc',
+'aesenclast',
+'aesdec',
+'aesdeclast',
+'aesimc',
+'aeskeygen',
+'stosq',
+'lodsq',
+'cmpsq'
 );

+ 78 - 1
compiler/x86_64/x8664int.inc

@@ -602,5 +602,82 @@
 'insertq',
 'extrq',
 'lzcnt',
-'popcnt'
+'pabsb',
+'pabsw',
+'pabsd',
+'palignr',
+'phaddw',
+'phaddd',
+'phaddsw',
+'phsubw',
+'phsubd',
+'phsubsw',
+'pmaddubsw',
+'pmulhrsw',
+'pshufb',
+'psignb',
+'psignw',
+'psignd',
+'blendps',
+'blendpd',
+'blendvps',
+'blendvpd',
+'dpps',
+'dppd',
+'extractps',
+'insertps',
+'movntdqa',
+'mpsadbw',
+'packusdw',
+'pblendvb',
+'pblendw',
+'pcmpeqq',
+'pextrb',
+'pextrd',
+'pextrq',
+'phminposuw',
+'pinsrb',
+'pinsrd',
+'pinsrq',
+'pmaxsb',
+'pmaxsd',
+'pmaxud',
+'pmaxuw',
+'pminsb',
+'pminsd',
+'pminuw',
+'pminud',
+'pmovsxbw',
+'pmovsxbd',
+'pmovsxbq',
+'pmovsxwd',
+'pmovsxwq',
+'pmovsxdq',
+'pmovzxbw',
+'pmovzxbd',
+'pmovzxbq',
+'pmovzxwd',
+'pmovzxwq',
+'pmovzxdq',
+'pmuldq',
+'ptest',
+'roundps',
+'roundpd',
+'roundss',
+'roundsd',
+'pcmpestri',
+'pcmpestrm',
+'pcmpistri',
+'pcmpistrm',
+'pcmpgtq',
+'popcnt',
+'aesenc',
+'aesenclast',
+'aesdec',
+'aesdeclast',
+'aesimc',
+'aeskeygen',
+'stosq',
+'lodsq',
+'cmpsq'
 );

+ 1 - 1
compiler/x86_64/x8664nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
-1372;
+1555;

+ 78 - 1
compiler/x86_64/x8664op.inc

@@ -602,5 +602,82 @@ A_MOVNTSD,
 A_INSERTQ,
 A_EXTRQ,
 A_LZCNT,
-A_POPCNT
+A_PABSB,
+A_PABSW,
+A_PABSD,
+A_PALIGNR,
+A_PHADDW,
+A_PHADDD,
+A_PHADDSW,
+A_PHSUBW,
+A_PHSUBD,
+A_PHSUBSW,
+A_PMADDUBSW,
+A_PMULHRSW,
+A_PSHUFB,
+A_PSIGNB,
+A_PSIGNW,
+A_PSIGND,
+A_BLENDPS,
+A_BLENDPD,
+A_BLENDVPS,
+A_BLENDVPD,
+A_DPPS,
+A_DPPD,
+A_EXTRACTPS,
+A_INSERTPS,
+A_MOVNTDQA,
+A_MPSADBW,
+A_PACKUSDW,
+A_PBLENDVB,
+A_PBLENDW,
+A_PCMPEQQ,
+A_PEXTRB,
+A_PEXTRD,
+A_PEXTRQ,
+A_PHMINPOSUW,
+A_PINSRB,
+A_PINSRD,
+A_PINSRQ,
+A_PMAXSB,
+A_PMAXSD,
+A_PMAXUD,
+A_PMAXUW,
+A_PMINSB,
+A_PMINSD,
+A_PMINUW,
+A_PMINUD,
+A_PMOVSXBW,
+A_PMOVSXBD,
+A_PMOVSXBQ,
+A_PMOVSXWD,
+A_PMOVSXWQ,
+A_PMOVSXDQ,
+A_PMOVZXBW,
+A_PMOVZXBD,
+A_PMOVZXBQ,
+A_PMOVZXWD,
+A_PMOVZXWQ,
+A_PMOVZXDQ,
+A_PMULDQ,
+A_PTEST,
+A_ROUNDPS,
+A_ROUNDPD,
+A_ROUNDSS,
+A_ROUNDSD,
+A_PCMPESTRI,
+A_PCMPESTRM,
+A_PCMPISTRI,
+A_PCMPISTRM,
+A_PCMPGTQ,
+A_POPCNT,
+A_AESENC,
+A_AESENCLAST,
+A_AESDEC,
+A_AESDECLAST,
+A_AESIMC,
+A_AESKEYGEN,
+A_STOSQ,
+A_LODSQ,
+A_CMPSQ
 );

+ 77 - 0
compiler/x86_64/x8664pro.inc

@@ -602,5 +602,82 @@
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_RRAX, Ch_WMemEDI, Ch_RWRDI)),
+(Ch: (Ch_WRAX, Ch_RWRSI, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None))
 );

+ 1291 - 10
compiler/x86_64/x8664tab.inc

@@ -7705,7 +7705,14 @@
     ops     : 3;
     optypes : (ot_reg32,ot_xmmreg,ot_immediate);
     code    : #1#102#211#2#15#197#72#22;
-    flags   : if_willamette or if_sse2 or if_sb or if_ar2
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRW;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#21#65#22;
+    flags   : if_sse4
   ),
   (
     opcode  : A_PINSRW;
@@ -9552,7 +9559,7 @@
     opcode  : A_MOVNTSD;
     ops     : 2;
     optypes : (ot_memory,ot_xmmreg,ot_none);
-    code    : #192#220#213#211#2#15#43#0#65;
+    code    : #192#220#213#211#2#15#43#65;
     flags   : if_sse4
   ),
   (
@@ -9591,17 +9598,1291 @@
     flags   : if_386 or if_sm or if_sse4
   ),
   (
-    opcode  : A_POPCNT;
+    opcode  : A_PABSB;
     ops     : 2;
-    optypes : (ot_reg16,ot_regmem,ot_none);
-    code    : #208#219#193#211#2#15#184#72;
-    flags   : if_386 or if_sm or if_sse4
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#28#72;
+    flags   : if_sse4
   ),
   (
-    opcode  : A_POPCNT;
+    opcode  : A_PABSB;
     ops     : 2;
-    optypes : (ot_reg32 or ot_bits64,ot_regmem,ot_none);
-    code    : #209#219#193#211#2#15#184#72;
-    flags   : if_386 or if_sm or if_sse4
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_immediate);
+    code    : #217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_mmxreg,ot_memory,ot_immediate);
+    code    : #193#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg or ot_signed,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#12#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg or ot_signed,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#12#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#2#15#58#253#1#13#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#2#15#58#253#1#13#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#20#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#20#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#21#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#21#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#64#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#64#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#65#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#65#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_EXTRACTPS;
+    ops     : 3;
+    optypes : (ot_memory,ot_xmmreg,ot_immediate);
+    code    : #1#102#213#3#15#58#23#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_EXTRACTPS;
+    ops     : 3;
+    optypes : (ot_reg32 or ot_bits64,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#3#15#58#23#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_INSERTPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#33#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_INSERTPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#33#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MOVNTDQA;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#42#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MPSADBW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#66#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MPSADBW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#66#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PACKUSDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#43#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PACKUSDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#43#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDVB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#16#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDVB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#16#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate or ot_signed);
+    code    : #1#102#217#3#15#58#14#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate or ot_signed);
+    code    : #1#102#193#217#3#15#58#14#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPEQQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#41#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPEQQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#41#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRB;
+    ops     : 3;
+    optypes : (ot_reg32,ot_xmmreg,ot_immediate);
+    code    : #1#102#211#3#15#58#20#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRB;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits8,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#20#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRD;
+    ops     : 3;
+    optypes : (ot_reg32,ot_xmmreg,ot_immediate);
+    code    : #1#102#211#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRD;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRQ;
+    ops     : 3;
+    optypes : (ot_reg64,ot_xmmreg,ot_immediate);
+    code    : #1#102#214#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRQ;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits64,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#214#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHMINPOSUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#65#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHMINPOSUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#65#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRB;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg32,ot_immediate);
+    code    : #1#102#217#3#15#58#32#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRB;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits8,ot_immediate);
+    code    : #1#102#193#217#3#15#58#32#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg32,ot_immediate);
+    code    : #1#102#217#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits32,ot_immediate);
+    code    : #1#102#193#217#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRQ;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg64,ot_immediate);
+    code    : #1#102#214#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRQ;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits64,ot_immediate);
+    code    : #1#102#193#214#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#60#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#60#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#61#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#61#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#63#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#63#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#62#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#62#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#56#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#56#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#57#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#57#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#58#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#58#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#59#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#59#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#32#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#32#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#33#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#33#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#34#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#34#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#35#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#35#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#36#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#36#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#37#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#37#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#48#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#48#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#49#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#49#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#50#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#50#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#51#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#51#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#52#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#52#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#53#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#53#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#40#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#40#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PTEST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#23#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#8#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#8#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#9#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#9#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#10#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#10#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#11#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#11#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#97#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#97#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#96#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#96#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#99#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#99#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#98#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#98#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPGTQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#55#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPGTQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#55#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg16,ot_regmem or ot_bits16,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg32,ot_regmem or ot_bits32,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg64,ot_regmem or ot_bits64,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_AESENC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#220#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#220#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENCLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#221#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENCLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#221#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDEC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#222#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDEC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#222#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDECLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#223#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDECLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#223#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESIMC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#219#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESIMC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#219#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESKEYGEN;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#223#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESKEYGEN;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#223#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_STOSQ;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none);
+    code    : #2#72#171;
+    flags   : if_x86_64
+  ),
+  (
+    opcode  : A_LODSQ;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none);
+    code    : #2#72#173;
+    flags   : if_x86_64
+  ),
+  (
+    opcode  : A_CMPSQ;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none);
+    code    : #2#72#167;
+    flags   : if_x86_64
   )
 );

+ 0 - 2
packages/fcl-db/src/base/fields.inc

@@ -827,8 +827,6 @@ begin
     Validate(Buffer);
     end;
   FDataSet.SetFieldData(Self,Buffer, NativeFormat);
-  if not (FDataSet.State in [dsCalcFields, dsFilter, dsNewValue]) then
-    DataChanged;
 end;
 
 Procedure TField.SetDataset (AValue : TDataset);

+ 41 - 16
packages/fcl-db/src/memds/memds.pp

@@ -11,8 +11,10 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
  **********************************************************************}
+{$IFDEF FPC}
 {$mode objfpc}
 {$H+}
+{$ENDIF}
 {
   TMemDataset : In-memory dataset.
   - Has possibility to copy Structure/Data from other dataset.
@@ -37,6 +39,10 @@ const
   smData      = 2;
 
 type
+  {$IFNDEF FPC}
+  ptrint = Integer;
+  {$ENDIF}
+
   MDSError=class(Exception);
 
   PRecInfo=^TMTRecInfo;
@@ -63,6 +69,9 @@ type
     FFilterBuffer: PChar;
     ffieldoffsets: PInteger;
     ffieldsizes: PInteger;
+    function GetCharPointer(p:PChar; Pos:Integer):PChar;
+    function GetIntegerPointer(p:PInteger; Pos:Integer):PInteger;
+
     procedure calcrecordlayout;
     function  MDSGetRecordOffset(ARecNo: integer): longint;
     function  MDSGetFieldOffset(FieldNo: integer): integer;
@@ -123,16 +132,16 @@ type
 
     Function  DataSize : Integer;
 
-    procedure Clear(ClearDefs : Boolean);
-    procedure Clear;
-    Procedure SaveToFile(AFileName : String);
-    Procedure SaveToFile(AFileName : String; SaveData : Boolean);
-    Procedure SaveToStream(F : TStream);
-    Procedure SaveToStream(F : TStream; SaveData : Boolean);
+    procedure Clear(ClearDefs : Boolean);{$IFNDEF FPC} overload; {$ENDIF}
+    procedure Clear;{$IFNDEF FPC} overload; {$ENDIF}
+    Procedure SaveToFile(AFileName : String);{$IFNDEF FPC} overload; {$ENDIF}
+    Procedure SaveToFile(AFileName : String; SaveData : Boolean);{$IFNDEF FPC} overload; {$ENDIF}
+    Procedure SaveToStream(F : TStream); {$IFNDEF FPC} overload; {$ENDIF}
+    Procedure SaveToStream(F : TStream; SaveData : Boolean);{$IFNDEF FPC} overload; {$ENDIF}
     Procedure LoadFromStream(F : TStream);
     Procedure LoadFromFile(AFileName : String);
-    Procedure CopyFromDataset(DataSet : TDataSet);
-    Procedure CopyFromDataset(DataSet : TDataSet; CopyData : Boolean);
+    Procedure CopyFromDataset(DataSet : TDataSet); {$IFNDEF FPC} overload; {$ENDIF}
+    Procedure CopyFromDataset(DataSet : TDataSet; CopyData : Boolean); {$IFNDEF FPC} overload; {$ENDIF}
 
     Property FileModified : Boolean Read FFileModified;
 
@@ -284,7 +293,7 @@ end;
 
 function TMemDataset.MDSGetFieldOffset(FieldNo: integer): integer;
 begin
- result:= ffieldoffsets[fieldno-1];
+ result:= getIntegerpointer(ffieldoffsets, fieldno-1)^;
 end;
 
 Procedure TMemDataset.RaiseError(Fmt : String; Args : Array of const);
@@ -706,7 +715,7 @@ begin
           not getfieldisnull(pointer(srcbuffer),I);
  if result and (buffer <> nil) then 
    begin
-   Move((SrcBuffer+ffieldoffsets[I])^, Buffer^,FFieldSizes[I]);
+   Move(getcharpointer(SrcBuffer,getintegerpointer(ffieldoffsets,I)^)^, Buffer^,GetIntegerPointer(FFieldSizes, I)^);
    end;
 end;
 
@@ -724,10 +733,10 @@ begin
    else 
      begin 
      unsetfieldisnull(pointer(destbuffer),I);
-     J:=FFieldSizes[I];
+     J:=GetIntegerPointer(FFieldSizes, I)^;
      if Field.DataType=ftString then
        Dec(J); // Do not move terminating 0, which is in the size.
-     Move(Buffer^,(DestBuffer+FFieldOffsets[I])^,J);
+     Move(Buffer^,GetCharPointer(DestBuffer, getIntegerPointer(FFieldOffsets, I)^)^,J);
      dataevent(defieldchange,ptrint(field));
      end;
    end;
@@ -843,18 +852,22 @@ begin
  // Avoid mem-leak if CreateTable is called twice
  FreeMem(ffieldoffsets);
  Freemem(ffieldsizes);
-
+ {$IFDEF FPC}
  FFieldOffsets:=getmem(Count*sizeof(integer));
  FFieldSizes:=getmem(Count*sizeof(integer));
+ {$ELSE}
+ getmem(FFieldOffsets, Count*sizeof(integer));
+ getmem(FFieldSizes, Count*sizeof(integer));
+ {$ENDIF}
  FRecSize:= (Count+7) div 8; //null mask
 {$IFDEF FPC_REQUIRES_PROPER_ALIGNMENT}
  FRecSize:=Align(FRecSize,4);
 {$ENDIF}
  for i:= 0 to Count-1 do
    begin
-   ffieldoffsets[i] := frecsize;
-   ffieldsizes[i] := MDSGetbufferSize(i+1);
-   FRecSize:= FRecSize+FFieldSizes[i];
+   GetIntegerPointer(ffieldoffsets, i)^ := frecsize;
+   GetIntegerPointer(ffieldsizes,   i)^ := MDSGetbufferSize(i+1);
+   FRecSize:= FRecSize+GetIntegerPointeR(FFieldSizes, i)^;
    end;
 end;
 
@@ -988,4 +1001,16 @@ begin
     end;
 end;
 
+function TMemDataset.GetCharPointer(p:PChar; Pos:Integer):PChar;
+begin
+  Result:=p;
+  inc(Result, Pos);
+end;
+
+function TMemDataset.GetIntegerPointer(p:PInteger; Pos:Integer):PInteger;
+begin
+  Result:=p;
+  inc(Result, Pos);
+end;
+
 end.

+ 5 - 758
packages/fcl-stl/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/03/21]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2010/11/14]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=x86_64-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -245,7 +245,7 @@ endif
 ifndef CROSSBINDIR
 CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
 endif
-ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_TARGET),darwin)
 ifeq ($(OS_SOURCE),darwin)
 DARWIN2DARWIN=1
 endif
@@ -266,574 +266,16 @@ endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
 override PACKAGE_NAME=fcl-stl
 override PACKAGE_VERSION=2.5.1
-ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-nativent)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc-wii)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
-endif
-ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
+override TARGET_UNITS+=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector ghashset ghashmap
 endif
 override INSTALL_FPCPACKAGE=y
-ifeq ($(FULL_TARGET),i386-linux)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-go32v2)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-win32)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-os2)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-freebsd)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-beos)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-haiku)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-netbsd)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-solaris)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-qnx)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-netware)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-openbsd)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-wdosx)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-darwin)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-emx)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-watcom)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-netwlibc)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-wince)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-nativent)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),m68k-linux)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),m68k-freebsd)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),m68k-netbsd)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),m68k-amiga)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),m68k-atari)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),m68k-openbsd)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),m68k-palmos)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc-linux)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc-netbsd)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc-amiga)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc-macos)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc-darwin)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc-morphos)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc-wii)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),sparc-linux)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),sparc-netbsd)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),sparc-solaris)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 override COMPILER_OPTIONS+=-S2h
 endif
-ifeq ($(FULL_TARGET),x86_64-freebsd)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),x86_64-solaris)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),x86_64-darwin)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),x86_64-win64)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),arm-linux)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),arm-palmos)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),arm-darwin)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),arm-wince)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),arm-gba)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),arm-nds)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc64-linux)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc64-darwin)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),avr-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),mipsel-linux)
-override COMPILER_OPTIONS+=-S2h
-endif
-ifeq ($(FULL_TARGET),i386-linux)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-go32v2)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-win32)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-os2)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-freebsd)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-beos)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-haiku)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-netbsd)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-solaris)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-qnx)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-netware)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-openbsd)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-wdosx)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-darwin)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-emx)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-watcom)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-netwlibc)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-wince)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-embedded)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-nativent)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),m68k-linux)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),m68k-freebsd)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),m68k-netbsd)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),m68k-amiga)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),m68k-atari)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),m68k-openbsd)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),m68k-palmos)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc-linux)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc-netbsd)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc-amiga)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc-macos)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc-darwin)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc-morphos)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc-wii)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),sparc-linux)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),sparc-netbsd)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),sparc-solaris)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-override COMPILER_SOURCEDIR+=src
-endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 override COMPILER_SOURCEDIR+=src
 endif
-ifeq ($(FULL_TARGET),x86_64-freebsd)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),x86_64-solaris)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),x86_64-darwin)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),x86_64-win64)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),arm-linux)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),arm-palmos)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),arm-darwin)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),arm-wince)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),arm-gba)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),arm-nds)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc64-linux)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc64-darwin)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),avr-embedded)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-override COMPILER_SOURCEDIR+=src
-endif
-ifeq ($(FULL_TARGET),mipsel-linux)
-override COMPILER_SOURCEDIR+=src
-endif
 ifdef REQUIRE_UNITSDIR
 override UNITSDIR+=$(REQUIRE_UNITSDIR)
 endif
@@ -1161,7 +603,7 @@ DEBUGSYMEXT=.xcoff
 SHORTSUFFIX=mac
 IMPORTLIBPREFIX=imp
 endif
-ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_TARGET),darwin)
 BATCHEXT=.sh
 EXEEXT=
 HASSHAREDLIB=1
@@ -1176,15 +618,6 @@ ifeq ($(OS_TARGET),symbian)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=symbian
 endif
-ifeq ($(OS_TARGET),NativeNT)
-SHAREDLIBEXT=.dll
-SHORTSUFFIX=nativent
-endif
-ifeq ($(OS_TARGET),wii)
-EXEEXT=.dol
-SHAREDLIBEXT=.so
-SHORTSUFFIX=wii
-endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1610,195 +1043,9 @@ TAROPT=vz
 TAREXT=.tar.gz
 endif
 override REQUIRE_PACKAGES=rtl 
-ifeq ($(FULL_TARGET),i386-linux)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-go32v2)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-win32)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-os2)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-freebsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-beos)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-haiku)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-netbsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-solaris)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-qnx)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-netware)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-openbsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-wdosx)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-darwin)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-emx)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-watcom)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-netwlibc)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-wince)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-symbian)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-nativent)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),i386-iphonesim)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),m68k-linux)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),m68k-freebsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),m68k-netbsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),m68k-amiga)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),m68k-atari)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),m68k-openbsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),m68k-palmos)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),m68k-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc-linux)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc-netbsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc-amiga)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc-macos)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc-darwin)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc-morphos)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc-wii)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),sparc-linux)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),sparc-netbsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),sparc-solaris)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),sparc-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 REQUIRE_PACKAGES_RTL=1
 endif
-ifeq ($(FULL_TARGET),x86_64-freebsd)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),x86_64-solaris)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),x86_64-darwin)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),x86_64-win64)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),x86_64-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),arm-linux)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),arm-palmos)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),arm-darwin)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),arm-wince)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),arm-gba)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),arm-nds)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),arm-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),arm-symbian)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc64-linux)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc64-darwin)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),powerpc64-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),avr-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),armeb-linux)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),armeb-embedded)
-REQUIRE_PACKAGES_RTL=1
-endif
-ifeq ($(FULL_TARGET),mipsel-linux)
-REQUIRE_PACKAGES_RTL=1
-endif
 ifdef REQUIRE_PACKAGES_RTL
 PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
 ifneq ($(PACKAGEDIR_RTL),)

+ 1 - 1
packages/fcl-stl/Makefile.fpc

@@ -7,7 +7,7 @@ name=fcl-stl
 version=2.5.1
 
 [target]
-units=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector
+units=garrayutils gdeque gmap gpriorityqueue gqueue gset gstack gutil gvector ghashset ghashmap
 
 [install]
 fpcpackage=y

+ 1 - 1
packages/fcl-stl/doc/set.tex

@@ -11,7 +11,7 @@ that node. This node can be also used for navigation between elements by methods
 (But don't do anything else with it, you can lose data integrity.)
 
 Memory complexity:
-Size of stored base + constant overhead for each stored element (3 pointers + one boolean).
+Size of stored elements + constant overhead for each stored element (3 pointers + one boolean).
 
 Members list:
 

+ 27 - 0
packages/fcl-stl/src/garrayutils.pp

@@ -32,6 +32,7 @@ type
     class function Parent(a:SizeUInt):SizeUInt;inline;
   public
     class procedure Sort(var Arr: TArr; size:SizeUInt);
+    class function NextPermutation(var Arr: TArr; size:SizeUInt):boolean;
   end;
 
   generic TArrayUtils<TArr, Tvalue>=class
@@ -212,6 +213,32 @@ begin
   end;
 end;
 
+class function TOrderingArrayUtils.NextPermutation(var Arr: TArr; size: SizeUInt):boolean;
+var i,f:SizeUInt; temp:TValue;
+begin
+  f := -1;
+  for i:=size-1 downto 1 do begin 
+    if (TCompare.c(arr[i-1], arr[i])) then begin
+      f := i-1;
+      break;
+    end;
+  end;
+  if f = -1 then exit(false);
+  for i:=size-1 downto 1 do begin
+    if (TCompare.c(arr[f], arr[i])) then begin
+      temp:=arr[f]; arr[f] := arr[i]; arr[i] := temp;
+      break;
+    end;
+  end;
+  i:= size-1;
+  inc(f);
+  while (i > f) do begin
+    temp:=arr[f]; arr[f] := arr[i]; arr[i] := temp;
+    dec(i); inc(f);
+  end;
+  NextPermutation := true;
+end;
+
 class procedure TArrayUtils.RandomShuffle(Arr: TArr; size: SizeUInt);
 var i,r:SizeUInt; temp:Tvalue;
 begin

+ 216 - 0
packages/fcl-stl/src/ghashmap.pp

@@ -0,0 +1,216 @@
+{
+   This file is part of the Free Pascal FCL library.
+   BSD parts (c) 2011 Vlado Boza
+
+   See the file COPYING.FPC, included in this distribution,
+   for details about the copyright.
+
+   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.
+
+**********************************************************************}
+{$mode objfpc}
+
+unit ghashmap;
+
+interface
+uses gvector, gutil, garrayutils;
+
+const baseFDataSize = 8;
+
+{Thash should have one class function hash(a:TKey, n:longint):longint which return uniformly distributed
+value in range <0,n-1> base only on arguments, n will be always power of 2}
+
+type
+  generic THashmapIterator<T, TTable>=class
+    public
+    var
+      Fh,Fp:SizeUInt;
+      FData:TTable;
+      function Next:boolean;
+      function GetValue:T;
+  end;
+
+  generic THashmap<TKey, TValue, Thash>=class
+    public
+    type
+      TPair=record
+        Value:TValue;
+        Key:TKey;
+      end;
+    var
+    private 
+    type
+      TContainer = specialize TVector<TPair>;
+      TTable = specialize TVector<TContainer>;
+    var 
+      FData:TTable;
+      FDataSize:SizeUInt; 
+      procedure EnlargeTable;
+    public 
+    type
+      TIterator = specialize THashmapIterator<TPair, TTable>;
+      constructor create;
+      destructor destroy;override;
+      procedure insert(key:TKey;value:TValue);inline;
+      function contains(key:TKey):boolean;inline;
+      function size:SizeUInt;inline;
+      procedure delete(key:TKey);inline;
+      function IsEmpty:boolean;inline;
+      function GetValue(key:TKey):TValue;inline;
+
+      property Items[i : TKey]: TValue read GetValue write Insert; default;
+
+      function Iterator:TIterator;
+  end;
+
+implementation
+
+function THashmap.Size:SizeUInt;inline;
+begin
+  Size:=FDataSize;
+end;
+
+destructor THashmap.Destroy;
+var i:SizeUInt;
+begin
+  for i:=0 to FData.size do
+    (FData[i]).Destroy;
+  FData.Destroy;
+end;
+
+function THashmap.IsEmpty():boolean;inline;
+begin
+  if Size()=0 then 
+    IsEmpty:=true
+  else 
+    IsEmpty:=false;
+end;
+
+procedure THashmap.EnlargeTable;
+var i,j,h,oldDataSize:SizeUInt; 
+    value:TPair;
+begin
+  oldDataSize:=FData.size;
+  FData.resize(FData.size*2);
+  for i:=oldDataSize to FData.size-1 do
+    FData[i] := TContainer.create;
+  for i:=oldDataSize-1 downto 0 do begin
+    j := 0;
+    while j < (FData[i]).size do begin
+      value := (FData[i])[j];
+      h:=Thash.hash(value.key,FData.size);
+      if (h <> i) then begin
+        (FData[i])[j] := (FData[i]).back;
+        (FData[i]).popback;
+        (FData[h]).pushback(value);
+      end else
+        inc(j);
+    end;
+  end;
+end;
+
+constructor THashmap.create;
+var i:longint;
+begin
+  FDataSize:=0;
+  FData:=TTable.create;
+  FData.resize(baseFDataSize);
+  for i:=0 to baseFDataSize-1 do
+    FData[i]:=TContainer.create;
+end;
+
+function THashmap.contains(key:TKey):boolean;inline;
+var i,h,bs:longint;
+begin
+  h:=Thash.hash(key,FData.size);
+  bs:=(FData[h]).size;
+  for i:=0 to bs-1 do begin
+    if (((FData[h])[i]).Key=key) then exit(true);
+  end;
+  exit(false);
+end;
+
+function THashmap.GetValue(key:TKey):TValue;inline;
+var i,h,bs:longint;
+begin
+  h:=Thash.hash(key,FData.size);
+  bs:=(FData[h]).size;
+  for i:=0 to bs-1 do begin
+    if (((FData[h])[i]).Key=key) then exit(((FData[h])[i]).Value);
+  end;
+end;
+
+procedure THashmap.insert(key:TKey;value:TValue);inline;
+var pair:TPair; i,h,bs:longint;
+begin
+  h:=Thash.hash(key,FData.size);
+  bs:=(FData[h]).size;
+  for i:=0 to bs-1 do begin
+    if (((FData[h])[i]).Key=key) then begin
+      ((FData[h]).mutable[i])^.value := value;
+      exit;
+    end;
+  end;
+  pair.Key := key;
+  pair.Value := value;
+  inc(FDataSize);
+  (FData[h]).pushback(pair);
+
+  if (FDataSize > 2*FData.size) then
+    EnlargeTable;
+end;
+
+procedure THashmap.delete(key:TKey);inline;
+var h,i:SizeUInt;
+begin
+  h:=Thash.hash(key,FData.size);
+  i:=0;
+  while i < (FData[h]).size do begin
+    if (((FData[h])[i]).key=key) then begin
+      (FData[h])[i] := (FData[h]).back;
+      (FData[h]).popback;
+      dec(FDataSize);
+      exit;
+    end;
+    inc(i);
+  end;
+end;
+
+function THashmapIterator.Next:boolean;
+begin
+  inc(Fp);
+  if (Fp = (FData[Fh]).size) then begin
+    Fp:=0; inc(Fh);
+    while Fh < FData.size do begin
+      if ((FData[Fh]).size > 0) then break;
+      inc(Fh);
+    end;
+    if (Fh = FData.size) then exit(false);
+  end;
+  Next := true;
+end;
+
+function THashmapIterator.GetValue:T;
+begin
+  GetValue:=(FData[Fh])[Fp];
+end;
+
+function THashmap.Iterator:TIterator;
+var h,p:SizeUInt;
+begin
+  h:=0;
+  p:=0;
+  while h < FData.size do begin
+    if ((FData[h]).size > 0) then break;
+    inc(h);
+  end;
+  if (h = FData.size) then exit(nil);
+  Iterator := TIterator.create;
+  Iterator.Fh := h;
+  Iterator.Fp := p;
+  Iterator.FData := FData;
+end;
+
+end.

+ 186 - 0
packages/fcl-stl/src/ghashset.pp

@@ -0,0 +1,186 @@
+{
+   This file is part of the Free Pascal FCL library.
+   BSD parts (c) 2011 Vlado Boza
+
+   See the file COPYING.FPC, included in this distribution,
+   for details about the copyright.
+
+   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.
+
+**********************************************************************}
+{$mode objfpc}
+
+unit ghashset;
+
+interface
+uses gvector, gutil, garrayutils;
+
+const baseFDataSize = 8;
+
+{Thash should have one class function hash(a:T, n:longint):longint which return uniformly distributed
+value in range <0,n-1> base only on arguments, n will be always power of 2}
+
+type
+    generic THashSetIterator<T, TTable>=class
+    public
+    var
+      Fh,Fp:SizeUInt;
+      FData:TTable;
+      function Next:boolean;
+      function GetValue:T;
+  end;
+
+  generic THashSet<T, Thash>=class
+    private 
+    type 
+      TContainer = specialize TVector<T>;
+      TTable = specialize TVector<TContainer>;
+    var 
+      FData:TTable;
+      FDataSize:SizeUInt; 
+      procedure EnlargeTable;
+    public 
+    type
+      TIterator = specialize THashSetIterator<T, TTable>;
+      constructor create;
+      destructor destroy;override;
+      procedure insert(value:T);inline;
+      function contains(value:T):boolean;inline;
+      function size:SizeUInt;inline;
+      procedure delete(value:T);inline;
+      function IsEmpty:boolean;inline;
+
+      function Iterator:TIterator;
+  end;
+
+implementation
+
+function THashSet.Size:SizeUInt;inline;
+begin
+  Size:=FDataSize;
+end;
+
+destructor THashSet.Destroy;
+var i:SizeUInt;
+begin
+  for i:=0 to FData.size do
+    (FData[i]).Destroy;
+  FData.Destroy;
+end;
+
+function THashSet.IsEmpty():boolean;inline;
+begin
+  if Size()=0 then 
+    IsEmpty:=true
+  else 
+    IsEmpty:=false;
+end;
+
+procedure THashSet.EnlargeTable;
+var i,j,h,oldDataSize:SizeUInt; 
+    value:T;
+begin
+  oldDataSize:=FData.size;
+  FData.resize(FData.size*2);
+  for i:=oldDataSize to FData.size-1 do
+    FData[i] := TContainer.create;
+  for i:=oldDataSize-1 downto 0 do begin
+    j := 0;
+    while j < (FData[i]).size do begin
+      value := (FData[i])[j];
+      h:=Thash.hash(value,FData.size);
+      if (h <> i) then begin
+        (FData[i])[j] := (FData[i]).back;
+        (FData[i]).popback;
+        (FData[h]).pushback(value);
+      end else
+        inc(j);
+    end;
+  end;
+end;
+
+constructor THashSet.create;
+var i:longint;
+begin
+  FDataSize:=0;
+  FData:=TTable.create;
+  FData.resize(baseFDataSize);
+  for i:=0 to baseFDataSize-1 do
+    FData[i]:=TContainer.create;
+end;
+
+function THashSet.contains(value:T):boolean;inline;
+var i,h,bs:longint;
+begin
+  h:=Thash.hash(value,FData.size);
+  bs:=(FData[h]).size;
+  for i:=0 to bs-1 do begin
+    if ((FData[h])[i]=value) then exit(true);
+  end;
+  exit(false);
+end;
+
+procedure THashSet.insert(value:T);inline;
+begin
+  if (contains(value)) then exit;
+  inc(FDataSize);
+  (FData[Thash.hash(value,FData.size)]).pushback(value);
+
+  if (FDataSize > 2*FData.size) then
+    EnlargeTable;
+end;
+
+procedure THashSet.delete(value:T);inline;
+var h,i:SizeUInt;
+begin
+  h:=Thash.hash(value,FData.size);
+  i:=0;
+  while i < (FData[h]).size do begin
+    if ((FData[h])[i]=value) then begin
+      (FData[h])[i] := (FData[h]).back;
+      (FData[h]).popback;
+      dec(FDataSize);
+      exit;
+    end;
+    inc(i);
+  end;
+end;
+
+function THashSetIterator.Next:boolean;
+begin
+  inc(Fp);
+  if (Fp = (FData[Fh]).size) then begin
+    Fp:=0; inc(Fh);
+    while Fh < FData.size do begin
+      if ((FData[Fh]).size > 0) then break;
+      inc(Fh);
+    end;
+    if (Fh = FData.size) then exit(false);
+  end;
+  Next := true;
+end;
+
+function THashSetIterator.GetValue:T;
+begin
+  GetValue:=(FData[Fh])[Fp];
+end;
+
+function THashSet.Iterator:TIterator;
+var h,p:SizeUInt;
+begin
+  h:=0;
+  p:=0;
+  while h < FData.size do begin
+    if ((FData[h]).size > 0) then break;
+    inc(h);
+  end;
+  if (h = FData.size) then exit(nil);
+  Iterator := TIterator.create;
+  Iterator.Fh := h;
+  Iterator.Fp := p;
+  Iterator.FData := FData;
+end;
+
+end.

+ 1 - 1
packages/fcl-stl/src/gmap.pp

@@ -27,8 +27,8 @@ type
   public
   type
     TPair=record
-      Key:TKey;
       Value:TValue;
+      Key:TKey;
     end;
     TMCompare = specialize TMapCompare<TPair, TCompare>;
     TMSet = specialize TSet<TPair, TMCompare>;

+ 116 - 0
packages/fcl-stl/tests/garrayutilstest.pp

@@ -0,0 +1,116 @@
+{$mode objfpc}
+
+unit garrayutilstest;
+
+interface
+
+uses fpcunit, testregistry, gvector, garrayutils, gutil;
+
+type vectorlli=specialize TVector<longint>;
+     lesslli=specialize TLess<longint>;
+     sortlli=specialize TOrderingArrayUtils<vectorlli, longint, lesslli>;
+
+type TGArrayUtilsTest = class(TTestCase)
+  Published
+    procedure SortRandomTest;
+    procedure SortZeroOneTest;
+    procedure NextPermutationTest1;
+    procedure NextPermutationTest2;
+    procedure NextPermutationTest3;
+    procedure NextPermutationTest4;
+  public
+    procedure Setup;override;
+  private 
+    data:vectorlli;
+  end;
+
+implementation
+
+procedure TGArrayUtilsTest.SortRandomTest;
+var i:longint;
+begin
+  for i:=0 to 5000 do
+    data.pushBack(random(10000));
+  sortlli.sort(data, 5001);
+  for i:=0 to 4999 do
+    AssertEquals('Wrong order', false, data[i+1]<data[i]);
+end;
+
+procedure TGArrayUtilsTest.SortZeroOneTest;
+var i:longint;
+begin
+  for i:=0 to 5000 do
+    data.pushBack(random(2));
+  sortlli.sort(data, 5001);
+  for i:=0 to 4999 do
+    AssertEquals('Wrong order', false, data[i+1]<data[i]);
+end;
+
+procedure TGArrayUtilsTest.NextPermutationTest1;
+begin
+  data.pushBack(1);
+  data.pushBack(2);
+  data.pushBack(3);
+  data.pushBack(4);
+  AssertEquals('Wrong ret', true, sortlli.NextPermutation(data, 4));
+  AssertEquals('Wrong perm 1', 1, data[0]);
+  AssertEquals('Wrong perm 2', 2, data[1]);
+  AssertEquals('Wrong perm 3', 4, data[2]);
+  AssertEquals('Wrong perm 4', 3, data[3]);
+end;
+
+procedure TGArrayUtilsTest.NextPermutationTest2;
+begin
+  data.pushBack(4);
+  data.pushBack(3);
+  data.pushBack(2);
+  data.pushBack(1);
+  AssertEquals('Wrong ret', false, sortlli.NextPermutation(data, 4));
+  AssertEquals('Wrong perm 1', 4, data[0]);
+  AssertEquals('Wrong perm 2', 3, data[1]);
+  AssertEquals('Wrong perm 3', 2, data[2]);
+  AssertEquals('Wrong perm 4', 1, data[3]);
+end;
+
+procedure TGArrayUtilsTest.NextPermutationTest3;
+begin
+  data.pushBack(5);
+  data.pushBack(10);
+  data.pushBack(9);
+  data.pushBack(8);
+  data.pushBack(7);
+  data.pushBack(3);
+  AssertEquals('Wrong ret', true, sortlli.NextPermutation(data, 6));
+  AssertEquals('Wrong perm 1', 7, data[0]);
+  AssertEquals('Wrong perm 2', 3, data[1]);
+  AssertEquals('Wrong perm 3', 5, data[2]);
+  AssertEquals('Wrong perm 4', 8, data[3]);
+  AssertEquals('Wrong perm 5', 9, data[4]);
+  AssertEquals('Wrong perm 6', 10, data[5]);
+end;
+
+procedure TGArrayUtilsTest.NextPermutationTest4;
+begin
+  data.pushBack(0);
+  data.pushBack(1);
+  data.pushBack(0);
+  data.pushBack(1);
+  data.pushBack(1);
+  data.pushBack(0);
+  AssertEquals('Wrong ret', true, sortlli.NextPermutation(data, 6));
+  AssertEquals('Wrong perm 1', 0, data[0]);
+  AssertEquals('Wrong perm 2', 1, data[1]);
+  AssertEquals('Wrong perm 3', 1, data[2]);
+  AssertEquals('Wrong perm 4', 0, data[3]);
+  AssertEquals('Wrong perm 5', 0, data[4]);
+  AssertEquals('Wrong perm 6', 1, data[5]);
+end;
+
+procedure TGArrayUtilsTest.Setup;
+begin
+  data:=vectorlli.create;
+end;
+
+initialization
+  RegisterTest(TGArrayUtilsTest);
+end.

+ 99 - 0
packages/fcl-stl/tests/ghashmaptest.pp

@@ -0,0 +1,99 @@
+{$mode objfpc}
+
+unit ghashmaptest;
+
+interface
+
+uses fpcunit, testregistry, ghashmap;
+
+type hint=class
+  class function hash(a,n:SizeUInt):SizeUInt;
+end;
+
+type THashmaplli=specialize THashMap<longint, longint, hint>;
+
+type TGHashmapTest = class(TTestCase)
+  Published
+    procedure HashmapTest1;
+    procedure HashmapTest2;
+    procedure HashmapTest3;
+  public
+    procedure Setup;override;
+  private 
+    data:THashmaplli;
+  end;
+
+implementation
+
+class function hint.hash(a,n:SizeUInt):SizeUInt;
+begin
+  hash:= (a xor (a shr 5) xor (a shl 7)) and (n-1);
+end;
+
+procedure TGHashmapTest.HashMapTest1;
+var i:longint;
+begin
+  AssertEquals('Not IsEmpty', true, data.IsEmpty);
+  data.insert(47, 42);
+  AssertEquals('47 not found', true, data.contains(47));
+  AssertEquals('39 found', false, data.contains(39));
+  data[39]:=33;
+  data[47]:=22;
+  AssertEquals('bad size', 2, data.size);
+  AssertEquals('bad 47', 22, data[47]);
+  for i:=0 to 10000 do
+    data[20*i+42] := 47+i;
+  for i:=0 to 10000 do
+    AssertEquals('bad number found', false, data.contains(i*5+101));
+  for i:=0 to 10000 do
+    AssertEquals('bad number', i+47, data[i*20+42]);
+  AssertEquals('IsEmpty', false, data.IsEmpty);
+end;
+
+procedure TGHashmapTest.HashMapTest2;
+var i:longint;
+begin
+  for i:=0 to 1000 do
+    data[3*i] := 7*i;
+  for i:=0 to 1000 do
+    data.delete(3*i+1);
+  AssertEquals('bad size before delete', 1001, data.size);
+  for i:=500 to 1000 do
+    data.delete(3*i);
+  AssertEquals('bad size after delete', 500, data.size);
+  for i:=0 to 499 do
+    AssertEquals('element not found', true, data.contains(3*i));
+  for i:=500 to 1000 do
+    AssertEquals('deleted element found', false, data.contains(3*i));
+end;
+
+procedure TGHashmapTest.HashMapTest3;
+var i:longint;
+    x:array[0..1000] of longint;
+    it:THashmaplli.TIterator;
+begin
+  it:=data.Iterator;
+  if it <> nil then
+    AssertEquals('it not null', 0, 1);
+  for i:=0 to 1000 do begin
+    data[i]:=47*i;
+    x[i]:=0;
+  end;
+  it:=data.Iterator;
+  repeat
+    inc(x[it.GetValue.key]);
+    AssertEquals('bad value', it.GetValue.key*47, it.GetValue.value);
+  until not it.next;
+  for i:=0 to 1000 do begin
+    AssertEquals('som not 1', 1, x[i]);
+  end;
+end;
+
+procedure TGHashmapTest.Setup;
+begin
+  data:=THashmaplli.create;
+end;
+
+initialization
+  RegisterTest(TGHashmapTest);
+end.

+ 97 - 0
packages/fcl-stl/tests/ghashsettest.pp

@@ -0,0 +1,97 @@
+{$mode objfpc}
+
+unit ghashsettest;
+
+interface
+
+uses fpcunit, testregistry, ghashset;
+
+type hint=class
+  class function hash(a,n:SizeUInt):SizeUInt;
+end;
+
+type THashsetlli=specialize THashSet<longint, hint>;
+
+type TGHashSetTest = class(TTestCase)
+  Published
+    procedure HashSetTest1;
+    procedure HashSetTest2;
+    procedure HashSetTest3;
+  public
+    procedure Setup;override;
+  private 
+    data:THashsetlli;
+  end;
+
+implementation
+
+class function hint.hash(a,n:SizeUInt):SizeUInt;
+begin
+  hash:= (a xor (a shr 5) xor (a shl 7)) and (n-1);
+end;
+
+procedure TGHashSetTest.HashSetTest1;
+var i:longint;
+begin
+  AssertEquals('Not IsEmpty', true, data.IsEmpty);
+  data.insert(47);
+  AssertEquals('47 not found', true, data.contains(47));
+  AssertEquals('39 found', false, data.contains(39));
+  data.insert(39);
+  data.insert(47);
+  AssertEquals('bad size', 2, data.size);
+  for i:=0 to 10000 do
+    data.insert(20*i+42);
+  for i:=0 to 10000 do
+    AssertEquals('bad number found', false, data.contains(i*5+101));
+  for i:=0 to 10000 do
+    AssertEquals('number not found', true, data.contains(i*20+42));
+  AssertEquals('IsEmpty', false, data.IsEmpty);
+end;
+
+procedure TGHashSetTest.HashSetTest2;
+var i:longint;
+begin
+  for i:=0 to 1000 do
+    data.insert(3*i);
+  for i:=0 to 1000 do
+    data.delete(3*i+1);
+  AssertEquals('bad size before delete', 1001, data.size);
+  for i:=500 to 1000 do
+    data.delete(3*i);
+  AssertEquals('bad size after delete', 500, data.size);
+  for i:=0 to 499 do
+    AssertEquals('element not found', true, data.contains(3*i));
+  for i:=500 to 1000 do
+    AssertEquals('deleted element found', false, data.contains(3*i));
+end;
+
+procedure TGHashSetTest.HashSetTest3;
+var i:longint;
+    x:array[0..1000] of longint;
+    it:THashSetlli.TIterator;
+begin
+  it:=data.Iterator;
+  if it <> nil then
+    AssertEquals('it not null', 0, 1);
+  for i:=0 to 1000 do begin
+    data.insert(i);
+    x[i]:=0;
+  end;
+  it:=data.Iterator;
+  repeat
+    inc(x[it.GetValue]);
+  until not it.next;
+  for i:=0 to 1000 do begin
+    AssertEquals('som not 1', 1, x[i]);
+  end;
+end;
+
+procedure TGHashSetTest.Setup;
+begin
+  data:=THashSetlli.create;
+end;
+
+initialization
+  RegisterTest(TGHashSetTest);
+end.

+ 6 - 6
packages/fcl-stl/tests/gpriorityqueuetest.pp

@@ -6,8 +6,8 @@ interface
 
 uses fpcunit, testregistry, gpriorityqueue, gutil;
 
-type lesslli=specialize TLess<longint>;
-     queuelli=specialize TPriorityQueue<longint,lesslli>;
+{type lesslli=specialize TLess<longint>;
+     queuelli=specialize TPriorityQueue<longint,lesslli>;}
 
 type TGPQueueTest = class(TTestCase)
   Published
@@ -15,7 +15,7 @@ type TGPQueueTest = class(TTestCase)
   public
     procedure Setup;override;
   private 
-    data:queuelli;
+   { data:queuelli;}
   end;
 
 implementation
@@ -23,7 +23,7 @@ implementation
 procedure TGPQueueTest.QueueTest;
 var i,last:longint;
 begin
-  AssertEquals('Not IsEmpty', true, data.IsEmpty);
+{  AssertEquals('Not IsEmpty', true, data.IsEmpty);
   for i:=0 to 10 do
     data.push(random(10000));
   last:=data.top;
@@ -34,12 +34,12 @@ begin
     last:=data.top;
     data.pop;
   end;
-  AssertEquals('Not IsEmpty', true, data.IsEmpty);
+  AssertEquals('Not IsEmpty', true, data.IsEmpty);}
 end;
 
 procedure TGPQueueTest.Setup;
 begin
-  data:=queuelli.create;
+{  data:=queuelli.create;}
 end;
 
 initialization

+ 0 - 52
packages/fcl-stl/tests/gsorttest.pp

@@ -1,52 +0,0 @@
-{$mode objfpc}
-
-unit gsorttest;
-
-interface
-
-uses fpcunit, testregistry, gvector, garrayutils, gutil;
-
-type vectorlli=specialize TVector<longint>;
-     lesslli=specialize TLess<longint>;
-     sortlli=specialize TOrderingArrayUtils<vectorlli, longint, lesslli>;
-
-type TGSortTest = class(TTestCase)
-  Published
-    procedure SortRandomTest;
-    procedure SortZeroOneTest;
-  public
-    procedure Setup;override;
-  private 
-    data:vectorlli;
-  end;
-
-implementation
-
-procedure TGSortTest.SortRandomTest;
-var i:longint;
-begin
-  for i:=0 to 5000 do
-    data.pushBack(random(10000));
-  sortlli.sort(data, 5001);
-  for i:=0 to 4999 do
-    AssertEquals('Wrong order', false, data[i+1]<data[i]);
-end;
-
-procedure TGSortTest.SortZeroOneTest;
-var i:longint;
-begin
-  for i:=0 to 5000 do
-    data.pushBack(random(2));
-  sortlli.sort(data, 5001);
-  for i:=0 to 4999 do
-    AssertEquals('Wrong order', false, data[i+1]<data[i]);
-end;
-
-procedure TGSortTest.Setup;
-begin
-  data:=vectorlli.create;
-end;
-
-initialization
-  RegisterTest(TGSortTest);
-end.

+ 2 - 2
packages/fcl-stl/tests/run-all-tests

@@ -1,4 +1,4 @@
 #!/bin/bash
-rm *.o *.ppu ../*.o ../*.ppu testrunner
-fpc -Fu.. -gttt testrunner.pp -Sa
+rm *.o *.ppu testrunner
+fpc -Fu../units/x86_64-linux -gttt testrunner.pp -Sa
 ./testrunner --all

+ 2 - 2
packages/fcl-stl/tests/suiteconfig.pp

@@ -19,8 +19,8 @@ unit suiteconfig;
 interface
 
 uses
-  gvectortest, gstacktest, gqueuetest, gdequetest, gsorttest,
-  gpriorityqueuetest, gsettest, gmaptest;
+  gvectortest, gstacktest, gqueuetest, gdequetest, garrayutilstest,
+  gsettest, gmaptest, ghashsettest, ghashmaptest;
 
 implementation
 

+ 7 - 6
packages/fcl-web/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/04/01]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/04/05]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
@@ -276,6 +276,7 @@ endif
 ifdef CPU_TARGET
 FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
 endif
+LOCALFPMAKE=.$(PATHSEP)fpmake$(EXEEXT)
 ifdef REQUIRE_UNITSDIR
 override UNITSDIR+=$(REQUIRE_UNITSDIR)
 endif
@@ -2138,14 +2139,14 @@ $(COMPILER_UNITTARGETDIR):
 fpmake: $(COMPILER_UNITTARGETDIR) fpmake.pp
 	$(FPC) fpmake.pp $(FPCOPT)
 all:	fpmake
-	./fpmake build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
+	$(LOCALFPMAKE) build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
 smart:	fpmake
-	./fpmake build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-XX -CX"
+	$(LOCALFPMAKE) build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-XX -CX"
 release:	fpmake
-	./fpmake build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-dRELEASE"
+	$(LOCALFPMAKE) build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-dRELEASE"
 debug:	fpmake
-	./fpmake build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-dDEBUG"
+	$(LOCALFPMAKE) build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-dDEBUG"
 clean:	
 	$(FPMAKE_BIN_CLEAN) clean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
 install:	fpmake
-	./fpmake install --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(PREFIX)
+	$(LOCALFPMAKE) install --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(INSTALL_PREFIX)

+ 6 - 5
packages/fcl-web/Makefile.fpc

@@ -26,6 +26,7 @@ endif
 ifdef CPU_TARGET
 FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
 endif
+LOCALFPMAKE=.$(PATHSEP)fpmake$(EXEEXT)
 
 [rules]
 $(COMPILER_UNITTARGETDIR):
@@ -33,15 +34,15 @@ $(COMPILER_UNITTARGETDIR):
 fpmake: $(COMPILER_UNITTARGETDIR) fpmake.pp
 	$(FPC) fpmake.pp $(FPCOPT)
 all:	fpmake
-	./fpmake build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
+	$(LOCALFPMAKE) build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
 smart:	fpmake
-	./fpmake build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-XX -CX"
+	$(LOCALFPMAKE) build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-XX -CX"
 release:	fpmake
-	./fpmake build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-dRELEASE"
+	$(LOCALFPMAKE) build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-dRELEASE"
 debug:	fpmake
-	./fpmake build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-dDEBUG"
+	$(LOCALFPMAKE) build --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) -o "-dDEBUG"
 clean:	
 	$(FPMAKE_BIN_CLEAN) clean --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC)
 install:	fpmake
-	./fpmake install --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(PREFIX)
+	$(LOCALFPMAKE) install --localunitdir=../.. --globalunitdir=.. $(FPC_TARGETOPT) $(addprefix -o ,$(FPCOPT)) --compiler=$(FPC) --prefix=$(INSTALL_PREFIX)
 

+ 20 - 0
packages/fcl-web/examples/combined/combined.html

@@ -0,0 +1,20 @@
+<html>
+<head>
+<title>ExtJS application demo</title>
+<link rel="stylesheet" type="text/css" href="/ext/resources/css/ext-all.css"/>
+<script src="/ext/adapter/ext/ext-base.js"></script>
+<script src="/ext/ext-all-debug.js"></script>
+<script src="combined.cgi/Login/API"></script>
+<script src="login.js"></script>
+<script>
+Ext.onReady(function() {  
+  // API is registered under FPWeb by default.
+  Ext.Direct.addProvider(FPWeb);
+  fpWeb.login=new fpWeb.LoginForm({});
+  fpWeb.login.show();
+});
+</script>
+</head>
+<body>
+</body>
+</html>

二進制
packages/fcl-web/examples/combined/combined.ico


+ 4 - 0
packages/fcl-web/examples/combined/combined.ini

@@ -0,0 +1,4 @@
+[Database]
+Path=/home/firebird/combined.fb
+UserName=WISASOFT
+Password=SysteemD

+ 116 - 0
packages/fcl-web/examples/combined/combined.lpi

@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<CONFIG>
+  <ProjectOptions>
+    <Version Value="9"/>
+    <General>
+      <Flags>
+        <SaveOnlyProjectUnits Value="True"/>
+        <MainUnitHasCreateFormStatements Value="False"/>
+        <Runnable Value="False"/>
+      </Flags>
+      <SessionStorage Value="InProjectDir"/>
+      <MainUnit Value="0"/>
+      <Title Value="Combined RPC/Webdata example"/>
+      <ResourceType Value="res"/>
+      <UseXPManifest Value="True"/>
+      <Icon Value="0"/>
+    </General>
+    <i18n>
+      <EnableI18N LFM="False"/>
+    </i18n>
+    <VersionInfo>
+      <StringTable ProductVersion=""/>
+    </VersionInfo>
+    <BuildModes Count="1">
+      <Item1 Name="Default" Default="True"/>
+    </BuildModes>
+    <PublishOptions>
+      <Version Value="2"/>
+      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+      <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
+    </PublishOptions>
+    <RunParams>
+      <local>
+        <FormatVersion Value="1"/>
+        <LaunchingApplication PathPlusParams="/usr/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+      </local>
+    </RunParams>
+    <RequiredPackages Count="5">
+      <Item1>
+        <PackageName Value="SQLDBLaz"/>
+        <MinVersion Major="1" Release="1" Valid="True"/>
+      </Item1>
+      <Item2>
+        <PackageName Value="lazwebextra"/>
+        <MinVersion Minor="9" Valid="True"/>
+      </Item2>
+      <Item3>
+        <PackageName Value="WebLaz"/>
+      </Item3>
+      <Item4>
+        <PackageName Value="LCL"/>
+      </Item4>
+      <Item5>
+        <PackageName Value="FCL"/>
+      </Item5>
+    </RequiredPackages>
+    <Units Count="5">
+      <Unit0>
+        <Filename Value="combined.lpr"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="combined"/>
+      </Unit0>
+      <Unit1>
+        <Filename Value="wmlogin.pp"/>
+        <IsPartOfProject Value="True"/>
+        <ComponentName Value="SessionManagement"/>
+        <ResourceBaseClass Value="DataModule"/>
+        <UnitName Value="wmlogin"/>
+      </Unit1>
+      <Unit2>
+        <Filename Value="wmusers.pp"/>
+        <IsPartOfProject Value="True"/>
+        <ComponentName Value="CombinedModule"/>
+        <HasResources Value="True"/>
+        <ResourceBaseClass Value="DataModule"/>
+        <UnitName Value="wmusers"/>
+      </Unit2>
+      <Unit3>
+        <Filename Value="login.js"/>
+        <IsPartOfProject Value="True"/>
+      </Unit3>
+      <Unit4>
+        <Filename Value="users.js"/>
+        <IsPartOfProject Value="True"/>
+      </Unit4>
+    </Units>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="10"/>
+    <Target>
+      <Filename Value="combined.cgi"/>
+    </Target>
+    <SearchPaths>
+      <IncludeFiles Value="$(ProjOutDir)"/>
+    </SearchPaths>
+    <Other>
+      <CompilerMessages>
+        <UseMsgFile Value="True"/>
+      </CompilerMessages>
+      <CompilerPath Value="$(CompPath)"/>
+    </Other>
+  </CompilerOptions>
+  <Debugging>
+    <Exceptions Count="3">
+      <Item1>
+        <Name Value="EAbort"/>
+      </Item1>
+      <Item2>
+        <Name Value="ECodetoolError"/>
+      </Item2>
+      <Item3>
+        <Name Value="EFOpenError"/>
+      </Item3>
+    </Exceptions>
+  </Debugging>
+</CONFIG>

+ 15 - 0
packages/fcl-web/examples/combined/combined.lpr

@@ -0,0 +1,15 @@
+program combined;
+
+{$mode objfpc}{$H+}
+
+uses
+  fpCGI, wmusers, httpdefs, websession,wmlogin;
+
+{$R *.res}
+
+begin
+  Application.Title:='Combined RPC/Webdata example';
+  Application.Initialize;
+  Application.Run;
+end.
+

二進制
packages/fcl-web/examples/combined/combined.res


+ 11 - 0
packages/fcl-web/examples/combined/combined.sql

@@ -0,0 +1,11 @@
+CREATE TABLE USERS (
+  U_ID BIGINT NOT NULL,
+  U_LOGIN VARCHAR(40) NOT NULL,
+  U_NAME VARCHAR(30) NOT NULL,
+  U_EMAIL VARCHAR(100),
+  U_PASSWORD VARCHAR(100) NOT NULL,
+  CONSTRAINT PK_FPCUSERS PRIMARY KEY (U_ID),
+  CONSTRAINT U_USERNAME UNIQUE (U_LOGIN)
+);
+
+  

+ 105 - 0
packages/fcl-web/examples/combined/login.js

@@ -0,0 +1,105 @@
+Ext.ns("fpWeb");
+fpWeb.LoginForm = Ext.extend (Ext.Window, {
+  /* Control references */ 
+  blogin : null,
+  eusername : null,
+  epassword : null,
+  plock : null,
+  fform : null,
+  /* Callbacks */
+  OnLogin : function (Provider,Response) {
+    if (!Ext.isEmpty(Response.error)) {
+      Ext.Msg.show({
+        title : 'Login failed',
+        msg : 'An error occurred during login: '+Response.error.message+'. Please try again.',
+        icon : Ext.Msg.ERROR,
+        buttons : Ext.Msg.OK
+      });
+    } else if (Response.result > 0) {
+      // here code to switch to data editing
+       window.location='users.html';
+/*
+       Ext.Msg.show({
+        title : 'Login OK',
+        msg : 'Your username/pasword was accepted. We will now proceed to the editing form',
+        icon : Ext.Msg.ERROR,
+        buttons : Ext.Msg.OK
+    });
+*/
+    } else {
+       Ext.Msg.show({
+        title : 'Login failed',
+        msg : 'Your username/pasword is incorrect. Please try again.',
+        icon : Ext.Msg.ERROR,
+        buttons : Ext.Msg.OK
+    });
+    }
+  },
+  loginbuttonclick : function (sender) {
+    SessionManagement.Login(this.eusername.getValue(), this.epassword.getValue(),this.OnLogin.createDelegate(this));
+  },
+  focususer : function () {
+    this.eusername.focus();
+  },
+  /* Build the actual form */
+  constructor : function (config) {
+    this.eusername = new Ext.form.TextField({
+      name:"user",
+      fieldLabel:"Login",
+      inputType:"text"
+    });
+    this.epassword = new Ext.form.TextField({
+      name:"pass",
+      fieldLabel:"Password",
+      inputType:"password"
+    });
+    this.blogin = new Ext.Button({
+       text:"Login",
+       handler : this.loginbuttonclick,
+       scope : this
+    });
+    this.fform = new Ext.form.FormPanel({
+      width: 350,
+      labelWidth:150,
+      border:false,
+      xtype: "form",
+      buttonAlign: "right",
+      bodyStyle: "padding: 10px 15px",
+      defaultType: "textfield",
+      defaults: {width: 150},
+      items: [this.eusername,this.epassword],
+      buttons:[this.blogin],
+      keys: {key: Ext.EventObject.ENTER,  
+             handler: function(){  
+               this.blogin.focus(); 
+             }, 
+             scope: this
+      }
+    });
+    this.plock = new Ext.Panel({ 
+      border:false,
+      html:"<img src='login.png' width=114 height=128/>",
+      width:114,
+      height:128
+    });
+    Ext.apply(config, {
+      title: "Login",
+      width: 500,
+      height: 200,
+      plain: true,
+      layout: "hbox",
+      defaultButton: this.eusername,
+      layoutConfig: {
+        align : "middle",
+        pack: "center"
+      },
+      closable: false,
+      listeners: {
+        'show' : { fn: this.focususer.createDelegate(this) }
+      },
+      items: [ this.fform, this.plock ]  
+    });
+    fpWeb.LoginForm.superclass.constructor.call(this,config);
+  } /* constructor*/
+});
+

二進制
packages/fcl-web/examples/combined/login.png


+ 18 - 0
packages/fcl-web/examples/combined/users.html

@@ -0,0 +1,18 @@
+<html>
+<head>
+<title>Edit users in database</title>
+<link rel="stylesheet" type="text/css" href="/ext/resources/css/ext-all.css"/>
+<script src="/ext/adapter/ext/ext-base.js"></script>
+<script src="/ext/ext-all-debug.js"></script>
+<script src="combined.cgi/Login/API"></script>
+<script src="users.js"></script>
+<script>
+Ext.onReady(function() {  
+  // API is registered under FPWeb by default.
+  Ext.Direct.addProvider(FPWeb);
+});
+</script>
+</head>
+<body>
+</body>
+</html>

+ 108 - 0
packages/fcl-web/examples/combined/users.js

@@ -0,0 +1,108 @@
+Ext.ns('fpWeb');
+
+fpWeb.ShowPage = function () {
+  var myproxy = new Ext.data.HttpProxy ( {
+    api : {
+      read: "combined.cgi/Provider/Users/Read/",
+      update: "combined.cgi/Provider/Users/Update/",
+      create: "combined.cgi/Provider/Users/Insert/",
+      destroy: "combined.cgi/Provider/Users/Delete/"
+    }
+  });
+  var myreader = new Ext.data.JsonReader ({
+      root: "rows",
+      successProperty : 'success',
+      idProperty: "U_ID",
+      messageProperty: 'message', // Must be specified here
+      fields: ["U_ID","U_LOGIN","U_NAME","U_EMAIL", "U_PASSWORD"]
+  });
+  var mywriter = new Ext.data.JsonWriter({
+      encode: true,
+      writeAllFields: true,
+      idProperty: "U_ID"
+  }); 
+  var data = new Ext.data.Store({
+    proxy: myproxy,
+    reader: myreader,
+    writer: mywriter,
+    autoSave: false,
+    idProperty: "U_ID",
+  });
+  // Listen to errors.
+  data.addListener('exception', function(proxy, type, action, options, res) {
+    if (type === 'remote') {
+        Ext.Msg.show({
+            title: 'REMOTE EXCEPTION',
+            msg: res.message, 
+            icon: Ext.MessageBox.ERROR,
+            buttons: Ext.Msg.OK
+        });
+    }
+  });
+  data.load({ params:{start: 0, limit: 30}});
+  var grid = new Ext.grid.EditorGridPanel({
+    renderTo: Ext.getBody(),
+    frame: true,
+    title: "Known users",
+    height: 600,
+    width: 800,
+    store: data,
+    columns: [
+      {header: 'ID', dataIndex: "U_ID", sortable: true, hidden: true},
+      {header: 'Login', dataIndex: "U_LOGIN", sortable: true, editor: new Ext.form.TextField({allowBlank: false})},
+      {header: 'Name', dataIndex: "U_NAME", sortable: true, editor: new Ext.form.TextField({allowBlank: false}), width : 200},
+      {header: 'Email', dataIndex: "U_EMAIL", sortable: true, editor: new Ext.form.TextField({allowBlank: false}), width : 200},
+      {header: 'Password', dataIndex: "U_PASSWORD", sortable: true, editor: new Ext.form.TextField()},
+    ],
+    bbar: new Ext.PagingToolbar({
+      pageSize: 30,
+      store: data,
+      displayInfo: true
+    }),
+    tbar : [{
+            text: 'Add',
+            iconCls: 'icon-add',
+            handler: function(btn, ev) {
+              var u = new grid.store.recordType();
+              grid.stopEditing();
+              grid.store.insert(0, u);
+              grid.startEditing(0, 1);
+            },
+            scope: grid
+        }, '-', {
+            text: 'Delete',
+            iconCls: 'icon-delete',
+            handler: function(btn, ev) {
+	      var index = grid.getSelectionModel().getSelectedCell();
+	      if (!index) {
+		  return false;
+	      }
+	      var rec = grid.store.getAt(index[0]);
+	      grid.store.remove(rec);
+	      },
+            scope: grid
+        }, '-', {
+            text: 'Save',
+            iconCls: 'icon-save',
+            handler: function(btn, ev) {
+	      grid.store.save();
+	    },
+            scope: grid
+        },'->', {
+          text: 'Log out',
+          iconCls: 'logout',
+          handler: function () {
+            SessionManagement.Logout(function (provider,response) {
+              if (response.result=='Bye') {
+                window.location='combined.html';
+              }
+            });
+          }
+        }
+	]
+ //          F.ContentToStream(M);
+
+  });
+  grid.show();
+}
+Ext.onReady(fpWeb.ShowPage);

+ 15 - 0
packages/fcl-web/examples/combined/users.sql

@@ -0,0 +1,15 @@
+CREATE TABLE USERS (
+U_ID BIGINT Not Null ,
+U_LOGIN VARCHAR(40) Not Null,
+U_NAME VARCHAR(30) Not Null,
+U_EMAIL VARCHAR(100),
+U_PASSWORD VARCHAR(100) Not Null,
+CONSTRAINT PK_FPCUSERS Primary key (U_ID),
+CONSTRAINT U_USERNAME Unique key (U_LOGIN)
+);
+
+COMMIT;
+
+CREATE GENERATOR GEN_USERS;
+
+COMMIT;

+ 76 - 0
packages/fcl-web/examples/combined/wmlogin.lfm

@@ -0,0 +1,76 @@
+object SessionManagement: TSessionManagement
+  OnCreate = DataModuleCreate
+  OldCreateOrder = False
+  DispatchOptions = [jdoSearchRegistry, jdoSearchOwner, jdoJSONRPC1, jdoJSONRPC2, jdoNotifications]
+  APIPath = 'API'
+  RouterPath = 'router'
+  Height = 200
+  HorizontalOffset = 582
+  VerticalOffset = 455
+  Width = 295
+  object Login: TJSONRPCHandler
+    OnExecute = LoginExecute
+    Options = []
+    ParamDefs = <    
+      item
+        Name = 'UserName'
+      end    
+      item
+        Name = 'Password'
+      end>
+    left = 24
+    top = 24
+  end
+  object IBConnection1: TIBConnection
+    Connected = False
+    LoginPrompt = False
+    KeepConnection = False
+    Transaction = SQLTransaction1
+    LogEvents = []
+    left = 24
+    top = 117
+  end
+  object SQLTransaction1: TSQLTransaction
+    Active = False
+    Action = caNone
+    Database = IBConnection1
+    left = 26
+    top = 72
+  end
+  object QAuthenticate: TSQLQuery
+    AutoCalcFields = False
+    Database = IBConnection1
+    Transaction = SQLTransaction1
+    ReadOnly = False
+    SQL.Strings = (
+      'SELECT'
+      '  U_ID, U_NAME'
+      'From'
+      '  USERS'
+      'WHERE'
+      ' (U_LOGIN = :LOGIN)'
+      '  AND (U_PASSWORD=:PASSWORD);'
+      ''
+    )
+    Params = <    
+      item
+        DataType = ftUnknown
+        Name = 'LOGIN'
+        ParamType = ptUnknown
+      end    
+      item
+        DataType = ftUnknown
+        Name = 'PASSWORD'
+        ParamType = ptUnknown
+      end>
+    left = 128
+    top = 117
+  end
+  object Logout: TJSONRPCHandler
+    OnExecute = LogoutExecute
+    Options = []
+    ParamDefs = <>
+    left = 120
+    top = 16
+  end
+end

+ 129 - 0
packages/fcl-web/examples/combined/wmlogin.pp

@@ -0,0 +1,129 @@
+unit wmlogin;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, FileUtil, HTTPDefs, websession, fpHTTP, fpWeb, fpjsonrpc, 
+  fpjson, IBConnection, sqldb, webjsonrpc, fpextdirect, sqldbwebdata;
+
+type
+
+  { TSessionManagement }
+
+  TSessionManagement = class(TExtDirectModule)
+    IBConnection1: TIBConnection;
+    Logout: TJSONRPCHandler;
+    Login: TJSONRPCHandler;
+    SessionManagement: TJSONRPCHandler;
+    QAuthenticate: TSQLQuery;
+    SQLTransaction1: TSQLTransaction;
+    procedure DataModuleCreate(Sender: TObject);
+    procedure LoginExecute(Sender: TObject; const Params: TJSONData;
+      out Res: TJSONData);
+    procedure LogoutExecute(Sender: TObject; const Params: TJSONData;
+      out Res: TJSONData);
+  private
+    function AuthenticateUser(AUsername, APassword: String): Integer;
+    procedure DoOnNewSession(Sender: TObject);
+    { private declarations }
+  public
+    { public declarations }
+  end; 
+
+var
+  SessionManagement: TSessionManagement;
+
+implementation
+
+uses inifiles;
+
+{$R *.lfm}
+
+{ TSessionManagement }
+
+function TSessionManagement.AuthenticateUser(AUsername,APassword : String) : Integer;
+
+begin
+  With QAuthenticate do
+    begin
+    ParamByName('Login').AsString:=AUserName;
+    ParamByName('Password').AsString:=APassword;
+    Open;
+    try
+      if (EOF and BOF) then
+        Result:=-1
+      else
+        begin
+        Result:=FieldByName('U_ID').AsInteger;
+        Session.Variables['UserName']:=FieldByName('U_NAME').AsString;
+        end;
+      Session.Variables['UserID']:=IntToStr(Result);
+    finally
+      Close;
+    end;
+    end;
+end;
+
+procedure TSessionManagement.LoginExecute(Sender: TObject;
+  const Params: TJSONData; out Res: TJSONData);
+
+Var
+  A : TJSONArray ;
+  AUserName,APassword : String;
+begin
+  A:=Params as TJSONArray;
+  AUserName:=A.Strings[0];
+  APassword:=A.Strings[1];
+  Res:=TJSONIntegerNumber.Create(AuthenticateUser(AUsername,APassword));
+end;
+
+procedure TSessionManagement.LogoutExecute(Sender: TObject;
+  const Params: TJSONData; out Res: TJSONData);
+begin
+  // To be sure
+  Session.Variables['UserID']:='-1';
+  Session.Terminate;
+  // A result must always be sent back.
+  Res:=TJSONString.Create('Bye');
+end;
+
+procedure TSessionManagement.DoOnNewSession(Sender : TObject);
+
+begin
+  // The cookies must all originate from the same path, otherwise the 2 datamodules will use a different session.
+  (Sender as TFPWebSession).SessionCookiePath:='/';
+end;
+
+procedure TSessionManagement.DataModuleCreate(Sender: TObject);
+Var
+  FN : String;
+  Ini : TMemIniFile;
+
+begin
+  // The following 2 statements are needed because the 2 properties are (currently) not published.
+  OnNewSession:=@DoOnNewSession;
+  CreateSession:=True;
+  FN:=ChangeFileExt(Paramstr(0),'.ini');
+  If FileExists(FN) then
+    begin
+    Ini:=TMemIniFile.Create(FN);
+    try
+      With IBConnection1 do
+        begin
+        DatabaseName:=Ini.ReadString('Database','Path',DatabaseName);
+        UserName:=Ini.ReadString('Database','UserName',UserName);
+        Password:=Ini.ReadString('Database','Password',Password);
+        end;
+    finally
+      Ini.Free;
+    end;
+    end;
+  IBConnection1.Connected:=True;
+end;
+
+initialization
+  RegisterHTTPModule('Login', TSessionManagement);
+end.
+

+ 94 - 0
packages/fcl-web/examples/combined/wmusers.lfm

@@ -0,0 +1,94 @@
+object CombinedModule: TCombinedModule
+  OnCreate = DataModuleCreate
+  OldCreateOrder = False
+  InputAdaptor = ProviderInputAdaptor
+  ContentProducer = ProviderFormatter
+  OnGetContentProducer = DataModuleGetContentProducer
+  OnGetInputAdaptor = DataModuleGetInputAdaptor
+  OnNewSession = DataModuleNewSession
+  Height = 300
+  HorizontalOffset = 635
+  VerticalOffset = 230
+  Width = 400
+  object ProviderFormatter: TExtJSJSONDataFormatter
+    AllowPageSize = False
+    BeforeDataToJSON = ProviderFormatterBeforeDataToJSON
+    BeforeUpdate = ProviderFormatterBeforeUpdate
+    BeforeInsert = ProviderFormatterBeforeInsert
+    BeforeDelete = ProviderFormatterBeforeDelete
+    left = 272
+    top = 72
+  end
+  object Users: TSQLDBWebDataProvider
+    SelectSQL.Strings = (
+      'SELECT FIRST :limit SKIP :start U_ID, U_NAME, U_LOGIN, U_PASSWORD, U_EMAIL FROM USERS'
+    )
+    UpdateSQL.Strings = (
+      'UPDATE USERS SET'
+      '  U_NAME=:U_NAME,'
+      '  U_LOGIN=:U_LOGIN,'
+      '  U_EMAIL=:U_EMAIL,'
+      '  U_PASSWORD=:U_PASSWORD'
+      'WHERE'
+      '  (U_ID=:U_ID)'
+    )
+    DeleteSQL.Strings = (
+      'DELETE FROM USERS WHERE (U_ID=:ID)'
+    )
+    InsertSQL.Strings = (
+      'INSERT INTO USERS'
+      '(U_ID, U_LOGIN, U_NAME, U_EMAIL, U_PASSWORD)'
+      'VALUES'
+      '(:U_ID, :U_LOGIN, :U_NAME, :U_EMAIL, :U_PASSWORD)'
+    )
+    Connection = IBConnection1
+    IDFieldName = 'U_ID'
+    OnGetNewID = UsersGetNewID
+    Options = []
+    Params = <    
+      item
+        DataType = ftUnknown
+        Name = 'limit'
+        ParamType = ptUnknown
+      end    
+      item
+        DataType = ftUnknown
+        Name = 'start'
+        ParamType = ptUnknown
+      end>
+    left = 32
+    top = 72
+  end
+  object IBConnection1: TIBConnection
+    Connected = False
+    LoginPrompt = False
+    KeepConnection = False
+    Transaction = SQLTransaction1
+    LogEvents = []
+    left = 32
+    top = 16
+  end
+  object QGetID: TSQLQuery
+    AutoCalcFields = False
+    Database = IBConnection1
+    Transaction = SQLTransaction1
+    ReadOnly = False
+    SQL.Strings = (
+      'SELECT GEN_ID(GEN_USERS,1) AS THEID  FROM RDB$DATABASE'
+    )
+    Params = <>
+    left = 32
+    top = 128
+  end
+  object SQLTransaction1: TSQLTransaction
+    Active = False
+    Action = caNone
+    Database = IBConnection1
+    left = 144
+    top = 16
+  end
+  object ProviderInputAdaptor: TExtJSJSonWebdataInputAdaptor
+    left = 272
+    top = 16
+  end
+end

+ 35 - 0
packages/fcl-web/examples/combined/wmusers.lrs

@@ -0,0 +1,35 @@
+{ This is an automatically generated lazarus resource file }
+
+LazarusResources.Add('TCombinedModule','FORMDATA',[
+  'TPF0'#15'TCombinedModule'#14'CombinedModule'#8'OnCreate'#7#16'DataModuleCrea'
+  +'te'#14'OldCreateOrder'#8#12'InputAdaptor'#7#20'ProviderInputAdaptor'#15'Con'
+  +'tentProducer'#7#17'ProviderFormatter'#20'OnGetContentProducer'#7#28'DataMod'
+  +'uleGetContentProducer'#17'OnGetInputAdaptor'#7#25'DataModuleGetInputAdaptor'
+  +#12'OnNewSession'#7#20'DataModuleNewSession'#6'Height'#3','#1#16'HorizontalO'
+  +'ffset'#3'{'#2#14'VerticalOffset'#3#230#0#5'Width'#3#144#1#0#23'TExtJSJSONDa'
+  +'taFormatter'#17'ProviderFormatter'#13'AllowPageSize'#8#16'BeforeDataToJSON'
+  +#7'!ProviderFormatterBeforeDataToJSON'#12'BeforeUpdate'#7#29'ProviderFormatt'
+  +'erBeforeUpdate'#12'BeforeInsert'#7#29'ProviderFormatterBeforeInsert'#12'Bef'
+  +'oreDelete'#7#29'ProviderFormatterBeforeDelete'#4'left'#3#16#1#3'top'#2'H'#0
+  +#0#21'TSQLDBWebDataProvider'#5'Users'#17'SelectSQL.Strings'#1#6'USELECT FIRS'
+  +'T :limit SKIP :start U_ID, U_NAME, U_LOGIN, U_PASSWORD, U_EMAIL FROM USERS'
+  +#0#17'UpdateSQL.Strings'#1#6#16'UPDATE USERS SET'#6#17'  U_NAME=:U_NAME,'#6
+  +#19'  U_LOGIN=:U_LOGIN,'#6#19'  U_EMAIL=:U_EMAIL,'#6#24'  U_PASSWORD=:U_PASS'
+  +'WORD'#6#5'WHERE'#6#14'  (U_ID=:U_ID)'#0#17'DeleteSQL.Strings'#1#6'"DELETE F'
+  +'ROM USERS WHERE (U_ID=:ID)'#0#17'InsertSQL.Strings'#1#6#17'INSERT INTO USER'
+  +'S'#6',(U_ID, U_LOGIN, U_NAME, U_EMAIL, U_PASSWORD)'#6#6'VALUES'#6'1(:U_ID, '
+  +':U_LOGIN, :U_NAME, :U_EMAIL, :U_PASSWORD)'#0#10'Connection'#7#13'IBConnecti'
+  +'on1'#11'IDFieldName'#6#4'U_ID'#10'OnGetNewID'#7#13'UsersGetNewID'#7'Options'
+  +#11#0#6'Params'#14#1#8'DataType'#7#9'ftUnknown'#4'Name'#6#5'limit'#9'ParamTy'
+  +'pe'#7#9'ptUnknown'#0#1#8'DataType'#7#9'ftUnknown'#4'Name'#6#5'start'#9'Para'
+  +'mType'#7#9'ptUnknown'#0#0#4'left'#2' '#3'top'#2'H'#0#0#13'TIBConnection'#13
+  +'IBConnection1'#9'Connected'#8#11'LoginPrompt'#8#14'KeepConnection'#8#11'Tra'
+  +'nsaction'#7#15'SQLTransaction1'#9'LogEvents'#11#0#4'left'#2' '#3'top'#2#16#0
+  +#0#9'TSQLQuery'#6'QGetID'#14'AutoCalcFields'#8#8'Database'#7#13'IBConnection'
+  +'1'#11'Transaction'#7#15'SQLTransaction1'#8'ReadOnly'#8#11'SQL.Strings'#1#6
+  +'6SELECT GEN_ID(GEN_USERS,1) AS THEID  FROM RDB$DATABASE'#0#6'Params'#14#0#4
+  +'left'#2' '#3'top'#3#128#0#0#0#15'TSQLTransaction'#15'SQLTransaction1'#6'Act'
+  +'ive'#8#6'Action'#7#6'caNone'#8'Database'#7#13'IBConnection1'#4'left'#3#144#0
+  +#3'top'#2#16#0#0#29'TExtJSJSonWebdataInputAdaptor'#20'ProviderInputAdaptor'#4
+  +'left'#3#16#1#3'top'#2#16#0#0#0
+]);

+ 145 - 0
packages/fcl-web/examples/combined/wmusers.pp

@@ -0,0 +1,145 @@
+unit wmusers;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, FileUtil, LResources, HTTPDefs, websession, fpHTTP, fpWeb,
+  IBConnection, sqldb, fpwebdata, fpjson, extjsjson, extjsxml, sqldbwebdata;
+
+type
+
+  { TCombinedModule }
+
+  TCombinedModule = class(TFPWebProviderDataModule)
+    ProviderFormatter: TExtJSJSONDataFormatter;
+    ProviderInputAdaptor: TExtJSJSonWebdataInputAdaptor;
+    IBConnection1: TIBConnection;
+    Users: TSQLDBWebDataProvider;
+    QGetID: TSQLQuery;
+    SQLTransaction1: TSQLTransaction;
+    procedure DataModuleNewSession(Sender: TObject);
+    procedure ProviderFormatterBeforeDataToJSON(Sender: TObject;
+      AObject: TJSONObject);
+    procedure ProviderFormatterBeforeDelete(Sender: TObject);
+    procedure ProviderFormatterBeforeInsert(Sender: TObject);
+    procedure ProviderFormatterBeforeUpdate(Sender: TObject);
+    procedure UsersGetNewID(Sender: TObject; out AID: String);
+    procedure DataModuleCreate(Sender: TObject);
+    procedure DataModuleGetContentProducer(Sender: TObject;
+      var AContentProducer: TCustomHTTPDataContentProducer);
+    procedure DataModuleGetInputAdaptor(Sender: TObject;
+      var AInputAdaptor: TCustomWebdataInputAdaptor);
+  private
+    procedure CheckLoggedIn;
+    { private declarations }
+  public
+    { public declarations }
+  end; 
+
+var
+  CombinedModule: TCombinedModule;
+
+implementation
+
+uses inifiles;
+
+{ TCombinedModule }
+
+procedure TCombinedModule.DataModuleGetContentProducer(
+  Sender: TObject; var AContentProducer: TCustomHTTPDataContentProducer);
+begin
+end;
+
+procedure TCombinedModule.DataModuleCreate(Sender: TObject);
+
+Var
+  FN : String;
+  Ini : TMemIniFile;
+
+begin
+  // Not yet published.
+  CreateSession:=True;
+  FN:=ChangeFileExt(Paramstr(0),'.ini');
+  If FileExists(FN) then
+    begin
+    Ini:=TMemIniFile.Create(FN);
+    try
+      With IBConnection1 do
+        begin
+        DatabaseName:=Ini.ReadString('Database','Path',DatabaseName);
+        UserName:=Ini.ReadString('Database','UserName',UserName);
+        Password:=Ini.ReadString('Database','Password',Password);
+        end;
+    finally
+      Ini.Free;
+    end;
+    end;
+  IBConnection1.Connected:=True;
+end;
+
+procedure TCombinedModule.UsersGetNewID(Sender: TObject; out
+  AID: String);
+begin
+  With QGetID Do
+    begin
+    Close;
+    Open;
+    try
+      if (EOF and BOF) then
+        Raise Exception.Create('No ID generated');
+      AID:=Fields[0].AsString;
+    finally
+      Close;
+    end;
+    end;
+end;
+
+procedure TCombinedModule.CheckLoggedIn;
+
+begin
+  If StrToIntDef(Session.Variables['UserID'],-1)=-1 then
+    Raise Exception.Create('You must be logged in to see or modify data');
+end;
+procedure TCombinedModule.ProviderFormatterBeforeDataToJSON(
+  Sender: TObject; AObject: TJSONObject);
+begin
+  CheckLoggedIn;
+end;
+
+procedure TCombinedModule.DataModuleNewSession(Sender: TObject);
+begin
+  // The cookies must all originate from the same path, otherwise the 2 datamodules will use a different session.
+  (Sender as TFPWebSession).SessionCookiePath:='/';
+end;
+
+procedure TCombinedModule.ProviderFormatterBeforeDelete(
+  Sender: TObject);
+begin
+  CheckLoggedIn;
+end;
+
+procedure TCombinedModule.ProviderFormatterBeforeInsert(
+  Sender: TObject);
+begin
+  CheckLoggedIn;
+end;
+
+procedure TCombinedModule.ProviderFormatterBeforeUpdate(
+  Sender: TObject);
+begin
+  CheckLoggedIn;
+end;
+
+procedure TCombinedModule.DataModuleGetInputAdaptor(Sender: TObject;
+  var AInputAdaptor: TCustomWebdataInputAdaptor);
+begin
+end;
+
+initialization
+  {$I wmusers.lrs}
+
+  RegisterHTTPModule('Provider', TCombinedModule);
+end.
+

+ 2 - 0
packages/fcl-web/fpmake.pp

@@ -25,6 +25,8 @@ begin
     P.Dependencies.Add('fcl-process');
     P.Dependencies.Add('fastcgi');
     P.Dependencies.Add('httpd22');
+    // (Temporary) indirect dependencies, not detected by fpcmake:
+    P.Dependencies.Add('univint',[MacOSX]);
 
     P.Author := 'FreePascal development team';
     P.License := 'LGPL with modification, ';

+ 1 - 1
packages/fcl-web/src/base/fphtml.pp

@@ -812,7 +812,7 @@ begin
       exit;
       end;
     end
-  else //if (owner is TDataModule) then
+  else if assigned(Owner) then //if (owner is TDataModule) then
     begin
     for i := 0 to owner.ComponentCount-1 do if owner.Components[i] is TWebController then
       begin

+ 1 - 0
packages/fcl-web/src/jsonrpc/fpextdirect.pp

@@ -130,6 +130,7 @@ Type
     Property DispatchOptions;
     Property APIPath;
     Property RouterPath;
+    Property CreateSession;
     Property NameSpace;
   end;
 

+ 5 - 1
packages/fcl-web/src/jsonrpc/fpjsonrpc.pp

@@ -357,6 +357,10 @@ resourcestring
 
 implementation
 
+{$IFDEF WMDEBUG}
+uses dbugintf;
+{$ENDIF}
+
 function CreateJSONErrorObject(Const AMessage : String; Const ACode : Integer) : TJSONObject;
 
 begin
@@ -1014,7 +1018,7 @@ Var
 
 begin
   Result:=Nil;
-  {$ifdef wmdebug}SendDebug(Format('Creating instance for %s',[Self.ProviderName]));{$endif}
+  {$ifdef wmdebug}SendDebug(Format('Creating instance for %s',[Self.HandlerMethodName]));{$endif}
   If Assigned(FDataModuleClass) then
     begin
     {$ifdef wmdebug}SendDebug(Format('Creating datamodule from class %d ',[Ord(Assigned(FDataModuleClass))]));{$endif}

Some files were not shown because too many files changed in this diff