Objective-C

1 program Added 2025-10-22T09:41:25Z Model: openai/gpt-4o-miniTemp: 0.4 Evidence Report issue View issues
Aliases: Obj-C, OC
Provenance: commit fae28ba33b · authored 2025-10-22T11:41:25+02:00 · model openai/gpt-4o-mini

Sources mentioning this language

8 sources · pl_id: pl/objective-c
LLM (this repo) · 1PldbLinguistPygmentsWikipediaHyperpolyglotRosettacodeWikidata · Q188531

Wikipedia infobox ↗

Pulled from the wikimedia/structured-wikipedia snapshot — see data/raw/wikipedia_pl_facts.*.jsonl and pl_fact.csv for the long-table provenance.

Paradigmsreflective · class-based object-oriented
Typingstatic, dynamic, weak
Designed byBrad Cox · Tom Love
First appeared1984
Influenced byC · Smalltalk
Homepagehttps://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html

Extensions claimed by this language

9 claims. Each row is one upstream assertion with its strength. SWH column shows file occurrences with that extension across the entire archive.
ExtensionSourceStrengthSWH
.cwikidataprimary209.3M files
.hwikidataprimary269.4M files
.mlinguistprimary52.6M files
.mpygmentsprimary52.6M files
.mwikidataprimary52.6M files
.mmwikidataprimary2.9M files
.hlinguistsecondary269.4M files
.hpygmentssecondary269.4M files
.hmanual_review:achermproposed269.4M files

Related languages

Objective-C++ (0.52)Objective-J (0.48)Objective Caml (0.37)OCaml (0.37)ObjectIcon (0.30)

Real programs from Software Heritage

7 samples mined from derived_datasets/<date>/contents/*.parquet, byte-verified against the SWH archive. Citation-grade qualified SWHIDs preserved.
GSConversationMoreContainerConfig.m · 3108 B · ext .m · SWH occurrences unknown
via swh_study:m (judge:claude-sonnet-4.6; judge:gemini-3.8-flash)
swh:1:cnt:45112c5a36dcee4af28ca21ca2f57f1990eeea52;origin=https://github.com/BusyCat/KaiXueLaiOS;path=/K12EDUIOS/ShangXueLa/ShangXueLa/UserInterface/Message/Session/Config/GSConversationMoreContainerConfig.m
Open in SWH · Raw bytes (SWH)
Reviews (2 LLM)
Ground truth · how?
🤖 anthropic-claude-sonnet-4.6 m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (UIKit/iOS messaging UI)
🤖 google-gemini-3.8-flash m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (UIKit)
Show source
//
//  GSConversationMoreContainerConfig.m
//  ShangXueLa
//
//  Created by yangqian on 15/10/22.
//  Copyright © 2015年 ShangXueLa. All rights reserved.
//

#import "GSConversationMoreContainerConfig.h"
#import "GSMediaItem.h"

@implementation GSConversationMoreContainerConfig
- (NSArray *)mediaItems
{
    return @[[GSMediaItem item:GSMediaButtonPicture
                   normalImage:[UIImage imageNamed:@"im_add_picture"]
                 selectedImage:[UIImage imageNamed:@"im_add_picture"]
                         title:@"相册"],
             
             [GSMediaItem item:GSMediaButtonShoot
                   normalImage:[UIImage imageNamed:@"im_add_camera"]
                 selectedImage:[UIImage imageNamed:@"im_add_camera"]
                         title:@"拍摄"],
             
             [GSMediaItem item:GSMediaButtonCard
                   normalImage:[UIImage imageNamed:@"im_add_card"]
                 selectedImage:[UIImage imageNamed:@"im_add_card"]
                         title:@"名片"],
             
             [GSMediaItem item:GSMediaButtonCall
                   normalImage:[UIImage imageNamed:@"im_add_phone"]
                 selectedImage:[UIImage imageNamed:@"im_add_phone"]
                         title:@"免费电话"]];
}

- (BOOL)shouldHideItem:(GSMediaItem *)item
{
    BOOL hidden = NO;
    if ([_conversation gsConversationType] == GSConversationChatGroup || [_conversation gsConversationType] == GSConversationClass || [_conversation gsConversationType] == GSConversationUnknown) {
        hidden = item.tag == GSMediaButtonCall;
    }
    if ([_conversation isPublicService]) {
        if (item.tag == GSMediaButtonCall || item.tag == GSMediaButtonCard) {
            hidden = YES;
        }
    }
    return hidden;
}

- (id<GSCellLayoutConfig>)layoutConfigWithMessage:(RCMessage *)message{
    return nil;
}

- (id<GSCellLayoutConfig>)layoutConfigWithCustomMessage:(GSCustomMessage *)customMessage{
    return nil;
}

- (BOOL)disableInputView{
    if (_conversation.gsConversationType == GSConversationClass) {
        if ([GSContacts retrievalClassesWithClassIds:@[_conversation.targetId] autoFill:NO].count==0) {//检查班级是否已经解散
            [SVProgressHUD showErrorWithStatus:@"班级已解散"];
            return YES;
        }else if (![GSContacts retrievalClassUser:CurrentUser.userId InClass:_conversation.targetId]){//检查我是都还在班级中
            [SVProgressHUD showErrorWithStatus:@"你已不在班级中"];
            return YES;
        }
        //    }else if (_conversation.gsConversationType == GSConversationChatGroup){
        //        if (![GSContacts retrievalChatGroupUser:CurrentUser.userId InChatGroup:_conversation.targetId]) {//判断是否还在群聊中
        //            [SVProgressHUD showErrorWithStatus:@"你已不在群聊中"];
        //            return YES;
        //        }
    }else if (_conversation.gsConversationType == GSConversationUnknown){
        [SVProgressHUD showErrorWithStatus:@"你们还不是好友"];
        return YES;
    }
    return NO;
}

@end
SWEyeDropperTool.m · 1876 B · ext .m · SWH occurrences unknown
via swh_study:m (judge:claude-sonnet-4.6; judge:gemini-3.8-flash; human:mathieu-acher)
swh:1:cnt:4b700d2e4564e793ec685f9bc5004a860d46020d;origin=https://github.com/cntrump/Paintbrush;path=/SWEyeDropperTool.m
Open in SWH · Raw bytes (SWH)
Reviews (1 human, 2 LLM)
Ground truth · how?
👤 mathieu-acher → pl/objective-c (high) 2026-10-02
A simple paint program for Mac OS X (probably written in Objective-C)
🤖 anthropic-claude-sonnet-4.6 m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (Cocoa/AppKit)
🤖 google-gemini-3.8-flash m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (Cocoa / AppKit)
Show source
/**
 * Paintbrush
 * Copyright (C) 2007-2019  Michael Schreiber
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#import "SWEyeDropperTool.h"
#import "SWToolboxController.h"


@implementation SWEyeDropperTool

- (NSBezierPath *)performDrawAtPoint:(NSPoint)point 
					   withMainImage:(NSBitmapImageRep *)mainImage 
						 bufferImage:(NSBitmapImageRep *)bufferImage 
						  mouseEvent:(SWMouseEvent)event
{
	// This should happen regardless of the type of click
	NSColor *colorClicked = [mainImage colorAtX:point.x y:(mainImage.pixelsHigh - point.y - 1)];
	
	if (colorClicked != nil) {
		NSColor *colorClickedConverted = [colorClicked colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]];
        if (flags & NSEventModifierFlagOption) {
			[[SWToolboxController sharedToolboxPanelController] setBackgroundColor:colorClickedConverted];
		} else {
			[[SWToolboxController sharedToolboxPanelController] setForegroundColor:colorClickedConverted];
		}
	}

	return nil;
}

- (NSCursor *)cursor
{
	if (!customCursor) {
		NSImage *customImage = [NSImage imageNamed:@"eyedrop-cursor.png"];
		customCursor = [[NSCursor alloc] initWithImage:customImage hotSpot:NSMakePoint(1,15)];
	}
	return customCursor;
}

- (NSString *)description
{
	return @"Eyedropper";
}


@end
ViewUtils.m · 4703 B · ext .m · SWH occurrences unknown
via swh_study:m (judge:claude-sonnet-4.6; judge:gemini-3.8-flash; human:mathieu-acher)
swh:1:cnt:ddf374993dccb95f9c334ef305acbf0100cc6fd3;origin=https://github.com/jay16/YongHui-IOS;path=/YH-IOS/Utils/ViewUtils/ViewUtils.m
Open in SWH · Raw bytes (SWH)
Reviews (1 human, 2 LLM)
Ground truth · how?
👤 mathieu-acher → pl/objective-c (medium) 2026-10-02
iOS app YongHui-IOS
🤖 anthropic-claude-sonnet-4.6 m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (UIKit, MBProgressHUD)
🤖 google-gemini-3.8-flash m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (Cocoa Touch / UIKit)
Show source
//
//  ViewUtils.m
//  iLogin
//
//  Created by lijunjie on 15/5/6.
//  Copyright (c) 2015年 Intfocus. All rights reserved.
//

#import "ViewUtils.h"
#define RMB_WAN 10000
#define TIME_HOUR 60

@implementation ViewUtils

+ (void) simpleAlertView: delegate Title: (NSString*) title Message: (NSString*) message ButtonTitle: (NSString*) buttonTitle {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title message:message delegate:delegate cancelButtonTitle:buttonTitle otherButtonTitles:nil];
    [alert show];
}

+ (UIView *)loadNibClass:(Class)cls {
    UINib *nib=[UINib nibWithNibName:NSStringFromClass(cls) bundle:nil];
    NSArray *views=[nib instantiateWithOwner:nil options:nil];
    return [views firstObject];
}


+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
    //UIGraphicsBeginImageContext(newSize);
    // In next line, pass 0.0 to use the current device's pixel scaling factor (and thus account for Retina resolution).
    // Pass 1.0 to force exact pixel size.
    UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
    [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
    UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return newImage;
}

/**
 *  弹出框架显示临时性文字
 *
 *  @param view controller.view
 *  @param text 提示文字
 */
+ (void)showPopupView:(UIView *)view Info:(NSString*)text {
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
    
    // Configure for text only and offset down
    hud.mode                      = MBProgressHUDModeText;
    hud.labelText                 = text;
    hud.margin                    = 10.f;
    hud.removeFromSuperViewOnHide = YES;
    
    [hud hide:YES afterDelay:1.5];
}

+ (void)showPopupView:(UIView *)view Info:(NSString*)text while:(void(^)(void))executeBlock {
    MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:view animated:YES];
    
    // Configure for text only and offset down
    hud.mode                      = MBProgressHUDModeText;
    hud.labelText                 = text;
    hud.margin                    = 10.f;
    hud.removeFromSuperViewOnHide = YES;
    
    executeBlock();
    
    [hud hide:YES];
}

/**
 *  tableViewCell根据内容自定义高度
 *
 *  @param text     cell显示内容
 *  @param width    cell的宽度,以此自适应高度
 *  @param fontSize 内容字段大小
 *
 *  @return CGSize
 */
+ (CGSize) sizeForTableViewCell:(NSString *)text
                          Width:(NSInteger)width
                       FontSize:(NSInteger)fontSize {
    UILabel *textLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width, 50000)];
    textLabel.text=text;
    textLabel.numberOfLines=0;
    textLabel.textColor = [UIColor whiteColor];
    textLabel.font = [UIFont systemFontOfSize:fontSize];
    [textLabel sizeToFit];
    CGRect rect = textLabel.frame;;
    return rect.size;
}

// 100000 元 => 10 万元
+ (NSDictionary *)dealWithMoney:(NSString *)nMoney {
    NSString *unit = @"元";
    NSInteger iMoney = [nMoney intValue];
    
    if (iMoney > RMB_WAN) {
        nMoney = [NSString stringWithFormat:@"%.1f", roundf(iMoney * 10 / RMB_WAN ) / 10];
        unit   = @"万元";
    }
    return [NSDictionary dictionaryWithObjectsAndKeys:nMoney,@"nMoney",unit,@"unit", nil];
}

// 90 分钟 => 1.5 小时
+ (NSDictionary *)dealWithHour:(NSString *)nTime {
    NSString *unit = @"分钟";
    NSInteger iTime = [nTime intValue];
    
    if (iTime > TIME_HOUR) {
        nTime = [NSString stringWithFormat:@"%.1f", roundf(iTime * 10 / TIME_HOUR ) / 10];
        unit   = @"小时";
    }
    return [NSDictionary dictionaryWithObjectsAndKeys:nTime,@"nTime",unit,@"unit", nil];
}

+ (NSString *)moneyformat:(int)num {
    NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
    [numberFormatter setPositiveFormat:@"###,##0"];
    return [numberFormatter stringFromNumber:[NSNumber numberWithInt: num]];
}

+ (NSString *)humanTimeInterval:(NSInteger)interval {
    NSString *humanSize = [NSString string];
    
    @try {
        NSInteger index = 0;
        NSArray *tokens = [NSArray arrayWithObjects:@"分钟",@"小时",@"天",nil];
        NSArray *intervals = [NSArray arrayWithObjects:@60, @60, @24, nil];
        
        while (interval > [intervals[index] integerValue]) {
            interval = interval / [intervals[index] integerValue];
        }
        humanSize = [NSString stringWithFormat:@"%li%@",(long)interval, tokens[index]];
    } @catch(NSException *e) {
        humanSize = [NSString stringWithFormat:@"%li%@",(long)interval, @"秒"];
    }
    
    return humanSize;
}

@end
GTKBin.m · 232 B · ext .m · SWH occurrences unknown
via swh_study:m (judge:claude-sonnet-4.6; judge:gemini-3.8-flash; human:mathieu-acher)
swh:1:cnt:461a890cf58094a804747f56e7288659685768b4;origin=https://github.com/KyleCardoza/GTKKit;path=/src/GTKBin.m
Open in SWH · Raw bytes (SWH)
Reviews (1 human, 2 LLM)
Ground truth · how?
👤 mathieu-acher → pl/objective-c (high) 2026-10-02
README GTKKit is a multithreaded MVC GUI framework, which implements a UIKit-style Objective-C API on top of the GTK+ cross-platform widget toolkit.
🤖 anthropic-claude-sonnet-4.6 m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (ObjFW + GTK+)
🤖 google-gemini-3.8-flash m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (ObjFW / GTK+ bindings)
Show source
#import <ObjFW/ObjFW.h>

#import <gtk/gtk.h>

#import "GTKBin.h"

@implementation GTKBin

- (GTKWidget *)childWidget
{
  GtkWidget *w = gtk_bin_get_child (GTK_BIN (self.widget));
  return [GTKWidget widgetFromGtkWidget: w];
}

@end
OrderHelper.m · 13391 B · ext .m · SWH occurrences unknown
via swh_study:m (judge:claude-sonnet-4.6; judge:gemini-3.8-flash; human:mathieu-acher)
swh:1:cnt:2b0a23329e4cc8db7ec5bfbecfb0e2a32cf92434;origin=https://github.com/Tjatse/TaurusAir;path=/Data/Helper/OrderHelper.m
Open in SWH · Raw bytes (SWH)
Reviews (1 human, 2 LLM)
Ground truth · how?
👤 mathieu-acher → pl/objective-c (high) 2026-10-01
🤖 anthropic-claude-sonnet-4.6 m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (iOS/UIKit, ASIHTTPRequest)
🤖 google-gemini-3.8-flash m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (Cocoa Touch)
Show source
//
//  OrderHelper.m
//  TaurusClient
//
//  Created by Tjatse on 13-1-4.
//  Copyright (c) 2013年 Taurus. All rights reserved.
//

#import "OrderHelper.h"
#import "AppContext.h"
#import "AppDefines.h"
#import "ASIHTTPRequest.h"
#import "ASIFormDataRequest.h"
#import "JSONKit.h"
#import "NSDictionaryAdditions.h"
#import "BBlock.h"

#import "ThreeCharCode.h"
#import "TwoCharCode.h"
#import "User.h"

@interface OrderHelper(Private)
+ (id)dummy: (NSString *)key;
@end

@implementation OrderHelper
#pragma mark Dummy Data
+ (id)dummy: (NSString *)key
{
    NSString *path = [[NSBundle mainBundle] pathForResource:key ofType:@"json"];
    NSString *content = [NSString stringWithContentsOfFile:path
                                                  encoding:NSUTF8StringEncoding
                                                     error:nil];
    
    return [content objectFromJSONString];
}

#pragma mark - Order List
+ (void)analyzeOrderListRet: (id)JSON
                    success: (void (^)(NSArray *results))success
                    failure: (void (^)(NSString *errorMsg))failure;
{
    if (JSON == [NSNull null] || JSON == nil) {
        failure(@"无法连接服务器。");
    }else{
        NSDictionary *meta= [JSON objectForKey:@"Meta"];
        
        if ([[meta getStringValueForKey:@"Method" defaultValue:@""] isEqualToString: @"GetTicketOrdersByCondition"] && [[meta getStringValueForKey:@"Status" defaultValue:@"fail"] isEqualToString:@"ok"]){
            NSArray *resp = [JSON objectForKey:@"Response"];
            if(resp) {
                success((NSNull *)resp == [NSNull null] ? @[]:resp);
            }else{
                failure([meta getStringValueForKey:@"Message" defaultValue:@"获取订单列表失败,服务器端返回错误。"]);
            }
        }else{
            failure([meta getStringValueForKey:@"Message" defaultValue:@"服务器返回数据错误。"]);
        }
    }
}
+ (void)orderListWithUser:(User *)user
                  success:(void (^)(NSArray *orders))success
                  failure:(void (^)(NSString *errMsg))failure
{
    if(IS_DEPLOYED()){
        if([AppContext get].online)
        {
            NSString *url = [NSString stringWithFormat:@"%@/%@", REACHABLE_HOST, ORDER_LIST];
            __block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];
            [request setPostValue:user.userId forKey:@"Tid"];
            [request setPostValue:user.loginName forKey:@"UserName"];
            [request setPostValue:user.guid forKey:@"Guid"];
            [request setPostValue:user.userPwd forKey:@"UserPwd"];
            
            [request setPostValue:@"1" forKey:@"NowPage"];
            [request setPostValue:@"10000" forKey:@"PerPageCount"];
            setRequestAuth(request);
            [request setCompletionBlock:^{
                id JSON = [[request responseString] objectFromJSONString];
                [self analyzeOrderListRet:JSON
                                  success:success
                                  failure:failure];
            }];
            [request setFailedBlock:^{
                failure([request.error localizedDescription]);
            }];
            [request startAsynchronous];
        }
        else
        {
            failure(@"当前网络不可用,且没有本地数据。");
        }
    }else{
        [BBlock dispatchAfter:1 onMainThread:^{
            id JSON = [self dummy:@"OrderList"];
            [self analyzeOrderListRet:JSON
                              success:success
                              failure:failure];
        }];
    }
}

#pragma mark - Order Detail
+ (void)analyzeOrderDetailRet: (id)JSON
                      success: (void (^)(NSDictionary *results))success
                      failure: (void (^)(NSString *errorMsg))failure;
{
    if (JSON == [NSNull null] || JSON == nil) {
        failure(@"无法连接服务器。");
    }else{
        NSDictionary *meta= [JSON objectForKey:@"Meta"];
        
        if ([[meta getStringValueForKey:@"Method" defaultValue:@""] isEqualToString: @"GetTicketOrderDetailById"] && [[meta getStringValueForKey:@"Status" defaultValue:@"fail"] isEqualToString:@"ok"]){
            NSDictionary *resp = [JSON objectForKey:@"Response"];
            if(resp) {
                success(resp);
            }else{
                failure([meta getStringValueForKey:@"Message" defaultValue:@"获取订单详细信息失败,服务器端返回错误。"]);
            }
        }else{
            failure([meta getStringValueForKey:@"Message" defaultValue:@"服务器返回数据错误。"]);
        }
    }
}
+ (void)orderDetailWithId:(NSString *)orderId
                   userId: (NSString *)userId
                  success:(void (^)(NSDictionary *order))success
                  failure:(void (^)(NSString *))failure
{
    if(IS_DEPLOYED()){
        if([AppContext get].online)
        {
            NSString *url = [NSString stringWithFormat:@"%@/%@", REACHABLE_HOST, ORDER_DETAIL];
            __block ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];
            [request setPostValue:userId forKey:@"Tid"];
            [request setPostValue:orderId forKey:@"OrderId"];
            setRequestAuth(request);
            [request setCompletionBlock:^{
                id JSON = [[request responseString] objectFromJSONString];
                [self analyzeOrderDetailRet:JSON
                                    success:success
                                    failure:failure];
            }];
            [request setFailedBlock:^{
                failure([request.error localizedDescription]);
            }];
            [request startAsynchronous];
        }
        else
        {
            failure(@"当前网络不可用,且没有本地数据。");
        }
    }else{
        [BBlock dispatchAfter:1 onMainThread:^{
            id JSON = [self dummy:@"OrderDetail"];
            [self analyzeOrderDetailRet:JSON
                                success:success
                                failure:failure];
        }];
    }
}

#pragma mark - place order

+ (void)performPlaceOrderWithFlightInfo:(NSArray*)flightInfos						// NSDictionary
							   andCabin:(NSArray*)cabins							// NSDictionary
						   andTravelers:(NSArray *)travelers
						   andContactor:(NSDictionary*)contactor
								success:(void (^)(NSDictionary *))success
								failure:(void (^)(NSString *))failure
{
	NSParameterAssert(success != nil);
	NSParameterAssert(failure != nil);
	
    if (IS_DEPLOYED()) {
        if ([AppContext get].online) {
            NSString *url = [NSString stringWithFormat:@"%@/%@", REACHABLE_HOST, kFlightPlaceOrderURL];
            __block ASIFormDataRequest* request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];

            // flight
			NSMutableString* flightStr = [NSMutableString string];
			
			for (int count = flightInfos.count, n = 0
				 ; n < count
				 ; ++n) {
				
				for (int travelersCount = travelers.count, m = 0
					 ; m < travelersCount
					 ; ++m) {

					if ([flightStr length] != 0) {
						[flightStr appendString:@"^"];
					}
					
					NSDictionary* flightInfo = flightInfos[n];
					NSString* twoCharCode = [flightInfo getStringValueForKey:@"Ezm" defaultValue:@""];
					NSString* fromToCode = [flightInfo getStringValueForKey:@"FromTo" defaultValue:@""];
					
					NSString* fromThreeCharCode = [fromToCode substringToIndex:3];
					NSString* toThreeCharCode = [fromToCode substringFromIndex:3];
					
					NSDictionary* cabin = cabins[n];
					
					// 格式:二字码_航班号_舱位_出发三字码_出发时间_到达三字码_到达时间^二字码_航班号_舱位_出发三字码_出发时间_到达三字码_到达时间
					// 如:CZ_CZ1234_Y_PEK_2012-12-25 11:00_SHA_2012-12-25 14:25^CZ_CZ1234_Y_PEK_2012-12-25 11:00_SHA_2012-12-25 14:25
					
					[flightStr appendFormat:@"%@_%@_%@_%@_%@_%@_%@"
					 , twoCharCode
					 , [flightInfo getStringValueForKey:@"FlightNum" defaultValue:@""]
					 , [cabin getStringValueForKey:@"CabinName" defaultValue:@""]
					 , fromThreeCharCode
					 , [flightInfo getStringValueForKey:@"LeaveTime" defaultValue:@""]
					 , toThreeCharCode
					 , [flightInfo getStringValueForKey:@"ArriveTime" defaultValue:@""]];
				}
			}
			
			// Traveler
			// 乘客
			NSMutableString* travelerStr = [NSMutableString string];
			for (int flightCount = flightInfos.count, m = 0
				 ; m < flightCount
				 ; ++m) {
				
				for (int count = travelers.count, n = 0
					 ; n < count
					 ; ++n) {
					
					// 格式:姓名_乘客类型_身份证号^姓名_乘客类型_身份证号
					// 如:张三_1_413024198309141234^李四_1_413024198309141234
					//
					// 乘客类型:1成人 2儿童
					if ([travelerStr length] != 0)
						[travelerStr appendString:@"^"];
					
					NSDictionary* traveler = travelers[n];
					
					// 姓名
					NSString* name = [traveler getStringValueForKey:@"Name" defaultValue:@""];
					
					// 乘客类型
					NSString* travelerType = [traveler getStringValueForKey:@"TravelerType" defaultValue:@""];
					
					// 身份证号
					NSString* chinaId = [traveler getStringValueForKey:@"ChinaId" defaultValue:@""];
					
					[travelerStr appendFormat:@"%@_%@_%@", name, travelerType, chinaId];
				}
			}
			
			// 联系人姓名 ContactorName
			NSString* contactorName = [contactor getStringValueForKey:@"Name" defaultValue:@""];
			
			// 联系人手机号 ContactorPhone
			NSString* contactorPhone = [contactor getStringValueForKey:@"Phone" defaultValue:@""];
			
			// 联系人email ContactorEmail
			NSString* contactorEmail = [contactor getStringValueForKey:@"Email" defaultValue:@""];
			
			// 乘客备注 PassengerRemark
			NSString* passengerRemark = @"";
			
			[request setPostValue:flightStr forKey:@"Flight"];
            [request setPostValue:travelerStr forKey:@"Traveler"];
            [request setPostValue:contactorName forKey:@"ContactorName"];
            [request setPostValue:contactorPhone forKey:@"ContactorPhone"];
            [request setPostValue:contactorEmail forKey:@"ContactorEmail"];
            [request setPostValue:passengerRemark forKey:@"PassengerRemark"];
            
			setRequestAuth(request);
            
			[request setCompletionBlock:^{
                id jsonObj = [[request responseString] mutableObjectFromJSONString];
				
 				if (![[jsonObj getStringValueForKeyPath:@"Meta.Status" defaultValue:@""] isEqualToString:@"ok"])
					failure([jsonObj getStringValueForKeyPath:@"Meta.Message" defaultValue:@"订单失败。"]);
				else
					success(jsonObj);
            }];
			
            [request setFailedBlock:^{
                failure([request.error localizedDescription]);
            }];
			
            [request startAsynchronous];
        } else {
            failure(@"当前网络不可用,且没有本地数据。");
        }
    } else {
        [BBlock dispatchAfter:0.2f onMainThread:^{
			NSString* path = [[NSBundle mainBundle] pathForResource:@"PlaceOrder" ofType:@"js"];
			NSString* content = [NSString stringWithContentsOfFile:path
														  encoding:NSUTF8StringEncoding
															 error:nil];
			
			NSMutableDictionary* jsonContent = [[content mutableObjectFromJSONString] objectForKey:@"Response"];
			
			success(jsonContent);
        }];
    }
}

+ (void)performCreatePayUrl:(NSDictionary *)placeOrderJson
					success:(void (^)(NSDictionary *))success
					failure:(void (^)(NSString *))failure
{
	NSParameterAssert(success != nil);
	NSParameterAssert(failure != nil);
	
	if (IS_DEPLOYED()) {
        if ([AppContext get].online) {
            NSString *url = [NSString stringWithFormat:@"%@/%@", REACHABLE_HOST, kOrderCreatePayUrl];
            __block ASIFormDataRequest* request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];
			
//			OrderId	Y	订单Id
//			PayPlat	Y	支付平台  如2表示支付宝
			
			NSString* orderId = [placeOrderJson getStringValueForKey:@"Response" defaultValue:@""];
            NSString* payPlat = @"2";
			
			[request setPostValue:orderId forKey:@"OrderId"];
            [request setPostValue:payPlat forKey:@"PayPlat"];
            
			setRequestAuth(request);
            
			[request setCompletionBlock:^{
                id jsonObj = [[request responseString] mutableObjectFromJSONString];
				
				if (![[jsonObj getStringValueForKeyPath:@"Meta.Status" defaultValue:@""] isEqualToString:@"ok"])
					failure([jsonObj getStringValueForKeyPath:@"Meta.Message" defaultValue:@"支付失败。"]);
				else
					success(jsonObj);
            }];
			
            [request setFailedBlock:^{
                failure([request.error localizedDescription]);
            }];
			
            [request startAsynchronous];
        } else {
            failure(@"当前网络不可用,且没有本地数据。");
        }
    } else {
        [BBlock dispatchAfter:0.2f onMainThread:^{
			NSString* path = [[NSBundle mainBundle] pathForResource:@"CreatePayUrl" ofType:@"js"];
			NSString* content = [NSString stringWithContentsOfFile:path
														  encoding:NSUTF8StringEncoding
															 error:nil];
			
			NSMutableDictionary* jsonContent = [[content mutableObjectFromJSONString] objectForKey:@"Response"];
			
			success(jsonContent);
        }];
    }
}

@end
AboutWindowController.m · 2506 B · ext .m · SWH occurrences unknown
via swh_study:m (judge:claude-sonnet-4.6; judge:gemini-3.8-flash)
swh:1:cnt:32d17b6311486f86b2651c4a9bce616c63ccc934;origin=https://github.com/hokhyk/teleport;path=/client/tp_assist_macos/src/AboutWindowController.m
Open in SWH · Raw bytes (SWH)
Reviews (2 LLM)
Ground truth · how?
🤖 anthropic-claude-sonnet-4.6 m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (AppKit/Cocoa, macOS)
🤖 google-gemini-3.8-flash m-judge/1 → pl/objective-c (high) 2026-09-29
Objective-C (Cocoa/AppKit)
Show source
//
//  AboutWindowController.m
//  TPAssist
//
//  Created by ApexLiu at 2017-09-13.
//

#import "AboutWindowController.h"

@interface AboutWindowController ()

@end

@implementation AboutWindowController
@synthesize aboutWindow;
@synthesize appName;
@synthesize appVersion;
@synthesize appCopyright;

NSDictionary *plistDict;

- (id)initWithWindow:(NSWindow *)window
{
    aboutWindow = [super initWithWindow:window];
    if (self) {
        // Initialization code here.
    }
    return self;
}

- (void)windowDidLoad
{
    [super windowDidLoad];
    //Prevent the window from changing positions after multiple opens.
    [aboutWindow setShouldCascadeWindows:NO];
    
    //Load the plist so we can get current info for the about box.
    plistDict = [[NSBundle mainBundle] infoDictionary];
    
    //Get the application name.
//    id applicationName = [plistDict objectForKey:@"CFBundleName"];
    //Get the build version.
    id applicationVersion = [plistDict objectForKey:@"CFBundleVersion"];
    //Get the copyright.
//    id applicationCopyright = [plistDict objectForKey:@"NSHumanReadableCopyright"];
    
    //Build the string for the windows title.
    // NSString *aboutTitle = [NSString stringWithFormat:@"%@%@", NSLocalizedString(@"About ",nil), applicationName];
    NSString *strTitle = [NSString stringWithFormat:@"%@%@",
                          NSLocalizedString(@"about ",nil),
                          NSLocalizedString(@"app_name",nil)];
    [aboutWindow.window setTitle:strTitle];
    
    //Build the string for the application name. appName - tagline
    NSString *strProgName = [NSString stringWithFormat:@"%@", NSLocalizedString(@"app_full_name", nil)];
    [appName setStringValue:strProgName];
    
    //Build the string for the version. Version: $build
    NSString *strVersion = [NSString stringWithFormat:@"%@%@", NSLocalizedString(@"version", nil), applicationVersion];
    [appVersion setStringValue:strVersion];

    NSString *strCopyright = [NSString stringWithFormat:@"%@", NSLocalizedString(@"copyright", nil)];
    [appCopyright setStringValue:strCopyright];
}

- (IBAction)btnHomepage:(id)sender {
    
    //Get the homepage from the plist
    id applicationHomepage = [plistDict objectForKey:@"Product Homepage"];
    //Build the homepage's URL.
    NSURL *homeURL = [NSURL URLWithString:applicationHomepage];
    
    //Go to the website.
    [[NSWorkspace sharedWorkspace] openURL:homeURL];
    
    //Close the about box.
    [aboutWindow close];
}
@end
XSetModifierMapping.m · 13796 B · ext .m · SWH occurrences unknown
via manual-request
swh:1:cnt:f851a314d7b2dfc8949028f3671dba8f268ac4ee;origin=https://gitlab.freedesktop.org/xorg/test/xts;anchor=swh:1:rev:497a0865d1fa51adbba53c5c1c930dd18beacc4e;path=/xts5/tset/Xlib13/XSetModifierMapping/XSetModifierMapping.m
Open in SWH · Raw bytes (SWH)
Reviews (1 human)
Ground truth · how?
👤 mathieu-acher → pl/new:xlib-and-x-protocol-test-suite (medium) amended 2026-06-12
X Test Suite (XTS), test file for X11 https://www.freedesktop.org/software/fontconfig/xtest/progguide.pdf
Show source
Copyright (c) 2005 X.Org Foundation L.L.C.

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
$Header: /cvs/xtest/xtest/xts5/tset/Xlib13/XSetModifierMapping/XSetModifierMapping.m,v 1.2 2005-11-03 08:42:41 jmichael Exp $

Copyright (c) Applied Testing and Technology, Inc. 1995
All Rights Reserved.

>># Project: VSW5
>># 
>># File: xts5/tset/Xlib13/XSetModifierMapping/XSetModifierMapping.m
>># 
>># Description:
>># 	Tests for XSetModifierMapping()
>># 
>># Modifications:
>># $Log: stmdfrmppn.m,v $
>># Revision 1.2  2005-11-03 08:42:41  jmichael
>># clean up all vsw5 paths to use xts5 instead.
>>#
>># Revision 1.1.1.2  2005/04/15 14:05:19  anderson
>># Reimport of the base with the legal name in the copyright fixed.
>>#
>># Revision 8.0  1998/12/23 23:33:43  mar
>># Branch point for Release 5.0.2
>>#
>># Revision 7.0  1998/10/30 22:55:28  mar
>># Branch point for Release 5.0.2b1
>>#
>># Revision 6.0  1998/03/02 05:25:07  tbr
>># Branch point for Release 5.0.1
>>#
>># Revision 5.0  1998/01/26 03:21:39  tbr
>># Branch point for Release 5.0.1b1
>>#
>># Revision 4.0  1995/12/15 09:08:39  tbr
>># Branch point for Release 5.0.0
>>#
>># Revision 3.1  1995/12/15  01:10:04  andy
>># Prepare for GA Release
>>#
/*
Portions of this software are based on Xlib and X Protocol Test Suite.
We have used this material under the terms of its copyright, which grants
free use, subject to the conditions below.  Note however that those
portions of this software that are based on the original Test Suite have
been significantly revised and that all such revisions are copyright (c)
1995 Applied Testing and Technology, Inc.  Insomuch as the proprietary
revisions cannot be separated from the freely copyable material, the net
result is that use of this software is governed by the ApTest copyright.

Copyright (c) 1990, 1991  X Consortium

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.

Permission to use, copy, modify, distribute, and sell this software and
its documentation for any purpose is hereby granted without fee,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of UniSoft not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.  UniSoft
makes no representations about the suitability of this software for any
purpose.  It is provided "as is" without express or implied warranty.
*/
>>TITLE XSetModifierMapping Xlib13
int
xname
Display	*display = Dsp;
XModifierKeymap	*modmap;
>>SET return-value MappingSuccess
>>EXTERN

static	XModifierKeymap	*origmap;

static	int	Minkc, Maxkc;

>>SET startup savemap
static void
savemap()
{
	startup();
	if(Dsp) {
		origmap = XGetModifierMapping(Dsp);
		XDisplayKeycodes(Dsp, &Minkc, &Maxkc);
	}
}

>>SET cleanup cleanmap
static void
cleanmap()
{
	if(Dsp)
		XSetModifierMapping(Dsp, origmap);
	cleanup();
}

>>ASSERTION Good A
A succesful call to xname
specifies the KeyCodes of the keys that are to be used
as modifiers and returns
.S MappingSuccess .
>>STRATEGY
Set up a modifier map.
Call xname to set servers map.
Verify that MappingSuccess is returned.
Get current map with XGetModifierMapping.
Verify that the mapping has been set correctly.
>>CODE
int 	i;
int 	kpm;
XModifierKeymap	*newmap;

	/*
	 * Because some keycodes may not be usable as modifiers in a server
	 * dependent fashion, then we must take steps to avoid this.
	 * Therefore: get current modifiers and rearrange them.
	 */
	kpm = origmap->max_keypermod;
	modmap = XNewModifiermap(kpm);
	if (modmap == 0) {
		delete("Could not create new map");
		return;
	}

	for (i = 0; i < kpm*8; i++)
		modmap->modifiermap[i] = origmap->modifiermap[kpm*8-1 - i];

	XCALL;

	newmap = XGetModifierMapping(display);

	if (newmap->max_keypermod == modmap->max_keypermod)
		CHECK;
	else {
		report("max_keypermod was %d, expecting %d", newmap->max_keypermod,
			modmap->max_keypermod);
		FAIL;
	}
	for (i = 0; i < kpm*8; i++) {
		if (modmap->modifiermap[i] == newmap->modifiermap[i])
			CHECK;
		else {
			report("Modifier map was not set correctly");
			FAIL;
			break;
		}
	}
	CHECKPASS(1+kpm*8);

	XFreeModifiermap(newmap);
>>ASSERTION Good A
When a call to xname succeeds, then a
.S MappingNotify
event is generated.
>>STRATEGY
Call xname to set mapping.
Verify that a MappingNotify event is generated.
>>CODE
int 	n;
XEvent	ev;
XMappingEvent	good;

	modmap = origmap;

	XCALL;

	defsetevent(good, display, MappingNotify);
	good.window = None;	/* unused */
	good.request = MappingModifier;
	/* rest not used */

	n = getevent(display, &ev);
	if (n == 0 || ev.type != MappingNotify) {
		report("Expecting a MappingNotify event");
		FAIL;
		return;
	} else
		CHECK;

	if (checkevent((XEvent*)&good, &ev))
		FAIL;
	else
		CHECK;

	CHECKPASS(2);
>>ASSERTION def
The
.M modifiermap
member of the
.S XModifierKeymap
structure contains eight sets of
.M max_keypermod
KeyCodes, one for each modifier in the order
.S Shift ,
.S Lock ,
.S Control ,
.S Mod1 ,
.S Mod2 ,
.S Mod3 ,
.S Mod4 ,
and
.S Mod5 .
>>ASSERTION Good A
When a zero KeyCode occurs in a set, then it is ignored.
>>STRATEGY
>># This is not really true in any sense that we can test.
>># Check that 0 does not generate BadValue when used multiple times.
Set up a mapping with all keycodes zero.
Set mapping with xname.
Verify no BadValue error.
>># Verify that mapping did not change.
>>CODE
XModifierKeymap	*oldmap;
int 	i;

	oldmap = XGetModifierMapping(display);
	if (oldmap == 0) {
		delete("Could not get the old map");
		return;
	}

	modmap = XNewModifiermap(1);
	for (i = 0; i < 8; i++)
		modmap->modifiermap[i] = 0;

	XCALL;

	if (geterr() == Success)
		CHECK;

	CHECKPASS(1);

>>ASSERTION Bad C
When an implementation restriction on which keys can be used
as modifiers is violated,
then a call to xname returns
.S MappingFailed
and none of the modifiers are changed.
>>STRATEGY
Try in turn all possible keycodes.
If all return MappingSuccess:
  Report unsupported.
else
  Verify that MappingFailed is returned.
  Verify that modifier has not been set to this keycode.
>>CODE
int 	i;
int 	ret;
int 	found;
XModifierKeymap *newmap;
unsigned int	kc;

	if ((modmap = XNewModifiermap(1)) == 0) {
		delete("Failed to create new modifier map");
		return;
	}

	for (i = 0; i < 8; i++)
		modmap->modifiermap[i] = 0;

	found = 0;
	for (kc = Minkc; kc <= Maxkc; kc++) {
		modmap->modifiermap[0] = (KeyCode)kc;

		ret = XCALL;

		if (ret != MappingSuccess) {

			found = True;

			if (ret != MappingFailed) {
				report("Return value was %d, expecting MappingFailure", ret);
				FAIL;
				break;
			}
			newmap = XGetModifierMapping(display);

			if (newmap->modifiermap[0] == (KeyCode)kc) {
				report("An invalid keycode (%u) was set into the map", kc);
				FAIL;
				break;
			} else
				CHECK;
		} else
			CHECK;
	}

	if (!found)
		unsupported("All keycodes are acceptable as modifiers for this server");
	else
		CHECKPASS(Maxkc-Minkc+1);

>>ASSERTION Bad B 3
When the new KeyCodes specified for a modifier differ from those
currently defined and any of the
current or new keys for that modifier are
in the logically down state, then a call to xname returns
.S MappingBusy
and none of the modifiers are changed.
>>STRATEGY
If extension available:
  Get current modifier mapping (other tests may have changed it from origmap).
  Make a new modifier map by permuting the old.
  Check there is at least one non-zero keycode in it.
  Simulate pressing this key using extension.
  Call xname to set the new mod. map.
  Expect MappingBusy
  Release all keys.
  Get current mapping with XGetModifierMapping.
  Compare with that got at first.
  Remove key from map.
  Simulate pressing key not in the map.
  Call xname.
  Expect MappingBusy as one of current (at time of xname call) mod keys pressed.
  Release all keys.
  Call xname to set up map to not include this key.
  Expect MappingSuccess.
  Simulate pressing key not in the map.
  Call xname.
  Expect !MappingBusy as key not in current or new maps (at time of xname call).
  Release all keys.
else
  Report untested.
>>CODE
int 	i;
int 	kpm;
int	modkc;
XModifierKeymap	*newmap;
XModifierKeymap	*oldmap;
int	ret;
KeyCode *kcp;

	if (noext(0))
		return;
	else
		CHECK;

	oldmap = XGetModifierMapping(display);

	/*
	 * Because some keycodes may not be usable as modifiers in a server
	 * dependent fashion, then we must take steps to avoid this.
	 * Therefore: get current modifiers and rearrange them.
	 */
	kpm = oldmap->max_keypermod;
	modmap = XNewModifiermap(kpm);
	if (modmap == 0) {
		delete("Could not create new map");
		XFreeModifiermap(oldmap);
		return;
	}

	modkc = 0;
	for (i = 0; i < kpm*8; i++) {
		KeyCode kc = modmap->modifiermap[i] = oldmap->modifiermap[kpm*8-1 - i];

		if (!modkc && kc) {
			modkc = kc;
			kcp = &(modmap->modifiermap[i]);
		}
	}

	if (!modkc) {
		delete("Can't find a usable modifier key code.");
		XFreeModifiermap(oldmap);
		XFreeModifiermap(modmap);
		return;
	} else
		CHECK;

	keypress(display, modkc);

	ret = XCALL;

	relalldev();

	if (ret == MappingBusy)
		CHECK;
	else {
		report("Key %d did not cause MappingBusy when pressed.", modkc);
		FAIL;
	}
	/* now check no change occurred */
	newmap = XGetModifierMapping(display);

	if (newmap->max_keypermod == oldmap->max_keypermod)
		CHECK;
	else {
		report("max_keypermod was %d, expecting %d", newmap->max_keypermod,
			oldmap->max_keypermod);
		FAIL;
	}
	for (i = 0; i < kpm*8; i++) {
		if (oldmap->modifiermap[i] == newmap->modifiermap[i])
			CHECK;
		else {
			report("Modifier map was not set correctly");
			FAIL;
			break;
		}
	}

	/* use a key not in new map, but in current, and expect MappingBusy */
	*kcp = 0; /* remove modkc from map */
	keypress(display, modkc);
	ret = XCALL;
	relalldev();

	if (ret == MappingBusy)
		CHECK;
	else {
		report("Pressing key %d caused %s, not MappingBusy, though in old map.",
			modkc, (ret==MappingSuccess)?"MappingSuccess":"MappingFailed");
		FAIL;
	}
	/* make sure that key is not in map, now */
	ret = XCALL;
	if (ret != MappingSuccess) {
		delete("Can't install new mod. map not including key %d.", modkc);
		XFreeModifiermap(modmap);
		XFreeModifiermap(oldmap);
		XFreeModifiermap(newmap);
		return;
	} else
		CHECK;
	/* use a key not in the new or current map and expect other than MappingBusy */
	keypress(display, modkc);
	ret = XCALL;
	relalldev();

	if (ret != MappingBusy)
		CHECK;
	else {
		report("Pressing key %d caused MappingBusy though not in new or old map.", modkc);
		FAIL;
	}

	XFreeModifiermap(modmap);
	XFreeModifiermap(oldmap);
	XFreeModifiermap(newmap);

	CHECKPASS(7 + kpm*8);
>>SET return-value MappingSuccess
>>ASSERTION Bad B 3
.ER BadAlloc
>>ASSERTION Bad A
When a KeyCode is not in the range returned by
>># This was an error not spotted in the assertion reviews.
>># .F XDisplayCodes ,
.F XDisplayKeycodes ,
then a
.S BadValue
error occurs.
>>STRATEGY
Call XDisplayKeycodes to get range of valid keycodes.
Set up map with keycode less than the minimum value.
Call xname.
Verify that a BadValue error occurs.

Set up map with keycode greater than the maximum value (if possible).
Call xname.
Verify that a BadValue error occurs.
>>CODE BadValue
>>SET return-value MappingFailed
int 	i;

	modmap = XNewModifiermap(1);
	for (i = 0; i < 8*modmap->max_keypermod; i++)
		modmap->modifiermap[i] = 0;

	modmap->modifiermap[0] = Minkc-1;
	XCALL;

	if (geterr() == BadValue)
		CHECK;
	else
		FAIL;

	if (Maxkc+1 < 0xff) {
		modmap->modifiermap[0] = Maxkc+1;
		XCALL;

		if (geterr() == BadValue)
			CHECK;
		else
			FAIL;
	} else
		CHECK;

	CHECKPASS(2);

Programs collected by LLM agents experimental · unverified

Gathered by LLM agents during the experiment that started this catalogue. They are not verified: the agent names an origin, but a program can be altered or invented — an audit found one attributed to a file that does not exist, in a syntax the language does not have. Prefer the programs archived by Software Heritage above. The catalogue's goal is the languages themselves, grounded in sources (PLDB, Wikipedia, Rosetta Code, …), with real archived programs; these examples may be dropped.

Simple Objective-C Program

Provenance: commit fae28ba33b · authored 2025-10-22T11:41:25+02:00 · model openai/gpt-4o-mini · Temp 0.4
code.m · license: MIT · added: 2025-10-22T09:41:25Z
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSString *greeting = @"Hello, World!";
        NSLog(@"%@", greeting);
    }
    return 0;
}

Disambiguation rules

Linguist heuristic rules that predict this language when one of its claimed extensions is shared with another.
RuleExtKindPredicates (truncated)
h/linguist/.h/0.hpredicates[{"kind": "any", "regexes": ["^\\s*(@(interface|class|protocol|property|end|synchronised|selector|implementation)\\b|#import\\s+.+\\.h[\">])"]}]
h/linguist/.m/0.mpredicates[{"kind": "any", "regexes": ["^\\s*(@(interface|class|protocol|property|end|synchronised|selector|implementation)\\b|#import\\s+.+\\.h[\">])"]}]

Contribute — propose a file extension

Tell us where to find evidence about Objective-C (mapped to pl/objective-c). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/Objective-C/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Objective LOLCODE Objective-C++ →