Mac-Carbon

 view release on metacpan or  search on metacpan

InternetConfig/InternetConfig.xs  view on Meta::CPAN

	RETVAL.flags		= flags;
	PLstrcpy(RETVAL.extension, extension);
	PLstrcpy(RETVAL.creator_app_name, creator_app_name);
	PLstrcpy(RETVAL.post_app_name, post_app_name);
	PLstrcpy(RETVAL.MIME_type, MIME_type);
	PLstrcpy(RETVAL.entry_name, entry_name);
	OUTPUT:
	RETVAL

=back

=head2 Functions

=over 4

=item ICStart 

=item ICStart CREATOR

Call this at application initialisation. Set creator to your application creator to 
allow for future expansion of the IC system (Default is MacPerl's creator). Returns 
a connection to the IC system.

=cut
MODULE = Mac::InternetConfig   PACKAGE = Mac::InternetConfig

ICInstance
ICStart(creator='McPL')
	OSType	creator;
	CODE:
	if (gMacPerl_OSErr = ICStart(&RETVAL, creator)) {
		XSRETURN_UNDEF;
	}
	OUTPUT:
	RETVAL
	
=item ICStop INST

It is illegal to call this routine inside a ICBegin/End pair.
Call this at application termination, after which INST
is no longer valid connection to IC.

=cut

MacOSRet
ICStop(inst)
	ICInstance	inst;

=item ICGeneralFindConfigFile INST, SEARCH_PREFS, CAN_CREATE, @FOLDERS

=item ICGeneralFindConfigFile INST, SEARCH_PREFS, CAN_CREATE

=item ICGeneralFindConfigFile INST

B<Mac OS only.>

It is illegal to call this routine inside a ICBegin/End pair.
Call to configure this connection to IC.
This routine acts as a more general replacement for
ICFindConfigFile and ICFindUserConfigFile.
Set search_prefs to 1 (default) if you want it to search the preferences folder.
Set can_create to 1 if you want it to be able to create a new config.
Set count as the number of valid elements in folders.
Set folders to a pointer to the folders to search.
Setting count to 0 and folders to nil is OK.
Searches the specified folders and then optionally the Preferences folder
in a unspecified manner.

=cut

MacOSRet
ICGeneralFindConfigFile(inst, search_prefs=1, can_create=0, ...)
	ICInstance	inst;
	Boolean		search_prefs;
	Boolean		can_create;
	PREINIT:
	int			i;
	short		count;
	FSSpec		spec;
	ICDirSpec	spex[8];
	CODE:
#ifndef MACOS_TRADITIONAL
	croak("Usage: Mac::InternetConfig::ICGeneralFindConfigFile unsupported in Carbon");
#else
	count = 0;
	for (i=3; i<items; ++i)
		if (!GUSIPath2FSp((char *) SvPV_nolen(ST(i)), &spec) && !GUSIFSpDown(&spec, "\p")) {
			spex[count].vRefNum = spec.vRefNum;
			spex[count].dirID	= spec.parID;
			++count;
		}
	RETVAL = ICGeneralFindConfigFile(inst, search_prefs, can_create, count, (ICDirSpecArrayPtr) spex);
#endif
	OUTPUT:
	RETVAL

=item ICChooseConfig INST

B<Mac OS only.>

Requires IC 1.2.
It is illegal to call this routine inside a ICBegin/End pair.
Requests the user to choose a configuration, typically using some
sort of modal dialog. If the user cancels the dialog the configuration
state will be unaffected.

=cut

#ifndef MACOS_TRADITIONAL

MacOSRet
ICChooseConfig(inst)
	ICInstance	inst;
	CODE:
	croak("Usage: Mac::InternetConfig::ICChooseConfig unsupported in Carbon");

#else

MacOSRet
ICChooseConfig(inst)
	ICInstance	inst;

#endif

=item ICChooseNewConfig INST

B<Mac OS only.>

Requires IC 1.2.
It is illegal to call this routine inside a ICBegin/End pair.
Requests the user to choose a new configuration, typically using some
sort of modal dialog. If the user cancels the dialog the configuration
state will be unaffected.

=cut

#ifndef MACOS_TRADITIONAL

MacOSRet
ICChooseNewConfig(inst)
	ICInstance	inst;
	CODE:
	croak("Usage: Mac::InternetConfig::ICChooseNewConfig unsupported in Carbon");

#else

MacOSRet
ICChooseNewConfig(inst)
	ICInstance	inst;

#endif

InternetConfig/InternetConfig.xs  view on Meta::CPAN


Requires IC 1.2.
You must specify a configuration before calling this routine.
Returns a self-contained reference to the instance's current
configuration.

=cut

Handle
ICGetConfigReference(inst)
	ICInstance	inst;
	CODE:
#ifndef MACOS_TRADITIONAL
	croak("Usage: Mac::InternetConfig::ICGetConfigReference unsupported in Carbon");
#else
	if (!(RETVAL = NewHandle(0))) {
		XSRETURN_UNDEF;
	}
	if (gMacPerl_OSErr = ICGetConfigReference(inst, (ICConfigRefHandle) RETVAL)) {
		DisposeHandle(RETVAL);
		XSRETURN_UNDEF;
	}
#endif
	OUTPUT:
	RETVAL

=item ICSetConfigReference INST, REF, FLAGS

=item ICSetConfigReference INST, REF

B<Mac OS only.>

Requires IC 1.2.
It is illegal to call this routine inside a ICBegin/End pair.
Reconfigures the instance using a configuration reference that was
got using ICGetConfigReference reference. Set the
icNoUserInteraction_bit in flags if you require that this routine
not present a modal dialog. Other flag bits are reserved and should
be set to zero.

=cut

MacOSRet
ICSetConfigReference(inst, ref, flags=0)
	ICInstance	inst; 
	Handle		ref;
	long		flags;
	CODE:
#ifndef MACOS_TRADITIONAL
	croak("Usage: Mac::InternetConfig::ICSetConfigReference unsupported in Carbon");
#else
	RETVAL = ICSetConfigReference(inst, (ICConfigRefHandle) ref, flags);
#endif
	OUTPUT:
	RETVAL

=item ICGetSeed INST

You do not have to specify a configuration before calling this routine.
You do not have to be inside an ICBegin/End pair to call this routine.
Returns the current seed for the IC prefs database.
This seed changes each time a non-volatile preference is changed.
You can poll this to determine if any cached preferences change.

=cut

long
ICGetSeed(inst)
	ICInstance	inst;
	CODE:
	if (gMacPerl_OSErr = ICGetSeed(inst, &RETVAL)) {
		XSRETURN_UNDEF;
	}
	OUTPUT:
	RETVAL

=item ICGetComponentInstance INST

B<Mac OS only.>

Requires IC 1.2.
You do not have to specify a configuration before calling this routine.
You do not have to be inside an ICBegin/End pair to call this routine.
Returns the connection to the IC component.

=cut

ComponentInstance
ICGetComponentInstance(inst)
	ICInstance	inst;
	CODE:
#ifndef MACOS_TRADITIONAL
	croak("Usage: Mac::InternetConfig::ICGetComponentInstance unsupported in Carbon");
#else
	if (gMacPerl_OSErr = ICGetComponentInstance(inst, &RETVAL)) {
		XSRETURN_UNDEF;
	}
#endif
	OUTPUT:
	RETVAL

=item ICBegin INST, PERM

You must specify a configuration before calling this routine. It is illegal to
call this routine inside a ICBegin/End pair. Starting reading or writing
multiple preferences. A call to this must be balanced by a call to ICEnd. Do
not call WaitNextEvent between these calls. The perm specifies whether you
intend to read or read/write. Only one writer is allowed per instance. Note
that this may open resource files that are not closed until you call ICEnd. 

=cut

MacOSRet
ICBegin(inst, perm)
	ICInstance	inst;
	ICPerm		perm;

=item ICGetPref INST, KEY

You must specify a configuration before calling this routine.
If you are getting or setting multiple preferences, you should place



( run in 0.713 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )