Helix SwarmHelix Swarm
  • Loading...

files/APIComparisons.html

APIComparisons.html

  • //
  • guest/
  • erik_purins/
  • P4.Net/
  • release/
  • 0.9/
  • doc/
  • html/
  • APIComparisons.html #1
  • View
  • Commits
  • Open Download .zip Download (44 KB)
  1. <html dir="LTR">
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
  4. <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
  5. <title>P4.Net API Comparisons</title>
  6. <xml>
  7. </xml>
  8. <link rel="stylesheet" type="text/css" href="MSDN.css" />
  9. <style>
  10. <!--table
  11. {mso-displayed-decimal-separator:"\.";
  12. mso-displayed-thousand-separator:"\,";}
  13. @page
  14. {margin:1.0in .75in 1.0in .75in;
  15. mso-header-margin:.5in;
  16. mso-footer-margin:.5in;
  17. mso-page-orientation:landscape;}
  18. .font6
  19. {color:windowtext;
  20. font-size:8.0pt;
  21. font-weight:400;
  22. font-style:normal;
  23. text-decoration:none;
  24. font-family:"Courier New", monospace;
  25. mso-font-charset:0;}
  26. .font7
  27. {color:fuchsia;
  28. font-size:8.0pt;
  29. font-weight:400;
  30. font-style:normal;
  31. text-decoration:none;
  32. font-family:"Courier New", monospace;
  33. mso-font-charset:0;}
  34. .font8
  35. {color:blue;
  36. font-size:8.0pt;
  37. font-weight:400;
  38. font-style:normal;
  39. text-decoration:none;
  40. font-family:"Courier New", monospace;
  41. mso-font-charset:0;}
  42. .font10
  43. {color:#993366;
  44. font-size:8.0pt;
  45. font-weight:700;
  46. font-style:normal;
  47. text-decoration:none;
  48. font-family:"Courier New", monospace;
  49. mso-font-charset:0;}
  50. .font11
  51. {color:#993366;
  52. font-size:8.0pt;
  53. font-weight:700;
  54. font-style:normal;
  55. text-decoration:none;
  56. font-family:"Courier New", monospace;
  57. mso-font-charset:0;}
  58. tr
  59. {mso-height-source:auto;}
  60. col
  61. {mso-width-source:auto;}
  62. br
  63. {mso-data-placement:same-cell;}
  64. .style0
  65. {mso-number-format:General;
  66. text-align:general;
  67. vertical-align:bottom;
  68. white-space:nowrap;
  69. mso-rotate:0;
  70. mso-background-source:auto;
  71. mso-pattern:auto;
  72. color:windowtext;
  73. font-size:10.0pt;
  74. font-weight:400;
  75. font-style:normal;
  76. text-decoration:none;
  77. font-family:Arial;
  78. mso-generic-font-family:auto;
  79. mso-font-charset:0;
  80. border:none;
  81. mso-protection:locked visible;
  82. mso-style-name:Normal;
  83. mso-style-id:0;}
  84. td
  85. {mso-style-parent:style0;
  86. padding-top:1px;
  87. padding-right:1px;
  88. padding-left:1px;
  89. mso-ignore:padding;
  90. color:windowtext;
  91. font-size:10.0pt;
  92. font-weight:400;
  93. font-style:normal;
  94. text-decoration:none;
  95. font-family:Arial;
  96. mso-generic-font-family:auto;
  97. mso-font-charset:0;
  98. mso-number-format:General;
  99. text-align:general;
  100. vertical-align:bottom;
  101. border:none;
  102. mso-background-source:auto;
  103. mso-pattern:auto;
  104. mso-protection:locked visible;
  105. white-space:nowrap;
  106. mso-rotate:0;}
  107. .xl24
  108. {mso-style-parent:style0;
  109. font-size:8.0pt;
  110. font-family:"Courier New", monospace;
  111. mso-font-charset:0;
  112. text-align:center;
  113. border-top:.5pt solid windowtext;
  114. border-right:none;
  115. border-bottom:none;
  116. border-left:.5pt solid windowtext;}
  117. .xl25
  118. {mso-style-parent:style0;
  119. font-size:8.0pt;
  120. font-family:"Courier New", monospace;
  121. mso-font-charset:0;
  122. border-top:.5pt solid windowtext;
  123. border-right:.5pt solid windowtext;
  124. border-bottom:none;
  125. border-left:.5pt solid windowtext;}
  126. .xl26
  127. {mso-style-parent:style0;
  128. font-size:8.0pt;
  129. font-family:"Courier New", monospace;
  130. mso-font-charset:0;
  131. border-top:.5pt solid windowtext;
  132. border-right:none;
  133. border-bottom:none;
  134. border-left:.5pt solid windowtext;}
  135. .xl27
  136. {mso-style-parent:style0;
  137. font-size:8.0pt;
  138. font-family:"Courier New", monospace;
  139. mso-font-charset:0;}
  140. .xl28
  141. {mso-style-parent:style0;
  142. font-size:8.0pt;
  143. font-family:"Courier New", monospace;
  144. mso-font-charset:0;
  145. text-align:center;
  146. border-top:none;
  147. border-right:none;
  148. border-bottom:none;
  149. border-left:.5pt solid windowtext;}
  150. .xl29
  151. {mso-style-parent:style0;
  152. font-size:8.0pt;
  153. font-family:"Courier New", monospace;
  154. mso-font-charset:0;
  155. border-top:none;
  156. border-right:.5pt solid windowtext;
  157. border-bottom:none;
  158. border-left:.5pt solid windowtext;}
  159. .xl30
  160. {mso-style-parent:style0;
  161. font-size:8.0pt;
  162. font-family:"Courier New", monospace;
  163. mso-font-charset:0;
  164. border-top:none;
  165. border-right:none;
  166. border-bottom:none;
  167. border-left:.5pt solid windowtext;}
  168. .xl31
  169. {mso-style-parent:style0;
  170. color:fuchsia;
  171. font-size:8.0pt;
  172. font-family:"Courier New", monospace;
  173. mso-font-charset:0;
  174. border-top:none;
  175. border-right:.5pt solid windowtext;
  176. border-bottom:none;
  177. border-left:none;}
  178. .xl32
  179. {mso-style-parent:style0;
  180. font-size:8.0pt;
  181. font-family:"Courier New", monospace;
  182. mso-font-charset:0;
  183. text-align:center;
  184. border-top:none;
  185. border-right:none;
  186. border-bottom:.5pt solid windowtext;
  187. border-left:.5pt solid windowtext;}
  188. .xl33
  189. {mso-style-parent:style0;
  190. font-size:8.0pt;
  191. font-family:"Courier New", monospace;
  192. mso-font-charset:0;
  193. border-top:none;
  194. border-right:.5pt solid windowtext;
  195. border-bottom:.5pt solid windowtext;
  196. border-left:.5pt solid windowtext;}
  197. .xl34
  198. {mso-style-parent:style0;
  199. font-size:8.0pt;
  200. font-family:"Courier New", monospace;
  201. mso-font-charset:0;
  202. border-top:none;
  203. border-right:none;
  204. border-bottom:.5pt solid windowtext;
  205. border-left:.5pt solid windowtext;}
  206. .xl35
  207. {mso-style-parent:style0;
  208. font-size:8.0pt;
  209. font-family:"Courier New", monospace;
  210. mso-font-charset:0;
  211. border-top:none;
  212. border-right:.5pt solid windowtext;
  213. border-bottom:.5pt solid windowtext;
  214. border-left:none;}
  215. .xl36
  216. {mso-style-parent:style0;
  217. color:fuchsia;
  218. font-size:8.0pt;
  219. font-family:"Courier New", monospace;
  220. mso-font-charset:0;
  221. border-top:none;
  222. border-right:.5pt solid windowtext;
  223. border-bottom:none;
  224. border-left:.5pt solid windowtext;}
  225. .xl37
  226. {mso-style-parent:style0;
  227. color:fuchsia;
  228. font-size:8.0pt;
  229. font-family:"Courier New", monospace;
  230. mso-font-charset:0;
  231. border-top:none;
  232. border-right:none;
  233. border-bottom:none;
  234. border-left:.5pt solid windowtext;}
  235. .xl38
  236. {mso-style-parent:style0;
  237. font-size:8.0pt;
  238. font-family:"Courier New", monospace;
  239. mso-font-charset:0;
  240. border-top:none;
  241. border-right:.5pt solid windowtext;
  242. border-bottom:none;
  243. border-left:none;}
  244. .xl39
  245. {mso-style-parent:style0;
  246. font-size:8.0pt;
  247. font-family:"Courier New", monospace;
  248. mso-font-charset:0;
  249. border-top:.5pt solid windowtext;
  250. border-right:.5pt solid windowtext;
  251. border-bottom:none;
  252. border-left:none;}
  253. .xl40
  254. {mso-style-parent:style0;
  255. color:green;
  256. font-size:8.0pt;
  257. font-family:"Courier New", monospace;
  258. mso-font-charset:0;
  259. border-top:none;
  260. border-right:.5pt solid windowtext;
  261. border-bottom:none;
  262. border-left:.5pt solid windowtext;}
  263. .xl41
  264. {mso-style-parent:style0;
  265. color:green;
  266. font-size:8.0pt;
  267. font-family:"Courier New", monospace;
  268. mso-font-charset:0;
  269. border-top:none;
  270. border-right:none;
  271. border-bottom:none;
  272. border-left:.5pt solid windowtext;}
  273. .xl42
  274. {mso-style-parent:style0;
  275. color:green;
  276. font-size:8.0pt;
  277. font-family:"Courier New", monospace;
  278. mso-font-charset:0;
  279. border-top:none;
  280. border-right:.5pt solid windowtext;
  281. border-bottom:none;
  282. border-left:none;}
  283. .xl43
  284. {mso-style-parent:style0;
  285. color:#993366;
  286. font-size:8.0pt;
  287. font-weight:700;
  288. font-family:"Courier New", monospace;
  289. mso-font-charset:0;
  290. border-top:none;
  291. border-right:.5pt solid windowtext;
  292. border-bottom:none;
  293. border-left:.5pt solid windowtext;}
  294. .xl44
  295. {mso-style-parent:style0;
  296. color:#993366;
  297. font-size:8.0pt;
  298. font-weight:700;
  299. font-family:"Courier New", monospace;
  300. mso-font-charset:0;
  301. border-top:none;
  302. border-right:none;
  303. border-bottom:none;
  304. border-left:.5pt solid windowtext;}
  305. .xl45
  306. {mso-style-parent:style0;
  307. color:#993366;
  308. font-size:8.0pt;
  309. font-weight:700;
  310. font-family:"Courier New", monospace;
  311. mso-font-charset:0;
  312. border-top:none;
  313. border-right:.5pt solid windowtext;
  314. border-bottom:none;
  315. border-left:none;}
  316. .xl46
  317. {mso-style-parent:style0;
  318. font-size:8.0pt;
  319. font-family:"Courier New", monospace;
  320. mso-font-charset:0;
  321. text-align:center;}
  322. .xl47
  323. {mso-style-parent:style0;
  324. color:green;
  325. font-size:8.0pt;
  326. font-family:"Courier New", monospace;
  327. mso-font-charset:0;
  328. border-top:.5pt solid windowtext;
  329. border-right:.5pt solid windowtext;
  330. border-bottom:none;
  331. border-left:.5pt solid windowtext;}
  332. .xl48
  333. {mso-style-parent:style0;
  334. font-size:8.0pt;
  335. font-family:"Courier New", monospace;
  336. mso-font-charset:0;
  337. text-align:center;
  338. border-top:.5pt solid windowtext;
  339. border-right:none;
  340. border-bottom:none;
  341. border-left:.5pt solid windowtext;
  342. background:silver;
  343. mso-pattern:auto none;}
  344. .xl49
  345. {mso-style-parent:style0;
  346. font-size:8.0pt;
  347. font-family:"Courier New", monospace;
  348. mso-font-charset:0;
  349. border-top:.5pt solid windowtext;
  350. border-right:.5pt solid windowtext;
  351. border-bottom:none;
  352. border-left:.5pt solid windowtext;
  353. background:silver;
  354. mso-pattern:auto none;}
  355. .xl50
  356. {mso-style-parent:style0;
  357. font-size:8.0pt;
  358. font-family:"Courier New", monospace;
  359. mso-font-charset:0;
  360. border-top:.5pt solid windowtext;
  361. border-right:none;
  362. border-bottom:none;
  363. border-left:.5pt solid windowtext;
  364. background:silver;
  365. mso-pattern:auto none;}
  366. .xl51
  367. {mso-style-parent:style0;
  368. color:fuchsia;
  369. font-size:8.0pt;
  370. font-family:"Courier New", monospace;
  371. mso-font-charset:0;
  372. border-top:.5pt solid windowtext;
  373. border-right:.5pt solid windowtext;
  374. border-bottom:none;
  375. border-left:none;
  376. background:silver;
  377. mso-pattern:auto none;}
  378. .xl52
  379. {mso-style-parent:style0;
  380. font-size:8.0pt;
  381. font-family:"Courier New", monospace;
  382. mso-font-charset:0;
  383. text-align:center;
  384. border-top:none;
  385. border-right:none;
  386. border-bottom:none;
  387. border-left:.5pt solid windowtext;
  388. background:silver;
  389. mso-pattern:auto none;}
  390. .xl53
  391. {mso-style-parent:style0;
  392. font-size:8.0pt;
  393. font-family:"Courier New", monospace;
  394. mso-font-charset:0;
  395. border-top:none;
  396. border-right:.5pt solid windowtext;
  397. border-bottom:none;
  398. border-left:.5pt solid windowtext;
  399. background:silver;
  400. mso-pattern:auto none;}
  401. .xl54
  402. {mso-style-parent:style0;
  403. font-size:8.0pt;
  404. font-family:"Courier New", monospace;
  405. mso-font-charset:0;
  406. border-top:none;
  407. border-right:none;
  408. border-bottom:none;
  409. border-left:.5pt solid windowtext;
  410. background:silver;
  411. mso-pattern:auto none;}
  412. .xl55
  413. {mso-style-parent:style0;
  414. color:fuchsia;
  415. font-size:8.0pt;
  416. font-family:"Courier New", monospace;
  417. mso-font-charset:0;
  418. border-top:none;
  419. border-right:.5pt solid windowtext;
  420. border-bottom:none;
  421. border-left:none;
  422. background:silver;
  423. mso-pattern:auto none;}
  424. .xl56
  425. {mso-style-parent:style0;
  426. font-size:8.0pt;
  427. font-family:"Courier New", monospace;
  428. mso-font-charset:0;
  429. text-align:center;
  430. border-top:none;
  431. border-right:none;
  432. border-bottom:.5pt solid windowtext;
  433. border-left:.5pt solid windowtext;
  434. background:silver;
  435. mso-pattern:auto none;}
  436. .xl57
  437. {mso-style-parent:style0;
  438. font-size:8.0pt;
  439. font-family:"Courier New", monospace;
  440. mso-font-charset:0;
  441. border-top:none;
  442. border-right:.5pt solid windowtext;
  443. border-bottom:.5pt solid windowtext;
  444. border-left:.5pt solid windowtext;
  445. background:silver;
  446. mso-pattern:auto none;}
  447. .xl58
  448. {mso-style-parent:style0;
  449. font-size:8.0pt;
  450. font-family:"Courier New", monospace;
  451. mso-font-charset:0;
  452. border-top:none;
  453. border-right:none;
  454. border-bottom:.5pt solid windowtext;
  455. border-left:.5pt solid windowtext;
  456. background:silver;
  457. mso-pattern:auto none;}
  458. .xl59
  459. {mso-style-parent:style0;
  460. font-size:8.0pt;
  461. font-family:"Courier New", monospace;
  462. mso-font-charset:0;
  463. border-top:none;
  464. border-right:.5pt solid windowtext;
  465. border-bottom:.5pt solid windowtext;
  466. border-left:none;
  467. background:silver;
  468. mso-pattern:auto none;}
  469. .xl60
  470. {mso-style-parent:style0;
  471. font-size:8.0pt;
  472. font-family:"Courier New", monospace;
  473. mso-font-charset:0;
  474. border-top:.5pt solid windowtext;
  475. border-right:.5pt solid windowtext;
  476. border-bottom:none;
  477. border-left:none;
  478. background:silver;
  479. mso-pattern:auto none;}
  480. .xl61
  481. {mso-style-parent:style0;
  482. font-size:8.0pt;
  483. font-family:"Courier New", monospace;
  484. mso-font-charset:0;
  485. border-top:none;
  486. border-right:.5pt solid windowtext;
  487. border-bottom:none;
  488. border-left:none;
  489. background:silver;
  490. mso-pattern:auto none;}
  491. .xl62
  492. {mso-style-parent:style0;
  493. font-size:8.0pt;
  494. font-family:"Courier New", monospace;
  495. mso-font-charset:0;
  496. text-align:center;
  497. border-top:.5pt solid windowtext;
  498. border-right:none;
  499. border-bottom:.5pt solid windowtext;
  500. border-left:.5pt solid windowtext;
  501. background:silver;
  502. mso-pattern:auto none;}
  503. .xl63
  504. {mso-style-parent:style0;
  505. color:#993366;
  506. font-size:8.0pt;
  507. font-weight:700;
  508. font-family:"Courier New", monospace;
  509. mso-font-charset:0;
  510. border-top:.5pt solid windowtext;
  511. border-right:none;
  512. border-bottom:.5pt solid windowtext;
  513. border-left:.5pt solid windowtext;
  514. background:silver;
  515. mso-pattern:auto none;}
  516. .xl64
  517. {mso-style-parent:style0;
  518. color:#993366;
  519. font-size:8.0pt;
  520. font-weight:700;
  521. font-family:"Courier New", monospace;
  522. mso-font-charset:0;
  523. border-top:.5pt solid windowtext;
  524. border-right:.5pt solid windowtext;
  525. border-bottom:.5pt solid windowtext;
  526. border-left:none;
  527. background:silver;
  528. mso-pattern:auto none;}
  529. .xl65
  530. {mso-style-parent:style0;
  531. color:green;
  532. font-size:8.0pt;
  533. font-family:"Courier New", monospace;
  534. mso-font-charset:0;
  535. border-top:.5pt solid windowtext;
  536. border-right:.5pt solid windowtext;
  537. border-bottom:none;
  538. border-left:.5pt solid windowtext;
  539. background:silver;
  540. mso-pattern:auto none;}
  541. .xl66
  542. {mso-style-parent:style0;
  543. color:green;
  544. font-size:8.0pt;
  545. font-family:"Courier New", monospace;
  546. mso-font-charset:0;
  547. border-top:.5pt solid windowtext;
  548. border-right:none;
  549. border-bottom:none;
  550. border-left:.5pt solid windowtext;
  551. background:silver;
  552. mso-pattern:auto none;}
  553. .xl67
  554. {mso-style-parent:style0;
  555. color:green;
  556. font-size:8.0pt;
  557. font-family:"Courier New", monospace;
  558. mso-font-charset:0;
  559. border-top:.5pt solid windowtext;
  560. border-right:.5pt solid windowtext;
  561. border-bottom:none;
  562. border-left:none;}
  563. .xl68
  564. {mso-style-parent:style0;
  565. color:#993366;
  566. font-size:8.0pt;
  567. font-weight:700;
  568. font-family:"Courier New", monospace;
  569. mso-font-charset:0;
  570. border:.5pt solid windowtext;
  571. background:silver;
  572. mso-pattern:auto none;}
  573. .xl69
  574. {mso-style-parent:style0;
  575. color:#993366;
  576. font-size:8.0pt;
  577. font-weight:700;
  578. font-family:"Courier New", monospace;
  579. mso-font-charset:0;
  580. border-top:.5pt solid windowtext;
  581. border-right:.5pt solid windowtext;
  582. border-bottom:none;
  583. border-left:.5pt solid windowtext;
  584. background:silver;
  585. mso-pattern:auto none;}
  586. .xl70
  587. {mso-style-parent:style0;
  588. color:#993366;
  589. font-size:8.0pt;
  590. font-weight:700;
  591. font-family:"Courier New", monospace;
  592. mso-font-charset:0;
  593. border-top:.5pt solid windowtext;
  594. border-right:.5pt solid windowtext;
  595. border-bottom:none;
  596. border-left:none;
  597. background:silver;
  598. mso-pattern:auto none;}
  599. .xl71
  600. {mso-style-parent:style0;
  601. font-size:8.0pt;
  602. font-family:"Courier New", monospace;
  603. mso-font-charset:0;
  604. text-align:center;
  605. vertical-align:middle;
  606. border-top:.5pt solid windowtext;
  607. border-right:.5pt solid windowtext;
  608. border-bottom:none;
  609. border-left:.5pt solid windowtext;
  610. background:silver;
  611. mso-pattern:auto none;}
  612. .xl72
  613. {mso-style-parent:style0;
  614. font-size:8.0pt;
  615. font-family:"Courier New", monospace;
  616. mso-font-charset:0;
  617. text-align:center;
  618. vertical-align:middle;
  619. border-top:none;
  620. border-right:.5pt solid windowtext;
  621. border-bottom:.5pt solid windowtext;
  622. border-left:.5pt solid windowtext;
  623. background:silver;
  624. mso-pattern:auto none;}
  625. .xl73
  626. {mso-style-parent:style0;
  627. text-align:center;
  628. vertical-align:middle;
  629. border-top:none;
  630. border-right:.5pt solid windowtext;
  631. border-bottom:.5pt solid windowtext;
  632. border-left:.5pt solid windowtext;}
  633. -->
  634. </style>
  635. </head>
  636. <body id="bodyID" class="dtBODY">
  637. <body id="body1" class="dtBODY">
  638. <div id="nsbanner">
  639. <div id="bannerrow1">
  640. <table class="bannerparthead" cellspacing="0" id="Table1">
  641. <tr id="hdr">
  642. <td class="runninghead">Perforce API for the .Net CLR</td>
  643. <td class="product"><img alt="P4.Net" src="p4net.GIF" /></td>
  644. </tr>
  645. </table>
  646. </div>
  647. <div id="TitleRow">
  648. <h1 class="dtH1">Comparisons with other Perforce APIs</h1>
  649. </div>
  650. </div>
  651. <div id="nstext">
  652. <H4 class="dtH4">Other APIs</H4>
  653. <P>
  654. There are a number of Perforce APIs out there...
  655. <a href="http://public.perforce.com/guest/tony_smith/perforce/API/Ruby/index.html">P4Ruby</a>,
  656. <a href="http://public.perforce.com/guest/robert_cowham/perforce/API/python/index.html">P4Python</a>,
  657. <a href="http://public.perforce.com/guest/tony_smith/perforce/API/Perl/index.html">P4Perl</a>, and
  658. <a href="http://public.perforce.com/guest/robert_cowham/perforce/API/p4com/main/index.html">P4COM</a> are some of the most popular.
  659. My goal was to make P4.Net as similar as possible to these. In general, if you're familiar with the
  660. Ruby/Python/Perl APIs, you'll be able to transition to P4.Net fairly quickly. The biggest conceptual difference
  661. is that those APIs are used in dynamic languages, and P4.Net targets static languages. As a result, P4.Net
  662. uses custom types where the other APIs use built-in types, and P4.Net will use separate methods/properties to
  663. distinguish actions that output different types.
  664. </P>
  665. <H4 class="dtH4">Python Example</H4>
  666. <P>
  667. Let's just dive into a sample, and do a side-by-side comparison. In this case, I'll compare P4.Net using IronPython
  668. to P4Python using standard Python. Note, I don't mean to suggest that P4.Net/IronPython is superior to P4Python/Standard Python,
  669. I just want to show apples-to-apples comparisons, without interference from individual language features.
  670. </P>
  671.  
  672. <table x:str border=0 cellpadding=0 cellspacing=0 width=817 style='border-collapse:
  673. collapse;table-layout:fixed;width:613pt'>
  674. <col class=xl46 width=28 style='mso-width-source:userset;mso-width-alt:1024;
  675. width:21pt'>
  676. <col class=xl29 width=385 style='mso-width-source:userset;mso-width-alt:14080;
  677. width:289pt'>
  678. <col class=xl30 width=13 style='mso-width-source:userset;mso-width-alt:475;
  679. width:10pt'>
  680. <col class=xl27 width=391 style='mso-width-source:userset;mso-width-alt:14299;
  681. width:293pt'>
  682. <tr height=15 style='height:11.25pt'>
  683. <td height=15 class=xl24 width=28 style='height:11.25pt;width:21pt'>&nbsp;</td>
  684. <td class=xl47 width=385 style='width:289pt'># Standard Python and P4Python</td>
  685. <td class=xl26 width=13 style='border-left:none;width:10pt'>&nbsp;</td>
  686. <td class=xl67 width=391 style='width:293pt'># IronPython and P4.Net</td>
  687. </tr>
  688. <tr height=15 style='height:11.25pt'>
  689. <td height=15 class=xl32 style='height:11.25pt'>&nbsp;</td>
  690. <td class=xl33>&nbsp;</td>
  691. <td class=xl34 style='border-left:none'>&nbsp;</td>
  692. <td class=xl35>&nbsp;</td>
  693. </tr>
  694. <tr height=15 style='height:11.25pt'>
  695. <td height=15 class=xl48 style='height:11.25pt;border-top:none'>&nbsp;</td>
  696. <td class=xl49 style='border-top:none'>&nbsp;</td>
  697. <td class=xl50 style='border-top:none;border-left:none'>&nbsp;</td>
  698. <td class=xl51 style='border-top:none'>import<font class="font6"> clr</font></td>
  699. </tr>
  700. <tr height=15 style='height:11.25pt'>
  701. <td height=15 class=xl52 style='height:11.25pt' x:num><a href="#Block1">1</a></td>
  702. <td class=xl53>&nbsp;</td>
  703. <td class=xl54 style='border-left:none'>&nbsp;</td>
  704. <td class=xl55>from<font class="font6"> System </font><font class="font7">import</font><font
  705. class="font6"> Array, String</font></td>
  706. </tr>
  707. <tr height=15 style='height:11.25pt'>
  708. <td height=15 class=xl56 style='height:11.25pt'>&nbsp;</td>
  709. <td class=xl57>&nbsp;</td>
  710. <td class=xl58 style='border-left:none'>&nbsp;</td>
  711. <td class=xl59>clr.AddReferenceToFile('<font class="font8">P4API.dll</font><font
  712. class="font6">')</font></td>
  713. </tr>
  714. <tr height=15 style='height:11.25pt'>
  715. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  716. <td class=xl36>&nbsp;</td>
  717. <td class=xl37 style='border-left:none'>&nbsp;</td>
  718. <td class=xl38>&nbsp;</td>
  719. </tr>
  720. <tr height=15 style='height:11.25pt'>
  721. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  722. <td class=xl36>import<font class="font6"> p4 as P4API</font></td>
  723. <td class=xl37 style='border-left:none'>&nbsp;</td>
  724. <td class=xl31>import<font class="font6"> P4API</font></td>
  725. </tr>
  726. <tr height=15 style='height:11.25pt'>
  727. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  728. <td class=xl36>&nbsp;</td>
  729. <td class=xl37 style='border-left:none'>&nbsp;</td>
  730. <td class=xl38>&nbsp;</td>
  731. </tr>
  732. <tr height=15 style='height:11.25pt'>
  733. <td height=15 class=xl48 style='height:11.25pt'>&nbsp;</td>
  734. <td class=xl49>p4 = P4API.P4()</td>
  735. <td class=xl50 style='border-left:none'>&nbsp;</td>
  736. <td class=xl60>p4 = P4API.P4Connection()</td>
  737. </tr>
  738. <tr height=15 style='height:11.25pt'>
  739. <td height=15 class=xl52 style='height:11.25pt' x:num><a href="#Block2">2</a></td>
  740. <td class=xl53>p4.parse_forms()</td>
  741. <td class=xl54 style='border-left:none'>&nbsp;</td>
  742. <td class=xl61>&nbsp;</td>
  743. </tr>
  744. <tr height=15 style='height:11.25pt'>
  745. <td height=15 class=xl56 style='height:11.25pt'>&nbsp;</td>
  746. <td class=xl57>p4.connect()</td>
  747. <td class=xl58 style='border-left:none'>&nbsp;</td>
  748. <td class=xl59>p4.Connect()</td>
  749. </tr>
  750. <tr height=15 style='height:11.25pt'>
  751. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  752. <td class=xl29>&nbsp;</td>
  753. <td class=xl30 style='border-left:none'>&nbsp;</td>
  754. <td class=xl38>&nbsp;</td>
  755. </tr>
  756. <tr height=15 style='height:11.25pt'>
  757. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  758. <td class=xl29>lname = '<font class="font8">P4NetTestingSample</font><font
  759. class="font6">'</font></td>
  760. <td class=xl30 style='border-left:none'>&nbsp;</td>
  761. <td class=xl38>lname = '<font class="font8">P4NetTestingSample</font><font
  762. class="font6">'</font></td>
  763. </tr>
  764. <tr height=15 style='height:11.25pt'>
  765. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  766. <td class=xl29>&nbsp;</td>
  767. <td class=xl30 style='border-left:none'>&nbsp;</td>
  768. <td class=xl38>&nbsp;</td>
  769. </tr>
  770. <tr height=15 style='height:11.25pt'>
  771. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  772. <td class=xl40># build my label</td>
  773. <td class=xl41 style='border-left:none'>&nbsp;</td>
  774. <td class=xl42># build my label</td>
  775. </tr>
  776. <tr height=15 style='height:11.25pt'>
  777. <td height=15 class=xl48 style='height:11.25pt'>&nbsp;</td>
  778. <td class=xl49>labelForm = p4.fetch_label(lname)</td>
  779. <td class=xl50 style='border-left:none'>&nbsp;</td>
  780. <td class=xl60>labelForm = p4.Fetch_Form('<font class="font8">label</font><font
  781. class="font6">', lname)</font></td>
  782. </tr>
  783. <tr height=15 style='height:11.25pt'>
  784. <td height=15 class=xl52 style='height:11.25pt'>&nbsp;</td>
  785. <td class=xl53>labelForm['<font class="font8">Description</font><font
  786. class="font6">'] = '</font><font class="font8">Created for P4.Net sample</font><font
  787. class="font6">'</font></td>
  788. <td class=xl54 style='border-left:none'>&nbsp;</td>
  789. <td class=xl61>labelForm['<font class="font8">Description</font><font
  790. class="font6">'] = '</font><font class="font8">Created for P4.Net sample</font><font
  791. class="font6">'</font></td>
  792. </tr>
  793. <tr height=15 style='height:11.25pt'>
  794. <td height=15 class=xl52 style='height:11.25pt' x:num><a href="#Block3">3</a></td>
  795. <td class=xl53>view = ['<font class="font8">//guest/shawn_hladky/...</font><font
  796. class="font6">']</font></td>
  797. <td class=xl54 style='border-left:none'>&nbsp;</td>
  798. <td class=xl61>view = Array[String](['<font class="font8">//guest/shawn_hladky/...</font><font
  799. class="font6">'])</font></td>
  800. </tr>
  801. <tr height=15 style='height:11.25pt'>
  802. <td height=15 class=xl52 style='height:11.25pt'>&nbsp;</td>
  803. <td class=xl53>labelForm['<font class="font8">View</font><font class="font6">']
  804. = view</font></td>
  805. <td class=xl54 style='border-left:none'>&nbsp;</td>
  806. <td class=xl61>labelForm.ArrayFields['<font class="font8">View</font><font
  807. class="font6">'] = view</font></td>
  808. </tr>
  809. <tr height=15 style='height:11.25pt'>
  810. <td height=15 class=xl56 style='height:11.25pt'>&nbsp;</td>
  811. <td class=xl57>res = p4.save_label(labelForm)</td>
  812. <td class=xl58 style='border-left:none'>&nbsp;</td>
  813. <td class=xl59>res = p4.Save_Form(labelForm)</td>
  814. </tr>
  815. <tr height=15 style='height:11.25pt'>
  816. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  817. <td class=xl29>&nbsp;</td>
  818. <td class=xl30 style='border-left:none'>&nbsp;</td>
  819. <td class=xl38>&nbsp;</td>
  820. </tr>
  821. <tr height=15 style='height:11.25pt'>
  822. <td rowspan=2 height=30 class=xl71 style='border-bottom:.5pt solid black;
  823. height:22.5pt' x:num><a href="#Block4" >4</a></td>
  824. <td class=xl69 style='border-left:none'>if<font class="font6"> len(p4.errors)
  825. &gt; 0:</font></td>
  826. <td class=xl50 style='border-left:none'>&nbsp;</td>
  827. <td class=xl70>if<font class="font6"> res.HasErrors():</font></td>
  828. </tr>
  829. <tr height=15 style='height:11.25pt'>
  830. <td height=15 class=xl57 style='height:11.25pt;border-left:none'><span
  831. style='mso-spacerun:yes'> </span><font class="font11">for</font><font
  832. class="font6"> e </font><font class="font11">in</font><font class="font6">
  833. p4.errors: print e</font></td>
  834. <td class=xl58 style='border-left:none'>&nbsp;</td>
  835. <td class=xl59><span style='mso-spacerun:yes'> </span><font class="font11">for</font><font
  836. class="font6"> e </font><font class="font11">in</font><font class="font6">
  837. res.Errors: print e</font></td>
  838. </tr>
  839. <tr height=15 style='height:11.25pt'>
  840. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  841. <td class=xl29>&nbsp;</td>
  842. <td class=xl30 style='border-left:none'>&nbsp;</td>
  843. <td class=xl38>&nbsp;</td>
  844. </tr>
  845. <tr height=15 style='height:11.25pt'>
  846. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  847. <td class=xl40># My list of changes.<span style='mso-spacerun:yes'>
  848. </span>This is totally arbitrary</td>
  849. <td class=xl41 style='border-left:none'>&nbsp;</td>
  850. <td class=xl42># My list of changes.<span style='mso-spacerun:yes'>
  851. </span>This is totally arbitrary</td>
  852. </tr>
  853. <tr height=15 style='height:11.25pt'>
  854. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  855. <td class=xl29>changes=['<font class="font8">5774</font><font class="font6">',
  856. '</font><font class="font8">5680</font><font class="font6">', '</font><font
  857. class="font8">5636</font><font class="font6">', '</font><font class="font8">5444</font><font
  858. class="font6">']</font></td>
  859. <td class=xl30 style='border-left:none'>&nbsp;</td>
  860. <td class=xl38>changes=['<font class="font8">5774</font><font class="font6">',
  861. '</font><font class="font8">5680</font><font class="font6">', '</font><font
  862. class="font8">5636</font><font class="font6">', '</font><font class="font8">5444</font><font
  863. class="font6">']</font></td>
  864. </tr>
  865. <tr height=15 style='height:11.25pt'>
  866. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  867. <td class=xl29>&nbsp;</td>
  868. <td class=xl30 style='border-left:none'>&nbsp;</td>
  869. <td class=xl38>&nbsp;</td>
  870. </tr>
  871. <tr height=15 style='height:11.25pt'>
  872. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  873. <td class=xl29>sorted_changes = changes.sort()</td>
  874. <td class=xl30 style='border-left:none'>&nbsp;</td>
  875. <td class=xl38>sorted_changes = changes.sort()</td>
  876. </tr>
  877. <tr height=15 style='height:11.25pt'>
  878. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  879. <td class=xl29>&nbsp;</td>
  880. <td class=xl30 style='border-left:none'>&nbsp;</td>
  881. <td class=xl38>&nbsp;</td>
  882. </tr>
  883. <tr height=15 style='height:11.25pt'>
  884. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  885. <td class=xl40># dictionary: keyed by file, value = revision</td>
  886. <td class=xl41 style='border-left:none'>&nbsp;</td>
  887. <td class=xl42># dictionary: keyed by file, value = revision</td>
  888. </tr>
  889. <tr height=15 style='height:11.25pt'>
  890. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  891. <td class=xl29>filerevs = {}</td>
  892. <td class=xl30 style='border-left:none'>&nbsp;</td>
  893. <td class=xl38>filerevs = {}</td>
  894. </tr>
  895. <tr height=15 style='height:11.25pt'>
  896. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  897. <td class=xl29>&nbsp;</td>
  898. <td class=xl30 style='border-left:none'>&nbsp;</td>
  899. <td class=xl38>&nbsp;</td>
  900. </tr>
  901. <tr height=15 style='height:11.25pt'>
  902. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  903. <td class=xl40># spin the description on each file</td>
  904. <td class=xl41 style='border-left:none'>&nbsp;</td>
  905. <td class=xl42># spin the description on each file</td>
  906. </tr>
  907. <tr height=15 style='height:11.25pt'>
  908. <td height=15 class=xl62 style='height:11.25pt' x:num><a href="#Block5">5</a></td>
  909. <td class=xl68>for<font class="font6"> chg </font><font class="font10">in</font><font
  910. class="font6"> p4.run_describe('</font><font class="font8">-s</font><font
  911. class="font6">', *changes):</font></td>
  912. <td class=xl63 style='border-left:none'>&nbsp;</td>
  913. <td class=xl64>for<font class="font6"> chg </font><font class="font10">in</font><font
  914. class="font6"> p4.Run('</font><font class="font8">describe</font><font
  915. class="font6">', '</font><font class="font8">-s</font><font class="font6">',
  916. *changes):</font></td>
  917. </tr>
  918. <tr height=15 style='height:11.25pt'>
  919. <td rowspan=2 height=30 class=xl71 style='border-bottom:.5pt solid black;
  920. height:22.5pt;border-top:none' x:num><a href="#Block5">6</a></td>
  921. <td class=xl49 style='border-top:none;border-left:none'><span
  922. style='mso-spacerun:yes'> </span>depotFiles = chg['<font class="font8">depotFile</font><font
  923. class="font6">']</font></td>
  924. <td class=xl50 style='border-top:none;border-left:none'>&nbsp;</td>
  925. <td class=xl60 style='border-top:none'>
  926. <span style='mso-spacerun:yes'> </span>depotFiles = chg.ArrayFields['<font class="font8">depotFile</font><font
  927. class="font6">']</font></td>
  928. </tr>
  929. <tr height=15 style='height:11.25pt'>
  930. <td height=15 class=xl57 style='height:11.25pt;border-left:none'><span
  931. style='mso-spacerun:yes'> </span>revisions<span style='mso-spacerun:yes'>
  932. </span>= chg['<font class="font8">rev</font><font class="font6">']</font></td>
  933. <td class=xl58 style='border-left:none'>&nbsp;</td>
  934. <td class=xl59><span style='mso-spacerun:yes'> </span>revisions<span
  935. style='mso-spacerun:yes'></span>= chg.ArrayFields['<font class="font8">rev</font><font
  936. class="font6">']</font></td>
  937. </tr>
  938. <tr height=15 style='height:11.25pt'>
  939. <td height=15 class=xl24 style='height:11.25pt;border-top:none'>&nbsp;</td>
  940. <td class=xl25 style='border-top:none'><span style='mso-spacerun:yes'>
  941. </span><font class="font10">for</font><font class="font6"> i </font><font
  942. class="font10">in</font><font class="font6"> range(0, len(depotFiles)):</font></td>
  943. <td class=xl26 style='border-top:none;border-left:none'>&nbsp;</td>
  944. <td class=xl39 style='border-top:none'><span style='mso-spacerun:yes'>
  945. </span><font class="font10">for</font><font class="font6"> i </font><font
  946. class="font10">in</font><font class="font6"> range(0, len(depotFiles)):</font></td>
  947. </tr>
  948. <tr height=15 style='height:11.25pt'>
  949. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  950. <td class=xl29>
  951. &nbsp;&nbsp;&nbsp;&nbsp;key,value = depotFiles[i], revisions[i]</td>
  952. <td class=xl30 style='border-left:none'>&nbsp;</td>
  953. <td class=xl38>
  954. &nbsp;&nbsp;&nbsp;&nbsp;key,value = depotFiles[i], revisions[i]</td>
  955. </tr>
  956. <tr height=15 style='height:11.25pt'>
  957. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  958. <td class=xl29>&nbsp;&nbsp;&nbsp;&nbsp;filerevs[key]=value</td>
  959. <td class=xl30 style='border-left:none'>&nbsp;</td>
  960. <td class=xl38>&nbsp;&nbsp;&nbsp;&nbsp;filerevs[key]=value</td>
  961. </tr>
  962. <tr height=15 style='height:11.25pt'>
  963. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  964. <td class=xl29>&nbsp;</td>
  965. <td class=xl30 style='border-left:none'>&nbsp;</td>
  966. <td class=xl38>&nbsp;</td>
  967. </tr>
  968. <tr height=15 style='height:11.25pt'>
  969. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  970. <td class=xl40># convert the dictionary to a list</td>
  971. <td class=xl41 style='border-left:none'>&nbsp;</td>
  972. <td class=xl42># convert the dictionary to a list</td>
  973. </tr>
  974. <tr height=15 style='height:11.25pt'>
  975. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  976. <td class=xl29>flist = []</td>
  977. <td class=xl41 style='border-left:none'>&nbsp;</td>
  978. <td class=xl38>flist = []</td>
  979. </tr>
  980. <tr height=15 style='height:11.25pt'>
  981. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  982. <td class=xl43>for<font class="font6"> k,v </font><font class="font10">in</font><font
  983. class="font6"> filerevs.items():</font></td>
  984. <td class=xl30 style='border-left:none'>&nbsp;</td>
  985. <td class=xl45>for<font class="font6"> k,v </font><font class="font10">in</font><font
  986. class="font6"> filerevs.items():</font></td>
  987. </tr>
  988. <tr height=15 style='height:11.25pt'>
  989. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  990. <td class=xl29>&nbsp;&nbsp;&nbsp;&nbsp;flist.append(&quot;%s#%s&quot; % (k,v))</td>
  991. <td class=xl30 style='border-left:none'>&nbsp;</td>
  992. <td class=xl38>&nbsp;&nbsp;&nbsp;&nbsp;flist.append(&quot;%s#%s&quot; % (k,v))</td>
  993. </tr>
  994. <tr height=15 style='height:11.25pt'>
  995. <td height=15 class=xl32 style='height:11.25pt'>&nbsp;</td>
  996. <td class=xl33>&nbsp;</td>
  997. <td class=xl34 style='border-left:none'>&nbsp;</td>
  998. <td class=xl35>&nbsp;</td>
  999. </tr>
  1000. <tr height=15 style='height:11.25pt'>
  1001. <td height=15 class=xl48 style='height:11.25pt;border-top:none'>&nbsp;</td>
  1002. <td class=xl65 style='border-top:none'># now I want to run in non-parsed mode</td>
  1003. <td class=xl66 style='border-top:none;border-left:none'>&nbsp;</td>
  1004. <td class=xl60 style='border-top:none'>&nbsp;</td>
  1005. </tr>
  1006. <tr height=15 style='height:11.25pt'>
  1007. <td height=15 class=xl52 style='height:11.25pt'>&nbsp;</td>
  1008. <td class=xl53>p4.disconnect()</td>
  1009. <td class=xl54 style='border-left:none'>&nbsp;</td>
  1010. <td class=xl61>&nbsp;</td>
  1011. </tr>
  1012. <tr height=15 style='height:11.25pt'>
  1013. <td height=15 class=xl52 style='height:11.25pt'>&nbsp;</td>
  1014. <td class=xl53>p4 = P4API.P4()</td>
  1015. <td class=xl54 style='border-left:none'>&nbsp;</td>
  1016. <td class=xl61>&nbsp;</td>
  1017. </tr>
  1018. <tr height=15 style='height:11.25pt'>
  1019. <td height=15 class=xl52 style='height:11.25pt' x:num><a href="#Block7">7</a></td>
  1020. <td class=xl53>p4.connect()</td>
  1021. <td class=xl54 style='border-left:none'>&nbsp;</td>
  1022. <td class=xl61>&nbsp;</td>
  1023. </tr>
  1024. <tr height=15 style='height:11.25pt'>
  1025. <td height=15 class=xl52 style='height:11.25pt'>&nbsp;</td>
  1026. <td class=xl53>&nbsp;</td>
  1027. <td class=xl54 style='border-left:none'>&nbsp;</td>
  1028. <td class=xl61>&nbsp;</td>
  1029. </tr>
  1030. <tr height=15 style='height:11.25pt'>
  1031. <td height=15 class=xl56 style='height:11.25pt'>&nbsp;</td>
  1032. <td class=xl57>out = p4.run('<font class="font8">labelsync</font><font
  1033. class="font6">', '</font><font class="font8">-l</font><font class="font6">',
  1034. lname, *flist)</font></td>
  1035. <td class=xl58 style='border-left:none'>&nbsp;</td>
  1036. <td class=xl59>out = p4.RunUnParsed('<font class="font8">labelsync</font><font
  1037. class="font6">', '</font><font class="font8">-l</font><font class="font6">',
  1038. lname, *flist)</font></td>
  1039. </tr>
  1040. <tr height=15 style='height:11.25pt'>
  1041. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  1042. <td class=xl29>&nbsp;</td>
  1043. <td class=xl30 style='border-left:none'>&nbsp;</td>
  1044. <td class=xl38>&nbsp;</td>
  1045. </tr>
  1046. <tr height=15 style='height:11.25pt'>
  1047. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  1048. <td class=xl43>for<font class="font6"> s </font><font class="font10">in</font><font
  1049. class="font6"> out: </font><font class="font10">print</font><font
  1050. class="font6"> s</font></td>
  1051. <td class=xl44 style='border-left:none'>&nbsp;</td>
  1052. <td class=xl45>for<font class="font6"> s </font><font class="font10">in</font><font
  1053. class="font6"> out: </font><font class="font10">print</font><font
  1054. class="font6"> s</font></td>
  1055. </tr>
  1056. <tr height=15 style='height:11.25pt'>
  1057. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  1058. <td class=xl29>&nbsp;</td>
  1059. <td class=xl30 style='border-left:none'>&nbsp;</td>
  1060. <td class=xl38>&nbsp;</td>
  1061. </tr>
  1062. <tr height=15 style='height:11.25pt'>
  1063. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  1064. <td class=xl40># delete the label to keep the public depot clean :-)</td>
  1065. <td class=xl41 style='border-left:none'>&nbsp;</td>
  1066. <td class=xl42># delete the label to keep the public depot clean :-)</td>
  1067. </tr>
  1068. <tr height=15 style='height:11.25pt'>
  1069. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  1070. <td class=xl29>p4.run('<font class="font8">label</font><font class="font6">',
  1071. '</font><font class="font8">-d</font><font class="font6">', lname)</font></td>
  1072. <td class=xl30 style='border-left:none'>&nbsp;</td>
  1073. <td class=xl38>p4.RunUnParsed('<font class="font8">label</font><font
  1074. class="font6">', '</font><font class="font8">-d</font><font class="font6">',
  1075. lname)</font></td>
  1076. </tr>
  1077. <tr height=15 style='height:11.25pt'>
  1078. <td height=15 class=xl28 style='height:11.25pt'>&nbsp;</td>
  1079. <td class=xl29>&nbsp;</td>
  1080. <td class=xl30 style='border-left:none'>&nbsp;</td>
  1081. <td class=xl38>&nbsp;</td>
  1082. </tr>
  1083. <tr height=15 style='height:11.25pt'>
  1084. <td height=15 class=xl32 style='height:11.25pt'>&nbsp;</td>
  1085. <td class=xl33>p4.disconnect()</td>
  1086. <td class=xl34 style='border-left:none'>&nbsp;</td>
  1087. <td class=xl35>p4.Disconnect()</td>
  1088. </tr>
  1089. <![if supportMisalignedColumns]>
  1090. <tr height=0 style='display:none'>
  1091. <td width=28 style='width:21pt'></td>
  1092. <td width=385 style='width:289pt'></td>
  1093. <td width=13 style='width:10pt'></td>
  1094. <td width=391 style='width:293pt'></td>
  1095. </tr>
  1096. <![endif]>
  1097. </table>
  1098.  
  1099.  
  1100. <H4 class="dtH4"><a name="Block1">Block 1</a></H4>
  1101. <p>
  1102. This is some overhead required for IronPython. It will load the CLR, and P4.Net.
  1103. </p>
  1104. <H4 class="dtH4"><a name="Block2">Block 2</a></H4>
  1105. <p>
  1106. This chunk of code is establishing a connection to the Perforce server. There are a couple things
  1107. unique to P4.Net worth noting here. Classes in P4.Net are more explicitly named. Here the connection
  1108. class is named P4Connection. While we're talking about naming, P4.Net uses traditional .Net conventions,
  1109. and all method names use camel case.
  1110. </p>
  1111. <p>
  1112. Also, note that P4.Net does not need the parse_forms() method. P4.Net is designed to be more statically
  1113. typed than P4Python/P4Ruby/P4Perl. You use different methods to retrieve tagged vs. untagged output. Therefore,
  1114. P4.Net auto-manages the connection, and will dynamically switch modes in the native C++ API when needed.
  1115. </p>
  1116.  
  1117. <H4 class="dtH4"><a name="Block3">Block 3</a></H4>
  1118. <p>
  1119. There's several things going on in this chunk, so let's break it down line-by-line:
  1120. </p>
  1121. <pre class="code" language="C#" escaped="true">
  1122. P4Python: labelForm = p4.fetch_label(lname)
  1123. P4.Net : labelForm = p4.Fetch_Form('label', lname)</pre>
  1124. <p>Since P4.Net isn't meant for dynamic languages, there are no shortcut methods available.</p><p/>
  1125. <pre class="code" language="C#" escaped="true">
  1126. P4Python: labelForm['Description'] = 'Created for P4.Net sample'
  1127. P4.Net : labelForm['Description'] = 'Created for P4.Net sample'</pre>
  1128. <p>Identical syntax!</p><p/>
  1129. <pre class="code" language="C#" escaped="true">
  1130. P4Python: view = ['//guest/shawn_hladky/...']
  1131. P4.Net : view = Array[String](['//guest/shawn_hladky/...'])</pre>
  1132. <p>IronPython doesn't explicitly convert Python lists to .Net Arrays.</p><p/>
  1133.  
  1134. <pre class="code" language="C#" escaped="true">
  1135. P4Python: labelForm['View'] = view
  1136. P4.Net : labelForm.ArrayFields['View'] = view</pre>
  1137. <p>In P4.Net, you use the ArrayFields property when getting/setting fields with array values.</p><p/>
  1138. <pre class="code" language="C#" escaped="true">
  1139. P4Python: res = p4.save_label(labelForm)
  1140. P4.Net : res = p4.Save_Form(labelForm)</pre>
  1141. <p>There's no shortcut methode available in P4.Net; however, sine the form is a rich object,
  1142. it already knows the command, and doesn't need to be supplied with the Save_Form method.</p><p />
  1143. <H4 class="dtH4"><a name="Block4">Block 4</a></H4>
  1144. <p>
  1145. This is a subtle, but significant departure from the other APIs.
  1146. In P4.Net, results are rich objects, not just simple lists. All
  1147. warnings, errors, and messages are associated with the results object.
  1148. In other APIs, these are part of the connection object, and are reset with
  1149. each run.
  1150. </p>
  1151. <H4 class="dtH4"><a name="Block5">Block 5 & 6</a></H4>
  1152. <p>
  1153. More of the same... no short-cut methods, and use the ArrayFields property. Only in this instance
  1154. we're dealing with a P4Recordset instead of a form.
  1155. </p>
  1156. <H4 class="dtH4"><a name="Block7">Block 7</a></H4>
  1157. <p>
  1158. In P4.Net, you use different methods to return tagged and untagged output. This means P4.Net
  1159. auto-manages the connection for you, so no need to explicitly reset as other APIs require.
  1160. </p>
  1161. <hr />
  1162. <div id="footer">
  1163. <p>
  1164. <a href="Copyright.html">Copyright 2006 Shawn Hladky</a>
  1165. </p>
  1166. <p>
  1167. </p>
  1168. </div>
  1169. </div>
  1170. </body>
  1171. </html>
# Change User Description Committed
#1 7341 Erik Purins p4.net
---
pull p4.net#head
16 years ago
//guest/shawn_hladky/P4.Net/release/0.9/doc/html/APIComparisons.html
#1 5831 Shawn Hladky P4.Net: Branch release 0.9 and delete a few files missed last time 19 years ago
//guest/shawn_hladky/P4.Net/main/doc/html/APIComparisons.html
#1 5830 Shawn Hladky P4.Net: reorg to support release branches 19 years ago
//guest/shawn_hladky/P4.Net/doc/html/APIComparisons.html
#2 5825 Shawn Hladky P4.Net: Binaries and compiled docs for 0.9 19 years ago
#1 5812 Shawn Hladky P4.Net: More documentation. 19 years ago