void ClassNode::GenerateCreateArrayMethod(const char* methodName, MethodNode* constructor) { IdentifyNode* name = (IdentifyNode*)newIdentify(methodName); ParameterNode* parameter = (ParameterNode*)newParameter(newPrimitiveType(newToken(snt_keyword_unsigned), pt_uint), 0, 0, newIdentify("count")); ParameterListNode* parameterList = (ParameterListNode*)newParameterList(0,0,parameter); MethodNode* method = (MethodNode*)newMethod(name, constructor->m_leftParenthesis, parameterList, constructor->m_rightParenthesis, constructor->m_constant); method->m_semicolon = constructor->m_semicolon; ScopeNameNode* scopeName = (ScopeNameNode*)newScopeName(m_name, 0, 0, 0); ScopeNameListNode* scopeNameList = (ScopeNameListNode*)newScopeNameList(0, scopeName); TypeNameNode* typeName = (TypeNameNode*)newTypeName(scopeNameList); TokenNode* passing = (TokenNode*)newToken('^'); setMethodResult(method, typeName, passing); setMethodResultArray(method); TokenNode* modifier = (TokenNode*)newToken(snt_keyword_static); setMethodModifier(method, modifier); if (constructor->m_filterNode) { method->m_filterNode = (TokenNode*)newToken(constructor->m_filterNode->m_nodeType); } method->m_enclosing = this; m_additionalMethods.push_back(method); }
static CFURLRequestRef willSendRequest(CFURLConnectionRef conn, CFURLRequestRef cfRequest, CFURLResponseRef cfRedirectResponse, const void* clientInfo) { #if LOG_DISABLED UNUSED_PARAM(conn); #endif ResourceHandle* handle = static_cast<ResourceHandle*>(const_cast<void*>(clientInfo)); if (!cfRedirectResponse) { CFRetain(cfRequest); return cfRequest; } LOG(Network, "CFNet - willSendRequest(conn=%p, handle=%p) (%s)", conn, handle, handle->firstRequest().url().string().utf8().data()); ResourceRequest request; if (cfRedirectResponse) { CFHTTPMessageRef httpMessage = CFURLResponseGetHTTPResponse(cfRedirectResponse); if (httpMessage && CFHTTPMessageGetResponseStatusCode(httpMessage) == 307) { RetainPtr<CFStringRef> lastHTTPMethod(AdoptCF, handle->lastHTTPMethod().createCFString()); RetainPtr<CFStringRef> newMethod(AdoptCF, CFURLRequestCopyHTTPRequestMethod(cfRequest)); if (CFStringCompareWithOptions(lastHTTPMethod.get(), newMethod.get(), CFRangeMake(0, CFStringGetLength(lastHTTPMethod.get())), kCFCompareCaseInsensitive)) { RetainPtr<CFMutableURLRequestRef> mutableRequest(AdoptCF, CFURLRequestCreateMutableCopy(0, cfRequest)); #if USE(CFURLSTORAGESESSIONS) wkSetRequestStorageSession(ResourceHandle::currentStorageSession(), mutableRequest.get()); #endif CFURLRequestSetHTTPRequestMethod(mutableRequest.get(), lastHTTPMethod.get()); FormData* body = handle->firstRequest().httpBody(); if (!equalIgnoringCase(handle->firstRequest().httpMethod(), "GET") && body && !body->isEmpty()) WebCore::setHTTPBody(mutableRequest.get(), body); String originalContentType = handle->firstRequest().httpContentType(); RetainPtr<CFStringRef> originalContentTypeCF(AdoptCF, originalContentType.createCFString()); if (!originalContentType.isEmpty()) CFURLRequestSetHTTPHeaderFieldValue(mutableRequest.get(), CFSTR("Content-Type"), originalContentTypeCF.get()); request = mutableRequest.get(); } } } if (request.isNull()) request = cfRequest; // Should not set Referer after a redirect from a secure resource to non-secure one. if (!request.url().protocolIs("https") && protocolIs(request.httpReferrer(), "https")) request.clearHTTPReferrer(); handle->willSendRequest(request, cfRedirectResponse); if (request.isNull()) return 0; cfRequest = request.cfURLRequest(); CFRetain(cfRequest); return cfRequest; }
/* readClass reads a class method description */ static void readMethods(FILE* fd, bool printit) { ObjectHandle classObj, methTable, theMethod, selector; # define LINEBUFFERSIZE 16384 char *cp, *eoftest, lineBuffer[LINEBUFFERSIZE]; ObjectHandle protocol; Parser pp; lineBuffer[0] = '\0'; protocol = nilobj; if (ll.nextToken() != nameconst) sysError("missing name","following Method keyword"); classObj = findClass(ll.strToken().c_str()); pp.setInstanceVariables(classObj); if (printit) cp = objectRef(classObj->basicAt(nameInClass)).charPtr(); /* now find or create a method table */ methTable = classObj->basicAt(methodsInClass); if (methTable == nilobj) { /* must make */ methTable = newDictionary(MethodTableSize); classObj->basicAtPut(methodsInClass, methTable); } if(ll.nextToken() == strconst) { protocol = newStString(ll.strToken().c_str()); } /* now go read the methods */ do { if (lineBuffer[0] == '|') /* get any left over text */ strcpy(textBuffer,&lineBuffer[1]); else textBuffer[0] = '\0'; while((eoftest = fgets(lineBuffer, LINEBUFFERSIZE, fd)) != NULL) { if ((lineBuffer[0] == '|') || (lineBuffer[0] == ']')) break; strcat(textBuffer, lineBuffer); } if (eoftest == NULL) { sysError("unexpected end of file","while reading method"); break; } /* now we have a method */ theMethod = newMethod(); pp.setLexer(Lexer(textBuffer)); if (pp.parseMessageHandler(theMethod, savetext)) { selector = theMethod->basicAt(messageInMethod); theMethod->basicAtPut(methodClassInMethod, classObj); theMethod->basicAtPut(protocolInMethod, protocol); if (printit) dspMethod(cp, selector->charPtr()); nameTableInsert(methTable, selector.hash(), selector, theMethod); } else { /* get rid of unwanted method */ givepause(); } } while (lineBuffer[0] != ']'); }
void NumberGenComboBox::handleIndexChanged(const int /*index*/) { emit newMethod(method()); emit newMethod((int)method()); emit newMethodCode(methodCode()); }
/* readClass reads a class method description */ static void readMethods(FILE *fd, boolean printit) { object classObj, methTable, theMethod, selector; # define LINEBUFFERSIZE 512 char *cp, *eoftest, lineBuffer[LINEBUFFERSIZE]; if (nextToken() != nameconst) sysError("missing name", "following Method keyword"); classObj = findClass(tokenString); setInstanceVariables(classObj); if (printit) cp = charPtr(basicAt(classObj, nameInClass)); /* now find or create a method table */ methTable = basicAt(classObj, methodsInClass); if (methTable == nilobj) /* must make */ { methTable = newDictionary(MethodTableSize); basicAtPut(classObj, methodsInClass, methTable); } /* now go read the methods */ do { if (lineBuffer[0] == '|') /* get any left over text */ strcpy(textBuffer, &lineBuffer[1]); else textBuffer[0] = '\0'; while ((eoftest = fgets(lineBuffer, LINEBUFFERSIZE, fd)) != NULL) { if ((lineBuffer[0] == '|') || (lineBuffer[0] == ']')) break; strcat(textBuffer, lineBuffer); } if (eoftest == NULL) { sysError("unexpected end of file", "while reading method"); break; } /* now we have a method */ theMethod = newMethod(); if (parse(theMethod, textBuffer, savetext)) { selector = basicAt(theMethod, messageInMethod); basicAtPut(theMethod, methodClassInMethod, classObj); if (printit) dspMethod(cp, charPtr(selector)); nameTableInsert(methTable, (int) selector, selector, theMethod); } else { /* get rid of unwanted method */ incr(theMethod); decr(theMethod); givepause(); } } while (lineBuffer[0] != ']'); }