]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
new syntax
authorGuido van Rossum <guido@python.org>
Tue, 11 Feb 1992 14:50:22 +0000 (14:50 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 11 Feb 1992 14:50:22 +0000 (14:50 +0000)
Demo/sgi/video/cam.py
Demo/sgi/video/camcorder.py
Demo/sgi/video/colorsys.py
Demo/sgi/video/statit.py
Demo/sgi/video/syncaudio.py
Demo/sgi/video/tv.py
Demo/sgi/video/vcopy.py
Demo/sgi/video/video.py
Demo/sgi/video/vinfo.py
Demo/sgi/video/vtime.py

index f30e1e0ad4056cd96b18efac336102ef97a097a7..fa8966f8b3b0e93ecf89cca8a4eabc5e34d14f6d 100755 (executable)
@@ -23,7 +23,7 @@ if sys.argv[1:]:
 
 if sys.argv[2:]:
        HOST = sys.argv[2]
-       if HOST = 'all':
+       if HOST == 'all':
                HOST = '<broadcast>'
                MAX = 1400
 
@@ -47,7 +47,7 @@ def main():
        readsource(SRC_FRAMEGRABBER)
 
        s = socket(AF_INET, SOCK_DGRAM)
-       if HOST = '<broadcast>':
+       if HOST == '<broadcast>':
                s.allowbroadcast(1)
        addr = HOST, PORT
 
@@ -72,7 +72,7 @@ def main():
        while 1:
                while qtest():
                        dev, val = qread()
-                       if dev = REDRAW:
+                       if dev == REDRAW:
                                reshapeviewport()
                                w, h = getsize()
                                ortho2(0, w, 0, h)
@@ -93,7 +93,7 @@ def main():
 
                                fps = 0
 
-                       elif dev = ESCKEY:
+                       elif dev == ESCKEY:
                                winclose(wid)
                                return
 
index 528ff299cf41eb8fb498bb3d26f75aff72c65dde..9b7618c436bb88c466011f509e492cc5c905f885 100755 (executable)
@@ -93,7 +93,7 @@ def wrheader(f, w, h, pf):
        f.write('CMIF video 1.0\n')
        f.write(`w,h,pf` + '\n')
        print 'width,height,pf:', w, h, pf,
-       if pf = 0: pf = 4
+       if pf == 0: pf = 4
        print '(i.e.,', w*h*pf, 'bytes/frame)'
 
 def main():
@@ -103,14 +103,14 @@ def main():
     austart = 0
     optlist, args = getopt.getopt(sys.argv[1:],'ca:sp:')
     for opt, arg in optlist:
-       if opt = '-c':
+       if opt == '-c':
            pf = 0
-       elif opt = '-a':
+       elif opt == '-a':
            ausync = 1
            aumachine = arg
-       elif opt = '-s':
+       elif opt == '-s':
            austart = 1
-       elif opt = '-p':
+       elif opt == '-p':
            pf = int(eval(arg))
        else:
            usage()
@@ -184,13 +184,13 @@ def main():
            if qtest() or \
            not (mousing or inrunning or insingle or outrunning or outsingle):
                ev, val = qread()
-               if ev = LEFTMOUSE and val = 1:
+               if ev == LEFTMOUSE and val == 1:
                    drawframe(x,y,w,h,0)
                    mousing = 1
                    ox, oy = getorigin()
                    x = getvaluator(MOUSEX)-ox
                    y = getvaluator(MOUSEY)-oy
-               elif ev = LEFTMOUSE and val = 0:
+               elif ev == LEFTMOUSE and val == 0:
                    if h < 0:
                        y, h = y+h, -h
                    if w < 0:
@@ -200,7 +200,7 @@ def main():
                        wrheader(f, w, h, pf)
                        sizewritten = 1
                        prealloc(w, h)
-               elif ev = RKEY and val = 1:
+               elif ev == RKEY and val == 1:
                    if not inrunning:
                        ringbell()
                    else:
@@ -211,7 +211,7 @@ def main():
                        starttime = time.millitimer()
                        if ausync:
                            ctl.sendto(`(1,starttime)`, aua)
-               elif ev = PKEY and val = 1 and outrunning:
+               elif ev == PKEY and val == 1 and outrunning:
                    outrunning = 0
                    stoptime = time.millitimer()
                    if ausync:
@@ -222,11 +222,11 @@ def main():
                    print 'Saving...'
                    saveframes(f, w, h, pf)
                    print 'Done.'
-               elif ev = PKEY and val = 1 and not outrunning:
+               elif ev == PKEY and val == 1 and not outrunning:
                        outsingle = 1
-               elif ev = CKEY and val = 1:
+               elif ev == CKEY and val == 1:
                        inrunning = 1
-               elif ev = SKEY and val = 1:
+               elif ev == SKEY and val == 1:
                        if outrunning:
                            ringbell()
                        elif inrunning:
@@ -237,7 +237,7 @@ def main():
                    if ausync:
                        ctl.sendto(`(2,time.millitimer())`, aua)
                    raise stop
-               elif ev = REDRAW:
+               elif ev == REDRAW:
                        drawframe(x,y,w,h,0)
                        reshapeviewport()
                        drawframe(x,y,w,h,1)
index 6735b3533d789ab2fb87bf8d9d95b4afded9665b..dd3a033b26ec20f8c3cd3e0559cb7c3d183a365a 100755 (executable)
@@ -96,11 +96,11 @@ def hsv_to_rgb(h,s,v):
     q = v*(1.0-s*f)
     t = v*(1.0-s*(1.0-f))
     if i in (0,6): return v,t,p
-    if i = 1: return q,v,p
-    if i = 2: return p,v,t
-    if i = 3: return p,q,v
-    if i = 4: return t,p,v
-    if i = 5: return v,p,q
+    if i == 1: return q,v,p
+    if i == 2: return p,v,t
+    if i == 3: return p,q,v
+    if i == 4: return t,p,v
+    if i == 5: return v,p,q
     print i, h, f
     print h, s, v
     raise 'Bad color'
index 360e49e8738e638f450b123a1e2bbacddd3a966c..b0c1782927729370dfdb0065e256c7db9fe6b115 100755 (executable)
@@ -94,7 +94,7 @@ def packline(line):
        i, n = 1, len(bytes)
        while i < n:
                for pack in (0, 2, 4, 8):
-                       if pack = 0:
+                       if pack == 0:
                                lo, hi = 0, 0
                        else:
                                hi = pow(2, pack-1)-1
index 742a4338e0742b6c158a9c007b76d8912cc560ca..fd09d2879c6580dc1792dc5de08ede9e2e4a84f2 100755 (executable)
@@ -70,8 +70,8 @@ def mainloop(ofile, ctl, inp, out, globaltime):
     # buffer. Discard all buffered data upto his starttime
     #
     startstop,histime = eval(ctl.recv(100))
-    if (ofile = None and startstop = 0) or \
-                          (ofile <> None and startstop = 1):
+    if (ofile == None and startstop == 0) or \
+                          (ofile <> None and startstop == 1):
        print 'Sync error: saving=',save,' request=',startstop
        sys.exit(1)
     filllevel = inp.getfilled()
@@ -89,6 +89,6 @@ def mainloop(ofile, ctl, inp, out, globaltime):
     print 'Time: ', time.millitimer()-starttime, ', Bytes: ', totbytes, ', Samples: ', totsamps
     if ofile <> None:
        ofile.write(data)
-    return (startstop = 2)
+    return (startstop == 2)
 
 main()
index 621740cbbc5bcf2e182d91473214df09ae7c39be..da4bacbb63a85f6abf41d910ec20cb412c8810ce 100755 (executable)
@@ -44,10 +44,10 @@ def main():
        while 1:
                if qtest():
                        dev, val = qread()
-                       if dev = ESCKEY:
+                       if dev == ESCKEY:
                                winclose(wid)
                                return
-                       elif dev = REDRAW:
+                       elif dev == REDRAW:
                                oldw, oldh = reshape()
                elif s.avail():
                        data = s.recv(17000)
index a492073d01fc43e5c03a3d219c914d6382cf4ada..3afe119ea09db87d7b6f50ad065650c2bc58acca 100755 (executable)
@@ -7,10 +7,10 @@ from DEVICE import *
 
 def loadframe(f, w, h, pf):
        line = f.readline()
-       if not line or line = '\n':
+       if not line or line == '\n':
                raise EOFError
        x = eval(line[:-1])
-       if type(x) = type(0):
+       if type(x) == type(0):
                if pf: size = w*h*4
                else: size = w*h*pf
        else:
@@ -47,10 +47,10 @@ def main():
        ofp = open(ofile, 'w')
        #
        line = ifp.readline()
-       if line[:4] = 'CMIF':
+       if line[:4] == 'CMIF':
                line = ifp.readline()
        x = eval(line[:-1])
-       if len(x) = 3:
+       if len(x) == 3:
                w, h, pf = x
        else:
                w, h = x
@@ -82,11 +82,11 @@ def main():
                dev, val = qread()
                if dev in (ESCKEY, WINQUIT, WINSHUT):
                        break
-               if dev = REDRAW:
+               if dev == REDRAW:
                        reshapeviewport()
-               elif dev = KEYBD:
+               elif dev == KEYBD:
                        c = chr(val)
-                       if c = 'n':
+                       if c == 'n':
                                try:
                                        time, data = loadframe(ifp, w, h, pf)
                                        iframe = iframe+1
@@ -94,13 +94,13 @@ def main():
                                except EOFError:
                                        print 'EOF'
                                        ringbell()
-                       elif c = 'w':
+                       elif c == 'w':
                                ofp.write(`time, len(data)` + '\n')
                                ofp.write(data)
                                print 'Frame', iframe, 'written.'
                        else:
                                print 'Character', `c`, 'ignored'
-               elif dev = INPUTCHANGE:
+               elif dev == INPUTCHANGE:
                        pass
                else:
                        print '(dev, val) =', (dev, val)
index da2d2c72336da6051b3278259fda785dd9944899..cf994a3eb4e9af7eaa00448f5ec432bc412938cc 100755 (executable)
@@ -31,26 +31,26 @@ def openvideo(name):
         sys.exit(1)
     line = f.readline()
     if not line: raise EndOfFile
-    if line[:4] = 'CMIF':
-       if line[:14] = 'CMIF video 2.0':
+    if line[:4] == 'CMIF':
+       if line[:14] == 'CMIF video 2.0':
            line = f.readline()
            colorinfo = eval(line[:-1])
        else:
            colorinfo = (8,0,0,0)
        line = f.readline()
     x = eval(line[:-1])
-    if len(x) = 3: w, h, pf = x
+    if len(x) == 3: w, h, pf = x
     else: w, h = x; pf = 2
     return f, w, h, pf, colorinfo
 
 def loadframe(f,w,h,pf,af,spkr, (ybits,ibits,qbits,chrompack),mf):
     line = f.readline()
-    if line = '':
+    if line == '':
        raise EndOfFile
     x = eval(line[:-1])
-    if type(x) = type(0) or type(x) = type(0.0):
+    if type(x) == type(0) or type(x) == type(0.0):
        tijd = x
-       if pf = 0:
+       if pf == 0:
                size = w*h*4
        else:
                size = (w/pf) * (h/pf)
@@ -98,10 +98,10 @@ def initcmap(ybits,ibits,qbits,chrompack):
     for y in range(maxy):
       yv = float(y)/float(maxy-1)
       for i in range(maxi):
-       if maxi = 1: iv = 0
+       if maxi == 1: iv = 0
        else: iv = (float(i)/float(maxi-1))-0.5
        for q in range(maxq):
-         if maxq = 1: qv = 0
+         if maxq == 1: qv = 0
          else: qv = (float(q)/float(maxq-1))-0.5
          index = 2048 + y + (i << ybits) + (q << (ybits+ibits))
          rv,gv,bv = colorsys.yiq_to_rgb(yv,iv,qv)
@@ -125,13 +125,13 @@ def main():
        '[-l] [-p pf] [-m mag] [-F] [moviefile [soundfile [skipbytes]]]\n')
                sys.exit(2)
        for opt, arg in opts:
-               if opt = '-m':
+               if opt == '-m':
                        magfactor = int(eval(arg))
-               elif opt = '-p':
+               elif opt == '-p':
                        packfactor = int(eval(arg))
-               elif opt = '-l':
+               elif opt == '-l':
                        looping = 1
-               elif opt = '-F':
+               elif opt == '-F':
                        epoch.correcttiming = 0
        if args:
                filename = args[0]
@@ -206,7 +206,7 @@ def main():
                    dev, val = qread()
                    if dev in (ESCKEY, WINSHUT, WINQUIT):
                        raise bye
-                   elif dev = REDRAW:
+                   elif dev == REDRAW:
                        reshapeviewport()
        except bye:
            pass
index e230c4fee320ab3b94a83515fc04ccf388214d88..6f8b54341ec9fa7f13af801c900ce6f4ef2ee227 100755 (executable)
@@ -14,20 +14,20 @@ def openvideo(filename):
     f = open(filename, 'r')
     line = f.readline()
     if not line: raise EndOfFile
-    if line[:4] = 'CMIF': line = f.readline()
+    if line[:4] == 'CMIF': line = f.readline()
     x = eval(line[:-1])
-    if len(x) = 3: w, h, pf = x
+    if len(x) == 3: w, h, pf = x
     else: w, h = x; pf = 2
     return f, w, h, pf
 
 def loadframe(f, w, h, pf):
     line = f.readline()
-    if line = '':
+    if line == '':
        raise EndOfFile
     x = eval(line[:-1])
-    if type(x) = type(0) or type(x) = type(0.0):
+    if type(x) == type(0) or type(x) == type(0.0):
        tijd = x
-       if pf = 0:
+       if pf == 0:
                size = w*h*4
        else:
                size = (w/pf) * (h/pf)
@@ -47,8 +47,8 @@ def main():
        delta = 0
        opts, names = getopt.getopt(sys.argv[1:], 'd')
        for opt, arg in opts:
-               if opt = '-d': delta = 1
-       if names = []:
+               if opt == '-d': delta = 1
+       if names == []:
                names = ['film.video']
        for name in names:
            try:
@@ -67,7 +67,7 @@ def main():
                        else: print '\t', tijd,
                        otijd = tijd
                        num = num + 1
-                       if num % 8 = 0:
+                       if num % 8 == 0:
                                print
                    except EndOfFile:
                        raise bye
index 00d821e7324c5744c4849e625e386517dad70a83..c333e57983ec14296495687a444c97a6f87995be 100755 (executable)
@@ -59,7 +59,7 @@ class VTime():
                            print 'Someone else syncing to us: ', other
                            raise bad_connect
                        data = eval(data)
-                       if data[:2] = (loopct+1,curtijd):
+                       if data[:2] == (loopct+1,curtijd):
                            break
                        if data[0] <> 2:
                            print 'Illegal sync reply: ', data
@@ -83,7 +83,7 @@ class VTime():
                if data[0] in (0,2):
                    curtijd = time.millitimer()
                    s.sendto(`(data[0]+1,data[1],curtijd)`,raddr)
-               elif data[0] = 4:
+               elif data[0] == 4:
                    newtijd = time.millitimer()
                    histime = data[1]
                    mytime = timeavg(curtijd,newtijd)