Mac-Carbon
view release on metacpan or search on metacpan
InternetConfig/InternetConfig.xs view on Meta::CPAN
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
these calls within an ICBegin/ICEnd pair.
If you call this routine outside of such a pair, it implicitly
calls ICBegin(inst, icReadOnlyPerm).
Reads the preference specified by key from the IC database to the
buffer pointed to by buf and size.
key must not be the empty string.
If called in a scalar context, return the preference. If called in a list
context, additionally returns the attributes.
Returns icPrefNotFound if there is no preference for the key.
=cut
void
ICGetPref(inst, key)
ICInstance inst;
Str255 key;
PREINIT:
ICAttr attr;
Handle pref;
PPCODE:
pref = NewHandle(0);
gMacPerl_OSErr = ICFindPrefHandle(inst, key, &attr, pref);
if (!gMacPerl_OSErr)
if (GIMME != G_ARRAY) {
XPUSHs(sv_2mortal(MakeHndSV(pref)));
} else {
XPUSHs(sv_2mortal(MakeHndSV(pref)));
XPUSHs(sv_2mortal(newSViv(attr)));
}
DisposeHandle(pref);
=item ICSetPref INST, KEY, VALUE
=item ICSetPref INST, KEY, VALUE, ATTR
You must specify a configuration before calling this routine.
If you are getting or setting multiple preferences, you should place
these calls within an ICBegin/ICEnd pair.
If you call this routine outside of such a pair, it implicitly
calls ICBegin(inst, icReadWritePerm).
Sets the preference specified by KEY from the IC database to the
VALUE. If attr is ICattr_no_change (the default) then the preference attributes
are not set. Otherwise the preference attributes are set to attr.
Returns icPermErr if the previous ICBegin was passed icReadOnlyPerm.
Returns icPermErr if current attr is locked, new attr is locked.
=cut
MacOSRet
ICSetPref(inst, key, value, attr=(unsigned long)(kICAttrNoChange))
ICInstance inst;
Str255 key;
SV * value;
ICAttr attr;
PREINIT:
STRLEN len;
Ptr ptr;
Handle pref;
CODE:
ptr = SvPV(value, len);
RETVAL = PtrToHand(ptr, &pref, len);
if (!RETVAL) {
RETVAL = ICSetPrefHandle(inst, key, attr, pref);
DisposeHandle(pref);
}
OUTPUT:
RETVAL
=item ICCountPref INST
You must specify a configuration before calling this routine.
You must be inside an ICBegin/End pair to call this routine.
Counts the total number of preferences.
=cut
long
ICCountPref(inst)
ICInstance inst;
CODE:
if (gMacPerl_OSErr = ICCountPref(inst, &RETVAL)) {
InternetConfig/InternetConfig.xs view on Meta::CPAN
MacOSRet
ICEnd(inst)
ICInstance inst;
=item ICEditPreferences INST, KEY
Requires IC 1.1.
You must specify a configuration before calling this routine.
You do not have to be inside an ICBegin/End pair to call this routine.
Instructs IC to display the user interface associated with editing
preferences and focusing on the preference specified by key.
If key is the empty string then no preference should be focused upon.
You must have specified a configuration before calling this routine.
You do not need to call ICBegin before calling this routine.
In the current implementation this launches the IC application
(or brings it to the front) and displays the window containing
the preference specified by key.
It may have a radically different implementation in future
IC systems.
=cut
MacOSRet
ICEditPreferences(ic, key)
ICInstance ic;
Str255 key;
=item ICParseURL INST, HINT, DATA, START, END
=item ICParseURL INST, HINT, DATA
Requires IC 1.1.
You must specify a configuration before calling this routine.
You do not have to be inside an ICBegin/End pair to call this routine.
Parses a URL out of the specified text and returns it in a canonical form
in a handle.
HINT indicates the default scheme for URLs of the form "name@address".
If HINT is the empty string then URLs of that form are not allowed.
DATA contains the text.
START and END should be passed in as the current selection of
the text. This selection is given in the same manner as TextEdit,
ie if START == END then there is no selection only an insertion
point. Also START ² END and 0 ² START ² length(DATA) and 0 ² END ² length(DATA).
If START and END are omitted, the whole of DATA is assumed.
In a scalar context, returns URL. In an array context, returns URL, START, END.
=cut
void
ICParseURL(ic, hint, sv, start=-1, end=-1)
ICInstance ic;
Str255 hint;
SV * sv;
long start;
long end;
PREINIT:
STRLEN len;
Ptr data;
Handle url;
PPCODE:
url = NewHandle(0);
data = (Ptr) SvPV(sv, len);
if (start == -1) {
start = 0;
end = len;
} else if (end == -1)
end = start;
gMacPerl_OSErr = ICParseURL(ic, hint, data, len, &start, &end, url);
if (!gMacPerl_OSErr)
if (GIMME != G_ARRAY) {
XPUSHs(sv_2mortal(MakeHndSV(url)));
} else {
XPUSHs(sv_2mortal(MakeHndSV(url)));
XPUSHs(sv_2mortal(newSViv(start)));
XPUSHs(sv_2mortal(newSViv(end)));
}
DisposeHandle(url);
=item ICLaunchURL INST, HINT, DATA, START, END
=item ICLaunchURL INST, HINT, DATA
Requires IC 1.1.
You must specify a configuration before calling this routine.
You do not have to be inside an ICBegin/End pair to call this routine.
Parses a URL out of the specified text and feeds it off to the appropriate helper.
HINT indicates the default scheme for URLs of the form "name@address".
If HINT is the empty string then URLs of that form are not allowed.
DATA contains the text.
START and END should be passed in as the current selection of
the text. This selection is given in the same manner as TextEdit,
ie if START == END then there is no selection only an insertion
point. Also START ² END and 0 ² START ² length(DATA) and 0 ² END ² length(DATA).
If START and END are omitted, the whole of DATA is assumed.
In a scalar context, returns URL. In an array context, returns URL, START, END.
=cut
void
ICLaunchURL(ic, hint, sv, start=-1, end=-1)
ICInstance ic;
Str255 hint;
SV * sv;
long start;
long end;
PREINIT:
STRLEN len;
Ptr data;
PPCODE:
data = (Ptr) SvPV(sv, len);
if (start == -1) {
start = 0;
end = len;
} else if (end == -1)
end = start;
gMacPerl_OSErr = ICLaunchURL(ic, hint, data, len, &start, &end);
if (!gMacPerl_OSErr)
if (GIMME != G_ARRAY) {
XPUSHs(sv_2mortal(newSViv(1)));
} else {
XPUSHs(sv_2mortal(newSViv(start)));
XPUSHs(sv_2mortal(newSViv(end)));
}
=item ICMapFileName INST, NAME
Returns the C<ICMapEntry> matching best the given name.
=cut
ICMapEntry
ICMapFilename(inst, filename)
ICInstance inst
Str255 filename
CODE:
if (gMacPerl_OSErr = ICMapFilename(inst, filename, &RETVAL)) {
XSRETURN_UNDEF;
}
OUTPUT:
RETVAL
=item ICMapTypeCreator INST, TYPE, CREATOR [, NAME]
Takes the type and creator (and optionally the name) of an outgoing
file and returns the most appropriate C<ICMapEntry>.
=cut
ICMapEntry
ICMapTypeCreator(inst, fType, fCreator, filename=NO_INIT)
ICInstance inst
OSType fType
OSType fCreator
Str255 filename
CODE:
if (items < 4)
filename[0] = 0;
if (gMacPerl_OSErr = ICMapTypeCreator(inst, fType, fCreator, filename, &RETVAL)) {
XSRETURN_UNDEF;
}
OUTPUT:
RETVAL
=item ICMapEntriesFileName INST, ENTRIES, NAME
Returns the C<ICMapEntry> matching best the given name.
=cut
ICMapEntry
ICMapEntriesFilename(inst, entries, filename)
ICInstance inst
Handle entries
Str255 filename
CODE:
if (gMacPerl_OSErr = ICMapEntriesFilename(inst, entries, filename, &RETVAL)) {
XSRETURN_UNDEF;
}
OUTPUT:
RETVAL
=item ICMapEntriesTypeCreator INST, ENTRIES, TYPE, CREATOR [, NAME]
Takes the type and creator (and optionally the name) of an outgoing
file and returns the most appropriate C<ICMapEntry>.
=cut
ICMapEntry
ICMapEntriesTypeCreator(inst, entries, fType, fCreator, filename=NO_INIT)
ICInstance inst
Handle entries
OSType fType
OSType fCreator
Str255 filename
CODE:
if (items < 5)
filename[0] = 0;
if (gMacPerl_OSErr = ICMapEntriesTypeCreator(inst, entries, fType, fCreator, filename, &RETVAL)) {
XSRETURN_UNDEF;
}
OUTPUT:
RETVAL
=item ICCountMapEntries INST, ENTRIES
Counts the number of entries in the map.
=cut
long
ICCountMapEntries(inst, entries)
ICInstance inst
Handle entries
CODE:
if (gMacPerl_OSErr = ICCountMapEntries(inst, entries, &RETVAL)) {
XSRETURN_UNDEF;
}
OUTPUT:
RETVAL
=item ICGetIndMapEntry INST, ENTRIES, INDEX
Returns the position of a map entry and the entry itself.
$map = ICGetIndMapEntry $inst, $entries, 5;
($pos, $map) = ICGetIndMapEntry $inst, $entries, 5;
=cut
void
ICGetIndMapEntry(inst, entries, ndx)
ICInstance inst
Handle entries
long ndx
PPCODE:
{
long pos;
ICMapEntry entry;
if (gMacPerl_OSErr = ICGetIndMapEntry(inst, entries, ndx, &pos, &entry)) {
XSRETURN_EMPTY;
}
XS_XPUSH(long, pos);
XS_XPUSH(ICMapEntry, entry);
}
=item ICGetMapEntry INST, ENTRIES, POS
Returns the entry located at position pos in the mappings database.
=cut
ICMapEntry
ICGetMapEntry(inst, entries, pos)
ICInstance inst
Handle entries
long pos
CODE:
if (gMacPerl_OSErr = ICGetMapEntry(inst, entries, pos, &RETVAL)) {
XSRETURN_UNDEF;
}
OUTPUT:
RETVAL
=item ICSetMapEntry INST, ENTRIES, POS, ENTRY
Replace the entry at position pos
=cut
MacOSRet
ICSetMapEntry(inst, entries, pos, entry)
ICInstance inst
Handle entries
long pos
ICMapEntry &entry
=item ICDeleteMapEntry INST, ENTRIES, POS
Delete the entry at position pos
=cut
MacOSRet
ICDeleteMapEntry(inst, entries, pos)
ICInstance inst
Handle entries
long pos
=item ICAddMapEntry INST, ENTRIES, ENTRY
Add an entry to the database.
=cut
MacOSRet
ICAddMapEntry(inst, entries, entry)
ICInstance inst
Handle entries
( run in 1.018 second using v1.01-cache-2.11-cpan-5511b514fd6 )