Freeciv-3.2: /fast/freeciv/nightly/S3_2/utility/specpq.h File Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Macros | Typedefs | Functions | Variables
specpq.h File Reference
`#include "mem.h"`

Go to the source code of this file.

## Macros

#define | SPECPQ_PASTE_(x, y) x ## y
#define | SPECPQ_PASTE(x, y) SPECPQ_PASTE_(x, y)
#define | SPECPQ_PQ struct SPECPQ_PASTE(SPECPQ_TAG, _pq)
#define | SPECPQ_PQ_ struct SPECPQ_PASTE(SPECPQ_TAG, _pq_private_)
#define | SPECPQ_CELL_ struct SPECPQ_PASTE(SPECPQ_TAG, _cell_private_)
#define | SPECPQ_FOO(suffix) SPECPQ_PASTE(SPECPQ_TAG, suffix)

## Typedefs

typedef void(*)(SPECPQ_DATA_TYPE | SPECPQ_FOO) (_pq_data_free_fn_t)

## Functions

static SPECPQ_PQ *SPECPQ_FOO() | _pq_new (int initial_size)
static void SPECPQ_FOO() | _pq_destroy (SPECPQ_PQ *_pq)
static void SPECPQ_FOO() | _pq_destroy_full (SPECPQ_PQ *_pq, SPECPQ_FOO(_pq_data_free_fn_t) data_free)
static void SPECPQ_FOO() | _pq_insert (SPECPQ_PQ *_pq, SPECPQ_DATA_TYPE data, SPECPQ_PRIORITY_TYPE priority)
static void SPECPQ_FOO() | _pq_replace (SPECPQ_PQ *_pq, SPECPQ_DATA_TYPE data, SPECPQ_PRIORITY_TYPE priority)
static bool SPECPQ_FOO() | _pq_remove (SPECPQ_PQ *_pq, SPECPQ_DATA_TYPE *pdata)
static bool SPECPQ_FOO() | _pq_peek (const SPECPQ_PQ *_pq, SPECPQ_DATA_TYPE *pdata)
static bool SPECPQ_FOO() | _pq_priority (const SPECPQ_PQ *_pq, SPECPQ_PRIORITY_TYPE *ppriority)

## Variables

| SPECPQ_PQ
| SPECPQ_CELL_
SPECPQ_PRIORITY_TYPE | priority
| SPECPQ_PQ_
int | avail
int | step
SPECPQ_CELL_ * | cells

## Macro Definition Documentation

## ◆ SPECPQ_CELL_

#define SPECPQ_CELL_ struct SPECPQ_PASTE(SPECPQ_TAG, _cell_private_)

Definition at line 73 of file specpq.h.

## ◆ SPECPQ_FOO

#define SPECPQ_FOO | ( |  | suffix | ) | SPECPQ_PASTE(SPECPQ_TAG, suffix)

Definition at line 74 of file specpq.h.

## ◆ SPECPQ_PASTE

#define SPECPQ_PASTE | ( |  | x,
|  |  | y
| ) |  | SPECPQ_PASTE_(x, y)

Definition at line 69 of file specpq.h.

## ◆ SPECPQ_PASTE_

#define SPECPQ_PASTE_ | ( |  | x,
|  |  | y
| ) |  | x ## y

Definition at line 68 of file specpq.h.

## ◆ SPECPQ_PQ

#define SPECPQ_PQ struct SPECPQ_PASTE(SPECPQ_TAG, _pq)

Definition at line 71 of file specpq.h.

## ◆ SPECPQ_PQ_

#define SPECPQ_PQ_ struct SPECPQ_PASTE(SPECPQ_TAG, _pq_private_)

Definition at line 72 of file specpq.h.

## Typedef Documentation

## ◆ SPECPQ_FOO

typedef void(*)(SPECPQ_DATA_TYPE SPECPQ_FOO) (_pq_data_free_fn_t)

Definition at line 80 of file specpq.h.

## Function Documentation

## ◆ _pq_destroy()

static void SPECPQ_FOO() _pq_destroy | ( | SPECPQ_PQ * | _pq | ) |

inlinestatic

Destructor for queue structure.

Definition at line 117 of file specpq.h.

## ◆ _pq_destroy_full()

static void SPECPQ_FOO() _pq_destroy_full | ( | SPECPQ_PQ * | _pq,
|  | SPECPQ_FOO(_pq_data_free_fn_t) | data_free
| ) |  |

inlinestatic

Alternative destructor for queue structure.

Definition at line 129 of file specpq.h.

## ◆ _pq_insert()

static void SPECPQ_FOO() _pq_insert | ( | SPECPQ_PQ * | _pq,
|  | SPECPQ_DATA_TYPE | data,
|  | SPECPQ_PRIORITY_TYPE | priority
| ) |  |

inlinestatic

Insert an item into the queue.

Definition at line 147 of file specpq.h.

Referenced by _pq_replace().

## ◆ _pq_new()

static SPECPQ_PQ *SPECPQ_FOO() _pq_new | ( | int | initial_size | ) |

inlinestatic

Build a new queue. 'initial_size' is the number of queue items for which memory should be preallocated, that is, the initial size of the item array the queue uses. If you insert more than n items to the queue, another n items will be allocated automatically.

Definition at line 103 of file specpq.h.

## ◆ _pq_peek()

static bool SPECPQ_FOO() _pq_peek | ( | const SPECPQ_PQ * | _pq,
|  | SPECPQ_DATA_TYPE * | pdata
| ) |  |

inlinestatic

Store the highest-ranking item in dest without removing it. Return FALSE if the queue is empty, in case 'pdata' is not set.

Definition at line 255 of file specpq.h.

## ◆ _pq_priority()

static bool SPECPQ_FOO() _pq_priority | ( | const SPECPQ_PQ * | _pq,
|  | SPECPQ_PRIORITY_TYPE * | ppriority
| ) |  |

inlinestatic

Set the highest priority of the queue in 'datum_priority'. Return FALSE iff the queue is empty.

Definition at line 272 of file specpq.h.

## ◆ _pq_remove()

static bool SPECPQ_FOO() _pq_remove | ( | SPECPQ_PQ * | _pq,
|  | SPECPQ_DATA_TYPE * | pdata
| ) |  |

inlinestatic

Remove the highest-ranking item from the queue and store it in 'pdata'. 'pdata' may be NULL. Return FALSE iff no item could be removed, because the queue was empty.

Definition at line 208 of file specpq.h.

## ◆ _pq_replace()

static void SPECPQ_FOO() _pq_replace | ( | SPECPQ_PQ * | _pq,
|  | SPECPQ_DATA_TYPE | data,
|  | SPECPQ_PRIORITY_TYPE | priority
| ) |  |

inlinestatic

Set a better priority for datum. Insert if 'data' is not present yet.

Definition at line 175 of file specpq.h.

## Variable Documentation

## ◆ avail

int avail

Definition at line 91 of file specpq.h.

## ◆ cells

SPECPQ_CELL_* cells

Definition at line 93 of file specpq.h.

## ◆ priority

SPECPQ_PRIORITY_TYPE priority

Definition at line 86 of file specpq.h.

Referenced by _pq_insert(), _pq_replace(), evaluate_city_name_priority(), get_city_dialog_output_text(), pf_fuel_map_iterate(), pf_jumbo_map_iterate(), and search_for_city_name().

## ◆ SPECPQ_CELL_

SPECPQ_CELL_

Initial value:
{
SPECPQ_DATA_TYPE data
SPECPQ_DATA_TYPE
#define SPECPQ_DATA_TYPE
Definition path_finding.c:37

Definition at line 84 of file specpq.h.

## ◆ SPECPQ_PQ

SPECPQ_PQ

Definition at line 77 of file specpq.h.

## ◆ SPECPQ_PQ_

SPECPQ_PQ_

Initial value:
{
int size
size
size_t size
Definition specvec.h:72

Definition at line 89 of file specpq.h.

## ◆ step

int step

Definition at line 92 of file specpq.h.

Referenced by battle_animation(), cai_unit_move_or_attack(), create_unit_surface(), create_vertical_scrollbar(), dai_unit_move_or_attack(), dlsend_packet_ruleset_multiplier(), down_scroll_widget_list(), dsend_packet_ruleset_multiplier(), gen5rec(), get_position(), get_step(), make_pseudofractal1_hmap(), objprop_refresh_widget(), hud_message_box::paintEvent(), hud_input_box::paintEvent(), player_base_citizen_happiness(), real_science_report_dialog_update(), receive_packet_ruleset_multiplier_100(), redraw_city_dialog(), redraw_happiness_city_dialog(), redraw_info_city_dialog(), redraw_tech_tree_dlg(), setup_vertical_widgets_position(), text_happiness_cities(), texwai_unit_move_or_attack(), update_city_cma_dialog(), and vertical_scroll_widget_list().