DAC-port functions:

//----------------------------------------------------------------
/*

pm_ChangeAttr() supports currently only two tags, other will be
ignored:

*/

DAC_ASYNC_RUN   (BOOL)  TRUE    /* If you want to run
                                   asynchronously to BareED. */
            
DEFAULT FALSE

DAC_UNIQUE_RUN  (BOOL)  TRUE    /* If you want only one running
                                   copy of your program; when the
                                   user selects once more in the
                                   DAC-menu your program item,
                                   you'll receive a
                                   "SIGBREAK_CTRL_F" signal. */

            
NOTE: Once "DAC_UNIQUE_RUN" has been established you
                  have to reset it before your program quits!

            DEFAULT  
FALSE

//----------------------------------------------------------------
/*

pm_GetAttr() supports following:

*/

DAC_VERSION         (ULONG// Version of DAC-port
DAC_ARCHIVE_START   (ULONG/* To get address first character in
                               archive */
DAC_ARCHIVE_END     (ULONG// To get last character in archive
DAC_ARCHIVE_LENGTH  (ULONG// Amount characters in archive
DAC_PAGEUPDATE_MESSAGE  (struct PageUpdateMsg *) /* By you set up
                     message which will be filled in and returned
                     by BareED */
DAC_BG_PEN          (ULONG)  /* Background pen value (not a colour
                                value) */
DAC_FG_PEN          (ULONG)  // ditto, only for foreground
DAC_WINDOW          (struct Window *)   // BareED's editor window
DAC_SCREEN          (struct Screen *)   /* BareED's custom screen
                     or NULL if no own screen */
DAC_VISUAL_INFO     (void VisualInfo *) /* VisualInfo pointer for
                    system to create correct GUI elements */
DAC_DRAW_INFO       (struct DrawInfo *)  /* DrawInfo structure
                    used by system to create correct GUI elements
                    */

/* New for DAC port version >= 6 !
   Return strings where the buffer holding them was allocated via
   AllocVec()
*/
DAC_VB_FILEPATH         // VB means VECTOR BASED - thus allocated
DAC_VB_PROJECTNAME      // for youv ia AllocVec()!
DAC_VB_FILEEXTENSION    // You're yourself responsible to free
DAC_VB_FILENAME         // them!


NOTE:   /* Since these are all standard tags they are all posted
           as ULONGs (32 bits).
           By BareED unsupported tags will not cause the "ti_Data"
           field set to zero - so you should clear it first before
           you pass in this tag to BareED: */

struct TextAttr *attr;
.....
    attr =
NULL;    // or: attr = 0;
    
PsMsg->pm_GetAttr( DAC_FONT_ATTR, (ULONG) &attr);

/*
This ensures that your application can run on newer versions of
BareED while on an older it will not produce a GURU since you can
check the result against zero.

New functions for your disposal:
*/

//----------------------------------------------------------------
void pm_CursorOff( void)

    
/* Will erase the cursor out of the window and draws the
       character that lies under the cursor new. */

//----------------------------------------------------------------
void pm_CursorOn( void)

    
/* Draws the cursor inclusive the character the cursor
       points at. */

//----------------------------------------------------------------
void pm_CursorOnNewColor( unsigned int bg_pen, unsigned int aaRRGGBB)

    
/* Actually, it does the same as pm_CursorOn and ignores the
        colour setting. */

//----------------------------------------------------------------
void pm_RedrawChars( int x, int y, int len, unsigned int fg_pen,
         
unsigned int aaRRGGBB)

    x   
// offset as number of characters from line start
    
y   // offset as number of text-lines from top of drawing area
    
len // amount characters to redraw
    
fg_pen  /* pen number to use for characters to redraw
               if set to minus 1 (32 bits !) then aaRRGGBB is used
               instead of fg_pen !
               aaRRGGBB 32-bit colour value, alpha channel is
               (currently) ignored.
               Will use the OS function FindColor() to obtain a
               suitable pen.
               aaRRGGBB value only taken into account if fg_pen is
               set to minus 1! */

//----------------------------------------------------------------
unsigned int pm_PosNextWord( unsigned char *text, unsigned int *posx,
                 
unsigned char **ts, unsigned char **te,
                 
unsigned int *len)

    text    
// the memory-address where to begin
    
posx    /* pointer to a 32-bit variable that contains after
               success the start-offset from the word counting
               from start of line */
    
ts      /* pointer to a 32-bit variable that contains after
               success the memory-address where the word begins */
    
te      /* pointer to a 32-bit variable that contains after
               success the memory-address where the word ends */
    
len     /* pointer to a 32-bit variable that contains after
               success the amount characters the word contains,
               zero if no word could be found */

    
RESULT      /* Amount characters (identical to len) or zero */

/*
pm_PosNextWord() will search for - and return the address of an
encountered word (more specified: an ordinary word, a letter or a
number) in a single line that is either terminated with a linefeed
or zero byte.

pm_PosNextWord() will return NOT the first encountered word,
instead, it jumps to the next and returns this. This allows you to
pass in to pm_PosNextWord() the returned text-start value (ts).

Because it would have to compute each time when called the
x-position and the linestart, several calls to pm_PosNextWord()
for a line would result in speed-lost, to avoid this, "posx" can
be set, then pm_PosNextWord() does not compute x-position and
line-start but will calculate with your specified position.
If you don't want this, you have to declare "posx" as empty.

If you would like to receive the first encountered word, you have
to clear the contents of the variable, that "te" points at.
Example:
*/

TEXT String[] = " >> 100: This __is && THE || line !!! #we ... want ,," \
                "
to ++ EXAMINE\n";
....
TEXT *text, *ts, *te;
unsigned char posx, len;

    text =
String;

    posx =
NULL;    // We didn't compute x-position at all
    
te = NULL;      // First encountered word should be returned

    // Now, go and get all "words" of this line:
    
while ( (PsMsg->pm_PosNextWord( text, &posx, &ts, &te, &len)) )
    {
        
Write( Output() "Encountered this word: \"", 24);
        
Write( Output(), ts, len);
        
Write( Output(), "\"\n", 2);
        text = ts;
    }

//----------------------------------------------------------------
unsigned int pm_IsWord( unsigned char *text)

    text    
// the memory-address where to begin

    
RESULT  /* length of the encountered word, letter or number or
               zero if "text" does not point to such a thing */

/*
pm_IsWord checks if the pointer "text" points at the beginning of
a word, letter or number in a single line of text terminated by a
linefeed or zero byte.
Example:
*/

TEXT String[] = " >> 100: This __ is && THE || line !!! #we ... want ,," \
                "
to ++ EXAMINE\n";
....
TEXT *text;
unsigned int len;

    text =
String;
    
while ( !(len = PsMsg->pm_IsWord( text)) )
        *text ++;
    
Write( Output() "Encountered this as first: \"", 28);
    
Write( Output(), text, len);
    
Write( Output(), "\"\n", 2);

//----------------------------------------------------------------
unsigned int pm_IsWordAlt( unsigned char *text, unsigned int *capitals)

    text        
// the memory-address where to begin
    
capitals    /* pointer to a 32-bit variable that is set to zero
                   when the encountered word contains letters - if
                   only capitals or numbers were encountered, this
                   variable is unchanged. */

    
RESULT      /* length of the encountered word, letter or
                   number or zero if "text" does not point to such
                   a thing */

/*
pm_IsWordAlt is identical to pm_IsWord with the differences that a
leading number sign ('#') does not stop pm_IsWordAlt from
continuing and that the word may contain underscores ('_').
*/

Example:

TEXT String[] = " >> 100: This __is && THE || line !!! #we ... want ,," \
                "
to ++ EXAMINE\n";
....
TEXT *text;
unsigned int len, capitals;

    len = 1;
    text =
String;
    
while (len)
    {
        capitals = 1;
        len = PsMsg->pm_IsWord( text, &capitals)
        text += len;
        
Write( Output() "Encountered this as first: \"", 28);
        
Write( Output(), text, len);
        
Write( Output(), "\"\n", 2);
        
if (capitals)
            
Write( Output(), "Word/number consists only of capitals!\n", 39);
    }

//----------------------------------------------------------------
void pm_CancelPuRequest(struct PageUpdateMsg *pum)

    pum     
/* An already requested (through
               DAC_PAGEUPDATE_MESSAGE) but not replied PageUpdate
               message should be taken from BareED's list of
               request. */

NOTE:   /* Once requested and as long not replied the PageUpdate
           message may in no manner access by you - otherwise you
           risk a deadlock - or if you are the lucky one, only a
           GURU.
           Be warned!
           Because BareED supports now a double buffered message
           system, this function cares about it and will cancel
           both! */

/*
------------------------------------------------------------------
!!! NEW FUNCTIONS FOR DAC-PORT VERSIONS EQUAL OR GREATER 3 !!!
------------------------------------------------------------------
*/

unsigned int pm_IsLetter( unsigned char *text, unsigned int *iscapital);

    text        
// the memory-address where to begin
    
capitals    /* pointer to a 32-bit variable that is set to
                   zero when the encountered word contains letters
                   - if only capitals or numbers were encountered,
                   this variable is unchanged. */

    
RESULT      /* length of the encountered word or letter or
                   zero if "text" does not point to such a thing */

/*
pm_IsLetter is different to pm_IsWord or pm_IsWordAlt because it
only allows letters, and where this word may have one leading
number sign ('#'). But any amount of underscores ('_') are allowed.
*/

//----------------------------------------------------------------
unsigned int pm_HashValNoCase( unsigned char *text, unsigned int len);

    text    
// the start of the string
    
len     // the length of the string

    
RESULT  // Calculated FNV-1 hash-value for this string.

/*
NOTE: The hash-value is calculated case insensitive; this means
that "foo" and "FOO" are identical!
*/
//----------------------------------------------------------------
unsigned int pm_HashVal( unsigned char *text, unsigned int len);

    text    
// the start of the string
    
len     // the length of the string

    
RESULT  // Calculated FNV-1 hash-value for this string.

/*
Calculates case sensitive hash-values.
*/

//----------------------------------------------------------------
struct ColorChooserStruct * pm_ColorChooser( Tag tag1, ...);

/*
Tags for the ColorChooser() which displays a ListView-,
ColorWheel-, Gradient- and button gadgets.

Although you can use PEN entries you shouldn't, it's recommended
to use COLORS32 entries instead, which is from the application
more easy to handle because the native OS3.0 graphics functions
support this format for obtaining pens - and then you not need to
display the ColorChooser again when BareED opens or closes an own
screen.
*/


DAC_CC_LABELS       (STRPTR *)
    
/* Pointer to an array of strings (displayed in ListView
       gadget) Last entry must be a NULL-pointer (indicating
       list's end). */

DAC_CC_DEFAULTPENS  (ULONG *)
    
/* Pointer to an array of longwords for using these pens as
       default and initial!
       There have to be as much entries as in LABELS! */
    
DAC_CC_DEFAULTCOLORS    (ULONG *)
    
/* Pointer to an array of longwords for using these colors as
       default and initial!
       Leads to ignore DAC_CC_DEFAULTPENS tag!
       There have to be as much entries as in LABELS!
       Each longword is set up as aaRRGGBB, thus 4 values à 8 bits!
       */

DAC_CC_DEFAULTCOLORS32  (ULONG *)
    
/* Pointer to an array of 3 longwords for each color-entry for
       using these colors as default and initial!
       Leads to ignore DAC_CC_DEFAULT-PENS & -COLOR tags!
       There have to be as much entries as in LABELS!
       Each longword is set up as n8n4n4n4 (¹), thus 4 values à 8
       bits (Amiga OS RGB32 color component)!
       Each color requires three longwords!!!

       (¹)
       v8n4n4n4 means: "n8" = 8 bit colour value
                       "n4" = an 8-bit value representing the
                       lower 4 bits of "v8" */

DAC_CC_RESULTPENS   (ULONG *)
    
/* Pointer to an array of longwords for storing these chosen
       pens!
       There have to be as much entries as in LABELS! */

DAC_CC_RESULTCOLORS (ULONG *)
    
/* Pointer to an array of longwords for storing these chosen
       colors!
       There have to be as much entries as in LABELS!
       Each longword is set up as aaRRGGBB, thus 4 values à 8 bits!
       Alpha channel always set to zero. */

DAC_CC_RESULTCOLORS32   (ULONG *)
    
/* Pointer to an array of 3 longwords for each color-entry for
       storing these chosen colors!
       There have to be as much entries as in LABELS!
       Each color requires three longwords - and its order is
       Amiga OS RGB32 color component alike (n8n4n4n4)!!! */

DAC_CC_RESULT       (ULONG *)
    
/* Pointer to a longword containing the result of
       ColorChooser() after leaving it.
    */

DAC_CC_SAVEGADGET   (BOOL/ULONG)
    
/* By default - disabled; display the additional save gadget */

DAC_CC_STDSAVECALL  (STRPTR)
    
/* By default disabled; save the color values to disk using
       built-in function; enables automatically DAC_CC_SAVEGADGET */

DAC_CC_SAVEGADGET.
    
/* By default disabled; display the save gadget */

DAC_CC_STDLOADCALL  (STRPTR)
    
/* Try to automatically load in by built-in save function
       saved colors (used upon displaying the ColorChooser). */

DAC_CC_BAREEDCALL
    
/*      INTERNAL USE; HANDS OFF !!! */

Returned in longword pointing to by DAC_CC_RESULT

DACCR_CANCEL    
// Don't change anything (user cancelled)
DACCR_SAVE      // User wants to have changes saved to disk
DACCR_SAVED     // Colour file saved to disk by built-in function
DACCR_USE       // User wants to use these colours
DACCR_LOADED    // A colour-file was loaded as default from disk
DACCR_SHAREDPENS    /* Pens were obtained using ObtainBestPenA -
                       thus you have to free them manually! */

//----------------------------------------------------------------
struct PageUpdateMsg * pm_CreatePuMessage( Tag tag1, ...);

/* Normally, you provide the PageUpdateMsg record. Using this
   function, BareED, repspectively your code, allocates such a
   record dynamically.
*/

DACP_DOUBLETTE  /* By default, the message structure allocated is
                   for single actions, providing this tag, a
                   double buffered will be returned and handled by
                   BareED transparently
                */

    
RESULT      // Zero returned if an error occured

//----------------------------------------------------------------
void * pm_DeletePuMessage( struct PageUpdateMsg *pum);

/* Delete dynamically allocated (with function pm_CreatePuMessage()
   ) PageUpdateMsg. Pending request will be taken first from
   BareED's list of requests - and then this message (or both -
   in case tag DACP_DOUBLETTE was used for allocation) will be
   freed.*/