Project

Profile

Help

Revision 08626590

Added by O'Neil Delpratt 5 months ago

Saxon/C PHP development - refactor XsltExecutable and Xslt30Processor in separate files

View differences:

src/main/c/Saxon.C.API/PHP7-Build/php7_Xslt30Processor.cpp
129 129
    }
130 130
}
131 131

  
132
PHP_METHOD(Xslt30Processor, transformToFile)
133
{
134
    Xslt30Processor *xslt30Processor;
135

  
136
    if (ZEND_NUM_ARGS()>1) {
137
        WRONG_PARAM_COUNT;
138
    }
139

  
140

  
141
    zval* oth;
142

  
143

  
144
    if (ZEND_NUM_ARGS() == 1 && zend_parse_parameters(ZEND_NUM_ARGS() , "z", &oth) == FAILURE) {
145
        RETURN_NULL();
146
    }
147

  
148
    zend_object* pobj = Z_OBJ_P(getThis());
149
    xslt30Processor_object *obj = (xslt30Processor_object *)((char *)pobj - XtOffsetOf(xslt30Processor_object, std));
150
    xslt30Processor = obj->xslt30Processor;
151

  
152
    if (xslt30Processor != nullptr) {
153
        if(!oth) {
154
            php_error(E_WARNING, "Error setting source value");
155
            return;
156
        } else {
157
            if(ZEND_NUM_ARGS() == 0) {
158
                xslt30Processor->transformToFile();
159
            } else {
160
                if(Z_TYPE_P(oth) == mIS_NULL){
161
                    php_error(E_WARNING,"Error setting source value");
162
                    return;
163
                }
164

  
165
                const char *objName = ZSTR_VAL(Z_OBJCE_P(oth)->name);
166 132

  
167
                if(strcmp(objName,"Saxon\\XdmNode")==0) {
168
                    zend_object *nobj = Z_OBJ_P(oth);
169

  
170
                    xdmNode_object *ooth = (xdmNode_object *) ((char *) nobj -
171
                                                               XtOffsetOf(xdmNode_object, std));//(xdmNode_object*)Z_OBJ_P(oth);
172
                    if(ooth != nullptr) {
173
                        XdmNode *value = ooth->xdmNode;
174
                        if(value != nullptr) {
175
                            xslt30Processor->transformToFile(value);
176
                        }
177
                    }
178
                }
179

  
180
            }
181
        }
182
    }
183
}
184 133

  
185 134
PHP_METHOD(Xslt30Processor, compileFromFile)
186 135
{
......
336 285
        PHP_ME(Xslt30Processor,  transformFileToFile, nullptr, ZEND_ACC_PUBLIC)
337 286
        PHP_ME(Xslt30Processor,  transformFileToString, nullptr, ZEND_ACC_PUBLIC)
338 287
        PHP_ME(Xslt30Processor,  transformFileToValue, nullptr, ZEND_ACC_PUBLIC)
339
        PHP_ME(Xslt30Processor,  transformToFile, nullptr, ZEND_ACC_PUBLIC)
340 288
        PHP_ME(Xslt30Processor, compileFromFile, nullptr, ZEND_ACC_PUBLIC)
341 289
        PHP_ME(Xslt30Processor, compileFromValue, nullptr, ZEND_ACC_PUBLIC)
342 290
        PHP_ME(Xslt30Processor, compileFromString, nullptr, ZEND_ACC_PUBLIC)

Also available in: Unified diff