aboutsummaryrefslogtreecommitdiff
path: root/Scripting/Perl/HostControl.pm
blob: 4d481c8acf90d5bc826abb2a1d035255776b0d05 (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
########################################################################
#
#	File:			HostControl.pm
#
#	Purpose:		Perl wrappers for Palm OS Emulator HostControl 
#					functions.
#
#	Description:	This file contains Perl equivalents of Palm OS
#					Emulator Host Control functions, like HostGetHostID,
#					HostGetHostVersion, HostProfileStart etc...
#
#					In general, functions follow the calling
#					conventions in the SDK headers.  However, there
#					are exceptions.  See the comments before each
#					subroutine for details.
#
########################################################################

package HostControl;

use EmRPC qw(DoRPC);
use EmSysTraps;

use strict;
use vars qw(@ISA @EXPORT);

use Exporter;
@ISA = qw(Exporter);

@EXPORT = qw(

	HostGetHostVersion HostGetHostID HostGetHostPlatform 
	HostIsSelectorImplemented HostGestalt HostIsCallingTrap
	
	HostProfileInit HostProfileStart HostProfileStop HostProfileDump 
	HostProfileCleanup HostProfileDetailFn
	
	HostErrNo HostFClose HostFEOF HostFError HostFFlush HostFGetC 
	HostFGetPos HostFGetS HostFOpen HostFPrintF HostFPutC HostFPutS 
	HostFRead HostRemove HostRename HostFReopen HostFScanF HostFSeek 
	HostFSetPos HostFTell HostFWrite HostTmpFile HostTmpNam HostGetEnv

	HostMalloc HostRealloc HostFree

	HostGremlinIsRunning HostGremlinNumber HostGremlinCounter 
	HostGremlinLimit HostGremlinNew
	
	HostImportFile HostExportFile

	HostGetPreference HostSetPreference

	HostLogFile HostSetLogFileSize

	HostSessionCreate HostSessionOpen HostSessionClose HostSessionQuit 
	HostSignalSend HostSignalWait HostSignalResume

	HostTraceInit HostTraceClose HostTraceOutputT HostTraceOutputTL 
	HostTraceOutputVT HostTraceOutputVTL HostTraceOutputB

);

#// HostControl.h functions.

# Host information selectors
use constant hostSelectorGetHostVersion			=> 0x0100;
use constant hostSelectorGetHostID				=> 0x0101;
use constant hostSelectorGetHostPlatform		=> 0x0102;
use constant hostSelectorIsSelectorImplemented	=> 0x0103;
use constant hostSelectorGestalt				=> 0x0104;
use constant hostSelectorIsCallingTrap			=> 0x0105;

# Profiler Selectors
use constant hostSelectorProfileInit			=> 0x0200;
use constant hostSelectorProfileStart			=> 0x0201;
use constant hostSelectorProfileStop			=> 0x0202;
use constant hostSelectorProfileDump			=> 0x0203;
use constant hostSelectorProfileCleanup			=> 0x0204;
use constant hostSelectorProfileDetailFn		=> 0x0205;

# Std C Library wrapper selectors

use constant hostSelectorErrNo					=> 0x0300;

use constant hostSelectorFClose					=> 0x0301;
use constant hostSelectorFEOF					=> 0x0302;
use constant hostSelectorFError					=> 0x0303;
use constant hostSelectorFFlush					=> 0x0304;
use constant hostSelectorFGetC					=> 0x0305;
use constant hostSelectorFGetPos				=> 0x0306;
use constant hostSelectorFGetS					=> 0x0307;
use constant hostSelectorFOpen					=> 0x0308;
use constant hostSelectorFPrintF				=> 0x0309;		# Floating point not yet supported in Poser
use constant hostSelectorFPutC					=> 0x030A;
use constant hostSelectorFPutS					=> 0x030B;
use constant hostSelectorFRead					=> 0x030C;
use constant hostSelectorRemove					=> 0x030D;		# Not yet implemented in Poser
use constant hostSelectorRename					=> 0x030E;		# Not yet implemented in Poser
use constant hostSelectorFReopen				=> 0x030F;		# Not yet implemented in Poser
use constant hostSelectorFScanF					=> 0x0310;		# Not yet implemented in Poser
use constant hostSelectorFSeek					=> 0x0311;
use constant hostSelectorFSetPos				=> 0x0312;
use constant hostSelectorFTell					=> 0x0313;
use constant hostSelectorFWrite					=> 0x0314;
use constant hostSelectorTmpFile				=> 0x0315;
use constant hostSelectorTmpNam					=> 0x0316;		# Not yet implemented in Poser
use constant hostSelectorGetEnv					=> 0x0317;

use constant hostSelectorMalloc					=> 0x0318;		# Not yet implemented in Poser
use constant hostSelectorRealloc				=> 0x0319;		# Not yet implemented in Poser
use constant hostSelectorFree					=> 0x031A;		# Not yet implemented in Poser

# Gremlin Selectors
use constant hostSelectorGremlinIsRunning		=> 0x0400;
use constant hostSelectorGremlinNumber			=> 0x0401;
use constant hostSelectorGremlinCounter			=> 0x0402;
use constant hostSelectorGremlinLimit			=> 0x0403;
use constant hostSelectorGremlinNew				=> 0x0404;

# Database Selectors
use constant hostSelectorImportFile				=> 0x0500;
use constant hostSelectorExportFile				=> 0x0501;

# Preference Selectors
use constant hostSelectorGetPreference			=> 0x0600;
use constant hostSelectorSetPreference			=> 0x0601;

# Logging Selectors
use constant hostSelectorLogFile				=> 0x0700;
use constant hostSelectorSetLogFileSize			=> 0x0701;

# RPC Selectors
use constant hostSelectorSessionCreate			=> 0x0800;		# Not yet implemented in Poser
use constant hostSelectorSessionOpen			=> 0x0801;		# Not yet implemented in Poser
use constant hostSelectorSessionClose			=> 0x0802;
use constant hostSelectorSessionQuit			=> 0x0803;
use constant hostSelectorSignalSend				=> 0x0804;
use constant hostSelectorSignalWait				=> 0x0805;
use constant hostSelectorSignalResume			=> 0x0806;

# External tracing tool support
use constant hostSelectorTraceInit				=> 0x0900;
use constant hostSelectorTraceClose				=> 0x0901;
use constant hostSelectorTraceOutputT			=> 0x0902;
use constant hostSelectorTraceOutputTL			=> 0x0903;
use constant hostSelectorTraceOutputVT			=> 0x0904;
use constant hostSelectorTraceOutputVTL			=> 0x0905;
use constant hostSelectorTraceOutputB			=> 0x0906;

use constant hostSelectorLastTrapNumber			=> 0x0907;


#/* ==================================================================== */
#/* Host environment-related calls										 */
#/* ==================================================================== */

########################################################################
#
#	FUNCTION:		HostGetHostVersion
#
#	DESCRIPTION:	Get the version number of the host (Palm OS Emulator).
#
#	PARAMETERS:		None
#
#	RETURNS:		Version number of Poser in Palm OS version format.
#
########################################################################

sub HostGetHostVersion
{
	# long HostGetHostVersion(void)

	my ($return, $format) = ("int32", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorGetHostVersion, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostGetHostID
#
#	DESCRIPTION:	Get the ID of the debugging host.
#
#	PARAMETERS:		None
#
#	RETURNS:		hostIDPalmOS, hostIDPalmOSEmulator, hostIDPalmOSSimulator 
#					etc...
#
########################################################################

sub HostGetHostID
{
	# HostID HostGetHostID(void)

	my ($return, $format) = ("int32", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorGetHostID, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostGetHostPlatform
#
#	DESCRIPTION:	Get the host platform ID.
#					hostPlatformPalmOS, hostPlatformWindows, 
#					hostPlatformMacintosh, hostPlatformUnix etc...
#
#	PARAMETERS:		None
#
#	RETURNS:		hostPlatformPalmOS, hostPlatformWindows, 
#					hostPlatformMacintosh, hostPlatformUnix etc...
#
########################################################################

sub HostGetHostPlatform
{
	# HostPlatform HostGetHostPlatform(void)

	my ($return, $format) = ("int32", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorGetHostPlatform, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostIsSelectorImplemented
#
#	DESCRIPTION:	Determines if the particular selector is implemented.
#
#	PARAMETERS:		None
#
#	RETURNS:		True or False.
#
########################################################################

sub HostIsSelectorImplemented
{
	# HostBool HostIsSelectorImplemented(long selector)

	my ($return, $format) = ("int32", "int16 int32");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorIsSelectorImplemented, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostGestalt
#
#	DESCRIPTION:	Return queries about the Runtime environment.
#
#	PARAMETERS:		None
#
#	RETURNS:		Runtime environment info.
#
########################################################################

sub HostGestalt
{
	# HostErr HostGestalt(long gestSel, long* response)

	my ($return, $format) = ("HostErr", "int16 int32 rptr");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorGestalt, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostIsCallingTrap
#
#	DESCRIPTION:	Determines if the Palm OS Emulator is currently
#					calling a trap.  True if so, false if not.
#
#	PARAMETERS:		None
#
#	RETURNS:		True if trap is being called, false if not.
#
########################################################################

sub HostIsCallingTrap
{
	# HostBool HostIsCallingTrap(void)

	my ($return, $format) = ("int32", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorIsCallingTrap, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


#/* ==================================================================== */
#/* Profiling-related calls												 */
#/* ==================================================================== */


########################################################################
#
#	FUNCTION:		HostProfileInit
#
#	DESCRIPTION:	Initializes and enables profiling in debugging host.
#
#	PARAMETERS:		None
#
#	RETURNS:		Returns zero if successful, non-zero otherwise.
#
########################################################################

sub HostProfileInit
{
	# HostErr HostProfileInit(long maxCalls, long maxDepth)

	my ($return, $format) = ("HostErr", "int16 int32 int32");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorProfileInit, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostProfileDetailFn
#
#	DESCRIPTION:	Profiles the function that contains the specified 
#					address.
#
#	PARAMETERS:		None
#
#	RETURNS:		Returns zero if successful, non-zero otherwise.
#
########################################################################

sub HostProfileDetailFn
{
	# HostErr HostProfileDetailFn(void* addr, HostBool logDetails)

	my ($return, $format) = ("HostErr", "int16 rptr int32");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorProfileDetailFn, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostProfileStart
#
#	DESCRIPTION:	Turns Profiling on.
#
#	PARAMETERS:		None
#
#	RETURNS:		Returns zero if successful, non-zero otherwise.
#
########################################################################

sub HostProfileStart
{
	# HostErr HostProfileStart(void)

	my ($return, $format) = ("HostErr", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorProfileStart, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostProfileStop
#
#	DESCRIPTION:	Initializes and enables profiling in debugging host.
#
#	PARAMETERS:		None
#
#	RETURNS:		Returns zero if successful, non-zero otherwise.
#
########################################################################

sub HostProfileStop
{
	# HostErr HostProfileStop(void)

	my ($return, $format) = ("HostErr", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorProfileStop, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostProfileDump
#
#	DESCRIPTION:	Writes the current profiling information to the 
#					named file.
#
#	PARAMETERS:		None
#
#	RETURNS:		Returns zero if successful, non-zero otherwise.
#
########################################################################

sub HostProfileDump
{
	# HostErr HostProfileDump(const char* filename)

	my ($return, $format) = ("HostErr", "int16 string");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorProfileDump, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostProfileCleanup
#
#	DESCRIPTION:	Initializes and enables profiling in debugging host.
#
#	PARAMETERS:		None
#
#	RETURNS:		Returns zero if successful, non-zero otherwise.
#
########################################################################

sub HostProfileCleanup
{
	# HostErr HostProfileCleanup(void)

	my ($return, $format) = ("HostErr", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorProfileCleanup, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


#/* ==================================================================== */
#/* Std C Library-related calls											 */
#/* 	ADD LATER!!!													 */
#/* ==================================================================== */


#/* ==================================================================== */
#/* Gremlin-related calls												 */
#/* ==================================================================== */


########################################################################
#
#	FUNCTION:		HostGremlinIsRunning
#
#	DESCRIPTION:	Determines if Gremlin is currently running.
#
#	PARAMETERS:		None
#
#	RETURNS:		True if a gremlin is currently running, False otherwise.
#
########################################################################

sub HostGremlinIsRunning
{
	# HostBool HostGremlinIsRunning(void)

	my ($return, $format) = ("int32", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorGremlinIsRunning, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostGremlinNumber
#
#	DESCRIPTION:	Retrieves the number of the currently running gremlin.
#
#	PARAMETERS:		None
#
#	RETURNS:		The number of the current gremlin.
#					Only valid if a gremlin is currently executing.
#
########################################################################

sub HostGremlinNumber
{
	# long HostGremlinNumber(void)

	my ($return, $format) = ("int32", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorGremlinNumber, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostGremlinCounter
#
#	DESCRIPTION:	Returns the current event counter of the currently 
#					running gremlin.
#
#	PARAMETERS:		None
#
#	RETURNS:		Current event counter.  
#					Only valid if a gremlin is currently executing.
#
########################################################################

sub HostGremlinCounter
{
	# long HostGremlinCounter(void)

	my ($return, $format) = ("int32", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorGremlinCounter, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostGremlinLimit
#
#	DESCRIPTION:	Retrieves the limit value of the currently running gremlin.
#
#	PARAMETERS:		None
#
#	RETURNS:		Limit value of the currently running gremlin.
#					Only valid if a gremlin is currently executing.
#
########################################################################

sub HostGremlinLimit
{
	# long HostGremlinLimit(void)

	my ($return, $format) = ("int32", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorGremlinLimit, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostGremlinNew
#
#	DESCRIPTION:	Start a new Gremlin Horde.
#
#	PARAMETERS:		Starting Gremlin number.
#					Ending Gremlin number.
#					Frequency (in terms of Gremlin events) at which
#						states are automatically saved.
#					Switching depth (number of events generated before
#						switching to a different Gremlin).
#					Max depth (maximum number of events generated
#						for each Gremlin).
#					List of application names on which to run Gremlins.
#
#	RETURNS:		Error code.
#
########################################################################

sub HostGremlinNew
{
	# HostErr HostGremlinNew(const HostGremlinInfo*)

	my($start, $stop, $save_freq, $switch_depth, $max_depth, @apps) = @_;

	my ($app_string) = join (",", @apps);

	my ($struct) = pack("NNNNN", $start, $stop, $save_freq, $switch_depth, $max_depth) . $app_string;

	my ($return, $format) = ("HostErr", "int16 block");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorGremlinNew, $struct);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


#/* ==================================================================== */
#/* Import/export-related calls											 */
#/* ==================================================================== */


########################################################################
#
#	FUNCTION:	HostImportFile
#
#	DESCRIPTION:	Path to file on desktop
#			Card to import file to.
#
#	PARAMETERS:	None
#
#	RETURNS:	Error code.
#
########################################################################

sub HostImportFile
{
	# HostErr HostImportFile(const char* fileName, long cardNum)

	my ($return, $format) = ("HostErr", "int16 string int32");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorImportFile, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:	HostExportFile
#
#	DESCRIPTION:	Export a db from Emulator to the host.
#
#	PARAMETERS:	None
#
#	RETURNS:	Error code.
#
########################################################################

sub HostExportFile
{
	# HostErr HostExportFile(const char* fileName, long cardNum, const char* dbName)

	my ($return, $format) = ("HostErr", "int16 string int32 string");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorExportFile, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


#/* ==================================================================== */
#/* Logging-related calls												 */
#/* ==================================================================== */


########################################################################
#
#	FUNCTION:	HostSetPreference
#
#	DESCRIPTION:	Set a preference.
#
#	PARAMETERS:	prefName, The name of the preference whose value you
#                          are setting.
#               prefValue, The new value of the preference.
#	
#	RETURNS:	Nothing.
#
########################################################################

sub HostSetPreference
{
	# void HostSetPreference(const char*, const char*)

	my ($return, $format) = ("void", "int16 string string");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorSetPreference, @_);
	#//EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:	HostGetPreference
#
#	DESCRIPTION:	Export a db from Emulator to the host.
#
#	PARAMETERS:	prefName, The name of the preference whose value you
#                  want to retrieve.
#
#	RETURNS:	Error code.
#
########################################################################
	
sub HostGetPreference
{
	# HostBool HostGetPreference(const char*, char*)

	my ($return, $format) = ("int32", "int16 string string");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorGetPreference, $_[0], "");
	($D0,	prefName	=> $params[1],
			prefValue	=> $params[2]);
}




########################################################################
#
#	FUNCTION:		HostSetLogFileSize
#
#	DESCRIPTION:	Determines the size of the log file the Palm OS 
#					Emulator is using.  By default the Palm OS Emulator
#					Uses a 1 MB log file to record the last 1 MB of 
#					Log Data information.
#
#	PARAMETERS:		Size, The new size for the logging file in bytes.
#
#	RETURNS:		None.
#
#
########################################################################

sub HostSetLogFileSize
{
	# void HostSetLogFileSize(long)

	my ($return, $format) = ("int16", "int16 int32");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorSetLogFileSize, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


#/* ==================================================================== */
#/* RPC-related calls													 */
#/* ==================================================================== */


########################################################################
#
#	FUNCTION:		HostSessionCreate
#
#	DESCRIPTION:	Create a new session.
#
#	PARAMETERS:		Name of device to emulate.  Choices are: "Pilot",
#						"PalmPilot", "Palm III", "Palm IIIx",
#						"Palm V", "Palm VII".
#					RAM size (in K) to emulate.
#					Path to ROM to use.
#
#	RETURNS:		Error code.
#
########################################################################

sub HostSessionCreate
{
	# HostErr HostSessionCreate(const char* device, long ramSize, const char* romPath)

	my ($return, $format) = ("HostErr", "int16 string int32 string");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorSessionCreate, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostSessionOpen
#
#	DESCRIPTION:	Open a previously create session file.
#
#	PARAMETERS:		Path to session file to open.
#
#	RETURNS:		Error code.
#
########################################################################

sub HostSessionOpen
{
	# HostErr HostSessionOpen(const char* psfFileName)

	my ($return, $format) = ("HostErr",  "int16 string");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorSessionOpen, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostSessionClose
#
#	DESCRIPTION:	Close the current session, optionally saving it.
#
#	PARAMETERS:		Name of session file to create. Can be null.
#
#	RETURNS:		Error code.
#
########################################################################

sub HostSessionClose
{
	# HostErr HostSessionClose(const char* saveFileName)

	my ($return, $format) = ("HostErr", "int16 string");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorSessionClose, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostSessionQuit
#
#	DESCRIPTION:	Ask Palm OS Emulator to quit.
#
#	PARAMETERS:		None
#
#	RETURNS:		Error code.
#
########################################################################

sub HostSessionQuit
{
	# HostErr HostSessionQuit(void)

	my ($return, $format) = ("HostErr", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorSessionQuit, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostSignalSend
#
#	DESCRIPTION:	Sends a signal to any script that has host signal 
#					wait calls pending.
#
#	PARAMETERS:		signalNumber, The signal you want to wait for.
#
#	RETURNS:		List containing the error code and the numeric
#					signal value returned from the Emulator.
#
########################################################################

sub HostSignalSend
{
	# HostErr HostSignalSend(HostSignal signalNumber)

	my ($return, $format) = ("HostErr", "int16 int32*");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorSignalSend, $_[0], 0);

	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}


########################################################################
#
#	FUNCTION:		HostSignalWait
#
#	DESCRIPTION:	Wait for a signal from the Palm OS Emulator.
#
#	PARAMETERS:		timeout (in milliseconds)
#
#	RETURNS:		List containing the error code and the numeric
#					signal value returned from the Emulator.
#
########################################################################

sub HostSignalWait
{
	# HostErr HostSignalWait(long timeout, HostSignal* signalNumber)
	
	my ($return, $format) = ("HostErr", "int16 int32 rptr");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorSignalWait, $_[0], 0);

	($D0, $params[2]);	# 0 = selector, 1 = timeout, 2 = signal number
}


########################################################################
#
#	FUNCTION:		HostSignalResume
#
#	DESCRIPTION:	Tell the Emulator to resume after it has sent us
#					a signal.
#
#	PARAMETERS:		None
#
#	RETURNS:		Error code.
#
########################################################################

sub HostSignalResume
{
	# HostErr HostSignalResume(void)

	my ($return, $format) = ("HostErr", "int16");
	my ($D0, $A0, @params) = EmRPC::DoRPC (EmSysTraps::sysTrapHostControl, $format,
						hostSelectorSignalResume, @_);
	EmRPC::ReturnValue ($return, $D0, $A0, @params);
}