Home > Programming > C Programming Language
Ex11 An Erlang GUI Joe Armstrong joe@sics.se
Sort Desciption:Help wanted I'm very bad at C++/GUI programming. Acknowledgements:. Tobbe first version of ex11 Proof of concept. Tony added many features ...
Content Inside:Ex11 An Erlang GUI Joe Armstrong joe@sics.sePage 11Ex11 An Erlang GUIJoe Armstrongjoe@sics.sePage 22Why? No good GUIs for ErlangErlang's message passing maps well onto XProtocol messagesWindows/widgets are concurrent but this factis not reflected in the API'sFunPage 33Interfacing Erlang to X widowsExternal Port processX serverEtermprotocol Erlang VMX protocol Marshall/unmarshall codeXlib/CErlangErlang VMErlangX serverX protocol Page 44Interfacing Erlang to X widows+ Efficient+ All code in Erlang Must reimplement a significant subsectionof xlib and make something like athenawidgets or motifPage 55Interfacing Erlang to X widowsXlib is complexThe X Protocol is simpleYou don't need all of the X protocol to douseful stuffAthena Xtoolkits Motif are complex butunecessarily soPage 66X PrototocolPort 6000 socket based TCP/IP protocol(or unix domain sockets)154 protocol message (mostly very simple)XlibLots of routines (800 ish) Why the mismatch? bad concurrency modelPage 77ex11_lib.erl... 50 odd protocol messages ...ePolyText8(Drawable GC X Y Str) >Len = length(Str)Delta = 2BStr = list_to_binary(Str)B = <<Len:8Delta:8 BStr/binary>>req(74 <<Drawable:32 GC:32 X:16 Y:16 B/binary>>).ePutImage(Draw GC Width Ht X Y Pad Depth Data) >req(72 2 <<Draw:32GC:32Width:16Ht:16X:16Y:16P ad:8Depth:80:16Data/binary>>).Page 88Widgetsstart() >spawn_link(fun win/0).win() >Display = xStart("3.2")Win= swTopLevel:make(Display350145?bg)Label1 = swLabel:make(Win1010220300?cornsilkFirst name:")Entry1 = swEntry:make(Win14010120 "Peg leg")Label2 = swLabel:make(Win106022030?cornsilk "Last name:")Entry2 = swEntry:make(Win14060120"Loombucket&q uot;)Button = swButton:make(Win1010012030?grey88 "Swap")Button ! {onClick fun(X) >Val1 = Entry1 !! readVal2 = Entry2 !! readEntry1 ! {set Val2}Entry2 ! {set Val1}end}loop().Page 99Higher order WidgetsDragBar = swDragBox:make(WinXY...)Rectangle = swRectangle:make(Win ...
Source: www.erlang.se
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Related Files
Programming in C C++ Java
Filed under: Programming and C Programming LanguageProgramming in C C++ Java. Course Overview. Object oriented programming languages are widely used for the development of complex software systems. ...
C Programming
Filed under: Programming and C Programming LanguageThe C Programming Language ANSI C. By Brian W. C. Kernighan & Dennis M. Ritchie. K and R. "Practical C programming". By Steve ...
An Overview of the C++ Programming Language
Filed under: Programming and C Programming LanguageThe C++ programming language provides a model of memory and computation that ... 3 The C Programming Model presents the C subset of C++ and other C++ ...
C Programming Fundamentals
Filed under: Programming and C Programming Language1 C Programming Fundamentals C is a compiled language. The user creates source code (often ... exe extension). Below is typical C program called LED.C that illustrates some fundamental C ...
Essential C
Filed under: Programming and C Programming LanguageC Programming Language (below) as part of their research at AT&T. Unix and C++ ... The C Programming Language 2nd ed. by Kernighan and Ritchie. ...
