From jilani.khaldi@REDACTED Mon Sep 2 00:23:28 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Mon, 02 Sep 2002 00:23:28 +0200 Subject: atom_to_list Message-ID: Hi All, why atom_to_list(abc) gives me 'abc' instead of [97,98,99]? Thanx. jk From kent@REDACTED Mon Sep 2 00:33:20 2002 From: kent@REDACTED (Kent Boortz) Date: 02 Sep 2002 00:33:20 +0200 Subject: atom_to_list In-Reply-To: References: Message-ID: Jilani Khaldi writes: > why atom_to_list(abc) gives me 'abc' instead of [97,98,99]? You probably mean "abc"? It is the same thing, try 1> [97,98,99]. "abc" 2> [97,98,99] == "abc". true Strings in Erlang don't have their own type, it is a list of character codes. The Erlang shell output routines try to output it in a string format if it can but is just guessing, kent From etxuwig@REDACTED Mon Sep 2 10:11:10 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 2 Sep 2002 10:11:10 +0200 (MET DST) Subject: xmerl:export In-Reply-To: <200208301932.30492.mikael.karlsson@creado.com> Message-ID: On Fri, 30 Aug 2002, Mikael Karlsson wrote: >The reason why I like the idea about one single pass was that I >had a vague idea of using xmerl + yaws to export/publish XML >documents written in the Simplified DocBook DTD on the fly. So I >was i bit biased towards performance. One or two extra passes may not even be noticeable. The whole area of performance is tricky, and to really find out what affects it the most, you usually need to experiment and measure. You can, for example, get worse performance by doing everything in a single pass, if it means using complex functions or deep function call chains that make life difficult for the garbage collector and stack management -- not to mention the fact that it really messes with the readability of your code as well. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From bjarne@REDACTED Mon Sep 2 18:26:56 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Mon, 02 Sep 2002 18:26:56 +0200 Subject: Erlang's Garbage Collection References: <000001c25277$d3763340$1c01a8c0@viking> Message-ID: <3D739150.2E505682@erix.ericsson.se> Hello Leandro > Hi > > I'm a member of an Erlang resource team (Viking Tech) > here in Brazil, and I would like to have some > information about Erlang?s Garbage Collection, specially the code. Please contact Bj?rn Gustavsson of the Erlang/OTP unit. I have put him in the c.c. list. Best regards Bjarne From Sean.Hinde@REDACTED Mon Sep 2 16:44:34 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Mon, 2 Sep 2002 15:44:34 +0100 Subject: inets vs. yaws Message-ID: <04D356A3B172D611981B0008C791C3126BF331@imp02mbx.t-mobile.co.uk> inets works fine and is very stable - we use it for lots of stuff. The config files are well documented and Apache like. yaws is lightweight, super fast and cutting edge. APIs are not particularly fixed and it is quite possible there are still bugs. The Docs are falling behind (sorry guys!). But it is darned fast. Take your pick. Sean > -----Original Message----- > From: Jilani Khaldi [mailto:jilani.khaldi@REDACTED] > Sent: 31 August 2002 10:38 > To: erlang-questions@REDACTED > Subject: inets vs. yaws > > > Hi all, > for medium web applications with some dynamic pages what are > the pros and cons of inets and yaws. > One important point is the ease of use. > Thanx. > > -- > Jilani Khaldi > > > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From svg@REDACTED Mon Sep 2 22:02:47 2002 From: svg@REDACTED (Vladimir Sekissov) Date: Tue, 03 Sep 2002 02:02:47 +0600 (YEKST) Subject: ANN: MicroLex - simple lexical scanner Message-ID: <20020903.020247.74755235.svg@surnet.ru> Good day, MicroLex is a simple DFA based lexical scanner. I decided to post it to list in hope to get suggestions and comments. If somebody find it useful I 'm ready to post it to Erlang user contributions list. IMicroLex supports mostly all frequently used lex regexps, predictive operator, long (default) and short regexps. * Grammar MicroLex grammar is a list of rules. Order is significant. If input matches few rules the first in the list is chosen. * Rules Rules have three forms: ** {Class, Regexp, FormatFun} Class - token class Regexp - regular expression FormatFun = Fun(Class, Line, String) Line - current line in input stream String - longest string matched Regexp ** {Class, Regexp, FormatFun, short} The same as above but the shortest string matched Regexp is chosen. ** {Class, Regexp1, '/', Regexp2, FormatFun} Predictive operator. Input matches Regexp1Regexp2 but only the part matched Regexp1 is chosen as token string and buffer position points to the next char after it. * Grammar Example Following simple grammar recognizes integers and floats %% Grammar grammar() -> [{ws, ws(), ?skip}, {float_num, float_num(), fun yeec_token/3}, {integer_num, integer_num(), fun yeec_token/3}]. ws() -> ci(" \t\f"). %%Float %%(+|-)?[0-9]+\.[0-9]+((E|e)(+|-)?[0-9]+)? float_num() -> '@'([integer_num(), c($.),'+'(digit()),'?'('@'([ci("Ee"), integer_num()]))]). integer_num() -> '@'(['?'(ci("+-")), '+'(digit())]). digit() -> ci($0, $9). %% End of Grammar * Regexps MicroLex regexp Lex analog '@'([R1, R2, ...]) R1R2... '|'([R1, R2, ...]) R1|R2|... '*'(R) R* '+'(R) R+ '?'(R) R? '.'() . sol(R) ^R eol(R) R$ btw(From, To, R) R{From, To} c($a) a nc($a) [^a] ci($a, $z) [a-z] ci("abc") [abc] cni($a, $z) [^a-z] cni("abc") [^abc] str("abba") abba * Scanner Scanner can be used in batch mode when the whole input buffer is processed and list of tokens is returned and in continuation style. If rule's format function returns empty list it isn't included to the output. ** Errors On syntax error scanner returns tuple {error, Error}, where Error = {scan, LineNum, Char, Expect, Str} LineNum - line number Char - first unmatched character Expect - character classes grammar expecting at that point Str - last recognized characters It could be formatted to user friendly string with format_error/1. * Examples There are two example grammars mlex_asn1.erl - subset of ASN.1 grammar mlex_freeradius_conf.erl - cshell-like configuration file grammar of FreeRadius package Test files are in 'priv/test' directory. Look also at mlex_test.erl Best Regards, Vladimir Sekissov -------------- next part -------------- A non-text attachment was scrubbed... Name: mlex.tar.gz Type: application/octet-stream Size: 15182 bytes Desc: not available URL: From klacke@REDACTED Mon Sep 2 23:16:57 2002 From: klacke@REDACTED (Klacke) Date: Mon, 2 Sep 2002 23:16:57 +0200 Subject: yaws 0.54 Message-ID: <20020902231657.A22132@bluetail.com> New release (0.54) of yaws at http://yaws.hyber.org Many fixes in the wikiweb by Johan Bevemyr, I'm now running a wikiweb at http://wiki.hyber.org Support for HTTP Basic authentication by Sean Hinde Better support for HTTP file upload by Johan and Sean Support for many more MIME types by compiling a mime.types file by klacke Support for OPTIONS http request by Johan Bevemyr Lots of non ready code for a webmail app by klacke. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From klacke@REDACTED Mon Sep 2 23:25:50 2002 From: klacke@REDACTED (Klacke) Date: Mon, 2 Sep 2002 23:25:50 +0200 Subject: inets vs. yaws In-Reply-To: <04D356A3B172D611981B0008C791C3126BF331@imp02mbx.t-mobile.co.uk>; from Sean.Hinde@t-mobile.co.uk on Mon, Sep 02, 2002 at 03:44:34PM +0100 References: <04D356A3B172D611981B0008C791C3126BF331@imp02mbx.t-mobile.co.uk> Message-ID: <20020902232550.A22323@bluetail.com> On Mon, Sep 02, 2002 at 03:44:34PM +0100, Sean Hinde wrote: > inets works fine and is very stable - we use it for lots of stuff. The > config files are well documented and Apache like. > > yaws is lightweight, super fast and cutting edge. APIs are not particularly > fixed and it is quite possible there are still bugs. The Docs are falling > behind (sorry guys!). But it is darned fast. > The major drawback of yaws (which is also its major strength) is that it is pure erlang and that dynamic pages must be programmed in erlang. It's no rocket science to do a regular cgi interface, but for now all dyncontent must be written in erlang. Hey .. I like that but I know a lot of webdesigners that will have .. ehhh well how shall put this .. "a hard time" grasping the recursion and all the other cool whatnots in erlang. /klacke -- Claes Wikstrom -- Caps lock is nowhere and Alteon WebSystems -- everything is under control http://www.bluetail.com/~klacke cellphone: +46 70 2097763 From tobbe@REDACTED Tue Sep 3 08:18:41 2002 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: 03 Sep 2002 08:18:41 +0200 Subject: ANN: MicroLex - simple lexical scanner In-Reply-To: <20020903.020247.74755235.svg@surnet.ru> References: <20020903.020247.74755235.svg@surnet.ru> Message-ID: Nice ! > If somebody find it > useful I 'm ready to post it to Erlang user contributions list. You should post it regardless. Cheers /Tobbe From sureshsaragadam@REDACTED Tue Sep 3 09:24:28 2002 From: sureshsaragadam@REDACTED (=?iso-8859-1?q?Suresh=20S?=) Date: Tue, 3 Sep 2002 08:24:28 +0100 (BST) Subject: help me in mnesia_session Message-ID: <20020903072428.77118.qmail@web8205.mail.in.yahoo.com> In mnesia_session example there is an example problem in c_session using the make i am tring to compile this example some make file errors r seen even make dev is also returning some errors [root@REDACTED c_session]# make person_ex.o gcc -c -I /usr/local/lib/erlang/lib/ic-4.0.5/include -I /usr/local/lib/erlang/lib/erl_interface-3.2.4/include -I gen_person_files -I gen_session_files person_ex.c -o person_ex.o while i compile this file person_ex.c some errors r coming how any example programme to use mnesia_session using c language , please let me know ________________________________________________________________________ Want to sell your car? advertise on Yahoo Autos Classifieds. It's Free!! visit http://in.autos.yahoo.com From Johan.Garpendahl@REDACTED Tue Sep 3 10:04:30 2002 From: Johan.Garpendahl@REDACTED (Johan Garpendahl) Date: Tue, 3 Sep 2002 10:04:30 +0200 (MET DST) Subject: ANN: Erlang style sheet for a2ps Message-ID: <200209030804.KAA04525@lm6128.lmera.ericsson.se> After seeing the discussion about the MicroLexer I suddenly remembered that I have a style sheet for a2ps that I would like to share. I thought it could be a good idea to beta-test it here before sending it to the a2ps maintainers. Regards, Johan -------------- next part -------------- # Style sheet for erlang # Copyright (c) 2002 Johan Garpendahl # $Id$ # # # This file is part of a2ps. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; see the file COPYING. If not, write to # the Free Software Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # style Erlang is written by "Johan Garpendahl " version is 1.1 documentation is "To be done." end documentation first alphabet is "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_" second alphabet is "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_" case sensitive keywords in Keyword are abs, append_element, apply, atom_to_list, binary_to_float, binary_to_list, binary_to_term, bump_reductions, cancel_timer, check_process_code, concat_binary, date, delete_module, demonitor, disconnect_node, display, element, erase, exit, fault, float_to_list, fun_info, fun_to_list, garbage_collect, get, get_cookie, get_keys, group_leader, halt, hash, hd, info, integer_to_list, is_alive, is_builtin, is_process_alive, length, link, list_to_atom, list_to_binary, list_to_float, list_to_integer, list_to_pid, list_to_tuple, load_module, loaded, localtime, localtime_to_universaltime, make_ref, make_tuple, md5, md5_final, md5_init, md5_update, module_loaded, monitor, monitor_node, node, nodes, now, open_port, phash, pid_to_list, port_close, port_command, port_connect, port_control, port_call, port_info, port_to_list, ports, pre_loaded, process_display, process_flag, process_info, processes, purge_module, read_timer, ref_to_list, register, registered, resume_process, round, self, send_after, set_cookie, setelement, size, spawn, spawn_link, spawn_opt, split_binary, start_timer, statistics, suspend_process, system_flag, system_info, term_to_binary, throw, time, tl, trace, trace_info, trace_pattern, trunc, tuple_to_list, universaltime, universaltime_to_localtime, unlink, unregister, whereis, yield end keywords keywords in Keyword_strong are if, of, receive, after, "case", begin, "end", when, atom, constant, float, integer, list, number, pid, port, reference, tuple, binary, div, rem, band, bor, bxor, bsl, bsr, bnot, catch end keywords optional operators are -> \rightarrow, <- \leftarrow, /([\/][=])/ \neq, == \equiv, =:=, /([+][+])/, /([-][-])/, <<, >>, =< \leq, >= \geq end operators operators are (/(^[-])/ /([a-z][a-zA-Z0-9]*)/ \1 Plain, \2 Keyword_strong), (/([?])/ /([a-zA-Z0-9]*)/ \1 String, \2 String), (/([$])/ /([\\]*.)/ \1 String, \2 String) end operators sequences are % Comment, "'" String "'", C-string end sequences end style From matthias@REDACTED Tue Sep 3 10:48:34 2002 From: matthias@REDACTED (Matthias Lang) Date: Tue, 3 Sep 2002 10:48:34 +0200 Subject: ANN: Erlang style sheet for a2ps In-Reply-To: <200209030804.KAA04525@lm6128.lmera.ericsson.se> References: <200209030804.KAA04525@lm6128.lmera.ericsson.se> Message-ID: <15732.30562.451315.23442@antilipe.corelatus.se> Johan Garpendahl writes: > I have a style sheet for a2ps that I would like to share. > I thought it could be a good idea to beta-test it here before sending > it to the a2ps maintainers. I didn't even know a2ps had pretty printing. Cool. In case I'm not alone in my ignorance about a2ps, here's what I did to install and use the stylesheet: 1. Saved the stylesheet as "erlang.ssh" and copied it to wherever my system keeps the other a2ps stylesheets. (some style sheets which came with a2ps are: c.ssh, sh.ssh, perl.ssh) 2. Invoked a2ps with the --pretty-print option, e.g. a2ps --pretty-print=erlang -o new.ps gth_log.erl One comment: highlit text with underscore characters in it doesn't get printed the way I expected, e.g. '-include_lib' appears with only '-include' bold. Same thing for macros like ?LOG_FILENAME. Matthias From luke@REDACTED Tue Sep 3 11:04:07 2002 From: luke@REDACTED (Luke Gorrie) Date: 03 Sep 2002 11:04:07 +0200 Subject: ANN: Erlang style sheet for a2ps In-Reply-To: <15732.30562.451315.23442@antilipe.corelatus.se> References: <200209030804.KAA04525@lm6128.lmera.ericsson.se> <15732.30562.451315.23442@antilipe.corelatus.se> Message-ID: Matthias Lang writes: > Johan Garpendahl writes: > > > I have a style sheet for a2ps that I would like to share. > > I thought it could be a good idea to beta-test it here before sending > > it to the a2ps maintainers. > > I didn't even know a2ps had pretty printing. Cool. In case I'm not > alone in my ignorance about a2ps, here's what I did to install and use the > stylesheet: Something else that I only found out about recently is Emacs's "ps-print-buffer-with-faces" command, that generates postscript from your buffer with all the same colours. (Do C-u before you call it to print to a file.) To make the colours really come out nicely when printed, I do a bunch of (ps-extend-face ...) tweaks in my .emacs. -Luke From hakan@REDACTED Tue Sep 3 15:27:06 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Tue, 3 Sep 2002 15:27:06 +0200 (MEST) Subject: help me in mnesia_session In-Reply-To: <20020903072428.77118.qmail@web8205.mail.in.yahoo.com> Message-ID: On Tue, 3 Sep 2002, Suresh S wrote: Suresh> some make file errors r seen Suresh> even make dev is also returning some errors [...] Suresh> while i compile this file person_ex.c Suresh> some errors r coming how Ok, you got some errors. Do you mind sharing the error messages with us? /H?kan From sk@REDACTED Tue Sep 3 17:26:35 2002 From: sk@REDACTED (Shriram Krishnamurthi) Date: Tue, 3 Sep 2002 11:26:35 -0400 Subject: PLI 2002 early registration deadline approaching Message-ID: <15732.54443.73045.995646@cs.brown.edu> [This is the last announcement we will send about PLI 2002. Please note that the early registration deadline is just over a week away. We look forward to your participation in the events!] PLI 2002 Principles, Logics, and Implementations of High-Level Programming Languages Early Registration Deadline: SEPTEMBER 12, 2002 Pittsburgh, PA, USA October 3-8, 2002 http://pli2002.cs.brown.edu/ PLI is a confederation of conferences and workshops aimed at the advancement of high-level programming languages. This year, PLI consists of three conferences: ICFP (International Conference on Functional Programming) PPDP (International Conference on Principles and Practice of Declarative Programming) GPCE (Generative Programming and Component Engineering) and seven workshops: Haskell PLAN-X (Programming Languages for XML) Scheme Rule (Rule-Based Programming) VCL (Verification and Computational Logic) Erlang FDPE (Functional and Declarative Programming in Education) The hotel's cut-off date for guaranteed reservations at the group rate is also September 12, 2002, so do register and reserve soon. We look forward to seeing you in Pittsburgh! Shriram Krishnamurthi Publicity Chair PLI 2002 From erikp@REDACTED Tue Sep 3 20:23:23 2002 From: erikp@REDACTED (Erik Pearson) Date: Tue, 3 Sep 2002 11:23:23 -0700 Subject: ANN: Erlang style sheet for a2ps Message-ID: <0D595F5EC57C9D4B800DAF910C3DA98F058CFD@ctsmail1.celtech.com> A good contribution. I'm not a a2ps guru, but I was wondering if the "_" should be mentioned in the 'operators' [a-zA-Z0-9] reg exps. >From erlang.ssh: operators are (/(^[-])/ /([a-z][a-zA-Z0-9]*)/ \1 Plain, \2 Keyword_strong), (/([?])/ /([a-zA-Z0-9]*)/ \1 String, \2 String), (/([$])/ /([\\]*.)/ \1 String, \2 String) end operators --erikp-- -----Original Message----- From: Matthias Lang [mailto:matthias@REDACTED] Subject: Re: ANN: Erlang style sheet for a2ps One comment: highlit text with underscore characters in it doesn't get printed the way I expected, e.g. '-include_lib' appears with only '-include' bold. Same thing for macros like ?LOG_FILENAME. Matthias From Johan.Garpendahl@REDACTED Wed Sep 4 07:44:23 2002 From: Johan.Garpendahl@REDACTED (Johan Garpendahl) Date: Wed, 4 Sep 2002 07:44:23 +0200 (MET DST) Subject: ANN: Erlang style sheet for a2ps In-Reply-To: <0D595F5EC57C9D4B800DAF910C3DA98F058CFD@ctsmail1.celtech.com> (message from Erik Pearson on Tue, 3 Sep 2002 11:23:23 -0700) References: <0D595F5EC57C9D4B800DAF910C3DA98F058CFD@ctsmail1.celtech.com> Message-ID: <200209040544.HAA05246@lm6128.lmera.ericsson.se> Yes, I missed that one. I've probably missed other things as well. Thanks! By the way, try printing with --highlight-level=heavy I'm not quite sure that I really like the feature, but it looks nice :-) Regards, Johan >>>>> "Erik" == Erik Pearson writes: Erik> A good contribution. Erik> I'm not a a2ps guru, but I was wondering if the "_" should be Erik> mentioned in the 'operators' [a-zA-Z0-9] reg exps. Mattias> -----Original Message----- From: Matthias Lang Mattias> [mailto:matthias@REDACTED] Subject: Re: ANN: Erlang style Mattias> sheet for a2ps Mattias> One comment: highlit text with underscore characters in it Mattias> doesn't get printed the way I expected, e.g. '-include_lib' Mattias> appears with only '-include' bold. Same thing for macros like Mattias> ?LOG_FILENAME. From jilani.khaldi@REDACTED Wed Sep 4 15:05:22 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Wed, 04 Sep 2002 15:05:22 +0200 Subject: Installing yaws on Windows Message-ID: Hi All, I wonder if somebody has installed yaws on Windows. How to? Thanks. jilani From Marc.Vanwoerkom@REDACTED Wed Sep 4 17:47:17 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Wed, 4 Sep 2002 17:47:17 +0200 (MEST) Subject: Emacs major mode, IDEs, tools? Message-ID: <200209041547.g84FlH518804@bonsai.fernuni-hagen.de> Hello, I started work on an already existing large Erlang project and wonder what tools are there around that might help me to grasp the existing code. Is there an Emacs mode, syntax highlighting would be a help already? Is there any sophisticated graphical IDE, perhaps an Eclipse extension that is worth trying? The OOP world uses graphical modelers/code generators/ code reengeering tools like Together, ArgoUML, Fujaba.. has anything similiar developed in the world of Erlang? If not why? Does it make less sense or has simply noone done the work so far? Regards, Marc From matthias@REDACTED Wed Sep 4 18:32:13 2002 From: matthias@REDACTED (Matthias Lang) Date: Wed, 4 Sep 2002 18:32:13 +0200 Subject: Emacs major mode, IDEs, tools? In-Reply-To: <200209041547.g84FlH518804@bonsai.fernuni-hagen.de> References: <200209041547.g84FlH518804@bonsai.fernuni-hagen.de> Message-ID: <15734.13709.732859.468452@antilipe.corelatus.se> Marc Ernst Eddy van Woerkom writes: > I started work on an already existing large Erlang > project and wonder what tools are there around that > might help me to grasp the existing code. > Is there an Emacs mode, syntax highlighting would > be a help already? > Is there any sophisticated graphical IDE, perhaps > an Eclipse extension that is worth trying? >From http://www.erlang.org/faq/x617.html#AEN654: 7.7. Is there an Erlang IDE? The "official" development environment for Erlang is Emacs, and there's a special emacs mode for Erlang. This can be found in lib/emacs/erlang.el under the source tree. VI fans may want to try the colouring mode for nedit or the mode for VIM. There is a defunct X IDE for unix systems called "xerl". It isn't worth using. > The OOP world uses graphical modelers/code generators/ > code reengeering tools like Together, ArgoUML, > Fujaba.. has anything similiar developed in the > world of Erlang? > If not why? Does it make less sense or has simply > noone done the work so far? 7.3. Is there a diagram tool for Erlang? Not really, most people use general-purpose diagram tools like xfig. Some people see SDL as the natural way of expressing telecomms problems in diagrams, while Maurice Castro presented some interesting work on an alternative notation at the Erlang User Conference 1999. The first thing many people say is "what about Rose". An Ericsson project took a look at using Rose for Erlang projects, and concluded that it wasn't worth using for a whole host of reasons (you can read Ulf Wiger's post about an investigation into using Rose as much more than just a diagram tool in the mailing list archive. The essential reason for Rose and such not looking promising for use with Erlang is that the way you model a problem in Erlang is rather different to the way you decompose a problem with OO. While you're worrying about processes, gen_servers, asynchronous messages and supervision trees the tool wants to help you with singletons, exceptions, threads and templates. For what it's worth, I generally don't use IDEs or debuggers (well, ok, I occasionally fire up GDB to get a stack backtrace from a core file), but the one time I tend to think "gee, it'd be nice to have a graphical tool" is when trying to reverse engineer someone else's code. Printing out the whole lot and spreading it out on the floor isn't such a bad approach either. You can use the recently-posted a2ps filter to get the keywords highlit ;-) Matt From cyberlync@REDACTED Wed Sep 4 19:08:24 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Wed, 4 Sep 2002 10:08:24 -0700 (PDT) Subject: Emacs major mode, IDEs, tools? In-Reply-To: <200209041547.g84FlH518804@bonsai.fernuni-hagen.de> Message-ID: <20020904170824.91645.qmail@web40202.mail.yahoo.com> Marc, I have an Eclipse plugin I have been working on at erlide.sourceforge.net. It's somewhat usable at the moment. Whats in CVS is coming along nicely. Erlang Projects, Code Help, make support etc. I was expecting to finish up sometime ago but someone broke into my house and stold my computer. As soon as I get another one I will get going on it. I had just finished up the beam file parser for the code completion when my box got taken, fortunatly its all on sourceforge. I expect to be done about a few weeks after I get a new box. As to an erlang emacs mode there is one included in the Erlang/OTP distrobution. Its not bad really. If you would like I also have a syntax file for Jedit around someplace if you use that. Thanks, Eric --- Marc Ernst Eddy van Woerkom wrote: > Hello, > > I started work on an already existing large Erlang > project and wonder what tools are there around that > might help me to grasp the existing code. > > Is there an Emacs mode, syntax highlighting would > be a help already? > > Is there any sophisticated graphical IDE, perhaps > an Eclipse extension that is worth trying? > > The OOP world uses graphical modelers/code > generators/ > code reengeering tools like Together, ArgoUML, > Fujaba.. has anything similiar developed in the > world of Erlang? > If not why? Does it make less sense or has simply > noone done the work so far? > > Regards, > Marc __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From Marc.Vanwoerkom@REDACTED Thu Sep 5 02:31:09 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Thu, 5 Sep 2002 02:31:09 +0200 (MEST) Subject: Emacs major mode, IDEs, tools? In-Reply-To: <15734.13709.732859.468452@antilipe.corelatus.se> (message from Matthias Lang on Wed, 4 Sep 2002 18:32:13 +0200) Message-ID: <200209050031.g850V9U24017@bonsai.fernuni-hagen.de> > From http://www.erlang.org/faq/x617.html#AEN654: > > 7.7. Is there an Erlang IDE? > > 7.3. Is there a diagram tool for Erlang? Dang!, I just did a search for "emacs" on the TOC page of the FAQ and missed these entries. :) I promise to read it fully after this mail session. :) > The essential reason for Rose and such not looking promising for use > with Erlang is that the way you model a problem in Erlang is rather > different to the way you decompose a problem with OO. While you're > worrying about processes, gen_servers, asynchronous messages and > supervision trees the tool wants to help you with singletons, > exceptions, threads and templates. >From that UML stuff only the diagrams for packaging and those interaction diagramms (not unlike Feynman diagramms in particle physics :) came to mind as useful for Erlang. The things you list seem to cover the concurrent programming part of Erlang. How about the functional langage aspects, is there any noteworthy graphical notation for them available? What I have as learning materials for functional (Lisp - Sussman book, Erlang book) and logical languages (Prolog - Clocksin/Mellin) is from the Pascal/C era of the 70ies/80ies, I wonder if I missed modern developments. > file), but the one time I tend to think "gee, it'd be nice to have a > graphical tool" is when trying to reverse engineer someone else's > code. I did my C++ work under Emacs, and used Visual Studio only for debugging and Purify usage. However during my Java work, at one point I switched to use the Jbuilder IDE. The reason was a very large bio informatics project and it turned out the tree view in the IDE allowed for faster navigation through the source tree, the F1 context help gave easier access to the Java Help documentation which is a must for using the large Java class libs. The structure tree view that gave quick navigation to classes, methods and fields was very handy too. Also the search over files was easier. Compare that to a not 100% port of Emacs to Windows. The graphical GUI constructor/designer for Swing UI came handy in for some easy cases as well. At least part of this should be able to do with Emacs as well, but honestly I had not much time to fine tune my Emacs. I had to use what is in a standard Emacs distribution. > Printing out the whole lot and spreading it out on the floor isn't > such a bad approach either. You can use the recently-posted a2ps > filter to get the keywords highlit ;-) I know that it is inevitable to rread all sources at one point. For now I need a quick start. :) Regards, Marc From Marc.Vanwoerkom@REDACTED Thu Sep 5 02:43:18 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Thu, 5 Sep 2002 02:43:18 +0200 (MEST) Subject: Emacs major mode, IDEs, tools? In-Reply-To: <20020904170824.91645.qmail@web40202.mail.yahoo.com> (message from Eric Merritt on Wed, 4 Sep 2002 10:08:24 -0700 (PDT)) Message-ID: <200209050043.g850hIS24369@bonsai.fernuni-hagen.de> > I have an Eclipse plugin I have been working on at > erlide.sourceforge.net. It's somewhat usable at the > moment. Great. My dream would be an Emacs with the graphical elegance of one of the top notch Java IDEs and some of their easy graphical navigation stuff. No idea if that ever materializes. :) > Code Help, make support etc. I was expecting to finish > up sometime ago but someone broke into my house and > stold my computer. As soon as I get another one I will > get going on it. I had just finished up the beam file Shit happens. Sorry for you. > parser for the code completion when my box got taken, What is your experience with Eclipse - I perceived it as Meta IDE (similiar to Suns Netbeans) - is it easy to build Erlang support for it? Do I needa special Eclipse Version to run your stuff? Regards, Marc From vlad_dumitrescu@REDACTED Thu Sep 5 06:37:48 2002 From: vlad_dumitrescu@REDACTED (Vlad Dumitrescu) Date: Thu, 5 Sep 2002 06:37:48 +0200 Subject: Emacs major mode, IDEs, tools? References: <200209050043.g850hIS24369@bonsai.fernuni-hagen.de> Message-ID: Hi, There are also tools for Emacs that will provide some of the stuff you mention: tree view of the code, quick navigation, mm. Most of them are at cedet.sourceforge.net and there is an Erlang semantic mode by Vladimir Sekissov (look in the archive of this mailing list, I think) And there is also the brand new Distel 3.0, just announced. I couldn't make it work properly on Windows yet, but the part that works is excellent. best regards, Vlad From jch@REDACTED Thu Sep 5 08:28:54 2002 From: jch@REDACTED (Jenny Dybedahl) Date: 05 Sep 2002 08:28:54 +0200 Subject: Emacs major mode, IDEs, tools? In-Reply-To: <200209041547.g84FlH518804@bonsai.fernuni-hagen.de> References: <200209041547.g84FlH518804@bonsai.fernuni-hagen.de> Message-ID: Marc Ernst Eddy van Woerkom writes: > The OOP world uses graphical modelers/code generators/ > code reengeering tools like Together, ArgoUML, > Fujaba.. has anything similiar developed in the > world of Erlang? > If not why? Does it make less sense or has simply > noone done the work so far? Others have already answered the Emacs questions. I'd just like to add that I've found TCM (http://www.cs.utwente.nl/~tcm/) very useful for drawing state diagrams when working on an Erlang project. IMO it's much better than xfig for that purpose. -- "I live in the heart of the machine. We are one." From martin@REDACTED Thu Sep 5 02:24:49 2002 From: martin@REDACTED (martin j. logan) Date: Wed, 04 Sep 2002 19:24:49 -0500 Subject: Some mnesia subscription problems. Message-ID: <3D76A451.4030202@vailsys.com> Hello All, I have an interesting problem with mnesia:subscribe/1. Perhaps someone could explain this to me. Inf = mnesia:system_info(is_running), Sub = mnesia:subscribe(system), io:format("~n~n* Result of subscription ~p ~n Is node running? ~p~n~n", [Sub, Inf]), Result of subscription {error,{node_not_running, 'martin_cdr_mapper_rel@REDACTED'}} Is node running? yes Can anyone tell me how this can exist? Thanks alot, Martin From hakan@REDACTED Thu Sep 5 09:34:02 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 5 Sep 2002 09:34:02 +0200 (MEST) Subject: Some mnesia subscription problems. In-Reply-To: <3D76A451.4030202@vailsys.com> Message-ID: On Wed, 4 Sep 2002, martin j. logan wrote: martin> I have an interesting problem with mnesia:subscribe/1. Perhaps someone martin> could explain this to me. martin> martin> Inf = mnesia:system_info(is_running), martin> Sub = mnesia:subscribe(system), martin> io:format("~n~n* Result of subscription ~p ~n Is node running? ~p~n~n", martin> [Sub, Inf]), martin> martin> Result of subscription {error,{node_not_running, martin> 'martin_cdr_mapper_rel@REDACTED'}} martin> Is node running? yes If you run the code above while Mnesia is shutting down, the result is expected. But if it happens at other occations it looks like a bug. /H?kan From cyberlync@REDACTED Thu Sep 5 14:36:06 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 5 Sep 2002 05:36:06 -0700 (PDT) Subject: Emacs major mode, IDEs, tools? In-Reply-To: <200209050043.g850hIS24369@bonsai.fernuni-hagen.de> Message-ID: <20020905123606.53114.qmail@web40209.mail.yahoo.com> > What is your experience with Eclipse - I perceived > it > as Meta IDE (similiar to Suns Netbeans) - is it easy > > to build Erlang support for it? Its kinda like a lightweight version of netbeans. Eclipse support was not difficult at all really. Once you have a handle on the API is pretty simple to add new languages. The only thing that becomes a problem is the SWT doesn't really behave like an GCed OO toolkit should. There are allot of classes that you cannot subclass, you have to dispose your classes manually etc. Fortunatly, once you get passed the inconsistancies its not to difficult. Another issue (though not really a problem really) is the shear number of APIs available to a plugin developer. It takes awhile to learn each one. > Do I needa special Eclipse Version to run your > stuff? Eclipse >= 2.0 Java >= 1.4 The only thing that really needs java 1.4 are some of the regexps I use. If the 1.4 dependency becomes an issue I will simply remove the built in regexps and use jakarta rexexp package or perhaps oro. I would really like to avoid further library dependencies though, so we will see what happens. Thanks, Eric __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From bjarne@REDACTED Thu Sep 5 15:08:14 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Thu, 05 Sep 2002 15:08:14 +0200 Subject: PLI 2002 early registration deadline approaching Message-ID: <3D77573E.B2E7A2CC@erix.ericsson.se> Please note that there is an Erlang workshop too ! Bjarne -------------- next part -------------- An embedded message was scrubbed... From: Shriram Krishnamurthi Subject: PLI 2002 early registration deadline approaching Date: Tue, 3 Sep 2002 11:26:35 -0400 Size: 3859 URL: From luke@REDACTED Thu Sep 5 18:07:00 2002 From: luke@REDACTED (Luke Gorrie) Date: 05 Sep 2002 18:07:00 +0200 Subject: Emacs major mode, IDEs, tools? In-Reply-To: <200209050031.g850V9U24017@bonsai.fernuni-hagen.de> References: <200209050031.g850V9U24017@bonsai.fernuni-hagen.de> Message-ID: Marc Ernst Eddy van Woerkom writes: > The reason was a very large bio informatics project > and it turned out the tree view in the IDE allowed for > faster navigation through the source tree, the > F1 context help gave easier access to the Java Help > documentation which is a must for using the large > Java class libs. Not as similar as the Cedet tree view that Vlad mentioned, but Distel lets you navigate by jumping from a function call to that function's definition (and back again) in Emacs, like "tags" but without needing a TAGS file. If you use source code for documentation, this is also an online help system. ;-) Cheers, Luke From cyberlync@REDACTED Thu Sep 5 18:17:56 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Thu, 5 Sep 2002 09:17:56 -0700 (PDT) Subject: Emacs major mode, IDEs, tools? In-Reply-To: <200209051251.g85CpL906734@bonsai.fernuni-hagen.de> Message-ID: <20020905161756.11343.qmail@web40210.mail.yahoo.com> > > The only thing that becomes a problem > > is the SWT doesn't really behave like an GCed OO > > toolkit should. There are allot of classes that > you > > cannot subclass, you have to dispose your classes > > manually etc. Fortunatly, once you get passed the > > inconsistancies its not to difficult. Another > issue > > (though not really a problem really) is the shear > > number of APIs available to a plugin developer. It > > takes awhile to learn each one. > > Interesting. > Would it possible to add a graph layout engine on > top of some canvas widget? - I mean I would be very > surprised if the SWT would not allow to roll > customized graphical panels. You may subclass a canvas type widget. Its just that you can't arbitrarily subclass any widget. For example, you may not subclass the 'Dialog' widget and come up with your own dialog class. You either have to use an existing class or build your own dialog from scratch. I personally don't like having to figure out what I may subclass and what I may not. > > > Do I needa special Eclipse Version to run your > > > stuff? > > > > Eclipse >= 2.0 > > Java >= 1.4 > > Hmrbl. I use FreeBSD and Windows ME at home. > I'm not sure if there is any 1.4 JDK in the FreeBSD > ports > collection (Linux or FreeBSD binaries) and the non > NT > technology variants of Windows have their quirks > with > Java. Your not the first to have this problem. I think I will stop using the built in 1.4 regexps and just use the jakarta regexp library. That should allow this to be used with Java >= 1.2. There is no what I am going back to 1.0 or 1.1, sorry. Thanks, Eric __________________________________________________ Do You Yahoo!? Yahoo! Finance - Get real-time stock quotes http://finance.yahoo.com From matthias@REDACTED Fri Sep 6 09:59:14 2002 From: matthias@REDACTED (Matthias Lang) Date: Fri, 6 Sep 2002 09:59:14 +0200 Subject: javascript modules index: tester with IE wanted Message-ID: <15736.24658.885008.810747@antilipe.corelatus.se> Hi, My last beta tester seems to have disappeared, though he claims not to have been put off by IE getting its knickers in a knot and threatening to crash his laptop. Anyway: If you've got a minute and you're running an OS/Browser combination which is NOT linux/mozilla, point your browser at http://www.corelatus.com/~matthias/modules.html and tell me whether it works or not for you. The idea is to type in the start of a library module (e.g. 'mn' gets you mnesia), hit enter and see the man page. You need to have javascript enabled. If it doesn't work, speculation as to why not would be interesting. The searching is done by your browser (i.e. it doesn't use CGI), so it's possible to install the same thing locally. See http://www.corelatus.com/~matthias/erlman.erl Matt From hakan@REDACTED Fri Sep 6 10:36:05 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 6 Sep 2002 10:36:05 +0200 (MEST) Subject: Some mnesia subscription problems. In-Reply-To: <3D77B210.6080308@vailsys.com> Message-ID: On Thu, 5 Sep 2002, martin j. logan wrote: Martin> Hakan, Martin> First off thanks for the reply. I think that I may be running the Martin> code while mnesia is still shutting down. Here is my problem. Martin> I have an event handler that I use to gather mnesia events. I add the Martin> handler and I use mnesia:subscribe/1 in its init method. Martin> At some point I bring mnesia down in order to delete and old schema. Martin> I get the mnesia_down event. What I would like to do is resubscribe to Martin> the new mnesia instance so that I can continue to handle events. Martin> I can not seem to get it to work though. What mechanism would you Martin> suggest using to make my event handler persistant through stops Martin> and starts? Have you considered using the event_module configuration parameter? If you use that, Mnesia will restart your event handler for you at the startup of Mnesia. A drawback is however that the event handler process will be stopped when Mnesia is stopped. This means that if you need to keep the state of the event handler when Mnesia stops, you need to store it elsewhere, e.g. in an ets table owned by another process. I think that it is harder to achieve a dependable solution based on mnesia:subscribe/1. /H?kan From info@REDACTED Fri Sep 6 11:43:09 2002 From: info@REDACTED (Levada.com) Date: Fri, 6 Sep 2002 11:43:09 +0200 Subject: javascript modules index: tester with IE wanted Message-ID: <003701c25589$cf772e10$0100a8c0@berndt.213.252.1.1> Hi this happens using a Netscape 4.79 running on a NT 4.0 machine with SP 5 installed. Following the same entries using a IE 4.72 with Java logging und Java JIT compiler but no Java console enabled being run on the same machine bernie ++++++++++++++++++++++++++++++++++++++++++++++++ Netscape 4.79 em => 2 Windows NT (em is not listed in your module index) m => 7 Miscellaneous mm => 7 Miscellaneous (m and mm is not listed in your module index) ma => Manual Page Index (though there is "make" as the first entry starting with "ma" in module index) mak => make cal => calendar mn => mnesia /Netscape 4.79 ++++++++++++++++++++++++++++++++++++++++++++++++ IE 4.72 em => Manual Page Index (em is not listed in your module index) m => Manual Page Index mm => Manual Page Index (m and mm is not listed in your module index) ma => Manual Page Index (though there is "make" as the first entry starting with "ma" in module index) mak => Manual Page Index make => Manual Page Index cal => Manual Page Index mn => Manual Page Index In other words: No module is found, i.e. no man page is displayed Two oddities occured while using IE 4.72: a) Every time I clicked into the search field it's whole frame moved up to IE's upper edge and every time the Manual Page Index was displayed again the search fields and the two buttons "slide done" to the "dividing line" between this frame an the Manual Page Index b) The screening of your list and the display of the result takes a whole lot longer then with Netscape 4.79, i.e. something like 3 seconds vs. 0.5 seconds /IE 4.72 -----Original Message----- From: Matthias Lang To: erlang-questions@REDACTED Date: Freitag, 6. September 2002 10:30 Subject: javascript modules index: tester with IE wanted >Hi, > >My last beta tester seems to have disappeared, though he claims not to >have been put off by IE getting its knickers in a knot and threatening >to crash his laptop. Anyway: > >If you've got a minute and you're running an OS/Browser combination >which is NOT linux/mozilla, point your browser at > > http://www.corelatus.com/~matthias/modules.html > >and tell me whether it works or not for you. The idea is to type in >the start of a library module (e.g. 'mn' gets you mnesia), hit enter >and see the man page. You need to have javascript enabled. > >If it doesn't work, speculation as to why not would be interesting. >The searching is done by your browser (i.e. it doesn't use CGI), so >it's possible to install the same thing locally. See > > http://www.corelatus.com/~matthias/erlman.erl > >Matt > From per@REDACTED Fri Sep 6 12:50:48 2002 From: per@REDACTED (Per Bergqvist) Date: Fri, 06 Sep 2002 11:50:48 +0100 Subject: javascript modules index: tester with IE wanted In-Reply-To: <15736.24658.885008.810747@antilipe.corelatus.se> Message-ID: <200209060950.g869omG03951@hyena.levonline.com> Works fine with IE 6.0.2600 on XP Pro. Very handy. /Per > Hi, > > My last beta tester seems to have disappeared, though he claims not to > have been put off by IE getting its knickers in a knot and threatening > to crash his laptop. Anyway: > > If you've got a minute and you're running an OS/Browser combination > which is NOT linux/mozilla, point your browser at > > http://www.corelatus.com/~matthias/modules.html > > and tell me whether it works or not for you. The idea is to type in > the start of a library module (e.g. 'mn' gets you mnesia), hit enter > and see the man page. You need to have javascript enabled. > > If it doesn't work, speculation as to why not would be interesting. > The searching is done by your browser (i.e. it doesn't use CGI), so > it's possible to install the same thing locally. See > > http://www.corelatus.com/~matthias/erlman.erl > > Matt > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From Sean.Hinde@REDACTED Fri Sep 6 12:01:25 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 6 Sep 2002 11:01:25 +0100 Subject: javascript modules index: tester with IE wanted Message-ID: <04D356A3B172D611981B0008C791C3126BF353@imp02mbx.t-mobile.co.uk> I agree, very handy - I am now using it all the time in prefererence to all other ways of reading the docs. This would be a very nice addition to the full OTP documentation set i.e. a new link - permuted_index_on_acid :) Sean > -----Original Message----- > From: Per Bergqvist [mailto:per@REDACTED] > Sent: 06 September 2002 11:51 > To: matthias@REDACTED > Cc: erlang-questions@REDACTED > Subject: Re: javascript modules index: tester with IE wanted > > > Works fine with IE 6.0.2600 on XP Pro. > > Very handy. > > /Per > > > Hi, > > > > My last beta tester seems to have disappeared, though he claims not > to > > have been put off by IE getting its knickers in a knot and > threatening > > to crash his laptop. Anyway: > > > > If you've got a minute and you're running an OS/Browser combination > > which is NOT linux/mozilla, point your browser at > > > > http://www.corelatus.com/~matthias/modules.html > > > > and tell me whether it works or not for you. The idea is to type in > > the start of a library module (e.g. 'mn' gets you mnesia), hit enter > > and see the man page. You need to have javascript enabled. > > > > If it doesn't work, speculation as to why not would be interesting. > > The searching is done by your browser (i.e. it doesn't use CGI), so > > it's possible to install the same thing locally. See > > > > http://www.corelatus.com/~matthias/erlman.erl > > > > Matt > > > ========================================================= > Per Bergqvist > Synapse Systems AB > Phone: +46 709 686 685 > Email: per@REDACTED > NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From matthias@REDACTED Fri Sep 6 13:04:41 2002 From: matthias@REDACTED (Matthias Lang) Date: Fri, 6 Sep 2002 13:04:41 +0200 Subject: javascript modules index: results summary In-Reply-To: <04D356A3B172D611981B0008C791C3126BF353@imp02mbx.t-mobile.co.uk> References: <04D356A3B172D611981B0008C791C3126BF353@imp02mbx.t-mobile.co.uk> Message-ID: <15736.35785.728150.338694@antilipe.corelatus.se> Hi, Thanks for flooding my mailbox with replies (about 10 within 15 minutes of posting!). Here's a summary: Reported Working: IE 6, Win XP Pro (PB) IE 6, Win XP (VD) IE 6, Win 2k (ES, BB) IE 6, Win 98 (FK) IE ?, OSX 1.5 (CW) Moz 1.1, Win 2k (BB) Netscape 4.61, Solaris (LV) Netscape 4.79, Linux (MK) Netscape 4.78, Win 95 (SM) Netscape 6.x, Win 98 (FC) Opera 6.03, linux (MK) Opera 6.01, win 95 (SM) Reported not Working Konqueror ?, linux (MK) Wish list/bug reports: - horribly slow on IE 4.72 - wouldn't it be nice if when there are several modules matching the query, a list of links to those will appear? (yes, but this should be optional. Autocomplete would also be nifty, but I haven't thought about how to do it) - searching on 'z' gives you the page for 'c' (true. showing the index would probably be more useful) - plus a couple of others I haven't read yet Matthias From Marc.Vanwoerkom@REDACTED Fri Sep 6 13:05:31 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Fri, 6 Sep 2002 13:05:31 +0200 (MEST) Subject: javascript modules index: tester with IE wanted In-Reply-To: <15736.24658.885008.810747@antilipe.corelatus.se> (message from Matthias Lang on Fri, 6 Sep 2002 09:59:14 +0200) Message-ID: <200209061105.g86B5O508498@bonsai.fernuni-hagen.de> Hi, it works fine for me using IE6 under Windows ME. BTW it would be very nice if one could click man page references, do you have time for this? If not I could try a patch.. Regards, Marc From Sean.Hinde@REDACTED Fri Sep 6 14:12:44 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 6 Sep 2002 13:12:44 +0100 Subject: Deleting mnesia tables Message-ID: <04D356A3B172D611981B0008C791C3126BF354@imp02mbx.t-mobile.co.uk> Anyone know an easy way to delete a table which one node thinks exists both on itself and on another node, while the other node is down (please don't ask!)? Thanks, Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From hakan@REDACTED Fri Sep 6 14:48:43 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Fri, 6 Sep 2002 14:48:43 +0200 (MEST) Subject: Deleting mnesia tables In-Reply-To: <04D356A3B172D611981B0008C791C3126BF354@imp02mbx.t-mobile.co.uk> Message-ID: On Fri, 6 Sep 2002, Sean Hinde wrote: Sean> Anyone know an easy way to delete a table which one node thinks exists both Sean> on itself and on another node, while the other node is down (please don't Sean> ask!)? You need to remove the other node from the schema before you can delete the table: (one@REDACTED)8> mnesia:create_table(t, [{disc_copies, [one@REDACTED, other@REDACTED]}]). {atomic,ok} (one@REDACTED)9> rpc:call(other@REDACTED, mnesia, stop, []). stopped (one@REDACTED)10> mnesia:delete_table(t). {aborted,{not_active,"All replicas on diskfull nodes are not active yet", t, [other@REDACTED]}} (one@REDACTED)11> mnesia:del_table_copy(schema, other@REDACTED). {atomic,ok} (one@REDACTED)12> mnesia:delete_table(t). {atomic,ok} (one@REDACTED)13> /H?kan From Sean.Hinde@REDACTED Fri Sep 6 15:41:16 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 6 Sep 2002 14:41:16 +0100 Subject: Deleting mnesia tables Message-ID: <04D356A3B172D611981B0008C791C3126BF359@imp02mbx.t-mobile.co.uk> > Sean> Anyone know an easy way to delete a table which one > node thinks exists both > Sean> on itself and on another node, while the other node is > down (please don't > Sean> ask!)? > > You need to remove the other node from the schema before you > can delete the table: > > (one@REDACTED)8> mnesia:create_table(t, [{disc_copies, > [one@REDACTED, other@REDACTED]}]). > {atomic,ok} > (one@REDACTED)9> rpc:call(other@REDACTED, mnesia, stop, []). > stopped > (one@REDACTED)10> mnesia:delete_table(t). > {aborted,{not_active,"All replicas on diskfull nodes are > not active yet", > t, > [other@REDACTED]}} > (one@REDACTED)11> mnesia:del_table_copy(schema, > other@REDACTED). > {atomic,ok} > (one@REDACTED)12> mnesia:delete_table(t). > > {atomic,ok} > (one@REDACTED)13> Thanks, Trouble is there are loads of tables on the other node and It is a lot of work to re-build it all again from the replica. I've thought over lunch and concluded that mnesia needs a "more rope" mode. It is good at trying to prevent dumb users from creating a network of inconsistent schemas, but not quite good enough (e.g. manually upgrade one node leaving cruft behind on another). The trouble is that once a live system is inconsistent it is nigh on impossible to repair it without a major rebuild of at least one node. I would be interested to see some functions along the lines of: dire_warning_but_delete_this_table_locally_regardless_of_replicas(Tab). and such like. Meanwhile I'm fiddling with dets (but the support guys will want us to do the job properly..) Cheers,, Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From etxuwig@REDACTED Fri Sep 6 15:49:26 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 6 Sep 2002 15:49:26 +0200 (MET DST) Subject: Deleting mnesia tables In-Reply-To: <04D356A3B172D611981B0008C791C3126BF359@imp02mbx.t-mobile.co.uk> Message-ID: On Fri, 6 Sep 2002, Sean Hinde wrote: >Thanks, Trouble is there are loads of tables on the other node >and It is a lot of work to re-build it all again from the >replica. > >I've thought over lunch and concluded that mnesia needs a "more >rope" mode. It is good at trying to prevent dumb users from >creating a network of inconsistent schemas, but not quite good >enough (e.g. manually upgrade one node leaving cruft behind on >another). > >The trouble is that once a live system is inconsistent it is >nigh on impossible to repair it without a major rebuild of at >least one node. But isn't mnesia:set_master_nodes(Tab, OtherNodes) what you're really looking for? It will force mnesia on the node where the call is made to unconditionally load Tab from one of the given nodes. The function can be called before mnesia is started. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From bjarne@REDACTED Fri Sep 6 15:58:53 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Fri, 06 Sep 2002 15:58:53 +0200 Subject: Erlang usage statistics References: <15736.24658.885008.810747@antilipe.corelatus.se> Message-ID: <3D78B49D.60D54DAC@erix.ericsson.se> Dear Erlang friends, Erlang/OTP has been open source for some time and we believe that the entire Erlang community is interested in statistics of its use. There is a web questionaire on the Erlang/OTP site http://www.erlang.org/ and we kindly ask those who have down-loaded Erlang/OTP to tell us what you use it for. The result will be collected during September and will be presented at the Erlang workshop in Pittsburg October 7, 2002. They will also be available on the Erlang/OTP site. Best wishes Bjarne D?cker From Sean.Hinde@REDACTED Fri Sep 6 18:16:00 2002 From: Sean.Hinde@REDACTED (Sean Hinde) Date: Fri, 6 Sep 2002 17:16:00 +0100 Subject: Deleting mnesia tables Message-ID: <04D356A3B172D611981B0008C791C3126BF35D@imp02mbx.t-mobile.co.uk> > > > >The trouble is that once a live system is inconsistent it is > >nigh on impossible to repair it without a major rebuild of at > >least one node. > > But isn't mnesia:set_master_nodes(Tab, OtherNodes) what you're > really looking for? > > It will force mnesia on the node where the call is made to > unconditionally load Tab from one of the given nodes. The > function can be called before mnesia is started. It was a slightly unusual situation. We had a table mirrored across two nodes of a 24 node system. One of these nodes was rebuilt from scratch with a newly spliced in schema not including this table. At some point in the past set_master_nodes had been run to set the now 'orphan' copy as the master. The new node crashed (reason unknown) but then would not start correctly because of an {undefined, 'orphan_table'} type error. obviously I couldn't delete the 'orphan' because the other node wasn't started - catch 22. I tried setting master nodes for this table to [] but it didn't help. I do not understand quite how, but following Hakan's procedure worked spectatcularly well. 1. mnesia:del_table_copy(schema, other@REDACTED). worked 2. mnesia:delete_table(t). worked I then started mnesia on other@REDACTED and it came up straight away fully integrated into the schema with all it's tables intact. It was just as through I had never deleted it's schema from the other nodes at all. Quite a relief, but I've no idea quite why it worked..? Sean NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From etxuwig@REDACTED Fri Sep 6 18:21:57 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Fri, 6 Sep 2002 18:21:57 +0200 (MET DST) Subject: Deleting mnesia tables In-Reply-To: <04D356A3B172D611981B0008C791C3126BF35D@imp02mbx.t-mobile.co.uk> Message-ID: On Fri, 6 Sep 2002, Sean Hinde wrote: >I then started mnesia on other@REDACTED and it came up >straight away fully integrated into the schema with all it's >tables intact. It was just as through I had never deleted it's >schema from the other nodes at all. If I'm not mistaken, this is a bug. At least this was Dan's comment when I pointed it out to him a while back. If you, say, move a table copy from node A to node B while one schema node C is down, the copy on node A will reappear when schema node C comes back up. This makes for fun effects if you try to co-locate processes and data, or move replicas around for other reasons. It's kindof like that amusement park game where you try to clobber pegs that keep popping up out of different holes -- when a schema node restarts, you have to check that you don't have unwanted old replicas around. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From mickael.remond@REDACTED Fri Sep 6 19:22:06 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Fri, 6 Sep 2002 19:22:06 +0200 Subject: Impact of native compilation Message-ID: <1031332926.3d78e43e85340@webmail.spamcop.net> Hello, We were wondering with Thierry Mallard about the impact of native compilation. We tried to compare a big amount of floating point operations (100 millions). The result is greatly improved over standard Erlang. The result is also far from the C execution time. We were wondering why the result was different. Is there many more operations implied by Erlang ? The test are at the bottom of this email. I have not yet tested the same example with ETOS. Does someone know the expected impact with ETOS ? Thank you for you help. -- Micka?l R?mond -=-=-=-=-=- Erlang test: Erlang (BEAM) emulator version 2002.09.05 [source] [hipe] [threads:0] Eshell V2002.09.05 (abort with ^G) 1> c(test2, [native, {hipe, [o3]}]). {ok,test2} 2> test2:run(). {5820686,ok} ======= >Means 5.8 seconds. -=-=-=-=-=- [mremond@REDACTED test]$ g++ -O3 -o testmulti testmulti.cpp [mremond@REDACTED test]$ ./testmulti 0.27user 0.00system 0:00.89elapsed 30%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (129major+34minor)pagefaults 0swaps ======= >Means less than 1 second. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: test2.erl URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testmulti.cpp Type: text/x-c++src Size: 103 bytes Desc: not available URL: From pascal.brisset@REDACTED Fri Sep 6 19:51:58 2002 From: pascal.brisset@REDACTED (Pascal Brisset) Date: Fri, 6 Sep 2002 19:51:58 +0200 Subject: Impact of native compilation In-Reply-To: <1031332926.3d78e43e85340@webmail.spamcop.net> References: <1031332926.3d78e43e85340@webmail.spamcop.net> Message-ID: <15736.60222.828264.600816@pcg.localdomain> > We were wondering why the result was different. Is there many more operations implied by Erlang ? More important is that there are much less operations than you think in the C version: "g++ -O3" optimizes the unused code out. main: .LFB1: pushl %ebp .LCFI0: movl %esp, %ebp .LCFI1: movl $99999999, %eax .p2align 2 .L6: decl %eax jns .L6 xorl %eax, %eax popl %ebp ret -- Pascal Brisset [pascal.brisset@REDACTED] -- -- Cellicium | 157 r des Blains | F-92220 Bagneux -- From feeley@REDACTED Fri Sep 6 20:03:01 2002 From: feeley@REDACTED (Marc Feeley) Date: Fri, 6 Sep 2002 14:03:01 -0400 Subject: Impact of native compilation In-Reply-To: <1031332926.3d78e43e85340@webmail.spamcop.net> (message from Mickael Remond on Fri, 6 Sep 2002 19:22:06 +0200) References: <1031332926.3d78e43e85340@webmail.spamcop.net> Message-ID: <200209061803.g86I31K20857@dino00.iro.umontreal.ca> > We tried to compare a big amount of floating point operations (100 millions). > The result is greatly improved over standard Erlang. > The result is also far from the C execution time. > > We were wondering why the result was different. Is there many more operations > implied by Erlang ? > > The test are at the bottom of this email. > > I have not yet tested the same example with ETOS. Does someone know the > expected impact with ETOS ? The main loop of your Erlang benchmark is loop(0) -> ok; loop(Count) -> 1.0 * 1.234, loop(Count -1). and in C for(long i = 0 ; i < 100000000 ; i ++) { double x = 1.0 * 1.000234 ; } I am sure the C compiler is completely discarding this loop, as it is dead code (it doesn't contribute anything useful to the rest of the program). This is a standard problem in benchmarks which don't compute something useful... The Erlang compiler is probably not transforming the loop function into loop(_) -> ok. as might be expected because in fact they are not equivalent (for example if Count is initially negative, or if Count is not an integer an exception is raised). Note that the compiler can't be sure from which module loop is called, and if the call timer:tc(?MODULE, loop, [100000000]). at the top of the module actually calls the loop function defined in this module (a new version of the module might be loaded just after timer:tc is called, and before loop is called). Optimizing Erlang is not easy due to such subtle semantic points. So in fact the performance of your code has nothing to do with the speed of floating point computation!!! For the record, ETOS has very good floating point performance, thanks to Gambit-C on which it is based. On some complex numerical programs Gambit-C can compile floating-point code as efficiently as C (see for example http://www.ccs.neu.edu/home/matthias/Scheme2000/lucier.ps). Marc From luke@REDACTED Fri Sep 6 20:18:27 2002 From: luke@REDACTED (Luke Gorrie) Date: 06 Sep 2002 20:18:27 +0200 Subject: Impact of native compilation In-Reply-To: <200209061803.g86I31K20857@dino00.iro.umontreal.ca> References: <1031332926.3d78e43e85340@webmail.spamcop.net> <200209061803.g86I31K20857@dino00.iro.umontreal.ca> Message-ID: Marc Feeley writes: > For the record, ETOS has very good floating point performance, thanks > to Gambit-C on which it is based. On some complex numerical programs > Gambit-C can compile floating-point code as efficiently as C (see for > example http://www.ccs.neu.edu/home/matthias/Scheme2000/lucier.ps). What's the word on ETOS' availability? Last year I mailed in asking for the sources to the lastest version, but didn't hear back. The website only has 2.3 in binary, and 1.4 as source. Cheers, Luke From per@REDACTED Sat Sep 7 09:16:50 2002 From: per@REDACTED (Per Bergqvist) Date: Sat, 07 Sep 2002 08:16:50 +0100 Subject: Impact of native compilation In-Reply-To: <1031332926.3d78e43e85340@webmail.spamcop.net> Message-ID: <200209070617.g876H0v05084@lejon.levonline.com> Hi, (Disclaimer: this behaviour might have changed, haven't really checked it in the current release but anyway ...) I had the same experience regarding loop performance in C vs. Hipe erlang and decided to look in to it about a year ago. It looked like hipe did a very good job generating code for the body of the function, but did no optimization for recursive calls (i.e. loops). It handled it as any other call. After each execution of the "body" hipe called runtime functions to allow housekeeping and scheduling. Unfortunately most functions in erlang are very small and the setup overhead for each body call was significant resulting in very small perfomance gains (but still some). Compare this with an tight optimized (unrolled|coiled|pipelined) loop in C doing condition checking on a register flag. This is a bit unfortunate since performance bottlenecks can usually be tracked down a few inner loops for almost any given system... /Per > Hello, > > We were wondering with Thierry Mallard about the impact of native compilation. > We tried to compare a big amount of floating point operations (100 millions). > The result is greatly improved over standard Erlang. > The result is also far from the C execution time. > > We were wondering why the result was different. Is there many more operations > implied by Erlang ? > > The test are at the bottom of this email. > > I have not yet tested the same example with ETOS. Does someone know the > expected impact with ETOS ? > > Thank you for you help. > > -- > Micka?l R?mond > > > -=-=-=-=-=- > Erlang test: > > Erlang (BEAM) emulator version 2002.09.05 [source] [hipe] [threads:0] > > Eshell V2002.09.05 (abort with ^G) > 1> c(test2, [native, {hipe, [o3]}]). > {ok,test2} > 2> test2:run(). > {5820686,ok} > ======= >Means 5.8 seconds. > -=-=-=-=-=- > [mremond@REDACTED test]$ g++ -O3 -o testmulti testmulti.cpp > [mremond@REDACTED test]$ ./testmulti > 0.27user 0.00system 0:00.89elapsed 30%CPU (0avgtext+0avgdata 0maxresident)k > 0inputs+0outputs (129major+34minor)pagefaults 0swaps > ======= >Means less than 1 second. > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From thierry@REDACTED Sat Sep 7 09:12:58 2002 From: thierry@REDACTED (Thierry Mallard) Date: Sat, 07 Sep 2002 09:12:58 +0200 (MEST) Subject: Impact of native compilation In-Reply-To: <15736.60222.828264.600816@pcg.localdomain> References: <1031332926.3d78e43e85340@webmail.spamcop.net> <15736.60222.828264.600816@pcg.localdomain> Message-ID: <1031382778.3d79a6faef230@imp.pro.proxad.net> Quoting Pascal Brisset : > > We were wondering why the result was different. Is there many more > operations implied by Erlang ? > > More important is that there are much less operations than you > think in the C version: "g++ -O3" optimizes the unused code out. > [ ...assembly code...] Gosh.. silly me, I should have wondered. Making a real float var that changes 100 millions time does indeed change the taken time. ( from .16 seconds to 2.26 seconds at home ) Thanks for the review ! With kind regards, -- Thierry Mallard http://vawis.net From mickael.remond@REDACTED Sat Sep 7 10:25:47 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 7 Sep 2002 10:25:47 +0200 Subject: Impact of native compilation Message-ID: <1031387147.3d79b80b1d64d@webmail.spamcop.net> Thank you, everyone. I now understand better the optimisation aspects of Hipe. I will try to play with it a bit more to test how it reacts in other contexts. -- Micka?l R?mond From happi@REDACTED Sat Sep 7 11:29:15 2002 From: happi@REDACTED (Happi) Date: Sat, 7 Sep 2002 11:29:15 +0200 Subject: Impact of native compilation References: <200209070617.g876H0v05084@lejon.levonline.com> Message-ID: <005501c25651$085ce2c0$c90b0a0a@LISA> Per Bergqvist wrote: [...] > It looked like hipe did a very good job generating code for the body > of the function, but did no optimization for > recursive calls (i.e. loops). It handled it as any other call. Well, almost, a tail-call to the same function is turned into something slightly faster than any other call: it is actually a "real" loop and no stack adjustment code is needed. > After each execution of the "body" hipe called runtime functions to > allow housekeeping and scheduling. Yes, this is the real problem. The scheduling in the Erlang runtime system is done by counting reductions -- A process gets a number of reductions and each function call decrements this number, when the count reaches zero the process is suspended. This mechanism is also used in HiPE, which means that each function call still has to reduce the reduction count and test for zero. Without this test a bug which makes one process loop forever could block all processes on the node, which of course is unacceptable. Still, there are many cases where unrolling could be done, and this we hope to do in the upcoming (well sometime in the future) new HiPE front-end (Core Erlang to HiPE). > Unfortunately most functions in erlang are very small and the setup > overhead for each body call was significant resulting in very small > perfomance gains (but still some). Well, compared to the BEAM the performance gain of native-code compiling a tight loop is 4 to 10 times. > Compare this with an tight optimized (unrolled|coiled|pipelined) loop > in C doing condition checking on a register flag. Yes, we still have a long way to go to get to the performance of a statically typed language. > This is a bit unfortunate since performance bottlenecks can usually be > tracked down a few inner loops for almost any given system... Yes, this is the type of code that HiPE concentrates on optimizing. We would very much like it if you could send us examples of such loops where the HiPE compiler does not do a good job so that we can find the problem and improve the compiler. Micka?l R?mond Wrote: > > We were wondering with Thierry Mallard about the impact of native > compilation. > > We tried to compare a big amount of floating point operations (100 > millions). > > The result is greatly improved over standard Erlang. Yes, HiPE now has native support for floating point operations (Both SPARC and x86) with very promising results, more information will come with the announcements for R9 and HiPE 2.0. I would like to stress that there is yet no new release of HiPE since HiPE 1.0, and that the P9 snapshots are not official releases, these snapshots often contains untested and even broken code, use with extreme care. To get back to the question on the performance of the example program loop(0) -> ok; loop(Count) -> 1.0 * 1.234, loop(Count -1). In this case the even the BEAM compiler throws away the fp operation the resulting code is just: loop(0) -> ok; loop(Count) -> loop(Count -1). To test fp performance you have to hide the constants from the compiler but still hint to it that they are floats: loop(N)-> floop(N,1.0,1.234). floop(0,_,_) -> ok; floop(Count,A,B) when float(A), float(B) -> A * B, floop(Count -1,A,B). 7> test2:run(). {66662095,ok} 8> hipe:c(test2,[o3]). {ok,test2} 9> test2:run(). {15735078,ok} 10> 66662095/15735078. 4.23653 A four times speedup for native code. /Erik -------------------------------------- I'm Happi, you should be happy. Praeterea censeo 0xCA scribere Erlang posse. From mickael.remond@REDACTED Sat Sep 7 13:17:34 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Sat, 7 Sep 2002 13:17:34 +0200 Subject: Erlang usage statistics Message-ID: <1031397454.3d79e04e6620d@webmail.spamcop.net> Bjarne D?cker : > and we kindly ask those who have down-loaded Erlang/OTP > to tell us what you use it for. The result will be > collected during September and will be presented at > the Erlang workshop in Pittsburg October 7, 2002. > They will also be available on the Erlang/OTP site. I think this study is very important, because it will help prove that the Erlang community exist, is a reality and is dynamic. I will answer the questionnaire during the week-end. My only comments is about the field regarding project in Erlang. I have more than one project to mention, but maybe I should put a link to a home page dispatching to my others projects. Maybe, it should be a better idea for you to store several page for developpers participating to several projects. It will be easier, later on, to make a page linking to all Erlang known projects. -- Micka?l R?mond From francesco@REDACTED Sat Sep 7 15:29:17 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Sat, 07 Sep 2002 14:29:17 +0100 Subject: Erlang usage statistics References: <1031397454.3d79e04e6620d@webmail.spamcop.net> Message-ID: <3D79FF2D.80703@erlang-consulting.com> > > >My only comments is about the field regarding project in Erlang. I have more >than one project to mention, but maybe I should put a link to a home page >dispatching to my others projects. > It is all my fault. I was the one asking for those links.. Guess why :-) Once the survey is over, I will be dropping a line to the people who added the links and ask if they mind them beeing added in the open directory. >Maybe, it should be a better idea for you to store several page for developpers >participating to several projects. It will be easier, later on, to make a page >linking to all Erlang known projects. > I am attempting to list all of these projects on the Erlang section of the Open Directory at http://dmoz.org/Computers/Programming/Languages/Erlang/ We have now reached 280 links (Lots has happened, especially at sourceforge!), and with packloads of Articles I found recently that still to be added. If any one has external Erlang pages, add them there or email them to me!!! Regards, Franesco -- http://www.erlang-consulting.com From jch@REDACTED Sat Sep 7 16:24:19 2002 From: jch@REDACTED (Jenny Dybedahl) Date: 07 Sep 2002 16:24:19 +0200 Subject: javascript modules index: tester with IE wanted In-Reply-To: <15736.24658.885008.810747@antilipe.corelatus.se> References: <15736.24658.885008.810747@antilipe.corelatus.se> Message-ID: Matthias Lang writes: 2> If you've got a minute and you're running an OS/Browser combination > which is NOT linux/mozilla, point your browser at > > http://www.corelatus.com/~matthias/modules.html It works in both mozilla and netscape under freebsd, and under mozilla and IE on WinMe and W2K. > and tell me whether it works or not for you. The idea is to type in > the start of a library module (e.g. 'mn' gets you mnesia), hit enter > and see the man page. You need to have javascript enabled. That works, provided what I type really is the start of a module. If I type something else, I get *a* man page for something that may or may not be related. E.g., typing nntp gives me the net_adm man page; typing foo gives me ftp; bar gives me BIF. IMO it'd be more useful to be told that what I typed doesn't exist. That's a matter of taste, though, so I'm not sure whether it's intentional or not. -- "I live in the heart of the machine. We are one." From apeake@REDACTED Sat Sep 7 23:51:26 2002 From: apeake@REDACTED (Alex Peake) Date: Sat, 7 Sep 2002 14:51:26 -0700 Subject: Erlang and GUI Message-ID: Sorry to ask about this again. I read in the PowerPoint presentation "Concurrent Functional Programming with Erlang and OTP" by Bjarne D?cker that (in the section on Carrier Class apps) "Operator GUI applets" were written in Java. Is this the best way to develop apps that have a significant Graphical User Interface element to them? (I looked at "gs" and find that it is the (somewhat limited relative to the MS Windows world with ActiveX grids, trees, etc. "widgets") tcl/tk). Alex From apeake@REDACTED Sat Sep 7 23:50:57 2002 From: apeake@REDACTED (Alex Peake) Date: Sat, 7 Sep 2002 14:50:57 -0700 Subject: Behaviours Message-ID: Is there, somewhere, a more tutorial description of how to create behaviours? Alex From achay@REDACTED Sat Sep 7 20:32:07 2002 From: achay@REDACTED (Antonio Chay Hidalgo) Date: Sat, 7 Sep 2002 18:32:07 +0000 Subject: BER and ASN1 question Message-ID: <20020907183207.2b7e0d82.achay@its.cl> Hello! There is a way to know what type of register comes in a file BER coded? Thanks in advance. -- Antonio Chay Hidalgo. From francesco@REDACTED Sun Sep 8 15:02:15 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Sun, 08 Sep 2002 14:02:15 +0100 Subject: Behaviours References: Message-ID: <3D7B4A57.9070206@erlang-consulting.com> Hi Alex, OTP behaviors are covered in detail in the Design Principles documentation at http://www.erlang.org/doc/r8b/doc/design_principles/part_frame.html It also gives a few good examples. You can complement this with the manual pages for the different behavior modules. Lastly, you can find tons of examples of usage of behaviors in the contributions section of the open directory. Good Luck, Francesco -- http://www.erlang-consulting.com Alex Peake wrote: >Is there, somewhere, a more tutorial description of how to create behaviours? > >Alex > > > From lennart.ohman@REDACTED Sun Sep 8 16:39:39 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Sun, 08 Sep 2002 16:39:39 +0200 Subject: Erlang and GUI References: Message-ID: <3D7B612B.B5DEAF6B@st.se> Hi, perhaps Bjarne should defend his own powerpoint slides. But I believe his point is that when developing telecom equipment the GUI must be separate from the control processor (which usually is the CPU running the application(s) programmed in Erlang). 1) You don't want the CP to have to use its power to handle windows etc. 2) You may anyway need many different ways to communicate with the CP since most customers have their own idea of how it should be managed. Therefore you rather think of a few commands which are allowed and then let the task of illustrating them to someone else. If your application *is* the GUI things might very well come in a another light. I believe however that there is a bug in GS in R8 for win32 Erlang (!?). Sometimes GS refuses to start. It can be noticed when trying to run some of the tools. /Lennart Alex Peake wrote: > > Sorry to ask about this again. > > I read in the PowerPoint presentation "Concurrent Functional Programming with Erlang and OTP" by > Bjarne D?cker that (in the section on Carrier Class apps) "Operator GUI applets" were written in > Java. > > Is this the best way to develop apps that have a significant Graphical User Interface element to > them? > > (I looked at "gs" and find that it is the (somewhat limited relative to the MS Windows world with > ActiveX grids, trees, etc. "widgets") tcl/tk). > > Alex ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From apeake@REDACTED Sun Sep 8 18:20:39 2002 From: apeake@REDACTED (Alex Peake) Date: Sun, 8 Sep 2002 09:20:39 -0700 Subject: Behaviours In-Reply-To: <3D7B4A57.9070206@erlang-consulting.com> Message-ID: Thank you Francesco. I guess the answer is that there is nothing "of a tutorial nature". I was looking for more of: What is a behaviour? When do you need one? How do you build one? (I saw a quote from Joe Armstrong something of the nature that -- in Erlang you do not need objects because you have behaviours -- so I wanted to explore what this meant) Alex > -----Original Message----- > From: Francesco Cesarini [mailto:francesco@REDACTED] > Sent: Sunday, September 08, 2002 6:02 AM > To: Alex Peake > Cc: erlang-questions@REDACTED > Subject: Re: Behaviours > > > Hi Alex, > > OTP behaviors are covered in detail in the Design Principles > documentation at > http://www.erlang.org/doc/r8b/doc/design_principles/part_frame.html It > also gives a few good examples. You can complement this with the manual > pages for the different behavior modules. Lastly, you can find tons of > examples of usage of behaviors in the contributions section of the open > directory. > > Good Luck, > Francesco > -- > http://www.erlang-consulting.com > > Alex Peake wrote: > > >Is there, somewhere, a more tutorial description of how to create behaviours? > > > >Alex > > > > > > > > > From lennart.ohman@REDACTED Sun Sep 8 18:41:55 2002 From: lennart.ohman@REDACTED (Lennart =?iso-8859-1?Q?=D6hman?=) Date: Sun, 08 Sep 2002 18:41:55 +0200 Subject: Behaviours References: Message-ID: <3D7B7DD3.B1BFE15D@st.se> Hi, originally behaviours were developed because their are many ways to implement a process structure of linked processes monitoring each other. Monitoring each other in the sence that you like appropriate actions to be taken if a process terminates due to a fault. In large project you like all programmers to use the *same* strategy. It would also be nice if this fault tolerance stuff was programmed once and for all (by someone who hopefully knows what he is doing :-). Therefore the code of a process "using" a certain behaviour is divided into a generic part and a specific part. In the generic code these things are hidden, linking, reporting erronous states, taking some kind of action in the event of an unexpected process termination etc. You then only have to write the specific code that will do the task your process is meant to be responsible for. But since different tasks may require processes to behave in slightly different manners, a collection of behaviours were invented. The specific code must implement an interface to the generic code. Those functiona are called the call-backs. Take a look at the man-page for gen_server, which is the simplest behaviour. /Lennart Alex Peake wrote: > > Thank you Francesco. > > I guess the answer is that there is nothing "of a tutorial nature". > > I was looking for more of: > > What is a behaviour? When do you need one? How do you build one? > > (I saw a quote from Joe Armstrong something of the nature that -- in Erlang you do not need objects > because you have behaviours -- so I wanted to explore what this meant) > > Alex > > > -----Original Message----- > > From: Francesco Cesarini [mailto:francesco@REDACTED] > > Sent: Sunday, September 08, 2002 6:02 AM > > To: Alex Peake > > Cc: erlang-questions@REDACTED > > Subject: Re: Behaviours > > > > > > Hi Alex, > > > > OTP behaviors are covered in detail in the Design Principles > > documentation at > > http://www.erlang.org/doc/r8b/doc/design_principles/part_frame.html It > > also gives a few good examples. You can complement this with the manual > > pages for the different behavior modules. Lastly, you can find tons of > > examples of usage of behaviors in the contributions section of the open > > directory. > > > > Good Luck, > > Francesco > > -- > > http://www.erlang-consulting.com > > > > Alex Peake wrote: > > > > >Is there, somewhere, a more tutorial description of how to create behaviours? > > > > > >Alex > > > > > > > > > > > > > > > -- ------------------------------------------------------------- Lennart Ohman phone : +46-8-587 623 27 Sjoland & Thyselius Telecom AB cellular: +46-70-552 6735 Sehlstedtsgatan 6 fax : +46-8-667 8230 SE-115 28 STOCKHOLM, SWEDEN email : lennart.ohman@REDACTED From mickael.remond@REDACTED Sun Sep 8 20:52:50 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Sun, 8 Sep 2002 20:52:50 +0200 Subject: Behaviours Message-ID: <1031511170.3d7b9c821141c@webmail.spamcop.net> Alex Peake : > Thank you Francesco. > > I guess the answer is that there is nothing "of a tutorial nature". > > I was looking for more of: > > What is a behaviour? When do you need one? How do you build one? > > (I saw a quote from Joe Armstrong something of the nature that -- in Erlang > you do not need objects > because you have behaviours -- so I wanted to explore what this meant) Regarding behaviours, most of the time you need to _use_ an existing behaviour (found in the Erlang/OTP framework): You write a module that implements specific code and use generic code of a behaviour. You should very rarely need to write your own behaviour, like you asked in your previous question. Joe Armstrong phrase does not mean that behaviours are used like object (The first things you need to do in an object system is to create a new one), but that the behaviour mechanism is a powerful way to solve some of the problems that object was made for (Most notably provide an architecture model for your application). -- Micka?l R?mond From luke@REDACTED Sun Sep 8 21:19:00 2002 From: luke@REDACTED (Luke Gorrie) Date: 08 Sep 2002 21:19:00 +0200 Subject: Behaviours In-Reply-To: <1031511170.3d7b9c821141c@webmail.spamcop.net> References: <1031511170.3d7b9c821141c@webmail.spamcop.net> Message-ID: Mickael Remond writes: > Regarding behaviours, most of the time you need to _use_ an existing > behaviour (found in the Erlang/OTP framework): You write a module > that implements specific code and use generic code of a > behaviour. You should very rarely need to write your own behaviour, > like you asked in your previous question. >From my own experience of learning erlang, I think it's easy to get the feeling that behaviours are more magical than they really are. Behaviours are very simple: you have one module that does some general/reusable stuff, and you pass it the name of another module to call for doing more specific things. So gen_server itself handles receiving/replying to messages and keeping the state record, and you tell it which module to call to actually do something with the messages and choose new states. It's pretty much the same thing as abstract classes (or interfaces declaring callbacks) in java, or using a struct of callbacks in C. The only magic part is the "-behaviour(name)." declaration in the source file, which AFAIK just makes the compiler check that your module has defined all the right functions for callbacks. So to make your own behaviour you just write one general module that takes the name of another module as a parameter, and have it call some well-defined functions of that module to do certain things. I think you can even hook into the compiler for the -behaviour stuff now. Cheers, Luke From vances@REDACTED Sun Sep 8 23:19:18 2002 From: vances@REDACTED (Vance Shipley) Date: Sun, 8 Sep 2002 17:19:18 -0400 Subject: Behaviours In-Reply-To: References: <1031511170.3d7b9c821141c@webmail.spamcop.net> Message-ID: <20020908211918.GA75033@frogman.motivity.ca> I can remember struggling to understand the "magic" of the standard behaviours. The light really came on for me when I realized the distinction between modules and processes. The two are pretty much unrelated. A module may be executed by many processes and a process may execute code from many modules. The documentation (for gen_fsm in this case) has the following description which, while being quite useful, can confuse this issue: A gen_fsm assumes all specific parts to be located in a callback module exporting a pre-defined set of functions. The relationship between the behaviour functions and the callback functions can be illustrated as follows: gen_fsm module Callback module -------------- --------------- gen_fsm:start_link -----> Module:init/1 gen_fsm:send_event -----> Module:StateName/2 gen_fsm:send_all_state_event -----> Module:handle_event/3 gen_fsm:sync_send_event -----> Module:StateName/3 gen_fsm:sync_send_all_state_event -----> Module:handle_sync_event/4 - -----> Module:handle_info/3 - -----> Module:terminate/3 - -----> Module:code_change/4 While there is nothing wrong with this description my read of it suggested there were messages being passed between processes. When I realized that using a behaviour simply meant that you were including code from a standard library into your own I truly understood them. -Vance From francesco@REDACTED Mon Sep 9 00:53:23 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Sun, 08 Sep 2002 23:53:23 +0100 Subject: Behaviours References: Message-ID: <3D7BD4E3.4070505@erlang-consulting.com> Lots of valid suggestions on behaviors came by in the past posts. To them, I would like to abstract a little and define "OTP". OTP consists of three things. 1 Erlang 2 A set of applications (or components) 3 A set of design principles. These design principles allow you to build an application which exhibit the exact same behavior as the applications which are part of the release. In an Erlang system, you create your applications, package them together with OTP's applications (So that the underlying system does not differentiate between them), and then use the SASL application to "glue and start them together". As Lennart said, part of these design principles involves abstracting away as much of the common code as possible, leaving only the specific code to be implemented by the designers. All client - servers for example follow the same structure. You start them, you stop them, you send synchronous and asynchronous messages to them. By abstracting away all of this common functionality into behavior modules, you can A. Allow all your processes to display a uniform interface to what ever application is controlling them. B. Allow your processes to follow a certain protocol (Such as when applying a software upgrade) C. Centrally add/control features and support such as debug printouts, stat monitoring, etc. D. Allow you to control them uniformly (ex. Start/stop as a whole) E. Allow a component based terminology When ever processes follow the same patterns, we say they share the same behavior. Based on this and all the other emails, I would suggest you reread the design principle document, as the message it is trying to portray might be a little clearer. Give us a shout if it isn't.. Francesco -- http://www.erlang-consulting.com Alex Peake wrote: >Thank you Francesco. > >I guess the answer is that there is nothing "of a tutorial nature". > >I was looking for more of: > >What is a behaviour? When do you need one? How do you build one? > >(I saw a quote from Joe Armstrong something of the nature that -- in Erlang you do not need objects >because you have behaviours -- so I wanted to explore what this meant) > >Alex > >>-----Original Message----- >>From: Francesco Cesarini [mailto:francesco@REDACTED] >>Sent: Sunday, September 08, 2002 6:02 AM >>To: Alex Peake >>Cc: erlang-questions@REDACTED >>Subject: Re: Behaviours >> >> >>Hi Alex, >> >>OTP behaviors are covered in detail in the Design Principles >>documentation at >>http://www.erlang.org/doc/r8b/doc/design_principles/part_frame.html It >>also gives a few good examples. You can complement this with the manual >>pages for the different behavior modules. Lastly, you can find tons of >>examples of usage of behaviors in the contributions section of the open >>directory. >> >>Good Luck, >>Francesco >>-- >>http://www.erlang-consulting.com >> >>Alex Peake wrote: >> >>>Is there, somewhere, a more tutorial description of how to create behaviours? >>> >>>Alex >>> >>> >>> >> >> > > > > From cpressey@REDACTED Mon Sep 9 02:09:39 2002 From: cpressey@REDACTED (Chris Pressey) Date: Sun, 8 Sep 2002 19:09:39 -0500 Subject: Behaviours In-Reply-To: References: <3D7B4A57.9070206@erlang-consulting.com> Message-ID: <20020908190939.08bf94e9.cpressey@catseye.mb.ca> On Sun, 8 Sep 2002 09:20:39 -0700 "Alex Peake" wrote: > Thank you Francesco. > > I guess the answer is that there is nothing "of a tutorial nature". > > I was looking for more of: > > What is a behaviour? When do you need one? How do you build one? > > (I saw a quote from Joe Armstrong something of the nature that -- in > Erlang you do not need objects because you have behaviours -- so I > wanted to explore what this meant) > > Alex To add my spin on this - clarifying or not :) What is a behaviour? Like an object class, a behaviour is a way of generalizing code. Unlike an object class, the generalized code is not specialized by overriding methods, but rather, by supplying callbacks. When do you need one? You benefit from using a behaviour whenever you have several different components which follow a common pattern. Like a regular module, the behaviour can encapsulate the common code used by the components. Unlike a regular module, the behaviour can define the interface the components will share, including callbacks that are used by the common code. Usually, the module which implements a behaviour can be thought of as a "callback module" - the functions it exposes will be called by the common code in the behaviour. (However, I don't think it necessarily stops there - the behaviour can specify what functions the implementing module should expose for ANY purpose - although that could be viewed as feature abuse.) How do you build one? You write a module which exports a behaviour_info/1 function. This function, when called with the atom 'callbacks', should return a list of {Function, Arity} tuples, which specify the functions that each module that implements this behaviour should export. The behaviour_info function is used by the compiler to ensure that modules which claim to implement that behaviour, really do. Anyway, that's my analysis of behaviours based on how they work, rather than what they're intended for. I tend to use them much as I would use abstract base classes if I were to do OO programming - except that the inheritance tree tends to be much shallower. A behaviour which itself implements a behaviour is a rare thing, but occasionally appropriate. -Chris From matthias@REDACTED Mon Sep 9 10:20:17 2002 From: matthias@REDACTED (Matthias Lang) Date: Mon, 9 Sep 2002 10:20:17 +0200 Subject: javascript modules index: tester with IE wanted In-Reply-To: References: <15736.24658.885008.810747@antilipe.corelatus.se> Message-ID: <15740.22977.731106.659912@antilipe.corelatus.se> Jenny Dybedahl writes: > That works, provided what I type really is the start of a module. If I > type something else, I get *a* man page for something that may or may > not be related. E.g., typing nntp gives me the net_adm man page; > typing foo gives me ftp; bar gives me BIF. IMO it'd be more useful to > be told that what I typed doesn't exist. That's a matter of taste, > though, so I'm not sure whether it's intentional or not. It's intentional, but it works the way you want if you use http://www.corelatus.com/~matthias/modules.html?pedantic (this is not documented) Matthias From achay@REDACTED Mon Sep 9 14:36:41 2002 From: achay@REDACTED (Antonio Chay Hidalgo) Date: Mon, 9 Sep 2002 12:36:41 +0000 Subject: BER and ASN1 question In-Reply-To: <20020907183207.2b7e0d82.achay@its.cl> References: <20020907183207.2b7e0d82.achay@its.cl> Message-ID: <20020909123641.0c666769.achay@its.cl> En Sat, 7 Sep 2002 18:32:07 +0000 Antonio Chay Hidalgo Escribio: > Hello! > There is a way to know what type of register comes in a file BER coded? Well, my question has grown. I need to detect if the format is BER or PER, and get what kind of ASN1 register contains. Where can i get some info? What i need to learn? Thanks in advance. -- Antonio Chay Hidalgo. From martin@REDACTED Mon Sep 9 18:52:20 2002 From: martin@REDACTED (martin j. logan) Date: Mon, 09 Sep 2002 11:52:20 -0500 Subject: Dual Processors Message-ID: <3D7CD1C4.1050407@vailsys.com> Hello all, I was just wondering if the current erlang implementation could reap considerable performace benefits from running on a dual CPU machine? I have an application, Call Detail Record Collection, that is very resource hungry. It spawns processes like mad - one for each truly concurrent activity. What hardware enviornment does ERTS thrive in? Thanks, Martin From spearce@REDACTED Mon Sep 9 19:36:17 2002 From: spearce@REDACTED (Shawn Pearce) Date: Mon, 9 Sep 2002 13:36:17 -0400 Subject: Dual Processors In-Reply-To: <3D7CD1C4.1050407@vailsys.com> References: <3D7CD1C4.1050407@vailsys.com> Message-ID: <20020909173617.GA392@spearce.org> Well, Erts today is not yet able to use multiple CPUs at once. The driver async thread system can use the other CPUs in the system to perform IO operations on, but this is only of benefit if you are doing that much IO... which is doubtful. Best is to setup a distributed Erlang system with one Erts node per CPU. Configure some type of pool resource or something to send jobs to the two nodes, trying to split the load between them as evenly as possible. Something of a PITA, since Erts won't do it on its own. Since you stated that your application is pretty concurrent, this may be pretty easy to setup. Fast single CPU boxes may be very good for Erts, as the cost to communicate between two nodes on the same machine is not much higher than the cost to communicate over a switched Ethernet network one hop. There is a difference, but multiple machines may give you extra memory bandwidth, not to mention more disk space and bandwidth and better reliability for hardware failure cases, esp. if you only need all nodes to meet some performance target, but can "limp along" with one or more down. "martin j. logan" wrote: > Hello all, > > I was just wondering if the current erlang implementation could > reap > considerable performace benefits from running on a dual CPU machine? > > I have an application, Call Detail Record Collection, that is very > resource hungry. > It spawns processes like mad - one for each truly concurrent activity. > What hardware > enviornment does ERTS thrive in? > > Thanks, > Martin > -- Shawn. Try the Moo Shu Pork. It is especially good today. From eleberg@REDACTED Tue Sep 10 12:12:16 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Tue, 10 Sep 2002 12:12:16 +0200 (MET DST) Subject: Behaviours Message-ID: <200209101012.g8AACGr09467@cbe.ericsson.se> > X-Authentication-Warning: frogman.motivity.ca: Host localhost.motivity.ca [127.0.0.1] claimed to be frogman.motivity.ca > Date: Sun, 8 Sep 2002 17:19:18 -0400 > From: Vance Shipley > To: erlang-questions@REDACTED > Subject: Re: Behaviours ...deleted > suggested there were messages being passed between processes. When I > realized that using a behaviour simply meant that you were including > code from a standard library into your own I truly understood them. i think of it as the other way around: when using a behaviour i include my code (the callback module) in the standard library. have i misunderstood things (again). bengt From Chandrashekhar.Mullaparthi@REDACTED Tue Sep 10 13:33:16 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Tue, 10 Sep 2002 12:33:16 +0100 Subject: Behaviours Message-ID: <04D356A3B172D611981B0008C791C312404AC4@imp02mbx.t-mobile.co.uk> Maybe it will be clearer if it is said that when you are using a behaviour, you are using code which implements that behaviour - you are not including anything. -----Original Message----- From: Bengt Kleberg [mailto:eleberg@REDACTED] > From: Vance Shipley > suggested there were messages being passed between processes. When I > realized that using a behaviour simply meant that you were including > code from a standard library into your own I truly understood them. i think of it as the other way around: when using a behaviour i include my code (the callback module) in the standard library. have i misunderstood things (again). bengt NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From erlang@REDACTED Wed Sep 11 00:24:37 2002 From: erlang@REDACTED (Peter Mander) Date: Tue, 10 Sep 2002 23:24:37 +0100 Subject: Megaco simple Media Gateway bleeds memory under load. References: Message-ID: <001b01c25919$07cc7710$2257893e@Athlon> Hi H?kan, hi Ulf I've been offline/bedridden with the flu, hence the delay on returning emails. This has forced me to think (in bed) rather than hack away at a "solution", and I now understand the problem better: messages are being queued by spawning new threads, but they are not being processed quickly enough to clear a growing backlog of messages. Hence your suggestion below of throttling the socket when the number of currently processed messages exceeds some upper threshold. Sorry for accusing Erlang of bleeding memory, it's simply not true! I'll hopefully soon be able to supply some feedback on my attempts at distributed encoding and decoding, there is a growing need to prove the scalability of the MGC and MG. They may end up being used as performance testing tools for our product, not just functional testing tools. Pete. ----- Original Message ----- From: "Hakan Mattsson" To: "Peter-Henry Mander" Cc: Sent: Wednesday, August 28, 2002 9:11 PM Subject: Re: Megaco simple Media Gateway bleeds memory under load. On Wed, 28 Aug 2002, Peter-Henry Mander wrote: Pete> I think understand you now, lets see if I got it. With a large enough Pete> heap, a spawned process will not require further chunks from system Pete> memory, and therefore will not cause garbage collection sweeps, but only Pete> while the process doesn't terminate. When the process itself terminates, Pete> garbage collection reclaims the process heap and anything else allocated Pete> from it in one sweep. Am I correct? If I am, I can understand why it Pete> would be more efficient than allocating and freeing small fragments of Pete> system memory, and that it would avoid memory fragmentation. As a dead process has no data alive, no GC sweep is needed at all (unless you use unified heap). Pete> But what if the megaco_messenger processes are spawned at a high rate, Pete> as they appear to be in the MG when receiving almost 1000 Pete> transactions/second? I suspect that memory will get eaten up very Pete> quickly by spawned processes with large heaps. Is it possible that the Pete> garbage collector process is starved (since CPU usage is 99%) due to the Pete> rate at which megaco_messenger processes are being spawned? My idea of Pete> maintaining a pool of megaco_messenger may not be an elegant solution, Pete> and I may be accused of micro-managing memory as would a C programmer! Pete> But I would like to persue it, simply to convince myself, either yes or Pete> no, whether this imperative pardigm may have value in a functional Pete> language. Regardless of the issue of spawning new fresh processes or reusing a pool of old ones, you can still get a more predictable memory consumption by explicitly blocking the socket when the number of currently processed messages exceeds some upper threshold and then unblock it at some lower threshold. Pete> I'll try to keep you updated on this, and the distributed MG Pete> as you describe below, and the Megaco V2 work I mentioned earlier. Pete> Pete> I wonder, since you seem to still be developing the Megaco stack, Pete> whether my feedback is useful to you? Yes, your feedback is useful. Our Megaco application will also support V2 (both text and binary), but currently not know when it will be completed. We need to discuss this internally when Micael returns from his vacation. My own work situation is quite unclear right now, as the Ericsson Computer Science Lab recently has ceased to exist. I hope that I still will have the opportunity to continue working with Erlang, but some dark forces in the new organization want me to work with something completely different (and boring) stuff. Pete> I am extremely interested in the Pete> partial/distributed decoding you mentioned in the last paragraph. Is Pete> there a complementary distributed encoding project in the pipeline? The encoding part is already distributed! There is no automatic load balancing, but you have the opportunity to choose any Erlang node and perform the encoding there. The encoding is performed on the node where the megaco:call/3 or megaco:cast/3 is invoked. /H?kan From mickael.remond@REDACTED Wed Sep 11 11:00:11 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Wed, 11 Sep 2002 11:00:11 +0200 Subject: Eddieware.org domain name lost and question about Enhanced DNS Message-ID: <1031734811.3d7f061b3ca9e@webmail.spamcop.net> Hello, It seems that Eddieware.org domain name has been lost. I am pretty sure I have been there very soon but it need lead to an advertissement page. I am trying to dig into this complex tool. To make it a little less complex, I wanted to separate the dns server so I can use it as an independant module. I manage to compile it. Launch does not output any message, but it does not seem to answer DNS request at all (Bind 4.x configuration file style). If someone has previous experience using Eddieware Enhanced DNS, maybe we could see together what is wrong. Thank you in advance. -- Micka?l R?mond From matthias@REDACTED Wed Sep 11 13:56:01 2002 From: matthias@REDACTED (Matthias Lang) Date: Wed, 11 Sep 2002 13:56:01 +0200 Subject: undocumented inet (and gen_tcp) Message-ID: <15743.12113.274093.982877@antilipe.corelatus.se> Hi, This should be useful for others. Inet (and related stuff, e.g. gen_tcp) have many undocumented features. Some of these are really useful: getopts/2 (lets you inspect the options in setopts) options/0 (gives a complete list of the options for get and setopts. There are 22 in R8B-2, the inet manpage documents only 10 of them.) getif/0 (list of network interfaces) getiflist/0 (ditto) ifget/2 (information about an interface, e.g. IP addr) ifset/2 getstat/2 (call stats/0 for the possible atoms) (Background: Normal gen_tcp behaviour when the remote receiver can't keep up is to block on send/2. Sometimes this is NOT what I want, sometimes I want to kill the 'full' socket rather than wait forever. The dumb solution which does something vaguely similar to what I want: Write code like this: {ok, Tref} = timer:apply_after(500, erlang, exit, [self(), kill]), gen_tcp:send(S, Data), timer:cancel(Tref). The nice, but undocumented, solution which does exactly what I want: gen_tcp:connect(Host, Port, [{send_timeout, 0}]) ) Question for Tony: what's that (unimplemented) 'pushf' stuff intended for? Matthias From phranck@REDACTED Wed Sep 11 15:56:54 2002 From: phranck@REDACTED (phranck@REDACTED) Date: Wed, 11 Sep 2002 15:56:54 +0200 (CEST) Subject: Remove from list Message-ID: <4102.195.193.202.94.1031752614.squirrel@webmail.xs4all.nl> Remove from list From tony@REDACTED Wed Sep 11 16:51:15 2002 From: tony@REDACTED (Tony Rogvall) Date: Wed, 11 Sep 2002 16:51:15 +0200 Subject: undocumented inet (and gen_tcp) References: <15743.12113.274093.982877@antilipe.corelatus.se> Message-ID: <3D7F5863.2010003@rogvall.com> Matthias Lang wrote: >Hi, > > > >Question for Tony: what's that (unimplemented) 'pushf' stuff intended for? > >Matthias > > pushf and popf was used to add stream filter functions etc. They became unusable when we removed the "middle man" process. Now all gen_tcp, gen_udp sockets are represented by ports. The reason for the change was SPEED (traded for flexibility). By implementing my old idea with port filters (.so/.dll modules that could be pushed on a port) the pushf and popf could very well be implemented again ? /Tony From jilani.khaldi@REDACTED Wed Sep 11 20:15:48 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Wed, 11 Sep 2002 20:15:48 +0200 Subject: Why erlang.org and ericsson.com use Apache/Perl/PHP instead of inters/Erlang? Message-ID: <3D7F8854.4080705@tin.it> Hi All, as subject. Is there a reasonable answer? jilani ps. asked to www.netcraft.com From matthias@REDACTED Wed Sep 11 23:09:46 2002 From: matthias@REDACTED (Matthias Lang) Date: Wed, 11 Sep 2002 23:09:46 +0200 Subject: Why erlang.org and ericsson.com use Apache/Perl/PHP instead of inters/Erlang? In-Reply-To: <3D7F8854.4080705@tin.it> References: <3D7F8854.4080705@tin.it> Message-ID: <15743.45338.523638.725936@antilipe.corelatus.se> Jilani Khaldi writes: > as subject. Is there a reasonable answer? Apache and INETs aren't really intended for the same thing. Apache is primarily designed to run large sites and it does that quite well. There's a rich collection of tools for Apache and lots of people know how to run it. Inets, on the other hand, is just a part of Erlang's libraries. Great if you have an Erlang-based product and want a webserver on it so people can do O&M from a browser. Infinitely customisable and really easy to interface to the rest of your Erlang code, but definitely not optimised for performance or ease of use for running a mostly static site like erlang.org. If you want to push the envelope, take a look at http://sourceforge.net/projects/erlyaws/ Matthias From feeley@REDACTED Thu Sep 12 00:38:59 2002 From: feeley@REDACTED (Marc Feeley) Date: Wed, 11 Sep 2002 18:38:59 -0400 Subject: Impact of native compilation In-Reply-To: (message from Luke Gorrie on 06 Sep 2002 20:18:27 +0200) References: <1031332926.3d78e43e85340@webmail.spamcop.net> <200209061803.g86I31K20857@dino00.iro.umontreal.ca> Message-ID: <200209112238.g8BMcxu10139@dino00.iro.umontreal.ca> > What's the word on ETOS' availability? Last year I mailed in asking > for the sources to the lastest version, but didn't hear back. The > website only has 2.3 in binary, and 1.4 as source. ETOS has not progressed since version 2.3 and it is unlikely that my group will ever finish the implementation completely (i.e. conformance to the Erlang spec). Remember that ETOS is a research project whose aim is to show that it is possible to quickly implement a compiler from Erlang to Scheme that achieves good performance. I think we attained that goal with ETOS even though not all of Erlang's libraries are implemented. Implementing good Erlang librairies takes a lot of time, and there is unfortunately very little "academic reward". Given that Hipe has reached (and most likely by now exceeded) the performance of ETOS, and Hipe implements all of Erlang, there is little real need to continue the development of ETOS. Note that I am still interested in Erlang. I think there are many lessons to learn from it. Some of the features are really important and relatively unique (distribution, communication, dynamic code loading). There are also some problems with Erlang's syntax and semantics (exceptions, records, types, macros, distributed garbage collection, etc). One of my pet projects is a redesign of an Erlang-like language "from scratch". So stay tuned... but then again don't hold your breath! Marc From luke@REDACTED Thu Sep 12 00:58:06 2002 From: luke@REDACTED (Luke Gorrie) Date: 12 Sep 2002 00:58:06 +0200 Subject: Impact of native compilation In-Reply-To: <200209112238.g8BMcxu10139@dino00.iro.umontreal.ca> References: <1031332926.3d78e43e85340@webmail.spamcop.net> <200209061803.g86I31K20857@dino00.iro.umontreal.ca> <200209112238.g8BMcxu10139@dino00.iro.umontreal.ca> Message-ID: Marc Feeley writes: > > What's the word on ETOS' availability? Last year I mailed in asking > > for the sources to the lastest version, but didn't hear back. The > > website only has 2.3 in binary, and 1.4 as source. > > ETOS has not progressed since version 2.3 and it is unlikely that my > group will ever finish the implementation completely (i.e. conformance > to the Erlang spec). Remember that ETOS is a research project whose > aim is to show that it is possible to quickly implement a compiler > from Erlang to Scheme that achieves good performance. I think we > attained that goal with ETOS even though not all of Erlang's libraries > are implemented. Agreed, it looks like a very nice compiler to me. But my question is: why is the latest release only distributed as a binary, with no source code? The website lets you download the sources for version 1.4, but only linux/solaris binaries for version 2.3. There doesn't seem to be any info about how they differ, either. Well, my real question is: How can I get a copy of 2.3's sources? I was playing with ETOS a little bit last year and liked the look of it, but there's too much of a psychological barrier to hack on a copy that sounds so outdated :-). Otherwise it's pretty appealing. Cheers, Luke From mickael.remond@REDACTED Thu Sep 12 11:15:32 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Thu, 12 Sep 2002 11:15:32 +0200 Subject: Eddieware.org domain name lost and question about Enhanced DNS Message-ID: <1031822132.3d805b34ad452@webmail.spamcop.net> Pekka Hedqvist : > I dug around a lot in the DNS server a few years back. Dunno if I can > help U but gimme some questions and I see if I remember anything. Where > did U fetch it from, sourceforge? Yes. I used the CVS version which seems more up to date and can work with only few changes with OTP R8B-2. I manage to make to compile Eddieware and the DNS is properly working. Now I did not manage to isolate it from the other part of Eddieware. It seems to start correctly but in fact does not accept connection. I only took the dns_server part from eddieware. Do you know if there are other dependancies ? -- Micka?l R?mond From kent@REDACTED Thu Sep 12 12:44:01 2002 From: kent@REDACTED (Kent Boortz) Date: 12 Sep 2002 12:44:01 +0200 Subject: Why erlang.org and ericsson.com use Apache/Perl/PHP instead of inters/Erlang? In-Reply-To: <3D7F8854.4080705@tin.it> References: <3D7F8854.4080705@tin.it> Message-ID: Jilani Khaldi writes: > as subject. Is there a reasonable answer? One of the reason that www.erlang.org don't use the Erlang web server is that we don't have time to set up and maintain it. We have apache up and running and it works so other things have higher priority. We use the erlang web server for our project internal intranet web server, kent From erlang@REDACTED Thu Sep 12 13:31:40 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Thu, 12 Sep 2002 12:31:40 +0100 Subject: TopologyRequest syntax error Message-ID: <3D807B1C.1050003@manderp.freeserve.co.uk> Hi everyone, I'm using the Megaco stack in Erlang/OTP reusing the simple MGC and simple MG code, and I'm having a problem with the TopologyRequest issued from the Gateway Controller. The Erlang code used to add a TopologyRequest is included below. The Controller issues the ActionRequest without complaining, but the Gateway at the other end gives a syntax error, correctly I believe since the Controller issues a TopologyRequest within a TopologyRequest, and that doesn't look right to me! What am I doing wrong? Pete. Controller code: #'ActionRequest'{ contextId = ContextId, contextRequest = #'ContextRequest'{ topologyReq = [ #'TopologyRequest'{ terminationFrom = #megaco_term_id{ contains_wildcards = false, id = ["from"] }, terminationTo = #megaco_term_id{ contains_wildcards = false, id = ["to"] }, topologyDirection = bothway } ] }, commandRequests = CommandRequestList } Trace of outgoing message from the Controller: DETAIL LEVEL: 60 LABEL: send trans request #2 FROM: controller TO: mediaproxy EVENT_TS: 2002-9-12 11.21.11.802772 TRACE_TS: 2002-9-12 11.21.11.802273 CONTENTS: MESSAGE: MEGACO/1 controller Transaction = 2 { Context = 4 { Topology { Topology { from, to, Bothway } }, Modify = 2, Modify = 3 } } Trace of syntax error report from the Gateway DETAIL LEVEL: 60 LABEL: return: syntax error FROM: MediaProxy@REDACTED TO: MediaProxy EVENT_TS: 2002-9-12 11.21.11.803644 TRACE_TS: 2002-9-12 11.21.11.803317 CONTENTS: CODE: 400 TEXT: Syntax error on line 4 {return,reply} ERROR: [{reason,{4,megaco_text_parser,["syntax error before: ",["'LBRKT'"]]}}, {token,[{'SafeChars',1,"megaco/1"}, {'SEP',1}, {'SafeChars',1,"controller"}, {'SEP',1}, {'TransToken',1,"transaction"}, {'EQUAL',1}, {'SafeChars',1,"2"}, {'LBRKT',1}, {'CtxToken',2,"context"}, {'EQUAL',2}, {'SafeChars',2,"4"}, {'LBRKT',2}, {'TopologyToken',3,"topology"}, {'LBRKT',3}, {'TopologyToken',4,"topology"}, {'LBRKT',4}, {'SafeChars',5,"from"}, {'COMMA',5}, {'TimeOutToken',6,"to"}, {'COMMA',6}, {'BothwayToken',7,"bothway"}, {'RBRKT',7}, {'RBRKT',8}, {'COMMA',8}, {'ModifyToken',9,"modify"}, {'EQUAL',9}, {'SafeChars',9,"2"}, {'COMMA',9}, {'ModifyToken',10,"modify"}, {'EQUAL',10}, {'SafeChars',10,"3"}, {'RBRKT',10}, {'RBRKT',11}, {endOfMessage,11,endOfMessage}]}, {chars, (deleted for clarity) }] From hakan@REDACTED Thu Sep 12 14:43:52 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 12 Sep 2002 14:43:52 +0200 (MEST) Subject: TopologyRequest syntax error In-Reply-To: <3D807B1C.1050003@manderp.freeserve.co.uk> Message-ID: On Thu, 12 Sep 2002, Peter-Henry Mander wrote: erlang>I'm using the Megaco stack in Erlang/OTP reusing the simple MGC and erlang>simple MG code, and I'm having a problem with the TopologyRequest issued erlang>from the Gateway Controller. The Erlang code used to add a erlang>TopologyRequest is included below. The Controller issues the erlang>ActionRequest without complaining, but the Gateway at the other end erlang>gives a syntax error, correctly I believe since the Controller issues erlang>a TopologyRequest within a TopologyRequest, and that doesn't look right erlang>to me! erlang> erlang>What am I doing wrong? Congratulations, you seem to be the first one that have decoded textual topology requests! There was a bug in megaco/src/text/megaco_text_gen.hrl. I have fixed the bug in the attached file. It will be included in next snapshot for Erlang/OTP R9. Replace the old version of the file and re-run make in megaco/src/text. /H?kan -------------- next part -------------- %% ``The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in %% compliance with the License. You should have received a copy of the %% Erlang Public License along with this software. If not, it can be %% retrieved via the world wide web at http://www.erlang.org/. %% %% Software distributed under the License is distributed on an "AS IS" %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See %% the License for the specific language governing rights and limitations %% under the License. %% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB. %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings %% AB. All Rights Reserved.'' %% %% $Id$ %% %%---------------------------------------------------------------------- %% Purpose: Encode Megaco/H.248 text messages from internal form %%---------------------------------------------------------------------- -define(META_ENC(Type, Item), Item) . %% -define(META_ENC(Type, Item), megaco_meta_package:encode(text, Type, Item)). %% -define(META_DEC(Type, Item), megaco_meta_package:decode(text, Type, Item)). enc_MegacoMessage(Val) -> State = ?INIT_INDENT, enc_MegacoMessage(Val, State). enc_MegacoMessage(Val, State) when record(Val, 'MegacoMessage') -> [ ?LWSP, enc_AuthenticationHeader(Val#'MegacoMessage'.authHeader, State), enc_Message( Val#'MegacoMessage'.mess, State) ]. enc_Transaction(Val) -> State = ?INIT_INDENT, enc_Transaction(Val, State). enc_CommandRequest(Val) -> State = ?INIT_INDENT, enc_CommandRequest(Val, State). enc_ActionReply(Val) -> State = ?INIT_INDENT, enc_ActionReply(Val, State). enc_AuthenticationHeader(asn1_NOVALUE, _State) -> []; enc_AuthenticationHeader(Val, State) when record(Val, 'AuthenticationHeader') -> [ ?AuthToken, ?EQUAL, enc_SecurityParmIndex(Val#'AuthenticationHeader'.secParmIndex, State), ?COLON, enc_SequenceNum(Val#'AuthenticationHeader'.seqNum, State), ?COLON, enc_AuthData(Val#'AuthenticationHeader'.ad, State), ?SEP_INDENT(State) ]. enc_SecurityParmIndex({'SecurityParmIndex',Val}, State) -> enc_SecurityParmIndex(Val, State); enc_SecurityParmIndex(Val, State) -> [ "0x", enc_HEXDIG(Val, State, 8, 8) ]. enc_SequenceNum({'SequenceNum',Val}, State) -> enc_SequenceNum(Val, State); enc_SequenceNum(Val, State) -> [ "0x", enc_HEXDIG(Val, State, 8, 8) ]. enc_AuthData({'AuthData',Val}, State) -> enc_AuthData(Val, State); enc_AuthData(Val, State) -> [ "0x", enc_HEXDIG(Val, State, 32, 64) ]. enc_Message(Val, State) when record(Val, 'Message') -> [ ?MegacopToken, ?SLASH, enc_version(Val#'Message'.version, State), ?SEP, enc_MId(Val#'Message'.mId, State), ?SEP_INDENT(State), enc_Message_messageBody(Val#'Message'.messageBody, State) ]. enc_version(Val, State) when integer(Val), Val >= 0 -> enc_DIGIT(Val, State, 0, 99). enc_Message_messageBody({'Message_messageBody',Val}, State) -> enc_Message_messageBody(Val, State); enc_Message_messageBody({Tag, Val}, State) -> case Tag of messageError -> enc_ErrorDescriptor(Val, State); transactions -> enc_Message_messageBody_transactions(Val, State) end. enc_Message_messageBody_transactions({'Message_messageBody_transactions',Val}, State) -> enc_Message_messageBody_transactions(Val, State); enc_Message_messageBody_transactions(Val, State) when list(Val), Val /= []-> [enc_Transaction(T, State) || T <- Val]. enc_MId({'MId',Val}, State) -> enc_MId(Val, State); enc_MId({Tag, Val}, State) -> case Tag of ip4Address -> enc_IP4Address(Val, State); ip6Address -> enc_IP6Address(Val, State); domainName -> enc_DomainName(Val, State); deviceName -> enc_PathName(Val, State); mtpAddress -> enc_mtpAddress(Val, State) end. enc_mtpAddress(Val, State) -> [ ?MtpToken, ?LBRKT, enc_OCTET_STRING(Val, State, 2, 4), ?RBRKT ]. enc_DomainName(Val, State) when record(Val, 'DomainName') -> [ $<, %% BUGBUG: (ALPHA / DIGIT) *63(ALPHA / DIGIT / "-" / ".") enc_STRING(Val#'DomainName'.name, State, 1, 64), $>, case Val#'DomainName'.portNumber of asn1_NOVALUE -> []; PortNumber -> [ $:, enc_portNumber(PortNumber, State) ] end ]. enc_IP4Address(Val, State) when record(Val, 'IP4Address') -> [A1, A2, A3, A4] = Val#'IP4Address'.address, [ $[, enc_V4hex(A1, State), ?DOT, enc_V4hex(A2, State), ?DOT, enc_V4hex(A3, State), ?DOT, enc_V4hex(A4, State), $], case Val#'IP4Address'.portNumber of asn1_NOVALUE -> []; PortNumber -> [ $:, enc_portNumber(PortNumber, State) ] end ]. enc_V4hex(Val, State) -> enc_DIGIT(Val, State, 0, 255). enc_IP6Address(Val, State) when record(Val, 'IP6Address'), list(Val#'IP6Address'.address), length(Val#'IP6Address'.address) == 16 -> exit(ipv6_not_supported), %% BUGBUG: nyi [ $[, Val#'IP6Address'.address, $], case Val#'IP6Address'.portNumber of asn1_NOVALUE -> []; PortNumber -> [ $:, enc_portNumber(PortNumber, State) ] end ]. enc_PathName({'PathName',Val}, State) -> enc_PathName(Val, State); enc_PathName(Val, State) -> %% BUGBUG: ["*"] NAME *("/" / "*"/ ALPHA / DIGIT /"_" / "$" ) %% BUGBUG: ["@" pathDomainName ] enc_STRING(Val, State, 1, 64). enc_Transaction({'Transaction',Val}, State) -> enc_Transaction(Val, State); enc_Transaction({Tag, Val}, State) -> case Tag of transactionRequest -> enc_TransactionRequest(Val, State); transactionPending -> enc_TransactionPending(Val, State); transactionReply -> enc_TransactionReply(Val, State); transactionResponseAck -> [enc_TransactionAck(T, State) || T <- Val] end. enc_TransactionAck(Val, State) when record(Val, 'TransactionAck') -> [ ?ResponseAckToken, ?LBRKT_INDENT(State), enc_TransactionId(Val#'TransactionAck'.firstAck, ?INC_INDENT(State)), case Val#'TransactionAck'.lastAck of asn1_NOVALUE -> []; LastAck -> enc_TransactionId(LastAck, State) end, ?RBRKT_INDENT(State) ]. enc_TransactionId({'TransactionId',Val}, State) -> enc_TransactionId(Val, State); enc_TransactionId(Val, State) -> enc_UINT32(Val, State). enc_TransactionRequest(Val, State) when record(Val, 'TransactionRequest') -> [ ?TransToken, ?EQUAL, enc_TransactionId(Val#'TransactionRequest'.transactionId, State), ?LBRKT_INDENT(State), enc_TransactionRequest_actions(Val#'TransactionRequest'.actions, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_TransactionRequest_actions({'TransactionRequest_actions',Val}, State) -> enc_TransactionRequest_actions(Val, State); enc_TransactionRequest_actions([Mand | Opt], State) -> [enc_ActionRequest(Mand, State) | [[?COMMA_INDENT(State), enc_ActionRequest(Val, State)] || Val <- Opt]]. enc_TransactionPending(Val, State) when record(Val, 'TransactionPending') -> [?PendingToken, ?EQUAL, enc_TransactionId(Val#'TransactionPending'.transactionId, State), ?LBRKT_INDENT(State), ?RBRKT_INDENT(State) ]. enc_TransactionReply(Val, State) when record(Val, 'TransactionReply') -> [ ?ReplyToken, ?EQUAL, enc_TransactionId(Val#'TransactionReply'.transactionId, State), ?LBRKT_INDENT(State), enc_immAckRequired(Val#'TransactionReply'.immAckRequired, State), enc_TransactionReply_transactionResult(Val#'TransactionReply'.transactionResult, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_immAckRequired(Val, State) -> case Val of asn1_NOVALUE -> []; 'NULL' -> [?ImmAckRequiredToken, ?COMMA_INDENT(?INC_INDENT(State))] end. enc_TransactionReply_transactionResult({'TransactionReply_transactionResult',Val}, State) -> enc_TransactionReply_transactionResult(Val, State); enc_TransactionReply_transactionResult({Tag, Val}, State) -> case Tag of transactionError -> enc_ErrorDescriptor(Val, State); actionReplies -> enc_TransactionReply_transactionResult_actionReplies(Val, State) end. enc_TransactionReply_transactionResult_actionReplies({'TransactionReply_transactionResult_actionReplies',Val}, State) -> enc_TransactionReply_transactionResult_actionReplies(Val, State); enc_TransactionReply_transactionResult_actionReplies([Mand | Opt], State) -> [enc_ActionReply(Mand, State), [[?COMMA_INDENT(State), enc_ActionReply(Val, State)] || Val <- Opt]]. enc_ErrorDescriptor(Val, State) when record(Val, 'ErrorDescriptor') -> [ ?ErrorToken, ?EQUAL, enc_ErrorCode(Val#'ErrorDescriptor'.errorCode, State), ?LBRKT, case Val#'ErrorDescriptor'.errorText of asn1_NOVALUE -> []; ErrorText -> enc_ErrorText(ErrorText, State) end, ?RBRKT ]. enc_ErrorCode({'ErrorCode',Val}, State)-> enc_ErrorCode(Val, State); enc_ErrorCode(Val, State) -> enc_DIGIT(Val, State, 0, 999). enc_ErrorText({'ErrorText',Val}, State) -> enc_ErrorText(Val, State); enc_ErrorText(Val, State) -> enc_QUOTED_STRING(Val, State). enc_ContextID({'ContextID',Val}, State) -> enc_ContextID(Val, State); enc_ContextID(Val, State) -> case Val of ?megaco_all_context_id -> $*; ?megaco_null_context_id -> $-; ?megaco_choose_context_id -> $$; Int when integer(Int) -> enc_UINT32(Int, State) end. enc_ActionRequest(Val, State) when record(Val, 'ActionRequest') -> [ ?CtxToken, ?EQUAL, enc_ContextID(Val#'ActionRequest'.contextId, State), ?LBRKT_INDENT(State), enc_list([{[Val#'ActionRequest'.contextAttrAuditReq], fun enc_ContextAttrAuditRequest/2}] ++ decompose_ContextRequest(Val#'ActionRequest'.contextRequest) ++ [{Val#'ActionRequest'.commandRequests, fun enc_CommandRequest/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_ActionReply(Val, State) when record(Val, 'ActionReply') -> [ ?CtxToken, ?EQUAL, enc_ContextID(Val#'ActionReply'.contextId, State), ?LBRKT_INDENT(State), case Val#'ActionReply'.errorDescriptor of asn1_NOVALUE -> enc_list(decompose_ContextRequest(Val#'ActionReply'.contextReply) ++ [{Val#'ActionReply'.commandReply, fun enc_CommandReply/2}], ?INC_INDENT(State)); ErrorDesc when Val#'ActionReply'.contextReply == asn1_NOVALUE, Val#'ActionReply'.commandReply == [] -> enc_ErrorDescriptor(ErrorDesc, ?INC_INDENT(State)) end, ?RBRKT_INDENT(State) ]. decompose_ContextRequest(asn1_NOVALUE) -> [{[], dummy}] ; decompose_ContextRequest(Val) when record(Val, 'ContextRequest') -> OptPriority = case Val#'ContextRequest'.priority of asn1_NOVALUE -> {[], dummy}; Prio -> {[Prio], fun enc_priority/2} end, OptEmergency = case Val#'ContextRequest'.emergency of asn1_NOVALUE -> {[], dummy}; false -> {[], dummy}; true -> {[?EmergencyToken], fun(Elem, _) -> Elem end} end, OptTopologyReq = case Val#'ContextRequest'.topologyReq of asn1_NOVALUE -> {[], dummy}; {'ContextRequest_topologyReq', asn1_NOVALUE} -> {[], dummy}; {'ContextRequest_topologyReq', List} -> {List, fun enc_TopologyRequest/2}; List -> {[List], fun enc_TopologyRequest/2} end, [OptPriority, OptEmergency, OptTopologyReq]. enc_priority(Val, State) -> [ ?PriorityToken, ?EQUAL, enc_UINT16(Val, State) ]. enc_ContextAttrAuditRequest(Val, State) when record(Val, 'ContextAttrAuditRequest') -> [ ?ContextAuditToken, ?LBRKT_INDENT(State), enc_list([{[Val#'ContextAttrAuditRequest'.topology], fun('NULL', _) -> ?TopologyToken end}, {[Val#'ContextAttrAuditRequest'.emergency], fun('NULL', _) -> ?EmergencyToken end}, {[Val#'ContextAttrAuditRequest'.priority], fun('NULL', _) -> ?PriorityToken end}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_CommandRequest(Val, State) when record(Val, 'CommandRequest') -> [ case Val#'CommandRequest'.optional of asn1_NOVALUE -> []; 'NULL' -> "O-" end, case Val#'CommandRequest'.wildcardReturn of asn1_NOVALUE -> []; 'NULL' -> "W-" end, enc_Command(Val#'CommandRequest'.command, State) ]. enc_Command({'Command',Val}, State) -> enc_Command(Val, State); enc_Command({Tag, Val}, State) -> case Tag of addReq -> [?AddToken, enc_AmmRequest(Val, State)]; moveReq -> [?MoveToken, enc_AmmRequest(Val, State)]; modReq -> [?ModifyToken, enc_AmmRequest(Val, State)]; subtractReq -> [?SubtractToken, enc_SubtractRequest(Val, State)]; auditCapRequest -> [?AuditCapToken, enc_AuditRequest(Val, State)]; auditValueRequest -> [?AuditValueToken, enc_AuditRequest(Val, State)]; notifyReq -> [?NotifyToken, enc_NotifyRequest(Val, State)]; serviceChangeReq -> [?ServiceChangeToken, enc_ServiceChangeRequest(Val, State)] end. enc_CommandReply({'CommandReply',Val}, State) -> enc_CommandReply(Val, State); enc_CommandReply({Tag, Val}, State) -> case Tag of addReply -> [?AddToken, enc_AmmsReply(Val, State)]; moveReply -> [?MoveToken, enc_AmmsReply(Val, State)]; modReply -> [?ModifyToken, enc_AmmsReply(Val, State)]; subtractReply -> [?SubtractToken, enc_AmmsReply(Val, State)]; auditCapReply -> [?AuditCapToken, enc_AuditReply(Val, State)]; auditValueReply -> [?AuditValueToken, enc_AuditReply(Val, State)]; notifyReply -> [?NotifyToken, enc_NotifyReply(Val, State)]; serviceChangeReply -> [?ServiceChangeToken, enc_ServiceChangeReply(Val, State)] end. enc_TopologyRequest(Val, State) when list(Val) -> [ ?TopologyToken, ?LBRKT_INDENT(State), enc_list([{Val, fun enc_TopologyRequest1/2}],?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_TopologyRequest1(Val, State) when record(Val, 'TopologyRequest') -> [ fun(S) -> [ enc_TerminationID(Val#'TopologyRequest'.terminationFrom, S), ?COMMA_INDENT(S), enc_TerminationID(Val#'TopologyRequest'.terminationTo, S), ?COMMA_INDENT(S), case Val#'TopologyRequest'.topologyDirection of bothway -> ?BothwayToken; isolate -> ?IsolateToken; oneway -> ?OnewayToken end ] end(?INC_INDENT(State)) ]. enc_AmmRequest(Val, State) when record(Val, 'AmmRequest') -> [ %% Assume that Token is added elsewhere ?EQUAL, enc_TerminationIDList1(Val#'AmmRequest'.terminationID, State), enc_opt_brackets( enc_list([{Val#'AmmRequest'.descriptors, fun enc_ammDescriptor/2}], ?INC_INDENT(State)), State) ]. enc_ammDescriptor({Tag, Desc}, State) -> case Tag of mediaDescriptor -> enc_MediaDescriptor(Desc, State); modemDescriptor -> enc_ModemDescriptor(Desc, State); muxDescriptor -> enc_MuxDescriptor(Desc, State); eventsDescriptor -> enc_EventsDescriptor(Desc, State); eventBufferDescriptor -> enc_EventBufferDescriptor(Desc, State); signalsDescriptor -> enc_SignalsDescriptor(Desc, State); digitMapDescriptor -> enc_DigitMapDescriptor(Desc, State); auditDescriptor -> enc_AuditDescriptor(Desc, State) end. enc_AmmsReply(Val, State) when record(Val, 'AmmsReply') -> [ ?EQUAL, enc_TerminationIDList1(Val#'AmmsReply'.terminationID, State), case Val#'AmmsReply'.terminationAudit of asn1_NOVALUE -> []; [] -> []; TermAudit -> [ ?LBRKT_INDENT(State) , enc_TerminationAudit(TermAudit, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ] end ]. enc_SubtractRequest(Val, State) when record(Val, 'SubtractRequest') -> [ %% Assume that Token is added elsewhere ?EQUAL, enc_TerminationIDList1(Val#'SubtractRequest'.terminationID, State), case Val#'SubtractRequest'.auditDescriptor of asn1_NOVALUE -> []; AuditDescr -> [ ?LBRKT_INDENT(State) , enc_AuditDescriptor(AuditDescr, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ] end ]. enc_AuditRequest(Val, State) when record(Val, 'AuditRequest') -> [ %% Assume that Token is added elsewhere ?EQUAL, enc_TerminationIDList1([Val#'AuditRequest'.terminationID], State), case Val#'AuditRequest'.auditDescriptor of asn1_NOVALUE -> []; AuditDescr -> [ ?LBRKT_INDENT(State) , enc_AuditDescriptor(AuditDescr, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ] end ]. %% auditReply = (AuditValueToken / AuditCapToken ) %% ( contextTerminationAudit / auditOther) %% auditOther = EQUAL TerminationID LBRKT %% terminationAudit RBRKT %% terminationAudit = auditReturnParameter *(COMMA auditReturnParameter) %% %% contextTerminationAudit = EQUAL CtxToken ( terminationIDList / %% LBRKT errorDescriptor RBRKT ) enc_AuditReply({Tag, Val}, State) -> case Tag of contextAuditResult -> [ ?EQUAL, ?CtxToken, enc_TerminationIDListN(Val, State) ]; error -> [ ?EQUAL, ?CtxToken, ?LBRKT_INDENT(State), enc_ErrorDescriptor(Val, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]; auditResult when record(Val, 'AuditResult') -> %% auditOther [ ?EQUAL, enc_TerminationID(Val#'AuditResult'.terminationID, State), ?LBRKT_INDENT(State), enc_TerminationAudit(Val#'AuditResult'.terminationAuditResult, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ] end. enc_AuditDescriptor(Val, State) when record(Val, 'AuditDescriptor') -> [ ?AuditToken, case Val#'AuditDescriptor'.auditToken of asn1_NOVALUE -> [?LBRKT, ?RBRKT]; List -> [ ?LBRKT_INDENT(State), enc_list([{List, fun enc_auditItem/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ] end ]. enc_auditItem(Val, _State) -> case Val of muxToken -> ?MuxToken; modemToken -> ?ModemToken; mediaToken -> ?MediaToken; eventsToken -> ?EventsToken; signalsToken -> ?SignalsToken; digitMapToken -> ?DigitMapToken; statsToken -> ?StatsToken; observedEventsToken -> ?ObservedEventsToken; packagesToken -> ?PackagesToken; eventBufferToken -> ?EventBufferToken end. enc_TerminationAudit({'TerminationAudit',Val}, State) -> enc_TerminationAudit(Val, State); enc_TerminationAudit([], _State) -> []; enc_TerminationAudit([Mand | Opt], State) -> [enc_AuditReturnParameter(Mand, State), [[?COMMA_INDENT(State), enc_AuditReturnParameter(Val, State)] || Val <- Opt]]. enc_AuditReturnParameter({'AuditReturnParameter',Val}, State) -> enc_AuditReturnParameter(Val, State); enc_AuditReturnParameter({Tag, Val}, State) -> case Tag of errorDescriptor -> enc_ErrorDescriptor(Val, State); mediaDescriptor -> enc_MediaDescriptor(Val, State); modemDescriptor -> enc_ModemDescriptor(Val, State); muxDescriptor -> enc_MuxDescriptor(Val, State); eventsDescriptor -> enc_EventsDescriptor(Val, State); eventBufferDescriptor -> enc_EventBufferDescriptor(Val, State); signalsDescriptor -> enc_SignalsDescriptor(Val, State); digitMapDescriptor -> enc_DigitMapDescriptor(Val, State); observedEventsDescriptor -> enc_ObservedEventsDescriptor(Val, State); statisticsDescriptor -> enc_StatisticsDescriptor(Val, State); packagesDescriptor -> enc_PackagesDescriptor(Val, State); emptyDescriptors -> enc_EmptyDescriptors(Val, State) end. enc_EmptyDescriptors(Val, State) when record(Val, 'AuditDescriptor') -> [ case Val#'AuditDescriptor'.auditToken of asn1_NOVALUE -> []; List -> enc_list([{List, fun enc_auditItem/2}], ?INC_INDENT(State)) end ]. enc_NotifyRequest(Val, State) when record(Val, 'NotifyRequest') -> [ %% Assume that Token is added elsewhere ?EQUAL, enc_TerminationIDList1(Val#'NotifyRequest'.terminationID, State), ?LBRKT_INDENT(State), %% BUGBUG: Mismatch between ASN.1 and ABNF %% BUGBUG: The following ought to be a 'choice' case Val#'NotifyRequest'.errorDescriptor of asn1_NOVALUE -> OED = Val#'NotifyRequest'.observedEventsDescriptor, enc_ObservedEventsDescriptor(OED, ?INC_INDENT(State)); ErrorDescr -> enc_ErrorDescriptor(ErrorDescr, ?INC_INDENT(State)) end, ?RBRKT_INDENT(State) ]. enc_NotifyReply(Val, State) when record(Val, 'NotifyReply') -> [ %% Assume that Token is added elsewhere ?EQUAL, case Val#'NotifyReply'.terminationID of asn1_NOVALUE -> exit(asn1_not_compliant_with_abnf); TermId -> enc_TerminationIDList1(TermId, State) end, case Val#'NotifyReply'.errorDescriptor of asn1_NOVALUE -> []; ErrorDescr -> [ ?LBRKT_INDENT(State), enc_ErrorDescriptor(ErrorDescr, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ] end ]. enc_ObservedEventsDescriptor(Val, State) when record(Val, 'ObservedEventsDescriptor') -> [ ?ObservedEventsToken, ?EQUAL, enc_RequestID(Val#'ObservedEventsDescriptor'.requestId, State), ?LBRKT_INDENT(State), enc_observedEventsDescriptors(Val#'ObservedEventsDescriptor'.observedEventLst, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_observedEventsDescriptors([Mand | Opt], State) -> [enc_ObservedEvent(Mand, State), [[?COMMA_INDENT(State), enc_ObservedEvent(Val, State)] || Val <- Opt]]. %% ;time per event, because it might be buffered %% observedEvent = [ TimeStamp LWSP COLON] LWSP %% pkgdName [ LBRKT observedEventParameter %% *(COMMA observedEventParameter) RBRKT ] %% %% ;at-most-once eventStream, every eventParameterName at most once %% observedEventParameter = eventStream / eventOther enc_ObservedEvent(Val, State) when record(Val, 'ObservedEvent') -> [ case Val#'ObservedEvent'.timeNotation of asn1_NOVALUE -> []; TimeStamp -> [ enc_TimeNotation(TimeStamp, State), ?LWSP, ?COLON ] end, ?LWSP, enc_EventName(Val#'ObservedEvent'.eventName, State), enc_opt_brackets( enc_list([{[Val#'ObservedEvent'.streamID], fun enc_eventStream/2}, {Val#'ObservedEvent'.eventParList, fun enc_eventOther/2}], ?INC_INDENT(State)), State) ]. enc_EventName({'EventName',Val}, State) -> enc_EventName(Val, State); enc_EventName(Val, State) -> PkgdName = ?META_ENC(event, Val), enc_PkgdName(PkgdName, State). enc_eventStream(Val, State) -> [ ?StreamToken, ?EQUAL, enc_StreamID(Val, State) ]. enc_eventOther(Val, State) when record(Val, 'EventParameter') -> [ enc_Name(Val#'EventParameter'.eventParameterName, State), enc_propertyParmValues(Val#'EventParameter'.value, Val#'EventParameter'.extraInfo, State) ]. enc_ServiceChangeRequest(Val, State) when record(Val, 'ServiceChangeRequest') -> [ %% Assume that Token is added elsewhere ?EQUAL, enc_TerminationIDList1(Val#'ServiceChangeRequest'.terminationID, State), ?LBRKT_INDENT(State), enc_ServiceChangeParm(Val#'ServiceChangeRequest'.serviceChangeParms, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. %% serviceChangeReply = ServiceChangeToken EQUAL TerminationID %% [LBRKT (errorDescriptor / %% serviceChangeReplyDescriptor) RBRKT] %% serviceChangeReplyDescriptor = ServicesToken LBRKT %% servChgReplyParm *(COMMA servChgReplyParm) RBRKT %% %% ;at-most-once. Version is REQUIRED on first ServiceChange response %% servChgReplyParm = (serviceChangeAddress / serviceChangeMgcId / %% serviceChangeProfile / serviceChangeVersion ) enc_ServiceChangeReply(Val, State) when record(Val, 'ServiceChangeReply') -> [ %% Assume that Token is added elsewhere ?EQUAL, enc_TerminationIDList1(Val#'ServiceChangeReply'.terminationID, State), enc_ServiceChangeResult(Val#'ServiceChangeReply'.serviceChangeResult, State) ]. enc_ServiceChangeResult({'ServiceChangeResult',Val}, State) -> enc_ServiceChangeResult(Val, State); enc_ServiceChangeResult({Tag, Val}, State) -> case Tag of errorDescriptor -> [ ?LBRKT_INDENT(State), enc_ErrorDescriptor(Val, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]; serviceChangeResParms -> case enc_ServiceChangeResParm(Val, ?INC_INDENT(?INC_INDENT(State))) of [] -> []; ResParms -> [ ?LBRKT_INDENT(State), ?ServicesToken, fun(S) -> [ ?LBRKT_INDENT(S), ResParms, ?RBRKT_INDENT(S), ?RBRKT_INDENT(S) ] end(?INC_INDENT(State)) ] end end. %% Required length of termination ID list is 1 enc_TerminationIDList1({'TerminationIDList',Val}, State) -> enc_TerminationIDList1(Val, State); enc_TerminationIDList1([Singleton], State) -> enc_TerminationID(Singleton, State). %% No required length of termination ID list enc_TerminationIDListN({'TerminationIDList',Val}, State) -> enc_TerminationIDListN(Val, State); enc_TerminationIDListN(TidList, State) -> enc_list([{TidList, fun enc_TerminationID/2}], State). %% TerminationID = "ROOT" / pathNAME / "$" / "*" %% ; Total length of pathNAME must not exceed 64 chars. %% pathNAME = ["*"] NAME *("/" / "*"/ ALPHA / DIGIT /"_" / "$" ) %% ["@" pathDomainName ] enc_TerminationID(Tid, State) when record(Tid, megaco_term_id) -> List = [{Tid#megaco_term_id.id, fun enc_tid_component/2 }], enc_list(List, State, fun(_S) -> ?SLASH end, false). enc_tid_component(Component, State) -> [enc_tid_sub_component(Sub, State) || Sub <- Component]. enc_tid_sub_component(Sub, _State) -> case Sub of all -> ?megaco_all; choose -> ?megaco_choose; Char when integer(Char) -> Char end. %% mediaDescriptor = MediaToken LBRKT mediaParm *(COMMA mediaParm) RBRKT %% ; at-most-once per item %% ; and either streamParm or streamDescriptor but not both %% mediaParm = (streamParm / streamDescriptor / %% terminationStateDescriptor) %% ; at-most-once %% streamParm = ( localDescriptor / remoteDescriptor / %% localControlDescriptor ) %% streamDescriptor = StreamToken EQUAL StreamID LBRKT streamParm %% *(COMMA streamParm) RBRKT enc_MediaDescriptor(Val, State) when record(Val, 'MediaDescriptor') -> [ ?MediaToken, ?LBRKT_INDENT(State), enc_list([{[Val#'MediaDescriptor'.termStateDescr], fun enc_TerminationStateDescriptor/2} | decompose_streams(Val#'MediaDescriptor'.streams)], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. decompose_streams({'MediaDescriptor_streams',Val}) -> decompose_streams(Val); decompose_streams({Tag, Val}) -> case Tag of oneStream -> decompose_StreamParms(Val); multiStream -> [{Val, fun enc_StreamDescriptor/2}] end. decompose_StreamParms(Val) when record(Val, 'StreamParms') -> [ {[Val#'StreamParms'.localControlDescriptor], fun enc_LocalControlDescriptor/2}, {[Val#'StreamParms'.localDescriptor], fun enc_localDescriptor/2}, {[Val#'StreamParms'.remoteDescriptor], fun enc_remoteDescriptor/2} ]. enc_StreamDescriptor(Val, State) when record(Val, 'StreamDescriptor') -> [ ?StreamToken, ?EQUAL, enc_StreamID(Val#'StreamDescriptor'.streamID, State), ?LBRKT_INDENT(State), enc_list(decompose_StreamParms(Val#'StreamDescriptor'.streamParms), ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. %% localControlDescriptor = LocalControlToken LBRKT localParm %% *(COMMA localParm) RBRKT %% %% ; at-most-once per item %% localParm = ( streamMode / propertyParm / %% reservedValueMode / reservedGroupMode ) %% reservedValueMode = ReservedValueToken EQUAL ( "ON" / "OFF" ) %% reservedGroupMode = ReservedGroupToken EQUAL ( "ON" / "OFF" ) %% %% reservedMode = ReservedToken EQUAL ( "ON" / "OFF" ) %% %% streamMode = ModeToken EQUAL streamModes enc_LocalControlDescriptor(Val, State) when record(Val, 'LocalControlDescriptor') -> [ ?LocalControlToken, ?LBRKT_INDENT(State), enc_list([{[Val#'LocalControlDescriptor'.streamMode], fun enc_StreamMode/2}, {[Val#'LocalControlDescriptor'.reserveGroup], fun enc_reservedGroupMode/2}, {[Val#'LocalControlDescriptor'.reserveValue], fun enc_reservedValueMode/2}, {Val#'LocalControlDescriptor'.propertyParms, fun enc_PropertyParm/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_reservedGroupMode(Val, _State) -> [ ?ReservedGroupToken, ?EQUAL, case Val of false -> ?OffToken; true -> ?OnToken end ]. enc_reservedValueMode(Val, _State) -> [ ?ReservedValueToken, ?EQUAL, case Val of false -> ?OffToken; true -> ?OnToken end ]. enc_StreamMode({'StreamMode',Val}, State) -> enc_StreamMode(Val, State); enc_StreamMode(Val, _State) -> [ ?ModeToken, ?EQUAL, case Val of sendOnly -> ?SendonlyToken; recvOnly -> ?RecvonlyToken; sendRecv -> ?SendrecvToken; inactive -> ?InactiveToken; loopBack -> ?LoopbackToken end ]. enc_Name({'Name',Val}, State) -> enc_Name(Val, State); enc_Name(Val, State) -> %% BUGBUG: NAME = ALPHA *63(ALPHA / DIGIT / "_" ) enc_STRING(Val, State, 1, 64). enc_PkgdName({'PkgdName', Val}, State) -> enc_PkgdName(Val, State); enc_PkgdName(Val, State) -> %% BUGBUG: pkgdName = (NAME / "*") SLASH (ItemID / "*" ) enc_OCTET_STRING(Val, State, 1, 64). enc_localDescriptor(Val, State) when record(Val, 'LocalRemoteDescriptor') -> [ ?LocalToken, ?LBRKT, enc_LocalRemoteDescriptor(Val, State), ?RBRKT_INDENT(State) ]. enc_remoteDescriptor(Val, State) when record(Val, 'LocalRemoteDescriptor') -> [ ?RemoteToken, ?LBRKT, enc_LocalRemoteDescriptor(Val, State), ?RBRKT_INDENT(State) ]. %% When text encoding the protocol, the descriptors consist of session %% descriptions as defined in SDP (RFC2327), except that the "s=", "t=" %% and "o=" lines are optional. When multiple session descriptions are %% provided in one descriptor, the "v=" lines are required as delimiters; %% otherwise they are optional. Implementations shall accept session %% descriptions that are fully conformant to RFC2327. When binary %% encoding the protocol the descriptor consists of groups of properties %% (tag-value pairs) as specified in Annex C. Each such group may %% contain the parameters of a session description. enc_LocalRemoteDescriptor(Val, State) when record(Val, 'LocalRemoteDescriptor') -> case Val#'LocalRemoteDescriptor'.propGrps of [] -> []; [OptV | MandV] -> [?LfToken, enc_PropertyGroup(OptV, opt_v, State) | [enc_PropertyGroup(M, mand_v, State) || M <- MandV]] end. enc_PropertyGroup({'PropertyGroup',Val}, RequiresV, State) -> enc_PropertyGroup(Val, RequiresV, State); enc_PropertyGroup([H | _T] = List, mand_v, State) when record(H, 'PropertyParm'), H#'PropertyParm'.name == "v" -> enc_PropertyGroup(List, opt_v, State); enc_PropertyGroup(PG, opt_v, State) -> [ [[enc_PropertyGroupParm(PP, State), ?LfToken] || PP <- PG] ]. enc_PropertyGroupParm(Val, State) when record(Val, 'PropertyParm') -> [OctetString] = Val#'PropertyParm'.value, [ enc_PkgdName(Val#'PropertyParm'.name, State), ?EqualToken, enc_OCTET_STRING(OctetString, State, 0, infinity) ]. %% propertyParm = pkgdName parmValue %% parmValue = (EQUAL alternativeValue/ INEQUAL VALUE) %% alternativeValue = ( VALUE / LSBRKT VALUE *(COMMA VALUE) RSBRKT / %% LSBRKT VALUE DOT DOT VALUE RSBRKT ) enc_PropertyParm(Val, State) when record(Val, 'PropertyParm') -> PkgdName = ?META_ENC(property, Val#'PropertyParm'.name), [ enc_PkgdName(PkgdName, State), enc_propertyParmValues(Val#'PropertyParm'.value, Val#'PropertyParm'.extraInfo, State) ]. enc_propertyParmValues([Single], asn1_NOVALUE, State) -> [ ?EqualToken, enc_Value(Single, State) ]; enc_propertyParmValues([Single], {relation, Rel}, State) -> case Rel of greaterThan -> [$>, enc_Value(Single, State)]; smallerThan -> [$<, enc_Value(Single, State)]; unequalTo -> [$#, enc_Value(Single, State)] end; enc_propertyParmValues([Low, High], {range, true}, State)-> %% Exact two values [ ?EqualToken, ?LSBRKT, enc_Value(Low, State), ?COLON, enc_Value(High, State), ?RSBRKT ]; enc_propertyParmValues(Values, {sublist, true}, State)-> %% sublist (i.e. A AND B AND ...) [ ?EqualToken, ?LSBRKT, enc_list([{Values, fun enc_Value/2}], State), ?RSBRKT ]; enc_propertyParmValues(Values, {sublist, false}, State) -> %% alternatives (i.e. A OR B OR ...) [ ?EqualToken, ?LBRKT, enc_list([{Values, fun enc_Value/2}], State), ?RBRKT ]. enc_TerminationStateDescriptor(Val, State) when record(Val, 'TerminationStateDescriptor') -> [ ?TerminationStateToken, ?LBRKT_INDENT(State), enc_list([{Val#'TerminationStateDescriptor'.propertyParms, fun enc_PropertyParm/2}, {[Val#'TerminationStateDescriptor'.eventBufferControl], fun enc_eventBufferControl/2}, {[Val#'TerminationStateDescriptor'.serviceState], fun enc_serviceState/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_eventBufferControl(Val, _State) -> [ ?BufferToken, ?EQUAL, case Val of off -> ?OffToken; lockStep -> ?LockStepToken end ]. enc_serviceState({'ServiceState',Val}, State) -> enc_serviceState(Val, State); enc_serviceState(Val, _State) -> [ ?ServiceStatesToken, ?EQUAL, case Val of test -> ?TestToken; outOfSvc -> ?OutOfSvcToken; inSvc -> ?InSvcToken end ]. enc_MuxDescriptor(Val, State) when record(Val, 'MuxDescriptor') -> [ ?MuxToken, ?EQUAL, enc_MuxType(Val#'MuxDescriptor'.muxType, State), enc_TerminationIDList1(Val#'MuxDescriptor'.termList, State) ]. enc_MuxType({'MuxType',Val}, State) -> enc_MuxType(Val, State); enc_MuxType(Val, _State) -> case Val of h221 -> ?H221Token; h223 -> ?H223Token; h226 -> ?H226Token; v76 -> ?V76Token end. enc_StreamID({'StreamID',Val}, State) -> enc_StreamID(Val, State); enc_StreamID(Val, State) -> enc_UINT16(Val, State). enc_EventsDescriptor(Val, State) when record(Val, 'EventsDescriptor') -> RequestId = Val#'EventsDescriptor'.requestID, Events = Val#'EventsDescriptor'.eventList, if %% BUGBUG: IG 6.82 introduces parse conflict %% RequestId == asn1_NOVALUE, Events == [] -> %% [ %% ?EventsToken %% ]; RequestId /= asn1_NOVALUE, Events /= [] -> [ ?EventsToken, ?EQUAL, enc_RequestID(RequestId, State), ?LBRKT_INDENT(State), enc_list([{Events, fun enc_RequestedEvent/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ] end. enc_RequestedEvent(Val, State) when record(Val, 'RequestedEvent') -> PkgdName = ?META_ENC(event, Val#'RequestedEvent'.pkgdName), [ enc_PkgdName(PkgdName, State), enc_opt_brackets( enc_list([{[Val#'RequestedEvent'.streamID], fun enc_eventStream/2}, {Val#'RequestedEvent'.evParList, fun enc_eventOther/2} | decompose_requestedActions(Val#'RequestedEvent'.eventAction)], ?INC_INDENT(State)), State) ]. decompose_requestedActions(asn1_NOVALUE) -> []; decompose_requestedActions(Val) when record(Val, 'RequestedActions') -> [ {[Val#'RequestedActions'.keepActive], fun enc_keepActive/2}, {[Val#'RequestedActions'.eventDM], fun enc_EventDM/2}, {[Val#'RequestedActions'.secondEvent], fun enc_SecondEventsDescriptor/2}, {[Val#'RequestedActions'.signalsDescriptor], fun enc_SignalsDescriptor/2} ]. enc_keepActive(Val, _State) -> case Val of true -> [?KeepActiveToken]; false -> [] end. enc_EventDM({'EventDM',Val}, State) -> enc_EventDM(Val, State); enc_EventDM({Tag, Val}, State) -> case Tag of digitMapName -> [ ?DigitMapToken, ?EQUAL, enc_DigitMapName(Val, State) ]; digitMapValue -> [ ?DigitMapToken, ?LBRKT_INDENT(State), enc_DigitMapValue(Val, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ] end. enc_SecondEventsDescriptor(Val, State) when record(Val, 'SecondEventsDescriptor') -> RequestId = Val#'SecondEventsDescriptor'.requestID, Events = Val#'SecondEventsDescriptor'.eventList, if %% BUGBUG: IG 6.82 introduces parse conflict %% RequestId == asn1_NOVALUE, Events == [] -> %% [ %% ?EmbedToken %% ]; RequestId /= asn1_NOVALUE, Events /= [] -> [ ?EmbedToken, ?LBRKT_INDENT(State), enc_list([{Events, fun(V, S) -> enc_embedFirst(V, S, RequestId) end}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ] end. enc_embedFirst(Val, State, RequestId) when record(Val, 'SecondRequestedEvent') -> [ ?EventsToken, ?EQUAL, enc_RequestID(RequestId, State), ?LBRKT_INDENT(State), %% BUGBUG: Does this really work? enc_list([{[Val], fun enc_SecondRequestedEvent/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_SecondRequestedEvent(Val, State) when record(Val, 'SecondRequestedEvent') -> PkgdName = ?META_ENC(event, Val#'SecondRequestedEvent'.pkgdName), [ enc_PkgdName(PkgdName, State), enc_opt_brackets( enc_list( [{[Val#'SecondRequestedEvent'.streamID], fun enc_eventStream/2}, {Val#'SecondRequestedEvent'.evParList, fun enc_eventOther/2} | decompose_secondRequestedActions(Val#'SecondRequestedEvent'.eventAction)], ?INC_INDENT(State)), State) ]. decompose_secondRequestedActions(asn1_NOVALUE) -> []; decompose_secondRequestedActions(Val) when record(Val, 'SecondRequestedActions') -> [ {[Val#'SecondRequestedActions'.keepActive], fun enc_keepActive/2}, {[Val#'SecondRequestedActions'.eventDM], fun enc_EventDM/2}, {[Val#'SecondRequestedActions'.signalsDescriptor], fun enc_embeddedSignalsDescriptor/2} ]. enc_embeddedSignalsDescriptor(Val, State) -> [ ?EmbedToken, ?LBRKT_INDENT(State), enc_SignalsDescriptor(Val, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_EventBufferDescriptor({'EventBufferDescriptor',Val}, State) -> enc_EventBufferDescriptor(Val, State); enc_EventBufferDescriptor([Mand | Opt], State) -> [ ?EventBufferToken, ?LBRKT_INDENT(State), enc_eventSpecs([Mand | Opt], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_eventSpecs([Mand | Opt], State) -> [enc_eventSpecs(Mand, State), [[?COMMA_INDENT(State), enc_eventSpec(Val, State)] || Val <- Opt]]. enc_eventSpec(Val, State) when record(Val, 'EventSpec') -> [ enc_EventName(Val#'EventSpec'.eventName, State), enc_opt_brackets( enc_list([{[Val#'EventSpec'.streamID], fun enc_eventStream/2}, {Val#'EventSpec'.eventParList, fun enc_eventOther/2}], ?INC_INDENT(State)), State) ]. enc_SignalsDescriptor({'SignalsDescriptor',Val}, State) -> enc_SignalsDescriptor(Val, State); enc_SignalsDescriptor(List, State) when list(List) -> [ ?SignalsToken, ?LBRKT_INDENT(State), enc_list([{List, fun enc_SignalRequest/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_SignalRequest({'SignalRequest',Val}, State) -> enc_SignalRequest(Val, State); enc_SignalRequest({Tag, Val}, State) -> case Tag of signal -> enc_Signal(Val, State); seqSigList -> enc_SeqSigList(Val, State) end. enc_SeqSigList(Val, State) when record(Val, 'SeqSigList') -> [ ?SignalListToken, ?EQUAL, enc_UINT16(Val#'SeqSigList'.id, State), ?LBRKT_INDENT(State), enc_list([{Val#'SeqSigList'.signalList, fun enc_Signal/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_Signal(Val, State) when record(Val, 'Signal') -> [ enc_SignalName(Val#'Signal'.signalName, State), enc_opt_brackets( enc_list([{[Val#'Signal'.streamID], fun enc_sigStream/2}, {[Val#'Signal'.sigType], fun enc_sigSignalType/2}, {[Val#'Signal'.duration], fun enc_sigDuration/2}, {[Val#'Signal'.notifyCompletion], fun enc_notifyCompletion/2}, {[Val#'Signal'.keepActive], fun enc_keepActive/2}, {Val#'Signal'.sigParList, fun enc_sigOther/2}], ?INC_INDENT(State)), State) ]. enc_sigStream(Val, State) -> [ ?StreamToken, ?EQUAL, enc_StreamID(Val, State) ]. enc_sigSignalType(Val, State) -> [ ?SignalTypeToken, ?EQUAL, enc_SignalType(Val, State) ]. enc_sigDuration(Val, State) -> [ ?DurationToken, ?EQUAL, enc_UINT16(Val, State) ]. enc_notifyCompletion(List, State) when list(List) -> [ ?NotifyCompletionToken, ?EQUAL, ?LBRKT_INDENT(State), enc_list([{List, fun enc_notifyCompletionItem/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_notifyCompletionItem(Val, _State) -> case Val of onTimeOut -> ?TimeOutToken; onInterruptByEvent -> ?InterruptByEventToken; onInterruptByNewSignalDescr -> ?InterruptByNewSignalsDescrToken; otherReason -> ?OtherReasonToken end. enc_SignalType({'SignalType',Val}, State) -> enc_SignalType(Val, State); enc_SignalType(Val, _State) -> case Val of brief -> ?BriefToken; onOff -> ?OnOffToken; timeOut -> ?TimeOutToken end. enc_SignalName({'SignalName',Val}, State)-> enc_SignalName(Val, State); enc_SignalName(Val, State) -> PkgdName = ?META_ENC(signal, Val), enc_PkgdName(PkgdName, State). enc_sigOther(Val, State) when record(Val, 'SigParameter') -> [ enc_Name(Val#'SigParameter'.sigParameterName, State), enc_propertyParmValues(Val#'SigParameter'.value, Val#'SigParameter'.extraInfo, State) ]. enc_RequestID({'RequestID',Val}, State) -> enc_RequestID(Val, State); enc_RequestID(Val, _State) when Val == ?megaco_all_request_id -> "*"; enc_RequestID(Val, State) -> enc_UINT32(Val, State). enc_ModemDescriptor(Val, State) when record(Val, 'ModemDescriptor') -> [ ?ModemToken, %% BUGBUG: Does never generate: EQUAL modemType ?LSBRKT, enc_list([{Val#'ModemDescriptor'.mtl,fun enc_ModemType/2}], State), ?RSBRKT, enc_opt_brackets( enc_list([{Val#'ModemDescriptor'.mpl, fun enc_PropertyParm/2}], ?INC_INDENT(State)), State) %% BUGBUG: Is PropertyParm == NAME parmValue? ]. enc_ModemType({'ModemType',Val}, State)-> enc_ModemType(Val, State); enc_ModemType(Val, _State) -> %% BUGBUG: Does not handle extensionParameter case Val of v18 -> ?V18Token; v22 -> ?V22Token; v22bis -> ?V22bisToken; v32 -> ?V32Token; v32bis -> ?V32bisToken; v34 -> ?V34Token; v90 -> ?V90Token; v91 -> ?V91Token; synchISDN -> ?SynchISDNToken end. enc_DigitMapDescriptor(Val, State) when record(Val, 'DigitMapDescriptor') -> [ ?DigitMapToken, ?EQUAL, enc_DigitMapName(Val#'DigitMapDescriptor'.digitMapName, State), ?LBRKT_INDENT(State), enc_DigitMapValue(Val#'DigitMapDescriptor'.digitMapValue, ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_DigitMapName({'DigitMapName',Val}, State) -> enc_DigitMapName(Val, State); enc_DigitMapName(Val, State) -> enc_Name(Val, State). enc_DigitMapValue(Val, State) when record(Val, 'DigitMapValue') -> [ enc_timer(Val#'DigitMapValue'.startTimer, $T, State), enc_timer(Val#'DigitMapValue'.shortTimer, $S, State), enc_timer(Val#'DigitMapValue'.longTimer, $L, State), %% BUGBUG: digitMapBody not handled at all enc_STRING(Val#'DigitMapValue'.digitMapBody, State, 0, infinity) ]. enc_timer(asn1_NOVALUE, _Prefix, _State) -> []; enc_timer(Timer, Prefix, State) -> [ Prefix, ?COLON, enc_DIGIT(Timer, State, 0, 99), ?COMMA_INDENT(State) ]. enc_ServiceChangeParm(Val, State) when record(Val, 'ServiceChangeParm') -> [ ?ServicesToken, ?LBRKT_INDENT(State), enc_list([{[Val#'ServiceChangeParm'.serviceChangeMethod], fun enc_ServiceChangeMethod/2}, {[Val#'ServiceChangeParm'.serviceChangeAddress], fun enc_ServiceChangeAddress/2}, {[Val#'ServiceChangeParm'.serviceChangeVersion], fun enc_serviceChangeVersion/2}, {[Val#'ServiceChangeParm'.serviceChangeProfile], fun enc_ServiceChangeProfile/2}, {[{reason, Val#'ServiceChangeParm'.serviceChangeReason}], fun enc_serviceChangeReason/2}, {[Val#'ServiceChangeParm'.serviceChangeDelay], fun enc_serviceChangeDelay/2}, {[Val#'ServiceChangeParm'.serviceChangeMgcId], fun enc_serviceChangeMgcId/2}, {[Val#'ServiceChangeParm'.timeStamp], fun enc_TimeNotation/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_ServiceChangeMethod({'ServiceChangeMethod',Val}, State) -> enc_ServiceChangeMethod(Val, State); enc_ServiceChangeMethod(Val, _State) -> [ ?MethodToken, ?EQUAL, case Val of failover -> ?FailoverToken; forced -> ?ForcedToken; graceful -> ?GracefulToken; restart -> ?RestartToken; disconnected -> ?DisconnectedToken; handOff -> ?HandOffToken end %% BUGBUG: extension ]. enc_ServiceChangeAddress({'ServiceChangeAddress',Val}, State) -> enc_ServiceChangeAddress(Val, State); enc_ServiceChangeAddress({Tag, Val}, State) -> [ ?ServiceChangeAddressToken, ?EQUAL, case Tag of portNumber -> enc_portNumber(Val, State); ip4Address -> enc_IP4Address(Val, State); ip6Address -> enc_IP6Address(Val, State); domainName -> enc_DomainName(Val, State); deviceName -> enc_PathName(Val, State); mtpAddress -> enc_mtpAddress(Val, State) end ]. enc_serviceChangeVersion(Val, State) -> [ ?VersionToken, ?EQUAL, enc_version(Val, State) ]. enc_ServiceChangeProfile(Val, State) when record(Val, 'ServiceChangeProfile') -> ProfName = ?META_ENC(profile, Val#'ServiceChangeProfile'.profileName), [ ?ProfileToken, ?EQUAL, enc_Name(ProfName, State), ?SLASH, enc_version(Val#'ServiceChangeProfile'.version, State) ]. enc_serviceChangeReason({reason, Val}, State) -> case Val of asn1_NOVALUE -> []; [List] when list(List) -> [ ?ReasonToken, ?EQUAL, enc_Value(List, State) ] end. enc_serviceChangeDelay(Val, State) -> [ ?DelayToken, ?EQUAL, enc_UINT32(Val, State) ]. enc_serviceChangeMgcId(Val, State) -> [ ?MgcIdToken, ?EQUAL, enc_MId(Val, State) ]. enc_portNumber(Val, State) when integer(Val), Val >= 0 -> enc_UINT16(Val, State). enc_ServiceChangeResParm(Val, State) when record(Val, 'ServiceChangeResParm') -> enc_list([{[Val#'ServiceChangeResParm'.serviceChangeAddress], fun enc_ServiceChangeAddress/2}, {[Val#'ServiceChangeResParm'.serviceChangeVersion], fun enc_serviceChangeVersion/2}, {[Val#'ServiceChangeResParm'.serviceChangeProfile], fun enc_ServiceChangeProfile/2}, {[Val#'ServiceChangeResParm'.serviceChangeMgcId], fun enc_serviceChangeMgcId/2}, {[Val#'ServiceChangeResParm'.timeStamp], fun enc_TimeNotation/2}], State). enc_PackagesDescriptor({'PackagesDescriptor',Val}, State) -> enc_PackagesDescriptor(Val, State); enc_PackagesDescriptor(Val, State) -> [ ?PackagesToken, ?LBRKT_INDENT(State), enc_list([{Val, fun enc_PackagesItem/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_PackagesItem(Val, State) when record(Val, 'PackagesItem') -> PkgdName = ?META_ENC(package, Val#'PackagesItem'.packageName), [ enc_Name(PkgdName, State), "-", enc_UINT16(Val#'PackagesItem'.packageVersion, State) ]. enc_StatisticsDescriptor({'StatisticsDescriptor',Val}, State) -> enc_StatisticsDescriptor(Val, State); enc_StatisticsDescriptor(List, State) when list(List) -> [ ?StatsToken, ?LBRKT_INDENT(State), enc_list([{List, fun enc_StatisticsParameter/2}], ?INC_INDENT(State)), ?RBRKT_INDENT(State) ]. enc_StatisticsParameter(Val, State) when record(Val, 'StatisticsParameter') -> PkgdName = ?META_ENC(statistics, Val#'StatisticsParameter'.statName), case Val#'StatisticsParameter'.statValue of asn1_NOVALUE -> [ enc_PkgdName(PkgdName, State) ]; [StatVal] when list(StatVal) -> [ enc_PkgdName(PkgdName, State), ?EQUAL, enc_Value(StatVal, State) ] end. enc_TimeNotation(Val, State) when record(Val, 'TimeNotation') -> [ enc_STRING(Val#'TimeNotation'.date, State, 8, 8), % "yyyymmdd" "T", enc_STRING(Val#'TimeNotation'.time, State, 8, 8) % "hhmmssss" ]. %% BUGBUG: Does not verify that string must contain at least one char %% BUGBUG: This violation of the is required in order to comply with %% BUGBUG: the dd/ce ds parameter that may possibly be empty. enc_Value({'Value',Val}, State) -> enc_Value(Val, State); enc_Value(String, _State) -> case quoted_string_count(String, 0, true) of {_, 0} -> [?DQUOTE, String, ?DQUOTE]; {false, _} -> [?DQUOTE, String, ?DQUOTE]; {true, _} -> [String] end. quoted_string_count([H | T], Count, IsSafe) -> case ?classify_char(H) of safe_char -> quoted_string_count(T, Count + 1, IsSafe); rest_char -> quoted_string_count(T, Count + 1, false); white_space -> quoted_string_count(T, Count + 1, false); _ -> exit({illegal_char, H}) end; quoted_string_count([], Count, IsSafe) -> {IsSafe, Count}. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Encode an octet string, escape } by \ if necessary enc_OCTET_STRING(List, State, Min, Max) -> do_enc_OCTET_STRING(List, State, Min, Max, 0). do_enc_OCTET_STRING([H | T], State, Min, Max, Count) -> case H of $} -> [$\\, H | do_enc_OCTET_STRING(T, State, Min, Max, Count + 1)]; _ -> [H | do_enc_OCTET_STRING(T, State, Min, Max, Count + 1)] end; do_enc_OCTET_STRING([], _State, Min, Max, Count) -> verify_count(Count, Min, Max), []. enc_QUOTED_STRING(String, _State) when list(String) -> {_IsSafe, Count} = quoted_string_count(String, 0, true), verify_count(Count, 1, infinity), [?DQUOTE, String, ?DQUOTE]. %% The internal format of hex digits is a list of octets %% Min and Max means #hexDigits %% Leading zeros are prepended in order to fulfill Min enc_HEXDIG(Octets, State, Min, Max) when list(Octets) -> do_enc_HEXDIG(Octets, State, Min, Max, 0, []). do_enc_HEXDIG([Octet | Rest], State, Min, Max, Count, Acc) when Octet >= 0, Octet =< 255 -> Acc2 = [hex(Octet) | Acc], if Octet =< 15 -> do_enc_HEXDIG(Rest, State, Min, Max, Count + 2, ["0" | Acc2]); true -> do_enc_HEXDIG(Rest, State, Min, Max, Count + 2, Acc2) end; do_enc_HEXDIG([], State, Min, Max, Count, Acc) when integer(Min), Count < Min -> do_enc_HEXDIG([0], State, Min, Max, Count, Acc); do_enc_HEXDIG([], _State, Min, Max, Count, Acc) when integer(Min), Count < Min -> verify_count(Count, Min, Max), lists:reverse(Acc). enc_DIGIT(Val, State, Min, Max) -> enc_integer(Val, State, Min, Max). enc_STRING(String, _State, Min, Max) when list(String) -> verify_count(length(String), Min, Max), String. enc_UINT16(Val, State) -> enc_integer(Val, State, 0, 65535). enc_UINT32(Val, State) -> enc_integer(Val, State, 0, 4294967295). enc_integer(Val, _State, Min, Max) -> verify_count(Val, Min, Max), integer_to_list(Val). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Encodes a list of elements with separator tokens between %% the elements. Optional asn1_NOVALUE values are ignored. enc_list(List, State) -> enc_list(List, State, fun(S) -> ?COMMA_INDENT(S) end, false). enc_list([{Elems, ElemEncoder} | Tail], State, SepEncoder, NeedsSep) -> case do_enc_list(Elems, State, ElemEncoder, SepEncoder, NeedsSep) of [] -> enc_list(Tail, State, SepEncoder, NeedsSep); List -> [List, enc_list(Tail, State, SepEncoder, true)] end; enc_list([], _State, _SepEncoder, _NeedsSep) -> []; enc_list(asn1_NOVALUE, _State, _SepEncoder, _NeedsSep) -> []. do_enc_list(asn1_NOVALUE, _State, _ElemEncoder, _SepEncoder, _NeedsSep) -> []; do_enc_list([], _State, _ElemEncoder, _SepEncoder, _NeedsSep) -> []; do_enc_list([asn1_NOVALUE | T], State, ElemEncoder, SepEncoder, NeedsSep) -> do_enc_list(T, State, ElemEncoder, SepEncoder, NeedsSep); do_enc_list([H | T], State, ElemEncoder, SepEncoder, NeedsSep) when function(ElemEncoder), function(SepEncoder) -> case ElemEncoder(H, State) of [] -> do_enc_list(T, State, ElemEncoder, SepEncoder, NeedsSep); List when NeedsSep == true -> [SepEncoder(State), List, do_enc_list(T, State, ElemEncoder, SepEncoder, true)]; List when NeedsSep == false -> [List, do_enc_list(T, State, ElemEncoder, SepEncoder, true)] end. %% Add brackets if list is non-empty enc_opt_brackets([], _State) -> []; enc_opt_brackets(List, State) when list(List) -> [?LBRKT_INDENT(State), List, ?RBRKT_INDENT(State)]. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Int -> list of hex chars hex(Int) -> hexi(get_lo_bits(Int, 4), []). hexi({0, Lo}, Ack) -> [hex4(Lo) | Ack]; hexi({Hi, Lo} , Ack) -> hexi(get_lo_bits(Hi, 4), [hex4(Lo) | Ack]). hex4(Int) when Int < 10 -> Int + $0; hex4(Int) -> ($A - 10) + Int. get_lo_bits(Int, Size) -> Lo = Int band ones_mask(Size), Hi = Int bsr Size, {Hi, Lo}. ones_mask(Ones) -> (1 bsl Ones) - 1. %% Verify that Count is within the range of Min and Max verify_count(Count, Min, Max) -> if integer(Count) -> if integer(Min), Count >= Min -> if integer(Max), Count =< Max -> Count; Max == infinity -> Count; true -> exit({count_too_large, Count, Max}) end; true -> exit({count_too_small, Count, Min}) end; true -> exit({count_not_an_integer, Count}) end. From mikael.karlsson@REDACTED Fri Sep 13 10:27:17 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Fri, 13 Sep 2002 10:27:17 +0200 Subject: xmerl_xpath lists reversed? Message-ID: <200209131027.17638.mikael.karlsson@creado.com> Hi, I am trying to extract xmlElement nodes from a document using xmerl_xpath. The nodes seem to show up in reversed order. The example below gives me the last section title, while I expected the first. Have I missed something in the interpretation of xmerl_xpath? Thanks Mikael Code snippet: {B,_}=xmerl_scan:file(A#arg.docroot ++ "/testdir/test1.xml",[{fetch_fun, fun(DTDSpec,S) -> {ok,S} end}]), D = xmerl_xpath:string("child::node()/title[position() = 1]",B), io:fwrite("~p~n",[D]), F = sdocbook2xhtml:changetitle(B), C = xmerl:export(F,sdocbook2xhtml), {content,"text/html",C}. Document:
......bla bla....
Section 1 Para 1 in section 1
... lots of sections...
Section 6, the last section This is the first paragraph in the last section.
io:fwrite gives: [{xmlElement,title, [{section,14},{article,1}], 2, [], [{xmlText,[{title,2},{section,14},{article,1}], 1, [], "Section 6, the last section"}], [], title, [], {xmlNamespace,[],[]}}] From erlang@REDACTED Thu Sep 12 17:26:28 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Thu, 12 Sep 2002 16:26:28 +0100 Subject: TopologyRequest syntax error References: Message-ID: <3D80B224.7060707@manderp.freeserve.co.uk> Hi H?kan, Thanks for letting me know I'm not barking in the wrong forest. Phew! I'm going to apply the patch tomorrow, and I'll let you know the result. Are there any other OTP-Megaco stack "features" you keep under your hat? :-) Pete. Hakan Mattsson wrote: > On Thu, 12 Sep 2002, Peter-Henry Mander wrote: > > erlang>I'm using the Megaco stack in Erlang/OTP reusing the simple MGC and > erlang>simple MG code, and I'm having a problem with the TopologyRequest issued > erlang>from the Gateway Controller. The Erlang code used to add a > erlang>TopologyRequest is included below. The Controller issues the > erlang>ActionRequest without complaining, but the Gateway at the other end > erlang>gives a syntax error, correctly I believe since the Controller issues > erlang>a TopologyRequest within a TopologyRequest, and that doesn't look right > erlang>to me! > erlang> > erlang>What am I doing wrong? > > Congratulations, you seem to be the first one that have decoded > textual topology requests! > > There was a bug in megaco/src/text/megaco_text_gen.hrl. > > I have fixed the bug in the attached file. > It will be included in next snapshot for Erlang/OTP R9. > > Replace the old version of the file and re-run make in > megaco/src/text. > > /H?kan > > > ------------------------------------------------------------------------ > From hakan@REDACTED Thu Sep 12 18:11:31 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Thu, 12 Sep 2002 18:11:31 +0200 (MEST) Subject: TopologyRequest syntax error In-Reply-To: <3D80B224.7060707@manderp.freeserve.co.uk> Message-ID: On Thu, 12 Sep 2002, Peter-Henry Mander wrote: Pete> Are there any other OTP-Megaco stack "features" you keep under your hat? :-) This was a brand new "enhancement possibility". I was not aware of the bug before you run into it. /H?kan From jilani.khaldi@REDACTED Fri Sep 13 20:03:52 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Fri, 13 Sep 2002 20:03:52 +0200 Subject: Do Erlang BEAMS act like Java applet? Message-ID: Hi All, Having 2 computers A and B connected to the web and both are running Erlang. The computer B has somewhere (say in "/usr/physics") an application called "magnetism.beam" which requires other "*.beam" to run and all these files are in "/usr/physics". Is it possible to run "magnetism.beam" on the Computer A (something like Java applet)? Is it possible to run it on B and have the output on A (something like X server)? Or combining both: calculations on B and visualization on A? Thank you. jk From matthias@REDACTED Fri Sep 13 21:07:12 2002 From: matthias@REDACTED (Matthias Lang) Date: Fri, 13 Sep 2002 21:07:12 +0200 Subject: Do Erlang BEAMS act like Java applet? In-Reply-To: References: Message-ID: <15746.14176.631817.517864@antilipe.corelatus.se> Jilani Khaldi writes: > Having 2 computers A and B connected to the web and both are > running Erlang. The computer B has somewhere (say in > "/usr/physics") an application called "magnetism.beam" which > requires other "*.beam" to run and all these files > are in "/usr/physics". > Is it possible to run "magnetism.beam" on the Computer A > (something like Java applet)? Yes. If A & B share filesystems, such as through NFS, then you don't need to do anything apart from setting your code path. If A & B are connected via distributed Erlang (or HTTP, for that matter), it's reasonably straightforward, albeit fiddly: (b@REDACTED)3> {ok, Bin} = rpc:call(a@REDACTED, file, read_file, ["gth_log.beam"]). {ok,<<...>>} (b@REDACTED)4> code:load_binary(gth_log, "remote_file_gth_log", Bin). {module,gth_log} (I only have one computer here, so my two nodes are on the same host, but the method is identical for multiple hosts). > Is it possible to run it on B and have the output on A (something > like X server)? Or combining both: calculations on B and > visualization on A? You can divide your application across nodes any way you want. In practice you'll be restricted a by what sort of user interface you want. There's quite a bit of documentation to help you get started, for instance the "getting started" guide has a quick introduction to distributed Erlang: http://www.erlang.org/doc/r8b/doc/getting_started/part_frame.html another good source of information is the Erlang book, which you can download from http://www.erlang.org/download/erlang-book-part1.pdf it's a little out of date, but it's lies are mostly of the omission type. Matthias From mikael.karlsson@REDACTED Fri Sep 13 21:31:20 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Fri, 13 Sep 2002 21:31:20 +0200 Subject: Section numbering using xmerl:export In-Reply-To: References: <200208291019.40246.mikael.karlsson@creado.com> Message-ID: <200209132131.20423.mikael.karlsson@creado.com> Hi Vlad, thanks for your routine. If I understand it right it is a map function of the "RoseTree" like structure of xmlElements. The problem was that I needed to now where in the tree I was in order to set the chapter numbers correctly. With a slight modification, adding accumulator and folding top->down as well as left right I could get things in place. /Mikael %% mapfoldxml %% Fun is fun(Old#xmlElement, OldAccu) -> {New#xmlElement, NewAccu} mapfoldxml(Fun, Accu0, #xmlElement{}=E) -> {C1,Accu1} = Fun(E, Accu0), {C2,Accu2} = mapfoldxml(Fun, Accu1, lists:flatten(C1#xmlElement.content)), {C1#xmlElement{content=C2},Accu2}; mapfoldxml(Fun, Accu, List) when list(List) -> AFun = fun(E,A) -> mapfoldxml(Fun, A, E) end, lists:mapfoldl(AFun, Accu, List); mapfoldxml(_Fun, Accu, E) -> {E,Accu}. changetitle(A) -> Afun = fun changecount/2, {E, Acc} = mapfoldxml(Afun, {0,0,0}, A), E. changecount(#xmlElement{name=title}=E, {A,B,C})-> case E#xmlElement.parents of [{section,_},{section,_},{section,_},{article,_} |_] -> addheader(E,{A,B,C+1}); [{section,_},{section,_},{article,_} |_] -> addheader(E,{A,B+1,0}); [{section,_},{article,_} |_] -> addheader(E,{A+1,0,0}); _ -> {E,{A,B,C}} end; changecount(E, Acc)->{E,Acc}. addheader(#xmlElement{name=title,content=[#xmlText{}=T1|_]}= E, Chapters)-> NewHeader = chapterstring(Chapters)++ " " ++ T1#xmlText.value, NewAtts = addid(E#xmlElement.attributes, Chapters), {E#xmlElement{content=[T1#xmlText{value=NewHeader}], attributes = NewAtts},Chapters}. chapterstring({A,0,0})->integer_to_list(A); chapterstring({A,B,0})->integer_to_list(A)++"."++ integer_to_list(B); chapterstring({A,B,C})->integer_to_list(A) ++ "." ++ integer_to_list(B) ++ "." ++ integer_to_list(C). torsdag 29 augusti 2002 12:09 skrev Vlad Dumitrescu: > Hi, > > I don't know about the xmerl details, but I think it might be risky to rely > on a implementation dependent feature... Of course, this depends on your > application's use. > > The safe way would be going through the tree and numbering the nodes along > the path. I have written a small routine that will traverse a xml tree and > call a fun with every node. I think it might help you too (or others). > > best regards, > Vlad > > %%% File : xmerl_util.erl > %%% Author : > %%% Description : > %%% Created : 14 Aug 2002 by > > -module(xmerl_util). > -export([traverse/2]). > -include("xmerl.hrl"). > > %% convert an xml doc into another > %% > %% Fun should return a xmlXXX record, or a list of such records > > traverse(#xmlElement{content=C}=E, Fun) -> > C1 = lists:flatten(traverse(C, Fun)), > Fun(E#xmlElement{content=C1}); > traverse(List, Fun) when list(List) -> > AFun = fun(E) -> traverse(E, Fun) end, > lists:map(AFun, List); > traverse(E, _Fun) -> > E. From mikael.karlsson@REDACTED Fri Sep 13 22:00:07 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Fri, 13 Sep 2002 22:00:07 +0200 Subject: Section numbering using xmerl:export In-Reply-To: References: Message-ID: <200209132200.07585.mikael.karlsson@creado.com> fredag 30 augusti 2002 11:18 skrev Ulf Wiger: > Yes, given the choice, one would probably use Erlang directly > instead of XSLT. It would still be nice to be able to use an > existing XSLT framework, if someone else has already done the > hard work, but there are fortunately tools to do that already, > available to the Erlang programmer. I don't know how well they > fit with xmerl, though. Perhaps someone else knows? > > /Uffe (who has about a thousand things he would rather do than > add XSLT support to XMErl) Hi Ulf, I was able to implement some kind of XSLT lookalike in Erlang using xmerl_xpath, and working on xmlElements similar to Vlads traverse/2 function. At least I can select were I want to have the new transformed elements. For some reason I have to reverse the list returned by xmerl_xpath:string/2. I also wonder how performance is affected, considering that you have to parse the strings passed to xmerl_path? /Mikael process_xml(E)-> lists:flatten(template(E)). %% article is the root element template(E0 = #xmlElement{name=article})-> E1 = changetitle(E0), %% Yes, I have to add section numbering to titles in %% separate pass. [ "<\?xml version=\"1.0\" encoding=\"iso-8859-1\"\?>" "" "" "" "", value_of(select("articleinfo/title",E1)), "" "" "" "", template(xmerl_xpath:string("articleinfo",E1)), process_toc(E1), %% Insert toc between info and main part of article template(lists:reverse(xmerl_xpath:string("section",E1))), ""]; %% All callback functions used by xmerl:export can be %% reused for straight transformations template(E = #xmlElement{name=Name,content=C})-> apply(sdocbook2xhtml,Name, [template(C), E#xmlElement.attributes, E#xmlElement.parents,E]); template(EList) when list(EList) -> lists:map(fun(E) -> template(E) end, EList); template(E = #xmlText{}) -> E#xmlText.value; template(E)-> io:fwrite("Got unexpected element ~p~n",[E]), []. value_of(E = #xmlElement{content=[#xmlText{}=T1|_]})-> T1#xmlText.value; value_of(E) ->[]. select(Str,E)-> [H|_] = xmerl_xpath:string(Str,E), H. From raimo.niskanen@REDACTED Sat Sep 14 20:04:01 2002 From: raimo.niskanen@REDACTED (Raimo Niskanen) Date: Sat, 14 Sep 2002 20:04:01 +0200 Subject: Impact of native compilation References: <200209061803.g86I31K20857@dino00.iro.umontreal.ca>, , <200209112238.g8BMcxu10139@dino00.iro.umontreal.ca> Message-ID: You may find it interesting to have a look at mOZart. Some of their ideas may be useful. http://www.mozart-oz.org / Raimo Niskanen, Erlang/OTP, Ericsson AB Marc Feeley wrote: > > > From etxuwig@REDACTED Mon Sep 16 09:32:06 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 16 Sep 2002 09:32:06 +0200 (MET DST) Subject: Section numbering using xmerl:export In-Reply-To: <200209132200.07585.mikael.karlsson@creado.com> Message-ID: On Fri, 13 Sep 2002, Mikael Karlsson wrote: >I was able to implement some kind of XSLT lookalike in Erlang >using xmerl_xpath, and working on xmlElements similar to Vlads >traverse/2 function. At least I can select were I want to have the >new transformed elements. Good. I think this is probably much better than using XSLT. (: >For some reason I have to reverse the list returned by >xmerl_xpath:string/2. This is most likely a bug, but I'm afraid I don't have time to look into it right now. Perhaps someone else could look at the code? >I also wonder how performance is affected, considering that you >have to parse the strings passed to xmerl_path? The XPATH strings are so short that I think this is negligible in most cases. The XPATH strings you use take about 100-150 us to parse on my machine. /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From erlang@REDACTED Mon Sep 16 10:25:48 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Mon, 16 Sep 2002 09:25:48 +0100 Subject: TopologyRequest syntax error References: Message-ID: <3D85958C.3090801@manderp.freeserve.co.uk> Hi, The TopologyRequest patch fixed the problem, thanks H?kan. Pete. P.s. When is Erlang/OTP R9 due? Hakan Mattsson wrote: > On Thu, 12 Sep 2002, Peter-Henry Mander wrote: > > Pete> Are there any other OTP-Megaco stack "features" you keep under your hat? :-) > > This was a brand new "enhancement possibility". > I was not aware of the bug before you run into it. > > /H?kan > > > From ingela@REDACTED Mon Sep 16 10:37:54 2002 From: ingela@REDACTED (Ingela Anderton) Date: Mon, 16 Sep 2002 10:37:54 +0200 (MEST) Subject: TopologyRequest syntax error References: <3D85958C.3090801@manderp.freeserve.co.uk> Message-ID: <200209160837.KAA28353@gildor.du.uab.ericsson.se> Peter-Henry Mander wrote: > Hi, > > The TopologyRequest patch fixed the problem, thanks H?kan. > > Pete. > > P.s. When is Erlang/OTP R9 due? 16 of Octobre. -- /m.v.h Ingela Ericsson AB - OTP team From jilani.khaldi@REDACTED Mon Sep 16 11:24:03 2002 From: jilani.khaldi@REDACTED (Jilani Khaldi) Date: Mon, 16 Sep 2002 11:24:03 +0200 Subject: Erlang/OTP R9 In-Reply-To: <200209160837.KAA28353@gildor.du.uab.ericsson.se> Message-ID: >> P.s. When is Erlang/OTP R9 due? >16 of Octobre. What's new in it? Partciculary about Mnesia and Inets? Thanks! jk -- Jilani Khaldi http://space.tin.it/scuola/jkhaldi From mikael.karlsson@REDACTED Mon Sep 16 11:54:39 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Mon, 16 Sep 2002 11:54:39 +0200 Subject: Section numbering using xmerl:export In-Reply-To: References: Message-ID: <200209161154.39439.mikael.karlsson@creado.com> m?ndag 16 september 2002 09:32 skrev Ulf Wiger: > On Fri, 13 Sep 2002, Mikael Karlsson wrote: > >I was able to implement some kind of XSLT lookalike in Erlang > >using xmerl_xpath, and working on xmlElements similar to Vlads > >traverse/2 function. At least I can select were I want to have the > >new transformed elements. > > Good. I think this is probably much better than using XSLT. > > (: Agreed. It is much easier to implement anyway. As a matter of fact it it is also possible to carry a reference to the toplevel structure around as well "template(CurrentE,TopE)" if one needs to resolve cross references into other nodes. > >For some reason I have to reverse the list returned by > >xmerl_xpath:string/2. > > This is most likely a bug, but I'm afraid I don't have time > to look into it right now. Perhaps someone else could look > at the code? I get the message :-). I'll have a look and see if I can understand it. > > >I also wonder how performance is affected, considering that you > >have to parse the strings passed to xmerl_path? > > The XPATH strings are so short that I think this is > negligible in most cases. The XPATH strings you use take > about 100-150 us to parse on my machine. Good! Thanks /Mikael From etxuwig@REDACTED Mon Sep 16 17:02:41 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Mon, 16 Sep 2002 17:02:41 +0200 (MET DST) Subject: Section numbering using xmerl:export In-Reply-To: <200209161154.39439.mikael.karlsson@creado.com> Message-ID: On Mon, 16 Sep 2002, Mikael Karlsson wrote: >> >For some reason I have to reverse the list returned by >> >xmerl_xpath:string/2. >> >> This is most likely a bug, but I'm afraid I don't have time >> to look into it right now. Perhaps someone else could look >> at the code? > >I get the message :-). >I'll have a look and see if I can understand it. I wonder if not all instances of lists:foldl in xmerl_xpath.erl should be replaced by lists:foldr... /Uffe -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From fjburgos@REDACTED Mon Sep 16 17:01:47 2002 From: fjburgos@REDACTED (Fco Javier Burgos Maciá) Date: Mon, 16 Sep 2002 17:01:47 +0200 (CEST) Subject: No subject Message-ID: <20020916150147.1A585320011@obelix.umh.es> Hello. I'm a student from Spain and I have a question. Is made in erlang any function to convert a term to a string representation? The term can be a tuple, a tuple of lists, a list of tuples of strings or atoms ... I have tried to make it using the module io_lib, but I have problems like this: 1> String=io_lib:fwrite("~p",[{atom1,[{1,2,[atom_2,"string"]}]}]). [[123, ["atom1", 44, [91,[[123,["1",44,"2",44,[91,["atom_2",44,"\"string\""],93]],125]],93]], 125]] 2> String. [[123, ["atom1", 44, [91,[[123,["1",44,"2",44,[91,["atom_2",44,"\"string\""],93]],125]],93]], 125]] In this case, I want to obtain "{atom1,[{1,2,[atom_2,"string"]}]}" Will I have to make the function or Does it exist already? Thank you in advance and excuse my English. From kent@REDACTED Mon Sep 16 17:32:30 2002 From: kent@REDACTED (Kent Boortz) Date: 16 Sep 2002 17:32:30 +0200 Subject: none In-Reply-To: <20020916150147.1A585320011@obelix.umh.es> References: <20020916150147.1A585320011@obelix.umh.es> Message-ID: fjburgos@REDACTED (Fco Javier Burgos Maci?) writes: > Is made in erlang any function to convert a term to a string representation? > > The term can be a tuple, a tuple of lists, a list of tuples of strings or atoms ... > > I have tried to make it using the module io_lib, but I have problems like this: > > 1> String=io_lib:fwrite("~p",[{atom1,[{1,2,[atom_2,"string"]}]}]). > [[123, > ["atom1", > 44, > [91,[[123,["1",44,"2",44,[91,["atom_2",44,"\"string\""],93]],125]],93]], > 125]] > 2> String. > [[123, > ["atom1", > 44, > [91,[[123,["1",44,"2",44,[91,["atom_2",44,"\"string\""],93]],125]],93]], > 125]] > > In this case, I want to obtain "{atom1,[{1,2,[atom_2,"string"]}]}" The resulting string above is a "deep list", see the beginning and the first example at http://www.erlang.org/doc/r8b/lib/stdlib-1.10.1.1/doc/html/io_lib.html Use something like 1> DeepString = io_lib:fwrite("~p",[{atom1,[{1,2,[atom_2,"string"]}]}]). 2> String = lists:flatten(DeepString). or directly like 1> String = lists:flatten(io_lib:fwrite("~p",[{atom1,[{1,2,[atom_2,"string"]}]}])). kent From cyberlync@REDACTED Mon Sep 16 18:06:02 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 16 Sep 2002 09:06:02 -0700 (PDT) Subject: Make replacement for Erlang - suggestions? Message-ID: <20020916160602.40827.qmail@web40205.mail.yahoo.com> Guys, I am currently working on an Eclipse plugin for Erlang. One of the features I would like to add is simple (and hopefully powerful) Erlang specific build scripting facility. I will probably set it up as a standalone project and integrate into the plugin as an external tool. I believe that the immediate question that people will ask is 'why not use make?'. I personally dislike make for numerous reasons, which I will not bring up here so as to avoid a holy war. For these reasons I do not consider it an option. Although, I will need to support it for the people out there that do like and use it. Java already has a similar tool call 'Ant'. Its a very good tool directed specifically at Java. It may be customized for other languages due to the provision of extension tags, however the core of 'Ant' including all the built in tags are specific to Java. The only areas where I believe that the 'Ant' developers took a wrong step is use of XML as their scripting language. I personally believe that XML is not really a great basis for descriptions of logic. Also, the lack of conditional logic make for some awkward scripts (thought they have recently fixed this problem) . Right now my current idea is to use Erlang itself as the build script language .A master module that controls the build would simply make callbacks into the users Erlang build script for instructions/directions. This, should, I believe provide the simplest, quickest and most flexible solution to the problem. Do any of you have suggestions concerning this? Knowledge of other projects who have already done something similar? Criticism of the approach? I would be happy to receive whatever feedback you wish to provide. __________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com From daniel.neri@REDACTED Mon Sep 16 18:26:37 2002 From: daniel.neri@REDACTED (Daniel =?iso-8859-1?q?N=E9ri?=) Date: 16 Sep 2002 16:26:37 +0000 Subject: Make replacement for Erlang - suggestions? References: <20020916160602.40827.qmail@web40205.mail.yahoo.com> Message-ID: Eric Merritt writes: > The only areas where I believe that the 'Ant' developers took a > wrong step is use of XML as their scripting language. *Yuck* > Right now my current idea is to use Erlang itself as the build > script language Good idea. > Do any of you have suggestions concerning this? Knowledge of other > projects who have already done something similar? There's SCons, which IMO is very elegant and somewhat similar to your idea, but using Python: http://www.scons.org/ Regards, --Daniel -- Daniel N?ri, Sigicom AB, Sweden From cyberlync@REDACTED Mon Sep 16 19:04:06 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 16 Sep 2002 10:04:06 -0700 (PDT) Subject: Make replacement for Erlang - suggestions? In-Reply-To: Message-ID: <20020916170406.22840.qmail@web40209.mail.yahoo.com> > > The only areas where I believe that the 'Ant' > developers took a > > wrong step is use of XML as their scripting > language. > > *Yuck* Pretty much my response as well. But the functionality , for java apps, is good enough to overcome those drawbacks. > There's SCons, which IMO is very elegant and > somewhat similar to your > idea, but using Python: > > http://www.scons.org/ I saw this the other day, the idea is a good one and I will probably pull a whole lot of things from it. Thanks, Eric __________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com From francesco@REDACTED Mon Sep 16 19:18:30 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Mon, 16 Sep 2002 18:18:30 +0100 Subject: Make replacement for Erlang - suggestions? References: <20020916160602.40827.qmail@web40205.mail.yahoo.com> Message-ID: <3D861266.4050205@erlang-consulting.com> In most large scale projects I have been involved in, we have used gnumake, and whenever busted by some paranoid project manager, we moved over to make. If you want to have as many people as possible use the plug in, I would try to stick to the tools users in major projects required to use (Freedom of choice is rarely an option on a large scale) or at least try to facilitate their usage as much as possible... Even if I have to admit, an Erlang variant sounds neat. Francesco -- http://www.erlang-consulting.com From per@REDACTED Mon Sep 16 21:28:22 2002 From: per@REDACTED (Per Bergqvist) Date: Mon, 16 Sep 2002 20:28:22 +0100 Subject: Make replacement for Erlang - =?iso-8859-1?q?suggestions=3F?= In-Reply-To: <3D861266.4050205@erlang-consulting.com> Message-ID: <200209161828.g8GISOo20400@sork.levonline.com> In most projects I been involded in we have used gmake and stayed with it. For make replacement I simply ask why ? You can use gmake on every useable platform on earth, and even windows with cygwin ... I think it would be better to spend the time of fixing the otp build chain to build native on a windows machine instead ;-) (For general purpose scripting it's another story.) /Per > In most large scale projects I have been involved in, we have used > gnumake, and whenever busted by some paranoid project manager, we moved > over to make. If you want to have as many people as possible use the > plug in, I would try to stick to the tools users in major projects > required to use (Freedom of choice is rarely an option on a large scale) > or at least try to facilitate their usage as much as possible... Even if > I have to admit, an Erlang variant sounds neat. > > Francesco > -- > http://www.erlang-consulting.com > > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From cyberlync@REDACTED Mon Sep 16 21:35:24 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 16 Sep 2002 12:35:24 -0700 (PDT) Subject: Make replacement for Erlang - suggestions? In-Reply-To: <3D861266.4050205@erlang-consulting.com> Message-ID: <20020916193524.90053.qmail@web40210.mail.yahoo.com> Francesco, Support for make/gnumake has to be in place, thats a given for the very reasons you mentioned. Fortunatly, I believe that I can pick up most of this support from some of the other available plugins. So it shouldn't cost me much in the way of time. I would like to see an alternative to make/gnumake. This is largly due to the fact that I have a very, very low opinion of make and make clones in general. Thanks, Eric --- Francesco Cesarini wrote: > In most large scale projects I have been involved > in, we have used > gnumake, and whenever busted by some paranoid > project manager, we moved > over to make. If you want to have as many people as > possible use the > plug in, I would try to stick to the tools users in > major projects > required to use (Freedom of choice is rarely an > option on a large scale) > or at least try to facilitate their usage as much as > possible... Even if > I have to admit, an Erlang variant sounds neat. > > Francesco > -- > http://www.erlang-consulting.com > > __________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com From cyberlync@REDACTED Mon Sep 16 22:17:50 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 16 Sep 2002 13:17:50 -0700 (PDT) Subject: Make replacement for Erlang - suggestions? In-Reply-To: <200209161828.g8GISOo20400@sork.levonline.com> Message-ID: <20020916201750.30621.qmail@web40208.mail.yahoo.com> > In most projects I been involded in we have used > gmake and stayed with > it. I think allot of software projects use make, hence the requirement that it be supported. > > For make replacement I simply ask why ? You can use > gmake on every > useable platform on earth, and even windows with > cygwin ... Ok, I will tell you why. Just remember that this is my opionion, I am not trying to troll here. Feel free to disagree with me as you see fit. One of the foundation stones of a decent software system is maintainability. One of the hall marks of maintainability as far as I am concerned is ease of reading and understanding the source. This may be one of the reasons I like Ada so much (not as much as Erlang, of course). :) 'Make' syntax is a horrible shell like quasi-scripting langauge that has a definate propensity to be difficult to read and understand. It feels like it has just slowly become encrusted with barnicle like syntax changes and features. I personally hate looking at a 'make' file that I have not personally written for this very reason. Don't get me wrong, it does its job and does it rather well. This is not really a valid argument for continued, unreviewed, use in my book. If everyone accepted this approach we would all still be using assembler. Fortunatly, we have generally moved on to langauges like Erlang, Ada, Java, etc. Assembler is still used in some situtations where its advantages outweight its disadvantages. These situations are, however, the vast minority of cases. I see the 'make' following that same route. It already has begun in the areas where there are viable replacements. Java projects are a good example of this. I personally can't think of any project where make is used instead of ant. Of course, I am not privey to the interal projects of companies outside my own, but this definatly applies to the open source projects. Ant, even with its ugly XML based syntax, far outstrips make in its ease of use, features, and maintainability. I would like to see something similar happen for Erlang. > > I think it would be better to spend the time of > fixing the otp build > chain to build native on a windows machine instead ;-) Perhaps, but that doesn't really fit into my current IDE project, so I will leave that one for others. It is a good idea though :P __________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com From mikael.karlsson@REDACTED Mon Sep 16 22:38:39 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Mon, 16 Sep 2002 22:38:39 +0200 Subject: Make replacement for Erlang - suggestions? In-Reply-To: <20020916193524.90053.qmail@web40210.mail.yahoo.com> References: <20020916193524.90053.qmail@web40210.mail.yahoo.com> Message-ID: <200209162238.39788.mikael.karlsson@creado.com> Joe Armstrong has made ermake: http://www.erlang.org/user.html#ermake-2.0 Don't know if it fullfils all your expectations, but since it is done in Erlang I guess you could always tailor it to your needs. /Mikael m?ndag 16 september 2002 21:35 skrev Eric Merritt: > Francesco, > Support for make/gnumake has to be in place, thats a > given for the very reasons you mentioned. Fortunatly, > I believe that I can pick up most of this support from > some of the other available plugins. So it shouldn't > cost me much in the way of time. > > I would like to see an alternative to make/gnumake. > This is largly due to the fact that I have a very, > very low opinion of make and make clones in general. > > Thanks, > Eric > > --- Francesco Cesarini > > wrote: > > In most large scale projects I have been involved > > in, we have used > > gnumake, and whenever busted by some paranoid > > project manager, we moved > > over to make. If you want to have as many people as > > possible use the > > plug in, I would try to stick to the tools users in > > major projects > > required to use (Freedom of choice is rarely an > > option on a large scale) > > or at least try to facilitate their usage as much as > > possible... Even if > > I have to admit, an Erlang variant sounds neat. > > > > Francesco > > -- > > http://www.erlang-consulting.com > > __________________________________________________ > Do you Yahoo!? > Yahoo! News - Today's headlines > http://news.yahoo.com From cyberlync@REDACTED Mon Sep 16 23:00:42 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 16 Sep 2002 14:00:42 -0700 (PDT) Subject: Make replacement for Erlang - suggestions? In-Reply-To: <200209162238.39788.mikael.karlsson@creado.com> Message-ID: <20020916210042.65591.qmail@web40209.mail.yahoo.com> Mikael, The only problem with ermake is that Joe simply reimplemented 'make' in Erlang. Although, it is cool its still 'make'. I am looking to replace 'make', syntax and all. Thanks, Eric --- Mikael Karlsson wrote: > Joe Armstrong has made ermake: > > http://www.erlang.org/user.html#ermake-2.0 > > Don't know if it fullfils all your expectations, but > since it is done in Erlang I guess you could always > tailor it to your needs. > > /Mikael > > m?ndag 16 september 2002 21:35 skrev Eric Merritt: > > Francesco, > > Support for make/gnumake has to be in place, > thats a > > given for the very reasons you mentioned. > Fortunatly, > > I believe that I can pick up most of this support > from > > some of the other available plugins. So it > shouldn't > > cost me much in the way of time. > > > > I would like to see an alternative to > make/gnumake. > > This is largly due to the fact that I have a very, > > very low opinion of make and make clones in > general. > > > > Thanks, > > Eric > > > > --- Francesco Cesarini > > > > wrote: > > > In most large scale projects I have been > involved > > > in, we have used > > > gnumake, and whenever busted by some paranoid > > > project manager, we moved > > > over to make. If you want to have as many people > as > > > possible use the > > > plug in, I would try to stick to the tools users > in > > > major projects > > > required to use (Freedom of choice is rarely an > > > option on a large scale) > > > or at least try to facilitate their usage as > much as > > > possible... Even if > > > I have to admit, an Erlang variant sounds neat. > > > > > > Francesco > > > -- > > > http://www.erlang-consulting.com > > > > __________________________________________________ > > Do you Yahoo!? > > Yahoo! News - Today's headlines > > http://news.yahoo.com > __________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com From mikael.karlsson@REDACTED Tue Sep 17 09:07:07 2002 From: mikael.karlsson@REDACTED (Mikael Karlsson) Date: Tue, 17 Sep 2002 09:07:07 +0200 Subject: Section numbering using xmerl:export In-Reply-To: References: Message-ID: <200209170907.07589.mikael.karlsson@creado.com> m?ndag 16 september 2002 17:02 skrev Ulf Wiger: > On Mon, 16 Sep 2002, Mikael Karlsson wrote: > >> >For some reason I have to reverse the list returned by > >> >xmerl_xpath:string/2. > >> > >> This is most likely a bug, but I'm afraid I don't have time > >> to look into it right now. Perhaps someone else could look > >> at the code? > > > >I get the message :-). > >I'll have a look and see if I can understand it. > > I wonder if not all instances of lists:foldl in > xmerl_xpath.erl should be replaced by lists:foldr... > Yes. It works just fine after changing. Also positioning like "section[position() = 1]" selects the first section now. Thanks! /Mikael From mickael.remond@REDACTED Tue Sep 17 12:02:05 2002 From: mickael.remond@REDACTED (Mickael Remond) Date: Tue, 17 Sep 2002 12:02:05 +0200 Subject: Make replacement for Erlang - suggestions? Message-ID: <1032256925.3d86fd9d81600@webmail.spamcop.net> Eric Merritt : > Mikael, > > The only problem with ermake is that Joe simply > reimplemented 'make' in Erlang. Although, it is cool > its still 'make'. I am looking to replace 'make', > syntax and all. What is cool in Ermake is that you can develop the to build the target directly in Erlang. You can also use some Erlang functions to detect where Erlang has been installed, to help you detect the os, etc. I have a modified version of ermake where I added some helper functions to replace the sed type substitution, with some complete examples of how to write an Ermake file that make it possible to compile an Erlang code on several platform. Unfortunately the work is still in progress, but you will find an example as attachement and the work in progress ermake_lib file that is need to use it. You are welcome to improve this file. I hope to release a version 3.0 of ermake soon as a packaged new version. I hope this will help promoting the Erlang platform on Windows by helping the generation of multiplatform "makefile". I hoping to get time to convert the makefile for BTT (Open Source source bug tracker are a nightmare to install except this one=> I hope the makefile will make it attractive on windows),and yaws. -- Micka?l R?mond -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: EMakefile URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ermake_lib.erl URL: From cyberlync@REDACTED Tue Sep 17 14:56:58 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Tue, 17 Sep 2002 05:56:58 -0700 (PDT) Subject: Make replacement for Erlang - suggestions? In-Reply-To: <1032256925.3d86fd9d81600@webmail.spamcop.net> Message-ID: <20020917125658.57035.qmail@web40208.mail.yahoo.com> Mickael, It looks like I was *way* to hasty to dismiss ermake as a 'make' clone. I do that more then I like to admit :-) I apoligize. Thank you for your examples, I will definatly take the time to look into it further. Thanks, Eric --- Mickael Remond wrote: > Eric Merritt : > > > Mikael, > > > > The only problem with ermake is that Joe simply > > reimplemented 'make' in Erlang. Although, it is > cool > > its still 'make'. I am looking to replace 'make', > > syntax and all. > > What is cool in Ermake is that you can develop the > to build the target > directly in Erlang. You can also use some Erlang > functions to detect where > Erlang has been installed, to help you detect the > os, etc. > I have a modified version of ermake where I added > some helper functions to > replace the sed type substitution, with some > complete examples of how to write > an Ermake file that make it possible to compile an > Erlang code on several > platform. > > Unfortunately the work is still in progress, but you > will find an example as > attachement and the work in progress ermake_lib file > that is need to use it. > You are welcome to improve this file. > > I hope to release a version 3.0 of ermake soon as a > packaged new version. > > I hope this will help promoting the Erlang platform > on Windows by helping the > generation of multiplatform "makefile". > I hoping to get time to convert the makefile for BTT > (Open Source source bug > tracker are a nightmare to install except this one=> > I hope the makefile will > make it attractive on windows),and yaws. > > -- > Micka?l R?mond > %% -=-=-=- > %% 20020913 - Mickael Remond > %% Platform independant version of the compilation > file for > %% Eddieware dns_server > %% -=-=-=- > include("vsn.emk"). > > SRCDIR=src. > EBINDIR=ebin. > BINDIR=bin. > INCDIR=inc. > PRIVDIR=priv. > PREFIX=/usr/local. > > include("standard_rules.emk"). > > %% Erlang source files > EBINFILES=$(EBINDIR)/dns_app.beam, > $(EBINDIR)/dns_cache.beam, > $(EBINDIR)/dns_catalog.beam, > $(EBINDIR)/dns_domain_sup.beam, > $(EBINDIR)/dns_load.beam, > $(EBINDIR)/dns_parse.beam, > $(EBINDIR)/dns_query.beam, > $(EBINDIR)/dns_recurse.beam, > $(EBINDIR)/dns_recurse_udp_tracker.beam, > $(EBINDIR)/dns_rr.beam, > $(EBINDIR)/dns_server.beam, > $(EBINDIR)/dns_sig.beam, > $(EBINDIR)/dns_sup.beam, > $(EBINDIR)/dns_tcp_accept.beam, > $(EBINDIR)/dns_udp.beam, > $(EBINDIR)/dns_xfr.beam, > $(EBINDIR)/dns_zone.beam, > $(EBINDOR)/config_file.erl. > > %% OTP Application files > APPFILE=dns_server.app. > APPSRC=$(SRCDIR)/$(APPFILE).src. > APPTARGET=$(EBINDIR)/$(APPFILE). > RELSRC=$(SRCDIR)/dns.rel.src. > RELFILE=$(EBINDIR)/dns. > RELTARGET=$(RELFILE).rel. > > CONFIGSRC=$(SRCDIR)/sys.config.src. > CONFIGTARGET=$(EBINDIR)/dns_sys.config. > > STARTSRC=$(SRCDIR)/lbdns.src. > STARTTARGET=$(BINDIR)/lbdns. > > %% -=-=- > > all when $(EBINFILES), appfile, script, sysconfig, > lbdns. > > appfile when $(APPTARGET) -> > ermake_lib:subst("$(APPSRC)", "$(APPTARGET)", > [{"%VSN%", $(VSN)}]). > > %% TODO: Make start script both on Windows and > Unix/Linux > %% Use: os:type to switch to the proper build of > the script. > script -> > ermake_lib:subst("$(RELSRC)", "$(RELTARGET)", []), > systools:make_script("$(RELFILE)", [{path, > ["$(EBINDIR)"]}]). > > sysconfig -> > ermake_lib:subst("$(CONFIGSRC)", "$(CONFIGTARGET)", > [{"%MF_BYTES%", "512000"}, > {"%MF_FILES%", "5"}]). > > %% Start script: > %% TODO: Windows version > lbdns -> > {ok, ROOTDIR} = file:get_cwd(), > ermake_lib:subst("$(STARTSRC)", "$(STARTTARGET)", > [{"%ROOTDIR%", ROOTDIR}, > {"%DNS_BOOT%", > filename:absname("$(EBINDIR)/dns")}, > {"%BINDIR%", > filename:absname("$(BINDIR)")}, > {"%SYSCONF%", > filename:absname("$(EBINDIR)/dns_sys")}, > {"%ERL_ROOT%", code:root_dir()}]). > %%TODO: chmod of start file > > test -> > %% TODO: Test build > system:cmd("bin/start -b test/named.boot"). > %% TODO: Call test functions. > > clean -> > %% Not yet implemented in ermake_lib. > %%ermake_lib:clean("$(APPTARGET)"). > io:format("Removing ~s ~n", ["$(EBINFILES)"]). > %% TODO Tar generation. > > %% This library contains functions aiming at > simplifying the development of > %% EMakefiles > -module(ermake_lib). > > -author("mickael.remond@REDACTED"). > > -export([subst/3]). > > > %% This function aims at replacing simple and direct > substitution traditionaly > %% done with SED in Unix makefile > %% Take the name of an Input file and output file. > %% It is usefull when you have template (for example > starting scripts) > %% that need some substitution during the build of > the project. > %% Substitution are expressed as a list of tuples of > the form {"Regexp", "Replacement string"} > > %% Load file, perform substitution, save new file > subst(InFile, OutFile, ListOfSubsts) -> > %% Read the file as a binary. > {ok, Bin} = file:read_file(InFile), > String = binary_to_list(Bin), > NewString = perform_all_substs(String, > ListOfSubsts), > NewBin = list_to_binary(NewString), > file:write_file(OutFile, NewBin). > > perform_all_substs(String, []) -> > String; > perform_all_substs(String, [Subst|Substs]) -> > {Regexp, NewStr} = Subst, > case regexp:gsub(String, Regexp, NewStr) of > {ok, NewString, RepCount} -> > perform_all_substs(NewString, Substs); > {error, Error} -> > io:format("Error in Regexp: ~p~n", [Error]), > perform_all_substs(String, Substs) > end. > > %% Clean is intended to be use as a way to remove > list of target > %% resulting from previous project build. > %% It get a string, which is a comma separated list > of file to remove. > %% Space, tabulation and carriage return are remove > from the string. > %% Then the string is split based on the comma file > delimiter. > %% Each file from the resulting list of file is then > deleted. > %% It makes easy to write a clean target in > EMakefile, thus making easier > %% to clean-up your directory structure before > release your source code. > %clean(String) -> > %% Remove unwanted characters: > __________________________________________________ Do you Yahoo!? Yahoo! News - Today's headlines http://news.yahoo.com From vances@REDACTED Wed Sep 18 10:04:48 2002 From: vances@REDACTED (Vance Shipley) Date: Wed, 18 Sep 2002 04:04:48 -0400 Subject: match List1 in List2 Message-ID: <20020918080448.GF431@frogman.motivity.ca> What would be the best way to return the list of tuples in List1 which match the tuples in List2? List1 = [{foo, 13}, {bar, 42}, {fooz, 67}] List2 = [{baz, 15}, {booz, 145}, .....] It seems to me that this should be a one liner but I've not found the simple solution yet. -Vance From hakan@REDACTED Wed Sep 18 10:33:38 2002 From: hakan@REDACTED (Hakan Mattsson) Date: Wed, 18 Sep 2002 10:33:38 +0200 (MEST) Subject: match List1 in List2 In-Reply-To: <20020918080448.GF431@frogman.motivity.ca> Message-ID: On Wed, 18 Sep 2002, Vance Shipley wrote: Vance> What would be the best way to return the list of tuples Vance> in List1 which match the tuples in List2? Vance> Vance> List1 = [{foo, 13}, {bar, 42}, {fooz, 67}] Vance> List2 = [{baz, 15}, {booz, 145}, .....] Vance> Vance> It seems to me that this should be a one liner but I've Vance> not found the simple solution yet. This perhaps? 1> List1 = [{foo, 13}, {bar, 42}, {fooz, 67}]. [{foo,13},{bar,42},{fooz,67}] 2> List2 = [{baz, 15}, {booz, 145},{fooz,67}]. [{baz,15},{booz,145},{fooz,67}] 3> [A || A <- List1, B <- List2, A == B]. [{fooz,67}] 4> /H?kan From etxhua@REDACTED Wed Sep 18 10:44:24 2002 From: etxhua@REDACTED (Asko Husso) Date: Wed, 18 Sep 2002 10:44:24 +0200 (MET DST) Subject: match List1 in List2 Message-ID: <200209180844.g8I8iOr08283@cbe.ericsson.se> > What would be the best way to return the list of tuples > in List1 which match the tuples in List2? > > List1 = [{foo, 13}, {bar, 42}, {fooz, 67}] > List2 = [{baz, 15}, {booz, 145}, .....] > > It seems to me that this should be a one liner but I've > not found the simple solution yet. > > -Vance List2--(List2--List1). That's another solution.. Asko Husso E-mail:etxhua@REDACTED Ericsson AB Phone: +46 8 7192324 Varuv?gen 9B S-126 25 Stockholm-?lvsj?, Sweden From eleberg@REDACTED Wed Sep 18 11:05:47 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Wed, 18 Sep 2002 11:05:47 +0200 (MET DST) Subject: Make replacement for Erlang - suggestions? Message-ID: <200209180905.g8I95lr10326@cbe.ericsson.se> > From: Per Bergqvist > In most projects I been involded in we have used gmake and stayed with > it. > > For make replacement I simply ask why ? You can use gmake on every > useable platform on earth, and even windows with cygwin ... i find http://aegis.sourceforge.net/auug97.pdf a good way of opening peoples eyes to the fallacy of using (g)make. as for the statement about 'if everybody continued using existing tools we would still be using assembler' (sorry for not having a proper quoute): i strongly belive that most programmers today do use a portable, somewhat object oriented, assembler. it is called c++. bengt From luke@REDACTED Wed Sep 18 13:46:07 2002 From: luke@REDACTED (Luke Gorrie) Date: 18 Sep 2002 13:46:07 +0200 Subject: Make replacement for Erlang - suggestions? In-Reply-To: <200209180905.g8I95lr10326@cbe.ericsson.se> References: <200209180905.g8I95lr10326@cbe.ericsson.se> Message-ID: Bengt Kleberg writes: > > From: Per Bergqvist > > > In most projects I been involded in we have used gmake and stayed with > > it. > > > > For make replacement I simply ask why ? You can use gmake on every > > useable platform on earth, and even windows with cygwin ... > > i find http://aegis.sourceforge.net/auug97.pdf a good way of opening > peoples eyes to the fallacy of using (g)make. I read that paper (Recursive Make Considered Harmful) a ways back and it didn't make much of an impression. But then I was recently playing with Ghostscript, which uses non-recursive makefiles (i.e. a "monolithic" Makefile, modularized with includes), and it's pretty nice. If you "make" when things are already up-to-date, it just returns very quickly, rather than taking several seconds and outputting hundreds of lines like "Entering .." I tried the same approach on my last program that needed makefiles, and though it performs nicely, I did find it a bugger to code. There appear to be some tricks, but they don't seem very widely known. A friend also "ported" a Makefile for a java program of mine into Ant's XML format, incase anyone's curious you can see the before and after: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/echidna/echidna/Makefile?rev=1.7&content-type=text/vnd.viewcvs-markup http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/echidna/echidna/build.xml?rev=1.4&content-type=text/vnd.viewcvs-markup I'll just say that the XML version is larger (at least in part) because it is also generating documentation, and let you draw your own conclusions. Cheers, Luke From matthias@REDACTED Wed Sep 18 16:29:33 2002 From: matthias@REDACTED (Matthias Lang) Date: Wed, 18 Sep 2002 16:29:33 +0200 Subject: Make replacement for Erlang - suggestions? In-Reply-To: References: <200209180905.g8I95lr10326@cbe.ericsson.se> Message-ID: <15752.36301.400628.275014@antilipe.corelatus.se> Luke Gorrie writes: > I read that paper (Recursive Make Considered Harmful) a ways back and > it didn't make much of an impression. [...] > I did find it a bugger to code. There appear to be some tricks, > but they don't seem very widely known. I hadn't seen the paper until now. It raised some interesting points, though I'm suspicious because - 'make' systems are a very soft target. Lots of strange rules to make them work around all sorts of local problems makes them inherently ugly. - the author comes from Canberra, which is basically chock-full of people peddling "simple" solutions to complex problems - I can't find any advice on the WWW for "how do I actually make this work" An example: in the source tree for one of our products, there are at least three different ways to turn a .c file into a .o file, depending on whether the object code is meant to run on the target board's CPU, the DSP or on the build system. I currently deal with this by keeping code intended for different compilers in different directories. In one Makefile I might have %.o: %.c $(CC) $(CFLAGS) -c $< while in another I might have %.o: %.c $(PPC_CC) $(PPC_CFLAGS) -c $< I can't think of a sensible way to do this in a combined makefile, with or without include files. Maybe I've missed something obvious. Matt From luke@REDACTED Wed Sep 18 16:47:14 2002 From: luke@REDACTED (Luke Gorrie) Date: 18 Sep 2002 16:47:14 +0200 Subject: Make replacement for Erlang - suggestions? In-Reply-To: <15752.36301.400628.275014@antilipe.corelatus.se> References: <200209180905.g8I95lr10326@cbe.ericsson.se> <15752.36301.400628.275014@antilipe.corelatus.se> Message-ID: Matthias Lang writes: > - I can't find any advice on the WWW for "how do I actually make > this work" A program called "Idel" makes a very nice example, I reckon. http://www.accesscom.com/~darius/software/idel/ One nice trick is defining some variables in the top level, like TESTS, EXAMPLES, OBJECTS, etc, with user-visible targets like "test" depending on them. The included sub-makefiles define all their own rules, and then "+=" their targets onto those top-level variables to "hook into" the user-visible make targets. > An example: in the source tree for one of our products, there are at > least three different ways to turn a .c file into a .o file, depending > on whether the object code is meant to run on the target board's CPU, > the DSP or on the build system. > > I currently deal with this by keeping code intended for different > compilers in different directories. In one Makefile I might have > > %.o: %.c > $(CC) $(CFLAGS) -c $< > > while in another I might have > > %.o: %.c > $(PPC_CC) $(PPC_CFLAGS) -c $< > > I can't think of a sensible way to do this in a combined makefile, > with or without include files. Maybe I've missed something obvious. How about: board/%.o: board/%.c $(PPC_CC) $(PPC_CFLAGS) -c $< dsp/%.o: dsp/%.c $(DSP_CC) $(DSP_CFLAGS) -c $< (Maybe a GNU-ism, not sure.) Cheers, Luke From eleberg@REDACTED Wed Sep 18 16:51:41 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Wed, 18 Sep 2002 16:51:41 +0200 (MET DST) Subject: Make replacement for Erlang - suggestions? Message-ID: <200209181451.g8IEpfr04133@cbe.ericsson.se> > X-Original-Recipient: eleberg@REDACTED > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Date: Wed, 18 Sep 2002 16:29:33 +0200 > From: Matthias Lang > - 'make' systems are a very soft target. Lots of strange rules to > make them work around all sorts of local problems makes them > inherently ugly. i would take this as a reason to create a new system for building software. better suited to the task than 'make'. > - the author comes from Canberra, which is basically chock-full of > people peddling "simple" solutions to complex problems you are the domain expert here :-) > - I can't find any advice on the WWW for "how do I actually make > this work" perhaps this is because most people use recursive make systems. this fact does not (automatically) make recursive make better. as a counter example: most people use c(++). most people use windows. > An example: in the source tree for one of our products, there are at > least three different ways to turn a .c file into a .o file, depending > on whether the object code is meant to run on the target board's CPU, > the DSP or on the build system. > > I currently deal with this by keeping code intended for different > compilers in different directories. In one Makefile I might have > > %.o: %.c > $(CC) $(CFLAGS) -c $< > > while in another I might have > > %.o: %.c > $(PPC_CC) $(PPC_CFLAGS) -c $< > > I can't think of a sensible way to do this in a combined makefile, > with or without include files. Maybe I've missed something obvious. i would guess that there is nothing wrong with your intellect. more likely there is a problem with 'make'. perhaps there is a better solution for building software. bengt From eleberg@REDACTED Wed Sep 18 17:12:18 2002 From: eleberg@REDACTED (Bengt Kleberg) Date: Wed, 18 Sep 2002 17:12:18 +0200 (MET DST) Subject: Make replacement for Erlang - suggestions? Message-ID: <200209181512.g8IFCIr06635@cbe.ericsson.se> > To: matthias@REDACTED > Cc: Bengt Kleberg , erlang-questions@REDACTED > Subject: Re: Make replacement for Erlang - suggestions? > From: Luke Gorrie ...deleted > How about: > > board/%.o: board/%.c > $(PPC_CC) $(PPC_CFLAGS) -c $< > > dsp/%.o: dsp/%.c > $(DSP_CC) $(DSP_CFLAGS) -c $< > > (Maybe a GNU-ism, not sure.) genuine make, not gnumake specific. bengt From jamesh@REDACTED Thu Sep 19 21:26:50 2002 From: jamesh@REDACTED (James Hague) Date: Thu, 19 Sep 2002 14:26:50 -0500 Subject: map and filter with list comprehensions Message-ID: Map and filter can be written with list comprehensions as follows: map(Fun, L) -> [Fun(X) || X <- L]. filter(Pred, L) -> [X || X <- L, Pred(X)]. In the lists module of the standard library, filter is written using list comprehensions, just as above. Map looks like this: map(F, [H|T]) -> [F(H)|map(F, T)]; map(F, []) -> []. Is there a reason why the list comprehension version isn't preferred? From hakan.stenholm@REDACTED Fri Sep 20 00:22:40 2002 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Fri, 20 Sep 2002 00:22:40 +0200 Subject: map and filter with list comprehensions Message-ID: <4F7711F0-CC1E-11D6-A7A6-000393B8AB26@mbox304.swipnet.se> If memory serves right, the reason used to be that list comprehension was slower than the recursiv version - this was true in R6 (R5 ?) and earlier, but nowdays there should be no major difference. From bjorn@REDACTED Fri Sep 20 09:47:54 2002 From: bjorn@REDACTED (=?ISO-8859-15?Q?Bj=F6rn_Bylander?=) Date: Fri, 20 Sep 2002 09:47:54 +0200 Subject: Correct way of including a module in an application Message-ID: <3D8AD2AA.7010906@loxysoft.se> Hello, I'm currently writing an OTP application which makes use of http://www.erlang.org/contrib/ucs-0.1.tgz. What would be the correct way of integrating this module into my application? I've created a boot file which primLoads ucs but that doesn't actually load the module. Should I put code:load_file(ucs) somewhere in my application or is there some other more "correct" way of doing this? Thanks in advance, Bj?rn From matthias@REDACTED Fri Sep 20 09:59:37 2002 From: matthias@REDACTED (Matthias Lang) Date: Fri, 20 Sep 2002 09:59:37 +0200 Subject: Make replacement for Erlang - suggestions? In-Reply-To: <200209181451.g8IEpfr04133@cbe.ericsson.se> References: <200209181451.g8IEpfr04133@cbe.ericsson.se> Message-ID: <15754.54633.643580.339042@antilipe.corelatus.se> Bengt Kleberg writes: > > - 'make' systems are a very soft target. Lots of strange rules to > > make them work around all sorts of local problems makes them > > inherently ugly. > i would take this as a reason to create a new system for building > software. better suited to the task than 'make'. I can't prove my conjecture, whereas you can prove yours (by coming up with a make system so much better than gnumake that people switch to it in spite of the inconvenience of having to learn something new). I look forward to being proven wrong. Others have had similar ideas: http://directory.google.com/Top/Computers/Software/Build_Management/Make_Tools/ Matt From bjorn@REDACTED Fri Sep 20 13:58:38 2002 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 20 Sep 2002 13:58:38 +0200 Subject: map and filter with list comprehensions In-Reply-To: Håkan Stenholm's message of "Fri, 20 Sep 2002 00:22:40 +0200" References: <4F7711F0-CC1E-11D6-A7A6-000393B8AB26@mbox304.swipnet.se> Message-ID: H?kan Stenholm writes: > If memory serves right, the reason used to be that list comprehension > was slower than the recursiv version - this was true in R6 (R5 ?) and > earlier, but nowdays there should be no major difference. > Yes, that is correct. Nowadays lists comprehensions are transformed to a recursive function. List comprehensions used to be very slow because the were transformed to a recursive fun, and fun calls too used to be a lot slower than they are today. /Bjorn -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From goran.bage@REDACTED Sun Sep 22 16:22:57 2002 From: goran.bage@REDACTED (=?ISO-8859-1?Q?G=F6ran_B=E5ge?=) Date: Sun, 22 Sep 2002 16:22:57 +0200 Subject: I/O streams References: Message-ID: <3D8DD241.3090702@home.se> Torbjorn Tornkvist wrote: > Talking about streams. Just for the fun of it, here's an old hack that > the great Phil Wadler helped me out with once. > Fun stuff! Going thru it I took the liberty to clean up some macros and adapt them to todays Erlang. -- -- Goran -------------------- May the Snow be with you ------- Goran Bage Byvagen 10, SE-133 34 Saltsjobaden, Sweden email:goran.bage@REDACTED, phone: +46 8 7172907 -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: ns.erl URL: From luke@REDACTED Sun Sep 22 20:56:27 2002 From: luke@REDACTED (Luke Gorrie) Date: 22 Sep 2002 20:56:27 +0200 Subject: Make replacement for Erlang - suggestions? In-Reply-To: <20020916160602.40827.qmail@web40205.mail.yahoo.com> References: <20020916160602.40827.qmail@web40205.mail.yahoo.com> Message-ID: Eric Merritt writes: > Java already has a similar tool call 'Ant'. Its a > very good tool directed specifically at Java. It may > be customized for other languages due to the provision > of extension tags, however the core of 'Ant' including > all the built in tags are specific to Java. I interrogated some Java friends about why they like Ant better than Make. Apparently the big win is portability - it runs stand-alone anywhere you have java. Since an extremely common platform for java programmers is windows with java and without cygwin, Ant-based programs are more accessible. Apparently it also does a nice job of some things that are hard in Make, related to the gazillion new file formats (with catchy names like Enterprise Archives, or .ear). I didn't get the details of that, so I'm not sure if a short Make include file would do the job too. I'd be tempted to write it all off as java not-invented-here syndrome, but they guys I asked are good programmers who know unix, so I guess it's a real win for java. Didn't sound like it had any fundamental improvements that one would want in a new Make replacement for unix-like environments though. Cheers, Luke From luke@REDACTED Sun Sep 22 23:13:07 2002 From: luke@REDACTED (Luke Gorrie) Date: 22 Sep 2002 23:13:07 +0200 Subject: Who's the Erl-y Bird? Message-ID: Ahoy, There were two Erlang entries to the ICFP contest this year, one by me, Joe, and Robert, and another with team name "The Erl-y Bird". I'm most curious - who was it? :-) Cheers, Luke From jabeena@REDACTED Mon Sep 23 06:47:48 2002 From: jabeena@REDACTED (Jabeena) Date: Mon, 23 Sep 2002 10:17:48 +0530 Subject: Controlling Erlang stack from C Message-ID: <001001c262bc$5d9d0360$8502a8c0@Venus> Hi, I wanted to know the procedure, How the Protocol Stack (megaco) implemented in Erlang can be controlled from C? Regards Jabeena Begum G Deccanet Designs Ltd Telecom Business Unit 3rd Floor, Oxford Towers #139, Airport Road Bangalore - 560 008 India -------------- next part -------------- An HTML attachment was scrubbed... URL: From Erik.Reitsma@REDACTED Mon Sep 23 10:44:00 2002 From: Erik.Reitsma@REDACTED (Erik Reitsma (ELN)) Date: Mon, 23 Sep 2002 10:44:00 +0200 Subject: Erlang and Java through CORBA version combinations Message-ID: Hi! About a year ago, I tried to get Erlang to talk to Java JDK 1.3.1 through CORBA. At that time I did not succeed, but now I finally found a work-around. Not that I have been working on it all this time of course... I assume that it is a bug in JDK 1.3.1: it gives IORs with GIOP version 1.1, but when Erlang speaks 1.1 to it, the Java ORB throws marshalling errors. So my work-around is, to change the versions of incoming IORs to the version that was provided at the command line to the Erlang shell with '-orber giop_version "{1,0}"'. That way Orber will think that it is supposed to talk GIOP 1.0 to it. It is a bit dirty, but it worked... It is a very small modification, and I have only tried it with Orber 3.2.13 and JDK 1.3.1. So I cannot promise that it will not break anything else. It only solved my problem, so I am happy with it myself. I have included the diff from the original to my adapted version. Regards, *Erik. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: diff.txt URL: From Niclas.Eklund@REDACTED Mon Sep 23 11:24:07 2002 From: Niclas.Eklund@REDACTED (Niclas Eklund) Date: Mon, 23 Sep 2002 11:24:07 +0200 (MEST) Subject: Erlang and Java through CORBA version combinations In-Reply-To: Message-ID: Hello! There seems to be a problem with JDK-1.3.1 regarding CodeSet negotiation; it cannot handle IOR:s which include CodeSet components correctly. This happens if the JDK-ORB act as client-side ORB - raises the org.omg.CORBA.INV_OBJREF exception (minor code: 1398079490). In the next Orber-version it will be possible to configure Orber to exclude this component, even though the OMG specification states that it should be included. Activating this option will most likely cause problems if you use the datatype(s) wchar and/or wstring. I'll probably be able to give a better answer if you could: * Use 'orber_debug_level 10' and e-mail any printouts. shell> erl -orber orber_debug_level 10 erl> orber:configure(orber_debug_level, 10). * The minor-code in the marshal-exception? * Which datatypes are you using (IDL-code)? /Nick > Hi! > > About a year ago, I tried to get Erlang to talk to Java JDK 1.3.1 > through CORBA. At that time I did not succeed, but now I finally found a > work-around. Not that I have been working on it all this time of > course... > > I assume that it is a bug in JDK 1.3.1: it gives IORs with GIOP version > 1.1, but when Erlang speaks 1.1 to it, the Java ORB throws marshalling > errors. So my work-around is, to change the versions of incoming IORs to > the version that was provided at the command line to the Erlang shell > with '-orber giop_version "{1,0}"'. That way Orber will think that it is > supposed to talk GIOP 1.0 to it. It is a bit dirty, but it worked... > > It is a very small modification, and I have only tried it with Orber > 3.2.13 and JDK 1.3.1. So I cannot promise that it will not break > anything else. It only solved my problem, so I am happy with it myself. > > I have included the diff from the original to my adapted version. > > Regards, > *Erik. From bjarne@REDACTED Mon Sep 23 11:34:04 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Mon, 23 Sep 2002 11:34:04 +0200 Subject: Two exciting Erlang events References: Message-ID: <3D8EE00C.E9AFB08C@erix.ericsson.se> Call for attendance ACM SIGPLAN Erlang Workshop October 7, 2002, Pittsburgh, PA, USA http://www.erlang.se/workshop/2002/ Call for Papers Erlang/OTP User Conference, EUC November 19, 2002, Stockholm, Sweden http://www.erlang.se/euc/02/ There have been already 8-10 papers submitted for the EUC so it looks like becoming as interesting as always. Best regards Bjarne From micael.karlberg@REDACTED Mon Sep 23 13:20:32 2002 From: micael.karlberg@REDACTED (Micael Karlberg) Date: 23 Sep 2002 11:20:32 GMT Subject: Controlling Erlang stack from C References: <001001c262bc$5d9d0360$8502a8c0@Venus> Message-ID: Hi, The application megaco_session is intended for this. I.e. it provides a C-interface to the Megaco (erlang-) application. Megaco is part of Erlang/OTP, and the open source version can be found at: http://www.erlang.org/ Megaco session is available as a separate download from: http://www.erlang.org/project/megaco/ The documentation for the Megaco session application is currently not very extensive... Regards, /BMK In article <001001c262bc$5d9d0360$8502a8c0@REDACTED>, Jabeena wrote: > This is a multi-part message in MIME format. > > ------=_NextPart_000_000D_01C262EA.772F19C0 > Content-Type: text/plain; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > Hi, > > I wanted to know the procedure, > How the Protocol Stack (megaco) implemented in Erlang can be controlled = > from C? > > Regards > Jabeena Begum G > Deccanet Designs Ltd > Telecom Business Unit > 3rd Floor, Oxford Towers > #139, Airport Road > Bangalore - 560 008 > India > > ------=_NextPart_000_000D_01C262EA.772F19C0 > Content-Type: text/html; > charset="iso-8859-1" > Content-Transfer-Encoding: quoted-printable > > > > http-equiv=3DContent-Type> > > > > >
Hi,
>
 
>
I wanted to know the = > procedure,
>
 How the Protocol Stack = > (megaco)=20 > implemented in Erlang can be controlled from C?
>
 
>
Regards
>
Jabeena Begum G
Deccanet Designs = > Ltd
Telecom=20 > Business Unit
3rd Floor, Oxford Towers
#139, Airport = > Road
Bangalore -=20 > 560 008
India
> > ------=_NextPart_000_000D_01C262EA.772F19C0-- > > -- Micael Karlberg Mail: micael.karlberg@REDACTED Ericsson AB, ?lvsj? Sweden EAB/UHK/KD From cyberlync@REDACTED Mon Sep 23 14:56:06 2002 From: cyberlync@REDACTED (Eric Merritt) Date: Mon, 23 Sep 2002 05:56:06 -0700 (PDT) Subject: Make replacement for Erlang - suggestions? In-Reply-To: Message-ID: <20020923125606.77111.qmail@web40209.mail.yahoo.com> > I'd be tempted to write it all off as java > not-invented-here syndrome, > but they guys I asked are good programmers who know > unix, so I guess > it's a real win for java. > > Didn't sound like it had any fundamental > improvements that one would > want in a new Make replacement for unix-like > environments though. I guess it would depend on what you considered fundamental improvements. I will agree with you, the functionality of make is pretty much all there. I am sure there are not to many features that it is lacking at this time. I have two big problems with make 1) The fact that you can not really write cross-platform make files. 2) The ugly non-intuitive syntax, and distribution of make files. (* This is of course my opinion, and I realize that not everyone shares this opinion with me. *) As for the first problem, for languages like C/C++ etc I don't really know how you could create a truly cross-platform makefile or at least a makefile without a lot of branches and tweeks for each platform. So much of the compilation of these langauges requires platform specific tweeks. However, for languages like Java, Erlang, Python, Ocaml, etc. that are inherently cross-platform this is not a problem. 2) I am a big believer the the fact that a languages syntax matters a great deal to its understandability and maintainability. To me, the standard 'make' syntax leaves a whole lot to be desired. Many would argue that this is a waste of time, I don't agree with that assessment at all. I think make is so ubiquitous becuase its is available on allot of platforms, it's free, and replacing all it's functionality would take a significant amount of time. At this point it has a significant amount of market share as well. Fortunatly, my goal is not to replace make for everyone. Only to replace make for myself, if anyone else who would like to use it thats fine too. Also I would like to build in support for it into the eclipse plugin I have been working on. __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com From Marc.Vanwoerkom@REDACTED Mon Sep 23 16:51:48 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Mon, 23 Sep 2002 16:51:48 +0200 (MEST) Subject: Make replacement for Erlang - suggestions? In-Reply-To: <15754.54633.643580.339042@antilipe.corelatus.se> (message from Matthias Lang on Fri, 20 Sep 2002 09:59:37 +0200) Message-ID: <200209231451.g8NEpmM19835@bonsai.fernuni-hagen.de> > > i would take this as a reason to create a new system for building > > software. better suited to the task than 'make'. > > I can't prove my conjecture, whereas you can prove yours (by coming up > with a make system so much better than gnumake that people switch to > it in spite of the inconvenience of having to learn something new). > > I look forward to being proven wrong. Jakarta Ant is definitely making its way into the Java community. Ant is better than what most Java IDEs offered in the past and easier to use than make (because of many predefined targets that are useful for Java related build tasks) and because it is relativly new and compels to the rather younger Java developers without C/UNIX background, eg its input format is XML based, which is buzzwordy but I guess at this point this neither a pro or con for it. Regards, Marc From Marc.Vanwoerkom@REDACTED Mon Sep 23 17:31:21 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Mon, 23 Sep 2002 17:31:21 +0200 (MEST) Subject: Make replacement for Erlang - suggestions? In-Reply-To: <20020923125606.77111.qmail@web40209.mail.yahoo.com> (message from Eric Merritt on Mon, 23 Sep 2002 05:56:06 -0700 (PDT)) Message-ID: <200209231531.g8NFVLD24693@bonsai.fernuni-hagen.de> > fundamental improvements. I will agree with you, the > functionality of make is pretty much all there. I am > sure there are not to many features that it is lacking > at this time. I have two big problems with make It has dependencies, lots of predefined targets (useful for Java work) and the ability to do work via a call to the local shell. > 1) The fact that you can not really write > cross-platform make files. I would argue that gnumake is available on virtually every platform and that is not too hard to make stuff work for many platforms under it. Note that Ant has the same portability problem, once you need to do work that is not in the predefined bag of targets. > 2) The ugly non-intuitive syntax, and distribution of > make files. (* This is of course my opinion, and I > realize that not everyone shares this opinion with me. > *) I only hate the mix of different syntaxes between make and usually bourne shell syntax. > As for the first problem, for languages like C/C++ etc > I don't really know how you could create a truly > cross-platform makefile or at least a makefile without > a lot of branches and tweeks for each platform. The autotools (automake/autoconf/libtool) are not bad either, they work one level higher, but have their own problems. My ex-colleagues hated it because they were too lazy learn the extra stuff and kept to their make/sh stuff despite my autotools system being much powerful. The manager wanted more than one person to be able to support the build system so we had to agree on the lower common denominator make/sh. :( > I think make is so ubiquitous becuase its is available > on allot of platforms, it's free, and replacing all > it's functionality would take a significant amount of > time. At this point it has a significant amount of > market share as well. What ever happened to the code sourcery attempt to replace some of the build/configuration infrastructure? They ran a competition which produced some interesting drafts on what to create but which got never implemented, as far as I know. Regards, Marc From roberto.portugal@REDACTED Mon Sep 23 22:01:36 2002 From: roberto.portugal@REDACTED (Roberto Portugal (CEC)) Date: Mon, 23 Sep 2002 15:01:36 -0500 Subject: dirty mnesia function Message-ID: <9777764CE9E3D311A97600508B63B91603E73302@eamsant700.cec.ericsson.se> Hi, We are trying to get all records from a mnesia's table. "dirty_match_object" function is used to this purpose: mnesia:dirty_match_object(piuTable, {piuTable,'_','_','_','_','_','_','_','_','_','_','_','_','_'}). However some records are not valid when content is returned. The following is a valid record returned: {piuTable,{1,2,2,1}, 2, "SC", 1, 5, 2, "ROJ_238_007/1", "R7A/B", "T220089350", "SCB_20G", 2, 2, [1]}. But in the next case, record information is not valid: {piuTable,{1,19,19,2}, 5, "CP-IO", 1, 5, 2, "ROJ_237_051/1", "R9A", "T220110020"|...}. some fields are replaced with "|...". How we can to get all records in a rigth form througth this function? Thanks in advanced. Roberto Roberto Portugal System Integrator Regional Competence Center Ericsson Chile, S.A. Av. Vitacura 2808, Las Condes, Santiago, Chile Telf.: +56 2 372 53 95 Fax: +56 2 372 50 57 E-mail: roberto.portugal@REDACTED http://www.ericsson.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From francesco@REDACTED Tue Sep 24 01:03:59 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Tue, 24 Sep 2002 00:03:59 +0100 Subject: dirty mnesia function References: <9777764CE9E3D311A97600508B63B91603E73302@eamsant700.cec.ericsson.se> Message-ID: <3D8F9DDF.7050404@erlang-consulting.com> Hi Roberto, you are running your match_object function from the shell. That means that the shell will format the result for you as it sees fit. Thus, as is happening in your second example, if there are many records, instead of printing them all out, it prints out the leading elements and replaces all the others with |... Try binding your result to a variable and print it out. For example > RecordList = mnesia:dirty_match_object(piuTable, {piuTable,'_','_','_','_','_','_','_','_','_','_','_','_','_'}). > io:format("~p~n",[RecordList]). Because you are using the tuple representation or records, I am assuming your retrieving the list of records from the shell is for pure test reasons. In that case, as mnesia tables are built on ets tables, you can instead use > RecordList = ets:tab2list(piuTable). You have to still assign it to a variable and print it out using io:format, but avoiding the underscores, are not using the tuple representation of records, with less chances of making mistakes. Good Luck (More like good night over here :-), Francesco -- http://www.erlang-consulting.com Roberto Portugal (CEC) wrote: > Hi, > > We are trying to get all records from a mnesia's table. > "dirty_match_object" function is used to this purpose: > > mnesia:dirty_match_object(piuTable, > {piuTable,'_','_','_','_','_','_','_','_','_','_','_','_','_'}). > > However some records are not valid when content is returned. > The following is a valid record returned: > > {piuTable,{1,2,2,1}, > 2, > "SC", > 1, > 5, > 2, > "ROJ_238_007/1", > "R7A/B", > "T220089350", > "SCB_20G", > 2, > 2, > [1]}. > > But in the next case, record information is not valid: > > {piuTable,{1,19,19,2}, > 5, > "CP-IO", > 1, > 5, > 2, > "ROJ_237_051/1", > "R9A", > "T220110020"|...}. > > some fields are replaced with "|...". > > How we can to get all records in a rigth form througth this function? > > Thanks in advanced. > > Roberto > > > Roberto Portugal > System Integrator > > Regional Competence Center > Ericsson Chile, S.A. > Av. Vitacura 2808, Las Condes, Santiago, Chile > Telf.: +56 2 372 53 95 > Fax: +56 2 372 50 57 > E-mail: roberto.portugal@REDACTED > http://www.ericsson.com > From fritchie@REDACTED Tue Sep 24 05:34:02 2002 From: fritchie@REDACTED (Scott Lystig Fritchie) Date: Mon, 23 Sep 2002 22:34:02 -0500 Subject: Make replacement for Erlang - suggestions? In-Reply-To: Message of "Mon, 23 Sep 2002 17:31:21 +0200." <200209231531.g8NFVLD24693@bonsai.fernuni-hagen.de> Message-ID: <200209240334.g8O3Y2p67879@snookles.snookles.com> >>>>> "meevw" == Marc Ernst Eddy van Woerkom writes: meevw> What ever happened to the code sourcery attempt to replace some meevw> of the build/configuration infrastructure? They ran a meevw> competition which produced some interesting drafts on what to meevw> create but which got never implemented, as far as I know. It's SCons. See http://scons.sourceforge.net/faq/current.html for the full FAQ. "5.4. Is SCons the same as the ScCons design from the Software Carpentry competition? "Yes. Same design, same developer, same goals, essentially the same tool. "SCons, however, is an independent project, and no longer directly associated with Software Carpentry. Hence, we dropped the middle 'c' to differentiate it slightly, and to make it a tiny bit easier to type. "Even though SCons is being developed independently, the goal is for SCons to be a flexible enough tool that it would fit in with any future tools that the Software Carpentry project may produce. "Note that, at last report, the Software Carpentry project renamed their tools with the prefix "qm"--the build tool being "qmbuild"--so there shouldn't be any confusion between SCons and any indepent build tool that Software Carpentry may eventually produce. "Information about Software Carpentry is available at: http://software-carpentry.codesourcery.com/" -Scott From sstrollo@REDACTED Tue Sep 24 03:53:43 2002 From: sstrollo@REDACTED (Sebastian Strollo) Date: 23 Sep 2002 18:53:43 -0700 Subject: dirty mnesia function In-Reply-To: <3D8F9DDF.7050404@erlang-consulting.com> References: <9777764CE9E3D311A97600508B63B91603E73302@eamsant700.cec.ericsson.se> <3D8F9DDF.7050404@erlang-consulting.com> Message-ID: Francesco Cesarini writes: > Try binding your result to a variable and print it out. For example > > > RecordList = mnesia:dirty_match_object(piuTable, > {piuTable,'_','_','_','_','_','_','_','_','_','_','_','_','_'}). > > io:format("~p~n",[RecordList]). I think ~p is actually what is doing the "pretty printing" including adding |... when the data is too deep (see io_lib:print). If you want to print a term completely use ~w. Cheers, /Sebastian From Chandrashekhar.Mullaparthi@REDACTED Tue Sep 24 09:13:59 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Tue, 24 Sep 2002 08:13:59 +0100 Subject: dirty mnesia function Message-ID: <04D356A3B172D611981B0008C791C312404B78@imp02mbx.t-mobile.co.uk> ~w doesn't print strings as strings. It prints them as a list of integers. io:format("~100.p~n", [RecordList]). works well. Chandru -----Original Message----- From: Sebastian Strollo [mailto:sstrollo@REDACTED] Francesco Cesarini writes: > Try binding your result to a variable and print it out. For example > > > RecordList = mnesia:dirty_match_object(piuTable, > {piuTable,'_','_','_','_','_','_','_','_','_','_','_','_','_'}). > > io:format("~p~n",[RecordList]). I think ~p is actually what is doing the "pretty printing" including adding |... when the data is too deep (see io_lib:print). If you want to print a term completely use ~w. Cheers, /Sebastian NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From etxuwig@REDACTED Tue Sep 24 09:53:14 2002 From: etxuwig@REDACTED (Ulf Wiger) Date: Tue, 24 Sep 2002 09:53:14 +0200 (MET DST) Subject: dirty mnesia function In-Reply-To: Message-ID: On 23 Sep 2002, Sebastian Strollo wrote: >I think ~p is actually what is doing the "pretty printing" >including adding |... when the data is too deep (see >io_lib:print). If you want to print a term completely use >~w. For reasons that I have not had the energy to investigate, calling io:format("~p~n", [X]) from the shell does _not_ lead to truncated output (at least not for me.) ...after a quick look in the shell.erl source: The parameter that causes the truncated output is ~P. Note that it takes two arguments: io:format("~P~n", [X,LineMax]) (It's even documented in http://www.erlang.org/doc/r8b/lib/stdlib-1.10.1.1/doc/html/io.html#fwrite%3) Eshell V5.0.2.15 (abort with ^G) 1> T = erlang:make_tuple(10,foo). {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo} 2> L = lists:duplicate(20,T). [{foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo|...}] 3> io:format("~p~n", [L]). [{foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}] ok 4> io:format("~P~n", [L,30]). [{foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo,foo}, {foo,foo,foo,foo,foo,foo,foo,foo,foo|...}] ok -- Ulf Wiger, Senior Specialist, / / / Architecture & Design of Carrier-Class Software / / / Strategic Product & System Management / / / Ericsson Telecom AB, ATM Multiservice Networks From francesco@REDACTED Tue Sep 24 10:28:46 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Tue, 24 Sep 2002 09:28:46 +0100 Subject: dirty mnesia function References: <9777764CE9E3D311A97600508B63B91603E73302@eamsant700.cec.ericsson.se> <3D8F9DDF.7050404@erlang-consulting.com> Message-ID: <3D90223E.9090502@erlang-consulting.com> > > >>> RecordList = mnesia:dirty_match_object(piuTable, >>{piuTable,'_','_','_','_','_','_','_','_','_','_','_','_','_'}). >> > io:format("~p~n",[RecordList]). >> > >I think ~p is actually what is doing the "pretty printing" including >adding |... when the data is too deep (see io_lib:print). If you want >to print a term completely use ~w. > I think it used to be that way, but changed a couple of releases ago.... Francesco -- http://www.erlang-consulting.com From Marc.Vanwoerkom@REDACTED Tue Sep 24 12:30:49 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Tue, 24 Sep 2002 12:30:49 +0200 (MEST) Subject: Make replacement for Erlang - suggestions? In-Reply-To: <200209240334.g8O3Y2p67879@snookles.snookles.com> (message from Scott Lystig Fritchie on Mon, 23 Sep 2002 22:34:02 -0500) Message-ID: <200209241030.g8OAUnr22732@bonsai.fernuni-hagen.de> > It's SCons. See http://scons.sourceforge.net/faq/current.html for the > full FAQ. > > "5.4. Is SCons the same as the ScCons design from the Software > Carpentry competition? > > > "Yes. Same design, same developer, same goals, essentially the same > tool. Ah.. thanks for the information. Marc From vances@REDACTED Tue Sep 24 12:33:23 2002 From: vances@REDACTED (Vance Shipley) Date: Tue, 24 Sep 2002 06:33:23 -0400 Subject: zero length segments! Message-ID: <20020924103323.GC16482@frogman.motivity.ca> Was I ever happily suprised when I found that this was a valid expression: <<0:8, 1:24, 0:0>> It results in: <<0,0,0,1>> The reason this is so good is that it I don't have to handle a special case when X=0: Flag = <<_:(31-X), Flag:1, _:(X)>> Of course I'm sure that that is why it works, I'm just very happy about it. :) -Vance From johan.blom@REDACTED Tue Sep 24 13:10:27 2002 From: johan.blom@REDACTED (Johan Blom) Date: 24 Sep 2002 13:10:27 +0200 Subject: xmerl-0.18 Message-ID: <1032865826.16783.9.camel@localhost.localdomain> Hi, new release of xmerl at http://sowap.sourceforge.net/ Changes since 0.17 includes: Improved simple-format (Richard C), ability to handle fun() in xmerl_xpath expressions (Ulf W), and lots of bugfixes! Regards Johan Blom Mobile Arts From vances@REDACTED Tue Sep 24 16:02:46 2002 From: vances@REDACTED (Vance Shipley) Date: Tue, 24 Sep 2002 10:02:46 -0400 Subject: zero length segments! In-Reply-To: <20020924103323.GC16482@frogman.motivity.ca> References: <20020924103323.GC16482@frogman.motivity.ca> Message-ID: <20020924140246.GF16482@frogman.motivity.ca> Well didn't I speak too soon! While this works wonderfully in the shell it won't complile. :( Eshell V5.1.2 (abort with ^G) 1> T = fun(Bit) -> <<_:(31 - Bit), Flag:1, _:(Bit)>> = <<1:32>>, Flag end. #Fun 2> T(0). 1 3> T(1). 0 -module(t). -export([t/1]). t(Bit) when integer(Bit) -> <<_:(31 - Bit), Flag:1, _:(Bit)>> = <<1:32>>, Flag. 1> c(t). ./t.erl:5: illegal bit size error The problem seems to be with the expression (31 - Bit). Any idea how to get past this? -Vance Vance Shipley Motivity Telecom Inc. +1 519 579 5816 vances@REDACTED On Tue, Sep 24, 2002 at 06:33:23AM -0400, Vance Shipley wrote: > > Was I ever happily suprised when I found that this was a valid expression: > > <<0:8, 1:24, 0:0>> > > It results in: > > <<0,0,0,1>> > > The reason this is so good is that it I don't have to handle a special > case when X=0: > > Flag = <<_:(31-X), Flag:1, _:(X)>> > > Of course I'm sure that that is why it works, I'm just very happy about it. :) > > -Vance From Chandrashekhar.Mullaparthi@REDACTED Tue Sep 24 16:35:14 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Tue, 24 Sep 2002 15:35:14 +0100 Subject: zero length segments! Message-ID: <04D356A3B172D611981B0008C791C312404B8D@imp02mbx.t-mobile.co.uk> I've had the same problem. You have to do Var = 31 - Bit, <<_:Var, Flag:1, _:(Bit)>> = <<1:32>>, cheers Chandru -----Original Message----- From: Vance Shipley [mailto:vances@REDACTED] Sent: 24 September 2002 15:03 To: erlang-questions@REDACTED Subject: Re: zero length segments! Well didn't I speak too soon! While this works wonderfully in the shell it won't complile. :( Eshell V5.1.2 (abort with ^G) 1> T = fun(Bit) -> <<_:(31 - Bit), Flag:1, _:(Bit)>> = <<1:32>>, Flag end. #Fun 2> T(0). 1 3> T(1). 0 -module(t). -export([t/1]). t(Bit) when integer(Bit) -> <<_:(31 - Bit), Flag:1, _:(Bit)>> = <<1:32>>, Flag. 1> c(t). ./t.erl:5: illegal bit size error The problem seems to be with the expression (31 - Bit). Any idea how to get past this? -Vance Vance Shipley Motivity Telecom Inc. +1 519 579 5816 vances@REDACTED On Tue, Sep 24, 2002 at 06:33:23AM -0400, Vance Shipley wrote: > > Was I ever happily suprised when I found that this was a valid expression: > > <<0:8, 1:24, 0:0>> > > It results in: > > <<0,0,0,1>> > > The reason this is so good is that it I don't have to handle a special > case when X=0: > > Flag = <<_:(31-X), Flag:1, _:(X)>> > > Of course I'm sure that that is why it works, I'm just very happy about it. :) > > -Vance NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From happi@REDACTED Tue Sep 24 16:40:53 2002 From: happi@REDACTED (Happi) Date: Tue, 24 Sep 2002 16:40:53 +0200 Subject: zero length segments! References: <20020924103323.GC16482@frogman.motivity.ca> <20020924140246.GF16482@frogman.motivity.ca> Message-ID: <006001c263d8$63f0b3c0$c90b0a0a@LISA> The bitsize can not be an arbitrary expression, just bind the size before the match: t(Bit) when integer(Bit) -> S = (31 - Bit), <<_:S, Flag:1, _:(Bit)>> = <<1:32>>, Flag. ----- Original Message ----- From: "Vance Shipley" To: Sent: Tuesday, September 24, 2002 4:02 PM Subject: Re: zero length segments! > > Well didn't I speak too soon! While this works wonderfully in the shell > it won't complile. :( > > > Eshell V5.1.2 (abort with ^G) > 1> T = fun(Bit) -> <<_:(31 - Bit), Flag:1, _:(Bit)>> = <<1:32>>, Flag end. > #Fun > 2> T(0). > 1 > 3> T(1). > 0 > > -module(t). > -export([t/1]). > > t(Bit) when integer(Bit) -> > <<_:(31 - Bit), Flag:1, _:(Bit)>> = <<1:32>>, > Flag. > > 1> c(t). > ./t.erl:5: illegal bit size > error > > > The problem seems to be with the expression (31 - Bit). > > Any idea how to get past this? > > -Vance > > Vance Shipley > Motivity Telecom Inc. > +1 519 579 5816 > vances@REDACTED > > > On Tue, Sep 24, 2002 at 06:33:23AM -0400, Vance Shipley wrote: > > > > Was I ever happily suprised when I found that this was a valid expression: > > > > <<0:8, 1:24, 0:0>> > > > > It results in: > > > > <<0,0,0,1>> > > > > The reason this is so good is that it I don't have to handle a special > > case when X=0: > > > > Flag = <<_:(31-X), Flag:1, _:(X)>> > > > > Of course I'm sure that that is why it works, I'm just very happy about it. :) > > > > -Vance > From vances@REDACTED Tue Sep 24 16:21:32 2002 From: vances@REDACTED (Vance Shipley) Date: Tue, 24 Sep 2002 10:21:32 -0400 Subject: zero length segments! In-Reply-To: <04D356A3B172D611981B0008C791C312404B8D@imp02mbx.t-mobile.co.uk> References: <04D356A3B172D611981B0008C791C312404B8D@imp02mbx.t-mobile.co.uk> Message-ID: <20020924142132.GG16482@frogman.motivity.ca> Yes, that was pretty obvious wasn't it. I realized this right after asking. :) -Vance On Tue, Sep 24, 2002 at 03:35:14PM +0100, Chandrashekhar Mullaparthi wrote: > I've had the same problem. You have to do > > Var = 31 - Bit, > <<_:Var, Flag:1, _:(Bit)>> = <<1:32>>, > > cheers > Chandru From per@REDACTED Wed Sep 25 01:11:03 2002 From: per@REDACTED (Per Bergqvist) Date: Wed, 25 Sep 2002 00:11:03 +0100 Subject: =?iso-8859-1?q?erl=5Finterface?= patch R8B-2 Message-ID: <200209242211.g8OMB5830848@sork.levonline.com> Hi, attached is a patch to solve fix erl_compare when comparing tuples and lists containing numbers. To apply: cd $ERL_TOP patch -p1 < patch_file /Per ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED -------------- next part -------------- A non-text attachment was scrubbed... Name: R8B-2.patch01 Type: application/octet-stream Size: 1680 bytes Desc: not available URL: From tobbe@REDACTED Wed Sep 25 09:48:50 2002 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: 25 Sep 2002 09:48:50 +0200 Subject: OTP-R8B-2 does not compile on FreeBSD 4.6.2 Message-ID: At least not right out of the (tar-)box: ..... gcc -g -O2 -I/usr/local/share/winhome/otp_src_R8B-2/erts/i386-unknown-freebsd4.6.2 -g -O2 -I/usr/local/share/winhome/otp_src_R8B-2/erts/i386-unknown-freebsd4.6.2 -fPIC -Wall -O2 -DDEBUG_DIST -I. -DHAVE_CONFIG_H -DUSE_DNS -DEPMD_PORT=4369 -c erl_error.c -o /usr/local/share/winhome/otp_src_R8B-2/lib/erl_interface/obj/i386-unknown-freebsd4.6.2/erl_error.o erl_error.c:186: conflicting types for `strerror_r' /usr/include/string.h:88: previous declaration of `strerror_r' gmake[3]: *** [/usr/local/share/winhome/otp_src_R8B-2/lib/erl_interface/obj/i386-unknown-freebsd4.6.2/erl_error.o] Error 1 gmake[3]: Leaving directory `/usr/local/share/winhome/otp_src_R8B-2/lib/erl_interface/src' gmake[2]: *** [opt] Error 2 ..... BTW: How do I specify where my SSL inc/lib stuff are located ? (did Klacke's make-SSL patch go in ?) Cheers /Tobbe From bjorn@REDACTED Wed Sep 25 10:25:57 2002 From: bjorn@REDACTED (Bjorn Gustavsson) Date: 25 Sep 2002 10:25:57 +0200 Subject: zero length segments! In-Reply-To: "Happi"'s message of "Tue, 24 Sep 2002 16:40:53 +0200" References: <20020924103323.GC16482@frogman.motivity.ca> <20020924140246.GF16482@frogman.motivity.ca> <006001c263d8$63f0b3c0$c90b0a0a@LISA> Message-ID: It is an old bug that the shell allows some bit syntax expressions that the compiler doesn't allow. In the upcoming R9 release, the shell evalulator has been corrected. /Bjorn "Happi" writes: > The bitsize can not be an arbitrary expression, just bind the size before > the match: > > t(Bit) when integer(Bit) -> > S = (31 - Bit), > <<_:S, Flag:1, _:(Bit)>> = <<1:32>>, > Flag. > > ----- Original Message ----- > From: "Vance Shipley" > To: > Sent: Tuesday, September 24, 2002 4:02 PM > Subject: Re: zero length segments! > > > > > > Well didn't I speak too soon! While this works wonderfully in the shell > > it won't complile. :( > > > > > > Eshell V5.1.2 (abort with ^G) > > 1> T = fun(Bit) -> <<_:(31 - Bit), Flag:1, _:(Bit)>> = <<1:32>>, Flag end. > > #Fun > > 2> T(0). > > 1 > > 3> T(1). > > 0 > > > > -module(t). > > -export([t/1]). > > > > t(Bit) when integer(Bit) -> > > <<_:(31 - Bit), Flag:1, _:(Bit)>> = <<1:32>>, > > Flag. > > > > 1> c(t). > > ./t.erl:5: illegal bit size > > error > > > > > > The problem seems to be with the expression (31 - Bit). > > > > Any idea how to get past this? > > > > -Vance -- Bj?rn Gustavsson Ericsson Utvecklings AB bjorn@REDACTED ?T2/UAB/F/P BOX 1505 +46 8 727 56 87 125 25 ?lvsj? From kent@REDACTED Wed Sep 25 11:45:02 2002 From: kent@REDACTED (Kent Boortz) Date: 25 Sep 2002 11:45:02 +0200 Subject: OTP-R8B-2 does not compile on FreeBSD 4.6.2 In-Reply-To: References: Message-ID: Torbjorn Tornkvist writes: > BTW: How do I specify where my SSL inc/lib stuff are located ? > (did Klacke's make-SSL patch go in ?) % ./configure --help should give that information. If not this is the relevant section from the configure script dnl Check flags --with-ssl, --without-ssl --with-ssl=PATH. dnl If no option is given or --with-ssl is set without a path then we dnl search for SSL libraries and header files in the standard locations. dnl If set to --without-ssl we disable the use of SSL dnl If set to --with-ssl=PATH we use that path as the prefix, i.e. we dnl use "PATH/include" and "PATH/lib". . . AC_ARG_WITH(ssl, [ --with-ssl=PATH specify location of openSSL/ssleay include and lib --with-ssl use SSL (default) --without-ssl don't use SSL]) kent From erlang@REDACTED Wed Sep 25 09:09:43 2002 From: erlang@REDACTED (Peter-Henry Mander) Date: Wed, 25 Sep 2002 08:09:43 +0100 Subject: Coverage analysis Message-ID: <3D916137.5010907@manderp.freeserve.co.uk> Hi everyone, Do you know of code analysis tools for Erlang? I had heard of a research project aimed at proving program correctness, but I don't remember where to find it. What I'm looking for primarily is something that will simply do static and dynamic code coverage, telling me if there's untested code, or "dead wood" in a program. Is such a thing available under a GNU or BSD licence? Pete. From hakan.stenholm@REDACTED Wed Sep 25 15:46:35 2002 From: hakan.stenholm@REDACTED (=?ISO-8859-1?Q?H=E5kan_Stenholm?=) Date: Wed, 25 Sep 2002 15:46:35 +0200 Subject: Coverage analysis Message-ID: <34FBC5AE-D08D-11D6-A170-000393B8AB26@mbox304.swipnet.se> There's the OTP module "cover", which at least allows basic dynamic code coverage testing. "xref" (OTP module) might be useful for static code coverage testing. From tobbe@REDACTED Wed Sep 25 16:38:03 2002 From: tobbe@REDACTED (Torbjorn Tornkvist) Date: 25 Sep 2002 16:38:03 +0200 Subject: OTP-R8B-2 does not compile on FreeBSD 4.6.2 In-Reply-To: References: Message-ID: > > BTW: How do I specify where my SSL inc/lib stuff are located ? > > % ./configure --help > > should give that information. Well, it didn't. I got around the compile problem by doing: make CFLAGS=-DHAVE_STRERROR_R Cheers /Tobbe From jamesh@REDACTED Wed Sep 25 19:31:02 2002 From: jamesh@REDACTED (James Hague) Date: Wed, 25 Sep 2002 12:31:02 -0500 Subject: Bit syntax frustrations, again Message-ID: I've been writing an Erlang module to decode swf (Flash) files. The swf format is documented at http://www.openswf.org. The problem I've been having is that Erlang starts decoding bits with the most significant bit, whereas the swf format--which is very bit-oriented--starts with the least significant bit. As best I can tell, the "little" qualifier in Erlang's bit syntax refers to bytes in multi-byte values, not bits. To give an example, suppose the next byte in the input stream contains 16#fe, and I need to grab a 3-bit field followed by a 5-bit field. The obvious match of: <> = Binary results in: Field1 = 2#111 Field2 = 2#11110 In the swf format, though, the correct answer is: Field1 = 2#110 Field2 = 2#11111 In this simple case there's an easy enough fix, but not for the general case when bit fields cross byte boundaries. I don't see a nice fix in that case. I'm guessing I'll have to put aside the bit syntax for most of it and do bit manipulations directly. Bleah. Any thoughts we could appreciated. From Marc.Vanwoerkom@REDACTED Thu Sep 26 14:15:40 2002 From: Marc.Vanwoerkom@REDACTED (Marc Ernst Eddy van Woerkom) Date: Thu, 26 Sep 2002 14:15:40 +0200 (MEST) Subject: OTP-R8B-2 does not compile on FreeBSD 4.6.2 In-Reply-To: (message from Torbjorn Tornkvist on 25 Sep 2002 09:48:50 +0200) Message-ID: <200209261215.g8QCFeG26283@bonsai.fernuni-hagen.de> Hi, > At least not right out of the (tar-)box: I would be interested in updating the existing FreeBSD port as well. A mail to the freebsd-ports mailing list to find out who is maintaining the Erlang ports gave no result. Thus I don't know if someone works on the port or not. If not, I would try it. > (did Klacke's make-SSL patch go in ?) What kind of patch is this? Regards, Marc From taavi@REDACTED Thu Sep 26 14:32:39 2002 From: taavi@REDACTED (Taavi Talvik) Date: Thu, 26 Sep 2002 15:32:39 +0300 (EEST) Subject: OTP-R8B-2 does not compile on FreeBSD 4.6.2 In-Reply-To: <200209261215.g8QCFeG26283@bonsai.fernuni-hagen.de> Message-ID: <20020926152753.N94635-100000@valu.uninet.ee> On Thu, 26 Sep 2002, Marc Ernst Eddy van Woerkom wrote: > Hi, > > > At least not right out of the (tar-)box: > > I would be interested in updating the existing FreeBSD port as > well. > A mail to the freebsd-ports mailing list to find out who is > maintaining the Erlang ports gave no result. > Thus I don't know if someone works on the port or not. > If not, I would try it. >From /usr/ports/lang/erlang/Makefile MAINTAINER= olgeni@REDACTED best regards, taavi From luke@REDACTED Thu Sep 26 15:00:30 2002 From: luke@REDACTED (Luke Gorrie) Date: 26 Sep 2002 15:00:30 +0200 Subject: foo::bar(...) Message-ID: Hi all, I suggest that Erlang be extended to allow calling unexported functions. This could be restricted to the shell to avoid any software-engineering objections. The syntax could be "::", like: foo::bar(1) This would let you use the shell to test logically module-internal functions without having to toggle "-compile(export_all)" all the time. Sensible people get annoyed when I checkin export_all's to CVS, and I get annoyed when I need to toggle it on/off between checkins while actively hacking/testing modules. This seems like a nice balance? The idea is borrowed from Common Lisp. Cheers, Luke From happi@REDACTED Thu Sep 26 15:22:29 2002 From: happi@REDACTED (Erik.Stenman) Date: Thu, 26 Sep 2002 15:22:29 +0200 Subject: foo::bar(...) References: Message-ID: <0aa601c2655f$c4971790$980cee82@it.uu.se> It looks like a nice feature but I object to letting anyone call exported functions. (If the shell was rewritten to interpret erlang source code then it could be permissible to allow calls to unexported functions, but not to functions in a beam file.) The reason is that it would make some compiler optimizations impossible. As it is today, inlining might remove a non-exported function completely, and in the future the calling convention for non-exported functions might be changed so that functions returning tuples instead returns multiple values. Also the token :: is "reserved by HiPE" for parametrisized modules ;) If putting the export_all option in the file is to cumbersome for you why don't you just supply it as an argument to the compiler: c(foo,[export_all]) ? /Erik -------------------------------------- I'm Happi, you should be happy. Praeterea censeo "0xCA" scribere Erlang posse. ----- Original Message ----- From: "Luke Gorrie" To: Sent: Thursday, September 26, 2002 3:00 PM Subject: foo::bar(...) > Hi all, > > I suggest that Erlang be extended to allow calling unexported > functions. This could be restricted to the shell to avoid any > software-engineering objections. The syntax could be "::", like: > > foo::bar(1) > > This would let you use the shell to test logically module-internal > functions without having to toggle "-compile(export_all)" all the > time. Sensible people get annoyed when I checkin export_all's to CVS, > and I get annoyed when I need to toggle it on/off between checkins > while actively hacking/testing modules. This seems like a nice > balance? > > The idea is borrowed from Common Lisp. > > Cheers, > Luke > > From Chandrashekhar.Mullaparthi@REDACTED Thu Sep 26 15:28:49 2002 From: Chandrashekhar.Mullaparthi@REDACTED (Chandrashekhar Mullaparthi) Date: Thu, 26 Sep 2002 14:28:49 +0100 Subject: :bar(...) Message-ID: <04D356A3B172D611981B0008C791C312404BA7@imp02mbx.t-mobile.co.uk> Lovely idea. Can we have it for R9 :) Chandru -----Original Message----- From: Luke Gorrie [mailto:luke@REDACTED] Sent: 26 September 2002 14:01 To: erlang-questions@REDACTED Subject: foo::bar(...) Hi all, I suggest that Erlang be extended to allow calling unexported functions. This could be restricted to the shell to avoid any software-engineering objections. The syntax could be "::", like: foo::bar(1) NOTICE AND DISCLAIMER: This email (including attachments) is confidential. If you have received this email in error please notify the sender immediately and delete this email from your system without copying or disseminating it or placing any reliance upon its contents. We cannot accept liability for any breaches of confidence arising through use of email. Any opinions expressed in this email (including attachments) are those of the author and do not necessarily reflect our opinions. We will not accept responsibility for any commitments made by our employees outside the scope of our business. We do not warrant the accuracy or completeness of such information. From ingela@REDACTED Thu Sep 26 15:47:57 2002 From: ingela@REDACTED (Ingela Anderton) Date: Thu, 26 Sep 2002 15:47:57 +0200 (MEST) Subject: :bar(...) References: <04D356A3B172D611981B0008C791C312404BA7@imp02mbx.t-mobile.co.uk> Message-ID: <200209261347.PAA25239@gildor.du.uab.ericsson.se> Chandrashekhar Mullaparthi wrote: > Lovely idea. Can we have it for R9 :) We will not be implementing anything new and unthought of for R9, however lovely it might be. (Also I am not sure I think this suggestion would be lovely.) Actually the implementing phase of R9 is over now, we are integrating, fixing bugs and other wrapping it up activities... > Chandru > > -----Original Message----- > From: Luke Gorrie [mailto:luke@REDACTED] > Sent: 26 September 2002 14:01 > To: erlang-questions@REDACTED > Subject: foo::bar(...) > > > Hi all, > > I suggest that Erlang be extended to allow calling unexported > functions. This could be restricted to the shell to avoid any > software-engineering objections. The syntax could be "::", like: > > foo::bar(1) > > > > NOTICE AND DISCLAIMER: > This email (including attachments) is confidential. If you have received > this email in error please notify the sender immediately and delete this > email from your system without copying or disseminating it or placing any > reliance upon its contents. We cannot accept liability for any breaches of > confidence arising through use of email. Any opinions expressed in this > email (including attachments) are those of the author and do not necessarily > reflect our opinions. We will not accept responsibility for any commitments > made by our employees outside the scope of our business. We do not warrant > the accuracy or completeness of such information. -- /m.v.h Ingela Ericsson AB - OTP team From luke@REDACTED Thu Sep 26 15:46:38 2002 From: luke@REDACTED (Luke Gorrie) Date: 26 Sep 2002 15:46:38 +0200 Subject: foo::bar(...) In-Reply-To: <0aa601c2655f$c4971790$980cee82@it.uu.se> References: <0aa601c2655f$c4971790$980cee82@it.uu.se> Message-ID: "Erik.Stenman" writes: > It looks like a nice feature but I object to letting anyone call > exported functions. (If the shell was rewritten to interpret erlang > source code then it could be permissible to allow calls to > unexported functions, but not to functions in a beam file.) But people don't trust interpreters to run _exactly_ like the compiled code (witness recent shell vs. compiler bit syntax differences), so I don't think this would fly. > The reason is that it would make some compiler optimizations > impossible. As it is today, inlining might remove a non-exported > function completely, and in the future the calling convention for > non-exported functions might be changed so that functions returning > tuples instead returns multiple values. You could still inline and generate special versions, so long as you also generated a "fully general" one. Perhaps you could live with that as a compiler option, similar to debug_info? > Also the token :: is "reserved by HiPE" for parametrisized modules ;) How about "foo:-)bar(1)" then. :-) > If putting the export_all option in the file is to cumbersome for you why don't you just supply it as an argument to the compiler: > c(foo,[export_all]) > ? Well, an objection to export_all in general is that it affects how the program actually runs. In practice this means that when I'm doing export_all as a compiler switch locally, then I might check in code that doesn't work when other people compile it normally. I have exactly this problem when I go to checkin a file but see that I have an "export_all" in it - to remove it, I have to re-test the module. I'd much prefer to never use export_all and still be able to do interactive debugging from the shell. Cheers, Luke From francesco@REDACTED Thu Sep 26 16:39:18 2002 From: francesco@REDACTED (Francesco Cesarini) Date: Thu, 26 Sep 2002 15:39:18 +0100 Subject: OTP-R8B-2 does not compile on FreeBSD 4.6.2 References: <200209261215.g8QCFeG26283@bonsai.fernuni-hagen.de> Message-ID: <3D931C16.9040309@erlang-consulting.com> The contact details are online at http://www.freebsd.org/cgi/ports.cgi?query=Erlang&stype=all If you do a port, make sure to add the link @ http://dmoz.org/Computers/Programming/Languages/Erlang/Contributions/Ports_and_Compilers/ Regards, Francesco -- http://www.erlang-consulting.com Marc Ernst Eddy van Woerkom wrote: >Hi, > >> At least not right out of the (tar-)box: >> > >I would be interested in updating the existing FreeBSD port as >well. >A mail to the freebsd-ports mailing list to find out who is >maintaining the Erlang ports gave no result. >Thus I don't know if someone works on the port or not. >If not, I would try it. > > >> (did Klacke's make-SSL patch go in ?) >> > >What kind of patch is this? > >Regards, >Marc > > > > From matthias@REDACTED Thu Sep 26 16:59:00 2002 From: matthias@REDACTED (Matthias Lang) Date: Thu, 26 Sep 2002 16:59:00 +0200 Subject: how to run out of memory: let binaries leverage the heap Message-ID: <15763.8372.695898.556706@antilipe.corelatus.se> Hi, A problem that bites me a couple of times a year is this: some piece of code involving binaries causes the Erlang VM to expand its memory footprint enormously for no particularly good reason. The Erlang VM then dies because it can't allocate more ram. Here's how to do it: 1. Make the heap grow by doing something memory-intensive. Cross your fingers and hope that you get left with a half-full heap. 2. Do something tail-recursive which involves creating a lot binary garbage. 3. Watch the VM expand to many times the original heap size. The problem at the bottom of this is that the size of binaries created (or referenced) by a process has very little effect on when that process will be GCed next. Binaries can be large, the references to them are small. I've attached a little program which demonstrates this. On my machine (linux, x86), it'll happily eat 60M before a being GCed back down to 6M. On an embedded system with just 32M, this is a bit of a bummer. What's the solution? Specifying {fullsweep_after, 0} in the spawn option doesn't help much (as the attached example demonstrates). Forcing a GC immediately before a "binary-intensive" series of operations helps a lot. Any cleaner or better ideas? Does the (HIPE) unified heap put binaries on that heap? Matthias -------------- next part -------------- A non-text attachment was scrubbed... Name: eatmem.erl Type: application/octet-stream Size: 2012 bytes Desc: not available URL: From Laszlo.Varga@REDACTED Thu Sep 26 17:37:11 2002 From: Laszlo.Varga@REDACTED (Laszlo Varga) Date: Thu, 26 Sep 2002 17:37:11 +0200 (MEST) Subject: how to run out of memory: let binaries leverage the heap Message-ID: <200209261537.g8QFbBr22710@duna273.eth.ericsson.se> Hi, sorry for my stupidity, but I've been thought that tail recursion needs constant space (as it is a loop). Then why binary garbage? Laszlo mailto: ethvala@REDACTED > X-Original-Recipient: > MIME-Version: 1.0 > Content-Transfer-Encoding: 7bit > Date: Thu, 26 Sep 2002 16:59:00 +0200 > From: Matthias Lang > To: erlang-questions@REDACTED > Subject: how to run out of memory: let binaries leverage the heap > > Hi, > > A problem that bites me a couple of times a year is this: some piece > of code involving binaries causes the Erlang VM to expand its memory > footprint enormously for no particularly good reason. The Erlang VM > then dies because it can't allocate more ram. > > Here's how to do it: > > 1. Make the heap grow by doing something memory-intensive. Cross > your fingers and hope that you get left with a half-full heap. > > 2. Do something tail-recursive which involves creating a lot > binary garbage. > > 3. Watch the VM expand to many times the original heap size. > > The problem at the bottom of this is that the size of binaries created > (or referenced) by a process has very little effect on when that > process will be GCed next. Binaries can be large, the references to > them are small. > > I've attached a little program which demonstrates this. On my machine > (linux, x86), it'll happily eat 60M before a being GCed back down to > 6M. On an embedded system with just 32M, this is a bit of a bummer. > > What's the solution? Specifying {fullsweep_after, 0} in the spawn > option doesn't help much (as the attached example > demonstrates). Forcing a GC immediately before a "binary-intensive" > series of operations helps a lot. Any cleaner or better ideas? > > Does the (HIPE) unified heap put binaries on that heap? > > Matthias > From spearce@REDACTED Thu Sep 26 17:49:59 2002 From: spearce@REDACTED (Shawn Pearce) Date: Thu, 26 Sep 2002 11:49:59 -0400 Subject: how to run out of memory: let binaries leverage the heap In-Reply-To: <200209261537.g8QFbBr22710@duna273.eth.ericsson.se> References: <200209261537.g8QFbBr22710@duna273.eth.ericsson.se> Message-ID: <20020926154959.GA19554@spearce.org> The binary garbage is being created because the GC isn't kicking in to release it. Since the binaries are quite large, they fill memory very quickly. What Matthias is pointing out is a flaw in the Erlang GC where the size of the pointer to the binary is being considered for memory usage, and not the binary itself. So the tail recursion is creating small bits of garbage on each loop (a pointer to the binary), but lots of garbage (the binary) which isn't being accounted for. The tail recursion is however using constant space on the stack, like a loop. Its just the memory being created during each iteration that is the problem here. Laszlo Varga wrote: > Hi, > sorry for my stupidity, but I've been thought that > tail recursion needs constant space (as it is a loop). > > Then why binary garbage? > > Laszlo > > mailto: ethvala@REDACTED > > > X-Original-Recipient: > > MIME-Version: 1.0 > > Content-Transfer-Encoding: 7bit > > Date: Thu, 26 Sep 2002 16:59:00 +0200 > > From: Matthias Lang > > To: erlang-questions@REDACTED > > Subject: how to run out of memory: let binaries leverage the heap > > > > Hi, > > > > A problem that bites me a couple of times a year is this: some piece > > of code involving binaries causes the Erlang VM to expand its memory > > footprint enormously for no particularly good reason. The Erlang VM > > then dies because it can't allocate more ram. > > > > Here's how to do it: > > > > 1. Make the heap grow by doing something memory-intensive. Cross > > your fingers and hope that you get left with a half-full heap. > > > > 2. Do something tail-recursive which involves creating a lot > > binary garbage. > > > > 3. Watch the VM expand to many times the original heap size. > > > > The problem at the bottom of this is that the size of binaries created > > (or referenced) by a process has very little effect on when that > > process will be GCed next. Binaries can be large, the references to > > them are small. > > > > I've attached a little program which demonstrates this. On my machine > > (linux, x86), it'll happily eat 60M before a being GCed back down to > > 6M. On an embedded system with just 32M, this is a bit of a bummer. > > > > What's the solution? Specifying {fullsweep_after, 0} in the spawn > > option doesn't help much (as the attached example > > demonstrates). Forcing a GC immediately before a "binary-intensive" > > series of operations helps a lot. Any cleaner or better ideas? > > > > Does the (HIPE) unified heap put binaries on that heap? > > > > Matthias > > > -- Shawn. You work very hard. Don't try to think as well. From olgeni@REDACTED Thu Sep 26 18:24:10 2002 From: olgeni@REDACTED (Jimmy Olgeni) Date: Thu, 26 Sep 2002 18:24:10 +0200 (CEST) Subject: OTP-R8B-2 does not compile on FreeBSD 4.6.2 In-Reply-To: <200209261215.g8QCFeG26283@bonsai.fernuni-hagen.de> Message-ID: <20020926181653.U25906-100000@server.localdomain.net> On Thu, 26 Sep 2002, Marc Ernst Eddy van Woerkom wrote: > Thus I don't know if someone works on the port or not. > If not, I would try it. That would be me :), I tried to upgrade the port but I had some problem merging the port patches from the previous release (freebsd specific monitoring stuff + misc. build fixes), unfortunately I'm currently traveling around for work and I don't have time to look into it just right now. Any help would be welcome, I'm not very familiar with the OTP source code :o) -- jimmy From matthias@REDACTED Thu Sep 26 21:05:10 2002 From: matthias@REDACTED (Matthias Lang) Date: Thu, 26 Sep 2002 21:05:10 +0200 Subject: how to run out of memory: let binaries leverage the heap In-Reply-To: <200209261537.g8QFbBr22710@duna273.eth.ericsson.se> References: <200209261537.g8QFbBr22710@duna273.eth.ericsson.se> Message-ID: <15763.23142.765637.225794@antilipe.corelatus.se> Laszlo Varga writes: > Hi, > sorry for my stupidity, but I've been thought that > tail recursion needs constant space (as it is a loop). > Then why binary garbage? Tail recursion gets you a constant number of stack frames. Typically, it also gets you constant _stack_ space. The data in my function consists of binaries (which are allocated from a special pool) and references to the binaries (which are allocated from the heap). Matthias From matthias@REDACTED Thu Sep 26 22:39:53 2002 From: matthias@REDACTED (Matthias Lang) Date: Thu, 26 Sep 2002 22:39:53 +0200 Subject: Bit syntax frustrations, again In-Reply-To: References: Message-ID: <15763.28825.130937.439170@antilipe.corelatus.se> James Hague writes: > I've been writing an Erlang module to decode swf (Flash) files. The swf > format is documented at http://www.openswf.org. The problem I've been > having is that Erlang starts decoding bits with the most significant bit, > whereas the swf format--which is very bit-oriented--starts with the least > significant bit. As best I can tell, the "little" qualifier in Erlang's bit > syntax refers to bytes in multi-byte values, not bits. > > To give an example, suppose the next byte in the input stream contains > 16#fe, and I need to grab a 3-bit field followed by a 5-bit field. The > obvious match of: > > <> = Binary > > results in: > > Field1 = 2#111 > Field2 = 2#11110 > > In the swf format, though, the correct answer is: > > Field1 = 2#110 > Field2 = 2#11111 Nobody else has answered, maybe because they're as confused as I am about what the problem actually is. Options: 1. Shockwave _really_ does pack the bits the wrong way around, i.e. when you look at byte, what my CPU considers to be the LSB is actually the MSB. This just cannot be true. (*) or 2. Shockwave numbers the bits in a byte the opposite way to Erlang. This is quite common, for instance in Motorola manuals the MSB is bit 0, whereas infineon calls bit 0 the LSB. So if the documentation says Octet Bits Meaning ---------------------------------------------------------------------- 0 0,1 Filter mask 2,3,4,5,6 Packet counter 7 Reserved then you'd write it differently for Motorola and Infineon: <> = Infineon, <> = Motorola. But you seemed to say it wasn't that simple... or 3. Shockwave numbers the bits in a word in a topsy-turvy little-endian inspired way, e.g. if I got the following 16 bits (32 bits is the same idea, just more confusion): MSB LSB 0000 0001 1100 0000 then the shockwave format considers them to be numbered after the way a 16 bit word would be laid out in memory on a little endian machine, i.e. Byte Address Value 0 0xc0 1 0x01 Expressing the set bits in Motorola numbering, we have bits 7,8 and 9 set. In Infineon numbering we have 6,7 and 8. In Bizarro numbering it's 0, 14 and 15. If this is the case, then when the manual says Bits Meaning ------------------- 0-5 Annoyingness factor 6-8 Bullshit power 9-15 Convolution correction Then expressed in sane notation that means BBBA AAAA CCCC CCCB The only general way I can think of decoding that with the bit syntax is <> = Bin, <> = <>. All of the above could also be 32-bits at a time little endian. 4. None of the above options. I'll have to go out and take more drugs to twist my brain some more. Matthias (* Bits-in-a-byte the wrong way around can happen, but surely not in a file format. When you transmit SS7 traffic over a E1/T1 PCM line, you send the LSB first. When you send voice over the same line, you send the MSB first. Some hardware, such as ours, doesn't distinguish between voice and data at lower levels, so sometimes you get bit-reversed data up at the CPU. This is kinda annoying, but easily dealt with in hardware.) From jamesh@REDACTED Fri Sep 27 21:22:27 2002 From: jamesh@REDACTED (James Hague) Date: Fri, 27 Sep 2002 14:22:27 -0500 Subject: Bit syntax frustrations, again Message-ID: > Nobody else has answered, maybe because they're as confused as I am > about what the problem actually is. Heh. I think in this case I thought I could use the bit-syntax verbatim, but what I really needed to do was write a thin layer on top of swf bitstreams to handle decoding. Done. From madhan@REDACTED Mon Sep 30 04:21:36 2002 From: madhan@REDACTED (G. Madhan Dennis) Date: Mon, 30 Sep 2002 07:51:36 +0530 Subject: MEGACO Message-ID: Hi ! I'm using Erlang to write a MGC. However I need to write the MG in C++. Is anyone aware of any SDKs/Libraries available to write MGs in C++ ? If you are please let me know :-) Thanks !! - Madhan From jay@REDACTED Mon Sep 30 01:19:41 2002 From: jay@REDACTED (Jay Nelson) Date: Sun, 29 Sep 2002 16:19:41 -0700 Subject: Binary matching Message-ID: <4.2.2.20020929133346.00cfa990@duomark.com> I am trying to use port communications and do as much of the parsing / matching as possible on the binary data to keep the speed up. The problem is that I either don't understand it, have some missing syntax, or it just doesn't work as documented. My initial testing was to use a web browser to contact the active port, receive the GET request and split it into separate lines (breaking on cr / lf) and printing it out to see the result. This would be an easy way to see how to receive and parse binary data. Of course, the first thing I noticed was that I can only go from a binary to a list of ints or a list of ints to a binary. There is no documented way to print a binary as string which makes things a bit difficult to review. Ignoring that, I forged ahead with a little practice matching in the interpreter: Eshell V5.1.2 (abort with ^G) 1> Bin = <<"just a test">>. <<106,117,115,116,32,97,32,116,101,115,116>> 2> <> = Bin. ** exited: {{badmatch,<<106,117,115,116,32,97,32,116,101,115,116>>}, [{erl_eval,expr,3}]} ** 3> <> = Bin. <<106,117,115,116,32,97,32,116,101,115,116>> 4> b(). Bin = <<106,117,115,116,32,97,32,116,101,115,116>> Rest = <<32,97,32,116,101,115,116>> W1 = 1786082164 ok OK, I can stick a string in a binary but I can't split it in two by specifying a binary length and then getting the rest, but I can pull of a 32-bit int and get the rest as a binary. 5> <> = Bin. ** exited: {{badmatch,<<106,117,115,116,32,97,32,116,101,115,116>>}, [{erl_eval,expr,3}]} ** 6> <<106, 117,115, 116, 32, End/binary>> = Bin. <<106,117,115,116,32,97,32,116,101,115,116>> 7> b(). Bin = <<106,117,115,116,32,97,32,116,101,115,116>> End = <<97,32,116,101,115,116>> Rest = <<32,97,32,116,101,115,116>> W1 = 1786082164 10> os:version(). {4,10,67766222} 11> os:type(). {win32,windows} and so on... Various tests basically conclude that I can only match with the last term as a binary, and that the beginning must match exactly byte for byte or else I get badmatch. I cannot even specify an exact binary length for the leading segments, although I can specify a length and strip it off as a big integer (e.g., <> = Data). Do I have the wrong version or is this the intended functionality? (R8B2 on both Windows 98 and Red Hat 7.3 compiled from scratch both running Erlang 5.1.2). I read the documentation a little more closely as I was writing this and it didn't say that the sizes had to be bound, but if they are specified they must be bound. It implied that <> = EightBytes was allowed. I want to write: breakLines(Binary) -> lines(Binary, []). lines(<<>>, Acc) -> lists:reverse(Acc). lines(<>, Acc) -> lines(Rest, [Line | Acc]). Seems straightforward and not too difficult for the pattern-matcher, but then I'm no compiler writer. Instead I am left with converting to a list of ints and writing a few helper functions to loop over the list pulling out chars using two accumulators (one for the current line and one for the list of lines). Am I too worried about efficiency? Should I forget about binaries? Am I doing something wrong? Is it more efficient to make a pass across the binary looking for the location of all <<13, 10>> pairs, returning a list of the number of bytes between them and then doing binary matching now that I know how many bytes to specify on the initial patterns? I tried this and ended up with the same problem: -------------------------- cut here -------------------------- -module(bin_utils). -export([breakLines/1,extract/3,scan/6]). breakLines(Binary) -> StartStop = scan(Binary, <<13,10>>, 16, 0, 0, []), extract(Binary, StartStop, []). extract(<<>>, _Locs, Acc) -> lists:reverse(Acc); extract(Data, [Start, Stop | Rest], Acc) -> Len = Stop - Start, %%%%%%%%% Here is the problem %%%%%%%%%%%% %% It does little good to get Line as an int %% <> = Data, %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% extract(Back, Rest, [Line | Acc]). scan(<<>>, _Pattern, _Len, 0, 0, Acc) -> lists:reverse(Acc); scan(<<>>, _Pattern, _Len, Start, End, Acc) -> lists:reverse([End | [Start | Acc]]); scan(<>, Pattern, Len, Start, End, Acc) -> scan(Rest, Pattern, Len, End + Len, End + Len, [End | [Start | Acc]]); scan(Data, Pattern, Len, Start, End, Acc) -> <> = Data, scan(Rest, Pattern, Len, Start, End + 8, Acc). ---------------------- end cut ------------------------------ Does this avoid copying the binary (except for inside the function extract)? Is looping over the binary more efficient than looping over a list of integers? NOTE: There is a bug in my scan function because the following doesn't work: 136> CRLF = <<13, 10>>. <<13, 10>> 137> Test = <<67, 13, 10>>. <<67, 13, 10>> %%%%%%%%%%% This looks good! 138> bin_utils:scan(Test, CRLF, 16, 0, 0, []). [0, 8, 24, 24] 139> L1 = <<"how are you">>. <<104,111,119,32,97,114,101,32,121,111,117>> 140> L2 = <<"just fine.">>. <<106,117,115,116,32,102,105,110,101,46>> 141> L3 = <<"how about you?">>. <<104,111,119,32,97,98,111,117,116,32,121,111,117,63>> 142> L4 = <>. <<104,111,119,32,97,114,101,32,121,111,117,13,10,106,117,115,116,32,102,105, 110,101,46,13,10,104,111,119,32,...>> %%%%%%%%%% Ooops. 143> bin_utils:scan(L4, CRLF, 16, 0, 0, []). [0,312] I can't even figure out how to determine the length of the binary without converting it to a list. jay --------------------------------------------------- DuoMark International, Inc. 6523 Colgate Avenue, Suite 325 Los Angeles, CA 90048-4410 / USA Voice: +1 323 381-0001 FAX: +1 323 549 0172 Email: jay@REDACTED WWW: http://www.duomark.com/ From matthias@REDACTED Mon Sep 30 08:55:01 2002 From: matthias@REDACTED (Matthias Lang) Date: Mon, 30 Sep 2002 08:55:01 +0200 Subject: Binary matching In-Reply-To: <4.2.2.20020929133346.00cfa990@duomark.com> References: <4.2.2.20020929133346.00cfa990@duomark.com> Message-ID: <15767.62789.549830.976625@antilipe.corelatus.se> Jay Nelson writes: > There is no documented way to print a binary as string > which makes things a bit difficult to review. A string _is_ a list in Erlang. So binary_to_list will get you a "string" if the binary concerned is a string. > Eshell V5.1.2 (abort with ^G) > 1> Bin = <<"just a test">>. > <<106,117,115,116,32,97,32,116,101,115,116>> > 2> <> = Bin. > ** exited: {{badmatch,<<106,117,115,116,32,97,32,116,101,115,116>>}, > [{erl_eval,expr,3}]} ** > OK, I can stick a string in a binary but I can't split it in two > by specifying a binary length and then getting the rest, The width of 'binary' types in a binary match is measured in bytes, not bits, you're getting the badmatch above because the binary you're matching isn't 32 bytes long: 1> Bin = <<"just a test">>. <<106,117,115,116,32,97,32,116,101,115,116>> 2> <> = Bin. <<106,117,115,116,32,97,32,116,101,115,116>> 3> W1. <<106,117,115,116>> > I want to write: > > breakLines(Binary) -> lines(Binary, []). > lines(<<>>, Acc) -> lists:reverse(Acc). > lines(<>, Acc) -> > lines(Rest, [Line | Acc]). > Seems straightforward and not too difficult for the pattern-matcher, > but then I'm no compiler writer. The binary syntax was a fairly radical change when introduced and the implementation was deliberately conservative, leaving out some of the features which were discussed earlier, such as your example. The best way to split socket input into lines is to let the driver do it by specifing {packet, line} in the socket options. > Am I too worried about efficiency? Probably. Converting all string-related code to binary manipulations probably won't make your code go faster. Judicious use of binaries probably will. > Should I forget about binaries? No. Binaries are fantastically useful for encoding and decoding bit-oriented protocols and files. They can provide nice speedups in many situations, especially when IO is involved. > I can't even figure out how to determine the length of > the binary without converting it to a list. size(Binary) Matthias From per@REDACTED Mon Sep 30 10:01:25 2002 From: per@REDACTED (Per Bergqvist) Date: Mon, 30 Sep 2002 09:01:25 +0100 Subject: Binary matching In-Reply-To: <4.2.2.20020929133346.00cfa990@duomark.com> Message-ID: <200209300701.g8U71R906979@vargen.levonline.com> Hi Jay, you should specify the size of the binary in units not in bits. For a binary the unit size is 8 bits. I.e. use: <> = Bin. /Per > I am trying to use port communications and do as much > of the parsing / matching as possible on the binary data > to keep the speed up. The problem is that I either don't > understand it, have some missing syntax, or it just doesn't > work as documented. > > My initial testing was to use a web browser to contact the > active port, receive the GET request and split it into separate > lines (breaking on cr / lf) and printing it out to see the result. > This would be an easy way to see how to receive and parse > binary data. > > Of course, the first thing I noticed was that I can only go > from a binary to a list of ints or a list of ints to a binary. > There is no documented way to print a binary as string > which makes things a bit difficult to review. > > Ignoring that, I forged ahead with a little practice matching > in the interpreter: > > Eshell V5.1.2 (abort with ^G) > 1> Bin = <<"just a test">>. > <<106,117,115,116,32,97,32,116,101,115,116>> > 2> <> = Bin. > ** exited: {{badmatch,<<106,117,115,116,32,97,32,116,101,115,116>>}, > [{erl_eval,expr,3}]} ** > 3> <> = Bin. > <<106,117,115,116,32,97,32,116,101,115,116>> > 4> b(). > Bin = <<106,117,115,116,32,97,32,116,101,115,116>> > Rest = <<32,97,32,116,101,115,116>> > W1 = 1786082164 > ok > > OK, I can stick a string in a binary but I can't split it in two > by specifying a binary length and then getting the rest, but > I can pull of a 32-bit int and get the rest as a binary. > > 5> <> = Bin. > ** exited: {{badmatch,<<106,117,115,116,32,97,32,116,101,115,116>>}, > [{erl_eval,expr,3}]} ** > 6> <<106, 117,115, 116, 32, End/binary>> = Bin. > <<106,117,115,116,32,97,32,116,101,115,116>> > 7> b(). > Bin = <<106,117,115,116,32,97,32,116,101,115,116>> > End = <<97,32,116,101,115,116>> > Rest = <<32,97,32,116,101,115,116>> > W1 = 1786082164 > 10> os:version(). > {4,10,67766222} > 11> os:type(). > {win32,windows} > > and so on... Various tests basically conclude that I can only > match with the last term as a binary, and that the beginning must > match exactly byte for byte or else I get badmatch. I cannot even > specify an exact binary length for the leading segments, although > I can specify a length and strip it off as a big integer > (e.g., <> = Data). > > Do I have the wrong version or is this the intended functionality? > (R8B2 on both Windows 98 and Red Hat 7.3 compiled from scratch > both running Erlang 5.1.2). I read the documentation a little more > closely as I was writing this and it didn't say that the sizes had to > be bound, but if they are specified they must be bound. It implied > that <> = EightBytes was allowed. > > I want to write: > > breakLines(Binary) -> lines(Binary, []). > > lines(<<>>, Acc) -> lists:reverse(Acc). > lines(<>, Acc) -> > lines(Rest, [Line | Acc]). > > Seems straightforward and not too difficult for the pattern-matcher, > but then I'm no compiler writer. > > Instead I am left with converting to a list of ints and writing a few > helper functions to loop over the list pulling out chars using two > accumulators (one for the current line and one for the list of lines). > > Am I too worried about efficiency? Should I forget about binaries? > Am I doing something wrong? > > Is it more efficient to make a pass > across the binary looking for the location of all <<13, 10>> pairs, returning > a list of the number of bytes between them and then doing binary > matching now that I know how many bytes to specify on the initial > patterns? > > > > I tried this and ended up with the same problem: > -------------------------- cut here -------------------------- > > -module(bin_utils). > -export([breakLines/1,extract/3,scan/6]). > > breakLines(Binary) -> > StartStop = scan(Binary, <<13,10>>, 16, 0, 0, []), > extract(Binary, StartStop, []). > > extract(<<>>, _Locs, Acc) -> lists:reverse(Acc); > extract(Data, [Start, Stop | Rest], Acc) -> > Len = Stop - Start, > %%%%%%%%% Here is the problem %%%%%%%%%%%% > %% It does little good to get Line as an int %% > <> = Data, > %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% > extract(Back, Rest, [Line | Acc]). > > scan(<<>>, _Pattern, _Len, 0, 0, Acc) -> lists:reverse(Acc); > scan(<<>>, _Pattern, _Len, Start, End, Acc) -> lists:reverse([End | [Start > | Acc]]); > scan(<>, Pattern, Len, Start, End, Acc) -> > scan(Rest, Pattern, Len, End + Len, End + Len, [End | [Start | Acc]]); > scan(Data, Pattern, Len, Start, End, Acc) -> > <> = Data, > scan(Rest, Pattern, Len, Start, End + 8, Acc). > > ---------------------- end cut ------------------------------ > > > Does this avoid copying the binary (except for inside the function > extract)? Is looping over the binary more efficient than looping over > a list of integers? > > NOTE: There is a bug in my scan function because the following > doesn't work: > > 136> CRLF = <<13, 10>>. > <<13, 10>> > > 137> Test = <<67, 13, 10>>. > <<67, 13, 10>> > > %%%%%%%%%%% This looks good! > 138> bin_utils:scan(Test, CRLF, 16, 0, 0, []). > [0, 8, 24, 24] > > 139> L1 = <<"how are you">>. > <<104,111,119,32,97,114,101,32,121,111,117>> > > 140> L2 = <<"just fine.">>. > <<106,117,115,116,32,102,105,110,101,46>> > > 141> L3 = <<"how about you?">>. > <<104,111,119,32,97,98,111,117,116,32,121,111,117,63>> > > 142> L4 = <>. > <<104,111,119,32,97,114,101,32,121,111,117,13,10,106,117,115,116,32,10 2,105, > 110,101,46,13,10,104,111,119,32,...>> > > %%%%%%%%%% Ooops. > 143> bin_utils:scan(L4, CRLF, 16, 0, 0, []). > [0,312] > > > > > I can't even figure out how to determine the length of > the binary without converting it to a list. > > jay > > > --------------------------------------------------- > DuoMark International, Inc. > 6523 Colgate Avenue, Suite 325 > Los Angeles, CA 90048-4410 / USA > Voice: +1 323 381-0001 > FAX: +1 323 549 0172 > Email: jay@REDACTED > WWW: http://www.duomark.com/ > ========================================================= Per Bergqvist Synapse Systems AB Phone: +46 709 686 685 Email: per@REDACTED From bjarne@REDACTED Mon Sep 30 09:40:05 2002 From: bjarne@REDACTED (Bjarne =?iso-8859-1?Q?D=E4cker?=) Date: Mon, 30 Sep 2002 09:40:05 +0200 Subject: ACM SIGPLAN Erlang Workshop - 3 rooms available at conference rates Message-ID: <3D97FFD5.F60BE5D5@erix.ericsson.se> Hello PLI2002 is the conference of which the Erlang workshop is a satellite event. Rgrds Bjarne http://pli2002.cs.brown.edu/ -------------- next part -------------- An embedded message was scrubbed... From: Jennifer Landefeld Subject: PLI 2002 accommodations update - 3 rooms available directly from Jennifer Landefeld at conference rate Date: Sun, 29 Sep 2002 10:16:22 -0400 Size: 3030 URL: From micael.karlberg@REDACTED Mon Sep 30 10:18:24 2002 From: micael.karlberg@REDACTED (Micael Karlberg) Date: 30 Sep 2002 08:18:24 GMT Subject: MEGACO References: Message-ID: Hi, C++ no, C yes. You can download the megaco_session app from http://www.erlang.org/project/megaco/ Regards, /BMK In article , G. Madhan Dennis wrote: > Hi ! > > I'm using Erlang to write a MGC. However I need to write the MG in C++. Is > anyone aware of any SDKs/Libraries available to write MGs in C++ ? If you > are please let me know :-) > > Thanks !! > > - Madhan > -- Micael Karlberg Mail: micael.karlberg@REDACTED Ericsson AB, ?lvsj? Sweden EAB/UHK/KD