skylib_fluffos_v3/
skylib_fluffos_v3/bin/
skylib_fluffos_v3/bin/db/
skylib_fluffos_v3/fluffos-2.9-ds2.04/
skylib_fluffos_v3/fluffos-2.9-ds2.04/ChangeLog.old/
skylib_fluffos_v3/fluffos-2.9-ds2.04/Win32/
skylib_fluffos_v3/fluffos-2.9-ds2.04/compat/
skylib_fluffos_v3/fluffos-2.9-ds2.04/compat/simuls/
skylib_fluffos_v3/fluffos-2.9-ds2.04/include/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/clone/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/command/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/data/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/etc/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/include/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/inherit/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/inherit/master/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/log/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/tests/compiler/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/tests/efuns/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/single/tests/operators/
skylib_fluffos_v3/fluffos-2.9-ds2.04/testsuite/u/
skylib_fluffos_v3/fluffos-2.9-ds2.04/tmp/
skylib_fluffos_v3/fluffos-2.9-ds2.04/windows/
skylib_fluffos_v3/mudlib/
skylib_fluffos_v3/mudlib/cmds/
skylib_fluffos_v3/mudlib/cmds/admin/
skylib_fluffos_v3/mudlib/cmds/guild-race/
skylib_fluffos_v3/mudlib/cmds/living/broken/
skylib_fluffos_v3/mudlib/cmds/player/group_cmds/
skylib_fluffos_v3/mudlib/cmds/playtester/
skylib_fluffos_v3/mudlib/d/admin/
skylib_fluffos_v3/mudlib/d/admin/room/
skylib_fluffos_v3/mudlib/d/admin/room/we_care/
skylib_fluffos_v3/mudlib/d/admin/save/
skylib_fluffos_v3/mudlib/d/admin/text/
skylib_fluffos_v3/mudlib/d/learning/TinyTown/buildings/
skylib_fluffos_v3/mudlib/d/learning/TinyTown/map/
skylib_fluffos_v3/mudlib/d/learning/TinyTown/roads/
skylib_fluffos_v3/mudlib/d/learning/chars/
skylib_fluffos_v3/mudlib/d/learning/functions/
skylib_fluffos_v3/mudlib/d/learning/handlers/
skylib_fluffos_v3/mudlib/d/learning/help_topics/
skylib_fluffos_v3/mudlib/d/learning/help_topics/npcs/
skylib_fluffos_v3/mudlib/d/learning/help_topics/objects/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rcs_demo/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rcs_demo/RCS/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rooms/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rooms/crowd/
skylib_fluffos_v3/mudlib/d/learning/help_topics/rooms/situations/
skylib_fluffos_v3/mudlib/d/learning/save/
skylib_fluffos_v3/mudlib/d/learning/school/
skylib_fluffos_v3/mudlib/d/learning/school/add_sc/
skylib_fluffos_v3/mudlib/d/learning/school/characters/
skylib_fluffos_v3/mudlib/d/learning/school/general/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/basic_commands/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/edtutor/
skylib_fluffos_v3/mudlib/d/learning/school/getting-started/unix_tutor/
skylib_fluffos_v3/mudlib/d/learning/school/items/
skylib_fluffos_v3/mudlib/d/learning/school/npc_school/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/room_basic/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/situations/
skylib_fluffos_v3/mudlib/d/learning/school/room_school/terrain_tutor/
skylib_fluffos_v3/mudlib/d/learning/text/
skylib_fluffos_v3/mudlib/d/liaison/
skylib_fluffos_v3/mudlib/d/mudlib/
skylib_fluffos_v3/mudlib/d/mudlib/changes/
skylib_fluffos_v3/mudlib/d/playtesters/
skylib_fluffos_v3/mudlib/d/playtesters/effects/
skylib_fluffos_v3/mudlib/d/playtesters/handlers/
skylib_fluffos_v3/mudlib/d/playtesters/items/
skylib_fluffos_v3/mudlib/d/sage/
skylib_fluffos_v3/mudlib/doc/
skylib_fluffos_v3/mudlib/doc/creator/
skylib_fluffos_v3/mudlib/doc/driver/
skylib_fluffos_v3/mudlib/doc/driver/efuns/arrays/
skylib_fluffos_v3/mudlib/doc/driver/efuns/buffers/
skylib_fluffos_v3/mudlib/doc/driver/efuns/calls/
skylib_fluffos_v3/mudlib/doc/driver/efuns/compile/
skylib_fluffos_v3/mudlib/doc/driver/efuns/filesystem/
skylib_fluffos_v3/mudlib/doc/driver/efuns/floats/
skylib_fluffos_v3/mudlib/doc/driver/efuns/functions/
skylib_fluffos_v3/mudlib/doc/driver/efuns/general/
skylib_fluffos_v3/mudlib/doc/driver/efuns/mappings/
skylib_fluffos_v3/mudlib/doc/driver/efuns/mixed/
skylib_fluffos_v3/mudlib/doc/driver/efuns/mudlib/
skylib_fluffos_v3/mudlib/doc/driver/efuns/numbers/
skylib_fluffos_v3/mudlib/doc/driver/efuns/parsing/
skylib_fluffos_v3/mudlib/doc/login/
skylib_fluffos_v3/mudlib/doc/lpc/basic_manual/
skylib_fluffos_v3/mudlib/doc/lpc/intermediate/
skylib_fluffos_v3/mudlib/doc/new/add_command/
skylib_fluffos_v3/mudlib/doc/new/events/
skylib_fluffos_v3/mudlib/doc/new/handlers/
skylib_fluffos_v3/mudlib/doc/new/living/race/
skylib_fluffos_v3/mudlib/doc/new/living/spells/
skylib_fluffos_v3/mudlib/doc/new/object/
skylib_fluffos_v3/mudlib/doc/new/player/
skylib_fluffos_v3/mudlib/doc/new/room/guild/
skylib_fluffos_v3/mudlib/doc/new/room/outside/
skylib_fluffos_v3/mudlib/doc/new/room/storeroom/
skylib_fluffos_v3/mudlib/doc/object/
skylib_fluffos_v3/mudlib/doc/playtesters/
skylib_fluffos_v3/mudlib/doc/policy/
skylib_fluffos_v3/mudlib/doc/weapons/
skylib_fluffos_v3/mudlib/global/
skylib_fluffos_v3/mudlib/global/creator/
skylib_fluffos_v3/mudlib/handlers/
skylib_fluffos_v3/mudlib/include/casino/
skylib_fluffos_v3/mudlib/include/cmds/
skylib_fluffos_v3/mudlib/include/effects/
skylib_fluffos_v3/mudlib/include/npc/
skylib_fluffos_v3/mudlib/include/room/
skylib_fluffos_v3/mudlib/include/shops/
skylib_fluffos_v3/mudlib/net/daemon/
skylib_fluffos_v3/mudlib/net/daemon/chars/
skylib_fluffos_v3/mudlib/net/inherit/
skylib_fluffos_v3/mudlib/net/obj/
skylib_fluffos_v3/mudlib/net/obj/BACKUPS/
skylib_fluffos_v3/mudlib/obj/amulets/
skylib_fluffos_v3/mudlib/obj/armours/plate/
skylib_fluffos_v3/mudlib/obj/b_day/
skylib_fluffos_v3/mudlib/obj/clothes/transport/horse/
skylib_fluffos_v3/mudlib/obj/faith/symbols/
skylib_fluffos_v3/mudlib/obj/fungi/
skylib_fluffos_v3/mudlib/obj/gatherables/
skylib_fluffos_v3/mudlib/obj/instruments/
skylib_fluffos_v3/mudlib/obj/media/
skylib_fluffos_v3/mudlib/obj/misc/player_shop/
skylib_fluffos_v3/mudlib/obj/monster/godmother/
skylib_fluffos_v3/mudlib/obj/monster/transport/
skylib_fluffos_v3/mudlib/obj/rings/
skylib_fluffos_v3/mudlib/obj/scabbards/
skylib_fluffos_v3/mudlib/obj/spells/
skylib_fluffos_v3/mudlib/obj/stationery/
skylib_fluffos_v3/mudlib/obj/stationery/envelopes/
skylib_fluffos_v3/mudlib/obj/toys/
skylib_fluffos_v3/mudlib/obj/vessels/
skylib_fluffos_v3/mudlib/obj/weapons/axes/
skylib_fluffos_v3/mudlib/obj/weapons/chains/
skylib_fluffos_v3/mudlib/obj/weapons/maces/BACKUPS/
skylib_fluffos_v3/mudlib/save/autodoc/
skylib_fluffos_v3/mudlib/save/book_handler/
skylib_fluffos_v3/mudlib/save/books/history/calarien/
skylib_fluffos_v3/mudlib/save/mail/
skylib_fluffos_v3/mudlib/save/new_soul/data/
skylib_fluffos_v3/mudlib/save/parcels/
skylib_fluffos_v3/mudlib/save/playerinfo/
skylib_fluffos_v3/mudlib/save/players/d/
skylib_fluffos_v3/mudlib/save/players/s/
skylib_fluffos_v3/mudlib/save/random_names/
skylib_fluffos_v3/mudlib/save/random_names/data/
skylib_fluffos_v3/mudlib/save/terrains/
skylib_fluffos_v3/mudlib/save/terrains/tutorial_desert/
skylib_fluffos_v3/mudlib/save/terrains/tutorial_grassy_field/
skylib_fluffos_v3/mudlib/save/terrains/tutorial_mountain/
skylib_fluffos_v3/mudlib/save/todo_lists/
skylib_fluffos_v3/mudlib/secure/
skylib_fluffos_v3/mudlib/secure/cmds/admin/
skylib_fluffos_v3/mudlib/secure/cmds/lord/
skylib_fluffos_v3/mudlib/secure/config/
skylib_fluffos_v3/mudlib/secure/handlers/autodoc/
skylib_fluffos_v3/mudlib/secure/handlers/intermud/
skylib_fluffos_v3/mudlib/secure/include/global/
skylib_fluffos_v3/mudlib/secure/save/
skylib_fluffos_v3/mudlib/secure/save/handlers/
skylib_fluffos_v3/mudlib/secure/std/
skylib_fluffos_v3/mudlib/secure/std/classes/
skylib_fluffos_v3/mudlib/secure/std/modules/
skylib_fluffos_v3/mudlib/std/creator/
skylib_fluffos_v3/mudlib/std/dom/
skylib_fluffos_v3/mudlib/std/effects/
skylib_fluffos_v3/mudlib/std/effects/external/
skylib_fluffos_v3/mudlib/std/effects/fighting/
skylib_fluffos_v3/mudlib/std/effects/magic/
skylib_fluffos_v3/mudlib/std/effects/magic/BACKUPS/
skylib_fluffos_v3/mudlib/std/effects/other/BACKUPS/
skylib_fluffos_v3/mudlib/std/effects/priest/
skylib_fluffos_v3/mudlib/std/effects/room/
skylib_fluffos_v3/mudlib/std/environ/
skylib_fluffos_v3/mudlib/std/guilds/
skylib_fluffos_v3/mudlib/std/guilds/old/
skylib_fluffos_v3/mudlib/std/languages/
skylib_fluffos_v3/mudlib/std/liquids/
skylib_fluffos_v3/mudlib/std/npc/
skylib_fluffos_v3/mudlib/std/npc/goals/
skylib_fluffos_v3/mudlib/std/npc/goals/basic/
skylib_fluffos_v3/mudlib/std/npc/goals/misc/
skylib_fluffos_v3/mudlib/std/npc/plans/
skylib_fluffos_v3/mudlib/std/npc/plans/basic/
skylib_fluffos_v3/mudlib/std/npc/types/
skylib_fluffos_v3/mudlib/std/npc/types/helper/
skylib_fluffos_v3/mudlib/std/npcs/
skylib_fluffos_v3/mudlib/std/outsides/
skylib_fluffos_v3/mudlib/std/races/shadows/
skylib_fluffos_v3/mudlib/std/room/basic/BACKUPS/
skylib_fluffos_v3/mudlib/std/room/basic/topography/
skylib_fluffos_v3/mudlib/std/room/controller/
skylib_fluffos_v3/mudlib/std/room/inherit/topography/
skylib_fluffos_v3/mudlib/std/room/topography/area/
skylib_fluffos_v3/mudlib/std/room/topography/iroom/
skylib_fluffos_v3/mudlib/std/room/topography/milestone/
skylib_fluffos_v3/mudlib/std/shadows/curses/
skylib_fluffos_v3/mudlib/std/shadows/disease/
skylib_fluffos_v3/mudlib/std/shadows/fighting/
skylib_fluffos_v3/mudlib/std/shadows/healing/
skylib_fluffos_v3/mudlib/std/shadows/magic/
skylib_fluffos_v3/mudlib/std/shadows/poison/
skylib_fluffos_v3/mudlib/std/shadows/room/
skylib_fluffos_v3/mudlib/std/shops/controllers/
skylib_fluffos_v3/mudlib/std/shops/objs/
skylib_fluffos_v3/mudlib/std/shops/player_shop/
skylib_fluffos_v3/mudlib/std/socket/
skylib_fluffos_v3/mudlib/std/soul/d/
skylib_fluffos_v3/mudlib/std/soul/e/
skylib_fluffos_v3/mudlib/std/soul/i/
skylib_fluffos_v3/mudlib/std/soul/j/
skylib_fluffos_v3/mudlib/std/soul/k/
skylib_fluffos_v3/mudlib/std/soul/l/
skylib_fluffos_v3/mudlib/std/soul/n/
skylib_fluffos_v3/mudlib/std/soul/o/
skylib_fluffos_v3/mudlib/std/soul/q/
skylib_fluffos_v3/mudlib/std/soul/r/
skylib_fluffos_v3/mudlib/std/soul/u/
skylib_fluffos_v3/mudlib/std/soul/v/
skylib_fluffos_v3/mudlib/std/soul/y/
skylib_fluffos_v3/mudlib/std/soul/z/
skylib_fluffos_v3/mudlib/std/stationery/
skylib_fluffos_v3/mudlib/w/
skylib_fluffos_v3/mudlib/w/default/
skylib_fluffos_v3/mudlib/w/default/armour/
skylib_fluffos_v3/mudlib/w/default/clothes/
skylib_fluffos_v3/mudlib/w/default/item/
skylib_fluffos_v3/mudlib/w/default/npc/
skylib_fluffos_v3/mudlib/w/default/room/
skylib_fluffos_v3/mudlib/w/default/weapon/
skylib_fluffos_v3/mudlib/www/
skylib_fluffos_v3/mudlib/www/java/
skylib_fluffos_v3/mudlib/www/secure/
skylib_fluffos_v3/mudlib/www/secure/lpc/advanced/
skylib_fluffos_v3/mudlib/www/secure/lpc/intermediate/
skylib_fluffos_v3/win32/
/**
 * This compiles the soul files into a non human readable format.  The
 * format is far more useful to the soul though :)
 */
#include "soul.h"
#include "user_parser.h"

private nosave string _current_file;
private nosave int _current_line;
private nosave int _file_len;
private nosave int _depth;
private nosave int _look_for;
private nosave mixed *_to_compile;
private nosave mixed *_arguments;
private nosave object _current_player;

void start_compile();
void parse_chunk(string chunk);
void make_into_soul_commands(mapping commands);

/* Number of lines in a chunk */
#define CHUNK_SIZE 20

#define OPEN_BRACKET 1
#define START_ARGUMENT 2
#define END_BRACKET 3
#define END_STRING 4
#define ARGUMENT_VALUE 5
#define ARGUMENT_NAME 6
#define REST_OF_ARGUMENT 7

void create() {
  _to_compile = ({ });
  seteuid("Root");
} /* create() */

/** @ignore yes */
int test_security(string fname) {
  return 1;
} /* test_security() */

/** @ignore yes */
void notify(string mess) {
  if (_current_player)
    tell_object(_current_player, mess);
} /* notify() */

/**
 * Compiles up the file into the useful soul format.  It also tells
 * the soul about it.
 * <p>
 * See the soul data files in /save/new_soul for details of the format
 * for the soul files.  The file has to come from the soul save
 * directory or the call will not work.
 * @param fname the name of the file to compile
 */
void compile_file(string fname) {
/*
 * First, do we have read access to the file.
 * and is it actually a file?
 */  
  if (file_size(SOUL_DIR+fname) == -1) {
    tell_object(this_player(), "The file "+
                 SOUL_DIR+fname+" does not exist.\n");
    return ;
  }
  if (file_size(SOUL_DIR+fname) == -2) {
    tell_object(this_player(), "The file "+
                 SOUL_DIR+fname+" is a directory exist.\n");
    return ;
  }
  _to_compile += ({ SOUL_DIR+fname, this_player() });
  start_compile();
} /* compile_file() */

/**
 * Compiles up a directory full of files.
 * @see compile_file() 
 * @param fname the directory name to compile
 */
void compile_directory(string fname) {
  string *bits, start;
  int i;

  if (file_size(SOUL_DIR+fname) != -2) {
    tell_object(this_player(), "The file "+
                 fname+" is not a directory exist.\n");
    return ;
  }
  bits = explode(fname, "/");
  start = implode(bits[0..<1], "/");
  if (start != "")
    start += "/";
  fname = SOUL_DIR+fname;
  if (fname[<1] == '/')
    fname += "*.s";
  else
    fname += "/*.s";
  bits = get_dir(fname);
  for (i=0;i<sizeof(bits);i++) {
    bits[i] = start+bits[i];
    tell_object(this_player(), "Compiling "+bits[i]+"\n");
    compile_file(bits[i]);
  }
} /* compile_directory() */

/** @ignore yes */
void start_compile() {
/* We are already compiling */
  if (_current_file || !sizeof(_to_compile))
    return ;
  _current_file = _to_compile[0];
  _current_player = _to_compile[1];
  _to_compile = _to_compile[2..];
  _current_line = 1;
  _depth = 0;
  _look_for = OPEN_BRACKET;
  _file_len = file_length(_current_file);
  _arguments = ({ 0, ([ ]) });
  call_out("compile_chunk", 2);
} /* start_compile() */

/** @ignore yes */
void compile_chunk() {
  string chunk;
  int end;
  
  if (_current_line+CHUNK_SIZE > _file_len)
    end = _file_len+1;
  else
    end = _current_line+CHUNK_SIZE;
  chunk = unguarded((: read_file, _current_file, _current_line,
                     end-_current_line :));
  _current_line = end;
  parse_chunk(chunk);
  if (end > _file_len) {
/* finished file */
    call_out("start_compile", 2);
    _current_file = 0;
    make_into_soul_commands(_arguments[1]);
  } else {
    call_out("compile_chunk", 2);
  }
} /* compile_chunk() */

/** @ignore yes */
void parse_chunk(string chunk) {
  /* Now.  What are we looking for? */
  /* Love, a nice place in the world, a happy bag full of groceries. */
  string *bits, s1, s2;
  int pos, chunk_size, start;

  chunk_size = strlen(chunk);
  pos = 0;
  bits = explode(chunk, "(");
  while (pos < chunk_size) {
    switch (_look_for) {
      case OPEN_BRACKET :
        if (sscanf(chunk[pos..], "%s(%s", s1, s2)) {
          chunk = s2;
          chunk_size = strlen(chunk);
          pos = 0;
          _depth++;
          _arguments += ({ 0, 0 });
          _look_for = ARGUMENT_NAME;
        } else {
          pos = chunk_size;
        }
        break;

      case ARGUMENT_NAME :
        /* We look for the first non-space, non-tab, non-nl */
        while (pos < chunk_size && (chunk[pos] == ' ' || 
               chunk[pos] == '\t' || chunk[pos] == '\n'))
          pos++;
        if (pos == chunk_size)
          break;
        start = pos;
        /* Ok, now we search for the next one. */
        while (pos < chunk_size && chunk[pos] != ' ' && 
               chunk[pos] != '\t' && chunk[pos] != '\n')
          pos++;
        /* Thats it.  Our argument name. */
        _arguments[_depth*2] = chunk[start..pos-1];
        _look_for = ARGUMENT_VALUE;
        break;

      case ARGUMENT_VALUE :
        while (pos < chunk_size && (chunk[pos] == ' ' || 
               chunk[pos] == '\t' || chunk[pos] == '\n'))
          pos++;
        if (pos >= chunk_size)
          break;
        switch (chunk[pos]) {
          case '(' :
            _arguments[_depth*2+1] = ([ ]);
            _depth++;
            _arguments += ({ 0, 0 });
            _look_for = ARGUMENT_NAME;
            pos++;
            break;
          case '"' :
            _arguments[_depth*2+1] = "";
            _look_for = END_STRING;
            pos++;
            break;
          default :
/* A string, at most one space seperator between them... */
            start = pos;
            if (sscanf(chunk[pos..], "%s)%s", s1, s2) == 2) {
              _arguments[_depth*2+1] = replace(implode(explode(replace(s1, 
                   ({ "\n", " ", "\r", "" })), " ")-({ "" }), " "), ", ", ",");
              pos = 0;
              chunk = ")"+s2;
              _look_for = END_BRACKET;
            } else {
              _arguments[_depth*2+1] = chunk[pos..];
              _look_for = REST_OF_ARGUMENT;
              pos = 0;
              chunk = "";
            }
            chunk_size = strlen(chunk);
            break;
        }
        break;

      case REST_OF_ARGUMENT :
        if (sscanf(chunk[pos..], "%s)%s", s1, s2) == 2) {
          _arguments[_depth*2+1] = replace(implode(explode(
                                   replace(_arguments[_depth*2+1]+s1, "\n", " "),
                                                 " ") - ({ "" }),
                                         " "), ", ", ",");
          pos = 0;
          chunk = ")"+s2;
          _look_for = END_BRACKET;
        } else {
          _arguments[_depth*2+1] += chunk[pos..];
          pos = 0;
          chunk = "";
        }
        chunk_size = strlen(chunk);
        break;

      case END_BRACKET :
        if (sscanf(chunk[pos..], "%s)%s", s1, s2)) {
          switch (_depth) {
            case 2 : 
            case 3 :
              if (pointerp(_arguments[_depth*2-1][_arguments[_depth*2]]))
                _arguments[_depth*2-1][_arguments[_depth*2]] += ({ _arguments[_depth*2+1] });
              else
                _arguments[_depth*2-1][_arguments[_depth*2]] = ({ _arguments[_depth*2+1] });
              break;
            case 1 :
            case 4 :
            case 5 :
            case 6 :
            case 7 :
              _arguments[_depth*2-1][_arguments[_depth*2]] = _arguments[_depth*2+1];
              break;
          }
          chunk = s2;
          chunk_size = strlen(s2);
          _depth--;
          pos = 0;
          _arguments = _arguments[0.._depth*2+1];
          if (_depth)
            _look_for = START_ARGUMENT;
          else
            _look_for = OPEN_BRACKET;
        }
        break;

      case START_ARGUMENT :
        while (pos < chunk_size && (chunk[pos] == ' '
             || chunk[pos] == '\t' || chunk[pos] == '\n'))
          pos++;
        if (pos >= chunk_size)
          break;
        switch (chunk[pos]) {
          case ')' :
            _look_for = END_BRACKET;
            break;
          case '(' :
            _look_for = OPEN_BRACKET;
            break;
          default :
            if (!sscanf(chunk[pos..], "%s\n%s", s1, s2))
              s1 = chunk;
            printf("Syntax error in file %s, near %s\n", _current_file, s1);
            _look_for = END_BRACKET;
            break;
        }
        break;

      case END_STRING :
        if (sscanf(chunk[pos..], "%s\"%s", s1, s2)) {
          if (strlen(s1) > 0 && s1[strlen(s1)-1] == '\\') {
            _arguments[_depth*2+1] += replace(s1[0..strlen(s1)-2], "\n", "")+"\"";
            chunk = s2;
            pos = 0;
            chunk_size = strlen(s2);
          } else {
            _arguments[_depth*2+1] += replace(s1, "\n", "");
            _look_for = END_BRACKET;
            chunk = s2;
            pos = 0;
            chunk_size = strlen(s2);
          }
        } else {
          _arguments[_depth*2+1] += replace(chunk, "\n", "");
          pos = chunk_size;
        }
        break;

      default :
        notify("Horrible error "+_look_for+"\n");
        pos = chunk_size;
        break;
    }
  }
} /* parse_chunk() */

/** @ignore yes */
int check_sort(string pat1, string pat2) {
  int lvl1, lvl2;

  lvl1 = ((mixed *)PATTERN_OB->compile_pattern(pat1))[0];
  lvl2 = ((mixed *)PATTERN_OB->compile_pattern(pat2))[0];
  return lvl2-lvl1;
} /* check_sort() */

/** @ignore yes */
string *sort_patterns(string *inp) {
  if (!pointerp(inp)) {
    printf("%O\n", inp);
    return ({ });
  }
  return sort_array(inp, "check_sort", this_object());
/*
  string *ret;
  int *lvl, i, j, level;

  lvl = allocate(sizeof(inp));
  ret = ({ });
  for (i=0;i<sizeof(inp);i++) {
    level = ((mixed *)PATTERN_OB->compile_pattern(inp[i]))[0];
    for (j=0;j<sizeof(ret);j++)
      if (lvl[j] < level) {
        if (j) {
          ret = ret[0..j-1]+({ inp[i] })+ret[j..];
          lvl = lvl[0..j-1]+({ level })+lvl[j..];
        } else {
          ret = ({ inp[i] })+ret[j..];
          lvl = ({ level })+lvl[j..];
        }
        break;
      }
    if (j == sizeof(ret)) {
      ret += ({ inp[i] });
      lvl += ({ level });
    }
  }
  return ret;
 */
} /* sort_patterns() */

/** @ignore yes */
void make_into_soul_commands(mapping comms) {
  string *fluff;
  int i, failed, j;
  mapping ret, tmp;

  fluff = keys(comms);
  ret = ([ ]);
  for (i=0;i<sizeof(fluff);i++) {
/* No arguments and arguments... */
    ret[fluff[i]] = ({ comms[fluff[i]]["pattern"], 0, 0 });
/* Ok, now we see if we have a single bit */
    if (comms[fluff[i]]["single"]) {
/* Yes! */
      if (comms[fluff[i]]["single"][0]["no-arguments"]) {
        tmp = comms[fluff[i]]["single"][0]["no-arguments"][0];  
        if (!tmp["self"]) {
          notify("The 'self' type is missing in the no-argument, single for the soul command "+fluff[i]+"\n");
          failed = 1;
        } else if (!tmp["rest"]) {
          notify("The 'rest' type is missing in the no-argument, single for the soul command "+fluff[i]+"\n");
          failed = 1;
        } else {
          ret[fluff[i]][SINGLE] = ({ ({ tmp["self"], tmp["rest"],
                                        tmp["position"] }),
                                      0 });
        }
      }
      if (comms[fluff[i]]["single"][0]["arguments"]) {
        j = sizeof(comms[fluff[i]]["single"][0]["arguments"]);
        if (!ret[fluff[i]][SINGLE]) 
          ret[fluff[i]][SINGLE] = ({ 0, allocate(j*SMALL_ARG_SIZE) });
        else
          ret[fluff[i]][SINGLE][ARGUMENTS] = allocate(j*SMALL_ARG_SIZE);
        for (j=0;j<sizeof(comms[fluff[i]]["single"][0]["arguments"]);j++) {
          tmp = comms[fluff[i]]["single"][0]["arguments"][j];
          if (!mapp(tmp)) {
            notify("The soul command "+fluff[i]+" is totaly stuffed.\n");
            failed = 1;
          } else if (!tmp["self"]) {
            notify("The 'self' type is missing in the argument, single for the soul command "+fluff[i]+"\n");
            failed = 1;
          } else if (!tmp["rest"]) {
            notify("The 'rest' type is missing in the argument, single for the soul command "+fluff[i]+"\n");
            failed = 1;
          } else if (!tmp["arguments"]) {
            notify("The 'arguments' type is missing in the argument, single for the soul command "+fluff[i]+"\n");
            failed = 1;
          } else {
            ret[fluff[i]][SINGLE][ARGUMENTS][j*SMALL_ARG_SIZE+SELF] = tmp["self"];
            ret[fluff[i]][SINGLE][ARGUMENTS][j*SMALL_ARG_SIZE+REST] = tmp["rest"];
            ret[fluff[i]][SINGLE][ARGUMENTS][j*SMALL_ARG_SIZE+ARGS] = explode(tmp["arguments"], ",");
            ret[fluff[i]][SINGLE][ARGUMENTS][j*SMALL_ARG_SIZE+POSITION_SINGLE] = tmp["position"];
          }
        }
      }
    }
    if (comms[fluff[i]]["targeted"]) {
/* Yes! */
      if (comms[fluff[i]]["targeted"][0]["no-arguments"]) {
        tmp = comms[fluff[i]]["targeted"][0]["no-arguments"][0];  
        if (!tmp["self"]) {
          notify("The 'self' type is missing in the no-argument, target for the soul command "+fluff[i]+"\n");
          failed = 1;
        } else if (!tmp["rest"]) {
          notify("The 'rest' type is missing in the no-argument, target for the soul command "+fluff[i]+"\n");
          failed = 1;
        } else {
          ret[fluff[i]][TARGET] = ({ ({ tmp["self"], tmp["rest"],
                         tmp["target"], 0, tmp["force"], tmp["position"] }),
                                      0 });
        }
      }
      if (comms[fluff[i]]["targeted"][0]["arguments"]) {
        j = sizeof(comms[fluff[i]]["targeted"][0]["arguments"]);
        if (!ret[fluff[i]][TARGET]) 
          ret[fluff[i]][TARGET] = ({ 0, allocate(j*ARG_SIZE) });
        else
          ret[fluff[i]][TARGET][ARGUMENTS] = allocate(j*ARG_SIZE);
        for (j=0;j<sizeof(comms[fluff[i]]["targeted"][0]["arguments"]);j++) {
          tmp = comms[fluff[i]]["targeted"][0]["arguments"][j];
          if (!tmp["self"]) {
            notify("The 'self' type is missing in the argument, target for the soul command "+fluff[i]+"\n");
            failed = 1;
          } else if (!tmp["rest"]) {
            notify("The 'rest' type is missing in the argument, target for the soul command "+fluff[i]+"\n");
            failed = 1;
          } else if (!tmp["arguments"]) {
            notify("The 'arguments' type is missing in the argument, target for the soul command "+fluff[i]+"\n");
            failed = 1;
          } else {
            ret[fluff[i]][TARGET][ARGUMENTS][j*ARG_SIZE+SELF] = tmp["self"];
            ret[fluff[i]][TARGET][ARGUMENTS][j*ARG_SIZE+REST] = tmp["rest"];
            ret[fluff[i]][TARGET][ARGUMENTS][j*ARG_SIZE+TARG] = tmp["target"];
            ret[fluff[i]][TARGET][ARGUMENTS][j*ARG_SIZE+ARGS] = explode(tmp["arguments"], ",");
            ret[fluff[i]][TARGET][ARGUMENTS][j*ARG_SIZE+FORCE] = tmp["force"];
            ret[fluff[i]][TARGET][ARGUMENTS][j*ARG_SIZE+POSITION] = tmp["position"];
          }
        }
      }
    }
  }
  fluff = keys(ret);
  for (i=0;i<sizeof(fluff);i++) {
    ret[fluff[i]][PATTERNS] = sort_patterns(ret[fluff[i]][PATTERNS]);
    SOUL_OBJECT->add_soul_command(fluff[i], ret[fluff[i]]);
    notify("Added soul command "+fluff[i]+".\n");
  }
} /* make_into_soul_commands() */

/** @ignore yes */
void blue() {
  printf("%O\n", sort_patterns(({ "[at] <indirect:object>", "<string>" })));
} /* blue() */