--- deliantra/server/lib/cf.pm 2007/07/23 23:38:17 1.317 +++ deliantra/server/lib/cf.pm 2007/09/04 08:42:58 1.357 @@ -12,7 +12,7 @@ use Safe; use Safe::Hole; -use Coro 3.61 (); +use Coro 3.64 (); use Coro::State; use Coro::Handle; use Coro::Event; @@ -21,8 +21,9 @@ use Coro::Semaphore; use Coro::AIO; use Coro::Storable; +use Coro::Util (); -use JSON::XS 1.4 (); +use JSON::XS (); use BDB (); use Data::Dumper; use Digest::MD5; @@ -88,8 +89,8 @@ our $UPTIME; $UPTIME ||= time; our $RUNTIME; -our %PLAYER; # all users -our %MAP; # all maps +our (%PLAYER, %PLAYER_LOADING); # all users +our (%MAP, %MAP_LOADING ); # all maps our $LINK_MAP; # the special {link} map, which is always available # used to convert map paths into valid unix filenames by replacing / by ∕ @@ -273,6 +274,9 @@ for example when the coroutine gets canceled), the lock is automatically returned. +Locks are *not* recursive, locking from the same coro twice results in a +deadlocked coro. + Lock names should begin with a unique identifier (for example, cf::map::find uses map_find and cf::map::load uses map_load). @@ -474,57 +478,19 @@ =cut -sub _store_scalar { - open my $fh, ">", \my $buf - or die "fork_call: cannot open fh-to-buf in child : $!"; - Storable::store_fd $_[0], $fh; - close $fh; - - $buf -} - sub fork_call(&@) { my ($cb, @args) = @_; -# socketpair my $fh1, my $fh2, Socket::AF_UNIX, Socket::SOCK_STREAM, Socket::PF_UNSPEC -# or die "socketpair: $!"; - pipe my $fh1, my $fh2 - or die "pipe: $!"; - - if (my $pid = fork) { - close $fh2; + # we seemingly have to make a local copy of the whole thing, + # otherwise perl prematurely frees the stuff :/ + # TODO: investigate and fix (likely this will be rather laborious) - my $res = (Coro::Handle::unblock $fh1)->readline (undef); - warn "pst<$res>" unless $res =~ /^pst/; - $res = Coro::Storable::thaw $res; - - waitpid $pid, 0; # should not block anymore, we expect the child to simply behave - - Carp::confess $$res unless "ARRAY" eq ref $res; - - return wantarray ? @$res : $res->[-1]; - } else { + my @res = Coro::Util::fork_eval { reset_signals; - local $SIG{__WARN__}; - local $SIG{__DIE__}; - # just in case, this hack effectively disables event - # in the child. cleaner and slower would be canceling all watchers, - # but this works for the time being. - local $Coro::idle; - $Coro::current->prio (Coro::PRIO_MAX); - - eval { - close $fh1; - - my @res = eval { $cb->(@args) }; + &$cb + }, @args; - syswrite $fh2, _store_scalar $@ ? \"$@" : \@res; - close $fh2; - }; - - warn $@ if $@; - _exit 0; - } + wantarray ? @res : $res[-1] } =item $value = cf::db_get $family => $key @@ -614,7 +580,7 @@ join "\x00", $processversion, map { - Coro::cede; + cf::cede_to_tick; ($src->[$_], Digest::MD5::md5_hex $data[$_]) } 0.. $#$src; @@ -1041,6 +1007,8 @@ sub object_freezer_save { my ($filename, $rdata, $objs) = @_; + my $guard = cf::lock_acquire "io"; + sync_job { if (length $$rdata) { warn sprintf "saving %s (%d,%d)\n", @@ -1073,7 +1041,9 @@ aio_unlink $filename; aio_unlink "$filename.pst"; } - } + }; + + undef $guard; } sub object_freezer_as_string { @@ -1089,18 +1059,23 @@ my ($data, $av); + my $guard = cf::lock_acquire "io"; + (aio_load $filename, $data) >= 0 or return; unless (aio_stat "$filename.pst") { (aio_load "$filename.pst", $av) >= 0 or return; + + undef $guard; $av = eval { (Storable::thaw $av)->{objs} }; } warn sprintf "loading %s (%d)\n", $filename, length $data, scalar @{$av || []}; - return ($data, $av); + + ($data, $av) } =head2 COMMAND CALLBACKS @@ -1188,12 +1163,15 @@ ? @$msg : ($msg->{msgtype}, $msg->{msgid}, %$msg); # TODO: version 1, remove - if (my $cb = $EXTCMD{$type}) { - my @reply = $cb->($pl, @payload); + my @reply; - $pl->ext_reply ($reply, @reply) - if $reply; + if (my $cb = $EXTCMD{$type}) { + @reply = $cb->($pl, @payload); } + + $pl->ext_reply ($reply, @reply) + if $reply; + } else { warn "player " . ($pl->ob->name) . " sent unparseable ext message: <$buf>\n"; } @@ -1337,8 +1315,14 @@ aio_unlink +(playerdir $login) . "/$login.pl.pst"; aio_unlink +(playerdir $login) . "/$login.pl"; - my $pl = load_pl path $login + my $f = new_from_file cf::object::thawer path $login + or return; + + $f->next; + my $pl = cf::player::load_pl $f or return; + local $cf::PLAYER_LOADING{$login} = $pl; + $f->resolve_delayed_derefs; $cf::PLAYER{$login} = $pl } } @@ -1358,7 +1342,7 @@ $pl->{last_save} = $cf::RUNTIME; $pl->save_pl ($path); - Coro::cede; + cf::cede_to_tick; } sub new($) { @@ -1374,6 +1358,16 @@ $self } +=item $player->send_msg ($channel, $msg, $color, [extra...]) + +=cut + +sub send_msg { + my $ns = shift->ns + or return; + $ns->send_msg (@_); +} + =item $pl->quit_character Nukes the player without looking back. If logged in, the connection will @@ -1436,9 +1430,14 @@ my @logins; for my $login (@$dirs) { - my $fh = aio_open path $login, Fcntl::O_RDONLY, 0 or next; - aio_read $fh, 0, 512, my $buf, 0 or next; - $buf !~ /^password -------------$/m or next; # official not-valid tag + my $path = path $login; + + # a .pst is a dead give-away for a valid player + unless (-e "$path.pst") { + my $fh = aio_open $path, Fcntl::O_RDONLY, 0 or next; + aio_read $fh, 0, 512, my $buf, 0 or next; + $buf !~ /^password -------------$/m or next; # official not-valid tag + } utf8::decode $login; push @logins, $login; @@ -1486,7 +1485,7 @@ # escape & and < s/&/&/g; - s/(?]*)>/$1<\/b>/ || s/I<([^\>]*)>/$1<\/i>/ || s/U<([^\>]*)>/$1<\/u>/ + || s/T<([^\>]*)>/$1<\/b><\/big>/ # replace G tags || s{G<([^>|]*)\|([^>]*)>}{ $self->gender ? $2 : $1 @@ -1534,13 +1534,7 @@ sub ext_reply($$@) { my ($self, $id, @msg) = @_; - if ($self->ns->extcmd == 2) { - $self->send ("ext " . $self->ns->{json_coder}->encode (["reply-$id", @msg])); - } elsif ($self->ns->extcmd == 1) { - #TODO: version 1, remove - unshift @msg, msgtype => "reply", msgid => $id; - $self->send ("ext " . $self->ns->{json_coder}->encode ({@msg})); - } + $self->ns->ext_reply ($id, @msg) } =item $player->ext_msg ($type, @msg) @@ -1778,12 +1772,15 @@ my ($self, $path) = @_; utf8::encode $path; - #aio_open $path, O_RDONLY, 0 - # or return; + my $f = new_from_file cf::object::thawer $path + or return; - $self->_load_header ($path) + $self->_load_header ($f) or return; + local $MAP_LOADING{$self->{path}} = $self; + $f->resolve_delayed_derefs; + $self->{load_path} = $path; 1 @@ -1881,8 +1878,9 @@ my $path = $self->{path}; { - my $guard = cf::lock_acquire "map_load:$path"; + my $guard = cf::lock_acquire "map_data:$path"; + return unless $self->valid; return if $self->in_memory != cf::MAP_SWAPPED; $self->in_memory (cf::MAP_LOADING); @@ -1890,9 +1888,11 @@ $self->alloc; $self->pre_load; - Coro::cede; + cf::cede_to_tick; - $self->_load_objects ($self->{load_path}, 1) + my $f = new_from_file cf::object::thawer $self->{load_path}; + $f->skip_block; + $self->_load_objects ($f) or return; $self->set_object_flag (cf::FLAG_OBJ_ORIGINAL, 1) @@ -1900,29 +1900,37 @@ if (my $uniq = $self->uniq_path) { utf8::encode $uniq; - if (aio_open $uniq, O_RDONLY, 0) { - $self->clear_unique_items; - $self->_load_objects ($uniq, 0); + unless (aio_stat $uniq) { + if (my $f = new_from_file cf::object::thawer $uniq) { + $self->clear_unique_items; + $self->_load_objects ($f); + $f->resolve_delayed_derefs; + } } } - Coro::cede; + $f->resolve_delayed_derefs; + + cf::cede_to_tick; # now do the right thing for maps $self->link_multipart_objects; $self->difficulty ($self->estimate_difficulty) unless $self->difficulty; - Coro::cede; + cf::cede_to_tick; unless ($self->{deny_activate}) { $self->decay_objects; $self->fix_auto_apply; $self->update_buttons; - Coro::cede; + cf::cede_to_tick; $self->set_darkness_map; - Coro::cede; + cf::cede_to_tick; $self->activate; } + $self->{last_save} = $cf::RUNTIME; + $self->last_access ($cf::RUNTIME); + $self->in_memory (cf::MAP_IN_MEMORY); } @@ -1942,10 +1950,10 @@ } # find and load all maps in the 3x3 area around a map -sub load_diag { +sub load_neighbours { my ($map) = @_; - my @diag; # diagonal neighbours + my @neigh; # diagonal neighbours for (0 .. 3) { my $neigh = $map->tile_path ($_) @@ -1954,12 +1962,14 @@ or next; $neigh->load; - push @diag, [$neigh->tile_path (($_ + 3) % 4), $neigh], - [$neigh->tile_path (($_ + 1) % 4), $neigh]; + push @neigh, + [$neigh->tile_path (($_ + 3) % 4), $neigh], + [$neigh->tile_path (($_ + 1) % 4), $neigh]; } - for (@diag) { - my $neigh = find @$_ + for (grep defined $_->[0], @neigh) { + my ($path, $origin) = @$_; + my $neigh = find $path, $origin or next; $neigh->load; } @@ -1974,6 +1984,9 @@ sub do_load_sync { my ($map) = @_; + cf::LOG cf::llevDebug | cf::logBacktrace, "do_load_sync" + if $Coro::current == $Coro::main; + cf::sync_job { $map->load }; } @@ -1981,23 +1994,24 @@ our $MAP_PREFETCHER = undef; sub find_async { - my ($path, $origin) = @_; + my ($path, $origin, $load) = @_; $path = normalise $path, $origin && $origin->{path}; if (my $map = $cf::MAP{$path}) { - return $map if $map->in_memory == cf::MAP_IN_MEMORY; + return $map if !$load || $map->in_memory == cf::MAP_IN_MEMORY; } - undef $MAP_PREFETCH{$path}; + $MAP_PREFETCH{$path} |= $load; + $MAP_PREFETCHER ||= cf::async { while (%MAP_PREFETCH) { - for my $path (keys %MAP_PREFETCH) { - if (my $map = find $path) { - $map->load; + while (my ($k, $v) = each %MAP_PREFETCH) { + if (my $map = find $k) { + $map->load if $v; } - delete $MAP_PREFETCH{$path}; + delete $MAP_PREFETCH{$k}; } } undef $MAP_PREFETCHER; @@ -2010,7 +2024,7 @@ sub save { my ($self) = @_; - my $lock = cf::lock_acquire "map_data:" . $self->path; + my $lock = cf::lock_acquire "map_data:$self->{path}"; $self->{last_save} = $cf::RUNTIME; @@ -2043,7 +2057,7 @@ # save first because save cedes $self->save; - my $lock = cf::lock_acquire "map_data:" . $self->path; + my $lock = cf::lock_acquire "map_data:$self->{path}"; return if $self->players; return if $self->in_memory != cf::MAP_IN_MEMORY; @@ -2105,17 +2119,21 @@ sub nuke { my ($self) = @_; - delete $cf::MAP{$self->path}; + { + my $lock = cf::lock_acquire "map_data:$self->{path}"; - $self->unlink_save; + delete $cf::MAP{$self->path}; - bless $self, "cf::map"; - delete $self->{deny_reset}; - $self->{deny_save} = 1; - $self->reset_timeout (1); - $self->path ($self->{path} = "{nuke}/" . ($nuke_counter++)); + $self->unlink_save; + + bless $self, "cf::map"; + delete $self->{deny_reset}; + $self->{deny_save} = 1; + $self->reset_timeout (1); + $self->path ($self->{path} = "{nuke}/" . ($nuke_counter++)); - $cf::MAP{$self->path} = $self; + $cf::MAP{$self->path} = $self; + } $self->reset; # polite request, might not happen } @@ -2201,6 +2219,37 @@ inv_recursive_ inv $_[0] } +=item $ref = $ob->ref + +creates and returns a persistent reference to an objetc that can be stored as a string. + +=item $ob = cf::object::deref ($refstring) + +returns the objetc referenced by refstring. may return undef when it cnanot find the object, +even if the object actually exists. May block. + +=cut + +sub deref { + my ($ref) = @_; + + # temporary compatibility#TODO#remove + $ref =~ s{^<}{player/<}; + + if ($ref =~ m{^player\/(<1\.\d+>)/(.*)$}) { + my ($uuid, $name) = ($1, $2); + my $pl = $cf::PLAYER_LOADING{$name} || cf::player::find $name + or return; + $pl->ob->uuid eq $uuid + or return; + + $pl->ob + } else { + warn "$ref: cannot resolve object reference\n"; + undef + } +} + package cf; =back @@ -2242,6 +2291,16 @@ } } +=item $object->send_msg ($channel, $msg, $color, [extra...]) + +=cut + +sub cf::object::send_msg { + my $pl = shift->contr + or return; + $pl->send_msg (@_); +} + =item $player_object->may ("access") Returns wether the given player is authorized to access resource "access" @@ -2328,7 +2387,7 @@ if $x <=0 && $y <= 0; $map->load; - $map->load_diag; + $map->load_neighbours; return unless $self->contr->active; $self->activate_recursive; @@ -2509,18 +2568,37 @@ =cut +our %CHANNEL = ( + "c/identify" => { + id => "identify", + title => "Identify", + reply => undef, + tooltip => "Items recently identified", + }, + "c/examine" => { + id => "examine", + title => "Examine", + reply => undef, + tooltip => "Signs and other items you examined", + }, +); + sub cf::client::send_msg { my ($self, $channel, $msg, $color, @extra) = @_; $msg = $self->pl->expand_cfpod ($msg); - $color &= ~cf::NDI_UNIQUE; # just in case... + $color &= cf::NDI_CLIENT_MASK; # just in case... + + # check predefined channels, for the benefit of C + $channel = $CHANNEL{$channel} if $CHANNEL{$channel}; if (ref $channel) { # send meta info to client, if not yet sent unless (exists $self->{channel}{$channel->{id}}) { $self->{channel}{$channel->{id}} = $channel; - $self->ext_msg (channel_info => %$channel); + $self->ext_msg (channel_info => $channel) + if $self->can_msg; } $channel = $channel->{id}; @@ -2529,21 +2607,31 @@ return unless @extra || length $msg; if ($self->can_msg) { - $self->send_packet ("msg " . $self->{json_coder}->encode ([$color, $channel, $msg, @extra])); - } else { - # replace some tags by gcfclient-compatible ones - for ($msg) { - 1 while - s/([^<]*)<\/b>/[b]${1}[\/b]/ - || s/([^<]*)<\/i>/[i]${1}[\/i]/ - || s/([^<]*)<\/u>/[ul]${1}[\/ul]/ - || s/([^<]*)<\/tt>/[fixed]${1}[\/fixed]/ - || s/([^<]*)<\/fg>/[color=$1]${2}[\/color]/; - } + # default colour, mask it out + $color &= ~(cf::NDI_COLOR_MASK | cf::NDI_DEF) + if $color & cf::NDI_DEF; + $self->send_packet ("msg " . $self->{json_coder}->encode ( + [$color & cf::NDI_CLIENT_MASK, $channel, $msg, @extra])); + } else { if ($color >= 0) { + # replace some tags by gcfclient-compatible ones + for ($msg) { + 1 while + s/([^<]*)<\/b>/[b]${1}[\/b]/ + || s/([^<]*)<\/i>/[i]${1}[\/i]/ + || s/([^<]*)<\/u>/[ul]${1}[\/ul]/ + || s/([^<]*)<\/tt>/[fixed]${1}[\/fixed]/ + || s/([^<]*)<\/fg>/[color=$1]${2}[\/color]/; + } + + $color &= cf::NDI_COLOR_MASK; + + utf8::encode $msg; + if (0 && $msg =~ /\[/) { - $self->send_packet ("drawextinfo $color 4 0 $msg") + # COMMAND/INFO + $self->send_packet ("drawextinfo $color 10 8 $msg") } else { $msg =~ s/\[\/?(?:b|i|u|fixed|color)[^\]]*\]//g; $self->send_packet ("drawinfo $color $msg") @@ -2561,16 +2649,32 @@ sub cf::client::ext_msg($$@) { my ($self, $type, @msg) = @_; - my $extcmd = $self->extcmd; - - if ($extcmd == 2) { + if ($self->extcmd == 2) { $self->send_packet ("ext " . $self->{json_coder}->encode ([$type, @msg])); - } elsif ($extcmd == 1) { # TODO: remove + } elsif ($self->extcmd == 1) { # TODO: remove push @msg, msgtype => "event_$type"; $self->send_packet ("ext " . $self->{json_coder}->encode ({@msg})); } } +=item $client->ext_reply ($msgid, @msg) + +Sends an ext reply to the client. + +=cut + +sub cf::client::ext_reply($$@) { + my ($self, $id, @msg) = @_; + + if ($self->extcmd == 2) { + $self->send_packet ("ext " . $self->{json_coder}->encode (["reply-$id", @msg])); + } elsif ($self->extcmd == 1) { + #TODO: version 1, remove + unshift @msg, msgtype => "reply", msgid => $id; + $self->send_packet ("ext " . $self->{json_coder}->encode ({@msg})); + } +} + =item $success = $client->query ($flags, "text", \&cb) Queues a query to the client, calling the given callback with @@ -2638,12 +2742,15 @@ ? @$msg : ($msg->{msgtype}, $msg->{msgid}, %$msg); # TODO: version 1, remove - if (my $cb = $EXTICMD{$type}) { - my @reply = $cb->($ns, @payload); + my @reply; - $ns->ext_reply ($reply, @reply) - if $reply; + if (my $cb = $EXTICMD{$type}) { + @reply = $cb->($ns, @payload); } + + $ns->ext_reply ($reply, @reply) + if $reply; + } else { warn "client " . ($ns->pl ? $ns->pl->ob->name : $ns->host) . " sent unparseable exti message: <$buf>\n"; } @@ -2700,7 +2807,11 @@ $SIG{FPE} = 'IGNORE'; -$safe->permit_only (Opcode::opset qw(:base_core :base_mem :base_orig :base_math sort time)); +$safe->permit_only (Opcode::opset qw( + :base_core :base_mem :base_orig :base_math + grepstart grepwhile mapstart mapwhile + sort time +)); # here we export the classes and methods available to script code @@ -2710,7 +2821,7 @@ cf::object contr pay_amount pay_player map x y force_find force_add - insert remove + insert remove name archname title slaying race decrease_ob_nr cf::object::player player @@ -2725,7 +2836,8 @@ for ( ["cf::object" => qw(contr pay_amount pay_player map force_find force_add x y - insert remove)], + insert remove inv name archname title slaying race + decrease_ob_nr)], ["cf::object::player" => qw(player)], ["cf::player" => qw(peaceful)], ["cf::map" => qw(trigger)], @@ -2811,6 +2923,12 @@ sub load_facedata($) { my ($path) = @_; + # HACK to clear player env face cache, we need some signal framework + # for this (global event?) + %ext::player_env::MUSIC_FACE_CACHE = (); + + my $enc = JSON::XS->new->utf8->canonical->relaxed; + warn "loading facedata from $path\n"; my $facedata; @@ -2822,6 +2940,13 @@ $facedata->{version} == 2 or cf::cleanup "$path: version mismatch, cannot proceed."; + # patch in the exptable + $facedata->{resource}{"res/exp_table"} = { + type => FT_RSRC, + data => $enc->encode ([map cf::level_to_min_exp $_, 1 .. cf::settings->max_level]), + }; + cf::cede_to_tick; + { my $faces = $facedata->{faceinfo}; @@ -2829,8 +2954,8 @@ my $idx = (cf::face::find $face) || cf::face::alloc $face; cf::face::set_visibility $idx, $info->{visibility}; cf::face::set_magicmap $idx, $info->{magicmap}; - cf::face::set_data $idx, 0, $info->{data32}, $info->{chksum32}; - cf::face::set_data $idx, 1, $info->{data64}, $info->{chksum64}; + cf::face::set_data $idx, 0, $info->{data32}, Digest::MD5::md5 $info->{data32}; + cf::face::set_data $idx, 1, $info->{data64}, Digest::MD5::md5 $info->{data64}; cf::cede_to_tick; } @@ -2865,36 +2990,67 @@ # TODO: for gcfclient pleasure, we should give resources # that gcfclient doesn't grok a >10000 face index. my $res = $facedata->{resource}; - my $enc = JSON::XS->new->utf8->canonical; - while (my ($name, $info) = each %$res) { - my $meta = $enc->encode ({ - name => $name, - type => $info->{type}, - copyright => $info->{copyright}, #TODO# - }); + my $soundconf = delete $res->{"res/sound.conf"}; + while (my ($name, $info) = each %$res) { my $idx = (cf::face::find $name) || cf::face::alloc $name; + my $data; - if ($name =~ /\.(?:jpg|png)$/) { - cf::face::set_data $idx, 0, $info->{data}, $info->{chksum};#d# temp hack - cf::face::set_data $idx, 1, $info->{data}, $info->{chksum};#d# temp hack - } else { - my $data = pack "(w/a*)*", $meta, $info->{data}; - my $chk = Digest::MD5::md5 "$info->{chksum},$meta"; # mangle data checksum and metadata + if ($info->{type} & 1) { + # prepend meta info - cf::face::set_type $idx, 1; - cf::face::set_data $idx, 0, $data, $chk; + my $meta = $enc->encode ({ + name => $name, + %{ $info->{meta} || {} }, + }); + + $data = pack "(w/a*)*", $meta, $info->{data}; + } else { + $data = $info->{data}; } + cf::face::set_data $idx, 0, $data, Digest::MD5::md5 $data; + cf::face::set_type $idx, $info->{type}; + cf::cede_to_tick; } + + if ($soundconf) { + $soundconf = $enc->decode (delete $soundconf->{data}); + + for (0 .. SOUND_CAST_SPELL_0 - 1) { + my $sound = $soundconf->{compat}[$_] + or next; + + my $face = cf::face::find "sound/$sound->[1]"; + cf::sound::set $sound->[0] => $face; + cf::sound::old_sound_index $_, $face; # gcfclient-compat + } + + while (my ($k, $v) = each %{$soundconf->{event}}) { + my $face = cf::face::find "sound/$v"; + cf::sound::set $k => $face; + } + } } 1 } +register_exticmd fx_want => sub { + my ($ns, $want) = @_; + + while (my ($k, $v) = each %$want) { + $ns->fx_want ($k, $v); + } +}; + sub reload_regions { + # HACK to clear player env face cache, we need some signal framework + # for this (global event?) + %ext::player_env::MUSIC_FACE_CACHE = (); + load_resource_file "$MAPDIR/regions" or die "unable to load regions file\n"; @@ -2940,7 +3096,7 @@ reload_resources; } -sub cfg_load { +sub reload_config { open my $fh, "<:utf8", "$CONFDIR/config" or return; @@ -2970,7 +3126,7 @@ })->prio (Coro::PRIO_MAX); }; - cfg_load; + reload_config; db_init; load_extensions; @@ -3173,7 +3329,7 @@ cf::_connect_to_perl; # nominally unnecessary, but cannot hurt warn "loading config and database again"; - cf::cfg_load; + cf::reload_config; warn "loading extensions"; cf::load_extensions; @@ -3276,7 +3432,7 @@ $map->width (50); $map->height (50); $map->alloc; - $map->_load_objects ("/tmp/x.map", 1); + $map->_load_objects ("/tmp/x.map", 1); #TODO: does not work my $t = Event::time - $t; #next unless $t < 0.0013;#d#