summaryrefslogtreecommitdiff
path: root/include/gutenprint/vars.h
blob: 796e796708bb450403da9a5e483447ce821f479f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
/*
 * "$id: vars.h,v 1.3.4.4 2004/03/09 03:00:25 rlk Exp $"
 *
 *   libgimpprint stp_vars_t core functions.
 *
 *   Copyright 1997-2000 Michael Sweet (mike@easysw.com) and
 *	Robert Krawitz (rlk@alum.mit.edu)
 *
 *   This program is free software; you can redistribute it and/or modify it
 *   under the terms of the GNU General Public License as published by the Free
 *   Software Foundation; either version 2 of the License, or (at your option)
 *   any later version.
 *
 *   This program is distributed in the hope that it will be useful, but
 *   WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 *   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 *   for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

/**
 * @file gutenprint/vars.h
 * @brief Print job functions.
 */

#ifndef GUTENPRINT_VARS_H
#define GUTENPRINT_VARS_H

#include <gutenprint/array.h>
#include <gutenprint/curve.h>
#include <gutenprint/string-list.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * The vars data type contains all the information about a print job,
 * this includes information such as the printer model, paper size,
 * print resolution etc.  Most of these job options are expressed as
 * parameters which vary according to the model and other options
 * selected.
 *
 * The representation of printer settings has changed dramatically from 4.2.
 * All (well most, anyway) settings outside of basics such as the printer
 * model and sizing settings are now typed parameters.
 *
 * @defgroup vars vars
 * @{
 */

struct stp_vars;
/** The vars opaque data type. */
typedef struct stp_vars stp_vars_t;

/**
 * Parameter types.
 * The following types are permitted for a printer setting.  Not all
 * are currently implemented.
 */
typedef enum
{
  STP_PARAMETER_TYPE_STRING_LIST, /*!< Single string choice from a list. */
  STP_PARAMETER_TYPE_INT,	/*!< Integer. */
  STP_PARAMETER_TYPE_BOOLEAN,	/*!< Boolean. */
  STP_PARAMETER_TYPE_DOUBLE,	/*!< Floating point number. */
  STP_PARAMETER_TYPE_CURVE,	/*!< Curve. */
  STP_PARAMETER_TYPE_FILE,	/*!< Filename (NYI, need to consider security). */
  STP_PARAMETER_TYPE_RAW,	/*!< Raw, opaque data. */
  STP_PARAMETER_TYPE_ARRAY,     /*!< Array. */
  STP_PARAMETER_TYPE_DIMENSION, /*!< Linear dimension. */
  STP_PARAMETER_TYPE_INVALID    /*!< Invalid type (should never be used). */
} stp_parameter_type_t;

/**
 * Parameter class.
 * What kind of setting this is, for the purpose of user interface
 * representation.
 */
typedef enum
{
  STP_PARAMETER_CLASS_FEATURE,	/*!< Printer feature. */
  STP_PARAMETER_CLASS_OUTPUT,	/*!< Output control. */
  STP_PARAMETER_CLASS_CORE,	/*!< Core Gimp-Print parameter. */
  STP_PARAMETER_CLASS_INVALID   /*!< Invalid class (should never be used). */
} stp_parameter_class_t;

/**
 * Parameter level.
 * What "level" a setting is at, for UI design.
 */
typedef enum
{
  STP_PARAMETER_LEVEL_BASIC,     /*!< Basic parameter, shown by all UIs. */
  STP_PARAMETER_LEVEL_ADVANCED,  /*!< Advanced parameter, shown by advanced UIs. */
  STP_PARAMETER_LEVEL_ADVANCED1, /*!< Advanced1 parameter, shown by advanced UIs. */
  STP_PARAMETER_LEVEL_ADVANCED2, /*!< Advanced2 parameter, shown by advanced UIs. */
  STP_PARAMETER_LEVEL_ADVANCED3, /*!< Advanced3 parameter, shown by advanced UIs. */
  STP_PARAMETER_LEVEL_ADVANCED4, /*!< Advanced4 parameter, shown by advanced UIs. */
  STP_PARAMETER_LEVEL_INTERNAL,	 /*!< Parameters used only within Gimp-Print. */
  STP_PARAMETER_LEVEL_EXTERNAL,	 /*!< Parameters used only outside Gimp-Print. */
  STP_PARAMETER_LEVEL_INVALID    /*!< Invalid level (should never be used). */
} stp_parameter_level_t;

/**
 * Parameter activity.
 * Whether a parameter is currently active (i. e. whether its value
 * should be used by the driver or not).  All parameters default to being
 * active unless explicitly "turned off".
 */
typedef enum
{
  STP_PARAMETER_INACTIVE,  /*!< Parameter is inactive (unused). */
  STP_PARAMETER_DEFAULTED, /*!< Parameter is set to its default value. */
  STP_PARAMETER_ACTIVE     /*!< Parameter is active (used). */
} stp_parameter_activity_t;

/*
 * Other parameter types
 */

/** Raw parameter. */
typedef struct
{
  size_t bytes;     /*!< Size of data. */
  const void *data; /*!< Raw data. */
} stp_raw_t;

#define STP_RAW(x) { sizeof((x)), (x) }
#define STP_RAW_STRING(x) { sizeof((x)) - 1, (x) }

/** double_bound (range) parameter. */
typedef struct
{
  double lower; /*!< Lower bound. */
  double upper; /*!< Upper bound. */
} stp_double_bound_t;

/** int_bound (range) parameter. */
typedef struct
{
  int lower; /*!< Lower bound. */
  int upper; /*!< Upper bound. */
} stp_int_bound_t;

#define STP_CHANNEL_NONE ((unsigned char) -1)

/** Parameter description. */
typedef struct
{
  const char *name;		 /*!< Internal name (key). */
  const char *text;		 /*!< User-visible name. */
  const char *category;		 /*!< User-visible category name. */
  const char *help;		 /*!< Help string. */
  stp_parameter_type_t p_type;   /*!< Parameter type. */
  stp_parameter_class_t p_class; /*!< Parameter class. */
  stp_parameter_level_t p_level; /*!< Parameter level. */
  unsigned char is_mandatory;    /*!< The parameter is required, even when set inactive. */
  unsigned char is_active;       /*!< Is the parameter active? */
  unsigned char channel;         /*!< The channel to which this parameter applies */
  unsigned char verify_this_parameter;	 /*!< Should the verify system check this parameter? */
  unsigned char read_only;
  union
  {
    stp_curve_t *curve;       /*!< curve parameter value. */
    stp_double_bound_t dbl;  /*!< double_bound parameter value. */
    stp_int_bound_t integer; /*!< int_bound parameter value. */
    stp_int_bound_t dimension; /*!< int_bound parameter value. */
    stp_string_list_t *str;   /*!< string_list parameter value. */
    stp_array_t *array;      /*!< array parameter value. */
  } bounds; /*!< Limits on the values the parameter may take. */
  union
  {
    stp_curve_t *curve; /*!< Default curve parameter value. */
    double dbl;         /*!< Default double parameter value. */
    int dimension;      /*!< Default dimension parameter value. */
    int integer;        /*!< Default int parameter value. */
    int boolean;        /*!< Default boolean parameter value. */
    const char *str;    /*!< Default string parameter value. */
    stp_array_t *array; /*!< Default array parameter value. */
  } deflt; /*!< Default value of the parameter. */
} stp_parameter_t;

/** The parameter_list opaque data type. */
typedef void *stp_parameter_list_t;
/** The constant parameter_list opaque data type. */
typedef const void *stp_const_parameter_list_t;

/**
 * Output function supplied by the calling application.
 * There are two output functions supplied by the caller, one to send
 * output data and one to report errors.
 * @param data a pointer to an opaque object owned by the calling
 *             application.
 * @param buffer the data to output.
 * @param bytes the size of buffer (in bytes).
 */
typedef void (*stp_outfunc_t) (void *data, const char *buffer, size_t bytes);


/****************************************************************
*                                                               *
* BASIC PRINTER SETTINGS                                        *
*                                                               *
****************************************************************/

/**
 * Create a new vars object.
 * @returns the newly created vars object.
 */
extern stp_vars_t *stp_vars_create(void);

/**
 * Copy a vars object.
 * Both dest and source must be valid vars objects previously
 * created with stp_vars_create().
 * @param dest the destination vars.
 * @param source the source vars.
 */
extern void stp_vars_copy(stp_vars_t *dest, const stp_vars_t *source);

/**
 * Copy and allocate a vars object.
 * source must be a valid vars object previously created with
 * stp_vars_create().
 * @param source the source vars.
 * @returns the new copy of the vars.
 */
extern stp_vars_t *stp_vars_create_copy(const stp_vars_t *source);

/**
 * Destroy a vars object.
 * It is an error to destroy the vars more than once.
 * @param v the vars to destroy.
 */
extern void stp_vars_destroy(stp_vars_t *v);

/**
 * Set the name of the printer driver.
 * @param v the vars to use.
 * @param val the name to set.
 */
extern void stp_set_driver(stp_vars_t *v, const char *val);

/**
 * Set the name of the printer driver.
 * @param v the vars to use.
 * @param val the name to set.
 * @param bytes the length of val (in bytes).
 */
extern void stp_set_driver_n(stp_vars_t *v, const char *val, int bytes);

/**
 * Get the name of the printer driver.
 * @returns the name of the printer driver (must not be freed).
 */
extern const char *stp_get_driver(const stp_vars_t *v);

/**
 * Set the name of the color conversion routine, if not the default.
 * @param v the vars to use.
 * @param val the name to set.
 */
extern void stp_set_color_conversion(stp_vars_t *v, const char *val);

/**
 * Set the name of the color conversion routine, if not the default.
 * @param v the vars to use.
 * @param val the name to set.
 * @param bytes the length of val (in bytes).
 */
extern void stp_set_color_conversion_n(stp_vars_t *v, const char *val, int bytes);

/**
 * Get the name of the color conversion routine.
 * @returns the name of the color conversion routine (must not be freed).
 */
extern const char *stp_get_color_conversion(const stp_vars_t *v);

/*
 * Set/get the position and size of the image
 */

/**
 * Set the left edge of the image.
 * @param v the vars to use.
 * @param val the value to set.
 */
extern void stp_set_left(stp_vars_t *v, int val);

/**
 * Get the left edge of the image.
 * @returns the left edge.
 */
extern int stp_get_left(const stp_vars_t *v);

/**
 * Set the top edge of the image.
 * @param v the vars to use.
 * @param val the value to set.
 */
extern void stp_set_top(stp_vars_t *v, int val);

/**
 * Get the top edge of the image.
 * @returns the left edge.
 */
extern int stp_get_top(const stp_vars_t *v);

/**
 * Set the width of the image.
 * @param v the vars to use.
 * @param val the value to set.
 */
extern void stp_set_width(stp_vars_t *v, int val);

/**
 * Get the width edge of the image.
 * @returns the left edge.
 */
extern int stp_get_width(const stp_vars_t *v);

/**
 * Set the height of the image.
 * @param v the vars to use.
 * @param val the value to set.
 */
extern void stp_set_height(stp_vars_t *v, int val);

/**
 * Get the height of the image.
 * @returns the left edge.
 */
extern int stp_get_height(const stp_vars_t *v);

/*
 * For custom page widths, these functions may be used.
 */

/**
 * Set the page width.
 * @param v the vars to use.
 * @param val the value to set.
 */
extern void stp_set_page_width(stp_vars_t *v, int val);

/**
 * Get the page width.
 * @returns the page width.
 */
extern int stp_get_page_width(const stp_vars_t *v);

/**
 * Set the page height.
 * @param v the vars to use.
 * @param val the value to set.
 */
extern void stp_set_page_height(stp_vars_t *v, int val);

/**
 * Get the page height.
 * @returns the page height.
 */
extern int stp_get_page_height(const stp_vars_t *v);

/**
 * Set the function used to print output information.
 * These must be supplied by the caller.  outdata is passed as an
 * arguments to outfunc; typically it will be a file descriptor.
 * @param v the vars to use.
 * @param val the value to set.
 */
extern void stp_set_outfunc(stp_vars_t *v, stp_outfunc_t val);

/**
 * Get the function used to print output information.
 * @param v the vars to use.
 * @returns the outfunc.
 */
extern stp_outfunc_t stp_get_outfunc(const stp_vars_t *v);

/**
 * Set the function used to print error and diagnostic information.
 * These must be supplied by the caller.  errdata is passed as an
 * arguments to errfunc; typically it will be a file descriptor.
 * @param v the vars to use.
 * @param val the value to set.
 */
extern void stp_set_errfunc(stp_vars_t *v, stp_outfunc_t val);

/**
 * Get the function used to print output information.
 * @param v the vars to use.
 * @returns the outfunc.
 */
extern stp_outfunc_t stp_get_errfunc(const stp_vars_t *v);

/**
 * Set the output data.
 * @param v the vars to use.
 * @param val the output data.  This will typically be a file
 * descriptor, but it is entirely up to the caller exactly what type
 * this might be.
 */
extern void stp_set_outdata(stp_vars_t *v, void *val);

/**
 * Get the output data.
 * @param v the vars to use.
 * @returns the output data.
 */
extern void *stp_get_outdata(const stp_vars_t *v);

/**
 * Set the error data.
 * @param v the vars to use.
 * @param val the error data.  This will typically be a file
 * descriptor, but it is entirely up to the caller exactly what type
 * this might be.
 */
extern void stp_set_errdata(stp_vars_t *v, void *val);

/**
 * Get the error data.
 * @param v the vars to use.
 * @returns the output data.
 */
extern void *stp_get_errdata(const stp_vars_t *v);

/**
 * Merge defaults for a printer with user-chosen settings.
 * @deprecated This is likely to go away.
 * @param user the destination vars.
 * @param print the vars to merge into user.
 */
extern void stp_merge_printvars(stp_vars_t *user, const stp_vars_t *print);

/**
 * Copy settings from one vars object to another, not modifying anything
 * unset in the source.
 * @param to the destination vars.
 * @param from the vars to merge into user.
 */
extern void stp_copy_vars_from(stp_vars_t *to, const stp_vars_t *from);


/****************************************************************
*                                                               *
* PARAMETER MANAGEMENT                                          *
*                                                               *
****************************************************************/

/**
 * List the available parameters for the currently chosen settings.
 * This does not fill in the bounds and defaults; it merely provides
 * a list of settings.  To fill in detailed information for a setting,
 * use stp_describe_parameter.
 * @param v the vars to use.
 * @returns a list of available parameters (must be freed with
 * stp_parameter_list_destroy()).
 */
extern stp_parameter_list_t stp_get_parameter_list(const stp_vars_t *v);

/**
 * List the number of available parameters for the currently chosen
 * settings.
 * @param list the parameter_list to use.
 * @returns the number of parameters.
 */
extern size_t stp_parameter_list_count(stp_const_parameter_list_t list);

/**
 * Find a parameter by its name.
 * @param list the parameter_list to use.
 * @param name the name of the parameter.
 * @returns a pointer to the parameter (must not be freed), or NULL if
 * no parameter was found.
 */
extern const stp_parameter_t *
stp_parameter_find(stp_const_parameter_list_t list, const char *name);

/**
 * Find a parameter by its index number.
 * @param list the parameter_list to use.
 * @param item the index number of the parameter (must not be greater
 * than stp_parameter_list_count - 1).
 * @returns a pointer to the parameter (must not be freed), or NULL if
 * no parameter was found.
 */
extern const stp_parameter_t *
stp_parameter_list_param(stp_const_parameter_list_t list, size_t item);

/**
 * Destroy a parameter_list.
 * It is an error to destroy the parameter_list more than once.
 * @param list the parameter_list to destroy.
 */
extern void stp_parameter_list_destroy(stp_parameter_list_t list);

/**
 * Create a parameter_list.
 * @returns the newly created parameter_list.
 */
extern stp_parameter_list_t stp_parameter_list_create(void);

/**
 * Add a parameter to a parameter_list.
 * @param list the parameter_list to use.
 * @param item the parameter to add.
 */
extern void stp_parameter_list_add_param(stp_parameter_list_t list,
					 const stp_parameter_t *item);

/**
 * Copy and allocate a parameter_list.
 * A new parameter_list will be created, and then the contents of
 * source will be
 * copied into it.
 * @param list the source parameter_list.
 * @returns the new copy of the parameter_list.
 */
extern stp_parameter_list_t
stp_parameter_list_copy(stp_const_parameter_list_t list);

/**
 * Append one parameter_list to another.
 * @param list the destination list (to append to).
 * @param append the list of paramters to append.  Each item that does
 * not already exist in list will be appended.
 */
extern void
stp_parameter_list_append(stp_parameter_list_t list,
			  stp_const_parameter_list_t append);

/**
 * Describe a parameter in detail.
 * All of the parameter fields will be populated.
 * @param v the vars to use.
 * @param name the name of the parameter.
 * @param description a pointer to an stp_parameter_t to store the
 * parameter description in.
 */
extern void
stp_describe_parameter(const stp_vars_t *v, const char *name,
		       stp_parameter_t *description);

/**
 * Destroy a parameter description.
 * This must be called even if the stp_parameter_t was not allocated
 * with malloc, since some members are dynamically allocated.
 * @param description the parameter description to destroy.
 */
extern void stp_parameter_description_destroy(stp_parameter_t *description);

/**
 * Find a parameter by its name from a vars object.
 * @param v the vars to use.
 * @param name the name of the parameter.
 * @returns a pointer to the parameter (must not be freed), or NULL if
 * no parameter was found.
 */
extern const stp_parameter_t *
stp_parameter_find_in_settings(const stp_vars_t *v, const char *name);

/**
 * Set a string parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_string_parameter(stp_vars_t *v, const char *parameter,
				     const char *value);

/**
 * Set a string parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set (must not contain NUL).
 * @param bytes the length of value (in bytes).
 */
extern void stp_set_string_parameter_n(stp_vars_t *v, const char *parameter,
				       const char *value, size_t bytes);

/**
 * Set a file parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_file_parameter(stp_vars_t *v, const char *parameter,
				   const char *value);

/**
 * Set a file parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set (must not contain NUL).
 * @param bytes the length of value (in bytes).
 */
extern void stp_set_file_parameter_n(stp_vars_t *v, const char *parameter,
				     const char *value, size_t bytes);

/**
 * Set a float parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_float_parameter(stp_vars_t *v, const char *parameter,
				    double value);

/**
 * Set an integer parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_int_parameter(stp_vars_t *v, const char *parameter,
				  int value);

/**
 * Set a dimension parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_dimension_parameter(stp_vars_t *v, const char *parameter,
					int value);

/**
 * Set a boolean parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_boolean_parameter(stp_vars_t *v, const char *parameter,
				      int value);

/**
 * Set a curve parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_curve_parameter(stp_vars_t *v, const char *parameter,
				    const stp_curve_t *value);

/**
 * Set an array parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_array_parameter(stp_vars_t *v, const char *parameter,
				    const stp_array_t *value);

/**
 * Set a raw parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 * @param bytes the length of value (in bytes).
 */
extern void stp_set_raw_parameter(stp_vars_t *v, const char *parameter,
				  const void *value, size_t bytes);

/**
 * Multiply the value of a float parameter by a scaling factor.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param scale the factor to multiply the value by.
 */
extern void stp_scale_float_parameter(stp_vars_t *v, const char *parameter,
				      double scale);

/**
 * Set a default string parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_default_string_parameter(stp_vars_t *v,
					     const char *parameter,
					     const char *value);

/**
 * Set a default string parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set (must not contain NUL).
 * @param bytes the length of value (in bytes).
 */
extern void stp_set_default_string_parameter_n(stp_vars_t *v,
					       const char *parameter,
					       const char *value, size_t bytes);

/**
 * Set a default file parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_default_file_parameter(stp_vars_t *v,
					   const char *parameter,
					   const char *value);

/**
 * Set a default file parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set (must not contain NUL).
 * @param bytes the length of value (in bytes).
 */
extern void stp_set_default_file_parameter_n(stp_vars_t *v,
					     const char *parameter,
					     const char *value, size_t bytes);

/**
 * Set a default float parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_default_float_parameter(stp_vars_t *v,
					    const char *parameter,
					    double value);

/**
 * Set a default integer parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_default_int_parameter(stp_vars_t *v,
					  const char *parameter,
					  int value);

/**
 * Set a default dimension parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_default_dimension_parameter(stp_vars_t *v,
						const char *parameter,
						int value);

/**
 * Set a default boolean parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_default_boolean_parameter(stp_vars_t *v,
					      const char *parameter,
					      int value);

/**
 * Set a default curve parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_default_curve_parameter(stp_vars_t *v,
					    const char *parameter,
					    const stp_curve_t *value);

/**
 * Set a default array parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 */
extern void stp_set_default_array_parameter(stp_vars_t *v,
					    const char *parameter,
					    const stp_array_t *value);

/**
 * Set a default raw parameter.
 * The value is set if the parameter is not already set.  This avoids
 * having to check if the parameter is set prior to setting it, if you
 * do not want to override the existing value.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param value the value to set.
 * @param bytes the length of value (in bytes).
 */
extern void stp_set_default_raw_parameter(stp_vars_t *v,
					  const char *parameter,
					  const void *value, size_t bytes);

/**
 * Get a string parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the string, or NULL if no parameter was found.
 */
extern const char *stp_get_string_parameter(const stp_vars_t *v,
					    const char *parameter);

/**
 * Get a file parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the filename, or NULL if no parameter was found.
 */
extern const char *stp_get_file_parameter(const stp_vars_t *v,
					  const char *parameter);

/**
 * Get a float parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the float value.
 */
extern double stp_get_float_parameter(const stp_vars_t *v,
					    const char *parameter);

/**
 * Get an integer parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the integer value.
 */
extern int stp_get_int_parameter(const stp_vars_t *v,
				 const char *parameter);

/**
 * Get a dimension parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the dimension (integer) value.
 */
extern int stp_get_dimension_parameter(const stp_vars_t *v,
				       const char *parameter);

/**
 * Get a boolean parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the boolean value.
 */
extern int stp_get_boolean_parameter(const stp_vars_t *v,
				     const char *parameter);

/**
 * Get a curve parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the curve, or NULL if no parameter was found.
 */
extern const stp_curve_t *stp_get_curve_parameter(const stp_vars_t *v,
						  const char *parameter);

/**
 * Get an array parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the array, or NULL if no parameter was found.
 */
extern const stp_array_t *stp_get_array_parameter(const stp_vars_t *v,
						  const char *parameter);

/**
 * Get a raw parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the raw data, or NULL if no parameter was found.
 */
extern const stp_raw_t *stp_get_raw_parameter(const stp_vars_t *v,
					      const char *parameter);

/**
 * Clear a string parameter.
 * The parameter is set to NULL.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 */
extern void stp_clear_string_parameter(stp_vars_t *v, const char *parameter);

/**
 * Clear a file parameter.
 * The parameter is set to NULL.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 */
extern void stp_clear_file_parameter(stp_vars_t *v, const char *parameter);

/**
 * Clear (remove) a float parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 */
extern void stp_clear_float_parameter(stp_vars_t *v, const char *parameter);

/**
 * Clear (remove) an integer parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 */
extern void stp_clear_int_parameter(stp_vars_t *v, const char *parameter);

/**
 * Clear (remove) a dimension parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 */
extern void stp_clear_dimension_parameter(stp_vars_t *v, const char *parameter);

/**
 * Clear (remove) a boolean parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 */
extern void stp_clear_boolean_parameter(stp_vars_t *v, const char *parameter);

/**
 * Clear a curve parameter.
 * The parameter is set to NULL.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 */
extern void stp_clear_curve_parameter(stp_vars_t *v, const char *parameter);

/**
 * Clear an array parameter.
 * The parameter is set to NULL.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 */
extern void stp_clear_array_parameter(stp_vars_t *v, const char *parameter);

/**
 * Clear a raw parameter.
 * The parameter is set to NULL.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 */
extern void stp_clear_raw_parameter(stp_vars_t *v, const char *parameter);

/**
 * Clear a parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param type the type of the parameter.
 */
extern void stp_clear_parameter(stp_vars_t *v, const char *parameter, stp_parameter_type_t type);


/**
 * List all string parameters.
 * The return value must be freed after use.
 * @param v the vars to use.
 */
extern stp_string_list_t *stp_list_string_parameters(const stp_vars_t *v);

/**
 * List all file parameters.
 * The return value must be freed after use.
 * @param v the vars to use.
 */
extern stp_string_list_t *stp_list_file_parameters(const stp_vars_t *v);

/**
 * List all float parameters.
 * The return value must be freed after use.
 * @param v the vars to use.
 */
extern stp_string_list_t *stp_list_float_parameters(const stp_vars_t *v);

/**
 * List all integer parameters.
 * The return value must be freed after use.
 * @param v the vars to use.
 */
extern stp_string_list_t *stp_list_int_parameters(const stp_vars_t *v);

/**
 * List all dimension parameters.
 * The return value must be freed after use.
 * @param v the vars to use.
 */
extern stp_string_list_t *stp_list_dimension_parameters(const stp_vars_t *v);

/**
 * List all boolean parameters.
 * The return value must be freed after use.
 * @param v the vars to use.
 */
extern stp_string_list_t *stp_list_boolean_parameters(const stp_vars_t *v);

/**
 * List all curve parameters.
 * The return value must be freed after use.
 * @param v the vars to use.
 */
extern stp_string_list_t *stp_list_curve_parameters(const stp_vars_t *v);

/**
 * List all array parameters.
 * The return value must be freed after use.
 * @param v the vars to use.
 */
extern stp_string_list_t *stp_list_array_parameters(const stp_vars_t *v);

/**
 * List all raw parameters.
 * The return value must be freed after use.
 * @param v the vars to use.
 */
extern stp_string_list_t *stp_list_raw_parameters(const stp_vars_t *v);

/**
 * List all parameters.
 * The return value must be freed after use.
 * @param v the vars to use.
 * @param type the type of the parameter.
 */
extern stp_string_list_t *stp_list_parameters(const stp_vars_t *v,
					      stp_parameter_type_t type);


/**
 * Set the activity of a string parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the activity status to set (should be set to
 * STP_PARAMETER_ACTIVE or STP_PARAMETER_INACTIVE).
 */
extern void stp_set_string_parameter_active(stp_vars_t *v,
					    const char *parameter,
					    stp_parameter_activity_t active);

/**
 * Set the activity of a file parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the activity status to set (should be set to
 * STP_PARAMETER_ACTIVE or STP_PARAMETER_INACTIVE).
 */
extern void stp_set_file_parameter_active(stp_vars_t *v,
					  const char *parameter,
					  stp_parameter_activity_t active);

/**
 * Set the activity of a float parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the activity status to set (should be set to
 * STP_PARAMETER_ACTIVE or STP_PARAMETER_INACTIVE).
 */
extern void stp_set_float_parameter_active(stp_vars_t *v,
					 const char *parameter,
					 stp_parameter_activity_t active);

/**
 * Set the activity of an integer parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the activity status to set (should be set to
 * STP_PARAMETER_ACTIVE or STP_PARAMETER_INACTIVE).
 */
extern void stp_set_int_parameter_active(stp_vars_t *v,
					 const char *parameter,
					 stp_parameter_activity_t active);

/**
 * Set the activity of a dimension parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the activity status to set (should be set to
 * STP_PARAMETER_ACTIVE or STP_PARAMETER_INACTIVE).
 */
extern void stp_set_dimension_parameter_active(stp_vars_t *v,
					       const char *parameter,
					       stp_parameter_activity_t active);

/**
 * Set the activity of a boolean parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the activity status to set (should be set to
 * STP_PARAMETER_ACTIVE or STP_PARAMETER_INACTIVE).
 */
extern void stp_set_boolean_parameter_active(stp_vars_t *v,
					     const char *parameter,
					     stp_parameter_activity_t active);

/**
 * Set the activity of a curveparameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the activity status to set (should be set to
 * STP_PARAMETER_ACTIVE or STP_PARAMETER_INACTIVE).
 */
extern void stp_set_curve_parameter_active(stp_vars_t *v,
					   const char *parameter,
					   stp_parameter_activity_t active);

/**
 * Set the activity of an array parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the activity status to set (should be set to
 * STP_PARAMETER_ACTIVE or STP_PARAMETER_INACTIVE).
 */
extern void stp_set_array_parameter_active(stp_vars_t *v,
					   const char *parameter,
					   stp_parameter_activity_t active);

/**
 * Set the activity of a raw parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the activity status to set (should be set to
 * STP_PARAMETER_ACTIVE or STP_PARAMETER_INACTIVE).
 */
extern void stp_set_raw_parameter_active(stp_vars_t *v,
					 const char *parameter,
					 stp_parameter_activity_t active);

/**
 * Set the activity of a parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the activity status to set (should be set to
 * STP_PARAMETER_ACTIVE or STP_PARAMETER_INACTIVE).
 * @param type the type of the parameter.
 */
extern void stp_set_parameter_active(stp_vars_t *v,
				     const char *parameter,
				     stp_parameter_activity_t active,
				     stp_parameter_type_t type);

/**
 * Check if a string parameter is set.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the minimum activity status.
 */
extern int stp_check_string_parameter(const stp_vars_t *v, const char *parameter,
				      stp_parameter_activity_t active);

/**
 * Check if a file parameter is set.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the minimum activity status.
 */
extern int stp_check_file_parameter(const stp_vars_t *v, const char *parameter,
				    stp_parameter_activity_t active);

/**
 * Check if a float parameter is set.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the minimum activity status.
 */
extern int stp_check_float_parameter(const stp_vars_t *v, const char *parameter,
				     stp_parameter_activity_t active);

/**
 * Check if an integer parameter is set.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the minimum activity status.
 */
extern int stp_check_int_parameter(const stp_vars_t *v, const char *parameter,
				   stp_parameter_activity_t active);

/**
 * Check if a dimension parameter is set.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the minimum activity status.
 */
extern int stp_check_dimension_parameter(const stp_vars_t *v, const char *parameter,
					 stp_parameter_activity_t active);

/**
 * Check if a boolean parameter is set.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the minimum activity status.
 */
extern int stp_check_boolean_parameter(const stp_vars_t *v, const char *parameter,
				       stp_parameter_activity_t active);

/**
 * Check if a curve parameter is set.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the minimum activity status.
 */
extern int stp_check_curve_parameter(const stp_vars_t *v, const char *parameter,
				     stp_parameter_activity_t active);

/**
 * Check if an array parameter is set.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the minimum activity status.
 */
extern int stp_check_array_parameter(const stp_vars_t *v, const char *parameter,
				     stp_parameter_activity_t active);

/**
 * Check if a raw parameter is set.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the minimum activity status.
 */
extern int stp_check_raw_parameter(const stp_vars_t *v, const char *parameter,
				   stp_parameter_activity_t active);

/**
 * Check if a parameter is set.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param active the minimum activity status.
 * @param type the type of the parameter.
 */
extern int stp_check_parameter(const stp_vars_t *v, const char *parameter,
			       stp_parameter_activity_t active,
			       stp_parameter_type_t type);

/**
 * Get the activity status of a string parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the activity status.
 */
extern stp_parameter_activity_t
stp_get_string_parameter_active(const stp_vars_t *v, const char *parameter);

/**
 * Get the activity status of a file parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the activity status.
 */
extern stp_parameter_activity_t
stp_get_file_parameter_active(const stp_vars_t *v, const char *parameter);

/**
 * Get the activity status of a float parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the activity status.
 */
extern stp_parameter_activity_t
stp_get_float_parameter_active(const stp_vars_t *v, const char *parameter);

/**
 * Get the activity status of an integer parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the activity status.
 */
extern stp_parameter_activity_t
stp_get_int_parameter_active(const stp_vars_t *v, const char *parameter);

/**
 * Get the activity status of a dimension parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the activity status.
 */
extern stp_parameter_activity_t
stp_get_dimension_parameter_active(const stp_vars_t *v, const char *parameter);

/**
 * Get the activity status of a boolean parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the activity status.
 */
extern stp_parameter_activity_t
stp_get_boolean_parameter_active(const stp_vars_t *v, const char *parameter);

/**
 * Get the activity status of a curve parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the activity status.
 */
extern stp_parameter_activity_t
stp_get_curve_parameter_active(const stp_vars_t *v, const char *parameter);

/**
 * Get the activity status of an array parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the activity status.
 */
extern stp_parameter_activity_t
stp_get_array_parameter_active(const stp_vars_t *v, const char *parameter);

/**
 * Get the activity status of a raw parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @returns the activity status.
 */
extern stp_parameter_activity_t
stp_get_raw_parameter_active(const stp_vars_t *v, const char *parameter);

/**
 * Get the activity status of a parameter.
 * @param v the vars to use.
 * @param parameter the name of the parameter.
 * @param type the type of the parameter.
 */
extern stp_parameter_activity_t
stp_get_parameter_active(const stp_vars_t *v, const char *parameter,
			 stp_parameter_type_t type);



/****************************************************************
*                                                               *
* INFORMATIONAL QUERIES                                         *
*                                                               *
****************************************************************/

/**
 * Get the media (paper) size.
 * Retrieve the media size of the media type set in V, expressed in units
 * of 1/72".  If the media size is invalid, width and height will be set
 * to -1.  Values of 0 for width or height indicate that the dimension
 * is variable, so that custom page sizes or roll paper can be used.
 * In this case, the size limit should be used to determine maximum and
 * minimum values permitted.
 * @param v the vars to use.
 * @param width a pointer to an int to store the media width in.
 * @param height a pointer to an int to store the media height in.
 */
extern void stp_get_media_size(const stp_vars_t *v, int *width, int *height);

/**
 * Get the imagable area of the page.
 * Retrieve the boundaries of the printable area of the page.  In combination
 * with the media size, this can be used to determine the actual printable
 * region, which callers can use to place the image precisely.  The
 * dimensions are relative to the top left of the physical page.
 *
 * If a customizable page size is used (see stp_printer_get_media_size),
 * the actual desired width and/or height must be filled in using
 * stp_set_page_width and/or stp_set_page_height.  If these are not filled
 * in, the margins will be returned.
 *
 * Returned values may be negative if a printer is capable of full bleed
 * by printing beyond the physical boundaries of the page.
 *
 * If the media size stored in V is invalid, the return values
 * will be indeterminate.  It is up to the user to specify legal values.
 * @param v the vars to use.
 * @param left a pointer to a int to store the left edge in.
 * @param right a pointer to a int to store the right edge in.
 * @param bottom a pointer to a int to store the bottom edge in.
 * @param top a pointer to a int to store the top edge in.
 */
extern void stp_get_imageable_area(const stp_vars_t *v, int *left, int *right,
				   int *bottom, int *top);

/**
 * Get the maximum imagable area of the page.
 * Retrieve the maximum (regardless of settings other than page sise)
 * boundaries of the printable area of the page.  In combination
 * with the media size, this can be used to determine the actual printable
 * region, which callers can use to place the image precisely.  The
 * dimensions are relative to the top left of the physical page.
 *
 * If a customizable page size is used (see stp_printer_get_media_size),
 * the actual desired width and/or height must be filled in using
 * stp_set_page_width and/or stp_set_page_height.  If these are not filled
 * in, the margins will be returned.
 *
 * Returned values may be negative if a printer is capable of full bleed
 * by printing beyond the physical boundaries of the page.
 *
 * If the media size stored in V is invalid, the return values
 * will be indeterminate.  It is up to the user to specify legal values.
 * @param v the vars to use.
 * @param left a pointer to a int to store the left edge in.
 * @param right a pointer to a int to store the right edge in.
 * @param bottom a pointer to a int to store the bottom edge in.
 * @param top a pointer to a int to store the top edge in.
 */
extern void stp_get_maximum_imageable_area(const stp_vars_t *v, int *left,
					   int *right, int *bottom, int *top);

/**
 * Get the media size limits.
 * Retrieve the minimum and maximum size limits for custom media sizes
 * with the current printer settings.
 * @param v the vars to use.
 * @param max_width a pointer to a int to store the maximum width in.
 * @param max_height a pointer to a int to store the maximum height in.
 * @param min_width a pointer to a int to store the minimum width in.
 * @param min_height a pointer to a int to store the minimum height in.
 */
extern void
stp_get_size_limit(const stp_vars_t *v, int *max_width, int *max_height,
		   int *min_width, int *min_height);


/**
 * Retrieve the printing resolution of the selected resolution.  If the
 * resolution is invalid, -1 will be returned in both x and y.
 * @param v the vars to use.
 * @param x a pointer to a int to store the horizontal resolution in.
 * @param y a pointer to a int to store the vertical resolution in.
 */
extern void stp_describe_resolution(const stp_vars_t *v, int *x, int *y);

/**
 * Verify parameters.
 * Verify that the parameters selected are consistent with those allowed
 * by the driver.  This must be called prior to printing; failure to do
 * so will result in printing failing.
 * @param v the vars to use.
 * @returns 0 on failure, 1 on success; other status values are reserved.
 */
extern int stp_verify(stp_vars_t *v);

/**
 * Get default global settings.  The main use of this is to provide a
 * usable stp_vars_t for purposes of parameter inquiry in the absence
 * of a specific printer.  This is currently used in a variety of
 * places to get information on the standard color parameters without
 * querying a particular printer.
 * @returns the default settings.
 */
extern const stp_vars_t *stp_default_settings(void);

/**
 * Get the value of a specified category for the specified parameter.
 * @param v the vars to use.
 * @param desc the parameter description to use (must already be described)
 * @param category the name of the category to search for.
 * @returns the value of the category or NULL.  String must be freed by caller.
 */
extern char *stp_parameter_get_category(const stp_vars_t *v,
					const stp_parameter_t *desc,
					const char *category);

/**
 * Determine whether a parameter has a category with the specified value.
 * If a null value is passed in, return whether the parameter has
 * the category at all.  Return -1 if any other error condition (null
 * vars, desc, or category).
 * @param v the vars to use.
 * @param desc the parameter description to use (must already be described)
 * @param category the name of the category to search for.
 * @param value the value of the category to search for.
 * @returns whether the parameter has the category with the specified value. 
 */
extern int stp_parameter_has_category_value(const stp_vars_t *v,
					    const stp_parameter_t *desc,
					    const char *category,
					    const char *value);

/**
 * Get the list of categories and their values for the specified parameter.
 * @param v the vars to use.
 * @param desc the parameter description to use (must already be described)
 * @returns the list of categories.
 */
extern stp_string_list_t *stp_parameter_get_categories(const stp_vars_t *v,
						       const stp_parameter_t *desc);

typedef void *(*stp_copy_data_func_t)(void *);
typedef void (*stp_free_data_func_t)(void *);

typedef enum
{
  PARAMETER_BAD,
  PARAMETER_OK,
  PARAMETER_INACTIVE
} stp_parameter_verify_t;

extern void stp_allocate_component_data(stp_vars_t *v,
					const char *name,
					stp_copy_data_func_t copyfunc,
					stp_free_data_func_t freefunc,
					void *data);
extern void stp_destroy_component_data(stp_vars_t *v, const char *name);

struct stp_compdata;
typedef struct stp_compdata compdata_t;

extern void *stp_get_component_data(const stp_vars_t *v, const char *name);

extern stp_parameter_verify_t stp_verify_parameter(const stp_vars_t *v,
						   const char *parameter,
						   int quiet);
extern int stp_get_verified(const stp_vars_t *v);
extern void stp_set_verified(stp_vars_t *v, int value);

extern void stp_copy_options(stp_vars_t *vd, const stp_vars_t *vs);

extern void
stp_fill_parameter_settings(stp_parameter_t *desc,
			    const stp_parameter_t *param);

  /** @} */

#ifdef __cplusplus
  }
#endif

#endif /* GUTENPRINT_VARS_H */
/*
 * End of "$Id: vars.h,v 1.10 2011/06/12 00:47:15 rlk Exp $".
 */