Пример #1
0
static int
fileEntryInDataEntries (
	int			nEntries,
	IceAuthDataEntry	*entries,
	IceAuthFileEntry	*fileEntry)
{
    int i;

#define SAME_STR(field) \
    ((entries->field != (char *)NULL) &&\
     (fileEntry->field != (char *)NULL) &&\
     (strcmp(entries->field, fileEntry->field) == 0))

    for (i = 0; i < nEntries; i++, entries++)
    {
	if (SAME_STR(protocol_name) &&
	    SAME_STR(network_id) &&
	    SAME_STR(auth_name))
	    return 1;
    }

#undef SAME_STR

    return 0;
}
Пример #2
0
int present(char *name)
{
  //  int len;
  char *suffix;
  if (name==NULL)
    {
      return FILE_LISTER_BAD_ARG;
    }

  /* length of the name */
  //  len = strlen(name);
  
  /* last occurance of . in name */
  suffix = strrchr(name, '.');
  if ( ( suffix != NULL ) &&
       SAME_STR(suffix, ".o"))
    {
      fprintf(stdout, "[obj] %s\n", name);
      return FILE_LISTER_OK;
    }
  return FILE_LISTER_SUFFIX_UNKNOWN;
}
Пример #3
0
//
//  For_Each_Unspecialized_Param: C
//
// We have to take into account specialization of refinements in order to know
// the correct order.  If someone has:
//
//     foo: func [a [integer!] /b [integer!] /c [integer!]] [...]
//
// They can partially specialize this as :foo/c/b.  This makes it seem to the
// caller a function originally written with spec:
//
//     [a [integer!] c [integer!] b [integer!]]
//
// But the frame order doesn't change; the information for knowing the order
// is encoded with instructions occupying the non-fully-specialized slots.
// (See %c-specialize.c for a description of the mechanic.)
//
// The true order could be cached when the function is generated, but to keep
// things "simple" we capture the behavior in this routine.
//
// Unspecialized parameters are visited in two passes: unsorted, then sorted.
//
void For_Each_Unspecialized_Param(
    REBACT *act,
    PARAM_HOOK hook,
    void *opaque
){
    REBDSP dsp_orig = DSP;

    // Do an initial scan to push the partial refinements in the reverse
    // order that they apply.  While walking the parameters in a potentially
    // "unsorted" fashion, offer them to the passed-in hook in case it has a
    // use for this first pass (e.g. just counting, to make an array big
    // enough to hold what's going to be given to it in the second pass.

    REBVAL *param = ACT_PARAMS_HEAD(act);
    REBVAL *special = ACT_SPECIALTY_HEAD(act);

    REBCNT index = 1;
    for (; NOT_END(param); ++param, ++special, ++index) {
        if (Is_Param_Hidden(param))
            continue;  // specialized out, not in interface

        Reb_Param_Class pclass = VAL_PARAM_CLASS(param);
        if (pclass == REB_P_RETURN or pclass == REB_P_LOCAL)
            continue;  // locals not in interface

        if (not hook(param, false, opaque)) { // false => unsorted pass
            DS_DROP_TO(dsp_orig);
            return;
        }

        if (IS_SYM_WORD(special)) {
            assert(TYPE_CHECK(param, REB_TS_REFINEMENT));
            Move_Value(DS_PUSH(), special);
        }
    }

    // Refinements are now on stack such that topmost is first in-use
    // specialized refinement.

    // Now second loop, where we print out just the normal args.
    //
    param = ACT_PARAMS_HEAD(act);
    for (; NOT_END(param); ++param) {
        if (Is_Param_Hidden(param))
            continue;

        if (TYPE_CHECK(param, REB_TS_REFINEMENT))
            continue;

        Reb_Param_Class pclass = VAL_PARAM_CLASS(param);
        if (pclass == REB_P_LOCAL or pclass == REB_P_RETURN)
            continue;

        if (not hook(param, true, opaque)) { // true => sorted pass
            DS_DROP_TO(dsp_orig);
            return;
        }
    }

    // Now jump around and take care of the partial refinements.

    DECLARE_LOCAL (unrefined);

    REBDSP dsp = DSP;  // highest priority are at *top* of stack, go downward
    while (dsp != dsp_orig) {
        param = ACT_PARAM(act, VAL_WORD_INDEX(DS_AT(dsp)));
        --dsp;

        Move_Value(unrefined, param);
        assert(TYPE_CHECK(unrefined, REB_TS_REFINEMENT));
        TYPE_CLEAR(unrefined, REB_TS_REFINEMENT);

        PUSH_GC_GUARD(unrefined);
        bool cancel = not hook(unrefined, true, opaque);  // true => sorted
        DROP_GC_GUARD(unrefined);

        if (cancel) {
            DS_DROP_TO(dsp_orig);
            return;
        }
    }

    // Finally, output any fully unspecialized refinements

    param = ACT_PARAMS_HEAD(act);

    for (; NOT_END(param); ++param) {
        if (Is_Param_Hidden(param))
            continue;

        if (not TYPE_CHECK(param, REB_TS_REFINEMENT))
            continue;

        dsp = dsp_orig;
        while (dsp != DSP) {
            ++dsp;
            if (SAME_STR(
                VAL_WORD_SPELLING(DS_AT(dsp)),
                VAL_PARAM_SPELLING(param)
            )){
                goto continue_unspecialized_loop;
            }
        }

        if (not hook(param, true, opaque)) {  // true => sorted pass
            DS_DROP_TO(dsp_orig);
            return; // stack should be balanced here
        }

      continue_unspecialized_loop:
        NOOP;
    }

    DS_DROP_TO(dsp_orig);
}