郭雪松 | 9 Feb 04:17
Picon

module Search

Hi,
 
Is there any example about howto use the module Search?

Guo Xuesong
郭雪松 | 8 Feb 06:30
Picon

Warnings from Parser.LR.GrammarParser

Should I ignore these warnings?
 
Warning: repair: Repaired Shift-Reduce conflict on "RETURN"
Warning: repair: All conflicts removed!
Warning: repair: Repaired Reduce-Reduce conflict on "-"
Warning: repair: Repaired Reduce-Reduce conflict on "]"
Warning: repair: Repaired Reduce-Reduce conflict on ")"
Warning: repair: Repaired Reduce-Reduce conflict on ":"
Warning: repair: Repaired Reduce-Reduce conflict on "*"
Warning: repair: Repaired Reduce-Reduce conflict on "="
Warning: repair: Repaired Reduce-Reduce conflict on "!"
Warning: repair: Repaired Reduce-Reduce conflict on "token"
Warning: repair: All conflicts removed!
Warning: repair: Repaired Shift-Reduce-Reduce conflict on "-"
Warning: repair: Repaired Reduce-Reduce conflict on "]"
Warning: repair: Repaired Reduce-Reduce conflict on ")"
Warning: repair: Repaired Reduce-Reduce conflict on ":"
Warning: repair: Repaired Shift-Reduce-Reduce conflict on "*"
Warning: repair: Repaired Reduce-Reduce conflict on "="
Warning: repair: Repaired Reduce-Reduce conflict on "!"
Warning: repair: Repaired Reduce-Reduce conflict on "token"
Warning: repair: All conflicts removed!
Warning: repair: Repaired Shift-Reduce conflict on "="
Warning: repair: All conflicts removed!
Warning: repair: Repaired Shift-Reduce conflict on "-"
Warning: repair: Repaired Shift-Reduce conflict on "*"
Warning: repair: All conflicts removed!


Guo Xuesong
郭雪松 | 3 Feb 11:49
Picon

MinGW is good

Dynamic link under MinGW looks good, I even use dlfcn-win32 to make my old dlopen code run.
Why Pike must linked static under MinGW?
 
After I installed dlfcn-win32, I try to make pike again, Something such as ___Math.so is build out,
but ___Math.so has a ELF header, not MZ header, and Pike complain can't load it.
 
Maybe this is the problem.

Guo Xuesong
郭雪松 | 2 Feb 08:13
Picon

RE: Cannot compile pike 7.8 from git

I'm just trying.
 
After fix something I got a tpike.exe.
tpike.exe complain "build/mingw32_nt-5.1-1.0.17_0.48_3_2_-i686/master.pike:42: Error in constant definition." and stoped.
 
 
 
Guo Xuesong
 
> To: pike <at> roxen.com
> Subject: RE: Cannot compile pike 7.8 from git
> From: 6341 <at> lyskom.lysator.liu.se
> Date: Thu, 2 Feb 2012 07:05:01 +0000
>
> I might be wrong here, but the last time I tried to compile Pike using
> Mingw, it failed miserably. After patching the most obvious
> flaws/problems, it did compile but the resulting binary was useless
> and crashed while trying to execute the master.
>
> Have you (or anyone else for that matter) managed to compile Pike
> under Mingw in recent times?
>
郭雪松 | 29 Jan 18:21
Picon

Public.Standards.vCard broken by Pike-v7.9.5(from git)

[peterpan <at> brain vcard.d]$pike -M pike-modules/
Pike v7.9 release 5 running Hilfe v3.5 (Incremental Pike Frontend)
> object ob=Public.Standards.vCard.strict_parser();
pike-modules/Public.pmod/Standards.pmod/vCard.pmod/module.pmod:442:Can not clone program without parent context.
Compiler Error: 1: Index 'strict_parser' not present in module vCard.
Compiler Error: 1: Indexed module was: Public.Standards.vCard.
Compiler Error: 1: Attempt to call a non function value `() (function call).
Compiler Error: 1: Expected: function.
Compiler Error: 1: Got     : zero.

[peterpan <at> brain vcard.d]$head -n 442 pike-modules/Public.pmod/Standards.pmod/vCard.pmod/module.pmod|tail
        //!     <at> value "version"
        //!             A string or float containing the version of the vCard s pecification that should be used when rendering the vCard. Use either 2.1 or 3.0.
    //! <at> endstring
        //! The following properties have to be passed as strings and are used "as-is": "fn", "bday", "nickname", "label", "mailer", "tz", "geo",
        //! "title", "role", "agent", "org", "categories", "note", "prodid", "rev", "sort-string", "sound", "source", "url", "uid", "class", "key".
        //! Properties beginning with "x-" are also accepted. These are allowed by the vCard specification for extensions to the format.
        //! <at> seealso
        //!     Have a look at the vCard specification for information about how those different properties are defined.
    void add_prop(string key, mixed value) {
   &nb sp;            .ContentLine line = .ContentLine();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There must be something wrong with .ContentLine, I don't known the dot can be used this way. where is the document? Maybe it's a undocumented feature, and broken now?

Guo Xuesong
郭雪松 | 29 Jan 12:21
Picon

Cannot compile pike 7.8 from git

src/interpret_protos.h looks not correct, many \275 in it.

Guo Xuesong
郭雪松 | 27 Jan 07:10
Picon

pike complain "Unexpected end of file" when using #line in macro call

[root <at> brain brain4]$cat t.pike #define A(a) class T{a};
A(class aa{
#line 2
                int n;
                });
void main()
{
        T();
}
[root <at> brain brain4]$pike t.pike
t.pike:6:Missing '}'.
t.pike:6:Unexpected end of file.
t.pike:6:Missing '}'.
t.pike:6:Unexpected end of file.
Pike: Failed to compile script.


Guo Xuesong
Bill Welliver | 26 Jan 21:20
Gravatar

cast_to_program() and CompilationHandlers

At the conference in November, we had the following conversation (to quote 
mast's report):

"Bill talked about his attempts to separate resolver contexts, to be able 
to run different versions of an application in the same pike process. He 
would try to solve this with separate compilation handlers, similar to how 
the #pike compat system works."

Over the last few days, I've been playing with this idea a little bit 
more, and I think I can get at least part of the way to where I need with 
passing a CompatResolver object to compile() and friends.

One problem that I've noticed is that the compilation handler doesn't seem 
to concern itself with program loading (as opposed to loading from 
modules). Specifically, cast_to_program() consults the program path 
defined in the master and not the one that's used in the CompatResolver. 
Is that an oversight, or is that by design?

That is, shouldn't the following line:

  foreach(pike_program_path, string path)
       if(program ret=findprog(combine_path(path,pname),ext,handler,mkobj))
         return ret;

be something like:

  foreach(handler->pike_program_path||pike_program_path, string path)
       if(program ret=findprog(combine_path(path,pname),ext,handler,mkobj))
         return ret;

?

Secondly, I'm not sure if there's a way to completely override compile() 
and the like, as it seems as though the system prefers to use the 
originally defined efun even after I've added compile using add_constant. 
It does get used in the rare cases where my code calls compile() 
explicitly, but otherwise it seems as though that's not the case (and I've 
made sure that there aren't any cached copies of programs in the programs 
mapping in master().

Any thoughts?

Bill

Chris Angelico | 16 Jan 13:15
Picon

Re: Good code? Bad code? Horribly horribly ugly code?

2012/1/16 Per Hedbor () @ Pike (-) importmöte för mailinglistan
<6341 <at> lyskom.lysator.liu.se>:
> Well.  I would rewrite it using () instead of {}. :)
>
>> !catch(throw(ip!=gethostbyname("hostname.domain.com")[1][0]))

Hmm, wasn't aware of that. Learn something new every day!

> Also, if hostname.domain.com happens to have multiple IP:s the results
> could be somewhat random. :)
>
> Anyway, for clarity I would probably avoid that construction.

I run the nameserver in question, and that hostname is specifically a
way to reference that IP, so that's safe.

How would you go about this? Ideally without a splash of temporary
variables, and self-contained.

ChrisA

Chris Angelico | 16 Jan 12:50
Picon

Re: Good code? Bad code? Horribly horribly ugly code?

2012/1/16 Mirar @ Pike  importmöte för mailinglistan
<6341 <at> lyskom.lysator.liu.se>:
> My only problem is only that throws are generally rather expensive
> compared to an if. :)
>

Heh! It's called once only, in response to a user command, and only on
one particular parameter, so I'm not too concerned about cost. But
yes, that is definitely a consideration.

ChrisA

Chris Angelico | 16 Jan 09:12
Picon

Good code? Bad code? Horribly horribly ugly code?

I just wrote this into my MUD. It's beautifully elegant and
disgustingly ugly... at the same time.

else if (!catch
{throw(ip!=gethostbyname("hostname.domain.com")[1][0]);})
location="descriptive location";

This is in a long chain of "else if" checks on an IP address (most of
which are, for instance, prefix checks for "192.168"), and it looks up
the hostname to see if the IP matches it. In the event of DNS failure,
either gethostbyname will return 0, or it'll return something that
doesn't have the proper arrays to index - either of which will throw
an exception, causing the if to fail and the next else to be checked.
If the lookup succeeds and returns something different from the IP,
then the integer 1 will be thrown and the if will fail. If it does
match, though, the integer 0 will be thrown - which is perfectly legal
- and the "!catch {}" will be true, and the location will be set.

Would you, if you saw this code in a production environment, be scared
or delighted? I'm suspecting the former...

ChrisA


Gmane