Browse Source

+ exclude/include with constant second parameter added

florian 27 years ago
parent
commit
c5932b0677
5 changed files with 123 additions and 12 deletions
  1. 41 1
      compiler/cgi386.pas
  2. 6 1
      compiler/innr.inc
  3. 51 8
      compiler/pass_1.pas
  4. 19 1
      compiler/pexpr.pas
  5. 6 1
      compiler/pmodules.pas

+ 41 - 1
compiler/cgi386.pas

@@ -3748,6 +3748,7 @@ implementation
 
       var
          r : preference;
+         l : longint;
 
       begin
          case p^.inlinenumber of
@@ -3979,6 +3980,42 @@ implementation
                  handle_str;
                  maybe_loadesi;
               end;
+            in_include_x_y,
+            in_exclude_x_y:
+              begin
+                 secondpass(p^.left^.left);
+                 if p^.left^.right^.left^.treetype=ordconstn then
+                   begin
+                      { calculate bit position }
+                      l:=1 shl (p^.left^.right^.left^.value mod 32);
+
+                      { determine operator }
+                      if p^.inlinenumber=in_include_x_y then
+                        asmop:=A_OR
+                      else
+                        begin
+                           asmop:=A_AND;
+                           l:=not(l);
+                        end;
+                      if (p^.left^.left^.location.loc=LOC_REFERENCE) then
+                        begin
+                           inc(p^.left^.left^.location.reference.offset,(p^.left^.right^.left^.value div 32)*4);
+                           exprasmlist^.concat(new(pai386,op_const_ref(asmop,S_L,
+                             l,newreference(p^.left^.left^.location.reference))));
+                           del_reference(p^.left^.left^.location.reference);
+                        end
+                      else
+                        exprasmlist^.concat(new(pai386,op_const_reg(asmop,S_L,
+                          l,p^.left^.left^.location.register)));
+                   end
+                 else
+                   if psetdef(p^.left^.resulttype)^.settype=smallset then
+                     begin
+                     end
+                   else
+                     begin
+                     end;
+              end;
             else internalerror(9);
          end;
       end;
@@ -5807,7 +5844,10 @@ do_jmp:
 end.
 {
   $Log$
-  Revision 1.12  1998-04-13 21:15:41  florian
+  Revision 1.13  1998-04-14 23:27:02  florian
+    + exclude/include with constant second parameter added
+
+  Revision 1.12  1998/04/13 21:15:41  florian
     * error handling of pass_1 and cgi386 fixed
     * the following bugs fixed: 0117, 0118, 0119 and 0129, 0122 was already
       fixed, verified

+ 6 - 1
compiler/innr.inc

@@ -51,10 +51,15 @@ const
    in_settextbuf_file_x = 34;
    in_inc_x = 35;
    in_dec_x = 36;
+   in_include_x_y = 37;
+   in_exclude_x_y = 38;
 
 {
   $Log$
-  Revision 1.2  1998-04-08 16:58:02  pierre
+  Revision 1.3  1998-04-14 23:27:03  florian
+    + exclude/include with constant second parameter added
+
+  Revision 1.2  1998/04/08 16:58:02  pierre
     * several bugfixes
       ADD ADC and AND are also sign extended
       nasm output OK (program still crashes at end

+ 51 - 8
compiler/pass_1.pas

@@ -3324,7 +3324,7 @@ unit pass_1;
              in_length_string:
                begin
                   p^.resulttype:=u8bitdef;
-                  { String nach Stringkonvertierungen brauchen wir hier nicht }
+                  { wer don't need string conversations here }
                   if (p^.left^.treetype=typeconvn) and
                      (p^.left^.left^.resulttype^.deftype=stringdef) then
                     begin
@@ -3502,7 +3502,7 @@ unit pass_1;
                                  hp:=hp^.right;
                               end;
                          end;
-                       { nochmals alle Parameter bearbeiten }
+                       { pass all parameters again }
                        firstcallparan(p^.left,nil);
                     end;
                end;
@@ -3604,23 +3604,63 @@ unit pass_1;
                   must_be_valid:=true;
                   firstcallparan(p^.left,nil);
                end;
+            in_include_x_y,
+            in_exclude_x_y:
+              begin
+                 p^.resulttype:=voiddef;
+                 if assigned(p^.left) then
+                   begin
+                      firstcallparan(p^.left,nil);
+                      p^.registers32:=p^.left^.registers32;
+                      p^.registersfpu:=p^.left^.registersfpu;
+{$ifdef SUPPORT_MMX}
+                      p^.registersmmx:=p^.left^.registersmmx;
+{$endif SUPPORT_MMX}
+                      { first param must be var }
+                      if (p^.left^.left^.location.loc<>LOC_REFERENCE) and
+                         (p^.left^.left^.location.loc<>LOC_CREGISTER) then
+                        Message(cg_e_illegal_expression);
+                      { check type }
+                      if (p^.left^.resulttype^.deftype=setdef) then
+                        begin
+                           { two paras ? }
+                           if assigned(p^.left^.right) then
+                             begin
+                                { insert a type conversion         }
+                                { to the type of the set elements  }
+                                p^.left^.right^.left:=gentypeconvnode(
+                                  p^.left^.right^.left,
+                                  psetdef(p^.left^.resulttype)^.setof);
+                                { check the type conversion }
+                                firstpass(p^.left^.right^.left);
+                                { only three parameters are allowed }
+                                if assigned(p^.left^.right^.right) then
+                                  Message(cg_e_illegal_expression);
+                             end;
+                        end
+                      else
+                        Message(sym_e_type_mismatch);
+                   end
+                 else
+                   Message(sym_e_type_mismatch);
+              end;
              in_low_x,in_high_x:
                begin
                   if p^.left^.treetype in [typen,loadn] then
                     begin
                        case p^.left^.resulttype^.deftype of
-                  orddef,enumdef:
-                begin
+                          orddef,enumdef:
+                            begin
                                do_lowhigh(p^.left^.resulttype);
                                firstpass(p);
                             end;
-              setdef:
-                        begin
+                          setdef:
+                            begin
                                do_lowhigh(Psetdef(p^.left^.resulttype)^.setof);
                                firstpass(p);
                             end;
                          arraydef:
-                begin
+                            begin
                               if is_open_array(p^.left^.resulttype) then
                                 begin
                                    if p^.inlinenumber=in_low_x then
@@ -4557,7 +4597,10 @@ unit pass_1;
 end.
 {
   $Log$
-  Revision 1.9  1998-04-13 21:15:42  florian
+  Revision 1.10  1998-04-14 23:27:03  florian
+    + exclude/include with constant second parameter added
+
+  Revision 1.9  1998/04/13 21:15:42  florian
     * error handling of pass_1 and cgi386 fixed
     * the following bugs fixed: 0117, 0118, 0119 and 0129, 0122 was already
       fixed, verified

+ 19 - 1
compiler/pexpr.pas

@@ -361,6 +361,21 @@ unit pexpr;
                                  statement_syssym := p1;
                                  pd:=voiddef;
                               end;
+            in_include_x_y,
+            in_exclude_x_y:
+              begin
+                 consume(LKLAMMER);
+                 in_args:=true;
+                 p1:=expr;
+                 Must_be_valid:=false;
+                 consume(COMMA);
+                 p2:=expr;
+                 { just a bit lisp feeling }
+                 statement_syssym:=geninlinenode(l,
+                   gencallparanode(p1,gencallparanode(p2,nil)));
+                 consume(RKLAMMER);
+                 pd:=voiddef;
+              end;
             {in_val_x :        begin
                                  consume(LKLAMMER);
                                  paras:=parse_paras(false);
@@ -1625,7 +1640,10 @@ unit pexpr;
 end.
 {
   $Log$
-  Revision 1.7  1998-04-09 23:02:15  florian
+  Revision 1.8  1998-04-14 23:27:03  florian
+    + exclude/include with constant second parameter added
+
+  Revision 1.7  1998/04/09 23:02:15  florian
     * small problems solved to get remake3 work
 
   Revision 1.6  1998/04/09 22:16:35  florian

+ 6 - 1
compiler/pmodules.pas

@@ -78,6 +78,8 @@ unit pmodules;
          p^.insert(new(psyssym,init('ORD',in_ord_x)));
          p^.insert(new(psyssym,init('PRED',in_pred_x)));
          p^.insert(new(psyssym,init('SUCC',in_succ_x)));
+         p^.insert(new(psyssym,init('EXCLUDE',in_exclude_x_y)));
+         p^.insert(new(psyssym,init('INCLUDE',in_include_x_y)));
 
          { for testing purpose }
          p^.insert(new(psyssym,init('DECI',in_dec_x)));
@@ -934,7 +936,10 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.4  1998-04-10 14:41:43  peter
+  Revision 1.5  1998-04-14 23:27:03  florian
+    + exclude/include with constant second parameter added
+
+  Revision 1.4  1998/04/10 14:41:43  peter
     * removed some Hints
     * small speed optimization for AsmLn