GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — added libappindicator · leonhd/rpythonic@155f53d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .hgignore
  • README.txt
  • doc
    • RPython-spec-draft.txt
    • rpython-ctypes-1.png
    • rpython-ctypes-2.png
    • rpython-ctypes-shared-objects.png
    • rpython-ctypes-stackless.png
    • rpython-javascript.png
  • examples-android
    • androidGLES1.py
    • android_helloworld.py
    • android_opengl.py
  • examples-c++
    • data
      • Cube.mesh.xml
      • Cube.mesh
      • Scene.material
      • ogre.cfg
      • ogre.log
      • plugins.cfg
      • testscene.scene
    • irrlicht-helloworld.py
    • ogre-helloworld.py
  • examples-rpython
    • nbody_shedskin.py
    • nbody_shedskin_rpythonic.py
    • openGLES1.py
    • rpy_SDL_opengl.py
    • test1-functions.py
    • test10-llvm-shuffle-vectors.py
    • test2-objects.py
    • test3-neorpython.py
    • test4-objects-threading.py
    • test6-javascript.py
    • test7-array.py
    • test8-llvm.py
    • test9-llvm-vectors.py
  • examples
    • Kinect-tripple.py
    • SDL
      • __init__.py
    • alut
      • __init__.py
    • appindicator-helloworld.py
    • avcodec
      • __init__.py
    • avformat
      • __init__.py
    • cares
      • __init__.py
    • clutter-animation.py
    • clutter-helloworld.py
    • ctypes_freenect.py
    • deprecated
      • bpy-libblender-test1.py
      • gtk-blender-xembed.py
      • kinect_dualthreaded.py
      • kinect_tripple_threaded.py
      • pypy-gtk-blender-xembed.py
    • emokit
      • __init__.py
    • fftw
      • __init__.py
    • fluidsynth
      • __init__.py
    • glx-helloworld.py
    • gstreamer-helloworld.py
    • gtk-helloworld.py
    • gtk-xembed.py
    • gtk3
      • __init__.py
    • highgui
      • __init__.py
    • inotify-helloworld.py
    • inotify
      • __init__.py
    • kinect_head_hand_tracker.py
    • libappindicator
      • __init__.py
    • libblender
      • __init__.py
    • libclutter_gtk
      • __init__.py
    • libev-helloworld.py
    • libev
      • __init__.py
    • libfreenect_sync
      • __init__.py
    • libfreenect
      • __init__.py
    • libgimp
      • __init__.py
    • libgio-helloworld.py
    • libgio
      • __init__.py
    • libgstreamer
      • __init__.py
    • libmlt
      • __init__.py
    • libmono
      • __init__.py
    • libnautilus
      • __init__.py
    • libverse
      • __init__.py
    • nautilus-helloworld.py
    • ode_geomtest.py
    • ode_ooapi.py
    • ode_simple.py
    • ode
      • __init__.py
    • openGLUT
      • __init__.py
    • openGLU
      • __init__.py
    • openGL
      • __init__.py
    • openal-capture.py
    • openal-helloworld.py
    • openal-streaming.py
    • openal
      • __init__.py
    • opencv-drawing.py
    • opencv-webcam.py
    • opencv_core
      • __init__.py
    • opencv_highgui
      • __init__.py
    • openjpeg
      • __init__.py
    • python3-in-pypy.py
    • python3
      • __init__.py
    • sdl_joystick.py
    • unistd
      • __init__.py
    • vncclient
      • __init__.py
    • vncserver
      • __init__.py
    • wayland-client-test.py
    • wayland-server-eventloop.py
    • wayland_client
      • __init__.py
    • wayland_server
      • __init__.py
    • wiiuse-helloworld.py
    • wiiuse-test.py
    • wiiuse
      • __init__.py
    • xlib-helloworld.py
    • xlib
      • __init__.py
  • rpythonic
    • CppHeaderParser
      • CppHeaderParser.py
      • __init__.py
      • examples
        • SampleClass.h
        • bindings.all.h
        • bindings.all.py
        • boost-intadapt.h
        • boost-intadapt.py
        • boost-test1.h
        • boost-test1.py
        • bullet-nested-test.h
        • bullet-nested-test.py
        • bullet-test1.h
        • bullet-test1.py
        • enum-test.h
        • enum-test.py
        • g3d-any.h
        • g3d-any.py
        • g3d-map2d.h
        • g3d-map2d.py
        • g3d-ray.h
        • g3d-ray.py
        • g3d-stream.h
        • g3d-stream.py
        • g3d-text.h
        • g3d-text.py
        • g3d-videoinput.h
        • g3d-videoinput.py
        • irr-alloc-test.h
        • irr-alloc-test.py
        • irr-color-test.h
        • irr-color-test.py
        • irr-template-2D-test.h
        • irr-template-2D-test.py
        • locale-test.h
        • locale-test.py
        • ogre-any-test.h
        • ogre-any-test.py
        • ogre-overlay.h
        • ogre-overlay.py
        • ogre-resource-test.h
        • ogre-resource-test.py
        • ogre-root-test.h
        • ogre-root-test.py
        • ogre-scene-node.h
        • ogre-scene-node.py
        • ogretest.h
        • ogretest.py
        • ogretest2.h
        • ogretest2.py
        • ogretest3.h
        • ogretest3.py
        • ogretest4.h
        • ogretest4.py
        • ogretest5.h
        • ogretest5.py
        • python3-test.py
        • readSampleClass.py
        • simple.h
        • simple.py
        • test-irrlicht.h
        • test-irrlicht.py
        • test-irrlicht2.h
        • test-irrlicht2.py
        • test-irrlicht3.h
        • test-irrlicht3.py
        • test-nested-struct.h
        • test-nested-struct.py
        • test-private.h
        • test-private.py
        • test-private2.h
        • test-private2.py
        • test2.py
    • __init__.py
    • magicheader.py
    • neorpython.py
    • pycparser
      • __init__.py
      • _ast_gen.py
      • _build_tables.py
      • _c_ast.cfg
      • ast_transforms.py
      • c_ast.py
      • c_generator.py
      • c_lexer.py
      • c_parser.py
      • lextab.py
      • plyparser.py
    • rpyllvmjit.py
    • rpythonic.py
  • scripts
    • android-generate-wrappers.py
    • gen-gtk-wrappers.py
    • generate-wrappers.py
    • glibfooter.py
    • gtkfooter.py
    • ios-generate-wrappers.py
    • ios-hacks
      • float.h
      • secure
        • _stdio.h
        • _string.h
      • stdarg.h
    • make-pyppet-wrappers.sh

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.hgignore‎

Copy file name to clipboard
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
syntax: glob
2+
# This line is a comment, and will be skipped.
3+
# Empty lines are skipped too.
4+
5+
# Backup files left behind by the Emacs editor.
6+
*~
7+
8+
# Lock files used by the Emacs editor.
9+
# Notice that the "#" character is quoted with a backslash.
10+
# This prevents it from being interpreted as starting a comment.
11+
.\#*
12+
13+
# Temporary files used by the vim editor.
14+
.*.swp
15+
16+
# A hidden file created by the Mac OS X Finder.
17+
.DS_Store
18+
19+
# python bytecode
20+
*.pyc
21+
22+
yacctab.py
23+
parser.out
Collapse file

‎README.txt‎

Copy file name to clipboard
+66Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
RPythonic: Beta9 - May, 2012
2+
Copyright 2012: Brett Hartshorn and The Blender Research Lab.
3+
License: BSD
4+
5+
INSTALLING:
6+
Ubuntu:
7+
apt-get install
8+
python-ply
9+
libreadline-dev
10+
python-llvm
11+
Fedora:
12+
yum install
13+
python-ply
14+
cpp
15+
gcc
16+
glibc-devel
17+
mono-devel
18+
19+
Optional:
20+
java
21+
android SDK/NDK
22+
llvm
23+
24+
25+
DEV NOTES:
26+
C++ Wrapper Gen - in progress...
27+
Rpython > LLVM - in progress...
28+
see the "scripts" folder for wrapper generator examples
29+
30+
Known Issues:
31+
rffi wrapper gen is broken
32+
android demos are broken
33+
c++ wrapper gen broken?
34+
35+
36+
_____________________________________________________________
37+
PYPY NOTES:
38+
A stripped down PyPy is now included with Rpythonic,
39+
it is no longer required you fetch the PyPy source and patch it.
40+
41+
Custom Hacks:
42+
copy "pypy-trunk/pypy" to "rpythonic"
43+
44+
pypy/translator/c/debug_print.c
45+
line 92, remove the ifndef block using "clock_gettime"
46+
47+
copy file "opcode.py" from "lib-python/modified-2.7" to "pypy/tool"
48+
49+
pypy/tool/stdlib_opcode.py
50+
line 108:
51+
def load_pypy_opcode():
52+
#from pypy.tool.lib_pypy import LIB_PYTHON_MODIFIED
53+
#opcode_path = LIB_PYTHON_MODIFIED.join('opcode.py')
54+
import os
55+
opcode_path = os.path.join( os.path.split(os.path.abspath(__file__))[0], 'opcode.py' )
56+
57+
from "pypy-trunk/" copy "py" and "lib_pypy" to "rpythonic"
58+
59+
from "pypy-trunk/" copy "pytest.py" and "_pytest" to "rpythonic/pypy"
60+
modify pytest.py:
61+
import os
62+
DIR = os.path.split(os.path.abspath(__file__))[0]
63+
if DIR not in sys.path: sys.path.append( DIR )
64+
65+
66+
Collapse file

‎doc/RPython-spec-draft.txt‎

Copy file name to clipboard
+94Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
==============================
2+
Strict Rpython 1.0
3+
==============================
4+
5+
RPython rule1: All rules can be broken if you can meta-program your way around them
6+
( using function decorators to rewrite functions to comply with the rules below )
7+
8+
RPython rule2: All globals and class-level attributes are constants.
9+
. PyPy considers globals to always be constant, including class-
10+
level attributes. Use singleton instances to store global changeable state.
11+
12+
RPython rule3: Tuples may contain mixed types, but it should be avoided.
13+
. PyPy can not use a loop to iterate over mixed tuples
14+
( because to iterate over a tuple it must be cast to a list - ie. for x in list(mytuple) )
15+
16+
RPython rule4: Dicts and lists must contain compatible types (homogeneous).
17+
. ShedSkin and PyPy common rule
18+
19+
RPython rule5: No reflection (getattr, hasattr, etc..)
20+
. PyPy allows for limited getattr, hasattr.., but only if the string is 'concrete.'
21+
22+
RPython rule6: No runtime evaluation.
23+
. Neither ShedSkin or PyPy support eval or exec
24+
25+
RPython rule7: No **keywordargs
26+
. Neither ShedSkin or PyPy support **kw
27+
this is ok: def func(a, b=None, y=2): pass
28+
this is not ok: def func(a,**b): pass
29+
30+
RPython rule 8: Within a scope, a variable must not change type; however,
31+
`None` can be used as a place holder and intermixed with any type, but NOT with ints or floats.
32+
33+
RPython rule 9: For instances to be of a compatible type, they must inherit from a common base class.
34+
. ShedSkin and PyPy requirement
35+
36+
RPython rule 10: For compatible instances stored in the same list, but
37+
of different subclasses, to call methods with incompatible signatures
38+
or access attributes unique to the subclass, the type must be asserted
39+
first:
40+
assert isinstance(a,MySubClass)
41+
42+
43+
RPython rule 11: The *assert isinstance* statement acts like a cast in
44+
C/C++, turning `SomeObject` into the real subclass instance. This
45+
solves problems like in rule10, and in other cases where an instance
46+
of uncertian type must be passed to a function that expects a certian
47+
type.
48+
49+
RPython rule 12: No overloading, except for __init__ and __del__.
50+
51+
RPython rule 13: Attribute variables should be of consistent type in
52+
all subclasses. Do not create a subclass that redefines the type of
53+
an attribute.
54+
55+
RPython rule 14: The calling and return signature of a function must
56+
not change. The types of function arguments must always be the same
57+
for each function call. Only `None` can be intermixed but not with ints or floats.
58+
Function returns must always have the same type.
59+
60+
RPython rule 15: Its not recommended to define subclasses with like-
61+
named functions that have different signatures. Casting by `assert
62+
isinstance` is the work around that allows this rule to be bent.
63+
In addition when doing this you may need to follow rule16 below.
64+
65+
RPython rule 16: The root base class should define dummy functions,
66+
if multiple subclasses will overload them those functions with
67+
incompatible signatures.
68+
. Prevents method `demotion` error in PyPy
69+
70+
RPython Extra Quirks:
71+
1. a string of multiple characters is not the same as a string of a single character,
72+
some functions will only accept a single character string; Examples:
73+
this is valid:
74+
a = 'hello world'
75+
a.split(' ')
76+
a.split('x')
77+
this is invalid:
78+
a = 'hello world'
79+
a.split()
80+
a.split('world')
81+
82+
2. some builtin functions require an argument where normally they do not, Example:
83+
this is valid:
84+
a = ['x','y','z']
85+
a.pop( len(a)-1 ) # pop by index, pop the last item
86+
this is invalid:
87+
a = ['x','y','z']
88+
a.pop() # pop requires an index so this fails
89+
90+
91+
92+
93+
94+
Collapse file

‎doc/rpython-ctypes-1.png‎

Copy file name to clipboard
76.7 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎doc/rpython-ctypes-2.png‎

Copy file name to clipboard
78.9 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎doc/rpython-ctypes-shared-objects.png‎

Copy file name to clipboard
83.6 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎doc/rpython-ctypes-stackless.png‎

Copy file name to clipboard
95.1 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎doc/rpython-javascript.png‎

Copy file name to clipboard
101 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎examples-android/androidGLES1.py‎

Copy file name to clipboard
+125Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#!/usr/bin/python
2+
import os,sys, time
3+
4+
if '..' not in sys.path: sys.path.append( '..' )
5+
import rpythonic
6+
rpythonic.set_pypy_root( '../../pypy' )
7+
rpythonic.set_android_sdk_root( '../../android-sdk-linux_x86/' )
8+
rpythonic.set_android_ndk_root( '../../android-ndk-r5/' )
9+
rpy = rpythonic.RPython('android')
10+
11+
gl = rpy.rimport( 'GLES', namespace=globals() )
12+
e = rpy.rimport( 'EGL' )
13+
glue = rpy.rimport('android_native_app_glue')
14+
15+
## API ##
16+
get_app_state = rffi.llexternal('rpythonic_get_app_state', [], lltype.Ptr(glue.android_app) )
17+
setup_glue = rffi.llexternal('rpythonic_setup_glue', [ lltype.Ptr(glue.android_app) ], rffi.VOIDP )
18+
swap_buffers = rffi.llexternal('rpythonic_swap_buffers', [ rffi.VOIDP ], rffi.INT )
19+
mainloop = rffi.llexternal('rpythonic_mainloop', [ rffi.VOIDP ], lltype.Void )
20+
21+
#/*
22+
# * Send a simple string to the log.
23+
# */
24+
#int __android_log_write(int prio, const char *tag, const char *text);
25+
log = rffi.llexternal('__android_log_write', [ rffi.INT, rffi.CCHARP, rffi.CCHARP ], rffi.INT )
26+
def rprint( s, tag='rpythonic' ): log( 5, tag, s ) # 3 is debug level, 4 is info level, 5 is warn level
27+
28+
29+
def reset_viewport( width, height ):
30+
ratio = float( width ) / float( height )
31+
glViewport(0, 0, width, height)
32+
33+
glMatrixMode(GL_PROJECTION);
34+
glLoadIdentity();
35+
36+
#/* Set our perspective */
37+
#gluPerspective(45.0, ratio, 0.1, 100.0);
38+
39+
#/* Make sure we're chaning the model view and not the projection */
40+
glMatrixMode(GL_MODELVIEW);
41+
42+
#/* Reset The View */
43+
glLoadIdentity();
44+
45+
46+
def redraw_callback():
47+
vec3_t = rffi.CFixedArray( rffi.DOUBLE, 3 )
48+
vec4_t = rffi.CFixedArray( rffi.DOUBLE, 4 )
49+
colors_t = rffi.CFixedArray( vec4_t, 4 )
50+
verts_t = rffi.CFixedArray( vec3_t, 4 )
51+
52+
colors = lltype.malloc( colors_t, flavor='raw' )
53+
verts = lltype.malloc( verts_t, flavor='raw' )
54+
for i in range(4):
55+
colors[i][0] = 1.0
56+
if i==0: verts[i][1] = 1.0
57+
elif i==1: verts[i][0] = -1.0; verts[i][1] = -1.0
58+
elif i==2: verts[i][0] = 1.0; verts[i][1] = -1.0
59+
60+
61+
width = 320; height = 240
62+
63+
#/* Enable smooth shading */
64+
glShadeModel(GL_SMOOTH);
65+
66+
#/* Set the background black */
67+
glClearColor(0.0, 0.0, 0.0, 0.0);
68+
69+
#/* Depth buffer setup */
70+
glClearDepthf(1.0);
71+
72+
#/* Enables Depth Testing */
73+
glEnable(GL_DEPTH_TEST);
74+
75+
#/* The Type Of Depth Test To Do */
76+
glDepthFunc(GL_LEQUAL);
77+
#/* Really Nice Perspective Calculations */
78+
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
79+
80+
reset_viewport( width, height )
81+
82+
for i in range( 1000 ):
83+
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT )
84+
85+
#/* Enable COLOR and VERTEX arrays */
86+
glEnableClientState(GL_COLOR_ARRAY);
87+
glEnableClientState(GL_VERTEX_ARRAY);
88+
89+
#/* Setup pointers to COLOR and VERTEX arrays */
90+
glColorPointer(4, GL_FLOAT, 0, colors);
91+
glVertexPointer(3, GL_FLOAT, 0, verts);
92+
#glColorPointer(4, GL_DOUBLE, 0, colors); # no GL_DOUBLE on Android?
93+
#glVertexPointer(3, GL_DOUBLE, 0, verts);
94+
95+
#/* Move Left 1.5 Units And Into The Screen 6.0 */
96+
glLoadIdentity();
97+
glTranslatef(-1.5, 0.0, -6.0);
98+
glDrawArrays(GL_TRIANGLES, 0, 3);
99+
100+
swap_buffers( engine )
101+
time.sleep(0.01)
102+
103+
104+
@rpy.standalone
105+
def myentrypoint( _app_ ):
106+
#app = rffi.cast( lltype.Ptr(glue.android_app), _app_ )
107+
for i in range(10):
108+
rprint( 'please work' )
109+
110+
app = get_app_state()
111+
engine = setup_glue( app )
112+
113+
#display, context, surface = setup_egl( app )
114+
#rpy.engine.setup_display()
115+
116+
mainloop( engine )
117+
118+
119+
120+
pak = rpy.compile()
121+
print( pak.apk )
122+
pak.upload()
123+
print( 'logcat?' )
124+
if raw_input().strip(): pak.logcat()
125+
Collapse file

‎examples-android/android_helloworld.py‎

Copy file name to clipboard
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os, sys, time
2+
sys.path.append('..')
3+
import rpythonic
4+
rpythonic.set_pypy_root( '../../pypy' )
5+
rpythonic.set_android_sdk_root( '../../android-sdk-linux_x86/' )
6+
rpythonic.set_android_ndk_root( '../../android-ndk-r5b/' )
7+
rpy = rpythonic.RPython('android')
8+
9+
@rpy.standalone
10+
def main():
11+
rpy.setup_display()
12+
13+
14+
package = rpy.compile()
15+
print( package.apk )
16+
17+
18+

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.