100+ results for 'php printf'

Not the results you expected?

class-cp-user-relationships.php (https://gitlab.com/clusterpress/clusterpress) PHP · 543 lines

1 <?php

2 /**

3 * ClusterPress User Relationships.

400

401 $sql = array(

402 'select' => sprintf( 'SELECT %s FROM %s', esc_sql( $column ), $this->table ),

403 'where' => array(),

404 );

465

466 $sql = array(

467 'select' => sprintf( 'SELECT count( %s ) FROM %s', esc_sql( $column ), $this->table ),

468 'where' => array(),

469 );

476

477 if ( $group_by && in_array( $group_by, array( 'user_id', 'primary_id', 'secondary_id' ) ) ) {

478 $sql['select'] = sprintf( 'SELECT DISTINCT %s, count( %s ) as count FROM %s', esc_sql( $group_by ), esc_sql( $column ), $this->table );

479 $sql['groupby'] = sprintf( 'GROUP BY %s', esc_sql( $group_by ) );

zone.php (https://bitbucket.org/sandeepbhaskar/inspiredliving.git) PHP · 441 lines

1 <?php

2 class ControllerLocalisationZone extends Controller {

3 private $error = array();

410

411 if ($store_total) {

412 $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);

413 }

414

416

417 if ($address_total) {

418 $this->error['warning'] = sprintf($this->language->get('error_address'), $address_total);

419 }

420

422

423 if ($affiliate_total) {

424 $this->error['warning'] = sprintf($this->language->get('error_affiliate'), $affiliate_total);

425 }

426

DefaultOptions.php (https://github.com/Exercise/symfony.git) PHP · 320 lines

1 <?php

2

3 /*

18 * Helper for specifying and resolving inter-dependent options.

19 *

20 * Options are a common pattern for initializing classes in PHP. Avoiding the

21 * problems related to this approach is however a non-trivial task. Usually,

22 * both classes and subclasses should be able to set default option values.

293

294 if (count($diff) > 1) {

295 throw new InvalidOptionException(sprintf('The options "%s" do not exist. Known options are: "%s"', implode('", "', $diff), implode('", "', $knownOptions)));

296 }

297

298 if (count($diff) > 0) {

299 throw new InvalidOptionException(sprintf('The option "%s" does not exist. Known options are: "%s"', current($diff), implode('", "', $knownOptions)));

300 }

301 }

length_class.php (https://bitbucket.org/elena_dyavolova/omf.git) PHP · 412 lines

1 <?php

2 class ControllerLocalisationLengthClass extends Controller {

3 private $error = array();

399

400 if ($product_total) {

401 $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);

402 }

403 }

lr0.c (https://bitbucket.org/iorivur/freebsd-bhyve-with-suspend-resume.git) C · 599 lines

97

98 #ifdef TRACE

99 fprintf(stderr, "Entering append_states()\n");

100 #endif

101 for (i = 1; i < nshifts; i++)

167

168 #ifdef TRACE

169 fprintf(stderr, "Entering get_state(%d)\n", symbol);

170 #endif

171

289

290 #ifdef TRACE

291 fprintf(stderr, "Entering new_state(%d)\n", symbol);

292 #endif

293

Service.php (https://bitbucket.org/resourcemode/smodels.git) PHP · 439 lines

1 <?php

2 /**

3 * Smodels

250 $attrValue = new ProductAttributeValue(array('uid'=>$attrValueUid)); //$this->getByUid($attrValueUid);

251 // if(!$attrValue) {

252 // $this->messages[] = sprintf('Unable to load attribute value: %s', $attrValue);

253 // }

254 $prodAttrValColl->append($attrValue);

Create.php (https://gitlab.com/crazybutterfly815/magento2) PHP · 374 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

358 public function saveCreditCard($paymentMethod, $creditCardSave)

359 {

360 $saveCard = sprintf($this->vaultCheckbox, $paymentMethod);

361 $this->_rootElement->find($saveCard, Locator::SELECTOR_CSS, 'checkbox')->setValue($creditCardSave);

362 }

ConstructorAnnotationsInspectorTest.php (https://gitlab.com/nstwf.pro/json-mapper) PHP · 413 lines

1 <?php

2

3

26 use Nstwf\JsonMapper\Unit\Implementation\UnionEnumObject;

27 use Nstwf\JsonMapper\Unit\Implementation\UnionScalarTypesObject;

28 use PHPUnit\Framework\TestCase;

29 use Psr\SimpleCache\CacheInterface;

30

377 $cache = $this->createMock(CacheInterface::class);

378 $cache->method('has')

379 ->with(sprintf('%s-%s', ConstructorAnnotationsInspector::class, NoTypeObject::class))

380 ->willReturn(false);

381 $cache->expects($this->once())

382 ->method('set')

383 ->with(sprintf('%s-%s', ConstructorAnnotationsInspector::class, NoTypeObject::class));

384

385 $reflection = new ReflectionWrapper(NoTypeObject::class);

TraitUsageGenerator.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 353 lines

1 <?php

2 /**

3 * Zend Framework (http://framework.zend.com/)

317 // validation check

318 if ($this->classGenerator->hasMethod($alias['alias'])) {

319 throw new Exception\RuntimeException(sprintf(

320 'Generation Error: Aliased method %s already exists on this class',

321 $alias['alias']

xil_testcache.c (https://gitlab.com/21mece13/FreeRTOS) C · 371 lines

64 #include "xil_types.h"

65

66 extern void xil_printf(const char8 *ctrl1, ...);

67

68 #define DATA_LENGTH 128

96 INTPTR Value;

97

98 xil_printf("-- Cache Range Test --\n\r");

99

100 for (Index = 0; Index < DATA_LENGTH; Index++)

101 Data[Index] = 0xA0A00505;

102

103 xil_printf(" initialize Data done:\r\n");

104

105 Xil_DCacheFlushRange((INTPTR)Data, DATA_LENGTH * sizeof(INTPTR));

ClassScanner.php (https://github.com/tjswebdesign/zf2.git) PHP · 494 lines

1 <?php

2

3 namespace Zend\Code\Scanner;

434 && !is_subclass_of($returnScannerClass, $baseScannerClass)

435 ) {

436 throw new Exception\RuntimeException(sprintf(

437 'Class must be or extend "%s"', $baseScannerClass

438 ));

ListenerOptions.php (https://gitlab.com/yousafsyed/easternglamor) PHP · 396 lines

1 <?php

2 /**

3 * Zend Framework (http://framework.zend.com/)

89 if (!is_array($modulePaths) && !$modulePaths instanceof Traversable) {

90 throw new Exception\InvalidArgumentException(

91 sprintf(

92 'Argument passed to %s::%s() must be an array, '

93 . 'implement the Traversable interface, or be an '

135 if (!is_array($configGlobPaths) && !$configGlobPaths instanceof Traversable) {

136 throw new Exception\InvalidArgumentException(

137 sprintf(

138 'Argument passed to %s::%s() must be an array, '

139 . 'implement the Traversable interface, or be an '

161 if (!is_array($configStaticPaths) && !$configStaticPaths instanceof Traversable) {

162 throw new Exception\InvalidArgumentException(

163 sprintf(

164 'Argument passed to %s::%s() must be an array, '

165 . 'implement the Traversable interface, or be an '

voucher.php (https://bitbucket.org/elena_dyavolova/omf.git) PHP · 263 lines

1 <?php

2 class ControllerAccountVoucher extends Controller {

3 private $error = array();

14 if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {

15 $this->session->data['vouchers'][mt_rand()] = array(

16 'description' => sprintf($this->language->get('text_for'), $this->currency->format($this->currency->convert($this->request->post['amount'], $this->currency->getCode(), $this->config->get('config_currency'))), $this->request->post['to_name']),

17 'to_name' => $this->request->post['to_name'],

18 'to_email' => $this->request->post['to_email'],

58 $this->data['entry_theme'] = $this->language->get('entry_theme');

59 $this->data['entry_message'] = $this->language->get('entry_message');

60 $this->data['entry_amount'] = sprintf($this->language->get('entry_amount'), $this->currency->format($this->config->get('config_voucher_min')), $this->currency->format($this->config->get('config_voucher_max')));

61

62 $this->data['button_continue'] = $this->language->get('button_continue');

247

248 if (($this->currency->convert($this->request->post['amount'], $this->currency->getCode(), $this->config->get('config_currency')) < $this->config->get('config_voucher_min')) || ($this->currency->convert($this->request->post['amount'], $this->currency->getCode(), $this->config->get('config_currency')) > $this->config->get('config_voucher_max'))) {

249 $this->error['amount'] = sprintf($this->language->get('error_amount'), $this->currency->format($this->config->get('config_voucher_min')), $this->currency->format($this->config->get('config_voucher_max')) . ' ' . $this->currency->getCode());

250 }

251

order_status.php (https://gitlab.com/shapcy/opencart) PHP · 380 lines

1 <?php

2 class ControllerLocalisationOrderStatus extends Controller {

3 private $error = array();

245 $data['pagination'] = $pagination->render();

246

247 $data['results'] = sprintf($this->language->get('text_pagination'), ($order_status_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($order_status_total - $this->config->get('config_limit_admin'))) ? $order_status_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $order_status_total, ceil($order_status_total / $this->config->get('config_limit_admin')));

248

249 $data['sort'] = $sort;

366

367 if ($store_total) {

368 $this->error['warning'] = sprintf($this->language->get('error_store'), $store_total);

369 }

370

372

373 if ($order_total) {

374 $this->error['warning'] = sprintf($this->language->get('error_order'), $order_total);

375 }

376 }

vec.c (https://github.com/llucax/dmd.git) C · 656 lines

58 if (vec_count != 0)

59 {

60 printf("vec_count = %d\n",vec_count);

61 assert(0);

62 }

120 vec_dim(v) = dim;

121 vec_numbits(v) = numbits;

122 /*printf("vec_calloc(%d): v = %p vec_numbits = %d vec_dim = %d\n",

123 numbits,v,vec_numbits(v),vec_dim(v));*/

124 vec_count++;

167 void vec_free(vec_t v)

168 {

169 /*printf("vec_free(%p)\n",v);*/

170 if (v)

171 { size_t dim = vec_dim(v);

shipping.php (https://gitlab.com/reclamare/mao) PHP · 268 lines

1 <?php

2 class ControllerApiShipping extends Controller {

3 public function address() {

73 foreach ($custom_fields as $custom_field) {

74 if (($custom_field['location'] == 'address') && $custom_field['required'] && empty($this->request->post['custom_field'][$custom_field['custom_field_id']])) {

75 $json['error']['custom_field' . $custom_field['custom_field_id']] = sprintf($this->language->get('error_custom_field'), $custom_field['name']);

76 }

77 }

tabs_helper.php (https://github.com/rickogden/joind.in.git) PHP · 337 lines

1 <?php

2 /**

3 * Helpers for creating Accessible Tabs.

4 *

5 * PHP version 5

6 *

7 * @category Joind.in

145 }

146 ?>

147 <div id="<?php echo $this->_containerName; ?>-tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">

148 <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">

149 <?php

160 ?>

161 </ul>

162 <?php foreach($contentList as $hash=>$tabContent):

163 echo $tabContent;

164 endforeach; ?>

srm_env.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 300 lines ✨ Summary

This C code creates a Linux kernel module that provides access to an SRM (System Resource Management) interface on Alpha systems. It sets up directories and nodes in the /proc filesystem, allowing users to read and write values associated with system resources. The module is initialized at boot time and unloaded when the system shuts down.

208 */

209 for (var_num = 0; var_num <= 255; var_num++)

210 sprintf(number[var_num], "%ld", var_num);

211

212 /*

membership_account.php (https://gitlab.com/najomie/fit-hippie) PHP · 265 lines

1 <div class="ms-account-wrapper">

2 <?php if ( ms_is_user_logged_in() ) : ?>

3

4 <?php

7 <div id="account-membership">

8 <h2>

9 <?php

10 echo get_ms_ac_title();

11

15 ?>

16 </h2>

17 <?php

18 /**

19 * Add custom content right before the memberships list.

30 <table>

31 <tr>

32 <th class="ms-col-membership"><?php

33 _e( 'Membership name', 'membership2' );

34 ?></th>

weight_class.php (https://bitbucket.org/deringer/opencart.git) PHP · 412 lines

1 <?php

2 class ControllerLocalisationWeightClass extends Controller {

3 private $error = array();

399

400 if ($product_total) {

401 $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);

402 }

403 }

errors.php (https://github.com/greevex/mzz-framework-blank-application.git) PHP · 288 lines

163 if ($expectation = $this->_extractExpectation()) {

164 list($expected, $message) = $expectation;

165 $this->_test->assert($expected, $content, sprintf(

166 $message,

167 "%s -> PHP error [$content] severity [" .

177 * @return mixed False if none, or a list of error

178 * information. Elements are: severity

179 * as the PHP error code, the error message,

180 * the file with the error, the line number

181 * and a list of PHP super global arrays.

224 $expected,

225 $content,

226 sprintf($message, "Expected PHP error [$content] severity [$severity] in [$file] line [$line]"));

227 }

228

tax_class.php (https://bitbucket.org/mjalajel/opencart.git) PHP · 413 lines

1 <?php

2 class ControllerLocalisationTaxClass extends Controller {

3 private $error = array();

244 $this->data['pagination'] = $pagination->render();

245

246 $this->data['results'] = sprintf($this->language->get('text_pagination'), ($tax_class_total) ? (($page - 1) * $this->config->get('config_admin_limit')) + 1 : 0, ((($page - 1) * $this->config->get('config_admin_limit')) > ($tax_class_total - $this->config->get('config_admin_limit'))) ? $tax_class_total : ((($page - 1) * $this->config->get('config_admin_limit')) + $this->config->get('config_admin_limit')), $tax_class_total, ceil($tax_class_total / $this->config->get('config_admin_limit')));

247

248 $this->data['sort'] = $sort;

400

401 if ($product_total) {

402 $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);

403 }

404 }

PropertyPathBuilder.php (https://github.com/deviantintegral/symfony.git) PHP · 299 lines

1 <?php

2

3 /*

95 {

96 if (!isset($this->elements[$offset])) {

97 throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset));

98 }

99

150 {

151 if (!isset($this->elements[$offset])) {

152 throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset));

153 }

154

171 {

172 if (!isset($this->elements[$offset])) {

173 throw new OutOfBoundsException(sprintf('The offset %s is not within the property path', $offset));

174 }

175

return_status.php (https://gitlab.com/reclamare/mao) PHP · 375 lines

1 <?php

2 class ControllerLocalisationReturnStatus extends Controller {

3 private $error = array();

245 $data['pagination'] = $pagination->render();

246

247 $data['results'] = sprintf($this->language->get('text_pagination'), ($return_status_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($return_status_total - $this->config->get('config_limit_admin'))) ? $return_status_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $return_status_total, ceil($return_status_total / $this->config->get('config_limit_admin')));

248

249 $data['sort'] = $sort;

361

362 if ($return_total) {

363 $this->error['warning'] = sprintf($this->language->get('error_return'), $return_total);

364 }

365

367

368 if ($return_total) {

369 $this->error['warning'] = sprintf($this->language->get('error_return'), $return_total);

370 }

371 }

Item.php (https://bitbucket.org/dnejedly/eaparts.git) PHP · 335 lines

1 <?php

2 /**

3 * Magento

8 * that is bundled with this package in the file LICENSE.txt.

9 * It is also available through the world-wide-web at this URL:

10 * http://opensource.org/licenses/osl-3.0.php

11 * If you did not receive a copy of the license and are unable to

12 * obtain it through the world-wide-web, please send an email

22 * @package Mage_Sales

23 * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)

24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

25 */

26

198 * Check qty availability

199 */

200 $qtyToInvoice = sprintf("%F", $this->getOrderItem()->getQtyToInvoice());

201 $qty = sprintf("%F", $qty);

utilities.c (https://github.com/ekcell/lovdbyless.git) C · 446 lines

355 {

356 #if 0

357 fprintf(stderr, "faulty slice operation:\n");

358 debug(z, -1, 0);

359 #endif

428 int i;

429 int limit = SIZE(z->p);

430 /*if (number >= 0) printf("%3d (line %4d): '", number, line_count);*/

431 if (number >= 0) printf("%3d (line %4d): [%d]'", number, line_count,limit);

432 for (i = 0; i <= limit; i++) {

433 if (z->lb == i) printf("{");

434 if (z->bra == i) printf("[");

435 if (z->c == i) printf("|");

436 if (z->ket == i) printf("]");

move.php (https://github.com/MarxGames/E-Hobused.git) PHP · 328 lines

1 <?php

2 include_once 'models/game.php';

57 // Don forget call parent::save($game)!

58 public function save(Game $game) {

59 $q = sprintf("UPDATE game SET checksum = checksum + 1 WHERE id = %d;", $game->values['id']);

60 $game->values['checksum'] += 1;

61 query($q);

77 parent::save($game);

78

79 $query_string = sprintf("INSERT INTO move(game_id, type, object, param1) ".

80 "VALUES (%d, 'add_horse', %d, %d);",

81 $game->values['id'],

109 parent::save($game);

110

111 $query_string = sprintf("INSERT INTO move(game_id, type, subject, object, round, param1, param2, param3) ".

112 "VALUES (%d, 'place_horse', %d, %d, %d, %d, %d, %d);",

113 $game->values['id'],

Grammar.php (https://github.com/sergiosgc/Structures_Grammar.git) PHP · 407 lines

1 <?php

2 /* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */

3 namespace sergiosgc;

165 public function addRule($value)

166 {

167 if ($this->isRegular() && !$value->isRegular()) throw new Structures_Grammar_RestrictionException(sprintf(

168 'Trying to add non regular rule to regular grammar (%s)', (string) $value));

169 if ($this->isContextFree() && !$value->isContextFree()) throw new Structures_Grammar_RestrictionException(sprintf(

314 public function setRegular($value)

315 {

316 if ($value && !$this->testRegular()) foreach ($this->rules as $rule) if (!$rule->isRegular()) throw new Structures_Grammar_RestrictionException(sprintf('Grammar is not regular. Unable to introduce restriction. Rule \'%s\' is not regular', (string) $rule));

317 $this->regular = $value;

318 if ($value) $this->setContextFree(true);

388 {

389 $result = '';

390 foreach ($this->rules as $index => $value) $result .= sprintf("[%d] %s\n", $index, (string) $value);

391

392 return $result;

filespec.c (https://bitbucket.org/olioengr/dmd.git) C · 424 lines

153 cwd = (char *)mem_calloc(strlen(cwd_t) + 1 + strlen(p) + 1);

154 #if SUN || M_UNIX || M_XENIX || linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun&&__SVR4

155 sprintf(cwd, "%s/%s", cwd_t, p); /* add relative directory */

156 #endif

157 #if MSDOS || __OS2__ || __NT__ || _WIN32

158 sprintf(cwd, "%s\\%s", cwd_t, p); /* add relative directory */

159 #endif

160 mem_free(cwd_t);

174 cwd = (char *)mem_calloc(strlen(cwd_t) + 1 + strlen(p) + 1);

175 #if SUN || M_UNIX || M_XENIX || linux || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun&&__SVR4

176 sprintf(cwd, "%s/%s", cwd_t, p); /* add relative directory */

177 #endif

178 #if MSDOS || __OS2__ || __NT__ || _WIN32

Definition.php (https://github.com/nattaphat/hgis.git) PHP · 659 lines

1 <?php

2

3 /*

249 {

250 if ($index < 0 || $index > count($this->arguments) - 1) {

251 throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1));

252 }

253

283 {

284 if ($index < 0 || $index > count($this->arguments) - 1) {

285 throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1));

286 }

287

323 {

324 if (empty($method)) {

325 throw new InvalidArgumentException(sprintf('Method name cannot be empty.'));

326 }

327 $this->calls[] = array($method, $arguments);

Form.php (https://github.com/flubbers/cloudFutbol.git) PHP · 390 lines

1 <?php

2

3 /*

123

124 /**

125 * Gets the field values as PHP.

126 *

127 * This method converts fields with th array notation

128 * (like foo[bar] to arrays) like PHP does.

129 *

130 * @return array An array of field values.

132 * @api

133 */

134 public function getPhpValues()

135 {

136 $qs = http_build_query($this->getValues());

PU_test_dcp_role.php (https://github.com/CircleCode/dynacase-core.git) PHP · 432 lines

1 <?php

2 /*

3 * @author Anakeen

13 */

14

15 require_once 'PU_testcase_dcp_commonfamily.php';

16

17 class TestRole extends TestCaseDcpCommonFamily

58

59 foreach ($expectedRoles as $roleLogin) {

60 $this->assertTrue(in_array($roleLogin, $uRoleLogins) , sprintf("role %s must be present", $roleLogin));

61 }

62 foreach ($uRoleLogins as $roleLogin) {

63 $this->assertTrue(in_array($roleLogin, $expectedRoles) , sprintf("role %s must not be present", $roleLogin));

64 }

65 }

Config.cpp (https://gitlab.com/DELTA_37/Config) C++ · 746 lines

6 if (this->IntK == IntN)

7 {

8 printf("AddIntMax");

9 return -1;

10 }

23 if (DoubleK == DoubleN)

24 {

25 printf("AddDoubleMax");

26 return -1;

27 }

40 if (StringK == StringN)

41 {

42 printf("AddStringMax");

43 }

44 else

Collection.php (https://bitbucket.org/dnejedly/eaparts.git) PHP · 333 lines

1 <?php

2 /**

3 * Magento

8 * that is bundled with this package in the file LICENSE.txt.

9 * It is also available through the world-wide-web at this URL:

10 * http://opensource.org/licenses/osl-3.0.php

11 * If you did not receive a copy of the license and are unable to

12 * obtain it through the world-wide-web, please send an email

22 * @package Mage_Catalog

23 * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)

24 * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)

25 */

26

297 foreach ($attributes as $attribute) {

298 $table = $this->getLinkModel()->getAttributeTypeTable($attribute['type']);

299 $alias = sprintf('link_attribute_%s_%s', $attribute['code'], $attribute['type']);

300

301 $joinCondiotion = array(

Route.php (https://bitbucket.org/laborautonomo/laborautonomo-site.git) PHP · 594 lines

1 <?php

2

3 /*

568 {

569 if (!is_string($regex)) {

570 throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" must be a string.', $key));

571 }

572

580

581 if ('' === $regex) {

582 throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" cannot be empty.', $key));

583 }

584

switch_.d (https://github.com/SDX2000/helios.git) D · 430 lines

31 in

32 {

33 //printf("in _d_switch_string()\n");

34 assert(table.length >= 0);

35 assert(ca.length >= 0);

58 int cj;

59

60 //printf("out _d_switch_string()\n");

61 if (result == -1)

62 {

90 body

91 {

92 //printf("body _d_switch_string(%.*s)\n", ca.length, ca.ptr);

93 size_t low = 0;

94 size_t high = table.length;

xallocx.c (https://github.com/rillian/firefox.git) C · 497 lines

380 uint8_t c0;

381

382 malloc_printf(" p=%p, c=%#x, len=%zu:", p, c, len);

383 range0 = 0;

384 c0 = pc[0];

385 for (i = 0; i < len; i++) {

386 if (pc[i] != c0) {

387 malloc_printf(" %#x[%zu..%zu)", c0, range0, i);

388 range0 = i;

389 c0 = pc[i];

390 }

391 }

392 malloc_printf(" %#x[%zu..%zu)\n", c0, range0, i);

393 }

394

nf_conntrack_expect.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 627 lines ✨ Summary

This C code implements a module for the Linux kernel that manages network traffic tracking, specifically for the nf_conntrack_expect protocol. It initializes and cleans up data structures to track expected connections, including a hash table and cache, and provides a proc file interface to display information about tracked connections. The code is part of the Linux networking subsystem.

507

508 if (expect->timeout.function)

509 seq_printf(s, "%ld ", timer_pending(&expect->timeout)

510 ? (long)(expect->timeout.expires - jiffies)/HZ : 0);

511 else

512 seq_printf(s, "- ");

513 seq_printf(s, "l3proto = %u proto=%u ",

520

521 if (expect->flags & NF_CT_EXPECT_PERMANENT) {

522 seq_printf(s, "PERMANENT");

523 delim = ",";

524 }

525 if (expect->flags & NF_CT_EXPECT_INACTIVE)

526 seq_printf(s, "%sINACTIVE", delim);

527

528 return seq_putc(s, '\n');

Query.php (https://github.com/mpous/mandango.git) PHP · 606 lines

1 <?php

2

3 /*

51 $hash = $this->repository->getDocumentClass();

52

53 if (version_compare(PHP_VERSION, '5.3.6', '=>')) {

54 $debugBacktrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);

55 } else {

220 {

221 if (null !== $references && !is_array($references)) {

222 throw new \InvalidArgumentException(sprintf('The references "%s" are not valid.', $references));

223 }

224

254 {

255 if (null !== $sort && !is_array($sort)) {

256 throw new \InvalidArgumentException(sprintf('The sort "%s" is not valid.', $sort));

257 }

258

function.html_select_time.php (https://github.com/cabenitez/factuweb.git) PHP · 364 lines

1 <?php

2 /**

3 * Smarty plugin

10 * @ignore

11 */

12 require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');

13 /**

14 * @ignore

15 */

16 require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');

17

18 /**

23 * Purpose: Prints the dropdowns for time selection

24 *

25 * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}

26 * (Smarty online manual)

27 * @author Roberto Berto <roberto@berto.net>

DelegatingValidator.php (https://github.com/xbojer/gfw.git) PHP · 259 lines

1 <?php

2

3 /*

250 if (is_string($form)) {

251 if (!isset($forms[$form])) {

252 throw new FormException(sprintf('The child form with path "%s" does not exist', $form));

253 }

254

Message.php (https://github.com/schmittjoh/JMSTranslationBundle.git) PHP · 409 lines

1 <?php

2

3 declare(strict_types=1);

293 {

294 if ($this->id !== $message->getId()) {

295 throw new RuntimeException(sprintf('You can only merge messages with the same id. Expected id "%s", but got "%s".', $this->id, $message->getId()));

296 }

297

328 {

329 if ($this->id !== $message->getId()) {

330 throw new RuntimeException(sprintf('You can only merge messages with the same id. Expected id "%s", but got "%s".', $this->id, $message->getId()));

331 }

332

361 {

362 if ($this->id !== $message->getId()) {

363 throw new RuntimeException(sprintf('You can only merge messages with the same id. Expected id "%s", but got "%s".', $this->id, $message->getId()));

364 }

365

NameContext.php (https://gitlab.com/madwanz64/laravel) PHP · 285 lines

1 <?php declare(strict_types=1);

2

3 namespace PhpParser;

4

5 use PhpParser\Node\Name;

6 use PhpParser\Node\Name\FullyQualified;

7 use PhpParser\Node\Stmt;

8

9 class NameContext

70

71 $this->errorHandler->handleError(new Error(

72 sprintf(

73 'Cannot use %s%s as %s because the name is already in use',

74 $typeStringMap[$type], $name, $aliasName

Module.php (https://github.com/turanga/Tinyboard.git) PHP · 302 lines

1 <?php

2

3 /*

25

26 /**

27 * Compiles the node to PHP.

28 *

29 * @param Twig_Compiler A Twig_Compiler instance

103 {

104 $compiler

105 ->write("<?php\n\n")

106 // if the filename contains */, add a blank to avoid a PHP parse error

107 ->write("/* ".str_replace('*/', '* /', $this->getAttribute('filename'))." */\n")

108 ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->getAttribute('filename')))

109 ->raw(sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass()))

110 ->write("{\n")

111 ->indent()

yosen.c (https://github.com/tsukud-y/estiva.git) C · 872 lines

127 }

128

129 fprintf(s, "Problem NO : %d\n", key);

130 fprintf(s, "|b - Ax|_inf = %g", max_r);

131

132 if (max_r < resmax) {

133 fprintf (s, " (OK)\n");

134 }

135 else {

136 fprintf (s, " (NG)\n");

137 }

138 }

banner.php (https://gitlab.com/dadangnh/sb1-bon) PHP · 430 lines

1 <?php

2 class ControllerDesignBanner extends Controller {

3 private $error = array();

248 $data['pagination'] = $pagination->render();

249

250 $data['results'] = sprintf($this->language->get('text_pagination'), ($banner_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($banner_total - $this->config->get('config_limit_admin'))) ? $banner_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $banner_total, ceil($banner_total / $this->config->get('config_limit_admin')));

251

252 $data['sort'] = $sort;

TraceableEventDispatcher.php (https://github.com/deviantintegral/symfony.git) PHP · 335 lines

1 <?php

2

3 /*

131

132 if (null !== $this->logger && $event->isPropagationStopped()) {

133 $this->logger->debug(sprintf('The "%s" event is already stopped. No listeners have been called.', $eventName));

134 }

135

SubscriptionDAO.inc.php (https://github.com/mcrider/pkpUpgradeTestSuite.git) PHP · 474 lines

1 <?php

2

3 /**

4 * SubscriptionDAO.inc.php

5 *

6 * Copyright (c) 2003-2004 The Public Knowledge Project

12 * Operations for retrieving and modifying Subscription objects.

13 *

14 * $Id: SubscriptionDAO.inc.php,v 1.6 2005/05/03 17:45:25 alec Exp $

15 */

16

383 } else {

384 $matchFound = false;

385 $IP = sprintf('%u', ip2long($IP));

386

387 while (!$result->EOF) {

YPFHasManyRelation.php (https://github.com/yonpols/ypframework.git) PHP · 351 lines

1 <?php

2 class YPFHasManyRelation extends YPFModelBaseRelation implements IYPFModelQuery, Iterator {

3

103 $this->setCache($relatorModel, $list);

104 } else

105 throw new ErrorDataModel($this->relatorModelName, sprintf('Can\'t assign values to has_many relation: %s', $this->relationName));

106 }

107

118 {

119 if (is_numeric($index))

120 $whereConditions[sprintf('`%s`.`%s`', $aliasPrefix, $key)] = $relatorModel->__get($this->relatorModelParams->keyFields[$index]);

121 else

122 $whereConditions[sprintf('`%s`.`%s`', $aliasPrefix, $key)] = $relatorModel->{$index};

133 public function includeInQuery(YPFModelQuery $query) {

134 if ($this->tableAlias) {

135 $joinedTableName = sprintf('`%s` AS `%s`', $this->relatedModelParams->tableName, $this->tableAlias);

136 $joinedAliasPrefix = $this->tableAlias;

137 } elseif ($this->relatedModelParams->tableAlias) {

options.php (https://github.com/livinglab/openlab.git) PHP · 316 lines

1 <?php

2 /**

3 * Genesis Framework.

173 * Echo only the first value of custom field.

174 *

175 * Pass in a `printf()` pattern as the second parameter and have that wrap around the value, if the value is not falsy.

176 *

177 * @since 1.0.0

178 *

179 * @param string $field Custom field key.

180 * @param string $output_pattern `printf()` compatible output pattern.

181 * @param int $post_id Optional. Post ID to use for Post Meta lookup, defaults to `get_the_ID()`.

182 */

185 $value = genesis_get_custom_field( $field, $post_id );

186 if ( $value ) {

187 printf( $output_pattern, $value );

188 }

189

Router.php (https://gitlab.com/mdabutaleb/bitm-laravel-1) PHP · 388 lines

1 <?php

2

3 /*

132 'generator_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',

133 'generator_base_class' => 'Symfony\\Component\\Routing\\Generator\\UrlGenerator',

134 'generator_dumper_class' => 'Symfony\\Component\\Routing\\Generator\\Dumper\\PhpGeneratorDumper',

135 'generator_cache_class' => 'ProjectUrlGenerator',

136 'matcher_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',

137 'matcher_base_class' => 'Symfony\\Component\\Routing\\Matcher\\UrlMatcher',

138 'matcher_dumper_class' => 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper',

139 'matcher_cache_class' => 'ProjectUrlMatcher',

140 'resource_type' => null,

153

154 if ($invalid) {

155 throw new \InvalidArgumentException(sprintf('The Router does not support the following options: "%s".', implode('", "', $invalid)));

156 }

157 }

listings.php (https://gitlab.com/sihabudinahmad/asppi) PHP · 423 lines

39 if ( ! empty( $post_types ) ) {

40 ?>

41 <p><?php printf( esc_html__( 'CPTUI registered post types count total: %d', 'custom-post-type-ui' ), count( $post_types ) ); ?></p>

42

43 <?php

225 if ( ! empty( $taxonomies ) ) {

226 ?>

227 <p><?php printf( esc_html__( 'CPTUI registered taxonomies count total: %d', 'custom-post-type-ui' ), count( $taxonomies ) ); ?></p>

228

229 <?php

284 $taxonomy_link_url = ( is_network_admin() ) ? network_admin_url( $edit_path ) : admin_url( $edit_path ); ?>

285 <td>

286 <?php printf(

287 '<a href="%s">%s</a> | <a href="%s">%s</a>',

288 esc_attr( $taxonomy_link_url ),

voucher.php (https://github.com/smadi/arabian-land.git) PHP · 259 lines

1 <?php

2 class ControllerCheckoutVoucher extends Controller {

3 private $error = array();

16 if (($this->request->server['REQUEST_METHOD'] == 'POST') && $this->validate()) {

17 $this->session->data['vouchers'][rand()] = array(

18 'description' => sprintf($this->language->get('text_for'), $this->currency->format($this->currency->convert($this->request->post['amount'], $this->currency->getCode(), $this->config->get('config_currency'))), $this->request->post['to_name']),

19 'to_name' => $this->request->post['to_name'],

20 'to_email' => $this->request->post['to_email'],

53 $this->data['entry_from_email'] = $this->language->get('entry_from_email');

54 $this->data['entry_message'] = $this->language->get('entry_message');

55 $this->data['entry_amount'] = sprintf($this->language->get('entry_amount'), $this->currency->format(1, false, 1), $this->currency->format(1000, false, 1));

56 $this->data['entry_theme'] = $this->language->get('entry_theme');

57

239

240 if (($this->request->post['amount'] < 1) || ($this->request->post['amount'] > 1000)) {

241 $this->error['amount'] = sprintf($this->language->get('error_amount'), $this->currency->format(1, false, 1), $this->currency->format(1000, false, 1) . ' ' . $this->currency->getCode());

242 }

243

DataSeriesValues.php (https://github.com/sbourget/moodle.git) PHP · 397 lines

1 <?php

2

3 namespace PhpOffice\PhpSpreadsheet\Chart;

4

5 use PhpOffice\PhpSpreadsheet\Calculation\Calculation;

6 use PhpOffice\PhpSpreadsheet\Calculation\Functions;

7 use PhpOffice\PhpSpreadsheet\Cell\Coordinate;

8 use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;

9

10 class DataSeriesValues

251 {

252 if (!preg_match('/^[a-f0-9]{6}$/i', $color)) {

253 throw new Exception(sprintf('Invalid hex color for chart series (color: "%s")', $color));

254 }

255

MultiselectgrouplistElement.php (https://gitlab.com/axeltizon/magento-demopoweraccess) PHP · 327 lines

1 <?php

2 /**

3 * Copyright © 2016 Magento. All rights reserved.

129 protected function selectOption($option)

130 {

131 $optionElement = $this->find(sprintf($this->uiOptionText, $option), Locator::SELECTOR_XPATH);

132 if ($optionElement->isVisible()) {

133 if (!$optionElement->isSelected()) {

144 foreach ($values as $value) {

145 $optionIndent = $isOptgroup ? $this->indent : '';

146 $optionElement = $context->find(sprintf($this->option, $optionIndent . $value), Locator::SELECTOR_XPATH);

147 if ($optionElement->isVisible()) {

148 if (!$optionElement->isSelected()) {

174 protected function getOptgroup($value, ElementInterface $context)

175 {

176 $optgroup = $context->find(sprintf($this->optgroupByLabel, $value), Locator::SELECTOR_XPATH);

177 if (!$optgroup->isVisible()) {

178 throw new \Exception("Can't find group \"{$value}\".");

home.php (https://gitlab.com/Etern4l/BitcoinDice) PHP · 84 lines

21 <tr class="vypis_table_obsah">

22 <td>Total profit:</td>

23 <td><b><?php $settings['t_player_profit']=(0-$settings['t_player_profit']); echo ($settings['t_player_profit']>=0)?'<span style="color: green;">+'.sprintf("%.8f",$settings['t_player_profit']).'</span>':'<span style="color: #d10000;">'.sprintf("%.8f",$settings['t_player_profit']).'</span>'; ?></b> <?php echo $settings['currency_sign']; ?></td>

24 </tr>

25 <tr class="vypis_table_obsah">

66 <td><?php $this_q=mysql_query("SELECT SUM(CASE WHEN `win_lose`=1 THEN (0-((`bet_amount`*`multiplier`)-`bet_amount`)) ELSE `bet_amount` END) AS `total_profit`,SUM(`bet_amount`) AS `total_wager` FROM `bets` WHERE `time`>NOW()-INTERVAL 30 DAY"); $h_e_=mysql_fetch_array($this_q); $h_e_['h_e']=($h_e_['total_wager']!=0)?(($h_e_['total_profit']/$h_e_['total_wager'])*100):0; echo ($h_e_['h_e']>=0)?'<span style="color: green;">+'.sprintf("%.5f",$h_e_['h_e']).'%</span>':'<span style="color: #d10000;">'.sprintf("%.5f",$h_e_['h_e']).'%</span>'; ?></td>

67 <td><?php $profit_=mysql_fetch_array(mysql_query("SELECT SUM(CASE WHEN `win_lose`=1 THEN ((`bet_amount`*`multiplier`)-`bet_amount`) ELSE (0-`bet_amount`) END) AS `profit` FROM `bets` WHERE `time`>NOW()-INTERVAL 30 DAY")); echo ((0-$profit_['profit'])>=0)?'<span style="color: green;">+'.sprintf("%.8f",0-$profit_['profit']).'</span>':'<span style="color: #d10000;">'.sprintf("%.8f",0-$profit_['profit']).'</span>'; ?></td>

68 </tr>

69 <tr>

71 <td><?php $this_q=mysql_query("SELECT SUM(CASE WHEN `win_lose`=1 THEN (0-((`bet_amount`*`multiplier`)-`bet_amount`)) ELSE `bet_amount` END) AS `total_profit`,SUM(`bet_amount`) AS `total_wager` FROM `bets` WHERE `time`>NOW()-INTERVAL 6 MONTH"); $h_e_=mysql_fetch_array($this_q); $h_e_['h_e']=($h_e_['total_wager']!=0)?(($h_e_['total_profit']/$h_e_['total_wager'])*100):0; echo ($h_e_['h_e']>=0)?'<span style="color: green;">+'.sprintf("%.5f",$h_e_['h_e']).'%</span>':'<span style="color: #d10000;">'.sprintf("%.5f",$h_e_['h_e']).'%</span>'; ?></td>

72 <td><?php $profit_=mysql_fetch_array(mysql_query("SELECT SUM(CASE WHEN `win_lose`=1 THEN ((`bet_amount`*`multiplier`)-`bet_amount`) ELSE (0-`bet_amount`) END) AS `profit` FROM `bets` WHERE `time`>NOW()-INTERVAL 6 MONTH")); echo ((0-$profit_['profit'])>=0)?'<span style="color: green;">+'.sprintf("%.8f",0-$profit_['profit']).'</span>':'<span style="color: #d10000;">'.sprintf("%.8f",0-$profit_['profit']).'</span>'; ?></td>

73 </tr>

74 <tr>

81 <td><?php $this_q=mysql_query("SELECT SUM(CASE WHEN `win_lose`=1 THEN (0-((`bet_amount`*`multiplier`)-`bet_amount`)) ELSE `bet_amount` END) AS `total_profit`,SUM(`bet_amount`) AS `total_wager` FROM `bets`"); $h_e_=mysql_fetch_array($this_q); $h_e_['h_e']=($h_e_['total_wager']!=0)?(($h_e_['total_profit']/$h_e_['total_wager'])*100):0; echo ($h_e_['h_e']>=0)?'<span style="color: green;">+'.sprintf("%.5f",$h_e_['h_e']).'%</span>':'<span style="color: #d10000;">'.sprintf("%.5f",$h_e_['h_e']).'%</span>'; ?></td>

82 <td><?php $profit_=mysql_fetch_array(mysql_query("SELECT SUM(CASE WHEN `win_lose`=1 THEN ((`bet_amount`*`multiplier`)-`bet_amount`) ELSE (0-`bet_amount`) END) AS `profit` FROM `bets`")); echo ((0-$profit_['profit'])>=0)?'<span style="color: green;">+'.sprintf("%.8f",0-$profit_['profit']).'</span>':'<span style="color: #d10000;">'.sprintf("%.8f",0-$profit_['profit']).'</span>'; ?></td>

83 </tr>

84 </table>

EEOReport.tpl (https://bitbucket.org/jstechnologies/cats.git) Smarty Template · 164 lines

25 <tr>

26 <td style="vertical-align: top;">

27 <table class="editTable" <?php if (isset($this->EEOReportStatistics)): ?>width="230"<?php else: ?>width="680"<?php endif; ?>>

28 <tr>

29 <td class="tdVertical" style="width: 75px;">

33 <input type="radio" name="period" value="all" <?php if ($this->modePeriod == 'all'): ?>checked<?php endif; ?>>&nbsp;All time<br />

34 <input type="radio" name="period" value="month" <?php if ($this->modePeriod == 'month'): ?>checked<?php endif; ?>>&nbsp;Last Month<br />

35 <input type="radio" name="period" value="week" <?php if ($this->modePeriod == 'week'): ?>checked<?php endif; ?>>&nbsp;Last Week<br />

45 <input type="radio" name="status" value="placed" <?php if ($this->modeStatus == 'placed'): ?>checked<?php endif; ?>>&nbsp;Placed<br />

46 <input type="radio" name="status" value="rejected" <?php if ($this->modeStatus == 'rejected'): ?>checked<?php endif; ?>>&nbsp;Not in Consideration<br />

47 </td>

48 </tr>

162 </div>

163 <div id="bottomShadow"></div>

164 <?php TemplateUtility::printFooter(); ?>

165

weight_class.php (https://gitlab.com/dadangnh/sb1-bon) PHP · 401 lines

1 <?php

2 class ControllerLocalisationWeightClass extends Controller {

3 private $error = array();

251 $data['pagination'] = $pagination->render();

252

253 $data['results'] = sprintf($this->language->get('text_pagination'), ($weight_class_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($weight_class_total - $this->config->get('config_limit_admin'))) ? $weight_class_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $weight_class_total, ceil($weight_class_total / $this->config->get('config_limit_admin')));

254

255 $data['sort'] = $sort;

393

394 if ($product_total) {

395 $this->error['warning'] = sprintf($this->language->get('error_product'), $product_total);

396 }

397 }

FlashMessenger.php (https://github.com/tmccormi/openemr.git) PHP · 353 lines

1 <?php

2 /**

3 * @link http://github.com/zendframework/zend-view for the canonical source repository

190

191 // Generate markup

192 $markup = sprintf($this->getMessageOpenFormat(), ' class="' . implode(' ', $classes) . '"');

193 $markup .= implode(

194 sprintf($this->getMessageSeparatorString(), ' class="' . implode(' ', $classes) . '"'),

299 && ! $pluginFlashMessenger instanceof PluginFlashMessenger

300 ) {

301 throw new InvalidArgumentException(sprintf(

302 '%s expects either a %s or %s instance; received %s',

303 __METHOD__,

admin-stats.php (https://github.com/voidit/nycga2.git) PHP · 422 lines

376

377 <td>

378 <?php echo $period['top_users']['top_user_num']['user_link'] ?> <span class="description"><?php printf( __( '(%d sent)', 'bp-invite-anyone' ), $period['top_users']['top_user_num']['sent'] ) ?></span>

379 </td>

380

401

402 <td>

403 <?php echo $period['top_users']['top_user_num_cs']['user_link'] ?> <span class="description"><?php printf( __( '(%d sent)', 'bp-invite-anyone' ), $period['top_users']['top_user_num_cs']['sent'] ) ?></span>

404 </td>

405

406 <td>

407 <?php echo $period['top_users']['top_user_pct_cs']['user_link'] ?> <span class="description"><?php printf( __( '(%s accepted)', 'bp-invite-anyone' ), $period['top_users']['top_user_pct_cs']['accepted'] ) ?></span>

408 </td>

409 <?php endif ?>

t_k5buf.c (https://github.com/rhuitl/uClinux.git) C · 287 lines

36 {

37 if (condition) {

38 fprintf(stderr, "%s failed\n", name);

39 exit(1);

40 }

voucher_theme.php (https://gitlab.com/shapcy/opencart) PHP · 402 lines

1 <?php

2 class ControllerSaleVoucherTheme extends Controller {

3 private $error = array();

245 $data['pagination'] = $pagination->render();

246

247 $data['results'] = sprintf($this->language->get('text_pagination'), ($voucher_theme_total) ? (($page - 1) * $this->config->get('config_limit_admin')) + 1 : 0, ((($page - 1) * $this->config->get('config_limit_admin')) > ($voucher_theme_total - $this->config->get('config_limit_admin'))) ? $voucher_theme_total : ((($page - 1) * $this->config->get('config_limit_admin')) + $this->config->get('config_limit_admin')), $voucher_theme_total, ceil($voucher_theme_total / $this->config->get('config_limit_admin')));

248

249 $data['sort'] = $sort;

394

395 if ($voucher_total) {

396 $this->error['warning'] = sprintf($this->language->get('error_voucher'), $voucher_total);

397 }

398 }

main.cpp (https://bitbucket.org/__wp__/mb-linux-msli.git) C++ · 408 lines

62 va_start( args, format_str );

63 char msg[256];

64 std::vsnprintf(msg, sizeof(msg)/sizeof(*msg) - 1, format_str, args );

65 DebugStr( c2pstr(msg) );

66 }

83 std::strncat( msg, ", ", 255 );

84 char line[20];

85 std::sprintf( line, "%d", lineno );

86 std::strncat( msg, line, 255 );

87 DebugStr( c2pstr( msg ) );

example.cxx (https://swig.svn.sourceforge.net/svnroot/swig) C++ · 47 lines ✨ Summary

This C++ code defines a Vector class and a VectorArray class, which is an array of Vectors. The Vector class has methods for adding two vectors together and printing its contents. The VectorArray class provides an array-like interface to access individual vectors in the array, with bounds checking and size retrieval functionality.

20 char *Vector::print() {

21 static char temp[512];

22 sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z);

23 return temp;

24 }

35 Vector &VectorArray::operator[](int index) {

36 if ((index < 0) || (index >= maxsize)) {

37 printf("Panic! Array index out of bounds.\n");

38 exit(1);

39 }

g_NCR5380.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 957 lines ✨ Summary

This C code defines a Linux kernel module for a SCSI driver, specifically for NCR (NCR Corporation) storage devices. It provides functions for detecting and initializing the device, handling commands, and managing resources. The code is part of the Linux kernel’s SCSI subsystem and is designed to work with various NCR storage controllers, including the 5380 and 53C400 models.

746 #include "NCR5380.c"

747

748 #define PRINTP(x) len += sprintf(buffer+len, x)

749 #define ANDP ,

750

767

768 /**

769 * sprintf_Scsi_Cmnd - print a scsi command

770 * @buffer: buffr to print into

771 * @len: buffer length

xml2net.pl (https://freespeech.svn.sourceforge.net/svnroot/freespeech) Perl · 272 lines ✨ Summary

The Perl code parses a network diagram in XML format, extracting node and connection information. It creates a hierarchical structure of nodes and connections, including input/output parameters and conditions. The output is a representation of the network’s topology, which can be used for analysis or further processing.

68 {

69 $name = $curr_net[$i]{"name"};

70 printf " <netInput: $name>\n";

71 }

72 }

76 {

77 $name = $curr_net[$i]{"name"};

78 printf " <netOutput: $name>\n";

79 }

80 }

86 {

87 $name = $curr_net[$i]{"name"};

88 printf " <netCondition: $name>\n";

89 }

90 }

PngFile.c (http://angel-engine.googlecode.com/svn/trunk/) C · 443 lines ✨ Summary

This C code provides functions for reading and writing PNG (Portable Network Graphics) files. The png_read_data function reads data from a file, while png_write_data writes data to a file. The png_flush function is used to flush the output buffer after writing data. The png_read and png_write functions are wrappers around these three functions, providing a more convenient interface for reading and writing PNG files.

37 ;

38 #ifdef PNG_CONSOLE_IO_SUPPORTED

39 fprintf(stderr, "libpng error: %s\n", msg);

40 #endif

41 {

example.c (https://swig.svn.sourceforge.net/svnroot/swig) C · 92 lines ✨ Summary

The provided C code defines a set of global variables and functions to demonstrate their usage. It prints out the values of these variables, including integers, shorts, longs, floats, doubles, characters, and pointers to strings and structures. The output displays the memory addresses and values of each variable, showcasing their data types and storage locations.

40

41 void print_vars() {

42 printf("ivar = %d\n", ivar);

43 printf("svar = %d\n", svar);

44 printf("lvar = %ld\n", lvar);

45 printf("uivar = %u\n", uivar);

46 printf("usvar = %u\n", usvar);

47 printf("ulvar = %lu\n", ulvar);

48 printf("scvar = %d\n", scvar);

49 printf("ucvar = %u\n", ucvar);

50 printf("fvar = %g\n", fvar);

51 printf("dvar = %g\n", dvar);

question49234.sh (https://bitbucket.org/shuangxinyu/emacspack.git) Shell · 42 lines

34 s/&/&amp;/g; # Fix ampersands

35 s/"/&quot;/g; # Fix quotes

36 printf qq(<s d="%02d" i="%d" n="%s"/>\n),\$div,\$s,\$_;

37 }

38 print "</stores>";

octave.cxx (https://swig.svn.sourceforge.net/svnroot/swig) C++ · 1418 lines ✨ Summary

This C++ code is a part of the SWIG (Simplified Interface Generator) framework, which generates interface code for wrapping C/C++ libraries in multiple programming languages, including Octave. It defines a class OCTAVE that inherits from Language, and implements methods to generate Octave-specific code for creating a director method, handling runtime code, and defining external runtime filenames.

127 Swig_banner(f_begin);

128

129 Printf(f_runtime, "\n");

130 Printf(f_runtime, "#define SWIGOCTAVE\n");

131 Printf(f_runtime, "#define SWIG_name_d \"%s\"\n", module);

132 Printf(f_runtime, "#define SWIG_name %s\n", module);

133

134 if (directorsEnabled()) {

135 Printf(f_runtime, "#define SWIG_DIRECTORS\n");

136 Swig_banner(f_directors_h);

137 if (dirprot_mode()) {

138 // Printf(f_directors_h, "#include <map>\n");

139 // Printf(f_directors_h, "#include <string>\n\n");

proc.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 168 lines ✨ Summary

This C code implements a procfs interface for displaying information about cryptographic algorithms used in Linux. It provides a command-line interface to view details such as algorithm names, drivers, priorities, and flags. The code also handles initialization and cleanup of the procfs interface, including registration and deregistration of sysctl tables and removal of the “crypto” proc entry when exiting.

87 struct crypto_alg *alg = list_entry(p, struct crypto_alg, cra_list);

88

89 seq_printf(m, "name : %s\n", alg->cra_name);

90 seq_printf(m, "driver : %s\n", alg->cra_driver_name);

91 seq_printf(m, "module : %s\n", module_name(alg->cra_module));

92 seq_printf(m, "priority : %d\n", alg->cra_priority);

93 seq_printf(m, "refcnt : %d\n", atomic_read(&alg->cra_refcnt));

94 seq_printf(m, "selftest : %s\n",

97

98 if (alg->cra_flags & CRYPTO_ALG_LARVAL) {

99 seq_printf(m, "type : larval\n");

100 seq_printf(m, "flags : 0x%x\n", alg->cra_flags);

109 switch (alg->cra_flags & (CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL)) {

110 case CRYPTO_ALG_TYPE_CIPHER:

111 seq_printf(m, "type : cipher\n");

112 seq_printf(m, "blocksize : %u\n", alg->cra_blocksize);

tst.uregsarray.d (https://bitbucket.org/freebsd/freebsd-head/) D · 64 lines ✨ Summary

This D code outputs the values of various registers from a user process’s stack frame, which is stored in the uregs array. It prints the values of 17 specific registers, including general-purpose registers and some special registers used by the processor. The output is intended to verify that the uregs array can be accessed correctly.

43 BEGIN

44 {

45 printf("R_GS = 0x%x\n", uregs[R_GS]);

46 printf("R_ES = 0x%x\n", uregs[R_ES]);

47 printf("R_DS = 0x%x\n", uregs[R_DS]);

48 printf("R_EDI = 0x%x\n", uregs[R_EDI]);

49 printf("R_ESI = 0x%x\n", uregs[R_ESI]);

50 printf("R_EBP = 0x%x\n", uregs[R_EBP]);

51 printf("R_EBX = 0x%x\n", uregs[R_EBX]);

52 printf("R_EDX = 0x%x\n", uregs[R_EDX]);

53 printf("R_ECX = 0x%x\n", uregs[R_ECX]);

54 printf("R_EAX = 0x%x\n", uregs[R_EAX]);

journal.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 2456 lines ✨ Summary

This C code initializes and manages a journaling system for Linux file systems, specifically ext4. It sets up various data structures, caches, and modules to handle journaling operations, including logging, caching, and device name mapping. The code also handles module initialization and cleanup, as well as error handling and debugging features.

736 struct transaction_stats_s *ts = v;

737 if (v == SEQ_START_TOKEN) {

738 seq_printf(seq, "%-4s %-5s %-5s %-5s %-5s %-5s %-5s %-6s %-5s "

739 "%-5s %-5s %-5s %-5s %-5s\n", "R/C", "tid",

740 "wait", "run", "lock", "flush", "log", "hndls",

744 }

745 if (ts->ts_type == JBD2_STATS_RUN)

746 seq_printf(seq, "%-4s %-5lu %-5u %-5u %-5u %-5u %-5u "

747 "%-6lu %-5lu %-5lu\n", "R", ts->ts_tid,

748 jiffies_to_msecs(ts->u.run.rs_wait),

755 ts->u.run.rs_blocks_logged);

756 else if (ts->ts_type == JBD2_STATS_CHECKPOINT)

757 seq_printf(seq, "%-4s %-5lu %48s %-5u %-5lu %-5lu %-5lu\n",

758 "C", ts->ts_tid, " ",

759 jiffies_to_msecs(ts->u.chp.cs_chp_time),

csharp.cxx (https://swig.svn.sourceforge.net/svnroot/swig) C++ · 4181 lines ✨ Summary

This C++ code generates a class definition for a C++/CLI wrapper around a native C++ class, using the SWIG (Simplified Wrapper and Interface Generator) tool. It creates a class with methods to call the native class’s destructor, finalize, and dispose, as well as connect methods to interact with the native class’s director. The code is generated based on metadata provided in typemap attributes associated with the native class.

229 if (argv[i + 1]) {

230 dllimport = NewString("");

231 Printf(dllimport, argv[i + 1]);

232 Swig_mark_arg(i);

233 Swig_mark_arg(i + 1);

239 if (argv[i + 1]) {

240 namespce = NewString("");

241 Printf(namespce, argv[i + 1]);

242 if (Len(namespce) == 0) {

243 Delete(namespce);

257 old_variable_names = true;

258 } else if (strcmp(argv[i], "-help") == 0) {

259 Printf(stdout, "%s\n", usage);

260 }

261 }

ScriptingCore.cpp (https://bitbucket.org/Tsiannian/cocos2d-x.git) C++ · 882 lines

158 va_list vl;

159 va_start(vl, format);

160 int len = vsnprintf(_js_log_buf, 256, format, vl);

161 va_end(vl);

162 if (len) {

402 static void dumpNamedRoot(const char *name, void *addr, JSGCRootType type, void *data)

403 {

404 printf("Root: '%s' at %p\n", name, addr);

405 }

406

lbfgsUpdate.m (git://github.com/Sohl-Dickstein/Minimum-Probability-Flow-Learning.git) Objective C · 21 lines ✨ Summary

This MATLAB function updates the limited-memory Broyden-Fletcher-Goldfarb-Shanno (LBFGS) algorithm’s memory with new corrections. It checks if a correction is significant enough to update the memory, and if so, it either performs a full update or adds the new correction to the existing memory. The function also updates the scale of the initial Hessian approximation based on the significance of the correction.

17 else

18 if debug

19 fprintf('Skipping Update\n');

20 end

21 end

nodeGen.cpp (git://github.com/ticking/self.git) C++ · 469 lines ✨ Summary

This C++ code is part of a compiler implementation, specifically responsible for generating branch instructions (if-else statements) in machine code. It creates nodes and merges them to represent conditional branches, allowing the compiler to decide which path to take based on the program’s logic. The generated code is optimized for performance and minimizes unnecessary operations.

309 if (PrintSICBranchSplitting)

310 if (!whyNot)

311 lprintf("branch splitting succeeded\n");

312 else

313 lprintf("branch splitting failed: %s\n", whyNot);

463

464

465 void NodeGen::print_short() { lprintf("NodeGen %#lx", (unsigned long)this); }

466

467 # endif

word_count_functor.flex (http://hadesmem.googlecode.com/svn/trunk/) text · 0 lines

38 yyin = fopen(1 == argc ? "word_count.input" : argv[1], "r");

39 if (NULL == yyin) {

40 fprintf(stderr, "Couldn't open input file!\n");

41 exit(-1);

42 }

48 break;

49 } while (EOF != tok);

50 printf("lines: %d, words: %d, characters: %d\n", l, w, c);

51 fclose(yyin);

52 return 0;

db_queues.rb (git://github.com/37signals/37s_cookbooks.git) Ruby · 103 lines ✨ Summary

This Ruby script checks the size of a database queue by executing a MySQL query and comparing its result to user-defined thresholds for warning and critical values. It outputs Nagios-compatible performance data, indicating whether the query result is within acceptable limits or not, and exits with an appropriate status code (OK, WARNING, CRITICAL, or UNKNOWN).

85

86 if value >= c[:crit]

87 puts sprintf(message, value, c[:crit], value)

88 exit(EXIT_CRITICAL)

89 end

90

91 if value >= c[:warn]

92 puts sprintf(message, value, c[:warn], value)

93 exit(EXIT_WARNING)

94 end

100 # if warning nor critical trigger, say OK and return performance data

101

102 puts sprintf("Query '#{c[:query]}' result %d OK|#{perfdata}", value, value)

103

mdio-gpio.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 299 lines ✨ Summary

This C code implements a generic driver for an MDIO (Media Interface Bus) bus using GPIO (General Purpose Input/Output) pins on a Linux system. It provides a platform-independent way to emulate an MDIO bus, allowing it to be used with various devices that require an MDIO interface. The driver is designed to work with both non-OF and OF-based systems.

116 new_bus->irq[i] = PHY_POLL;

117

118 snprintf(new_bus->id, MII_BUS_ID_SIZE, "%x", bus_id);

119

120 if (gpio_request(bitbang->mdc, "mdc"))

server.c (https://bitbucket.org/mokonzi131/gos_project_1.git) C · 179 lines

51 break;

52 default:

53 printf("ERROR: Could not initialize the server\n");

54 return result;

55 }

61 break;

62 default:

63 printf("ERROR: Server is down\n");

64 return result;

65 }

80 struct stat rootstat;

81

82 printf("INITIALIZING Server...\n");

83

84 // setup the port

ltmain.sh (https://freespeech.svn.sourceforge.net/svnroot/freespeech) Shell · 3976 lines ✨ Summary

This shell script is used to build and configure a library for use with the GNU Compiler Collection (GCC). It checks if the library is being built as a shared object, static library, or executable, and performs different actions accordingly. It also handles various flags and options passed to the compiler, such as version information, release information, and runtime path settings.

689 # */

690 #

691 # #include <stdio.h> /* for printf() */

692 # #include <unistd.h> /* for open(), lseek(), read() */

693 # #include <fcntl.h> /* for O_RDONLY, O_BINARY */

788 # name_rvas = pe_as32 (expdata+32);

789 #

790 # printf ("EXPORTS\n");

791 # for (i = 0; i<nexp; i++)

792 # {

793 # unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);

794 # printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);

795 # }

796 #

sh.time.c (https://bitbucket.org/freebsd/freebsd-head/) C · 741 lines ✨ Summary

This C code generates a human-readable representation of system resource usage statistics, such as CPU time, memory usage, and disk activity, in a format similar to top or htop. It displays the current values for various metrics, along with their changes since the last update, in a simple text-based output.

366 #endif /* !BSDTIMES */

367 #ifdef TDEBUG

368 xprintf("es->tms_utime %lu bs->tms_utime %lu\n",

369 (unsigned long)es->tms_utime, (unsigned long)bs->tms_utime);

370 xprintf("es->tms_stime %lu bs->tms_stime %lu\n",

371 (unsigned long)es->tms_stime, (unsigned long)bs->tms_stime);

372 xprintf("ms %llu e %p b %p\n", (unsigned long long)ms, e, b);

373 xprintf("t %llu\n", (unsigned long long)t);

436 i = (ms == 0) ? 0 : (long)(t * 1000.0 / ms);

437 #endif /* convex */

438 xprintf("%ld.%01ld%%", i / 10, i % 10); /* nn.n% */

439 break;

440

446 i = r1->ru_nswap - r0->ru_nswap;

447 #endif

448 xprintf("%ld", i);

449 break;

450

lex.c (https://bitbucket.org/freebsd/freebsd-head/) C · 960 lines ✨ Summary

This C code implements a lexical analyzer for parsing input source files. It manages multiple input sources, tracks consumed characters and tokens, and provides functions to retrieve token text, unget tokens, and set source file names. The code is part of a larger parser implementation, likely for a programming language. It ensures accurate tracking of input data and tokenization.

255 REQUIRE(VALID_LEX(lex));

256

257 snprintf(name, sizeof(name), "stream-%p", stream);

258

259 return (new_source(lex, ISC_TRUE, ISC_FALSE, stream, name));

270 REQUIRE(VALID_LEX(lex));

271

272 snprintf(name, sizeof(name), "buffer-%p", buffer);

273

274 return (new_source(lex, ISC_FALSE, ISC_FALSE, buffer, name));

mptag_test.cpp (git://github.com/hpcc-systems/HPCC-Platform.git) C++ · 139 lines ✨ Summary

This C++ code tests various scenarios for a memory pool tag (MPTAG) system, including allocating and deallocating tags, freeing marked tags, and querying formatters for non-existent tags. It exercises different aspects of the MPTAG system, such as memory management, exception handling, and formatter association. The test cases cover various edge cases to ensure the system’s correctness and robustness.

33 for( i=0;i<(size);i++) {

34 a[i]=allocMPtag("hello",123);

35 printf("alloc: %d \n" ,a[i]);

36 }

37 printf("alloc: %d \n" , allocMPtag("hello",123));

38 for( i=0;i<size;i++) { //free marked 10

39 printf("free: %d \n",a[i]);

40 freeMPtag(a[i]);

41 }

47 {

48 mptag_t a[10]; int i; //IMessageTraceFormatter f;

49 printf("**********************ENTER 100 \n");

50 for( i=1;i<101;i++) { //enter 100

51 printf("alloc: %d \n" ,allocMPtag("hello",123));

tsql.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 1020 lines

839 <KEYWORD3>xp_revokelogin</KEYWORD3>

840 <KEYWORD3>xp_sendmail</KEYWORD3>

841 <KEYWORD3>xp_sprintf</KEYWORD3>

842 <KEYWORD3>xp_sqlinventory</KEYWORD3>

843 <KEYWORD3>xp_sqlmaint</KEYWORD3>

sample_advanced.cpp (http://hadesmem.googlecode.com/svn/trunk/) C++ · 0 lines ✨ Summary

The code demonstrates advanced usage of the Boost Format library, showcasing its capabilities for formatting strings with various options and manipulators. It shows how to store parsed format-strings in objects, bind arguments, modify formatting options, handle exceptions, and use manipulators to control output. The example outputs a series of formatted strings with different settings and manipulations.

126 // misc:

127

128 // unsupported printf directives %n and asterisk-fields are purely ignored.

129 // do *NOT* provide an argument for them, it is an error.

130 cout << format("|%5d| %n") % 7 << endl;

class.bp-sql-schema-parser.php (https://bitbucket.org/simplemediacode/bptrunk.git) PHP · 615 lines

1 <?php

2 /**

3 * Parses SQL schema statements for comparison to real table structures

414 $alterations[$_dbhname][$_new_table_name][] = array(

415 'action' => 'add_column',

416 'message' => sprintf( __( 'Adding column: %s' ), $_new_column_name ),

417 'column' => $_new_column_name,

418 'query' => 'ALTER TABLE `' . $_new_table_name . '` ADD COLUMN ' . BP_SQL_Schema_Parser::get_column_definition( $_new_column_data ) . ';'

432 $alterations[$_dbhname][$_new_table_name][] = array(

433 'action' => 'set_default',

434 'message' => sprintf( __( 'Setting default on column: %s' ), $_new_column_name ),

435 'column' => $_new_column_name,

436 'query' => 'ALTER TABLE `' . $_new_table_name . '` ALTER COLUMN `' . $_new_column_name . '` SET DEFAULT \'' . $_new_column_data['Default'] . '\';'

447 $alterations[$_dbhname][$_new_table_name][] = array(

448 'action' => 'change_column',

449 'message' => sprintf( __( 'Changing column: %s' ), $_new_column_name ),

450 'column' => $_new_column_name,

451 'query' => 'ALTER TABLE `' . $_new_table_name . '` CHANGE COLUMN `' . $_new_column_name . '` ' . BP_SQL_Schema_Parser::get_column_definition( $_new_column_data ) . ';'

awk.xml (https://jedit.svn.sourceforge.net/svnroot/jedit) XML · 116 lines

60 <KEYWORD1>nextfile</KEYWORD1>

61 <KEYWORD1>print</KEYWORD1>

62 <KEYWORD1>printf</KEYWORD1>

63 <KEYWORD1>return</KEYWORD1>

64 <KEYWORD1>while</KEYWORD1>

78 <KEYWORD2>sin</KEYWORD2>

79 <KEYWORD2>split</KEYWORD2>

80 <KEYWORD2>sprintf</KEYWORD2>

81 <KEYWORD2>sqrt</KEYWORD2>

82 <KEYWORD2>srand</KEYWORD2>

aic79xx_osm.h (http://omnia2droid.googlecode.com/svn/trunk/) C++ Header · 711 lines ✨ Summary

This C++ header file provides a set of functions and macros for interacting with a Linux-based storage controller, specifically the AIC79xx series. It defines various interfaces for managing SCSI commands, handling interrupts, and controlling device operations. The code is designed to be platform-specific, with Linux being one of the supported platforms.

84 #else

85 /*

86 * Compile in debugging code, but do not enable any printfs.

87 */

88 #define AHD_DEBUG 1

365

366 /************************** OS Utility Wrappers *******************************/

367 #define printf printk

368 #define M_NOWAIT GFP_ATOMIC

369 #define M_WAITOK 0

ChangeLog-9899 (https://bitbucket.org/freebsd/freebsd-head/) Unknown · 1670 lines

214 * dis-buf.c (buffer_read_memory): Rewrite expression to avoid

215 overflow at end of address space.

216 (generic_print_address): Use sprintf_vma.

217

218 1999-08-08 Ian Lance Taylor <ian@zembu.com>

664

665 * dis-buf.c (generic_strcat_address): reformat to GNU coding

666 conventions. change sprintf call to an sprintf_vma call.

667

668 Tue Dec 8 13:12:44 1998 Dave Brolley <brolley@cygnus.com>

example.c (https://swig.svn.sourceforge.net/svnroot/swig) C · 54 lines ✨ Summary

The code calculates the greatest common divisor (GCD) of two positive integers, counts the occurrences of a character in a string, capitalizes all characters in a string, and checks if points are within a circle defined by their coordinates. It also handles command-line arguments for GCD calculation and provides usage instructions if not provided.

19 int x,y;

20 if (argc != 3) {

21 printf("usage: gcd x y\n");

22 return -1;

23 }

24 x = atoi(argv[1]);

25 y = atoi(argv[2]);

26 printf("gcd(%d,%d) = %d\n", x,y,gcd(x,y));

27 return 0;

28 }

47 double a = x*x + y*y;

48 if (a > 1.0) {

49 printf("Bad points %g, %g\n", x,y);

50 } else {

51 printf("Good points %g, %g\n", x,y);

procstat_args.c (https://bitbucket.org/freebsd/freebsd-head/) C · 92 lines ✨ Summary

The code prints information about a process to the console. It takes a struct kinfo_proc as input, which contains details about a running process. The output includes the process ID, command name, and either its environment variables or arguments, depending on the specified option. The program uses the sysctl system call to retrieve this information from the kernel.

51

52 if (!hflag)

53 printf("%5s %-16s %-53s\n", "PID", "COMM",

54 env ? "ENVIRONMENT" : "ARGS");

55

72 }

73

74 printf("%5d ", kipp->ki_pid);

75 printf("%-16s ", kipp->ki_comm);

76 for (cp = args; cp < args + len; cp += strlen(cp) + 1)

77 printf("%s%s", cp != args ? " " : "", cp);

78 printf("\n");

dhd_common.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 1733 lines ✨ Summary

This C code snippet appears to be part of a wireless networking driver, specifically related to Wi-Fi scanning and management. It provides functions for requesting Wi-Fi scans, deleting BSS (Basic Service Set) entries, and retrieving partial scan results. The code also handles various error conditions and manages internal data structures, such as the iscan_chain buffer.

7 * agreement governing use of this software, this software is licensed to you

8 * under the terms of the GNU General Public License version 2 (the "GPL"),

9 * available at http://www.broadcom.com/licenses/GPLv2.php, with the

10 * following added to such license:

11 *

157

158 /* Base DHD info */

159 bcm_bprintf(strbuf, "%s\n", dhd_version);

160 bcm_bprintf(strbuf, "\n");

161 bcm_bprintf(strbuf, "pub.up %d pub.txoff %d pub.busstate %d\n",

162 dhdp->up, dhdp->txoff, dhdp->busstate);

163 bcm_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n",

164 dhdp->hdrlen, dhdp->maxctl, dhdp->rxsz);

165 bcm_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %s\n",

166 dhdp->iswl, dhdp->drv_version, bcm_ether_ntoa(&dhdp->mac, eabuf));

167 bcm_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", dhdp->bcmerror, dhdp->tickcnt);

gtk.m4 (git://github.com/xbmc/xbmc.git) m4 · 195 lines ✨ Summary

This M4 code checks if a GTK library is installed and configured correctly on the system. It runs a test program to verify that the correct version of GTK is being used, and provides error messages if the installation is incorrect or missing. If the installation is correct, it substitutes the GTK CFLAGS and LIBS into the build process, allowing the build to use the correct libraries.

79 tmp_version = g_strdup("$min_gtk_version");

80 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {

81 printf("%s, bad version string\n", "$min_gtk_version");

82 exit(1);

83 }

87 (gtk_micro_version != $gtk_config_micro_version))

88 {

89 printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n",

90 $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,

91 gtk_major_version, gtk_minor_version, gtk_micro_version);

92 printf ("*** was found! If gtk-config was correct, then it is best\n");

93 printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");

94 printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");

95 printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");

example.cxx (https://swig.svn.sourceforge.net/svnroot/swig) C++ · 50 lines ✨ Summary

The code outputs messages indicating when objects are created and destroyed, such as “VectorArray new: self=%p” and “VectorArray delete: self=%p”. It also handles array index out of bounds errors with a panic message and exits the program. Additionally, it prints the size of the VectorArray object.

20 char *Vector::as_string() {

21 static char temp[512];

22 sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z);

23 return temp;

24 }

27 items = new Vector[size];

28 maxsize = size;

29 printf("VectorArray new: self=%p\n",this);

30 }

31

32 VectorArray::~VectorArray() {

33 printf("VectorArray delete: self=%p\n",this);

34 delete [] items;

35 }

cpuprofile.html (http://google-perftools.googlecode.com/svn/trunk/) HTML · 521 lines ✨ Summary

This is a documentation page for the gprof command, explaining its usage and options. It provides detailed information on how to use gprof, including various flags and heuristics that control the output of the profiling tool. The text also notes potential limitations and caveats of using gprof.

215 code in <code>test_main_thread()</code> and 200 units were spent while

216 executing <code>test_main_thread()</code> and its callees such as

217 <code>snprintf()</code>.</p>

218

219 <p>The size of the node is proportional to the local count. The

227 relationship. Each edge is labelled with the time spent by the callee

228 on behalf of the caller. E.g, the edge from

229 <code>test_main_thread()</code> to <code>snprintf()</code> indicates

230 that of the 200 samples in <code>test_main_thread()</code>, 37 are

231 because of calls to <code>snprintf()</code>.</p>

232

233 <p>Note that <code>test_main_thread()</code> has an edge to

234 <code>vsnprintf()</code>, even though <code>test_main_thread()</code>

235 doesn't call that function directly. This is because the code was

236 compiled with <code>-O2</code>; the profile reflects the optimized

testclosure.c (git://github.com/stevedekorte/io.git) C · 71 lines ✨ Summary

This C code tests a closure function that takes a struct as an argument and prints its fields to the console. It creates a struct, prepares a CIF (C Interface File) for the closure, allocates memory for the closure, and then calls the closure with the struct as an argument, verifying that the output matches the expected values.

17 void cls_struct_combined_fn(struct cls_struct_combined arg)

18 {

19 printf("%g %g %g %g\n",

20 arg.a, arg.b,

21 arg.c, arg.d);

parse-events.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 847 lines ✨ Summary

This C code parses command-line options and prints a list of pre-defined events that can be used with the perf command. It also provides help text for event symbols, including hardware cache events and raw hardware event descriptors. The output is printed to standard error, allowing users to pipe it into other commands or use it as input for further processing.

130 int fd;

131

132 snprintf(evt_path, MAXPATHLEN, "%s/%s/%s/id", debugfs_path,

133 sys_dir->d_name, evt_dir->d_name);

134 fd = open(evt_path, O_RDONLY);

180 for_each_subsystem(sys_dir, sys_dirent, sys_next) {

181

182 snprintf(dir_path, MAXPATHLEN, "%s/%s", debugfs_path,

183 sys_dirent.d_name);

184 evt_dir = opendir(dir_path);

188 for_each_event(sys_dirent, evt_dir, evt_dirent, evt_next) {

189

190 snprintf(evt_path, MAXPATHLEN, "%s/%s/id", dir_path,

191 evt_dirent.d_name);

192 fd = open(evt_path, O_RDONLY);

Header.pl (git://github.com/zpao/v8monkey.git) Perl · 183 lines ✨ Summary

The Perl code generates a table with various metrics related to web page loading times, including parsing, content creation, frame creation, style resolution, reflow, total layout time, and total page load time. The table is formatted in a specific way, with columns for the metric name, percentage of total time spent on that task, and a brief description.

98 print (TABLE_FILE "$weekday{$wday} ");

99 print (TABLE_FILE "$mon/$mday/$year ");

100 printf (TABLE_FILE "%02d:%02d:%02d", $hour, $min, $sec);

101 print (TABLE_FILE "</font></b></center>");

102 print (TABLE_FILE "<BR>");

acpi.c (http://omnia2droid.googlecode.com/svn/trunk/) C · 264 lines ✨ Summary

This C code is part of the Linux kernel’s PCI (Peripheral Component Interconnect) subsystem, specifically for ACPI (Advanced Configuration and Power Interface) based systems. It scans for PCI devices on a system, allocates resources for each device, and sets up IRQ routing using ACPI. The code initializes the PCI subsystem to use ACPI for IRQ routing and scanning of PCI devices.

140 if (!info.name)

141 goto name_alloc_fail;

142 sprintf(info.name, "PCI Bus %04x:%02x", domain, busnum);

143

144 info.res_num = 0;

cls_multi_ushort.c (git://github.com/gmarceau/PLT.git) C · 74 lines ✨ Summary

This C code tests the passing of multiple unsigned short values between a function call and a closure. It defines two functions, test_func_fn and test_func_gn, which take two unsigned short arguments and return their sum. The code then calls these functions using both a direct function call and a closure, verifying that the results match.

14 result = a1 + a2;

15

16 printf("%d %d: %d\n", a1, a2, result);

17

18 return result;

61 ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl);

62 /* { dg-output "2 32765: 32767" } */

63 printf("res: %d\n", (unsigned short)res_call);

64 /* { dg-output "\nres: 32767" } */

65

68 res_closure = (*((test_type)code))(2, 32765);

69 /* { dg-output "\n2 32765: 32767" } */

70 printf("res: %d\n", res_closure);

71 /* { dg-output "\nres: 32767" } */

72