home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / s / sd-27.zip / sd.h < prev    next >
C/C++ Source or Header  |  1992-11-23  |  54KB  |  1,366 lines

  1. /* SD -- square dance caller's helper.
  2.  
  3.     Copyright (C) 1990, 1991, 1992  William B. Ackerman.
  4.  
  5.     This program is free software; you can redistribute it and/or modify
  6.     it under the terms of the GNU General Public License as published by
  7.     the Free Software Foundation; either version 1, or (at your option)
  8.     any later version.
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19.     This is for version 27. */
  20.  
  21. #define TRUE 1
  22. #define FALSE 0
  23. #define NULLCONCEPTPTR (concept_descriptor *) 0
  24. #define NULLCALLSPEC (callspec_block *) 0
  25.  
  26. typedef int long_boolean;
  27.  
  28. /* We would like this to be a signed char, but not all compilers are fully ANSI compliant. */
  29. /* The IBM AIX compiler, for example, considers char to be unsigned. */
  30. typedef short veryshort;
  31.  
  32. #include <setjmp.h>
  33. #include "database.h"
  34.  
  35. #define MAX_ERR_LENGTH 200
  36. #define MAX_FILENAME_LENGTH 260
  37. #define MAX_PEOPLE 24
  38.  
  39. /* Probability (out of 8) that a concept will be placed on a randomly generated call. */
  40. #define CONCEPT_PROBABILITY 2
  41.  
  42. /* Absolute maximum length we can handle in text operations, including
  43.    writing to file.  If a call gets more complicated than this, stuff
  44.    will simply not be written to the file.  Too bad. */
  45. #define MAX_TEXT_LINE_LENGTH 200
  46.  
  47. /* This defines a person in a setup.  Unfortunately, there is too much data to fit into 32 bits. */
  48. typedef struct {
  49.    unsigned int id1;       /* Frequently used bits go here. */
  50.    unsigned int id2;       /* Bits used for evaluating predicates. */
  51. } personrec;
  52.  
  53. /* Person bits for "id1" field are:
  54.  20 000 000 000 -
  55.  10 000 000 000 - 
  56.   4 000 000 000 - 
  57.   2 000 000 000 -
  58.   1 000 000 000 -
  59.     400 000 000 - roll direction is CCW
  60.     200 000 000 - roll direction is neutral
  61.     100 000 000 - roll direction is CW
  62.      40 000 000 - fractional stability enabled
  63.      20 000 000 - stability "v" field -- 2 bits
  64.      10 000 000 -     "
  65.       4 000 000 - stability "r" field -- 3 bits
  66.       2 000 000 -     "
  67.       1 000 000 -     "
  68.         400 000 -
  69.         200 000 -
  70.         100 000 -
  71.          40 000 -
  72.          20 000 -
  73.          10 000 -
  74.           4 000 - 
  75.           2 000 - virtual person (created by tandem/couples concept, can't print out)
  76.           1 000 - live person (just so at least one bit is always set)
  77.             700 - these 3 bits identify actual person
  78.              60 - these 2 bits must be clear for rotation
  79.              10 - part of rotation (facing north/south)
  80.               4 - bit must be clear for rotation
  81.               2 - part of rotation
  82.               1 - part of rotation (facing east/west)
  83. */
  84.  
  85. /* These are a 3 bit field -- ROLL_BIT tells where its low bit lies. */
  86. #define ROLL_MASK   0700000000
  87. #define ROLL_BIT    0100000000
  88. #define ROLLBITL    0400000000
  89. #define ROLLBITM    0200000000
  90. #define ROLLBITR    0100000000
  91. #define STABLE_MASK  077000000
  92. #define STABLE_ENAB  040000000
  93. #define STABLE_VBIT  010000000
  94. #define STABLE_RBIT  001000000
  95. #define BIT_VIRTUAL 02000
  96. #define BIT_PERSON  01000
  97. #define d_mask  01013
  98. #define d_north 01010
  99. #define d_south 01012
  100. #define d_east  01001
  101. #define d_west  01003
  102.  
  103. /* Person bits for "id2" field are:
  104.  20 000 000 000 -
  105.  10 000 000 000 - 
  106.   4 000 000 000 - center 2
  107.   2 000 000 000 - belle
  108.   1 000 000 000 - beau
  109.     400 000 000 - center 6
  110.     200 000 000 - outer 2
  111.     100 000 000 - outer 6
  112.      40 000 000 - trailer
  113.      20 000 000 - leader
  114.      10 000 000 - not side girl
  115.       4 000 000 - not side boy
  116.       2 000 000 - not head girl
  117.       1 000 000 - not head boy
  118.         400 000 - head corner
  119.         200 000 - side corner
  120.         100 000 - head
  121.          40 000 - side
  122.          20 000 - boy
  123.          10 000 - girl
  124.           4 000 - center
  125.           2 000 - end
  126.           1 000 - near column
  127.             400 - near line
  128.             200 - near box
  129.             100 - far column
  130.              40 - far line
  131.              20 - far box
  132.              10 -
  133.               4 -
  134.               2 -
  135.               1 -
  136. */
  137.  
  138. #define ID2_CTR2    04000000000
  139. #define ID2_BELLE   02000000000
  140. #define ID2_BEAU    01000000000
  141. #define ID2_CTR6     0400000000
  142. #define ID2_OUTR2    0200000000
  143. #define ID2_OUTR6    0100000000
  144. #define ID2_TRAILER   040000000
  145. #define ID2_LEAD      020000000
  146. #define ID2_NSG       010000000
  147. #define ID2_NSB        04000000
  148. #define ID2_NHG        02000000
  149. #define ID2_NHB        01000000
  150. #define ID2_HCOR        0400000
  151. #define ID2_SCOR        0200000
  152. #define ID2_HEAD        0100000
  153. #define ID2_SIDE         040000
  154. #define ID2_BOY          020000
  155. #define ID2_GIRL         010000
  156. #define ID2_CENTER        04000
  157. #define ID2_END           02000
  158. #define ID2_NEARCOL       01000
  159. #define ID2_NEARLINE       0400
  160. #define ID2_NEARBOX        0200
  161. #define ID2_FARCOL         0100
  162. #define ID2_FARLINE         040
  163. #define ID2_FARBOX          020
  164.  
  165.  
  166. typedef struct {
  167.    setup_kind skind;
  168.    int srotation;
  169. } small_setup;
  170.  
  171. /* Flags that reside in the "setupflags" word of a setup BEFORE a call is executed.
  172.  
  173.    BEWARE!! These flags co-exist in the setupflags word with copies of some
  174.    of the call invocation flags.  The mask for those flags is
  175.    DFM_CONCENTRICITY_FLAG_MASK.  Those flags, and that mask, are defined
  176.    in database.h .  We define these flags at the extreme left end of the
  177.    word in order to keep them away from the concentricity flags.
  178.  
  179.    SETUPFLAG__DISTORTED means that we are at a level of recursion in which some
  180.    distorted-setup concept has been used.  When this is set, "matrix" (a.k.a.
  181.    "space invader") calls, such as press and truck, are not permitted.  Sorry, Clark.
  182.  
  183.    SETUPFLAG__OFFSET_Z means that we are doing a 2x3 call (the only known case
  184.    of this is "Z axle") that came from Z's picked out of a 4x4 setup.  The map
  185.    that we are using has a "50% offset" map schema, so that, if the call goes
  186.    into 1x4's (which Z axle does) it will put the results into a parallelogram,
  187.    in accordance with customary usage.  The problem is that, if the call goes
  188.    into a setup other than a 1x4 oriented in the appropriate way, using the
  189.    50% offset schema will lead to the wrong result.  For example, if a call
  190.    were defined that went from Z's into 2x2's, the program would attempt to
  191.    bizarrely offset boxes.  (Yes, I know that Z axle is the only call in the
  192.    database that can cause Z's to be picked out of a 4x4.  The program is just
  193.    trying to be very careful.)  So, when this flag is on and a shape-changer
  194.    occurs, the program insists on a parallelogram result.
  195.  
  196.    SETUPFLAG__SAID_SPLIT means that we are at a level of recursion in which
  197.    the "split" concept has been used.  When this is on, it is not permissible
  198.    to do a 4-person call that has not 8-person definition, and hence would have
  199.    been done the same way without the "split" concept.  This prevents superfluous
  200.    things like "split pass thru".
  201.  
  202.    SETUPFLAG__SAID_TRIANGLE means that we are at a level of recursion in which
  203.    the word "triangle" has been uttered, so it is OK to do things like "triangle
  204.    peel and trail" without giving the explicit "triangle" concept again.  This
  205.    makes it possible to say things like "tandem-based triangles peel and trail".
  206.  
  207.    SETUPFLAG__FRACTIONALIZE_MASK is a 9 bit field that is nonzero when some form
  208.    of fractionalization control is in use.  These bits are set up by concepts like
  209.    "random" and "fractional", and are used in sdmoves.c to control sequentially
  210.    defined calls.  See the comments there for details.
  211.  
  212.    SETUPFLAG__ELONGATE_MASK is a 2 bit field that tells, for a 2x2 setup prior to
  213.    having a call executed, how that 2x2 is elongated (due to these people
  214.    being the outsides) in the east-west or north-south direction.  Since 2x2's are
  215.    always totally canonical, the interpretation of the elongation direction is
  216.    always absolute.  A 1 in this field means the elongation is east-west.  A 2
  217.    means the elongation is north-south.  A zero means the elongation is unknown.
  218.  
  219.    SETUPFLAG__NO_CHK_ELONG means that the elongation of the incoming setup is for
  220.    informational purposes only (to tell where people should finish) and should not
  221.    be used for raising error messages.  It suppresses the error that would be
  222.    raised if we have people in a facing 2x2 star thru when they are far from the
  223.    ones they are facing.
  224.  
  225.    SETUPFLAG__PHANTOMS means that we are at a level of recursion in which some phantom concept
  226.    has been used.  When this is set, the "tandem" or "as couples" concepts will
  227.    forgive phantoms wherever they might appear, so that "split phantom lines tandem
  228.    <call>" is legal.  Otherwise, we would have to say "split phantom lines phantom
  229.    tandem <call>.
  230.  
  231.    SETUPFLAG__NO_STEP_TO_WAVE means that we are at a level of recursion that no longer permits us to do the
  232.    implicit step to a wave or rear back from one that some calls permit at the top level.
  233.  
  234.    SETUPFLAG__NO_EXPAND_MATRIX means that we are at a level of recursion that no longer permits us to do the
  235.    implicit expansion of the matrix (e.g. add outboard phantoms to turn a 2x4 into a 2x6
  236.    if the concept "triple box" is used) that some concepts perform at the top level.
  237.  
  238.    SETUPFLAG__DOING_ENDS means that this call is directed only to the ends (and the setup is the ends
  239.    of the original setup.  If the call turns out to be an 8-person call with distinct
  240.    centers and ends parts, we may want to just apply the ends part.  This is what
  241.    makes "ends detour" work.
  242. */
  243.  
  244. #define SETUPFLAG__NO_EXPAND_MATRIX   0x00001000
  245. #define SETUPFLAG__DISTORTED          0x00002000
  246. #define SETUPFLAG__OFFSET_Z           0x00004000
  247. #define SETUPFLAG__SAID_SPLIT         0x00008000
  248. #define SETUPFLAG__SAID_TRIANGLE      0x00010000
  249. /* This one is a 9 bit field -- FRACTIONALIZE_BIT tells where its low bit lies. */
  250. #define SETUPFLAG__FRACTIONALIZE_MASK 0x03FE0000
  251. #define SETUPFLAG__FRACTIONALIZE_BIT  0x00020000
  252. /* This one is a 2 bit field -- ELONGATE_BIT tells where its low bit lies. */
  253. #define SETUPFLAG__ELONGATE_MASK      0x0C000000
  254. #define SETUPFLAG__ELONGATE_BIT       0x04000000
  255. #define SETUPFLAG__NO_CHK_ELONG       0x10000000
  256. #define SETUPFLAG__PHANTOMS           0x20000000
  257. #define SETUPFLAG__NO_STEP_TO_WAVE    0x40000000
  258. #define SETUPFLAG__DOING_ENDS         0x80000000
  259.  
  260. /* Flags that reside in the "setupflags" word of a setup AFTER a call is executed.
  261.    There shouldn't be a problem of conflict with the "before" flags, but we take
  262.    no chances.
  263.  
  264.    RESULTFLAG__EXPAND_TO_2X3 means that a call was executed that takes a four person
  265.    starting setup (typically a line) and yields a 2x3 result setup.  Two of those
  266.    result spots will be phantoms, of course.  When recombining a divided setup in
  267.    which such a call was executed, if the recombination wuold yield a 2x6, and if
  268.    the center 4 spots would be empty, this flag directs divided_setup_move to
  269.    collapse the setup to a 2x4.  This is what makes calls like "pair the line"
  270.    and "step and slide" behave correctly from parallel lines and from a grand line.
  271.  
  272.    RESULTFLAG__DID_LAST_PART means that, when a sequentially defined call was executed
  273.    with the SETUPFLAG__FRACTIONALIZE_MASK nonzero, so that just one part was done,
  274.    that part was the last part.  Hence, if we are doing a call with some "piecewise"
  275.    or "random" concept, we do that parts of the call one at a time, with appropriate
  276.    concepts on each part, until it comes back with this flag set.
  277.  
  278.    RESULTFLAG__ELONGATE_MASK is a 2 bit field that tells, for a 2x2 setup after
  279.    having a call executed, how that 2x2 is elongated in the east-west or
  280.    north-south direction.  Since 2x2's are always totally canonical, the
  281.    interpretation of the elongation direction is always absolute.  A 1 in this
  282.    field means the elongation is east-west.  A 2 means the elongation is
  283.    north-south.  A zero means the elongation is unknown.  These bits will be set
  284.    whenever we know which elongation is preferred.  This will be the case if the
  285.    setup was an elongated 2x2 prior to the call (because they are the ends), or
  286.    the setup was a 1x4 prior to the call.  So, for example, after any recycle
  287.    from a wave, these bits will be set to indicate that the dancers want to
  288.    elongate the 2x2 perpendicular to their original wave.  These bits will be
  289.    looked at only if the call was directed to the ends (starting from a grand
  290.    wave, for example.)  Furthermore, the bits will be overridden if the
  291.    "concentric" or "checkpoint" concepts were used, or if the ends did this
  292.    as part of a concentrically defined call for which some forcing modifier
  293.    such as "force_columns" was used.
  294.  
  295. ******** not true any longer VVVVVVVV *********
  296.    RESULTFLAG__PAR_CONC_END means that, if the call just executed went from a
  297.    2x2 to a 2x2, the call desires that the elongation change, or if the call just
  298.    executed went from a 1x4/diamond to a 2x2, the call desires that the elongation
  299.    be parallel to the original long axis.  The defaults for such calls are, for
  300.    2x2->2x2, that the elongation remain, and, for 1x4->2x2, that the elongation
  301.    be perpendicular to the long axis.  Whatever the outcome of this flag or the
  302.    default, it can be overriden by various concentric invocation flags, or by
  303.    the "concentric" and "checkpoint" concepts.  In general, this flag is taken
  304.    from the corresponding flag in the call definition.  HOWEVER: this is done only
  305.    for calls that are defined for 2x2->2x2 or 1x4->2x2 or dmd->2x2.  If the call
  306.    is defined for 1x2->1x2 and finds itself being executed on a 1x4 or 2x2 (by
  307.    subdividing the setup), the flag from the calls database is IGNORED.  In such
  308.    a case, RESULTFLAG__PAR_CONC_END will be cleared for a 2x2->2x2 transformation
  309.    and set for a 1x4->2x2 transformation, in each case indicating the the call
  310.    desires the elongation to stay the same.
  311.  
  312.    RESULTFLAG__PAR_CONC_UNK means that it is unknown what
  313.    the state of RESULTFLAG__PAR_CONC_END should be, that is, if the call just
  314.    executed went to a 2x2, it is not known what elongation the call prefers.
  315.    This will never be set for any existing calls.  Only compound calls that
  316.    go through an intermediate state which is a star could cause this.
  317. ******** not true any longer ^^^^^^^^ *********
  318.  
  319.    RESULTFLAG__NEED_DIAMOND means that a call has been executed with the "magic" or
  320.    "interlocked" modifier, and it really should be changed to the "magic diamond"
  321.    concept.  Otherwise, we might end up saying "magic diamond single wheel" when
  322.    we should have said "magic diamond, diamond single wheel".
  323. */
  324.  
  325. #define RESULTFLAG__EXPAND_TO_2X3   0x00000002
  326. #define RESULTFLAG__DID_LAST_PART   0x00000004
  327. /* This one is a 2 bit field -- ELONGATE_BIT tells where its low bit lies. */
  328. #define RESULTFLAG__ELONGATE_MASK   0x00000018
  329. #define RESULTFLAG__ELONGATE_BIT    0x00000008
  330. #define RESULTFLAG__NEED_DIAMOND    0x00000020
  331.  
  332. /* It should be noted that the SETUPFLAG__XXX and RESULTFLAG__XXX bits have
  333.    nothing to do with each other.  They just happen to occupy the same word
  334.    before and after the call is executed, respectively.  It is not intended that
  335.    the flags resulting from one call be passed to the next.  In fact, that
  336.    would be incorrect.  The SETUPFLAG__XXX bits should start at zero at the
  337.    beginning of each call, and accumulate stuff as the call goes deeper into
  338.    recursion.  The RESULTFLAG__XXX bits should, in general, be the OR of the
  339.    bits of the components of a compound call, though this is not so for
  340.    RESULTFLAG__PAR_CONC_END. */
  341.  
  342.  
  343.  
  344. typedef struct {
  345.    setup_kind kind;
  346.    int setupflags;
  347.    personrec people[MAX_PEOPLE];
  348.    int rotation;
  349.    small_setup inner;
  350.    small_setup outer;
  351.    int outer_elongation;
  352. } setup;
  353.  
  354. /* BEWARE!!  If change these next definitions, be sure to update the definition of
  355.    "warning_strings" in sdutil.c . */
  356. #define warn__do_your_part        0
  357. #define warn__tbonephantom        1
  358. #define warn__ends_work_to_spots  2
  359. #define warn__awkward_centers     3
  360. #define warn__bad_concept_level   4
  361. #define warn__not_funny           5
  362. #define warn__hard_funny          6
  363. #define warn__unusual             7
  364. #define warn__rear_back           8
  365. #define warn__awful_rear_back     9
  366. #define warn__excess_split        10
  367. #define warn__lineconc_perp       11
  368. #define warn__dmdconc_perp        12
  369. #define warn__lineconc_par        13
  370. #define warn__dmdconc_par         14
  371. #define warn__xclineconc_perp     15
  372. #define warn__xcdmdconc_perp      16
  373. #define warn__ctrstand_endscpls   17
  374. #define warn__ctrscpls_endstand   18
  375. #define warn__each2x2             19
  376. #define warn__each1x4             20
  377. #define warn__each1x2             21
  378. #define warn__take_right_hands    22
  379. #define warn__ctrs_are_dmd        23
  380. #define warn__full_pgram          24
  381. #define warn__offset_gone         25
  382. #define warn__overlap_gone        26
  383. #define warn__to_o_spots          27
  384. #define warn__to_x_spots          28
  385. #define warn__some_rear_back      29
  386. #define warn__not_tbone_person    30
  387. #define warn__check_c1_phan       31
  388. #define warn__check_dmd_qtag      32
  389. #define warn__check_2x4           33
  390. #define warn__check_pgram         34
  391.  
  392.  
  393. /* BEWARE!!  The warning numbers in this set must all be <= 31.  This is a
  394.    mask that is checked against the first word in the warning struct.
  395.    It just isn't worth doing this the really right way. */
  396. #define Warnings_That_Preclude_Searching (1<<warn__do_your_part | 1<<warn__ends_work_to_spots | 1<<warn__awkward_centers | \
  397.                                           1<<warn__hard_funny   | 1<<warn__rear_back          | 1<<warn__awful_rear_back | \
  398.                                           1<<warn__excess_split | \
  399.                                           1<<warn__unusual      | 1<<warn__bad_concept_level  | 1<<warn__not_funny)
  400.  
  401. /* BEWARE!!  The warning numbers in this set must all be <= 31.  This is a
  402.    mask that is cleared if a concentric call was done and the "suppress_elongation_warnings"
  403.    flag was on.  It just isn't worth doing this the really right way. */
  404. #define Warnings_About_Conc_elongation   (1<<warn__lineconc_perp | 1<<warn__dmdconc_perp    | 1<<warn__lineconc_par | \
  405.                                           1<<warn__dmdconc_par   | 1<<warn__xclineconc_perp | 1<<warn__xcdmdconc_perp)
  406.  
  407.  
  408. /* BEWARE!!  If change this next definition, be sure to update the definition of
  409.    "resolve_names" in SDTABLES. */
  410. typedef enum {
  411.    resolve_none,
  412.    resolve_rlg, resolve_la,
  413.    resolve_ext_rlg, resolve_ext_la,
  414.    resolve_circ_rlg, resolve_circ_la,
  415.    resolve_pth_rlg, resolve_pth_la,
  416.    resolve_tby_rlg, resolve_tby_la,
  417.    resolve_xby_rlg, resolve_xby_la,
  418.    resolve_dixie_grand,
  419.    resolve_prom
  420. } resolve_kind;
  421.  
  422. typedef struct {
  423.    resolve_kind kind;
  424.    int distance;
  425. } resolve_indicator;
  426.  
  427. typedef enum {
  428.    mode_none,     /* Not a real mode; used only for
  429.                      fictional purposes in the user interface;
  430.                      never appears in the rest of the program. */
  431.    mode_normal,
  432.    mode_startup,
  433.    mode_resolve
  434. } mode_kind;
  435.  
  436. typedef enum {
  437.     modify_popup_any,
  438.     modify_popup_only_tag,
  439.     modify_popup_only_scoot
  440. } modify_popup_kind;
  441.  
  442. /* These are the values returned by "uims_get_command". */
  443.  
  444. typedef enum {
  445.    ui_command_select,   /* (normal/resolve) User chose one of the special buttons like "resolve" or "quit". */
  446.    ui_resolve_select,   /* (resolve only) User chose one of the various actions peculiar to resolving. */
  447.    ui_start_select,     /* (startup only) User chose something. This is the only outcome in startup mode. */
  448.    ui_concept_select,   /* (normal only) User clicked in the miscellaneous concept menu. */
  449.    ui_call_select,      /* (normal only) User clicked in the current call menu. */
  450.    ui_special_concept   /* (normal only) User clicked in the menu of special concept popup names. */
  451. } uims_reply;
  452.  
  453. /* In each case, an integer or enum is deposited into the global variable uims_menu_index.  Its interpretation
  454.    depends on which of the replies above was given.  For some of the replies, it gives the index
  455.    into a menu.  For "ui_start_select" it is a start_select_kind.
  456.    For other replies, it is one of the following constants: */
  457.  
  458. /* BEWARE!!  This list may need to track some stuff in sdui.c and/or sd.dps . */
  459. /* BEWARE!!  This list must track all the "startinfolist" definitions in sdtables.c . */
  460. typedef enum {
  461.    start_select_exit,        /* Don't start a sequence; exit from the program. */
  462.    start_select_h1p2p,       /* Start with Heads 1P2P. */
  463.    start_select_s1p2p,       /* Etc. */
  464.    start_select_heads_start,
  465.    start_select_sides_start,
  466.    start_select_as_they_are
  467. } start_select_kind;
  468. #define NUM_START_SELECT_KINDS (((int) start_select_as_they_are)+1)
  469.  
  470. /* For ui_command_select: */
  471. typedef enum {
  472.    command_quit,
  473.    command_undo,
  474.    command_abort,
  475.    command_allow_modification,
  476.    command_create_comment,
  477.    command_change_outfile,
  478.    command_getout,
  479.    command_resolve,
  480.    command_reconcile,
  481.    command_anything,
  482.    command_nice_setup,
  483.    command_neglect,
  484.    command_save_pic
  485. } command_kind;
  486. #define NUM_COMMAND_KINDS (((int) command_save_pic)+1)
  487.  
  488. /* For ui_resolve_select: */
  489. typedef enum {
  490.    resolve_command_abort,
  491.    resolve_command_find_another,
  492.    resolve_command_goto_next,
  493.    resolve_command_goto_previous,
  494.    resolve_command_accept,
  495.    resolve_command_raise_rec_point,
  496.    resolve_command_lower_rec_point
  497. } resolve_command_kind;
  498. #define NUM_RESOLVE_COMMAND_KINDS (((int) resolve_command_lower_rec_point)+1)
  499.  
  500. /* BEWARE!!  There may be tables in the user interface file keyed to this enumeration. */
  501. /* In particular, this list must track the array "menu_names" in sdtables.c . */
  502. typedef enum {
  503.    call_list_none, call_list_empty, /* Not real call list kinds; used only for
  504.                                        fictional purposes in the user interface;
  505.                        never appear in the rest of the program. */
  506.    call_list_any,                   /* This is the "universal" call list; used
  507.                                        whenever the setup isn't one of the known ones. */
  508.    call_list_1x8, call_list_l1x8,
  509.    call_list_dpt, call_list_cdpt,
  510.    call_list_rcol, call_list_lcol,
  511.    call_list_8ch, call_list_tby,
  512.    call_list_lin, call_list_lout,
  513.    call_list_rwv, call_list_lwv,
  514.    call_list_r2fl, call_list_l2fl,
  515.    call_list_gcol, call_list_qtag
  516. } call_list_kind;
  517. #define NUM_CALL_LIST_KINDS (((int) call_list_qtag)+1)
  518.  
  519. /* BEWARE!!  
  520.    The last bunch of flags are pushed up against the high end of the word, so that
  521.    they can exactly match some other flags.  The constant HERITABLE_FLAG_MASK
  522.    embraces them.  The flags that must stay in step are in the "FINAL__XXX" group
  523.    in sd.h, the "cflag__xxx" group in database.h, and the "dfm_xxx" group in
  524.    database.h . There is compile-time code in sdinit.c to check that these
  525.    constants are all in step.
  526. */
  527.  
  528. #define FINAL__SPLIT                 0x00000001
  529. #define FINAL__SPLIT_SQUARE_APPROVED 0x00000002
  530. #define FINAL__SPLIT_DIXIE_APPROVED  0x00000004
  531. #define FINAL__MUST_BE_TAG           0x00000008
  532. #define FINAL__MUST_BE_SCOOT         0x00000010
  533. #define FINAL__TRIANGLE              0x00000020
  534. #define FINAL__SPLIT_SEQ_DONE        0x00000040
  535.  
  536. #define FINAL__DIAMOND               0x00400000
  537. #define FINAL__REVERSE               0x00800000
  538. #define FINAL__LEFT                  0x01000000
  539. #define FINAL__FUNNY                 0x02000000
  540. #define FINAL__INTERLOCKED           0x04000000
  541. #define FINAL__MAGIC                 0x08000000
  542. #define FINAL__GRAND                 0x10000000
  543. #define FINAL__12_MATRIX             0x20000000
  544. #define FINAL__CROSS                 0x40000000
  545. #define FINAL__SINGLE                0x80000000
  546.  
  547. typedef unsigned int final_set;
  548.  
  549. typedef long_boolean (*predicate_ptr)(
  550.    setup *real_people,
  551.    int real_index,
  552.    int real_direction,
  553.    int northified_index);
  554.  
  555. typedef struct glosk {
  556.    predicate_ptr pred;
  557.    struct glosk *next;
  558.    /* Dynamically allocated to whatever size is required. */
  559.    unsigned short arr[4];
  560. } predptr_pair;
  561.  
  562. typedef struct glork {
  563.    struct glork *next;
  564.    unsigned int callarray_flags;
  565.    call_restriction restriction;
  566.    search_qualifier qualifier;
  567.    begin_kind start_setup;
  568.    setup_kind end_setup;
  569.    setup_kind end_setup_in;             /* only if end_setup = concentric */
  570.    setup_kind end_setup_out;            /* only if end_setup = concentric */
  571.    union {
  572.       /* Dynamically allocated to whatever size is required. */
  573.       unsigned short def[4];     /* only if pred = false */
  574.       struct {                   /* only if pred = true */
  575.          predptr_pair *predlist;
  576.          /* Dynamically allocated to whatever size is required. */
  577.          char errmsg[4];
  578.       } prd;
  579.    } stuff;
  580. } callarray;
  581.  
  582. typedef struct glonk {
  583.    char txt[80];
  584.    struct glonk *nxt;
  585. } comment_block;
  586.  
  587. typedef struct flonk {
  588.    char txt[80];
  589.    struct flonk *nxt;
  590. } outfile_block;
  591.  
  592. typedef int defmodset;
  593.  
  594. typedef struct {
  595.    short call_id;
  596.    defmodset modifiers;
  597. } by_def_item;
  598.  
  599. typedef struct glowk {
  600.    int modifier_set;
  601.    callarray *callarray_list;
  602.    struct glowk *next;
  603.    level modifier_level;
  604. } calldef_block;
  605.  
  606. typedef struct {
  607.    int callflags;
  608.    int age;
  609.    calldef_schema schema;
  610.    union {
  611.       struct {
  612.          calldef_block *def_list;
  613.       } arr;            /* if schema = schema_by_array */
  614.       struct {
  615.          int flags;
  616.          short stuff[8];
  617.       } matrix;         /* if schema = schema_matrix or schema_partner_matrix */
  618.       struct {
  619.          by_def_item defarray[SEQDEF_MAX+1];
  620.       } def;            /* if schema = schema_by_def */
  621.       struct {
  622.          by_def_item innerdef;
  623.          by_def_item outerdef;
  624.       } conc;           /* if schema = schema_concentric, schema_concentric_6_2, schema_concentric_2_6, schema_cross_concentric, schema_concentric_diamond_line */
  625.    } stuff;
  626.    /* Dynamically allocated to whatever size is required, will have trailing null. */
  627.    char name[4];
  628. } callspec_block;
  629.  
  630. /* BEWARE!!  This list must track all the "map_hunk" definitions in sdtables.c . */
  631. typedef enum {
  632.    MPKIND__NONE,
  633.    MPKIND__SPLIT,
  634.    MPKIND__REMOVED,
  635.    MPKIND__OVERLAP,
  636.    MPKIND__INTLK,
  637.    MPKIND__OFFS_L_HALF,
  638.    MPKIND__OFFS_R_HALF,
  639.    MPKIND__OFFS_L_FULL,
  640.    MPKIND__OFFS_R_FULL,
  641.    MPKIND__O_SPOTS,
  642.    MPKIND__X_SPOTS,
  643.    MPKIND__4_QUADRANTS,
  644.    MPKIND__DMD_STUFF
  645. } mpkind;
  646.  
  647. typedef struct {
  648.    veryshort map1[8];
  649.    veryshort map2[8];
  650.    veryshort map3[8];
  651.    veryshort map4[8];
  652.    mpkind map_kind;
  653.    int arity;
  654.    setup_kind outer_kind;
  655.    setup_kind inner_kind;
  656.    int rot;
  657.    int vert;
  658. } map_thing;
  659.  
  660. typedef map_thing *map_hunk[][2];
  661.  
  662. typedef struct {
  663.    setup_kind result_kind;
  664.    int xfactor;
  665.    veryshort xca[24];
  666.    veryshort yca[24];
  667.    veryshort diagram[64];
  668. } coordrec;
  669.  
  670.  
  671. /* BEWARE!!  This list must track the array "concept_table" in sd.c . */
  672. typedef enum {
  673.  
  674. /* These next few are not concepts.  Their appearance marks
  675.    the final end of the concept list.  It has a selector and number
  676.    specifier following, and then the call itself. */
  677.  
  678.    concept_another_call_next_mod,         /* calla modified by callb */
  679.    concept_another_call_next_modreact,    /* calla, which is a "scoot reaction" type, modified by callb */
  680.    concept_another_call_next_modtag,      /* calla, which is a "tag your neighbor" type, modified by callb */
  681.    concept_another_call_next_force,       /* calla, old subcall, changed to callb */
  682.    concept_mod_declined,                  /* user was queried about modification, and said no. */
  683.    marker_end_of_list,                    /* normal case */
  684.  
  685. /* This is not a concept.  Its appearance indicates a comment is to be placed here. */
  686.  
  687.    concept_comment,
  688.  
  689. /* Everything after this is a real concept. */
  690.  
  691.    concept_concentric,
  692.    concept_single_concentric,
  693.    concept_tandem,
  694.    concept_phantom_tandem,
  695.    concept_gruesome_tandem,
  696.    concept_some_are_tandem,
  697.    concept_frac_tandem,
  698.    concept_phantom_frac_tandem,
  699.    concept_gruesome_frac_tandem,
  700.    concept_some_are_frac_tandem,
  701.    concept_checkerboard,
  702.    concept_reverse,
  703.    concept_left,
  704.    concept_grand,
  705.    concept_magic,
  706.    concept_cross,
  707.    concept_single,
  708.    concept_interlocked,
  709.    concept_12_matrix,
  710.    concept_funny,
  711.    concept_randomtrngl,
  712.    concept_selbasedtrngl,
  713.    concept_split,
  714.    concept_diamond,
  715.    concept_triangle,
  716.    concept_do_both_boxes,
  717.    concept_once_removed,
  718.    concept_do_phantom_2x2,
  719.    concept_do_phantom_boxes,
  720.    concept_do_phantom_diamonds,
  721.    concept_do_phantom_1x6,
  722.    concept_do_phantom_1x8,
  723.    concept_do_phantom_2x4,
  724.    concept_do_phantom_2x3,
  725.    concept_divided_2x4,
  726.    concept_divided_2x3,
  727.    concept_distorted,
  728.    concept_single_diagonal,
  729.    concept_double_diagonal,
  730.    concept_parallelogram,
  731.    concept_triple_lines,
  732.    concept_triple_lines_together,
  733.    concept_quad_lines,
  734.    concept_quad_lines_together,
  735.    concept_quad_boxes,
  736.    concept_quad_boxes_together,
  737.    concept_triple_boxes,
  738.    concept_triple_boxes_together,
  739.    concept_triple_diamonds,
  740.    concept_triple_diamonds_together,
  741.    concept_quad_diamonds,
  742.    concept_quad_diamonds_together,
  743.    concept_triple_diag,
  744.    concept_triple_diag_together,
  745.    concept_triple_twin,
  746.    concept_misc_distort,
  747.    concept_old_stretch,
  748.    concept_new_stretch,
  749.    concept_c1_phantom,
  750.    concept_grand_working,
  751.    concept_centers_or_ends,
  752.    concept_so_and_so_only,
  753.    concept_some_vs_others,
  754.    concept_stable,
  755.    concept_so_and_so_stable,
  756.    concept_frac_stable,
  757.    concept_so_and_so_frac_stable,
  758.    concept_standard,
  759.    concept_double_offset,
  760.    concept_checkpoint,
  761.    concept_on_your_own,
  762.    concept_trace,
  763.    concept_ferris,
  764.    concept_centers_and_ends,
  765.    concept_sequential,
  766.    concept_meta,
  767.    concept_so_and_so_begin,
  768.    concept_nth_part,
  769.    concept_replace_nth_part,
  770.    concept_interlace,
  771.    concept_fractional,
  772.    concept_rigger,
  773.    concept_callrigger
  774. } concept_kind;
  775.  
  776. /* These flags go into the "concept_prop" field of a "concept_table_item". */
  777.  
  778. /* This means that the concept takes a second call, so a sublist must
  779.    be created, with a pointer to same just after the concept pointer. */
  780. #define CONCPROP__SECOND_CALL     0x00000001
  781. /* This means that the concept requires a selector, which must be
  782.    inserted into the concept list just after the concept pointer. */
  783. #define CONCPROP__USE_SELECTOR    0x00000002
  784. /* These mean that the concept requires the indicated setup, and, at
  785.    the top level, the existing setup should be expanded as needed. */
  786. #define CONCPROP__NEED_4X4        0x00000004
  787. #define CONCPROP__NEED_2X8        0x00000008
  788. #define CONCPROP__NEED_2X6        0x00000010
  789. #define CONCPROP__NEED_4DMD       0x00000020
  790. #define CONCPROP__NEED_BLOB       0x00000040
  791. #define CONCPROP__NEED_4X6        0x00000080
  792. /* This means that phantoms are in use under this concept, so that,
  793.    when looking for tandems or couples, we shouldn't be disturbed if we
  794.    pair someone with a phantom.  It is what makes "split phantom lines tandem"
  795.    work, so that "split phantom lines phantom tandem" is unnecessary. */
  796. #define CONCPROP__SET_PHANTOMS    0x00000100
  797. /* This means that stepping to a wave or rearing back from one is not
  798.    allowed under this concept. */
  799. #define CONCPROP__NO_STEP         0x00000200
  800. /* This means that tbonetest & livemask need to be computed before executing the concept. */
  801. #define CONCPROP__GET_MASK        0x00000400
  802. /* This means that the concept can be "standard". */
  803. #define CONCPROP__STANDARD        0x00000800
  804. /* If a concept takes one number, only CONCPROP__USE_NUMBER is set.
  805.    If it takes two numbers both bits are set. */
  806. #define CONCPROP__USE_NUMBER      0x00001000
  807. #define CONCPROP__USE_TWO_NUMBERS 0x00002000
  808. #define CONCPROP__NEED_3DMD       0x00004000
  809. #define CONCPROP__NEED_3X4_1X12   0x00008000
  810. #define CONCPROP__NEED_3X4        0x00010000
  811. #define CONCPROP__NEED_4X4_1X16   0x00020000
  812.  
  813. typedef enum {    /* These control error messages that arise when we divide a setup
  814.                      into subsetups (e.g. phantom lines) and find that one of
  815.                      the setups is empty.  For example, if we are in normal lines
  816.                      and select "phantom lines", it will notice that one of the setups
  817.                      (the outer one) isn't occupied and will give the error message
  818.                      "Don't use phantom concept if you don't mean it." */
  819.  
  820.    phantest_ok,               /* Anything goes */
  821.    phantest_impossible,       /* Can't happen in symmetric stuff?? */
  822.    phantest_both,             /* Require both setups (partially) occupied */
  823.    phantest_only_one,         /* Require only one setup occupied, don't care which */
  824.    phantest_only_first_one,   /* Require only first setup occupied, second empty */
  825.    phantest_only_second_one,  /* Require only second setup occupied, first empty */
  826.    phantest_first_or_both,    /* Require first setup only, or a mixture */
  827.    phantest_2x2_both,
  828.    phantest_2x2_only_two,
  829.    phantest_not_just_centers
  830. } phantest_kind;
  831.  
  832. typedef enum {
  833.    disttest_t, disttest_nil, disttest_only_two,
  834.    disttest_any, disttest_offset, disttest_z} disttest_kind;
  835.  
  836. /* BEWARE!!  If change this next definition, be sure to update the definition of
  837.    "selector_names" and "selector_singular" in SDUTIL, and also necessary stuff in SDUI. */
  838. typedef enum {
  839.    selector_uninitialized,
  840.    selector_boys,
  841.    selector_girls,
  842.    selector_heads,
  843.    selector_sides,
  844.    selector_headcorners,
  845.    selector_sidecorners,
  846.    selector_headboys,
  847.    selector_headgirls,
  848.    selector_sideboys,
  849.    selector_sidegirls,
  850.    selector_centers,
  851.    selector_ends,
  852.    selector_leads,
  853.    selector_trailers,
  854.    selector_beaux,
  855.    selector_belles,
  856.    selector_center2,
  857.    selector_center6,
  858.    selector_outer2,
  859.    selector_outer6,
  860.    selector_nearline,
  861.    selector_farline,
  862.    selector_nearcolumn,
  863.    selector_farcolumn,
  864.    selector_nearbox,
  865.    selector_farbox,
  866.    selector_all,
  867.    selector_none
  868. } selector_kind;
  869. #define last_selector_kind ((int) selector_none)
  870.  
  871. typedef struct {
  872.    char *name;
  873.    concept_kind kind;
  874.    level level;
  875.    struct {
  876.       map_thing *maps;
  877.       int arg1;
  878.       int arg2;
  879.       int arg3;
  880.       int arg4;
  881.       int arg5;
  882.    } value;
  883. } concept_descriptor;
  884.  
  885. typedef enum {
  886.    simple_normalize,
  887.    normalize_before_isolated_call,
  888.    normalize_before_merge
  889. } normalize_level;
  890.  
  891. typedef struct glock {
  892.    concept_descriptor *concept;   /* the concept or end marker */
  893.    callspec_block *call;          /* if this is end mark, gives the call; otherwise unused */
  894.    struct glock *next;            /* next concept, or, if this is end mark, points to substitution list */
  895.    struct glock *subsidiary_root; /* for concepts that take a second call, this is its parse root */
  896.    struct glock *gc_ptr;          /* used for reclaiming dead blocks */
  897.    selector_kind selector;        /* selector, if any, used by concept or call */
  898.    int number;                    /* number, if any, used by concept or call */
  899. } parse_block;
  900.  
  901. typedef struct {
  902.    int bits[2];
  903. } warning_info;
  904.  
  905. typedef struct {           /* This record is one state in the evolving sequence. */
  906.    parse_block *command_root;
  907.    setup state;
  908.    resolve_indicator resolve_flag;
  909.    long_boolean draw_pic;
  910.    warning_info warnings;
  911.    int centersp;           /* only nonzero for history[1] */
  912.    int text_line;          /* how many lines of text existed after this item was written,
  913.                               only meaningful if "written_history_items" is >= this index */
  914. } configuration;
  915.  
  916. typedef struct {
  917.    parse_block **concept_write_save_ptr;
  918.    concept_kind save_concept_kind;
  919. } parse_stack_item;
  920.  
  921. typedef struct {
  922.    parse_stack_item parse_stack[40];
  923.    int parse_stack_index;
  924.    parse_block **concept_write_ptr;
  925.    parse_block **concept_write_base;
  926.    char *specialprompt;
  927.    int topcallflags;
  928.    call_list_kind call_list_to_use;
  929. } parse_state_type;
  930.  
  931. typedef struct {
  932.    unsigned int concept_prop;      /* Takes bits of the form CONCPROP__??? */
  933.    void (*concept_action)(setup *, parse_block *, setup *);
  934. } concept_table_item;
  935.  
  936. typedef enum {
  937.    file_write_no,
  938.    file_write_double
  939. } file_write_flag;
  940.  
  941. typedef enum {
  942.    call_list_mode_none,
  943.    call_list_mode_writing,
  944.    call_list_mode_writing_full,
  945.    call_list_mode_abridging
  946. } call_list_mode_t;
  947.  
  948. typedef struct {
  949.    char *name;
  950.    long_boolean into_the_middle;
  951.    setup the_setup;
  952. } startinfo;
  953.  
  954. /* BEWARE!!  This next definition is keyed to stuff in SDRESOLVE, particularly the array "title_string". */
  955. typedef enum {search_anything, search_nice_setup, search_resolve, search_reconcile} search_kind;
  956.  
  957. #define cross_by_level l_c1
  958. #define dixie_grand_level l_plus
  959.  
  960. typedef struct {           /* This is done to preserve the encapsulation of type "jmp_buf".                  */
  961.    jmp_buf the_buf;        /*   We are going to use pointers to these things.  If we simply used             */
  962. } real_jmp_buf;            /*   pointers to jmp_buf, the semantics would not be transparent if jmp_buf       */
  963.                            /*   were defined as an array.  The semantics of pointers to arrays are different */
  964.                            /*   from those of pointers to other types, and are not transparent.              */
  965.                            /*   In particular, we would need to look inside the include file to see what     */
  966.                            /*   underlying type jmp_buf is an array of, which would violate the principle    */
  967.                            /*   of type encapsulation.                                                       */
  968.  
  969.  
  970. /* Values returned by the various popup routines: */
  971. #define POPUP_DECLINE 0
  972. #define POPUP_ACCEPT  1
  973. #define POPUP_ACCEPT_WITH_STRING 2
  974.  
  975.  
  976. /* VARIABLES */
  977.  
  978. extern real_jmp_buf longjmp_buffer;                                 /* in SDUTIL */
  979. extern real_jmp_buf *longjmp_ptr;                                   /* in SDUTIL */
  980. extern configuration history[];                                     /* in SDUTIL */
  981. extern int history_ptr;                                             /* in SDUTIL */
  982. extern int written_history_items;                                   /* in SDUTIL */
  983. extern int written_history_nopic;                                   /* in SDUTIL */
  984. extern parse_block *last_magic_diamond;                             /* in SDUTIL */
  985. extern char error_message1[MAX_ERR_LENGTH];                         /* in SDUTIL */
  986. extern char error_message2[MAX_ERR_LENGTH];                         /* in SDUTIL */
  987. extern unsigned int collision_person1;                              /* in SDUTIL */
  988. extern unsigned int collision_person2;                              /* in SDUTIL */
  989. extern long_boolean enable_file_writing;                            /* in SDUTIL */
  990. extern char *selector_names[];                                      /* in SDUTIL */
  991.  
  992. extern int global_tbonetest;                                        /* in SD */
  993. extern int global_livemask;                                         /* in SD */
  994. extern int global_selectmask;                                       /* in SD */
  995. extern concept_table_item concept_table[];                          /* in SD */
  996.  
  997. extern int general_concept_size;                                    /* in SDTABLES */
  998. extern int general_concept_offset;                                  /* in SDTABLES */
  999. extern int *concept_offset_tables[];                                /* in SDTABLES */
  1000. extern int *concept_size_tables[];                                  /* in SDTABLES */
  1001. extern char *concept_menu_strings[];                                /* in SDTABLES */
  1002. extern callspec_block **main_call_lists[NUM_CALL_LIST_KINDS];       /* in SDTABLES */
  1003. extern int number_of_calls[NUM_CALL_LIST_KINDS];                    /* in SDTABLES */
  1004. extern level calling_level;                                         /* in SDTABLES */
  1005. extern char *getout_strings[];                                      /* in SDTABLES */
  1006. extern char *filename_strings[];                                    /* in SDTABLES */
  1007. extern char *resolve_names[];                                       /* in SDTABLES */
  1008. extern char *resolve_distances[];                                   /* in SDTABLES */
  1009. extern char *menu_names[];                                          /* in SDTABLES */
  1010. extern begin_kind keytab[][2];                                      /* in SDTABLES */
  1011. extern coordrec *setup_coords[];                                    /* in SDTABLES */
  1012. extern coordrec *nice_setup_coords[];                               /* in SDTABLES */
  1013. extern int setup_limits[];                                          /* in SDTABLES */
  1014. extern int begin_sizes[];                                           /* in SDTABLES */
  1015. extern startinfo startinfolist[];                                   /* in SDTABLES */
  1016.  
  1017. extern map_thing map_b6_trngl;                                      /* in SDTABLES */
  1018. extern map_thing map_s6_trngl;                                      /* in SDTABLES */
  1019. extern map_thing map_2x2v;                                          /* in SDTABLES */
  1020. extern map_thing map_4x4v;                                          /* in SDTABLES */
  1021. extern map_thing map_2x4_magic;                                     /* in SDTABLES */
  1022. extern map_thing map_qtg_magic;                                     /* in SDTABLES */
  1023. extern map_thing map_qtg_intlk;                                     /* in SDTABLES */
  1024. extern map_thing map_qtg_magic_intlk;                               /* in SDTABLES */
  1025. extern map_thing map_ptp_magic;                                     /* in SDTABLES */
  1026. extern map_thing map_ptp_intlk;                                     /* in SDTABLES */
  1027. extern map_thing map_ptp_magic_intlk;                               /* in SDTABLES */
  1028. extern map_thing map_4x4_ns;                                        /* in SDTABLES */
  1029. extern map_thing map_4x4_ew;                                        /* in SDTABLES */
  1030. extern map_thing map_offset;                                        /* in SDTABLES */
  1031. extern map_thing map_ov_s2x4_k;                                     /* in SDTABLES */
  1032. extern map_thing map_dbloff1;                                       /* in SDTABLES */
  1033. extern map_thing map_dbloff2;                                       /* in SDTABLES */
  1034. extern map_thing map_trngl_box1;                                    /* in SDTABLES */
  1035. extern map_thing map_trngl_box2;                                    /* in SDTABLES */
  1036. extern map_thing map_lh_s2x3_3;                                     /* in SDTABLES */
  1037. extern map_thing map_lh_s2x3_2;                                     /* in SDTABLES */
  1038. extern map_thing map_rh_s2x3_3;                                     /* in SDTABLES */
  1039. extern map_thing map_rh_s2x3_2;                                     /* in SDTABLES */
  1040. extern map_thing map_lf_s2x4_r;                                     /* in SDTABLES */
  1041. extern map_thing map_rf_s2x4_r;                                     /* in SDTABLES */
  1042. extern map_thing map_dmd_1x1;                                       /* in SDTABLES */
  1043. extern map_thing *maps_3diag[4];                                    /* in SDTABLES */
  1044. extern map_thing *maps_3diagwk[4];                                  /* in SDTABLES */
  1045. extern map_hunk *map_lists[][4];                                    /* in SDTABLES */
  1046.  
  1047. extern concept_descriptor special_magic;                            /* in SDTABLES */
  1048. extern concept_descriptor special_interlocked;                      /* in SDTABLES */
  1049. extern concept_descriptor mark_end_of_list;                         /* in SDTABLES */
  1050. extern concept_descriptor marker_decline;                           /* in SDTABLES */
  1051. extern concept_descriptor marker_concept_mod;                       /* in SDTABLES */
  1052. extern concept_descriptor marker_concept_modreact;                  /* in SDTABLES */
  1053. extern concept_descriptor marker_concept_modtag;                    /* in SDTABLES */
  1054. extern concept_descriptor marker_concept_force;                     /* in SDTABLES */
  1055. extern concept_descriptor marker_concept_comment;                   /* in SDTABLES */
  1056. extern concept_descriptor concept_descriptor_table[];               /* in SDTABLES */
  1057. extern int nice_setup_concept[];                                    /* in SDTABLES */
  1058.  
  1059. /*
  1060. extern comment_block *comment_root;
  1061. extern comment_block *comment_last;
  1062. */
  1063.  
  1064. extern int abs_max_calls;                                           /* in SDMAIN */
  1065. extern int max_base_calls;                                          /* in SDMAIN */
  1066. extern callspec_block **base_calls;                                 /* in SDMAIN */
  1067. extern char outfile_string[];                                       /* in SDMAIN */
  1068. extern int last_file_position;                                      /* in SDMAIN */
  1069. extern int global_age;                                              /* in SDMAIN */
  1070. extern parse_state_type parse_state;                                /* in SDMAIN */
  1071. extern int uims_menu_index;                                         /* in SDMAIN */
  1072. extern char major_database_version[20];                             /* in SDMAIN */
  1073. extern char minor_database_version[20];                             /* in SDMAIN */
  1074. extern int whole_sequence_low_lim;                                  /* in SDMAIN */
  1075. extern long_boolean not_interactive;                                /* in SDMAIN */
  1076. extern long_boolean initializing_database;                          /* in SDMAIN */
  1077. extern long_boolean testing_fidelity;                               /* in SDMAIN */
  1078. extern selector_kind selector_for_initialize;                       /* in SDMAIN */
  1079.  
  1080. extern int random_number;                                           /* in SDSI */
  1081. extern int hashed_randoms;                                          /* in SDSI */
  1082. extern char *database_filename;                        /* in SDSI */
  1083.  
  1084. extern selector_kind current_selector;                              /* in PREDS */
  1085. extern long_boolean selector_used;                                  /* in PREDS */
  1086. extern long_boolean (*pred_table[])(                                /* in PREDS */
  1087.    setup *real_people,
  1088.    int real_index,
  1089.    int real_direction,
  1090.    int northified_index);
  1091.  
  1092.  
  1093. /* In SDMAIN */
  1094.  
  1095. extern parse_block *mark_parse_blocks(void);
  1096. extern void release_parse_blocks_to_mark(parse_block *mark_point);
  1097. extern void initialize_parse(void);
  1098. extern void save_parse_state(void);
  1099. extern long_boolean restore_parse_state(void);
  1100. extern parse_block *copy_parse_tree(parse_block *original_tree);
  1101. extern long_boolean deposit_call(callspec_block *call);
  1102. extern long_boolean deposit_concept(concept_descriptor *conc);
  1103. extern long_boolean query_for_call(void);
  1104. extern void get_real_subcall(
  1105.    parse_block *parseptr,
  1106.    by_def_item *item,
  1107.    final_set concin,
  1108.    parse_block **concptrout,
  1109.    callspec_block **callout,
  1110.    final_set *concout);
  1111.  
  1112. /* In PREDS */
  1113.  
  1114. extern long_boolean selectp(setup *ss, int place);
  1115.  
  1116. /* In SDINIT */
  1117.  
  1118. extern void initialize_menus(call_list_mode_t call_list_mode);
  1119.  
  1120. /* In SDSI */
  1121.  
  1122. extern void general_initialize(void);
  1123. extern int generate_random_number(int modulus);
  1124. extern long_boolean generate_random_concept_p(void);
  1125. extern void *get_mem(unsigned int siz);
  1126. extern void free_mem(void *ptr);
  1127. extern void get_date(char dest[]);
  1128. extern void unparse_number(int arg, char dest[]);
  1129. extern void open_file(void);
  1130. extern long_boolean probe_file(char filename[]);
  1131. extern void write_file(char line[]);
  1132. extern void close_file(void);
  1133. extern void print_line(char s[]);
  1134. extern void print_id_error(int n);
  1135. extern void init_error(char s[]);
  1136. extern void add_resolve_indices(char junk[], int cur, int max);
  1137. extern void final_exit(int code);
  1138. extern void open_database(void);
  1139. extern int read_from_database(void);
  1140. extern void close_database(void);
  1141. extern void fill_in_neglect_percentage(char junk[], int n);
  1142. extern int parse_number(char junk[]);
  1143. extern long_boolean open_call_list_file(call_list_mode_t call_list_mode, char filename[]);
  1144. extern char *read_from_call_list_file(char name[], int n);
  1145. extern void write_to_call_list_file(char name[]);
  1146. extern long_boolean close_call_list_file(void);
  1147.  
  1148. /* In SDUI */
  1149.  
  1150. extern void uims_process_command_line(int *argcp, char *argv[]);
  1151. extern void uims_preinitialize(void);
  1152. extern void uims_add_call_to_menu(call_list_kind cl, int call_menu_index, char name[]);
  1153. extern void uims_finish_call_menu(call_list_kind cl, char menu_name[]);
  1154. extern void uims_postinitialize(void);
  1155. extern int uims_do_outfile_popup(char dest[]);
  1156. extern int uims_do_comment_popup(char dest[]);
  1157. extern int uims_do_getout_popup(char dest[]);
  1158. extern int uims_do_abort_popup(void);
  1159. extern int uims_do_neglect_popup(char dest[]);
  1160. extern int uims_do_selector_popup(void);
  1161. extern int uims_do_quantifier_popup(void);
  1162. extern int uims_do_modifier_popup(char callname[], modify_popup_kind kind);
  1163. extern int uims_do_concept_popup(int kind);
  1164. extern void uims_reduce_line_count(int n);
  1165. extern void uims_add_new_line(char the_line[]);
  1166. extern uims_reply uims_get_command(mode_kind mode, call_list_kind call_menu, int modifications_flag);
  1167. extern void uims_update_resolve_menu(char *title);
  1168. extern void uims_terminate(void);
  1169. extern char *uims_version_string(void);
  1170.  
  1171. /* In SDUTIL */
  1172.  
  1173. extern void clear_screen(void);
  1174. extern void writestuff(char s[]);
  1175. extern void newline(void);
  1176. extern void doublespace_file(void);
  1177. extern void exit_program(int code);
  1178. extern void fail(char s[]);
  1179. extern void fail2(char s1[], char s2[]);
  1180. extern void specialfail(char s[]);
  1181. extern void string_copy(char **dest, char src[]);
  1182. extern void display_initial_history(int upper_limit, int num_pics);
  1183. extern void write_history_line(int history_index, char *header, long_boolean picture, file_write_flag write_to_file);
  1184. extern void warn(int w);
  1185. extern call_list_kind find_proper_call_list(setup *s);
  1186. extern callarray *assoc(begin_kind key, setup *ss, callarray *spec);
  1187. extern unsigned int find_calldef(
  1188.    callarray *tdef,
  1189.    setup *scopy,
  1190.    int real_index,
  1191.    int real_direction,
  1192.    int northified_index);
  1193. extern void clear_people(setup *z);
  1194. extern unsigned int rotperson(unsigned int n, int amount);
  1195. extern unsigned int rotcw(unsigned int n);
  1196. extern unsigned int rotccw(unsigned int n);
  1197. extern void clear_person(setup *resultpeople, int resultplace);
  1198. extern unsigned int copy_person(setup *resultpeople, int resultplace, setup *sourcepeople, int sourceplace);
  1199. extern unsigned int copy_rot(setup *resultpeople, int resultplace, setup *sourcepeople, int sourceplace, int rotamount);
  1200. extern void swap_people(setup *ss, int oneplace, int otherplace);
  1201. extern void install_person(setup *resultpeople, int resultplace, setup *sourcepeople, int sourceplace);
  1202. extern void install_rot(setup *resultpeople, int resultplace, setup *sourcepeople, int sourceplace, int rotamount);
  1203. extern parse_block *process_final_concepts(
  1204.    parse_block *cptr,
  1205.    long_boolean check_errors,
  1206.    final_set *final_concepts);
  1207. extern long_boolean fix_n_results(int arity, setup z[]);
  1208. extern void divided_setup_move(
  1209.    setup *ss,
  1210.    parse_block *parseptr,
  1211.    callspec_block *callspec,
  1212.    final_set final_concepts,
  1213.    map_thing *maps,
  1214.    phantest_kind phancontrol,
  1215.    long_boolean recompute_id,
  1216.    setup *result);
  1217. extern void overlapped_setup_move(setup *s, map_thing *maps,
  1218.    int m1, int m2, int m3, parse_block *parseptr, setup *result);
  1219.  
  1220. /* In SDGETOUT */
  1221.  
  1222. extern resolve_indicator resolve_p(setup *s);
  1223. extern uims_reply full_resolve(search_kind goal);
  1224.  
  1225. /* In SDBASIC */
  1226.  
  1227. extern void mirror_this(setup *s);
  1228.  
  1229. extern void basic_move(
  1230.    setup *ss,
  1231.    parse_block *parseptr,
  1232.    callspec_block *callspec,
  1233.    final_set final_concepts,
  1234.    int tbonetest,
  1235.    long_boolean fudged,
  1236.    setup *result);
  1237.  
  1238. /* In SDMOVES */
  1239.  
  1240. extern void reinstate_rotation(setup *ss, setup *result);
  1241. extern void canonicalize_rotation(setup *result);
  1242.  
  1243. extern void move(
  1244.    setup *ss,
  1245.    parse_block *parseptr,
  1246.    callspec_block *callspec,
  1247.    final_set final_concepts,
  1248.    long_boolean qtfudged,
  1249.    setup *result);
  1250.  
  1251. /* In SDISTORT */
  1252.  
  1253. extern void distorted_2x2s_move(
  1254.    setup *ss,
  1255.    parse_block *parseptr,
  1256.    setup *result);
  1257.  
  1258. extern void distorted_move(
  1259.    setup *ss,
  1260.    parse_block *parseptr,
  1261.    setup *result);
  1262.  
  1263. extern void triple_twin_move(
  1264.    setup *ss,
  1265.    parse_block *parseptr,
  1266.    setup *result);
  1267.  
  1268. extern void do_concept_rigger(
  1269.    setup *ss,
  1270.    parse_block *parseptr,
  1271.    setup *result);
  1272.  
  1273. extern void do_concept_callrigger(
  1274.    setup *ss,
  1275.    parse_block *parseptr,
  1276.    setup *result);
  1277.  
  1278. /* In SD12 */
  1279.  
  1280. extern void triangle_move(
  1281.    setup *s,
  1282.    parse_block *parseptr,
  1283.    setup *result);
  1284.  
  1285. /* In SD16 */
  1286.  
  1287. extern void phantom_2x4_move(
  1288.    setup *ss,
  1289.    int lineflag,
  1290.    phantest_kind phantest,
  1291.    map_thing *maps,
  1292.    parse_block *parseptr,
  1293.    setup *result);
  1294.  
  1295. /* In SD */
  1296.  
  1297. extern long_boolean do_big_concept(
  1298.    setup *ss,
  1299.    parse_block *parseptr,
  1300.    setup *result);
  1301.  
  1302. /* In SDTAND */
  1303.  
  1304. extern void tandem_couples_move(
  1305.    setup *ss,
  1306.    parse_block *parseptr,
  1307.    callspec_block *callspec,
  1308.    final_set final_concepts,
  1309.    selector_kind selector,
  1310.    int twosome,               /* solid=0 / twosome=1 / solid-to-twosome=2 / twosome-to-solid=3 */
  1311.    int fraction,              /* number, if doing fractional twosome/solid */
  1312.    int phantom,               /* normal=0 / phantom=1 / gruesome=2 */
  1313.    int tnd_cpl_siam,          /* tandem=0 / couples=1 / siamese=2 / skew=3 */
  1314.    setup *result);
  1315.  
  1316. extern void initialize_tandem_tables(void);
  1317.  
  1318. /* In SDCONC */
  1319.  
  1320. extern void concentric_move(
  1321.    setup *ss,
  1322.    parse_block *parsein,
  1323.    parse_block *parseout,
  1324.    callspec_block *callspecin,
  1325.    callspec_block *callspecout,
  1326.    final_set final_conceptsin,
  1327.    final_set final_conceptsout,
  1328.    calldef_schema analyzer,
  1329.    defmodset modifiersin,
  1330.    defmodset modifiersout,
  1331.    setup *result);
  1332.  
  1333. extern void normalize_concentric(
  1334.    calldef_schema synthesizer,
  1335.    int center_arity,
  1336.    setup inners[],
  1337.    setup *outers,
  1338.    int outer_elongation,
  1339.    setup *result);
  1340.  
  1341. extern void merge_setups(setup *ss, setup *result);
  1342.  
  1343. extern void on_your_own_move(
  1344.    setup *ss,
  1345.    parse_block *parseptr,
  1346.    setup *result);
  1347.  
  1348. extern void so_and_so_only_move(
  1349.    setup *ss,
  1350.    parse_block *parseptr,
  1351.    setup *result);
  1352.  
  1353. /* In SDTOP */
  1354.  
  1355. extern void update_id_bits(setup *ss);
  1356.  
  1357. extern void touch_or_rear_back(
  1358.    setup *scopy,
  1359.    int callflags);
  1360.  
  1361. extern void do_matrix_expansion(setup *ss, concept_kind ckind);
  1362.  
  1363. extern void normalize_setup(setup *ss, normalize_level level);
  1364.  
  1365. extern void toplevelmove(void);
  1366.