Permalink
Browse files

import ubf-1.11.tgz

  • Loading branch information...
1 parent 580fb80 commit 3d1086071e48f47099add8933625308321a5a7dd @norton norton committed Apr 11, 2009
Showing with 1,173 additions and 4,310 deletions.
  1. +0 −1 .#plugins.erl
  2. +19 −1 ReadMe
  3. +0 −22 ReadMeLuke
  4. BIN bug.beam
  5. +92 −6 bug.erl
  6. BIN client.beam
  7. +8 −40 client.erl
  8. +1 −1 contract.hrl
  9. +2 −4 contract.xrl
  10. +33 −26 contract.yrl
  11. BIN contract_lex.beam
  12. +0 −728 contract_lex.erl
  13. BIN contract_manager.beam
  14. +21 −103 contract_manager.erl
  15. BIN contract_parser.beam
  16. +24 −21 contract_parser.erl
  17. BIN contract_yecc.beam
  18. +0 −668 contract_yecc.erl
  19. BIN contracts.beam
  20. +19 −10 contracts.erl
  21. +32 −22 doc/site/eserve.html
  22. +53 −38 doc/site/file.html
  23. +44 −55 doc/site/irc.html
  24. +47 −24 doc/site/quick.html
  25. +44 −55 doc/site/ubfb.html
  26. +6 −19 doc/site/ubfc.html
  27. +0 −32 doc/src/Makefile~
  28. +0 −35 doc/src/downloads.ehtml~
  29. +0 −75 doc/src/eserver.ehtml~
  30. +0 −32 doc/src/file.ehtml~
  31. +0 −21 doc/src/ftp.ehtml~
  32. +0 −66 doc/src/home.ehtml~
  33. +0 −103 doc/src/irc.ehtml~
  34. +0 −24 doc/src/javac.ehtml~
  35. +0 −128 doc/src/layout.mac~
  36. +0 −31 doc/src/menus.inc~
  37. +0 −35 doc/src/messagebox.ehtml~
  38. +29 −10 doc/src/quick.ehtml
  39. +0 −75 doc/src/quick.ehtml~
  40. +0 −149 doc/src/ubfa.ehtml~
  41. +0 −102 doc/src/ubfa_quick.ehtml~
  42. +0 −19 doc/src/ubfa_quick.erl~
  43. +0 −103 doc/src/ubfb.ehtml~
  44. +0 −102 doc/src/ubfb_quick.ehtml~
  45. +7 −19 doc/src/ubfc.ehtml
  46. +0 −103 doc/src/ubfc.ehtml~
  47. +0 −179 doc/src/white.ehtml~
  48. BIN file_client.beam
  49. +3 −2 file_client.erl
  50. BIN file_plugin.beam
  51. +0 −1 file_plugin.buc
  52. +18 −14 file_plugin.con
  53. +34 −24 file_plugin.erl
  54. BIN find.beam
  55. +3 −0 find.erl
  56. BIN irc_client.beam
  57. +3 −3 irc_client.erl
  58. BIN irc_client_gs.beam
  59. +6 −5 irc_client_gs.erl
  60. BIN irc_plugin.beam
  61. +0 −1 irc_plugin.buc
  62. +44 −55 irc_plugin.con
  63. +54 −44 irc_plugin.erl
  64. BIN leex.beam
  65. BIN mods.beam
  66. +0 −594 nohup.out
  67. BIN plugin_handler.beam
  68. +19 −27 plugin_handler.erl
  69. BIN proc_socket_server.beam
  70. BIN server.beam
  71. +0 −57 server.con.old
  72. +3 −2 server.erl
  73. BIN server_plugin.beam
  74. +0 −1 server_plugin.buc
  75. +19 −25 server_plugin.con
  76. +105 −14 server_plugin.erl
  77. BIN test.beam
  78. +9 −4 test.erl
  79. BIN test_plugin.beam
  80. +0 −1 test_plugin.buc
  81. +45 −29 test_plugin.con
  82. +35 −34 test_plugin.erl
  83. +0 −71 ubf-java-0.2/src/ubf/irc1/IRCClient.java
  84. +1 −1 {ubf-java-0.2 → ubf-java-0.3}/Makefile
  85. +9 −0 ubf-java-0.3/irc_client.sh
  86. 0 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/InteractiveClient.java
  87. +21 −11 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBF.java
  88. 0 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBFAtom.java
  89. +123 −0 ubf-java-0.3/src/ubf/UBFClient.java
  90. +2 −2 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBFDecoder.java
  91. 0 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBFEncoder.java
  92. +8 −0 ubf-java-0.3/src/ubf/UBFEventHandler.java
  93. 0 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBFException.java
  94. 0 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBFInteger.java
  95. +0 −1 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBFList.java
  96. 0 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBFObject.java
  97. 0 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBFString.java
  98. 0 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBFTest.java
  99. 0 {ubf-java-0.2 → ubf-java-0.3}/src/ubf/UBFTuple.java
  100. +128 −0 ubf-java-0.3/src/ubf/irc1/IRCClient.java
  101. BIN ubf.beam
  102. BIN ubf_driver.beam
  103. BIN ubf_test.beam
  104. BIN ubf_utils.beam
View
View
20 ReadMe
@@ -96,4 +96,22 @@ Client RPC are perfomed with
Plugin:handle_rpc(State1, Q, handerState(), Env) ->
{reply, Val, State2, Data2}
-When
+...
+
+ Try this
+
+ set the environment variable WHERE to $HOME
+
+ ./irc_server in one window
+
+ ./irc_client "luke" in window 1
+ ./irc_client "fred" in window 2
+
+ Look in irc_clinet.erl
+ irc_plugin.erl
+ irc_plugin.con
+
+ If it doesn't work the paths aren't picking up the code
+
+
+ (mail me if you have problems with cc:joe.armstrong@telia.com)
View
@@ -1,22 +0,0 @@
-
- Hi Luke
-
- Try this
-
- set the environment variable WHERE to $HOME
-
- ./irc_server in one window
-
- ./irc_client "luke" in window 1
- ./irc_client "fred" in window 2
-
- Look in irc_clinet.erl
- irc_plugin.erl
- irc_plugin.con
-
- If it doesn't work the paths aren't picking up the code
-
-
- /Joe
-
- (mail me if you have problems with cc:joe.armstrong@telia.com)
View
BIN bug.beam
Binary file not shown.
View
98 bug.erl
@@ -1,11 +1,97 @@
-module(bug).
-compile(export_all).
+-import(client, [rpc/2]).
+
+
+-define(S(X), {'#S',X}).
+s(X) -> {'#S', X}.
+
+batch([Name]) ->
+ start(atom_to_list(Name)),
+ erlang:halt().
+
+start(Nick) ->
+ {ok, Pid, Name} = client:connect("localhost", 2000),
+ {reply,{ok,_}, _} = rpc(Pid, {startService, "irc_server", []}),
+ client:install_handler(Pid, fun print_msg/1),
+ {reply, _, _} = rpc(Pid, logon),
+ case rpc(Pid, {nick, s(Nick)}) of
+ {reply, false, _} ->
+ client:stop(Pid);
+ {reply, true, active} ->
+ {reply,_,_} = rpc(Pid, {join, s("erlang")}),
+ loop(Pid, "erlang", ["erlang"], Nick)
+ end,
+ io:format("client stops~n").
+
+loop(Pid, Group, Gs, Nick) ->
+ io:format("Status: Nick=~s Group=~s Joined groups=~p~n",[Nick, Group, Gs]),
+ case io:get_line('> ') of
+ "\\" ++ T ->
+ case string:tokens(T, "\s\n\t\r") of
+ ["group",G] ->
+ loop(Pid, G, Gs, Nick);
+ ["ls"] ->
+ {reply, G, _} = rpc(Pid, groups),
+ io:format("Groups=~p~n",[G]),
+ loop(Pid, Group, Gs, Nick);
+ ["join", G] ->
+ {reply, _, _} = rpc(Pid, {join, s(G)}),
+ loop(Pid, Group, [G|Gs], Nick);
+ ["leave", G] ->
+ rpc(Pid, {leave, s(G)}),
+ Gs1 = lists:delete(G, Gs),
+ loop(Pid, Group, [G|Gs], Nick);
+ ["nick", N] ->
+ case rpc(Pid, {nick, s(N)}) of
+ {reply, nickInUse, _} ->
+ loop(Pid, Group, Gs, Nick);
+ {reply, nickChanged, active} ->
+ loop(Pid, "erlang", ["erlang"], N)
+ end;
+ ["quit"] ->
+ client:stop(Pid),
+ true;
+ _ ->
+ %% io:format("OOPs:~p~n",[X]),
+ banner(),
+ loop(Pid, Group, Gs, Nick)
+
+ end;
+ Msg ->
+ case rpc(Pid, {msg, s(Group), s(Msg)}) of
+ {reply, R,_} ->
+ loop(Pid, Group, Gs, Nick);
+ {error, stop, stop} ->
+ io:format("The server died :-(~n")
+ end
+ end.
+
+banner() ->
+ io:format("\\group G -- change to group G\n"
+ "\\ls -- list groups\n"
+ "\\nick N -- change nick to N\n"
+ "\\join G -- join G\n"
+ "\\leave G -- leave G\n"
+ "\\quit -- quit\n"
+ "Msg -- send msg with current N to G\n").
+
+print_msg(X) ->
+ case ubf:deabstract(X) of
+ {joins, Who, Group} ->
+ io:format("~s joins the group ~s~n",[Who, Group]);
+ {leaves, Who, Group} ->
+ io:format("~s leaves the group ~s~n",[Who, Group]);
+ {msg, Who, Group, Msg} ->
+ io:format("Msg from ~s to ~s => ~s~n",[Who, Group,Msg]);
+ {changesName, Old, New, Group} ->
+ io:format("~s is now called ~s in group ~s~n",
+ [Old, New, Group]);
+ Other ->
+ io:format("==> ~p~n",[Other])
+ end,
+ fun print_msg/1.
+
-test() ->
- match([[123,[]]]).
-match( [ [H1,H2|T] | Stack]) ->
- {ok, H1, H2, T, Stack};
-match(C) ->
- nomatch.
View
Binary file not shown.
View
@@ -7,16 +7,15 @@
%% stop(Pid) -> ack.
-export([connect/2, rpc/2, stop/1, install_default_handler/1,
- info/1, services/1, install_handler/2, start/2]).
+ install_handler/2]).
-import(ubf_utils, [spawn_link_debug/2]).
-import(lists, [reverse/1]).
-s(X) ->
- {'#S', X}.
+%% s(X) -> {'#S', X}.
debug(F, S) -> true.
-%% debug(F, S) -> io:format(F, S).
+%%debug(F, S) -> io:format(F, S).
connect(Host, Port) ->
Self = self(),
@@ -76,23 +75,6 @@ rpc(Pid, Q) ->
Reply
end.
-info(Pid) -> meta(Pid, info).
-decription(Pid) -> meta(Pid, description).
-services(Pid) -> meta(Pid, services).
-start(Pid, Service) -> meta(Pid, {start, s(Service)}).
-contract(Pid) -> meta(Pid, contract).
-
-
-meta(Pid, Q) ->
- Pid ! {self(), {meta, Q}},
- receive
- {Pid, Reply} ->
- debug(">>> client META (~p)~n"
- "<<< ~p ~n",[Q, Reply]),
- Reply
- end.
-
-
install_default_handler(Pid) ->
install_handler(Pid, fun drop_fun/1).
@@ -117,30 +99,16 @@ loop(Driver, Fun) ->
loop(Driver, Fun1);
{From, {rpc, Q}} ->
%% rpc
- Driver ! {self(), {rpc, Q}},
+ Driver ! {self(), Q},
receive
- {Driver, {rpcReply, R, S}} ->
+ {Driver, {R, S}} ->
From ! {self(), {reply, R, S}},
loop(Driver, Fun);
{Driver, {error, X}} ->
- From ! {self(), {error, X}}
+ From ! {self(), {error, X}};
+ {Driver, Other} ->
+ From ! {self(), {error, Other}}
end;
- {From, {meta, Q}} ->
- Driver ! {self(), Q},
- receive
- {Driver, Reply} ->
- From ! {self(), Reply}
- end,
- loop(Driver, Fun);
- {From, P={startService, Name, Reply}} ->
- Driver ! {self(), P},
- receive
- {Driver, {accept, Val, State}} ->
- From ! {self(), {ok, Val, State}};
- {Driver, {reject, Reason}} ->
- From ! {self(), {error, Reason}}
- end,
- loop(Driver, Fun);
{'EXIT', Driver, _} ->
wait_terminate();
{Driver, {event, Msg, State}} ->
View
@@ -1,3 +1,3 @@
--record(contract, {name, vsn, info, services, description,types,transitions}).
+-record(contract, {name, vsn, types,transitions, anystate}).
View
@@ -17,13 +17,11 @@ Rules.
false -> {atom,YYline,Atom}
end}.
VSN : {token,{vsn, YYline}}.
-TYPE : {token,{typeKwd,YYline}}.
+TYPES : {token,{typeKwd,YYline}}.
STATE : {token,{state,YYline}}.
+ANYSTATE : {token,{anystate,YYline}}.
EVENT : {token,{event,YYline}}.
NAME : {token,{name,YYline}}.
-INFO : {token,{info,YYline}}.
-DESCRIPTION : {token,{description,YYline}}.
-SERVICES : {token,{services,YYline}}.
"[^"]*" : S = lists:sublist(YYtext, 2, length(YYtext) - 2),
{token,{string,YYline,S}}.
=> : {token,{'=>',YYline}}.
View
@@ -1,32 +1,32 @@
Nonterminals
-transitions transition outputs typeAndState strings
-form type orType annotatedType primType annotation typeSeq.
+anyrules anyrule annotation
+transitions transition outputs types responseAndState strings
+form type typeDef typeRef primType typeSeq.
Terminals
-info description event vsn atom services
+event vsn atom anystate
name integer string typeKwd state
-':' '+' '|' '=' '{' '}' '&' ';' ',' '.' '[' ']' '(' ')' '=>' dot.
+ '+' '|' '=' '{' '}' '&' ';' ',' '.' '[' ']' '(' ')' '=>' dot.
Rootsymbol form.
-form -> '+' name '(' string ')' dot: {name, unwrap('$4')}.
-form -> '+' vsn '(' string ')' dot : {vsn, unwrap('$4')}.
-form -> '+' typeKwd atom '(' ')' '=' type dot : {type, {unwrap('$3'), '$7'}}.
-form -> '+' state atom transitions dot: {transition, {unwrap('$3'), '$4'}}.
-form -> '+' info '(' string ')' dot: {info, unwrap('$4')}.
-form -> '+' description '(' string ')' dot: {description, unwrap('$4')}.
-form -> '+' services '(' strings ')' dot: {services, '$4'}.
+form -> '+' name '(' string ')' dot : {name, unwrap('$4')}.
+form -> '+' vsn '(' string ')' dot : {vsn, unwrap('$4')}.
+form -> '+' typeKwd types dot : {types, '$3'}.
+form -> '+' state atom transitions dot : {transition, {unwrap('$3'), '$4'}}.
+form -> '+' anystate anyrules dot : {anystate, '$3'}.
-type -> annotatedType orType : eor('$1', '$2').
+types -> typeDef ';' types : ['$1'|'$3'].
+types -> typeDef : ['$1'].
-orType -> '|' annotatedType orType : eor('$2', '$3').
-orType -> '$empty' : nil.
+typeDef -> atom '(' ')' '=' type annotation: {unwrap('$1'), '$5', '$6'}.
-annotatedType -> atom ':' ':' primType : '$4'.
-annotatedType -> primType : '$1'.
+annotation -> string : unwrap('$1').
+annotation -> '$empty' : "".
-annotation -> atom : unwrap('$1').
+type -> primType '|' type : eor('$1', '$3').
+type -> primType : '$1'.
primType -> atom '(' ')' : {prim, unwrap('$1')}.
primType -> '{' typeSeq '}' : {tuple, '$2'}.
@@ -39,28 +39,35 @@ primType -> string : {string, unwrap('$1')}.
typeSeq -> type : ['$1'].
typeSeq -> type ',' typeSeq : ['$1'|'$3'].
+typeRef -> atom '(' ')' : {prim, unwrap('$1')}.
+
transitions -> transition ';' transitions: ['$1'|'$3'].
-transitions -> transition : ['$1'].
+transitions -> transition : ['$1'].
+
+transition -> typeRef '=>' outputs : {input, '$1', '$3'}.
+transition -> event '=>' typeRef : {event, '$3'}.
+
+outputs -> responseAndState '|' outputs: ['$1'|'$3'].
+outputs -> responseAndState : ['$1'].
-transition -> type '=>' outputs: {input, '$1', '$3'}.
-transition -> event '=>' type : {event, '$3'}.
+responseAndState -> typeRef '&' atom : {output, '$1', unwrap('$3')}.
-outputs -> typeAndState '|' outputs: ['$1'|'$3'].
-outputs -> typeAndState : ['$1'].
+anyrules -> anyrule ';' anyrules : ['$1'|'$3'].
+anyrules -> anyrule : ['$1'].
-typeAndState -> type '&' atom: {output, '$1', unwrap('$3')}.
+anyrule -> typeRef '=>' typeRef : {'$1', '$3'}.
strings -> string ',' strings : [unwrap('$1')|'$3'].
strings -> string : [unwrap('$1')].
strings -> '$empty' : [].
Erlang code.
+-export([return_error/2]).
eor(X, nil) -> X;
eor(X, Y) -> {alt, X, Y}.
unwrap({V,_}) -> V;
-unwrap({_,_,V}) -> V.
+unwrap({_,_,V}) -> V;
+unwrap(X) -> {oops, X}.
-simplify({Tag,A,nil}) -> A;
-simplify(X) -> X.
View
Binary file not shown.
Oops, something went wrong.

0 comments on commit 3d10860

Please sign in to comment.