~ubuntu-branches/ubuntu/oneiric/swig1.3/oneiric

« back to all changes in this revision

Viewing changes to Doc/Manual/Allegrocl.html

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-12-06 10:27:08 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20071206102708-t37t62i45n595w0e
Tags: 1.3.33-2ubuntu1
* Merge with Debian; remaining changes:
  - Drop support for pike.
  - Use python2.5 instead of python2.4.
  - Clean Runtime/ as well.
  - Force a few environment variables.
* debian/Rules (clean): Remove Lib/ocaml/swigp4.ml.

Show diffs side-by-side

added added

removed removed

Lines of Context:
760
760
    </p>
761
761
      <div class="code">
762
762
      <pre>
763
 
#define A 1                    => (swig-defconstant "A" 1)  
764
 
#define B 'c'                  => (swig-defconstant "B" #\c)
765
 
#define C B                    => (swig-defconstant "C" #\c)
766
 
#define D 1.0e2                => (swig-defconstant "D" 1.0d2)
767
 
#define E 2222                 => (swig-defconstant "E" 2222)
768
 
#define F (unsigned int)2222   => no code generated
769
 
#define G 1.02e2f              => (swig-defconstant "G" 1.02f2)
770
 
#define H foo                  => no code generated
 
763
#define A 1                    =&gt; (swig-defconstant "A" 1)  
 
764
#define B 'c'                  =&gt; (swig-defconstant "B" #\c)
 
765
#define C B                    =&gt; (swig-defconstant "C" #\c)
 
766
#define D 1.0e2                =&gt; (swig-defconstant "D" 1.0d2)
 
767
#define E 2222                 =&gt; (swig-defconstant "E" 2222)
 
768
#define F (unsigned int)2222   =&gt; no code generated
 
769
#define G 1.02e2f              =&gt; (swig-defconstant "G" 1.02f2)
 
770
#define H foo                  =&gt; no code generated
771
771
      </pre>
772
772
      </div>
773
773
 
789
789
      
790
790
      <div class="code">
791
791
      <pre>
792
 
#define I A + E                => (swig-defconstant "I" (+ 1 2222))
793
 
#define J 1|2                  => (swig-defconstant "J" (logior 1 2))
794
 
#define Y 1 + 2 * 3 + 4        => (swig-defconstant "Y" (* (+ 1 2) (+ 3 4)))
795
 
#define Y1 (1 + 2) * (3 + 4)   => (swig-defconstant "Y1" (* (+ 1 2) (+ 3 4)))
796
 
#define Y2 1 * 2 + 3 * 4       => (swig-defconstant "Y2" (* 1 (+ 2 3) 4))  ;; WRONG
797
 
#define Y3 (1 * 2) + (3 * 4)   => (swig-defconstant "Y3" (* 1 (+ 2 3) 4))  ;; WRONG
798
 
#define Z 1 + 2 - 3 + 4 * 5    => (swig-defconstant "Z" (* (+ 1 (- 2 3) 4) 5)) ;; WRONG
 
792
#define I A + E                =&gt; (swig-defconstant "I" (+ 1 2222))
 
793
#define J 1|2                  =&gt; (swig-defconstant "J" (logior 1 2))
 
794
#define Y 1 + 2 * 3 + 4        =&gt; (swig-defconstant "Y" (* (+ 1 2) (+ 3 4)))
 
795
#define Y1 (1 + 2) * (3 + 4)   =&gt; (swig-defconstant "Y1" (* (+ 1 2) (+ 3 4)))
 
796
#define Y2 1 * 2 + 3 * 4       =&gt; (swig-defconstant "Y2" (* 1 (+ 2 3) 4))  ;; WRONG
 
797
#define Y3 (1 * 2) + (3 * 4)   =&gt; (swig-defconstant "Y3" (* 1 (+ 2 3) 4))  ;; WRONG
 
798
#define Z 1 + 2 - 3 + 4 * 5    =&gt; (swig-defconstant "Z" (* (+ 1 (- 2 3) 4) 5)) ;; WRONG
799
799
      </pre>
800
800
      </div>
801
801
      <p>
863
863
 
864
864
    <div class="targetlang">
865
865
    <pre>
866
 
user> (load "globalvar.dll")
 
866
user&gt; (load "globalvar.dll")
867
867
; Foreign loading globalvar.dll.
868
868
t
869
 
user> (load "globalvar.cl")
 
869
user&gt; (load "globalvar.cl")
870
870
; Loading c:\mikel\src\swig\test\globalvar.cl
871
871
t
872
 
user> 
873
 
globalvar> (globalvar.nnn::global_var)
 
872
user&gt; 
 
873
globalvar&gt; (globalvar.nnn::global_var)
874
874
2
875
 
globalvar> (globalvar.nnn::glob_float)
 
875
globalvar&gt; (globalvar.nnn::glob_float)
876
876
2.0
877
 
globalvar> (setf (globalvar.nnn::glob_float) 3.0)
 
877
globalvar&gt; (setf (globalvar.nnn::glob_float) 3.0)
878
878
3.0
879
 
globalvar> (globalvar.nnn::glob_float)
 
879
globalvar&gt; (globalvar.nnn::glob_float)
880
880
3.0
881
881
    </pre>
882
882
    </div>
1215
1215
 
1216
1216
typedef A Foo;
1217
1217
 
1218
 
A *xxx(int i);         /* sets A->x = A->y = i */
1219
 
Foo *yyy(int i);       /* sets Foo->x = Foo->y = i */
 
1218
A *xxx(int i);         /* sets A-&gt;x = A-&gt;y = i */
 
1219
Foo *yyy(int i);       /* sets Foo-&gt;x = Foo-&gt;y = i */
1220
1220
 
1221
 
int zzz(A *inst = 0);  /* return inst->x + inst->y */
 
1221
int zzz(A *inst = 0);  /* return inst-&gt;x + inst-&gt;y */
1222
1222
    </pre>
1223
1223
    </div>
1224
1224
 
1258
1258
    </p>
1259
1259
    <div class="targetlang">
1260
1260
    <pre>
1261
 
CL-USER> (load "synonym.dll")
 
1261
CL-USER&gt; (load "synonym.dll")
1262
1262
; Foreign loading synonym.dll.
1263
1263
t
1264
 
CL-USER> (load "synonym.cl")
 
1264
CL-USER&gt; (load "synonym.cl")
1265
1265
; Loading c:\mikel\src\swig\test\synonym.cl
1266
1266
t
1267
 
CL-USER> 
1268
 
synonym> (setf a (xxx 3))
 
1267
CL-USER&gt; 
 
1268
synonym&gt; (setf a (xxx 3))
1269
1269
#&lt;A nil #x3261a0 @ #x207299da&gt;
1270
 
synonym> (setf foo (yyy 10))
 
1270
synonym&gt; (setf foo (yyy 10))
1271
1271
#&lt;A nil #x3291d0 @ #x2072e982&gt;
1272
 
synonym> (zzz a)
 
1272
synonym&gt; (zzz a)
1273
1273
6
1274
 
synonym> (zzz foo)
 
1274
synonym&gt; (zzz foo)
1275
1275
20
1276
 
synonym> 
 
1276
synonym&gt; 
1277
1277
    </pre>
1278
1278
    </div>
1279
1279
 
1326
1326
};
1327
1327
 
1328
1328
float xxx(int i, int x = 0);   /* return i * x */
1329
 
float xxx(A *inst, int x);     /* return x + A->x + A->y */
 
1329
float xxx(A *inst, int x);     /* return x + A-&gt;x + A-&gt;y */
1330
1330
    </pre>
1331
1331
    </div>
1332
1332
 
1443
1443
    </p>
1444
1444
    <div class="targetlang">
1445
1445
    <pre>
1446
 
overload> (setf a (new_A))
 
1446
overload&gt; (setf a (new_A))
1447
1447
#&lt;A nil #x329268 @ #x206cf612&gt;
1448
 
overload> (setf (A_x a) 10)
 
1448
overload&gt; (setf (A_x a) 10)
1449
1449
10
1450
 
overload> (setf (A_y a) 20)
 
1450
overload&gt; (setf (A_y a) 20)
1451
1451
20
1452
 
overload> (xxx 1)
 
1452
overload&gt; (xxx 1)
1453
1453
0.0
1454
 
overload> (xxx 3 10)
 
1454
overload&gt; (xxx 3 10)
1455
1455
30.0
1456
 
overload> (xxx a 1)
 
1456
overload&gt; (xxx a 1)
1457
1457
31.0
1458
 
overload> (xxx a 2)
 
1458
overload&gt; (xxx a 2)
1459
1459
32.0
1460
 
overload> 
 
1460
overload&gt; 
1461
1461
    </pre>
1462
1462
    </div>
1463
1463
 
1506
1506
%rename(__logand_assign__)   *::operator&amp;=;
1507
1507
%rename(__logior_assign__)   *::operator|=;
1508
1508
 
1509
 
%rename(__lshift__)          *::operator<<;
1510
 
%rename(__lshift_assign__)   *::operator<<=;
1511
 
%rename(__rshift__)          *::operator>>;
1512
 
%rename(__rshift_assign__)   *::operator>>=;
 
1509
%rename(__lshift__)          *::operator&lt;&lt;;
 
1510
%rename(__lshift_assign__)   *::operator&lt;&lt;=;
 
1511
%rename(__rshift__)          *::operator&gt;&gt;;
 
1512
%rename(__rshift_assign__)   *::operator&gt;&gt;=;
1513
1513
 
1514
1514
%rename(__eq__)              *::operator==;
1515
1515
%rename(__ne__)              *::operator!=;
1516
 
%rename(__lt__)              *::operator<;
1517
 
%rename(__gt__)              *::operator>;
1518
 
%rename(__lte__)             *::operator<=;
1519
 
%rename(__gte__)             *::operator>=;
 
1516
%rename(__lt__)              *::operator&lt;;
 
1517
%rename(__gt__)              *::operator&gt;;
 
1518
%rename(__lte__)             *::operator&lt;=;
 
1519
%rename(__gte__)             *::operator&gt;=;
1520
1520
 
1521
1521
%rename(__and__)             *::operator&amp;&amp;;
1522
1522
%rename(__or__)              *::operator||;
1529
1529
%rename(__comma__)           *::operator,();
1530
1530
%rename(__comma__)           *::operator,() const;
1531
1531
 
1532
 
%rename(__member_ref__)      *::operator->;
1533
 
%rename(__member_func_ref__) *::operator->*;
 
1532
%rename(__member_ref__)      *::operator-&gt;;
 
1533
%rename(__member_func_ref__) *::operator-&gt;*;
1534
1534
 
1535
1535
%rename(__funcall__)         *::operator();
1536
1536
%rename(__aref__)            *::operator[];
1599
1599
    </p>
1600
1600
    <div class="targetlang">
1601
1601
    <pre>
1602
 
opoverload> (B___eq__ x1 x2)
1603
 
nil
1604
 
opoverload> (B___eq__ x1 3)
1605
 
nil
1606
 
opoverload> 
 
1602
opoverload&gt; (B___eq__ x1 x2)
 
1603
nil
 
1604
opoverload&gt; (B___eq__ x1 3)
 
1605
nil
 
1606
opoverload&gt; 
1607
1607
    </pre>
1608
1608
    </div>
1609
1609