Changeset 119

Show
Ignore:
Timestamp:
05/16/05 17:55:29 (4 years ago)
Author:
athomas
Message:

More work on object creation. Objects now consist of arbitrary combinations
of other objects and new objects.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • fwc/trunk/fwc

    r118 r119  
    158158                objects = resolver.get_objects(t) 
    159159                for o in sorted(objects, lambda a, b: cmp(a.name, b.name)): 
    160                         str = "%s ^B%s^B ^B^6%s^N" % (o.type, o.name, o.value
    161                         if o.description: str += " ^2'%s^N'" % o.description 
    162                         cprint(str
     160                        text = "%s ^B%s^B ^B^6%s^N" % (o.type, o.name, ' '.join(map(str, tolist(o.value)))
     161                        if o.description: text += " description ^2'%s'^N" % o.description 
     162                        cprint(text
    163163 
    164164def quit(context = None): 
     
    450450                                        HELP : { '<name>' : 'Name of object to create.' }, 
    451451                                        LABEL : 'create', 
    452                                         lambda ctx, token: resolver.have_object(ctx['type'], token) or re.match(Object.TYPE_PATTERNS[ctx['type']], token) : { 
     452                                        'description' : { 
     453                                                UNLESS_VAR : 'description', 
     454                                                ORDER : 10, 
     455                                                GROUP : 20, 
     456                                                '.+' : { 
     457                                                        VAR : 'description', 
     458                                                        HELP : { '<description>' : 'Description of object.' }, 
     459                                                        JUMP : 'create', 
     460                                                        ACTION : { 
     461                                                                IF_VAR : 'value', 
     462                                                                ACTION : create_object, 
     463                                                        }, 
     464                                                }, 
     465                                                HELP : 'Optional description of object.' 
     466                                        }, 
     467                                        lambda ctx, token: re.match(Object.TYPE_PATTERNS[ctx['type']], token) or token in help_object(ctx, ctx['type']) : { 
     468                                                ORDER : 20, 
     469                                                GROUP : 10, 
    453470                                                VAR : 'value', 
    454                                                 HELP : lambda ctx: help_object(ctx, ctx['type']), 
    455                                                 ACTION : { 
    456                                                         IF_VAR : 'value', 
    457                                                         ACTION : create_object, 
    458                                                 }, 
     471                                                HELP : lambda ctx: [(k, v) for k, v in help_network(ctx).iteritems() if 'value' in ctx and k not in tolist(ctx['value']) or 'value' not in ctx], 
    459472                                                JUMP : 'create', 
    460                                                 'description' : { 
    461                                                         '.+' : { 
    462                                                                 VAR : 'description', 
    463                                                                 HELP : { '<description>' : 'Description of object.' }, 
    464                                                                 JUMP : 'create', 
    465                                                         }, 
    466                                                         HELP : 'Optional description of object.' 
    467                                                 }, 
     473                                                ACTION : create_object, 
    468474                                        }, 
    469475                                },