Пример #1
0
  void moduleInit() override {
    HHVM_ME(DateTime, __construct);
    HHVM_ME(DateTime, add);
    HHVM_ME(DateTime, diff);
    HHVM_ME(DateTime, format);
    HHVM_ME(DateTime, getOffset);
    HHVM_ME(DateTime, getTimestamp);
    HHVM_ME(DateTime, getTimezone);
    HHVM_ME(DateTime, modify);
    HHVM_ME(DateTime, setDate);
    HHVM_ME(DateTime, setISODate);
    HHVM_ME(DateTime, setTime);
    HHVM_ME(DateTime, setTimestamp);
    HHVM_ME(DateTime, setTimezone);
    HHVM_ME(DateTime, sub);
    HHVM_ME(DateTime, __sleep);
    HHVM_ME(DateTime, __wakeup);
    HHVM_ME(DateTime, __debuginfo);
    HHVM_STATIC_ME(DateTime, createFromFormat);
    HHVM_STATIC_ME(DateTime, getLastErrors);

    Native::registerNativeDataInfo<DateTimeData>(
      DateTimeData::s_className.get(), Native::NDIFlags::NO_SWEEP);

    REGISTER_TIME_ZONE_CONSTANT(AFRICA);
    REGISTER_TIME_ZONE_CONSTANT(AMERICA);
    REGISTER_TIME_ZONE_CONSTANT(ANTARCTICA);
    REGISTER_TIME_ZONE_CONSTANT(ARCTIC);
    REGISTER_TIME_ZONE_CONSTANT(ASIA);
    REGISTER_TIME_ZONE_CONSTANT(ATLANTIC);
    REGISTER_TIME_ZONE_CONSTANT(AUSTRALIA);
    REGISTER_TIME_ZONE_CONSTANT(EUROPE);
    REGISTER_TIME_ZONE_CONSTANT(INDIAN);
    REGISTER_TIME_ZONE_CONSTANT(PACIFIC);
    REGISTER_TIME_ZONE_CONSTANT(UTC);
    REGISTER_TIME_ZONE_CONSTANT(ALL);
    REGISTER_TIME_ZONE_CONSTANT(ALL_WITH_BC);
    REGISTER_TIME_ZONE_CONSTANT(PER_COUNTRY);

    HHVM_ME(DateTimeZone, __construct);
    HHVM_ME(DateTimeZone, getLocation);
    HHVM_ME(DateTimeZone, getName);
    HHVM_ME(DateTimeZone, getOffset);
    HHVM_ME(DateTimeZone, getTransitions);
    HHVM_STATIC_ME(DateTimeZone, listAbbreviations);
    HHVM_STATIC_ME(DateTimeZone, listIdentifiers);

    Native::registerNativeDataInfo<DateTimeZoneData>(
      DateTimeZoneData::s_className.get(), Native::NDIFlags::NO_SWEEP);

    HHVM_ME(DateInterval, __construct);
    HHVM_ME(DateInterval, __get);
    HHVM_ME(DateInterval, __set);
    HHVM_ME(DateInterval, format);
    HHVM_STATIC_ME(DateInterval, createFromDateString);

    Native::registerNativeDataInfo<DateIntervalData>(
      DateIntervalData::s_className.get(), Native::NDIFlags::NO_SWEEP);

    HHVM_FE(checkdate);
    HHVM_FE(date_parse_from_format);
    HHVM_FE(date_create);
    HHVM_FE(date_default_timezone_get);
    HHVM_FE(date_default_timezone_set);
    HHVM_FE(date_format);
    HHVM_FE(date_parse);
    HHVM_FE(date_sun_info);
    HHVM_NAMED_FE(date_sunrise, date_sunrise_sunset<false>);
    HHVM_NAMED_FE(date_sunset, date_sunrise_sunset<true>);
    HHVM_FE(date);
    HHVM_FE(getdate);
    HHVM_FE(gettimeofday);
    HHVM_FE(gmdate);
    HHVM_FE(gmmktime);
    HHVM_FE(gmstrftime);
    HHVM_FE(idate);
    HHVM_FE(localtime);
    HHVM_FE(microtime);
    HHVM_FE(mktime);
    HHVM_FE(strftime);
    HHVM_FE(strptime);
    HHVM_FE(strtotime);
    HHVM_FE(time);
    HHVM_FE(timezone_name_from_abbr);
    HHVM_FE(timezone_version_get);

#define SUNFUNCS_CNS(name, type) \
    Native::registerConstant<KindOfInt64> \
      (makeStaticString("SUNFUNCS_RET_" #name), \
      (int64_t)DateTime::SunInfoFormat::Return##type);
    SUNFUNCS_CNS(DOUBLE, Double);
    SUNFUNCS_CNS(STRING, String);
    SUNFUNCS_CNS(TIMESTAMP, TimeStamp);
#undef SUNFUNCS_CNS

    loadSystemlib("datetime");
  }
Пример #2
0
  virtual void moduleInit() {
    HHVM_ME(DateTime, __construct);
    HHVM_ME(DateTime, add);
    HHVM_ME(DateTime, diff);
    HHVM_ME(DateTime, format);
    HHVM_ME(DateTime, getOffset);
    HHVM_ME(DateTime, getTimestamp);
    HHVM_ME(DateTime, getTimezone);
    HHVM_ME(DateTime, modify);
    HHVM_ME(DateTime, setDate);
    HHVM_ME(DateTime, setISODate);
    HHVM_ME(DateTime, setTime);
    HHVM_ME(DateTime, setTimestamp);
    HHVM_ME(DateTime, setTimezone);
    HHVM_ME(DateTime, sub);
    HHVM_ME(DateTime, __sleep);
    HHVM_ME(DateTime, __wakeup);
    HHVM_ME(DateTime, __debuginfo);
    HHVM_STATIC_ME(DateTime, createFromFormat);
    HHVM_STATIC_ME(DateTime, getLastErrors);

    Native::registerNativeDataInfo<DateTimeData>(
      DateTimeData::s_className.get(), Native::NDIFlags::NO_SWEEP);

    REGISTER_TIME_ZONE_CONSTANT(AFRICA);
    REGISTER_TIME_ZONE_CONSTANT(AMERICA);
    REGISTER_TIME_ZONE_CONSTANT(ANTARCTICA);
    REGISTER_TIME_ZONE_CONSTANT(ARCTIC);
    REGISTER_TIME_ZONE_CONSTANT(ASIA);
    REGISTER_TIME_ZONE_CONSTANT(ATLANTIC);
    REGISTER_TIME_ZONE_CONSTANT(AUSTRALIA);
    REGISTER_TIME_ZONE_CONSTANT(EUROPE);
    REGISTER_TIME_ZONE_CONSTANT(INDIAN);
    REGISTER_TIME_ZONE_CONSTANT(PACIFIC);
    REGISTER_TIME_ZONE_CONSTANT(UTC);
    REGISTER_TIME_ZONE_CONSTANT(ALL);
    REGISTER_TIME_ZONE_CONSTANT(ALL_WITH_BC);
    REGISTER_TIME_ZONE_CONSTANT(PER_COUNTRY);

    HHVM_ME(DateTimeZone, __construct);
    HHVM_ME(DateTimeZone, getLocation);
    HHVM_ME(DateTimeZone, getName);
    HHVM_ME(DateTimeZone, getOffset);
    HHVM_ME(DateTimeZone, getTransitions);
    HHVM_STATIC_ME(DateTimeZone, listAbbreviations);
    HHVM_STATIC_ME(DateTimeZone, listIdentifiers);

    Native::registerNativeDataInfo<DateTimeZoneData>(
      DateTimeZoneData::s_className.get(), Native::NDIFlags::NO_SWEEP);

    HHVM_ME(DateInterval, __construct);
    HHVM_ME(DateInterval, __get);
    HHVM_ME(DateInterval, __set);
    HHVM_ME(DateInterval, format);
    HHVM_STATIC_ME(DateInterval, createFromDateString);

    Native::registerNativeDataInfo<DateIntervalData>(
      DateIntervalData::s_className.get(), Native::NDIFlags::NO_SWEEP);

    HHVM_FE(checkdate);
    HHVM_FE(date_parse_from_format);
    HHVM_FE(date_create);
    HHVM_FE(date_default_timezone_get);
    HHVM_FE(date_default_timezone_set);
    HHVM_FE(date_format);
    HHVM_FE(date_parse);
    HHVM_FE(date_sun_info);
    HHVM_FE(date_sunrise);
    HHVM_FE(date_sunset);
    HHVM_FE(date);
    HHVM_FE(getdate);
    HHVM_FE(gettimeofday);
    HHVM_FE(gmdate);
    HHVM_FE(gmmktime);
    HHVM_FE(gmstrftime);
    HHVM_FE(idate);
    HHVM_FE(localtime);
    HHVM_FE(microtime);
    HHVM_FE(mktime);
    HHVM_FE(strftime);
    HHVM_FE(strptime);
    HHVM_FE(strtotime);
    HHVM_FE(time);
    HHVM_FE(timezone_name_from_abbr);
    HHVM_FE(timezone_version_get);

    loadSystemlib("datetime");
  }